合同模版优化
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
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.service.tmpltp.TmplInscDatBsnService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -82,7 +83,9 @@ public class TmplInscDatBsnController implements BusinessControllerMarker {
|
||||
@PreAuthorize("@ss.hasPermission('base:tmpl-insc-dat-bsn:query')")
|
||||
public CommonResult<TmplInscDatBsnRespVO> getTmplInscDatBsn(@RequestParam("id") String 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")
|
||||
|
||||
@@ -26,12 +26,12 @@ public class TmplInscDatBsnRespVO {
|
||||
|
||||
@Schema(description = "用户填写的值")
|
||||
@ExcelProperty("用户填写的值")
|
||||
private String fldVal;
|
||||
private List<String> fldVal;
|
||||
|
||||
|
||||
@Schema(description = "字段标识")
|
||||
@ExcelProperty("字段标识")
|
||||
private String fldKy;
|
||||
private List<String> fldKy;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -22,6 +22,6 @@ public class TmplInscDatBsnSaveReqVO {
|
||||
private String inscFldId;
|
||||
|
||||
@Schema(description = "用户填写的值")
|
||||
private Object fldVal;
|
||||
private String fldVal;
|
||||
|
||||
}
|
||||
|
||||
@@ -302,48 +302,49 @@ public class TmplInscBsnRelServiceImpl implements TmplInscBsnRelService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> valueInfo(String cttId, String inscId) {
|
||||
// 1、通过实例和合同Id获取业务
|
||||
TmplInscBsnRelDO tmplInscBsnRelDO = tmplInscBsnRelMapper.selectOne(
|
||||
TmplInscBsnRelDO::getRelativityId, cttId,
|
||||
TmplInscBsnRelDO::getInscId, inscId
|
||||
);
|
||||
if (tmplInscBsnRelDO == null) {
|
||||
throw exception(TMPL_INSC_BSN_REL_NOT_EXISTS);
|
||||
}
|
||||
// // 1、通过实例和合同Id获取业务
|
||||
// TmplInscBsnRelDO tmplInscBsnRelDO = tmplInscBsnRelMapper.selectOne(
|
||||
// TmplInscBsnRelDO::getRelativityId, cttId,
|
||||
// TmplInscBsnRelDO::getInscId, inscId
|
||||
// );
|
||||
// if (tmplInscBsnRelDO == null) {
|
||||
// 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<>();
|
||||
// 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);
|
||||
}));
|
||||
|
||||
return Map.of("data", valueInfoS, "id", tmplInscBsnRelDO.getId());
|
||||
// return Map.of("data", valueInfoS, "id", tmplInscBsnRelDO.getId());
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -369,31 +370,31 @@ public class TmplInscBsnRelServiceImpl implements TmplInscBsnRelService {
|
||||
.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);
|
||||
}));
|
||||
// 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);
|
||||
}));
|
||||
// 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());
|
||||
}
|
||||
|
||||
@@ -11,9 +11,11 @@ import com.zt.plat.module.base.controller.admin.templtp.vo.TmplInscDatBsnSaveReq
|
||||
import com.zt.plat.module.base.dal.dataobject.tmpltp.TmplInscDatBsnDO;
|
||||
import com.zt.plat.module.base.dal.mysql.tmpltp.TmplInscDatBsnMapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import jodd.util.ArraysUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
@@ -37,13 +39,13 @@ public class TmplInscDatBsnServiceImpl implements TmplInscDatBsnService {
|
||||
//判断存在
|
||||
validateTmplInscDatBsnExistsByKey(createReqVO);
|
||||
// 插入
|
||||
String fldVal=createReqVO.getFldVal().toString();
|
||||
createReqVO.setFldVal(null);// 兼容前端传入数组或者字符串
|
||||
TmplInscDatBsnDO tmplInscDatBsn = BeanUtils.toBean(createReqVO, TmplInscDatBsnDO.class);
|
||||
tmplInscDatBsn.setFldVal(fldVal);
|
||||
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) {
|
||||
List<TmplInscDatBsnDO> tmplInscDatBsnDOS = tmplInscDatBsnMapper.selectList(TmplInscDatBsnDO::getInscFldId, createReqVO.getInscFldId(),TmplInscDatBsnDO::getBsnId, createReqVO.getBsnId());
|
||||
|
||||
Reference in New Issue
Block a user