Merge remote-tracking branch 'origin/dev' into test

This commit is contained in:
qianshijiang
2025-12-04 08:58:50 +08:00
8 changed files with 129 additions and 96 deletions

View File

@@ -1,5 +1,6 @@
package com.zt.plat.module.base.controller.admin.templtp; package com.zt.plat.module.base.controller.admin.templtp;
import cn.hutool.core.collection.CollUtil;
import com.zt.plat.module.base.dal.dataobject.tmpltp.TmplInscDatBsnDO; import com.zt.plat.module.base.dal.dataobject.tmpltp.TmplInscDatBsnDO;
import com.zt.plat.module.base.service.tmpltp.TmplInscDatBsnService; import com.zt.plat.module.base.service.tmpltp.TmplInscDatBsnService;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@@ -82,7 +83,9 @@ public class TmplInscDatBsnController implements BusinessControllerMarker {
@PreAuthorize("@ss.hasPermission('base:tmpl-insc-dat-bsn:query')") @PreAuthorize("@ss.hasPermission('base:tmpl-insc-dat-bsn:query')")
public CommonResult<TmplInscDatBsnRespVO> getTmplInscDatBsn(@RequestParam("id") String id) { public CommonResult<TmplInscDatBsnRespVO> getTmplInscDatBsn(@RequestParam("id") String id) {
TmplInscDatBsnDO tmplInscDatBsn = tmplInscDatBsnService.getTmplInscDatBsn(id); TmplInscDatBsnDO tmplInscDatBsn = tmplInscDatBsnService.getTmplInscDatBsn(id);
return success(BeanUtils.toBean(tmplInscDatBsn, TmplInscDatBsnRespVO.class)); TmplInscDatBsnRespVO tmplInscDatBsnRespVO = BeanUtils.toBean(tmplInscDatBsn, TmplInscDatBsnRespVO.class);
tmplInscDatBsnRespVO.setFldVal(CollUtil.toList(tmplInscDatBsn.getFldVal().split(",")));
return success(tmplInscDatBsnRespVO);
} }
@GetMapping("/page") @GetMapping("/page")

View File

@@ -26,12 +26,12 @@ public class TmplInscDatBsnRespVO {
@Schema(description = "用户填写的值") @Schema(description = "用户填写的值")
@ExcelProperty("用户填写的值") @ExcelProperty("用户填写的值")
private String fldVal; private List<String> fldVal;
@Schema(description = "字段标识") @Schema(description = "字段标识")
@ExcelProperty("字段标识") @ExcelProperty("字段标识")
private String fldKy; private List<String> fldKy;

View File

@@ -1,5 +1,6 @@
package com.zt.plat.module.base.controller.admin.templtp.vo; package com.zt.plat.module.base.controller.admin.templtp.vo;
import com.alibaba.fastjson2.JSONArray;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*; import lombok.*;
import java.util.*; import java.util.*;

View File

@@ -1,14 +1,15 @@
package com.zt.plat.module.base.dal.mysql.tmpltp; package com.zt.plat.module.base.dal.mysql.tmpltp;
import java.util.*;
import com.zt.plat.framework.common.pojo.PageResult; import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX; import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.module.base.controller.admin.templtp.vo.TmplInscDatBsnPageReqVO;
import com.zt.plat.module.base.dal.dataobject.tmpltp.TmplInscDatBsnDO; import com.zt.plat.module.base.dal.dataobject.tmpltp.TmplInscDatBsnDO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import com.zt.plat.module.base.controller.admin.templtp.vo.*; import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* 业务实例字段值 Mapper * 业务实例字段值 Mapper
@@ -26,5 +27,15 @@ public interface TmplInscDatBsnMapper extends BaseMapperX<TmplInscDatBsnDO> {
.betweenIfPresent(TmplInscDatBsnDO::getCreateTime, reqVO.getCreateTime()) .betweenIfPresent(TmplInscDatBsnDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(TmplInscDatBsnDO::getId)); .orderByDesc(TmplInscDatBsnDO::getId));
} }
//物理删除
@Delete({
"<script>",
"DELETE FROM bse_tmpl_insc_dat_bsn",
"WHERE bsn_id IN",
"<foreach collection='ids' item='id' open='(' separator=',' close=')'>",
"#{id}",
"</foreach>",
"</script>"
})
int physicalDeleteByBsnIds(@Param("ids") List<String> ids);
} }

View File

@@ -6,8 +6,10 @@ import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX; import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX; import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.module.base.dal.dataobject.tmpltp.TmplInscItmBsnDO; import com.zt.plat.module.base.dal.dataobject.tmpltp.TmplInscItmBsnDO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import com.zt.plat.module.base.controller.admin.templtp.vo.*; import com.zt.plat.module.base.controller.admin.templtp.vo.*;
import org.apache.ibatis.annotations.Param;
/** /**
* 业务实例条款值 Mapper * 业务实例条款值 Mapper
@@ -26,4 +28,14 @@ public interface TmplInscItmBsnMapper extends BaseMapperX<TmplInscItmBsnDO> {
.orderByDesc(TmplInscItmBsnDO::getId)); .orderByDesc(TmplInscItmBsnDO::getId));
} }
@Delete({
"<script>",
"DELETE FROM bse_tmpl_insc_itm_bsn",
"WHERE bsn_id IN",
"<foreach collection='ids' item='id' open='(' separator=',' close=')'>",
"#{id}",
"</foreach>",
"</script>"
})
int physicalDeleteByBsnIds(@Param("ids") List<String> ids);
} }

View File

@@ -69,7 +69,7 @@ public class TmplInscBsnRelServiceImpl implements TmplInscBsnRelService {
TmplInscBsnRelDO tmplInscBsnRel = BeanUtils.toBean(createReqVO, TmplInscBsnRelDO.class); TmplInscBsnRelDO tmplInscBsnRel = BeanUtils.toBean(createReqVO, TmplInscBsnRelDO.class);
tmplInscBsnRel.setRelativityId(createReqVO.getBsnId()); tmplInscBsnRel.setRelativityId(createReqVO.getBsnId());
// tmplInscBsnRel.setBsnId(Long.valueOf(createReqVO.getUuid())); // tmplInscBsnRel.setBsnId(Long.valueOf(createReqVO.getUuid()));
tmplInscBsnRelMapper.insert(tmplInscBsnRel); tmplInscBsnRelMapper.insertOrUpdate(tmplInscBsnRel);
// 返回 // 返回
return BeanUtils.toBean(tmplInscBsnRel, TmplInscBsnRelRespVO.class); return BeanUtils.toBean(tmplInscBsnRel, TmplInscBsnRelRespVO.class);
} }
@@ -302,48 +302,49 @@ public class TmplInscBsnRelServiceImpl implements TmplInscBsnRelService {
@Override @Override
public Map<String, Object> valueInfo(String cttId, String inscId) { public Map<String, Object> valueInfo(String cttId, String inscId) {
// 1、通过实例和合同Id获取业务 // // 1、通过实例和合同Id获取业务
TmplInscBsnRelDO tmplInscBsnRelDO = tmplInscBsnRelMapper.selectOne( // TmplInscBsnRelDO tmplInscBsnRelDO = tmplInscBsnRelMapper.selectOne(
TmplInscBsnRelDO::getRelativityId, cttId, // TmplInscBsnRelDO::getRelativityId, cttId,
TmplInscBsnRelDO::getInscId, inscId // TmplInscBsnRelDO::getInscId, inscId
); // );
if (tmplInscBsnRelDO == null) { // if (tmplInscBsnRelDO == null) {
throw exception(TMPL_INSC_BSN_REL_NOT_EXISTS); // throw exception(TMPL_INSC_BSN_REL_NOT_EXISTS);
} // }
//
// List<ValueInfo> valueInfoS = new ArrayList<>();
// // 2、获取绑定的字段
// List<TmplInscDatBsnRespVO> tmplInscDatBsnList = tmplInscDatBsnService
// .getTmplInscDatBsnListByBsnId(String.valueOf(tmplInscBsnRelDO.getRelativityId()));
//
//
// Optional.ofNullable(tmplInscDatBsnList)
// .ifPresent(list -> list.forEach(tmplInscDatBsnRespVO -> {
// ValueInfo valueInfo = new ValueInfo(
// tmplInscDatBsnRespVO.getId(),
// tmplInscDatBsnRespVO.getFldKy(),
// tmplInscDatBsnRespVO.getFldVal(),
// "field",
// tmplInscDatBsnRespVO.getInscFldId()
// );
// valueInfoS.add(valueInfo);
// }));
//
// // 3、获取条款
// List<TmplInscItmBsnRespVO> tmplInscItmBsnList = tmplInscItmBsnService.getTmplInscItmBsnList(String.valueOf(tmplInscBsnRelDO.getRelativityId()));
// Optional.ofNullable(tmplInscItmBsnList)
// .ifPresent(list -> list.forEach(tmplInscItmBsnRespVO -> {
// ValueInfo valueInfo = new ValueInfo(
// tmplInscItmBsnRespVO.getId(),
// tmplInscItmBsnRespVO.getItmName(),
// tmplInscItmBsnRespVO.getVal(),
// "item",
// tmplInscItmBsnRespVO.getItmId()
// );
// valueInfoS.add(valueInfo);
// }));
List<ValueInfo> valueInfoS = new ArrayList<>(); // return Map.of("data", valueInfoS, "id", tmplInscBsnRelDO.getId());
// 2、获取绑定的字段 return null;
List<TmplInscDatBsnRespVO> tmplInscDatBsnList = tmplInscDatBsnService
.getTmplInscDatBsnListByBsnId(String.valueOf(tmplInscBsnRelDO.getRelativityId()));
Optional.ofNullable(tmplInscDatBsnList)
.ifPresent(list -> list.forEach(tmplInscDatBsnRespVO -> {
ValueInfo valueInfo = new ValueInfo(
tmplInscDatBsnRespVO.getId(),
tmplInscDatBsnRespVO.getFldKy(),
tmplInscDatBsnRespVO.getFldVal(),
"field",
tmplInscDatBsnRespVO.getInscFldId()
);
valueInfoS.add(valueInfo);
}));
// 3、获取条款
List<TmplInscItmBsnRespVO> tmplInscItmBsnList = tmplInscItmBsnService.getTmplInscItmBsnList(String.valueOf(tmplInscBsnRelDO.getRelativityId()));
Optional.ofNullable(tmplInscItmBsnList)
.ifPresent(list -> list.forEach(tmplInscItmBsnRespVO -> {
ValueInfo valueInfo = new ValueInfo(
tmplInscItmBsnRespVO.getId(),
tmplInscItmBsnRespVO.getItmName(),
tmplInscItmBsnRespVO.getVal(),
"item",
tmplInscItmBsnRespVO.getItmId()
);
valueInfoS.add(valueInfo);
}));
return Map.of("data", valueInfoS, "id", tmplInscBsnRelDO.getId());
} }
@Override @Override
@@ -369,31 +370,31 @@ public class TmplInscBsnRelServiceImpl implements TmplInscBsnRelService {
.getTmplInscDatBsnListByBsnId(String.valueOf(tmplInscBsnRelDO.getRelativityId())); .getTmplInscDatBsnListByBsnId(String.valueOf(tmplInscBsnRelDO.getRelativityId()));
Optional.ofNullable(tmplInscDatBsnList) // Optional.ofNullable(tmplInscDatBsnList)
.ifPresent(list -> list.forEach(tmplInscDatBsnRespVO -> { // .ifPresent(list -> list.forEach(tmplInscDatBsnRespVO -> {
ValueInfo valueInfo = new ValueInfo( // ValueInfo valueInfo = new ValueInfo(
tmplInscDatBsnRespVO.getId(), // tmplInscDatBsnRespVO.getId(),
tmplInscDatBsnRespVO.getFldKy(), // tmplInscDatBsnRespVO.getFldKy(),
tmplInscDatBsnRespVO.getFldVal(), // tmplInscDatBsnRespVO.getFldVal(),
"field", // "field",
tmplInscDatBsnRespVO.getInscFldId() // tmplInscDatBsnRespVO.getInscFldId()
); // );
valueInfoS.add(valueInfo); // valueInfoS.add(valueInfo);
})); // }));
// 3、获取条款 // 3、获取条款
List<TmplInscItmBsnRespVO> tmplInscItmBsnList = tmplInscItmBsnService.getTmplInscItmBsnList(String.valueOf(tmplInscBsnRelDO.getRelativityId())); List<TmplInscItmBsnRespVO> tmplInscItmBsnList = tmplInscItmBsnService.getTmplInscItmBsnList(String.valueOf(tmplInscBsnRelDO.getRelativityId()));
Optional.ofNullable(tmplInscItmBsnList) // Optional.ofNullable(tmplInscItmBsnList)
.ifPresent(list -> list.forEach(tmplInscItmBsnRespVO -> { // .ifPresent(list -> list.forEach(tmplInscItmBsnRespVO -> {
ValueInfo valueInfo = new ValueInfo( // ValueInfo valueInfo = new ValueInfo(
tmplInscItmBsnRespVO.getId(), // tmplInscItmBsnRespVO.getId(),
tmplInscItmBsnRespVO.getItmName(), // tmplInscItmBsnRespVO.getItmName(),
tmplInscItmBsnRespVO.getVal(), // tmplInscItmBsnRespVO.getVal(),
"item", // "item",
tmplInscItmBsnRespVO.getItmId() // tmplInscItmBsnRespVO.getItmId()
); // );
valueInfoS.add(valueInfo); // valueInfoS.add(valueInfo);
})); // }));
return Map.of("data", valueInfoS, "id", tmplInscBsnRelDO.getId()); return Map.of("data", valueInfoS, "id", tmplInscBsnRelDO.getId());
} }

View File

@@ -1,29 +1,24 @@
package com.zt.plat.module.base.service.tmpltp; package com.zt.plat.module.base.service.tmpltp;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.zt.plat.framework.tenant.core.aop.CompanyVisitIgnore; import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.common.util.object.BeanUtils;
import com.zt.plat.framework.tenant.core.aop.TenantIgnore; import com.zt.plat.framework.tenant.core.aop.TenantIgnore;
import com.zt.plat.module.base.controller.admin.templtp.vo.TmplInscDatBsnPageReqVO;
import com.zt.plat.module.base.controller.admin.templtp.vo.TmplInscDatBsnRespVO;
import com.zt.plat.module.base.controller.admin.templtp.vo.TmplInscDatBsnSaveReqVO;
import com.zt.plat.module.base.dal.dataobject.tmpltp.TmplInscDatBsnDO; import com.zt.plat.module.base.dal.dataobject.tmpltp.TmplInscDatBsnDO;
import com.zt.plat.module.base.dal.mysql.tmpltp.TmplInscDatBsnMapper; import com.zt.plat.module.base.dal.mysql.tmpltp.TmplInscDatBsnMapper;
import org.springframework.stereotype.Service;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import jodd.util.ArraysUtil;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import com.zt.plat.module.base.controller.admin.templtp.vo.*;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.common.pojo.PageParam;
import com.zt.plat.framework.common.util.object.BeanUtils;
import java.util.Arrays;
import java.util.List;
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.zt.plat.framework.common.util.collection.CollectionUtils.convertList;
import static com.zt.plat.framework.common.util.collection.CollectionUtils.diffList;
import static com.zt.plat.module.base.enums.ErrorCodeConstants.*;
import static com.zt.plat.module.tmpltp.enums.ErrorCodeConstants.TMPL_INSC_DAT_BSN_EXISTS; import static com.zt.plat.module.tmpltp.enums.ErrorCodeConstants.TMPL_INSC_DAT_BSN_EXISTS;
import static com.zt.plat.module.tmpltp.enums.ErrorCodeConstants.TMPL_INSC_DAT_BSN_NOT_EXISTS; import static com.zt.plat.module.tmpltp.enums.ErrorCodeConstants.TMPL_INSC_DAT_BSN_NOT_EXISTS;
@@ -44,10 +39,13 @@ public class TmplInscDatBsnServiceImpl implements TmplInscDatBsnService {
//判断存在 //判断存在
validateTmplInscDatBsnExistsByKey(createReqVO); validateTmplInscDatBsnExistsByKey(createReqVO);
// 插入 // 插入
createReqVO.setFldVal(null);// 兼容前端传入数组或者字符串
TmplInscDatBsnDO tmplInscDatBsn = BeanUtils.toBean(createReqVO, TmplInscDatBsnDO.class); TmplInscDatBsnDO tmplInscDatBsn = BeanUtils.toBean(createReqVO, TmplInscDatBsnDO.class);
tmplInscDatBsnMapper.insert(tmplInscDatBsn); tmplInscDatBsnMapper.insert(tmplInscDatBsn);
// 返回 // 返回
return BeanUtils.toBean(tmplInscDatBsn, TmplInscDatBsnRespVO.class); TmplInscDatBsnRespVO tmplInscDatBsnRespVO = BeanUtils.toBean(tmplInscDatBsn, TmplInscDatBsnRespVO.class);
tmplInscDatBsnRespVO.setFldVal(CollUtil.toList(tmplInscDatBsn.getFldVal().split(",")));
return tmplInscDatBsnRespVO;
} }
private void validateTmplInscDatBsnExistsByKey(TmplInscDatBsnSaveReqVO createReqVO) { private void validateTmplInscDatBsnExistsByKey(TmplInscDatBsnSaveReqVO createReqVO) {
List<TmplInscDatBsnDO> tmplInscDatBsnDOS = tmplInscDatBsnMapper.selectList(TmplInscDatBsnDO::getInscFldId, createReqVO.getInscFldId(),TmplInscDatBsnDO::getBsnId, createReqVO.getBsnId()); List<TmplInscDatBsnDO> tmplInscDatBsnDOS = tmplInscDatBsnMapper.selectList(TmplInscDatBsnDO::getInscFldId, createReqVO.getInscFldId(),TmplInscDatBsnDO::getBsnId, createReqVO.getBsnId());
@@ -59,10 +57,13 @@ public class TmplInscDatBsnServiceImpl implements TmplInscDatBsnService {
@Override @Override
public void updateTmplInscDatBsn(TmplInscDatBsnSaveReqVO updateReqVO) { public void updateTmplInscDatBsn(TmplInscDatBsnSaveReqVO updateReqVO) {
// 校验存在 // 校验存在
validateTmplInscDatBsnExists(updateReqVO.getId()); // validateTmplInscDatBsnExists(updateReqVO.getId());
// 更新 // 物理删除旧记录
TmplInscDatBsnDO updateObj = BeanUtils.toBean(updateReqVO, TmplInscDatBsnDO.class); tmplInscDatBsnMapper.physicalDeleteByBsnIds(List.of(updateReqVO.getBsnId()));
tmplInscDatBsnMapper.updateById(updateObj);
TmplInscDatBsnDO saveObj = BeanUtils.toBean(updateReqVO, TmplInscDatBsnDO.class);
saveObj.setId(null);
tmplInscDatBsnMapper.insert(saveObj);
} }
@Override @Override

View File

@@ -61,10 +61,14 @@ public class TmplInscItmBsnServiceImpl implements TmplInscItmBsnService {
@Override @Override
public void updateTmplInscItmBsn(TmplInscItmBsnSaveReqVO updateReqVO) { public void updateTmplInscItmBsn(TmplInscItmBsnSaveReqVO updateReqVO) {
// 校验存在 // 校验存在
validateTmplInscItmBsnExists(updateReqVO.getId()); // validateTmplInscItmBsnExists(updateReqVO.getId());
// 更新 // 更新
TmplInscItmBsnDO updateObj = BeanUtils.toBean(updateReqVO, TmplInscItmBsnDO.class); tmplInscItmBsnMapper.physicalDeleteByBsnIds(List.of(updateReqVO.getBsnId()));
tmplInscItmBsnMapper.updateById(updateObj); TmplInscItmBsnDO saveObj = BeanUtils.toBean(updateReqVO, TmplInscItmBsnDO.class);
saveObj.setInscItmId(updateReqVO.getInstceItmId());
// tmplInscItmBsnMapper.updateById(updateObj);
saveObj.setId(null);
tmplInscItmBsnMapper.insert(saveObj);
} }
@Override @Override