模版修改

This commit is contained in:
潘荣晟
2025-11-11 11:52:35 +08:00
parent 886283cdf8
commit ddfc7d8965
21 changed files with 229 additions and 33 deletions

View File

@@ -120,4 +120,19 @@ public class TmplInscBsnRelController implements BusinessControllerMarker {
BeanUtils.toBean(list, TmplInscBsnRelRespVO.class));
}
@GetMapping("/value-info")
@Operation(summary = "根据合Id和实例Id获取字段和条款")
@PreAuthorize("@ss.hasPermission('base:tmpl-insc-bsn-rel:query')")
public CommonResult<Map<String, Object>> valueInfo(@RequestParam("cttId") @Valid @NotEmpty(message = "合同Id不能为空") String cttId, @RequestParam("inscId") @Valid @NotEmpty(message = "模版实例id不能为空") String inscId) {
return success(tmplInscBsnRelService.valueInfo(cttId, inscId));
}
@GetMapping("/bsn-info")
@Operation(summary = "根据合id和实例id获取中间表")
@PreAuthorize("@ss.hasPermission('base:tmpl-insc-bsn-rel:query')")
public CommonResult<TmplInscBsnRelRespVO> bseInfo(@RequestParam("cttId") @Valid @NotEmpty(message = "合同Id不能为空") String cttId, @RequestParam("inscId") @Valid @NotEmpty(message = "模版实例id不能为空") String inscId) {
return success(tmplInscBsnRelService.bseInfo(cttId, inscId));
}
}

View File

@@ -5,6 +5,8 @@ import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.module.base.controller.admin.templtp.onlyoffice.pojo.Action;
import com.zt.plat.module.base.controller.admin.templtp.onlyoffice.pojo.History;
import com.zt.plat.module.base.controller.admin.templtp.onlyoffice.pojo.OnlyOfficeCallback;
import com.zt.plat.module.base.dal.dataobject.tmpltp.TmplInscBsnRelDO;
import com.zt.plat.module.base.dal.mysql.tmpltp.TmplInscBsnRelMapper;
import com.zt.plat.module.base.service.tmpltp.TemplateInstanceService;
import com.zt.plat.module.infra.api.file.FileApi;
import com.zt.plat.module.infra.api.file.dto.FileCreateReqDTO;
@@ -29,7 +31,7 @@ import static com.zt.plat.module.base.controller.admin.templtp.onlyoffice.util.U
public class OnlyOfficeCallbackServiceImpl implements OnlyOfficeCallbackService {
private final FileApi fileApi;
private final TemplateInstanceService templateInstanceService;
private final TmplInscBsnRelMapper tmplInscBsnRelMapper;
@Override
public void processCallback(OnlyOfficeCallback callback, String id,String fileName) {
log.info("收到OnlyOffice文档回调: {}", callback.getKey());
@@ -354,7 +356,10 @@ public class OnlyOfficeCallbackServiceImpl implements OnlyOfficeCallbackService
fileInfo.put("name", fileRespDTO.getName());
fileInfo.put("directory", fileRespDTO.getDirectory());
fileInfo.put("key", callback.getKey());
templateInstanceService.updateTemplateInstanceFileUrlByInstanceId(id, JSONObject.toJSONString(fileInfo));
TmplInscBsnRelDO createReqVO = new TmplInscBsnRelDO();
createReqVO.setId(Long.valueOf(id));
createReqVO.setCntt(JSONObject.toJSONString(fileInfo));
tmplInscBsnRelMapper.updateById(createReqVO);
} else {
// 创建文件失败,处理错误
log.error("文件创建失败,错误信息:{}", result.getMsg());

View File

@@ -8,7 +8,7 @@ import java.util.List;
@Schema(description = "管理后台 - 合同动态表单 响应 VO")
@Data
public class FieldAndClauseRespVO {
@Schema(description = "模板分类")
@Schema(description = "模板字段")
List<TmplFldRespVO> tmplFldRespVOS;
@Schema(description = "条款")
List<TmplItmRespVO> tmplItmRespVOS;

View File

@@ -70,9 +70,22 @@ public interface TmplInscBsnRelService {
void getTmplInscBsnRelDetails(TmplInscBsnRelRespVO tmplInscBsnRelRespVO);
/**
* 新cntt
* 新cntt
*
* @param bsnId ,params
*/
void updateCntt(Long bsnId,String params);
/**
* 获取字段和条款
*
* @param cttId ,inscId
*/
Map<String,Object> valueInfo(String cttId,String inscId);
/**
* 获取中间表
*
* @param cttId ,inscId
*/
TmplInscBsnRelRespVO bseInfo(String cttId,String inscId);
}

View File

@@ -23,10 +23,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.zt.plat.module.infra.enums.ErrorCodeConstants.FILE_NOT_EXISTS;
@@ -47,32 +44,37 @@ public class TmplInscBsnRelServiceImpl implements TmplInscBsnRelService {
private TmplInscBsnRelMapper tmplInscBsnRelMapper;
@Resource
private TemplateInstanceService templateInstanceService;
@Resource
private TmplInscDatBsnService tmplInscDatBsnService;
@Resource
private TmplInscItmBsnService tmplInscItmBsnService;
@Override
@Transactional(rollbackFor = Exception.class)
public TmplInscBsnRelRespVO createTmplInscBsnRel(TmplInscBsnRelSaveReqVO createReqVO) {
TemplateInstanceRespVO templateInstance = templateInstanceService.getTemplateInstance(createReqVO.getInscId());
if (templateInstance == null) {
throw exception(TEMPLATE_INSTANCE_NOT_EXISTS);
}
String type = "cntt";
if (templateInstance.getCntt().isEmpty() && templateInstance.getOrigCntt().isEmpty()) {
throw exception(TEMPLATE_INSTANCE_FILE_NOT_EXISTS);
}
if (templateInstance.getCntt().isEmpty()) {
type = "origCntt";
}
//下载文件并且上传文件
fileUpload(createReqVO, templateInstance, type);
// TemplateInstanceRespVO templateInstance = templateInstanceService.getTemplateInstance(createReqVO.getInscId());
// if (templateInstance == null) {
// throw exception(TEMPLATE_INSTANCE_NOT_EXISTS);
// }
// String type = "cntt";
// if (templateInstance.getCntt().isEmpty() && templateInstance.getOrigCntt().isEmpty()) {
// throw exception(TEMPLATE_INSTANCE_FILE_NOT_EXISTS);
// }
// if (templateInstance.getCntt().isEmpty()) {
// type = "origCntt";
// }
// //下载文件并且上传文件
// fileUpload(createReqVO, templateInstance, type);
// 插入
TmplInscBsnRelDO tmplInscBsnRel = BeanUtils.toBean(createReqVO, TmplInscBsnRelDO.class);
// tmplInscBsnRel.setBsnId(Long.valueOf(createReqVO.getUuid()));
tmplInscBsnRelMapper.insert(tmplInscBsnRel);
// 返回
return BeanUtils.toBean(tmplInscBsnRel, TmplInscBsnRelRespVO.class);
}
@Override
public void updateTmplInscBsnRel(TmplInscBsnRelSaveReqVO updateReqVO) {
// 校验存在
@@ -83,7 +85,7 @@ public class TmplInscBsnRelServiceImpl implements TmplInscBsnRelService {
}
@Override
@Transactional
@Transactional(rollbackFor = Exception.class)
public void deleteTmplInscBsnRel(Long id) {
// 校验存在
validateTmplInscBsnRelExists(id);
@@ -92,11 +94,10 @@ public class TmplInscBsnRelServiceImpl implements TmplInscBsnRelService {
}
@Override
@Transactional
@Transactional(rollbackFor = Exception.class)
public void deleteTmplInscBsnRelListByIds(List<Long> ids) {
// 校验存在
validateTmplInscBsnRelExists(ids);
// 删除
//删除业务实例字段值
deleteFldOrItmByIds(tmplInscBsnRelMapper.selectByIds(ids).stream().map(TmplInscBsnRelDO::getBsnId).map(String::valueOf).toList(), tmplInscDatBsnService);
//删除业务实例字段值
@@ -154,11 +155,12 @@ public class TmplInscBsnRelServiceImpl implements TmplInscBsnRelService {
throw exception(TEMPLATE_INSTANCE_FILE_NOT_EXISTS);
}
TmplInscBsnRelDO tmplInscBsnRelDO = tmplInscBsnRelDOS.get(0);
tmplInscBsnRelDO.setCntt( params);
tmplInscBsnRelDO.setCntt(params);
tmplInscBsnRelMapper.updateById(tmplInscBsnRelDO);
log.info("更新业务实例cntt字段值成功");
}
//业务条款
private List<TmplInscItmBsnRespVO> setTmplInscItmBsnRespVOS(TmplInscBsnRelRespVO tmplInscBsnRelRespVO) {
List<TmplInscItmBsnRespVO> tmplInscItmBsnRespVOS = BeanUtils.toBean(SpringUtil.getBean(TmplInscItmBsnMapper.class).selectList(new LambdaQueryWrapper<TmplInscItmBsnDO>()
@@ -288,5 +290,69 @@ public class TmplInscBsnRelServiceImpl implements TmplInscBsnRelService {
}
}
@Override
public Map<String, Object> valueInfo(String cttId, String inscId) {
// 1、通过实例和合同Id获取业务
TmplInscBsnRelDO tmplInscBsnRelDO = tmplInscBsnRelMapper.selectOne(
TmplInscBsnRelDO::getBsnId, 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.getBsnId()));
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.getBsnId()));
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
public TmplInscBsnRelRespVO bseInfo(String cttId, String inscId) {
TmplInscBsnRelDO tmplInscBsnRelDO = tmplInscBsnRelMapper.selectOne(
TmplInscBsnRelDO::getBsnId, cttId,
TmplInscBsnRelDO::getInscId, inscId
);
return BeanUtils.toBean(tmplInscBsnRelDO, TmplInscBsnRelRespVO.class);
}
private record ValueInfo(
String id,
String label,
String value,
String type,
String codeNumber
) {
}
}

View File

@@ -69,5 +69,12 @@ public interface TmplInscDatBsnService {
*
*/
void deleteTmplInscDatBsnListByBsnIds(@Valid @NotEmpty(message = "业务编号不能为空") List<String> ids);
/**
* 通过业务id查询业务字段
*
* @param id 业务id
*
*/
List<TmplInscDatBsnRespVO> getTmplInscDatBsnListByBsnId(@Valid @NotEmpty(message = "业务编号不能为空") String id);
}

View File

@@ -24,6 +24,7 @@ import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.e
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_NOT_EXISTS;
/**
@@ -40,12 +41,20 @@ public class TmplInscDatBsnServiceImpl implements TmplInscDatBsnService {
@Override
public TmplInscDatBsnRespVO createTmplInscDatBsn(TmplInscDatBsnSaveReqVO createReqVO) {
//判断存在
validateTmplInscDatBsnExistsByKey(createReqVO);
// 插入
TmplInscDatBsnDO tmplInscDatBsn = BeanUtils.toBean(createReqVO, TmplInscDatBsnDO.class);
tmplInscDatBsnMapper.insert(tmplInscDatBsn);
// 返回
return BeanUtils.toBean(tmplInscDatBsn, TmplInscDatBsnRespVO.class);
}
private void validateTmplInscDatBsnExistsByKey(TmplInscDatBsnSaveReqVO createReqVO) {
List<TmplInscDatBsnDO> tmplInscDatBsnDOS = tmplInscDatBsnMapper.selectList(TmplInscDatBsnDO::getInscFldId, createReqVO.getInscFldId());
if (!tmplInscDatBsnDOS.isEmpty()) {
throw exception(TMPL_INSC_DAT_BSN_EXISTS);
}
}
@Override
public void updateTmplInscDatBsn(TmplInscDatBsnSaveReqVO updateReqVO) {
@@ -101,4 +110,10 @@ public class TmplInscDatBsnServiceImpl implements TmplInscDatBsnService {
tmplInscDatBsnMapper.update(new LambdaUpdateWrapper<TmplInscDatBsnDO>().in(TmplInscDatBsnDO::getBsnId, ids).set(TmplInscDatBsnDO::getDeleted, 1));
}
@Override
public List<TmplInscDatBsnRespVO> getTmplInscDatBsnListByBsnId(String id) {
List<TmplInscDatBsnDO> tmplInscDatBsnDOS = tmplInscDatBsnMapper.selectList(TmplInscDatBsnDO::getBsnId, id);
return BeanUtils.toBean(tmplInscDatBsnDOS, TmplInscDatBsnRespVO.class);
}
}

View File

@@ -67,5 +67,12 @@ public interface TmplInscItmBsnService {
* @param ids 编号
*/
void deleteTmplInscDatBsnListByBsnIds(@Valid @NotEmpty(message = "业务编号不能为空") List<String> ids);
/**
* 获取条款值列表
*
* @param bsnId 业务编号
* @return TmplInscItmBsnRespVO
*/
List<TmplInscItmBsnRespVO> getTmplInscItmBsnList(@Valid @NotEmpty(message = "创建信息不能为空")String bsnId);
}

View File

@@ -12,6 +12,7 @@ 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;
@@ -19,11 +20,11 @@ import com.zt.plat.framework.common.pojo.PageParam;
import com.zt.plat.framework.common.util.object.BeanUtils;
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_ITM_BSN_EXISTS;
import static com.zt.plat.module.tmpltp.enums.ErrorCodeConstants.TMPL_INSC_ITM_BSN_NOT_EXISTS;
/**
@@ -40,6 +41,8 @@ public class TmplInscItmBsnServiceImpl implements TmplInscItmBsnService {
@Override
public TmplInscItmBsnRespVO createTmplInscItmBsn(TmplInscItmBsnSaveReqVO createReqVO) {
//校验存在
validateTmplInscItmBsnExistsByKey(createReqVO);
// 插入
TmplInscItmBsnDO tmplInscItmBsn = BeanUtils.toBean(createReqVO, TmplInscItmBsnDO.class);
tmplInscItmBsnMapper.insert(tmplInscItmBsn);
@@ -47,6 +50,13 @@ public class TmplInscItmBsnServiceImpl implements TmplInscItmBsnService {
return BeanUtils.toBean(tmplInscItmBsn, TmplInscItmBsnRespVO.class);
}
void validateTmplInscItmBsnExistsByKey(TmplInscItmBsnSaveReqVO createReqVO) {
List<TmplInscItmBsnDO> tmplInscItmBsnDOS = tmplInscItmBsnMapper.selectList(TmplInscItmBsnDO::getBsnId, createReqVO.getBsnId(), TmplInscItmBsnDO::getInscItmId, createReqVO.getBsnId());
if (!tmplInscItmBsnDOS.isEmpty()){
throw exception(TMPL_INSC_ITM_BSN_EXISTS);
}
}
@Override
public void updateTmplInscItmBsn(TmplInscItmBsnSaveReqVO updateReqVO) {
// 校验存在
@@ -101,4 +111,10 @@ public class TmplInscItmBsnServiceImpl implements TmplInscItmBsnService {
tmplInscItmBsnMapper.update(new LambdaUpdateWrapper<TmplInscItmBsnDO>().in(TmplInscItmBsnDO::getBsnId, ids).set(TmplInscItmBsnDO::getDeleted, 1));
}
@Override
public List<TmplInscItmBsnRespVO> getTmplInscItmBsnList(String bsnId) {
List<TmplInscItmBsnDO> tmplInscItmBsnDOS = tmplInscItmBsnMapper.selectList(TmplInscItmBsnDO::getBsnId, bsnId);
return BeanUtils.toBean(tmplInscItmBsnDOS, TmplInscItmBsnRespVO.class);
}
}

View File

@@ -283,6 +283,11 @@ public class OrderDTO {
*/
@TableField("PYER_NUM")
private String payerNum;
/**
* 货权准转移类型
*/
private String meteringType;
/**
* 订单明细

View File

@@ -198,6 +198,11 @@ public class PurchaseOrderWithDetailsDTO {
* 税码
*/
private String taxNum;
/**
* 货权准转移类型
*/
private String meteringType;
/**
* 采购订单明细
*/

View File

@@ -1,5 +1,6 @@
package com.zt.plat.module.contractorder.controller.admin.purchaseorder.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
@@ -133,5 +134,8 @@ public class PurchaseOrderPageReqVO extends PageParam {
@Schema(description = "订单分类")
private String splyBsnTp;
@Schema(description = "货权转移类型(字典ASY_MTNG_TP)")
private String meteringType;
}

View File

@@ -196,4 +196,8 @@ public class PurchaseOrderRespVO {
@ExcelProperty(" 审批意见")
private String reviewOpinion;
@Schema(description = "货权转移类型(字典ASY_MTNG_TP)")
@ExcelProperty("货权转移类型(字典ASY_MTNG_TP)")
private String meteringType;
}

View File

@@ -178,4 +178,21 @@ public class PurchaseOrderSaveReqVO {
@Schema(description = "订单分类(字典SPLY_BSN_TP)", example = "2")
@ExcelProperty("订单分类")
private String splyBsnTp;
@Schema(description = "货权转移类型(字典ASY_MTNG_TP)")
@ExcelProperty("货权转移类型(字典ASY_MTNG_TP)")
private String meteringType;
@Schema(description = "产品组名")
@ExcelProperty("产品组名")
private String pdtGrpName;
@Schema(description = "产品组编码")
@ExcelProperty("产品组编码")
private String pdtGrpCdg;
@Schema(description = "付款方名称")
@ExcelProperty("付款方名称")
private String payerName;
@Schema(description = "付款方编码")
@ExcelProperty("付款方编码")
private String payerNum;
}

View File

@@ -156,4 +156,7 @@ public class SalesOrderPageReqVO extends PageParam {
@ExcelProperty("产品组编码")
private String pdtGrpCdg;
@Schema(description = "货权转移类型(字典ASY_MTNG_TP)")
private String meteringType;
}

View File

@@ -220,5 +220,8 @@ public class SalesOrderRespVO {
@Schema(description = "付款方编码")
@ExcelProperty("付款方编码")
private String payerNum;
@Schema(description = "货权转移类型(字典ASY_MTNG_TP)")
@ExcelProperty("货权转移类型(字典ASY_MTNG_TP)")
private String meteringType;
}

View File

@@ -198,4 +198,8 @@ public class SalesOrderSaveReqVO {
@Schema(description = "付款方编码")
@ExcelProperty("付款方编码")
private String payerNum;
@Schema(description = "货权转移类型(字典ASY_MTNG_TP)")
@ExcelProperty("货权转移类型(字典ASY_MTNG_TP)")
private String meteringType;
}

View File

@@ -283,4 +283,10 @@ public class PurchaseOrderDO extends BusinessBaseDO {
*/
@TableField("TAX_RTE")
private BigDecimal taxRte;
/**
* 货权准转移类型
*/
@TableField("MTRG_TP")
private String meteringType;
}

View File

@@ -303,9 +303,8 @@ public class SalesOrderDO extends BusinessBaseDO {
*/
@TableField("PYER_NUM")
private String payerNum;
// /**
// * 税码
// */
// @TableField("TAX_NUM")
// private String taxNum;
/**
* 货权准转移类型
*/
private String meteringType;
}

View File

@@ -61,6 +61,7 @@ public interface PurchaseOrderMapper extends BaseMapperX<PurchaseOrderDO> {
.eqIfPresent(PurchaseOrderDO::getSplyBsnTp, reqVO.getSplyBsnTp() != null ? reqVO.getSplyBsnTp() : "PUR")
.eqIfPresent(PurchaseOrderDO::getCause, reqVO.getCause())
.eqIfPresent(PurchaseOrderDO::getStatus, reqVO.getStatus())
.eqIfPresent(PurchaseOrderDO::getMeteringType, reqVO.getMeteringType())
.likeIfPresent(PurchaseOrderDO::getPurchaseGroupName, reqVO.getPurchaseGroupName())
.orderByDesc(PurchaseOrderDO::getId));
}

View File

@@ -27,6 +27,7 @@ public interface SalesOrderMapper extends BaseMapperX<SalesOrderDO> {
.eqIfPresent(SalesOrderDO::getSupplierNumber, reqVO.getSupplierNumber())
.likeIfPresent(SalesOrderDO::getSupplierName, reqVO.getSupplierName())
.eqIfPresent(SalesOrderDO::getType, reqVO.getType())
.eqIfPresent(SalesOrderDO::getMeteringType, reqVO.getMeteringType())
.betweenIfPresent(SalesOrderDO::getVoucherDate, reqVO.getVoucherDate())
.eqIfPresent(SalesOrderDO::getPurchaseOrganizationCustomsDeclaration, reqVO.getPurchaseOrganizationCustomsDeclaration())
.likeIfPresent(SalesOrderDO::getReceiveFactoryName, reqVO.getReceiveFactoryName())