Commit bb1b8702 authored by tangwei's avatar tangwei

新增合同模板动态填充

parent 3dcd8bbd
package com.yeejoin.amos.boot.module.hygf.api.dto;
import lombok.Data;
import java.util.List;
/**
* @description:
* @author: tw
* @createDate: 2023/11/23
*/
@Data
public class ContractFillDataDto {
//字段名称
private String title;
//字段类型
private String type;
//字段标识
private String field;
//是否必填
private boolean required;
//下拉值
private List<Object> selectList;
//字段值
private String value;
private Long templateId;
}
package com.yeejoin.amos.boot.module.hygf.api.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import lombok.Data;
import java.util.List;
/**
* @description:
* @author: tw
* @createDate: 2023/11/23
*/
/**
*
* 模板填充字段
*
* **/
@Data
public class ContractFillDto extends BaseDto {
//字段名称
private String title;
//字段类型
private String type;
//字段标识
private String field;
//是否必填
private boolean required;
//下拉值
private List<Object> selectList;
//字段值
private String value;
private Long templateId;
}
package com.yeejoin.amos.boot.module.hygf.api.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.yeejoin.amos.boot.module.hygf.api.entity.ContractFill;
import com.yeejoin.amos.boot.module.hygf.api.entity.ContractFillData;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import java.util.List;
/**
*
......@@ -135,5 +138,7 @@ public class HouseholdContractDto extends BaseDto {
private Date signingTime;
private String projectUserId;
//合同填充字段值
List<ContractFillData> contractFillData;
}
package com.yeejoin.amos.boot.module.hygf.api.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.List;
/**
* @description:
* @author: tw
* @createDate: 2023/11/23
*/
@Data
@Accessors(chain = true)
@TableName(value = "hygf_contract_fill",autoResultMap = true)
public class ContractFill extends BaseEntity{
//字段名称
@TableField("title")
private String title;
//字段类型
@TableField("type")
private String type;
//字段标识
@TableField("field")
private String field;
//是否必填
@TableField("required")
private boolean required;
//下拉值
@TableField(value = "select_list",typeHandler = FastjsonTypeHandler.class)
private List<Object> selectList;
//字段值
@TableField("value")
private String value;
//模板id
@TableField("template_id")
private Long templateId;
}
package com.yeejoin.amos.boot.module.hygf.api.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.List;
/**
* @description:
* @author: tw
* @createDate: 2023/11/23
*/
@Data
@Accessors(chain = true)
@TableName(value = "hygf_contract_fill_data",autoResultMap = true)
public class ContractFillData extends BaseEntity {
//字段名称
@TableField("title")
private String title;
//字段类型
@TableField("type")
private String type;
//字段标识
@TableField("field")
private String field;
//是否必填
@TableField("required")
private boolean required;
//下拉值
@TableField(value = "select_list",typeHandler = FastjsonTypeHandler.class)
private List<Object> selectList;
//字段值
@TableField("value")
private String value;
//模板id
@TableField("template_id")
private Long templateId;
}
......@@ -8,6 +8,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
import java.util.List;
/**
*
......@@ -248,4 +249,8 @@ public class HouseholdContract extends BaseEntity {
@TableField("project_user_id")
private String projectUserId;
//合同填充字段值
@TableField(exist = false)
List<ContractFillData> contractFillData;
}
package com.yeejoin.amos.boot.module.hygf.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.hygf.api.entity.ContractFill;
import com.yeejoin.amos.boot.module.hygf.api.entity.ContractFillData;
/**
* @description:
* @author: tw
* @createDate: 2023/11/23
*/
public interface ContractFillDataMapper extends BaseMapper<ContractFillData> {
}
package com.yeejoin.amos.boot.module.hygf.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.hygf.api.entity.ContractFill;
/**
* @description:
* @author: tw
* @createDate: 2023/11/23
*/
public interface ContractFillMapper extends BaseMapper<ContractFill> {
}
......@@ -22,14 +22,8 @@ import com.yeejoin.amos.boot.module.hygf.api.Enum.TaskTypeStationEnum;
import com.yeejoin.amos.boot.module.hygf.api.dto.CallbackDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.ContractDataDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.HouseholdContractDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.HouseholdContract;
import com.yeejoin.amos.boot.module.hygf.api.entity.SealDictionary;
import com.yeejoin.amos.boot.module.hygf.api.entity.ToDoTasks;
import com.yeejoin.amos.boot.module.hygf.api.entity.UserMessage;
import com.yeejoin.amos.boot.module.hygf.api.mapper.HouseholdContractMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.SealDictionaryMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.ToDoTasksMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.UserMessageMapper;
import com.yeejoin.amos.boot.module.hygf.api.entity.*;
import com.yeejoin.amos.boot.module.hygf.api.mapper.*;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.HouseholdContractServiceImpl;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.QiyuesuoServiceImpl;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.ToDoTasksServiceImpl;
......@@ -50,6 +44,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
import javax.ws.rs.GET;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
......@@ -87,6 +82,8 @@ public class QiyuesuoController extends BaseController {
ToDoTasksServiceImpl toDoTasksServiceImpl;
@Value("${dealer.engineering}")
private String engineering;
@Autowired
ContractFillMapper contractFillMapper;
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "POST",value = "个人token", notes = "个人token")
......@@ -129,6 +126,19 @@ public class QiyuesuoController extends BaseController {
return ResponseHelper.buildResponse(householdContract);
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "POST",value = "合同填充字段", notes = "合同填充字段")
@GetMapping (value = "/getContractFill")
public ResponseModel<List<ContractFill>> initiateHouseholdContract(Long templateId) {
LambdaQueryWrapper<ContractFill> up=new LambdaQueryWrapper();
up.eq(templateId!=null,ContractFill::getTemplateId,templateId);
List<ContractFill> list= contractFillMapper.selectList(up);
return ResponseHelper.buildResponse(list);
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
......
......@@ -6,6 +6,7 @@ import com.yeejoin.amos.boot.module.hygf.api.Enum.HouseholdContractEnum;
import com.yeejoin.amos.boot.module.hygf.api.Enum.TaskTypeStationEnum;
import com.yeejoin.amos.boot.module.hygf.api.dto.*;
import com.yeejoin.amos.boot.module.hygf.api.entity.*;
import com.yeejoin.amos.boot.module.hygf.api.mapper.ContractFillDataMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.ContractTemplateMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.HouseholdContractMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.SealDictionaryMapper;
......@@ -52,6 +53,8 @@ public class HouseholdContractServiceImpl extends BaseService<HouseholdContractD
@Autowired
PeasantHouseholdServiceImpl peasantHouseholdServiceImpl;
@Autowired
ContractFillDataMapper contractFillDataMapper;
/**
* 列表查询 示例
*/
......@@ -172,21 +175,34 @@ public class HouseholdContractServiceImpl extends BaseService<HouseholdContractD
Date now=new Date();
String daty= myFmt2.format(now);
List<TemplateParamDto> templateParam=new ArrayList<>();
//公共字段填充
SimpleDateFormat sdfdate = new SimpleDateFormat("yyyy-MM-dd");
templateParam.add(new TemplateParamDto("partyA",householdContract.getPartyA()!=null?householdContract.getPartyA():null));
templateParam.add(new TemplateParamDto("peasantHouseholdPhone",householdContract.getPeasantHouseholdPhone()!=null?householdContract.getPeasantHouseholdPhone():null));
templateParam.add(new TemplateParamDto("rentFree",householdContract.getRentFree()!=null?sdfdate.format(householdContract.getRentFree()):null));
templateParam.add(new TemplateParamDto("rentCalculationDate",householdContract.getRentCalculationDate()!=null?sdfdate.format(householdContract.getRentCalculationDate()):null));
templateParam.add(new TemplateParamDto("leaseEndDate",householdContract.getLeaseEndDate()!=null?sdfdate.format(householdContract.getLeaseEndDate()):null));
templateParam.add(new TemplateParamDto("constructionScale",householdContract.getConstructionScale()!=null?String.valueOf(householdContract.getConstructionScale()):null));
templateParam.add(new TemplateParamDto("componentQuantityBlock",householdContract.getComponentQuantityBlock()!=null?String.valueOf(householdContract.getComponentQuantityBlock()):null));
templateParam.add(new TemplateParamDto("totalInvestment",householdContract.getTotalInvestment()!=null?String.valueOf(householdContract.getTotalInvestment()):null));
templateParam.add(new TemplateParamDto("peasantHouseholdCard",householdContract.getPeasantHouseholdCard()!=null?householdContract.getPeasantHouseholdCard():null));
templateParam.add(new TemplateParamDto("permanentAddressDetail",householdContract.getPermanentAddressName()!=null?householdContract.getPermanentAddressName()+householdContract.getPermanentAddressDetail():null));
templateParam.add(new TemplateParamDto("projectAddressDetail",householdContract.getProjectAddressName()!=null?householdContract.getProjectAddressName()+householdContract.getProjectAddressDetail():null));
templateParam.add(new TemplateParamDto("componentPower",householdContract.getComponentPower()!=null?String.valueOf(householdContract.getComponentPower()):null));
templateParam.add(new TemplateParamDto("stationPower",householdContract.getStationPower()!=null?String.valueOf(householdContract.getStationPower()):null));
templateParam.add(new TemplateParamDto("signingTime",daty));
//合同动态填充字段
// templateParam.add(new TemplateParamDto("rentFree",householdContract.getRentFree()!=null?sdfdate.format(householdContract.getRentFree()):null));
// templateParam.add(new TemplateParamDto("rentCalculationDate",householdContract.getRentCalculationDate()!=null?sdfdate.format(householdContract.getRentCalculationDate()):null));
// templateParam.add(new TemplateParamDto("leaseEndDate",householdContract.getLeaseEndDate()!=null?sdfdate.format(householdContract.getLeaseEndDate()):null));
// templateParam.add(new TemplateParamDto("constructionScale",householdContract.getConstructionScale()!=null?String.valueOf(householdContract.getConstructionScale()):null));
// templateParam.add(new TemplateParamDto("componentQuantityBlock",householdContract.getComponentQuantityBlock()!=null?String.valueOf(householdContract.getComponentQuantityBlock()):null));
// templateParam.add(new TemplateParamDto("totalInvestment",householdContract.getTotalInvestment()!=null?String.valueOf(householdContract.getTotalInvestment()):null));
// templateParam.add(new TemplateParamDto("componentPower",householdContract.getComponentPower()!=null?String.valueOf(householdContract.getComponentPower()):null));
// templateParam.add(new TemplateParamDto("stationPower",householdContract.getStationPower()!=null?String.valueOf(householdContract.getStationPower()):null));
List<ContractFillData> contractFillData= model.getContractFillData();
if(contractFillData!=null&&!contractFillData.isEmpty()){
for (ContractFillData contractFillDatum : contractFillData) {
templateParam.add(new TemplateParamDto(contractFillDatum.getField(),contractFillDatum.getValue()));
//保存动态值
contractFillDataMapper.insert(contractFillDatum);
}
}
Long contractLockId=qiyuesuoServiceImpl.addContract(contractDataDto , templateParam);
householdContract.setContractLockId(contractLockId);
householdContract.setInitiateStatus(HouseholdContractEnum.发起状态_已发起.getCode());
......@@ -284,19 +300,32 @@ public class HouseholdContractServiceImpl extends BaseService<HouseholdContractD
SimpleDateFormat sdfdate = new SimpleDateFormat("yyyy-MM-dd");
templateParam.add(new TemplateParamDto("partyA",householdContract.getPartyA()!=null?householdContract.getPartyA():null));
templateParam.add(new TemplateParamDto("peasantHouseholdPhone",householdContract.getPeasantHouseholdPhone()!=null?householdContract.getPeasantHouseholdPhone():null));
templateParam.add(new TemplateParamDto("rentFree",householdContract.getRentFree()!=null?sdfdate.format(householdContract.getRentFree()):null));
templateParam.add(new TemplateParamDto("rentCalculationDate",householdContract.getRentCalculationDate()!=null?sdfdate.format(householdContract.getRentCalculationDate()):null));
templateParam.add(new TemplateParamDto("leaseEndDate",householdContract.getLeaseEndDate()!=null?sdfdate.format(householdContract.getLeaseEndDate()):null));
templateParam.add(new TemplateParamDto("constructionScale",householdContract.getConstructionScale()!=null?String.valueOf(householdContract.getConstructionScale()):null));
templateParam.add(new TemplateParamDto("componentQuantityBlock",householdContract.getComponentQuantityBlock()!=null?String.valueOf(householdContract.getComponentQuantityBlock()):null));
templateParam.add(new TemplateParamDto("totalInvestment",householdContract.getTotalInvestment()!=null?String.valueOf(householdContract.getTotalInvestment()):null));
templateParam.add(new TemplateParamDto("peasantHouseholdCard",householdContract.getPeasantHouseholdCard()!=null?householdContract.getPeasantHouseholdCard():null));
templateParam.add(new TemplateParamDto("permanentAddressDetail",householdContract.getPermanentAddressName()!=null?householdContract.getPermanentAddressName()+householdContract.getPermanentAddressDetail():null));
templateParam.add(new TemplateParamDto("projectAddressDetail",householdContract.getProjectAddressName()!=null?householdContract.getProjectAddressName()+householdContract.getProjectAddressDetail():null));
templateParam.add(new TemplateParamDto("componentPower",householdContract.getComponentPower()!=null?String.valueOf(householdContract.getComponentPower()):null));
templateParam.add(new TemplateParamDto("stationPower",householdContract.getStationPower()!=null?String.valueOf(householdContract.getStationPower()):null));
templateParam.add(new TemplateParamDto("signingTime",daty));
//合同动态填充字段
// templateParam.add(new TemplateParamDto("rentFree",householdContract.getRentFree()!=null?sdfdate.format(householdContract.getRentFree()):null));
// templateParam.add(new TemplateParamDto("rentCalculationDate",householdContract.getRentCalculationDate()!=null?sdfdate.format(householdContract.getRentCalculationDate()):null));
// templateParam.add(new TemplateParamDto("leaseEndDate",householdContract.getLeaseEndDate()!=null?sdfdate.format(householdContract.getLeaseEndDate()):null));
// templateParam.add(new TemplateParamDto("constructionScale",householdContract.getConstructionScale()!=null?String.valueOf(householdContract.getConstructionScale()):null));
// templateParam.add(new TemplateParamDto("componentQuantityBlock",householdContract.getComponentQuantityBlock()!=null?String.valueOf(householdContract.getComponentQuantityBlock()):null));
// templateParam.add(new TemplateParamDto("totalInvestment",householdContract.getTotalInvestment()!=null?String.valueOf(householdContract.getTotalInvestment()):null));
// templateParam.add(new TemplateParamDto("componentPower",householdContract.getComponentPower()!=null?String.valueOf(householdContract.getComponentPower()):null));
// templateParam.add(new TemplateParamDto("stationPower",householdContract.getStationPower()!=null?String.valueOf(householdContract.getStationPower()):null));
List<ContractFillData> contractFillData= model.getContractFillData();
if(contractFillData!=null&&!contractFillData.isEmpty()){
for (ContractFillData contractFillDatum : contractFillData) {
templateParam.add(new TemplateParamDto(contractFillDatum.getField(),contractFillDatum.getValue()));
//保存动态值
contractFillDataMapper.insert(contractFillDatum);
}
}
Long contractLockId=qiyuesuoServiceImpl.addContract(contractDataDto , templateParam);
householdContract.setContractLockId(contractLockId);
householdContract.setInitiateStatus(HouseholdContractEnum.发起状态_已发起.getCode());
......
......@@ -377,7 +377,6 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
//权限
List<String> statioId=new ArrayList();
if(reviewDto.getThirdStationIds()!=null){
//平台bug,暂时处理
List<String> dd= reviewDto.getThirdStationIds()!=null? JSON.parseArray(reviewDto.getThirdStationIds().get(0),String.class):null;
reviewDto.setThirdStationIds(dd);
}
......@@ -564,7 +563,6 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
//权限
List<String> statioId=new ArrayList();
if(reviewDto.getThirdStationIds()!=null){
//平台bug,暂时处理
List<String> dd= reviewDto.getThirdStationIds()!=null? JSON.parseArray(reviewDto.getThirdStationIds().get(0),String.class):null;
reviewDto.setThirdStationIds(dd);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment