Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -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