Showing
5 changed files
with
105 additions
and
0 deletions
xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/contract/GetContractDistributorStandardBo.java
| @@ -479,6 +479,19 @@ public class GetContractDistributorStandardBo extends BaseBo<ContractDistributor | @@ -479,6 +479,19 @@ public class GetContractDistributorStandardBo extends BaseBo<ContractDistributor | ||
| 479 | @ApiModelProperty(value = "是否可拆分") | 479 | @ApiModelProperty(value = "是否可拆分") |
| 480 | private Boolean canSplit; | 480 | private Boolean canSplit; |
| 481 | 481 | ||
| 482 | + /** | ||
| 483 | + * 创建人 | ||
| 484 | + */ | ||
| 485 | + @ApiModelProperty(value = "创建人") | ||
| 486 | + private String createBy; | ||
| 487 | + | ||
| 488 | + /** | ||
| 489 | + * 创建人ID | ||
| 490 | + */ | ||
| 491 | + @ApiModelProperty(value = "创建人ID") | ||
| 492 | + private String createById; | ||
| 493 | + | ||
| 494 | + | ||
| 482 | public GetContractDistributorStandardBo() { | 495 | public GetContractDistributorStandardBo() { |
| 483 | 496 | ||
| 484 | } | 497 | } |
| @@ -36,6 +36,7 @@ import com.lframework.xingyun.sc.service.contract.ContractDistributorLineService | @@ -36,6 +36,7 @@ import com.lframework.xingyun.sc.service.contract.ContractDistributorLineService | ||
| 36 | import com.lframework.xingyun.sc.service.contract.ContractDistributorStandardService; | 36 | import com.lframework.xingyun.sc.service.contract.ContractDistributorStandardService; |
| 37 | import com.lframework.xingyun.sc.service.contract.ContractFrameworkService; | 37 | import com.lframework.xingyun.sc.service.contract.ContractFrameworkService; |
| 38 | import com.lframework.xingyun.sc.service.contract.ContractStdProcessingLineService; | 38 | import com.lframework.xingyun.sc.service.contract.ContractStdProcessingLineService; |
| 39 | +import com.lframework.xingyun.sc.service.customer.CorePersonnelService; | ||
| 39 | import com.lframework.xingyun.sc.service.customer.CustomerCreditService; | 40 | import com.lframework.xingyun.sc.service.customer.CustomerCreditService; |
| 40 | import com.lframework.xingyun.sc.service.customer.CustomerDevelopPlanService; | 41 | import com.lframework.xingyun.sc.service.customer.CustomerDevelopPlanService; |
| 41 | import com.lframework.xingyun.sc.service.order.PurchaseOrderInfoService; | 42 | import com.lframework.xingyun.sc.service.order.PurchaseOrderInfoService; |
| @@ -45,6 +46,7 @@ import com.lframework.xingyun.sc.vo.contract.createVo.CreateContractDistributorS | @@ -45,6 +46,7 @@ import com.lframework.xingyun.sc.vo.contract.createVo.CreateContractDistributorS | ||
| 45 | import com.lframework.xingyun.sc.vo.contract.queryVo.QueryContractDistributorStandardVo; | 46 | import com.lframework.xingyun.sc.vo.contract.queryVo.QueryContractDistributorStandardVo; |
| 46 | import com.lframework.xingyun.sc.vo.contract.updateVo.UpdateContractDistributorStandardVo; | 47 | import com.lframework.xingyun.sc.vo.contract.updateVo.UpdateContractDistributorStandardVo; |
| 47 | import com.lframework.xingyun.sc.vo.customer.credit.QueryCustomerCreditVo; | 48 | import com.lframework.xingyun.sc.vo.customer.credit.QueryCustomerCreditVo; |
| 49 | +import com.lframework.xingyun.sc.vo.customer.credit.QueryCorePersonnelVo; | ||
| 48 | import com.lframework.xingyun.sc.vo.order.QueryPurchaseOrderInfoVo; | 50 | import com.lframework.xingyun.sc.vo.order.QueryPurchaseOrderInfoVo; |
| 49 | import io.swagger.annotations.Api; | 51 | import io.swagger.annotations.Api; |
| 50 | import io.swagger.annotations.ApiImplicitParam; | 52 | import io.swagger.annotations.ApiImplicitParam; |
| @@ -116,10 +118,13 @@ public class ContractDistributorStandardController extends DefaultBaseController | @@ -116,10 +118,13 @@ public class ContractDistributorStandardController extends DefaultBaseController | ||
| 116 | private PurchaseOrderInfoService purchaseOrderInfoService; | 118 | private PurchaseOrderInfoService purchaseOrderInfoService; |
| 117 | @Resource | 119 | @Resource |
| 118 | private CustomerCreditService customerCreditService; | 120 | private CustomerCreditService customerCreditService; |
| 121 | + @Resource | ||
| 122 | + private CorePersonnelService corePersonnelService; | ||
| 119 | 123 | ||
| 120 | 124 | ||
| 121 | public static final String SUPPLIER_DIC_CODE = "SUPPLIER"; // 所属单位/供方 | 125 | public static final String SUPPLIER_DIC_CODE = "SUPPLIER"; // 所属单位/供方 |
| 122 | public static final String UNIT_DIC_CODE = "UNIT"; // 单位 | 126 | public static final String UNIT_DIC_CODE = "UNIT"; // 单位 |
| 127 | + public static final String LANDLINE_DIC_CODE = "LANDLINE"; // 办事处固话 | ||
| 123 | public static final String CONTRACT_PRODUCT_DIC_CODE = "CONTRACT_PRODUCT"; // 合同产品名称 | 128 | public static final String CONTRACT_PRODUCT_DIC_CODE = "CONTRACT_PRODUCT"; // 合同产品名称 |
| 124 | public static final String CONDITIONS_REQUIRED_DIC_CODE = "CONDITIONS_REQUIRED"; // 特别条款要求 | 129 | public static final String CONDITIONS_REQUIRED_DIC_CODE = "CONDITIONS_REQUIRED"; // 特别条款要求 |
| 125 | public static final String APPLICABLE_STANDARD_DIC_CODE = "APPLICABLE_STANDARD"; // 执行标准 | 130 | public static final String APPLICABLE_STANDARD_DIC_CODE = "APPLICABLE_STANDARD"; // 执行标准 |
| @@ -1424,9 +1429,96 @@ public class ContractDistributorStandardController extends DefaultBaseController | @@ -1424,9 +1429,96 @@ public class ContractDistributorStandardController extends DefaultBaseController | ||
| 1424 | } else { | 1429 | } else { |
| 1425 | dataMap.put("remarks", ""); | 1430 | dataMap.put("remarks", ""); |
| 1426 | } | 1431 | } |
| 1432 | + SysUser createUser = StringUtils.isBlank(data.getCreateById()) ? null : sysUserService.findById(data.getCreateById()); | ||
| 1433 | + String creatorPhone = getUserContactPhone(createUser); | ||
| 1434 | + String officeLandline = getOfficeLandline(data.getDeptId()); | ||
| 1435 | + String legalRepresentative = ""; | ||
| 1436 | + if (CollectionUtils.isNotEmpty(query) && query.get(0) != null) { | ||
| 1437 | + QueryCorePersonnelVo corePersonnelVo = new QueryCorePersonnelVo(); | ||
| 1438 | + corePersonnelVo.setCreditId(query.get(0).getId()); | ||
| 1439 | + List<CorePersonnel> corePersonnelList = corePersonnelService.query(corePersonnelVo); | ||
| 1440 | + if (CollectionUtils.isNotEmpty(corePersonnelList)) { | ||
| 1441 | + legalRepresentative = corePersonnelList.stream() | ||
| 1442 | + .filter(item -> StringUtils.equals("法定代表人", item.getPosition())) | ||
| 1443 | + .map(CorePersonnel::getName) | ||
| 1444 | + .filter(StringUtils::isNotBlank) | ||
| 1445 | + .findFirst() | ||
| 1446 | + .orElse(""); | ||
| 1447 | + } | ||
| 1448 | + } | ||
| 1449 | + //委托代理人 | ||
| 1450 | + dataMap.put("createBy", data.getCreateBy() == null ? "" : data.getCreateBy()); | ||
| 1451 | + //电话及传真 | ||
| 1452 | + dataMap.put("phone", joinContactPhones(creatorPhone, officeLandline)); | ||
| 1453 | + //日期 | ||
| 1454 | + dataMap.put("orderDate", data.getOrderDate() == null ? "" : data.getOrderDate()); | ||
| 1455 | + //法定代表人 | ||
| 1456 | + dataMap.put("legalRepresentative", legalRepresentative); | ||
| 1427 | return dataMap; | 1457 | return dataMap; |
| 1428 | } | 1458 | } |
| 1429 | 1459 | ||
| 1460 | + private String getUserContactPhone(SysUser user) { | ||
| 1461 | + if (user == null) { | ||
| 1462 | + return ""; | ||
| 1463 | + } | ||
| 1464 | + | ||
| 1465 | + for (String methodName : Arrays.asList("getTelephone", "getPhone", "getMobile")) { | ||
| 1466 | + String value = invokeStringMethod(user, methodName); | ||
| 1467 | + if (StringUtils.isNotBlank(value)) { | ||
| 1468 | + return value; | ||
| 1469 | + } | ||
| 1470 | + } | ||
| 1471 | + return ""; | ||
| 1472 | + } | ||
| 1473 | + | ||
| 1474 | + private String getOfficeLandline(String deptId) { | ||
| 1475 | + String officeCode = resolveOfficeCode(deptId); | ||
| 1476 | + if (StringUtils.isBlank(officeCode)) { | ||
| 1477 | + return ""; | ||
| 1478 | + } | ||
| 1479 | + | ||
| 1480 | + SysDataDicItem landlineDicItem = sysDataDicItemService.findByCode(LANDLINE_DIC_CODE, officeCode); | ||
| 1481 | + return landlineDicItem == null || StringUtils.isBlank(landlineDicItem.getName()) ? "" : landlineDicItem.getName(); | ||
| 1482 | + } | ||
| 1483 | + | ||
| 1484 | + private String resolveOfficeCode(String deptId) { | ||
| 1485 | + if (StringUtils.isBlank(deptId)) { | ||
| 1486 | + return ""; | ||
| 1487 | + } | ||
| 1488 | + | ||
| 1489 | + Set<String> officeCodes = new HashSet<>(Arrays.asList("BF", "CZ", "DG", "FS", "NB", "SZ", "WM", "WZ", "ZT")); | ||
| 1490 | + SysDept current = sysDeptService.findById(deptId); | ||
| 1491 | + while (current != null) { | ||
| 1492 | + if (officeCodes.contains(current.getCode())) { | ||
| 1493 | + return current.getCode(); | ||
| 1494 | + } | ||
| 1495 | + if (StringUtils.isBlank(current.getParentId())) { | ||
| 1496 | + break; | ||
| 1497 | + } | ||
| 1498 | + current = sysDeptService.findById(current.getParentId()); | ||
| 1499 | + } | ||
| 1500 | + return ""; | ||
| 1501 | + } | ||
| 1502 | + | ||
| 1503 | + private String joinContactPhones(String creatorPhone, String officeLandline) { | ||
| 1504 | + if (StringUtils.isNotBlank(creatorPhone) && StringUtils.isNotBlank(officeLandline)) { | ||
| 1505 | + return creatorPhone + " " + officeLandline; | ||
| 1506 | + } | ||
| 1507 | + if (StringUtils.isNotBlank(creatorPhone)) { | ||
| 1508 | + return creatorPhone; | ||
| 1509 | + } | ||
| 1510 | + return StringUtils.defaultString(officeLandline); | ||
| 1511 | + } | ||
| 1512 | + | ||
| 1513 | + private String invokeStringMethod(Object target, String methodName) { | ||
| 1514 | + try { | ||
| 1515 | + Object value = target.getClass().getMethod(methodName).invoke(target); | ||
| 1516 | + return value instanceof String ? (String) value : ""; | ||
| 1517 | + } catch (Exception e) { | ||
| 1518 | + return ""; | ||
| 1519 | + } | ||
| 1520 | + } | ||
| 1521 | + | ||
| 1430 | private File convertExcelToPdf(File excelFile) throws IOException, InterruptedException { | 1522 | private File convertExcelToPdf(File excelFile) throws IOException, InterruptedException { |
| 1431 | if (!excelFile.exists()) { | 1523 | if (!excelFile.exists()) { |
| 1432 | throw new IllegalArgumentException("Excel 文件不存在: " + excelFile.getAbsolutePath()); | 1524 | throw new IllegalArgumentException("Excel 文件不存在: " + excelFile.getAbsolutePath()); |
No preview for this file type
No preview for this file type
No preview for this file type