Commit 430c43766c963a85c7e0828ee8e29a6b4b315211

Authored by 房远帅
1 parent fa8f621a

采购计划:记录节点审核人

@@ -402,31 +402,31 @@ public class GetProcurementPlanBo extends BaseBo<ProcurementPlan> { @@ -402,31 +402,31 @@ public class GetProcurementPlanBo extends BaseBo<ProcurementPlan> {
402 /** 402 /**
403 * 总经理审核人(name) 403 * 总经理审核人(name)
404 */ 404 */
405 - @ApiModelProperty("总经理审核人") 405 + @ApiModelProperty("总经理")
406 private String generalManagerName; 406 private String generalManagerName;
407 407
408 /** 408 /**
409 * 营销分管审核人(name) 409 * 营销分管审核人(name)
410 */ 410 */
411 - @ApiModelProperty("营销分管审核人") 411 + @ApiModelProperty("营销分管")
412 private String marketingManagerName; 412 private String marketingManagerName;
413 413
414 /** 414 /**
415 * 供应部经理审核人(name) 415 * 供应部经理审核人(name)
416 */ 416 */
417 - @ApiModelProperty("供应部经理审核人") 417 + @ApiModelProperty("供应部主管")
418 private String supplyManagerName; 418 private String supplyManagerName;
419 419
420 /** 420 /**
421 * 管理科审核人(name) 421 * 管理科审核人(name)
422 */ 422 */
423 - @ApiModelProperty("管理科审核人") 423 + @ApiModelProperty("供应管理科主管")
424 private String managementDeptName; 424 private String managementDeptName;
425 425
426 /** 426 /**
427 * 采购处审核人(name) 427 * 采购处审核人(name)
428 */ 428 */
429 - @ApiModelProperty("采购处审核人") 429 + @ApiModelProperty("采购处主管")
430 private String purchaseDeptName; 430 private String purchaseDeptName;
431 431
432 /** 432 /**
@@ -409,7 +409,16 @@ public class ProcurementPlanController extends DefaultBaseController { @@ -409,7 +409,16 @@ public class ProcurementPlanController extends DefaultBaseController {
409 } 409 }
410 //制单人 410 //制单人
411 planDataMap.put("createBy", nvl(plan.getCreateBy())); 411 planDataMap.put("createBy", nvl(plan.getCreateBy()));
412 - 412 + //采购处主管
  413 + planDataMap.put("purchaseDeptName", nvl(plan.getPurchaseDeptName()));
  414 + //供应管理科主管
  415 + planDataMap.put("managementDeptName", nvl(plan.getManagementDeptName()));
  416 + //供应部主管
  417 + planDataMap.put("supplyManagerName", nvl(plan.getSupplyManagerName()));
  418 + //营销分管
  419 + planDataMap.put("marketingManagerName", nvl(plan.getMarketingManagerName()));
  420 + //总经理
  421 + planDataMap.put("generalManagerName", nvl(plan.getGeneralManagerName()));
413 processTemplateSheet(sheet1, planDataMap); 422 processTemplateSheet(sheet1, planDataMap);
414 423
415 // === Sheet2:买断操作申请单(仅当存在时填充)=== 424 // === Sheet2:买断操作申请单(仅当存在时填充)===
@@ -446,6 +455,16 @@ public class ProcurementPlanController extends DefaultBaseController { @@ -446,6 +455,16 @@ public class ProcurementPlanController extends DefaultBaseController {
446 buyoutDataMap.put("supplierName", nvl(buyoutApply.getSupplierName())); 455 buyoutDataMap.put("supplierName", nvl(buyoutApply.getSupplierName()));
447 buyoutDataMap.put("paintLoss", formatDecimal(buyoutApply.getPaintLoss())); 456 buyoutDataMap.put("paintLoss", formatDecimal(buyoutApply.getPaintLoss()));
448 buyoutDataMap.put("createBy", nvl(buyoutApply.getCreateBy())); 457 buyoutDataMap.put("createBy", nvl(buyoutApply.getCreateBy()));
  458 + //采购处主管
  459 + planDataMap.put("purchaseDeptName", nvl(plan.getPurchaseDeptName()));
  460 + //供应管理科主管
  461 + planDataMap.put("managementDeptName", nvl(plan.getManagementDeptName()));
  462 + //供应部主管
  463 + planDataMap.put("supplyManagerName", nvl(plan.getSupplyManagerName()));
  464 + //营销分管
  465 + planDataMap.put("marketingManagerName", nvl(plan.getMarketingManagerName()));
  466 + //总经理
  467 + planDataMap.put("generalManagerName", nvl(plan.getGeneralManagerName()));
449 468
450 processTemplateSheet(sheet2, buyoutDataMap); 469 processTemplateSheet(sheet2, buyoutDataMap);
451 } 470 }
@@ -32,6 +32,7 @@ import com.lframework.xingyun.basedata.entity.Workshop; @@ -32,6 +32,7 @@ import com.lframework.xingyun.basedata.entity.Workshop;
32 import com.lframework.xingyun.basedata.service.workshop.WorkshopService; 32 import com.lframework.xingyun.basedata.service.workshop.WorkshopService;
33 import com.lframework.xingyun.sc.bo.procurement.GetProcurementPlanBo; 33 import com.lframework.xingyun.sc.bo.procurement.GetProcurementPlanBo;
34 import com.lframework.xingyun.sc.enums.CustomerDevelopStatus; 34 import com.lframework.xingyun.sc.enums.CustomerDevelopStatus;
  35 +import com.lframework.xingyun.sc.procurement.dto.DomesticReviewerDto;
35 import com.lframework.xingyun.sc.procurement.entity.ProcurementPlan; 36 import com.lframework.xingyun.sc.procurement.entity.ProcurementPlan;
36 import com.lframework.xingyun.sc.procurement.entity.ProcurementPlanChange; 37 import com.lframework.xingyun.sc.procurement.entity.ProcurementPlanChange;
37 import com.lframework.xingyun.sc.procurement.entity.ProcurementPlanLine; 38 import com.lframework.xingyun.sc.procurement.entity.ProcurementPlanLine;
@@ -39,6 +40,7 @@ import com.lframework.xingyun.sc.procurement.mappers.plan.ProcurementPlanMapper; @@ -39,6 +40,7 @@ import com.lframework.xingyun.sc.procurement.mappers.plan.ProcurementPlanMapper;
39 import com.lframework.xingyun.sc.procurement.service.buyout.ProcurementBuyoutApplyService; 40 import com.lframework.xingyun.sc.procurement.service.buyout.ProcurementBuyoutApplyService;
40 import com.lframework.xingyun.sc.procurement.service.plan.ProcurementPlanLineService; 41 import com.lframework.xingyun.sc.procurement.service.plan.ProcurementPlanLineService;
41 import com.lframework.xingyun.sc.procurement.service.plan.ProcurementPlanService; 42 import com.lframework.xingyun.sc.procurement.service.plan.ProcurementPlanService;
  43 +import com.lframework.xingyun.sc.procurement.service.quotation.SalesmanQuotationService;
42 import com.lframework.xingyun.sc.procurement.vo.buyout.CreateProcurementBuyoutApplyVo; 44 import com.lframework.xingyun.sc.procurement.vo.buyout.CreateProcurementBuyoutApplyVo;
43 import com.lframework.xingyun.sc.procurement.vo.plan.CreateProcurementPlanVo; 45 import com.lframework.xingyun.sc.procurement.vo.plan.CreateProcurementPlanVo;
44 import com.lframework.xingyun.sc.procurement.vo.plan.ProcurementPlanLineVo; 46 import com.lframework.xingyun.sc.procurement.vo.plan.ProcurementPlanLineVo;
@@ -77,6 +79,8 @@ public class ProcurementPlanServiceImpl extends BaseMpServiceImpl<ProcurementPla @@ -77,6 +79,8 @@ public class ProcurementPlanServiceImpl extends BaseMpServiceImpl<ProcurementPla
77 private FlowTaskWrapperMapper flowTaskWrapperMapper; 79 private FlowTaskWrapperMapper flowTaskWrapperMapper;
78 @Resource 80 @Resource
79 private SysRoleService sysRoleService; 81 private SysRoleService sysRoleService;
  82 + @Resource
  83 + private SalesmanQuotationService salesmanQuotationService;
80 84
81 @Override 85 @Override
82 public PageResult<ProcurementPlan> query(Integer pageIndex, Integer pageSize, 86 public PageResult<ProcurementPlan> query(Integer pageIndex, Integer pageSize,
@@ -186,7 +190,10 @@ public class ProcurementPlanServiceImpl extends BaseMpServiceImpl<ProcurementPla @@ -186,7 +190,10 @@ public class ProcurementPlanServiceImpl extends BaseMpServiceImpl<ProcurementPla
186 || roleCodes.contains("htcgeczg") || roleCodes.contains("htcgyczg")) { 190 || roleCodes.contains("htcgeczg") || roleCodes.contains("htcgyczg")) {
187 plan.setPurchaseDeptName(SecurityUtil.getCurrentUser().getName()); 191 plan.setPurchaseDeptName(SecurityUtil.getCurrentUser().getName());
188 } else if (roleCodes.contains("qyjl") || roleCodes.contains("nmcgkywy")) { 192 } else if (roleCodes.contains("qyjl") || roleCodes.contains("nmcgkywy")) {
189 - //todo 查找报价的 采购处主管审核人 193 + DomesticReviewerDto reviewer = salesmanQuotationService.getReviewerById(vo.getSalesmanQuotationId());
  194 + if (reviewer != null) {
  195 + plan.setPurchaseDeptName(reviewer.getProcurementOffice());
  196 + }
190 } 197 }
191 getBaseMapper().insert(plan); 198 getBaseMapper().insert(plan);
192 199
1 package com.lframework.xingyun.sc.procurement.impl.quotation; 1 package com.lframework.xingyun.sc.procurement.impl.quotation;
2 2
  3 +import cn.hutool.json.JSONArray;
  4 +import cn.hutool.json.JSONObject;
3 import com.baomidou.mybatisplus.core.conditions.Wrapper; 5 import com.baomidou.mybatisplus.core.conditions.Wrapper;
4 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 6 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
5 import com.baomidou.mybatisplus.core.toolkit.Wrappers; 7 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -17,10 +19,7 @@ import com.lframework.starter.web.core.annotations.oplog.OpLog; @@ -17,10 +19,7 @@ import com.lframework.starter.web.core.annotations.oplog.OpLog;
17 import com.lframework.starter.web.core.components.resp.PageResult; 19 import com.lframework.starter.web.core.components.resp.PageResult;
18 import com.lframework.starter.web.core.components.security.SecurityUtil; 20 import com.lframework.starter.web.core.components.security.SecurityUtil;
19 import com.lframework.starter.web.core.impl.BaseMpServiceImpl; 21 import com.lframework.starter.web.core.impl.BaseMpServiceImpl;
20 -import com.lframework.starter.web.core.utils.IdUtil;  
21 -import com.lframework.starter.web.core.utils.OpLogUtil;  
22 -import com.lframework.starter.web.core.utils.PageHelperUtil;  
23 -import com.lframework.starter.web.core.utils.PageResultUtil; 22 +import com.lframework.starter.web.core.utils.*;
24 import com.lframework.starter.web.inner.components.oplog.OtherOpLogType; 23 import com.lframework.starter.web.inner.components.oplog.OtherOpLogType;
25 import com.lframework.starter.web.inner.entity.SysRole; 24 import com.lframework.starter.web.inner.entity.SysRole;
26 import com.lframework.starter.web.inner.entity.SysUser; 25 import com.lframework.starter.web.inner.entity.SysUser;
@@ -33,6 +32,7 @@ import com.lframework.xingyun.basedata.service.breed.BreedRelationshipService; @@ -33,6 +32,7 @@ import com.lframework.xingyun.basedata.service.breed.BreedRelationshipService;
33 import com.lframework.xingyun.basedata.service.price.PriceService; 32 import com.lframework.xingyun.basedata.service.price.PriceService;
34 import com.lframework.xingyun.sc.enums.CustomerDevelopStatus; 33 import com.lframework.xingyun.sc.enums.CustomerDevelopStatus;
35 import com.lframework.xingyun.sc.events.quotation.CommonChangedEvent; 34 import com.lframework.xingyun.sc.events.quotation.CommonChangedEvent;
  35 +import com.lframework.xingyun.sc.procurement.dto.DomesticReviewerDto;
36 import com.lframework.xingyun.sc.procurement.entity.ProcurementDomesticCustomerCredit; 36 import com.lframework.xingyun.sc.procurement.entity.ProcurementDomesticCustomerCredit;
37 import com.lframework.xingyun.sc.procurement.entity.SalesmanQuotation; 37 import com.lframework.xingyun.sc.procurement.entity.SalesmanQuotation;
38 import com.lframework.xingyun.sc.procurement.entity.SalesmanQuotationLine; 38 import com.lframework.xingyun.sc.procurement.entity.SalesmanQuotationLine;
@@ -817,6 +817,97 @@ public class SalesmanQuotationServiceImpl @@ -817,6 +817,97 @@ public class SalesmanQuotationServiceImpl
817 getBaseMapper().update(null, updateWrapper); 817 getBaseMapper().update(null, updateWrapper);
818 } 818 }
819 819
  820 + @Override
  821 + public DomesticReviewerDto getReviewerById(String id) {
  822 + if (StringUtils.isBlank(id)) {
  823 + return new DomesticReviewerDto();
  824 + }
  825 + DomesticReviewerDto reviewer = new DomesticReviewerDto();
  826 + reviewer.setId(id);
  827 +
  828 + String defJson = getBaseMapper().getLatestFlowDefJson(id);
  829 + if (StringUtils.isBlank(defJson)) {
  830 + return reviewer;
  831 + }
  832 +
  833 + JSONObject flowJson = JsonUtil.parseObj(defJson);
  834 + Object nodeListObj = flowJson.get("nodeList");
  835 + if (ObjectUtil.isNull(nodeListObj)) {
  836 + return reviewer;
  837 + }
  838 +
  839 + JSONArray nodeList = JsonUtil.parseArray(nodeListObj);
  840 + for (Object nodeObj : nodeList) {
  841 + if (ObjectUtil.isNull(nodeObj)) {
  842 + continue;
  843 + }
  844 +
  845 + JSONObject nodeJson = JsonUtil.parseObj(nodeObj);
  846 + String nodeCode = nodeJson.getStr("nodeCode");
  847 + if (StringUtils.isBlank(nodeCode)) {
  848 + continue;
  849 + }
  850 +
  851 + String approverName = getFirstApproverName(nodeJson);
  852 + if (StringUtils.isBlank(approverName)) {
  853 + continue;
  854 + }
  855 +
  856 + if (isProcurementOfficeNode(nodeCode)) {
  857 + reviewer.setProcurementOffice(approverName);
  858 + }
  859 + }
  860 + return reviewer;
  861 + }
  862 +
  863 + /**
  864 + * 获取节点首个审批人名称
  865 + *
  866 + * @param nodeJson 流程节点JSON
  867 + * @return 审批人名称
  868 + */
  869 + private String getFirstApproverName(JSONObject nodeJson) {
  870 + if (nodeJson == null) {
  871 + return null;
  872 + }
  873 +
  874 + JSONObject extMap = nodeJson.getJSONObject("extMap");
  875 + if (extMap == null) {
  876 + return null;
  877 + }
  878 +
  879 + Object handleInfosObj = extMap.get("handleInfos");
  880 + if (ObjectUtil.isNull(handleInfosObj)) {
  881 + return null;
  882 + }
  883 +
  884 + JSONArray handleInfos = JsonUtil.parseArray(handleInfosObj);
  885 + if (handleInfos.isEmpty()) {
  886 + return null;
  887 + }
  888 +
  889 + JSONObject firstHandleInfo = JsonUtil.parseObj(handleInfos.get(0));
  890 + return firstHandleInfo.getStr("createBy");
  891 + }
  892 +
  893 +
  894 + /**
  895 + * 判断是否为采购处主管节点
  896 + *
  897 + * @param nodeCode 节点编码
  898 + * @return 是否为采购处主管节点
  899 + */
  900 + private boolean isProcurementOfficeNode(String nodeCode) {
  901 + return "b5e75530-1ba4-4c4d-8126-794cb26c8d97".equals(nodeCode)
  902 + || "f23419c3-d140-4599-a292-ef36c9f4b0c5".equals(nodeCode)
  903 + || "632f5695-bc77-48d0-a762-1f3f15db7462".equals(nodeCode)
  904 + || "325626ed-2b6d-4ac3-a325-5c1a0541a5fa".equals(nodeCode)
  905 + || "92586737-0498-445d-8c64-709ac4dfe076".equals(nodeCode)
  906 + || "f5e7c291-80d4-4789-95f3-8dea295c8cb9".equals(nodeCode)
  907 + || "47d3801f-d914-4835-a8cb-8ca328a24d85".equals(nodeCode)
  908 + || "dfc6af29-264e-4f55-93ad-26015de82560".equals(nodeCode);
  909 + }
  910 +
820 /** 911 /**
821 * 生成编号 912 * 生成编号
822 * 913 *
@@ -40,4 +40,9 @@ public interface SalesmanQuotationMapper extends BaseMapper<SalesmanQuotation> { @@ -40,4 +40,9 @@ public interface SalesmanQuotationMapper extends BaseMapper<SalesmanQuotation> {
40 * @return 最大编号 40 * @return 最大编号
41 */ 41 */
42 String getMaxCodeByMonth(@Param("monthPrefix") String monthPrefix); 42 String getMaxCodeByMonth(@Param("monthPrefix") String monthPrefix);
  43 +
  44 + /**
  45 + * 查询最新流程定义JSON
  46 + */
  47 + String getLatestFlowDefJson(@Param("id") String id);
43 } 48 }
@@ -2,6 +2,7 @@ package com.lframework.xingyun.sc.procurement.service.quotation; @@ -2,6 +2,7 @@ package com.lframework.xingyun.sc.procurement.service.quotation;
2 2
3 import com.lframework.starter.web.core.components.resp.PageResult; 3 import com.lframework.starter.web.core.components.resp.PageResult;
4 import com.lframework.starter.web.core.service.BaseMpService; 4 import com.lframework.starter.web.core.service.BaseMpService;
  5 +import com.lframework.xingyun.sc.procurement.dto.DomesticReviewerDto;
5 import com.lframework.xingyun.sc.procurement.entity.SalesmanQuotation; 6 import com.lframework.xingyun.sc.procurement.entity.SalesmanQuotation;
6 import com.lframework.xingyun.sc.procurement.vo.quotation.CreateSalesmanQuotationVo; 7 import com.lframework.xingyun.sc.procurement.vo.quotation.CreateSalesmanQuotationVo;
7 import com.lframework.xingyun.sc.procurement.vo.quotation.QuerySalesmanQuotationVo; 8 import com.lframework.xingyun.sc.procurement.vo.quotation.QuerySalesmanQuotationVo;
@@ -89,4 +90,9 @@ public interface SalesmanQuotationService extends BaseMpService<SalesmanQuotatio @@ -89,4 +90,9 @@ public interface SalesmanQuotationService extends BaseMpService<SalesmanQuotatio
89 * @param id 报价主键 90 * @param id 报价主键
90 */ 91 */
91 void createPlan(String id); 92 void createPlan(String id);
  93 +
  94 + /**
  95 + * 获取审核人
  96 + */
  97 + DomesticReviewerDto getReviewerById(String id);
92 } 98 }
@@ -169,4 +169,12 @@ @@ -169,4 +169,12 @@
169 ORDER BY CAST(RIGHT(tb.code, 4) AS UNSIGNED) DESC 169 ORDER BY CAST(RIGHT(tb.code, 4) AS UNSIGNED) DESC
170 LIMIT 1 170 LIMIT 1
171 </select> 171 </select>
  172 +
  173 + <select id="getLatestFlowDefJson" resultType="java.lang.String">
  174 + SELECT def_json
  175 + FROM flow_instance
  176 + WHERE business_id = #{id}
  177 + ORDER BY create_time DESC
  178 + LIMIT 1
  179 + </select>
172 </mapper> 180 </mapper>