Showing
6 changed files
with
410 additions
and
58 deletions
| ... | ... | @@ -230,9 +230,9 @@ public class BaseDataOnlinePriceImportListener |
| 230 | 230 | } |
| 231 | 231 | BigDecimal normalized = decimal.stripTrailingZeros(); |
| 232 | 232 | int scale = Math.max(normalized.scale(), 0); |
| 233 | - if (scale > 4) { | |
| 233 | + if (scale > 2) { | |
| 234 | 234 | throw new DefaultClientException( |
| 235 | - "第" + rowIndex + "行“" + fieldName + "”最多允许4位小数"); | |
| 235 | + "第" + rowIndex + "行“" + fieldName + "”最多允许2位小数"); | |
| 236 | 236 | } |
| 237 | 237 | return decimal; |
| 238 | 238 | } | ... | ... |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/customer/CustomerCreditController.java
| ... | ... | @@ -501,6 +501,136 @@ public class CustomerCreditController extends DefaultBaseController { |
| 501 | 501 | } |
| 502 | 502 | |
| 503 | 503 | /** |
| 504 | + * 按筛选条件批量导出(按导入模板结构) | |
| 505 | + */ | |
| 506 | + @ApiOperation("按筛选条件批量导出") | |
| 507 | + @HasPermission({"customer-credit-manage:customer-credit-plan:export"}) | |
| 508 | + @GetMapping("/export/list") | |
| 509 | + public void exportByCondition(@Valid QueryCustomerCreditVo vo, HttpServletResponse response) throws IOException { | |
| 510 | + applyQueryPermission(vo); | |
| 511 | + | |
| 512 | + List<CustomerCredit> datas = customerCreditService.query(vo); | |
| 513 | + String fileName = "客户资信批量导出.xlsx"; | |
| 514 | + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); | |
| 515 | + String encoded = URLEncoder.encode(fileName, StandardCharsets.UTF_8.name()).replace("+", "%20"); | |
| 516 | + response.setHeader("Content-Disposition", | |
| 517 | + "attachment; filename=\"" + encoded + "\"; filename*=UTF-8''" + encoded); | |
| 518 | + | |
| 519 | + DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); | |
| 520 | + List<CustomerCreditBatchExportModel> models = new ArrayList<>(datas.size()); | |
| 521 | + int idx = 1; | |
| 522 | + for (CustomerCredit credit : datas) { | |
| 523 | + GetCustomerCreditBo bo = packCustomerCreditData(credit); | |
| 524 | + CustomerCreditBatchExportModel m = new CustomerCreditBatchExportModel(); | |
| 525 | + m.setSort(String.valueOf(idx++)); | |
| 526 | + m.setCode(bo.getSerialNumber()); | |
| 527 | + m.setDeptName(bo.getDeptName()); | |
| 528 | + m.setRegionName(bo.getRegionName()); | |
| 529 | + m.setCustomerShortName(bo.getCustomerShortName()); | |
| 530 | + m.setRegisterDateStr(bo.getRegisterDate() == null ? "" : bo.getRegisterDate().format(dateFormatter)); | |
| 531 | + m.setName(bo.getCompanyName()); | |
| 532 | + m.setEnterpriseType(convertEnterpriseType(bo.getEnterpriseType())); | |
| 533 | + m.setCompanyNature(bo.getCompanyNature()); | |
| 534 | + m.setCompanyAddress(bo.getCompanyAddress()); | |
| 535 | + m.setRegisteredCapital(bo.getRegisteredCapital()); | |
| 536 | + m.setBankAccount(bo.getBankAccount()); | |
| 537 | + m.setBankName(bo.getBankName()); | |
| 538 | + m.setTaxNumber(bo.getTaxNumber()); | |
| 539 | + m.setRegistrationTimeStr(bo.getRegistrationTime() == null ? "" : bo.getRegistrationTime().format(dateFormatter)); | |
| 540 | + m.setBusinessYears(bo.getBusinessYears()); | |
| 541 | + | |
| 542 | + CorePersonnel legal = null; | |
| 543 | + if (CollectionUtils.isNotEmpty(bo.getCorePersonnelList())) { | |
| 544 | + legal = bo.getCorePersonnelList().stream() | |
| 545 | + .filter(p -> "法定代表人".equals(p.getPosition())) | |
| 546 | + .findFirst() | |
| 547 | + .orElse(null); | |
| 548 | + } | |
| 549 | + if (legal != null) { | |
| 550 | + m.setUserName1(legal.getName()); | |
| 551 | + m.setAge1(legal.getAge()); | |
| 552 | + m.setSex1(legal.getSex()); | |
| 553 | + m.setNativePlace1(legal.getNativePlace()); | |
| 554 | + m.setAddress1(legal.getAddress()); | |
| 555 | + m.setMobile1(legal.getMobile()); | |
| 556 | + m.setPhone1(legal.getPhone()); | |
| 557 | + m.setEmail1(legal.getEmail()); | |
| 558 | + } | |
| 559 | + | |
| 560 | + m.setBusinessProperty(bo.getBusinessProperty()); | |
| 561 | + m.setBusinessScope(bo.getBusinessScope()); | |
| 562 | + m.setLandArea(bo.getLandArea()); | |
| 563 | + m.setStorageConditions(bo.getStorageConditions()); | |
| 564 | + m.setEmployeeCount(bo.getEmployeeCount()); | |
| 565 | + m.setEquipmentAttributes(bo.getEquipmentAttributes()); | |
| 566 | + m.setAssetEvaluation(bo.getAssetEvaluation()); | |
| 567 | + m.setLastYearSales(bo.getLastYearSales()); | |
| 568 | + m.setMonthlyAvgSales(bo.getMonthlyAvgSales()); | |
| 569 | + m.setInvoiceItemUnit(bo.getInvoiceItemUnit()); | |
| 570 | + m.setCertificationCertificate(bo.getCertificationCertificate()); | |
| 571 | + m.setProductMatch(bo.getProductMatch()); | |
| 572 | + m.setMajorCustomers(bo.getMajorCustomers()); | |
| 573 | + m.setMainProjects(bo.getMainProjects()); | |
| 574 | + m.setIndustryInvolved(bo.getIndustryInvolved()); | |
| 575 | + m.setIndustryExperience(bo.getIndustryExperience()); | |
| 576 | + m.setHasDispute(bo.getHasDispute()); | |
| 577 | + m.setCooperationStartDate( | |
| 578 | + StringUtil.isBlank(bo.getCooperationStartDate()) | |
| 579 | + ? "" | |
| 580 | + : bo.getCooperationStartDate()); | |
| 581 | + m.setMonthlyAvgVolume(bo.getMonthlyAvgVolume()); | |
| 582 | + m.setIsVerbalAgreement( | |
| 583 | + StringUtil.isBlank(bo.getIsVerbalAgreement()) | |
| 584 | + ? "" | |
| 585 | + : bo.getIsVerbalAgreement()); | |
| 586 | + m.setOtherAgreements(bo.getOtherAgreements()); | |
| 587 | + m.setHasLongTermContract( | |
| 588 | + StringUtil.isBlank(bo.getHasLongTermContract()) | |
| 589 | + ? "" | |
| 590 | + : bo.getHasLongTermContract()); | |
| 591 | + m.setContractType(bo.getContractType()); | |
| 592 | + m.setHasInterruption(bo.getHasInterruption()); | |
| 593 | + m.setSettlementPeriod(bo.getSettlementPeriod()); | |
| 594 | + m.setMaterialSupplyPlan(bo.getMaterialSupplyPlan()); | |
| 595 | + m.setSuggestedCategory( | |
| 596 | + StringUtil.isNotBlank(bo.getSuggestedCategory()) | |
| 597 | + ? bo.getSuggestedCategory() | |
| 598 | + : bo.getCompanySuggestedCategory()); | |
| 599 | + m.setCreditLimit( | |
| 600 | + StringUtil.isNotBlank(bo.getCreditLimit()) | |
| 601 | + ? bo.getCreditLimit() | |
| 602 | + : bo.getCompanyCreditLimit()); | |
| 603 | + m.setInvestigatorName(bo.getInvestigatorName()); | |
| 604 | + | |
| 605 | + models.add(m); | |
| 606 | + } | |
| 607 | + | |
| 608 | + try (OutputStream out = response.getOutputStream()) { | |
| 609 | + EasyExcel.write(out, CustomerCreditBatchExportModel.class) | |
| 610 | + .registerWriteHandler(new AutoColumnWidthHandler()) | |
| 611 | + .sheet("客户资信") | |
| 612 | + .doWrite(models); | |
| 613 | + } | |
| 614 | + } | |
| 615 | + | |
| 616 | + private static String convertEnterpriseType(String type) { | |
| 617 | + if (StringUtil.isBlank(type)) return ""; | |
| 618 | + switch (type) { | |
| 619 | + case "DEALER": | |
| 620 | + case "经销商": | |
| 621 | + return "经销商"; | |
| 622 | + case "TERMINAL": | |
| 623 | + case "终端": | |
| 624 | + return "终端"; | |
| 625 | + case "FOREIGN": | |
| 626 | + case "外贸": | |
| 627 | + return "外贸"; | |
| 628 | + default: | |
| 629 | + return type; | |
| 630 | + } | |
| 631 | + } | |
| 632 | + | |
| 633 | + /** | |
| 504 | 634 | * 定时任务:冻结 |
| 505 | 635 | */ |
| 506 | 636 | @Scheduled(cron = "0 0 0 31 3 ?") | ... | ... |
| 1 | +package com.lframework.xingyun.sc.excel.customerCredit; | |
| 2 | + | |
| 3 | +import com.alibaba.excel.annotation.ExcelProperty; | |
| 4 | +import com.lframework.starter.web.core.components.excel.ExcelModel; | |
| 5 | +import lombok.Data; | |
| 6 | + | |
| 7 | +@Data | |
| 8 | +public class CustomerCreditBatchExportModel implements ExcelModel { | |
| 9 | + | |
| 10 | + @ExcelProperty("序号") | |
| 11 | + private String sort; | |
| 12 | + | |
| 13 | + @ExcelProperty("*编号") | |
| 14 | + private String code; | |
| 15 | + | |
| 16 | + @ExcelProperty("*办事处") | |
| 17 | + private String deptName; | |
| 18 | + | |
| 19 | + @ExcelProperty("*区域") | |
| 20 | + private String regionName; | |
| 21 | + | |
| 22 | + @ExcelProperty("*简写名称") | |
| 23 | + private String customerShortName; | |
| 24 | + | |
| 25 | + @ExcelProperty("*登记日期") | |
| 26 | + private String registerDateStr; | |
| 27 | + | |
| 28 | + @ExcelProperty("*公司名称") | |
| 29 | + private String name; | |
| 30 | + | |
| 31 | + @ExcelProperty("*企业类型") | |
| 32 | + private String enterpriseType; | |
| 33 | + | |
| 34 | + @ExcelProperty("企业性质") | |
| 35 | + private String companyNature; | |
| 36 | + | |
| 37 | + @ExcelProperty("注册地址") | |
| 38 | + private String companyAddress; | |
| 39 | + | |
| 40 | + @ExcelProperty("注册资本") | |
| 41 | + private String registeredCapital; | |
| 42 | + | |
| 43 | + @ExcelProperty("账号") | |
| 44 | + private String bankAccount; | |
| 45 | + | |
| 46 | + @ExcelProperty("开户行") | |
| 47 | + private String bankName; | |
| 48 | + | |
| 49 | + @ExcelProperty("税号") | |
| 50 | + private String taxNumber; | |
| 51 | + | |
| 52 | + @ExcelProperty("注册时间") | |
| 53 | + private String registrationTimeStr; | |
| 54 | + | |
| 55 | + @ExcelProperty("经营年限") | |
| 56 | + private String businessYears; | |
| 57 | + | |
| 58 | + @ExcelProperty("姓名(法定代表人)") | |
| 59 | + private String userName1; | |
| 60 | + | |
| 61 | + @ExcelProperty("年龄(法定代表人)") | |
| 62 | + private String age1; | |
| 63 | + | |
| 64 | + @ExcelProperty("性别(法定代表人)") | |
| 65 | + private String sex1; | |
| 66 | + | |
| 67 | + @ExcelProperty("籍贯(法定代表人)") | |
| 68 | + private String nativePlace1; | |
| 69 | + | |
| 70 | + @ExcelProperty("现住址(法定代表人)") | |
| 71 | + private String address1; | |
| 72 | + | |
| 73 | + @ExcelProperty("手机(法定代表人)") | |
| 74 | + private String mobile1; | |
| 75 | + | |
| 76 | + @ExcelProperty("固定电话(法定代表人)") | |
| 77 | + private String phone1; | |
| 78 | + | |
| 79 | + @ExcelProperty("邮箱地址(法定代表人)") | |
| 80 | + private String email1; | |
| 81 | + | |
| 82 | + @ExcelProperty("经营场地属性") | |
| 83 | + private String businessProperty; | |
| 84 | + | |
| 85 | + @ExcelProperty("经营范围") | |
| 86 | + private String businessScope; | |
| 87 | + | |
| 88 | + @ExcelProperty("占地面积(平方米)") | |
| 89 | + private String landArea; | |
| 90 | + | |
| 91 | + @ExcelProperty("仓储条件") | |
| 92 | + private String storageConditions; | |
| 93 | + | |
| 94 | + @ExcelProperty("员工人数") | |
| 95 | + private String employeeCount; | |
| 96 | + | |
| 97 | + @ExcelProperty("设备属性") | |
| 98 | + private String equipmentAttributes; | |
| 99 | + | |
| 100 | + @ExcelProperty("资产评估") | |
| 101 | + private String assetEvaluation; | |
| 102 | + | |
| 103 | + @ExcelProperty("上年度销售额") | |
| 104 | + private String lastYearSales; | |
| 105 | + | |
| 106 | + @ExcelProperty("月均销量") | |
| 107 | + private String monthlyAvgSales; | |
| 108 | + | |
| 109 | + @ExcelProperty("销项发票所开品名与计量单位") | |
| 110 | + private String invoiceItemUnit; | |
| 111 | + | |
| 112 | + @ExcelProperty("认证证书") | |
| 113 | + private String certificationCertificate; | |
| 114 | + | |
| 115 | + @ExcelProperty("我司售于产品与经营范围是否匹配") | |
| 116 | + private String productMatch; | |
| 117 | + | |
| 118 | + @ExcelProperty("主要客户") | |
| 119 | + private String majorCustomers; | |
| 120 | + | |
| 121 | + @ExcelProperty("主营项目") | |
| 122 | + private String mainProjects; | |
| 123 | + | |
| 124 | + @ExcelProperty("从事行业") | |
| 125 | + private String industryInvolved; | |
| 126 | + | |
| 127 | + @ExcelProperty("在该行业中的经验") | |
| 128 | + private String industryExperience; | |
| 129 | + | |
| 130 | + @ExcelProperty("是否与其他企业有经济纠纷 违规信息 拖欠员工薪资等") | |
| 131 | + private String hasDispute; | |
| 132 | + | |
| 133 | + @ExcelProperty("与我司合作时间") | |
| 134 | + private String cooperationStartDate; | |
| 135 | + | |
| 136 | + @ExcelProperty("月均操作量") | |
| 137 | + private String monthlyAvgVolume; | |
| 138 | + | |
| 139 | + @ExcelProperty("是否口头协议操作") | |
| 140 | + private String isVerbalAgreement; | |
| 141 | + | |
| 142 | + @ExcelProperty("是否签订其他协议(列举)") | |
| 143 | + private String otherAgreements; | |
| 144 | + | |
| 145 | + @ExcelProperty("与我司操作是否签订长年合同") | |
| 146 | + private String hasLongTermContract; | |
| 147 | + | |
| 148 | + @ExcelProperty("合同类型") | |
| 149 | + private String contractType; | |
| 150 | + | |
| 151 | + @ExcelProperty("是否有过中断及中断原因") | |
| 152 | + private String hasInterruption; | |
| 153 | + | |
| 154 | + @ExcelProperty("*结算期限") | |
| 155 | + private String settlementPeriod; | |
| 156 | + | |
| 157 | + @ExcelProperty("加工操作方案") | |
| 158 | + private String materialSupplyPlan; | |
| 159 | + | |
| 160 | + @ExcelProperty("建议客户分类") | |
| 161 | + private String suggestedCategory; | |
| 162 | + | |
| 163 | + @ExcelProperty("*授信额度") | |
| 164 | + private String creditLimit; | |
| 165 | + | |
| 166 | + @ExcelProperty("调查人") | |
| 167 | + private String investigatorName; | |
| 168 | +} | ... | ... |
| ... | ... | @@ -103,6 +103,19 @@ public class ProcurementDomesticCustomerCreditController extends DefaultBaseCont |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
| 106 | + * 提交审核 | |
| 107 | + */ | |
| 108 | + @ApiOperation("提交审核") | |
| 109 | + @HasPermission({"procure-manage:domestic-trade:submit"}) | |
| 110 | + @GetMapping("/submit") | |
| 111 | + public InvokeResult<Void> submit(@NotBlank(message = "id不能为空!") String id) { | |
| 112 | + | |
| 113 | + procurementDomesticCustomerCreditService.submit(id); | |
| 114 | + | |
| 115 | + return InvokeResultBuilder.success(); | |
| 116 | + } | |
| 117 | + | |
| 118 | + /** | |
| 106 | 119 | * 取消 |
| 107 | 120 | */ |
| 108 | 121 | @ApiOperation("取消") | ... | ... |
| ... | ... | @@ -165,39 +165,38 @@ public class ProcurementDomesticCustomerCreditServiceImpl |
| 165 | 165 | data.setPurchaseDepartment(vo.getPurchaseDepartment()); |
| 166 | 166 | data.setRegion(vo.getRegion()); |
| 167 | 167 | data.setReviewValidUntil(vo.getReviewValidUntil()); |
| 168 | - data.setStatus("AUDIT"); | |
| 169 | 168 | data.setFreeze(Boolean.FALSE); |
| 170 | 169 | |
| 171 | 170 | getBaseMapper().insert(data); |
| 172 | 171 | |
| 173 | - //开启审核 | |
| 174 | - ProcurementDomesticCustomerCredit customerCredit = getBaseMapper().findById(data.getId()); | |
| 175 | - List<SysRole> sysRoleList = sysRoleService.getByUserId(SecurityUtil.getCurrentUser().getId()); | |
| 176 | - String roleCode = null; | |
| 177 | - if (CollectionUtil.isNotEmpty(sysRoleList)) { | |
| 178 | - // 1. 提取角色列表中的所有 code,转换为 Set 集合,提升后续判断效率 | |
| 179 | - Set<String> roleCodeSet = sysRoleList.stream() | |
| 180 | - .map(SysRole::getCode) | |
| 181 | - .collect(Collectors.toSet()); | |
| 182 | - | |
| 183 | - // 2. 判断是否包含采购主管相关的角色 | |
| 184 | - if (roleCodeSet.contains("htcgeczg") || roleCodeSet.contains("htcgyczg") | |
| 185 | - || roleCodeSet.contains("ltcgczg") || roleCodeSet.contains("ztcgczg")) { | |
| 186 | - roleCode = "cgczg"; | |
| 187 | - } else if (roleCodeSet.contains("qyjl")) { | |
| 188 | - // 3. 如果没有,继续判断是否包含区域经理 | |
| 189 | - roleCode = "qyjl"; | |
| 190 | - } else if (roleCodeSet.contains("nmcgkywy")) { | |
| 191 | - // 4. 如果还没有,继续判断是否包含内贸采购科业务员 | |
| 192 | - roleCode = "nmcgkywy"; | |
| 193 | - } else { | |
| 194 | - throw new DefaultClientException("当前角色无法发起审核!"); | |
| 195 | - } | |
| 196 | - } else { | |
| 197 | - throw new DefaultClientException("当前角色无法发起审核!"); | |
| 198 | - } | |
| 199 | - customerCredit.setRoleCode(roleCode); | |
| 200 | - flowInstanceWrapperService.startInstance(BPM_FLAG, data.getId(), BPM_FLAG, customerCredit); | |
| 172 | +// //开启审核 | |
| 173 | +// ProcurementDomesticCustomerCredit customerCredit = getBaseMapper().findById(data.getId()); | |
| 174 | +// List<SysRole> sysRoleList = sysRoleService.getByUserId(SecurityUtil.getCurrentUser().getId()); | |
| 175 | +// String roleCode = null; | |
| 176 | +// if (CollectionUtil.isNotEmpty(sysRoleList)) { | |
| 177 | +// // 1. 提取角色列表中的所有 code,转换为 Set 集合,提升后续判断效率 | |
| 178 | +// Set<String> roleCodeSet = sysRoleList.stream() | |
| 179 | +// .map(SysRole::getCode) | |
| 180 | +// .collect(Collectors.toSet()); | |
| 181 | +// | |
| 182 | +// // 2. 判断是否包含采购主管相关的角色 | |
| 183 | +// if (roleCodeSet.contains("htcgeczg") || roleCodeSet.contains("htcgyczg") | |
| 184 | +// || roleCodeSet.contains("ltcgczg") || roleCodeSet.contains("ztcgczg")) { | |
| 185 | +// roleCode = "cgczg"; | |
| 186 | +// } else if (roleCodeSet.contains("qyjl")) { | |
| 187 | +// // 3. 如果没有,继续判断是否包含区域经理 | |
| 188 | +// roleCode = "qyjl"; | |
| 189 | +// } else if (roleCodeSet.contains("nmcgkywy")) { | |
| 190 | +// // 4. 如果还没有,继续判断是否包含内贸采购科业务员 | |
| 191 | +// roleCode = "nmcgkywy"; | |
| 192 | +// } else { | |
| 193 | +// throw new DefaultClientException("当前角色无法发起审核!"); | |
| 194 | +// } | |
| 195 | +// } else { | |
| 196 | +// throw new DefaultClientException("当前角色无法发起审核!"); | |
| 197 | +// } | |
| 198 | +// customerCredit.setRoleCode(roleCode); | |
| 199 | +// flowInstanceWrapperService.startInstance(BPM_FLAG, data.getId(), BPM_FLAG, customerCredit); | |
| 201 | 200 | |
| 202 | 201 | OpLogUtil.setVariable("id", data.getId()); |
| 203 | 202 | OpLogUtil.setExtra(vo); |
| ... | ... | @@ -273,44 +272,44 @@ public class ProcurementDomesticCustomerCreditServiceImpl |
| 273 | 272 | data.setPurchaseDepartment(vo.getPurchaseDepartment()); |
| 274 | 273 | data.setRegion(vo.getRegion()); |
| 275 | 274 | data.setReviewValidUntil(vo.getReviewValidUntil()); |
| 276 | - data.setStatus("AUDIT"); | |
| 277 | 275 | |
| 278 | 276 | //变更-审核通过再更新入库 |
| 279 | 277 | if ("CHANGE".equals(vo.getType())) { |
| 278 | + data.setStatus("AUDIT"); | |
| 280 | 279 | String jsonString = JsonUtil.toJsonString(data); |
| 281 | 280 | //存入缓存 |
| 282 | 281 | redisHandler.set(data.getId(), jsonString); |
| 283 | - } else { | |
| 284 | - //编辑-直接更新入库 | |
| 285 | - getBaseMapper().updateById(data); | |
| 286 | - } | |
| 287 | - List<SysRole> sysRoleList = sysRoleService.getByUserId(SecurityUtil.getCurrentUser().getId()); | |
| 288 | - String roleCode = null; | |
| 289 | - if (CollectionUtil.isNotEmpty(sysRoleList)) { | |
| 290 | - // 1. 提取角色列表中的所有 code,转换为 Set 集合,提升后续判断效率 | |
| 291 | - Set<String> roleCodeSet = sysRoleList.stream() | |
| 292 | - .map(SysRole::getCode) | |
| 293 | - .collect(Collectors.toSet()); | |
| 294 | - | |
| 295 | - // 2. 判断是否包含采购主管相关的角色 | |
| 296 | - if (roleCodeSet.contains("htcgeczg") || roleCodeSet.contains("htcgyczg") | |
| 297 | - || roleCodeSet.contains("ltcgczg") || roleCodeSet.contains("ztcgczg")) { | |
| 298 | - roleCode = "cgczg"; | |
| 299 | - } else if (roleCodeSet.contains("qyjl")) { | |
| 300 | - // 3. 如果没有,继续判断是否包含区域经理 | |
| 301 | - roleCode = "qyjl"; | |
| 302 | - } else if (roleCodeSet.contains("nmcgkywy")) { | |
| 303 | - // 4. 如果还没有,继续判断是否包含内贸采购科业务员 | |
| 304 | - roleCode = "nmcgkywy"; | |
| 282 | + List<SysRole> sysRoleList = sysRoleService.getByUserId(SecurityUtil.getCurrentUser().getId()); | |
| 283 | + String roleCode = null; | |
| 284 | + if (CollectionUtil.isNotEmpty(sysRoleList)) { | |
| 285 | + // 1. 提取角色列表中的所有 code,转换为 Set 集合,提升后续判断效率 | |
| 286 | + Set<String> roleCodeSet = sysRoleList.stream() | |
| 287 | + .map(SysRole::getCode) | |
| 288 | + .collect(Collectors.toSet()); | |
| 289 | + | |
| 290 | + // 2. 判断是否包含采购主管相关的角色 | |
| 291 | + if (roleCodeSet.contains("htcgeczg") || roleCodeSet.contains("htcgyczg") | |
| 292 | + || roleCodeSet.contains("ltcgczg") || roleCodeSet.contains("ztcgczg")) { | |
| 293 | + roleCode = "cgczg"; | |
| 294 | + } else if (roleCodeSet.contains("qyjl")) { | |
| 295 | + // 3. 如果没有,继续判断是否包含区域经理 | |
| 296 | + roleCode = "qyjl"; | |
| 297 | + } else if (roleCodeSet.contains("nmcgkywy")) { | |
| 298 | + // 4. 如果还没有,继续判断是否包含内贸采购科业务员 | |
| 299 | + roleCode = "nmcgkywy"; | |
| 300 | + } else { | |
| 301 | + throw new DefaultClientException("当前角色无法发起审核!"); | |
| 302 | + } | |
| 305 | 303 | } else { |
| 306 | 304 | throw new DefaultClientException("当前角色无法发起审核!"); |
| 307 | 305 | } |
| 306 | + data.setRoleCode(roleCode); | |
| 307 | + //开启审核 | |
| 308 | + flowInstanceWrapperService.startInstance(BPM_FLAG, data.getId(), BPM_FLAG, data); | |
| 308 | 309 | } else { |
| 309 | - throw new DefaultClientException("当前角色无法发起审核!"); | |
| 310 | + //编辑-直接更新入库 | |
| 311 | + getBaseMapper().updateById(data); | |
| 310 | 312 | } |
| 311 | - data.setRoleCode(roleCode); | |
| 312 | - //开启审核 | |
| 313 | - flowInstanceWrapperService.startInstance(BPM_FLAG, data.getId(), BPM_FLAG, data); | |
| 314 | 313 | |
| 315 | 314 | OpLogUtil.setExtra(vo); |
| 316 | 315 | } |
| ... | ... | @@ -342,6 +341,43 @@ public class ProcurementDomesticCustomerCreditServiceImpl |
| 342 | 341 | OpLogUtil.setExtra(vo); |
| 343 | 342 | } |
| 344 | 343 | |
| 344 | + @OpLog(type = OtherOpLogType.class, name = "内贸资信提交审核,ID:{}", params = {"#id"}) | |
| 345 | + @Transactional(rollbackFor = Exception.class) | |
| 346 | + @Override | |
| 347 | + public void submit(String id) { | |
| 348 | + updateStatus(id, "AUDIT"); | |
| 349 | + //开启审核 | |
| 350 | + ProcurementDomesticCustomerCredit customerCredit = getBaseMapper().findById(id); | |
| 351 | + List<SysRole> sysRoleList = sysRoleService.getByUserId(SecurityUtil.getCurrentUser().getId()); | |
| 352 | + String roleCode = null; | |
| 353 | + if (CollectionUtil.isNotEmpty(sysRoleList)) { | |
| 354 | + // 1. 提取角色列表中的所有 code,转换为 Set 集合,提升后续判断效率 | |
| 355 | + Set<String> roleCodeSet = sysRoleList.stream() | |
| 356 | + .map(SysRole::getCode) | |
| 357 | + .collect(Collectors.toSet()); | |
| 358 | + | |
| 359 | + // 2. 判断是否包含采购主管相关的角色 | |
| 360 | + if (roleCodeSet.contains("htcgeczg") || roleCodeSet.contains("htcgyczg") | |
| 361 | + || roleCodeSet.contains("ltcgczg") || roleCodeSet.contains("ztcgczg")) { | |
| 362 | + roleCode = "cgczg"; | |
| 363 | + } else if (roleCodeSet.contains("qyjl")) { | |
| 364 | + // 3. 如果没有,继续判断是否包含区域经理 | |
| 365 | + roleCode = "qyjl"; | |
| 366 | + } else if (roleCodeSet.contains("nmcgkywy")) { | |
| 367 | + // 4. 如果还没有,继续判断是否包含内贸采购科业务员 | |
| 368 | + roleCode = "nmcgkywy"; | |
| 369 | + } else { | |
| 370 | + throw new DefaultClientException("当前角色无法发起审核!"); | |
| 371 | + } | |
| 372 | + } else { | |
| 373 | + throw new DefaultClientException("当前角色无法发起审核!"); | |
| 374 | + } | |
| 375 | + customerCredit.setRoleCode(roleCode); | |
| 376 | + flowInstanceWrapperService.startInstance(BPM_FLAG, id, BPM_FLAG, customerCredit); | |
| 377 | + | |
| 378 | + OpLogUtil.setExtra(customerCredit); | |
| 379 | + } | |
| 380 | + | |
| 345 | 381 | @Override |
| 346 | 382 | public void updateStatus(String id, String status) { |
| 347 | 383 | if (StringUtils.isBlank(id) || StringUtils.isBlank(status)) { | ... | ... |
| ... | ... | @@ -61,6 +61,11 @@ public interface ProcurementDomesticCustomerCreditService extends BaseMpService< |
| 61 | 61 | void changeReview(UpdateProcurementDomesticCustomerCreditVo vo); |
| 62 | 62 | |
| 63 | 63 | /** |
| 64 | + * 提交审核 | |
| 65 | + */ | |
| 66 | + void submit(String id); | |
| 67 | + | |
| 68 | + /** | |
| 64 | 69 | * 更新审核状态 |
| 65 | 70 | */ |
| 66 | 71 | void updateStatus(String id, String status); | ... | ... |