Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -2,9 +2,11 @@ package com.zt.plat.module.contractorder.api;
|
||||
|
||||
|
||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.module.contractorder.api.dto.contract.ContractRespDTO;
|
||||
import com.zt.plat.module.contractorder.api.dto.order.PurchaseOrderWithDetailsDTO;
|
||||
import com.zt.plat.module.contractorder.api.vo.contract.international.ContractRequest;
|
||||
import com.zt.plat.module.contractorder.api.vo.contract.international.IntContract;
|
||||
import com.zt.plat.module.contractorder.api.vo.contract.international.IntContractPageReq;
|
||||
import com.zt.plat.module.contractorder.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -39,6 +41,10 @@ public interface ContractApi {
|
||||
CommonResult<List<PurchaseOrderWithDetailsDTO>> getOrderByOrderIds(@RequestBody List<Long> ids);
|
||||
|
||||
@PostMapping(PREFIX + "/push")
|
||||
@Operation(summary = "国贸2.0系统创建合同调用")
|
||||
CommonResult<Boolean> push(@Valid @RequestBody ContractRequest reqVO) throws Exception;
|
||||
@Operation(summary = "国贸2.0系统推送合同")
|
||||
CommonResult<Boolean> push(@Valid @RequestBody IntContract reqVO) throws Exception;
|
||||
|
||||
@GetMapping(PREFIX + "/logistics/list/page")
|
||||
@Operation(summary = "国贸2.0系统合同分页查询")
|
||||
CommonResult<PageResult<IntContract>> logisticsListPage(IntContractPageReq pageReq);
|
||||
}
|
||||
|
||||
@@ -233,6 +233,9 @@ public class ContractRespDTO {
|
||||
@Schema(description = "合同分类(字典:SPLY_BSN_TP)")
|
||||
private String businessType;
|
||||
|
||||
@Schema(description = "代理方名称")
|
||||
private String agentName;
|
||||
|
||||
// 物料信息
|
||||
private List<DetailRespDTO> detail;
|
||||
|
||||
|
||||
@@ -233,9 +233,15 @@ public class ContractRespVO {
|
||||
@Schema(description = "ERP乙方公司名称")
|
||||
private String erpSalesCompanyName;
|
||||
|
||||
@Schema(description = "是否内部企业(字典:ERP_CTRT_YN)")
|
||||
private String isInternal;
|
||||
|
||||
@Schema(description = "合同分类(字典:SPLY_BSN_TP)")
|
||||
private String businessType;
|
||||
|
||||
@Schema(description = "代理方名称")
|
||||
private String agentName;
|
||||
|
||||
// 物料信息
|
||||
private List<DetailRespVO> detail;
|
||||
|
||||
|
||||
@@ -208,6 +208,9 @@ public class ContractSaveReqVO {
|
||||
@Schema(description = "合同分类(字典:SPLY_BSN_TP)")
|
||||
private String businessType;
|
||||
|
||||
@Schema(description = "代理方名称")
|
||||
private String agentName;
|
||||
|
||||
// 物料信息
|
||||
private List<DetailSaveReqVO> detail;
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.util.List;
|
||||
* 合同请求主实体
|
||||
*/
|
||||
@Data
|
||||
public class ContractRequest {
|
||||
public class IntContract {
|
||||
|
||||
// 基础信息
|
||||
@Schema(description = "操作标志")
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.zt.plat.module.contractorder.api.vo.contract.international;
|
||||
|
||||
import com.zt.plat.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class IntContractPageReq extends PageParam {
|
||||
@Schema(description = "合同编号")
|
||||
private String contractCode;
|
||||
@Schema(description = "合同名称")
|
||||
private String contractName;
|
||||
}
|
||||
@@ -8,6 +8,15 @@ import lombok.Getter;
|
||||
@Getter
|
||||
public enum DictEnum {
|
||||
|
||||
/** 供应链业务大类 */
|
||||
SPLY_BSN_TP_03BX("货物保险","03BX",null),
|
||||
SPLY_BSN_TP_11CC("货物保管仓储","11CC",null),
|
||||
SPLY_BSN_TP_10YS("货物运输","10YS",null),
|
||||
SPLY_BSN_TP_13HD("货运代理","13HD",null),
|
||||
SPLY_BSN_TP_ENTED("来料加工","ENTED",null),
|
||||
SPLY_BSN_TP_ENT("委托加工","ENT",null),
|
||||
SPLY_BSN_TP_PUR("采购","PUR",null),
|
||||
SPLY_BSN_TP_SALE("销售","SALE",null),
|
||||
/** 业务类型 */
|
||||
BSN_TP_3("物流合同","3",null),
|
||||
/** ERP合同类型编码 */
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
package com.zt.plat.module.contractorder.api;
|
||||
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import cn.hutool.json.JSONArray;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.zt.plat.module.contractorder.api.dto.contract.ContractRespDTO;
|
||||
import com.zt.plat.module.contractorder.api.dto.order.PrchOrdDtlDTO;
|
||||
import com.zt.plat.module.contractorder.api.dto.order.PurchaseOrderWithDetailsDTO;
|
||||
@@ -39,6 +42,7 @@ import java.lang.reflect.Field;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
@@ -147,7 +151,7 @@ public class ContractApiImpl implements ContractApi {
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public CommonResult<Boolean> push(@RequestBody ContractRequest reqVO) throws Exception {
|
||||
public CommonResult<Boolean> push(@RequestBody IntContract reqVO) throws Exception {
|
||||
|
||||
// 合同主信息表映射
|
||||
ContractMainDO contractMainDO = getcontractMainDO(reqVO);
|
||||
@@ -339,6 +343,128 @@ public class ContractApiImpl implements ContractApi {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<PageResult<IntContract>> logisticsListPage(IntContractPageReq pageReq) {
|
||||
|
||||
// 查询条件
|
||||
LambdaQueryWrapperX<ContractMainDO> queryWrapperX = new LambdaQueryWrapperX<>();
|
||||
// 合同类型
|
||||
queryWrapperX.in(
|
||||
ContractMainDO::getBusinessType,
|
||||
Arrays.asList(
|
||||
DictEnum.SPLY_BSN_TP_13HD.getCode(),
|
||||
DictEnum.SPLY_BSN_TP_10YS.getCode(),
|
||||
DictEnum.SPLY_BSN_TP_11CC.getCode(),
|
||||
DictEnum.SPLY_BSN_TP_03BX.getCode()
|
||||
)
|
||||
);
|
||||
// 合同编号
|
||||
queryWrapperX.likeIfPresent(ContractMainDO::getContractPaperNumber, pageReq.getContractCode());
|
||||
// 合同名称
|
||||
queryWrapperX.likeIfPresent(ContractMainDO::getContractName, pageReq.getContractName());
|
||||
|
||||
// 查询
|
||||
PageResult<ContractMainDO> pageResult = contractMainMapper.selectPage(pageReq, queryWrapperX);
|
||||
|
||||
// 返回数据
|
||||
PageResult<IntContract> result = new PageResult<>();
|
||||
List<IntContract> resultList = new ArrayList<>();
|
||||
// 设置返回数据
|
||||
result.setTotal(pageResult.getTotal());
|
||||
result.setList(resultList);
|
||||
|
||||
// 遍历查询结果,设置返回数据列表
|
||||
if (pageResult.getTotal() > 0) {
|
||||
pageResult.getList().forEach(contractMainDO -> {
|
||||
|
||||
// 合同ID
|
||||
Long mainDOId = contractMainDO.getId();
|
||||
|
||||
// 合同主信息
|
||||
List<ContractOtherFieldDO> mainFields = contractOtherFieldMapper.selectList(
|
||||
new LambdaQueryWrapperX<ContractOtherFieldDO>()
|
||||
.eq(ContractOtherFieldDO::getContractMainId, mainDOId)
|
||||
.isNull(ContractOtherFieldDO::getRelativityId)
|
||||
);
|
||||
JSONObject resultJson = new JSONObject();
|
||||
mainFields.forEach(field
|
||||
-> resultJson.putOnce(field.getFieldNumber(), field.getFieldValue()));
|
||||
|
||||
// 附件清单列表
|
||||
List<ContractOtherFormDO> attachForms = contractOtherFormMapper.selectList(
|
||||
new LambdaQueryWrapperX<ContractOtherFormDO>()
|
||||
.eq(ContractOtherFormDO::getContractMainId, mainDOId)
|
||||
.eq(ContractOtherFormDO::getFormNumber, "attachList")
|
||||
);
|
||||
if (attachForms != null && !attachForms.isEmpty()) {
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
attachForms.forEach(form -> {
|
||||
ContractOtherFieldDO fieldDO = contractOtherFieldMapper.selectOne(
|
||||
new LambdaQueryWrapperX<ContractOtherFieldDO>()
|
||||
.eq(ContractOtherFieldDO::getContractMainId, mainDOId)
|
||||
.eq(ContractOtherFieldDO::getRelativityId, form.getId())
|
||||
);
|
||||
if (fieldDO != null) {
|
||||
jsonArray.add(fieldDO.getFieldValue());
|
||||
}
|
||||
});
|
||||
if (!jsonArray.isEmpty()) {
|
||||
resultJson.putOnce("attachList", jsonArray);
|
||||
}
|
||||
}
|
||||
|
||||
// 客商信息
|
||||
resultJson.putOnce("partnerList", getQueryFieldJsonArray(mainDOId, "partnerList"));
|
||||
// 收发港/站点
|
||||
resultJson.putOnce("goodsSiteList", getQueryFieldJsonArray(mainDOId, "goodsSiteList"));
|
||||
// 货物装卸要求
|
||||
resultJson.putOnce("loadingRequirementsList", getQueryFieldJsonArray(mainDOId, "loadingRequirementsList"));
|
||||
// 收付款账号
|
||||
resultJson.putOnce("accountList", getQueryFieldJsonArray(mainDOId, "accountList"));
|
||||
// 费用明细
|
||||
resultJson.putOnce("freightList", getQueryFieldJsonArray(mainDOId, "freightList"));
|
||||
// 服务费用项目
|
||||
resultJson.putOnce("serviceFeeList", getQueryFieldJsonArray(mainDOId, "serviceFeeList"));
|
||||
// 仓库明细
|
||||
resultJson.putOnce("storgeList", getQueryFieldJsonArray(mainDOId, "storgeList"));
|
||||
// 接货地址
|
||||
resultJson.putOnce("receivingAddrList", getQueryFieldJsonArray(mainDOId, "receivingAddrList"));
|
||||
|
||||
// 添加到结果集
|
||||
resultList.add(resultJson.toBean(IntContract.class));
|
||||
});
|
||||
}
|
||||
|
||||
return success(result);
|
||||
}
|
||||
|
||||
private JSONArray getQueryFieldJsonArray(Long mainDOId, String fieldName) {
|
||||
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
List<ContractOtherFormDO> forms = contractOtherFormMapper.selectList(
|
||||
new LambdaQueryWrapperX<ContractOtherFormDO>()
|
||||
.eq(ContractOtherFormDO::getContractMainId, mainDOId)
|
||||
.eq(ContractOtherFormDO::getFormNumber, fieldName)
|
||||
);
|
||||
if (forms != null && !forms.isEmpty()) {
|
||||
forms.forEach(form -> {
|
||||
List<ContractOtherFieldDO> fieldDOs = contractOtherFieldMapper.selectList(
|
||||
new LambdaQueryWrapperX<ContractOtherFieldDO>()
|
||||
.eq(ContractOtherFieldDO::getContractMainId, mainDOId)
|
||||
.eq(ContractOtherFieldDO::getRelativityId, form.getId())
|
||||
);
|
||||
if (fieldDOs != null && !fieldDOs.isEmpty()) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
fieldDOs.forEach(field
|
||||
-> jsonObject.putOnce(field.getFieldNumber(), field.getFieldValue()));
|
||||
jsonArray.add(jsonObject);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return jsonArray.isEmpty() ? null : jsonArray;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<List<PurchaseOrderWithDetailsDTO>> getOrderByOrderIds(List<Long> ids) {
|
||||
if (ids == null || ids.isEmpty()) {
|
||||
@@ -370,7 +496,7 @@ public class ContractApiImpl implements ContractApi {
|
||||
return CommonResult.success(purchaseOrderDetails);
|
||||
}
|
||||
|
||||
private ContractMainDO getcontractMainDO(ContractRequest reqVO) {
|
||||
private ContractMainDO getcontractMainDO(IntContract reqVO) {
|
||||
|
||||
// 合同主信息表映射
|
||||
ContractMainDO contractMainDO = new ContractMainDO();
|
||||
@@ -430,8 +556,8 @@ public class ContractApiImpl implements ContractApi {
|
||||
// 本币履约保证金 默认值:NULL
|
||||
// 交易方式 默认值:先款后货
|
||||
contractMainDO.setHasPayable(DictEnum.HS_PYBL_TP_PRE_PAY.getCode());
|
||||
// 合同类型 默认值:物流合同
|
||||
contractMainDO.setContractType(DictEnum.BSN_TP_3.getCode());
|
||||
// 合同类型
|
||||
contractMainDO.setBusinessType(reqVO.getContractType());
|
||||
// 签署地 -> 签约地 (40-签约必填)
|
||||
contractMainDO.setSignPlace(reqVO.getSignSite());
|
||||
// 甲方公司编号(采购方) -> 账套代码
|
||||
|
||||
@@ -394,4 +394,9 @@ public class ContractMainDO extends BusinessBaseDO {
|
||||
*/
|
||||
@TableField("BSN_TP")
|
||||
private String businessType;
|
||||
/**
|
||||
* 代理方名称
|
||||
*/
|
||||
@TableField("AGT_NAME")
|
||||
private String agentName;
|
||||
}
|
||||
@@ -17,10 +17,11 @@ public interface ContractMainMapper extends BaseMapperX<ContractMainDO> {
|
||||
default PageResult<ContractMainDO> selectContractPage(ContractPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<ContractMainDO>()
|
||||
.likeIfPresent(ContractMainDO::getContractName, reqVO.getContractName())
|
||||
.eqIfPresent(ContractMainDO::getContractPaperNumber, reqVO.getContractPaperNumber())
|
||||
.likeIfPresent(ContractMainDO::getContractPaperNumber, reqVO.getContractPaperNumber())
|
||||
.eqIfPresent(ContractMainDO::getDirection, reqVO.getDirection())
|
||||
.betweenIfPresent(ContractMainDO::getSignDate, reqVO.getSignDate())
|
||||
.likeIfPresent(ContractMainDO::getPurchaseCompanyName, reqVO.getPurchaseCompanyName())
|
||||
.likeIfPresent(ContractMainDO::getSalesCompanyName, reqVO.getSalesCompanyName())
|
||||
.eqIfPresent(ContractMainDO::getBasicAmount, reqVO.getBasicAmount())
|
||||
.eqIfPresent(ContractMainDO::getStatus, reqVO.getStatus())
|
||||
.eqIfPresent(ContractMainDO::getBusinessType, reqVO.getBusinessType())
|
||||
|
||||
Reference in New Issue
Block a user