Compare commits
2 Commits
e40f3599df
...
0e9900eadc
| Author | SHA1 | Date | |
|---|---|---|---|
| 0e9900eadc | |||
| 8bb1fb49d2 |
@@ -3,9 +3,7 @@ package com.seeyon.apps.src_rent;
|
||||
import com.seeyon.apps.common.plugin.api.APluginInfoApi;
|
||||
import com.seeyon.apps.common.plugin.vo.ConfigVo;
|
||||
import com.seeyon.apps.src_rent.constants.RentConstants;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class QiChenRentPluginApi extends APluginInfoApi {
|
||||
public QiChenRentPluginApi() {
|
||||
}
|
||||
|
||||
@@ -13,21 +13,14 @@ import com.seeyon.ctp.common.filemanager.manager.AttachmentManager;
|
||||
import com.seeyon.ctp.organization.bo.V3xOrgMember;
|
||||
import com.seeyon.ctp.organization.manager.OrgManager;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
@Component
|
||||
public class AssetsService {
|
||||
|
||||
@Autowired
|
||||
private RentConfigProvider configProvider;
|
||||
@Autowired
|
||||
private FormDataOperator formDataOperator;
|
||||
private RentConfigProvider configProvider = (RentConfigProvider)AppContext.getBean("rentConfigProvider");
|
||||
private FormDataOperator formDataOperator = (FormDataOperator) AppContext.getBean("qcFormDataOperator");
|
||||
|
||||
private AttachmentManager attachmentManager = (AttachmentManager) AppContext.getBean("attachmentManager");
|
||||
private OrgManager orgManager = (OrgManager) AppContext.getBean("orgManager");
|
||||
@@ -70,23 +63,81 @@ public class AssetsService {
|
||||
if(StringUtils.isNotBlank(params.getString("assetsType"))) {
|
||||
handleAssetsSubType(conditions,params.getString("assetsType"));
|
||||
}
|
||||
if(StringUtils.isNotBlank(params.getString("bizZone"))) {
|
||||
conditions.add(FormWhereCondition.build().display("商圈位置")
|
||||
.value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"商圈位置",params.getString("bizZone"))));
|
||||
}
|
||||
if(StringUtils.isNotBlank(params.getString("renovationStatus"))) {
|
||||
conditions.add(FormWhereCondition.build().display("装修情况")
|
||||
.value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"装修情况",params.getString("renovationStatus"))));
|
||||
}
|
||||
if(StringUtils.isNotBlank(params.getString("layout"))) {
|
||||
conditions.add(FormWhereCondition.build().display("房屋户型")
|
||||
.value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"房屋户型",params.getString("layout"))));
|
||||
}
|
||||
if(StringUtils.isNotBlank(params.getString("rentFeeRange"))) {
|
||||
String[] split = params.getString("rentFeeRange").split("-");
|
||||
String rentFeeStart = null;
|
||||
if(split.length > 1) {
|
||||
rentFeeStart = split[0];
|
||||
}
|
||||
String rentFeeEnd = split[split.length - 1];
|
||||
if(rentFeeStart != null) {
|
||||
conditions.add(FormWhereCondition.build().display("评估-参考租金").clauseFactor(ClauseFactor.GE)
|
||||
.value(new BigDecimal(rentFeeStart)));
|
||||
}
|
||||
conditions.add(FormWhereCondition.build().display("评估-参考租金").clauseFactor(ClauseFactor.LE)
|
||||
.value(new BigDecimal(rentFeeEnd)));
|
||||
}
|
||||
if(StringUtils.isNotBlank(params.getString("features"))){
|
||||
String[] features = params.getString("features").split(",");
|
||||
for (Object feature : features) {
|
||||
conditions.add(FormWhereCondition.build().display("基础配套").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"基础配套",feature + ""))
|
||||
.index("FIND_IN_SET(?").clauseFactor(ClauseFactor.GT));
|
||||
}
|
||||
}
|
||||
if(StringUtils.isNotBlank(params.getString("keyWord"))){
|
||||
conditions.add(FormWhereCondition.build().display("品牌名称")
|
||||
.startWithBracket(true)
|
||||
.concatFactor(ClauseFactor.OR)
|
||||
.value(params.getString("keyWord"))
|
||||
.clauseFactor(ClauseFactor.LIKE));
|
||||
conditions.add(FormWhereCondition.build().display("管理区域")
|
||||
.concatFactor(ClauseFactor.OR)
|
||||
.value(params.getString("keyWord"))
|
||||
.clauseFactor(ClauseFactor.LIKE));
|
||||
handleBizZoneSet(conditions,params.getString("keyWord"));
|
||||
conditions.add(FormWhereCondition.build().display("所在位置")
|
||||
.value(params.getString("keyWord"))
|
||||
.endWithBracket(true)
|
||||
.clauseFactor(ClauseFactor.LIKE));
|
||||
}
|
||||
return conditions;
|
||||
}
|
||||
|
||||
public Set<String> getAllBizZones(){
|
||||
return EnumMapUtils.getEnumItemValues(getFormNo(),"商圈位置");
|
||||
}
|
||||
|
||||
public Set<String> getFeatures(){
|
||||
return EnumMapUtils.getEnumItemValues(getFormNo(),"基础配套");
|
||||
}
|
||||
|
||||
private void handleBizZoneSet(List<FormWhereCondition> conditions,String keyWord) {
|
||||
if (conditions == null || keyWord == null || keyWord.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
Set<String> allBizZones = getAllBizZones();
|
||||
Set<String> tempSet = new HashSet<>();
|
||||
FormWhereCondition condition = FormWhereCondition.build().display("商圈位置").clauseFactor(ClauseFactor.IN).concatFactor(ClauseFactor.OR);
|
||||
for (String bizZone : allBizZones) {
|
||||
if(bizZone.contains(keyWord)){
|
||||
String enumItemId = EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"商圈位置",bizZone);
|
||||
tempSet.add(enumItemId);
|
||||
}
|
||||
}
|
||||
condition.addAllValue(tempSet);
|
||||
if(condition.getValues().size() > 0) {
|
||||
conditions.add(condition);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleAssetsSubType(List<FormWhereCondition> conditions,String type) {
|
||||
if("住房".equals(type)) {
|
||||
conditions
|
||||
@@ -131,6 +182,20 @@ public class AssetsService {
|
||||
return queryAssetsDetail(object);
|
||||
}
|
||||
|
||||
public String getContractNoByAssetsNo(String assetsNo) throws Exception {
|
||||
if(assetsNo == null) {
|
||||
return null;
|
||||
}
|
||||
List<FormWhereCondition> conditions = new ArrayList<>();
|
||||
conditions.add(FormWhereCondition.build().display("资产编号").value(assetsNo));
|
||||
FormColumn formColumn = formDataOperator.queryOneRowFormData(getFormNo(), true, null, conditions);
|
||||
if(formColumn == null) {
|
||||
return null;
|
||||
}
|
||||
Map<String, Object> fieldsMap = formColumn.getFieldsMap();
|
||||
return getStringValue(fieldsMap,"合同编号");
|
||||
}
|
||||
|
||||
public ContractAssetsVo queryContractAssetsDetail(JSONObject params) throws Exception {
|
||||
List<FormWhereCondition> conditions = buildConditions(params);
|
||||
ContractAssetsVo assetsVo = new ContractAssetsVo();
|
||||
@@ -181,21 +246,46 @@ public class AssetsService {
|
||||
assetsVo.setFloorNo(getStringValue(fieldsMap,"楼层"));
|
||||
assetsVo.setUnitNo(getStringValue(fieldsMap,"单元"));
|
||||
assetsVo.setRoomNo(getStringValue(fieldsMap,"门牌号"));
|
||||
assetsVo.setBuilding(getStringValue(fieldsMap,"门牌号"));
|
||||
V3xOrgMember member = orgManager.getMemberById(Long.parseLong((String)fieldsMap.get("运营管理员")));
|
||||
assetsVo.setBuilding(getStringValue(fieldsMap,"楼栋"));
|
||||
assetsVo.setHasLift(getStringValue(fieldsMap,"有无电梯"));
|
||||
assetsVo.setManagerPhone(getStringValue(fieldsMap,"管理员联系方式"));
|
||||
assetsVo.setBizZone(getStringValue(fieldsMap,"商圈位置"));
|
||||
assetsVo.setLayout(getStringValue(fieldsMap,"房屋户型"));
|
||||
assetsVo.setRenovationStatus(getStringValue(fieldsMap,"装修情况"));
|
||||
V3xOrgMember member = null;
|
||||
try {
|
||||
member = orgManager.getMemberById(Long.parseLong((String)fieldsMap.get("运营管理员")));
|
||||
}catch (Exception e) {
|
||||
|
||||
}
|
||||
if(member != null) {
|
||||
assetsVo.setManagerName(member.getName().substring(0,1) + "管家");
|
||||
}
|
||||
BigDecimal area = (BigDecimal)fieldsMap.get("评估-评估面积");
|
||||
BigDecimal price = (BigDecimal)fieldsMap.get("评估-评估单价");
|
||||
if(area != null && price != null) {
|
||||
assetsVo.setRentFee(area.multiply(price).toString());
|
||||
BigDecimal rentFee = (BigDecimal)fieldsMap.get("评估-参考租金");
|
||||
assetsVo.setFootPrint(area.toString());
|
||||
if(area != null && rentFee != null) {
|
||||
assetsVo.setRentFee(rentFee.toString());
|
||||
}
|
||||
if(fieldsMap.get("VR文件上传") != null) {
|
||||
assetsVo.setVrImg(OaFileVo.getInstance((Long)fieldsMap.get("VR文件上传"),attachmentManager));
|
||||
assetsVo.setVrImg(OaFileVo.getInstance(Long.parseLong((String)fieldsMap.get("VR文件上传")),attachmentManager));
|
||||
}
|
||||
if(fieldsMap.get("资产图片") != null) {
|
||||
assetsVo.setDetailImg(OaFileVo.getInstance(Long.parseLong((String)fieldsMap.get("资产图片")),attachmentManager));
|
||||
}
|
||||
if(fieldsMap.get("封面展示图") != null) {
|
||||
assetsVo.setCoverImg(OaFileVo.getInstance(Long.parseLong((String)fieldsMap.get("封面展示图")),attachmentManager));
|
||||
}
|
||||
}
|
||||
|
||||
public Map<String,Object> getAssetsManagerInfo(String assetsNo) throws Exception {
|
||||
String formNo = configProvider.getBizConfigByKey(RentConstants.ASSETS_FORMNO);
|
||||
List<FormWhereCondition> conditions = new ArrayList<>();
|
||||
conditions.add(FormWhereCondition.build().display("资产编号").value(assetsNo));
|
||||
FormColumn formColumn = formDataOperator.queryOneRowFormData(formNo, false, null, conditions);
|
||||
if(formColumn == null || formColumn.getFieldsMap() == null) {
|
||||
return null;
|
||||
}
|
||||
return formColumn.getFieldsMap();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.seeyon.apps.src_rent.assets;
|
||||
|
||||
import com.seeyon.apps.src_rent.file.OaFileVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class OaAssetsVo {
|
||||
|
||||
private String assetsNo; // 资产编号
|
||||
@@ -12,6 +14,7 @@ public class OaAssetsVo {
|
||||
private String footPrint; //占地大小
|
||||
private String formId; //表单记录ID
|
||||
private OaFileVo detailImg; //详情图片
|
||||
private OaFileVo coverImg; //封面图片
|
||||
private OaFileVo vrImg; //vr图
|
||||
private String assetsDesc; //资产描述
|
||||
private String assetsAddress; //资产地址
|
||||
@@ -20,7 +23,7 @@ public class OaAssetsVo {
|
||||
private String unitNo; //单元号
|
||||
private String floorNo; //楼层号
|
||||
private String roomNo; //房间号
|
||||
private Boolean hasLift;//有无电梯
|
||||
private String hasLift;//有无电梯
|
||||
private String managerPhone; //管理员电话
|
||||
private String managerName; //管理员姓名
|
||||
private String layout; //户型
|
||||
@@ -30,6 +33,9 @@ public class OaAssetsVo {
|
||||
private String waterFeeUnit; //水费单位
|
||||
private String powerFee; //电费
|
||||
private String powerFeeUnit; //电费单位
|
||||
private String bizZone;
|
||||
private List<String> features;
|
||||
private String renovationStatus; //装修状态
|
||||
|
||||
public String getAssetsNo() {
|
||||
return assetsNo;
|
||||
@@ -159,11 +165,11 @@ public class OaAssetsVo {
|
||||
this.roomNo = roomNo;
|
||||
}
|
||||
|
||||
public Boolean getHasLift() {
|
||||
public String getHasLift() {
|
||||
return hasLift;
|
||||
}
|
||||
|
||||
public void setHasLift(Boolean hasLift) {
|
||||
public void setHasLift(String hasLift) {
|
||||
this.hasLift = hasLift;
|
||||
}
|
||||
|
||||
@@ -238,4 +244,36 @@ public class OaAssetsVo {
|
||||
public void setManagerName(String managerName) {
|
||||
this.managerName = managerName;
|
||||
}
|
||||
|
||||
public String getBizZone() {
|
||||
return bizZone;
|
||||
}
|
||||
|
||||
public void setBizZone(String bizZone) {
|
||||
this.bizZone = bizZone;
|
||||
}
|
||||
|
||||
public List<String> getFeatures() {
|
||||
return features;
|
||||
}
|
||||
|
||||
public void setFeatures(List<String> features) {
|
||||
this.features = features;
|
||||
}
|
||||
|
||||
public String getRenovationStatus() {
|
||||
return renovationStatus;
|
||||
}
|
||||
|
||||
public void setRenovationStatus(String renovationStatus) {
|
||||
this.renovationStatus = renovationStatus;
|
||||
}
|
||||
|
||||
public OaFileVo getCoverImg() {
|
||||
return coverImg;
|
||||
}
|
||||
|
||||
public void setCoverImg(OaFileVo coverImg) {
|
||||
this.coverImg = coverImg;
|
||||
}
|
||||
}
|
||||
@@ -1,29 +1,46 @@
|
||||
package com.seeyon.apps.src_rent.bill;
|
||||
|
||||
import cn.hutool.log.Log;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.seeyon.apps.src_rent.assets.AssetsService;
|
||||
import com.seeyon.apps.src_rent.assets.OaAssetsVo;
|
||||
import com.seeyon.apps.src_rent.config.RentConfigProvider;
|
||||
import com.seeyon.apps.src_rent.constants.RentConstants;
|
||||
import com.seeyon.apps.src_rent.contract.ContractDocService;
|
||||
import com.seeyon.apps.src_rent.contract.ContractService;
|
||||
import com.seeyon.apps.src_rent.flow.FlowCreateService;
|
||||
import com.seeyon.apps.src_rent.form.*;
|
||||
import com.seeyon.apps.src_rent.po.PageQueryVo;
|
||||
import com.seeyon.cap4.form.api.FormApi4Cap4;
|
||||
import com.seeyon.cap4.form.bean.FormBean;
|
||||
import com.seeyon.cap4.form.bean.FormFieldBean;
|
||||
import com.seeyon.cap4.form.bean.FormTableBean;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
import com.seeyon.ctp.organization.bo.V3xOrgMember;
|
||||
import com.seeyon.ctp.organization.manager.OrgManager;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.math.RoundingMode;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
|
||||
@Component
|
||||
public class BillService {
|
||||
|
||||
@Autowired
|
||||
private RentConfigProvider configProvider;
|
||||
@Autowired
|
||||
private FormDataOperator formDataOperator;
|
||||
@Autowired
|
||||
private ContractService contractService;
|
||||
private static final Log log = Log.get(BillService.class);
|
||||
private RentConfigProvider configProvider = (RentConfigProvider) AppContext.getBean("rentConfigProvider");
|
||||
private FormDataOperator formDataOperator = (FormDataOperator) AppContext.getBean("qcFormDataOperator");
|
||||
private ContractService contractService = (ContractService) AppContext.getBean("qcContractService");
|
||||
private AssetsService assetsService = (AssetsService) AppContext.getBean("qcAssetsService");
|
||||
private ContractDocService contractDocService = (ContractDocService) AppContext.getBean("qcContractDocService");
|
||||
private FlowCreateService flowCreateService = (FlowCreateService) AppContext.getBean("qcFlowCreateService");
|
||||
private OrgManager orgManager = (OrgManager) AppContext.getBean("orgManager");
|
||||
private DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
||||
private DateFormat sysDf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
private String getFormNo() {
|
||||
return configProvider.getBizConfigByKey(RentConstants.CONTRACTBILLFORMNO);
|
||||
@@ -45,11 +62,18 @@ public class BillService {
|
||||
if(StringUtils.isNotBlank(params.getString("billNo"))) {
|
||||
conditions.add(FormWhereCondition.build().display("租赁账单编号").value(params.getString("billNo")));
|
||||
}
|
||||
if(StringUtils.isNotBlank(params.getString("startDate"))) {
|
||||
conditions.add(FormWhereCondition.build().display("账单-开始日期").clauseFactor(ClauseFactor.GT).value(params.getString("startDate")));
|
||||
}
|
||||
if(StringUtils.isNotBlank(params.getString("endDate"))) {
|
||||
conditions.add(FormWhereCondition.build().display("账单-开始日期").clauseFactor(ClauseFactor.LE).value(params.getString("endDate")));
|
||||
}
|
||||
if(StringUtils.isNotBlank(params.getString("billStatus"))) {
|
||||
if("已缴费".equals(params.getString("billStatus"))) {
|
||||
conditions.add(FormWhereCondition.build().display("收款结果反馈").clauseFactor(ClauseFactor.NOT_NULL));
|
||||
conditions.add(FormWhereCondition.build().display("账单-收款结果反馈").clauseFactor(ClauseFactor.NOT_NULL));
|
||||
}else {
|
||||
conditions.add(FormWhereCondition.build().display("收款结果反馈").clauseFactor(ClauseFactor.NULL));
|
||||
conditions.add(FormWhereCondition.build().display("账单-收款结果反馈").clauseFactor(ClauseFactor.NULL).startWithBracket(true).concatFactor(ClauseFactor.OR));
|
||||
conditions.add(FormWhereCondition.build().display("账单-收款结果反馈").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"账单-收款结果反馈","未收款")).endWithBracket(true));
|
||||
}
|
||||
}
|
||||
return conditions;
|
||||
@@ -75,7 +99,8 @@ public class BillService {
|
||||
|
||||
public Integer countUnpayRentBills(JSONObject params) throws Exception {
|
||||
List<FormWhereCondition> conditions = buildConditions(params);
|
||||
conditions.add(FormWhereCondition.build().display("收款结果反馈").clauseFactor(ClauseFactor.NULL));
|
||||
conditions.add(FormWhereCondition.build().display("账单-收款结果反馈").clauseFactor(ClauseFactor.NULL).startWithBracket(true).concatFactor(ClauseFactor.OR));
|
||||
conditions.add(FormWhereCondition.build().display("账单-收款结果反馈").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"账单-收款结果反馈","未收款")).endWithBracket(true));
|
||||
Long count = formDataOperator.countConditon(getFormNo(), conditions);
|
||||
return count.intValue();
|
||||
}
|
||||
@@ -85,7 +110,7 @@ public class BillService {
|
||||
Integer pageNo = params.getInteger("pageNo") == null ? 1 : params.getInteger("pageNo");
|
||||
Integer pageSize = params.getInteger("pageSize") == null ? 10 : params.getInteger("pageSize");
|
||||
PageQueryVo<BillVo> pageQueryVo = new PageQueryVo();
|
||||
List<Object> datas = formDataOperator.queryFormDataPageCondition(getFormNo(), true,null, conditions, pageNo, pageSize);
|
||||
List<Object> datas = formDataOperator.queryFormDataPageCondition(getFormNo(), true,null, conditions, pageNo, pageSize,"账单-开始日期",null);
|
||||
List<BillVo> vos = new ArrayList<>();
|
||||
Long count = formDataOperator.countConditon(getFormNo(), conditions);
|
||||
if(datas.size() > 0){
|
||||
@@ -115,15 +140,19 @@ public class BillService {
|
||||
|
||||
public void fillVo(Map<String, Object> fieldsMap, BillVo billVo) throws Exception {
|
||||
billVo.setBillType("CONTRACT");
|
||||
billVo.setBillNo(getStringValue(fieldsMap,"租赁账单编号" ));
|
||||
String payStatus = fieldsMap.get("收款结果反馈") == null ? "待缴费" : getStringValue(fieldsMap,"收款结果反馈");
|
||||
billVo.setBillNo(getStringValue(fieldsMap,"账单-账单明细编号" ));
|
||||
String payStatus = fieldsMap.get("账单-收款结果反馈") == null ? "待缴费" : getStringValue(fieldsMap,"收款结果反馈");
|
||||
billVo.setBillStatus(payStatus);
|
||||
billVo.setCusNo(getStringValue(fieldsMap,"承租方编号"));
|
||||
billVo.setBillStartDate(getStringValue(fieldsMap,"开始日期"));
|
||||
billVo.setBillStartDate(getStringValue(fieldsMap,"账单-开始日期"));
|
||||
billVo.setContractNo(getStringValue(fieldsMap,"合同编号"));
|
||||
billVo.setBillPayEndDate(getStringValue(fieldsMap,"账单-当前缴费时限"));
|
||||
billVo.setBillEndDate(getStringValue(fieldsMap,"结束日期"));
|
||||
String asssetsName = fieldsMap.get("资产名称") == null ? "" : fieldsMap.get("资产名称") + "-";
|
||||
billVo.setBillEndDate(getStringValue(fieldsMap,"账单-结束日期"));
|
||||
OaAssetsVo oaAssetsVo = assetsService.queryAssetsDetail(getStringValue(fieldsMap,"资产编号"));
|
||||
String asssetsName = null;
|
||||
if(oaAssetsVo != null) {
|
||||
asssetsName = oaAssetsVo.getAssetsName();
|
||||
}
|
||||
String roomNo = fieldsMap.get("门牌号") == null ? "" : fieldsMap.get("门牌号") + "-";
|
||||
String billTerm = "(" + billVo.getBillStartDate() + "-" + billVo.getBillEndDate() + ")";
|
||||
billVo.setBillName(asssetsName + roomNo + billTerm);
|
||||
@@ -134,9 +163,137 @@ public class BillService {
|
||||
|
||||
private String buildBillName(Map<String, Object> fieldsMap) throws Exception {
|
||||
String contractNo = getStringValue(fieldsMap,"合同编号");
|
||||
String term = contractService.queryContractPayPeriod(contractNo,getStringValue(fieldsMap,"开始日期")) + "-";
|
||||
String asssetsName = fieldsMap.get("资产名称") == null ? "" : fieldsMap.get("资产名称") + "-";
|
||||
String term = contractService.queryContractPayPeriod(contractNo,getStringValue(fieldsMap,"账单-开始日期")) + "-";
|
||||
OaAssetsVo oaAssetsVo = assetsService.queryAssetsDetail(getStringValue(fieldsMap,"资产编号"));
|
||||
String asssetsName = null;
|
||||
if(oaAssetsVo != null) {
|
||||
asssetsName = oaAssetsVo.getAssetsName();
|
||||
}
|
||||
String roomNo = fieldsMap.get("门牌号") == null ? "" : fieldsMap.get("门牌号") + "-";
|
||||
return asssetsName + roomNo + term;
|
||||
}
|
||||
|
||||
public String getBillPayReceiver(String billNo) throws Exception {
|
||||
List<FormWhereCondition> conditions = new ArrayList<>();
|
||||
conditions.add(FormWhereCondition.build().display("账单-账单明细编号").value(billNo));
|
||||
FormColumn formColumn = formDataOperator.queryOneRowFormData(getFormNo(), true, null, conditions);
|
||||
if(formColumn == null) {
|
||||
return null;
|
||||
}
|
||||
Map<String, Object> fieldsMap = formColumn.getFieldsMap();
|
||||
return getStringValue(fieldsMap,"签订单位");
|
||||
}
|
||||
|
||||
public void payCallBack(String billNo,String payDate) throws Exception {
|
||||
// 1. 获取Bean + 非空校验
|
||||
FormApi4Cap4 formApi4Cap4 = (FormApi4Cap4) AppContext.getBean("formApi4Cap4");
|
||||
if (formApi4Cap4 == null) {
|
||||
throw new Exception("Spring容器中未找到formApi4Cap4 Bean");
|
||||
}
|
||||
|
||||
// 2. 复用配置,避免重复查询
|
||||
String templateCode = this.configProvider.getBizConfigByKey(RentConstants.PAYMENT_REGISTRATION_TEMPLATECODE);
|
||||
String appName = this.configProvider.getBizConfigByKey(RentConstants.FORMAPPNAME);
|
||||
|
||||
// 3. 获取表单结构
|
||||
FormBean cap4FormBean = formApi4Cap4.getFormByFormCode(templateCode);
|
||||
FormTableBean masterTableBean = cap4FormBean.getMasterTableBean();
|
||||
String tableName = masterTableBean.getTableName();
|
||||
List<FormTableBean> subTableBeanList = cap4FormBean.getSubTableBean();
|
||||
FormTableBean subTableBean = null;
|
||||
// 4. 获取子表名 + 非空校验
|
||||
String subDbTableName = null;
|
||||
for (FormTableBean tableBean : subTableBeanList) {
|
||||
if ("租赁收款明细".equals(tableBean.getDisplay())) {
|
||||
subDbTableName = tableBean.getTableName();
|
||||
subTableBean = tableBean;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// 5. 构造数据结构(规范泛型)
|
||||
Map<String, Object> mainFormData = new HashMap<>();
|
||||
Map<String, List<Object>> subFormDataMap = new HashMap<>();
|
||||
List<Object> subFormDataList = new ArrayList<>();
|
||||
|
||||
Map<String, Object> mainData = new HashMap<>();
|
||||
mainFormData.put(tableName, mainData);
|
||||
if (subDbTableName != null) {
|
||||
log.info("明细表表名为: " + subDbTableName);
|
||||
subFormDataMap.put(subDbTableName, subFormDataList);
|
||||
}
|
||||
|
||||
// 6. 查询账单数据
|
||||
List<FormWhereCondition> conditions = new ArrayList<>();
|
||||
conditions.add(FormWhereCondition.build().display("账单-账单明细编号").value(billNo));
|
||||
FormColumn formColumn = this.formDataOperator.queryOneRowFormData(this.getFormNo(), false, null, conditions);
|
||||
// 7. 主数据非空判断
|
||||
if (formColumn == null || formColumn.getFieldsMap() == null) {
|
||||
throw new Exception("根据账单编号:" + billNo + "未查询到账单数据");
|
||||
}
|
||||
Map<String, Object> fieldsMap = formColumn.getFieldsMap();
|
||||
BigDecimal accountsReceivable = BigDecimal.ZERO;
|
||||
// 初始化实际收款金额(避免null)
|
||||
BigDecimal actualReceipts = BigDecimal.ZERO;
|
||||
BigDecimal rate = new BigDecimal("0.997");
|
||||
// 8. 组装子表数据
|
||||
Map<String, Object> subTableRowData = new HashMap<>();
|
||||
subTableRowData.put("账单明细编号", fieldsMap.get("账单-账单明细编号"));
|
||||
subTableRowData.put("开始日期", df.format((Date)fieldsMap.get("账单-开始日期")));
|
||||
subTableRowData.put("结束日期", df.format((Date)fieldsMap.get("账单-结束日期")));
|
||||
subTableRowData.put("当期缴费时限", fieldsMap.get("账单-当前缴费时限"));
|
||||
subTableRowData.put("综合减免", fieldsMap.get("账单-减免金额") == null ? BigDecimal.ZERO : fieldsMap.get("账单-减免金额"));
|
||||
subTableRowData.put("租费递增", fieldsMap.get("账单-租费递增") == null ? BigDecimal.ZERO : fieldsMap.get("账单-租费递增"));
|
||||
// 应收金额计算
|
||||
BigDecimal receivable = (BigDecimal) fieldsMap.get("账单-应收租金");
|
||||
if (receivable != null) {
|
||||
accountsReceivable = accountsReceivable.add(receivable);
|
||||
// 修复BigDecimal.setScale不生效问题
|
||||
actualReceipts = accountsReceivable.multiply(rate).setScale(2, RoundingMode.HALF_UP);
|
||||
}
|
||||
subTableRowData.put("应收租金", receivable);
|
||||
subTableRowData.put("未收租金", fieldsMap.get("账单-未收租金"));
|
||||
subTableRowData.put("资产编号", fieldsMap.get("资产编号"));
|
||||
subTableRowData.put("资产名称", fieldsMap.get("资产名称"));
|
||||
subTableRowData.put("本次收租金", receivable);
|
||||
subTableRowData.put("本次开票金额",receivable );
|
||||
subTableRowData.put("未开票金额", receivable);
|
||||
FormFieldBean formFieldBean = subTableBean.getFieldBeanByDisplay("收款结果");
|
||||
subTableRowData.put("收款结果", EnumMapUtils.getEnumItemValueByEnumId("已结清",formFieldBean.getEnumId()));
|
||||
subFormDataList.add(subTableRowData);
|
||||
// 9. 获取合同信息 + 非空校验
|
||||
String contractNo = (String) fieldsMap.get("合同编号");
|
||||
mainData.put("合同名称", fieldsMap.get("合同名称"));
|
||||
mainData.put("合同金额", fieldsMap.get("合同金额"));
|
||||
mainData.put("签订单位", fieldsMap.get("签订单位"));
|
||||
mainData.put("承租方类型", fieldsMap.get("承租方类型"));
|
||||
mainData.put("承租方名称", fieldsMap.get("承租方"));
|
||||
mainData.put("承租方名称编号", fieldsMap.get("承租方编号"));
|
||||
// 10. 经办人/部门信息(安全赋值)
|
||||
String assetNo = (String) fieldsMap.get("资产编号");
|
||||
Map<String, Object> assetsManagerInfo = this.assetsService.getAssetsManagerInfo(assetNo);
|
||||
if (assetsManagerInfo != null && assetsManagerInfo.get("运营管理员") != null) {
|
||||
String managerId = String.valueOf(assetsManagerInfo.get("运营管理员"));
|
||||
try {
|
||||
V3xOrgMember member = this.orgManager.getMemberById(Long.parseLong(managerId));
|
||||
if (member != null) {
|
||||
mainData.put("经办部门", member.getOrgDepartmentId());
|
||||
mainData.put("经办单位", member.getOrgAccountId());
|
||||
mainData.put("经办人员", managerId);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("获取经办人信息失败", e);
|
||||
}
|
||||
}
|
||||
// 11. 组装主表数据(线程安全日期)
|
||||
mainData.put("收款项", EnumMapUtils.getMasterTableEnumItemValue(templateCode, "收款项", "租金"));
|
||||
mainData.put("经办日期", LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
|
||||
mainData.put("本次收款时间", payDate);
|
||||
mainData.put("合同编号", contractNo);
|
||||
mainData.put("本次收款金额", actualReceipts);
|
||||
// 12. 启动流程
|
||||
this.flowCreateService.flowStart("微信小程序支付完成收款登记",
|
||||
mainFormData, subFormDataMap, appName, templateCode);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -3,30 +3,26 @@ package com.seeyon.apps.src_rent.bill;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.seeyon.apps.src_rent.config.RentConfigProvider;
|
||||
import com.seeyon.apps.src_rent.constants.RentConstants;
|
||||
import com.seeyon.apps.src_rent.form.ClauseFactor;
|
||||
import com.seeyon.apps.src_rent.form.EnumMapUtils;
|
||||
import com.seeyon.apps.src_rent.form.FormDataOperator;
|
||||
import com.seeyon.apps.src_rent.form.FormWhereCondition;
|
||||
import com.seeyon.apps.src_rent.po.PageQueryVo;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class FeeRecordService {
|
||||
|
||||
@Autowired
|
||||
private RentConfigProvider configProvider;
|
||||
@Autowired
|
||||
private FormDataOperator formDataOperator;
|
||||
@Autowired
|
||||
private BillService billService;
|
||||
@Autowired
|
||||
private WaeBillService waeBillService;
|
||||
private RentConfigProvider configProvider = (RentConfigProvider) AppContext.getBean("rentConfigProvider");
|
||||
private FormDataOperator formDataOperator = (FormDataOperator) AppContext.getBean("qcFormDataOperator");
|
||||
private BillService billService = (BillService) AppContext.getBean("qcBillService");
|
||||
private WaeBillService waeBillService = (WaeBillService) AppContext.getBean("qcWaeBillService");
|
||||
|
||||
private String getFormNo() {
|
||||
return configProvider.getBizConfigByKey(RentConstants.FEERECORDFORMNO);
|
||||
@@ -51,6 +47,21 @@ public class FeeRecordService {
|
||||
if(StringUtils.isNotBlank(params.getString("contractNo"))) {
|
||||
conditions.add(FormWhereCondition.build().display("合同编号").value(params.getString("contractNo")));
|
||||
}
|
||||
if(StringUtils.isNotBlank(params.getString("leType"))) {
|
||||
conditions.add(FormWhereCondition.build().display("收支类型").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"收支类型",params.getString("leType"))));
|
||||
}
|
||||
if(StringUtils.isNotBlank(params.getString("year"))) {
|
||||
conditions.add(FormWhereCondition.build()
|
||||
.display("收付款日期")
|
||||
.startWithBracket(true)
|
||||
.clauseFactor(ClauseFactor.GE)
|
||||
.value(params.getString("year") + "-01-01 00:00:00"));
|
||||
conditions.add(FormWhereCondition.build()
|
||||
.display("收付款日期")
|
||||
.endWithBracket(true)
|
||||
.clauseFactor(ClauseFactor.LE)
|
||||
.value(params.getString("year") + "-12-31 23:59:59"));
|
||||
}
|
||||
return conditions;
|
||||
}
|
||||
|
||||
@@ -67,6 +78,7 @@ public class FeeRecordService {
|
||||
PayRecordVo payRecordVo = new PayRecordVo();
|
||||
Map<String,Object> fieldsMap = (Map<String, Object>) data;
|
||||
fillVo(fieldsMap,payRecordVo);
|
||||
payRecordVos.add(payRecordVo);
|
||||
}
|
||||
pageQueryVo.setDatas(payRecordVos);
|
||||
pageQueryVo.setTotalCount(count);
|
||||
@@ -74,7 +86,7 @@ public class FeeRecordService {
|
||||
}
|
||||
|
||||
public void fillVo(Map<String, Object> fieldsMap, PayRecordVo payRecordVo) throws Exception {
|
||||
payRecordVo.setInOutType(EnumMapUtils.getEnumShowValue(getStringValue(fieldsMap,"收支类型")));
|
||||
payRecordVo.setInOutType(getStringValue(fieldsMap,"收支类型"));
|
||||
payRecordVo.setPayDate(getStringValue(fieldsMap,"收付款日期"));
|
||||
payRecordVo.setInDate(getStringValue(fieldsMap,"收付款日期"));
|
||||
BigDecimal amount = (BigDecimal) fieldsMap.get("收付款金额");
|
||||
@@ -89,4 +101,14 @@ public class FeeRecordService {
|
||||
payRecordVo.setItemName(getStringValue(fieldsMap,"费用类型"));
|
||||
}
|
||||
}
|
||||
|
||||
public void payCallBack(String billNo, String bizType, String payDate) throws Exception {
|
||||
if("rent".equals(bizType)) {
|
||||
billService.payCallBack(billNo,payDate);
|
||||
}else if("wae".equals(bizType)){
|
||||
waeBillService.payCallBack(billNo,payDate);
|
||||
}else if("margin".equals(bizType)){
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,247 @@
|
||||
package com.seeyon.apps.src_rent.bill;
|
||||
|
||||
import cn.hutool.log.Log;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.seeyon.apps.src_rent.assets.AssetsService;
|
||||
import com.seeyon.apps.src_rent.assets.OaAssetsVo;
|
||||
import com.seeyon.apps.src_rent.config.RentConfigProvider;
|
||||
import com.seeyon.apps.src_rent.constants.RentConstants;
|
||||
import com.seeyon.apps.src_rent.contract.ContractDocService;
|
||||
import com.seeyon.apps.src_rent.contract.ContractService;
|
||||
import com.seeyon.apps.src_rent.flow.FlowCreateService;
|
||||
import com.seeyon.apps.src_rent.form.*;
|
||||
import com.seeyon.apps.src_rent.po.PageQueryVo;
|
||||
import com.seeyon.cap4.form.api.FormApi4Cap4;
|
||||
import com.seeyon.cap4.form.bean.FormBean;
|
||||
import com.seeyon.cap4.form.bean.FormFieldBean;
|
||||
import com.seeyon.cap4.form.bean.FormTableBean;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
import com.seeyon.ctp.organization.bo.V3xOrgMember;
|
||||
import com.seeyon.ctp.organization.manager.OrgManager;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
|
||||
public class MarginBillService {
|
||||
|
||||
private static final Log log = Log.get(MarginBillService.class);
|
||||
private RentConfigProvider configProvider = (RentConfigProvider) AppContext.getBean("rentConfigProvider");
|
||||
private FormDataOperator formDataOperator = (FormDataOperator) AppContext.getBean("qcFormDataOperator");
|
||||
private AssetsService assetsService = (AssetsService) AppContext.getBean("qcAssetsService");
|
||||
private ContractDocService contractDocService = (ContractDocService) AppContext.getBean("qcContractDocService");
|
||||
private FlowCreateService flowCreateService = (FlowCreateService) AppContext.getBean("qcFlowCreateService");
|
||||
private OrgManager orgManager = (OrgManager) AppContext.getBean("orgManager");
|
||||
private DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
||||
private DateFormat sysDf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
private String getFormNo() {
|
||||
return configProvider.getBizConfigByKey(RentConstants.UNPAIDMARGINFORMNO);
|
||||
}
|
||||
|
||||
private String getStringValue(Map<String, Object> fieldsMap,String key) {
|
||||
Object o = fieldsMap.get(key);
|
||||
if(o == null) {
|
||||
return null;
|
||||
}
|
||||
return o + "";
|
||||
}
|
||||
|
||||
private List<FormWhereCondition> buildConditions(JSONObject params) {
|
||||
List<FormWhereCondition> conditions = new ArrayList<>();
|
||||
if(StringUtils.isNotBlank(params.getString("cusNo"))) {
|
||||
conditions.add(FormWhereCondition.build().display("承租方编号").value(params.getString("cusNo")));
|
||||
}
|
||||
if(StringUtils.isNotBlank(params.getString("billStatus"))) {
|
||||
if("已缴费".equals(params.getString("billStatus"))) {
|
||||
conditions.add(FormWhereCondition.build().display("缴费状态").clauseFactor(ClauseFactor.NOT_NULL));
|
||||
}else {
|
||||
conditions.add(FormWhereCondition.build().display("缴费状态").clauseFactor(ClauseFactor.NULL).startWithBracket(true).concatFactor(ClauseFactor.OR));
|
||||
conditions.add(FormWhereCondition.build().display("缴费状态").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"缴费状态","未结清")).endWithBracket(true));
|
||||
}
|
||||
}
|
||||
if(StringUtils.isNotBlank(params.getString("startDate"))) {
|
||||
conditions.add(FormWhereCondition.build().display("合同开始日期").clauseFactor(ClauseFactor.GT).value(params.getString("startDate")));
|
||||
}
|
||||
if(StringUtils.isNotBlank(params.getString("endDate"))) {
|
||||
conditions.add(FormWhereCondition.build().display("合同开始日期").clauseFactor(ClauseFactor.LE).value(params.getString("endDate")));
|
||||
}
|
||||
return conditions;
|
||||
}
|
||||
|
||||
|
||||
public PageQueryVo pageQuery(JSONObject params) throws Exception {
|
||||
List<FormWhereCondition> conditions = buildConditions(params);
|
||||
conditions.add(FormWhereCondition.build().display("是否同步小程序").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"是否同步小程序","是")));
|
||||
Integer pageNo = params.getInteger("pageNo") == null ? 1 : params.getInteger("pageNo");
|
||||
Integer pageSize = params.getInteger("pageSize") == null ? 10 : params.getInteger("pageSize");
|
||||
PageQueryVo<BillVo> pageQueryVo = new PageQueryVo();
|
||||
List<Object> datas = formDataOperator.queryFormDataPageCondition(getFormNo(), true,null, conditions, pageNo, pageSize,"账单开始日期",null);
|
||||
List<BillVo> vos = new ArrayList<>();
|
||||
Long count = formDataOperator.countConditon(getFormNo(), conditions);
|
||||
if(datas.size() > 0){
|
||||
for (Object data : datas) {
|
||||
Map<String,Object> map = (Map<String, Object>) data;
|
||||
BillVo billVo = new BillVo();
|
||||
fillVo(map, billVo);
|
||||
vos.add(billVo);
|
||||
}
|
||||
pageQueryVo.setDatas(vos);
|
||||
pageQueryVo.setTotalCount(count);
|
||||
}
|
||||
return pageQueryVo;
|
||||
}
|
||||
|
||||
public Integer countUnpay(JSONObject params) throws Exception {
|
||||
List<FormWhereCondition> conditions = buildConditions(params);
|
||||
conditions.add(FormWhereCondition.build().display("是否同步小程序").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"是否同步小程序","是")));
|
||||
conditions.add(FormWhereCondition.build().display("缴费状态").clauseFactor(ClauseFactor.NULL).startWithBracket(true).concatFactor(ClauseFactor.OR));
|
||||
conditions.add(FormWhereCondition.build().display("缴费状态").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"缴费状态","未结清")).endWithBracket(true));
|
||||
Long count = formDataOperator.countConditon(getFormNo(), conditions);
|
||||
return count.intValue();
|
||||
}
|
||||
|
||||
public void fillVo(Map<String, Object> fieldsMap, BillVo billVo) throws Exception {
|
||||
billVo.setBillType("MARGIN");
|
||||
billVo.setBillStartDate(getStringValue(fieldsMap,"合同开始日期"));
|
||||
billVo.setBillEndDate(getStringValue(fieldsMap,"合同截止日期"));
|
||||
billVo.setBillStatus(getStringValue(fieldsMap,"缴费状态"));
|
||||
billVo.setCusNo(getStringValue(fieldsMap,"承租方编号"));
|
||||
billVo.setBillNo(getStringValue(fieldsMap,"单据编号"));
|
||||
BigDecimal marginFee = fieldsMap.get("履约保证金") == null ? BigDecimal.ZERO : (BigDecimal) fieldsMap.get("履约保证金");
|
||||
billVo.setBillAmount(marginFee.toString());
|
||||
String contractName = null;
|
||||
String contractNo = getStringValue(fieldsMap, "合同编号");
|
||||
if(StringUtils.isNotBlank(contractNo)) {
|
||||
contractName = getContractName(contractNo);
|
||||
}
|
||||
billVo.setBillName(contractName + "_保证金");
|
||||
}
|
||||
|
||||
private String getContractName(String contractNo) throws Exception {
|
||||
if(contractNo == null) {
|
||||
return null;
|
||||
}
|
||||
Map<String, Object> map = contractDocService.getContractInfoByContractNo(contractNo);
|
||||
if(map == null) {
|
||||
return null;
|
||||
}
|
||||
return (String)map.get("合同名称");
|
||||
}
|
||||
|
||||
public String getBillPayReceiver(String billNo) throws Exception {
|
||||
List<FormWhereCondition> conditions = new ArrayList<>();
|
||||
conditions.add(FormWhereCondition.build().display("单据编号").value(billNo));
|
||||
FormColumn formColumn = formDataOperator.queryOneRowFormData(getFormNo(), true, null, conditions);
|
||||
if(formColumn == null) {
|
||||
return null;
|
||||
}
|
||||
Map<String, Object> fieldsMap = formColumn.getFieldsMap();
|
||||
String contractNo = getStringValue(fieldsMap, "合同编号");
|
||||
return contractDocService.getAssetsManagerOrg(contractNo);
|
||||
}
|
||||
|
||||
public void payCallBack(String billNo,String payDate) throws Exception {
|
||||
// 1. 获取Bean + 非空校验
|
||||
FormApi4Cap4 formApi4Cap4 = (FormApi4Cap4) AppContext.getBean("formApi4Cap4");
|
||||
if (formApi4Cap4 == null) {
|
||||
throw new Exception("Spring容器中未找到formApi4Cap4 Bean");
|
||||
}
|
||||
|
||||
// 2. 复用配置,避免重复查询
|
||||
String templateCode = this.configProvider.getBizConfigByKey(RentConstants.PAYMENT_REGISTRATION_TEMPLATECODE);
|
||||
String appName = this.configProvider.getBizConfigByKey(RentConstants.FORMAPPNAME);
|
||||
|
||||
// 3. 获取表单结构
|
||||
FormBean cap4FormBean = formApi4Cap4.getFormByFormCode(templateCode);
|
||||
FormTableBean masterTableBean = cap4FormBean.getMasterTableBean();
|
||||
String tableName = masterTableBean.getTableName();
|
||||
List<FormTableBean> subTableBeanList = cap4FormBean.getSubTableBean();
|
||||
FormTableBean subTableBean = null;
|
||||
// 4. 获取子表名 + 非空校验
|
||||
String subDbTableName = null;
|
||||
for (FormTableBean tableBean : subTableBeanList) {
|
||||
if ("非租赁收款明细".equals(tableBean.getDisplay())) {
|
||||
subDbTableName = tableBean.getTableName();
|
||||
subTableBean = tableBean;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// 5. 构造数据结构(规范泛型)
|
||||
Map<String, Object> mainFormData = new HashMap<>();
|
||||
Map<String, List<Object>> subFormDataMap = new HashMap<>();
|
||||
List<Object> subFormDataList = new ArrayList<>();
|
||||
|
||||
Map<String, Object> mainData = new HashMap<>();
|
||||
mainFormData.put(tableName, mainData);
|
||||
if (subDbTableName != null) {
|
||||
log.info("明细表表名为: " + subDbTableName);
|
||||
subFormDataMap.put(subDbTableName, subFormDataList);
|
||||
}
|
||||
|
||||
// 6. 查询账单数据
|
||||
List<FormWhereCondition> conditions = new ArrayList<>();
|
||||
conditions.add(FormWhereCondition.build().display("单据编号").value(billNo));
|
||||
FormColumn formColumn = this.formDataOperator.queryOneRowFormData(this.getFormNo(), false, null, conditions);
|
||||
// 7. 主数据非空判断
|
||||
if (formColumn == null || formColumn.getFieldsMap() == null) {
|
||||
throw new Exception("根据账单编号:" + billNo + "未查询到账单数据");
|
||||
}
|
||||
Map<String, Object> fieldsMap = formColumn.getFieldsMap();
|
||||
BigDecimal accountsReceivable = BigDecimal.ZERO;
|
||||
// 初始化实际收款金额(避免null)
|
||||
BigDecimal actualReceipts = BigDecimal.ZERO;
|
||||
BigDecimal rate = new BigDecimal("0.997");
|
||||
// 8. 组装子表数据
|
||||
Map<String, Object> subTableRowData = new HashMap<>();
|
||||
// 应收金额计算
|
||||
BigDecimal receivable = (BigDecimal) fieldsMap.get("履约保证金");
|
||||
if (receivable != null) {
|
||||
accountsReceivable = accountsReceivable.add(receivable);
|
||||
// 修复BigDecimal.setScale不生效问题
|
||||
actualReceipts = accountsReceivable.multiply(rate).setScale(2, RoundingMode.HALF_UP);
|
||||
}
|
||||
subTableRowData.put("收款金额", receivable);
|
||||
subTableRowData.put("开票金额", receivable);
|
||||
subFormDataList.add(subTableRowData);
|
||||
// 9. 获取合同信息 + 非空校验
|
||||
String contractNo = (String) fieldsMap.get("合同编号");
|
||||
mainData.put("合同名称", fieldsMap.get("合同名称"));
|
||||
mainData.put("合同金额", fieldsMap.get("合同金额"));
|
||||
mainData.put("承租方类型", fieldsMap.get("承租方类型"));
|
||||
mainData.put("承租方名称", fieldsMap.get("承租方名称"));
|
||||
mainData.put("承租方名称编号", fieldsMap.get("承租方编号"));
|
||||
// 10. 经办人/部门信息(安全赋值)
|
||||
String assetNo = (String) fieldsMap.get("资产编号");
|
||||
Map<String, Object> assetsManagerInfo = this.assetsService.getAssetsManagerInfo(assetNo);
|
||||
if (assetsManagerInfo != null && assetsManagerInfo.get("经办人") != null) {
|
||||
String managerId = String.valueOf(assetsManagerInfo.get("经办人"));
|
||||
try {
|
||||
V3xOrgMember member = this.orgManager.getMemberById(Long.parseLong(managerId));
|
||||
if (member != null) {
|
||||
mainData.put("经办部门", member.getOrgDepartmentId());
|
||||
mainData.put("经办单位", member.getOrgAccountId());
|
||||
mainData.put("经办人员", managerId);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("获取经办人信息失败", e);
|
||||
}
|
||||
}
|
||||
// 11. 组装主表数据(线程安全日期)
|
||||
mainData.put("收款项", EnumMapUtils.getMasterTableEnumItemValue(templateCode, "收款项", "非租金"));
|
||||
mainData.put("经办日期", LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
|
||||
mainData.put("本次收款时间", payDate);
|
||||
mainData.put("合同编号", contractNo);
|
||||
mainData.put("本次收款金额", actualReceipts);
|
||||
// 12. 启动流程
|
||||
this.flowCreateService.flowStart("微信小程序支付完成收款登记",
|
||||
mainFormData, subFormDataMap, appName, templateCode);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,29 +1,30 @@
|
||||
package com.seeyon.apps.src_rent.bill;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.seeyon.apps.src_rent.assets.AssetsService;
|
||||
import com.seeyon.apps.src_rent.config.RentConfigProvider;
|
||||
import com.seeyon.apps.src_rent.constants.RentConstants;
|
||||
import com.seeyon.apps.src_rent.form.ClauseFactor;
|
||||
import com.seeyon.apps.src_rent.form.FormDataOperator;
|
||||
import com.seeyon.apps.src_rent.form.FormWhereCondition;
|
||||
import com.seeyon.apps.src_rent.contract.ContractDocService;
|
||||
import com.seeyon.apps.src_rent.form.*;
|
||||
import com.seeyon.apps.src_rent.po.PageQueryVo;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
import com.seeyon.ctp.common.exceptions.BusinessException;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class WaeBillService {
|
||||
|
||||
@Autowired
|
||||
private RentConfigProvider configProvider;
|
||||
@Autowired
|
||||
private FormDataOperator formDataOperator;
|
||||
|
||||
private RentConfigProvider configProvider = (RentConfigProvider)AppContext.getBean("rentConfigProvider");
|
||||
private FormDataOperator formDataOperator = (FormDataOperator) AppContext.getBean("qcFormDataOperator");
|
||||
private AssetsService assetsService = (AssetsService) AppContext.getBean("qcAssetsService");
|
||||
private ContractDocService docService = (ContractDocService) AppContext.getBean("qcContractDocService");
|
||||
|
||||
private String getFormNo() {
|
||||
return configProvider.getBizConfigByKey(RentConstants.WAEBILLFORMNO);
|
||||
@@ -42,16 +43,49 @@ public class WaeBillService {
|
||||
if(StringUtils.isNotBlank(params.getString("cusNo"))) {
|
||||
conditions.add(FormWhereCondition.build().display("承租方编号").value(params.getString("cusNo")));
|
||||
}
|
||||
if(StringUtils.isNotBlank(params.getString("startDate"))) {
|
||||
conditions.add(FormWhereCondition.build().display("账单开始日期").clauseFactor(ClauseFactor.GT).value(params.getString("startDate")));
|
||||
}
|
||||
if(StringUtils.isNotBlank(params.getString("endDate"))) {
|
||||
conditions.add(FormWhereCondition.build().display("账单开始日期").clauseFactor(ClauseFactor.LE).value(params.getString("endDate")));
|
||||
}
|
||||
if(StringUtils.isNotBlank(params.getString("billStatus"))) {
|
||||
if("已缴费".equals(params.getString("billStatus"))) {
|
||||
conditions.add(FormWhereCondition.build().display("缴费状态").clauseFactor(ClauseFactor.NOT_NULL));
|
||||
}else {
|
||||
conditions.add(FormWhereCondition.build().display("缴费状态").clauseFactor(ClauseFactor.NULL).startWithBracket(true).concatFactor(ClauseFactor.OR));
|
||||
conditions.add(FormWhereCondition.build().display("缴费状态").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"缴费状态","未结清")).endWithBracket(true));
|
||||
}
|
||||
}
|
||||
return conditions;
|
||||
}
|
||||
|
||||
|
||||
public PageQueryVo pageQueryWaeBill(JSONObject params) throws Exception {
|
||||
List<FormWhereCondition> conditions = buildConditions(params);
|
||||
conditions.add(FormWhereCondition.build().display("是否同步小程序").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"是否同步小程序","是")));
|
||||
Integer pageNo = params.getInteger("pageNo") == null ? 1 : params.getInteger("pageNo");
|
||||
Integer pageSize = params.getInteger("pageSize") == null ? 10 : params.getInteger("pageSize");
|
||||
PageQueryVo<BillVo> pageQueryVo = new PageQueryVo();
|
||||
List<Object> datas = formDataOperator.queryFormDataPageCondition(getFormNo(), true,null, conditions, pageNo, pageSize);
|
||||
List<Object> datas = formDataOperator.queryFormDataPageCondition(getFormNo(), true,null, conditions, pageNo, pageSize,"账单开始日期",null);
|
||||
List<BillVo> vos = new ArrayList<>();
|
||||
Long count = formDataOperator.countConditon(getFormNo(), conditions);
|
||||
if(datas.size() > 0){
|
||||
for (Object data : datas) {
|
||||
Map<String,Object> map = (Map<String, Object>) data;
|
||||
BillVo billVo = new BillVo();
|
||||
fillVo(map, billVo);
|
||||
vos.add(billVo);
|
||||
}
|
||||
pageQueryVo.setDatas(vos);
|
||||
pageQueryVo.setTotalCount(count);
|
||||
}
|
||||
return pageQueryVo;
|
||||
}
|
||||
|
||||
public PageQueryVo queryAllWaeBill(List<FormWhereCondition> conditions) throws Exception {;
|
||||
PageQueryVo<BillVo> pageQueryVo = new PageQueryVo();
|
||||
List<Object> datas = formDataOperator.queryFormDataPageCondition(getFormNo(), true,null, conditions, null,null);
|
||||
List<BillVo> vos = new ArrayList<>();
|
||||
Long count = formDataOperator.countConditon(getFormNo(), conditions);
|
||||
if(datas.size() > 0){
|
||||
@@ -69,7 +103,9 @@ public class WaeBillService {
|
||||
|
||||
public Integer countUnpayWaeBills(JSONObject params) throws Exception {
|
||||
List<FormWhereCondition> conditions = buildConditions(params);
|
||||
conditions.add(FormWhereCondition.build().display("缴费状态").clauseFactor(ClauseFactor.NULL));
|
||||
conditions.add(FormWhereCondition.build().display("是否同步小程序").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"是否同步小程序","是")));
|
||||
conditions.add(FormWhereCondition.build().display("缴费状态").clauseFactor(ClauseFactor.NULL).startWithBracket(true).concatFactor(ClauseFactor.OR));
|
||||
conditions.add(FormWhereCondition.build().display("缴费状态").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"缴费状态","未结清")).endWithBracket(true));
|
||||
Long count = formDataOperator.countConditon(getFormNo(), conditions);
|
||||
return count.intValue();
|
||||
}
|
||||
@@ -80,10 +116,31 @@ public class WaeBillService {
|
||||
billVo.setBillEndDate(getStringValue(fieldsMap,"账单结束日期"));
|
||||
billVo.setBillStatus(getStringValue(fieldsMap,"缴费状态"));
|
||||
billVo.setCusNo(getStringValue(fieldsMap,"承租方编号"));
|
||||
billVo.setBillNo(getStringValue(fieldsMap,"档案编号"));
|
||||
BigDecimal powerFee = (BigDecimal) fieldsMap.get("本次应缴电费");
|
||||
BigDecimal waterFee = (BigDecimal) fieldsMap.get("本次应缴水费");
|
||||
billVo.setBillNo(getStringValue(fieldsMap,"唯一标识"));
|
||||
BigDecimal powerFee = fieldsMap.get("本次应缴电费") == null ? BigDecimal.ZERO : (BigDecimal) fieldsMap.get("本次应缴电费");
|
||||
BigDecimal waterFee = fieldsMap.get("本次应缴水费") == null ? BigDecimal.ZERO : (BigDecimal) fieldsMap.get("本次应缴水费");
|
||||
billVo.setBillAmount((powerFee.add(waterFee)).toString());
|
||||
billVo.setBillName("水电费");
|
||||
billVo.setBillName(BigDecimal.ZERO.equals(powerFee) ? "电费" : "水费");
|
||||
}
|
||||
|
||||
public String getBillPayReceiver(String billNo) throws Exception {
|
||||
List<FormWhereCondition> conditions = new ArrayList<>();
|
||||
conditions.add(FormWhereCondition.build().display("唯一标识").value(billNo));
|
||||
FormColumn formColumn = formDataOperator.queryOneRowFormData(getFormNo(), true, null, conditions);
|
||||
if(formColumn == null) {
|
||||
return null;
|
||||
}
|
||||
Map<String, Object> fieldsMap = formColumn.getFieldsMap();
|
||||
String assetsNo = getStringValue(fieldsMap, "资产编号");
|
||||
String contractNoByAssetsNo = assetsService.getContractNoByAssetsNo(assetsNo);
|
||||
return docService.getAssetsManagerOrg(contractNoByAssetsNo);
|
||||
}
|
||||
|
||||
public void payCallBack(String billNo, String payDate) throws BusinessException {
|
||||
List<FormWhereCondition> conditions = new ArrayList<>();
|
||||
conditions.add(FormWhereCondition.build().display("唯一标识").value(billNo));
|
||||
List<FormUpdateField> updateFields = new ArrayList<>();
|
||||
updateFields.add(FormUpdateField.build().display("缴费状态").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"缴费状态","结清")));
|
||||
formDataOperator.updateMasterForm(getFormNo(),updateFields,conditions);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import static com.seeyon.apps.src_rent.constants.RentConstants.getPluginId;
|
||||
|
||||
@Component
|
||||
public class RentConfigProvider {
|
||||
|
||||
protected ICstConfigApi cstConfigApi = (ICstConfigApi) AppContext.getBean("cstConfigApi");
|
||||
|
||||
@@ -3,18 +3,17 @@ package com.seeyon.apps.src_rent.constants;
|
||||
public enum RentConstants {
|
||||
|
||||
plugin("src_rent","插件ID"),
|
||||
APP_ID("7438886882",""),
|
||||
APP_SECRET("325c8cc6c2a303d6cf1fb5657a16e591",""),
|
||||
OA_HOST("",""),
|
||||
ESIGN_HOST("",""),
|
||||
SIGN_SERVICE_PROVIDER("ESIGN",""),
|
||||
APP_ID("7438886882","e签宝appId"),
|
||||
APP_SECRET("325c8cc6c2a303d6cf1fb5657a16e591","e签宝appSecret"),
|
||||
OA_HOST("","oa地址"),
|
||||
ESIGN_HOST("","e签宝地址"),
|
||||
UNITNAME("","平台方组织名称"),
|
||||
FORMEDITLOGINNAME("","表单修改登录名"),
|
||||
updateAccountName("表单",""),
|
||||
updateAccountName("表单","表单修改单位/组织名"),
|
||||
getTokenUrl("/seeyon/rest/token/","调用获取TOKEN地址"),
|
||||
nodeTokenUrl("/seeyon/rest/flow/notification/","超级节点回调URL"),
|
||||
restName("",""),
|
||||
restPwd("",""),
|
||||
restName("","rest用户名"),
|
||||
restPwd("","rest密码"),
|
||||
signAutoDate("","是否自动加盖签署日期"),
|
||||
eSignOrgId("61f735dd368c45a191f43a6711c3c88a","e签宝平台方组织id"),
|
||||
formLoginName("2019","表单数据录入登录名"),
|
||||
@@ -22,17 +21,26 @@ public enum RentConstants {
|
||||
ASSETS_FORMNO("","资产运营档案编码"),
|
||||
CONTRACT_FORMNO("","租赁合同表单编码"),
|
||||
DISCHARGE_TEMPLATECODE("","退租申请模板编码"),
|
||||
DISCHARGE_FORMNO("","退租申请表单编码"),
|
||||
FALLBACK_FORMNO("","留言板表单编码"),
|
||||
RESERVE_FORMNO("","看房预约表单编码"),
|
||||
VIEWRECORD_FORMNO("","浏览记录表单编码"),
|
||||
FORMAPPNAME("","表单应用名称"),
|
||||
FEERECORDFORMNO("","费用收支台账表单编码"),
|
||||
CONTRACTBILLFORMNO("","合同账单表单编码"),
|
||||
UNPAIDMARGINFORMNO("","履约保证金表单编码"),
|
||||
WAEBILLFORMNO("","水电费账单表单编码"),
|
||||
CUSDOCFORMNO("","客商档案表单编码"),
|
||||
NOTICEFORMNO("","招商公告表单编码"),
|
||||
WECHATBACKENDHOST("","微信小程序后端host"),
|
||||
aSignPositionKeyword("甲方盖章(签字)","甲方签署位置关键字"),
|
||||
bSignPositionKeyword("乙方盖章(签字)","乙方签署位置关键字"),
|
||||
lpSignPositionKeyword("法定代表人","法人签署位置关键字"),
|
||||
legalSealId("","法人章ID"),
|
||||
contractDocFormCode("","合同档案编码"),
|
||||
PAYMENT_REGISTRATION_TEMPLATECODE("","收款登记模板编码"),
|
||||
ASSETS_INFO_FORMNO("","资产信息台账表单编码"),
|
||||
ESIGN_APP_UNITMAP("","E签宝应用APPID与公司映射关系"),
|
||||
ESIGN_APP_SECRETMAP("325c8cc6c2a303d6cf1fb5657a16e591","e签宝appIDSecret映射"),
|
||||
;
|
||||
RentConstants(String defaultValue, String description) {
|
||||
this.defaultValue = defaultValue;
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.seeyon.apps.src_rent.contract;
|
||||
|
||||
import com.seeyon.apps.src_rent.config.RentConfigProvider;
|
||||
import com.seeyon.apps.src_rent.constants.RentConstants;
|
||||
import com.seeyon.apps.src_rent.form.FormColumn;
|
||||
import com.seeyon.apps.src_rent.form.FormDataOperator;
|
||||
import com.seeyon.apps.src_rent.form.FormWhereCondition;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ContractDocService {
|
||||
|
||||
private RentConfigProvider configProvider = (RentConfigProvider) AppContext.getBean("rentConfigProvider");
|
||||
private FormDataOperator formDataOperator = (FormDataOperator) AppContext.getBean("qcFormDataOperator");
|
||||
|
||||
public String getAssetsManagerOrg(String contractNo) throws Exception {
|
||||
String formNo = configProvider.getBizConfigByKey(RentConstants.contractDocFormCode);
|
||||
List<FormWhereCondition> conditions = new ArrayList<>();
|
||||
conditions.add(FormWhereCondition.build().display("合同编号").value(contractNo));
|
||||
FormColumn formColumn = formDataOperator.queryOneRowFormData(formNo, true, null, conditions);
|
||||
if(formColumn == null || formColumn.getFieldsMap() == null) {
|
||||
return null;
|
||||
}
|
||||
Map<String, Object> fieldsMap = formColumn.getFieldsMap();
|
||||
return (String)fieldsMap.get("签订单位");
|
||||
}
|
||||
|
||||
public Map<String,Object> getContractInfoByContractNo(String contractNo) throws Exception {
|
||||
String formNo = configProvider.getBizConfigByKey(RentConstants.contractDocFormCode);
|
||||
List<FormWhereCondition> conditions = new ArrayList<>();
|
||||
conditions.add(FormWhereCondition.build().display("合同编号").value(contractNo));
|
||||
FormColumn formColumn = formDataOperator.queryOneRowFormData(formNo, false, null, conditions);
|
||||
if(formColumn == null) {
|
||||
return null;
|
||||
}
|
||||
Map<String, Object> fieldsMap = formColumn.getFieldsMap();
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
if(fieldsMap == null) {
|
||||
return map;
|
||||
}
|
||||
map.put("合同名称",fieldsMap.get("合同名称"));
|
||||
map.put("合同金额",fieldsMap.get("合同金额"));
|
||||
map.put("承租方名称",fieldsMap.get("承租方名称"));
|
||||
map.put("承租方类型",fieldsMap.get("承租方类型"));
|
||||
return map;
|
||||
}
|
||||
}
|
||||
@@ -15,30 +15,22 @@ import com.seeyon.ctp.common.filemanager.manager.AttachmentManager;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class ContractService {
|
||||
|
||||
private static final Log log = LogFactory.getLog(ContractService.class);
|
||||
|
||||
@Autowired
|
||||
private RentConfigProvider configProvider;
|
||||
@Autowired
|
||||
private FormDataOperator formDataOperator;
|
||||
@Autowired
|
||||
private AssetsService assetsService;
|
||||
@Autowired
|
||||
private SignLinkService signLinkService;
|
||||
private RentConfigProvider configProvider = (RentConfigProvider)AppContext.getBean("rentConfigProvider");
|
||||
private FormDataOperator formDataOperator = (FormDataOperator) AppContext.getBean("qcFormDataOperator");
|
||||
private AssetsService assetsService = (AssetsService) AppContext.getBean("qcAssetsService");
|
||||
private SignLinkService signLinkService = (SignLinkService) AppContext.getBean("qcSignLinkService");
|
||||
private AttachmentManager attachmentManager = (AttachmentManager) AppContext.getBean("attachmentManager");
|
||||
|
||||
private String getFormNo() {
|
||||
@@ -71,6 +63,7 @@ public class ContractService {
|
||||
queryColumnVos.add("合同截止日期");
|
||||
queryColumnVos.add("签署状态");
|
||||
queryColumnVos.add("合同名称");
|
||||
queryColumnVos.add("签约时效");
|
||||
PageQueryVo<OaContractVo> pageQueryVo = new PageQueryVo();
|
||||
List<Object> datas = formDataOperator.queryFormDataPageCondition(getFormNo(), true,queryColumnVos, conditions, pageNo, pageSize);
|
||||
List<OaContractVo> oaContractVos = new ArrayList<>();
|
||||
@@ -128,7 +121,7 @@ public class ContractService {
|
||||
assetsVos.add(assetsVo);
|
||||
}
|
||||
oaContractVo.setAssetsVos(assetsVos);
|
||||
|
||||
oaContractVos.add(oaContractVo);
|
||||
}
|
||||
return oaContractVos;
|
||||
}
|
||||
@@ -140,7 +133,7 @@ public class ContractService {
|
||||
oaContractVo.setSignStatus(getStringValue(fieldsMap,"签署状态"));
|
||||
oaContractVo.setCusNo(getStringValue(fieldsMap,"承租方编号"));
|
||||
oaContractVo.setContractStartTime(getStringValue(fieldsMap,"合同开始日期"));
|
||||
oaContractVo.setContractEndTime(getStringValue(fieldsMap,"合同结束日期"));
|
||||
oaContractVo.setContractEndTime(getStringValue(fieldsMap,"合同截止日期"));
|
||||
oaContractVo.setStartDate(oaContractVo.getContractStartTime());
|
||||
oaContractVo.setEndDate(oaContractVo.getContractEndTime());
|
||||
if(fieldsMap.get("盖章后合同附件") != null) {
|
||||
@@ -167,6 +160,12 @@ public class ContractService {
|
||||
String enumId = EnumMapUtils.getEnumItemIdByGroupNameAndItemShowValue("签订方式",params.getString("signWay"));
|
||||
conditions.add(FormWhereCondition.build().display("签订方式").value(enumId).clauseFactor(ClauseFactor.NEQ));
|
||||
}
|
||||
if(StringUtils.isNotBlank(params.getString("startDate"))) {
|
||||
conditions.add(FormWhereCondition.build().display("合同开始日期").clauseFactor(ClauseFactor.GE).value(params.getString("startDate")));
|
||||
}
|
||||
if(StringUtils.isNotBlank(params.getString("endDate"))) {
|
||||
conditions.add(FormWhereCondition.build().display("合同截止日期").clauseFactor(ClauseFactor.LE).value(params.getString("endDate")));
|
||||
}
|
||||
return conditions;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,10 +25,10 @@ public class EsignCallBackController extends BaseController {
|
||||
|
||||
private static final Log log = Log.get(EsignCallBackController.class);
|
||||
|
||||
private EsignByUploadFileService esignByUploadFileService = (EsignByUploadFileService) AppContext.getBean("esignByUploadFileService");
|
||||
private EsignCallbackBizService esignCallbackBizService = (EsignCallbackBizService) AppContext.getBean("esignCallbackBizService");
|
||||
private SignLinkService signLinkService = (SignLinkService) AppContext.getBean("signLinkService");
|
||||
private ThirdMessageService thirdMessageService = (ThirdMessageService) AppContext.getBean("thirdMessageService");
|
||||
private EsignByUploadFileService esignByUploadFileService = (EsignByUploadFileService) AppContext.getBean("qcEsignByUploadFileService");
|
||||
private EsignCallbackBizService esignCallbackBizService = (EsignCallbackBizService) AppContext.getBean("qcEsignCallbackBizService");
|
||||
private SignLinkService signLinkService = (SignLinkService) AppContext.getBean("qcSignLinkService");
|
||||
private ThirdMessageService thirdMessageService = (ThirdMessageService) AppContext.getBean("qcThirdMessageService");
|
||||
|
||||
public void callback(HttpServletRequest request, HttpServletResponse response) {
|
||||
try {
|
||||
@@ -38,6 +38,7 @@ public class EsignCallBackController extends BaseController {
|
||||
String tableName = request.getParameter("tablename");
|
||||
String updatefield = request.getParameter("updatefield");
|
||||
String statusfield = request.getParameter("statusfield");
|
||||
String appId = request.getParameter("xId");
|
||||
BufferedReader reader = request.getReader();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String line;
|
||||
@@ -52,22 +53,22 @@ public class EsignCallBackController extends BaseController {
|
||||
String flowId = callbackParams.getSignFlowId();
|
||||
String action = callbackParams.getAction();
|
||||
log.info("签署回调当前流程: " + flowId);
|
||||
if(action.equals("SIGN_FLOW_COMPLETE")) {
|
||||
if(callbackParams.getSignFlowStatus() == 2) {
|
||||
Map<String, Object> fileInfo = esignByUploadFileService.getDownloadFileInfo(flowId);
|
||||
esignCallbackBizService.handleSuccessSignCallbackBiz(tableName,updatefield,statusfield,formId,(String)fileInfo.get("downloadUrl"),(String)fileInfo.get("fileName"));
|
||||
}else {
|
||||
esignCallbackBizService.handleFailSignCallbackBiz(tableName,statusfield,formId,callbackParams.getResultDescription());
|
||||
if (action.equals("SIGN_FLOW_COMPLETE")) {
|
||||
if (callbackParams.getSignFlowStatus() == 2) {
|
||||
Map<String, Object> fileInfo = esignByUploadFileService.getDownloadFileInfo(flowId,appId);
|
||||
esignCallbackBizService.handleSuccessSignCallbackBiz(tableName, updatefield, statusfield, formId, (String) fileInfo.get("downloadUrl"), (String) fileInfo.get("fileName"));
|
||||
} else if (callbackParams.getSignFlowStatus() == 5) {
|
||||
//合同过期
|
||||
esignCallbackBizService.handleExpiredSignCallbackBiz(tableName, statusfield, formId);
|
||||
} else {
|
||||
esignCallbackBizService.handleFailSignCallbackBiz(tableName, statusfield, formId, callbackParams.getResultDescription());
|
||||
}
|
||||
signLinkService.del(flowId);
|
||||
response.setStatus(HttpServletResponse.SC_OK);
|
||||
return;
|
||||
}else if(action.equals("SIGN_MISSON_COMPLETE") && callbackParams.getSignResult() == 2 && callbackParams.getSignOrder() == 2){
|
||||
} else if (action.equals("SIGN_MISSON_COMPLETE") && callbackParams.getSignResult() == 2 && callbackParams.getSignOrder() == 2) {
|
||||
//发送消息
|
||||
MessageVo messageVo = new MessageVo();
|
||||
messageVo.setBizId(flowId);
|
||||
messageVo.setMessageType("SIGN");
|
||||
|
||||
// thirdMessageService.sendMessage();
|
||||
}
|
||||
//下载合同
|
||||
@@ -79,11 +80,10 @@ public class EsignCallBackController extends BaseController {
|
||||
out.flush();
|
||||
}
|
||||
log.info("回调处理完成: " + flowId);
|
||||
return;
|
||||
} catch (Exception e) {
|
||||
log.error("回调处理失败", e);
|
||||
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
|
||||
e.printStackTrace();
|
||||
}
|
||||
// response.setStatus(HttpServletResponse.SC_OK);
|
||||
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,31 +3,27 @@ package com.seeyon.apps.src_rent.cus;
|
||||
import com.seeyon.apps.src_rent.config.RentConfigProvider;
|
||||
import com.seeyon.apps.src_rent.constants.RentConstants;
|
||||
import com.seeyon.apps.src_rent.form.*;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
import com.seeyon.ctp.common.exceptions.BusinessException;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class CustomerService {
|
||||
|
||||
@Autowired
|
||||
private RentConfigProvider configProvider;
|
||||
@Autowired
|
||||
private FormDataOperator formDataOperator;
|
||||
private RentConfigProvider configProvider = (RentConfigProvider) AppContext.getBean("rentConfigProvider");
|
||||
private FormDataOperator formDataOperator = (FormDataOperator) AppContext.getBean("qcFormDataOperator");
|
||||
|
||||
private String getFormNo() {
|
||||
return configProvider.getBizConfigByKey(RentConstants.CUSDOCFORMNO);
|
||||
}
|
||||
|
||||
public String matchCusPerson(Customer customer) throws Exception {
|
||||
String phone = customer.getCusPhone();
|
||||
String cardNo = customer.getCardNo();
|
||||
List<FormWhereCondition> conditions = new ArrayList<>();
|
||||
conditions.add(FormWhereCondition.build().display("联系电话").value(phone).clauseFactor(ClauseFactor.EQ));
|
||||
conditions.add(FormWhereCondition.build().display("统一社会信用代码").value(cardNo).clauseFactor(ClauseFactor.EQ));
|
||||
conditions.add(FormWhereCondition.build().display("承租方类型").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"承租方类型","个人")));
|
||||
List<FormColumn> formColumnList = formDataOperator.queryFormDataCondition(getFormNo(), null, conditions);
|
||||
if(formColumnList != null && formColumnList.size() > 0){
|
||||
@@ -40,7 +36,8 @@ public class CustomerService {
|
||||
public String matchCusOrg(Customer customer) throws BusinessException {
|
||||
String orgNo = customer.getOrgNo();
|
||||
List<FormWhereCondition> conditions = new ArrayList<>();
|
||||
conditions.add(FormWhereCondition.build().display("社会信用代码").value(orgNo).clauseFactor(ClauseFactor.EQ));
|
||||
conditions.add(FormWhereCondition.build().display("承租方类型").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"承租方类型","单位")));
|
||||
conditions.add(FormWhereCondition.build().display("统一社会信用代码").value(orgNo).clauseFactor(ClauseFactor.EQ));
|
||||
List<FormColumn> formColumnList = formDataOperator.queryFormDataCondition(getFormNo(), null, conditions);
|
||||
if(formColumnList != null && formColumnList.size() > 0){
|
||||
Map<String, Object> fieldsMap = formColumnList.get(0).getFieldsMap();
|
||||
|
||||
@@ -16,27 +16,20 @@ import com.seeyon.cap4.form.bean.FormTableBean;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
import com.seeyon.ctp.common.exceptions.BusinessException;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
public class DisCharegeService {
|
||||
|
||||
@Autowired
|
||||
private RentConfigProvider configProvider;
|
||||
@Autowired
|
||||
private FormDataOperator formDataOperator;
|
||||
@Autowired
|
||||
private FlowCreateService flowCreateService;
|
||||
@Autowired
|
||||
private ContractService contractService;
|
||||
private RentConfigProvider configProvider = (RentConfigProvider)AppContext.getBean("rentConfigProvider");
|
||||
private FormDataOperator formDataOperator = (FormDataOperator) AppContext.getBean("qcFormDataOperator");
|
||||
private FlowCreateService flowCreateService = (FlowCreateService) AppContext.getBean("qcFlowCreateService");
|
||||
private ContractService contractService = (ContractService) AppContext.getBean("qcContractService");
|
||||
|
||||
private String getFormNo() {
|
||||
return configProvider.getBizConfigByKey(RentConstants.DISCHARGE_FORMNO);
|
||||
return configProvider.getBizConfigByKey(RentConstants.PAYMENT_REGISTRATION_TEMPLATECODE);
|
||||
}
|
||||
|
||||
private String getStringValue(Map<String, Object> fieldsMap,String key) {
|
||||
@@ -77,8 +70,8 @@ public class DisCharegeService {
|
||||
List<FormTableBean> subTableBean = cap4FormBean.getSubTableBean();
|
||||
String subDbTableName = null;
|
||||
for (FormTableBean formTableBean : subTableBean) {
|
||||
if("租赁资产".equals(formTableBean.getTableName())){
|
||||
subDbTableName = formTableBean.getDbTableName();
|
||||
if("租赁资产".equals(formTableBean.getDisplay())){
|
||||
subDbTableName = formTableBean.getTableName();
|
||||
}
|
||||
}
|
||||
Map<String,Object> mainFormData = new HashMap<>();
|
||||
@@ -93,19 +86,23 @@ public class DisCharegeService {
|
||||
List<String> assetsNoList = (List<String>) params.get("assetsNoList");
|
||||
Set<String> assetsNoSet = assetsNoList.stream().collect(Collectors.toSet());
|
||||
List<OaAssetsVo> oaAssetsVos = contractService.queryContractAllAssets(contractNo);
|
||||
oaAssetsVos.forEach(oaAssetsVo -> {
|
||||
if(assetsNoSet.contains(oaAssetsVo.getAssetsNo())){
|
||||
Map<String,Object> tempMap = new HashMap<>();
|
||||
tempMap.put("资产编号",oaAssetsVo.getAssetsNo());
|
||||
subFormDataList.add(tempMap);
|
||||
}
|
||||
});
|
||||
if(oaAssetsVos != null) {
|
||||
oaAssetsVos.forEach(oaAssetsVo -> {
|
||||
if(assetsNoSet.contains(oaAssetsVo.getAssetsNo())){
|
||||
Map<String,Object> tempMap = new HashMap<>();
|
||||
tempMap.put("资产编号",oaAssetsVo.getAssetsNo());
|
||||
subFormDataList.add(tempMap);
|
||||
}
|
||||
});
|
||||
}
|
||||
data.put("合同名称",params.getString("contractName"));
|
||||
data.put("合同编号",contractNo);
|
||||
data.put("承租方类型", EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"承租方类型",params.getString("cusType")));
|
||||
data.put("承租方名称",params.getString("cusName"));
|
||||
data.put("联系方式",params.getString("phone"));
|
||||
data.put("终止原因",params.getString("reason"));
|
||||
data.put("退租申请状态",EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"退租申请状态","申请中"));
|
||||
data.put("清算状态",EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"清算状态","未清算"));
|
||||
flowCreateService.flowStart("退租申请",mainFormData,subFormDataMap,appName,templateCode);
|
||||
}
|
||||
|
||||
@@ -114,6 +111,18 @@ public class DisCharegeService {
|
||||
vo.setId(getStringValue(fieldsMap,"id"));
|
||||
vo.setRemark(getStringValue(fieldsMap,"审批意见"));
|
||||
vo.setStatus(getStringValue(fieldsMap,"退租申请状态"));
|
||||
vo.setApplyDate(getStringValue(fieldsMap,"经办日期"));
|
||||
Long id = Long.parseLong(vo.getId());
|
||||
List<FormWhereCondition> subConditions = new ArrayList<>();
|
||||
subConditions.add(FormWhereCondition.build().display("formmain_id").value(id));
|
||||
List<Object> subDatas = formDataOperator.pageQuerySubFormDatas(getFormNo(), "租赁资产", true, null, subConditions, null, null);
|
||||
StringBuilder dischargeItem = new StringBuilder("");
|
||||
for (Object subData : subDatas) {
|
||||
Map<String, Object> subOneRowData = (Map<String, Object>) subData;
|
||||
String assetsName = (String) subOneRowData.get("品牌名称");
|
||||
dischargeItem.append(assetsName).append(",");
|
||||
}
|
||||
vo.setDischargeItem(dischargeItem.toString());
|
||||
}
|
||||
|
||||
private List<FormWhereCondition> buildConditions(JSONObject params) {
|
||||
|
||||
@@ -9,23 +9,19 @@ import com.seeyon.apps.src_rent.form.FormColumn;
|
||||
import com.seeyon.apps.src_rent.form.FormDataOperator;
|
||||
import com.seeyon.apps.src_rent.form.FormWhereCondition;
|
||||
import com.seeyon.apps.src_rent.po.PageQueryVo;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
@Component
|
||||
public class FallbackService {
|
||||
|
||||
@Autowired
|
||||
private RentConfigProvider configProvider;
|
||||
@Autowired
|
||||
private FormDataOperator formDataOperator;
|
||||
@Autowired
|
||||
private FlowCreateService flowCreateService;
|
||||
private RentConfigProvider configProvider = (RentConfigProvider) AppContext.getBean("rentConfigProvider");
|
||||
private FormDataOperator formDataOperator = (FormDataOperator) AppContext.getBean("qcFormDataOperator");
|
||||
private FlowCreateService flowCreateService = (FlowCreateService) AppContext.getBean("qcFlowCreateService");
|
||||
|
||||
private String getFormNo() {
|
||||
return configProvider.getBizConfigByKey(RentConstants.FALLBACK_FORMNO);
|
||||
@@ -67,7 +63,7 @@ public class FallbackService {
|
||||
mainFormData.put("承租方编号", params.getString("cusNo"));
|
||||
mainFormData.put("承租方姓名", params.getString("tenantName"));
|
||||
mainFormData.put("承租方类型", EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"承租方类型",params.getString("tenantType")));
|
||||
mainFormData.put("看房人手机号", params.getString("tenantPhone"));
|
||||
mainFormData.put("承租方手机号", params.getString("tenantPhone"));
|
||||
mainFormData.put("留言内容", params.getString("content"));
|
||||
mainFormData.put("留言日期", df.format(new Date()));
|
||||
mainFormData.put("处理状态", EnumMapUtils.getMasterTableEnumItemValue(getFormNo(), "处理状态", "未处理"));
|
||||
|
||||
@@ -4,45 +4,56 @@ import com.seeyon.ctp.common.AppContext;
|
||||
import com.seeyon.ctp.common.filemanager.manager.AttachmentManager;
|
||||
import com.seeyon.ctp.common.filemanager.manager.FileManager;
|
||||
import com.seeyon.ctp.common.po.filemanager.Attachment;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
|
||||
@Component
|
||||
public class FileHandlerService {
|
||||
|
||||
private AttachmentManager attachmentManager = (AttachmentManager) AppContext.getBean("attachmentManager");
|
||||
private FileManager fileManager = (FileManager) AppContext.getBean("fileManager");
|
||||
|
||||
public void handleFile(String refId, HttpServletResponse response) throws Exception {
|
||||
File file = null;
|
||||
InputStream inputStream = null;
|
||||
try {
|
||||
Attachment attachment = attachmentManager.getAttachmentByFileURL(Long.valueOf(refId));
|
||||
InputStream inputStream = fileManager.getFileInputStream(attachment.getFileUrl());
|
||||
inputStream = fileManager.getFileInputStream(attachment.getFileUrl());
|
||||
|
||||
// ⭐ 关键:重置
|
||||
response.reset();
|
||||
|
||||
// ⭐ 必须设置类型
|
||||
response.setContentType("application/octet-stream");
|
||||
|
||||
// ⭐ 文件名处理
|
||||
String encodedFileName = URLEncoder.encode(attachment.getFilename(), "UTF-8")
|
||||
.replaceAll("\\+", "%20");
|
||||
|
||||
response.setHeader(
|
||||
"Content-Disposition",
|
||||
"attachment; filename=\"" + attachment.getFilename() + "\"; " +
|
||||
"filename*=UTF-8''" + encodedFileName
|
||||
"attachment; filename=\"" + attachment.getFilename() + "\"; filename*=UTF-8''" + encodedFileName
|
||||
);
|
||||
try (OutputStream outputStream = new BufferedOutputStream(response.getOutputStream())) {
|
||||
byte[] buffer = new byte[2048];
|
||||
int bytesRead;
|
||||
while ((bytesRead = inputStream.read(buffer)) != -1) {
|
||||
outputStream.write(buffer, 0, bytesRead);
|
||||
}
|
||||
outputStream.flush();
|
||||
} catch (Exception e) {
|
||||
|
||||
// ⭐ 输出流
|
||||
OutputStream outputStream = response.getOutputStream();
|
||||
|
||||
byte[] buffer = new byte[2048];
|
||||
int len;
|
||||
|
||||
while ((len = inputStream.read(buffer)) != -1) {
|
||||
outputStream.write(buffer, 0, len);
|
||||
}
|
||||
}finally {
|
||||
if(file != null) {
|
||||
file.delete();
|
||||
}
|
||||
|
||||
outputStream.flush();
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace(); // ❗不要吞异常
|
||||
} finally {
|
||||
try {
|
||||
if (inputStream != null) inputStream.close();
|
||||
} catch (Exception ignored) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,18 +4,15 @@ import com.seeyon.apps.src_rent.config.RentConfigProvider;
|
||||
import com.seeyon.apps.src_rent.constants.RentConstants;
|
||||
import com.seeyon.apps.src_rent.po.OaResp;
|
||||
import com.seeyon.apps.src_rent.utils.OaRestClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class FlowCreateService {
|
||||
|
||||
@Autowired
|
||||
private RentConfigProvider configProvider;
|
||||
private RentConfigProvider configProvider = (RentConfigProvider) AppContext.getBean("rentConfigProvider");
|
||||
|
||||
public void flowStart(String flowName,Map<String,Object> mainFormData, Map<String, List<Object>> subFormDatas,String appName,String templateCode) throws Exception {
|
||||
OaRestClient client = new OaRestClient(configProvider.getBizConfigByKey(RentConstants.OA_HOST),
|
||||
|
||||
@@ -11,7 +11,9 @@ public enum ClauseFactor {
|
||||
NOT_NULL, //非空
|
||||
LIKE, //模糊
|
||||
AND,
|
||||
OR
|
||||
OR,
|
||||
IN,
|
||||
NOT_IN
|
||||
;
|
||||
|
||||
public boolean isNullType() {
|
||||
|
||||
@@ -12,9 +12,7 @@ import com.seeyon.ctp.common.po.ctpenumnew.CtpEnumItem;
|
||||
import com.seeyon.ctp.util.JDBCAgent;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
public class EnumMapUtils {
|
||||
|
||||
@@ -98,6 +96,35 @@ public class EnumMapUtils {
|
||||
return "";
|
||||
}
|
||||
|
||||
public static Set<String> getEnumItemValues(String formNo,String fieldDisplay) {
|
||||
Set<String> set = new HashSet<>();
|
||||
try {
|
||||
FormApi4Cap4 formApi4Cap4 = (FormApi4Cap4) AppContext.getBean("formApi4Cap4");
|
||||
FormBean cap4FormBean = formApi4Cap4.getFormByFormCode(formNo);
|
||||
FormTableBean masterTableBean = cap4FormBean.getMasterTableBean();
|
||||
FormFieldBean beanByDisplay = masterTableBean.getFieldBeanByDisplay(fieldDisplay);
|
||||
if(beanByDisplay == null || beanByDisplay.getEnumId() == 0l) {
|
||||
return set;
|
||||
}
|
||||
EnumManager enumManagerNew = (EnumManager) AppContext.getBean("enumManagerNew");
|
||||
CtpEnumBean ctpEnumBean = enumManagerNew.getEnum(beanByDisplay.getEnumId());
|
||||
|
||||
if(ctpEnumBean == null) {
|
||||
return set;
|
||||
}
|
||||
List<CtpEnumItem> ctpEnumItems = ctpEnumBean.getItems();
|
||||
if(ctpEnumBean.getItems() == null) {
|
||||
return set;
|
||||
}
|
||||
for (CtpEnumItem enumItem : ctpEnumItems) {
|
||||
set.add(enumItem.getShowvalue());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
||||
public static String getEnumItemValueByEnumId(String showValue,long enumId) {
|
||||
EnumManager enumManagerNew = (EnumManager) AppContext.getBean("enumManagerNew");
|
||||
CtpEnumBean ctpEnumBean = enumManagerNew.getEnum(enumId);
|
||||
|
||||
@@ -2,26 +2,23 @@ package com.seeyon.apps.src_rent.form;
|
||||
|
||||
|
||||
import com.seeyon.aicloud.common.JsonUtils;
|
||||
import com.seeyon.apps.src_rent.po.PageQueryVo;
|
||||
import com.seeyon.cap4.form.api.FormApi4Cap4;
|
||||
import com.seeyon.cap4.form.bean.FormBean;
|
||||
import com.seeyon.cap4.form.bean.FormFieldBean;
|
||||
import com.seeyon.cap4.form.bean.FormTableBean;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
import com.seeyon.ctp.common.exceptions.BusinessException;
|
||||
import com.seeyon.ctp.services.ServiceException;
|
||||
import com.seeyon.ctp.util.JDBCAgent;
|
||||
import com.seeyon.v3x.services.form.FormFactory;
|
||||
import com.seeyon.v3x.services.form.bean.FormExport;
|
||||
import com.seeyon.v3x.services.form.bean.ValueExport;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
public class FormDataOperator {
|
||||
|
||||
private static final Log log = LogFactory.getLog(FormDataOperator.class);
|
||||
@@ -157,9 +154,9 @@ public class FormDataOperator {
|
||||
FormFieldBean fieldBean = fieldMap4Name.get(key);
|
||||
fieldVo.setDisplayName(fieldBean.getDisplay());
|
||||
fieldVo.setValue(columnMap.get(key));
|
||||
if(changeEnum && fieldBean.isEnumField()){
|
||||
if(changeEnum){
|
||||
//转换枚举值
|
||||
fieldVo.setValue(EnumMapUtils.getEnumShowValue(fieldVo.getValue()));
|
||||
convert2ShowValue(fieldVo, fieldBean);
|
||||
}
|
||||
vos.add(fieldVo);
|
||||
}
|
||||
@@ -372,6 +369,81 @@ public class FormDataOperator {
|
||||
return columns;
|
||||
}
|
||||
|
||||
public List<Object> queryFormDataPageCondition(String formNo,Boolean changeEnum,List<String> queryColumnVos, List<FormWhereCondition> conditionVos,Integer pageNo,Integer pageSize,String orderField,String orderKeyWord) throws BusinessException {
|
||||
FormApi4Cap4 formApi4Cap4 = (FormApi4Cap4) AppContext.getBean("formApi4Cap4");
|
||||
FormBean cap4FormBean = formApi4Cap4.getFormByFormCode(formNo);
|
||||
List<String> queryColumns = new ArrayList<>();
|
||||
FormTableBean masterTableBean = cap4FormBean.getMasterTableBean();
|
||||
String tableName = masterTableBean.getTableName();
|
||||
Map<String, FormFieldBean> fieldMap4Name = masterTableBean.getFieldMap4Name();
|
||||
String orderFieldName = null;
|
||||
if (queryColumnVos != null) {
|
||||
for (String queryColumnVo : queryColumnVos) {
|
||||
FormFieldBean fieldBeanByDisplay = masterTableBean.getFieldBeanByDisplay(queryColumnVo);
|
||||
if (fieldBeanByDisplay == null) {
|
||||
continue;
|
||||
}
|
||||
queryColumns.add(fieldBeanByDisplay.getColumnName());
|
||||
}
|
||||
}
|
||||
FormFieldBean formFieldBean = masterTableBean.getFieldBeanByDisplay(orderField);
|
||||
if(formFieldBean != null) {
|
||||
orderFieldName = formFieldBean.getColumnName();
|
||||
}
|
||||
for (FormWhereCondition conditionVo : conditionVos) {
|
||||
FormFieldBean fieldBeanByDisplay = masterTableBean.getFieldBeanByDisplay(conditionVo.getDisplay());
|
||||
if (fieldBeanByDisplay == null) {
|
||||
if (conditionVo.getDisplay().equals("ID") || conditionVo.getDisplay().equals("id")) {
|
||||
conditionVo.setFieldName("ID");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
conditionVo.setFieldName(fieldBeanByDisplay.getColumnName());
|
||||
}
|
||||
|
||||
Map<String, Object> generateSql = generatePageQuerySql(queryColumns, conditionVos, tableName,pageNo,pageSize,orderFieldName,orderKeyWord);
|
||||
String sql = (String) generateSql.get("sql");
|
||||
List<Object> params = (List<Object>) generateSql.get("params");
|
||||
log.info("sql为: " + sql);
|
||||
log.info("参数为: " + JsonUtils.toJSONString(params));
|
||||
JDBCAgent jdbcAgent = new JDBCAgent();
|
||||
List<Object> columns = new ArrayList<>();
|
||||
try {
|
||||
jdbcAgent.execute(sql, params);
|
||||
List list = jdbcAgent.resultSetToList();
|
||||
for (Object o : list) {
|
||||
FormColumn column = new FormColumn();
|
||||
Map<String, Object> columnMap = (Map<String, Object>) o;
|
||||
List<FormFieldVo> vos = new ArrayList<>();
|
||||
for (String key : columnMap.keySet()) {
|
||||
FormFieldVo fieldVo = new FormFieldVo();
|
||||
if (fieldMap4Name.containsKey(key)) {
|
||||
FormFieldBean fieldBean = fieldMap4Name.get(key);
|
||||
fieldVo.setDisplayName(fieldBean.getDisplay());
|
||||
fieldVo.setValue(columnMap.get(key));
|
||||
if(changeEnum){
|
||||
//转换枚举值
|
||||
convert2ShowValue(fieldVo,fieldBean);
|
||||
}
|
||||
vos.add(fieldVo);
|
||||
}
|
||||
}
|
||||
column.setVos(vos);
|
||||
if (columnMap.get("id") != null) {
|
||||
column.setId(columnMap.get("id") + "");
|
||||
}
|
||||
Map<String, Object> fieldsMap = column.getFieldsMap();
|
||||
columns.add(fieldsMap);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
} finally {
|
||||
jdbcAgent.close();
|
||||
}
|
||||
return columns;
|
||||
}
|
||||
|
||||
public List<Object> queryFormDataPageCondition(String formNo,Boolean changeEnum,List<String> queryColumnVos, List<FormWhereCondition> conditionVos,Integer pageNo,Integer pageSize) throws BusinessException {
|
||||
FormApi4Cap4 formApi4Cap4 = (FormApi4Cap4) AppContext.getBean("formApi4Cap4");
|
||||
FormBean cap4FormBean = formApi4Cap4.getFormByFormCode(formNo);
|
||||
@@ -419,9 +491,9 @@ public class FormDataOperator {
|
||||
FormFieldBean fieldBean = fieldMap4Name.get(key);
|
||||
fieldVo.setDisplayName(fieldBean.getDisplay());
|
||||
fieldVo.setValue(columnMap.get(key));
|
||||
if(changeEnum && fieldBean.isEnumField()){
|
||||
if(changeEnum){
|
||||
//转换枚举值
|
||||
fieldVo.setValue(EnumMapUtils.getEnumShowValue(fieldVo.getValue()));
|
||||
convert2ShowValue(fieldVo,fieldBean);
|
||||
}
|
||||
vos.add(fieldVo);
|
||||
}
|
||||
@@ -567,7 +639,7 @@ public class FormDataOperator {
|
||||
break;
|
||||
}
|
||||
}
|
||||
Map<String, Object> generateSql = generateSql(queryColumns, conditionVos, tableName,"sort",pageNo,pageSize);
|
||||
Map<String, Object> generateSql = generateSql(queryColumns, conditionVos, tableName,"sort",null,pageNo,pageSize);
|
||||
String sql = (String) generateSql.get("sql");
|
||||
List<Object> params = (List<Object>) generateSql.get("params");
|
||||
log.info("sql为: " + sql);
|
||||
@@ -587,9 +659,9 @@ public class FormDataOperator {
|
||||
FormFieldBean fieldBean = fieldMap4Name.get(key);
|
||||
fieldVo.setDisplayName(fieldBean.getDisplay());
|
||||
fieldVo.setValue(columnMap.get(key));
|
||||
if(changeEnum && fieldBean.isEnumField()){
|
||||
if(changeEnum){
|
||||
//转换枚举值
|
||||
fieldVo.setValue(EnumMapUtils.getEnumShowValue(fieldVo.getValue()));
|
||||
convert2ShowValue(fieldVo,fieldBean);
|
||||
}
|
||||
vos.add(fieldVo);
|
||||
}
|
||||
@@ -629,14 +701,19 @@ public class FormDataOperator {
|
||||
}
|
||||
|
||||
private Map<String, Object> generateSql(List<String> queryColumn, List<FormWhereCondition> conditions, String tableName) {
|
||||
return generateSql( queryColumn, conditions, tableName,null,null,null);
|
||||
return generateSql( queryColumn, conditions, tableName,null,null,null,null);
|
||||
}
|
||||
|
||||
private Map<String, Object> generatePageQuerySql(List<String> queryColumn, List<FormWhereCondition> conditions, String tableName,Integer pageNo,Integer pageSize,String orderField,String orderKeyWord) {
|
||||
return generateSql( queryColumn, conditions, tableName,orderField,orderKeyWord,pageNo,pageSize);
|
||||
}
|
||||
|
||||
|
||||
private Map<String, Object> generatePageQuerySql(List<String> queryColumn, List<FormWhereCondition> conditions, String tableName,Integer pageNo,Integer pageSize) {
|
||||
return generateSql( queryColumn, conditions, tableName,null,pageNo,pageSize);
|
||||
return generateSql( queryColumn, conditions, tableName,null,null,pageNo,pageSize);
|
||||
}
|
||||
|
||||
private Map<String, Object> generateSql(List<String> queryColumn, List<FormWhereCondition> conditions, String tableName,String orderField,Integer pageNo,Integer pageSize) {
|
||||
private Map<String, Object> generateSql(List<String> queryColumn, List<FormWhereCondition> conditions, String tableName,String orderField,String orderKeyWord,Integer pageNo,Integer pageSize) {
|
||||
if (tableName == null) {
|
||||
throw new IllegalArgumentException("tableName cannot be null or empty");
|
||||
}
|
||||
@@ -660,8 +737,11 @@ public class FormDataOperator {
|
||||
|
||||
List<Object> params = new ArrayList<>();
|
||||
sqlBuilder.append(buildWhereClause(conditions,params));
|
||||
String orderType = StringUtils.isBlank(orderKeyWord) ? "ASC" : orderKeyWord;
|
||||
if(orderField == null) {
|
||||
sqlBuilder.append(" order by start_date desc");
|
||||
sqlBuilder.append(" order by start_date " + orderType);
|
||||
}else {
|
||||
sqlBuilder.append(" order by " + orderField + " " +orderType);
|
||||
}
|
||||
if(pageNo != null && pageSize != null) {
|
||||
sqlBuilder.append(" limit " + pageSize + " offset " + (pageNo - 1) * pageSize);
|
||||
@@ -866,19 +946,21 @@ public class FormDataOperator {
|
||||
}
|
||||
}
|
||||
|
||||
public void handleEnumDeptEtc(Map<String,Object> map,String formNo) throws BusinessException {
|
||||
FormApi4Cap4 formApi4Cap4 = (FormApi4Cap4) AppContext.getBean("formApi4Cap4");
|
||||
FormBean cap4FormBean = formApi4Cap4.getFormByFormCode(formNo);
|
||||
FormTableBean masterTableBean = cap4FormBean.getMasterTableBean();
|
||||
for (String key : map.keySet()) {
|
||||
FormFieldBean fieldBean = masterTableBean.getFieldBeanByDisplay(key);
|
||||
if(fieldBean == null) {
|
||||
continue;
|
||||
}
|
||||
public void convert2ShowValue(FormFieldVo fieldVo,FormFieldBean fieldBean) throws BusinessException {
|
||||
switch (fieldBean.getInputType()) {
|
||||
case "select": if(fieldBean.getEnumId() != 0l) {
|
||||
String enumItemId = EnumMapUtils.getEnumItemValueByEnumId((String)map.get(key),fieldBean.getEnumId());
|
||||
map.put(key,enumItemId);
|
||||
case "select": if(fieldBean.isEnumField() && fieldVo.getValue() != null) {
|
||||
String value = EnumMapUtils.getEnumShowValue(fieldVo.getValue() + "");
|
||||
fieldVo.setValue(value);
|
||||
} break;
|
||||
case "multiselect": if(fieldBean.isEnumField() && fieldVo.getValue() != null) {
|
||||
String str = (String)fieldVo.getValue();
|
||||
String[] split = str.split(",");
|
||||
List<String> showValueList = new ArrayList<>();
|
||||
for (String enumId : split) {
|
||||
String value = EnumMapUtils.getEnumShowValue(enumId + "");
|
||||
showValueList.add(value);
|
||||
}
|
||||
fieldVo.setValue(showValueList);
|
||||
} break;
|
||||
case "image":break;
|
||||
case "attachment": break;
|
||||
@@ -892,7 +974,7 @@ public class FormDataOperator {
|
||||
default: break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void handleSubTableEnumDeptEtc(Map<String,Object> map,String formNo) throws BusinessException {
|
||||
@@ -994,56 +1076,74 @@ public class FormDataOperator {
|
||||
if (conditions == null || conditions.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
StringBuilder whereClause = new StringBuilder(" WHERE ");
|
||||
int conditionIndex = 0;
|
||||
|
||||
for (FormWhereCondition condition : conditions) {
|
||||
// 处理括号起始
|
||||
if (condition.isStartWithBracket()) {
|
||||
whereClause.append("(");
|
||||
StringBuilder whereCause = new StringBuilder(" WHERE ");
|
||||
for (int i = 0; i < conditions.size(); i++) {
|
||||
FormWhereCondition c = conditions.get(i);
|
||||
// 左括号
|
||||
if (c.isStartWithBracket()) {
|
||||
whereCause.append("(");
|
||||
}
|
||||
|
||||
// 字段名校验
|
||||
String fieldName = condition.getFieldName();
|
||||
ClauseFactor factor = condition.getClauseFactor();
|
||||
String field = c.getFieldName();
|
||||
ClauseFactor factor = c.getClauseFactor();
|
||||
String operator = parseOperator(factor);
|
||||
|
||||
// 构建条件表达式
|
||||
String conditionExpr;
|
||||
// NULL / NOT NULL
|
||||
if (factor.isNullType()) {
|
||||
// 处理 NULL/NOT NULL 条件(无需参数)
|
||||
conditionExpr = String.format("%s %s", fieldName, operator);
|
||||
whereCause.append(field).append(" ").append(operator);
|
||||
} else if (ClauseFactor.IN.equals(factor) || ClauseFactor.NOT_IN.equals(factor)) {
|
||||
appendInClause(whereCause, field, operator, c.getValue(), params);
|
||||
} else {
|
||||
// 处理普通条件(带占位符)
|
||||
conditionExpr = String.format("%s %s ?", fieldName, operator);
|
||||
// 处理函数模板(如 TO_DATE)
|
||||
if (condition.getIndex() != null) {
|
||||
conditionExpr = conditionExpr.replace("?", condition.getIndex());
|
||||
}
|
||||
// 添加参数值
|
||||
if(ClauseFactor.LIKE.equals(factor)){
|
||||
params.add("%" + condition.getValue() + "%");
|
||||
String placeholder = "?";
|
||||
// 函数模板(如 TO_DATE(?))
|
||||
if (c.getIndex() != null) {
|
||||
placeholder = c.getIndex();
|
||||
whereCause.append(" ").append(placeholder).append(",").append(field).append(")").append(operator).append(" ").append("0");
|
||||
}else {
|
||||
params.add(condition.getValue());
|
||||
whereCause.append(field).append(" ").append(operator).append(" ").append(placeholder);
|
||||
}
|
||||
if (ClauseFactor.LIKE.equals(factor)) {
|
||||
params.add("%" + c.getValue() + "%");
|
||||
} else {
|
||||
params.add(c.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
whereClause.append(conditionExpr);
|
||||
|
||||
// 处理括号闭合
|
||||
if (condition.isEndWithBracket()) {
|
||||
whereClause.append(")");
|
||||
// 右括号
|
||||
if (c.isEndWithBracket()) {
|
||||
whereCause.append(")");
|
||||
}
|
||||
|
||||
// 添加连接符(AND/OR)
|
||||
if (conditionIndex < conditions.size() - 1) {
|
||||
whereClause.append(" ").append(condition.getConcatFactor()).append(" ");
|
||||
// AND / OR
|
||||
if (i < conditions.size() - 1) {
|
||||
whereCause.append(" ").append(c.getConcatFactor()).append(" ");
|
||||
}
|
||||
conditionIndex++;
|
||||
}
|
||||
return whereCause.toString();
|
||||
}
|
||||
|
||||
return whereClause.toString();
|
||||
private void appendInClause(
|
||||
StringBuilder sql,
|
||||
String field,
|
||||
String operator,
|
||||
Object value,
|
||||
List<Object> params) {
|
||||
if (!(value instanceof Collection)) {
|
||||
throw new IllegalArgumentException("IN 条件的值必须是 Collection");
|
||||
}
|
||||
Collection<?> values = (Collection<?>) value;
|
||||
if (values.isEmpty()) {
|
||||
// 防止 SQL 语法错误
|
||||
sql.append("1 = 0");
|
||||
return;
|
||||
}
|
||||
sql.append(field).append(" ").append(operator).append(" (");
|
||||
int index = 0;
|
||||
for (Object v : values) {
|
||||
if (index > 0) {
|
||||
sql.append(", ");
|
||||
}
|
||||
sql.append("?");
|
||||
params.add(v);
|
||||
index++;
|
||||
}
|
||||
sql.append(")");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1070,6 +1170,7 @@ public class FormDataOperator {
|
||||
case GE: return ">=";
|
||||
case LT: return "<";
|
||||
case LE: return "<=";
|
||||
case IN: return "in";
|
||||
case LIKE: return "LIKE";
|
||||
case NULL: return "IS NULL"; // 空值判断
|
||||
case NOT_NULL: return "IS NOT NULL"; // 非空判断
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
package com.seeyon.apps.src_rent.form;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public class FormWhereCondition {
|
||||
private String display;
|
||||
private String fieldName; //字段名
|
||||
private Object value; //值
|
||||
private List<Object> values; //值
|
||||
private ClauseFactor clauseFactor = ClauseFactor.EQ; //条件因子 eq lt gt not_null null
|
||||
private ClauseFactor concatFactor = ClauseFactor.AND; //拼接因子
|
||||
private boolean startWithBracket = false; //是否以括号开头生成子条件
|
||||
@@ -12,6 +17,7 @@ public class FormWhereCondition {
|
||||
private String index;
|
||||
|
||||
public FormWhereCondition() {
|
||||
this.values = new ArrayList<>();
|
||||
}
|
||||
|
||||
public String getDisplay() {
|
||||
@@ -124,4 +130,21 @@ public class FormWhereCondition {
|
||||
public void setEndWithBracket(boolean endWithBracket) {
|
||||
this.endWithBracket = endWithBracket;
|
||||
}
|
||||
|
||||
public List<Object> getValues() {
|
||||
return values;
|
||||
}
|
||||
public FormWhereCondition addValue(Object value) {
|
||||
this.values.add(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public FormWhereCondition addAllValue(Collection <?> values) {
|
||||
this.values.addAll(values);
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setValues(List<Object> values) {
|
||||
this.values = values;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,13 +3,14 @@ package com.seeyon.apps.src_rent.job;
|
||||
import com.seeyon.apps.ext.quartz.AbstractQuartzTask;
|
||||
import com.seeyon.apps.src_rent.bill.BillService;
|
||||
import com.seeyon.apps.src_rent.bill.BillVo;
|
||||
import com.seeyon.apps.src_rent.bill.WaeBillService;
|
||||
import com.seeyon.apps.src_rent.form.ClauseFactor;
|
||||
import com.seeyon.apps.src_rent.form.FormWhereCondition;
|
||||
import com.seeyon.apps.src_rent.message.ThirdMessageService;
|
||||
import com.seeyon.apps.src_rent.message.MessageVo;
|
||||
import com.seeyon.apps.src_rent.po.PageQueryVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
@@ -17,22 +18,22 @@ import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
|
||||
public class BillPayUrgeJob extends AbstractQuartzTask {
|
||||
|
||||
@Autowired
|
||||
private BillService billService;
|
||||
@Autowired
|
||||
private ThirdMessageService thirdMessageService;
|
||||
private BillService billService = (BillService) AppContext.getBean("qcBillService");
|
||||
private WaeBillService waeBillService = (WaeBillService) AppContext.getBean("qcWaeBillService");
|
||||
private ThirdMessageService thirdMessageService = (ThirdMessageService) AppContext.getBean("qcThirdMessageService");
|
||||
|
||||
@Override
|
||||
public String taskRun(String s) throws Exception {
|
||||
hanleContractBill();
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "";
|
||||
return "账单催缴消息发送定时任务";
|
||||
}
|
||||
|
||||
private void hanleContractBill() {
|
||||
@@ -49,11 +50,45 @@ public class BillPayUrgeJob extends AbstractQuartzTask {
|
||||
for (BillVo data : datas) {
|
||||
//发送消息到小程序后端
|
||||
MessageVo messageVo = new MessageVo();
|
||||
String context = "尊敬的用户,";
|
||||
String context = "尊敬的用户,您有一笔" + data.getBillAmount() + "元的" + data.getBillName() + "账单尚未支付,请尽快支付";
|
||||
messageVo.setMessageContent(context);
|
||||
messageVo.setMessageTime(df.format(new Date()));
|
||||
messageVo.setMessageType("UNPAIDBILL");
|
||||
messageVo.setMessageType("BILL");
|
||||
messageVo.setMessageReceiver(data.getCusNo());
|
||||
messageVo.setBizId(data.getBillNo());
|
||||
messageVo.setMessageText(context);
|
||||
messageVo.setTitle("账单催缴");
|
||||
thirdMessageService.sendMessage(messageVo);
|
||||
}
|
||||
}while (pageQueryVo != null && pageQueryVo.getDatas() != null);
|
||||
}catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void hanleWaeBill() {
|
||||
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
try {
|
||||
//拉取收款结果反馈为空,且存在催缴时间的账单记录
|
||||
List<FormWhereCondition> conditions = new ArrayList<>();;
|
||||
conditions.add(FormWhereCondition.build().display("账单-收款结果反馈").clauseFactor(ClauseFactor.NULL));
|
||||
conditions.add(FormWhereCondition.build().display("账单-催缴时间").clauseFactor(ClauseFactor.NOT_NULL));
|
||||
PageQueryVo pageQueryVo = null;
|
||||
do{
|
||||
pageQueryVo = waeBillService.queryAllWaeBill(conditions);
|
||||
List<BillVo> datas = pageQueryVo.getDatas();
|
||||
for (BillVo data : datas) {
|
||||
//发送消息到小程序后端
|
||||
MessageVo messageVo = new MessageVo();
|
||||
String context = "尊敬的用户,您有一笔" + data.getBillAmount() + "元的" + data.getBillName() + "水电费账单尚未支付,请尽快支付";
|
||||
messageVo.setMessageContent(context);
|
||||
messageVo.setMessageTime(df.format(new Date()));
|
||||
messageVo.setMessageType("BILL");
|
||||
messageVo.setMessageReceiver(data.getCusNo());
|
||||
messageVo.setBizId(data.getBillNo());
|
||||
messageVo.setMessageText(context);
|
||||
messageVo.setTitle("账单催缴");
|
||||
thirdMessageService.sendMessage(messageVo);
|
||||
}
|
||||
}while (pageQueryVo != null && pageQueryVo.getDatas() != null);
|
||||
}catch (Exception e) {
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.seeyon.apps.src_rent.job;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.seeyon.apps.ext.quartz.AbstractQuartzTask;
|
||||
import com.seeyon.apps.src_rent.contract.ContractService;
|
||||
import com.seeyon.apps.src_rent.contract.OaContractVo;
|
||||
import com.seeyon.apps.src_rent.message.MessageVo;
|
||||
import com.seeyon.apps.src_rent.message.ThirdMessageService;
|
||||
import com.seeyon.apps.src_rent.po.PageQueryVo;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class ContractSignUrgeJob extends AbstractQuartzTask {
|
||||
|
||||
private ContractService contractService = (ContractService) AppContext.getBean("qcContractService");
|
||||
private ThirdMessageService thirdMessageService = (ThirdMessageService) AppContext.getBean("qcThirdMessageService");
|
||||
|
||||
@Override
|
||||
public String taskRun(String s) throws Exception {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "";
|
||||
}
|
||||
|
||||
void urgeSign() throws Exception {
|
||||
JSONObject param = new JSONObject();
|
||||
Integer pageNo = 1;
|
||||
Integer pageSize = 20;
|
||||
param.put("pageNo",pageNo);
|
||||
param.put("pageSize",pageSize);
|
||||
param.put("signStatus","未签署");
|
||||
List<OaContractVo> contracts = null;
|
||||
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
do{
|
||||
PageQueryVo queryVo = contractService.pageQuery(param);
|
||||
contracts = queryVo.getDatas();
|
||||
if(contracts == null || contracts.size() == 0) {
|
||||
break;
|
||||
}
|
||||
for (OaContractVo contract : contracts) {
|
||||
String endDate = contract.getEndDate();
|
||||
Date date = df.parse(endDate);
|
||||
Date nowDate = new Date();
|
||||
if(date.getTime() - nowDate.getTime() <= 259200000 ) {
|
||||
//还有三天到期则发消息提醒签署
|
||||
MessageVo messageVo = new MessageVo();
|
||||
messageVo.setBizId(contract.getContractNo());
|
||||
messageVo.setTitle("合同签署即将超期提醒");
|
||||
messageVo.setMessageText("您有一份租赁合同即将到期,请尽快登录伍家启辰资产小程序进行签署");
|
||||
messageVo.setMessageReceiver(contract.getCusNo());
|
||||
thirdMessageService.sendMessage(messageVo);
|
||||
}
|
||||
|
||||
}
|
||||
pageNo++;
|
||||
}while (contracts != null && contracts.size() > 0);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -11,43 +11,41 @@ import com.seeyon.apps.src_rent.po.SealInfoVo;
|
||||
import com.seeyon.apps.src_rent.service.SealService;
|
||||
import com.seeyon.apps.src_rent.service.TokenCacheManager;
|
||||
import com.seeyon.apps.src_rent.utils.HttpClient;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class SealDocSyncJob extends AbstractQuartzTask {
|
||||
|
||||
private static final Log log = LogFactory.getLog(SealDocSyncJob.class);
|
||||
@Autowired
|
||||
private RentConfigProvider configProvider;
|
||||
@Autowired
|
||||
private TokenCacheManager tokenCacheManager;
|
||||
@Autowired
|
||||
private SealService sealService;
|
||||
private RentConfigProvider configProvider = (RentConfigProvider) AppContext.getBean("rentConfigProvider");
|
||||
private TokenCacheManager tokenCacheManager = (TokenCacheManager) AppContext.getBean("qcTokenCacheManager");
|
||||
private SealService sealService = (SealService) AppContext.getBean("qcSealService");
|
||||
|
||||
@Override
|
||||
public String taskRun(String s) throws Exception {
|
||||
log.info("开始执行印章同步任务");
|
||||
syncSeals();
|
||||
List<String> appIds = tokenCacheManager.getAppIds();
|
||||
for (String appId : appIds) {
|
||||
syncSeals(appId);
|
||||
}
|
||||
log.info("印章同步任务完成");
|
||||
return "";
|
||||
}
|
||||
|
||||
private void syncSeals() {
|
||||
String orgId = configProvider.getBizConfigByKey(RentConstants.eSignOrgId);
|
||||
private void syncSeals(String appId) {
|
||||
String host = configProvider.getBizConfigByKey(RentConstants.ESIGN_HOST);
|
||||
Integer pageNum = 1;
|
||||
Integer pageSize = 20;
|
||||
EsignApiHeader esignApiHeader = EsignApiHeader.build().appId(configProvider.getBizConfigByKey(RentConstants.APP_ID));
|
||||
esignApiHeader.token(tokenCacheManager.getToken());
|
||||
EsignApiHeader esignApiHeader = EsignApiHeader.build().appId(appId);
|
||||
esignApiHeader.token(tokenCacheManager.getToken(appId));
|
||||
EsignBaseResp esignBaseResp = null;
|
||||
Map<String,Object> dataMap = null;
|
||||
do {
|
||||
String url = host + EsignApiUrl.SEAL_QUERY_URL + "?" + "orgId=" + orgId + "&pageNum=" + (pageNum++) + "&pageSize=" + pageSize;
|
||||
String url = host + EsignApiUrl.SEAL_QUERY_URL + "?" + "orgId=" + tokenCacheManager.getOrgNameByAppId(appId) + "&pageNum=" + (pageNum++) + "&pageSize=" + pageSize;
|
||||
String respStr = HttpClient.httpGet(url, esignApiHeader.convert2Headers(),"UTF-8");
|
||||
esignBaseResp = JsonUtils.parseObject(respStr, EsignBaseResp.class);
|
||||
if(esignBaseResp.getCode() != 0) {
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.seeyon.apps.src_rent.logfile;
|
||||
|
||||
import com.seeyon.aicloud.common.JsonUtils;
|
||||
import com.seeyon.v3x.dee.util.DateUtil;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
public class EsignParamRecordUtils {
|
||||
|
||||
public static void saveEsignParamRecord(Map<String,Object> params) {
|
||||
try {
|
||||
String str = "/home/seeyon/Seeyon/A8/ApacheJetspeed/logs_sy";
|
||||
String date = DateUtil.format(new Date(), "yyyyMMddHHmmss");
|
||||
FileUtils.writeStringToFile(new File(str+"/esignParams/" + date + ".json"), JsonUtils.toJSONString(params), "UTF-8");
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,19 @@
|
||||
package com.seeyon.apps.src_rent.message;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class MessageVo {
|
||||
|
||||
private String title;
|
||||
private String messageType;
|
||||
private String messageContent;
|
||||
private String messageText;
|
||||
private String messageTime;
|
||||
private String messageReceiver;
|
||||
private String bizId;
|
||||
private Boolean sendSubscribeMsg;
|
||||
private String subscribeMsgMode;
|
||||
private Map<String,String> templateValue;
|
||||
|
||||
public String getMessageType() {
|
||||
return messageType;
|
||||
@@ -47,4 +54,44 @@ public class MessageVo {
|
||||
public void setBizId(String bizId) {
|
||||
this.bizId = bizId;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getMessageText() {
|
||||
return messageText;
|
||||
}
|
||||
|
||||
public void setMessageText(String messageText) {
|
||||
this.messageText = messageText;
|
||||
}
|
||||
|
||||
public Boolean getSendSubscribeMsg() {
|
||||
return sendSubscribeMsg;
|
||||
}
|
||||
|
||||
public void setSendSubscribeMsg(Boolean sendSubscribeMsg) {
|
||||
this.sendSubscribeMsg = sendSubscribeMsg;
|
||||
}
|
||||
|
||||
public String getSubscribeMsgMode() {
|
||||
return subscribeMsgMode;
|
||||
}
|
||||
|
||||
public void setSubscribeMsgMode(String subscribeMsgMode) {
|
||||
this.subscribeMsgMode = subscribeMsgMode;
|
||||
}
|
||||
|
||||
public Map<String, String> getTemplateValue() {
|
||||
return templateValue;
|
||||
}
|
||||
|
||||
public void setTemplateValue(Map<String, String> templateValue) {
|
||||
this.templateValue = templateValue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,17 +5,14 @@ import com.seeyon.apps.src_rent.config.RentConfigProvider;
|
||||
import com.seeyon.apps.src_rent.constants.RentConstants;
|
||||
import com.seeyon.apps.src_rent.utils.AESUtils;
|
||||
import com.seeyon.apps.src_rent.utils.HttpClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class ThirdMessageService {
|
||||
|
||||
@Autowired
|
||||
private RentConfigProvider configProvider;
|
||||
private RentConfigProvider configProvider = (RentConfigProvider) AppContext.getBean("rentConfigProvider");
|
||||
|
||||
public void sendMessage(MessageVo messageVo) {
|
||||
String url = configProvider.getBizConfigByKey(RentConstants.WECHATBACKENDHOST) + "/message/send";
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.seeyon.apps.src_rent.constants.RentConstants;
|
||||
import com.seeyon.apps.src_rent.form.FormDataOperator;
|
||||
import com.seeyon.apps.src_rent.form.FormUpdateField;
|
||||
import com.seeyon.apps.src_rent.form.FormWhereCondition;
|
||||
import com.seeyon.apps.src_rent.logfile.EsignParamRecordUtils;
|
||||
import com.seeyon.apps.src_rent.po.NormalSignFieldConfig;
|
||||
import com.seeyon.apps.src_rent.po.SignField;
|
||||
import com.seeyon.apps.src_rent.po.SignFieldPosition;
|
||||
@@ -16,22 +17,20 @@ import com.seeyon.apps.src_rent.po.Signer;
|
||||
import com.seeyon.apps.src_rent.service.EsignByTemplateService;
|
||||
import com.seeyon.apps.src_rent.service.EsignByUploadFileService;
|
||||
import com.seeyon.apps.src_rent.service.SignLinkService;
|
||||
import com.seeyon.apps.src_rent.service.TokenCacheManager;
|
||||
import com.seeyon.cap4.form.bean.FormDataMasterBean;
|
||||
import com.seeyon.cap4.form.bean.FormFieldBean;
|
||||
import com.seeyon.cap4.form.service.CAP4FormManager;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
import com.seeyon.ctp.common.exceptions.BusinessException;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
@Component
|
||||
public class EsignMultipleSignerNode extends ACommonSuperNode {
|
||||
|
||||
private static final Log log = LogFactory.getLog(EsignMultipleSignerNode.class);
|
||||
@@ -40,14 +39,12 @@ public class EsignMultipleSignerNode extends ACommonSuperNode {
|
||||
private static final String CONTRACT_ATTACHMENT_FIELD = "合同审批附件";
|
||||
private static final String B_UNIT_NAME_FIELD = "乙方单位名称";
|
||||
private static CAP4FormManager cap4FormManager = (CAP4FormManager) AppContext.getBean("cap4FormManager");
|
||||
@Autowired
|
||||
private RentConfigProvider configProvider;
|
||||
@Autowired
|
||||
private EsignByUploadFileService uploadFileService;
|
||||
@Autowired
|
||||
private EsignByTemplateService templateService;
|
||||
@Autowired
|
||||
private SignLinkService signLinkService;
|
||||
private final DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
private RentConfigProvider configProvider = (RentConfigProvider)AppContext.getBean("rentConfigProvider");
|
||||
private EsignByUploadFileService uploadFileService = (EsignByUploadFileService) AppContext.getBean("qcEsignByUploadFileService");
|
||||
private EsignByTemplateService templateService = (EsignByTemplateService) AppContext.getBean("qcEsignByTemplateService");
|
||||
private SignLinkService signLinkService = (SignLinkService) AppContext.getBean("qcSignLinkService");
|
||||
private TokenCacheManager tokenCacheManager = (TokenCacheManager) AppContext.getBean("qcTokenCacheManager");
|
||||
|
||||
@Override
|
||||
public String getPluginId() {
|
||||
@@ -64,12 +61,17 @@ public class EsignMultipleSignerNode extends ACommonSuperNode {
|
||||
SuperNodeContext context = new SuperNodeContext();
|
||||
context.setNeedSave(true);
|
||||
log.info("进入 E签宝多方签署集成超级节点");
|
||||
|
||||
try {
|
||||
Map<String, Object> signParams = buildSignParams(formDataVo, formDataMasterBean, true);
|
||||
String appId = null;
|
||||
FieldDataVo signOrgData = formDataVo.getFieldData("签订单位");
|
||||
if(signOrgData != null) {
|
||||
appId = tokenCacheManager.getAppIdByOrgName(signOrgData.getStringValue());
|
||||
}
|
||||
Map<String, Object> signParams = buildSignParams(appId,formDataVo, formDataMasterBean, true);
|
||||
if (signParams == null) throw new RuntimeException("签署参数构建失败");
|
||||
String esignFlowId = templateService.createBySignTemplate(signParams);
|
||||
signLinkService.saveGetLinkParam(formDataVo, formDataMasterBean,esignFlowId);
|
||||
EsignParamRecordUtils.saveEsignParamRecord(signParams);
|
||||
String esignFlowId = templateService.createBySignTemplate(signParams,appId);
|
||||
signLinkService.saveGetLinkParam(appId,formDataVo, formDataMasterBean,esignFlowId);
|
||||
log.info("E签宝签署流程ID: " + esignFlowId + " , OA超级节点ID:" + formDataVo.getToken());
|
||||
log.info("E签宝多方签署合同已发送: " + esignFlowId);
|
||||
formDataVo.getNewFieldDataMap().put("电子签合同流程ID", esignFlowId);
|
||||
@@ -81,16 +83,22 @@ public class EsignMultipleSignerNode extends ACommonSuperNode {
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, Object> buildSignFlowConfig(FormDataVo formDataVo,FormDataMasterBean masterBean) throws Exception {
|
||||
private Map<String, Object> buildSignFlowConfig(String appId,FormDataVo formDataVo,FormDataMasterBean masterBean) throws Exception {
|
||||
String contractName = getStringField(formDataVo, CONTRACT_NAME_FIELD);
|
||||
if (contractName == null) throw new RuntimeException("合同名称不能为空");
|
||||
String formId = formDataVo.getToken() +"_" + formDataVo.getId();
|
||||
Long enumId = masterBean.getFormTable().getFieldBeanByDisplay("签署状态").getEnumId();
|
||||
String signCallBackUrl = configProvider.getBizConfigByKey(RentConstants.OA_HOST) + "/seeyon/esigncallback.do?method=callback&formId=" + formId + "&tablename=" + masterBean.getFormTable().getTableName() + "&updatefield=" + masterBean.getFormTable().getFieldBeanByDisplay("盖章后合同附件").getColumnName() + "&statusfield=" + masterBean.getFormTable().getFieldBeanByDisplay("签署状态").getColumnName() + "_" + enumId;
|
||||
String signCallBackUrl = configProvider.getBizConfigByKey(RentConstants.OA_HOST) + "/seeyon/esigncallback.do?method=callback&formId=" + formId + "&tablename=" + masterBean.getFormTable().getTableName() + "&updatefield=" + masterBean.getFormTable().getFieldBeanByDisplay("盖章后合同附件").getColumnName()
|
||||
+ "&statusfield=" + masterBean.getFormTable().getFieldBeanByDisplay("签署状态").getColumnName() + "_" + enumId + "&xId=" + appId;;
|
||||
Map<String, Object> config = new HashMap<>();
|
||||
config.put("signFlowTitle", contractName);
|
||||
config.put("autoFinish", true);
|
||||
config.put("notifyUrl", signCallBackUrl);
|
||||
if(formDataVo.getFieldData("签约时效") != null) {
|
||||
FieldDataVo signEndTime = formDataVo.getFieldData("签约时效");
|
||||
Date date = (Date) signEndTime.getDbValue();
|
||||
config.put("signFlowExpireTime",date.getTime());
|
||||
}
|
||||
Map<String, Object> noticeConfig = new HashMap<>();
|
||||
noticeConfig.put("noticeTypes", "1");
|
||||
config.put("noticeConfig", noticeConfig);
|
||||
@@ -100,10 +108,11 @@ public class EsignMultipleSignerNode extends ACommonSuperNode {
|
||||
return config;
|
||||
}
|
||||
|
||||
private List<Signer> buildSigners(FormDataVo formDataVo, String fileId, boolean qifengSign) throws Exception {
|
||||
List<Object> positions = uploadFileService.getSignPosition(fileId);
|
||||
List<SignFieldPosition> bPositions = extractPosition(positions, "乙方盖章/签字");
|
||||
List<SignFieldPosition> aPositions = extractPosition(positions, "甲方盖章/签字");
|
||||
private List<Signer> buildSigners(String appId,FormDataVo formDataVo, String fileId) throws Exception {
|
||||
List<Object> positions = uploadFileService.getSignPosition(appId,fileId);
|
||||
List<SignFieldPosition> bPositions = extractPosition(positions, configProvider.getBizConfigByKey(RentConstants.bSignPositionKeyword));
|
||||
List<SignFieldPosition> aPositions = extractPosition(positions, configProvider.getBizConfigByKey(RentConstants.aSignPositionKeyword));
|
||||
List<SignFieldPosition> lpPositions = extractPosition(positions, configProvider.getBizConfigByKey(RentConstants.lpSignPositionKeyword));
|
||||
String bSignerType = formDataVo.getFieldData("乙方签署类型").getStringValue();
|
||||
|
||||
SignFieldPosition aQiFengposition = new SignFieldPosition();
|
||||
@@ -112,7 +121,6 @@ public class EsignMultipleSignerNode extends ACommonSuperNode {
|
||||
SignFieldPosition bQiFengposition = new SignFieldPosition();
|
||||
bQiFengposition.setAcrossPageMode("ALL");
|
||||
bQiFengposition.setPositionY(720f);
|
||||
|
||||
aPositions.add(aQiFengposition);
|
||||
bPositions.add(bQiFengposition);
|
||||
String sealId = getStringField(formDataVo,"甲方印章ID");
|
||||
@@ -130,19 +138,36 @@ public class EsignMultipleSignerNode extends ACommonSuperNode {
|
||||
Signer aSigner = createOrgSigner(
|
||||
fileId,null, aPositions, 1, null, null, null, null, null, null,true
|
||||
,sealId);
|
||||
buildALegalSignField(true,lpPositions,fileId,aSigner.getSignFields());
|
||||
List<Signer> signers = new ArrayList<>();
|
||||
signers.add(bSigner);
|
||||
signers.add(aSigner);
|
||||
return signers;
|
||||
}
|
||||
|
||||
private Map<String, Object> buildSignParams(FormDataVo formDataVo, FormDataMasterBean formDataMasterBean, boolean byFile) throws Exception {
|
||||
private void buildALegalSignField(Boolean autoSign,List<SignFieldPosition> lpPositions,String fileId,List<SignField> signFields){
|
||||
for (SignFieldPosition lpPosition : lpPositions) {
|
||||
NormalSignFieldConfig fieldConfig = new NormalSignFieldConfig();
|
||||
lpPosition.setPositionX(lpPosition.getPositionX() + 100f);
|
||||
fieldConfig.setSignFieldPosition(lpPosition);
|
||||
fieldConfig.setAssignedSealId(configProvider.getBizConfigByKey(RentConstants.legalSealId));
|
||||
fieldConfig.setAutoSign(autoSign);
|
||||
fieldConfig.setSignFieldStyle(1);
|
||||
SignField field = new SignField();
|
||||
field.setSignFieldType(0);
|
||||
field.setNormalSignFieldConfig(fieldConfig);
|
||||
field.setFileId(fileId);
|
||||
signFields.add(field);
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, Object> buildSignParams(String appId,FormDataVo formDataVo, FormDataMasterBean formDataMasterBean, boolean byFile) throws Exception {
|
||||
log.info("开始构建签署方参数");
|
||||
String fileId = null;
|
||||
if (byFile) {
|
||||
String attachmentId = getStringField(formDataVo, CONTRACT_ATTACHMENT_FIELD);
|
||||
if (attachmentId == null) throw new RuntimeException("合同附件不能为空");
|
||||
fileId = uploadFileService.uploadFileToEsign(attachmentId);
|
||||
fileId = uploadFileService.uploadFileToEsign(appId,attachmentId);
|
||||
if(fileId == null) {
|
||||
throw new RuntimeException("合同附件上传E签宝失败");
|
||||
}
|
||||
@@ -153,8 +178,8 @@ public class EsignMultipleSignerNode extends ACommonSuperNode {
|
||||
Thread.sleep(1000);
|
||||
List<Object> docs = new ArrayList<>();
|
||||
docs.add(docMap);
|
||||
Map<String, Object> signFlowConfig = buildSignFlowConfig(formDataVo, formDataMasterBean);
|
||||
List<Signer> signers = buildSigners(formDataVo, fileId,true);
|
||||
Map<String, Object> signFlowConfig = buildSignFlowConfig(appId,formDataVo, formDataMasterBean);
|
||||
List<Signer> signers = buildSigners(appId,formDataVo, fileId);
|
||||
Map<String, Object> signParams = new HashMap<>();
|
||||
signParams.put("signFlowConfig", signFlowConfig);
|
||||
signParams.put("signers", signers);
|
||||
@@ -288,6 +313,9 @@ public class EsignMultipleSignerNode extends ACommonSuperNode {
|
||||
}
|
||||
|
||||
private List<SignFieldPosition> extractPosition(List<Object> positions, String keyword) {
|
||||
if(StringUtils.isBlank(keyword)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<SignFieldPosition> posList = new ArrayList<>();
|
||||
for (Object obj : positions) {
|
||||
Map<String, Object> position = (Map<String, Object>) obj;
|
||||
@@ -300,7 +328,7 @@ public class EsignMultipleSignerNode extends ACommonSuperNode {
|
||||
Map<String,Object> tempMap = (Map<String, Object>) coord;
|
||||
SignFieldPosition sfp = new SignFieldPosition();
|
||||
sfp.setPositionPage(posMap.get("pageNum") + "");
|
||||
sfp.setPositionX(toFloat(tempMap.get("positionX")) + 150f);
|
||||
sfp.setPositionX(toFloat(tempMap.get("positionX")) + 200f);
|
||||
sfp.setPositionY(toFloat(tempMap.get("positionY")));
|
||||
posList.add(sfp);
|
||||
}
|
||||
@@ -327,11 +355,11 @@ public class EsignMultipleSignerNode extends ACommonSuperNode {
|
||||
|
||||
@Override
|
||||
public String getNodeId() {
|
||||
return "nd_20250703";
|
||||
return "nd_20250803";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNodeName() {
|
||||
return "E签宝甲乙双方签署节点";
|
||||
return "启辰E签宝甲乙双方签署节点";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,28 +9,29 @@ import com.seeyon.apps.src_rent.constants.RentConstants;
|
||||
import com.seeyon.apps.src_rent.form.FormDataOperator;
|
||||
import com.seeyon.apps.src_rent.form.FormUpdateField;
|
||||
import com.seeyon.apps.src_rent.form.FormWhereCondition;
|
||||
import com.seeyon.apps.src_rent.logfile.EsignParamRecordUtils;
|
||||
import com.seeyon.apps.src_rent.po.NormalSignFieldConfig;
|
||||
import com.seeyon.apps.src_rent.po.SignField;
|
||||
import com.seeyon.apps.src_rent.po.SignFieldPosition;
|
||||
import com.seeyon.apps.src_rent.po.Signer;
|
||||
import com.seeyon.apps.src_rent.service.EsignByTemplateService;
|
||||
import com.seeyon.apps.src_rent.service.EsignByUploadFileService;
|
||||
import com.seeyon.apps.src_rent.service.TokenCacheManager;
|
||||
import com.seeyon.cap4.form.bean.FormDataMasterBean;
|
||||
import com.seeyon.cap4.form.bean.FormFieldBean;
|
||||
import com.seeyon.cap4.form.service.CAP4FormManager;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
import com.seeyon.ctp.common.exceptions.BusinessException;
|
||||
import com.seeyon.ctp.organization.bo.V3xOrgMember;
|
||||
import com.seeyon.ctp.organization.manager.OrgManager;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class EsignOneSignerNode extends ACommonSuperNode {
|
||||
|
||||
private static final Log log = LogFactory.getLog(EsignOneSignerNode.class);
|
||||
@@ -39,12 +40,11 @@ public class EsignOneSignerNode extends ACommonSuperNode {
|
||||
private static final String CONTRACT_ATTACHMENT_FIELD = "合同审批附件";
|
||||
private static final String B_UNIT_NAME_FIELD = "乙方单位名称";
|
||||
private static CAP4FormManager cap4FormManager = (CAP4FormManager) AppContext.getBean("cap4FormManager");
|
||||
@Autowired
|
||||
private RentConfigProvider configProvider;
|
||||
@Autowired
|
||||
private EsignByUploadFileService uploadFileService;
|
||||
@Autowired
|
||||
private EsignByTemplateService templateService;
|
||||
private RentConfigProvider configProvider = (RentConfigProvider) AppContext.getBean("rentConfigProvider");
|
||||
private EsignByUploadFileService uploadFileService = (EsignByUploadFileService) AppContext.getBean("qcEsignByUploadFileService");
|
||||
private EsignByTemplateService templateService = (EsignByTemplateService) AppContext.getBean("qcEsignByTemplateService");
|
||||
private OrgManager orgManager = (OrgManager) AppContext.getBean("orgManager");
|
||||
private TokenCacheManager tokenCacheManager = (TokenCacheManager) AppContext.getBean("qcTokenCacheManager");
|
||||
|
||||
@Override
|
||||
public String getPluginId() {
|
||||
@@ -63,9 +63,15 @@ public class EsignOneSignerNode extends ACommonSuperNode {
|
||||
log.info("进入 E签宝单方签署集成超级节点");
|
||||
|
||||
try {
|
||||
Map<String, Object> signParams = buildSignParams(formDataVo, formDataMasterBean, true);
|
||||
String appId = null;
|
||||
FieldDataVo signOrgData = formDataVo.getFieldData("签订单位");
|
||||
if(signOrgData != null) {
|
||||
appId = tokenCacheManager.getAppIdByOrgName(signOrgData.getStringValue());
|
||||
}
|
||||
Map<String, Object> signParams = buildSignParams(appId,formDataVo, formDataMasterBean, true);
|
||||
if (signParams == null) throw new RuntimeException("签署参数构建失败");
|
||||
String esignFlowId = templateService.createBySignTemplate(signParams);
|
||||
EsignParamRecordUtils.saveEsignParamRecord(signParams);
|
||||
String esignFlowId = templateService.createBySignTemplate(signParams,appId);
|
||||
log.info("E签宝签署流程ID: " + esignFlowId + " , OA超级节点ID:" + formDataVo.getToken());
|
||||
log.info("E签宝单方签署合同已发送: " + esignFlowId);
|
||||
formDataVo.getNewFieldDataMap().put("电子签合同流程ID", esignFlowId);
|
||||
@@ -77,12 +83,13 @@ public class EsignOneSignerNode extends ACommonSuperNode {
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, Object> buildSignFlowConfig(FormDataVo formDataVo,FormDataMasterBean masterBean) throws Exception {
|
||||
private Map<String, Object> buildSignFlowConfig(String appId,FormDataVo formDataVo,FormDataMasterBean masterBean) throws Exception {
|
||||
String contractName = getStringField(formDataVo, CONTRACT_NAME_FIELD);
|
||||
if (contractName == null) throw new RuntimeException("合同名称不能为空");
|
||||
String formId = formDataVo.getToken() +"_" + formDataVo.getId();
|
||||
Long enumId = masterBean.getFormTable().getFieldBeanByDisplay("签署状态").getEnumId();
|
||||
String signCallBackUrl = configProvider.getBizConfigByKey(RentConstants.OA_HOST) + "/seeyon/esigncallback.do?method=callback&formId=" + formId + "&tablename=" + masterBean.getFormTable().getTableName() + "&updatefield=" + masterBean.getFormTable().getFieldBeanByDisplay("盖章后合同附件").getColumnName() + "&statusfield=" + masterBean.getFormTable().getFieldBeanByDisplay("签署状态").getColumnName() + "_" + enumId;
|
||||
String signCallBackUrl = configProvider.getBizConfigByKey(RentConstants.OA_HOST) + "/seeyon/esigncallback.do?method=callback&formId=" + formId + "&tablename=" + masterBean.getFormTable().getTableName() + "&updatefield=" + masterBean.getFormTable().getFieldBeanByDisplay("盖章后合同附件").getColumnName() + "&statusfield="
|
||||
+ masterBean.getFormTable().getFieldBeanByDisplay("签署状态").getColumnName() + "_" + enumId + "&xId=" + appId;
|
||||
Map<String, Object> config = new HashMap<>();
|
||||
config.put("signFlowTitle", contractName);
|
||||
config.put("autoFinish", true);
|
||||
@@ -96,50 +103,47 @@ public class EsignOneSignerNode extends ACommonSuperNode {
|
||||
return config;
|
||||
}
|
||||
|
||||
private List<Signer> buildOnlyASigner(FormDataVo formDataVo, String fileId) throws Exception {
|
||||
private List<Signer> buildOnlyASigner(String appId,FormDataVo formDataVo, String fileId) throws Exception {
|
||||
|
||||
SignFieldPosition aQiFengposition = new SignFieldPosition();
|
||||
aQiFengposition.setAcrossPageMode("ALL");
|
||||
aQiFengposition.setPositionY(520f);
|
||||
String sealId = getStringField(formDataVo,"甲方印章ID");
|
||||
String psnName = getStringField(formDataVo,"甲方签署经办人");
|
||||
String psnMobile = getStringField(formDataVo,"甲方签署经办人联系方式");
|
||||
String orgName = configProvider.getBizConfigByKey(RentConstants.UNITNAME);
|
||||
List<SignFieldPosition> pos = new ArrayList<>();
|
||||
Map<String, List<FormDataVo>> subFormMap = formDataVo.getSubFormMap();
|
||||
List<FormDataVo> subDataVos = subFormMap.get("甲方签署位置");
|
||||
Boolean autoSign = true;
|
||||
if(subDataVos!= null && subDataVos.size() > 0 && !subDataVos.get(0).isEmpty()){
|
||||
for (FormDataVo subDataVo : subDataVos) {
|
||||
Map<String, FieldDataVo> fieldDataVoMap = subDataVo.getFieldDataVoMap();
|
||||
String pageNo = fieldDataVoMap.get("页码").getStringValue();
|
||||
String positionX = fieldDataVoMap.get("X坐标").getStringValue();
|
||||
String positionY = fieldDataVoMap.get("Y坐标").getStringValue();
|
||||
SignFieldPosition position = new SignFieldPosition();
|
||||
position.setPositionPage(pageNo);
|
||||
position.setPositionX(Float.parseFloat(positionX));
|
||||
position.setPositionY(Float.parseFloat(positionY));
|
||||
pos.add(position);
|
||||
FieldDataVo psn = formDataVo.getFieldData("甲方签署经办人");
|
||||
String psnName = null;
|
||||
if(psn != null) {
|
||||
try {
|
||||
V3xOrgMember member = orgManager.getMemberById(Long.parseLong((String) psn.getDbValue()));
|
||||
psnName = member.getName();
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
pos.add(aQiFengposition);
|
||||
}else {
|
||||
autoSign = false;
|
||||
}
|
||||
if(psnName == null) {
|
||||
throw new RuntimeException("甲方签署经办人为空");
|
||||
}
|
||||
String psnMobile = getStringField(formDataVo,"甲方签署经办人联系方式");
|
||||
String orgName = tokenCacheManager.getOrgNameByAppId(appId);
|
||||
List<SignFieldPosition> pos = new ArrayList<>();
|
||||
Signer aSigner = createOrgSigner(
|
||||
fileId,orgName, pos, 1, null, null, null, psnMobile, psnName, null,autoSign
|
||||
fileId,orgName, pos, null, null, null, psnMobile, psnName, null,false
|
||||
,sealId);
|
||||
Signer lpSigner = createLpSigner(
|
||||
fileId,orgName, pos, null, null, null, psnMobile, psnName, null,false
|
||||
,sealId);
|
||||
List<Signer> signers = new ArrayList<>();
|
||||
signers.add(aSigner);
|
||||
signers.add(lpSigner);
|
||||
return signers;
|
||||
}
|
||||
|
||||
private Map<String, Object> buildSignParams(FormDataVo formDataVo, FormDataMasterBean formDataMasterBean, boolean byFile) throws Exception {
|
||||
private Map<String, Object> buildSignParams(String appId,FormDataVo formDataVo, FormDataMasterBean formDataMasterBean, boolean byFile) throws Exception {
|
||||
log.info("开始构建签署方参数");
|
||||
String fileId = null;
|
||||
if (byFile) {
|
||||
String attachmentId = getStringField(formDataVo, CONTRACT_ATTACHMENT_FIELD);
|
||||
if (attachmentId == null) throw new RuntimeException("合同附件不能为空");
|
||||
fileId = uploadFileService.uploadFileToEsign(attachmentId);
|
||||
fileId = uploadFileService.uploadFileToEsign(appId,attachmentId);
|
||||
if(fileId == null) {
|
||||
throw new RuntimeException("合同附件上传E签宝失败");
|
||||
}
|
||||
@@ -150,8 +154,8 @@ public class EsignOneSignerNode extends ACommonSuperNode {
|
||||
docMap.put("fileId", fileId);
|
||||
List<Object> docs = new ArrayList<>();
|
||||
docs.add(docMap);
|
||||
Map<String, Object> signFlowConfig = buildSignFlowConfig(formDataVo, formDataMasterBean);
|
||||
List<Signer> signers = buildOnlyASigner(formDataVo, fileId);
|
||||
Map<String, Object> signFlowConfig = buildSignFlowConfig(appId,formDataVo, formDataMasterBean);
|
||||
List<Signer> signers = buildOnlyASigner(appId,formDataVo, fileId);
|
||||
Map<String, Object> signParams = new HashMap<>();
|
||||
signParams.put("signFlowConfig", signFlowConfig);
|
||||
signParams.put("signers", signers);
|
||||
@@ -228,12 +232,67 @@ public class EsignOneSignerNode extends ACommonSuperNode {
|
||||
return signer;
|
||||
}
|
||||
|
||||
private Signer createOrgSigner(String fileId ,String orgName, List<SignFieldPosition> pos, int order,
|
||||
private Signer createLpSigner(String fileId ,String orgName, List<SignFieldPosition> pos,
|
||||
String legalName, String legalId, String orgCode,
|
||||
String transPhone, String psnName, String psnId,Boolean autoSign,String sealId) {
|
||||
Signer signer = new Signer();
|
||||
signer.setSignerType(2);
|
||||
List<SignField> signFields = new ArrayList<>();
|
||||
signer.setSignFields(signFields);
|
||||
if(Boolean.FALSE.equals(autoSign)){
|
||||
signer.setNoticeConfig(mapOf("noticeTypes", "1"));
|
||||
|
||||
Map<String, Object> orgInfo = mapOf("orgName", orgName,
|
||||
"transactorInfo", mapOf(
|
||||
"psnAccount", transPhone,
|
||||
"psnInfo", mapOf(
|
||||
"psnName", psnName
|
||||
)
|
||||
)
|
||||
);
|
||||
signer.setOrgSignerInfo(orgInfo);
|
||||
NormalSignFieldConfig normalSignFieldConfig = new NormalSignFieldConfig();
|
||||
normalSignFieldConfig.setAssignedSealId(sealId);
|
||||
normalSignFieldConfig.setFreeMode(true);
|
||||
normalSignFieldConfig.setAutoSign(false);
|
||||
normalSignFieldConfig.setAdaptableSignFieldSize(true);
|
||||
SignField field = new SignField();
|
||||
field.setSignFieldType(0);
|
||||
field.setNormalSignFieldConfig(normalSignFieldConfig);
|
||||
field.setFileId(fileId);
|
||||
signFields.add(field);
|
||||
}else {
|
||||
for (SignFieldPosition po : pos) {
|
||||
NormalSignFieldConfig fieldConfig = new NormalSignFieldConfig();
|
||||
fieldConfig.setAssignedSealId(sealId);
|
||||
fieldConfig.setAutoSign(autoSign);
|
||||
if("ALL".equals(po.getAcrossPageMode())){
|
||||
fieldConfig.setSignFieldPosition(po);
|
||||
fieldConfig.setSignFieldStyle(2);
|
||||
SignField qiFengfield = new SignField();
|
||||
qiFengfield.setSignFieldType(0);
|
||||
qiFengfield.setNormalSignFieldConfig(fieldConfig);
|
||||
qiFengfield.setFileId(fileId);
|
||||
signFields.add(qiFengfield);
|
||||
}else {
|
||||
fieldConfig.setSignFieldPosition(po);
|
||||
fieldConfig.setSignFieldStyle(1);
|
||||
SignField field = new SignField();
|
||||
field.setSignFieldType(0);
|
||||
field.setNormalSignFieldConfig(fieldConfig);
|
||||
field.setFileId(fileId);
|
||||
signFields.add(field);
|
||||
}
|
||||
}
|
||||
}
|
||||
return signer;
|
||||
}
|
||||
|
||||
private Signer createOrgSigner(String fileId ,String orgName, List<SignFieldPosition> pos,
|
||||
String legalName, String legalId, String orgCode,
|
||||
String transPhone, String psnName, String psnId,Boolean autoSign,String sealId) {
|
||||
Signer signer = new Signer();
|
||||
signer.setSignerType(1);
|
||||
signer.setSignConfig(mapOf("signOrder", order));
|
||||
List<SignField> signFields = new ArrayList<>();
|
||||
signer.setSignFields(signFields);
|
||||
if(Boolean.FALSE.equals(autoSign)){
|
||||
@@ -365,11 +424,11 @@ public class EsignOneSignerNode extends ACommonSuperNode {
|
||||
|
||||
@Override
|
||||
public String getNodeId() {
|
||||
return "nd_20250702";
|
||||
return "nd_20250802";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNodeName() {
|
||||
return "E签宝甲方单方签署节点";
|
||||
return "启辰E签宝甲方单方签署节点";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,29 +5,26 @@ import com.seeyon.apps.src_rent.assets.OaAssetsVo;
|
||||
import com.seeyon.apps.src_rent.config.RentConfigProvider;
|
||||
import com.seeyon.apps.src_rent.constants.RentConstants;
|
||||
import com.seeyon.apps.src_rent.file.OaFileVo;
|
||||
import com.seeyon.apps.src_rent.form.EnumMapUtils;
|
||||
import com.seeyon.apps.src_rent.form.FormColumn;
|
||||
import com.seeyon.apps.src_rent.form.FormDataOperator;
|
||||
import com.seeyon.apps.src_rent.form.FormWhereCondition;
|
||||
import com.seeyon.apps.src_rent.form.*;
|
||||
import com.seeyon.apps.src_rent.po.PageQueryVo;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
import com.seeyon.ctp.common.filemanager.manager.AttachmentManager;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class NoticeService {
|
||||
|
||||
@Autowired
|
||||
private RentConfigProvider configProvider;
|
||||
@Autowired
|
||||
private FormDataOperator formDataOperator;
|
||||
private RentConfigProvider configProvider = (RentConfigProvider)AppContext.getBean("rentConfigProvider");
|
||||
private FormDataOperator formDataOperator = (FormDataOperator) AppContext.getBean("qcFormDataOperator");
|
||||
private AttachmentManager attachmentManager = (AttachmentManager) AppContext.getBean("attachmentManager");
|
||||
private DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
private String getFormNo() {
|
||||
return configProvider.getBizConfigByKey(RentConstants.NOTICEFORMNO);
|
||||
@@ -37,6 +34,9 @@ public class NoticeService {
|
||||
List<FormWhereCondition> conditions = buildConditions(params);
|
||||
Integer pageNo = params.getInteger("pageNo") == null ? 1 : params.getInteger("pageNo");
|
||||
Integer pageSize = params.getInteger("pageSize") == null ? 10 : params.getInteger("pageSize");
|
||||
Date date = new Date();
|
||||
conditions.add(FormWhereCondition.build().display("开始日期").clauseFactor(ClauseFactor.LE).value(df.format(date)));
|
||||
conditions.add(FormWhereCondition.build().display("过期日期").clauseFactor(ClauseFactor.GT).value(df.format(date)));
|
||||
PageQueryVo<NoticeVo> pageQueryVo = new PageQueryVo();
|
||||
List<Object> datas = formDataOperator.queryFormDataPageCondition(getFormNo(), true,null, conditions, pageNo, pageSize);
|
||||
List<NoticeVo> vos = new ArrayList<>();
|
||||
@@ -93,11 +93,10 @@ public class NoticeService {
|
||||
vo.setNoticeContent(getStringValue(fieldsMap,"招租公告"));
|
||||
vo.setCreateTime(fieldsMap.get("申请日期") + "");
|
||||
if(fieldsMap.get("相关附件") != null) {
|
||||
vo.setAttachments(OaFileVo.getInstance((Long)fieldsMap.get("相关附件"),attachmentManager));
|
||||
vo.setAttachments(OaFileVo.getInstance(Long.parseLong((String)fieldsMap.get("相关附件")),attachmentManager));
|
||||
}
|
||||
if(fieldsMap.get("VR文件") != null) {
|
||||
|
||||
vo.setImgs(OaFileVo.getInstance((Long)fieldsMap.get("VR文件"),attachmentManager));
|
||||
vo.setImgs(OaFileVo.getInstance(Long.parseLong((String)fieldsMap.get("VR文件")),attachmentManager));
|
||||
}
|
||||
vo.setNoticeType("bussiness");
|
||||
}
|
||||
|
||||
@@ -10,21 +10,16 @@ import com.seeyon.apps.src_rent.form.FormDataOperator;
|
||||
import com.seeyon.apps.src_rent.form.FormWhereCondition;
|
||||
import com.seeyon.apps.src_rent.po.PageQueryVo;
|
||||
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
import com.seeyon.ctp.common.exceptions.BusinessException;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@Component
|
||||
public class ReserveService {
|
||||
@Autowired
|
||||
private RentConfigProvider configProvider;
|
||||
@Autowired
|
||||
private FormDataOperator formDataOperator;
|
||||
@Autowired
|
||||
private AssetsService assetsService;
|
||||
private RentConfigProvider configProvider = (RentConfigProvider) AppContext.getBean("rentConfigProvider");
|
||||
private FormDataOperator formDataOperator = (FormDataOperator) AppContext.getBean("qcFormDataOperator");
|
||||
private AssetsService assetsService = (AssetsService) AppContext.getBean("qcAssetsService");
|
||||
|
||||
private String getFormNo() {
|
||||
return configProvider.getBizConfigByKey(RentConstants.RESERVE_FORMNO);
|
||||
@@ -98,7 +93,7 @@ public class ReserveService {
|
||||
formDataOperator.insertFormData(loginName,getFormNo(),mainFormData,null);
|
||||
}
|
||||
|
||||
private List<FormWhereCondition> buildConditions(JSONObject params) {
|
||||
private List<FormWhereCondition> buildConditions(JSONObject params) {
|
||||
List<FormWhereCondition> conditions = new ArrayList<>();
|
||||
if(StringUtils.isNotBlank(params.getString("openId"))){
|
||||
conditions.add(FormWhereCondition.build().display("微信openId").value(params.getString("openId")));
|
||||
|
||||
@@ -7,26 +7,25 @@ import com.seeyon.apps.src_rent.constants.RentConstants;
|
||||
import com.seeyon.apps.src_rent.po.EsignApiHeader;
|
||||
import com.seeyon.apps.src_rent.po.EsignBaseResp;
|
||||
import com.seeyon.apps.src_rent.utils.HttpClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class EsignAuthService {
|
||||
|
||||
@Autowired
|
||||
private RentConfigProvider configProvider;
|
||||
private RentConfigProvider configProvider = (RentConfigProvider) AppContext.getBean("rentConfigProvider");
|
||||
private TokenCacheManager tokenCacheManager = (TokenCacheManager) AppContext.getBean("qcTokenCacheManager");
|
||||
|
||||
public void personAuth(Map<String,Object> authParams) throws Exception {
|
||||
public void personAuth(Map<String,Object> authParams,String appId) throws Exception {
|
||||
EsignApiHeader esignApiHeader = EsignApiHeader.build();
|
||||
String jsonBody = JsonUtils.toJSONString(authParams);
|
||||
esignApiHeader.appId(configProvider.getBizConfigByKey(RentConstants.APP_ID))
|
||||
esignApiHeader.appId(appId)
|
||||
.httpMethod("POST")
|
||||
.heads("")
|
||||
.pathAndParameters(EsignApiUrl.PERSON_AUTH_URL)
|
||||
.contentMD5(jsonBody)
|
||||
.signature(configProvider.getBizConfigByKey(RentConstants.APP_SECRET));
|
||||
.signature(tokenCacheManager.getSecretByAppId(appId));
|
||||
String url = configProvider.getBizConfigByKey(RentConstants.ESIGN_HOST) + EsignApiUrl.PERSON_AUTH_URL;
|
||||
String respStr = HttpClient.httpPostRaw(url, jsonBody, esignApiHeader.convert2Headers(), "UTF-8");
|
||||
EsignBaseResp esignBaseResp = JsonUtils.parseObject(respStr, EsignBaseResp.class);
|
||||
|
||||
@@ -8,20 +8,17 @@ import com.seeyon.apps.src_rent.po.EsignApiHeader;
|
||||
import com.seeyon.apps.src_rent.po.EsignBaseResp;
|
||||
import com.seeyon.apps.src_rent.utils.HttpClient;
|
||||
import com.seeyon.apps.src_rent.utils.JsonCleaner;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
|
||||
public class EsignByTemplateService {
|
||||
|
||||
@Autowired
|
||||
private RentConfigProvider configProvider;
|
||||
@Autowired
|
||||
private TokenCacheManager tokenCacheManager;
|
||||
private RentConfigProvider configProvider = (RentConfigProvider) AppContext.getBean("rentConfigProvider");
|
||||
private TokenCacheManager tokenCacheManager = (TokenCacheManager) AppContext.getBean("qcTokenCacheManager");
|
||||
private static final Log log = LogFactory.getLog(EsignByTemplateService.class);
|
||||
|
||||
public void signByTemplate(Map<String,Object> params) {
|
||||
@@ -38,10 +35,10 @@ public class EsignByTemplateService {
|
||||
}
|
||||
}
|
||||
|
||||
public String createBySignTemplate(Map<String,Object> params) throws Exception {
|
||||
public String createBySignTemplate(Map<String,Object> params,String appId) throws Exception {
|
||||
EsignApiHeader esignApiHeader = EsignApiHeader.build();
|
||||
String jsonBody = JsonCleaner.removeEmptyObjects(JsonUtils.toJSONString(params));
|
||||
esignApiHeader.token(tokenCacheManager.getToken()).appId(configProvider.getBizConfigByKey(RentConstants.APP_ID));
|
||||
esignApiHeader.token(tokenCacheManager.getToken(appId)).appId(appId);
|
||||
String url = configProvider.getBizConfigByKey(RentConstants.ESIGN_HOST) + EsignApiUrl.SIGN_BY_FILE_URL;
|
||||
log.info("合同发起入参: " + jsonBody);
|
||||
String respStr = HttpClient.httpPostRaw(url, jsonBody, esignApiHeader.convert2Headers(), "UTF-8");
|
||||
|
||||
@@ -9,9 +9,9 @@ import com.seeyon.apps.src_rent.utils.EsignHttpHelper;
|
||||
import com.seeyon.apps.src_rent.utils.EsignRequestType;
|
||||
import com.seeyon.apps.src_rent.utils.FileUtil;
|
||||
import com.seeyon.apps.src_rent.utils.HttpClient;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
@@ -22,19 +22,16 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class EsignByUploadFileService {
|
||||
|
||||
@Autowired
|
||||
private RentConfigProvider configProvider;
|
||||
@Autowired
|
||||
protected TokenCacheManager tokenCacheManager;
|
||||
private RentConfigProvider configProvider = (RentConfigProvider) AppContext.getBean("rentConfigProvider");
|
||||
protected TokenCacheManager tokenCacheManager = (TokenCacheManager) AppContext.getBean("qcTokenCacheManager");
|
||||
|
||||
|
||||
public Map<String,Object> getDownloadFileInfo(String flowId) throws Exception {
|
||||
public Map<String,Object> getDownloadFileInfo(String flowId,String appId) throws Exception {
|
||||
String reqPath = EsignApiUrl.CONTRACT_DOWNLOAD_URL.replace("{signFlowId}", flowId);
|
||||
String getDownloadUrl = configProvider.getBizConfigByKey(RentConstants.ESIGN_HOST) + reqPath;
|
||||
EsignApiHeader esignApiHeader = EsignApiHeader.build().appId(configProvider.getBizConfigByKey(RentConstants.APP_ID)).token(tokenCacheManager.getToken());
|
||||
EsignApiHeader esignApiHeader = EsignApiHeader.build().appId(appId).token(tokenCacheManager.getToken(appId));
|
||||
String respStr = HttpClient.httpGet(getDownloadUrl, esignApiHeader.convert2Headers(), null);
|
||||
EsignBaseResp esignBaseResp = JsonUtils.parseObject(respStr, EsignBaseResp.class);
|
||||
if(esignBaseResp.getCode() != 0 || esignBaseResp.getData() == null){
|
||||
@@ -49,11 +46,11 @@ public class EsignByUploadFileService {
|
||||
return fileInfo;
|
||||
}
|
||||
|
||||
public GetUploadUrlResp getUploadFileUrl(String fileName, String fileMd5, Long fileSize, boolean convert2Pdf) throws Exception {
|
||||
public GetUploadUrlResp getUploadFileUrl(String appId,String fileName, String fileMd5, Long fileSize, boolean convert2Pdf) throws Exception {
|
||||
String url = configProvider.getBizConfigByKey(RentConstants.ESIGN_HOST) + EsignApiUrl.GET_UPLOAD_FILE_URL;
|
||||
GetUploadUrlResp resp = new GetUploadUrlResp();
|
||||
EsignApiHeader esignApiHeader = EsignApiHeader.build().appId(configProvider.getBizConfigByKey(RentConstants.APP_ID));
|
||||
esignApiHeader.token(tokenCacheManager.getToken());
|
||||
EsignApiHeader esignApiHeader = EsignApiHeader.build().appId(appId);
|
||||
esignApiHeader.token(tokenCacheManager.getToken(appId));
|
||||
EsignFileUploadParams params = new EsignFileUploadParams();
|
||||
params.setFileName(fileName);
|
||||
params.setContentMd5(fileMd5);
|
||||
@@ -74,16 +71,29 @@ public class EsignByUploadFileService {
|
||||
}
|
||||
|
||||
|
||||
public List<Object> getSignPosition(String fileId) throws Exception {
|
||||
public List<Object> getSignPosition(String appId,String fileId) throws Exception {
|
||||
String reqPath = EsignApiUrl.SIGN_POSITION_URL.replace("{fileId}", fileId);
|
||||
String url = configProvider.getBizConfigByKey(RentConstants.ESIGN_HOST) + reqPath;
|
||||
EsignApiHeader esignApiHeader = EsignApiHeader.build().appId(configProvider.getBizConfigByKey(RentConstants.APP_ID));
|
||||
EsignApiHeader esignApiHeader = EsignApiHeader.build().appId(appId);
|
||||
List<String> keywords = new ArrayList<>();
|
||||
keywords.add("甲方盖章/签字");
|
||||
keywords.add("乙方盖章/签字");
|
||||
String aSignPosKeyword = configProvider.getBizConfigByKey(RentConstants.aSignPositionKeyword);
|
||||
String bSignPosKeyword = configProvider.getBizConfigByKey(RentConstants.bSignPositionKeyword);
|
||||
String lpSignPosKeyword = configProvider.getBizConfigByKey(RentConstants.lpSignPositionKeyword);
|
||||
if(StringUtils.isNotBlank(aSignPosKeyword)){
|
||||
keywords.add(aSignPosKeyword);
|
||||
}
|
||||
if(StringUtils.isNotBlank(bSignPosKeyword)){
|
||||
keywords.add(bSignPosKeyword);
|
||||
}
|
||||
if(StringUtils.isNotBlank(lpSignPosKeyword)) {
|
||||
keywords.add(lpSignPosKeyword);
|
||||
}
|
||||
Map<String,Object> params = new HashMap<>();
|
||||
if(keywords.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
params.put("keywords",keywords);
|
||||
esignApiHeader.token(tokenCacheManager.getToken());
|
||||
esignApiHeader.token(tokenCacheManager.getToken(appId));
|
||||
String respStr = HttpClient.httpPostRaw(url,JsonUtils.toJSONString(params),esignApiHeader.convert2Headers(),null);
|
||||
Map map = JsonUtils.parseObject(respStr, Map.class);
|
||||
Map<String,Object> data = (Map<String,Object>) map.get("data");
|
||||
@@ -95,7 +105,7 @@ public class EsignByUploadFileService {
|
||||
return resList;
|
||||
}
|
||||
|
||||
public String uploadFileToEsign(String refId) throws Exception {
|
||||
public String uploadFileToEsign(String appId,String refId) throws Exception {
|
||||
String tempDir = System.getProperty("java.io.tmpdir");
|
||||
File file = null;
|
||||
FileUtil fileUtil = new FileUtil();
|
||||
@@ -103,7 +113,7 @@ public class EsignByUploadFileService {
|
||||
List<String> paths = fileUtil.fieldFileDownload(Long.parseLong(refId), tempDir + File.separator + "oafile" + File.separator);
|
||||
file = new File(paths.get(0));
|
||||
String contentMD5 = EsignByUploadFileService.getFileContentMD5(paths.get(0));
|
||||
GetUploadUrlResp uploadResp = getUploadFileUrl(file.getName(), contentMD5, file.length(),true);
|
||||
GetUploadUrlResp uploadResp = getUploadFileUrl(appId,file.getName(), contentMD5, file.length(),true);
|
||||
uploadFile(uploadResp.getFileUploadUrl(), contentMD5, file.getName(), paths.get(0));
|
||||
return uploadResp.getFileId();
|
||||
}finally {
|
||||
|
||||
@@ -9,25 +9,20 @@ import com.seeyon.apps.src_rent.form.FormUpdateField;
|
||||
import com.seeyon.apps.src_rent.form.FormWhereCondition;
|
||||
import com.seeyon.apps.src_rent.utils.FileUtil;
|
||||
import com.seeyon.apps.src_rent.utils.ProtUtil;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
import com.seeyon.ctp.util.JDBCAgent;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Component
|
||||
public class EsignCallbackBizService {
|
||||
|
||||
private static final Log log = LogFactory.getLog(EsignCallbackBizService.class);
|
||||
@Autowired
|
||||
private ProtUtil protUtil;
|
||||
@Autowired
|
||||
private RentConfigProvider configProvider;
|
||||
private ProtUtil protUtil = (ProtUtil) AppContext.getBean("qcProtUtil");
|
||||
private RentConfigProvider configProvider = (RentConfigProvider) AppContext.getBean("rentConfigProvider");
|
||||
|
||||
public void handleSuccessSignCallbackBiz(String tablename,String updatefield,String statusField,String formId,String fileUrl,String fileName) throws Exception {
|
||||
String[] strings = formId.split("_");
|
||||
@@ -55,6 +50,26 @@ public class EsignCallbackBizService {
|
||||
formDataOperator.updateMasterForm(updateFields,tablename,conditions);
|
||||
}
|
||||
|
||||
public void handleExpiredSignCallbackBiz(String tableName,String statusField,String formId) throws Exception {
|
||||
String[] strings = formId.split("_");
|
||||
String oaFlowId = strings[0];
|
||||
String tempFormId = strings[1];
|
||||
String[] statusParams = statusField.split("_");
|
||||
String status = statusParams[0];
|
||||
String enumId = statusParams[1];
|
||||
String enumItemId = EnumMapUtils.getEnumItemValueByEnumId("已过期",Long.parseLong(enumId));
|
||||
FormDataOperator formDataOperator = new FormDataOperator();
|
||||
List<FormWhereCondition> conditions = new ArrayList<>();
|
||||
List<FormUpdateField> updateFields = new ArrayList<>();
|
||||
updateFields.add(FormUpdateField.build().fieldName(status).value(enumItemId));
|
||||
conditions.add(FormWhereCondition.build().value(tempFormId).fieldName("ID"));
|
||||
JSONObject params = new JSONObject();
|
||||
params.put("message", "签署失败: 合同已过最大签署期限未签署");
|
||||
params.put("returnCode", 2);
|
||||
protUtil.sendPostNotification(params.toString(), configProvider.getBizConfigByKey(RentConstants.nodeTokenUrl), oaFlowId);
|
||||
formDataOperator.updateMasterForm(updateFields,tableName,conditions);
|
||||
}
|
||||
|
||||
public void handleFailSignCallbackBiz(String tableName,String statusField,String formId,String failMsg) throws Exception {
|
||||
String[] strings = formId.split("_");
|
||||
String oaFlowId = strings[0];
|
||||
|
||||
@@ -9,40 +9,34 @@ import com.seeyon.apps.src_rent.po.EsignBaseResp;
|
||||
import com.seeyon.apps.src_rent.po.SignFile;
|
||||
import com.seeyon.apps.src_rent.po.TemplateComponent;
|
||||
import com.seeyon.apps.src_rent.utils.HttpClient;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@Component
|
||||
public class EsignFileTemplateService {
|
||||
|
||||
private static final String ORI_TEMPLATE = "原始合同模板文件";
|
||||
private static final Log log = LogFactory.getLog(EsignFileTemplateService.class);
|
||||
@Autowired
|
||||
private RentConfigProvider configProvider;
|
||||
@Autowired
|
||||
private TokenCacheManager tokenCacheManager;
|
||||
@Autowired
|
||||
private EsignByUploadFileService uploadFileService;
|
||||
private String orgId;
|
||||
private RentConfigProvider configProvider = (RentConfigProvider) AppContext.getBean("rentConfigProvider");
|
||||
private TokenCacheManager tokenCacheManager = (TokenCacheManager) AppContext.getBean("qcTokenCacheManager");
|
||||
private EsignByUploadFileService uploadFileService = (EsignByUploadFileService)AppContext.getBean("qcEsignByUploadFileService");
|
||||
|
||||
private void fillOrgId() {
|
||||
private String getOrgId(String appId) {
|
||||
EsignApiHeader esignApiHeader = EsignApiHeader.build();
|
||||
try {
|
||||
esignApiHeader.token(tokenCacheManager.getToken()).appId(configProvider.getBizConfigByKey(RentConstants.APP_ID));
|
||||
esignApiHeader.token(tokenCacheManager.getToken(appId)).appId(appId);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
//获取orgId
|
||||
String queryStr = EsignApiUrl.QUERY_ORGINFO + "?orgName=" + configProvider.getBizConfigByKey(RentConstants.UNITNAME);
|
||||
String queryStr = EsignApiUrl.QUERY_ORGINFO + "?orgName=" + tokenCacheManager.getOrgNameByAppId(appId);
|
||||
String reqUrl = configProvider.getBizConfigByKey(RentConstants.ESIGN_HOST) + queryStr;
|
||||
String orgInfoRespStr = HttpClient.httpGet(reqUrl, esignApiHeader.convert2Headers(), "UTF-8");
|
||||
EsignBaseResp orgInfoResp = JsonUtils.parseObject(orgInfoRespStr, EsignBaseResp.class);
|
||||
Map<String, Object> orgData = (Map<String, Object>) orgInfoResp.getData();
|
||||
orgId = (String) orgData.get("orgId");
|
||||
return (String) orgData.get("orgId");
|
||||
}
|
||||
|
||||
//填充模板
|
||||
@@ -81,19 +75,19 @@ public class EsignFileTemplateService {
|
||||
}
|
||||
|
||||
//获取模板详细信息
|
||||
public Map<String,Object> getTemplateDetail(String signTemplateId,String orgId) {
|
||||
public Map<String,Object> getTemplateDetail(String appId,String signTemplateId,String orgId) {
|
||||
String url = configProvider.getBizConfigByKey(RentConstants.ESIGN_HOST) + EsignApiUrl.QUERY_TEMPLATE_DETAIL_URL + "?" +"orgId=" + orgId + "&signTemplateId=" + signTemplateId;
|
||||
EsignApiHeader apiHeader = EsignApiHeader.build().token(tokenCacheManager.getToken()).appId(configProvider.getBizConfigByKey(RentConstants.APP_ID));
|
||||
EsignApiHeader apiHeader = EsignApiHeader.build().token(tokenCacheManager.getToken(appId)).appId(appId);
|
||||
String resp = HttpClient.httpGet(url, apiHeader.convert2Headers(), "UTF-8");
|
||||
EsignBaseResp esignBaseResp = JsonUtils.parseObject(resp, EsignBaseResp.class);
|
||||
Map<String,Object> data = (Map<String, Object>) esignBaseResp.getData();
|
||||
return data;
|
||||
}
|
||||
|
||||
public Map<String,Object> queryTemplates(Integer pageNo) throws Exception {
|
||||
EsignApiHeader esignApiHeader = EsignApiHeader.build().appId(configProvider.getBizConfigByKey(RentConstants.APP_ID));
|
||||
String queryStr = EsignApiUrl.QUERY_TEMPLATES_URL + "?" + "orgId=" + obtainOrgId() + "&pageNum=" + pageNo + "&pageSize=" + 20 + "&status=" + 1;
|
||||
esignApiHeader.token(tokenCacheManager.getToken());
|
||||
public Map<String,Object> queryTemplates(Integer pageNo,String appId) throws Exception {
|
||||
EsignApiHeader esignApiHeader = EsignApiHeader.build().appId(appId);
|
||||
String queryStr = EsignApiUrl.QUERY_TEMPLATES_URL + "?" + "orgId=" + obtainOrgId(appId) + "&pageNum=" + pageNo + "&pageSize=" + 20 + "&status=" + 1;
|
||||
esignApiHeader.token(tokenCacheManager.getToken(appId));
|
||||
String url = configProvider.getBizConfigByKey(RentConstants.ESIGN_HOST) + queryStr;
|
||||
String templateListRespStr = HttpClient.httpGet(url, esignApiHeader.convert2Headers(), "UTF-8");
|
||||
EsignBaseResp templateListResp = JsonUtils.parseObject(templateListRespStr, EsignBaseResp.class);
|
||||
@@ -106,16 +100,16 @@ public class EsignFileTemplateService {
|
||||
return pageMap;
|
||||
}
|
||||
|
||||
public String getCompareDetailUrl(String templateRefId,String contractRefId) throws Exception {
|
||||
String templateFileId = uploadFileService.uploadFileToEsign(templateRefId);
|
||||
String contractFileId = uploadFileService.uploadFileToEsign(contractRefId);
|
||||
public String getCompareDetailUrl(String appId,String templateRefId,String contractRefId) throws Exception {
|
||||
String templateFileId = uploadFileService.uploadFileToEsign(appId,templateRefId);
|
||||
String contractFileId = uploadFileService.uploadFileToEsign(appId,contractRefId);
|
||||
String url = configProvider.getBizConfigByKey(RentConstants.ESIGN_HOST) + EsignApiUrl.CONTRACT_COMPARE_GETURL;
|
||||
Map<String,String> params = new HashMap<>();
|
||||
params.put("standardFileId",templateFileId);
|
||||
params.put("comparativeFileId",contractFileId);
|
||||
String jsonString = JsonUtils.toJSONString(params);
|
||||
EsignApiHeader esignApiHeader = EsignApiHeader.build().appId(configProvider.getBizConfigByKey(RentConstants.APP_ID));
|
||||
esignApiHeader.token(tokenCacheManager.getToken());
|
||||
EsignApiHeader esignApiHeader = EsignApiHeader.build().appId(appId);
|
||||
esignApiHeader.token(tokenCacheManager.getToken(appId));
|
||||
String respStr = HttpClient.httpPostRaw(url, jsonString, esignApiHeader.convert2Headers(), null);
|
||||
EsignBaseResp esignBaseResp = JsonUtils.parseObject(respStr, EsignBaseResp.class);
|
||||
log.info("调用获取合同比对链接接口返回值: " + JsonUtils.toJSONString(esignBaseResp));
|
||||
@@ -124,10 +118,7 @@ public class EsignFileTemplateService {
|
||||
return contractCompareUrl;
|
||||
}
|
||||
|
||||
private String obtainOrgId() {
|
||||
if(orgId == null) {
|
||||
fillOrgId();
|
||||
}
|
||||
return orgId;
|
||||
private String obtainOrgId(String appId) {
|
||||
return getOrgId(appId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,18 +21,15 @@ import com.seeyon.v3x.services.form.bean.FormExport;
|
||||
import com.seeyon.v3x.services.form.bean.ValueExport;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@Component
|
||||
public class SealService {
|
||||
|
||||
private static final Log log = LogFactory.getLog(SealService.class);
|
||||
@Autowired
|
||||
private RentConfigProvider configProvider;
|
||||
private RentConfigProvider configProvider = (RentConfigProvider) AppContext.getBean("rentConfigProvider");
|
||||
private FormFactory formFactory;
|
||||
private TokenCacheManager tokenCacheManager = (TokenCacheManager) AppContext.getBean("qcTokenCacheManager");
|
||||
|
||||
public FormFactory getFormFactory() {
|
||||
if (formFactory == null) {
|
||||
@@ -41,9 +38,9 @@ public class SealService {
|
||||
return formFactory;
|
||||
}
|
||||
|
||||
public void grantSeal(Map<String, Object> params) throws Exception {
|
||||
public void grantSeal(String appId,Map<String, Object> params) throws Exception {
|
||||
JsonObject reqParams = new JsonObject();
|
||||
String sealId = getSealId((String) params.get("orgId"), (String) params.get("sealName"));
|
||||
String sealId = getSealId(appId,(String) params.get("orgId"), (String) params.get("sealName"));
|
||||
reqParams.put("sealId", sealId);
|
||||
List<String> authorizedPsnIds = new ArrayList<>();
|
||||
authorizedPsnIds.add((String) params.get("accountId"));
|
||||
@@ -56,27 +53,27 @@ public class SealService {
|
||||
sealAuthScope.put("templateIds", templateIds);
|
||||
reqParams.put("sealAuthScope", sealAuthScope);
|
||||
EsignApiHeader esignApiHeader = EsignApiHeader.build();
|
||||
esignApiHeader.appId(configProvider.getBizConfigByKey(RentConstants.APP_ID))
|
||||
esignApiHeader.appId(appId)
|
||||
.httpMethod("POST")
|
||||
.heads("")
|
||||
.pathAndParameters(EsignApiUrl.SEAL_GRANT_URL)
|
||||
.contentMD5(reqParams.toString())
|
||||
.signature(configProvider.getBizConfigByKey(RentConstants.APP_SECRET));
|
||||
.signature(tokenCacheManager.getSecretByAppId(appId));
|
||||
String url = configProvider.getBizConfigByKey(RentConstants.ESIGN_HOST) + EsignApiUrl.SEAL_GRANT_URL;
|
||||
HttpClient.httpPostRaw(url, reqParams.toString(), esignApiHeader.convert2Headers(), null);
|
||||
}
|
||||
|
||||
private String getSealId(String orgId, String sealName) throws Exception {
|
||||
private String getSealId(String appId,String orgId, String sealName) throws Exception {
|
||||
String host = configProvider.getBizConfigByKey(RentConstants.ESIGN_HOST);
|
||||
int pageNo = 1;
|
||||
int pageSize = 20;
|
||||
EsignApiHeader esignApiHeader = EsignApiHeader.build();
|
||||
esignApiHeader.appId(configProvider.getBizConfigByKey(RentConstants.APP_ID))
|
||||
esignApiHeader.appId(appId)
|
||||
.httpMethod("GET")
|
||||
.heads("")
|
||||
.pathAndParameters(EsignApiUrl.SEAL_QUERY_URL + "?" + HttpClient.sortQueryString("orgId=" + orgId + "&pageNo=" + pageNo + "&pageSize=" + pageSize))
|
||||
.contentMD5("")
|
||||
.signature(configProvider.getBizConfigByKey(RentConstants.APP_SECRET));
|
||||
.signature(tokenCacheManager.getSecretByAppId(appId));
|
||||
String url = host + EsignApiUrl.SEAL_QUERY_URL + "?orgId=" + orgId + "&pageNo=" + pageNo + "&pageSize=" + pageSize;
|
||||
String respStr = HttpClient.httpGet(url, esignApiHeader.convert2Headers(), "UTF-8");
|
||||
EsignBaseResp esignBaseResp = JsonUtils.parseObject(respStr, EsignBaseResp.class);
|
||||
|
||||
@@ -9,11 +9,11 @@ import com.seeyon.apps.src_rent.po.EsignApiHeader;
|
||||
import com.seeyon.apps.src_rent.po.EsignBaseResp;
|
||||
import com.seeyon.apps.src_rent.utils.HttpClient;
|
||||
import com.seeyon.cap4.form.bean.FormDataMasterBean;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
import com.seeyon.ctp.util.JDBCAgent;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import www.seeyon.com.utils.UUIDUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -21,16 +21,13 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class SignLinkService {
|
||||
|
||||
private static final Log log = LogFactory.getLog(SignLinkService.class);
|
||||
@Autowired
|
||||
private RentConfigProvider configProvider;
|
||||
@Autowired
|
||||
private TokenCacheManager tokenCacheManager;
|
||||
private RentConfigProvider configProvider = (RentConfigProvider) AppContext.getBean("rentConfigProvider");
|
||||
private TokenCacheManager tokenCacheManager = (TokenCacheManager) AppContext.getBean("qcTokenCacheManager");
|
||||
|
||||
public void saveGetLinkParam(FormDataVo formDataVo, FormDataMasterBean formDataMasterBean,String eFlowId) {
|
||||
public void saveGetLinkParam(String appId,FormDataVo formDataVo, FormDataMasterBean formDataMasterBean,String eFlowId) {
|
||||
try {
|
||||
String bSignerType = formDataVo.getFieldData("乙方签署类型").getStringValue();
|
||||
String psnAccount = null;
|
||||
@@ -47,7 +44,7 @@ public class SignLinkService {
|
||||
param.put("signFlowId",eFlowId);
|
||||
param.put("operator",operator);
|
||||
String paramStr = JsonUtils.toJSONString(param);
|
||||
saveDb(paramStr,eFlowId,contractNo);
|
||||
saveDb(paramStr,eFlowId,appId,contractNo);
|
||||
}catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
}
|
||||
@@ -68,8 +65,8 @@ public class SignLinkService {
|
||||
}
|
||||
}
|
||||
|
||||
private void saveDb(String jsonStr,String eFlowId,String contractNo) {
|
||||
String sqlInsert = "insert into SIGN_LINK_PARAM (id,param,eFlowId,contractNo) values (?,?,?,?)";
|
||||
private void saveDb(String jsonStr,String eFlowId,String appId,String contractNo) {
|
||||
String sqlInsert = "insert into SIGN_LINK_PARAM (id,param,eFlowId,contractNo,appId) values (?,?,?,?,?)";
|
||||
String sqlQuery = "select * FROM SIGN_LINK_PARAM where contractNo = ?";
|
||||
String sqlUpdate = "update SIGN_LINK_PARAM set param = ?,eFlowId = ? where id = ?";
|
||||
JDBCAgent jdbcAgent = new JDBCAgent();
|
||||
@@ -86,6 +83,7 @@ public class SignLinkService {
|
||||
param.add(jsonStr);
|
||||
param.add(eFlowId);
|
||||
param.add(contractNo);
|
||||
param.add(appId);
|
||||
jdbcAgent.execute(sqlInsert,param);
|
||||
}else {
|
||||
param.clear();
|
||||
@@ -113,12 +111,13 @@ public class SignLinkService {
|
||||
if(list.size() > 0) {
|
||||
Map<String,Object> tempMap = (Map<String, Object>) list.get(0);
|
||||
String paramStr = (String)tempMap.get("param");
|
||||
if(!checkContractVaild(eFlowId)) {
|
||||
String appId = (String)tempMap.get("appid");
|
||||
if(!checkContractVaild(eFlowId,appId)) {
|
||||
throw new RuntimeException("当前合同无效");
|
||||
}
|
||||
String url = configProvider.getBizConfigByKey(RentConstants.ESIGN_HOST) + EsignApiUrl.SIGN_LINK_GET_URL.replace("{signFlowId}",eFlowId);
|
||||
EsignApiHeader esignApiHeader = EsignApiHeader.build();
|
||||
esignApiHeader.token(tokenCacheManager.getToken()).appId(configProvider.getBizConfigByKey(RentConstants.APP_ID));
|
||||
esignApiHeader.token(tokenCacheManager.getToken(appId)).appId(appId);
|
||||
String respStr = HttpClient.httpPostRaw(url, paramStr,esignApiHeader.convert2Headers(), "UTF-8");
|
||||
EsignBaseResp esignBaseResp = JsonUtils.parseObject(respStr, EsignBaseResp.class);
|
||||
Map<String,Object> dataMap = (Map<String, Object>) esignBaseResp.getData();
|
||||
@@ -137,9 +136,9 @@ public class SignLinkService {
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean checkContractVaild(String eFlowId) {
|
||||
private boolean checkContractVaild(String eFlowId,String appId) {
|
||||
EsignApiHeader esignApiHeader = EsignApiHeader.build();
|
||||
esignApiHeader.token(tokenCacheManager.getToken()).appId(configProvider.getBizConfigByKey(RentConstants.APP_ID));
|
||||
esignApiHeader.token(tokenCacheManager.getToken(appId)).appId(appId);
|
||||
String url = configProvider.getBizConfigByKey(RentConstants.ESIGN_HOST) + EsignApiUrl.SIGN_FLOW_QUERY.replace("{signFlowId}",eFlowId);
|
||||
String respStr = HttpClient.httpGet(url, esignApiHeader.convert2Headers(), "UTF-8");
|
||||
EsignBaseResp esignBaseResp = JsonUtils.parseObject(respStr, EsignBaseResp.class);
|
||||
|
||||
@@ -8,39 +8,31 @@ import com.seeyon.apps.src_rent.po.EsignApiHeader;
|
||||
import com.seeyon.apps.src_rent.po.EsignBaseResp;
|
||||
import com.seeyon.apps.src_rent.po.EsignToken;
|
||||
import com.seeyon.apps.src_rent.utils.HttpClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
public class TokenCacheManager {
|
||||
|
||||
@Autowired
|
||||
private RentConfigProvider configProvider;
|
||||
private final AtomicReference<EsignToken> tokenRef = new AtomicReference<>();
|
||||
private RentConfigProvider configProvider = (RentConfigProvider) AppContext.getBean("rentConfigProvider");
|
||||
private final ConcurrentHashMap<String, EsignToken> tokenRef = new ConcurrentHashMap<>();
|
||||
private final ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor();
|
||||
private static final long CHECK_INTERVAL = 2 * 60 * 60 * 1000; // 120分钟检查一次
|
||||
|
||||
public TokenCacheManager() {
|
||||
// 启动定期检查任务
|
||||
scheduler.scheduleAtFixedRate(this::checkTokenExpiry,
|
||||
CHECK_INTERVAL, CHECK_INTERVAL, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
private boolean checkExpired(String token) {
|
||||
private boolean checkExpired(String token,String appId) {
|
||||
EsignApiHeader esignApiHeader = EsignApiHeader.build();
|
||||
try {
|
||||
esignApiHeader.token(token).appId(configProvider.getBizConfigByKey(RentConstants.APP_ID));
|
||||
esignApiHeader.token(token).appId(appId);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
//获取orgId
|
||||
String queryStr = EsignApiUrl.QUERY_ORGINFO + "?orgName=" + configProvider.getBizConfigByKey(RentConstants.UNITNAME);
|
||||
String queryStr = EsignApiUrl.QUERY_ORGINFO + "?orgName=" + getOrgNameByAppId(appId);
|
||||
String reqUrl = configProvider.getBizConfigByKey(RentConstants.ESIGN_HOST) + queryStr;
|
||||
String orgInfoRespStr = HttpClient.httpGet(reqUrl, esignApiHeader.convert2Headers(), "UTF-8");
|
||||
EsignBaseResp orgInfoResp = JsonUtils.parseObject(orgInfoRespStr, EsignBaseResp.class);
|
||||
@@ -49,35 +41,35 @@ public class TokenCacheManager {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getToken() {
|
||||
EsignToken current = tokenRef.get();
|
||||
if (current != null && !checkExpired(current.getTokenStr())) {
|
||||
|
||||
public String getToken(String appId) {
|
||||
EsignToken current = tokenRef.get(appId);
|
||||
if (current != null && !checkExpired(current.getTokenStr(),appId)) {
|
||||
return current.getTokenStr();
|
||||
}
|
||||
return refreshToken();
|
||||
return refreshToken(appId);
|
||||
}
|
||||
|
||||
private String refreshToken() {
|
||||
EsignToken newToken = fetchNewToken();
|
||||
tokenRef.set(newToken);
|
||||
|
||||
private String refreshToken(String appId) {
|
||||
EsignToken newToken = fetchNewToken(appId);
|
||||
tokenRef.put(appId,newToken);
|
||||
return newToken.getTokenStr();
|
||||
}
|
||||
|
||||
private void checkTokenExpiry() {
|
||||
EsignToken current = tokenRef.get();
|
||||
|
||||
private void checkTokenExpiry(String appId) {
|
||||
EsignToken current = tokenRef.get(appId);
|
||||
if (current != null && isTokenExpired(current)) {
|
||||
refreshToken();
|
||||
refreshToken(appId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private boolean isTokenExpired(EsignToken token) {
|
||||
return System.currentTimeMillis() >= token.getTtl();
|
||||
}
|
||||
|
||||
private EsignToken fetchNewToken() {
|
||||
|
||||
private EsignToken fetchNewToken(String appId) {
|
||||
// 实际获取token的逻辑
|
||||
String queryStr = "?appId=" + configProvider.getBizConfigByKey(RentConstants.APP_ID) + "&secret=" + configProvider.getBizConfigByKey(RentConstants.APP_SECRET) + "&grantType=client_credentials";
|
||||
String queryStr = "?appId=" + appId + "&secret=" + getSecretByAppId(appId) + "&grantType=client_credentials";
|
||||
String url = configProvider.getBizConfigByKey(RentConstants.ESIGN_HOST) + EsignApiUrl.TOKEN_GET_URL + queryStr;
|
||||
String respStr = HttpClient.httpGet(url, null, null);
|
||||
EsignBaseResp esignBaseResp = JsonUtils.parseObject(respStr, EsignBaseResp.class);
|
||||
@@ -94,8 +86,37 @@ public class TokenCacheManager {
|
||||
esignToken.setRefreshToken(refreshToken);
|
||||
return esignToken;
|
||||
}
|
||||
|
||||
|
||||
public void shutdown() {
|
||||
scheduler.shutdown();
|
||||
}
|
||||
|
||||
public String getOrgNameByAppId(String appId) {
|
||||
String configMap = configProvider.getBizConfigByKey(RentConstants.ESIGN_APP_UNITMAP);
|
||||
Map<String,String> map = JsonUtils.parseObject(configMap, Map.class);
|
||||
return map.get(appId);
|
||||
}
|
||||
|
||||
public String getSecretByAppId(String appId) {
|
||||
String configMap = configProvider.getBizConfigByKey(RentConstants.ESIGN_APP_SECRETMAP);
|
||||
Map<String,String> map = JsonUtils.parseObject(configMap, Map.class);
|
||||
return map.get(appId);
|
||||
}
|
||||
|
||||
public String getAppIdByOrgName(String orgName) {
|
||||
String configMap = configProvider.getBizConfigByKey(RentConstants.ESIGN_APP_UNITMAP);
|
||||
Map<String,String> map = JsonUtils.parseObject(configMap, Map.class);
|
||||
for (String key : map.keySet()) {
|
||||
if(map.get(key).equals(orgName)) {
|
||||
return key;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<String> getAppIds() {
|
||||
String configMap = configProvider.getBizConfigByKey(RentConstants.ESIGN_APP_SECRETMAP);
|
||||
Map<String,String> map = JsonUtils.parseObject(configMap, Map.class);
|
||||
return map.keySet().stream().collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
package com.seeyon.apps.src_rent.service;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
|
||||
public class WeAppContractSyncService {
|
||||
|
||||
public void syncContract() {
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.seeyon.aicloud.common.JsonUtils;
|
||||
import com.seeyon.apps.src_rent.config.RentConfigProvider;
|
||||
import com.seeyon.apps.src_rent.constants.RentConstants;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
import org.apache.commons.httpclient.HttpStatus;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
@@ -20,12 +21,11 @@ import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
|
||||
public class ProtUtil {
|
||||
|
||||
private static final Log log = LogFactory.getLog(ProtUtil.class);
|
||||
@Autowired
|
||||
private RentConfigProvider configProvider;
|
||||
private RentConfigProvider configProvider = (RentConfigProvider) AppContext.getBean("rentConfigProvider");
|
||||
|
||||
public String getPluginId() {return RentConstants.getPluginId();}
|
||||
/**
|
||||
|
||||
@@ -4,10 +4,8 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.seeyon.apps.src_rent.assets.AssetsService;
|
||||
import com.seeyon.apps.src_rent.config.RentConfigProvider;
|
||||
import com.seeyon.apps.src_rent.constants.RentConstants;
|
||||
import com.seeyon.apps.src_rent.form.EnumMapUtils;
|
||||
import com.seeyon.apps.src_rent.form.FormDataOperator;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
@@ -16,15 +14,11 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
@Component
|
||||
public class ViewRecordService {
|
||||
|
||||
@Autowired
|
||||
private RentConfigProvider configProvider;
|
||||
@Autowired
|
||||
private FormDataOperator formDataOperator;
|
||||
@Autowired
|
||||
private AssetsService assetsService;
|
||||
private RentConfigProvider configProvider = (RentConfigProvider) AppContext.getBean("rentConfigProvider");
|
||||
private FormDataOperator formDataOperator = (FormDataOperator) AppContext.getBean("qcFormDataOperator");
|
||||
private AssetsService assetsService = (AssetsService) AppContext.getBean("qcAssetsService");
|
||||
|
||||
private String getFormNo() {
|
||||
return configProvider.getBizConfigByKey(RentConstants.VIEWRECORD_FORMNO);
|
||||
@@ -35,7 +29,7 @@ public class ViewRecordService {
|
||||
Map<String,Object> mainFormData = new HashMap<>();
|
||||
mainFormData.put("资产编号", params.getString("assetsNo"));
|
||||
mainFormData.put("资产名称", params.getString("assetsName"));
|
||||
mainFormData.put("浏览人手机号", params.getString("appointeePhone"));
|
||||
mainFormData.put("浏览人手机号", params.getString("phone"));
|
||||
String docNo = "weChat_" + UUID.randomUUID().toString().replace("-","");
|
||||
mainFormData.put("档案编号",docNo);
|
||||
mainFormData.put("浏览时间",df.format(new Date()));
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
package com.seeyon.ctp.rest.resources;
|
||||
package com.seeyon.ctp.rest.resources.rent;
|
||||
|
||||
import cn.hutool.log.Log;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.seeyon.apps.src_rent.assets.AssetsService;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
import com.seeyon.ctp.rest.resources.BaseResource;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.Response;
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -18,10 +16,10 @@ import java.io.IOException;
|
||||
*/
|
||||
@Path("/assets")
|
||||
@Produces({"application/json", "application/xml"})
|
||||
public class AssetsQueryResource extends BaseResource{
|
||||
public class AssetsQueryResource extends BaseResource {
|
||||
|
||||
private static final Log log = Log.get(AssetsQueryResource.class);
|
||||
private AssetsService assetsService = (AssetsService) AppContext.getBean("assetsService");
|
||||
private AssetsService assetsService = (AssetsService) AppContext.getBean("qcAssetsService");
|
||||
|
||||
@POST
|
||||
@Path("/queryPage")
|
||||
@@ -51,4 +49,27 @@ public class AssetsQueryResource extends BaseResource{
|
||||
}
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/getBizZones")
|
||||
@Produces({"application/json"})
|
||||
public Response getBizZones() throws IOException {
|
||||
try{
|
||||
return success(assetsService.getAllBizZones());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
return fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/getFeatures")
|
||||
@Produces({"application/json"})
|
||||
public Response getFeatures() throws IOException {
|
||||
try{
|
||||
return success(assetsService.getFeatures());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
return fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,20 @@
|
||||
package com.seeyon.ctp.rest.resources;
|
||||
package com.seeyon.ctp.rest.resources.rent;
|
||||
|
||||
import cn.hutool.log.Log;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.seeyon.apps.src_rent.bill.BillService;
|
||||
import com.seeyon.apps.src_rent.bill.FeeRecordService;
|
||||
import com.seeyon.apps.src_rent.bill.MarginBillService;
|
||||
import com.seeyon.apps.src_rent.bill.WaeBillService;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
import com.seeyon.ctp.rest.resources.BaseResource;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.Response;
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
@@ -20,12 +22,13 @@ import java.io.IOException;
|
||||
*/
|
||||
@Path("/bill")
|
||||
@Produces({"application/json", "application/xml"})
|
||||
public class BillResource extends BaseResource{
|
||||
public class BillResource extends BaseResource {
|
||||
|
||||
private static final Log log = Log.get(BillResource.class);
|
||||
private BillService billService = (BillService) AppContext.getBean("billService");
|
||||
private WaeBillService waeBillService = (WaeBillService) AppContext.getBean("waeBillService");
|
||||
private FeeRecordService feeRecordService = (FeeRecordService) AppContext.getBean("feeRecordService");
|
||||
private BillService billService = (BillService) AppContext.getBean("qcBillService");
|
||||
private WaeBillService waeBillService = (WaeBillService) AppContext.getBean("qcWaeBillService");
|
||||
private FeeRecordService feeRecordService = (FeeRecordService) AppContext.getBean("qcFeeRecordService");
|
||||
private MarginBillService marginBillService = (MarginBillService) AppContext.getBean("qcMarginBillService");
|
||||
|
||||
@POST
|
||||
@Path("/contractBill/queryPage")
|
||||
@@ -40,6 +43,21 @@ public class BillResource extends BaseResource{
|
||||
return fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/unpaidMargin/queryPage")
|
||||
@Produces({"application/json"})
|
||||
@Consumes({"application/json"})
|
||||
public Response cunpaidMarginQueryPage(JSONObject params) throws IOException {
|
||||
log.info("分页查询保证金账单信息参数为:"+params);
|
||||
try{
|
||||
return success(marginBillService.pageQuery(params));
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
return fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/payRecord/queryPage")
|
||||
@Produces({"application/json"})
|
||||
@@ -73,9 +91,13 @@ public class BillResource extends BaseResource{
|
||||
@Produces({"application/json"})
|
||||
@Consumes({"application/json"})
|
||||
public Response onlinePayCallback(JSONObject params) throws IOException {
|
||||
log.info("支付回调信息参数为:"+params);
|
||||
String billNo = params.getString("billNo");
|
||||
String bizType = params.getString("bizType");
|
||||
String payDate = params.getString("payDate");
|
||||
log.info("支付回调信息参数为:"+ billNo +"," + bizType + "," + payDate);
|
||||
try{
|
||||
return success(waeBillService.pageQueryWaeBill(params));
|
||||
feeRecordService.payCallBack(billNo,bizType,payDate);
|
||||
return this.success("回调处理成功");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
return fail(e.getMessage());
|
||||
@@ -97,6 +119,21 @@ public class BillResource extends BaseResource{
|
||||
}
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/countUnpay/margin")
|
||||
@Produces({"application/json"})
|
||||
@Consumes({"application/json"})
|
||||
public Response countUnpaidRentMargin(JSONObject params) throws IOException {
|
||||
log.info("统计待缴保证金账单数量:" + params, new Object[0]);
|
||||
|
||||
try {
|
||||
return this.success(marginBillService.countUnpay(params));
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), new Object[]{e});
|
||||
return this.fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/countUnpay/wae")
|
||||
@Produces({"application/json"})
|
||||
@@ -112,4 +149,25 @@ public class BillResource extends BaseResource{
|
||||
}
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/payreceiver")
|
||||
@Produces({"application/json"})
|
||||
@Consumes({"application/json"})
|
||||
public Response getBillPayReceiver(JSONObject params) throws IOException {
|
||||
log.info("获取账单收款方的参数:" + params, new Object[0]);
|
||||
try {
|
||||
String bizType = params.getString("bizType");
|
||||
if("rent".equals(bizType)){
|
||||
return this.success(billService.getBillPayReceiver(params.getString("billNo")));
|
||||
}else if("wae".equals(bizType)){
|
||||
return this.success(waeBillService.getBillPayReceiver(params.getString("billNo")));
|
||||
}else {
|
||||
return this.success(marginBillService.getBillPayReceiver(params.getString("billNo")));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), new Object[]{e});
|
||||
return this.fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,17 +1,16 @@
|
||||
package com.seeyon.ctp.rest.resources;
|
||||
package com.seeyon.ctp.rest.resources.rent;
|
||||
|
||||
import cn.hutool.log.Log;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.seeyon.apps.src_rent.assets.AssetsService;
|
||||
import com.seeyon.apps.src_rent.contract.ContractService;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
import com.seeyon.ctp.rest.resources.BaseResource;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.Response;
|
||||
import java.io.IOException;
|
||||
import java.net.URLDecoder;
|
||||
|
||||
|
||||
/**
|
||||
@@ -19,10 +18,10 @@ import java.net.URLDecoder;
|
||||
*/
|
||||
@Path("/contract")
|
||||
@Produces({"application/json", "application/xml"})
|
||||
public class ContractResource extends BaseResource{
|
||||
public class ContractResource extends BaseResource {
|
||||
|
||||
private static final Log log = Log.get(ContractResource.class);
|
||||
private ContractService contractService = (ContractService) AppContext.getBean("contractService");
|
||||
private ContractService contractService = (ContractService) AppContext.getBean("qcContractService");
|
||||
|
||||
@POST
|
||||
@Path("/queryPage")
|
||||
@@ -1,10 +1,11 @@
|
||||
package com.seeyon.ctp.rest.resources;
|
||||
package com.seeyon.ctp.rest.resources.rent;
|
||||
|
||||
import cn.hutool.log.Log;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.seeyon.apps.src_rent.cus.Customer;
|
||||
import com.seeyon.apps.src_rent.cus.CustomerService;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
import com.seeyon.ctp.rest.resources.BaseResource;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.POST;
|
||||
@@ -18,10 +19,10 @@ import java.io.IOException;
|
||||
*/
|
||||
@Path("/cus")
|
||||
@Produces({"application/json", "application/xml"})
|
||||
public class CustomerMatchResource extends BaseResource{
|
||||
public class CustomerMatchResource extends BaseResource {
|
||||
|
||||
private static final Log log = Log.get(CustomerMatchResource.class);
|
||||
private CustomerService customerService = (CustomerService) AppContext.getBean("customerService");
|
||||
private CustomerService customerService = (CustomerService) AppContext.getBean("qcCustomerService");
|
||||
|
||||
@POST
|
||||
@Path("/matchPerson")
|
||||
@@ -31,7 +32,7 @@ public class CustomerMatchResource extends BaseResource{
|
||||
try{
|
||||
log.info("匹配个人客商参数为:" + params);
|
||||
Customer customer = new Customer();
|
||||
customer.setCusPhone(params.getString("phone"));
|
||||
customer.setCardNo(params.getString("cardNo"));
|
||||
String cusNo = customerService.matchCusPerson(customer);
|
||||
return success(cusNo);
|
||||
} catch (Exception e) {
|
||||
@@ -46,6 +47,7 @@ public class CustomerMatchResource extends BaseResource{
|
||||
@Consumes({"application/json"})
|
||||
public Response matchOrg(JSONObject params) throws IOException {
|
||||
try{
|
||||
log.info("匹配单位客商参数为:" + params);
|
||||
Customer customer = new Customer();
|
||||
customer.setOrgNo(params.getString("orgNo"));
|
||||
return success(customerService.matchCusOrg(customer));
|
||||
@@ -1,9 +1,10 @@
|
||||
package com.seeyon.ctp.rest.resources;
|
||||
package com.seeyon.ctp.rest.resources.rent;
|
||||
|
||||
import cn.hutool.log.Log;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.seeyon.apps.src_rent.discharge.DisCharegeService;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
import com.seeyon.ctp.rest.resources.BaseResource;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.POST;
|
||||
@@ -18,10 +19,10 @@ import java.io.IOException;
|
||||
*/
|
||||
@Path("/discharge")
|
||||
@Produces({"application/json", "application/xml"})
|
||||
public class DisChargeResource extends BaseResource{
|
||||
public class DisChargeResource extends BaseResource {
|
||||
|
||||
private static final Log log = Log.get(DisChargeResource.class);
|
||||
private DisCharegeService disCharegeService = (DisCharegeService) AppContext.getBean("disCharegeService");
|
||||
private DisCharegeService disCharegeService = (DisCharegeService) AppContext.getBean("qcDisCharegeService");
|
||||
|
||||
@POST
|
||||
@Path("/queryPage")
|
||||
@@ -1,9 +1,10 @@
|
||||
package com.seeyon.ctp.rest.resources;
|
||||
package com.seeyon.ctp.rest.resources.rent;
|
||||
|
||||
import cn.hutool.log.Log;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.seeyon.apps.src_rent.fallback.FallbackService;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
import com.seeyon.ctp.rest.resources.BaseResource;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.POST;
|
||||
@@ -18,10 +19,10 @@ import java.io.IOException;
|
||||
*/
|
||||
@Path("/fallback")
|
||||
@Produces({"application/json", "application/xml"})
|
||||
public class FallbackResource extends BaseResource{
|
||||
public class FallbackResource extends BaseResource {
|
||||
|
||||
private static final Log log = Log.get(FallbackResource.class);
|
||||
private FallbackService fallbackService = (FallbackService) AppContext.getBean("fallbackService");
|
||||
private FallbackService fallbackService = (FallbackService) AppContext.getBean("qcFallbackService");
|
||||
|
||||
@POST
|
||||
@Path("/queryPage")
|
||||
@@ -1,8 +1,9 @@
|
||||
package com.seeyon.ctp.rest.resources;
|
||||
package com.seeyon.ctp.rest.resources.rent;
|
||||
|
||||
import cn.hutool.log.Log;
|
||||
import com.seeyon.apps.src_rent.file.FileHandlerService;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
import com.seeyon.ctp.rest.resources.BaseResource;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -14,10 +15,10 @@ import javax.ws.rs.core.Context;
|
||||
* 提供给外部下载OA文件
|
||||
*/
|
||||
@Path("/fileTransport")
|
||||
public class FileTransportResource extends BaseResource{
|
||||
public class FileTransportResource extends BaseResource {
|
||||
|
||||
private static final Log log = Log.get(FileTransportResource.class);
|
||||
private FileHandlerService fileHandlerService = (FileHandlerService) AppContext.getBean("fileHandlerService");
|
||||
private FileHandlerService fileHandlerService = (FileHandlerService) AppContext.getBean("qcFileHandlerService");
|
||||
|
||||
@GET
|
||||
@Path("/downloadFile")
|
||||
@@ -1,15 +1,12 @@
|
||||
package com.seeyon.ctp.rest.resources;
|
||||
package com.seeyon.ctp.rest.resources.rent;
|
||||
|
||||
import cn.hutool.log.Log;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.seeyon.apps.src_rent.file.FileHandlerService;
|
||||
import com.seeyon.apps.src_rent.notice.NoticeService;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
import com.seeyon.ctp.rest.resources.BaseResource;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.Response;
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -17,10 +14,10 @@ import java.io.IOException;
|
||||
* 招商公告
|
||||
*/
|
||||
@Path("/notice")
|
||||
public class NoticeResource extends BaseResource{
|
||||
public class NoticeResource extends BaseResource {
|
||||
|
||||
private static final Log log = Log.get(NoticeResource.class);
|
||||
private NoticeService noticeService = (NoticeService) AppContext.getBean("noticeService");
|
||||
private NoticeService noticeService = (NoticeService) AppContext.getBean("qcNoticeService");
|
||||
|
||||
@POST
|
||||
@Path("/queryPage")
|
||||
@@ -1,9 +1,10 @@
|
||||
package com.seeyon.ctp.rest.resources;
|
||||
package com.seeyon.ctp.rest.resources.rent;
|
||||
|
||||
import cn.hutool.log.Log;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.seeyon.apps.src_rent.reserve.ReserveService;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
import com.seeyon.ctp.rest.resources.BaseResource;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.POST;
|
||||
@@ -18,10 +19,10 @@ import java.io.IOException;
|
||||
*/
|
||||
@Path("/reserve")
|
||||
@Produces({"application/json", "application/xml"})
|
||||
public class ReserveResource extends BaseResource{
|
||||
public class ReserveResource extends BaseResource {
|
||||
|
||||
private static final Log log = Log.get(ReserveResource.class);
|
||||
private ReserveService reserveService = (ReserveService) AppContext.getBean("reserveService");
|
||||
private ReserveService reserveService = (ReserveService) AppContext.getBean("qcReserveService");
|
||||
|
||||
@POST
|
||||
@Path("/queryPage")
|
||||
@@ -1,9 +1,10 @@
|
||||
package com.seeyon.ctp.rest.resources;
|
||||
package com.seeyon.ctp.rest.resources.rent;
|
||||
|
||||
import cn.hutool.log.Log;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.seeyon.apps.src_rent.viewrecord.ViewRecordService;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
import com.seeyon.ctp.rest.resources.BaseResource;
|
||||
|
||||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.Response;
|
||||
@@ -13,10 +14,10 @@ import java.io.IOException;
|
||||
* 记录微信小程序租户浏览资产记录
|
||||
*/
|
||||
@Path("/potential")
|
||||
public class ViewRecordResource extends BaseResource{
|
||||
public class ViewRecordResource extends BaseResource {
|
||||
|
||||
private static final Log log = Log.get(ViewRecordResource.class);
|
||||
private ViewRecordService viewRecordService = (ViewRecordService) AppContext.getBean("viewRecordService");
|
||||
private ViewRecordService viewRecordService = (ViewRecordService) AppContext.getBean("qcViewRecordService");
|
||||
|
||||
@POST
|
||||
@Path("/add")
|
||||
@@ -1,5 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans>
|
||||
<bean>
|
||||
<id>/assetsmap.do</id>
|
||||
<methods>
|
||||
<method>index</method>
|
||||
</methods>
|
||||
</bean>
|
||||
<bean>
|
||||
<id>/esigncallback.do</id>
|
||||
<methods>
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<beans>
|
||||
|
||||
<bean>
|
||||
<id>/assetsmap.do</id>
|
||||
<name>com.seeyon.apps.src_rent.controller.AssetsMapController</name>
|
||||
<methods>
|
||||
<method>index</method>
|
||||
</methods>
|
||||
</bean>
|
||||
<bean>
|
||||
<id>/esigncallback.do</id>
|
||||
<name>com.seeyon.apps.src_rent.controller.EsignCallBackController</name>
|
||||
|
||||
@@ -1,12 +1,37 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans default-autowire="byName"
|
||||
xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context.xsd">
|
||||
<!-- 扫描包以发现bean-->
|
||||
<context:component-scan base-package="com.seeyon.apps.src_rent.*"/>
|
||||
</beans>
|
||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
||||
|
||||
<beans default-autowire="byName">
|
||||
<bean id="rentConfigProvider" class="com.seeyon.apps.src_rent.config.RentConfigProvider" />
|
||||
<bean id="qcAssetsService" class="com.seeyon.apps.src_rent.assets.AssetsService" />
|
||||
<bean id="qcBillService" class="com.seeyon.apps.src_rent.bill.BillService" />
|
||||
<bean id="qcFeeRecordService" class="com.seeyon.apps.src_rent.bill.FeeRecordService" />
|
||||
<bean id="qcWaeBillService" class="com.seeyon.apps.src_rent.bill.WaeBillService" />
|
||||
<bean id="qcContractService" class="com.seeyon.apps.src_rent.contract.ContractService" />
|
||||
<bean id="qcDisCharegeService" class="com.seeyon.apps.src_rent.discharge.DisCharegeService" />
|
||||
<bean id="qcFallbackService" class="com.seeyon.apps.src_rent.fallback.FallbackService" />
|
||||
<bean id="qcFileHandlerService" class="com.seeyon.apps.src_rent.file.FileHandlerService" />
|
||||
<bean id="qcFlowCreateService" class="com.seeyon.apps.src_rent.flow.FlowCreateService" />
|
||||
<bean id="qcFormDataOperator" class="com.seeyon.apps.src_rent.form.FormDataOperator" />
|
||||
<bean id="qcBillPayUrgeJob" class="com.seeyon.apps.src_rent.job.BillPayUrgeJob" />
|
||||
<bean id="qcContractSignUrgeJob" class="com.seeyon.apps.src_rent.job.ContractSignUrgeJob" />
|
||||
<bean id="qcSealDocSyncJob" class="com.seeyon.apps.src_rent.job.SealDocSyncJob" />
|
||||
<bean id="qcNoticeService" class="com.seeyon.apps.src_rent.notice.NoticeService" />
|
||||
<bean id="qcReserveService" class="com.seeyon.apps.src_rent.reserve.ReserveService" />
|
||||
<bean id="qcContractCompareFieldCtrl" class="com.seeyon.apps.src_rent.fieldCtrl.ContractCompareFieldCtrl" />
|
||||
<bean id="qcThirdMessageService" class="com.seeyon.apps.src_rent.message.ThirdMessageService" />
|
||||
<bean id="qcEsignMultipleSignerNode" class="com.seeyon.apps.src_rent.node.EsignMultipleSignerNode" />
|
||||
<bean id="qcEsignOneSignerNode" class="com.seeyon.apps.src_rent.node.EsignOneSignerNode" />
|
||||
<bean id="qcEsignByUploadFileService" class="com.seeyon.apps.src_rent.service.EsignByUploadFileService" />
|
||||
<bean id="qcEsignByTemplateService" class="com.seeyon.apps.src_rent.service.EsignByTemplateService" />
|
||||
<bean id="qcSealService" class="com.seeyon.apps.src_rent.service.SealService" />
|
||||
<bean id="qcSignLinkService" class="com.seeyon.apps.src_rent.service.SignLinkService" />
|
||||
<bean id="qcTokenCacheManager" class="com.seeyon.apps.src_rent.service.TokenCacheManager" />
|
||||
<bean id="qcProtUtil" class="com.seeyon.apps.src_rent.utils.ProtUtil" />
|
||||
<bean id="qcEsignCallbackBizService" class="com.seeyon.apps.src_rent.service.EsignCallbackBizService"/>
|
||||
<bean id="qcQiChenRentPluginApi" class="com.seeyon.apps.src_rent.QiChenRentPluginApi"/>
|
||||
<bean id="qcContractDocService" class="com.seeyon.apps.src_rent.contract.ContractDocService"/>
|
||||
<bean id="qcCustomerService" class="com.seeyon.apps.src_rent.cus.CustomerService"/>
|
||||
<bean id="qcViewRecordService" class="com.seeyon.apps.src_rent.viewrecord.ViewRecordService"/>
|
||||
<bean id="qcMarginBillService" class="com.seeyon.apps.src_rent.bill.MarginBillService"/>
|
||||
</beans>
|
||||
|
||||
Reference in New Issue
Block a user