This commit is contained in:
张秉卓
2026-01-09 18:06:12 +08:00
13 changed files with 320 additions and 28 deletions

View File

@ -608,9 +608,7 @@ public class DataLogTools {
if(idValue2==null || idValue2 <=0) {
joinTable.setIdValue(item, IdWorker.getId());
}
System.out.println(" field:"+joinColumn.field());
System.out.println(" relatedField:"+joinColumn.relatedField());
System.out.println(" joinFieldValue:"+joinFieldValue);
joinTable.setFieldValue(item, joinColumn.relatedField(), joinFieldValue);
Set<Class<?>> joinClasses = SetUtils.ofCollection(classes);
initJoinValue(item,joinTable,joinClasses);

View File

@ -75,7 +75,7 @@ public class UpdateLngContractPurPngPointDto implements Serializable {
@ApiModelProperty("租户id")
private Long tenantId;
private Boolean hasDel;
private Boolean hasDel = false;
/**
* lngContractPurPngPoint

View File

@ -4,6 +4,11 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;
import com.xjrsoft.common.annotation.Trans;
import com.xjrsoft.common.enums.TransType;
import com.xjrsoft.module.system.vo.LngFileUploadVo;
/**
* @title: 表单出参
@ -98,6 +103,74 @@ public class LngContractApproRelVo {
private Long ruleUserId;
/**
* lngFileUpload
*/
@ApiModelProperty("lngFileUpload子表")
private List<LngFileUploadVo> lngFileUploadList;
/**
* 签报类型(DJ-定价方案/XB-询比价销售方案/XS-双边协商谈判销售方案/YY-应邀报价销售方案/JP-竞拍销售方案/SJ-商机)
*/
@ApiModelProperty("签报类型(DJ-定价方案/XB-询比价销售方案/XS-双边协商谈判销售方案/YY-应邀报价销售方案/JP-竞拍销售方案/SJ-商机)")
@Trans(type = TransType.DIC, id = "2001500486723887105", transToFieldName = "typeName")
private String typeCode;
/**
* 签报类型描述
*/
@ApiModelProperty("签报类型描述")
private String typeName;
/**
* 编号(自动生成)
*/
@ApiModelProperty("编号(自动生成)")
private String code;
/**
* 标题
*/
@ApiModelProperty("标题")
private String title;
/**
* 拟稿日期
*/
@ApiModelProperty("拟稿日期")
private LocalDateTime dateAppro;
/**
* 拟稿人(xjr_user.id)
*/
@ApiModelProperty("拟稿人(xjr_user.id)")
@Trans(type = TransType.USER, transToFieldName = "empName")
private Long empId;
/**
* 拟稿人名称
*/
@ApiModelProperty("拟稿人名称")
private String empName;
/**
* 业务部门(xjr_department.id)
*/
@ApiModelProperty("业务部门(xjr_department.id)")
@Trans(type = TransType.DEPT, transToFieldName = "bDeptName")
private Long bDeptId;
/**
* 业务部门名称
*/
@ApiModelProperty("业务部门名称")
private String bDeptName;

View File

@ -4,6 +4,12 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;
import com.pictc.annotations.datalog.LogAttrField;
import com.xjrsoft.common.annotation.Trans;
import com.xjrsoft.common.enums.TransType;
import com.xjrsoft.module.system.vo.LngFileUploadVo;
/**
* @title: 表单出参
@ -89,9 +95,63 @@ public class LngContractFactRelVo extends com.xjrsoft.common.model.base.BaseMode
*/
@ApiModelProperty("数据权限id")
private Long ruleUserId;
/**
* 合同号
*/
@ApiModelProperty("合同号")
private String kNo;
/**
* 合同名称
*/
@ApiModelProperty("合同名称")
private String kName;
/**
* 我方联系人ID
*/
@ApiModelProperty("我方联系人ID")
@Trans(type = TransType.USER, transToFieldName = "empName")
private Long empId;
private String empName;
private String cpName;
/**
* 合同主体
*/
@ApiModelProperty("合同主体")
@Trans(type = TransType.DEPT, transToFieldName = "comName")
private Long comId;
private String comName;
/**
* 业务部门
*/
/**
* 关联类别(M-主合同/U-合同变更/C-确认函/A-补充协议/F-框架协议/R-续签合同/I-同一事项关联合同;以下不要:无/原合同补充协议/原合同续签合同/同一事项关联合同)
*/
@Trans(type = TransType.DIC, id = "2003815292742479874", transToFieldName = "relTypeName")
private String relTypeCode;
private String relTypeName;
/**
* 业务类型
*/
@ApiModelProperty("合同类别(日常采购/工程建设/人力资源/投资管理/金融保险/租赁/信息管理/咨询服务/综合服务/生产运营/天然气公司业务合同)")
@Trans(type = TransType.DIC, id = "2003815931950215169", transToFieldName = "kTypeName1")
private String kTypeCode1;
private String kTypeName1;
/**
* 联系电话
*/
@ApiModelProperty("联系电话")
private String tel;
/**
* lngFileUpload
*/
@ApiModelProperty("lngFileUpload子表")
@LogAttrField
private List<LngFileUploadVo> lngFileUploadList;
}

View File

@ -42,6 +42,7 @@ public class LngContractPurPngPointSalesVo implements Serializable {
*/
@ApiModelProperty("上载点编码")
private String pointUpCode;
private String pointUpName;
/**
* 自主托运(Y-是N-否)
@ -55,6 +56,7 @@ public class LngContractPurPngPointSalesVo implements Serializable {
*/
@ApiModelProperty("交割点编码")
private String pointDelyCode;
private String pointDelyName;
/**
* 备注

View File

@ -3,6 +3,8 @@ package com.xjrsoft.module.contract.vo;
import java.time.LocalDateTime;
import java.util.List;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -34,6 +36,7 @@ public class LngContractPurPngPointVo extends com.xjrsoft.common.model.base.Base
*/
@ApiModelProperty("上载点编码")
private String pointUpCode;
private String pointUpName;
/**
@ -99,6 +102,9 @@ public class LngContractPurPngPointVo extends com.xjrsoft.common.model.base.Base
private Long ruleUserId;
private String pointDelyName;
/**
* lngContractPurPngPointSales
*/

View File

@ -4,6 +4,8 @@ import java.time.LocalDateTime;
import java.util.List;
import com.pictc.annotations.datalog.LogAttrField;
import com.xjrsoft.common.annotation.Trans;
import com.xjrsoft.common.enums.TransType;
import com.xjrsoft.module.system.vo.LngFileUploadVo;
import io.swagger.annotations.ApiModelProperty;
@ -29,8 +31,11 @@ public class LngContractPurVo extends com.xjrsoft.common.model.base.BaseModel{
* 合同主体ID(天然气公司/惠贸)
*/
@ApiModelProperty("合同主体ID(天然气公司/惠贸)")
@Trans(type = TransType.DEPT, transToFieldName = "comName")
private Long comId;
private String comName;
/**
* 合同号
@ -141,14 +146,18 @@ public class LngContractPurVo extends com.xjrsoft.common.model.base.BaseModel{
* 我方联系人
*/
@ApiModelProperty("我方联系人")
@Trans(type = TransType.USER, transToFieldName = "empName")
private Long empId;
private String empName;
/**
* 业务部门ID
*/
@ApiModelProperty("业务部门ID")
@Trans(type = TransType.DEPT, transToFieldName = "bDeptName")
private Long bDeptId;
private String bDeptName;
/**
@ -213,7 +222,7 @@ public class LngContractPurVo extends com.xjrsoft.common.model.base.BaseModel{
@ApiModelProperty("数据权限id")
private Long ruleUserId;
private String transName;
/**

View File

@ -1,6 +1,10 @@
package com.xjrsoft.module.contract.controller;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collector;
import java.util.stream.Collectors;
import javax.validation.Valid;
@ -26,8 +30,12 @@ import com.xjrsoft.common.model.result.R;
import com.xjrsoft.module.contract.dto.LngContractPageDto;
import com.xjrsoft.module.contract.dto.UpdateLngContractPurDto;
import com.xjrsoft.module.contract.dto.UpdateLngContractPurPngPointDto;
import com.xjrsoft.module.contract.dto.UpdateLngContractPurPngPointSalesDto;
import com.xjrsoft.module.contract.dto.UpdateLngContractSalesPngPointDto;
import com.xjrsoft.module.contract.service.IContractPurPngService;
import com.xjrsoft.module.contract.vo.LngContractPurPngPointSalesVo;
import com.xjrsoft.module.contract.vo.LngContractPurPngPointVo;
import com.xjrsoft.module.contract.vo.LngContractPurVo;
import com.xjrsoft.module.datalog.service.DatalogService;
import com.xjrsoft.module.datalog.vo.DataChangeLogVo;
@ -105,22 +113,61 @@ public class ContractPurPngController {
boolean res = dataService.updateById(dto, new DataOperationListener<UpdateLngContractPurDto>() {
@Override
public UpdateLngContractPurDto before(DataOperationContent<UpdateLngContractPurDto> content) {
List<UpdateLngContractPurPngPointDto> list = dto.getLngContractPurPngPointList();
LngContractPurVo old = contractPurPngService.getInfoById(dto.getId());
List<LngContractPurPngPointVo> oldPpList = old.getLngContractPurPngPointList();
List<Long> oldPpIdList = Lists.newArrayList();
List<Long> oldSalesIdList = Lists.newArrayList();
for(LngContractPurPngPointVo pp:oldPpList) {
oldPpIdList.add(pp.getId());
if(pp.getLngContractPurPngPointSalesList() != null) {
for(LngContractPurPngPointSalesVo sales:pp.getLngContractPurPngPointSalesList()) {
oldSalesIdList.add(sales.getId());
}
}
}
List<UpdateLngContractPurPngPointDto> list = dto.getLngContractPurPngPointList();
List<Long> newPpIdList = Lists.newArrayList();
List<Long> newSalesIdList = Lists.newArrayList();
for (UpdateLngContractPurPngPointDto dto : list) {
if (dto.getHasDel()) {
String sql = StringUtils.format("{? = call pc_{0}.f before_delete_point(?)}",
"pc_lng_contract_pur_png");
List<JdbcParam> params = Lists.newArrayList();
JdbcParam outParam = JdbcParam.ofString(null).setOut(true);
params.add(outParam);
params.add(JdbcParam.ofLong(dto.getId()));
JdbcTools.call(sql,params);
String error = outParam.getStringValue();
if (StringUtils.isNotEmpty(error)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_DELETE_EXEC_ERROR, error));
}
if(dto.getId() != null) {
newPpIdList.add(dto.getId());
}
if(dto.getLngContractPurPngPointSalesList() != null) {
for(UpdateLngContractPurPngPointSalesDto sales:dto.getLngContractPurPngPointSalesList()) {
newSalesIdList.add(sales.getId());
}
}
}
for(Long sid:oldPpIdList) {
if(!newPpIdList.contains(sid)) {
String sql = StringUtils.format("{? = call pc_{0}.f_before_delete_point(?)}",
"lng_contract_pur_png");
List<JdbcParam> params = Lists.newArrayList();
JdbcParam outParam = JdbcParam.ofString(null).setOut(true);
params.add(outParam);
params.add(JdbcParam.ofLong(dto.getId()));
JdbcTools.call(sql,params);
String error = outParam.getStringValue();
if (StringUtils.isNotEmpty(error)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_DELETE_EXEC_ERROR, error));
}
}
}
for(Long sid:oldSalesIdList) {
if(!newSalesIdList.contains(sid)) {
String sql = StringUtils.format("{? = call pc_{0}.f_before_delete_point_sales(?)}",
"lng_contract_pur_png");
List<JdbcParam> params = Lists.newArrayList();
JdbcParam outParam = JdbcParam.ofString(null).setOut(true);
params.add(outParam);
params.add(JdbcParam.ofLong(dto.getId()));
JdbcTools.call(sql,params);
String error = outParam.getStringValue();
if (StringUtils.isNotEmpty(error)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_DELETE_EXEC_ERROR, error));
}
}
}
return content.getObj();
}

View File

@ -56,11 +56,14 @@ public class LngContractPurPngPoint implements Serializable {
* 上载点编码
*/
@ApiModelProperty("上载点编码")
private String pointUpCode;
@TableField(exist = false)
private String pointUpName;
@TableField(exist = false)
private String pointDelyName;
/**
* 自主托运(Y-是N-否)
*/

View File

@ -69,6 +69,13 @@ public class LngContractPurPngPointSales implements Serializable {
@ApiModelProperty("交割点编码")
private String pointDelyCode;
/**
* 交割点编码
*/
@ApiModelProperty("交割点名称")
@TableField(exist = false)
private String pointDelyName;
/**
* 备注
*/

View File

@ -1,11 +1,14 @@
package com.xjrsoft.module.contract.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.github.yulichang.base.MPJBaseMapper;
import com.xjrsoft.module.contract.entity.LngContractPurPngPoint;
import com.xjrsoft.module.contract.entity.LngContractPurPngQty;
import org.apache.ibatis.annotations.Mapper;
/**
* @title: mapper
@ -16,4 +19,18 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface LngContractPurPngPointMapper extends MPJBaseMapper<LngContractPurPngPoint> , BaseMapper<LngContractPurPngPoint>{
@Select("SELECT p.full_name " +
" FROM lng_b_station_png p" +
" WHERE p.code = #{code}")
String getLngStationPngNameByCode(@Param("code") String code);
/**
@Select("SELECT GROUP_CONCAT(p.full_name SEPARATOR ',') as fullNames " +
"FROM lng_b_station_png p " +
"WHERE p.code IN " +
"<foreach collection='codes' item='code' open='(' separator=',' close='')>" +
"#{code}" +
"</foreach>")
String getLngStationPngNameByCodes(@Param("codes") List<String> codes);
**/
}

View File

@ -1,7 +1,9 @@
package com.xjrsoft.module.contract.service.impl;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
@ -9,21 +11,30 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.google.common.collect.Lists;
import com.xjrsoft.common.page.ConventPage;
import com.xjrsoft.common.page.PageOutput;
import com.xjrsoft.module.contract.dto.LngContractPageDto;
import com.xjrsoft.module.contract.entity.LngContractFact;
import com.xjrsoft.module.contract.entity.LngContractPur;
import com.xjrsoft.module.contract.entity.LngContractPurPngPoint;
import com.xjrsoft.module.contract.entity.LngContractPurPngPointSales;
import com.xjrsoft.module.contract.mapper.LngContractFactMapper;
import com.xjrsoft.module.contract.mapper.LngContractPurMapper;
import com.xjrsoft.module.contract.mapper.LngContractPurPngPointMapper;
import com.xjrsoft.module.contract.mapper.LngContractPurPngPointSalesMapper;
import com.xjrsoft.module.contract.service.IContractPurPngService;
import com.xjrsoft.module.contract.vo.LngContractApproRelVo;
import com.xjrsoft.module.contract.vo.LngContractFactRelVo;
import com.xjrsoft.module.contract.vo.LngContractPageVo;
import com.xjrsoft.module.contract.vo.LngContractPurVo;
import com.xjrsoft.module.sales.entity.LngAppro;
import com.xjrsoft.module.sales.mapper.LngApproMapper;
import com.xjrsoft.module.system.client.IFileClient;
import com.xjrsoft.module.system.vo.LngFileUploadVo;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import lombok.AllArgsConstructor;
/**
@ -40,6 +51,16 @@ public class ContractPurPngServiceImpl extends MPJBaseServiceImpl<LngContractPur
private final LngContractPurPngPointSalesMapper lngContractPurPngPointSalesMapper;
//private final LngContractApproRelMapper lngContractApproRelMapper;
//private final LngContractFactRelMapper lngContractFactRelMapper;
private final LngContractPurPngPointMapper lngContractPurPngPointMapper;
private final LngContractFactMapper lngContractFactMapper;
private final LngApproMapper lngApproMapper;
@Override
public PageOutput<LngContractPageVo> queryPage(LngContractPageDto dto) {
QueryWrapper<LngContractPur> queryWrapper = new QueryWrapper<>();
@ -63,13 +84,63 @@ public class ContractPurPngServiceImpl extends MPJBaseServiceImpl<LngContractPur
}
if(lngContractPur.getLngContractPurPngPointList() != null) {
for(LngContractPurPngPoint pp:lngContractPur.getLngContractPurPngPointList()) {
String fullName = lngContractPurPngPointMapper.getLngStationPngNameByCode(pp.getPointUpCode());
pp.setPointUpName(fullName);
List<LngContractPurPngPointSales> list = lngContractPurPngPointSalesMapper.selectList(new LambdaQueryWrapper<LngContractPurPngPointSales>()
.eq(LngContractPurPngPointSales::getKpppId, pp.getId()));
pp.setLngContractPurPngPointSalesList(list);
List<String> names = Lists.newArrayList();
for(LngContractPurPngPointSales ps:list) {
String delyName = lngContractPurPngPointMapper.getLngStationPngNameByCode(ps.getPointDelyCode());
ps.setPointDelyName(delyName);
names.add(delyName);
}
if(CollectionUtil.isNotEmpty(names)) {
pp.setPointDelyName(names.stream().collect(Collectors.joining(",")));
}
}
}
LngContractPurVo vo = BeanUtil.toBean(lngContractPur, LngContractPurVo.class);
List<LngContractFactRelVo> lngContractFactRelList = vo.getLngContractFactRelList();
if (CollectionUtils.isNotEmpty(lngContractFactRelList)) {
lngContractFactRelList.forEach(x -> {
LngContractFact lngContractFact = lngContractFactMapper.selectById(x.getKFactId());
if(lngContractFact != null) {
x.setComId(lngContractFact.getComId());
x.setKName(lngContractFact.getKName());
x.setKNo(lngContractFact.getKNo());
x.setEmpId(lngContractFact.getEmpId());
x.setTel(lngContractFact.getTel());
x.setKTypeCode1(lngContractFact.getKTypeCode1());
x.setRelTypeCode(lngContractFact.getRelTypeCode());
}
List<LngFileUploadVo> fileList = fileClient.getTableFiles("lng_contract_fact",
"lngFileUploadList", lngContractFact.getId());
x.setLngFileUploadList(fileList);
});
}
List<LngContractApproRelVo> lngContractApproRelList = vo.getLngContractApproRelList();
if (CollectionUtils.isNotEmpty(lngContractApproRelList)) {
lngContractApproRelList.forEach(x -> {
LngAppro appro = lngApproMapper.selectById(x.getApproId());
if(appro != null) {
List<LngFileUploadVo> fileList = fileClient.getTableFiles("lng_appro",
"lngFileUploadList", appro.getId());
x.setLngFileUploadList(fileList);
x.setBDeptId(appro.getBDeptId());
x.setCode(appro.getCode());
x.setTypeCode(x.getTypeCode());
x.setEmpId(x.getEmpId());
x.setDateAppro(appro.getDateAppro());
x.setTitle(appro.getTitle());
}
});
}
List<LngFileUploadVo> fileList = fileClient.getTableFiles("lng_contract", "lngFileUploadList", vo.getId());
vo.setLngFileUploadList(fileList);

View File

@ -110,8 +110,7 @@ public class CustomerController {
String code = codeRuleClient.genEncode(CUSTOMER_CODE);
dto.setCuCode("C"+code);
//UpdateLngCustomerDto obj = dataService.insert(dto);
//return R.ok(obj);
return R.ok(dataService.insert(dto,new DataOperationListener<UpdateLngCustomerDto>() {
@Override