委托加工更新提交erp优化

This commit is contained in:
潘荣晟
2026-02-25 10:56:21 +08:00
parent 24c8734840
commit ecebf1d610
6 changed files with 50 additions and 9 deletions

View File

@@ -61,8 +61,8 @@ public enum DictEnum {
BSE_CTRT_STS_ARCHIVED("已归档","ARCHIVED","不允许任何操作"), BSE_CTRT_STS_ARCHIVED("已归档","ARCHIVED","不允许任何操作"),
BSE_CTRT_STS_TERMINATED("已完结","TERMINATED","只允许归档"), BSE_CTRT_STS_TERMINATED("已完结","TERMINATED","只允许归档"),
BSE_CTRT_STS_WAIT_AUDIT("待审核","WAIT_AUDIT",null), BSE_CTRT_STS_WAIT_AUDIT("待审核","WAIT_AUDIT",null),
BSE_CTRT_STS_VOID("已作废","VOID",null); BSE_CTRT_STS_VOID("已作废","VOID",null),
CONTRACT_PUSH_CODE("合同消息推送模版编码","CONTRACT_PUSH_CODE","合同消息推送模版编码");
DictEnum(String label, String code, String remark) { DictEnum(String label, String code, String remark) {
this.label = label; this.label = label;

View File

@@ -248,5 +248,14 @@ public class ContractController implements BusinessControllerMarker {
ContractRespVO contractRespVO = contractService.getNoPermission(id); ContractRespVO contractRespVO = contractService.getNoPermission(id);
return success(contractRespVO); return success(contractRespVO);
} }
//推送合同消息给对方
@GetMapping("/push-msg-by-id")
@Operation(summary = "推送合同消息")
@PreAuthorize("@ss.hasAnyPermissions({'base:contract:get','purchaseContract:detail'})")
public CommonResult<Boolean> pushMsgById(@RequestParam("id") Long id,@RequestParam("userId") Long userId) {
contractService.pushMsgById(id,userId);
return success(true);
}
} }

View File

@@ -7,12 +7,13 @@ import com.zt.plat.module.infra.api.businessfile.BusinessFileApi;
import com.zt.plat.module.infra.api.file.FileApi; import com.zt.plat.module.infra.api.file.FileApi;
import com.zt.plat.module.receivedeliver.api.bill.BillMainApi; import com.zt.plat.module.receivedeliver.api.bill.BillMainApi;
import com.zt.plat.module.system.api.dept.DeptApi; import com.zt.plat.module.system.api.dept.DeptApi;
import com.zt.plat.module.system.api.notify.NotifyMessageSendApi;
import com.zt.plat.module.system.api.sequence.SequenceApi; import com.zt.plat.module.system.api.sequence.SequenceApi;
import com.zt.plat.module.system.api.user.AdminUserApi; import com.zt.plat.module.system.api.user.AdminUserApi;
import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
@Configuration(value = "contractorderRpcConfiguration", proxyBeanMethods = false) @Configuration(value = "contractorderRpcConfiguration", proxyBeanMethods = false)
@EnableFeignClients(clients = {DeptApi.class, SequenceApi.class, BpmProcessInstanceApi.class, AdminUserApi.class, BpmTaskApi.class, BusinessFileApi.class, FileApi.class, BillMainApi.class, MaterialInfomationApi.class}) @EnableFeignClients(clients = {DeptApi.class, SequenceApi.class, BpmProcessInstanceApi.class, AdminUserApi.class, BpmTaskApi.class, BusinessFileApi.class, FileApi.class, BillMainApi.class, MaterialInfomationApi.class, NotifyMessageSendApi.class})
public class RpcConfiguration { public class RpcConfiguration {
} }

View File

@@ -267,4 +267,10 @@ public interface ContractService {
* @param relationContractVO 关联合同信息 * @param relationContractVO 关联合同信息
*/ */
void relationContract(RelationContractVO relationContractVO); void relationContract(RelationContractVO relationContractVO);
/**
* 推送消息
*
* @param id 合同id
*/
void pushMsgById(Long id,Long userId);
} }

View File

@@ -48,6 +48,8 @@ import com.zt.plat.module.erp.service.erp.ErpContractService;
import com.zt.plat.module.infra.api.file.FileApi; import com.zt.plat.module.infra.api.file.FileApi;
import com.zt.plat.module.infra.api.file.dto.FileRespDTO; import com.zt.plat.module.infra.api.file.dto.FileRespDTO;
import com.zt.plat.module.system.api.dept.DeptApi; import com.zt.plat.module.system.api.dept.DeptApi;
import com.zt.plat.module.system.api.notify.NotifyMessageSendApi;
import com.zt.plat.module.system.api.notify.dto.NotifySendSingleToUserReqDTO;
import com.zt.plat.module.system.api.user.AdminUserApi; import com.zt.plat.module.system.api.user.AdminUserApi;
import com.zt.plat.module.system.api.user.dto.AdminUserRespDTO; import com.zt.plat.module.system.api.user.dto.AdminUserRespDTO;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
@@ -130,6 +132,8 @@ public class ContractServiceImpl implements ContractService {
private AmountDismantleService amountDismantleService; private AmountDismantleService amountDismantleService;
@Resource @Resource
private DeptApi deptApi; private DeptApi deptApi;
@Resource
private NotifyMessageSendApi notifyMessageSendApi;
private static final Map<String, String> VALID_RELATIONS = new HashMap<>(); private static final Map<String, String> VALID_RELATIONS = new HashMap<>();
@@ -154,7 +158,7 @@ public class ContractServiceImpl implements ContractService {
throw exception(PARAMETER_ID_EMPTY); throw exception(PARAMETER_ID_EMPTY);
} }
ContractMainDO contractMainDO = contractMainMapper.selectById(pageReqVO.getId()); ContractMainDO contractMainDO = contractMainMapper.selectById(pageReqVO.getId());
if (contractMainDO == null){ if (contractMainDO == null) {
return PageResult.empty(); return PageResult.empty();
} }
String businessType = VALID_RELATIONS.getOrDefault(contractMainDO.getBusinessType(), null); String businessType = VALID_RELATIONS.getOrDefault(contractMainDO.getBusinessType(), null);
@@ -2219,30 +2223,50 @@ public class ContractServiceImpl implements ContractService {
updateWrapper.eq(ContractMainDO::getId, contractMainDO.getRelatedContractId()) updateWrapper.eq(ContractMainDO::getId, contractMainDO.getRelatedContractId())
.set(ContractMainDO::getRelatedContractId, null); // 强制设置为null .set(ContractMainDO::getRelatedContractId, null); // 强制设置为null
int update = contractMainMapper.update(updateWrapper); int update = contractMainMapper.update(updateWrapper);
log.info("解绑合同订单成功合同ID{},影响行数:{}", contractMainDO.getRelatedContractId(),update); log.info("解绑合同订单成功合同ID{},影响行数:{}", contractMainDO.getRelatedContractId(), update);
} }
contractMainDO.setRelatedContractId(relationContractVO.getRelationContractId()); contractMainDO.setRelatedContractId(relationContractVO.getRelationContractId());
contractMainMapper.updateById(contractMainDO);// 绑定合同订单 contractMainMapper.updateById(contractMainDO);// 绑定合同订单
ContractMainDO relationContract = contractMainMapper.selectById(relationContractVO.getRelationContractId()); ContractMainDO relationContract = contractMainMapper.selectById(relationContractVO.getRelationContractId());
if (relationContract != null) { if (relationContract != null) {
if (relationContract.getRelatedContractId()!=null) { if (relationContract.getRelatedContractId() != null) {
LambdaUpdateWrapper<ContractMainDO> updateWrapper = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<ContractMainDO> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(ContractMainDO::getId, relationContract.getId()) updateWrapper.eq(ContractMainDO::getId, relationContract.getId())
.set(ContractMainDO::getRelatedContractId, null); // 强制设置为null .set(ContractMainDO::getRelatedContractId, null); // 强制设置为null
int update = contractMainMapper.update(updateWrapper); int update = contractMainMapper.update(updateWrapper);
log.info("解绑合同订单成功合同ID{},影响行数:{}", relationContract.getId(),update); log.info("解绑合同订单成功合同ID{},影响行数:{}", relationContract.getId(), update);
} }
// 绑定合同订单 // 绑定合同订单
relationContract.setRelatedContractId(relationContractVO.getContractId()); relationContract.setRelatedContractId(relationContractVO.getContractId());
contractMainMapper.updateById(relationContract); contractMainMapper.updateById(relationContract);
log.info("绑定合同订单成功合同ID{}", relationContractVO.getRelationContractId()); log.info("绑定合同订单成功合同ID{}", relationContractVO.getRelationContractId());
}else { } else {
throw exception(CONTRACT_NOT_EXISTS); throw exception(CONTRACT_NOT_EXISTS);
} }
} }
/** @Override
public void pushMsgById(Long id,Long userId) {
ContractRespVO contractRespVO = get(id);
if (contractRespVO == null) {
throw exception(CONTRACT_NOT_EXISTS);
}
Map<String,Object > parms = new HashMap<>();
//放入合同编号,纸质合同编号,合同名称,甲方乙方
parms.put("系统合同编号",contractRespVO.getSystemContractNumber());
parms.put("纸质合同编号",contractRespVO.getSystemContractNumber());
parms.put("合同名称",contractRespVO.getSystemContractNumber());
parms.put("合同主体1",contractRespVO.getSystemContractNumber());
parms.put("合同主体2",contractRespVO.getSystemContractNumber());
NotifySendSingleToUserReqDTO notifySendSingleToUserReqDTO = new NotifySendSingleToUserReqDTO();
notifySendSingleToUserReqDTO.setTemplateCode(DictEnum.CONTRACT_PUSH_CODE.getCode());//消息模版编码
notifySendSingleToUserReqDTO.setUserId(userId);
notifySendSingleToUserReqDTO.setTemplateParams(parms);//放入模版消息
notifyMessageSendApi.sendSingleMessageToMember(notifySendSingleToUserReqDTO);
}
/**Object
* 校验合同内容 * 校验合同内容
* *
* @param contract 合同数据 * @param contract 合同数据

View File

@@ -402,6 +402,7 @@ public class PurchaseOrderServiceImpl implements PurchaseOrderService {
item.setVend_mat(TOKEN_.contentEquals(vendMat) ? null : vendMat.toString()); item.setVend_mat(TOKEN_.contentEquals(vendMat) ? null : vendMat.toString());
// 3.2 行项目扩展信息(Itex) // 3.2 行项目扩展信息(Itex)
ErpOrderSaveReqVO.Itex itex = new ErpOrderSaveReqVO.Itex(); ErpOrderSaveReqVO.Itex itex = new ErpOrderSaveReqVO.Itex();
itex.setPo_item(detail.getLineNum().intValue());
itex.setZmatnr(detail.getSaleMtrlNum()); // 销售物料号 -> 销售物料号 itex.setZmatnr(detail.getSaleMtrlNum()); // 销售物料号 -> 销售物料号
itex.setZaufnr(detail.getInOrd()); // 统计型内部订单 -> 统计型内部订单 itex.setZaufnr(detail.getInOrd()); // 统计型内部订单 -> 统计型内部订单
itex.setZpurty(detail.getPrchCtgr()); // 采购类别 -> 采购类别 itex.setZpurty(detail.getPrchCtgr()); // 采购类别 -> 采购类别