mirror of https://github.com/elunez/eladmin
委外公司
parent
35a359dcc7
commit
9061be818b
|
@ -10,4 +10,7 @@ import me.zhengjie.annotation.Query;
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class CustomerInfoQueryCriteria {
|
public class CustomerInfoQueryCriteria {
|
||||||
|
|
||||||
|
private String customerName;
|
||||||
|
|
||||||
}
|
}
|
|
@ -23,6 +23,7 @@ import org.springframework.data.domain.Pageable;
|
||||||
import me.zhengjie.utils.PageUtil;
|
import me.zhengjie.utils.PageUtil;
|
||||||
import me.zhengjie.utils.QueryHelp;
|
import me.zhengjie.utils.QueryHelp;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import javax.persistence.criteria.CriteriaBuilder;
|
import javax.persistence.criteria.CriteriaBuilder;
|
||||||
import javax.persistence.criteria.CriteriaQuery;
|
import javax.persistence.criteria.CriteriaQuery;
|
||||||
|
@ -52,6 +53,14 @@ public class CustomerInfoServiceImpl implements CustomerInfoService {
|
||||||
|
|
||||||
List<Predicate> targetPredicateList = new ArrayList<>();
|
List<Predicate> targetPredicateList = new ArrayList<>();
|
||||||
|
|
||||||
|
//客户名称
|
||||||
|
String customerName = criteria.getCustomerName();
|
||||||
|
if (!StringUtils.isEmpty(customerName)) {
|
||||||
|
Predicate namePredicate = criteriaBuilder.like(root.get("name"), "%" + customerName + "%");
|
||||||
|
targetPredicateList.add(namePredicate);
|
||||||
|
}
|
||||||
|
|
||||||
|
//状态
|
||||||
Predicate statusPredicate = criteriaBuilder.equal(root.get("status"), 1);
|
Predicate statusPredicate = criteriaBuilder.equal(root.get("status"), 1);
|
||||||
targetPredicateList.add(statusPredicate);
|
targetPredicateList.add(statusPredicate);
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@ public class MeasureUnitServiceImpl implements MeasureUnitService {
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public MeasureUnitDTO create(MeasureUnit resources) {
|
public MeasureUnitDTO create(MeasureUnit resources) {
|
||||||
|
resources.setStatus(true);
|
||||||
return measureUnitMapper.toDto(measureUnitRepository.save(resources));
|
return measureUnitMapper.toDto(measureUnitRepository.save(resources));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
package me.zhengjie.modules.wms.bd.service.request;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 黄星星
|
||||||
|
* @date 2019-08-03
|
||||||
|
*/
|
||||||
|
public class CreateCustomerOrderRequest {
|
||||||
|
}
|
|
@ -0,0 +1,103 @@
|
||||||
|
package me.zhengjie.modules.wms.order.domain;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.bean.copier.CopyOptions;
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jie
|
||||||
|
* @date 2019-08-03
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@Data
|
||||||
|
@Table(name="s_customer_order")
|
||||||
|
public class CustomerOrder implements Serializable {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
// 所属客户主键
|
||||||
|
@Column(name = "customer_id")
|
||||||
|
private Long customerId;
|
||||||
|
|
||||||
|
// 客户名称
|
||||||
|
@Column(name = "customer_name")
|
||||||
|
private String customerName;
|
||||||
|
|
||||||
|
// 订单日期
|
||||||
|
@Column(name = "order_date")
|
||||||
|
private Timestamp orderDate;
|
||||||
|
|
||||||
|
// 交货日期
|
||||||
|
@Column(name = "delivery_date")
|
||||||
|
private Timestamp deliveryDate;
|
||||||
|
|
||||||
|
// 客户订单编号
|
||||||
|
@Column(name = "customer_order_code")
|
||||||
|
private String customerOrderCode;
|
||||||
|
|
||||||
|
// 制单人主键
|
||||||
|
@Column(name = "customer_order_maker_id")
|
||||||
|
private Long customerOrderMakerId;
|
||||||
|
|
||||||
|
// 制单人姓名
|
||||||
|
@Column(name = "customer_order_maker_name")
|
||||||
|
private String customerOrderMakerName;
|
||||||
|
|
||||||
|
// 交货方式code
|
||||||
|
@Column(name = "delivery_way_code")
|
||||||
|
private String deliveryWayCode;
|
||||||
|
|
||||||
|
// 交货方式名称
|
||||||
|
@Column(name = "delivery_way_name")
|
||||||
|
private String deliveryWayName;
|
||||||
|
|
||||||
|
// 付款方式
|
||||||
|
@Column(name = "pay_way_code")
|
||||||
|
private String payWayCode;
|
||||||
|
|
||||||
|
// 付款方式名称
|
||||||
|
@Column(name = "pay_way_name")
|
||||||
|
private String payWayName;
|
||||||
|
|
||||||
|
// 收货地址
|
||||||
|
@Column(name = "delivery_address")
|
||||||
|
private String deliveryAddress;
|
||||||
|
|
||||||
|
// 收货人
|
||||||
|
@Column(name = "delivery_user")
|
||||||
|
private String deliveryUser;
|
||||||
|
|
||||||
|
// 收货人联系方式
|
||||||
|
@Column(name = "delivery_user_contact")
|
||||||
|
private String deliveryUserContact;
|
||||||
|
|
||||||
|
// 备注
|
||||||
|
@Column(name = "remark")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
// 创建时间
|
||||||
|
@Column(name = "create_time")
|
||||||
|
private Timestamp createTime;
|
||||||
|
|
||||||
|
// 更新时间
|
||||||
|
@Column(name = "update_time")
|
||||||
|
private Timestamp updateTime;
|
||||||
|
|
||||||
|
// 总额
|
||||||
|
@Column(name = "total_money")
|
||||||
|
private Long totalMoney;
|
||||||
|
|
||||||
|
// 总数量
|
||||||
|
@Column(name = "total_number")
|
||||||
|
private Long totalNumber;
|
||||||
|
|
||||||
|
public void copy(CustomerOrder source){
|
||||||
|
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,66 @@
|
||||||
|
package me.zhengjie.modules.wms.order.domain;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.bean.copier.CopyOptions;
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jie
|
||||||
|
* @date 2019-08-03
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@Data
|
||||||
|
@Table(name="s_customer_order_product")
|
||||||
|
public class CustomerOrderProduct implements Serializable {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@Column(name = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
// 所属客户订单
|
||||||
|
@Column(name = "customer_order_id")
|
||||||
|
private Long customerOrderId;
|
||||||
|
|
||||||
|
// 产品主键
|
||||||
|
@Column(name = "product_id")
|
||||||
|
private Long productId;
|
||||||
|
|
||||||
|
// 产品名称
|
||||||
|
@Column(name = "product_name")
|
||||||
|
private Long productName;
|
||||||
|
|
||||||
|
// 规格
|
||||||
|
@Column(name = "specifications")
|
||||||
|
private String specifications;
|
||||||
|
|
||||||
|
// 产品单价
|
||||||
|
@Column(name = "unit_price")
|
||||||
|
private Long unitPrice;
|
||||||
|
|
||||||
|
// 产品总价
|
||||||
|
@Column(name = "total_price")
|
||||||
|
private Long totalPrice;
|
||||||
|
|
||||||
|
// 产品数量
|
||||||
|
@Column(name = "product_number")
|
||||||
|
private Long productNumber;
|
||||||
|
|
||||||
|
// 备注
|
||||||
|
@Column(name = "remark")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
// 创建时间
|
||||||
|
@Column(name = "create_time")
|
||||||
|
private Timestamp createTime;
|
||||||
|
|
||||||
|
// 更新时间
|
||||||
|
@Column(name = "update_time")
|
||||||
|
private Timestamp updateTime;
|
||||||
|
|
||||||
|
public void copy(CustomerOrderProduct source){
|
||||||
|
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package me.zhengjie.modules.wms.order.repository;
|
||||||
|
|
||||||
|
import me.zhengjie.modules.wms.order.domain.CustomerOrderProduct;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jie
|
||||||
|
* @date 2019-08-03
|
||||||
|
*/
|
||||||
|
public interface CustomerOrderProductRepository extends JpaRepository<CustomerOrderProduct, Long>, JpaSpecificationExecutor {
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package me.zhengjie.modules.wms.order.repository;
|
||||||
|
|
||||||
|
import me.zhengjie.modules.wms.order.domain.CustomerOrder;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jie
|
||||||
|
* @date 2019-08-03
|
||||||
|
*/
|
||||||
|
public interface CustomerOrderRepository extends JpaRepository<CustomerOrder, Long>, JpaSpecificationExecutor {
|
||||||
|
}
|
|
@ -0,0 +1,61 @@
|
||||||
|
package me.zhengjie.modules.wms.order.rest;
|
||||||
|
|
||||||
|
import me.zhengjie.aop.log.Log;
|
||||||
|
import me.zhengjie.modules.wms.order.domain.CustomerOrder;
|
||||||
|
import me.zhengjie.modules.wms.order.service.CustomerOrderService;
|
||||||
|
import me.zhengjie.modules.wms.order.service.dto.CustomerOrderQueryCriteria;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jie
|
||||||
|
* @date 2019-08-03
|
||||||
|
*/
|
||||||
|
@Api(tags = "SCustomerOrder管理")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("api")
|
||||||
|
public class CustomerOrderController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CustomerOrderService customerOrderService;
|
||||||
|
|
||||||
|
@Log("分页查询客户订单列表")
|
||||||
|
@ApiOperation(value = "分页查询客户订单列表")
|
||||||
|
@GetMapping(value = "/customerOrders")
|
||||||
|
@PreAuthorize("hasAnyRole('ADMIN','SCUSTOMERORDER_ALL','SCUSTOMERORDER_SELECT')")
|
||||||
|
public ResponseEntity getCustomerOrders(CustomerOrderQueryCriteria criteria, Pageable pageable){
|
||||||
|
return new ResponseEntity(customerOrderService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log("新增客户订单")
|
||||||
|
@ApiOperation(value = "新增客户订单")
|
||||||
|
@PostMapping(value = "/customerOrder")
|
||||||
|
@PreAuthorize("hasAnyRole('ADMIN','SCUSTOMERORDER_ALL','SCUSTOMERORDER_CREATE')")
|
||||||
|
public ResponseEntity create(@Validated @RequestBody CustomerOrder resources){
|
||||||
|
return new ResponseEntity(customerOrderService.create(resources),HttpStatus.CREATED);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log("修改SCustomerOrder")
|
||||||
|
@ApiOperation(value = "修改SCustomerOrder")
|
||||||
|
@PutMapping(value = "/customerOrder")
|
||||||
|
@PreAuthorize("hasAnyRole('ADMIN','SCUSTOMERORDER_ALL','SCUSTOMERORDER_EDIT')")
|
||||||
|
public ResponseEntity update(@Validated @RequestBody CustomerOrder resources){
|
||||||
|
customerOrderService.update(resources);
|
||||||
|
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log("删除SCustomerOrder")
|
||||||
|
@ApiOperation(value = "删除SCustomerOrder")
|
||||||
|
@DeleteMapping(value = "/customerOrder/{id}")
|
||||||
|
@PreAuthorize("hasAnyRole('ADMIN','SCUSTOMERORDER_ALL','SCUSTOMERORDER_DELETE')")
|
||||||
|
public ResponseEntity delete(@PathVariable Long id){
|
||||||
|
customerOrderService.delete(id);
|
||||||
|
return new ResponseEntity(HttpStatus.OK);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,61 @@
|
||||||
|
package me.zhengjie.modules.wms.order.rest;
|
||||||
|
|
||||||
|
import me.zhengjie.aop.log.Log;
|
||||||
|
import me.zhengjie.modules.wms.order.domain.CustomerOrderProduct;
|
||||||
|
import me.zhengjie.modules.wms.order.service.CustomerOrderProductService;
|
||||||
|
import me.zhengjie.modules.wms.order.service.dto.CustomerOrderProductQueryCriteria;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jie
|
||||||
|
* @date 2019-08-03
|
||||||
|
*/
|
||||||
|
@Api(tags = "SCustomerOrderProduct管理")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("api")
|
||||||
|
public class CustomerOrderProductController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CustomerOrderProductService customerOrderProductService;
|
||||||
|
|
||||||
|
@Log("查询SCustomerOrderProduct")
|
||||||
|
@ApiOperation(value = "查询SCustomerOrderProduct")
|
||||||
|
@GetMapping(value = "/sCustomerOrderProduct")
|
||||||
|
@PreAuthorize("hasAnyRole('ADMIN','SCUSTOMERORDERPRODUCT_ALL','SCUSTOMERORDERPRODUCT_SELECT')")
|
||||||
|
public ResponseEntity getSCustomerOrderProducts(CustomerOrderProductQueryCriteria criteria, Pageable pageable){
|
||||||
|
return new ResponseEntity(customerOrderProductService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log("新增SCustomerOrderProduct")
|
||||||
|
@ApiOperation(value = "新增SCustomerOrderProduct")
|
||||||
|
@PostMapping(value = "/sCustomerOrderProduct")
|
||||||
|
@PreAuthorize("hasAnyRole('ADMIN','SCUSTOMERORDERPRODUCT_ALL','SCUSTOMERORDERPRODUCT_CREATE')")
|
||||||
|
public ResponseEntity create(@Validated @RequestBody CustomerOrderProduct resources){
|
||||||
|
return new ResponseEntity(customerOrderProductService.create(resources),HttpStatus.CREATED);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log("修改SCustomerOrderProduct")
|
||||||
|
@ApiOperation(value = "修改SCustomerOrderProduct")
|
||||||
|
@PutMapping(value = "/sCustomerOrderProduct")
|
||||||
|
@PreAuthorize("hasAnyRole('ADMIN','SCUSTOMERORDERPRODUCT_ALL','SCUSTOMERORDERPRODUCT_EDIT')")
|
||||||
|
public ResponseEntity update(@Validated @RequestBody CustomerOrderProduct resources){
|
||||||
|
customerOrderProductService.update(resources);
|
||||||
|
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log("删除SCustomerOrderProduct")
|
||||||
|
@ApiOperation(value = "删除SCustomerOrderProduct")
|
||||||
|
@DeleteMapping(value = "/sCustomerOrderProduct/{id}")
|
||||||
|
@PreAuthorize("hasAnyRole('ADMIN','SCUSTOMERORDERPRODUCT_ALL','SCUSTOMERORDERPRODUCT_DELETE')")
|
||||||
|
public ResponseEntity delete(@PathVariable Long id){
|
||||||
|
customerOrderProductService.delete(id);
|
||||||
|
return new ResponseEntity(HttpStatus.OK);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,64 @@
|
||||||
|
package me.zhengjie.modules.wms.order.service;
|
||||||
|
|
||||||
|
//import org.springframework.cache.annotation.CacheConfig;
|
||||||
|
//import org.springframework.cache.annotation.CacheEvict;
|
||||||
|
//import org.springframework.cache.annotation.Cacheable;
|
||||||
|
import me.zhengjie.modules.wms.order.domain.CustomerOrderProduct;
|
||||||
|
import me.zhengjie.modules.wms.order.service.dto.CustomerOrderProductDTO;
|
||||||
|
import me.zhengjie.modules.wms.order.service.dto.CustomerOrderProductQueryCriteria;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jie
|
||||||
|
* @date 2019-08-03
|
||||||
|
*/
|
||||||
|
//@CacheConfig(cacheNames = "sCustomerOrderProduct")
|
||||||
|
public interface CustomerOrderProductService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* queryAll 分页
|
||||||
|
* @param criteria
|
||||||
|
* @param pageable
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
//@Cacheable(keyGenerator = "keyGenerator")
|
||||||
|
Object queryAll(CustomerOrderProductQueryCriteria criteria, Pageable pageable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* queryAll 不分页
|
||||||
|
* @param criteria
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
//@Cacheable(keyGenerator = "keyGenerator")
|
||||||
|
public Object queryAll(CustomerOrderProductQueryCriteria criteria);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* findById
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
//@Cacheable(key = "#p0")
|
||||||
|
CustomerOrderProductDTO findById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* create
|
||||||
|
* @param resources
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
//@CacheEvict(allEntries = true)
|
||||||
|
CustomerOrderProductDTO create(CustomerOrderProduct resources);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* update
|
||||||
|
* @param resources
|
||||||
|
*/
|
||||||
|
//@CacheEvict(allEntries = true)
|
||||||
|
void update(CustomerOrderProduct resources);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* delete
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
//@CacheEvict(allEntries = true)
|
||||||
|
void delete(Long id);
|
||||||
|
}
|
|
@ -0,0 +1,64 @@
|
||||||
|
package me.zhengjie.modules.wms.order.service;
|
||||||
|
|
||||||
|
//import org.springframework.cache.annotation.CacheConfig;
|
||||||
|
//import org.springframework.cache.annotation.CacheEvict;
|
||||||
|
//import org.springframework.cache.annotation.Cacheable;
|
||||||
|
import me.zhengjie.modules.wms.order.domain.CustomerOrder;
|
||||||
|
import me.zhengjie.modules.wms.order.service.dto.CustomerOrderDTO;
|
||||||
|
import me.zhengjie.modules.wms.order.service.dto.CustomerOrderQueryCriteria;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jie
|
||||||
|
* @date 2019-08-03
|
||||||
|
*/
|
||||||
|
//@CacheConfig(cacheNames = "sCustomerOrder")
|
||||||
|
public interface CustomerOrderService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* queryAll 分页
|
||||||
|
* @param criteria
|
||||||
|
* @param pageable
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
//@Cacheable(keyGenerator = "keyGenerator")
|
||||||
|
Object queryAll(CustomerOrderQueryCriteria criteria, Pageable pageable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* queryAll 不分页
|
||||||
|
* @param criteria
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
//@Cacheable(keyGenerator = "keyGenerator")
|
||||||
|
public Object queryAll(CustomerOrderQueryCriteria criteria);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* findById
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
//@Cacheable(key = "#p0")
|
||||||
|
CustomerOrderDTO findById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* create
|
||||||
|
* @param resources
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
//@CacheEvict(allEntries = true)
|
||||||
|
CustomerOrderDTO create(CustomerOrder resources);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* update
|
||||||
|
* @param resources
|
||||||
|
*/
|
||||||
|
//@CacheEvict(allEntries = true)
|
||||||
|
void update(CustomerOrder resources);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* delete
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
//@CacheEvict(allEntries = true)
|
||||||
|
void delete(Long id);
|
||||||
|
}
|
|
@ -0,0 +1,73 @@
|
||||||
|
package me.zhengjie.modules.wms.order.service.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jie
|
||||||
|
* @date 2019-08-03
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class CustomerOrderDTO implements Serializable {
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
// 所属客户主键
|
||||||
|
private Long customerId;
|
||||||
|
|
||||||
|
// 客户名称
|
||||||
|
private String customerName;
|
||||||
|
|
||||||
|
// 订单日期
|
||||||
|
private Timestamp orderDate;
|
||||||
|
|
||||||
|
// 交货日期
|
||||||
|
private Timestamp deliveryDate;
|
||||||
|
|
||||||
|
// 客户订单编号
|
||||||
|
private String customerOrderCode;
|
||||||
|
|
||||||
|
// 制单人主键
|
||||||
|
private Long customerOrderMakerId;
|
||||||
|
|
||||||
|
// 制单人姓名
|
||||||
|
private String customerOrderMakerName;
|
||||||
|
|
||||||
|
// 交货方式code
|
||||||
|
private String deliveryWayCode;
|
||||||
|
|
||||||
|
// 交货方式名称
|
||||||
|
private String deliveryWayName;
|
||||||
|
|
||||||
|
// 付款方式
|
||||||
|
private String payWayCode;
|
||||||
|
|
||||||
|
// 付款方式名称
|
||||||
|
private String payWayName;
|
||||||
|
|
||||||
|
// 收货地址
|
||||||
|
private String deliveryAddress;
|
||||||
|
|
||||||
|
// 收货人
|
||||||
|
private String deliveryUser;
|
||||||
|
|
||||||
|
// 收货人联系方式
|
||||||
|
private String deliveryUserContact;
|
||||||
|
|
||||||
|
// 备注
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
// 创建时间
|
||||||
|
private Timestamp createTime;
|
||||||
|
|
||||||
|
// 更新时间
|
||||||
|
private Timestamp updateTime;
|
||||||
|
|
||||||
|
// 总额
|
||||||
|
private Long totalMoney;
|
||||||
|
|
||||||
|
// 总数量
|
||||||
|
private Long totalNumber;
|
||||||
|
}
|
|
@ -0,0 +1,50 @@
|
||||||
|
package me.zhengjie.modules.wms.order.service.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jie
|
||||||
|
* @date 2019-08-03
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class CustomerOrderProductDTO implements Serializable {
|
||||||
|
|
||||||
|
// 处理精度丢失问题
|
||||||
|
@JsonSerialize(using= ToStringSerializer.class)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
// 所属客户订单
|
||||||
|
private Long customerOrderId;
|
||||||
|
|
||||||
|
// 产品主键
|
||||||
|
private Long productId;
|
||||||
|
|
||||||
|
// 产品名称
|
||||||
|
private Long productName;
|
||||||
|
|
||||||
|
// 规格
|
||||||
|
private String specifications;
|
||||||
|
|
||||||
|
// 产品单价
|
||||||
|
private Long unitPrice;
|
||||||
|
|
||||||
|
// 产品总价
|
||||||
|
private Long totalPrice;
|
||||||
|
|
||||||
|
// 产品数量
|
||||||
|
private Long productNumber;
|
||||||
|
|
||||||
|
// 备注
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
// 创建时间
|
||||||
|
private Timestamp createTime;
|
||||||
|
|
||||||
|
// 更新时间
|
||||||
|
private Timestamp updateTime;
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
package me.zhengjie.modules.wms.order.service.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import me.zhengjie.annotation.Query;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jie
|
||||||
|
* @date 2019-08-03
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class CustomerOrderProductQueryCriteria {
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
package me.zhengjie.modules.wms.order.service.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import me.zhengjie.annotation.Query;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jie
|
||||||
|
* @date 2019-08-03
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class CustomerOrderQueryCriteria {
|
||||||
|
}
|
|
@ -0,0 +1,77 @@
|
||||||
|
package me.zhengjie.modules.wms.order.service.impl;
|
||||||
|
|
||||||
|
import me.zhengjie.modules.wms.order.domain.CustomerOrderProduct;
|
||||||
|
import me.zhengjie.modules.wms.order.repository.CustomerOrderProductRepository;
|
||||||
|
import me.zhengjie.modules.wms.order.service.CustomerOrderProductService;
|
||||||
|
import me.zhengjie.modules.wms.order.service.dto.CustomerOrderProductDTO;
|
||||||
|
import me.zhengjie.modules.wms.order.service.dto.CustomerOrderProductQueryCriteria;
|
||||||
|
import me.zhengjie.modules.wms.order.service.mapper.CustomerOrderProductMapper;
|
||||||
|
import me.zhengjie.utils.ValidationUtil;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import java.util.Optional;
|
||||||
|
import cn.hutool.core.lang.Snowflake;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import me.zhengjie.utils.PageUtil;
|
||||||
|
import me.zhengjie.utils.QueryHelp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jie
|
||||||
|
* @date 2019-08-03
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||||
|
public class CustomerOrderProductServiceImpl implements CustomerOrderProductService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CustomerOrderProductRepository customerOrderProductRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CustomerOrderProductMapper customerOrderProductMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object queryAll(CustomerOrderProductQueryCriteria criteria, Pageable pageable){
|
||||||
|
Page<CustomerOrderProduct> page = customerOrderProductRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||||
|
return PageUtil.toPage(page.map(customerOrderProductMapper::toDto));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object queryAll(CustomerOrderProductQueryCriteria criteria){
|
||||||
|
return customerOrderProductMapper.toDto(customerOrderProductRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CustomerOrderProductDTO findById(Long id) {
|
||||||
|
Optional<CustomerOrderProduct> sCustomerOrderProduct = customerOrderProductRepository.findById(id);
|
||||||
|
ValidationUtil.isNull(sCustomerOrderProduct,"SCustomerOrderProduct","id",id);
|
||||||
|
return customerOrderProductMapper.toDto(sCustomerOrderProduct.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public CustomerOrderProductDTO create(CustomerOrderProduct resources) {
|
||||||
|
Snowflake snowflake = IdUtil.createSnowflake(1, 1);
|
||||||
|
resources.setId(snowflake.nextId());
|
||||||
|
return customerOrderProductMapper.toDto(customerOrderProductRepository.save(resources));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void update(CustomerOrderProduct resources) {
|
||||||
|
Optional<CustomerOrderProduct> optionalSCustomerOrderProduct = customerOrderProductRepository.findById(resources.getId());
|
||||||
|
ValidationUtil.isNull( optionalSCustomerOrderProduct,"SCustomerOrderProduct","id",resources.getId());
|
||||||
|
CustomerOrderProduct customerOrderProduct = optionalSCustomerOrderProduct.get();
|
||||||
|
customerOrderProduct.copy(resources);
|
||||||
|
customerOrderProductRepository.save(customerOrderProduct);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void delete(Long id) {
|
||||||
|
customerOrderProductRepository.deleteById(id);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,73 @@
|
||||||
|
package me.zhengjie.modules.wms.order.service.impl;
|
||||||
|
|
||||||
|
import me.zhengjie.modules.wms.order.domain.CustomerOrder;
|
||||||
|
import me.zhengjie.modules.wms.order.repository.CustomerOrderRepository;
|
||||||
|
import me.zhengjie.modules.wms.order.service.CustomerOrderService;
|
||||||
|
import me.zhengjie.modules.wms.order.service.dto.CustomerOrderDTO;
|
||||||
|
import me.zhengjie.modules.wms.order.service.dto.CustomerOrderQueryCriteria;
|
||||||
|
import me.zhengjie.modules.wms.order.service.mapper.CustomerOrderMapper;
|
||||||
|
import me.zhengjie.utils.ValidationUtil;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import java.util.Optional;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import me.zhengjie.utils.PageUtil;
|
||||||
|
import me.zhengjie.utils.QueryHelp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jie
|
||||||
|
* @date 2019-08-03
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||||
|
public class CustomerOrderServiceImpl implements CustomerOrderService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CustomerOrderRepository customerOrderRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CustomerOrderMapper customerOrderMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object queryAll(CustomerOrderQueryCriteria criteria, Pageable pageable){
|
||||||
|
Page<CustomerOrder> page = customerOrderRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||||
|
return PageUtil.toPage(page.map(customerOrderMapper::toDto));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object queryAll(CustomerOrderQueryCriteria criteria){
|
||||||
|
return customerOrderMapper.toDto(customerOrderRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CustomerOrderDTO findById(Long id) {
|
||||||
|
Optional<CustomerOrder> sCustomerOrder = customerOrderRepository.findById(id);
|
||||||
|
ValidationUtil.isNull(sCustomerOrder,"SCustomerOrder","id",id);
|
||||||
|
return customerOrderMapper.toDto(sCustomerOrder.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public CustomerOrderDTO create(CustomerOrder resources) {
|
||||||
|
return customerOrderMapper.toDto(customerOrderRepository.save(resources));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void update(CustomerOrder resources) {
|
||||||
|
Optional<CustomerOrder> optionalSCustomerOrder = customerOrderRepository.findById(resources.getId());
|
||||||
|
ValidationUtil.isNull( optionalSCustomerOrder,"SCustomerOrder","id",resources.getId());
|
||||||
|
CustomerOrder customerOrder = optionalSCustomerOrder.get();
|
||||||
|
customerOrder.copy(resources);
|
||||||
|
customerOrderRepository.save(customerOrder);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void delete(Long id) {
|
||||||
|
customerOrderRepository.deleteById(id);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package me.zhengjie.modules.wms.order.service.mapper;
|
||||||
|
|
||||||
|
import me.zhengjie.mapper.EntityMapper;
|
||||||
|
import me.zhengjie.modules.wms.order.domain.CustomerOrder;
|
||||||
|
import me.zhengjie.modules.wms.order.service.dto.CustomerOrderDTO;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.ReportingPolicy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jie
|
||||||
|
* @date 2019-08-03
|
||||||
|
*/
|
||||||
|
@Mapper(componentModel = "spring",uses = {},unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||||
|
public interface CustomerOrderMapper extends EntityMapper<CustomerOrderDTO, CustomerOrder> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package me.zhengjie.modules.wms.order.service.mapper;
|
||||||
|
|
||||||
|
import me.zhengjie.mapper.EntityMapper;
|
||||||
|
import me.zhengjie.modules.wms.order.domain.CustomerOrderProduct;
|
||||||
|
import me.zhengjie.modules.wms.order.service.dto.CustomerOrderProductDTO;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.ReportingPolicy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jie
|
||||||
|
* @date 2019-08-03
|
||||||
|
*/
|
||||||
|
@Mapper(componentModel = "spring",uses = {},unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||||
|
public interface CustomerOrderProductMapper extends EntityMapper<CustomerOrderProductDTO, CustomerOrderProduct> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package me.zhengjie.modules.wms.order.service.request;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import me.zhengjie.modules.wms.order.domain.CustomerOrder;
|
||||||
|
import me.zhengjie.modules.wms.order.domain.CustomerOrderProduct;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 黄星星
|
||||||
|
* @date 2019-08-03
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class CreateCustomerOrderRequest {
|
||||||
|
|
||||||
|
private CustomerOrder customerOrder;
|
||||||
|
|
||||||
|
private List<CustomerOrderProduct> customerOrderProductList;
|
||||||
|
}
|
|
@ -4,9 +4,9 @@ spring:
|
||||||
druid:
|
druid:
|
||||||
type: com.alibaba.druid.pool.DruidDataSource
|
type: com.alibaba.druid.pool.DruidDataSource
|
||||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||||
url: jdbc:log4jdbc:mysql://localhost:3306/eladmin?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
|
url: jdbc:log4jdbc:mysql://rm-2ze4a3l502a15dg50qo.mysql.rds.aliyuncs.com:3306/eladmin?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
|
||||||
username: root
|
username: tenjeu
|
||||||
password: 123456
|
password: starrysky622209Qwe!
|
||||||
|
|
||||||
# 初始化配置
|
# 初始化配置
|
||||||
initial-size: 3
|
initial-size: 3
|
||||||
|
|
|
@ -3,7 +3,7 @@ server:
|
||||||
|
|
||||||
spring:
|
spring:
|
||||||
profiles:
|
profiles:
|
||||||
active: dev
|
active: prod
|
||||||
jackson:
|
jackson:
|
||||||
time-zone: GMT+8
|
time-zone: GMT+8
|
||||||
data:
|
data:
|
||||||
|
|
Loading…
Reference in New Issue