Showing
12 changed files
with
207 additions
and
0 deletions
| ... | ... | @@ -86,6 +86,7 @@ create table if not exists `tbl_contract_distributor_standard` |
| 86 | 86 | `dept_id` varchar(32) not null comment '办事处', |
| 87 | 87 | `order_date` date NOT NULL COMMENT '订货日期', |
| 88 | 88 | `unit` VARCHAR(50) COMMENT '单位', |
| 89 | + `workshop_id` varchar(32) comment '生产厂', | |
| 89 | 90 | `total_quantity` DECIMAL(15, 4) COMMENT '合计数量', |
| 90 | 91 | `total_amount_excluding_tax` DECIMAL(15, 4) COMMENT '合计不含税金额', |
| 91 | 92 | `total_amount_including_tax` DECIMAL(15, 4) COMMENT '合计总金额', | ... | ... |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/contract/GetContractDistributorStandardBo.java
| ... | ... | @@ -90,6 +90,18 @@ public class GetContractDistributorStandardBo extends BaseBo<ContractDistributor |
| 90 | 90 | private String unitName; |
| 91 | 91 | |
| 92 | 92 | /** |
| 93 | + * 生产厂 | |
| 94 | + */ | |
| 95 | + @ApiModelProperty("生产厂") | |
| 96 | + private String workshopId; | |
| 97 | + | |
| 98 | + /** | |
| 99 | + * 生产厂名称 | |
| 100 | + */ | |
| 101 | + @ApiModelProperty("生产厂名称") | |
| 102 | + private String workshopName; | |
| 103 | + | |
| 104 | + /** | |
| 93 | 105 | * 合计人民币金额(大写) |
| 94 | 106 | */ |
| 95 | 107 | @ApiModelProperty("合计人民币金额(大写)") | ... | ... |
| ... | ... | @@ -145,12 +145,16 @@ public class QueryContractDistributorStandardBo extends BaseBo<ContractDistribut |
| 145 | 145 | @ApiModelProperty(value = "正式合同是否审核完成(AUDIT:审核中,PASS:审核通过,REFUSE:已驳回,CANCEL:已取消)") |
| 146 | 146 | private String formalApproved; |
| 147 | 147 | |
| 148 | + private String formalApprovedName; | |
| 149 | + | |
| 148 | 150 | /** |
| 149 | 151 | * 标准合同是否审核完成(AUDIT:审核中,PASS:审核通过,REFUSE:已驳回,CANCEL:已取消) |
| 150 | 152 | */ |
| 151 | 153 | @ApiModelProperty(value = "标准合同是否审核完成(AUDIT:审核中,PASS:审核通过,REFUSE:已驳回,CANCEL:已取消)") |
| 152 | 154 | private String standardApproved; |
| 153 | 155 | |
| 156 | + private String standardApprovedName; | |
| 157 | + | |
| 154 | 158 | /** |
| 155 | 159 | * 是否展示审核按钮(非持久化字段) |
| 156 | 160 | */ | ... | ... |
| ... | ... | @@ -21,7 +21,9 @@ import com.lframework.starter.web.inner.service.system.SysDataDicItemService; |
| 21 | 21 | import com.lframework.starter.web.inner.service.system.SysDeptService; |
| 22 | 22 | import com.lframework.starter.web.inner.service.system.SysUserService; |
| 23 | 23 | import com.lframework.xingyun.basedata.entity.Customer; |
| 24 | +import com.lframework.xingyun.basedata.entity.Workshop; | |
| 24 | 25 | import com.lframework.xingyun.basedata.service.customer.CustomerService; |
| 26 | +import com.lframework.xingyun.basedata.service.workshop.WorkshopService; | |
| 25 | 27 | import com.lframework.xingyun.basedata.vo.customer.QueryCustomerVo; |
| 26 | 28 | import com.lframework.xingyun.sc.bo.contract.GetContractDistributorLineBo; |
| 27 | 29 | import com.lframework.xingyun.sc.bo.contract.GetContractDistributorStandardBo; |
| ... | ... | @@ -76,6 +78,8 @@ public class ContractDistributorStandardController extends DefaultBaseController |
| 76 | 78 | private GenerateCodeService generateCodeService; |
| 77 | 79 | @Autowired |
| 78 | 80 | private DicCityService dicCityService; |
| 81 | + @Autowired | |
| 82 | + private WorkshopService workshopService; | |
| 79 | 83 | |
| 80 | 84 | |
| 81 | 85 | public static final String SUPPLIER_DIC_CODE = "SUPPLIER"; // 所属单位/供方 |
| ... | ... | @@ -83,6 +87,7 @@ public class ContractDistributorStandardController extends DefaultBaseController |
| 83 | 87 | public static final String CONTRACT_PRODUCT_DIC_CODE = "CONTRACT_PRODUCT"; // 合同产品名称 |
| 84 | 88 | public static final String CONDITIONS_REQUIRED_DIC_CODE = "CONDITIONS_REQUIRED"; // 特别条款要求 |
| 85 | 89 | public static final String APPLICABLE_STANDARD_DIC_CODE = "APPLICABLE_STANDARD"; // 执行标准 |
| 90 | + public static final String AUDIT_STATUS_DIC_CODE = "AUDIT_STATUS"; // 审核状态 | |
| 86 | 91 | |
| 87 | 92 | /** |
| 88 | 93 | * 查询列表 |
| ... | ... | @@ -138,6 +143,10 @@ public class ContractDistributorStandardController extends DefaultBaseController |
| 138 | 143 | Map<String, Customer> customerMap = CollectionUtils.emptyIfNull(customerService.listByIds(buyerIdList)) |
| 139 | 144 | .stream() |
| 140 | 145 | .collect(Collectors.toMap(Customer::getId, Function.identity())); |
| 146 | + List<SysDataDicItem> sysDataDicItemList = sysDataDicItemService.findByDicCode(AUDIT_STATUS_DIC_CODE); | |
| 147 | + Map<String, String> auditCodeAndNameMap = CollectionUtils.emptyIfNull(sysDataDicItemList) | |
| 148 | + .stream() | |
| 149 | + .collect(Collectors.toMap(SysDataDicItem::getCode, SysDataDicItem::getName)); | |
| 141 | 150 | boList.forEach(bo -> { |
| 142 | 151 | if (bo == null) { |
| 143 | 152 | return; |
| ... | ... | @@ -164,6 +173,14 @@ public class ContractDistributorStandardController extends DefaultBaseController |
| 164 | 173 | bo.setDistrictName(dicCityDtoList.get(2).getName()); |
| 165 | 174 | } |
| 166 | 175 | } |
| 176 | + | |
| 177 | + if (StringUtils.isNotBlank(bo.getFormalApproved())) { | |
| 178 | + bo.setFormalApprovedName(auditCodeAndNameMap.get(bo.getFormalApproved())); | |
| 179 | + } | |
| 180 | + | |
| 181 | + if (StringUtils.isNotBlank(bo.getStandardApproved())) { | |
| 182 | + bo.setStandardApprovedName(auditCodeAndNameMap.get(bo.getStandardApproved())); | |
| 183 | + } | |
| 167 | 184 | }); |
| 168 | 185 | |
| 169 | 186 | boPageResult.setDatas(boList); |
| ... | ... | @@ -204,6 +221,8 @@ public class ContractDistributorStandardController extends DefaultBaseController |
| 204 | 221 | result.setSpecialTermsName(requiredDicItem == null ? "" : requiredDicItem.getName()); |
| 205 | 222 | SysDataDicItem standardDicItem = sysDataDicItemService.findByCode(APPLICABLE_STANDARD_DIC_CODE, result.getExecutionStandard()); |
| 206 | 223 | result.setExecutionStandardName(standardDicItem == null ? "" : standardDicItem.getName()); |
| 224 | + Workshop workshop = workshopService.findById(result.getWorkshopId()); | |
| 225 | + result.setWorkshopName(workshop == null ? "" : workshop.getName()); | |
| 207 | 226 | |
| 208 | 227 | List<DicCityDto> dicCityDtoList = dicCityService.getChainById(result.getDestination()); |
| 209 | 228 | if (CollectionUtils.isNotEmpty(dicCityDtoList) && dicCityDtoList.size() == 3) { |
| ... | ... | @@ -342,4 +361,48 @@ public class ContractDistributorStandardController extends DefaultBaseController |
| 342 | 361 | |
| 343 | 362 | return InvokeResultBuilder.success(); |
| 344 | 363 | } |
| 364 | + | |
| 365 | + /** | |
| 366 | + * 获取合同备注 | |
| 367 | + */ | |
| 368 | + @ApiOperation("获取合同备注") | |
| 369 | + @GetMapping("/getCustomerRemarks") | |
| 370 | + public InvokeResult<List<String>> getCustomerRemarks(@NotBlank(message = "客户信息不可为空") String customerId) { | |
| 371 | + Wrapper<ContractDistributorStandard> wrapper = Wrappers.lambdaQuery(ContractDistributorStandard.class) | |
| 372 | + .eq(ContractDistributorStandard::getBuyer, customerId) | |
| 373 | + .ne(ContractDistributorStandard::getStatus, "DELETED") | |
| 374 | + .isNotNull(ContractDistributorStandard::getRemarks) | |
| 375 | + .orderByDesc(ContractDistributorStandard::getCreateTime); | |
| 376 | + List<ContractDistributorStandard> contractDistributorStandardList = contractDistributorStandardService.list(wrapper); | |
| 377 | + if (CollectionUtils.isEmpty(contractDistributorStandardList)) { | |
| 378 | + return InvokeResultBuilder.success(new ArrayList<>(0)); | |
| 379 | + } | |
| 380 | + | |
| 381 | + List<String> remarksList = contractDistributorStandardList.stream() | |
| 382 | + .map(ContractDistributorStandard::getRemarks) | |
| 383 | + .filter(StringUtils::isNotEmpty) | |
| 384 | + .limit(3) // 限制前3个 | |
| 385 | + .collect(Collectors.toList()); | |
| 386 | + | |
| 387 | + return InvokeResultBuilder.success(remarksList); | |
| 388 | + } | |
| 389 | + | |
| 390 | + /** | |
| 391 | + * 获取具体质量要求 | |
| 392 | + */ | |
| 393 | + @ApiOperation("获取具体质量要求") | |
| 394 | + @GetMapping("/getCustomerSpecificQualityRequirements") | |
| 395 | + public InvokeResult<GetContractDistributorStandardBo> getCustomerSpecificQualityRequirements( | |
| 396 | + @RequestParam String customerId, @RequestParam List<String> productIdList) { | |
| 397 | + if (CollectionUtils.isEmpty(productIdList)) { | |
| 398 | + throw new DefaultClientException("产品信息不可为空"); | |
| 399 | + } | |
| 400 | + | |
| 401 | + ContractDistributorStandard contractDistributorStandard = contractDistributorStandardService.getCustomerSpecificQualityRequirements(customerId, productIdList); | |
| 402 | + if (contractDistributorStandard == null) { | |
| 403 | + return InvokeResultBuilder.success(new GetContractDistributorStandardBo()); | |
| 404 | + } | |
| 405 | + | |
| 406 | + return InvokeResultBuilder.success(new GetContractDistributorStandardBo(contractDistributorStandard)); | |
| 407 | + } | |
| 345 | 408 | } | ... | ... |
| ... | ... | @@ -116,6 +116,7 @@ public class ContractDistributorStandardServiceImpl extends |
| 116 | 116 | data.setDeptId(vo.getDeptId()); |
| 117 | 117 | data.setOrderDate(vo.getOrderDate()); |
| 118 | 118 | data.setUnit(vo.getUnit()); |
| 119 | + data.setWorkshopId(vo.getWorkshopId()); | |
| 119 | 120 | data.setTotalAmountCapital(vo.getTotalAmountCapital()); |
| 120 | 121 | data.setDepositInfo(vo.getDepositInfo()); |
| 121 | 122 | data.setPackagingRequirements(vo.getPackagingRequirements()); |
| ... | ... | @@ -173,6 +174,7 @@ public class ContractDistributorStandardServiceImpl extends |
| 173 | 174 | .set(ContractDistributorStandard::getBuyer, vo.getBuyer()) |
| 174 | 175 | .set(ContractDistributorStandard::getOrderDate, vo.getOrderDate()) |
| 175 | 176 | .set(ContractDistributorStandard::getUnit, vo.getUnit()) |
| 177 | + .set(ContractDistributorStandard::getWorkshopId, vo.getWorkshopId()) | |
| 176 | 178 | .set(ContractDistributorStandard::getTotalAmountCapital, vo.getTotalAmountCapital()) |
| 177 | 179 | .set(ContractDistributorStandard::getDepositInfo, vo.getDepositInfo()) |
| 178 | 180 | .set(ContractDistributorStandard::getPackagingRequirements, vo.getPackagingRequirements()) |
| ... | ... | @@ -392,6 +394,60 @@ public class ContractDistributorStandardServiceImpl extends |
| 392 | 394 | OpLogUtil.setExtra(vo); |
| 393 | 395 | } |
| 394 | 396 | |
| 397 | + @Override | |
| 398 | + public ContractDistributorStandard getCustomerSpecificQualityRequirements(String customerId, List<String> productIdList) { | |
| 399 | + if (StringUtils.isBlank(customerId) || CollectionUtils.isEmpty(productIdList)) { | |
| 400 | + return new ContractDistributorStandard(); | |
| 401 | + } | |
| 402 | + | |
| 403 | + List<ContractDistributorStandard> contractDistributorStandardList = getBaseMapper().getCustomerSpecificQualityRequirements(customerId, productIdList); | |
| 404 | + if (CollectionUtils.isEmpty(contractDistributorStandardList)) { | |
| 405 | + return new ContractDistributorStandard(); | |
| 406 | + } | |
| 407 | + | |
| 408 | + StringBuffer pieceWeightHeadBuffer = new StringBuffer(); | |
| 409 | + StringBuffer surfaceBuffer = new StringBuffer(); | |
| 410 | + StringBuffer toleranceBuffer = new StringBuffer(); | |
| 411 | + StringBuffer performanceBuffer = new StringBuffer(); | |
| 412 | + StringBuffer componentBuffer = new StringBuffer(); | |
| 413 | + StringBuffer packagingBuffer = new StringBuffer(); | |
| 414 | + | |
| 415 | + contractDistributorStandardList.forEach(contractDistributorStandard -> { | |
| 416 | + if (StringUtils.isNotBlank(contractDistributorStandard.getPieceWeightHead())) { | |
| 417 | + pieceWeightHeadBuffer.append(contractDistributorStandard.getPieceWeightHead()).append("\n"); | |
| 418 | + } | |
| 419 | + | |
| 420 | + if (StringUtils.isNotBlank(contractDistributorStandard.getSurface())) { | |
| 421 | + surfaceBuffer.append(contractDistributorStandard.getSurface()).append("\n"); | |
| 422 | + } | |
| 423 | + | |
| 424 | + if (StringUtils.isNotBlank(contractDistributorStandard.getTolerance())) { | |
| 425 | + toleranceBuffer.append(contractDistributorStandard.getTolerance()).append("\n"); | |
| 426 | + } | |
| 427 | + | |
| 428 | + if (StringUtils.isNotBlank(contractDistributorStandard.getPerformance())) { | |
| 429 | + performanceBuffer.append(contractDistributorStandard.getPerformance()).append("\n"); | |
| 430 | + } | |
| 431 | + | |
| 432 | + if (StringUtils.isNotBlank(contractDistributorStandard.getComponent())) { | |
| 433 | + componentBuffer.append(contractDistributorStandard.getComponent()).append("\n"); | |
| 434 | + } | |
| 435 | + | |
| 436 | + if (StringUtils.isNotBlank(contractDistributorStandard.getPackaging())) { | |
| 437 | + packagingBuffer.append(contractDistributorStandard.getPackaging()).append("\n"); | |
| 438 | + } | |
| 439 | + }); | |
| 440 | + | |
| 441 | + ContractDistributorStandard contractDistributorStandard = new ContractDistributorStandard(); | |
| 442 | + contractDistributorStandard.setPieceWeightHead(pieceWeightHeadBuffer.toString()); | |
| 443 | + contractDistributorStandard.setSurface(surfaceBuffer.toString()); | |
| 444 | + contractDistributorStandard.setTolerance(toleranceBuffer.toString()); | |
| 445 | + contractDistributorStandard.setPerformance(performanceBuffer.toString()); | |
| 446 | + contractDistributorStandard.setComponent(componentBuffer.toString()); | |
| 447 | + contractDistributorStandard.setPackaging(packagingBuffer.toString()); | |
| 448 | + return contractDistributorStandard; | |
| 449 | + } | |
| 450 | + | |
| 395 | 451 | @CacheEvict(value = ContractDistributorStandard.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") |
| 396 | 452 | @Override |
| 397 | 453 | public void cleanCacheByKey(Serializable key) { | ... | ... |
| ... | ... | @@ -21,4 +21,6 @@ public interface ContractDistributorStandardMapper extends BaseMapper<ContractDi |
| 21 | 21 | * @return |
| 22 | 22 | */ |
| 23 | 23 | List<ContractDistributorStandard> query(@Param("vo") QueryContractDistributorStandardVo vo); |
| 24 | + | |
| 25 | + List<ContractDistributorStandard> getCustomerSpecificQualityRequirements(@Param("customerId") String customerId, @Param("productIdList") List<String> productIdList); | |
| 24 | 26 | } | ... | ... |
| ... | ... | @@ -72,4 +72,13 @@ public interface ContractDistributorStandardService extends BaseMpService<Contra |
| 72 | 72 | |
| 73 | 73 | void deleteContract(String id); |
| 74 | 74 | |
| 75 | + /** | |
| 76 | + * 获取具体质量要求,多个数据拼接成一个 | |
| 77 | + * | |
| 78 | + * @param customerId | |
| 79 | + * @param productIdList | |
| 80 | + * @return | |
| 81 | + */ | |
| 82 | + ContractDistributorStandard getCustomerSpecificQualityRequirements(String customerId,List<String> productIdList); | |
| 83 | + | |
| 75 | 84 | } |
| \ No newline at end of file | ... | ... |
| ... | ... | @@ -68,6 +68,13 @@ public class CreateContractDistributorStandardVo implements BaseVo, Serializable |
| 68 | 68 | private String unit; |
| 69 | 69 | |
| 70 | 70 | /** |
| 71 | + * 生产厂 | |
| 72 | + */ | |
| 73 | + @ApiModelProperty(value = "生产厂") | |
| 74 | + @Length(message = "单位最多允许50个字符!") | |
| 75 | + private String workshopId; | |
| 76 | + | |
| 77 | + /** | |
| 71 | 78 | * 合计人民币金额(大写) |
| 72 | 79 | */ |
| 73 | 80 | @ApiModelProperty(value = "合计人民币金额(大写)", required = true) | ... | ... |
| ... | ... | @@ -67,5 +67,17 @@ public class QueryContractDistributorStandardVo extends PageVo implements BaseVo |
| 67 | 67 | |
| 68 | 68 | @ApiModelProperty("类型") |
| 69 | 69 | private String type; |
| 70 | + | |
| 71 | + /** | |
| 72 | + * 正式合同是否审核完成(AUDIT:审核中,PASS:审核通过,REFUSE:已驳回,CANCEL:已取消) | |
| 73 | + */ | |
| 74 | + @ApiModelProperty(value = "正式合同是否审核完成(AUDIT:审核中,PASS:审核通过,REFUSE:已驳回,CANCEL:已取消)") | |
| 75 | + private String formalApproved; | |
| 76 | + | |
| 77 | + /** | |
| 78 | + * 标准合同是否审核完成(AUDIT:审核中,PASS:审核通过,REFUSE:已驳回,CANCEL:已取消) | |
| 79 | + */ | |
| 80 | + @ApiModelProperty(value = "标准合同是否审核完成(AUDIT:审核中,PASS:审核通过,REFUSE:已驳回,CANCEL:已取消)") | |
| 81 | + private String standardApproved; | |
| 70 | 82 | } |
| 71 | 83 | ... | ... |
| ... | ... | @@ -71,6 +71,13 @@ public class UpdateContractDistributorStandardVo implements BaseVo, Serializable |
| 71 | 71 | private String unit; |
| 72 | 72 | |
| 73 | 73 | /** |
| 74 | + * 生产厂 | |
| 75 | + */ | |
| 76 | + @ApiModelProperty(value = "生产厂") | |
| 77 | + @Length(message = "单位最多允许50个字符!") | |
| 78 | + private String workshopId; | |
| 79 | + | |
| 80 | + /** | |
| 74 | 81 | * 合计人民币金额(大写) |
| 75 | 82 | */ |
| 76 | 83 | @ApiModelProperty(value = "合计人民币金额(大写)", required = true) | ... | ... |
| ... | ... | @@ -10,6 +10,7 @@ |
| 10 | 10 | <result column="dept_id" property="deptId"/> |
| 11 | 11 | <result column="order_date" property="orderDate"/> |
| 12 | 12 | <result column="unit" property="unit"/> |
| 13 | + <result column="workshop_id" property="workshopId"/> | |
| 13 | 14 | <result column="total_amount_capital" property="totalAmountCapital"/> |
| 14 | 15 | <result column="deposit_info" property="depositInfo"/> |
| 15 | 16 | <result column="packaging_requirements" property="packagingRequirements"/> |
| ... | ... | @@ -65,6 +66,7 @@ |
| 65 | 66 | tb.dept_id, |
| 66 | 67 | tb.order_date, |
| 67 | 68 | tb.unit, |
| 69 | + tb.workshop_id, | |
| 68 | 70 | tb.total_amount_capital, |
| 69 | 71 | tb.deposit_info, |
| 70 | 72 | tb.packaging_requirements, |
| ... | ... | @@ -145,6 +147,33 @@ |
| 145 | 147 | <if test="vo.type != null"> |
| 146 | 148 | AND tb.type = #{vo.type} |
| 147 | 149 | </if> |
| 150 | + <if test="vo.formalApproved != null"> | |
| 151 | + AND tb.formalApproved = #{vo.formalApproved} | |
| 152 | + </if> | |
| 153 | + <if test="vo.standardApproved != null"> | |
| 154 | + AND tb.standardApproved = #{vo.standardApproved} | |
| 155 | + </if> | |
| 148 | 156 | </where> |
| 157 | + order by tb.create_time desc | |
| 158 | + </select> | |
| 159 | + | |
| 160 | + <select id="getCustomerSpecificQualityRequirements" resultMap="ContractDistributorStandard"> | |
| 161 | + WITH LatestContracts AS (SELECT cdl.product_id, | |
| 162 | + cdl.contract_id, | |
| 163 | + cds.*, | |
| 164 | + ROW_NUMBER() OVER (PARTITION BY cdl.product_id ORDER BY cds.create_time DESC, cds.id DESC) as rn | |
| 165 | + FROM tbl_contract_distributor_line cdl | |
| 166 | + INNER JOIN tbl_contract_distributor_standard cds ON cdl.contract_id = cds.id | |
| 167 | + WHERE cds.STATUS != 'DELETED' | |
| 168 | + and cds.buyer = #{customerId} | |
| 169 | + and cdl.product_id IN | |
| 170 | + <foreach collection="productIdList" open="(" separator="," close=")" item="item"> | |
| 171 | + #{item} | |
| 172 | + </foreach> | |
| 173 | + ) | |
| 174 | + SELECT * | |
| 175 | + FROM LatestContracts | |
| 176 | + WHERE rn = 1 | |
| 177 | + ORDER BY create_time; | |
| 149 | 178 | </select> |
| 150 | 179 | </mapper> | ... | ... |