mirror of https://github.com/elunez/eladmin
				
				
				
			耗材采购列表查询
							parent
							
								
									65dbc6ee79
								
							
						
					
					
						commit
						3d5ba8be3a
					
				| 
						 | 
				
			
			@ -35,6 +35,10 @@ public class ConsumablesInfo implements Serializable {
 | 
			
		|||
    @Column(name = "consumables_name")
 | 
			
		||||
    private String consumablesName;
 | 
			
		||||
 | 
			
		||||
    // 耗材编号
 | 
			
		||||
    @Column(name = "consumables_code")
 | 
			
		||||
    private String consumablesCode;
 | 
			
		||||
 | 
			
		||||
    @Column(name = "status")
 | 
			
		||||
    private Boolean status;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -21,5 +21,8 @@ public class ConsumablesInfoDTO implements Serializable {
 | 
			
		|||
    // 耗材名称
 | 
			
		||||
    private String consumablesName;
 | 
			
		||||
 | 
			
		||||
    // 耗材编码
 | 
			
		||||
    private String consumablesCode;
 | 
			
		||||
 | 
			
		||||
    private Boolean status;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -3,6 +3,8 @@ package me.zhengjie.modules.wms.outSourceProductSheet.domain;
 | 
			
		|||
import lombok.Data;
 | 
			
		||||
import cn.hutool.core.bean.BeanUtil;
 | 
			
		||||
import cn.hutool.core.bean.copier.CopyOptions;
 | 
			
		||||
import org.hibernate.annotations.CreationTimestamp;
 | 
			
		||||
 | 
			
		||||
import javax.persistence.*;
 | 
			
		||||
import java.sql.Timestamp;
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
| 
						 | 
				
			
			@ -24,9 +26,11 @@ public class OutSourceInspectionCertificate implements Serializable {
 | 
			
		|||
    private Long id;
 | 
			
		||||
 | 
			
		||||
    @Column(name = "create_time")
 | 
			
		||||
    @CreationTimestamp
 | 
			
		||||
    private Timestamp createTime;
 | 
			
		||||
 | 
			
		||||
    @Column(name = "update_time")
 | 
			
		||||
    @CreationTimestamp
 | 
			
		||||
    private Timestamp updateTime;
 | 
			
		||||
 | 
			
		||||
    @Column(name = "status")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,6 +3,8 @@ package me.zhengjie.modules.wms.outSourceProductSheet.domain;
 | 
			
		|||
import lombok.Data;
 | 
			
		||||
import cn.hutool.core.bean.BeanUtil;
 | 
			
		||||
import cn.hutool.core.bean.copier.CopyOptions;
 | 
			
		||||
import org.hibernate.annotations.CreationTimestamp;
 | 
			
		||||
 | 
			
		||||
import javax.persistence.*;
 | 
			
		||||
import java.sql.Timestamp;
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
| 
						 | 
				
			
			@ -23,9 +25,11 @@ public class OutSourceInspectionCertificateProduct implements Serializable {
 | 
			
		|||
    private Long id;
 | 
			
		||||
 | 
			
		||||
    @Column(name = "create_time")
 | 
			
		||||
    @CreationTimestamp
 | 
			
		||||
    private Timestamp createTime;
 | 
			
		||||
 | 
			
		||||
    @Column(name = "update_time")
 | 
			
		||||
    @CreationTimestamp
 | 
			
		||||
    private Timestamp updateTime;
 | 
			
		||||
 | 
			
		||||
    @Column(name = "status")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,6 +3,8 @@ package me.zhengjie.modules.wms.outSourceProductSheet.domain;
 | 
			
		|||
import lombok.Data;
 | 
			
		||||
import cn.hutool.core.bean.BeanUtil;
 | 
			
		||||
import cn.hutool.core.bean.copier.CopyOptions;
 | 
			
		||||
import org.hibernate.annotations.CreationTimestamp;
 | 
			
		||||
 | 
			
		||||
import javax.persistence.*;
 | 
			
		||||
import java.sql.Timestamp;
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
| 
						 | 
				
			
			@ -28,10 +30,12 @@ public class OutSourceProcessSheetProduct implements Serializable {
 | 
			
		|||
 | 
			
		||||
    // 创建时间
 | 
			
		||||
    @Column(name = "create_time")
 | 
			
		||||
    @CreationTimestamp
 | 
			
		||||
    private Timestamp createTime;
 | 
			
		||||
 | 
			
		||||
    // 更新时间
 | 
			
		||||
    @Column(name = "update_time")
 | 
			
		||||
    @CreationTimestamp
 | 
			
		||||
    private Timestamp updateTime;
 | 
			
		||||
 | 
			
		||||
    // 所属委外加工单
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,6 +7,7 @@ import java.util.List;
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 委外加工单
 | 
			
		||||
* @author jie
 | 
			
		||||
* @date 2019-08-17
 | 
			
		||||
*/
 | 
			
		||||
| 
						 | 
				
			
			@ -21,6 +22,8 @@ public class OutSourceProcessSheetDTO implements Serializable {
 | 
			
		|||
    // 创建时间
 | 
			
		||||
    private Timestamp createTime;
 | 
			
		||||
 | 
			
		||||
    private String createTimeStr;
 | 
			
		||||
 | 
			
		||||
    // 更新时间
 | 
			
		||||
    private Timestamp updateTime;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -29,6 +29,8 @@ import org.springframework.stereotype.Service;
 | 
			
		|||
import org.springframework.transaction.annotation.Propagation;
 | 
			
		||||
import org.springframework.transaction.annotation.Transactional;
 | 
			
		||||
 | 
			
		||||
import java.sql.Timestamp;
 | 
			
		||||
import java.text.SimpleDateFormat;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
| 
						 | 
				
			
			@ -88,7 +90,19 @@ public class OutSourceProcessSheetServiceImpl implements OutSourceProcessSheetSe
 | 
			
		|||
            }
 | 
			
		||||
        };
 | 
			
		||||
        Page<OutSourceProcessSheet> page = outSourceProcessSheetRepository.findAll(specification,pageable);
 | 
			
		||||
        return PageUtil.toPage(page.map(outSourceProcessSheetMapper::toDto));
 | 
			
		||||
 | 
			
		||||
        Page<OutSourceProcessSheetDTO> outSourceProcessSheetDTOPage = page.map(outSourceProcessSheetMapper::toDto);
 | 
			
		||||
        if(null != outSourceProcessSheetDTOPage){
 | 
			
		||||
            List<OutSourceProcessSheetDTO> outSourceProcessSheetDTOList = outSourceProcessSheetDTOPage.getContent();
 | 
			
		||||
            if(!CollectionUtils.isEmpty(outSourceProcessSheetDTOList)){
 | 
			
		||||
                for(OutSourceProcessSheetDTO outSourceProcessSheetDTO : outSourceProcessSheetDTOList){
 | 
			
		||||
                    Timestamp createTime = outSourceProcessSheetDTO.getCreateTime();
 | 
			
		||||
                    outSourceProcessSheetDTO.setCreateTimeStr(new SimpleDateFormat("yyyy-MM-dd").format(createTime));
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        Map map = PageUtil.toPage(outSourceProcessSheetDTOPage);
 | 
			
		||||
        return map;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -50,6 +50,7 @@ public class ProductPurchaseOrder implements Serializable {
 | 
			
		|||
    @Column(name = "audit_user_name")
 | 
			
		||||
    private String auditUserName;
 | 
			
		||||
 | 
			
		||||
    // 产品采购单单据编号
 | 
			
		||||
    @Column(name = "product_purchase_order_code")
 | 
			
		||||
    private String productPurchaseOrderCode;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,37 @@
 | 
			
		|||
package me.zhengjie.modules.wms.purchase.request;
 | 
			
		||||
 | 
			
		||||
import cn.hutool.core.bean.BeanUtil;
 | 
			
		||||
import cn.hutool.core.bean.copier.CopyOptions;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 新增产品产品采购单请求参数
 | 
			
		||||
 * @author 黄星星
 | 
			
		||||
 * @date 2019-10-06
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
public class CreateProductPurchaseOrderRequest implements Serializable {
 | 
			
		||||
 | 
			
		||||
    // 采购人主键
 | 
			
		||||
    private Long purchaseUserId;
 | 
			
		||||
 | 
			
		||||
    //  采购人姓名
 | 
			
		||||
    private String purchaseUserName;
 | 
			
		||||
 | 
			
		||||
    // 审核人主键
 | 
			
		||||
    private Long auditUserId;
 | 
			
		||||
 | 
			
		||||
    // 审核人姓名
 | 
			
		||||
    private String auditUserName;
 | 
			
		||||
 | 
			
		||||
    // 产品采购单单据编号
 | 
			
		||||
    private String productPurchaseOrderCode;
 | 
			
		||||
 | 
			
		||||
    private List<ProductPurchaseOrderProductRequest> productPurchaseOrderProductList;
 | 
			
		||||
 | 
			
		||||
    public void copy(CreateProductPurchaseOrderRequest source){
 | 
			
		||||
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,57 @@
 | 
			
		|||
package me.zhengjie.modules.wms.purchase.request;
 | 
			
		||||
 | 
			
		||||
import cn.hutool.core.bean.BeanUtil;
 | 
			
		||||
import cn.hutool.core.bean.copier.CopyOptions;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
 | 
			
		||||
import javax.persistence.*;
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
import java.sql.Timestamp;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 新增产品采购单请求产品信息
 | 
			
		||||
* @author jie
 | 
			
		||||
* @date 2019-10-06
 | 
			
		||||
*/
 | 
			
		||||
@Data
 | 
			
		||||
public class ProductPurchaseOrderProductRequest implements Serializable {
 | 
			
		||||
 | 
			
		||||
    // 所属产品采购单
 | 
			
		||||
    private Long productPurchaseOrderId;
 | 
			
		||||
 | 
			
		||||
    // 产品主键
 | 
			
		||||
    private Long productId;
 | 
			
		||||
 | 
			
		||||
    // 产品名称
 | 
			
		||||
    private String productName;
 | 
			
		||||
 | 
			
		||||
    // 规格
 | 
			
		||||
    private String specifications;
 | 
			
		||||
 | 
			
		||||
    // 产品单价
 | 
			
		||||
    private Long unitPrice;
 | 
			
		||||
 | 
			
		||||
    // 产品总价
 | 
			
		||||
    private Long totalPrice;
 | 
			
		||||
 | 
			
		||||
    // 产品数量
 | 
			
		||||
    private Long productNumber;
 | 
			
		||||
 | 
			
		||||
    // 备注
 | 
			
		||||
    private String remark;
 | 
			
		||||
 | 
			
		||||
    // 创建时间
 | 
			
		||||
    private Timestamp createTime;
 | 
			
		||||
 | 
			
		||||
    // 更新时间
 | 
			
		||||
    private Timestamp updateTime;
 | 
			
		||||
 | 
			
		||||
    private Boolean status;
 | 
			
		||||
 | 
			
		||||
    // 产品编号
 | 
			
		||||
    private String productCode;
 | 
			
		||||
 | 
			
		||||
    public void copy(ProductPurchaseOrderProductRequest source){
 | 
			
		||||
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -13,11 +13,14 @@ import org.springframework.validation.annotation.Validated;
 | 
			
		|||
import org.springframework.web.bind.annotation.*;
 | 
			
		||||
import io.swagger.annotations.*;
 | 
			
		||||
 | 
			
		||||
import java.time.LocalDateTime;
 | 
			
		||||
import java.time.format.DateTimeFormatter;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
* @author jie
 | 
			
		||||
* @date 2019-10-06
 | 
			
		||||
*/
 | 
			
		||||
@Api(tags = "ConsumablesPurchaseOrder管理")
 | 
			
		||||
@Api(tags = "耗材采购管理")
 | 
			
		||||
@RestController
 | 
			
		||||
@RequestMapping("api")
 | 
			
		||||
public class ConsumablesPurchaseOrderController {
 | 
			
		||||
| 
						 | 
				
			
			@ -25,7 +28,7 @@ public class ConsumablesPurchaseOrderController {
 | 
			
		|||
    @Autowired
 | 
			
		||||
    private ConsumablesPurchaseOrderService consumablesPurchaseOrderService;
 | 
			
		||||
 | 
			
		||||
    @Log("查询ConsumablesPurchaseOrder")
 | 
			
		||||
    @Log("分页查询耗材采购单")
 | 
			
		||||
    @ApiOperation(value = "查询ConsumablesPurchaseOrder")
 | 
			
		||||
    @GetMapping(value = "/consumablesPurchaseOrder")
 | 
			
		||||
    @PreAuthorize("hasAnyRole('ADMIN','CONSUMABLESPURCHASEORDER_ALL','CONSUMABLESPURCHASEORDER_SELECT')")
 | 
			
		||||
| 
						 | 
				
			
			@ -33,16 +36,16 @@ public class ConsumablesPurchaseOrderController {
 | 
			
		|||
        return new ResponseEntity(consumablesPurchaseOrderService.queryAll(criteria,pageable),HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Log("新增ConsumablesPurchaseOrder")
 | 
			
		||||
    @ApiOperation(value = "新增ConsumablesPurchaseOrder")
 | 
			
		||||
    @Log("新增耗材采购单")
 | 
			
		||||
    @ApiOperation(value = "新增耗材采购单")
 | 
			
		||||
    @PostMapping(value = "/consumablesPurchaseOrder")
 | 
			
		||||
    @PreAuthorize("hasAnyRole('ADMIN','CONSUMABLESPURCHASEORDER_ALL','CONSUMABLESPURCHASEORDER_CREATE')")
 | 
			
		||||
    public ResponseEntity create(@Validated @RequestBody ConsumablesPurchaseOrder resources){
 | 
			
		||||
        return new ResponseEntity(consumablesPurchaseOrderService.create(resources),HttpStatus.CREATED);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Log("修改ConsumablesPurchaseOrder")
 | 
			
		||||
    @ApiOperation(value = "修改ConsumablesPurchaseOrder")
 | 
			
		||||
    @Log("修改耗材采购单")
 | 
			
		||||
    @ApiOperation(value = "修改耗材采购单")
 | 
			
		||||
    @PutMapping(value = "/consumablesPurchaseOrder")
 | 
			
		||||
    @PreAuthorize("hasAnyRole('ADMIN','CONSUMABLESPURCHASEORDER_ALL','CONSUMABLESPURCHASEORDER_EDIT')")
 | 
			
		||||
    public ResponseEntity update(@Validated @RequestBody ConsumablesPurchaseOrder resources){
 | 
			
		||||
| 
						 | 
				
			
			@ -50,12 +53,20 @@ public class ConsumablesPurchaseOrderController {
 | 
			
		|||
        return new ResponseEntity(HttpStatus.NO_CONTENT);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Log("删除ConsumablesPurchaseOrder")
 | 
			
		||||
    @ApiOperation(value = "删除ConsumablesPurchaseOrder")
 | 
			
		||||
    @Log("删除耗材采购单")
 | 
			
		||||
    @ApiOperation(value = "删除耗材采购单")
 | 
			
		||||
    @DeleteMapping(value = "/consumablesPurchaseOrder/{id}")
 | 
			
		||||
    @PreAuthorize("hasAnyRole('ADMIN','CONSUMABLESPURCHASEORDER_ALL','CONSUMABLESPURCHASEORDER_DELETE')")
 | 
			
		||||
    public ResponseEntity delete(@PathVariable Long id){
 | 
			
		||||
        consumablesPurchaseOrderService.delete(id);
 | 
			
		||||
        return new ResponseEntity(HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Log("初始化耗材采购单编号")
 | 
			
		||||
    @GetMapping(value = "/initConsumablesPurchaseOrderCode")
 | 
			
		||||
    public ResponseEntity initConsumablesPurchaseOrderCode(){
 | 
			
		||||
        DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS");//设置日期格式
 | 
			
		||||
        String supplierCode = "CP"+ LocalDateTime.now().format(fmt);
 | 
			
		||||
        return new ResponseEntity(supplierCode,HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,61 +0,0 @@
 | 
			
		|||
package me.zhengjie.modules.wms.purchase.rest;
 | 
			
		||||
 | 
			
		||||
import me.zhengjie.aop.log.Log;
 | 
			
		||||
import me.zhengjie.modules.wms.purchase.domain.ConsumablesPurchaseOrderProduct;
 | 
			
		||||
import me.zhengjie.modules.wms.purchase.service.ConsumablesPurchaseOrderProductService;
 | 
			
		||||
import me.zhengjie.modules.wms.purchase.service.dto.ConsumablesPurchaseOrderProductQueryCriteria;
 | 
			
		||||
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-10-06
 | 
			
		||||
*/
 | 
			
		||||
@Api(tags = "ConsumablesPurchaseOrderProduct管理")
 | 
			
		||||
@RestController
 | 
			
		||||
@RequestMapping("api")
 | 
			
		||||
public class ConsumablesPurchaseOrderProductController {
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private ConsumablesPurchaseOrderProductService consumablesPurchaseOrderProductService;
 | 
			
		||||
 | 
			
		||||
    @Log("查询ConsumablesPurchaseOrderProduct")
 | 
			
		||||
    @ApiOperation(value = "查询ConsumablesPurchaseOrderProduct")
 | 
			
		||||
    @GetMapping(value = "/consumablesPurchaseOrderProduct")
 | 
			
		||||
    @PreAuthorize("hasAnyRole('ADMIN','CONSUMABLESPURCHASEORDERPRODUCT_ALL','CONSUMABLESPURCHASEORDERPRODUCT_SELECT')")
 | 
			
		||||
    public ResponseEntity getConsumablesPurchaseOrderProducts(ConsumablesPurchaseOrderProductQueryCriteria criteria, Pageable pageable){
 | 
			
		||||
        return new ResponseEntity(consumablesPurchaseOrderProductService.queryAll(criteria,pageable),HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Log("新增ConsumablesPurchaseOrderProduct")
 | 
			
		||||
    @ApiOperation(value = "新增ConsumablesPurchaseOrderProduct")
 | 
			
		||||
    @PostMapping(value = "/consumablesPurchaseOrderProduct")
 | 
			
		||||
    @PreAuthorize("hasAnyRole('ADMIN','CONSUMABLESPURCHASEORDERPRODUCT_ALL','CONSUMABLESPURCHASEORDERPRODUCT_CREATE')")
 | 
			
		||||
    public ResponseEntity create(@Validated @RequestBody ConsumablesPurchaseOrderProduct resources){
 | 
			
		||||
        return new ResponseEntity(consumablesPurchaseOrderProductService.create(resources),HttpStatus.CREATED);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Log("修改ConsumablesPurchaseOrderProduct")
 | 
			
		||||
    @ApiOperation(value = "修改ConsumablesPurchaseOrderProduct")
 | 
			
		||||
    @PutMapping(value = "/consumablesPurchaseOrderProduct")
 | 
			
		||||
    @PreAuthorize("hasAnyRole('ADMIN','CONSUMABLESPURCHASEORDERPRODUCT_ALL','CONSUMABLESPURCHASEORDERPRODUCT_EDIT')")
 | 
			
		||||
    public ResponseEntity update(@Validated @RequestBody ConsumablesPurchaseOrderProduct resources){
 | 
			
		||||
        consumablesPurchaseOrderProductService.update(resources);
 | 
			
		||||
        return new ResponseEntity(HttpStatus.NO_CONTENT);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Log("删除ConsumablesPurchaseOrderProduct")
 | 
			
		||||
    @ApiOperation(value = "删除ConsumablesPurchaseOrderProduct")
 | 
			
		||||
    @DeleteMapping(value = "/consumablesPurchaseOrderProduct/{id}")
 | 
			
		||||
    @PreAuthorize("hasAnyRole('ADMIN','CONSUMABLESPURCHASEORDERPRODUCT_ALL','CONSUMABLESPURCHASEORDERPRODUCT_DELETE')")
 | 
			
		||||
    public ResponseEntity delete(@PathVariable Long id){
 | 
			
		||||
        consumablesPurchaseOrderProductService.delete(id);
 | 
			
		||||
        return new ResponseEntity(HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -2,6 +2,7 @@ package me.zhengjie.modules.wms.purchase.rest;
 | 
			
		|||
 | 
			
		||||
import me.zhengjie.aop.log.Log;
 | 
			
		||||
import me.zhengjie.modules.wms.purchase.domain.ProductPurchaseOrder;
 | 
			
		||||
import me.zhengjie.modules.wms.purchase.request.CreateProductPurchaseOrderRequest;
 | 
			
		||||
import me.zhengjie.modules.wms.purchase.service.ProductPurchaseOrderService;
 | 
			
		||||
import me.zhengjie.modules.wms.purchase.service.dto.ProductPurchaseOrderQueryCriteria;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
| 
						 | 
				
			
			@ -13,6 +14,9 @@ import org.springframework.validation.annotation.Validated;
 | 
			
		|||
import org.springframework.web.bind.annotation.*;
 | 
			
		||||
import io.swagger.annotations.*;
 | 
			
		||||
 | 
			
		||||
import java.time.LocalDateTime;
 | 
			
		||||
import java.time.format.DateTimeFormatter;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 产品采购管理控制类
 | 
			
		||||
* @author jie
 | 
			
		||||
| 
						 | 
				
			
			@ -38,8 +42,8 @@ public class ProductPurchaseOrderController {
 | 
			
		|||
    @ApiOperation(value = "新增产品采购单")
 | 
			
		||||
    @PostMapping(value = "/productPurchaseOrder")
 | 
			
		||||
    @PreAuthorize("hasAnyRole('ADMIN','PRODUCTPURCHASEORDER_ALL','PRODUCTPURCHASEORDER_CREATE')")
 | 
			
		||||
    public ResponseEntity create(@Validated @RequestBody ProductPurchaseOrder resources){
 | 
			
		||||
        return new ResponseEntity(productPurchaseOrderService.create(resources),HttpStatus.CREATED);
 | 
			
		||||
    public ResponseEntity create(@Validated @RequestBody CreateProductPurchaseOrderRequest createProductPurchaseOrderRequest){
 | 
			
		||||
        return new ResponseEntity(productPurchaseOrderService.create(createProductPurchaseOrderRequest),HttpStatus.CREATED);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Log("修改产品采购")
 | 
			
		||||
| 
						 | 
				
			
			@ -59,4 +63,12 @@ public class ProductPurchaseOrderController {
 | 
			
		|||
        productPurchaseOrderService.delete(id);
 | 
			
		||||
        return new ResponseEntity(HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Log("初始化产品采购单编号")
 | 
			
		||||
    @GetMapping(value = "/initProductPurchaseOrderCode")
 | 
			
		||||
    public ResponseEntity initProductPurchaseOrderCode(){
 | 
			
		||||
        DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS");//设置日期格式
 | 
			
		||||
        String supplierCode = "PP"+ LocalDateTime.now().format(fmt);
 | 
			
		||||
        return new ResponseEntity(supplierCode,HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,61 +0,0 @@
 | 
			
		|||
package me.zhengjie.modules.wms.purchase.rest;
 | 
			
		||||
 | 
			
		||||
import me.zhengjie.aop.log.Log;
 | 
			
		||||
import me.zhengjie.modules.wms.purchase.domain.ProductPurchaseOrderProduct;
 | 
			
		||||
import me.zhengjie.modules.wms.purchase.service.ProductPurchaseOrderProductService;
 | 
			
		||||
import me.zhengjie.modules.wms.purchase.service.dto.ProductPurchaseOrderProductQueryCriteria;
 | 
			
		||||
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-10-06
 | 
			
		||||
*/
 | 
			
		||||
@Api(tags = "ProductPurchaseOrderProduct管理")
 | 
			
		||||
@RestController
 | 
			
		||||
@RequestMapping("api")
 | 
			
		||||
public class ProductPurchaseOrderProductController {
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private ProductPurchaseOrderProductService productPurchaseOrderProductService;
 | 
			
		||||
 | 
			
		||||
    @Log("查询ProductPurchaseOrderProduct")
 | 
			
		||||
    @ApiOperation(value = "查询ProductPurchaseOrderProduct")
 | 
			
		||||
    @GetMapping(value = "/productPurchaseOrderProduct")
 | 
			
		||||
    @PreAuthorize("hasAnyRole('ADMIN','PRODUCTPURCHASEORDERPRODUCT_ALL','PRODUCTPURCHASEORDERPRODUCT_SELECT')")
 | 
			
		||||
    public ResponseEntity getProductPurchaseOrderProducts(ProductPurchaseOrderProductQueryCriteria criteria, Pageable pageable){
 | 
			
		||||
        return new ResponseEntity(productPurchaseOrderProductService.queryAll(criteria,pageable),HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Log("新增ProductPurchaseOrderProduct")
 | 
			
		||||
    @ApiOperation(value = "新增ProductPurchaseOrderProduct")
 | 
			
		||||
    @PostMapping(value = "/productPurchaseOrderProduct")
 | 
			
		||||
    @PreAuthorize("hasAnyRole('ADMIN','PRODUCTPURCHASEORDERPRODUCT_ALL','PRODUCTPURCHASEORDERPRODUCT_CREATE')")
 | 
			
		||||
    public ResponseEntity create(@Validated @RequestBody ProductPurchaseOrderProduct resources){
 | 
			
		||||
        return new ResponseEntity(productPurchaseOrderProductService.create(resources),HttpStatus.CREATED);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Log("修改ProductPurchaseOrderProduct")
 | 
			
		||||
    @ApiOperation(value = "修改ProductPurchaseOrderProduct")
 | 
			
		||||
    @PutMapping(value = "/productPurchaseOrderProduct")
 | 
			
		||||
    @PreAuthorize("hasAnyRole('ADMIN','PRODUCTPURCHASEORDERPRODUCT_ALL','PRODUCTPURCHASEORDERPRODUCT_EDIT')")
 | 
			
		||||
    public ResponseEntity update(@Validated @RequestBody ProductPurchaseOrderProduct resources){
 | 
			
		||||
        productPurchaseOrderProductService.update(resources);
 | 
			
		||||
        return new ResponseEntity(HttpStatus.NO_CONTENT);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Log("删除ProductPurchaseOrderProduct")
 | 
			
		||||
    @ApiOperation(value = "删除ProductPurchaseOrderProduct")
 | 
			
		||||
    @DeleteMapping(value = "/productPurchaseOrderProduct/{id}")
 | 
			
		||||
    @PreAuthorize("hasAnyRole('ADMIN','PRODUCTPURCHASEORDERPRODUCT_ALL','PRODUCTPURCHASEORDERPRODUCT_DELETE')")
 | 
			
		||||
    public ResponseEntity delete(@PathVariable Long id){
 | 
			
		||||
        productPurchaseOrderProductService.delete(id);
 | 
			
		||||
        return new ResponseEntity(HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,6 +1,7 @@
 | 
			
		|||
package me.zhengjie.modules.wms.purchase.service;
 | 
			
		||||
 | 
			
		||||
import me.zhengjie.modules.wms.purchase.domain.ProductPurchaseOrder;
 | 
			
		||||
import me.zhengjie.modules.wms.purchase.request.CreateProductPurchaseOrderRequest;
 | 
			
		||||
import me.zhengjie.modules.wms.purchase.service.dto.ProductPurchaseOrderDTO;
 | 
			
		||||
import me.zhengjie.modules.wms.purchase.service.dto.ProductPurchaseOrderQueryCriteria;
 | 
			
		||||
//import org.springframework.cache.annotation.CacheConfig;
 | 
			
		||||
| 
						 | 
				
			
			@ -42,11 +43,11 @@ public interface ProductPurchaseOrderService {
 | 
			
		|||
 | 
			
		||||
    /**
 | 
			
		||||
     * create
 | 
			
		||||
     * @param resources
 | 
			
		||||
     * @param createProductPurchaseOrderRequest
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    //@CacheEvict(allEntries = true)
 | 
			
		||||
    ProductPurchaseOrderDTO create(ProductPurchaseOrder resources);
 | 
			
		||||
    ProductPurchaseOrderDTO create(CreateProductPurchaseOrderRequest createProductPurchaseOrderRequest);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * update
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,6 +3,7 @@ package me.zhengjie.modules.wms.purchase.service.dto;
 | 
			
		|||
import lombok.Data;
 | 
			
		||||
import java.sql.Timestamp;
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
| 
						 | 
				
			
			@ -36,4 +37,7 @@ public class ProductPurchaseOrderDTO implements Serializable {
 | 
			
		|||
    private String auditUserName;
 | 
			
		||||
 | 
			
		||||
    private String productPurchaseOrderCode;
 | 
			
		||||
 | 
			
		||||
    //产品采购单产品信息
 | 
			
		||||
    private List<ProductPurchaseOrderProductDTO> productPurchaseOrderProductList;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,6 +1,7 @@
 | 
			
		|||
package me.zhengjie.modules.wms.purchase.service.impl;
 | 
			
		||||
 | 
			
		||||
import me.zhengjie.modules.wms.purchase.domain.ConsumablesPurchaseOrder;
 | 
			
		||||
import me.zhengjie.modules.wms.purchase.domain.ProductPurchaseOrder;
 | 
			
		||||
import me.zhengjie.utils.ValidationUtil;
 | 
			
		||||
import me.zhengjie.modules.wms.purchase.repository.ConsumablesPurchaseOrderRepository;
 | 
			
		||||
import me.zhengjie.modules.wms.purchase.service.ConsumablesPurchaseOrderService;
 | 
			
		||||
| 
						 | 
				
			
			@ -8,14 +9,24 @@ import me.zhengjie.modules.wms.purchase.service.dto.ConsumablesPurchaseOrderDTO;
 | 
			
		|||
import me.zhengjie.modules.wms.purchase.service.dto.ConsumablesPurchaseOrderQueryCriteria;
 | 
			
		||||
import me.zhengjie.modules.wms.purchase.service.mapper.ConsumablesPurchaseOrderMapper;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
import org.springframework.data.jpa.domain.Specification;
 | 
			
		||||
import org.springframework.stereotype.Service;
 | 
			
		||||
import org.springframework.transaction.annotation.Propagation;
 | 
			
		||||
import org.springframework.transaction.annotation.Transactional;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
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;
 | 
			
		||||
import org.springframework.util.CollectionUtils;
 | 
			
		||||
 | 
			
		||||
import javax.persistence.criteria.CriteriaBuilder;
 | 
			
		||||
import javax.persistence.criteria.CriteriaQuery;
 | 
			
		||||
import javax.persistence.criteria.Predicate;
 | 
			
		||||
import javax.persistence.criteria.Root;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
* @author jie
 | 
			
		||||
| 
						 | 
				
			
			@ -33,13 +44,50 @@ public class ConsumablesPurchaseOrderServiceImpl implements ConsumablesPurchaseO
 | 
			
		|||
 | 
			
		||||
    @Override
 | 
			
		||||
    public Object queryAll(ConsumablesPurchaseOrderQueryCriteria criteria, Pageable pageable){
 | 
			
		||||
        Page<ConsumablesPurchaseOrder> page = consumablesPurchaseOrderRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
 | 
			
		||||
        Specification<ConsumablesPurchaseOrder> specification = new Specification<ConsumablesPurchaseOrder>() {
 | 
			
		||||
            @Override
 | 
			
		||||
            public Predicate toPredicate(Root<ConsumablesPurchaseOrder> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) {
 | 
			
		||||
 | 
			
		||||
                List<Predicate> targetPredicateList = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
                //状态
 | 
			
		||||
                Predicate statusPredicate = criteriaBuilder.equal(root.get("status"), 1);
 | 
			
		||||
                targetPredicateList.add(statusPredicate);
 | 
			
		||||
 | 
			
		||||
                if(CollectionUtils.isEmpty(targetPredicateList)){
 | 
			
		||||
                    return null;
 | 
			
		||||
                }else{
 | 
			
		||||
                    return criteriaBuilder.and(targetPredicateList.toArray(new Predicate[targetPredicateList.size()]));
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        Page<ConsumablesPurchaseOrder> page = consumablesPurchaseOrderRepository.findAll(specification, pageable);
 | 
			
		||||
        return PageUtil.toPage(page.map(consumablesPurchaseOrderMapper::toDto));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public Object queryAll(ConsumablesPurchaseOrderQueryCriteria criteria){
 | 
			
		||||
        return consumablesPurchaseOrderMapper.toDto(consumablesPurchaseOrderRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
 | 
			
		||||
        Specification<ConsumablesPurchaseOrder> specification = new Specification<ConsumablesPurchaseOrder>() {
 | 
			
		||||
            @Override
 | 
			
		||||
            public Predicate toPredicate(Root<ConsumablesPurchaseOrder> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) {
 | 
			
		||||
 | 
			
		||||
                List<Predicate> targetPredicateList = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
                //状态
 | 
			
		||||
                Predicate statusPredicate = criteriaBuilder.equal(root.get("status"), 1);
 | 
			
		||||
                targetPredicateList.add(statusPredicate);
 | 
			
		||||
 | 
			
		||||
                if(CollectionUtils.isEmpty(targetPredicateList)){
 | 
			
		||||
                    return null;
 | 
			
		||||
                }else{
 | 
			
		||||
                    return criteriaBuilder.and(targetPredicateList.toArray(new Predicate[targetPredicateList.size()]));
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        List<ConsumablesPurchaseOrder> consumablesPurchaseOrderList = consumablesPurchaseOrderRepository.findAll(specification);
 | 
			
		||||
        return consumablesPurchaseOrderMapper.toDto(consumablesPurchaseOrderList);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,6 +2,7 @@ package me.zhengjie.modules.wms.purchase.service.impl;
 | 
			
		|||
 | 
			
		||||
import me.zhengjie.modules.wms.bd.domain.MeasureUnit;
 | 
			
		||||
import me.zhengjie.modules.wms.purchase.domain.ProductPurchaseOrder;
 | 
			
		||||
import me.zhengjie.modules.wms.purchase.request.CreateProductPurchaseOrderRequest;
 | 
			
		||||
import me.zhengjie.utils.ValidationUtil;
 | 
			
		||||
import me.zhengjie.modules.wms.purchase.repository.ProductPurchaseOrderRepository;
 | 
			
		||||
import me.zhengjie.modules.wms.purchase.service.ProductPurchaseOrderService;
 | 
			
		||||
| 
						 | 
				
			
			@ -99,8 +100,9 @@ public class ProductPurchaseOrderServiceImpl implements ProductPurchaseOrderServ
 | 
			
		|||
 | 
			
		||||
    @Override
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public ProductPurchaseOrderDTO create(ProductPurchaseOrder resources) {
 | 
			
		||||
        return productPurchaseOrderMapper.toDto(productPurchaseOrderRepository.save(resources));
 | 
			
		||||
    public ProductPurchaseOrderDTO create(CreateProductPurchaseOrderRequest createProductPurchaseOrderRequest) {
 | 
			
		||||
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue