commit e40f3599df508c97cc628a967225d606885b8c13 Author: RuicyWu <1063154311@qq.com> Date: Thu Jan 15 17:38:59 2026 +0800 初始化 diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/QiChenRentPluginApi.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/QiChenRentPluginApi.java new file mode 100644 index 0000000..b41058b --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/QiChenRentPluginApi.java @@ -0,0 +1,43 @@ +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() { + } + + public String getPluginId() { + return RentConstants.getPluginId(); + } + + public String getCreateUser() { + return "橙阳科技"; + } + + public String getDescription() { + return "启辰资产租赁集成"; + } + + public ConfigVo getDefaultConfig() { + ConfigVo configVo = new ConfigVo(); + RentConstants[] var2 = RentConstants.values(); + int var3 = var2.length; + + for(int var4 = 0; var4 < var3; ++var4) { + RentConstants value = var2[var4]; + if (value != RentConstants.plugin) { + configVo.getDevParams().put(value.name(), value.getDefaultValue()); + configVo.getProdParams().put(value.name(), value.getDefaultValue()); + configVo.getParamMap().put(value.name(), value.getDescription()); + } + } + + return configVo; + } + +} + diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/assets/AssetsService.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/assets/AssetsService.java new file mode 100644 index 0000000..3dbf891 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/assets/AssetsService.java @@ -0,0 +1,201 @@ +package com.seeyon.apps.src_rent.assets; + +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.contract.ContractAssetsVo; +import com.seeyon.apps.src_rent.file.OaFileVo; +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 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; + +@Component +public class AssetsService { + + @Autowired + private RentConfigProvider configProvider; + @Autowired + private FormDataOperator formDataOperator; + + private AttachmentManager attachmentManager = (AttachmentManager) AppContext.getBean("attachmentManager"); + private OrgManager orgManager = (OrgManager) AppContext.getBean("orgManager"); + private String getFormNo() { + return configProvider.getBizConfigByKey(RentConstants.ASSETS_FORMNO); + } + + public PageQueryVo pageQuery(JSONObject params) throws Exception { + List conditions = buildConditions(params); + Integer pageNo = params.getInteger("pageNo") == null ? 1 : params.getInteger("pageNo"); + Integer pageSize = params.getInteger("pageSize") == null ? 10 : params.getInteger("pageSize"); + PageQueryVo pageQueryVo = new PageQueryVo(); + List datas = formDataOperator.queryFormDataPageCondition(getFormNo(), true,null, conditions, pageNo, pageSize); + List vos = new ArrayList<>(); + Long count = formDataOperator.countConditon(getFormNo(), conditions); + if(datas.size() > 0){ + for (Object data : datas) { + Map map = (Map) data; + OaAssetsVo oaAssetsVo = new OaAssetsVo(); + fillVo(map, oaAssetsVo); + vos.add(oaAssetsVo); + } + pageQueryVo.setDatas(vos); + pageQueryVo.setTotalCount(count); + } + return pageQueryVo; + } + + private List buildConditions(JSONObject params) { + List conditions = new ArrayList<>(); + if(StringUtils.isNotBlank(params.getString("cusNo"))) { + conditions.add(FormWhereCondition.build().display("租户-租户编号").value(params.getString("cusNo"))); + } + if(StringUtils.isNotBlank(params.getString("assetsNo"))) { + conditions.add(FormWhereCondition.build().display("资产编号").value(params.getString("assetsNo"))); + } + if(StringUtils.isNotBlank(params.getString("assetsStatus"))) { + conditions.add(FormWhereCondition.build().display("资产状态").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"资产状态",params.getString("assetsStatus")))); + } + if(StringUtils.isNotBlank(params.getString("assetsType"))) { + handleAssetsSubType(conditions,params.getString("assetsType")); + } + 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)); + conditions.add(FormWhereCondition.build().display("所在位置") + .value(params.getString("keyWord")) + .clauseFactor(ClauseFactor.LIKE)); + } + return conditions; + } + + private void handleAssetsSubType(List conditions,String type) { + if("住房".equals(type)) { + conditions + .add(FormWhereCondition.build().display("资产二级类型") + .startWithBracket(true) + .concatFactor(ClauseFactor.OR) + .value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"资产二级类型","住宅"))); + conditions.add(FormWhereCondition.build().display("资产二级类型") + .endWithBracket(true) + .value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"资产二级类型","保障性住房"))); + } + if("商铺".equals(type)) { + conditions + .add(FormWhereCondition.build().display("资产二级类型") + .startWithBracket(true) + .concatFactor(ClauseFactor.OR) + .value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"资产二级类型","写字楼"))); + conditions.add(FormWhereCondition.build().display("资产二级类型") + .concatFactor(ClauseFactor.OR) + .value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"资产二级类型","商业门面"))); + conditions.add(FormWhereCondition.build().display("资产二级类型") + .concatFactor(ClauseFactor.OR) + .value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"资产二级类型","商业用房"))); + conditions.add(FormWhereCondition.build().display("资产二级类型") + .endWithBracket(true) + .value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"资产二级类型","政府机构"))); + } + if("厂房".equals(type)) { + conditions.add(FormWhereCondition.build().display("资产二级类型").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"资产二级类型","厂房"))); + } + if("停车场".equals(type)) { + conditions.add(FormWhereCondition.build().display("资产二级类型").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"资产二级类型","车房"))); + } + } + + public OaAssetsVo queryAssetsDetail(String id) throws Exception { + if(id == null) { + return null; + } + JSONObject object = new JSONObject(); + object.put("assetsNo", id); + return queryAssetsDetail(object); + } + + public ContractAssetsVo queryContractAssetsDetail(JSONObject params) throws Exception { + List conditions = buildConditions(params); + ContractAssetsVo assetsVo = new ContractAssetsVo(); + FormColumn formColumn = formDataOperator.queryOneRowFormData(getFormNo(),true, null, conditions); + if(formColumn == null) { + return assetsVo; + } + Map fieldsMap = formColumn.getFieldsMap(); + assetsVo.setFormId(formColumn.getId()); + assetsVo.setAssetsNo(getStringValue(fieldsMap,"资产编号")); + assetsVo.setAssetsName(getStringValue(fieldsMap,"品牌名称")); + if(fieldsMap.get("资产图片") != null) { + assetsVo.setDetailImg(OaFileVo.getInstance(Long.parseLong((String)fieldsMap.get("资产图片")),attachmentManager)); + } + return assetsVo; + } + + public OaAssetsVo queryAssetsDetail(JSONObject params) throws Exception { + List conditions = buildConditions(params); + OaAssetsVo assetsVo = new OaAssetsVo(); + FormColumn formColumn = formDataOperator.queryOneRowFormData(getFormNo(),true, null, conditions); + if(formColumn == null) { + return assetsVo; + } + Map fieldsMap = formColumn.getFieldsMap(); + fillVo(fieldsMap,assetsVo); + return assetsVo; + } + + private String getStringValue(Map fieldsMap,String key) { + Object o = fieldsMap.get(key); + if(o == null) { + return null; + } + return o + ""; + } + + public void fillVo(Map fieldsMap,OaAssetsVo assetsVo) throws BusinessException { + assetsVo.setAssetsNo(getStringValue(fieldsMap,"资产编号")); + assetsVo.setAssetsName(getStringValue(fieldsMap,"品牌名称")); + assetsVo.setAssetsDesc(getStringValue(fieldsMap,"详情信息")); + assetsVo.setFormId(getStringValue(fieldsMap,"id")); + assetsVo.setAssetsStatus(getStringValue(fieldsMap,"资产状态")); + assetsVo.setAssetsType(getStringValue(fieldsMap,"资产类型")); + assetsVo.setAssetsAddress(getStringValue(fieldsMap,"所在位置")); + assetsVo.setLongitude(getStringValue(fieldsMap,"坐落经度")); //经度 + assetsVo.setLatitude(getStringValue(fieldsMap,"坐落纬度")); //纬度 + 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("运营管理员"))); + 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()); + } + if(fieldsMap.get("VR文件上传") != null) { + assetsVo.setVrImg(OaFileVo.getInstance((Long)fieldsMap.get("VR文件上传"),attachmentManager)); + } + if(fieldsMap.get("资产图片") != null) { + assetsVo.setDetailImg(OaFileVo.getInstance(Long.parseLong((String)fieldsMap.get("资产图片")),attachmentManager)); + } + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/assets/OaAssetsVo.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/assets/OaAssetsVo.java new file mode 100644 index 0000000..0e9e97d --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/assets/OaAssetsVo.java @@ -0,0 +1,241 @@ +package com.seeyon.apps.src_rent.assets; + +import com.seeyon.apps.src_rent.file.OaFileVo; + +public class OaAssetsVo { + + private String assetsNo; // 资产编号 + private String assetsName; // 资产名称 + private String assetsType; //资产类型 + private String assetsStatus; //资产状态 + private String rentFee; //租金 + private String footPrint; //占地大小 + private String formId; //表单记录ID + private OaFileVo detailImg; //详情图片 + private OaFileVo vrImg; //vr图 + private String assetsDesc; //资产描述 + private String assetsAddress; //资产地址 + private String latitude; //纬度 + private String longitude; //经度 + private String unitNo; //单元号 + private String floorNo; //楼层号 + private String roomNo; //房间号 + private Boolean hasLift;//有无电梯 + private String managerPhone; //管理员电话 + private String managerName; //管理员姓名 + private String layout; //户型 + private String orientation; //朝向 + private String building; //楼栋 + private String waterFee; //水费 + private String waterFeeUnit; //水费单位 + private String powerFee; //电费 + private String powerFeeUnit; //电费单位 + + public String getAssetsNo() { + return assetsNo; + } + + public void setAssetsNo(String assetsNo) { + this.assetsNo = assetsNo; + } + + public String getAssetsName() { + return assetsName; + } + + public void setAssetsName(String assetsName) { + this.assetsName = assetsName; + } + + public String getAssetsType() { + return assetsType; + } + + public void setAssetsType(String assetsType) { + this.assetsType = assetsType; + } + + public String getAssetsStatus() { + return assetsStatus; + } + + public void setAssetsStatus(String assetsStatus) { + this.assetsStatus = assetsStatus; + } + + public String getRentFee() { + return rentFee; + } + + public void setRentFee(String rentFee) { + this.rentFee = rentFee; + } + + public String getFootPrint() { + return footPrint; + } + + public void setFootPrint(String footPrint) { + this.footPrint = footPrint; + } + + public String getFormId() { + return formId; + } + + public void setFormId(String formId) { + this.formId = formId; + } + + public OaFileVo getDetailImg() { + return detailImg; + } + + public void setDetailImg(OaFileVo detailImg) { + this.detailImg = detailImg; + } + + public OaFileVo getVrImg() { + return vrImg; + } + + public void setVrImg(OaFileVo vrImg) { + this.vrImg = vrImg; + } + + public String getAssetsDesc() { + return assetsDesc; + } + + public void setAssetsDesc(String assetsDesc) { + this.assetsDesc = assetsDesc; + } + + public String getAssetsAddress() { + return assetsAddress; + } + + public void setAssetsAddress(String assetsAddress) { + this.assetsAddress = assetsAddress; + } + + public String getLatitude() { + return latitude; + } + + public void setLatitude(String latitude) { + this.latitude = latitude; + } + + public String getLongitude() { + return longitude; + } + + public void setLongitude(String longitude) { + this.longitude = longitude; + } + + public String getUnitNo() { + return unitNo; + } + + public void setUnitNo(String unitNo) { + this.unitNo = unitNo; + } + + public String getFloorNo() { + return floorNo; + } + + public void setFloorNo(String floorNo) { + this.floorNo = floorNo; + } + + public String getRoomNo() { + return roomNo; + } + + public void setRoomNo(String roomNo) { + this.roomNo = roomNo; + } + + public Boolean getHasLift() { + return hasLift; + } + + public void setHasLift(Boolean hasLift) { + this.hasLift = hasLift; + } + + public String getManagerPhone() { + return managerPhone; + } + + public void setManagerPhone(String managerPhone) { + this.managerPhone = managerPhone; + } + + public String getLayout() { + return layout; + } + + public void setLayout(String layout) { + this.layout = layout; + } + + public String getOrientation() { + return orientation; + } + + public void setOrientation(String orientation) { + this.orientation = orientation; + } + + public String getBuilding() { + return building; + } + + public void setBuilding(String building) { + this.building = building; + } + + public String getWaterFee() { + return waterFee; + } + + public void setWaterFee(String waterFee) { + this.waterFee = waterFee; + } + + public String getWaterFeeUnit() { + return waterFeeUnit; + } + + public void setWaterFeeUnit(String waterFeeUnit) { + this.waterFeeUnit = waterFeeUnit; + } + + public String getPowerFee() { + return powerFee; + } + + public void setPowerFee(String powerFee) { + this.powerFee = powerFee; + } + + public String getPowerFeeUnit() { + return powerFeeUnit; + } + + public void setPowerFeeUnit(String powerFeeUnit) { + this.powerFeeUnit = powerFeeUnit; + } + + public String getManagerName() { + return managerName; + } + + public void setManagerName(String managerName) { + this.managerName = managerName; + } +} \ No newline at end of file diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/bill/BillService.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/bill/BillService.java new file mode 100644 index 0000000..04fdc6b --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/bill/BillService.java @@ -0,0 +1,142 @@ +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.contract.ContractService; +import com.seeyon.apps.src_rent.form.*; +import com.seeyon.apps.src_rent.po.PageQueryVo; +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; + +@Component +public class BillService { + + @Autowired + private RentConfigProvider configProvider; + @Autowired + private FormDataOperator formDataOperator; + @Autowired + private ContractService contractService; + + private String getFormNo() { + return configProvider.getBizConfigByKey(RentConstants.CONTRACTBILLFORMNO); + } + + private String getStringValue(Map fieldsMap,String key) { + Object o = fieldsMap.get(key); + if(o == null) { + return null; + } + return o + ""; + } + + private List buildConditions(JSONObject params) { + List conditions = new ArrayList<>(); + if(StringUtils.isNotBlank(params.getString("cusNo"))) { + conditions.add(FormWhereCondition.build().display("承租方编号").value(params.getString("cusNo"))); + } + if(StringUtils.isNotBlank(params.getString("billNo"))) { + conditions.add(FormWhereCondition.build().display("租赁账单编号").value(params.getString("billNo"))); + } + 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)); + } + } + return conditions; + } + + public PageQueryVo queryAllContractBill(List conditions) throws Exception {; + PageQueryVo pageQueryVo = new PageQueryVo(); + List datas = formDataOperator.queryFormDataPageCondition(getFormNo(), true,null, conditions, null,null); + List vos = new ArrayList<>(); + Long count = formDataOperator.countConditon(getFormNo(), conditions); + if(datas.size() > 0){ + for (Object data : datas) { + Map map = (Map) data; + BillVo billVo = new BillVo(); + fillVo(map, billVo); + vos.add(billVo); + } + pageQueryVo.setDatas(vos); + pageQueryVo.setTotalCount(count); + } + return pageQueryVo; + } + + public Integer countUnpayRentBills(JSONObject params) throws Exception { + List conditions = buildConditions(params); + conditions.add(FormWhereCondition.build().display("收款结果反馈").clauseFactor(ClauseFactor.NULL)); + Long count = formDataOperator.countConditon(getFormNo(), conditions); + return count.intValue(); + } + + public PageQueryVo pageQueryContractBill(JSONObject params) throws Exception { + List conditions = buildConditions(params); + Integer pageNo = params.getInteger("pageNo") == null ? 1 : params.getInteger("pageNo"); + Integer pageSize = params.getInteger("pageSize") == null ? 10 : params.getInteger("pageSize"); + PageQueryVo pageQueryVo = new PageQueryVo(); + List datas = formDataOperator.queryFormDataPageCondition(getFormNo(), true,null, conditions, pageNo, pageSize); + List vos = new ArrayList<>(); + Long count = formDataOperator.countConditon(getFormNo(), conditions); + if(datas.size() > 0){ + for (Object data : datas) { + Map map = (Map) data; + BillVo billVo = new BillVo(); + fillVo(map, billVo); + vos.add(billVo); + } + pageQueryVo.setDatas(vos); + pageQueryVo.setTotalCount(count); + } + return pageQueryVo; + } + + public BillVo queryOne(JSONObject params) throws Exception { + List conditions = buildConditions(params); + FormColumn formColumn = formDataOperator.queryOneRowFormData(getFormNo(), true, null, conditions); + if(formColumn == null) { + return null; + } + Map fieldsMap = formColumn.getFieldsMap(); + BillVo billVo = new BillVo(); + fillVo(fieldsMap, billVo); + return billVo; + } + + public void fillVo(Map fieldsMap, BillVo billVo) throws Exception { + billVo.setBillType("CONTRACT"); + billVo.setBillNo(getStringValue(fieldsMap,"租赁账单编号" )); + String payStatus = fieldsMap.get("收款结果反馈") == null ? "待缴费" : getStringValue(fieldsMap,"收款结果反馈"); + billVo.setBillStatus(payStatus); + billVo.setCusNo(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("资产名称") + "-"; + String roomNo = fieldsMap.get("门牌号") == null ? "" : fieldsMap.get("门牌号") + "-"; + String billTerm = "(" + billVo.getBillStartDate() + "-" + billVo.getBillEndDate() + ")"; + billVo.setBillName(asssetsName + roomNo + billTerm); + BigDecimal bigDecimal = (BigDecimal) fieldsMap.get("账单-租费"); + billVo.setBillAmount(bigDecimal == null ? null : bigDecimal.toString()); + billVo.setBillPayTime(getStringValue(fieldsMap,"账单-实际收款时间")); + } + + private String buildBillName(Map fieldsMap) throws Exception { + String contractNo = getStringValue(fieldsMap,"合同编号"); + String term = contractService.queryContractPayPeriod(contractNo,getStringValue(fieldsMap,"开始日期")) + "-"; + String asssetsName = fieldsMap.get("资产名称") == null ? "" : fieldsMap.get("资产名称") + "-"; + String roomNo = fieldsMap.get("门牌号") == null ? "" : fieldsMap.get("门牌号") + "-"; + return asssetsName + roomNo + term; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/bill/BillVo.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/bill/BillVo.java new file mode 100644 index 0000000..fa87ca3 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/bill/BillVo.java @@ -0,0 +1,112 @@ +package com.seeyon.apps.src_rent.bill; + +public class BillVo { + private String billType; //账单类型 + private String billNo; //账单编号 + private String cusNo; //租户编号 + private String contractNo; //合同编号 + private String billAmount; //账单金额 + private String billStatus; //账单状态 + private String billStartDate; //账单开始日期 + private String billEndDate; //账单结束日期 + private String billPayEndDate; //账单支付截止日期 + private String billName;// 账单名称 + private String billPayTime; + private String formId; + + public String getBillType() { + return billType; + } + + public void setBillType(String billType) { + this.billType = billType; + } + + public String getBillNo() { + return billNo; + } + + public void setBillNo(String billNo) { + this.billNo = billNo; + } + + public String getCusNo() { + return cusNo; + } + + public void setCusNo(String cusNo) { + this.cusNo = cusNo; + } + + public String getContractNo() { + return contractNo; + } + + public void setContractNo(String contractNo) { + this.contractNo = contractNo; + } + + public String getBillAmount() { + return billAmount; + } + + public void setBillAmount(String billAmount) { + this.billAmount = billAmount; + } + + public String getBillStatus() { + return billStatus; + } + + public void setBillStatus(String billStatus) { + this.billStatus = billStatus; + } + + public String getBillEndDate() { + return billEndDate; + } + + public void setBillEndDate(String billEndDate) { + this.billEndDate = billEndDate; + } + + public String getBillName() { + return billName; + } + + public void setBillName(String billName) { + this.billName = billName; + } + + public String getFormId() { + return formId; + } + + public void setFormId(String formId) { + this.formId = formId; + } + + public String getBillPayTime() { + return billPayTime; + } + + public void setBillPayTime(String billPayTime) { + this.billPayTime = billPayTime; + } + + public String getBillStartDate() { + return billStartDate; + } + + public void setBillStartDate(String billStartDate) { + this.billStartDate = billStartDate; + } + + public String getBillPayEndDate() { + return billPayEndDate; + } + + public void setBillPayEndDate(String billPayEndDate) { + this.billPayEndDate = billPayEndDate; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/bill/FeeRecordService.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/bill/FeeRecordService.java new file mode 100644 index 0000000..8ae782d --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/bill/FeeRecordService.java @@ -0,0 +1,92 @@ +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.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 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; + +@Component +public class FeeRecordService { + + @Autowired + private RentConfigProvider configProvider; + @Autowired + private FormDataOperator formDataOperator; + @Autowired + private BillService billService; + @Autowired + private WaeBillService waeBillService; + + private String getFormNo() { + return configProvider.getBizConfigByKey(RentConstants.FEERECORDFORMNO); + } + + private String getStringValue(Map fieldsMap,String key) { + Object o = fieldsMap.get(key); + if(o == null) { + return null; + } + return o + ""; + } + + private List buildConditions(JSONObject params) { + List conditions = new ArrayList<>(); + if(StringUtils.isNotBlank(params.getString("cusNo"))) { + conditions.add(FormWhereCondition.build().display("客商编号").value(params.getString("cusNo"))); + } + if(StringUtils.isNotBlank(params.getString("assetsNo"))) { + conditions.add(FormWhereCondition.build().display("资产编号").value(params.getString("assetsNo"))); + } + if(StringUtils.isNotBlank(params.getString("contractNo"))) { + conditions.add(FormWhereCondition.build().display("合同编号").value(params.getString("contractNo"))); + } + return conditions; + } + + + public PageQueryVo queryBillPayRecord(JSONObject params) throws Exception { + List conditions = buildConditions(params); + Integer pageNo = params.getInteger("pageNo") == null ? 1 : params.getInteger("pageNo"); + Integer pageSize = params.getInteger("pageSize") == null ? 10 : params.getInteger("pageSize"); + PageQueryVo pageQueryVo = new PageQueryVo(); + List datas = formDataOperator.queryFormDataPageCondition(getFormNo(), true,null, conditions, pageNo, pageSize); + List payRecordVos = new ArrayList<>(); + Long count = formDataOperator.countConditon(getFormNo(), conditions); + for (Object data : datas) { + PayRecordVo payRecordVo = new PayRecordVo(); + Map fieldsMap = (Map) data; + fillVo(fieldsMap,payRecordVo); + } + pageQueryVo.setDatas(payRecordVos); + pageQueryVo.setTotalCount(count); + return pageQueryVo; + } + + public void fillVo(Map fieldsMap, PayRecordVo payRecordVo) throws Exception { + payRecordVo.setInOutType(EnumMapUtils.getEnumShowValue(getStringValue(fieldsMap,"收支类型"))); + payRecordVo.setPayDate(getStringValue(fieldsMap,"收付款日期")); + payRecordVo.setInDate(getStringValue(fieldsMap,"收付款日期")); + BigDecimal amount = (BigDecimal) fieldsMap.get("收付款金额"); + payRecordVo.setItemAmount(amount.toString()); + JSONObject billQueryParam = new JSONObject(); + billQueryParam.put("billNo", fieldsMap.get("账单编号")); + BillVo billVo = billService.queryOne(billQueryParam); + if(billVo != null) { + String itemName = billVo.getBillName(); + payRecordVo.setItemName(itemName); + }else { + payRecordVo.setItemName(getStringValue(fieldsMap,"费用类型")); + } + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/bill/PayRecordVo.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/bill/PayRecordVo.java new file mode 100644 index 0000000..971627e --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/bill/PayRecordVo.java @@ -0,0 +1,50 @@ +package com.seeyon.apps.src_rent.bill; + +public class PayRecordVo { + private String itemName; //记录项名称 + private String itemAmount; //记录项金额 + private String payDate; //支付日期 + private String inDate; //入账日期 + private String inOutType; //收支类型 + + public String getItemName() { + return itemName; + } + + public void setItemName(String itemName) { + this.itemName = itemName; + } + + public String getItemAmount() { + return itemAmount; + } + + public void setItemAmount(String itemAmount) { + this.itemAmount = itemAmount; + } + + public String getPayDate() { + return payDate; + } + + public void setPayDate(String payDate) { + this.payDate = payDate; + } + + public String getInDate() { + return inDate; + } + + public void setInDate(String inDate) { + this.inDate = inDate; + } + + public String getInOutType() { + return inOutType; + } + + public void setInOutType(String inOutType) { + this.inOutType = inOutType; + } + +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/bill/WaeBillService.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/bill/WaeBillService.java new file mode 100644 index 0000000..50f323f --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/bill/WaeBillService.java @@ -0,0 +1,89 @@ +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.FormDataOperator; +import com.seeyon.apps.src_rent.form.FormWhereCondition; +import com.seeyon.apps.src_rent.po.PageQueryVo; +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.List; +import java.util.Map; + +@Component +public class WaeBillService { + + @Autowired + private RentConfigProvider configProvider; + @Autowired + private FormDataOperator formDataOperator; + + private String getFormNo() { + return configProvider.getBizConfigByKey(RentConstants.WAEBILLFORMNO); + } + + private String getStringValue(Map fieldsMap,String key) { + Object o = fieldsMap.get(key); + if(o == null) { + return null; + } + return o + ""; + } + + private List buildConditions(JSONObject params) { + List conditions = new ArrayList<>(); + if(StringUtils.isNotBlank(params.getString("cusNo"))) { + conditions.add(FormWhereCondition.build().display("承租方编号").value(params.getString("cusNo"))); + } + return conditions; + } + + + public PageQueryVo pageQueryWaeBill(JSONObject params) throws Exception { + List conditions = buildConditions(params); + Integer pageNo = params.getInteger("pageNo") == null ? 1 : params.getInteger("pageNo"); + Integer pageSize = params.getInteger("pageSize") == null ? 10 : params.getInteger("pageSize"); + PageQueryVo pageQueryVo = new PageQueryVo(); + List datas = formDataOperator.queryFormDataPageCondition(getFormNo(), true,null, conditions, pageNo, pageSize); + List vos = new ArrayList<>(); + Long count = formDataOperator.countConditon(getFormNo(), conditions); + if(datas.size() > 0){ + for (Object data : datas) { + Map map = (Map) data; + BillVo billVo = new BillVo(); + fillVo(map, billVo); + vos.add(billVo); + } + pageQueryVo.setDatas(vos); + pageQueryVo.setTotalCount(count); + } + return pageQueryVo; + } + + public Integer countUnpayWaeBills(JSONObject params) throws Exception { + List conditions = buildConditions(params); + conditions.add(FormWhereCondition.build().display("缴费状态").clauseFactor(ClauseFactor.NULL)); + Long count = formDataOperator.countConditon(getFormNo(), conditions); + return count.intValue(); + } + + public void fillVo(Map fieldsMap, BillVo billVo) { + billVo.setBillType("WAE"); + billVo.setBillStartDate(getStringValue(fieldsMap,"账单开始日期")); + 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.setBillAmount((powerFee.add(waterFee)).toString()); + billVo.setBillName("水电费"); + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/config/RentConfigProvider.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/config/RentConfigProvider.java new file mode 100644 index 0000000..34834fd --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/config/RentConfigProvider.java @@ -0,0 +1,20 @@ +package com.seeyon.apps.src_rent.config; + +import com.seeyon.apps.common.config.ICstConfigApi; +import com.seeyon.apps.common.plugin.vo.ConfigVo; +import com.seeyon.apps.src_rent.constants.RentConstants; +import com.seeyon.ctp.common.AppContext; +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"); + + public String getBizConfigByKey(RentConstants key) { + ConfigVo config = cstConfigApi.getConfig(getPluginId()); + return config.getParamVal(key.name()); + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/constants/EsignApiUrl.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/constants/EsignApiUrl.java new file mode 100644 index 0000000..f4a64d6 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/constants/EsignApiUrl.java @@ -0,0 +1,19 @@ +package com.seeyon.apps.src_rent.constants; + +public class EsignApiUrl { + public static final String SEAL_GRANT_URL = "/v3/seals/org-seals/internal-auth"; + public static final String SIGN_START_URL = "/v3/sign-flow/{signFlowId}/start"; + public static final String SIGN_BY_FILE_URL = "/v3/sign-flow/create-by-file"; + public static final String SIGN_FLOW_QUERY = "/v3/sign-flow/{signFlowId}/detail"; + public static final String GET_UPLOAD_FILE_URL = "/v3/files/file-upload-url"; + public static final String CONTRACT_DOWNLOAD_URL= "/v3/sign-flow/{signFlowId}/file-download-url"; + public static final String PERSON_AUTH_URL = "/v3/psn-auth-url"; + public static final String SIGN_POSITION_URL = "/v3/files/{fileId}/keyword-positions"; + public static final String QUERY_TEMPLATES_URL = "/v3/sign-templates"; + public static final String QUERY_TEMPLATE_DETAIL_URL = "/v3/sign-templates/detail"; + public static final String QUERY_ORGINFO = "/v3/organizations/identity-info"; + public static final String CONTRACT_COMPARE_GETURL = "/v3/contract-compare-url"; + public static final String TOKEN_GET_URL = "/v1/oauth2/access_token"; + public static final String SEAL_QUERY_URL = "/v3/seals/org-own-seal-list"; + public static final String SIGN_LINK_GET_URL ="/v3/sign-flow/{signFlowId}/sign-url"; +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/constants/RentConstants.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/constants/RentConstants.java new file mode 100644 index 0000000..7a6e21e --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/constants/RentConstants.java @@ -0,0 +1,56 @@ +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",""), + UNITNAME("","平台方组织名称"), + FORMEDITLOGINNAME("","表单修改登录名"), + updateAccountName("表单",""), + getTokenUrl("/seeyon/rest/token/","调用获取TOKEN地址"), + nodeTokenUrl("/seeyon/rest/flow/notification/","超级节点回调URL"), + restName("",""), + restPwd("",""), + signAutoDate("","是否自动加盖签署日期"), + eSignOrgId("61f735dd368c45a191f43a6711c3c88a","e签宝平台方组织id"), + formLoginName("2019","表单数据录入登录名"), + sealInfoFormCode("","印章档案编码"), + ASSETS_FORMNO("","资产运营档案编码"), + CONTRACT_FORMNO("","租赁合同表单编码"), + DISCHARGE_TEMPLATECODE("","退租申请模板编码"), + DISCHARGE_FORMNO("","退租申请表单编码"), + FALLBACK_FORMNO("","留言板表单编码"), + RESERVE_FORMNO("","看房预约表单编码"), + VIEWRECORD_FORMNO("","浏览记录表单编码"), + FORMAPPNAME("","表单应用名称"), + FEERECORDFORMNO("","费用收支台账表单编码"), + CONTRACTBILLFORMNO("","合同账单表单编码"), + WAEBILLFORMNO("","水电费账单表单编码"), + CUSDOCFORMNO("","客商档案表单编码"), + NOTICEFORMNO("","招商公告表单编码"), + WECHATBACKENDHOST("","微信小程序后端host"), + ; + RentConstants(String defaultValue, String description) { + this.defaultValue = defaultValue; + this.description = description; + } + + private String defaultValue; + private String description; + + public String getDefaultValue() { + return defaultValue; + } + + public String getDescription() { + return description; + } + + public static String getPluginId() { + return plugin.defaultValue; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/contract/ContractAssetsVo.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/contract/ContractAssetsVo.java new file mode 100644 index 0000000..bd64d82 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/contract/ContractAssetsVo.java @@ -0,0 +1,97 @@ +package com.seeyon.apps.src_rent.contract; + +import com.seeyon.apps.src_rent.file.OaFileVo; + +public class ContractAssetsVo { + + private String assetsNo; // 资产编号 + private String assetsName; // 资产名称 + private String rentFee; //租金 + private String formId; //表单记录ID + private OaFileVo detailImg; //详情图片 + private String waterFee; //水费 + private String waterFeeUnit; //水费单位 + private String powerFee; //电费 + private String powerFeeUnit; //电费单位 + private String footPrint; //占地大小 + + public String getAssetsNo() { + return assetsNo; + } + + public void setAssetsNo(String assetsNo) { + this.assetsNo = assetsNo; + } + + public String getAssetsName() { + return assetsName; + } + + public void setAssetsName(String assetsName) { + this.assetsName = assetsName; + } + + public String getRentFee() { + return rentFee; + } + + public void setRentFee(String rentFee) { + this.rentFee = rentFee; + } + + public String getFormId() { + return formId; + } + + public void setFormId(String formId) { + this.formId = formId; + } + + public OaFileVo getDetailImg() { + return detailImg; + } + + public void setDetailImg(OaFileVo detailImg) { + this.detailImg = detailImg; + } + + public String getWaterFee() { + return waterFee; + } + + public void setWaterFee(String waterFee) { + this.waterFee = waterFee; + } + + public String getWaterFeeUnit() { + return waterFeeUnit; + } + + public void setWaterFeeUnit(String waterFeeUnit) { + this.waterFeeUnit = waterFeeUnit; + } + + public String getPowerFee() { + return powerFee; + } + + public void setPowerFee(String powerFee) { + this.powerFee = powerFee; + } + + public String getPowerFeeUnit() { + return powerFeeUnit; + } + + public void setPowerFeeUnit(String powerFeeUnit) { + this.powerFeeUnit = powerFeeUnit; + } + + public String getFootPrint() { + return footPrint; + } + + public void setFootPrint(String footPrint) { + this.footPrint = footPrint; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/contract/ContractService.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/contract/ContractService.java new file mode 100644 index 0000000..87f6592 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/contract/ContractService.java @@ -0,0 +1,337 @@ +package com.seeyon.apps.src_rent.contract; + +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.file.OaFileVo; +import com.seeyon.apps.src_rent.form.*; +import com.seeyon.apps.src_rent.po.PageQueryVo; +import com.seeyon.apps.src_rent.service.SignLinkService; +import com.seeyon.ctp.common.AppContext; +import com.seeyon.ctp.common.exceptions.BusinessException; +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 AttachmentManager attachmentManager = (AttachmentManager) AppContext.getBean("attachmentManager"); + + private String getFormNo() { + return configProvider.getBizConfigByKey(RentConstants.CONTRACT_FORMNO); + } + + private String getStringValue(Map fieldsMap,String key) { + Object o = fieldsMap.get(key); + if(o == null) { + return null; + } + return o + ""; + } + + public Integer countUnSign(JSONObject params) throws BusinessException { + List conditions = buildConditions(params); + conditions.add(FormWhereCondition.build().display("签署状态").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"签署状态","待签署"))); + Long count = formDataOperator.countConditon(getFormNo(), conditions); + return count.intValue(); + } + + public PageQueryVo pageQuery(JSONObject params) throws Exception { + List conditions = buildConditions(params); + Integer pageNo = params.getInteger("pageNo") == null ? 1 : params.getInteger("pageNo"); + Integer pageSize = params.getInteger("pageSize") == null ? 10 : params.getInteger("pageSize"); + List queryColumnVos = new ArrayList<>(); + queryColumnVos.add("合同编号"); + queryColumnVos.add("承租方编号"); + queryColumnVos.add("合同开始日期"); + queryColumnVos.add("合同截止日期"); + queryColumnVos.add("签署状态"); + queryColumnVos.add("合同名称"); + PageQueryVo pageQueryVo = new PageQueryVo(); + List datas = formDataOperator.queryFormDataPageCondition(getFormNo(), true,queryColumnVos, conditions, pageNo, pageSize); + List oaContractVos = new ArrayList<>(); + Long count = formDataOperator.countConditon(getFormNo(), conditions); + pageQueryVo.setDatas(oaContractVos); + pageQueryVo.setTotalCount(count); + for (Object data : datas) { + OaContractVo oaContractVo = new OaContractVo(); + Map dataMap = (Map) data; + fillVo(dataMap,oaContractVo); + Long id = Long.parseLong((String)dataMap.get("id")); + List subConditions = new ArrayList<>(); + subConditions.add(FormWhereCondition.build().display("formmain_id").value(id)); + List subDatas = formDataOperator.pageQuerySubFormDatas(getFormNo(), "租赁资产明细", true, null, subConditions, 1, 10); + log.info("查询到的关联资产数量: " + subDatas.size()); + if(subDatas.size() > 0) { + Map subOneRowData = (Map) subDatas.get(0); + String assetsNo = (String) subOneRowData.get("资产编号"); + JSONObject temp = new JSONObject(); + temp.put("assetsNo",assetsNo); + ContractAssetsVo assetsVo = assetsService.queryContractAssetsDetail(temp); + List oaAssetsVos = new ArrayList<>(); + oaAssetsVos.add(assetsVo); + oaContractVo.setAssetsVos(oaAssetsVos); + } + oaContractVos.add(oaContractVo); + } + return pageQueryVo; + } + + public List queryAll(JSONObject params) throws Exception { + List conditions = buildConditions(params); + List queryColumns = new ArrayList<>(); + queryColumns.add("合同编号"); + queryColumns.add("合同名称"); + List datas = formDataOperator.queryFormDataCondition(getFormNo(), queryColumns,conditions); + List oaContractVos = new ArrayList<>(); + for (FormColumn data : datas) { + OaContractVo oaContractVo = new OaContractVo(); + Map dataMap = data.getFieldsMap(); + fillVo(dataMap,oaContractVo); + Long id = Long.parseLong((String)dataMap.get("id")); + List subConditions = new ArrayList<>(); + subConditions.add(FormWhereCondition.build().display("formmain_id").value(id)); + List subDatas = formDataOperator.pageQuerySubFormDatas(getFormNo(), "租赁资产明细", true, null, subConditions, null, null); + List assetsVos = new ArrayList<>(); + for (Object subData : subDatas) { + Map subOneRowData = (Map) subData; + String assetsNo = (String) subOneRowData.get("资产编号"); + JSONObject temp = new JSONObject(); + temp.put("assetsNo",assetsNo); + ContractAssetsVo assetsVo = new ContractAssetsVo(); + assetsVo.setAssetsNo(subOneRowData.get("资产编号") + ""); + assetsVo.setAssetsName(subOneRowData.get("资产名称") + ""); + assetsVos.add(assetsVo); + } + oaContractVo.setAssetsVos(assetsVos); + + } + return oaContractVos; + } + + public void fillVo(Map fieldsMap, OaContractVo oaContractVo) { + oaContractVo.setFormId(getStringValue(fieldsMap, "id")); + oaContractVo.setContractNo(getStringValue(fieldsMap,"合同编号")); + oaContractVo.setContractName(getStringValue(fieldsMap,"合同名称")); + oaContractVo.setSignStatus(getStringValue(fieldsMap,"签署状态")); + oaContractVo.setCusNo(getStringValue(fieldsMap,"承租方编号")); + oaContractVo.setContractStartTime(getStringValue(fieldsMap,"合同开始日期")); + oaContractVo.setContractEndTime(getStringValue(fieldsMap,"合同结束日期")); + oaContractVo.setStartDate(oaContractVo.getContractStartTime()); + oaContractVo.setEndDate(oaContractVo.getContractEndTime()); + if(fieldsMap.get("盖章后合同附件") != null) { + oaContractVo.seteContractFile(OaFileVo.getInstance(Long.parseLong((String)fieldsMap.get("盖章后合同附件")),attachmentManager)); + } + oaContractVo.seteContractFlowId(getStringValue(fieldsMap,"电子签合同流程ID")); + } + + private List buildConditions(JSONObject params) { + List conditions = new ArrayList<>(); + if(StringUtils.isNotBlank(params.getString("cusNo"))) { + conditions.add(FormWhereCondition.build().display("承租方编号").value(params.getString("cusNo"))); + } + if(StringUtils.isNotBlank(params.getString("contractNo"))) { + conditions.add(FormWhereCondition.build().display("合同编号").value(params.getString("contractNo"))); + } + if(StringUtils.isNotBlank(params.getString("formmainId"))) { + conditions.add(FormWhereCondition.build().display("formmainId").value(params.getString("formmainId"))); + } + if(StringUtils.isNotBlank(params.getString("signStatus"))) { + conditions.add(FormWhereCondition.build().display("签署状态").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"签署状态",params.getString("signStatus")))); + } + if(StringUtils.isNotBlank(params.getString("signWay"))) { + String enumId = EnumMapUtils.getEnumItemIdByGroupNameAndItemShowValue("签订方式",params.getString("signWay")); + conditions.add(FormWhereCondition.build().display("签订方式").value(enumId).clauseFactor(ClauseFactor.NEQ)); + } + return conditions; + } + + public String queryContractPayPeriod(String contractNo, String billDate) throws Exception { + List conditions = new ArrayList<>(); + conditions.add(FormWhereCondition.build() + .display("合同编号") + .value(contractNo)); + FormColumn formColumn = + formDataOperator.queryOneRowFormData(getFormNo(), true, null, conditions); + if (formColumn == null || formColumn.getFieldsMap() == null) { + return ""; + } + Map fieldsMap = formColumn.getFieldsMap(); + String payWay = toStr(fieldsMap.get("缴费方式")); + // 合同总租期 + int years = parseInt(fieldsMap.get("文本-年")); + int months = parseInt(fieldsMap.get("文本-月")); + int days = parseInt(fieldsMap.get("文本-日")); + LocalDate startDate = LocalDate.parse(fieldsMap.get("计租日期") + ""); + LocalDate billLocalDate = LocalDate.parse(billDate); + // 合同结束日 + LocalDate endDate = startDate.plusYears(years).plusMonths(months).plusDays(days); + // 一次性或年付,直接返回 + if ("一次性".equals(payWay)) { + return "1"; + } + // 账单日期早于计租起始日 + if (billLocalDate.isBefore(startDate)) { + return "1"; + } + // 账单日期超过合同结束日 + if (billLocalDate.isAfter(endDate)) { + switch (payWay) { + case "年": + return ""; + case "季": + return (((years * 12 + months) / 3) > 0 ? (int) ((years * 12 + months) / 3) : 1) + ""; + case "月": + return ((years * 12 + months) > 0 ? (years * 12 + months) : 1) + ""; + case "日": + return (ChronoUnit.DAYS.between(startDate, endDate)) + ""; + default: + return "1"; + } + } + // 账单日落在合同期内,计算期数 + switch (payWay) { + case "年": + return ""; + case "季": + long monthsBetweenQ = ChronoUnit.MONTHS.between(startDate, billLocalDate); + return ((monthsBetweenQ / 3) + 1) + "" ; + case "月": + long monthsBetween = ChronoUnit.MONTHS.between(startDate, billLocalDate); + return (monthsBetween + 1 ) + ""; + case "日": + long daysBetween = ChronoUnit.DAYS.between(startDate, billLocalDate); + return (daysBetween + 1) + ""; + default: + return "1"; + } + } + + private String toStr(Object obj) { + return obj == null ? "" : obj.toString().trim(); + } + + private int parseInt(Object obj) { + if (obj == null) return 0; + try { + return Integer.parseInt(obj.toString().trim()); + } catch (NumberFormatException e) { + return 0; + } + } + + public OaContractVo queryContractDetail(JSONObject params) throws Exception { + List conditions = buildConditions(params); + FormColumn formColumn = formDataOperator.queryOneRowFormData(getFormNo(),true, null, conditions); + if(formColumn == null) { + return new OaContractVo(); + } + Map dataMap = formColumn.getFieldsMap(); + OaContractVo oaContractVo = new OaContractVo(); + fillVo(dataMap,oaContractVo); + Long id = Long.parseLong((String)dataMap.get("id")); + List subConditions = new ArrayList<>(); + subConditions.add(FormWhereCondition.build().display("formmain_id").value(id)); + List subDatas = formDataOperator.pageQuerySubFormDatas(getFormNo(), "租赁资产明细", true, null, subConditions, 1, 10); + if(subDatas.size() > 0) { + Map subOneRowData = (Map) subDatas.get(0); + String assetsNo = (String) subOneRowData.get("资产编号"); + BigDecimal unitFee = (BigDecimal) subOneRowData.get("租赁单价"); + BigDecimal rentArea = (BigDecimal)subOneRowData.get("租赁面积"); + String rentFee = unitFee != null && rentArea != null ?unitFee.multiply(rentArea).toString() : null; + JSONObject temp = new JSONObject(); + temp.put("assetsNo",assetsNo); + ContractAssetsVo assetsVo = assetsService.queryContractAssetsDetail(temp); + assetsVo.setRentFee(rentFee); + assetsVo.setFootPrint(rentArea.toString()); + List vos = new ArrayList<>(); + vos.add(assetsVo); + oaContractVo.setAssetsVos(vos); + } + return oaContractVo; + } + + public List queryContractAllAssets(String contractNo) throws Exception { + List tempConditions = new ArrayList<>(); + tempConditions.add(FormWhereCondition.build().display("合同编号").value(contractNo)); + FormColumn formColumn = formDataOperator.queryOneRowFormData(getFormNo(), true, null, tempConditions); + if(formColumn == null) { + return null; + } + String id = formColumn.getId(); + List conditions = new ArrayList<>(); + conditions.add(FormWhereCondition.build().display("formmain_id").value(id)); + List subDatas = formDataOperator.pageQuerySubFormDatas(getFormNo(), "租赁资产明细", true, null, conditions, null, null); + List assetsVos = new ArrayList<>(); + if(subDatas.size() > 0) { + for (Object subData : subDatas) { + Map subOneRowData = (Map) subData; + String assetsNo = (String) subOneRowData.get("资产编号"); + BigDecimal unitFee = (BigDecimal) subOneRowData.get("租赁单价"); + BigDecimal rentArea = (BigDecimal)subOneRowData.get("租赁面积"); + String rentFee = unitFee != null && rentArea != null ?unitFee.multiply(rentArea).toString() : null; + JSONObject temp = new JSONObject(); + temp.put("assetsNo",assetsNo); + OaAssetsVo assetsVo = assetsService.queryAssetsDetail(temp); + assetsVo.setRentFee(rentFee); + assetsVo.setFootPrint(rentArea.toString()); + assetsVos.add(assetsVo); + } + } + return assetsVos; + } + + public PageQueryVo pageQueryContractAssetsInfoWithFee(JSONObject params) throws Exception { + List conditions = buildConditions(params); + List subDatas = formDataOperator.pageQuerySubFormDatas(getFormNo(), "租赁资产明细", true, null, conditions, 1, 10); + PageQueryVo< ContractAssetsVo> pageQueryVo = new PageQueryVo(); + List assetsVos = new ArrayList<>(); + if(subDatas.size() > 0) { + for (Object subData : subDatas) { + Map subOneRowData = (Map) subData; + String assetsNo = (String) subOneRowData.get("资产编号"); + BigDecimal unitFee = (BigDecimal) subOneRowData.get("租赁单价"); + BigDecimal rentArea = (BigDecimal)subOneRowData.get("租赁面积"); + String rentFee = unitFee != null && rentArea != null ?unitFee.multiply(rentArea).toString() : null; + JSONObject temp = new JSONObject(); + temp.put("assetsNo",assetsNo); + ContractAssetsVo assetsVo = assetsService.queryContractAssetsDetail(temp); + assetsVo.setRentFee(rentFee); + assetsVo.setFootPrint(rentArea.toString()); + assetsVos.add(assetsVo); + } + } + Long totalCount = formDataOperator.countSubTableConditon(getFormNo(), "租赁资产明细", conditions); + pageQueryVo.setTotalCount(totalCount); + pageQueryVo.setDatas(assetsVos); + return pageQueryVo; + } + + public String getSignLink(String eFlowId) { + return signLinkService.getSignLink(eFlowId); + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/contract/OaContractVo.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/contract/OaContractVo.java new file mode 100644 index 0000000..6ad68e1 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/contract/OaContractVo.java @@ -0,0 +1,117 @@ +package com.seeyon.apps.src_rent.contract; + +import com.seeyon.apps.src_rent.assets.OaAssetsVo; +import com.seeyon.apps.src_rent.file.OaFileVo; + +import java.util.List; + +public class OaContractVo { + private String formId; //表单ID + private String contractNo; //合同编号 + private String contractName; //合同名称 + private String signStatus; //签订状态 + private String startDate; //开始日期 + private String endDate; //开始日期 + private OaFileVo eContractFile; //电子合同文件 + private String eContractFlowId; //电子合同签署流程ID + private String contractStartTime; //合同开始时间 + private String contractEndTime; //合同结束时间 + private List assetsVos; //资产信息 + private String cusNo; //客商编码 + + public String getContractNo() { + return contractNo; + } + + public void setContractNo(String contractNo) { + this.contractNo = contractNo; + } + + public String getContractName() { + return contractName; + } + + public void setContractName(String contractName) { + this.contractName = contractName; + } + + public String getSignStatus() { + return signStatus; + } + + public void setSignStatus(String signStatus) { + this.signStatus = signStatus; + } + + public List getAssetsVos() { + return assetsVos; + } + + public void setAssetsVos(List assetsVos) { + this.assetsVos = assetsVos; + } + + public OaFileVo geteContractFile() { + return eContractFile; + } + + public void seteContractFile(OaFileVo eContractFile) { + this.eContractFile = eContractFile; + } + + public String getCusNo() { + return cusNo; + } + + public void setCusNo(String cusNo) { + this.cusNo = cusNo; + } + + public String geteContractFlowId() { + return eContractFlowId; + } + + public void seteContractFlowId(String eContractFlowId) { + this.eContractFlowId = eContractFlowId; + } + + public String getFormId() { + return formId; + } + + public void setFormId(String formId) { + this.formId = formId; + } + + public String getContractStartTime() { + return contractStartTime; + } + + public void setContractStartTime(String contractStartTime) { + this.contractStartTime = contractStartTime; + } + + public String getContractEndTime() { + return contractEndTime; + } + + public void setContractEndTime(String contractEndTime) { + this.contractEndTime = contractEndTime; + } + + public String getStartDate() { + return startDate; + } + + public void setStartDate(String startDate) { + this.startDate = startDate; + } + + public String getEndDate() { + return endDate; + } + + public void setEndDate(String endDate) { + this.endDate = endDate; + } +} \ No newline at end of file diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/controller/EsignCallBackController.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/controller/EsignCallBackController.java new file mode 100644 index 0000000..4c6544f --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/controller/EsignCallBackController.java @@ -0,0 +1,89 @@ +package com.seeyon.apps.src_rent.controller; + +import cn.hutool.log.Log; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.seeyon.apps.src_rent.message.MessageVo; +import com.seeyon.apps.src_rent.message.ThirdMessageService; +import com.seeyon.apps.src_rent.po.EsignCallbackParams; +import com.seeyon.apps.src_rent.service.EsignByUploadFileService; +import com.seeyon.apps.src_rent.service.EsignCallbackBizService; +import com.seeyon.apps.src_rent.service.SignLinkService; +import com.seeyon.ctp.common.AppContext; +import com.seeyon.ctp.common.controller.BaseController; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.BufferedReader; +import java.io.OutputStream; +import java.nio.charset.StandardCharsets; +import java.util.Map; + + +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"); + + public void callback(HttpServletRequest request, HttpServletResponse response) { + try { + log.info("签署回调触发"); + // 签署回调处理,改变超级节点状态 + String formId = request.getParameter("formId"); + String tableName = request.getParameter("tablename"); + String updatefield = request.getParameter("updatefield"); + String statusfield = request.getParameter("statusfield"); + BufferedReader reader = request.getReader(); + StringBuilder sb = new StringBuilder(); + String line; + while ((line = reader.readLine()) != null) { + sb.append(line); + } + String body = sb.toString(); + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + EsignCallbackParams callbackParams = mapper.readValue(body, new TypeReference() { + }); + String flowId = callbackParams.getSignFlowId(); + String action = callbackParams.getAction(); + log.info("签署回调当前流程: " + flowId); + if(action.equals("SIGN_FLOW_COMPLETE")) { + if(callbackParams.getSignFlowStatus() == 2) { + Map 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()); + } + signLinkService.del(flowId); + response.setStatus(HttpServletResponse.SC_OK); + return; + }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(); + } + //下载合同 + response.setContentType("application/json;charset=UTF-8"); + response.setCharacterEncoding("UTF-8"); + response.setStatus(HttpServletResponse.SC_OK); + try (OutputStream out = response.getOutputStream()) { + out.write("{\"code\":\"200\",\"msg\":\"success\"}".getBytes(StandardCharsets.UTF_8)); + out.flush(); + } + log.info("回调处理完成: " + flowId); + return; + } catch (Exception e) { + log.error("回调处理失败", e); + } +// response.setStatus(HttpServletResponse.SC_OK); + response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/cus/Customer.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/cus/Customer.java new file mode 100644 index 0000000..2552634 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/cus/Customer.java @@ -0,0 +1,76 @@ +package com.seeyon.apps.src_rent.cus; + +public class Customer { + private String id; + private String cusName; + private String cusPhone; + private String cardNo; + private String cusNo; + private String orgNo; + private String orgManagerName; + private int isOrg = 0; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getCusName() { + return cusName; + } + + public void setCusName(String cusName) { + this.cusName = cusName; + } + + public String getCusPhone() { + return cusPhone; + } + + public void setCusPhone(String cusPhone) { + this.cusPhone = cusPhone; + } + + public String getCardNo() { + return cardNo; + } + + public void setCardNo(String cardNo) { + this.cardNo = cardNo; + } + + public String getCusNo() { + return cusNo; + } + + public void setCusNo(String cusNo) { + this.cusNo = cusNo; + } + + public String getOrgManagerName() { + return orgManagerName; + } + + public void setOrgManagerName(String orgManagerName) { + this.orgManagerName = orgManagerName; + } + + public String getOrgNo() { + return orgNo; + } + + public void setOrgNo(String orgNo) { + this.orgNo = orgNo; + } + + public int getIsOrg() { + return isOrg; + } + + public void setIsOrg(int isOrg) { + this.isOrg = isOrg; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/cus/CustomerService.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/cus/CustomerService.java new file mode 100644 index 0000000..e9af2bd --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/cus/CustomerService.java @@ -0,0 +1,77 @@ +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.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 String getFormNo() { + return configProvider.getBizConfigByKey(RentConstants.CUSDOCFORMNO); + } + + public String matchCusPerson(Customer customer) throws Exception { + String phone = customer.getCusPhone(); + List conditions = new ArrayList<>(); + conditions.add(FormWhereCondition.build().display("联系电话").value(phone).clauseFactor(ClauseFactor.EQ)); + conditions.add(FormWhereCondition.build().display("承租方类型").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"承租方类型","个人"))); + List formColumnList = formDataOperator.queryFormDataCondition(getFormNo(), null, conditions); + if(formColumnList != null && formColumnList.size() > 0){ + Map fieldsMap = formColumnList.get(0).getFieldsMap(); + return (String)fieldsMap.get("客商编号"); + } + return null; + } + + public String matchCusOrg(Customer customer) throws BusinessException { + String orgNo = customer.getOrgNo(); + List conditions = new ArrayList<>(); + conditions.add(FormWhereCondition.build().display("社会信用代码").value(orgNo).clauseFactor(ClauseFactor.EQ)); + List formColumnList = formDataOperator.queryFormDataCondition(getFormNo(), null, conditions); + if(formColumnList != null && formColumnList.size() > 0){ + Map fieldsMap = formColumnList.get(0).getFieldsMap(); + return (String)fieldsMap.get("客商编码"); + } + return null; + } + + private String getStringValue(Map fieldsMap,String key) { + Object o = fieldsMap.get(key); + if(o == null) { + return null; + } + return o + ""; + } + + public Customer getCustomerInfo(String cusNo) throws BusinessException { + List conditions = new ArrayList<>(); + conditions.add(FormWhereCondition.build().display("客商编号").value(cusNo).clauseFactor(ClauseFactor.EQ)); + List formColumnList = formDataOperator.queryFormDataCondition(getFormNo(), null, conditions); + if(formColumnList != null && formColumnList.size() > 0){ + Map fieldsMap = formColumnList.get(0).getFieldsMap(); + Customer customer = new Customer(); + customer.setCusName(getStringValue(fieldsMap,"客商名称")); + customer.setCusNo(getStringValue(fieldsMap,"客商编码")); + customer.setCusPhone(getStringValue(fieldsMap,"客商联系人电话")); + customer.setOrgManagerName(getStringValue(fieldsMap,"客商联系人")); + customer.setOrgNo(getStringValue(fieldsMap,"社会信用代码")); + customer.setIsOrg(StringUtils.isNotEmpty(customer.getOrgNo()) ? 1 : 0); + return customer; + } + return null; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/discharge/DisCharegeService.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/discharge/DisCharegeService.java new file mode 100644 index 0000000..e77f7fd --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/discharge/DisCharegeService.java @@ -0,0 +1,126 @@ +package com.seeyon.apps.src_rent.discharge; + +import com.alibaba.fastjson.JSONObject; +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.ContractService; +import com.seeyon.apps.src_rent.flow.FlowCreateService; +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.cap4.form.api.FormApi4Cap4; +import com.seeyon.cap4.form.bean.FormBean; +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 String getFormNo() { + return configProvider.getBizConfigByKey(RentConstants.DISCHARGE_FORMNO); + } + + private String getStringValue(Map fieldsMap,String key) { + Object o = fieldsMap.get(key); + if(o == null) { + return null; + } + return o + ""; + } + + public PageQueryVo pageQuery(JSONObject params) throws Exception { + List conditions = buildConditions(params); + Integer pageNo = params.getInteger("pageNo") == null ? 1 : params.getInteger("pageNo"); + Integer pageSize = params.getInteger("pageSize") == null ? 10 : params.getInteger("pageSize"); + List queryColumnVos = new ArrayList<>(); + PageQueryVo pageQueryVo = new PageQueryVo(); + List vos = new ArrayList<>(); + List datas = formDataOperator.queryFormDataPageCondition(getFormNo(), true,queryColumnVos, conditions, pageNo, pageSize); + Long count = formDataOperator.countConditon(getFormNo(), conditions); + if(datas.size() > 0){ + for (Object data : datas) { + Map map = (Map) data; + DisChargeRecordVo vo = new DisChargeRecordVo(); + fillVo(map,vo); + vos.add(vo); + } + pageQueryVo.setDatas(vos); + pageQueryVo.setTotalCount(count); + } + return pageQueryVo; + } + + public void saveApplay(JSONObject params) throws Exception { + FormApi4Cap4 formApi4Cap4 = (FormApi4Cap4) AppContext.getBean("formApi4Cap4"); + FormBean cap4FormBean = formApi4Cap4.getFormByFormCode(getFormNo()); + FormTableBean masterTableBean = cap4FormBean.getMasterTableBean(); + String tableName = masterTableBean.getTableName(); + List subTableBean = cap4FormBean.getSubTableBean(); + String subDbTableName = null; + for (FormTableBean formTableBean : subTableBean) { + if("租赁资产".equals(formTableBean.getTableName())){ + subDbTableName = formTableBean.getDbTableName(); + } + } + Map mainFormData = new HashMap<>(); + Map> subFormDataMap = new HashMap<>(); + List subFormDataList = new ArrayList<>(); + Map data = new HashMap<>(); + subFormDataMap.put(subDbTableName,subFormDataList); + String templateCode = configProvider.getBizConfigByKey(RentConstants.DISCHARGE_TEMPLATECODE); + String appName = configProvider.getBizConfigByKey(RentConstants.FORMAPPNAME); + mainFormData.put(tableName,data); + String contractNo = params.getString("contractNo"); + List assetsNoList = (List) params.get("assetsNoList"); + Set assetsNoSet = assetsNoList.stream().collect(Collectors.toSet()); + List oaAssetsVos = contractService.queryContractAllAssets(contractNo); + oaAssetsVos.forEach(oaAssetsVo -> { + if(assetsNoSet.contains(oaAssetsVo.getAssetsNo())){ + Map 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")); + flowCreateService.flowStart("退租申请",mainFormData,subFormDataMap,appName,templateCode); + } + + public void fillVo(Map fieldsMap,DisChargeRecordVo vo) throws BusinessException { + vo.setContractName(getStringValue(fieldsMap,"合同名称")); + vo.setId(getStringValue(fieldsMap,"id")); + vo.setRemark(getStringValue(fieldsMap,"审批意见")); + vo.setStatus(getStringValue(fieldsMap,"退租申请状态")); + } + + private List buildConditions(JSONObject params) { + List conditions = new ArrayList<>(); + if(StringUtils.isNotBlank(params.getString("cusNo"))) { + conditions.add(FormWhereCondition.build().display("承租方编号").value(params.getString("cusNo"))); + } + return conditions; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/discharge/DisChargeRecordVo.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/discharge/DisChargeRecordVo.java new file mode 100644 index 0000000..03e220b --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/discharge/DisChargeRecordVo.java @@ -0,0 +1,58 @@ +package com.seeyon.apps.src_rent.discharge; + +public class DisChargeRecordVo { + private String contractName; + private String dischargeItem; + private String id; + private String status; + private String applyDate; + private String remark; + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getApplyDate() { + return applyDate; + } + + public void setApplyDate(String applyDate) { + this.applyDate = applyDate; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getContractName() { + return contractName; + } + + public void setContractName(String contractName) { + this.contractName = contractName; + } + + public String getDischargeItem() { + return dischargeItem; + } + + public void setDischargeItem(String dischargeItem) { + this.dischargeItem = dischargeItem; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/fallback/FallbackService.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/fallback/FallbackService.java new file mode 100644 index 0000000..ffebfb8 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/fallback/FallbackService.java @@ -0,0 +1,109 @@ +package com.seeyon.apps.src_rent.fallback; + +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.flow.FlowCreateService; +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.po.PageQueryVo; +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 String getFormNo() { + return configProvider.getBizConfigByKey(RentConstants.FALLBACK_FORMNO); + } + + public PageQueryVo pageQuery(JSONObject params) throws Exception { + List conditions = buildConditions(params); + Integer pageNo = params.getInteger("pageNo") == null ? 1 : params.getInteger("pageNo"); + Integer pageSize = params.getInteger("pageSize") == null ? 10 : params.getInteger("pageSize"); + PageQueryVo pageQueryVo = new PageQueryVo(); + List datas = formDataOperator.queryFormDataPageCondition(getFormNo(), true,null, conditions, pageNo, pageSize); + List vos = new ArrayList<>(); + Long count = formDataOperator.countConditon(getFormNo(), conditions); + if(datas.size() > 0) { + for (Object data : datas) { + FallbackVo fallbackVo = new FallbackVo(); + Map dataMap = (Map) data; + fillVo(dataMap,fallbackVo); + vos.add(fallbackVo); + } + } + pageQueryVo.setDatas(vos); + pageQueryVo.setTotalCount(count); + return pageQueryVo; + } + + public FallbackVo detail(JSONObject params) throws Exception { + List conditions = buildConditions(params); + FormColumn formColumn = formDataOperator.queryOneRowFormData(getFormNo(), true, null, conditions); + Map fieldsMap = formColumn.getFieldsMap(); + FallbackVo fallbackVo = new FallbackVo(); + fillVo(fieldsMap,fallbackVo); + return fallbackVo; + } + + public void saveFallback(JSONObject params) throws Exception { + DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Map mainFormData = new HashMap<>(); + 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("content")); + mainFormData.put("留言日期", df.format(new Date())); + mainFormData.put("处理状态", EnumMapUtils.getMasterTableEnumItemValue(getFormNo(), "处理状态", "未处理")); + String docNo = "weChat_" + UUID.randomUUID().toString().replace("-",""); + mainFormData.put("档案编号",docNo); + String loginName = configProvider.getBizConfigByKey(RentConstants.formLoginName); + formDataOperator.insertFormData(loginName,getFormNo(),mainFormData,null); + } + + private String getStringValue(Map fieldsMap,String key) { + Object o = fieldsMap.get(key); + if(o == null) { + return null; + } + return o + ""; + } + + private List buildConditions(JSONObject params) { + List conditions = new ArrayList<>(); + if(StringUtils.isNotBlank(params.getString("cusNo"))){ + conditions.add(FormWhereCondition.build().display("承租方编号").value(params.getString("cusNo"))); + } + if(StringUtils.isNotBlank(params.getString("id"))){ + conditions.add(FormWhereCondition.build().display("id").value(params.getString("id"))); + } + return conditions; + } + + private void fillVo(Map fieldMap, FallbackVo vo) { + vo.setId(getStringValue(fieldMap,"id")); + vo.setContent(getStringValue(fieldMap,"留言内容")); + vo.setStatus(getStringValue(fieldMap,"处理状态")); + vo.setComment(getStringValue(fieldMap,"处理意见")); + vo.setSummitDate(getStringValue(fieldMap,"留言日期")); + if(StringUtils.isNotBlank(vo.getComment())) { + vo.setHandleDate(getStringValue(fieldMap,"modify_date")); + } + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/fallback/FallbackVo.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/fallback/FallbackVo.java new file mode 100644 index 0000000..3de8928 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/fallback/FallbackVo.java @@ -0,0 +1,58 @@ +package com.seeyon.apps.src_rent.fallback; + +public class FallbackVo { + private String id; + private String content; + private String status; + private String comment; + private String summitDate; + private String handleDate; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getComment() { + return comment; + } + + public void setComment(String comment) { + this.comment = comment; + } + + public String getSummitDate() { + return summitDate; + } + + public void setSummitDate(String summitDate) { + this.summitDate = summitDate; + } + + public String getHandleDate() { + return handleDate; + } + + public void setHandleDate(String handleDate) { + this.handleDate = handleDate; + } +} \ No newline at end of file diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/fieldCtrl/ContractCompareFieldCtrl.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/fieldCtrl/ContractCompareFieldCtrl.java new file mode 100644 index 0000000..0f06318 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/fieldCtrl/ContractCompareFieldCtrl.java @@ -0,0 +1,62 @@ +package com.seeyon.apps.src_rent.fieldCtrl; + +import com.seeyon.cap4.form.bean.ParamDefinition; +import com.seeyon.cap4.form.bean.fieldCtrl.FormFieldCustomCtrl; +import com.seeyon.cap4.form.util.Enums; +import org.springframework.stereotype.Component; + +//@Component +public class ContractCompareFieldCtrl extends FormFieldCustomCtrl { + @Override + public String getPCInjectionInfo() { + return "{path:'apps_res/cap/customCtrlResources/esignContractCompareBtnResources',jsUri:'/js/compareinit.js',initMethod:'init',nameSpace:'" + getNameSpace() + "'}"; + } + + @Override + public String getMBInjectionInfo() { + return "{path:'http://mapResource.v5.cmp/v1.0.0/',weixinpath:'invoice',jsUri:'js/location.js',initMethod:'init',nameSpace:'"+getNameSpace()+"'}"; + } + + @Override + public String getKey() { + return "8899554679928334458"; + } + + @Override + public boolean canUse(Enums.FormType formType) { + return true; + } + + @Override + public String[] getDefaultVal(String s) { + return new String[0]; + } + + public String getNameSpace() { + return "field_" + this.getKey(); + } + + public String getFieldLength() { + return "20"; + } + @Override + public String getText() { + return "e签宝合同比对按钮"; + } + + /** + * 控件初始化接口,此接口在控件初始化的时候,会调用,主要用于定义控件所属插件id、在表单编辑器中的图标、表单编辑器中有哪些属性可以设置。 + * 使用举例:在接口中定义自定义控件在在表单编辑器中有哪些控件属性需要配置 + */ + @Override + public void init() { + //设置图标和插件ID + setPluginId("src_esign"); + setIcon("cap-icon-custom-button"); + // 自定义参数 + + ParamDefinition esignContractCompareBtnParam = new ParamDefinition(); + esignContractCompareBtnParam.setParamType(Enums.ParamType.button); + addDefinition(esignContractCompareBtnParam); + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/file/FileHandlerService.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/file/FileHandlerService.java new file mode 100644 index 0000000..553e418 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/file/FileHandlerService.java @@ -0,0 +1,48 @@ +package com.seeyon.apps.src_rent.file; + +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; + try { + Attachment attachment = attachmentManager.getAttachmentByFileURL(Long.valueOf(refId)); + InputStream inputStream = fileManager.getFileInputStream(attachment.getFileUrl()); + String encodedFileName = URLEncoder.encode(attachment.getFilename(), "UTF-8") + .replaceAll("\\+", "%20"); + response.setHeader( + "Content-Disposition", + "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) { + + } + }finally { + if(file != null) { + file.delete(); + } + } + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/file/OaFileVo.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/file/OaFileVo.java new file mode 100644 index 0000000..b1e55b0 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/file/OaFileVo.java @@ -0,0 +1,42 @@ +package com.seeyon.apps.src_rent.file; + +import com.seeyon.ctp.common.filemanager.manager.AttachmentManager; + +import java.util.ArrayList; +import java.util.List; + +public class OaFileVo { + private String mainRefId; + private List subRefIds; + + public List getSubRefIds() { + return subRefIds; + } + + public void setSubRefIds(List subRefIds) { + this.subRefIds = subRefIds; + } + + public String getMainRefId() { + return mainRefId; + } + + public void setMainRefId(String mainRefId) { + this.mainRefId = mainRefId; + } + + public static OaFileVo getInstance(Long refId, AttachmentManager attachmentManager) { + if(refId == null) { + return null; + } + OaFileVo oaFileVo = new OaFileVo(); + List subRefIds = new ArrayList<>(); + List fileUrls = attachmentManager.getBySubReference(refId); + oaFileVo.setMainRefId(refId + ""); + for (Long fileUrl : fileUrls) { + subRefIds.add(fileUrl + ""); + } + oaFileVo.setSubRefIds(subRefIds); + return oaFileVo; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/flow/FlowCreateService.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/flow/FlowCreateService.java new file mode 100644 index 0000000..572fec2 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/flow/FlowCreateService.java @@ -0,0 +1,45 @@ +package com.seeyon.apps.src_rent.flow; + +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 java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Component +public class FlowCreateService { + + @Autowired + private RentConfigProvider configProvider; + + public void flowStart(String flowName,Map mainFormData, Map> subFormDatas,String appName,String templateCode) throws Exception { + OaRestClient client = new OaRestClient(configProvider.getBizConfigByKey(RentConstants.OA_HOST), + configProvider.getBizConfigByKey(RentConstants.restName), + configProvider.getBizConfigByKey(RentConstants.restPwd)); + String url = "/bpm/process/start"; + Map params = new HashMap<>(); + Map datas = new HashMap<>(); + Map formDatas = new HashMap<>(); + params.put("appName",appName); + params.put("data",datas); + datas.put("templateCode",templateCode); + datas.put("draft","0"); + datas.put("data",formDatas); + for (String key : mainFormData.keySet()) { + formDatas.put(key,mainFormData.get(key)); + } + for (String key : subFormDatas.keySet()) { + formDatas.put(key,subFormDatas.get(key)); + } + OaResp oaResp = client.sendPost(flowName, url, params); + if(oaResp.getCode() != 0) { + throw new Exception(flowName + "流程发起失败:" + oaResp.getMessage()); + } + } + +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/ClauseFactor.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/ClauseFactor.java new file mode 100644 index 0000000..c28386f --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/ClauseFactor.java @@ -0,0 +1,20 @@ +package com.seeyon.apps.src_rent.form; + +public enum ClauseFactor { + NEQ,//不相等 + EQ, //相等 + GT, //大于 + GE, //大于等于 + LT, //小于 + LE, //小于等于 + NULL, //空 + NOT_NULL, //非空 + LIKE, //模糊 + AND, + OR + ; + + public boolean isNullType() { + return this == NULL || this == NOT_NULL; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/EnumMapUtils.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/EnumMapUtils.java new file mode 100644 index 0000000..27b48de --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/EnumMapUtils.java @@ -0,0 +1,134 @@ +package com.seeyon.apps.src_rent.form; + +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.ctpenumnew.manager.EnumManager; +import com.seeyon.ctp.common.exceptions.BusinessException; +import com.seeyon.ctp.common.po.ctpenumnew.CtpEnumBean; +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; + +public class EnumMapUtils { + + public static String getMasterTableEnumItemValue(String formNo,String fieldDisplay, String targetValue) { + if(targetValue == null || "null".equals(targetValue) || "".equals(targetValue)){ + return ""; + } + 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 ""; + } + return getEnumItemValueByEnumId(targetValue, beanByDisplay.getEnumId()); + } catch (Exception e) { + return ""; + } + } + + public static String getEnumItemIdByGroupNameAndItemShowValue(String enumGroupName, String targetValue) { + String sql = "SELECT * FROM ctp_enum ce let join ctp_enum_item cei on ce.`ID` = cei.REF_ENUMID where ce.`ENUMNAME` = ? and CEI.`SHOWVALUE` = ?"; + if(StringUtils.isAnyBlank(enumGroupName, targetValue)){ + return ""; + } + Long enumId = null; + JDBCAgent agent = new JDBCAgent(); + try { + agent.execute(sql, Arrays.asList(enumGroupName,targetValue)); + List> list = (List>) agent.resultSetToList(); + if(list == null || list.size() == 0) { + return ""; + } + Map map = list.get(0); + enumId = (Long)map.get("ID"); + return enumId == null ? "" : enumId + ""; + } catch (Exception e) { + + }finally { + agent.close(); + } + return ""; + } + + + public static String getEnumItemValue(String rootPCode, String groupValue, String targetValue) { + if(targetValue == null || "null".equals(targetValue) || "".equals(targetValue)){ + return ""; + } + String queryIdSql = "SELECT ce.ID FROM ctp_enum ce inner join ctp_enum cei on ce.`PARENT_ID` = cei.ID where CEI.`PROGRAM_CODE` = ? and ce.`ENUMNAME` = ?"; + Long enumId = null; + JDBCAgent agent = new JDBCAgent(); + try { + agent.execute(queryIdSql, Arrays.asList(rootPCode,groupValue)); + List> list = (List>) agent.resultSetToList(); + if(list == null || list.size() == 0) { + return ""; + } + Map map = list.get(0); + enumId = (Long)map.get("ID"); + } catch (Exception e) { + return ""; + }finally { + agent.close(); + } + EnumManager enumManagerNew = (EnumManager) AppContext.getBean("enumManagerNew"); + CtpEnumBean ctpEnumBean = enumManagerNew.getEnum(enumId); + if(ctpEnumBean == null) { + return ""; + } + List ctpEnumItems = ctpEnumBean.getItems(); + if(ctpEnumBean.getItems() == null) { + return ""; + } + for (CtpEnumItem enumItem : ctpEnumItems) { + if(enumItem.getShowvalue().equals(targetValue)) { + return enumItem.getId() + ""; + } + } + return ""; + } + + public static String getEnumItemValueByEnumId(String showValue,long enumId) { + EnumManager enumManagerNew = (EnumManager) AppContext.getBean("enumManagerNew"); + CtpEnumBean ctpEnumBean = enumManagerNew.getEnum(enumId); + if(ctpEnumBean == null) { + return ""; + } + List ctpEnumItems = ctpEnumBean.getItems(); + if(ctpEnumBean.getItems() == null) { + return ""; + } + for (CtpEnumItem enumItem : ctpEnumItems) { + if(enumItem.getShowvalue().equals(showValue)) { + return enumItem.getId() + ""; + } + } + return ""; + } + + public static String getEnumShowValue(Object enumItemId) throws BusinessException { + if(enumItemId == null) { + return ""; + } + Long temp = enumItemId instanceof Long ? (Long)enumItemId : (enumItemId instanceof String ? Long.parseLong((String)enumItemId) : null); + if(temp == null) { + return ""; + } + EnumManager enumManagerNew = (EnumManager) AppContext.getBean("enumManagerNew"); + CtpEnumItem ctpEnumItem = enumManagerNew.getCtpEnumItem(temp); + if(ctpEnumItem == null) { + return ""; + } + return ctpEnumItem.getShowvalue(); + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/FormColumn.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/FormColumn.java new file mode 100644 index 0000000..5cc728e --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/FormColumn.java @@ -0,0 +1,33 @@ +package com.seeyon.apps.src_rent.form; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class FormColumn { + private String id; + private List vos; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public List getVos() { + return vos; + } + + public void setVos(List vos) { + this.vos = vos; + } + + public Map getFieldsMap() { + Map map = new HashMap<>(); + vos.forEach(vo -> map.put(vo.getDisplayName(),vo.getValue())); + map.put("id",id); + return map; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/FormDataOperator.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/FormDataOperator.java new file mode 100644 index 0000000..83ef6cd --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/FormDataOperator.java @@ -0,0 +1,1081 @@ +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.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); + private FormFactory formFactory = (FormFactory) AppContext.getBean("formFactory"); + + public void updateMasterForm(String formNo, List updateFieldVos, List conditionVos) throws BusinessException { + FormApi4Cap4 formApi4Cap4 = (FormApi4Cap4) AppContext.getBean("formApi4Cap4"); + FormBean cap4FormBean = formApi4Cap4.getFormByFormCode(formNo); + FormTableBean masterTableBean = cap4FormBean.getMasterTableBean(); + + if (updateFieldVos == null) { + throw new IllegalArgumentException("要修改的字段为空"); + } + for (FormUpdateField fieldVo : updateFieldVos) { + FormFieldBean bean = masterTableBean.getFieldBeanByDisplay(fieldVo.getDisplay()); + if (bean == null) { + continue; + } + if(bean.getInputType().equals("image") || bean.getInputType().equals("attachment")){} + fieldVo.fieldName(bean.getColumnName()); + } + List updateFields = updateFieldVos.stream().filter(u -> u.getFieldName() != null).collect(Collectors.toList()); + for (FormWhereCondition conditionVo : conditionVos) { + FormFieldBean bean = masterTableBean.getFieldBeanByDisplay(conditionVo.getDisplay()); + if (bean == null) { + if (conditionVo.getDisplay().equals("ID") || conditionVo.getDisplay().equals("id")) { + conditionVo.setFieldName("ID"); + } + continue; + } + conditionVo.setFieldName(bean.getColumnName()); + } + List conditions = conditionVos.stream().filter(c -> c.getFieldName() != null).collect(Collectors.toList()); + Map map = generateUpdateSql(updateFields, masterTableBean.getTableName(), conditions); + JDBCAgent agent = new JDBCAgent(); + try { + agent.execute((String) map.get("sql"), (List) map.get("params")); + } catch (Exception e) { + log.error(e.getMessage()); + } finally { + agent.close(); + } + } + + public void updateMasterForm(List updateFields,String tableName, List conditionVos) throws BusinessException { + if (updateFields == null) { + throw new IllegalArgumentException("要修改的字段为空"); + } + List conditions = conditionVos.stream().filter(c -> c.getFieldName() != null).collect(Collectors.toList()); + Map map = generateUpdateSql(updateFields, tableName, conditions); + JDBCAgent agent = new JDBCAgent(); + try { + agent.execute((String) map.get("sql"), (List) map.get("params")); + log.info("sql: " + map.get("sql") + " 更新表单执行成功"); + } catch (Exception e) { + log.error(e.getMessage(),e); + } finally { + agent.close(); + } + } + + public void deleteByCondition(String formNo, List conditionVos) throws Exception { + FormApi4Cap4 formApi4Cap4 = (FormApi4Cap4) AppContext.getBean("formApi4Cap4"); + FormBean cap4FormBean = formApi4Cap4.getFormByFormCode(formNo); + FormTableBean masterTableBean = cap4FormBean.getMasterTableBean(); + String tableName = masterTableBean.getTableName(); + 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 generateSql = generateDelSql(conditionVos, tableName); + String sql = (String) generateSql.get("sql"); + List params = (List) generateSql.get("params"); + JDBCAgent jdbcAgent = new JDBCAgent(); + try { + jdbcAgent.execute(sql, params); + } catch (Exception e) { + log.error(e.getMessage(),e); + } finally { + jdbcAgent.close(); + } + } + + public FormColumn queryOneRowFormData(String formNo,Boolean changeEnum ,List queryColumnVos, List conditionVos) throws Exception { + FormApi4Cap4 formApi4Cap4 = (FormApi4Cap4) AppContext.getBean("formApi4Cap4"); + FormBean cap4FormBean = formApi4Cap4.getFormByFormCode(formNo); + List queryColumns = new ArrayList<>(); + FormTableBean masterTableBean = cap4FormBean.getMasterTableBean(); + String tableName = masterTableBean.getTableName(); + Map fieldMap4Name = masterTableBean.getFieldMap4Name(); + if (queryColumnVos != null) { + for (String queryColumnVo : queryColumnVos) { + FormFieldBean fieldBeanByDisplay = masterTableBean.getFieldBeanByDisplay(queryColumnVo); + if (fieldBeanByDisplay == null) { + continue; + } + queryColumns.add(fieldBeanByDisplay.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 generateSql = generateSql(queryColumns, conditionVos, tableName); + String sql = (String) generateSql.get("sql"); + List params = (List) generateSql.get("params"); + JDBCAgent jdbcAgent = new JDBCAgent(); + List columns = new ArrayList<>(); + try { + jdbcAgent.execute(sql, params); + List list = jdbcAgent.resultSetToList(); + for (Object o : list) { + FormColumn column = new FormColumn(); + Map columnMap = (Map) o; + List 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 && fieldBean.isEnumField()){ + //转换枚举值 + fieldVo.setValue(EnumMapUtils.getEnumShowValue(fieldVo.getValue())); + } + vos.add(fieldVo); + } + } + column.setVos(vos); + if (columnMap.get("id") != null) { + column.setId(columnMap.get("id") + ""); + } + columns.add(column); + } + return columns.size() > 0 ? columns.get(0) : null; + } catch (Exception e) { + log.error(e.getMessage(),e); + } finally { + jdbcAgent.close(); + } + return null; + } + + public List queryFormDataCondition(String formNo, List queryColumnVos, List conditionVos) throws BusinessException { + FormApi4Cap4 formApi4Cap4 = (FormApi4Cap4) AppContext.getBean("formApi4Cap4"); + FormBean cap4FormBean = formApi4Cap4.getFormByFormCode(formNo); + List queryColumns = new ArrayList<>(); + FormTableBean masterTableBean = cap4FormBean.getMasterTableBean(); + String tableName = masterTableBean.getTableName(); + Map fieldMap4Name = masterTableBean.getFieldMap4Name(); + if (queryColumnVos != null) { + for (String queryColumnVo : queryColumnVos) { + FormFieldBean fieldBeanByDisplay = masterTableBean.getFieldBeanByDisplay(queryColumnVo); + if (fieldBeanByDisplay == null) { + continue; + } + queryColumns.add(fieldBeanByDisplay.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 generateSql = generateSql(queryColumns, conditionVos, tableName); + String sql = (String) generateSql.get("sql"); + List params = (List) generateSql.get("params"); + log.info("sql为: " + sql); + log.info("参数为: " + JsonUtils.toJSONString(params)); + JDBCAgent jdbcAgent = new JDBCAgent(); + List columns = new ArrayList<>(); + try { + jdbcAgent.execute(sql, params); + List list = jdbcAgent.resultSetToList(); + for (Object o : list) { + FormColumn column = new FormColumn(); + Map columnMap = (Map) o; + List 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)); + vos.add(fieldVo); + } + } + column.setVos(vos); + if (columnMap.get("id") != null) { + column.setId(columnMap.get("id") + ""); + } + columns.add(column); + } + return columns; + } catch (Exception e) { + log.error(e.getMessage(),e); + } finally { + jdbcAgent.close(); + } + return null; + } + + public Long countSubTableConditon(String formNo,String subTableName,List conditionVos) throws BusinessException{ + FormApi4Cap4 formApi4Cap4 = (FormApi4Cap4) AppContext.getBean("formApi4Cap4"); + FormBean cap4FormBean = formApi4Cap4.getFormByFormCode(formNo); + List subTableBeans = cap4FormBean.getSubTableBean(); + String tableName = null; + Map fieldMap4Name = null; + for (FormTableBean subTableBean : subTableBeans) { + if(subTableBean.getDisplay().equals(subTableName)) { + tableName = subTableBean.getTableName(); + for (FormWhereCondition conditionVo : conditionVos) { + FormFieldBean fieldBeanByDisplay = subTableBean.getFieldBeanByDisplay(conditionVo.getDisplay()); + if (fieldBeanByDisplay == null) { + if (conditionVo.getDisplay().equals("ID") || conditionVo.getDisplay().equals("id")) { + conditionVo.setFieldName("ID"); + } + if (conditionVo.getDisplay().equals("formmain_id") || conditionVo.getDisplay().equals("formmainId")) { + conditionVo.setFieldName("formmain_id"); + } + continue; + } + conditionVo.setFieldName(fieldBeanByDisplay.getColumnName()); + } + break; + } + } + Map generateSql = generateCountSql(null, conditionVos, tableName); + String sql = (String) generateSql.get("sql"); + List params = (List) generateSql.get("params"); + JDBCAgent jdbcAgent = new JDBCAgent(); + try { + jdbcAgent.execute(sql, params); + Map map = jdbcAgent.resultSetToMap(); + return (Long) map.get("countnum"); + } catch (Exception e) { + log.error(e.getMessage(),e); + } finally { + jdbcAgent.close(); + } + return 0l; + } + + /** + * 将 JDBC 查询单条结果转换为 FormColumn(字段映射 + 枚举转换) + * + * @param resultMap JDBC 查询结果 Map + * @param fieldMap4Name 字段名映射 columnName -> FormFieldBean + * @param changeEnum 是否需要将枚举值转换为显示值 + * @return Map fieldsMap 或 null(如果 resultMap 为空) + */ + public Map convertSingleResultToFormColumn( + Map resultMap, + Map fieldMap4Name, + boolean changeEnum) throws BusinessException { + if (resultMap == null || resultMap.isEmpty()) { + return null; + } + FormColumn column = new FormColumn(); + List vos = new ArrayList<>(); + for (Map.Entry entry : resultMap.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + if (fieldMap4Name.containsKey(key)) { + FormFieldBean fieldBean = fieldMap4Name.get(key); + + FormFieldVo fieldVo = new FormFieldVo(); + fieldVo.setDisplayName(fieldBean.getDisplay()); + + if (changeEnum && fieldBean.isEnumField() && value != null) { + fieldVo.setValue(EnumMapUtils.getEnumShowValue(value)); + } else { + fieldVo.setValue(value); + } + vos.add(fieldVo); + } + } + column.setVos(vos); + // 设置 ID + if (resultMap.get("id") != null) { + column.setId(resultMap.get("id").toString()); + } + return column.getFieldsMap(); + } + + /** + * 将 JDBC 查询结果转换为 FormColumn 列表(字段名映射 + 枚举转换) + * + * @param resultList JDBC 查询结果 list,每个元素为 Map + * @param fieldMap4Name 字段名映射 columnName -> FormFieldBean + * @param changeEnum 是否需要将枚举值转换为显示值 + * @return List> 每条记录的 fieldsMap + */ + public List> convertResultToFormColumns( + List> resultList, + Map fieldMap4Name, + boolean changeEnum) throws BusinessException { + List> columns = new ArrayList<>(); + if (resultList == null || resultList.isEmpty()) { + return columns; + } + for (Map columnMap : resultList) { + FormColumn column = new FormColumn(); + List vos = new ArrayList<>(); + for (Map.Entry entry : columnMap.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + if (fieldMap4Name.containsKey(key)) { + FormFieldBean fieldBean = fieldMap4Name.get(key); + FormFieldVo fieldVo = new FormFieldVo(); + fieldVo.setDisplayName(fieldBean.getDisplay()); + + if (changeEnum && fieldBean.isEnumField() && value != null) { + fieldVo.setValue(EnumMapUtils.getEnumShowValue(value)); + } else { + fieldVo.setValue(value); + } + vos.add(fieldVo); + } + } + column.setVos(vos); + // 设置 ID + if (columnMap.get("id") != null) { + column.setId(columnMap.get("id").toString()); + } + columns.add(column.getFieldsMap()); + } + return columns; + } + + public List queryFormDataPageCondition(String formNo,Boolean changeEnum,List queryColumnVos, List conditionVos,Integer pageNo,Integer pageSize) throws BusinessException { + FormApi4Cap4 formApi4Cap4 = (FormApi4Cap4) AppContext.getBean("formApi4Cap4"); + FormBean cap4FormBean = formApi4Cap4.getFormByFormCode(formNo); + List queryColumns = new ArrayList<>(); + FormTableBean masterTableBean = cap4FormBean.getMasterTableBean(); + String tableName = masterTableBean.getTableName(); + Map fieldMap4Name = masterTableBean.getFieldMap4Name(); + if (queryColumnVos != null) { + for (String queryColumnVo : queryColumnVos) { + FormFieldBean fieldBeanByDisplay = masterTableBean.getFieldBeanByDisplay(queryColumnVo); + if (fieldBeanByDisplay == null) { + continue; + } + queryColumns.add(fieldBeanByDisplay.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 generateSql = generatePageQuerySql(queryColumns, conditionVos, tableName,pageNo,pageSize); + String sql = (String) generateSql.get("sql"); + List params = (List) generateSql.get("params"); + log.info("sql为: " + sql); + log.info("参数为: " + JsonUtils.toJSONString(params)); + JDBCAgent jdbcAgent = new JDBCAgent(); + List columns = new ArrayList<>(); + try { + jdbcAgent.execute(sql, params); + List list = jdbcAgent.resultSetToList(); + for (Object o : list) { + FormColumn column = new FormColumn(); + Map columnMap = (Map) o; + List 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 && fieldBean.isEnumField()){ + //转换枚举值 + fieldVo.setValue(EnumMapUtils.getEnumShowValue(fieldVo.getValue())); + } + vos.add(fieldVo); + } + } + column.setVos(vos); + if (columnMap.get("id") != null) { + column.setId(columnMap.get("id") + ""); + } + Map fieldsMap = column.getFieldsMap(); + columns.add(fieldsMap); + } + + } catch (Exception e) { + log.error(e.getMessage(),e); + } finally { + jdbcAgent.close(); + } + return columns; + } + + public Long countConditon(String formNo, List conditionVos) throws BusinessException{ + FormApi4Cap4 formApi4Cap4 = (FormApi4Cap4) AppContext.getBean("formApi4Cap4"); + FormBean cap4FormBean = formApi4Cap4.getFormByFormCode(formNo); + FormTableBean masterTableBean = cap4FormBean.getMasterTableBean(); + String tableName = masterTableBean.getTableName(); + 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 generateSql = generateCountSql(null, conditionVos, tableName); + String sql = (String) generateSql.get("sql"); + List params = (List) generateSql.get("params"); + JDBCAgent jdbcAgent = new JDBCAgent(); + try { + jdbcAgent.execute(sql, params); + Map map = jdbcAgent.resultSetToMap(); + return (Long) map.get("countnum"); + } catch (Exception e) { + log.error(e.getMessage(),e); + } finally { + jdbcAgent.close(); + } + return 0l; + } + + public void insertFormData(String loginName,String formNo,Map mainFormData,List> subFormDatas) throws Exception { + FormExport formExport = new FormExport(); + FormExportUtil formExportUtil = new FormExportUtil(); + List valueExport = formExportUtil.setFormValue(mainFormData); + formExport.setValues(valueExport); + if(subFormDatas != null) { + formExport.setSubordinateForms(formExportUtil.setAllSubordinateFormValue(subFormDatas)); + } + formFactory.importBusinessFormData(loginName, formNo, + formExport, new String[] {}); + } + + + /** + * 填充子表条件字段名 + * @param subTableBean 子表表结构 + * @param queryColumnVos 查询字段显示名列表 + * @param conditionVos 查询条件列表 + * @return queryColumns 对应数据库列名列表 + */ + public List fillSubTableFieldNames(FormTableBean subTableBean, + List queryColumnVos, + List conditionVos) { + List queryColumns = new ArrayList<>(); + + // 1️⃣ 填充查询列 + if (queryColumnVos != null) { + for (String queryColumnVo : queryColumnVos) { + FormFieldBean fieldBeanByDisplay = subTableBean.getFieldBeanByDisplay(queryColumnVo); + if (fieldBeanByDisplay != null) { + queryColumns.add(fieldBeanByDisplay.getColumnName()); + } + } + } + + // 2️⃣ 填充条件列 + if (conditionVos != null) { + for (FormWhereCondition conditionVo : conditionVos) { + FormFieldBean fieldBeanByDisplay = subTableBean.getFieldBeanByDisplay(conditionVo.getDisplay()); + if (fieldBeanByDisplay != null) { + conditionVo.setFieldName(fieldBeanByDisplay.getColumnName()); + } else { + // 特殊字段处理 + String disp = conditionVo.getDisplay(); + if ("ID".equalsIgnoreCase(disp)) { + conditionVo.setFieldName("ID"); + } else if ("formmain_id".equalsIgnoreCase(disp) || "formmainId".equalsIgnoreCase(disp)) { + conditionVo.setFieldName("formmain_id"); + } else { + conditionVo.setFieldName(null); // 找不到的字段置空 + } + } + } + } + + return queryColumns; + } + + public List pageQuerySubFormDatas(String formNo,String subTableName,Boolean changeEnum ,List queryColumnVos, List conditionVos,Integer pageNo,Integer pageSize) throws BusinessException { + FormApi4Cap4 formApi4Cap4 = (FormApi4Cap4) AppContext.getBean("formApi4Cap4"); + FormBean cap4FormBean = formApi4Cap4.getFormByFormCode(formNo); + List queryColumns = new ArrayList<>(); + List subTableBeans = cap4FormBean.getSubTableBean(); + String tableName = null; + Map fieldMap4Name = null; + for (FormTableBean subTableBean : subTableBeans) { + if(subTableBean.getDisplay().equals(subTableName)) { + fieldMap4Name = subTableBean.getFieldMap4Name(); + tableName = subTableBean.getTableName(); + if (queryColumnVos != null) { + for (String queryColumnVo : queryColumnVos) { + FormFieldBean fieldBeanByDisplay = subTableBean.getFieldBeanByDisplay(queryColumnVo); + if (fieldBeanByDisplay == null) { + continue; + } + queryColumns.add(fieldBeanByDisplay.getColumnName()); + } + } + for (FormWhereCondition conditionVo : conditionVos) { + FormFieldBean fieldBeanByDisplay = subTableBean.getFieldBeanByDisplay(conditionVo.getDisplay()); + if (fieldBeanByDisplay == null) { + if (conditionVo.getDisplay().equals("ID") || conditionVo.getDisplay().equals("id")) { + conditionVo.setFieldName("ID"); + } + if (conditionVo.getDisplay().equals("formmain_id") || conditionVo.getDisplay().equals("formmainId")) { + conditionVo.setFieldName("formmain_id"); + } + continue; + } + conditionVo.setFieldName(fieldBeanByDisplay.getColumnName()); + } + break; + } + } + Map generateSql = generateSql(queryColumns, conditionVos, tableName,"sort",pageNo,pageSize); + String sql = (String) generateSql.get("sql"); + List params = (List) generateSql.get("params"); + log.info("sql为: " + sql); + log.info("参数为: " + JsonUtils.toJSONString(params)); + JDBCAgent jdbcAgent = new JDBCAgent(); + List columns = new ArrayList<>(); + try { + jdbcAgent.execute(sql, params); + List list = jdbcAgent.resultSetToList(); + for (Object o : list) { + FormColumn column = new FormColumn(); + Map columnMap = (Map) o; + List 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 && fieldBean.isEnumField()){ + //转换枚举值 + fieldVo.setValue(EnumMapUtils.getEnumShowValue(fieldVo.getValue())); + } + vos.add(fieldVo); + } + } + column.setVos(vos); + if (columnMap.get("id") != null) { + column.setId(columnMap.get("id") + ""); + } + Map fieldsMap = column.getFieldsMap(); + columns.add(fieldsMap); + } + } catch (Exception e) { + log.error(e.getMessage(),e); + } finally { + jdbcAgent.close(); + } + return columns; + } + + + + public boolean queryExist(List conditionVos,String tableName) throws BusinessException { + String sql = "select 1 from " + tableName + " where 1=1 " + " AND " + conditionVos.get(0).getFieldName() + " =? " + " AND " + conditionVos.get(1).getFieldName() + " is not null;"; + JDBCAgent jdbcAgent = new JDBCAgent(); + List params = new ArrayList<>(); + params.add(conditionVos.get(0).getValue()); + try { + jdbcAgent.execute(sql, params); + List list = jdbcAgent.resultSetToList(); + return list.size() > 0; + } catch (Exception e) { + log.error(e.getMessage(),e); + } finally { + jdbcAgent.close(); + } + return false; + } + + private Map generateSql(List queryColumn, List conditions, String tableName) { + return generateSql( queryColumn, conditions, tableName,null,null,null); + } + + private Map generatePageQuerySql(List queryColumn, List conditions, String tableName,Integer pageNo,Integer pageSize) { + return generateSql( queryColumn, conditions, tableName,null,pageNo,pageSize); + } + + private Map generateSql(List queryColumn, List conditions, String tableName,String orderField,Integer pageNo,Integer pageSize) { + if (tableName == null) { + throw new IllegalArgumentException("tableName cannot be null or empty"); + } + StringBuilder sqlBuilder = new StringBuilder("SELECT "); + if (queryColumn == null || queryColumn.isEmpty()) { + sqlBuilder.append("*"); + } + + for (int i = 0; i < queryColumn.size(); i++) { + sqlBuilder.append(queryColumn.get(i)); + if (queryColumn.size() > 1 && i >= 0 && i < queryColumn.size() - 1) { + sqlBuilder.append(","); + } + } + + if (queryColumn.size() > 0) { + sqlBuilder.append(",`ID`"); + } + + sqlBuilder.append(" from " + tableName); + + List params = new ArrayList<>(); + sqlBuilder.append(buildWhereClause(conditions,params)); + if(orderField == null) { + sqlBuilder.append(" order by start_date desc"); + } + if(pageNo != null && pageSize != null) { + sqlBuilder.append(" limit " + pageSize + " offset " + (pageNo - 1) * pageSize); + } + sqlBuilder.append(";"); + Map result = new HashMap<>(); + result.put("sql", sqlBuilder.toString()); + result.put("params", params); + return result; + } + + private Map generateDelSql(List conditions, String tableName) { + if (tableName == null) { + throw new IllegalArgumentException("tableName cannot be null or empty"); + } + StringBuilder sqlBuilder = new StringBuilder("DELETE "); + sqlBuilder.append(" from " + tableName); + List params = new ArrayList<>(); + sqlBuilder.append(buildWhereClause(conditions,params)); + Map result = new HashMap<>(); + result.put("sql", sqlBuilder.toString()); + result.put("params", params); + return result; + } + + private Map generateCountSql(String countField,List conditions, String tableName) { + if (tableName == null) { + throw new IllegalArgumentException("tableName cannot be null or empty"); + } + String countFieldStr = countField == null ? "*" : countField; + StringBuilder sqlBuilder = new StringBuilder("SELECT COUNT(" + countFieldStr + ") as countNum"); + sqlBuilder.append(" from " + tableName); + List params = new ArrayList<>(); + sqlBuilder.append(buildWhereClause(conditions,params)); + Map result = new HashMap<>(); + result.put("sql", sqlBuilder.toString()); + result.put("params", params); + return result; + } + + private Map generateUpdateSql(List fieldValues, String tableName,List conditions) { + if (fieldValues == null || fieldValues.isEmpty()) { + throw new IllegalArgumentException("Field values cannot be null or empty"); + } + if (tableName == null || tableName.trim().isEmpty()) { + throw new IllegalArgumentException("Table name cannot be null or empty"); + } + StringBuilder sqlBuilder = new StringBuilder("UPDATE ").append(tableName).append(" SET "); + List params = new ArrayList<>(); + // Build the SET clause + int fieldCount = 0; + for (FormUpdateField updateField : fieldValues) { + if (updateField.getValue() == null || "".equals(updateField.getValue()) || "null".equals(updateField.getValue())) { + continue; + } + if (fieldCount > 0) { + sqlBuilder.append(", "); + } + if (updateField.getValue() instanceof String && ((String) updateField.getValue()).startsWith("DATE>")) { + String oldValue = (String) updateField.getValue(); + sqlBuilder.append(updateField.getFieldName()).append(" = TO_DATE( ?, 'YYYY-MM-DD')"); + updateField.setValue(oldValue.substring(oldValue.indexOf(">") + 1)); + } else { + sqlBuilder.append(updateField.getFieldName()).append(" = ?"); + } + params.add(updateField.getValue()); + fieldCount++; + } + String whereClauseStr = buildWhereClause(conditions,params); + // Append the WHERE clause + sqlBuilder.append(whereClauseStr); + // Create result map + Map result = new HashMap<>(); + result.put("sql", sqlBuilder.toString()); + result.put("params", params); + return result; + } + + public Map> getMainFormTableAttachments(String formNo,Map sourceMap) throws BusinessException { + FormApi4Cap4 formApi4Cap4 = (FormApi4Cap4) AppContext.getBean("formApi4Cap4"); + FormBean cap4FormBean = formApi4Cap4.getFormByFormCode(formNo); + FormTableBean masterTableBean = cap4FormBean.getMasterTableBean(); + Map> attachmentTempMap = new HashMap<>(); + Set removeKey = new HashSet<>(); + for (String key : sourceMap.keySet()) { + FormFieldBean fieldBeanByDisplay = masterTableBean.getFieldBeanByDisplay(key); + if(fieldBeanByDisplay == null ){ + continue; + } + if(fieldBeanByDisplay.getInputType().equals("image") || + fieldBeanByDisplay.getInputType().equals("attachment")) { + attachmentTempMap.put(fieldBeanByDisplay.getDisplay(),(List)sourceMap.get(key)); + removeKey.add(key); + } + } + for (String key : removeKey) { + sourceMap.remove(key); + } + return attachmentTempMap; + } + + public Map> getSubFormTableAttachments(String formNo,Map sourceMap) throws BusinessException { + FormApi4Cap4 formApi4Cap4 = (FormApi4Cap4) AppContext.getBean("formApi4Cap4"); + FormBean cap4FormBean = formApi4Cap4.getFormByFormCode(formNo); + List subTableBean = cap4FormBean.getSubTableBean(); + Map> attachmentTempMap = new HashMap<>(); + String tableName = null; + for (String key : sourceMap.keySet()) { + tableName = key; + } + String finalTableName = tableName; + FormTableBean tableBean = subTableBean.stream().filter(s->s.getTableName().equals(finalTableName)).collect(Collectors.toList()).get(0); + List> tableData = (List>)sourceMap.get(tableName); + Set removeKey = new HashSet<>(); + for (Map rowData : tableData) { + for (String key : rowData.keySet()) { + FormFieldBean fieldBeanByDisplay = tableBean.getFieldBeanByDisplay(key); + if(fieldBeanByDisplay == null ){ + continue; + } + if(fieldBeanByDisplay.getInputType().equals("image") || + fieldBeanByDisplay.getInputType().equals("attachment")) { + attachmentTempMap.put(fieldBeanByDisplay.getDisplay(),(List)sourceMap.get(key)); + removeKey.add(key); + } + } + for (String key : removeKey) { + rowData.remove(key); + } + removeKey.clear(); + } + return attachmentTempMap; + } + + public void addSubTableRecord(String subTableName,List data,String formNo,String formId) { + JDBCAgent agent = new JDBCAgent(); + try { + FormApi4Cap4 formApi4Cap4 = (FormApi4Cap4) AppContext.getBean("formApi4Cap4"); + FormBean cap4FormBean = formApi4Cap4.getFormByFormCode(formNo); + List tableBean = cap4FormBean.getSubTableBean(); + for (FormTableBean bean : tableBean) { + if(!bean.getTableName().equals(subTableName)) { + continue; + } + for (Object column : data) { + Map map = (Map) column; + Map tempMap = new HashMap<>(); + for (String key : map.keySet()) { + FormFieldBean fieldBeanByDisplay = bean.getFieldBeanByDisplay(key); + if(fieldBeanByDisplay == null) { + continue; + } + tempMap.put(fieldBeanByDisplay.getColumnName(),map.get(key)); + } + tempMap.put("formmain_id",formId); + tempMap.put("sort",1); + tempMap.put("ID",Math.abs(UUID.randomUUID().getLeastSignificantBits())); + Map insertSql = generateInsertSql(tempMap, subTableName); + agent.execute((String)insertSql.get("sql"),(List)insertSql.get("params")); + } + } + } catch (Exception e) { + log.error(e.getMessage(),e); + } finally { + agent.close(); + } + } + + public void rebuildSubTableRecord(String subTableName,List data,String formNo,String formId) { + String deleteSql = "delete from " + subTableName + " where formmain_id = ? "; + JDBCAgent agent = new JDBCAgent(); + try { + agent.execute(deleteSql, Arrays.asList(formId)); + FormApi4Cap4 formApi4Cap4 = (FormApi4Cap4) AppContext.getBean("formApi4Cap4"); + FormBean cap4FormBean = formApi4Cap4.getFormByFormCode(formNo); + List tableBean = cap4FormBean.getSubTableBean(); + for (FormTableBean bean : tableBean) { + if(!bean.getTableName().equals(subTableName)) { + continue; + } + for (Object column : data) { + Map map = (Map) column; + Map tempMap = new HashMap<>(); + for (String key : map.keySet()) { + FormFieldBean fieldBeanByDisplay = bean.getFieldBeanByDisplay(key); + if(fieldBeanByDisplay == null) { + continue; + } + tempMap.put(fieldBeanByDisplay.getColumnName(),map.get(key)); + } + tempMap.put("formmain_id",formId); + tempMap.put("sort",1); + tempMap.put("ID",Math.abs(UUID.randomUUID().getLeastSignificantBits())); + Map insertSql = generateInsertSql(tempMap, subTableName); + agent.execute((String)insertSql.get("sql"),(List)insertSql.get("params")); + } + } + } catch (Exception e) { + log.error(e.getMessage(),e); + } finally { + agent.close(); + } + } + + public void handleEnumDeptEtc(Map 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; + } + switch (fieldBean.getInputType()) { + case "select": if(fieldBean.getEnumId() != 0l) { + String enumItemId = EnumMapUtils.getEnumItemValueByEnumId((String)map.get(key),fieldBean.getEnumId()); + map.put(key,enumItemId); + } break; + case "image":break; + case "attachment": break; + case "account": break; + case "department": break; + case "radio": break; + case "member":break; + case "checkbox": + case "date": + case "text":break; + default: break; + + } + } + } + + public void handleSubTableEnumDeptEtc(Map map,String formNo) throws BusinessException { + FormApi4Cap4 formApi4Cap4 = (FormApi4Cap4) AppContext.getBean("formApi4Cap4"); + FormBean cap4FormBean = formApi4Cap4.getFormByFormCode(formNo); + List subTableBean = cap4FormBean.getSubTableBean(); + for (FormTableBean tableBean : subTableBean) { + String tableName = null; + for (String key : map.keySet()) { + tableName = key; + } + if(!tableBean.getTableName().equals(tableName)) { + continue; + } + List> subDatas = (List>) map.get(tableName); + for (Map subData : subDatas) { + for (String key : subData.keySet()) { + FormFieldBean fieldBean = tableBean.getFieldBeanByDisplay(key); + if(fieldBean == null) { + continue; + } + switch (fieldBean.getInputType()) { + case "select": if(fieldBean.getEnumId() != 0l) { + String enumItemId = EnumMapUtils.getEnumItemValueByEnumId((String)subData.get(key),fieldBean.getEnumId()); + subData.put(key,enumItemId); + } break; + case "image":break; + case "attachment": break; + case "account": break; + case "department": break; + case "radio": break; + case "member":break; + case "checkbox": + case "date": + case "text":break; + default: break; + + } + } + } + } + } + + public boolean isMasterTableFile(String displayName,String formNo) { + FormApi4Cap4 formApi4Cap4 = (FormApi4Cap4) AppContext.getBean("formApi4Cap4"); + try { + FormBean cap4FormBean = formApi4Cap4.getFormByFormCode(formNo); + FormTableBean masterTableBean = cap4FormBean.getMasterTableBean(); + FormFieldBean fieldBeanByDisplay = masterTableBean.getFieldBeanByDisplay(displayName); + return fieldBeanByDisplay.getInputType().equals("image") || fieldBeanByDisplay.getInputType().equals("attachment"); + } catch (BusinessException e) { + + } + return false; + } + + private Map generateInsertSql(Map data, String tableName) { + if (tableName == null || tableName.isEmpty()) { + throw new IllegalArgumentException("tableName cannot be null or empty"); + } + if (data == null || data.isEmpty()) { + throw new IllegalArgumentException("data cannot be null or empty"); + } + StringBuilder sqlBuilder = new StringBuilder("INSERT INTO " + tableName + " ("); + List params = new ArrayList<>(); + // 拼接字段名 + StringBuilder columns = new StringBuilder(); + // 拼接字段值 + StringBuilder values = new StringBuilder(); + for (Map.Entry entry : data.entrySet()) { + // 拼接字段名 + if (columns.length() > 0) { + columns.append(", "); + } + columns.append(entry.getKey()); + // 拼接值,使用占位符 ? + if (values.length() > 0) { + values.append(", "); + } + values.append("?"); + // 将值加入 params 列表 + params.add(entry.getValue()); + } + // 完善 SQL 语句 + sqlBuilder.append(columns).append(") VALUES (").append(values).append(");"); + Map result = new HashMap<>(); + result.put("sql", sqlBuilder.toString()); + result.put("params", params); + return result; + } + + /** + * 动态生成 WHERE 子句 + * @param conditions 条件集合 + * @param params 参数列表(引用传递) + * @return 拼接后的 WHERE 子句(包含 WHERE 关键字) + */ + private String buildWhereClause(List conditions, List params) { + if (conditions == null || conditions.isEmpty()) { + return ""; + } + + StringBuilder whereClause = new StringBuilder(" WHERE "); + int conditionIndex = 0; + + for (FormWhereCondition condition : conditions) { + // 处理括号起始 + if (condition.isStartWithBracket()) { + whereClause.append("("); + } + + // 字段名校验 + String fieldName = condition.getFieldName(); + ClauseFactor factor = condition.getClauseFactor(); + String operator = parseOperator(factor); + + // 构建条件表达式 + String conditionExpr; + if (factor.isNullType()) { + // 处理 NULL/NOT NULL 条件(无需参数) + conditionExpr = String.format("%s %s", fieldName, operator); + } 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() + "%"); + }else { + params.add(condition.getValue()); + } + } + + whereClause.append(conditionExpr); + + // 处理括号闭合 + if (condition.isEndWithBracket()) { + whereClause.append(")"); + } + + // 添加连接符(AND/OR) + if (conditionIndex < conditions.size() - 1) { + whereClause.append(" ").append(condition.getConcatFactor()).append(" "); + } + conditionIndex++; + } + + return whereClause.toString(); + } + + /** + * 校验字段名合法性(防止 SQL 注入) + */ + private String validateFieldName(String fieldName) { + if (!fieldName.matches("^[a-zA-Z_][a-zA-Z0-9_]*$")) { + throw new IllegalArgumentException("非法字段名: " + fieldName); + } + return fieldName; + } + + /** + * 解析运算符映射(eq -> =, lt -> < 等) + */ + private String parseOperator(ClauseFactor factor) { + if(factor == null) { + return "="; + } + switch (factor) { + case NEQ: return "!="; + case EQ: return "="; + case GT: return ">"; + case GE: return ">="; + case LT: return "<"; + case LE: return "<="; + case LIKE: return "LIKE"; + case NULL: return "IS NULL"; // 空值判断 + case NOT_NULL: return "IS NOT NULL"; // 非空判断 + default: throw new UnsupportedOperationException("不支持的运算符: " + factor); + } + } + + +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/FormExportUtil.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/FormExportUtil.java new file mode 100644 index 0000000..5a60171 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/FormExportUtil.java @@ -0,0 +1,85 @@ +package com.seeyon.apps.src_rent.form; + +import com.seeyon.v3x.services.form.bean.RecordExport; +import com.seeyon.v3x.services.form.bean.SubordinateFormExport; +import com.seeyon.v3x.services.form.bean.ValueExport; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Set; + +//创建无流程表单数据处理工具类 +public class FormExportUtil { + + /** + * 设置主表信息 + * @param map 设置主表字段。Map<主表显示名称,主表数据> + * @return + */ + public List setFormValue(Map map ){ +// 创建返回值对象 + List valueExports = new ArrayList(); + ValueExport valueExport ; +// 获取参数信息(显示名称) + Set keys = map.keySet(); + if(keys.size()>0) { +// 对控件赋值 + for (String key : keys) { + if(map.get(key) != null ){ + valueExport = new ValueExport(); + valueExport.setDisplayName(key); + valueExport.setValue(map.get(key).toString()); + valueExports.add(valueExport); + } + System.out.println(key+":"+map.get(key)); + } + } + return valueExports; + } + + /** + * 设置从表信息 + * @param lists 设置主表字段。List> + */ + public List setSubordinateFormValue(List> lists){ + List subordinateFormExports = new ArrayList(); + SubordinateFormExport subordinateFormExport = new SubordinateFormExport(); + List recordExports = new ArrayList(); + List valueExports; + RecordExport recordExport; + for(int i = 0 ; i < lists.size() ; i++) { + recordExport = new RecordExport(); + valueExports = setFormValue(lists.get(i)); + recordExport.setRecord(valueExports); + recordExports.add(recordExport); + } + subordinateFormExport.setValues(recordExports); + subordinateFormExports.add(subordinateFormExport); + + return subordinateFormExports; + } + + public List setAllSubordinateFormValue(List> lists){ + List subordinateFormExports = new ArrayList(); + for (Map list : lists) { + SubordinateFormExport subordinateFormExport = new SubordinateFormExport(); + List recordExports = new ArrayList(); + for (String key : list.keySet()) { + List> columns = (List>) list.get(key); + for(int i = 0 ; i < columns.size() ; i++) { + List valueExports = setFormValue(columns.get(i)); + RecordExport recordExport = new RecordExport(); + recordExport.setRecord(valueExports); + recordExports.add(recordExport); + } + } + subordinateFormExport.setValues(recordExports); + subordinateFormExports.add(subordinateFormExport); + } + return subordinateFormExports; + } + + + +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/FormFieldVo.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/FormFieldVo.java new file mode 100644 index 0000000..2c7fd6f --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/FormFieldVo.java @@ -0,0 +1,22 @@ +package com.seeyon.apps.src_rent.form; + +public class FormFieldVo { + private String displayName; + private Object value; + + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + public Object getValue() { + return value; + } + + public void setValue(Object value) { + this.value = value; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/FormUpdateField.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/FormUpdateField.java new file mode 100644 index 0000000..74860c5 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/FormUpdateField.java @@ -0,0 +1,57 @@ +package com.seeyon.apps.src_rent.form; + +public class FormUpdateField { + private String display; + private String fieldName; + private Object value; + + public FormUpdateField(Object value) { + this.value = value; + } + + public FormUpdateField() { + } + + public static FormUpdateField build() { + return new FormUpdateField(); + } + + public FormUpdateField display(String display) { + this.display = display; + return this; + } + + public FormUpdateField value(String value) { + this.value = value; + return this; + } + + public FormUpdateField fieldName(String fieldName) { + this.fieldName = fieldName; + return this; + } + + public Object getValue() { + return value; + } + + public void setValue(Object value) { + this.value = value; + } + + public String getDisplay() { + return display; + } + + public void setDisplay(String display) { + this.display = display; + } + + public String getFieldName() { + return fieldName; + } + + public void setFieldName(String fieldName) { + this.fieldName = fieldName; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/FormWhereCondition.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/FormWhereCondition.java new file mode 100644 index 0000000..9cffe20 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/FormWhereCondition.java @@ -0,0 +1,127 @@ +package com.seeyon.apps.src_rent.form; + + +public class FormWhereCondition { + private String display; + private String fieldName; //字段名 + private Object value; //值 + private ClauseFactor clauseFactor = ClauseFactor.EQ; //条件因子 eq lt gt not_null null + private ClauseFactor concatFactor = ClauseFactor.AND; //拼接因子 + private boolean startWithBracket = false; //是否以括号开头生成子条件 + private boolean endWithBracket = false; //是否以括号结尾结束子条件 + private String index; + + public FormWhereCondition() { + } + + public String getDisplay() { + return display; + } + + public void setDisplay(String display) { + this.display = display; + } + + public static FormWhereCondition build() { + return new FormWhereCondition(); + } + + public FormWhereCondition fieldName(String fieldName) { + this.fieldName = fieldName; + return this; + } + + public FormWhereCondition display(String display) { + this.display = display; + return this; + } + public FormWhereCondition value(Object value) { + this.value = value; + return this; + } + public FormWhereCondition clauseFactor(ClauseFactor clauseFactor) { + this.clauseFactor = clauseFactor; + return this; + } + public FormWhereCondition index(String index) { + this.index = index; + return this; + } + + public FormWhereCondition startWithBracket(boolean startWithBracket) { + this.startWithBracket = startWithBracket; + return this; + } + + public FormWhereCondition endWithBracket(boolean endWithBracket) { + this.endWithBracket = endWithBracket; + return this; + } + + public FormWhereCondition concatFactor(ClauseFactor concatFactor) { + this.concatFactor = concatFactor; + return this; + } + + + public FormWhereCondition(Object value, ClauseFactor clauseFactor) { + this.value = value; + this.clauseFactor = clauseFactor; + } + + public boolean isStartWithBracket() { + return startWithBracket; + } + + public void setStartWithBracket(boolean startWithBracket) { + this.startWithBracket = startWithBracket; + } + + public String getFieldName() { + return fieldName; + } + + public void setFieldName(String fieldName) { + this.fieldName = fieldName; + } + + public Object getValue() { + return value; + } + + public void setValue(Object value) { + this.value = value; + } + + public ClauseFactor getClauseFactor() { + return clauseFactor; + } + + public void setClauseFactor(ClauseFactor clauseFactor) { + this.clauseFactor = clauseFactor; + } + + public ClauseFactor getConcatFactor() { + return concatFactor; + } + + public void setConcatFactor(ClauseFactor concatFactor) { + this.concatFactor = concatFactor; + } + + public String getIndex() { + return index; + } + + public void setIndex(String index) { + this.index = index; + } + + public boolean isEndWithBracket() { + return endWithBracket; + } + + public void setEndWithBracket(boolean endWithBracket) { + this.endWithBracket = endWithBracket; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/QueryWhereCondition.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/QueryWhereCondition.java new file mode 100644 index 0000000..0c740d1 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/QueryWhereCondition.java @@ -0,0 +1,154 @@ +package com.seeyon.apps.src_rent.form; + +public class QueryWhereCondition { + private String display; + private String fieldName; //字段名 + private Object value; //值 + private ClauseFactor clauseFactor = ClauseFactor.EQ; //条件因子 eq lt gt not_null null + private ClauseFactor concatFactor = ClauseFactor.AND; //拼接因子 + private boolean startWithBracket = false; //是否以括号开头生成子条件 + private boolean endWithBracket = false; //是否以括号结尾结束子条件 + private String index; + private Integer limit = null; + private Integer offset = null; + + public QueryWhereCondition() { + } + + public String getDisplay() { + return display; + } + + public void setDisplay(String display) { + this.display = display; + } + + public static QueryWhereCondition build() { + return new QueryWhereCondition(); + } + + public QueryWhereCondition fieldName(String fieldName) { + this.fieldName = fieldName; + return this; + } + + public QueryWhereCondition display(String display) { + this.display = display; + return this; + } + public QueryWhereCondition value(Object value) { + this.value = value; + return this; + } + public QueryWhereCondition clauseFactor(ClauseFactor clauseFactor) { + this.clauseFactor = clauseFactor; + return this; + } + public QueryWhereCondition index(String index) { + this.index = index; + return this; + } + + public QueryWhereCondition limit(Integer limit) { + this.limit = limit; + return this; + } + + public QueryWhereCondition offset(Integer offset) { + this.offset = offset; + return this; + } + + public QueryWhereCondition startWithBracket(boolean startWithBracket) { + this.startWithBracket = startWithBracket; + return this; + } + + public QueryWhereCondition endWithBracket(boolean endWithBracket) { + this.endWithBracket = endWithBracket; + return this; + } + + public QueryWhereCondition concatFactor(ClauseFactor concatFactor) { + this.concatFactor = concatFactor; + return this; + } + + + public QueryWhereCondition(Object value, ClauseFactor clauseFactor) { + this.value = value; + this.clauseFactor = clauseFactor; + } + + public boolean isStartWithBracket() { + return startWithBracket; + } + + public void setStartWithBracket(boolean startWithBracket) { + this.startWithBracket = startWithBracket; + } + + public String getFieldName() { + return fieldName; + } + + public void setFieldName(String fieldName) { + this.fieldName = fieldName; + } + + public Object getValue() { + return value; + } + + public void setValue(Object value) { + this.value = value; + } + + public ClauseFactor getClauseFactor() { + return clauseFactor; + } + + public void setClauseFactor(ClauseFactor clauseFactor) { + this.clauseFactor = clauseFactor; + } + + public ClauseFactor getConcatFactor() { + return concatFactor; + } + + public void setConcatFactor(ClauseFactor concatFactor) { + this.concatFactor = concatFactor; + } + + public String getIndex() { + return index; + } + + public void setIndex(String index) { + this.index = index; + } + + public boolean isEndWithBracket() { + return endWithBracket; + } + + public void setEndWithBracket(boolean endWithBracket) { + this.endWithBracket = endWithBracket; + } + + public Integer getLimit() { + return limit; + } + + public void setLimit(Integer limit) { + this.limit = limit; + } + + public Integer getOffset() { + return offset; + } + + public void setOffset(Integer offset) { + this.offset = offset; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/job/BillPayUrgeJob.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/job/BillPayUrgeJob.java new file mode 100644 index 0000000..7d37cee --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/job/BillPayUrgeJob.java @@ -0,0 +1,63 @@ +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.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 java.text.DateFormat; +import java.text.SimpleDateFormat; +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; + + @Override + public String taskRun(String s) throws Exception { + return ""; + } + + @Override + public String getName() { + return ""; + } + + private void hanleContractBill() { + DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + try { + //拉取收款结果反馈为空,且存在催缴时间的账单记录 + List 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 = billService.queryAllContractBill(conditions); + List datas = pageQueryVo.getDatas(); + for (BillVo data : datas) { + //发送消息到小程序后端 + MessageVo messageVo = new MessageVo(); + String context = "尊敬的用户,"; + messageVo.setMessageContent(context); + messageVo.setMessageTime(df.format(new Date())); + messageVo.setMessageType("UNPAIDBILL"); + messageVo.setMessageReceiver(data.getCusNo()); + } + }while (pageQueryVo != null && pageQueryVo.getDatas() != null); + }catch (Exception e) { + + } + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/job/SealDocSyncJob.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/job/SealDocSyncJob.java new file mode 100644 index 0000000..5152c34 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/job/SealDocSyncJob.java @@ -0,0 +1,73 @@ +package com.seeyon.apps.src_rent.job; + +import com.seeyon.aicloud.common.JsonUtils; +import com.seeyon.apps.ext.quartz.AbstractQuartzTask; +import com.seeyon.apps.src_rent.config.RentConfigProvider; +import com.seeyon.apps.src_rent.constants.EsignApiUrl; +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.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 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 SealDocSyncJob extends AbstractQuartzTask { + + private static final Log log = LogFactory.getLog(SealDocSyncJob.class); + @Autowired + private RentConfigProvider configProvider; + @Autowired + private TokenCacheManager tokenCacheManager; + @Autowired + private SealService sealService; + + @Override + public String taskRun(String s) throws Exception { + log.info("开始执行印章同步任务"); + syncSeals(); + log.info("印章同步任务完成"); + return ""; + } + + private void syncSeals() { + String orgId = configProvider.getBizConfigByKey(RentConstants.eSignOrgId); + 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()); + EsignBaseResp esignBaseResp = null; + Map dataMap = null; + do { + String url = host + EsignApiUrl.SEAL_QUERY_URL + "?" + "orgId=" + orgId + "&pageNum=" + (pageNum++) + "&pageSize=" + pageSize; + String respStr = HttpClient.httpGet(url, esignApiHeader.convert2Headers(),"UTF-8"); + esignBaseResp = JsonUtils.parseObject(respStr, EsignBaseResp.class); + if(esignBaseResp.getCode() != 0) { + break; + } + dataMap = (Map)esignBaseResp.getData(); + Object[] sealArray = (Object[]) dataMap.get("seals"); + if(sealArray == null || sealArray.length == 0) { + break; + } + for (Object o : sealArray) { + SealInfoVo sealInfoVo = JsonUtils.parseObject(JsonUtils.toJSONString(o), SealInfoVo.class); + sealService.upsertOaSealDoc(sealInfoVo); + } + }while (true); + + } + + @Override + public String getName() { + return "E签宝印章信息同步任务"; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/message/MessageVo.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/message/MessageVo.java new file mode 100644 index 0000000..aa49b01 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/message/MessageVo.java @@ -0,0 +1,50 @@ +package com.seeyon.apps.src_rent.message; + +public class MessageVo { + + private String messageType; + private String messageContent; + private String messageTime; + private String messageReceiver; + private String bizId; + + public String getMessageType() { + return messageType; + } + + public void setMessageType(String messageType) { + this.messageType = messageType; + } + + public String getMessageContent() { + return messageContent; + } + + public void setMessageContent(String messageContent) { + this.messageContent = messageContent; + } + + public String getMessageTime() { + return messageTime; + } + + public void setMessageTime(String messageTime) { + this.messageTime = messageTime; + } + + public String getMessageReceiver() { + return messageReceiver; + } + + public void setMessageReceiver(String messageReceiver) { + this.messageReceiver = messageReceiver; + } + + public String getBizId() { + return bizId; + } + + public void setBizId(String bizId) { + this.bizId = bizId; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/message/ThirdMessageService.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/message/ThirdMessageService.java new file mode 100644 index 0000000..df95061 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/message/ThirdMessageService.java @@ -0,0 +1,33 @@ +package com.seeyon.apps.src_rent.message; + +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.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 java.util.HashMap; +import java.util.Map; + +@Component +public class ThirdMessageService { + + @Autowired + private RentConfigProvider configProvider; + + public void sendMessage(MessageVo messageVo) { + String url = configProvider.getBizConfigByKey(RentConstants.WECHATBACKENDHOST) + "/message/send"; + Map headers = new HashMap<>(); + headers.put("internalToken", AESUtils.encrypt("oa","rent*123")); + String resp = HttpClient.httpPostRaw(url, JsonUtils.toJSONString(messageVo), headers, null); + } + + public void deletByBizId(String bizId) { + String url = configProvider.getBizConfigByKey(RentConstants.WECHATBACKENDHOST) + "/message/delByBizId?bizId=?" + bizId; + Map headers = new HashMap<>(); + headers.put("internalToken", AESUtils.encrypt("oa","rent*123")); + String resp = HttpClient.httpGet(url, headers, null); + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/node/EsignMultipleSignerNode.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/node/EsignMultipleSignerNode.java new file mode 100644 index 0000000..bdac9eb --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/node/EsignMultipleSignerNode.java @@ -0,0 +1,337 @@ +package com.seeyon.apps.src_rent.node; + +import com.seeyon.apps.common.workflow.node.ACommonSuperNode; +import com.seeyon.apps.ext.workflow.vo.FieldDataVo; +import com.seeyon.apps.ext.workflow.vo.FormDataVo; +import com.seeyon.apps.ext.workflow.vo.SuperNodeContext; +import com.seeyon.apps.src_rent.config.RentConfigProvider; +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.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.SignLinkService; +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.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 EsignMultipleSignerNode extends ACommonSuperNode { + + private static final Log log = LogFactory.getLog(EsignMultipleSignerNode.class); + + private static final String CONTRACT_NAME_FIELD = "合同名称"; + 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; + + @Override + public String getPluginId() { + return RentConstants.getPluginId(); + } + + @Override + public String getFormParse() { + return ""; + } + + @Override + public SuperNodeContext proceed(String s, FormDataVo formDataVo, FormDataMasterBean formDataMasterBean) { + SuperNodeContext context = new SuperNodeContext(); + context.setNeedSave(true); + log.info("进入 E签宝多方签署集成超级节点"); + + try { + Map signParams = buildSignParams(formDataVo, formDataMasterBean, true); + if (signParams == null) throw new RuntimeException("签署参数构建失败"); + String esignFlowId = templateService.createBySignTemplate(signParams); + signLinkService.saveGetLinkParam(formDataVo, formDataMasterBean,esignFlowId); + log.info("E签宝签署流程ID: " + esignFlowId + " , OA超级节点ID:" + formDataVo.getToken()); + log.info("E签宝多方签署合同已发送: " + esignFlowId); + formDataVo.getNewFieldDataMap().put("电子签合同流程ID", esignFlowId); + return context.wait("等待签署结束"); + } catch (Exception e) { + log.error("E签宝签署失败", e); + context.setErrMsg("E签宝签署失败: " + e.getMessage()); + return context.back("E签宝签署失败: " + e.getMessage()); + } + } + + private Map buildSignFlowConfig(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; + Map config = new HashMap<>(); + config.put("signFlowTitle", contractName); + config.put("autoFinish", true); + config.put("notifyUrl", signCallBackUrl); + Map noticeConfig = new HashMap<>(); + noticeConfig.put("noticeTypes", "1"); + config.put("noticeConfig", noticeConfig); + Map signConfig = new HashMap<>(); + signConfig.put("showBatchDropSealButton", false); + config.put("signConfig",signConfig); + return config; + } + + private List buildSigners(FormDataVo formDataVo, String fileId, boolean qifengSign) throws Exception { + List positions = uploadFileService.getSignPosition(fileId); + List bPositions = extractPosition(positions, "乙方盖章/签字"); + List aPositions = extractPosition(positions, "甲方盖章/签字"); + String bSignerType = formDataVo.getFieldData("乙方签署类型").getStringValue(); + + SignFieldPosition aQiFengposition = new SignFieldPosition(); + aQiFengposition.setAcrossPageMode("ALL"); + aQiFengposition.setPositionY(520f); + SignFieldPosition bQiFengposition = new SignFieldPosition(); + bQiFengposition.setAcrossPageMode("ALL"); + bQiFengposition.setPositionY(720f); + + aPositions.add(aQiFengposition); + bPositions.add(bQiFengposition); + String sealId = getStringField(formDataVo,"甲方印章ID"); + Signer bSigner = !"组织".equals(bSignerType) ? createPsnSigner(fileId,formDataVo.getFieldData("乙方姓名").getStringValue(),bPositions,2,formDataVo.getFieldData("乙方电话").getStringValue(),false) : createOrgSigner( + fileId, + getStringField(formDataVo, B_UNIT_NAME_FIELD), + bPositions, 2, formDataVo.getFieldData("乙方法人姓名").getStringValue(), + formDataVo.getFieldData("乙方法人身份证号").getStringValue(), + formDataVo.getFieldData("乙方企业社会信用代码").getStringValue(), + formDataVo.getFieldData("乙方经办人手机号").getStringValue(), + formDataVo.getFieldData("乙方经办人姓名").getStringValue(), + formDataVo.getFieldData("乙方经办人身份证号").getStringValue(),false + ,null); + + Signer aSigner = createOrgSigner( + fileId,null, aPositions, 1, null, null, null, null, null, null,true + ,sealId); + List signers = new ArrayList<>(); + signers.add(bSigner); + signers.add(aSigner); + return signers; + } + + private Map buildSignParams(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); + if(fileId == null) { + throw new RuntimeException("合同附件上传E签宝失败"); + } + log.info("E签宝FileId: " + fileId); + } + Map docMap = new HashMap<>(); + docMap.put("fileId", fileId); + Thread.sleep(1000); + List docs = new ArrayList<>(); + docs.add(docMap); + Map signFlowConfig = buildSignFlowConfig(formDataVo, formDataMasterBean); + List signers = buildSigners(formDataVo, fileId,true); + Map signParams = new HashMap<>(); + signParams.put("signFlowConfig", signFlowConfig); + signParams.put("signers", signers); + signParams.put("docs", docs); + return signParams; + + } + + private void fillFileId(String fileId,FormDataVo formDataVo,FormDataMasterBean formDataMasterBean) throws NoSuchFieldException, BusinessException { + String tableName = formDataVo.getTableName(); + FormFieldBean fieldBeanByDisplay = formDataMasterBean.getFormTable().getFieldBeanByDisplay("合同文件ID"); + FormDataOperator formDataOperator = new FormDataOperator(); + List updateFields = new ArrayList<>(); + updateFields.add(FormUpdateField.build().fieldName(fieldBeanByDisplay.getColumnName()).value(fileId)); + List whereConditions = new ArrayList<>(); + FormWhereCondition condition = FormWhereCondition.build().value(formDataVo.getId()); + condition.setFieldName("ID"); + whereConditions.add(condition); + formDataOperator.updateMasterForm(updateFields,tableName,whereConditions); + } + + private Map mapOf(Object... keyValues) { + if (keyValues.length % 2 != 0) { + throw new IllegalArgumentException("参数个数必须为偶数:key 和 value 必须成对出现"); + } + Map map = new HashMap<>(); + for (int i = 0; i < keyValues.length; i += 2) { + Object key = keyValues[i]; + Object value = keyValues[i + 1]; + if (!(key instanceof String)) { + throw new IllegalArgumentException("key 必须是 String 类型,当前为:" + key.getClass()); + } + map.put((String) key, value); + } + return map; + } + + private Signer createPsnSigner( String fileId, String psnName,List pos, int order, String phone,Boolean autoSign) { + Signer signer = new Signer(); + signer.setSignerType(0); + signer.setSignConfig(mapOf("signOrder", order)); + if(Boolean.FALSE.equals(autoSign)){ + signer.setNoticeConfig(mapOf("noticeTypes", "1")); + + Map psnInfo = mapOf("psnAccount", phone, "psnInfo", mapOf("psnName", psnName)); + signer.setPsnSignerInfo(psnInfo); + } + + List signFields = new ArrayList<>(); + for (SignFieldPosition po : pos) { + NormalSignFieldConfig fieldConfig = new NormalSignFieldConfig(); + if("ALL".equals(po.getAcrossPageMode())){ + fieldConfig.setSignFieldPosition(po); + fieldConfig.setAutoSign(autoSign); + fieldConfig.setSignFieldStyle(2); + SignField qiFengfield = new SignField(); + qiFengfield.setSignFieldType(0); + qiFengfield.setNormalSignFieldConfig(fieldConfig); + qiFengfield.setFileId(fileId); + signFields.add(qiFengfield); + }else { + fieldConfig.setSignFieldPosition(po); + fieldConfig.setAutoSign(autoSign); + fieldConfig.setSignFieldStyle(1); + SignField field = new SignField(); + field.setSignFieldType(0); + field.setNormalSignFieldConfig(fieldConfig); + field.setFileId(fileId); + signFields.add(field); + } + } + + signer.setSignFields(signFields); + return signer; + } + + private Signer createOrgSigner(String fileId ,String orgName, List pos, int order, + 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)); + if(Boolean.FALSE.equals(autoSign)){ + signer.setNoticeConfig(mapOf("noticeTypes", "1")); + + Map orgInfo = mapOf("orgName", orgName, "orgInfo", mapOf( + "legalRepName", legalName, + "legalRepIDCardNum", legalId, + "orgIDCardNum", orgCode, + "orgIDCardType", "CRED_ORG_USCC" + ), + "transactorInfo", mapOf( + "psnAccount", transPhone, + "psnInfo", mapOf( + "psnName", psnName, + "psnIDCardNum", psnId + ) + ) + ); + + signer.setOrgSignerInfo(orgInfo); + } + + List signFields = new ArrayList<>(); + for (SignFieldPosition po : pos) { + NormalSignFieldConfig fieldConfig = new NormalSignFieldConfig(); + fieldConfig.setAssignedSealId(sealId); + if("ALL".equals(po.getAcrossPageMode())){ + fieldConfig.setSignFieldPosition(po); + fieldConfig.setAutoSign(autoSign); + fieldConfig.setSignFieldStyle(2); + SignField qiFengfield = new SignField(); + qiFengfield.setSignFieldType(0); + qiFengfield.setNormalSignFieldConfig(fieldConfig); + qiFengfield.setFileId(fileId); + signFields.add(qiFengfield); + }else { + fieldConfig.setSignFieldPosition(po); + fieldConfig.setAutoSign(autoSign); + fieldConfig.setSignFieldStyle(1); + SignField field = new SignField(); + field.setSignFieldType(0); + field.setNormalSignFieldConfig(fieldConfig); + field.setFileId(fileId); + signFields.add(field); + } + } + + signer.setSignFields(signFields); + return signer; + } + + private List extractPosition(List positions, String keyword) { + List posList = new ArrayList<>(); + for (Object obj : positions) { + Map position = (Map) obj; + if (Boolean.TRUE.equals(position.get("searchResult")) && keyword.equals(position.get("keyword"))) { + Object[] posArray = (Object[]) position.get("positions"); + for (Object o : posArray) { + Map posMap = (Map)o; + Object[] coords = (Object[]) posMap.get("coordinates"); + for (Object coord : coords) { + Map tempMap = (Map) coord; + SignFieldPosition sfp = new SignFieldPosition(); + sfp.setPositionPage(posMap.get("pageNum") + ""); + sfp.setPositionX(toFloat(tempMap.get("positionX")) + 150f); + sfp.setPositionY(toFloat(tempMap.get("positionY"))); + posList.add(sfp); + } + } + return posList; + } + } + throw new RuntimeException("未找到关键字位置: " + keyword); + } + + private String getStringField(FormDataVo vo, String field) { + try { + FieldDataVo fieldData = vo.getFieldData(field); + return fieldData.getStringValue(); + }catch (Exception e) { + log.error(e.getMessage()); + return null; + } + } + + private Float toFloat(Object val) { + return val instanceof Number ? ((Number) val).floatValue() : Float.parseFloat(val.toString()); + } + + @Override + public String getNodeId() { + return "nd_20250703"; + } + + @Override + public String getNodeName() { + return "E签宝甲乙双方签署节点"; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/node/EsignOneSignerNode.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/node/EsignOneSignerNode.java new file mode 100644 index 0000000..120647b --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/node/EsignOneSignerNode.java @@ -0,0 +1,375 @@ +package com.seeyon.apps.src_rent.node; + +import com.seeyon.apps.common.workflow.node.ACommonSuperNode; +import com.seeyon.apps.ext.workflow.vo.FieldDataVo; +import com.seeyon.apps.ext.workflow.vo.FormDataVo; +import com.seeyon.apps.ext.workflow.vo.SuperNodeContext; +import com.seeyon.apps.src_rent.config.RentConfigProvider; +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.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.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.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); + + private static final String CONTRACT_NAME_FIELD = "合同名称"; + 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; + + @Override + public String getPluginId() { + return RentConstants.getPluginId(); + } + + @Override + public String getFormParse() { + return ""; + } + + @Override + public SuperNodeContext proceed(String s, FormDataVo formDataVo, FormDataMasterBean formDataMasterBean) { + SuperNodeContext context = new SuperNodeContext(); + context.setNeedSave(true); + log.info("进入 E签宝单方签署集成超级节点"); + + try { + Map signParams = buildSignParams(formDataVo, formDataMasterBean, true); + if (signParams == null) throw new RuntimeException("签署参数构建失败"); + String esignFlowId = templateService.createBySignTemplate(signParams); + log.info("E签宝签署流程ID: " + esignFlowId + " , OA超级节点ID:" + formDataVo.getToken()); + log.info("E签宝单方签署合同已发送: " + esignFlowId); + formDataVo.getNewFieldDataMap().put("电子签合同流程ID", esignFlowId); + return context.wait("等待签署结束"); + } catch (Exception e) { + log.error("E签宝签署失败", e); + context.setErrMsg("E签宝签署失败: " + e.getMessage()); + return context.back("E签宝签署失败: " + e.getMessage()); + } + } + + private Map buildSignFlowConfig(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; + Map config = new HashMap<>(); + config.put("signFlowTitle", contractName); + config.put("autoFinish", true); + config.put("notifyUrl", signCallBackUrl); + Map noticeConfig = new HashMap<>(); + noticeConfig.put("noticeTypes", "1"); + config.put("noticeConfig", noticeConfig); + Map signConfig = new HashMap<>(); + signConfig.put("showBatchDropSealButton", false); + config.put("signConfig",signConfig); + return config; + } + + private List buildOnlyASigner(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 pos = new ArrayList<>(); + Map> subFormMap = formDataVo.getSubFormMap(); + List subDataVos = subFormMap.get("甲方签署位置"); + Boolean autoSign = true; + if(subDataVos!= null && subDataVos.size() > 0 && !subDataVos.get(0).isEmpty()){ + for (FormDataVo subDataVo : subDataVos) { + Map 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); + } + pos.add(aQiFengposition); + }else { + autoSign = false; + } + Signer aSigner = createOrgSigner( + fileId,orgName, pos, 1, null, null, null, psnMobile, psnName, null,autoSign + ,sealId); + List signers = new ArrayList<>(); + signers.add(aSigner); + return signers; + } + + private Map buildSignParams(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); + if(fileId == null) { + throw new RuntimeException("合同附件上传E签宝失败"); + } + log.info("E签宝FileId: " + fileId); + } + Map docMap = new HashMap<>(); + Thread.sleep(1000); + docMap.put("fileId", fileId); + List docs = new ArrayList<>(); + docs.add(docMap); + Map signFlowConfig = buildSignFlowConfig(formDataVo, formDataMasterBean); + List signers = buildOnlyASigner(formDataVo, fileId); + Map signParams = new HashMap<>(); + signParams.put("signFlowConfig", signFlowConfig); + signParams.put("signers", signers); + signParams.put("docs", docs); + return signParams; + + } + + private void fillFileId(String fileId,FormDataVo formDataVo,FormDataMasterBean formDataMasterBean) throws NoSuchFieldException, BusinessException { + String tableName = formDataVo.getTableName(); + FormFieldBean fieldBeanByDisplay = formDataMasterBean.getFormTable().getFieldBeanByDisplay("合同文件ID"); + FormDataOperator formDataOperator = new FormDataOperator(); + List updateFields = new ArrayList<>(); + updateFields.add(FormUpdateField.build().fieldName(fieldBeanByDisplay.getColumnName()).value(fileId)); + List whereConditions = new ArrayList<>(); + FormWhereCondition condition = FormWhereCondition.build().value(formDataVo.getId()); + condition.setFieldName("ID"); + whereConditions.add(condition); + formDataOperator.updateMasterForm(updateFields,tableName,whereConditions); + } + + private Map mapOf(Object... keyValues) { + if (keyValues.length % 2 != 0) { + throw new IllegalArgumentException("参数个数必须为偶数:key 和 value 必须成对出现"); + } + Map map = new HashMap<>(); + for (int i = 0; i < keyValues.length; i += 2) { + Object key = keyValues[i]; + Object value = keyValues[i + 1]; + if (!(key instanceof String)) { + throw new IllegalArgumentException("key 必须是 String 类型,当前为:" + key.getClass()); + } + map.put((String) key, value); + } + return map; + } + + private Signer createPsnSigner( String fileId, String psnName,List pos, int order, String phone,Boolean autoSign) { + Signer signer = new Signer(); + signer.setSignerType(0); + signer.setSignConfig(mapOf("signOrder", order)); + if(Boolean.FALSE.equals(autoSign)){ + signer.setNoticeConfig(mapOf("noticeTypes", "1")); + + Map psnInfo = mapOf("psnAccount", phone, "psnInfo", mapOf("psnName", psnName)); + signer.setPsnSignerInfo(psnInfo); + } + + List signFields = new ArrayList<>(); + for (SignFieldPosition po : pos) { + NormalSignFieldConfig fieldConfig = new NormalSignFieldConfig(); + if("ALL".equals(po.getAcrossPageMode())){ + fieldConfig.setSignFieldPosition(po); + fieldConfig.setAutoSign(autoSign); + fieldConfig.setSignFieldStyle(2); + SignField qiFengfield = new SignField(); + qiFengfield.setSignFieldType(0); + qiFengfield.setNormalSignFieldConfig(fieldConfig); + qiFengfield.setFileId(fileId); + signFields.add(qiFengfield); + }else { + fieldConfig.setSignFieldPosition(po); + fieldConfig.setAutoSign(autoSign); + fieldConfig.setSignFieldStyle(1); + SignField field = new SignField(); + field.setSignFieldType(0); + field.setNormalSignFieldConfig(fieldConfig); + field.setFileId(fileId); + signFields.add(field); + } + } + + signer.setSignFields(signFields); + return signer; + } + + private Signer createOrgSigner(String fileId ,String orgName, List pos, int order, + 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 signFields = new ArrayList<>(); + signer.setSignFields(signFields); + if(Boolean.FALSE.equals(autoSign)){ + signer.setNoticeConfig(mapOf("noticeTypes", "1")); + + Map 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 createOrgQiFengSigner(String fileId ,String orgName, SignFieldPosition po, int order, + 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)); + if(Boolean.FALSE.equals(autoSign)){ + signer.setNoticeConfig(mapOf("noticeTypes", "1")); + + Map orgInfo = mapOf("orgName", orgName, + "transactorInfo", mapOf( + "psnAccount", transPhone, + "psnInfo", mapOf( + "psnName", psnName + ) + ) + ); + + signer.setOrgSignerInfo(orgInfo); + } + + List signFields = new ArrayList<>(); + + NormalSignFieldConfig normalSignFieldConfig = new NormalSignFieldConfig(); + normalSignFieldConfig.setAssignedSealId(sealId); + + normalSignFieldConfig.setSignFieldPosition(po); + normalSignFieldConfig.setAutoSign(autoSign); + normalSignFieldConfig.setSignFieldStyle(2); + SignField qiFengfield = new SignField(); + qiFengfield.setSignFieldType(0); + qiFengfield.setNormalSignFieldConfig(normalSignFieldConfig); + qiFengfield.setFileId(fileId); + signFields.add(qiFengfield); + + signer.setSignFields(signFields); + return signer; + } + + + private List extractPosition(List positions, String keyword) { + List posList = new ArrayList<>(); + for (Object obj : positions) { + Map position = (Map) obj; + if (Boolean.TRUE.equals(position.get("searchResult")) && keyword.equals(position.get("keyword"))) { + Object[] posArray = (Object[]) position.get("positions"); + for (Object o : posArray) { + Map posMap = (Map)o; + Object[] coords = (Object[]) posMap.get("coordinates"); + for (Object coord : coords) { + Map tempMap = (Map) coord; + SignFieldPosition sfp = new SignFieldPosition(); + sfp.setPositionPage(posMap.get("pageNum") + ""); + sfp.setPositionX(toFloat(tempMap.get("positionX")) + 150f); + sfp.setPositionY(toFloat(tempMap.get("positionY"))); + posList.add(sfp); + } + } + return posList; + } + } + throw new RuntimeException("未找到关键字位置: " + keyword); + } + + private String getStringField(FormDataVo vo, String field) { + try { + FieldDataVo fieldData = vo.getFieldData(field); + return fieldData.getStringValue(); + }catch (Exception e) { + log.error(e.getMessage()); + return null; + } + } + + private Float toFloat(Object val) { + return val instanceof Number ? ((Number) val).floatValue() : Float.parseFloat(val.toString()); + } + + @Override + public String getNodeId() { + return "nd_20250702"; + } + + @Override + public String getNodeName() { + return "E签宝甲方单方签署节点"; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/node/EsignOrgAuthNode.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/node/EsignOrgAuthNode.java new file mode 100644 index 0000000..5e8249e --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/node/EsignOrgAuthNode.java @@ -0,0 +1,38 @@ +package com.seeyon.apps.src_rent.node; + +import com.seeyon.apps.common.workflow.node.ACommonSuperNode; +import com.seeyon.apps.ext.workflow.vo.FormDataVo; +import com.seeyon.apps.ext.workflow.vo.SuperNodeContext; +import com.seeyon.cap4.form.bean.FormDataMasterBean; + +public class EsignOrgAuthNode extends ACommonSuperNode { + @Override + public String getPluginId() { + return ""; + } + + @Override + public String getFormParse() { + return ""; + } + + @Override + public SuperNodeContext proceed(String s, FormDataVo formDataVo, FormDataMasterBean formDataMasterBean) throws Exception { + //个人实名认证、企业认证处理 + return null; + } + + public void personAuth() { + // /v3/psn-auth-url + } + + @Override + public String getNodeId() { + return ""; + } + + @Override + public String getNodeName() { + return ""; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/node/EsignPersonAuthNode.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/node/EsignPersonAuthNode.java new file mode 100644 index 0000000..a1327d2 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/node/EsignPersonAuthNode.java @@ -0,0 +1,56 @@ +package com.seeyon.apps.src_rent.node; + +import com.seeyon.apps.common.workflow.node.ACommonSuperNode; +import com.seeyon.apps.ext.workflow.vo.FormDataVo; +import com.seeyon.apps.ext.workflow.vo.SuperNodeContext; +import com.seeyon.apps.src_rent.po.AuthPsnInfo; +import com.seeyon.apps.src_rent.po.PsnAuthConfig; +import com.seeyon.cap4.form.bean.FormDataMasterBean; + +import java.util.HashMap; +import java.util.Map; + +public class EsignPersonAuthNode extends ACommonSuperNode { + @Override + public String getPluginId() { + return ""; + } + + @Override + public String getFormParse() { + return ""; + } + + @Override + public SuperNodeContext proceed(String s, FormDataVo formDataVo, FormDataMasterBean formDataMasterBean) throws Exception { + Map authParams = new HashMap<>(); + PsnAuthConfig psnAuthConfig = buildPsnAuthConfig(formDataVo,formDataMasterBean); + String notifyUrl= ""; + authParams.put("psnAuthConfig",psnAuthConfig); + authParams.put("notifyUrl",notifyUrl); + + return null; + } + + private PsnAuthConfig buildPsnAuthConfig(FormDataVo formDataVo, FormDataMasterBean formDataMasterBean) throws Exception { + PsnAuthConfig psnAuthConfig = new PsnAuthConfig(); + psnAuthConfig.setPsnAccount(formDataVo.getFieldData("客户联系电话").getStringValue()); + AuthPsnInfo authPsnInfo = new AuthPsnInfo(); + authPsnInfo.setPsnName(formDataVo.getFieldData("客户联系人姓名").getStringValue()); + authPsnInfo.setPsnMobile(formDataVo.getFieldData("客户联系电话").getStringValue()); + authPsnInfo.setPsnIDCardType("CRED_PSN_CH_IDCARD"); + authPsnInfo.setPsnIDCardNum(formDataVo.getFieldData("客户身份证号").getStringValue()); + authPsnInfo.setPsnIdentityVerify(true); + return psnAuthConfig; + } + + @Override + public String getNodeId() { + return ""; + } + + @Override + public String getNodeName() { + return ""; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/notice/NoticeService.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/notice/NoticeService.java new file mode 100644 index 0000000..1711d80 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/notice/NoticeService.java @@ -0,0 +1,104 @@ +package com.seeyon.apps.src_rent.notice; + +import com.alibaba.fastjson.JSONObject; +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.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.util.ArrayList; +import java.util.List; +import java.util.Map; + +@Component +public class NoticeService { + + @Autowired + private RentConfigProvider configProvider; + @Autowired + private FormDataOperator formDataOperator; + private AttachmentManager attachmentManager = (AttachmentManager) AppContext.getBean("attachmentManager"); + + private String getFormNo() { + return configProvider.getBizConfigByKey(RentConstants.NOTICEFORMNO); + } + + public PageQueryVo pageQuery(JSONObject params) throws Exception { + List conditions = buildConditions(params); + Integer pageNo = params.getInteger("pageNo") == null ? 1 : params.getInteger("pageNo"); + Integer pageSize = params.getInteger("pageSize") == null ? 10 : params.getInteger("pageSize"); + PageQueryVo pageQueryVo = new PageQueryVo(); + List datas = formDataOperator.queryFormDataPageCondition(getFormNo(), true,null, conditions, pageNo, pageSize); + List vos = new ArrayList<>(); + Long count = formDataOperator.countConditon(getFormNo(), conditions); + if(datas.size() > 0){ + for (Object data : datas) { + Map map = (Map) data; + NoticeVo vo = new NoticeVo(); + fillVo(map, vo); + vos.add(vo); + } + pageQueryVo.setDatas(vos); + pageQueryVo.setTotalCount(count); + } + return pageQueryVo; + } + + private List buildConditions(JSONObject params) { + List conditions = new ArrayList<>(); + if(StringUtils.isNotBlank(params.getString("assetsNo"))) { + conditions.add(FormWhereCondition.build().display("资产编号").value(params.getString("assetsNo"))); + } + if(StringUtils.isNotBlank(params.getString("id"))) { + conditions.add(FormWhereCondition.build().display("id").value(params.getString("id"))); + } + conditions.add(FormWhereCondition.build().display("是否同步小程序").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"是否同步小程序","是"))); + conditions.add(FormWhereCondition.build().display("招商状态").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"招商状态","上架"))); + return conditions; + } + + public NoticeVo queryNoticeDetail(JSONObject params) throws Exception { + List conditions = buildConditions(params); + NoticeVo vo = new NoticeVo(); + FormColumn formColumn = formDataOperator.queryOneRowFormData(getFormNo(),true, null, conditions); + if(formColumn == null) { + return vo; + } + Map fieldsMap = formColumn.getFieldsMap(); + fillVo(fieldsMap,vo); + return vo; + } + + private String getStringValue(Map fieldsMap,String key) { + Object o = fieldsMap.get(key); + if(o == null) { + return null; + } + return o + ""; + } + + public void fillVo(Map fieldsMap,NoticeVo vo) { + vo.setNoticeId(getStringValue(fieldsMap,"id")); + vo.setNoticeTitle(getStringValue(fieldsMap,"公告标题")); + vo.setNoticeContent(getStringValue(fieldsMap,"招租公告")); + vo.setCreateTime(fieldsMap.get("申请日期") + ""); + if(fieldsMap.get("相关附件") != null) { + vo.setAttachments(OaFileVo.getInstance((Long)fieldsMap.get("相关附件"),attachmentManager)); + } + if(fieldsMap.get("VR文件") != null) { + + vo.setImgs(OaFileVo.getInstance((Long)fieldsMap.get("VR文件"),attachmentManager)); + } + vo.setNoticeType("bussiness"); + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/notice/NoticeVo.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/notice/NoticeVo.java new file mode 100644 index 0000000..68cff00 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/notice/NoticeVo.java @@ -0,0 +1,115 @@ +package com.seeyon.apps.src_rent.notice; + +import com.seeyon.apps.src_rent.file.OaFileVo; + +import java.util.List; + +public class NoticeVo { + private String noticeId; + private String noticeTitle; + private String noticeType; + private String noticeContent; + private String status; + private String createBy; + private String createTime; + private String updateBy; + private String updateTime; + private String remark; + private OaFileVo attachments; //详情图片 + private OaFileVo imgs; //vr图 + public String getNoticeId() { + return noticeId; + } + + public void setNoticeId(String noticeId) { + this.noticeId = noticeId; + } + + public String getNoticeTitle() { + return noticeTitle; + } + + public void setNoticeTitle(String noticeTitle) { + this.noticeTitle = noticeTitle; + } + + public String getNoticeType() { + return noticeType; + } + + public void setNoticeType(String noticeType) { + this.noticeType = noticeType; + } + + public String getNoticeContent() { + return noticeContent; + } + + public void setNoticeContent(String noticeContent) { + this.noticeContent = noticeContent; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateBy() { + return createBy; + } + + public void setCreateBy(String createBy) { + this.createBy = createBy; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getUpdateBy() { + return updateBy; + } + + public void setUpdateBy(String updateBy) { + this.updateBy = updateBy; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public OaFileVo getAttachments() { + return attachments; + } + + public void setAttachments(OaFileVo attachments) { + this.attachments = attachments; + } + + public OaFileVo getImgs() { + return imgs; + } + + public void setImgs(OaFileVo imgs) { + this.imgs = imgs; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/AuthPsnInfo.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/AuthPsnInfo.java new file mode 100644 index 0000000..e5e52bc --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/AuthPsnInfo.java @@ -0,0 +1,61 @@ +package com.seeyon.apps.src_rent.po; + +import com.fasterxml.jackson.annotation.JsonInclude; + +@JsonInclude(JsonInclude.Include.NON_EMPTY) +public class AuthPsnInfo { + private String psnName; + private String psnIDCardNum; + private String psnIDCardType; + private String psnMobile; + private String bankCardNum; + private Boolean psnIdentityVerify; + + public String getPsnName() { + return psnName; + } + + public void setPsnName(String psnName) { + this.psnName = psnName; + } + + public String getPsnIDCardNum() { + return psnIDCardNum; + } + + public void setPsnIDCardNum(String psnIDCardNum) { + this.psnIDCardNum = psnIDCardNum; + } + + public String getPsnIDCardType() { + return psnIDCardType; + } + + public void setPsnIDCardType(String psnIDCardType) { + this.psnIDCardType = psnIDCardType; + } + + public String getPsnMobile() { + return psnMobile; + } + + public void setPsnMobile(String psnMobile) { + this.psnMobile = psnMobile; + } + + public String getBankCardNum() { + return bankCardNum; + } + + public void setBankCardNum(String bankCardNum) { + this.bankCardNum = bankCardNum; + } + + public Boolean getPsnIdentityVerify() { + return psnIdentityVerify; + } + + public void setPsnIdentityVerify(Boolean psnIdentityVerify) { + this.psnIdentityVerify = psnIdentityVerify; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/ContractFile.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/ContractFile.java new file mode 100644 index 0000000..5e5d1f0 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/ContractFile.java @@ -0,0 +1,61 @@ +package com.seeyon.apps.src_rent.po; + +import com.fasterxml.jackson.annotation.JsonInclude; + +@JsonInclude(JsonInclude.Include.NON_EMPTY) +public class ContractFile { + private String fileId; + private String fileName; + private Boolean neededPwd; + private String fileEditPwd; + private String contractBizTypeId; + private int order; + + public String getFileId() { + return fileId; + } + + public void setFileId(String fileId) { + this.fileId = fileId; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public Boolean getNeededPwd() { + return neededPwd; + } + + public void setNeededPwd(Boolean neededPwd) { + this.neededPwd = neededPwd; + } + + public String getFileEditPwd() { + return fileEditPwd; + } + + public void setFileEditPwd(String fileEditPwd) { + this.fileEditPwd = fileEditPwd; + } + + public String getContractBizTypeId() { + return contractBizTypeId; + } + + public void setContractBizTypeId(String contractBizTypeId) { + this.contractBizTypeId = contractBizTypeId; + } + + public int getOrder() { + return order; + } + + public void setOrder(int order) { + this.order = order; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/EsignApiHeader.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/EsignApiHeader.java new file mode 100644 index 0000000..58c29d4 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/EsignApiHeader.java @@ -0,0 +1,219 @@ +package com.seeyon.apps.src_rent.po; + +import org.apache.commons.codec.binary.Base64; +import org.apache.commons.lang.StringUtils; + +import javax.crypto.Mac; +import javax.crypto.spec.SecretKeySpec; +import java.io.UnsupportedEncodingException; +import java.nio.charset.StandardCharsets; +import java.security.InvalidKeyException; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.text.MessageFormat; +import java.util.HashMap; +import java.util.Map; + +public class EsignApiHeader { + private String xTsignOpenAppId; + private String xTsignOpenAuthMode; + private String xTsignOpenCaSignature; + private String xTsignOpenCaTimestamp; + private String accept; + private String contentType = "application/json; charset=UTF-8"; + private String contentMd5; + private String httpMethod; + private String date; + private String headers; + private String pathAndParameters; + private String token; + + public String getxTsignOpenAppId() { + return xTsignOpenAppId; + } + + public void setxTsignOpenAppId(String xTsignOpenAppId) { + this.xTsignOpenAppId = xTsignOpenAppId; + } + + public String getX_Tsign_Open_Auth_Mode() { + return xTsignOpenAuthMode; + } + + public void setX_Tsign_Open_Auth_Mode(String x_Tsign_Open_Auth_Mode) { + this.xTsignOpenAuthMode = x_Tsign_Open_Auth_Mode; + } + + public String getxTsignOpenCaSignature() { + return xTsignOpenCaSignature; + } + + public void setxTsignOpenCaSignature(String xTsignOpenCaSignature) { + this.xTsignOpenCaSignature = xTsignOpenCaSignature; + } + + public String getxTsignOpenCaTimestamp() { + return xTsignOpenCaTimestamp; + } + + public void setxTsignOpenCaTimestamp(String xTsignOpenCaTimestamp) { + this.xTsignOpenCaTimestamp = xTsignOpenCaTimestamp; + } + + public String getAccept() { + return accept; + } + + public void setAccept(String accept) { + this.accept = accept; + } + + public String getContentType() { + return contentType; + } + + public void setContentType(String contentType) { + this.contentType = contentType; + } + + public String getContentMd5() { + return contentMd5; + } + + public void setContentMd5(String contentMd5) { + this.contentMd5 = contentMd5; + } + + public static EsignApiHeader build() { + EsignApiHeader header = new EsignApiHeader(); + header.setAccept("*/*"); + header.setX_Tsign_Open_Auth_Mode("Signature"); + return header; + } + + public EsignApiHeader pathAndParameters(String pathAndParameters) { + this.pathAndParameters = pathAndParameters; + return this; + } + + public EsignApiHeader appId(String appId) { + this.xTsignOpenAppId = appId; + return this; + } + + public EsignApiHeader heads(String headers) { + this.headers = headers; + return this; + } + + public EsignApiHeader timeStamp() { + this.xTsignOpenCaTimestamp = System.currentTimeMillis() + ""; + return this; + } + + public EsignApiHeader token(String token) { + this.token = token; + return this; + } + + public EsignApiHeader contentMD5(String body) { + this.contentMd5 = getBodyContentMD5(body); + return this; + } + + public EsignApiHeader httpMethod(String httpMethod) { + this.httpMethod = httpMethod; + return this; + } + + public EsignApiHeader signature(String secret) throws Exception { + StringBuffer strBuff = new StringBuffer(); + strBuff.append(httpMethod).append("\n").append(accept).append("\n").append(contentMd5).append("\n") + .append(contentType).append("\n").append("").append("\n"); + if ("".equals(headers)) { + strBuff.append(headers).append(pathAndParameters); + } else { + strBuff.append(headers).append("\n").append(pathAndParameters); + } + String StringToSign = strBuff.toString(); + this.setxTsignOpenCaSignature(doSignatureBase64(StringToSign, secret)); + return this; + } + + + public String doSignatureBase64(String message, String secret) throws Exception { + String algorithm = "HmacSHA256"; + Mac hmacSha256; + String digestBase64 = null; + try { + hmacSha256 = Mac.getInstance(algorithm); + byte[] keyBytes = secret.getBytes("UTF-8"); + byte[] messageBytes = message.getBytes("UTF-8"); + hmacSha256.init(new SecretKeySpec(keyBytes, 0, keyBytes.length, algorithm)); + // 使用HmacSHA256对二进制数据消息Bytes计算摘要 + byte[] digestBytes = hmacSha256.doFinal(messageBytes); + // 把摘要后的结果digestBytes使用Base64进行编码 + digestBase64 = new String(Base64.encodeBase64(digestBytes), "UTF-8"); + } catch (NoSuchAlgorithmException e) { + String msg = MessageFormat.format("不支持此算法: {0}", e.getMessage()); + Exception ex = new Exception(msg); + ex.initCause(e); + throw ex; + } catch (UnsupportedEncodingException e) { + String msg = MessageFormat.format("不支持的字符编码: {0}", e.getMessage()); + Exception ex = new Exception(msg); + ex.initCause(e); + throw ex; + } catch (InvalidKeyException e) { + String msg = MessageFormat.format("无效的密钥规范: {0}", e.getMessage()); + Exception ex = new Exception(msg); + ex.initCause(e); + throw ex; + } + return digestBase64; + } + + /*** + * 计算请求Body体的Content-MD5 + * @param bodyData 请求Body体数据 + * @return + */ + public String getBodyContentMD5(String bodyData) { + if("".equals(bodyData)) { + return bodyData; + } + // 获取Body体的MD5的二进制数组(128位) + byte[] bytes = getBodyMD5Bytes128(bodyData); + // 对Body体MD5的二进制数组进行Base64编码 + return new String(Base64.encodeBase64(bytes)); + } + + public byte[] getBodyMD5Bytes128(String bodyData) { + byte[] md5Bytes = null; + try { + MessageDigest md5 = MessageDigest.getInstance("MD5"); + md5.update(bodyData.getBytes(StandardCharsets.UTF_8)); + md5Bytes = md5.digest(); + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } + return md5Bytes; + } + + public Map convert2Headers(){ + Map headers = new HashMap<>(); + if(xTsignOpenAppId != null) { + headers.put("X-Tsign-Open-App-Id", xTsignOpenAppId); + } + if(token != null) { + headers.put("X-Tsign-Open-Token", token); + } + if(contentType != null) { + headers.put("Content-Type", contentType); + } + if(!StringUtils.isBlank(contentMd5)) { + headers.put("Content-MD5", contentMd5); + } + return headers; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/EsignBaseResp.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/EsignBaseResp.java new file mode 100644 index 0000000..2856151 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/EsignBaseResp.java @@ -0,0 +1,31 @@ +package com.seeyon.apps.src_rent.po; + +public class EsignBaseResp { + private int code; + private String message; + private Object data; + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public Object getData() { + return data; + } + + public void setData(Object data) { + this.data = data; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/EsignCallbackOperator.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/EsignCallbackOperator.java new file mode 100644 index 0000000..369154c --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/EsignCallbackOperator.java @@ -0,0 +1,6 @@ +package com.seeyon.apps.src_rent.po; + +public class EsignCallbackOperator { + + +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/EsignCallbackParams.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/EsignCallbackParams.java new file mode 100644 index 0000000..10230da --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/EsignCallbackParams.java @@ -0,0 +1,64 @@ +package com.seeyon.apps.src_rent.po; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +import java.io.Serializable; + +@JsonIgnoreProperties(ignoreUnknown = true) +public class EsignCallbackParams implements Serializable { + + private String signFlowId; + private String action; + private String resultDescription; //签署结果描述 + private Integer signResult; //签署结果 + private Integer signFlowStatus; //签署流程状态 + private Integer signOrder; //签署顺序 + + public String getSignFlowId() { + return signFlowId; + } + + public void setSignFlowId(String signFlowId) { + this.signFlowId = signFlowId; + } + + public String getAction() { + return action; + } + + public void setAction(String action) { + this.action = action; + } + + public String getResultDescription() { + return resultDescription; + } + + public void setResultDescription(String resultDescription) { + this.resultDescription = resultDescription; + } + + public Integer getSignResult() { + return signResult; + } + + public void setSignResult(Integer signResult) { + this.signResult = signResult; + } + + public Integer getSignFlowStatus() { + return signFlowStatus; + } + + public void setSignFlowStatus(Integer signFlowStatus) { + this.signFlowStatus = signFlowStatus; + } + + public Integer getSignOrder() { + return signOrder; + } + + public void setSignOrder(Integer signOrder) { + this.signOrder = signOrder; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/EsignException.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/EsignException.java new file mode 100644 index 0000000..02f0efb --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/EsignException.java @@ -0,0 +1,36 @@ +package com.seeyon.apps.src_rent.po; + +/** + * description 自定义全局异常 + * @author 澄泓 + * datetime 2019年7月1日上午10:43:24 + */ +public class EsignException extends Exception { + + private static final long serialVersionUID = 4359180081622082792L; + private Exception e; + + public EsignException(String msg) { + super(msg); + } + + public EsignException(String msg, Throwable cause) { + super(msg,cause); + } + + public EsignException(){ + + } + + public Exception getE() { + return e; + } + + public void setE(Exception e) { + this.e = e; + } + + + + +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/EsignFileUploadParams.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/EsignFileUploadParams.java new file mode 100644 index 0000000..62982ac --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/EsignFileUploadParams.java @@ -0,0 +1,49 @@ +package com.seeyon.apps.src_rent.po; + +public class EsignFileUploadParams { + private String contentMd5; + private String contentType; + private String fileName; + private Long fileSize; + private Boolean convertToPDF = false; + + public String getContentMd5() { + return contentMd5; + } + + public void setContentMd5(String contentMd5) { + this.contentMd5 = contentMd5; + } + + public String getContentType() { + return contentType; + } + + public void setContentType(String contentType) { + this.contentType = contentType; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public Long getFileSize() { + return fileSize; + } + + public void setFileSize(Long fileSize) { + this.fileSize = fileSize; + } + + public Boolean getConvertToPDF() { + return convertToPDF; + } + + public void setConvertToPDF(Boolean convertToPDF) { + this.convertToPDF = convertToPDF; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/EsignHttpResponse.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/EsignHttpResponse.java new file mode 100644 index 0000000..1fc2837 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/EsignHttpResponse.java @@ -0,0 +1,27 @@ +package com.seeyon.apps.src_rent.po; +/** + * 网络请求的response类 + * @author 澄泓 + * @date 2022/2/21 17:28 + * @version + */ +public class EsignHttpResponse { + private int status; + private String body; + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public String getBody() { + return body; + } + + public void setBody(String body) { + this.body = body; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/EsignToken.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/EsignToken.java new file mode 100644 index 0000000..834ff62 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/EsignToken.java @@ -0,0 +1,34 @@ +package com.seeyon.apps.src_rent.po; + +import java.io.Serializable; + +public class EsignToken implements Serializable { + + private String tokenStr; + private Long ttl; + private String refreshToken; + + public String getTokenStr() { + return tokenStr; + } + + public void setTokenStr(String tokenStr) { + this.tokenStr = tokenStr; + } + + public Long getTtl() { + return ttl; + } + + public void setTtl(Long ttl) { + this.ttl = ttl; + } + + public String getRefreshToken() { + return refreshToken; + } + + public void setRefreshToken(String refreshToken) { + this.refreshToken = refreshToken; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/GetUploadUrlResp.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/GetUploadUrlResp.java new file mode 100644 index 0000000..331c616 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/GetUploadUrlResp.java @@ -0,0 +1,23 @@ +package com.seeyon.apps.src_rent.po; + +public class GetUploadUrlResp { + + private String fileId; + private String fileUploadUrl; + + public String getFileId() { + return fileId; + } + + public void setFileId(String fileId) { + this.fileId = fileId; + } + + public String getFileUploadUrl() { + return fileUploadUrl; + } + + public void setFileUploadUrl(String fileUploadUrl) { + this.fileUploadUrl = fileUploadUrl; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/NormalSignFieldConfig.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/NormalSignFieldConfig.java new file mode 100644 index 0000000..e5fa369 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/NormalSignFieldConfig.java @@ -0,0 +1,58 @@ +package com.seeyon.apps.src_rent.po; + +public class NormalSignFieldConfig { + private Boolean autoSign; + private Integer signFieldStyle; + private SignFieldPosition signFieldPosition; + private String assignedSealId; //指定签章id + private Boolean freeMode = false; + private Boolean adaptableSignFieldSize;//是否自适应签章大小 + + public Boolean getAutoSign() { + return autoSign; + } + + public void setAutoSign(Boolean autoSign) { + this.autoSign = autoSign; + } + + public Integer getSignFieldStyle() { + return signFieldStyle; + } + + public void setSignFieldStyle(Integer signFieldStyle) { + this.signFieldStyle = signFieldStyle; + } + + public SignFieldPosition getSignFieldPosition() { + return signFieldPosition; + } + + public void setSignFieldPosition(SignFieldPosition signFieldPosition) { + this.signFieldPosition = signFieldPosition; + } + + public String getAssignedSealId() { + return assignedSealId; + } + + public void setAssignedSealId(String assignedSealId) { + this.assignedSealId = assignedSealId; + } + + public Boolean getFreeMode() { + return freeMode; + } + + public void setFreeMode(Boolean freeMode) { + this.freeMode = freeMode; + } + + public Boolean getAdaptableSignFieldSize() { + return adaptableSignFieldSize; + } + + public void setAdaptableSignFieldSize(Boolean adaptableSignFieldSize) { + this.adaptableSignFieldSize = adaptableSignFieldSize; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/OaResp.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/OaResp.java new file mode 100644 index 0000000..743c3a2 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/OaResp.java @@ -0,0 +1,31 @@ +package com.seeyon.apps.src_rent.po; + +public class OaResp { + private Integer code; + private String message; + private Object data; + + public Integer getCode() { + return code; + } + + public void setCode(Integer code) { + this.code = code; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public Object getData() { + return data; + } + + public void setData(Object data) { + this.data = data; + } + } \ No newline at end of file diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/OrgBaseInfo.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/OrgBaseInfo.java new file mode 100644 index 0000000..314fce3 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/OrgBaseInfo.java @@ -0,0 +1,6 @@ +package com.seeyon.apps.src_rent.po; + +public class OrgBaseInfo { + private String orgIDCardNum; + private String legalRepName; +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/OrgInitiator.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/OrgInitiator.java new file mode 100644 index 0000000..157f7d7 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/OrgInitiator.java @@ -0,0 +1,22 @@ +package com.seeyon.apps.src_rent.po; + +public class OrgInitiator { + private String orgId; + private Transactor transactor; + + public String getOrgId() { + return orgId; + } + + public void setOrgId(String orgId) { + this.orgId = orgId; + } + + public Transactor getTransactor() { + return transactor; + } + + public void setTransactor(Transactor transactor) { + this.transactor = transactor; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/PageQueryVo.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/PageQueryVo.java new file mode 100644 index 0000000..6e91d87 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/PageQueryVo.java @@ -0,0 +1,25 @@ +package com.seeyon.apps.src_rent.po; + +import java.util.ArrayList; +import java.util.List; + +public class PageQueryVo{ + private Long totalCount = 0l; + private List datas; + + public Long getTotalCount() { + return totalCount; + } + + public void setTotalCount(Long totalCount) { + this.totalCount = totalCount; + } + + public List getDatas() { + return datas; + } + + public void setDatas(List datas) { + this.datas = datas; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/PsnAuthConfig.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/PsnAuthConfig.java new file mode 100644 index 0000000..e25ea5d --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/PsnAuthConfig.java @@ -0,0 +1,40 @@ +package com.seeyon.apps.src_rent.po; + +public class PsnAuthConfig { + private String psnAccount; + private String psnId; + private AuthPsnInfo psnInfo; + private PsnAuthPageConfig psnAuthPageConfig; + + public String getPsnAccount() { + return psnAccount; + } + + public void setPsnAccount(String psnAccount) { + this.psnAccount = psnAccount; + } + + public String getPsnId() { + return psnId; + } + + public void setPsnId(String psnId) { + this.psnId = psnId; + } + + public AuthPsnInfo getPsnInfo() { + return psnInfo; + } + + public void setPsnInfo(AuthPsnInfo psnInfo) { + this.psnInfo = psnInfo; + } + + public PsnAuthPageConfig getPsnAuthPageConfig() { + return psnAuthPageConfig; + } + + public void setPsnAuthPageConfig(PsnAuthPageConfig psnAuthPageConfig) { + this.psnAuthPageConfig = psnAuthPageConfig; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/PsnAuthPageConfig.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/PsnAuthPageConfig.java new file mode 100644 index 0000000..cc7908d --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/PsnAuthPageConfig.java @@ -0,0 +1,45 @@ +package com.seeyon.apps.src_rent.po; + +import com.fasterxml.jackson.annotation.JsonInclude; + +import java.util.List; + +@JsonInclude(JsonInclude.Include.NON_EMPTY) +public class PsnAuthPageConfig { + private String psnDefaultAuthMode; + private List psnAvailableAuthModes; + private List advancedVersion; + private List psnEditableFields; + + public String getPsnDefaultAuthMode() { + return psnDefaultAuthMode; + } + + public void setPsnDefaultAuthMode(String psnDefaultAuthMode) { + this.psnDefaultAuthMode = psnDefaultAuthMode; + } + + public List getPsnAvailableAuthModes() { + return psnAvailableAuthModes; + } + + public void setPsnAvailableAuthModes(List psnAvailableAuthModes) { + this.psnAvailableAuthModes = psnAvailableAuthModes; + } + + public List getAdvancedVersion() { + return advancedVersion; + } + + public void setAdvancedVersion(List advancedVersion) { + this.advancedVersion = advancedVersion; + } + + public List getPsnEditableFields() { + return psnEditableFields; + } + + public void setPsnEditableFields(List psnEditableFields) { + this.psnEditableFields = psnEditableFields; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/PsnInitiator.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/PsnInitiator.java new file mode 100644 index 0000000..cf0be60 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/PsnInitiator.java @@ -0,0 +1,13 @@ +package com.seeyon.apps.src_rent.po; + +public class PsnInitiator { + private String psnId; + + public String getPsnId() { + return psnId; + } + + public void setPsnId(String psnId) { + this.psnId = psnId; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/RemarkSignFieldConfig.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/RemarkSignFieldConfig.java new file mode 100644 index 0000000..0ea460a --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/RemarkSignFieldConfig.java @@ -0,0 +1,32 @@ +package com.seeyon.apps.src_rent.po; + +public class RemarkSignFieldConfig { + + private boolean freeMode = false; + private int inputType = 1; + private String remarkContent = ""; + + public boolean isFreeMode() { + return freeMode; + } + + public void setFreeMode(boolean freeMode) { + this.freeMode = freeMode; + } + + public int getInputType() { + return inputType; + } + + public void setInputType(int inputType) { + this.inputType = inputType; + } + + public String getRemarkContent() { + return remarkContent; + } + + public void setRemarkContent(String remarkContent) { + this.remarkContent = remarkContent; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/RestUser.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/RestUser.java new file mode 100644 index 0000000..7ee33b6 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/RestUser.java @@ -0,0 +1,32 @@ +package com.seeyon.apps.src_rent.po; + +public class RestUser { + + private String restName; + private String restPassword; + private String loginName; + + public String getRestName() { + return restName; + } + + public void setRestName(String restName) { + this.restName = restName; + } + + public String getRestPassword() { + return restPassword; + } + + public void setRestPassword(String restPassword) { + this.restPassword = restPassword; + } + + public String getLoginName() { + return loginName; + } + + public void setLoginName(String loginName) { + this.loginName = loginName; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/SealInfoVo.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/SealInfoVo.java new file mode 100644 index 0000000..9ccdad7 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/SealInfoVo.java @@ -0,0 +1,50 @@ +package com.seeyon.apps.src_rent.po; + +public class SealInfoVo { + + private String sealId; //印章ID + private String sealName; //印章名称 + private String sealBizTypeDescription; //印章描述 + private String statusDescription; //印章状态描述 + private String sealImageDownloadUrl; //印章图片下载地址 + + public String getSealId() { + return sealId; + } + + public void setSealId(String sealId) { + this.sealId = sealId; + } + + public String getSealName() { + return sealName; + } + + public void setSealName(String sealName) { + this.sealName = sealName; + } + + public String getSealBizTypeDescription() { + return sealBizTypeDescription; + } + + public void setSealBizTypeDescription(String sealBizTypeDescription) { + this.sealBizTypeDescription = sealBizTypeDescription; + } + + public String getStatusDescription() { + return statusDescription; + } + + public void setStatusDescription(String statusDescription) { + this.statusDescription = statusDescription; + } + + public String getSealImageDownloadUrl() { + return sealImageDownloadUrl; + } + + public void setSealImageDownloadUrl(String sealImageDownloadUrl) { + this.sealImageDownloadUrl = sealImageDownloadUrl; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/SignDateConfig.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/SignDateConfig.java new file mode 100644 index 0000000..2b1cbf6 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/SignDateConfig.java @@ -0,0 +1,31 @@ +package com.seeyon.apps.src_rent.po; + +public class SignDateConfig { + private String dateFormat = "yyyy年MM月dd日"; + private Integer fontSize = 20; + private Integer showSignDate = 1; + + public String getDateFormat() { + return dateFormat; + } + + public void setDateFormat(String dateFormat) { + this.dateFormat = dateFormat; + } + + public Integer getFontSize() { + return fontSize; + } + + public void setFontSize(Integer fontSize) { + this.fontSize = fontSize; + } + + public Integer getShowSignDate() { + return showSignDate; + } + + public void setShowSignDate(Integer showSignDate) { + this.showSignDate = showSignDate; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/SignField.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/SignField.java new file mode 100644 index 0000000..dfdc55e --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/SignField.java @@ -0,0 +1,42 @@ +package com.seeyon.apps.src_rent.po; + +public class SignField { + + private String fileId; + private Integer signFieldType; + private NormalSignFieldConfig normalSignFieldConfig; + private RemarkSignFieldConfig remarkSignFieldConfig; + + public String getFileId() { + return fileId; + } + + public void setFileId(String fileId) { + this.fileId = fileId; + } + + public Integer getSignFieldType() { + return signFieldType; + } + + public void setSignFieldType(Integer signFieldType) { + this.signFieldType = signFieldType; + } + + public NormalSignFieldConfig getNormalSignFieldConfig() { + return normalSignFieldConfig; + } + + public void setNormalSignFieldConfig(NormalSignFieldConfig normalSignFieldConfig) { + this.normalSignFieldConfig = normalSignFieldConfig; + } + + public RemarkSignFieldConfig getRemarkSignFieldConfig() { + return remarkSignFieldConfig; + } + + public void setRemarkSignFieldConfig(RemarkSignFieldConfig remarkSignFieldConfig) { + this.remarkSignFieldConfig = remarkSignFieldConfig; + } + +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/SignFieldPosition.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/SignFieldPosition.java new file mode 100644 index 0000000..2df91f1 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/SignFieldPosition.java @@ -0,0 +1,41 @@ +package com.seeyon.apps.src_rent.po; + +public class SignFieldPosition { + + private String acrossPageMode; + private String positionPage; + private Float positionX; + private Float positionY; + + public String getAcrossPageMode() { + return acrossPageMode; + } + + public void setAcrossPageMode(String acrossPageMode) { + this.acrossPageMode = acrossPageMode; + } + + public String getPositionPage() { + return positionPage; + } + + public void setPositionPage(String positionPage) { + this.positionPage = positionPage; + } + + public Float getPositionX() { + return positionX; + } + + public void setPositionX(Float positionX) { + this.positionX = positionX; + } + + public Float getPositionY() { + return positionY; + } + + public void setPositionY(Float positionY) { + this.positionY = positionY; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/SignFile.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/SignFile.java new file mode 100644 index 0000000..55e5c7a --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/SignFile.java @@ -0,0 +1,22 @@ +package com.seeyon.apps.src_rent.po; + +public class SignFile { + private String fileName; + private String fileId; + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getFileId() { + return fileId; + } + + public void setFileId(String fileId) { + this.fileId = fileId; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/SignFlowConfig.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/SignFlowConfig.java new file mode 100644 index 0000000..e3c4570 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/SignFlowConfig.java @@ -0,0 +1,127 @@ +package com.seeyon.apps.src_rent.po; + +import com.fasterxml.jackson.annotation.JsonInclude; + +import java.util.List; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_EMPTY) +public class SignFlowConfig { + private String signFlowTitle; + private Long signFlowExpireTime; + private Boolean autoStart; + private Boolean autoFinish; + private Boolean identifyVerify; + private String notifyUrl; + private Map redirectConfig; + private Map signConfig; + private Map noticeConfig; + private Map authConfig; + private Map contractConfig; + private List contractGroupIds; + private Boolean docsViewLimited; + + public String getSignFlowTitle() { + return signFlowTitle; + } + + public void setSignFlowTitle(String signFlowTitle) { + this.signFlowTitle = signFlowTitle; + } + + public Long getSignFlowExpireTime() { + return signFlowExpireTime; + } + + public void setSignFlowExpireTime(Long signFlowExpireTime) { + this.signFlowExpireTime = signFlowExpireTime; + } + + public Boolean getAutoStart() { + return autoStart; + } + + public void setAutoStart(Boolean autoStart) { + this.autoStart = autoStart; + } + + public Boolean getAutoFinish() { + return autoFinish; + } + + public void setAutoFinish(Boolean autoFinish) { + this.autoFinish = autoFinish; + } + + public Boolean getIdentifyVerify() { + return identifyVerify; + } + + public void setIdentifyVerify(Boolean identifyVerify) { + this.identifyVerify = identifyVerify; + } + + public String getNotifyUrl() { + return notifyUrl; + } + + public void setNotifyUrl(String notifyUrl) { + this.notifyUrl = notifyUrl; + } + + public Map getRedirectConfig() { + return redirectConfig; + } + + public void setRedirectConfig(Map redirectConfig) { + this.redirectConfig = redirectConfig; + } + + public Map getSignConfig() { + return signConfig; + } + + public void setSignConfig(Map signConfig) { + this.signConfig = signConfig; + } + + public Map getNoticeConfig() { + return noticeConfig; + } + + public void setNoticeConfig(Map noticeConfig) { + this.noticeConfig = noticeConfig; + } + + public Map getAuthConfig() { + return authConfig; + } + + public void setAuthConfig(Map authConfig) { + this.authConfig = authConfig; + } + + public Map getContractConfig() { + return contractConfig; + } + + public void setContractConfig(Map contractConfig) { + this.contractConfig = contractConfig; + } + + public List getContractGroupIds() { + return contractGroupIds; + } + + public void setContractGroupIds(List contractGroupIds) { + this.contractGroupIds = contractGroupIds; + } + + public Boolean getDocsViewLimited() { + return docsViewLimited; + } + + public void setDocsViewLimited(Boolean docsViewLimited) { + this.docsViewLimited = docsViewLimited; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/SignFlowInitiator.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/SignFlowInitiator.java new file mode 100644 index 0000000..2471bd3 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/SignFlowInitiator.java @@ -0,0 +1,37 @@ +package com.seeyon.apps.src_rent.po; + +import com.fasterxml.jackson.annotation.JsonInclude; + +import java.util.List; + +@JsonInclude(JsonInclude.Include.NON_EMPTY) +public class SignFlowInitiator { + + private OrgInitiator orgInitiator; + private PsnInitiator psnInitiator; + private List initialRemarks; + + public PsnInitiator getPsnInitiator() { + return psnInitiator; + } + + public void setPsnInitiator(PsnInitiator psnInitiator) { + this.psnInitiator = psnInitiator; + } + + public List getInitialRemarks() { + return initialRemarks; + } + + public void setInitialRemarks(List initialRemarks) { + this.initialRemarks = initialRemarks; + } + + public OrgInitiator getOrgInitiator() { + return orgInitiator; + } + + public void setOrgInitiator(OrgInitiator orgInitiator) { + this.orgInitiator = orgInitiator; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/Signer.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/Signer.java new file mode 100644 index 0000000..2e1a0c6 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/Signer.java @@ -0,0 +1,64 @@ +package com.seeyon.apps.src_rent.po; + +import com.fasterxml.jackson.annotation.JsonInclude; + +import java.util.List; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_EMPTY) +public class Signer { + private int signerType; + private Map signConfig; + private Map noticeConfig; + private Map orgSignerInfo; + private Map psnSignerInfo; + private List signFields; + + public int getSignerType() { + return signerType; + } + + public void setSignerType(int signerType) { + this.signerType = signerType; + } + + public Map getNoticeConfig() { + return noticeConfig; + } + + public void setNoticeConfig(Map noticeConfig) { + this.noticeConfig = noticeConfig; + } + + public Map getOrgSignerInfo() { + return orgSignerInfo; + } + + public void setOrgSignerInfo(Map orgSignerInfo) { + this.orgSignerInfo = orgSignerInfo; + } + + public Map getPsnSignerInfo() { + return psnSignerInfo; + } + + public void setPsnSignerInfo(Map psnSignerInfo) { + this.psnSignerInfo = psnSignerInfo; + } + + public List getSignFields() { + return signFields; + } + + public void setSignFields(List signFields) { + this.signFields = signFields; + } + + public Map getSignConfig() { + return signConfig; + } + + public void setSignConfig(Map signConfig) { + this.signConfig = signConfig; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/TemplateComponent.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/TemplateComponent.java new file mode 100644 index 0000000..4fe53f0 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/TemplateComponent.java @@ -0,0 +1,31 @@ +package com.seeyon.apps.src_rent.po; + +public class TemplateComponent { + private String componentId; + private String componentKey; + private String componentValue; + + public String getComponentId() { + return componentId; + } + + public void setComponentId(String componentId) { + this.componentId = componentId; + } + + public String getComponentKey() { + return componentKey; + } + + public void setComponentKey(String componentKey) { + this.componentKey = componentKey; + } + + public String getComponentValue() { + return componentValue; + } + + public void setComponentValue(String componentValue) { + this.componentValue = componentValue; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/TemplateInfo.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/TemplateInfo.java new file mode 100644 index 0000000..81d7a9c --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/TemplateInfo.java @@ -0,0 +1,22 @@ +package com.seeyon.apps.src_rent.po; + +public class TemplateInfo { + private String signTemplateName; + private String signTemplateId; + + public String getSignTemplateName() { + return signTemplateName; + } + + public void setSignTemplateName(String signTemplateName) { + this.signTemplateName = signTemplateName; + } + + public String getSignTemplateId() { + return signTemplateId; + } + + public void setSignTemplateId(String signTemplateId) { + this.signTemplateId = signTemplateId; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/Transactor.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/Transactor.java new file mode 100644 index 0000000..b26e533 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/po/Transactor.java @@ -0,0 +1,13 @@ +package com.seeyon.apps.src_rent.po; + +public class Transactor { + private String psnId; + + public String getPsnId() { + return psnId; + } + + public void setPsnId(String psnId) { + this.psnId = psnId; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/reserve/ReservationVo.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/reserve/ReservationVo.java new file mode 100644 index 0000000..c9a151f --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/reserve/ReservationVo.java @@ -0,0 +1,94 @@ +package com.seeyon.apps.src_rent.reserve; + +public class ReservationVo { + private String openId; + private String id; //id + private String date; //预约时间 + private String status; //状态 + private String assetName; //资产名称 + private String assetAddress; //资产地址 + private String managerName; //管理员姓名 + private String managerPhone; //管理员电话 + private String lat; //纬度 + private String lng; //经度 + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getDate() { + return date; + } + + public void setDate(String date) { + this.date = date; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getAssetName() { + return assetName; + } + + public void setAssetName(String assetName) { + this.assetName = assetName; + } + + public String getAssetAddress() { + return assetAddress; + } + + public void setAssetAddress(String assetAddress) { + this.assetAddress = assetAddress; + } + + public String getManagerName() { + return managerName; + } + + public void setManagerName(String managerName) { + this.managerName = managerName; + } + + public String getManagerPhone() { + return managerPhone; + } + + public void setManagerPhone(String managerPhone) { + this.managerPhone = managerPhone; + } + + public String getLat() { + return lat; + } + + public void setLat(String lat) { + this.lat = lat; + } + + public String getLng() { + return lng; + } + + public void setLng(String lng) { + this.lng = lng; + } + + public String getOpenId() { + return openId; + } + + public void setOpenId(String openId) { + this.openId = openId; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/reserve/ReserveService.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/reserve/ReserveService.java new file mode 100644 index 0000000..976a405 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/reserve/ReserveService.java @@ -0,0 +1,108 @@ +package com.seeyon.apps.src_rent.reserve; + +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.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.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 String getFormNo() { + return configProvider.getBizConfigByKey(RentConstants.RESERVE_FORMNO); + } + + public PageQueryVo pageQuery(JSONObject params) throws Exception { + List conditions = buildConditions(params); + Integer pageNo = params.getInteger("pageNo") == null ? 1 : params.getInteger("pageNo"); + Integer pageSize = params.getInteger("pageSize") == null ? 10 : params.getInteger("pageSize"); + List vos = new ArrayList<>(); + PageQueryVo pageQueryVo = new PageQueryVo(); + List datas = formDataOperator.queryFormDataPageCondition(getFormNo(), true,null, conditions, pageNo, pageSize); + Long count = formDataOperator.countConditon(getFormNo(), conditions); + if(datas.size() > 0){ + for (Object data : datas) { + Map map = (Map) data; + ReservationVo vo = new ReservationVo(); + fillVo(map,vo); + vos.add(vo); + } + pageQueryVo.setDatas(vos); + pageQueryVo.setTotalCount(count); + } + return pageQueryVo; + } + + private String getStringValue(Map fieldsMap,String key) { + Object o = fieldsMap.get(key); + if(o == null) { + return null; + } + return o + ""; + } + + public Integer countHandling(JSONObject params) throws BusinessException { + List conditions = buildConditions(params); + conditions.add(FormWhereCondition.build().display("处理状态").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"处理状态","未处理"))); + Long count = formDataOperator.countConditon(getFormNo(), conditions); + return count.intValue(); + } + + public void fillVo(Map fieldsMap,ReservationVo vo) throws Exception { + String assetsNo = getStringValue(fieldsMap,"资产编号"); + OaAssetsVo oaAssetsVo = assetsService.queryAssetsDetail(assetsNo); + if(oaAssetsVo != null) { + vo.setAssetName(oaAssetsVo.getAssetsName()); + vo.setAssetAddress(oaAssetsVo.getAssetsAddress()); + vo.setManagerName(oaAssetsVo.getManagerName()); + vo.setManagerPhone(oaAssetsVo.getManagerPhone()); + vo.setLat(oaAssetsVo.getLatitude()); + vo.setLng(oaAssetsVo.getLongitude()); + } + vo.setId(getStringValue(fieldsMap,"id")); + vo.setOpenId(getStringValue(fieldsMap,"微信openId")); + vo.setDate(getStringValue(fieldsMap,"预约时间")); + String status = "已处理".equals(fieldsMap.get("处理状态")) ? "done" : "pending"; + vo.setStatus(status); + } + + public void saveReserve(JSONObject params) throws Exception { + Map mainFormData = new HashMap<>(); + mainFormData.put("资产编号", params.getString("assetsNo")); + mainFormData.put("资产名称", params.getString("assetsName")); + mainFormData.put("看房人姓名", params.getString("reserveName")); + mainFormData.put("看房人手机号", params.getString("phone")); + mainFormData.put("微信openId", params.getString("openId")); + String docNo = "weChat_" + UUID.randomUUID().toString().replace("-",""); + mainFormData.put("档案编号",docNo); + mainFormData.put("处理状态", EnumMapUtils.getMasterTableEnumItemValue(getFormNo(), "处理状态", "未处理")); + String loginName = configProvider.getBizConfigByKey(RentConstants.formLoginName); + formDataOperator.insertFormData(loginName,getFormNo(),mainFormData,null); + } + + private List buildConditions(JSONObject params) { + List conditions = new ArrayList<>(); + if(StringUtils.isNotBlank(params.getString("openId"))){ + conditions.add(FormWhereCondition.build().display("微信openId").value(params.getString("openId"))); + } + return conditions; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/service/EsignAuthService.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/service/EsignAuthService.java new file mode 100644 index 0000000..0a7e7d9 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/service/EsignAuthService.java @@ -0,0 +1,35 @@ +package com.seeyon.apps.src_rent.service; + +import com.seeyon.aicloud.common.JsonUtils; +import com.seeyon.apps.src_rent.config.RentConfigProvider; +import com.seeyon.apps.src_rent.constants.EsignApiUrl; +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 java.util.Map; + +@Component +public class EsignAuthService { + + @Autowired + private RentConfigProvider configProvider; + + public void personAuth(Map authParams) throws Exception { + EsignApiHeader esignApiHeader = EsignApiHeader.build(); + String jsonBody = JsonUtils.toJSONString(authParams); + esignApiHeader.appId(configProvider.getBizConfigByKey(RentConstants.APP_ID)) + .httpMethod("POST") + .heads("") + .pathAndParameters(EsignApiUrl.PERSON_AUTH_URL) + .contentMD5(jsonBody) + .signature(configProvider.getBizConfigByKey(RentConstants.APP_SECRET)); + 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); + Map dataMap = (Map) esignBaseResp.getData(); + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/service/EsignByTemplateService.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/service/EsignByTemplateService.java new file mode 100644 index 0000000..281fecd --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/service/EsignByTemplateService.java @@ -0,0 +1,56 @@ +package com.seeyon.apps.src_rent.service; + +import com.seeyon.aicloud.common.JsonUtils; +import com.seeyon.apps.src_rent.config.RentConfigProvider; +import com.seeyon.apps.src_rent.constants.EsignApiUrl; +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 com.seeyon.apps.src_rent.utils.JsonCleaner; +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 static final Log log = LogFactory.getLog(EsignByTemplateService.class); + + public void signByTemplate(Map params) { + + } + + public void startSignFlow(String flowId) throws Exception { + String url = configProvider.getBizConfigByKey(RentConstants.ESIGN_HOST) + EsignApiUrl.SIGN_START_URL; + url.replace("{signFlowId}", flowId); + String respStr = HttpClient.httpPostRaw(url, "", null, null); + EsignBaseResp esignBaseResp = JsonUtils.parseObject(respStr, EsignBaseResp.class); + if (esignBaseResp.getCode() != 0) { + throw new Exception("签署发起失败"); + } + } + + public String createBySignTemplate(Map params) throws Exception { + EsignApiHeader esignApiHeader = EsignApiHeader.build(); + String jsonBody = JsonCleaner.removeEmptyObjects(JsonUtils.toJSONString(params)); + esignApiHeader.token(tokenCacheManager.getToken()).appId(configProvider.getBizConfigByKey(RentConstants.APP_ID)); + 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"); + EsignBaseResp esignBaseResp = JsonUtils.parseObject(respStr, EsignBaseResp.class); + Map dataMap = (Map) esignBaseResp.getData(); + if(!"0".equals(esignBaseResp.getCode() + "")) { + throw new RuntimeException("签署发起失败," + esignBaseResp.getMessage()); + } + String flowId = (String) dataMap.get("signFlowId"); + return flowId; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/service/EsignByUploadFileService.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/service/EsignByUploadFileService.java new file mode 100644 index 0000000..e53f273 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/service/EsignByUploadFileService.java @@ -0,0 +1,181 @@ +package com.seeyon.apps.src_rent.service; + +import com.seeyon.aicloud.common.JsonUtils; +import com.seeyon.apps.src_rent.config.RentConfigProvider; +import com.seeyon.apps.src_rent.constants.EsignApiUrl; +import com.seeyon.apps.src_rent.constants.RentConstants; +import com.seeyon.apps.src_rent.po.*; +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 org.apache.commons.codec.binary.Base64; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.security.MessageDigest; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Component +public class EsignByUploadFileService { + + @Autowired + private RentConfigProvider configProvider; + @Autowired + protected TokenCacheManager tokenCacheManager; + + + public Map getDownloadFileInfo(String flowId) 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()); + String respStr = HttpClient.httpGet(getDownloadUrl, esignApiHeader.convert2Headers(), null); + EsignBaseResp esignBaseResp = JsonUtils.parseObject(respStr, EsignBaseResp.class); + if(esignBaseResp.getCode() != 0 || esignBaseResp.getData() == null){ + throw new RuntimeException("下载合同文件失败"); + } + Map data = (Map) esignBaseResp.getData(); + Object[] files = (Object[]) data.get("files"); + if(files.length <= 0) { + throw new RuntimeException("下载合同文件失败"); + } + Map fileInfo = (Map) files[0]; + return fileInfo; + } + + public GetUploadUrlResp getUploadFileUrl(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()); + EsignFileUploadParams params = new EsignFileUploadParams(); + params.setFileName(fileName); + params.setContentMd5(fileMd5); + params.setFileSize(fileSize); + params.setConvertToPDF(convert2Pdf); + params.setContentType("application/octet-stream"); + String respStr = HttpClient.httpPostRaw(url, JsonUtils.toJSONString(params),esignApiHeader.convert2Headers(), null); + EsignBaseResp esignBaseResp = JsonUtils.parseObject(respStr, EsignBaseResp.class); + Object data = esignBaseResp.getData(); + if (data != null) { + Map map = (Map) data; + resp.setFileUploadUrl((String) map.get("fileUploadUrl")); + resp.setFileId((String) map.get("fileId")); + return resp; + }else { + throw new RuntimeException("获取合同上传地址失败: " + esignBaseResp.getMessage()); + } + } + + + public List getSignPosition(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)); + List keywords = new ArrayList<>(); + keywords.add("甲方盖章/签字"); + keywords.add("乙方盖章/签字"); + Map params = new HashMap<>(); + params.put("keywords",keywords); + esignApiHeader.token(tokenCacheManager.getToken()); + String respStr = HttpClient.httpPostRaw(url,JsonUtils.toJSONString(params),esignApiHeader.convert2Headers(),null); + Map map = JsonUtils.parseObject(respStr, Map.class); + Map data = (Map) map.get("data"); + Object[] keywordPositions = (Object[]) data.get("keywordPositions"); + List resList = new ArrayList<>(); + for (Object position : keywordPositions) { + resList.add(position); + } + return resList; + } + + public String uploadFileToEsign(String refId) throws Exception { + String tempDir = System.getProperty("java.io.tmpdir"); + File file = null; + FileUtil fileUtil = new FileUtil(); + try { + List 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); + uploadFile(uploadResp.getFileUploadUrl(), contentMD5, file.getName(), paths.get(0)); + return uploadResp.getFileId(); + }finally { + if(file != null) { + file.delete(); + } + } + } + + public static String getFileContentMD5(String filePath) throws Exception { + // 获取文件MD5的二进制数组(128位) + byte[] bytes = getFileMD5Bytes128(filePath); + // 对文件MD5的二进制数组进行base64编码 + return new String(Base64.encodeBase64String(bytes)); + } + + /*** + * 获取文件MD5-二进制数组(128位) + * + * @return + * @throws IOException + */ + public static byte[] getFileMD5Bytes128(String filePath) throws Exception { + byte[] md5Bytes = null; + File file = new File(filePath); + try (FileInputStream fis = new FileInputStream(file)) { + MessageDigest md5 = MessageDigest.getInstance("MD5"); + byte[] buffer = new byte[1024]; + int length = -1; + while ((length = fis.read(buffer, 0, 1024)) != -1) { + md5.update(buffer, 0, length); + } + md5Bytes = md5.digest(); + } + return md5Bytes; + } + + + public String uploadFile(String uploadUrl,String contentMD5,String fileName,String filePath) throws Exception { +// EsignApiHeader esignApiHeader = EsignApiHeader.build(); +// esignApiHeader.setContentType("application/octet-stream"); +// esignApiHeader.setContentMd5(contentMD5); + EsignHttpResponse esignHttpResponse = EsignHttpHelper.doUploadHttp(uploadUrl, EsignRequestType.PUT, getBytes(filePath), contentMD5, "application/octet-stream", false); +// return HttpClient.uploadBinaryFile(uploadUrl,esignApiHeader.convert2Headers(),new FileInputStream(file),fileName); + return esignHttpResponse.getBody(); + } + + public static byte[] getBytes(String filePath) throws Exception { + File file = new File(filePath); + FileInputStream fis = null; + byte[] buffer = null; + try { + fis = new FileInputStream(file); + buffer = new byte[(int) file.length()]; + fis.read(buffer); + } catch (Exception e) { + Exception ex = new Exception("获取文件字节流失败", e); + ex.initCause(e); + throw ex; + } finally { + if (fis != null) { + try { + fis.close(); + } catch (IOException e) { + Exception ex = new Exception("关闭文件字节流失败", e); + ex.initCause(e); + throw ex; + } + } + } + return buffer; + } + +} + diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/service/EsignCallbackBizService.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/service/EsignCallbackBizService.java new file mode 100644 index 0000000..1fff75c --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/service/EsignCallbackBizService.java @@ -0,0 +1,96 @@ +package com.seeyon.apps.src_rent.service; + +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.EnumMapUtils; +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.utils.FileUtil; +import com.seeyon.apps.src_rent.utils.ProtUtil; +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; + + public void handleSuccessSignCallbackBiz(String tablename,String updatefield,String statusField,String formId,String fileUrl,String fileName) 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 conditions = new ArrayList<>(); + String refId = FileUtil.uploadContractToOA(fileUrl, + fileName, getModuleId(tempFormId), + configProvider.getBizConfigByKey(RentConstants.FORMEDITLOGINNAME), + configProvider.getBizConfigByKey(RentConstants.updateAccountName)); + List updateFields = new ArrayList<>(); + updateFields.add(FormUpdateField.build().fieldName(updatefield).value(refId)); + 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", 1); + 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]; + 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 conditions = new ArrayList<>(); + List 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", "签署失败: " + failMsg); + params.put("returnCode", 2); + protUtil.sendPostNotification(params.toString(), configProvider.getBizConfigByKey(RentConstants.nodeTokenUrl), oaFlowId); + formDataOperator.updateMasterForm(updateFields,tableName,conditions); + } + + private String getModuleId(String formId) { + JDBCAgent jdbcAgent = new JDBCAgent(); + try { + String sql = "SELECT MODULE_ID FROM ctp_content_all where CONTENT_DATA_ID = ?"; + List params = new ArrayList<>(); + params.add(formId); + jdbcAgent.execute(sql,params); + List list = jdbcAgent.resultSetToList(); + if(list == null || !(list.size() > 0)) { + throw new RuntimeException("MODULE_ID获取失败"); + } + Map map = (Map) list.get(0); + return map.get("module_id") +""; + }catch (Exception e) { + e.printStackTrace(); + } + return null; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/service/EsignFileTemplateService.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/service/EsignFileTemplateService.java new file mode 100644 index 0000000..b951bcf --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/service/EsignFileTemplateService.java @@ -0,0 +1,133 @@ +package com.seeyon.apps.src_rent.service; + +import com.seeyon.aicloud.common.JsonUtils; +import com.seeyon.apps.src_rent.config.RentConfigProvider; +import com.seeyon.apps.src_rent.constants.EsignApiUrl; +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.po.SignFile; +import com.seeyon.apps.src_rent.po.TemplateComponent; +import com.seeyon.apps.src_rent.utils.HttpClient; +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 void fillOrgId() { + EsignApiHeader esignApiHeader = EsignApiHeader.build(); + try { + esignApiHeader.token(tokenCacheManager.getToken()).appId(configProvider.getBizConfigByKey(RentConstants.APP_ID)); + } catch (Exception e) { + e.printStackTrace(); + } + //获取orgId + String queryStr = EsignApiUrl.QUERY_ORGINFO + "?orgName=" + configProvider.getBizConfigByKey(RentConstants.UNITNAME); + 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 orgData = (Map) orgInfoResp.getData(); + orgId = (String) orgData.get("orgId"); + } + + //填充模板 + public SignFile fillTemplate(String templateId, String fileName, Map params) { + //请求示例 + Map reqParams = new HashMap<>(); + reqParams.put("docTemplateId",templateId); + reqParams.put("fileName",fileName); + List components = new ArrayList<>(); + Set keySets = params.keySet(); + for (String key : keySets) { + TemplateComponent component = new TemplateComponent(); + component.setComponentKey(key); + component.setComponentValue((String) params.get(key)); + components.add(component); + } + reqParams.put("components",components); + String url = ""; + String resp = HttpClient.httpPostRaw(url, JsonUtils.toJSONString(reqParams), null, null); + EsignBaseResp esignBaseResp = JsonUtils.parseObject(resp, EsignBaseResp.class); + if(esignBaseResp.getCode() != 0) {} + Map dataMap = (Map) esignBaseResp.getData(); + SignFile signFile = new SignFile(); + signFile.setFileId((String) dataMap.get("fileId")); + signFile.setFileName(fileName); + return signFile; + } + + //获取模板详细信息 + public Map getTemplateDetail(String signTemplateId,String orgId,Boolean queryComponents) { + String url = configProvider.getBizConfigByKey(RentConstants.ESIGN_HOST) + "?" + "signTemplateId=" + signTemplateId + "&orgId=" + orgId + (queryComponents != null ? "&queryComponents=" + queryComponents : ""); + String resp = HttpClient.httpGet(url, null, "UTF-8"); + EsignBaseResp esignBaseResp = JsonUtils.parseObject(resp, EsignBaseResp.class); + Map data = (Map) esignBaseResp.getData(); + return data; + } + + //获取模板详细信息 + public Map getTemplateDetail(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)); + String resp = HttpClient.httpGet(url, apiHeader.convert2Headers(), "UTF-8"); + EsignBaseResp esignBaseResp = JsonUtils.parseObject(resp, EsignBaseResp.class); + Map data = (Map) esignBaseResp.getData(); + return data; + } + + public Map 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()); + String url = configProvider.getBizConfigByKey(RentConstants.ESIGN_HOST) + queryStr; + String templateListRespStr = HttpClient.httpGet(url, esignApiHeader.convert2Headers(), "UTF-8"); + EsignBaseResp templateListResp = JsonUtils.parseObject(templateListRespStr, EsignBaseResp.class); + Map listData = (Map)templateListResp.getData(); + Integer total = (Integer) listData.get("total"); + Object[] templateArray = (Object[]) listData.get("signTemplates"); + Map pageMap = new HashMap<>(); + pageMap.put("total",total); + pageMap.put("templateList",templateArray); + return pageMap; + } + + public String getCompareDetailUrl(String templateRefId,String contractRefId) throws Exception { + String templateFileId = uploadFileService.uploadFileToEsign(templateRefId); + String contractFileId = uploadFileService.uploadFileToEsign(contractRefId); + String url = configProvider.getBizConfigByKey(RentConstants.ESIGN_HOST) + EsignApiUrl.CONTRACT_COMPARE_GETURL; + Map 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()); + String respStr = HttpClient.httpPostRaw(url, jsonString, esignApiHeader.convert2Headers(), null); + EsignBaseResp esignBaseResp = JsonUtils.parseObject(respStr, EsignBaseResp.class); + log.info("调用获取合同比对链接接口返回值: " + JsonUtils.toJSONString(esignBaseResp)); + Map data = (Map) esignBaseResp.getData(); + String contractCompareUrl = data.get("contractCompareUrl"); + return contractCompareUrl; + } + + private String obtainOrgId() { + if(orgId == null) { + fillOrgId(); + } + return orgId; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/service/SealService.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/service/SealService.java new file mode 100644 index 0000000..2f3ace1 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/service/SealService.java @@ -0,0 +1,135 @@ +package com.seeyon.apps.src_rent.service; + +import cn.hutool.json.JSONObject; +import com.cedarsoftware.util.io.JsonObject; +import com.seeyon.aicloud.common.JsonUtils; +import com.seeyon.apps.src_rent.config.RentConfigProvider; +import com.seeyon.apps.src_rent.constants.EsignApiUrl; +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.FormExportUtil; +import com.seeyon.apps.src_rent.form.FormWhereCondition; +import com.seeyon.apps.src_rent.po.EsignApiHeader; +import com.seeyon.apps.src_rent.po.EsignBaseResp; +import com.seeyon.apps.src_rent.po.SealInfoVo; +import com.seeyon.apps.src_rent.utils.HttpClient; +import com.seeyon.ctp.common.AppContext; +import com.seeyon.ctp.services.ServiceException; +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.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 FormFactory formFactory; + + public FormFactory getFormFactory() { + if (formFactory == null) { + formFactory = (FormFactory) AppContext.getBean("formFactory"); + } + return formFactory; + } + + public void grantSeal(Map params) throws Exception { + JsonObject reqParams = new JsonObject(); + String sealId = getSealId((String) params.get("orgId"), (String) params.get("sealName")); + reqParams.put("sealId", sealId); + List authorizedPsnIds = new ArrayList<>(); + authorizedPsnIds.add((String) params.get("accountId")); + reqParams.put("authorizedPsnIds", authorizedPsnIds); + reqParams.put("sealRole", "SEAL_USER"); + reqParams.put("transactorPsnId", params.get("managerId")); + JSONObject sealAuthScope = new JSONObject(); + List templateIds = new ArrayList<>(); + templateIds.add("ALL"); + sealAuthScope.put("templateIds", templateIds); + reqParams.put("sealAuthScope", sealAuthScope); + EsignApiHeader esignApiHeader = EsignApiHeader.build(); + esignApiHeader.appId(configProvider.getBizConfigByKey(RentConstants.APP_ID)) + .httpMethod("POST") + .heads("") + .pathAndParameters(EsignApiUrl.SEAL_GRANT_URL) + .contentMD5(reqParams.toString()) + .signature(configProvider.getBizConfigByKey(RentConstants.APP_SECRET)); + 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 { + String host = configProvider.getBizConfigByKey(RentConstants.ESIGN_HOST); + int pageNo = 1; + int pageSize = 20; + EsignApiHeader esignApiHeader = EsignApiHeader.build(); + esignApiHeader.appId(configProvider.getBizConfigByKey(RentConstants.APP_ID)) + .httpMethod("GET") + .heads("") + .pathAndParameters(EsignApiUrl.SEAL_QUERY_URL + "?" + HttpClient.sortQueryString("orgId=" + orgId + "&pageNo=" + pageNo + "&pageSize=" + pageSize)) + .contentMD5("") + .signature(configProvider.getBizConfigByKey(RentConstants.APP_SECRET)); + 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); + Map data = (Map) esignBaseResp.getData(); + LinkedList seals = (LinkedList) data.get("seals"); + for (Object seal : seals) { + Map sealMap = (Map) seal; + if (sealMap.get("sealName").equals(sealName)) { + return (String) sealMap.get("sealId"); + } + } + return null; + } + + public void upsertOaSealDoc(SealInfoVo vo) { + FormDataOperator formDataOperator = new FormDataOperator(); + String formNo = configProvider.getBizConfigByKey(RentConstants.sealInfoFormCode); + List conditions = new ArrayList<>(); + conditions.add(FormWhereCondition.build().display("印章ID").value(vo.getSealId())); + FormColumn formColumn = null; + try { + formColumn = formDataOperator.queryOneRowFormData(formNo,false ,null, conditions); + } catch (Exception e) { + log.error("查询印章信息失败: " + e.getMessage(), e); + } + if (formColumn == null) { + if ("已启用".equals(vo.getStatusDescription())) { + Map params = new HashMap<>(); + params.put("印章ID", vo.getSealId()); + params.put("印章名称", vo.getSealName()); + params.put("印章类型", vo.getSealBizTypeDescription()); + params.put("印章状态", vo.getStatusDescription()); +// params.put("印章图片地址",vo.getSealImageDownloadUrl()); + + FormExport formExport = new FormExport(); + FormExportUtil formExportUtil = new FormExportUtil(); + List valueExport = formExportUtil.setFormValue(params); + formExport.setValues(valueExport); + try { + getFormFactory().importBusinessFormData(configProvider.getBizConfigByKey(RentConstants.formLoginName), configProvider.getBizConfigByKey(RentConstants.sealInfoFormCode), + formExport, new String[]{}); + } catch (ServiceException e) { + log.error(vo.getSealName() + "信息写入OA档案失败," + e.getMessage(), e); + } + } + } else { + if (!"已启用".equals(vo.getStatusDescription())) { + try { + formDataOperator.deleteByCondition(formNo, conditions); + } catch (Exception e) { + log.error("删除停用印章失败" + e.getMessage(), e); + } + } + } + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/service/SignLinkService.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/service/SignLinkService.java new file mode 100644 index 0000000..4303122 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/service/SignLinkService.java @@ -0,0 +1,155 @@ +package com.seeyon.apps.src_rent.service; + +import com.seeyon.aicloud.common.JsonUtils; +import com.seeyon.apps.ext.workflow.vo.FormDataVo; +import com.seeyon.apps.src_rent.config.RentConfigProvider; +import com.seeyon.apps.src_rent.constants.EsignApiUrl; +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 com.seeyon.cap4.form.bean.FormDataMasterBean; +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; +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; + + public void saveGetLinkParam(FormDataVo formDataVo, FormDataMasterBean formDataMasterBean,String eFlowId) { + try { + String bSignerType = formDataVo.getFieldData("乙方签署类型").getStringValue(); + String psnAccount = null; + if(!"组织".equals(bSignerType) ) { + psnAccount = formDataVo.getFieldData("乙方电话").getStringValue(); + }else { + psnAccount = formDataVo.getFieldData("乙方经办人手机号").getStringValue(); + + } + String contractNo = formDataVo.getFieldData("合同编号").getStringValue(); + Map param = new HashMap<>(); + Map operator = new HashMap<>(); + operator.put("psnAccount",psnAccount); + param.put("signFlowId",eFlowId); + param.put("operator",operator); + String paramStr = JsonUtils.toJSONString(param); + saveDb(paramStr,eFlowId,contractNo); + }catch (Exception e) { + log.error(e.getMessage(),e); + } + + } + + public void del(String eFlowId) { + String sqlDel = "delete FROM SIGN_LINK_PARAM where eFlowId = ?"; + JDBCAgent jdbcAgent = new JDBCAgent(); + try { + List param = new ArrayList<>(); + param.add(eFlowId); + jdbcAgent.execute(sqlDel,param); + }catch (Exception e) { + log.error(e.getMessage(),e); + }finally { + jdbcAgent.close(); + } + } + + private void saveDb(String jsonStr,String eFlowId,String contractNo) { + String sqlInsert = "insert into SIGN_LINK_PARAM (id,param,eFlowId,contractNo) 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(); + try { + List param = new ArrayList<>(); + + param.add(contractNo); + jdbcAgent.execute(sqlQuery,param); + List list = jdbcAgent.resultSetToList(); + long id = UUIDUtil.getUUIDLong(); + if(list.size() == 0) { + param.clear(); + param.add(id); + param.add(jsonStr); + param.add(eFlowId); + param.add(contractNo); + jdbcAgent.execute(sqlInsert,param); + }else { + param.clear(); + Map tempMap = (Map) list.get(0); + param.add(jsonStr); + param.add(eFlowId); + param.add(tempMap.get("id")); + jdbcAgent.execute(sqlUpdate,param); + } + }catch (Exception e) { + log.error(e.getMessage(),e); + }finally { + jdbcAgent.close(); + } + } + + public String getSignLink(String eFlowId) { + String sqlQuery = "select * from SIGN_LINK_PARAM where eFlowId = ?"; + JDBCAgent jdbcAgent = new JDBCAgent(); + try { + List param = new ArrayList<>(); + param.add(eFlowId); + jdbcAgent.execute(sqlQuery,param); + List list = jdbcAgent.resultSetToList(); + if(list.size() > 0) { + Map tempMap = (Map) list.get(0); + String paramStr = (String)tempMap.get("param"); + if(!checkContractVaild(eFlowId)) { + 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)); + String respStr = HttpClient.httpPostRaw(url, paramStr,esignApiHeader.convert2Headers(), "UTF-8"); + EsignBaseResp esignBaseResp = JsonUtils.parseObject(respStr, EsignBaseResp.class); + Map dataMap = (Map) esignBaseResp.getData(); + if(!"0".equals(esignBaseResp.getCode() + "")) { + log.error("合同链接获取失败," + esignBaseResp.getMessage()); + }else { + return (String) dataMap.get("url"); + } + } + + }catch (Exception e) { + log.error("合同链接获取失败:"+e.getMessage(),e); + }finally { + jdbcAgent.close(); + } + return null; + } + + private boolean checkContractVaild(String eFlowId) { + EsignApiHeader esignApiHeader = EsignApiHeader.build(); + esignApiHeader.token(tokenCacheManager.getToken()).appId(configProvider.getBizConfigByKey(RentConstants.APP_ID)); + 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); + Map dataMap = (Map) esignBaseResp.getData(); + if(!"0".equals(esignBaseResp.getCode() + "")) { + log.error("合同信息查询失败," + esignBaseResp.getMessage()); + return false; + } + Integer flowStatus = (Integer) dataMap.get("signFlowStatus"); + return flowStatus == 1; + } + +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/service/TokenCacheManager.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/service/TokenCacheManager.java new file mode 100644 index 0000000..cf8fe70 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/service/TokenCacheManager.java @@ -0,0 +1,101 @@ +package com.seeyon.apps.src_rent.service; + +import com.seeyon.aicloud.common.JsonUtils; +import com.seeyon.apps.src_rent.config.RentConfigProvider; +import com.seeyon.apps.src_rent.constants.EsignApiUrl; +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.po.EsignToken; +import com.seeyon.apps.src_rent.utils.HttpClient; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.Map; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicReference; + +@Component +public class TokenCacheManager { + + @Autowired + private RentConfigProvider configProvider; + private final AtomicReference tokenRef = new AtomicReference<>(); + 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) { + EsignApiHeader esignApiHeader = EsignApiHeader.build(); + try { + esignApiHeader.token(token).appId(configProvider.getBizConfigByKey(RentConstants.APP_ID)); + } catch (Exception e) { + e.printStackTrace(); + } + //获取orgId + String queryStr = EsignApiUrl.QUERY_ORGINFO + "?orgName=" + configProvider.getBizConfigByKey(RentConstants.UNITNAME); + String reqUrl = configProvider.getBizConfigByKey(RentConstants.ESIGN_HOST) + queryStr; + String orgInfoRespStr = HttpClient.httpGet(reqUrl, esignApiHeader.convert2Headers(), "UTF-8"); + EsignBaseResp orgInfoResp = JsonUtils.parseObject(orgInfoRespStr, EsignBaseResp.class); + if(orgInfoResp.getCode() == 401) { + return true; + } + return false; + } + + public String getToken() { + EsignToken current = tokenRef.get(); + if (current != null && !checkExpired(current.getTokenStr())) { + return current.getTokenStr(); + } + return refreshToken(); + } + + private String refreshToken() { + EsignToken newToken = fetchNewToken(); + tokenRef.set(newToken); + return newToken.getTokenStr(); + } + + private void checkTokenExpiry() { + EsignToken current = tokenRef.get(); + if (current != null && isTokenExpired(current)) { + refreshToken(); + } + } + + private boolean isTokenExpired(EsignToken token) { + return System.currentTimeMillis() >= token.getTtl(); + } + + private EsignToken fetchNewToken() { + // 实际获取token的逻辑 + String queryStr = "?appId=" + configProvider.getBizConfigByKey(RentConstants.APP_ID) + "&secret=" + configProvider.getBizConfigByKey(RentConstants.APP_SECRET) + "&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); + if(esignBaseResp.getCode() != 0) { + throw new RuntimeException("获取e签宝token失败"); + } + Map dataMap = (Map) esignBaseResp.getData(); + String token = (String) dataMap.get("token"); + Long ttl = Long.parseLong((String) dataMap.get("expiresIn")) ; + String refreshToken = (String) dataMap.get("refreshToken"); + EsignToken esignToken = new EsignToken(); + esignToken.setTokenStr(token); + esignToken.setTtl(ttl); + esignToken.setRefreshToken(refreshToken); + return esignToken; + } + + public void shutdown() { + scheduler.shutdown(); + } +} \ No newline at end of file diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/service/WeAppContractSyncService.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/service/WeAppContractSyncService.java new file mode 100644 index 0000000..36043ab --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/service/WeAppContractSyncService.java @@ -0,0 +1,12 @@ +package com.seeyon.apps.src_rent.service; + +import org.springframework.stereotype.Service; + +@Service +public class WeAppContractSyncService { + + public void syncContract() { + // TODO: 同步合同信息到微信小程序 + + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/utils/AESUtils.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/utils/AESUtils.java new file mode 100644 index 0000000..b873689 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/utils/AESUtils.java @@ -0,0 +1,67 @@ +package com.seeyon.apps.src_rent.utils; + +import sun.misc.BASE64Decoder; +import sun.misc.BASE64Encoder; + +import javax.crypto.Cipher; +import javax.crypto.KeyGenerator; +import java.security.Key; +import java.security.SecureRandom; + +public class AESUtils { + public static final String encrypt(String oristr, String key) { + Key secretKey = getKey(key); + + try { + Cipher cipher = Cipher.getInstance("AES"); + cipher.init(1, secretKey); + byte[] p = oristr.getBytes("UTF-8"); + byte[] result = cipher.doFinal(p); + BASE64Encoder encoder = new BASE64Encoder(); + String encoded = encoder.encode(result); + return encoded; + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public static final String decrypt(String cipherText, String key) { + Key secretKey = getKey(key); + + try { + Cipher cipher = Cipher.getInstance("AES"); + cipher.init(2, secretKey); + BASE64Decoder decoder = new BASE64Decoder(); + byte[] c = decoder.decodeBuffer(cipherText); + byte[] result = cipher.doFinal(c); + String plainText = new String(result, "UTF-8"); + return plainText; + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + private static Key getKey(String keySeed) { + if (keySeed == null) { + keySeed = System.getenv("AES_SYS_KEY"); + } + + if (keySeed == null) { + keySeed = System.getProperty("AES_SYS_KEY"); + } + + if (keySeed == null || keySeed.trim().length() == 0) { + keySeed = "abcd1234!@#$"; + } + + try { + SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG"); + secureRandom.setSeed(keySeed.getBytes()); + KeyGenerator generator = KeyGenerator.getInstance("AES"); + generator.init(secureRandom); + return generator.generateKey(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } +} \ No newline at end of file diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/utils/AttachmentUtils.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/utils/AttachmentUtils.java new file mode 100644 index 0000000..1dc3f95 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/utils/AttachmentUtils.java @@ -0,0 +1,25 @@ +package com.seeyon.apps.src_rent.utils; + +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 java.util.ArrayList; +import java.util.List; + +public class AttachmentUtils { + + public void fileFillBack(String url,String fileName,String loginName,String unitName,String tableName,String updateField,String formId,String formNo) throws Exception { + String refId = FileUtil.uploadContractToOA(url, fileName, formId, loginName, unitName); + if(formNo != null) { + + }else { + FormDataOperator formDataOperator = new FormDataOperator(); + List updateFields = new ArrayList<>(); + List conditions = new ArrayList<>(); + updateFields.add(FormUpdateField.build().fieldName(updateField).value(refId)); + conditions.add(FormWhereCondition.build().value(formId).fieldName("ID")); + formDataOperator.updateMasterForm(updateFields,tableName,conditions); + } + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/utils/EnHancedMap.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/utils/EnHancedMap.java new file mode 100644 index 0000000..9c46ee4 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/utils/EnHancedMap.java @@ -0,0 +1,17 @@ +package com.seeyon.apps.src_rent.utils; + +import java.util.Map; + +public class EnHancedMap { + + private Map map; + + public EnHancedMap of(String key, Object value) { + map.put(key, value); + return this; + } + + public Map getMap() { + return map; + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/utils/EsignHttpCfgHelper.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/utils/EsignHttpCfgHelper.java new file mode 100644 index 0000000..67ce5d8 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/utils/EsignHttpCfgHelper.java @@ -0,0 +1,471 @@ +package com.seeyon.apps.src_rent.utils; +import com.seeyon.apps.src_rent.po.EsignException; +import com.seeyon.apps.src_rent.po.EsignHttpResponse; +import org.apache.http.*; +import org.apache.http.auth.AuthScope; +import org.apache.http.auth.UsernamePasswordCredentials; +import org.apache.http.client.ClientProtocolException; +import org.apache.http.client.CredentialsProvider; +import org.apache.http.client.HttpRequestRetryHandler; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.entity.UrlEncodedFormEntity; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpRequestBase; +import org.apache.http.client.protocol.HttpClientContext; +import org.apache.http.config.Registry; +import org.apache.http.config.RegistryBuilder; +import org.apache.http.conn.ConnectTimeoutException; +import org.apache.http.conn.socket.ConnectionSocketFactory; +import org.apache.http.conn.socket.LayeredConnectionSocketFactory; +import org.apache.http.conn.socket.PlainConnectionSocketFactory; +import org.apache.http.conn.ssl.NoopHostnameVerifier; +import org.apache.http.conn.ssl.SSLConnectionSocketFactory; +import org.apache.http.entity.ByteArrayEntity; +import org.apache.http.entity.ContentType; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.BasicCredentialsProvider; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; +import org.apache.http.protocol.HttpContext; +import org.apache.http.util.EntityUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.net.ssl.*; +import java.io.IOException; +import java.io.InterruptedIOException; +import java.net.UnknownHostException; +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; +import java.text.MessageFormat; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * @description Http请求 辅助类 + * @author 澄泓 + * @since JDK1.7 + */ +public class EsignHttpCfgHelper { + + private static Logger LOGGER = LoggerFactory.getLogger(EsignHttpCfgHelper.class); + /** + * 超时时间,默认15000毫秒 + */ + private static int MAX_TIMEOUT = 15000; + /** + * 请求池最大连接数,默认100个 + */ + private static int MAX_TOTAL=100; + /** + * 单域名最大的连接数,默认50个 + */ + private static int ROUTE_MAX_TOTAL=50; + /** + * 请求失败重试次数,默认3次 + */ + private static int MAX_RETRY = 3; + /** + * 是否需要域名校验,默认不需要校验 + */ + private static boolean SSL_VERIFY=false; + + /** + * 正向代理IP + */ + private static String PROXY_IP; + /** + * 正向代理端口,默认8888 + */ + private static int PROXY_PORT=8888; + /** + * 代理协议,默认http + */ + private static String PROXY_AGREEMENT="http"; + + /** + * 是否开启代理,默认false + */ + private static boolean OPEN_PROXY=false; + + /** + * 代理服务器用户名 + */ + private static String PROXY_USERNAME=""; + + /** + * 代理服务器密码 + */ + private static String PROXY_PASSWORD=""; + + + private static PoolingHttpClientConnectionManager connMgr; //连接池 + private static HttpRequestRetryHandler retryHandler; //重试机制 + + private static CloseableHttpClient httpClient=null; + + public static int getMaxTimeout() { + return MAX_TIMEOUT; + } + + public static void setMaxTimeout(int maxTimeout) { + MAX_TIMEOUT = maxTimeout; + } + + public static int getMaxTotal() { + return MAX_TOTAL; + } + + public static void setMaxTotal(int maxTotal) { + MAX_TOTAL = maxTotal; + } + + public static int getRouteMaxTotal() { + return ROUTE_MAX_TOTAL; + } + + public static void setRouteMaxTotal(int routeMaxTotal) { + ROUTE_MAX_TOTAL = routeMaxTotal; + } + + public static int getMaxRetry() { + return MAX_RETRY; + } + + public static void setMaxRetry(int maxRetry) { + MAX_RETRY = maxRetry; + } + + public static boolean isSslVerify() { + return SSL_VERIFY; + } + + public static void setSslVerify(boolean sslVerify) { + SSL_VERIFY = sslVerify; + } + + public static String getProxyIp() { + return PROXY_IP; + } + + public static void setProxyIp(String proxyIp) { + PROXY_IP = proxyIp; + } + + public static int getProxyPort() { + return PROXY_PORT; + } + + public static void setProxyPort(int proxyPort) { + PROXY_PORT = proxyPort; + } + + public static String getProxyAgreement() { + return PROXY_AGREEMENT; + } + + public static void setProxyAgreement(String proxyAgreement) { + PROXY_AGREEMENT = proxyAgreement; + } + + public static boolean getOpenProxy() { + return OPEN_PROXY; + } + + public static void setOpenProxy(boolean openProxy) { + OPEN_PROXY = openProxy; + } + + public static String getProxyUsername() { + return PROXY_USERNAME; + } + + public static void setProxyUserame(String proxyUsername) { + PROXY_USERNAME = proxyUsername; + } + + public static String getProxyPassword() { + return PROXY_PASSWORD; + } + + public static void setProxyPassword(String proxyPassword) { + PROXY_PASSWORD = proxyPassword; + } + + + + + /** + * 不允许外部创建实例 + */ + private EsignHttpCfgHelper() { + } + + //------------------------------公有方法start-------------------------------------------- + + + /** + * @description 发起HTTP / HTTPS 请求 + * + * @param reqType + * {@link EsignRequestType} 请求类型 GET、 POST 、 DELETE 、 PUT + * @param httpUrl + * {@link String} 请求目标地址 + * @param headers + * {@link Map} 请求头 + * @param param + * {@link Object} 参数 + * @return + * @throws EsignException + * @author 澄泓 + */ + public static EsignHttpResponse sendHttp(EsignRequestType reqType, String httpUrl, Map headers, Object param, boolean debug) + throws EsignException { + HttpRequestBase reqBase=null; + if(httpUrl.startsWith("http")){ + reqBase=reqType.getHttpType(httpUrl); + }else{ + throw new EsignException("请求url地址格式错误"); + } + if(debug){ + LOGGER.info("请求头:{}",headers+"\n"); + LOGGER.info("请求参数\n{}", param+"\n"); + LOGGER.info("请求地址\n:{}\n请求方式\n:{}",reqBase.getURI(),reqType+"\n"); + } + //请求方法不是GET或者DELETE时传入body体,否则不传入。 + String[] methods = {"DELETE", "GET"}; + if(param instanceof String&&Arrays.binarySearch(methods, reqType.name())<0){//POST或者PUT请求 + ((HttpEntityEnclosingRequest) reqBase).setEntity( + new StringEntity(String.valueOf(param), ContentType.create("application/json", "UTF-8"))); + } + //参数时字节流数组 + else if(param instanceof byte[]) { + reqBase=reqType.getHttpType(httpUrl); + byte[] paramBytes = (byte[])param; + ((HttpEntityEnclosingRequest) reqBase).setEntity(new ByteArrayEntity(paramBytes)); + } + //参数是form表单时 + else if(param instanceof List){ + ((HttpEntityEnclosingRequest) reqBase).setEntity(new UrlEncodedFormEntity((Iterable) param)); + } + httpClient = getHttpClient(); + config(reqBase); + + //设置请求头 + if(headers != null &&headers.size()>0) { + for(Map.Entry entry :headers.entrySet()) { + reqBase.setHeader(entry.getKey(), entry.getValue()); + } + } + //响应对象 + CloseableHttpResponse res = null; + //响应内容 + String resCtx = null; + int status; + EsignHttpResponse esignHttpResponse = new EsignHttpResponse(); + try { + //执行请求 + res = httpClient.execute(reqBase); + status=res.getStatusLine().getStatusCode(); + + //获取请求响应对象和响应entity + HttpEntity httpEntity = res.getEntity(); + if(httpEntity != null) { + resCtx = EntityUtils.toString(httpEntity,"utf-8"); + } + if(debug) { + LOGGER.info("响应\n{}", resCtx + "\n"); + LOGGER.info("----------------------------end------------------------"); + } + } catch (NoHttpResponseException e) { + throw new EsignException("服务器丢失了",e); + } catch (SSLHandshakeException e){ + String msg = MessageFormat.format("SSL握手异常", e); + EsignException ex = new EsignException(msg, e); + throw ex; + } catch (UnknownHostException e){ + EsignException ex = new EsignException("服务器找不到", e); + ex.initCause(e); + throw ex; + } catch(ConnectTimeoutException e){ + EsignException ex = new EsignException("连接超时", e); + ex.initCause(e); + throw ex; + } catch(SSLException e){ + EsignException ex = new EsignException("SSL异常",e); + ex.initCause(e); + throw ex; + } catch (ClientProtocolException e) { + EsignException ex = new EsignException("请求头异常",e); + ex.initCause(e); + throw ex; + } catch (IOException e) { + EsignException ex = new EsignException("网络请求失败",e); + ex.initCause(e); + throw ex; + } finally { + if(res != null) { + try { + res.close(); + } catch (IOException e) { + EsignException ex = new EsignException("--->>关闭请求响应失败",e); + ex.initCause(e); + throw ex; + } + } + } + esignHttpResponse.setStatus(status); + esignHttpResponse.setBody(resCtx); + return esignHttpResponse; + } + //------------------------------公有方法end---------------------------------------------- + + //------------------------------私有方法start-------------------------------------------- + + /** + * @description 请求头和超时时间配置 + * + * @param httpReqBase + * @author 澄泓 + */ + private static void config(HttpRequestBase httpReqBase) { + // 配置请求的超时设置 + RequestConfig.Builder builder = RequestConfig.custom() + .setConnectionRequestTimeout(MAX_TIMEOUT) + .setConnectTimeout(MAX_TIMEOUT) + .setSocketTimeout(MAX_TIMEOUT); + if(OPEN_PROXY){ + HttpHost proxy=new HttpHost(PROXY_IP,PROXY_PORT,PROXY_AGREEMENT); + builder.setProxy(proxy); + } + RequestConfig requestConfig = builder.build(); + httpReqBase.setConfig(requestConfig); + } + + /** + * @description 连接池配置 + * + * @return + * @author 澄泓 + */ + private static void cfgPoolMgr() throws EsignException { + ConnectionSocketFactory plainsf = PlainConnectionSocketFactory.getSocketFactory(); + LayeredConnectionSocketFactory sslsf = SSLConnectionSocketFactory.getSocketFactory(); + if(!SSL_VERIFY){ + sslsf=sslConnectionSocketFactory(); + } + + Registry registry = RegistryBuilder.create() + .register("http", plainsf) + .register("https", sslsf) + .build(); + + //连接池管理器 + connMgr = new PoolingHttpClientConnectionManager(registry); + //请求池最大连接数 + connMgr.setMaxTotal(MAX_TOTAL); + //但域名最大的连接数 + connMgr.setDefaultMaxPerRoute(ROUTE_MAX_TOTAL); + } + + + + + /** + * @description 设置重试机制 + * + * @author 澄泓 + */ + private static void cfgRetryHandler() { + retryHandler = new HttpRequestRetryHandler() { + + @Override + public boolean retryRequest(IOException e, int excCount, HttpContext ctx) { + //超过最大重试次数,就放弃 + if(excCount > MAX_RETRY) { + return false; + } + //服务器丢掉了链接,就重试 + if(e instanceof NoHttpResponseException) { + return true; + } + //不重试SSL握手异常 + if(e instanceof SSLHandshakeException) { + return false; + } + //中断 + if(e instanceof InterruptedIOException) { + return false; + } + //目标服务器不可达 + if(e instanceof UnknownHostException) { + return false; + } + //连接超时 + //SSL异常 + if(e instanceof SSLException) { + return false; + } + + HttpClientContext clientCtx = HttpClientContext.adapt(ctx); + HttpRequest req = clientCtx.getRequest(); + //如果是幂等请求,就再次尝试 + if(!(req instanceof HttpEntityEnclosingRequest)) { + return true; + } + return false; + } + }; + } + + /** + * 忽略域名校验 + */ + private static SSLConnectionSocketFactory sslConnectionSocketFactory() throws EsignException { + try { + SSLContext ctx = SSLContext.getInstance("TLS"); // 创建一个上下文(此处指定的协议类型似乎不是重点) + X509TrustManager tm = new X509TrustManager() { // 创建一个跳过SSL证书的策略 + public X509Certificate[] getAcceptedIssuers() { + return null; + } + + public void checkClientTrusted(X509Certificate[] arg0, String arg1) throws CertificateException { + } + + public void checkServerTrusted(X509Certificate[] arg0, String arg1) throws CertificateException { + } + }; + ctx.init(null, new TrustManager[] { tm }, null); // 使用上面的策略初始化上下文 + return new SSLConnectionSocketFactory(ctx, new String[] { "SSLv3", "TLSv1", "TLSv1.1", "TLSv1.2" }, null, NoopHostnameVerifier.INSTANCE); + }catch (Exception e){ + EsignException ex = new EsignException("忽略域名校验失败",e); + ex.initCause(e); + throw ex; + } + + } + + /** + * @description 获取单例HttpClient + * + * @return + * @author 澄泓 + */ + private static synchronized CloseableHttpClient getHttpClient() throws EsignException { + if(httpClient==null) { + CredentialsProvider credsProvider = new BasicCredentialsProvider(); + credsProvider.setCredentials(new AuthScope(PROXY_IP,PROXY_PORT),new UsernamePasswordCredentials(PROXY_USERNAME, PROXY_PASSWORD)); + cfgPoolMgr(); + cfgRetryHandler(); + HttpClientBuilder httpClientBuilder = HttpClientBuilder.create(); + httpClient = httpClientBuilder.setDefaultCredentialsProvider(credsProvider).setConnectionManager(connMgr).setRetryHandler(retryHandler).build(); + } + return httpClient; + + } + //------------------------------私有方法end---------------------------------------------- + + +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/utils/EsignHttpHelper.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/utils/EsignHttpHelper.java new file mode 100644 index 0000000..0c93f94 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/utils/EsignHttpHelper.java @@ -0,0 +1,83 @@ +package com.seeyon.apps.src_rent.utils; + +import com.seeyon.apps.src_rent.po.EsignException; +import com.seeyon.apps.src_rent.po.EsignHttpResponse; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.HashMap; +import java.util.Map; + +/** + * @description Http 请求 辅助类 + * @author 澄泓 + * @since JDK1.7 + */ +public class EsignHttpHelper { + private static final Logger LOGGER = LoggerFactory.getLogger(EsignHttpHelper.class); + + /** + * 不允许外部创建实例 + */ + private EsignHttpHelper() { + + } + + /** + * @description 发送常规HTTP 请求 + * + * @param reqType 请求方式 + * @param url 请求路径 + * @param paramStr 请求参数 + * @return + * @throws EsignException + * @author 澄泓 + */ + public static EsignHttpResponse doCommHttp(String host, String url, EsignRequestType reqType, Object paramStr , Map httpHeader, boolean debug) throws EsignException { + return EsignHttpCfgHelper.sendHttp(reqType, host+url,httpHeader, paramStr, debug); + } + + + /** + * @description 发送文件流上传 HTTP 请求 + * + * @param reqType 请求方式 + * @param uploadUrl 请求路径 + * @param param 请求参数 + * @param fileContentMd5 文件fileContentMd5 + * @param contentType 文件MIME类型 + * @return + * @author 澄泓 + */ + public static EsignHttpResponse doUploadHttp( String uploadUrl,EsignRequestType reqType,byte[] param, String fileContentMd5, + String contentType, boolean debug) throws EsignException { + Map uploadHeader = buildUploadHeader(fileContentMd5, contentType); + if(debug){ + LOGGER.info("----------------------------start------------------------"); + LOGGER.info("fileContentMd5:{}",fileContentMd5); + LOGGER.info("contentType:{}",contentType); + } + return EsignHttpCfgHelper.sendHttp(reqType,uploadUrl, uploadHeader, param,debug); + } + + + + + /** + * @description 创建文件流上传 请求头 + * + * @param fileContentMd5 + * @param contentType + * @return + * @author 澄泓 + */ + public static Map buildUploadHeader(String fileContentMd5, String contentType) { + Map header = new HashMap<>(); + header.put("Content-MD5", fileContentMd5); + header.put("Content-Type", contentType); + + return header; + } + + // ------------------------------私有方法end---------------------------------------------- +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/utils/EsignRequestType.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/utils/EsignRequestType.java new file mode 100644 index 0000000..b3b1412 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/utils/EsignRequestType.java @@ -0,0 +1,34 @@ +package com.seeyon.apps.src_rent.utils; + +import org.apache.http.client.methods.*; + +public enum EsignRequestType { + + POST{ + @Override + public HttpRequestBase getHttpType(String url) { + return new HttpPost(url); + } + }, + GET{ + @Override + public HttpRequestBase getHttpType(String url) { + return new HttpGet(url); + } + }, + DELETE{ + @Override + public HttpRequestBase getHttpType(String url) { + return new HttpDelete(url); + } + }, + PUT{ + @Override + public HttpRequestBase getHttpType(String url) { + return new HttpPut(url); + } + }, + ; + + public abstract HttpRequestBase getHttpType(String url); +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/utils/FileUtil.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/utils/FileUtil.java new file mode 100644 index 0000000..f6049ed --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/utils/FileUtil.java @@ -0,0 +1,517 @@ +package com.seeyon.apps.src_rent.utils; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.seeyon.ctp.common.AppContext; +import com.seeyon.ctp.common.SystemEnvironment; +import com.seeyon.ctp.common.exceptions.BusinessException; +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 com.seeyon.ctp.organization.bo.V3xOrgAccount; +import com.seeyon.ctp.organization.bo.V3xOrgMember; +import com.seeyon.ctp.organization.manager.OrgManager; +import com.seeyon.ctp.services.FileUploadExporter; +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import www.seeyon.com.utils.StringUtil; +import www.seeyon.com.utils.UUIDUtil; + +import java.io.*; +import java.text.SimpleDateFormat; +import java.util.*; + +public class FileUtil { + + private static final long MAX_FILE_SIZE = 100 * 1024 * 1024; // 100MB + private static final String TEMP_DIR = System.getProperty("java.io.tmpdir") + File.separator + "seeyontempfile"; + private static final String DEFAULT_FILENAME_PREFIX = "没有文件名_"; + private static final String CATEGORY_CODE = "66"; + private FileManager fileManager; + + public void setFileManager(FileManager fileManager) { + this.fileManager = fileManager; + } + + public FileManager getFileManager() { + if (fileManager == null) { + fileManager = (FileManager) AppContext.getBean("fileManager"); + } + return fileManager; + } + + private AttachmentManager attachmentManager; + + public void setAttachmentManager(AttachmentManager attachmentManager) { + this.attachmentManager = attachmentManager; + } + + public AttachmentManager getAttachmentManager() { + if (attachmentManager == null) { + attachmentManager = (AttachmentManager) AppContext.getBean("attachmentManager"); + } + return attachmentManager; + } + + public void isFilePath(String filePath) { + File directory = new File(filePath); + if (!directory.exists()) { + directory.mkdirs(); + } + + } + + + /** + * 上传附件 + * + * @param fileNames + * @throws Exception + * @throws NumberFormatException + */ + public List fileUpload(List fileNames, String summaryId, Long memberId, Long accountId) throws NumberFormatException, Exception { + + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); +// List> lists = dataDao.findAttachAll(id); + FileUploadExporter fileUpload = new FileUploadExporter(); + List attachments = new ArrayList(); + File f = null; + long l = UUIDUtil.getUUIDLong(); + for (int i = 0; i < fileNames.size(); i++) { + String fileName = fileNames.get(i); + if (StringUtils.isNotEmpty(fileName)) { + f = new File(fileName); + if (!f.exists()) { + return null; + } + if (f.length() > 102400000) { + return null; + } + } + String[] strs = new String[]{f.getAbsolutePath()}; + String s = fileUpload.processUpload(strs); + +// if(StringUtils.isNotEmpty(s)) { + Map map = new HashMap(); + String attachName = f.getName(); + String[] suffixNames = attachName.split("\\."); + map.put("type", "0"); + map.put("fileUrl", s); + map.put("mimeType", "application/" + suffixNames[suffixNames.length - 1].toLowerCase()); +// if(suffixNames[suffixNames.length-1].equals("docx")) { +// map.put("mimeType", "application/docx"); +// }else { +// map.put("mimeType", "image/png"); +// } + map.put("size", f.length() + ""); +// System.out.println(beanId); + + map.put("subReference", l + ""); + map.put("category", "66"); + map.put("createdate", sdf.format(new Date())); + map.put("filename", f.getName()); + map.put("reference", summaryId); + Attachment attachment = new Attachment(map); + + attachments.add(attachment); + } + +// } + String str = getAttachmentManager().create(attachments, memberId, accountId); +// attachmentManager.create(attachments); +// System.out.println(str); + return attachments; + } + + + public List fieldFileDownload(Long refId, String path) throws BusinessException { +// 判断路径是否存在 + File file = new File(path); + if (!file.exists()) { + file.mkdirs(); + } + List fileUrls = getAttachmentManager().getBySubReference(refId); + System.out.println(fileUrls.size()); + List filepaths = new ArrayList<>(); + for (Long fileUrl : fileUrls) { + Attachment attachment = getAttachmentManager().getAttachmentByFileURL(fileUrl); + InputStream inputStream = getFileManager().getFileInputStream(attachment.getFileUrl()); + String filepath = path + attachment.getFilename(); + try (OutputStream outputStream = new BufferedOutputStream(new FileOutputStream(filepath))) { + byte[] buffer = new byte[1024]; + int bytesRead; + while ((bytesRead = inputStream.read(buffer)) != -1) { + outputStream.write(buffer, 0, bytesRead); + } + outputStream.flush(); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + filepaths.add(filepath); + } + return filepaths; + } + + + public JSONArray getFileContent(String filePath) throws IOException { + JSONArray jsonArray = new JSONArray(); + String houzhui = filePath.substring(filePath.lastIndexOf(".") + 1); + // 创建文件输入流 + FileInputStream file = new FileInputStream(new File(filePath)); + // 创建工作簿对象 + Workbook workbook; + System.out.println("当前文件为"+houzhui+"后缀"); + if ("xlsx".equals(houzhui) || "XLSX".equals(houzhui)) { + workbook = new XSSFWorkbook(file); + } else { + workbook = new HSSFWorkbook(file); + } + // 获取第一个工作表 + Sheet sheet = workbook.getSheetAt(0); + // 迭代行 + Iterator rowIterator = sheet.iterator(); +// 根据行跳过设置 + row : while (rowIterator.hasNext()) { + Row row = rowIterator.next(); + if (row.getRowNum() < 2) { + continue; + } + int num = 0; + int bj = 0; + JSONObject jsonObject = new JSONObject(); + JSONArray SPS = new JSONArray(); + JSONObject SP = new JSONObject(); + boolean isddh = false; + + // 迭代单元格 + Iterator cellIterator = row.cellIterator(); + cell : while (cellIterator.hasNext()) { +// 获取单元格对象 + Cell cell = cellIterator.next(); +// 单元格索引为1的数据(订单号) + if (cell.getColumnIndex() == 1) { + String ddh = ""; + switch (cell.getCellType()) { + case STRING: + ddh = cell.getStringCellValue(); + break; + case NUMERIC: + ddh = cell.getNumericCellValue()+""; + break; + default: + ddh = ""; + } +// 如果当前订单号为空,则跳过当前行数据 +// 查询当前订单号是否已经存在 + for (int i = 0; i < jsonArray.size(); i++) { + JSONObject json = jsonArray.getJSONObject(i); + if (ddh.equals(json.getString("DDH"))) { +// 订单号已经存在 + bj = i; + isddh = true; + jsonObject = json; + SPS = jsonObject.getJSONArray("SPS"); + } else { + num++; + } + } + if (num == jsonArray.size()) { +// switch (cell.getCellType()) { +// case STRING: + jsonObject.put("DDH",ddh); +// break; +// case NUMERIC: +// jsonObject.put("DDH", cell.getNumericCellValue()); +// break; +// default: +// jsonObject.put("DDH", ""); +// } +//// jsonObject.put("DDH", cell.getStringCellValue()); + } + } + switch (cell.getColumnIndex()) { + case 3: + if (!isddh) { + switch (cell.getCellType()) { + case STRING: + jsonObject.put("GMFMC", cell.getStringCellValue()); + break; + case NUMERIC: + jsonObject.put("GMFMC", cell.getNumericCellValue()); + break; + default: + jsonObject.put("GMFMC", ""); + } + } + break; + case 4: + if (!isddh) { + switch (cell.getCellType()) { + case STRING: + jsonObject.put("GMFNSRSBH", cell.getStringCellValue()); + break; + case NUMERIC: + jsonObject.put("GMFNSRSBH", cell.getNumericCellValue()); + break; + default: + jsonObject.put("GMFNSRSBH", ""); + } + } + break; + case 5: + if (!isddh) { + switch (cell.getCellType()) { + case STRING: + jsonObject.put("GMFYX", cell.getStringCellValue()); + break; + case NUMERIC: + jsonObject.put("GMFYX", cell.getNumericCellValue()); + break; + default: + jsonObject.put("GMFYX", ""); + } + } + break; + case 6: + if (!isddh) { + switch (cell.getCellType()) { + case STRING: + jsonObject.put("GMFSJ", cell.getStringCellValue()); + break; + case NUMERIC: + jsonObject.put("GMFSJ", cell.getNumericCellValue()); + break; + default: + jsonObject.put("GMFSJ", ""); + } + } + break; + case 17: + if (!isddh) { + switch (cell.getCellType()) { + case STRING: + jsonObject.put("BZ", cell.getStringCellValue()); + break; + case NUMERIC: + jsonObject.put("BZ", cell.getNumericCellValue()); + break; + default: + jsonObject.put("BZ", ""); + } + } + break; + case 2: + switch (cell.getCellType()) { + case STRING: + SP.put("FXHXZ", cell.getStringCellValue()); + break; + case NUMERIC: + SP.put("FXHXZ", cell.getNumericCellValue()); + break; + default: + SP.put("FXHXZ", ""); + } + break; + case 7: + switch (cell.getCellType()) { + case STRING: + SP.put("XMMC", cell.getStringCellValue()); + break; + case NUMERIC: + SP.put("XMMC", cell.getNumericCellValue()); + break; + default: + SP.put("XMMC", ""); + } + break; + case 8: + switch (cell.getCellType()) { + case STRING: + SP.put("SPBM", cell.getStringCellValue()); + break; + case NUMERIC: + SP.put("SPBM", cell.getNumericCellValue()); + break; + default: + SP.put("SPBM", ""); + } + break; + case 9: + switch (cell.getCellType()) { + case STRING: + SP.put("GGXH", cell.getStringCellValue()); + break; + case NUMERIC: + SP.put("GGXH", cell.getNumericCellValue()); + break; + default: + SP.put("GGXH", ""); + } + break; + case 10: + switch (cell.getCellType()) { + case STRING: + SP.put("DW", cell.getStringCellValue()); + break; + case NUMERIC: + SP.put("DW", cell.getNumericCellValue()); + break; + default: + SP.put("DW", ""); + } + break; + case 11: + switch (cell.getCellType()) { + case STRING: + SP.put("NUM", cell.getStringCellValue()); + break; + case NUMERIC: + SP.put("NUM", cell.getNumericCellValue()); + break; + default: + SP.put("NUM", ""); + } + break; + case 12: + switch (cell.getCellType()) { + case STRING: + SP.put("SPDJ", cell.getStringCellValue()); + break; + case NUMERIC: + SP.put("SPDJ", cell.getNumericCellValue()); + break; + default: + SP.put("SPDJ", ""); + } + break; + case 13: + switch (cell.getCellType()) { + case STRING: + SP.put("JE", cell.getStringCellValue()); + break; + case NUMERIC: + SP.put("JE", cell.getNumericCellValue()); + break; + default: + SP.put("JE", ""); + } + break; + case 14: + switch (cell.getCellType()) { + case STRING: + SP.put("SL", cell.getStringCellValue()); + break; + case NUMERIC: + SP.put("SL", cell.getNumericCellValue()); + break; + default: + SP.put("SL", ""); + } + break; + case 15: + switch (cell.getCellType()) { + case STRING: + SP.put("ZKJE", cell.getStringCellValue()); + break; + case NUMERIC: + SP.put("ZKJE", cell.getNumericCellValue()); + break; + default: + SP.put("ZKJE", ""); + } + break; + case 16: + switch (cell.getCellType()) { + case STRING: + SP.put("YHZCBS", cell.getStringCellValue()); + break; + case NUMERIC: + SP.put("YHZCBS", cell.getNumericCellValue()); + break; + default: + SP.put("YHZCBS", ""); + } + break; + } + } + if(StringUtil.isEmpty(jsonObject.getString("DDH"))){ + continue row; + } + SPS.add(SP); + jsonObject.put("SPS", SPS); + if (num == jsonArray.size()) { + jsonArray.add(jsonObject); + } else { + jsonArray.set(bj, jsonObject); + } + } + // 关闭工作簿 + workbook.close(); + file.close(); + return jsonArray; + } + + public JSONArray getFileContent(long fileId) throws IOException { + System.out.println("获取参数附件ID"+fileId); +// 附件路径 + String path = SystemEnvironment.getApplicationFolder()+"/hxinvoiceFile/"+fileId+"/"; + System.out.println("文件下载路径"+path); + List fileUrls = getAttachmentManager().getBySubReference(fileId); + Attachment attachment = getAttachmentManager().getAttachmentByFileURL(fileUrls.get(0)); + String filePath = path+attachment.getFilename(); + JSONArray jsonArray = getFileContent(filePath); + return jsonArray; + } + + + public static String uploadContractToOA(String url,String fileName, String formId, String loginName, String updateAccountName) throws Exception { + + OrgManager orgManager = (OrgManager) AppContext.getBean("orgManager"); + V3xOrgMember member = orgManager.getMemberByLoginName(loginName); + V3xOrgAccount account = orgManager.getAccountByName(updateAccountName); + + File tempDir = new File(TEMP_DIR); + if (!tempDir.exists()) { + tempDir.mkdirs(); + } + String savePath = TEMP_DIR + File.separator + fileName; + HttpClient.httpDownloadFile(url, null,savePath,"ITF-8"); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + String refId = String.valueOf(Math.abs(UUID.randomUUID().getLeastSignificantBits())); + FileUploadExporter fileUpload = new FileUploadExporter(); + List attachments = new ArrayList<>(); + + File file = new File(savePath); + if (file.exists() && file.length() <= MAX_FILE_SIZE) { + String uploadedPath = fileUpload.processUpload(new String[]{file.getAbsolutePath()}); + Map attachMeta = new HashMap<>(); + attachMeta.put("type", "0"); + attachMeta.put("fileUrl", uploadedPath); + attachMeta.put("size", String.valueOf(file.length())); + attachMeta.put("subReference", refId); + attachMeta.put("category", CATEGORY_CODE); + attachMeta.put("createdate", sdf.format(new Date())); + attachMeta.put("filename", fileName); + attachMeta.put("reference", formId); + attachMeta.put("mimeType", "application/" + "pdf"); + attachments.add(new Attachment(attachMeta)); + } + if (attachments.isEmpty()) return null; + AttachmentManager attachmentManager = (AttachmentManager) AppContext.getBean("attachmentManager"); + attachmentManager.create(attachments, member.getId(), account.getId()); + file.delete(); + return refId; + } + + private static boolean isBlank(String str) { + return str == null || str.trim().isEmpty(); + } +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/utils/HmacSHA256Util.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/utils/HmacSHA256Util.java new file mode 100644 index 0000000..7fb7b96 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/utils/HmacSHA256Util.java @@ -0,0 +1,27 @@ +package com.seeyon.apps.src_rent.utils; + +import javax.crypto.Mac; +import javax.crypto.spec.SecretKeySpec; +import java.nio.charset.StandardCharsets; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; +import java.util.Base64; + +public class HmacSHA256Util { + public static String encrypt(String data, String key) + throws NoSuchAlgorithmException, InvalidKeyException { + Mac sha256_HMAC = Mac.getInstance("HmacSHA256"); + SecretKeySpec secret_key = new SecretKeySpec( + key.getBytes(StandardCharsets.UTF_8), "HmacSHA256"); + sha256_HMAC.init(secret_key); + byte[] hash = sha256_HMAC.doFinal(data.getBytes(StandardCharsets.UTF_8)); + return Base64.getEncoder().encodeToString(hash); + } + + public static void main(String[] args) throws Exception { + String data = "Hello World"; + String key = "secret"; + String result = encrypt(data, key); + System.out.println("HmacSHA256加密结果: " + result); + } +} \ No newline at end of file diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/utils/HttpClient.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/utils/HttpClient.java new file mode 100644 index 0000000..79ac307 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/utils/HttpClient.java @@ -0,0 +1,483 @@ +package com.seeyon.apps.src_rent.utils; + +import org.apache.http.HttpEntity; +import org.apache.http.NameValuePair; +import org.apache.http.client.entity.UrlEncodedFormEntity; +import org.apache.http.client.methods.*; +import org.apache.http.entity.ContentType; +import org.apache.http.entity.StringEntity; +import org.apache.http.entity.mime.HttpMultipartMode; +import org.apache.http.entity.mime.MultipartEntityBuilder; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.util.EntityUtils; + +import java.io.*; +import java.nio.charset.Charset; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @ClassName: HttpClient + * @Description: HTTP请求工具类 + * @Author: GiikJc + * @Date: 2022/7/12 15:03 + */ + +/** + * 发送Get请求:HttpResponse httpGet(String url,Map headers,String encode) + *发送Post请求,同表单Post提交:HttpResponse httpPostForm(String url,Map params, Map headers,String encode) + *发送Post Raw请求:HttpResponse httpPostRaw(String url,String stringJson,Map headers, String encode) + *发送Put Raw请求:HttpResponse httpPutRaw(String url,String stringJson,Map headers, String encode) + *发送Delete请求:HttpResponse httpDelete(String url,Map headers,String encode) + */ +public class HttpClient { + + /** + * 发送 HTTP GET 请求下载文件 + * @param url 下载文件的 URL + * @param headers 请求头 + * @param savePath 文件保存的路径 + * @param encode 文件内容的编码 + * @return 下载成功返回 true,失败返回 false + */ + public static boolean httpDownloadFile(String url, Map headers, String savePath, String encode) { + if (encode == null) { + encode = "utf-8"; // 默认字符编码 + } + + CloseableHttpClient httpClient = null; + CloseableHttpResponse httpResponse = null; + InputStream inputStream = null; + OutputStream outputStream = null; + + try { + // 创建 HttpClient 实例 + httpClient = HttpClients.createDefault(); + HttpGet httpGet = new HttpGet(url); + + // 设置请求头 + if (headers != null && headers.size() > 0) { + for (Map.Entry entry : headers.entrySet()) { + httpGet.setHeader(entry.getKey(), entry.getValue()); + } + } + + // 执行请求 + httpResponse = httpClient.execute(httpGet); + HttpEntity entity = httpResponse.getEntity(); + + // 检查响应状态码 + if (httpResponse.getStatusLine().getStatusCode() == 200) { + inputStream = entity.getContent(); + + // 创建输出流,将文件保存到本地 + outputStream = new FileOutputStream(savePath); + + // 设置缓冲区 + byte[] buffer = new byte[4096]; + int bytesRead; + while ((bytesRead = inputStream.read(buffer)) != -1) { + outputStream.write(buffer, 0, bytesRead); + } + + // 文件下载成功 + return true; + } else { + System.out.println("Download failed, HTTP error code: " + httpResponse.getStatusLine().getStatusCode()); + return false; + } + } catch (Exception e) { + e.printStackTrace(); + return false; + } finally { + try { + if (inputStream != null) { + inputStream.close(); + } + if (outputStream != null) { + outputStream.close(); + } + if (httpResponse != null) { + httpResponse.close(); + } + if (httpClient != null) { + httpClient.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + /** + * 对queryString参数按key进行字典序升序排序 + * @param queryString 原始参数字符串,如"b=2&a=1&c=3" + * @return 排序后的字符串,如"a=1&b=2&c=3" + */ + public static String sortQueryString(String queryString) { + if (queryString == null || queryString.isEmpty()) { + return queryString; + } + + String[] pairs = queryString.split("&"); + Map params = new TreeMap<>(); + + for (String pair : pairs) { + String[] kv = pair.split("="); + if (kv.length == 2) { + params.put(kv[0], kv[1]); + } else if (kv.length == 1) { + params.put(kv[0], ""); + } + } + + return params.entrySet().stream() + .map(entry -> entry.getKey() + "=" + entry.getValue()) + .collect(Collectors.joining("&")); + } + /** + * 发送http get请求 + */ + public static String httpGet(String url,Map headers,String encode){ + + if(encode == null){ + encode = "utf-8"; + } + CloseableHttpResponse httpResponse = null; + CloseableHttpClient closeableHttpClient = null; + String content = null; + //since 4.3 不再使用 DefaultHttpClient + try { + closeableHttpClient = HttpClientBuilder.create().build(); + HttpGet httpGet = new HttpGet(url); + //设置header + if (headers != null && headers.size() > 0) { + for (Map.Entry entry : headers.entrySet()) { + httpGet.setHeader(entry.getKey(),entry.getValue()); + } + } + + httpResponse = closeableHttpClient.execute(httpGet); + HttpEntity entity = httpResponse.getEntity(); + content = EntityUtils.toString(entity, encode); + } catch (Exception e) { + e.printStackTrace(); + }finally{ + try { + httpResponse.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + try { //关闭连接、释放资源 + closeableHttpClient.close(); + } catch (IOException e) { + e.printStackTrace(); + } + return content; + } + /** + * 发送 http post 请求,参数以form表单键值对的形式提交。 + */ + public static String httpPostForm(String url,Map params, Map headers,String encode){ + + if(encode == null){ + encode = "utf-8"; + } + + String content = null; + CloseableHttpResponse httpResponse = null; + CloseableHttpClient closeableHttpClient = null; + try { + + closeableHttpClient = HttpClients.createDefault(); + HttpPost httpost = new HttpPost(url); + + //设置header + if (headers != null && headers.size() > 0) { + for (Map.Entry entry : headers.entrySet()) { + httpost.setHeader(entry.getKey(),entry.getValue()); + } + } + //组织请求参数 + List paramList = new ArrayList (); + if(params != null && params.size() > 0){ + Set keySet = params.keySet(); + for(String key : keySet) { + paramList.add(new BasicNameValuePair(key, params.get(key))); + } + } + httpost.setEntity(new UrlEncodedFormEntity(paramList, encode)); + + + httpResponse = closeableHttpClient.execute(httpost); + HttpEntity entity = httpResponse.getEntity(); + content = EntityUtils.toString(entity, encode); + } catch (Exception e) { + e.printStackTrace(); + }finally{ + try { + httpResponse.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + try { //关闭连接、释放资源 + closeableHttpClient.close(); + } catch (IOException e) { + e.printStackTrace(); + } + return content; + } + + /** + * 发送 http post 请求,参数以原生字符串进行提交 + * @param url + * @param encode + * @return + */ + public static String httpPostRaw(String url,String stringJson,Map headers, String encode){ + if(encode == null){ + encode = "utf-8"; + } + String content = null; + CloseableHttpResponse httpResponse = null; + CloseableHttpClient closeableHttpClient = null; + try { + + //HttpClients.createDefault()等价于 HttpClientBuilder.create().build(); + closeableHttpClient = HttpClients.createDefault(); + HttpPost httpost = new HttpPost(url); + + //设置header + httpost.setHeader("Content-type", "application/json"); + if (headers != null && headers.size() > 0) { + for (Map.Entry entry : headers.entrySet()) { + httpost.setHeader(entry.getKey(),entry.getValue()); + } + } + //组织请求参数 + StringEntity stringEntity = new StringEntity(stringJson, encode); + httpost.setEntity(stringEntity); + + + //响应信息 + httpResponse = closeableHttpClient.execute(httpost); + HttpEntity entity = httpResponse.getEntity(); + content = EntityUtils.toString(entity, encode); + } catch (Exception e) { + e.printStackTrace(); + }finally{ + try { + httpResponse.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + try { //关闭连接、释放资源 + closeableHttpClient.close(); + } catch (IOException e) { + e.printStackTrace(); + } + return content; + } + + /** + * 发送 http put 请求,参数以原生字符串进行提交 + * @param url + * @param encode + * @return + */ + public static String httpPutRaw(String url,String stringJson,Map headers, String encode){ + if(encode == null){ + encode = "utf-8"; + } + CloseableHttpResponse httpResponse = null; + CloseableHttpClient closeableHttpClient = null; + String content = null; + //since 4.3 不再使用 DefaultHttpClient + try { + + //HttpClients.createDefault()等价于 HttpClientBuilder.create().build(); + closeableHttpClient = HttpClients.createDefault(); + HttpPut httpput = new HttpPut(url); + + //设置header + httpput.setHeader("Content-type", "application/json"); + if (headers != null && headers.size() > 0) { + for (Map.Entry entry : headers.entrySet()) { + httpput.setHeader(entry.getKey(),entry.getValue()); + } + } + //组织请求参数 + StringEntity stringEntity = new StringEntity(stringJson, encode); + httpput.setEntity(stringEntity); + //响应信息 + httpResponse = closeableHttpClient.execute(httpput); + HttpEntity entity = httpResponse.getEntity(); + content = EntityUtils.toString(entity, encode); + } catch (Exception e) { + e.printStackTrace(); + }finally{ + try { + httpResponse.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + try { + closeableHttpClient.close(); //关闭连接、释放资源 + } catch (IOException e) { + e.printStackTrace(); + } + return content; + } + /** + * 发送http delete请求 + */ + public static String httpDelete(String url,Map headers,String encode){ + if(encode == null){ + encode = "utf-8"; + } + String content = null; + CloseableHttpResponse httpResponse = null; + CloseableHttpClient closeableHttpClient = null; + try { + //since 4.3 不再使用 DefaultHttpClient + closeableHttpClient = HttpClientBuilder.create().build(); + HttpDelete httpdelete = new HttpDelete(url); + //设置header + if (headers != null && headers.size() > 0) { + for (Map.Entry entry : headers.entrySet()) { + httpdelete.setHeader(entry.getKey(),entry.getValue()); + } + } + + httpResponse = closeableHttpClient.execute(httpdelete); + HttpEntity entity = httpResponse.getEntity(); + content = EntityUtils.toString(entity, encode); + } catch (Exception e) { + e.printStackTrace(); + }finally{ + try { + httpResponse.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + try { //关闭连接、释放资源 + closeableHttpClient.close(); + } catch (IOException e) { + e.printStackTrace(); + } + return content; + } + + /** + * 发送 http post 请求,支持文件上传 + */ + public static String httpPostFormMultipart(String url,Map params, List files,Map headers,String encode){ + if(encode == null){ + encode = "utf-8"; + } + CloseableHttpResponse httpResponse = null; + CloseableHttpClient closeableHttpClient = null; + String content = null; + //since 4.3 不再使用 DefaultHttpClient + try { + + closeableHttpClient = HttpClients.createDefault(); + HttpPost httpost = new HttpPost(url); + + //设置header + if (headers != null && headers.size() > 0) { + for (Map.Entry entry : headers.entrySet()) { + httpost.setHeader(entry.getKey(),entry.getValue()); + } + } + MultipartEntityBuilder mEntityBuilder = MultipartEntityBuilder.create(); + mEntityBuilder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE); + mEntityBuilder.setCharset(Charset.forName(encode)); + + // 普通参数 + ContentType contentType = ContentType.create("text/plain",Charset.forName(encode));//解决中文乱码 + if (params != null && params.size() > 0) { + Set keySet = params.keySet(); + for (String key : keySet) { + mEntityBuilder.addTextBody(key, params.get(key),contentType); + } + } + //二进制参数 + if (files != null && files.size() > 0) { + for (File file : files) { + mEntityBuilder.addBinaryBody("file", file); + } + } + httpost.setEntity(mEntityBuilder.build()); + httpResponse = closeableHttpClient.execute(httpost); + HttpEntity entity = httpResponse.getEntity(); + content = EntityUtils.toString(entity, encode); + } catch (Exception e) { + e.printStackTrace(); + }finally{ + try { + httpResponse.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + try { //关闭连接、释放资源 + closeableHttpClient.close(); + } catch (IOException e) { + e.printStackTrace(); + } + return content; + } + + + public static String uploadBinaryFile(String url, Map headers, + InputStream io, String fileName) throws IOException { + + CloseableHttpClient client = HttpClients.createDefault(); + HttpPut put = new HttpPut(url); + String responseBody = null; + + try { + // 设置请求头 + for (String key : headers.keySet()) { + put.addHeader(key, headers.get(key)); + } + + // 构建多部分实体 + MultipartEntityBuilder builder = MultipartEntityBuilder.create() + .setMode(HttpMultipartMode.BROWSER_COMPATIBLE) + .setCharset(Charset.forName("UTF-8")); + builder.addBinaryBody("file", io, ContentType.MULTIPART_FORM_DATA, fileName); + + put.setEntity(builder.build()); + + // 执行请求 + CloseableHttpResponse response = null; + try { + response = client.execute(put); + HttpEntity resEntity = response.getEntity(); + responseBody = EntityUtils.toString(resEntity, "UTF-8"); + + // 无论状态码如何,都返回响应体 + return responseBody; + + } finally { + if(response != null) { + response.close(); + } + } + } finally { + client.close(); + io.close(); + } + } + +} \ No newline at end of file diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/utils/JsonCleaner.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/utils/JsonCleaner.java new file mode 100644 index 0000000..402f311 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/utils/JsonCleaner.java @@ -0,0 +1,28 @@ +package com.seeyon.apps.src_rent.utils; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ObjectNode; + +import java.util.Iterator; +import java.util.Map; + +public class JsonCleaner { + + public static String removeEmptyObjects(String jsonStr) throws Exception { + ObjectMapper mapper = new ObjectMapper(); + ObjectNode node = (ObjectNode) mapper.readTree(jsonStr); + + Iterator> fields = node.fields(); + while (fields.hasNext()) { + Map.Entry entry = fields.next(); + if (entry.getValue().isObject() && entry.getValue().isEmpty()) { + fields.remove(); + } + } + + return mapper.writeValueAsString(node); + } + + +} \ No newline at end of file diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/utils/OaRestClient.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/utils/OaRestClient.java new file mode 100644 index 0000000..a5933de --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/utils/OaRestClient.java @@ -0,0 +1,110 @@ +package com.seeyon.apps.src_rent.utils; + +import com.alibaba.fastjson.JSONObject; +import com.seeyon.aicloud.common.JsonUtils; +import com.seeyon.apps.src_rent.po.OaResp; +import org.apache.commons.httpclient.HttpStatus; +import org.apache.http.HttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.http.message.BasicHeader; +import org.apache.http.util.EntityUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + + +public class OaRestClient { + private static final Logger log = LoggerFactory.getLogger(OaRestClient.class); + private String oaHost; + private String restName; + private String restPwd; +// private ConcurrentHashMap tokenCache = new ConcurrentHashMap<>(); + + public OaRestClient(String oaHost, String restName, String restPwd) { + this.oaHost = oaHost; + this.restName = restName; + this.restPwd = restPwd; + } + + public OaResp sendGet(String bizName, String url) throws Exception { + Map headers = new HashMap<>(); + headers.put("token",getToken()); + log.info(bizName + "请求链接为:" + url); + String respStr = HttpClient.httpGet(oaHost + "/seeyon/rest" + url,headers,null); + log.info(bizName + "响应结果为:" + respStr); + return resovleResp(respStr); + } + + public OaResp sendPost(String bizName,String url,Map params) throws Exception { + Map headers = new HashMap<>(); + headers.put("token",getToken()); + String paramStr = JsonUtils.toJSONString(params); + log.info(bizName + "请求参数为:" + paramStr); + String respStr = HttpClient.httpPostRaw(oaHost + "/seeyon/rest" + url,paramStr,headers,null); + log.info(bizName + "响应结果为:" + respStr); + return resovleResp(respStr); + } + + OaResp resovleResp(String respStr){ + return JsonUtils.parseObject(respStr,OaResp.class); + } + + private String applyToken() { + String url = oaHost +"/seeyon/rest/token/" + restName + "/" + restPwd + "?loginName=" + restName; + DefaultHttpClient client = new DefaultHttpClient(); + String result = ""; + HttpGet get = new HttpGet(url); + // 添加 Headers 信息 + get.addHeader(new BasicHeader("Accept", "application/json")); + try { + HttpResponse res = client.execute(get); + if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { + result = EntityUtils.toString(res.getEntity()); + } + } catch (Exception e) { + throw new RuntimeException(e); + } + String token = ""; + if(result.contains("{")) { + JSONObject jsObj = JSONObject.parseObject(result); + token = jsObj.get("id").toString(); + }else { + token = result; + } + return token; + } + + private String getToken(){ +// String token = tokenCache.get(restName); +// if(token != null && !checkExpire(token)) { +// return token; +// }else { +// String tokenStr = applyToken(); +// tokenCache.put(restName, tokenStr); +// return tokenStr; +// } + return applyToken(); + } + +// private boolean checkExpire(String token) { +// String url = oaHost + "/seeyon/rest/cap4/batch/refresh"; +// try{ +// Map headers = new HashMap<>(); +// headers.put("token",token); +// headers.put("loginName",restName); +// HttpResponse response = HttpRequestUtils.sendPost(url, null, headers); +// if(response.getCode() == 200) { +// return false; +// }else { +// return true; +// } +// } catch (Exception e){ +// return true; +// } +// } + +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/utils/ProtUtil.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/utils/ProtUtil.java new file mode 100644 index 0000000..de7ab72 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/utils/ProtUtil.java @@ -0,0 +1,88 @@ +package com.seeyon.apps.src_rent.utils; + +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 org.apache.commons.httpclient.HttpStatus; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.http.HttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.http.message.BasicHeader; +import org.apache.http.util.EntityUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import www.seeyon.com.utils.StringUtil; + +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; + + public String getPluginId() {return RentConstants.getPluginId();} + /** + * 获取一个token + * + * @return + * @throws IOException + * @throws FileNotFoundException + */ + private String getToken(String oatokenurl,String restName,String restPassword,String loginName) throws FileNotFoundException, IOException { + String address = oatokenurl + restName + "/" + restPassword; + if(StringUtil.isNotEmpty(loginName)){ + address = address +"?loginName="+loginName; + } + DefaultHttpClient client = new DefaultHttpClient(); + String result = ""; + HttpGet get = new HttpGet(address); + // 添加 Headers 信息 + get.addHeader(new BasicHeader("Accept", "application/json")); + try { + HttpResponse res = client.execute(get); + if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { + result = EntityUtils.toString(res.getEntity()); + } + } catch (Exception e) { + throw new RuntimeException(e); + } + String token = ""; + if(result.contains("{")) { + JSONObject jsObj = JSONObject.parseObject(result); + token = jsObj.get("id").toString(); + }else { + token = result; + } + return token; + } + + + /** + * 调用post接口 + * @return + */ + public String sendPostNotification(String params, String urlParam, String token) throws IOException { + String host = configProvider.getBizConfigByKey(RentConstants.OA_HOST); + String tokenGetUrl = configProvider.getBizConfigByKey(RentConstants.getTokenUrl); + String restName = configProvider.getBizConfigByKey(RentConstants.restName); + String restPwd = configProvider.getBizConfigByKey(RentConstants.restPwd); + String oatoken = getToken(host + tokenGetUrl,restName,restPwd,null); + String url = host + urlParam+ token+"?token="+oatoken; + log.info("调用恢复超级节点接口请求地址为: " + url); + String respStr = HttpClient.httpPostRaw(url, params, null, null); + log.info("调用恢复超级节点接口响应结果: " + respStr); + if(!"1".equals(respStr)) { + Map map = JsonUtils.parseObject(respStr, Map.class); + throw new RuntimeException("恢复阻塞的超级节点失败: " + map.get("message")); + } + return respStr; + } + +} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/viewrecord/ViewRecordService.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/viewrecord/ViewRecordService.java new file mode 100644 index 0000000..f675414 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/viewrecord/ViewRecordService.java @@ -0,0 +1,45 @@ +package com.seeyon.apps.src_rent.viewrecord; + +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 java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; +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 String getFormNo() { + return configProvider.getBizConfigByKey(RentConstants.VIEWRECORD_FORMNO); + } + + public void record(JSONObject params) throws Exception { + DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Map mainFormData = new HashMap<>(); + mainFormData.put("资产编号", params.getString("assetsNo")); + mainFormData.put("资产名称", params.getString("assetsName")); + mainFormData.put("浏览人手机号", params.getString("appointeePhone")); + String docNo = "weChat_" + UUID.randomUUID().toString().replace("-",""); + mainFormData.put("档案编号",docNo); + mainFormData.put("浏览时间",df.format(new Date())); + String loginName = configProvider.getBizConfigByKey(RentConstants.formLoginName); + formDataOperator.insertFormData(loginName,getFormNo(),mainFormData,null); + } +} diff --git a/apps-customize/src/main/java/com/seeyon/ctp/rest/resources/AssetsQueryResource.java b/apps-customize/src/main/java/com/seeyon/ctp/rest/resources/AssetsQueryResource.java new file mode 100644 index 0000000..9c1bc2b --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/ctp/rest/resources/AssetsQueryResource.java @@ -0,0 +1,54 @@ +package com.seeyon.ctp.rest.resources; + +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 javax.ws.rs.Consumes; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Response; +import java.io.IOException; + + +/** + * 查询OA资产档案信息 + */ +@Path("/assets") +@Produces({"application/json", "application/xml"}) +public class AssetsQueryResource extends BaseResource{ + + private static final Log log = Log.get(AssetsQueryResource.class); + private AssetsService assetsService = (AssetsService) AppContext.getBean("assetsService"); + + @POST + @Path("/queryPage") + @Produces({"application/json"}) + @Consumes({"application/json"}) + public Response queryPage(JSONObject params) throws IOException { + log.info("分页查询资产信息参数为:"+params); + try{ + return success(assetsService.pageQuery(params)); + } catch (Exception e) { + log.error(e.getMessage(),e); + return fail(e.getMessage()); + } + } + + @POST + @Path("/detail") + @Produces({"application/json"}) + @Consumes({"application/json"}) + public Response queryDetail(JSONObject params) throws IOException { + log.info("查询资产详情信息参数为:"+params); + try{ + return success(assetsService.queryAssetsDetail(params)); + } catch (Exception e) { + log.error(e.getMessage(),e); + return fail(e.getMessage()); + } + } + +} diff --git a/apps-customize/src/main/java/com/seeyon/ctp/rest/resources/BillResource.java b/apps-customize/src/main/java/com/seeyon/ctp/rest/resources/BillResource.java new file mode 100644 index 0000000..2c234d7 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/ctp/rest/resources/BillResource.java @@ -0,0 +1,115 @@ +package com.seeyon.ctp.rest.resources; + +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.WaeBillService; +import com.seeyon.ctp.common.AppContext; + +import javax.ws.rs.Consumes; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Response; +import java.io.IOException; + + +/** + * 账单 + */ +@Path("/bill") +@Produces({"application/json", "application/xml"}) +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"); + + @POST + @Path("/contractBill/queryPage") + @Produces({"application/json"}) + @Consumes({"application/json"}) + public Response contractBillQueryPage(JSONObject params) throws IOException { + log.info("分页查询合同账单信息参数为:"+params); + try{ + return success(billService.pageQueryContractBill(params)); + } catch (Exception e) { + log.error(e.getMessage(),e); + return fail(e.getMessage()); + } + } + @POST + @Path("/payRecord/queryPage") + @Produces({"application/json"}) + @Consumes({"application/json"}) + public Response payRecordQueryPage(JSONObject params) throws IOException { + log.info("分页查询合同账单缴费明细参数为:"+params); + try{ + return success(feeRecordService.queryBillPayRecord(params)); + } catch (Exception e) { + log.error(e.getMessage(),e); + return fail(e.getMessage()); + } + } + + @POST + @Path("/waeBill/queryPage") + @Produces({"application/json"}) + @Consumes({"application/json"}) + public Response waeBillQueryPage(JSONObject params) throws IOException { + log.info("分页查询水电费账单信息参数为:"+params); + try{ + return success(waeBillService.pageQueryWaeBill(params)); + } catch (Exception e) { + log.error(e.getMessage(),e); + return fail(e.getMessage()); + } + } + + @POST + @Path("/pay/callback") + @Produces({"application/json"}) + @Consumes({"application/json"}) + public Response onlinePayCallback(JSONObject params) throws IOException { + log.info("支付回调信息参数为:"+params); + try{ + return success(waeBillService.pageQueryWaeBill(params)); + } catch (Exception e) { + log.error(e.getMessage(),e); + return fail(e.getMessage()); + } + } + + @POST + @Path("/countUnpay/rent") + @Produces({"application/json"}) + @Consumes({"application/json"}) + public Response countUnpayRentBills(JSONObject params) throws IOException { + log.info("统计待缴租金账单数量:" + params, new Object[0]); + + try { + return this.success(billService.countUnpayRentBills(params)); + } catch (Exception e) { + log.error(e.getMessage(), new Object[]{e}); + return this.fail(e.getMessage()); + } + } + + @POST + @Path("/countUnpay/wae") + @Produces({"application/json"}) + @Consumes({"application/json"}) + public Response countUnpayWaeBills(JSONObject params) throws IOException { + log.info("统计待缴水电费账单数量:" + params, new Object[0]); + + try { + return this.success(waeBillService.countUnpayWaeBills(params)); + } catch (Exception e) { + log.error(e.getMessage(), new Object[]{e}); + return this.fail(e.getMessage()); + } + } + +} diff --git a/apps-customize/src/main/java/com/seeyon/ctp/rest/resources/ContractResource.java b/apps-customize/src/main/java/com/seeyon/ctp/rest/resources/ContractResource.java new file mode 100644 index 0000000..d1efbf5 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/ctp/rest/resources/ContractResource.java @@ -0,0 +1,110 @@ +package com.seeyon.ctp.rest.resources; + +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 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; + + +/** + * 查询OA资产档案信息 + */ +@Path("/contract") +@Produces({"application/json", "application/xml"}) +public class ContractResource extends BaseResource{ + + private static final Log log = Log.get(ContractResource.class); + private ContractService contractService = (ContractService) AppContext.getBean("contractService"); + + @POST + @Path("/queryPage") + @Produces({"application/json"}) + @Consumes({"application/json"}) + public Response queryPage(JSONObject params) throws IOException { + log.info("分页查询合同信息参数为:"+params); + try{ + return success(contractService.pageQuery(params)); + } catch (Exception e) { + log.error(e.getMessage(),e); + return fail(e.getMessage()); + } + } + + @POST + @Path("/countUnsign") + @Produces({"application/json"}) + @Consumes({"application/json"}) + public Response countUnSign(JSONObject params) throws IOException { + log.info("查询租户待签署的合同数参数为:"+params); + try{ + return success(contractService.countUnSign(params)); + } catch (Exception e) { + log.error(e.getMessage(),e); + return fail(e.getMessage()); + } + } + + @POST + @Path("/queryAll") + @Produces({"application/json"}) + @Consumes({"application/json"}) + public Response queryCusAllContract(JSONObject params) throws IOException { + log.info("查询租户所有合同信息参数为:"+params); + try{ + return success(contractService.queryAll(params)); + } catch (Exception e) { + log.error(e.getMessage(),e); + return fail(e.getMessage()); + } + } + + @POST + @Path("/detail") + @Produces({"application/json"}) + @Consumes({"application/json"}) + public Response queryDetail(JSONObject params) throws IOException { + log.info("查询合同详情信息参数为:"+params); + try{ + return success(contractService.queryContractDetail(params)); + } catch (Exception e) { + log.error(e.getMessage(),e); + return fail(e.getMessage()); + } + } + + @POST + @Path("/pageQueryAssets") + @Produces({"application/json"}) + @Consumes({"application/json"}) + public Response pageQueryAssets(JSONObject params) throws IOException { + log.info("分页查询合同关联资产和费用信息参数为:"+params); + try{ + return success(contractService.pageQueryContractAssetsInfoWithFee(params)); + } catch (Exception e) { + log.error(e.getMessage(),e); + return fail(e.getMessage()); + } + } + + @GET + @Path("/getSignLink") + @Produces({"application/json"}) + public Response getEsignLink(@Context HttpServletRequest request) throws IOException { + String eFlowId = request.getParameter("eFlowId"); + log.info("获取电子签链接参数为:"+ eFlowId); + try{ + return success(contractService.getSignLink(eFlowId)); + } catch (Exception e) { + log.error(e.getMessage(),e); + return fail(e.getMessage()); + } + } +} diff --git a/apps-customize/src/main/java/com/seeyon/ctp/rest/resources/CustomerMatchResource.java b/apps-customize/src/main/java/com/seeyon/ctp/rest/resources/CustomerMatchResource.java new file mode 100644 index 0000000..81c4484 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/ctp/rest/resources/CustomerMatchResource.java @@ -0,0 +1,70 @@ +package com.seeyon.ctp.rest.resources; + +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 javax.ws.rs.Consumes; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Response; +import java.io.IOException; + +/** + * 匹配OA客商信息 + */ +@Path("/cus") +@Produces({"application/json", "application/xml"}) +public class CustomerMatchResource extends BaseResource{ + + private static final Log log = Log.get(CustomerMatchResource.class); + private CustomerService customerService = (CustomerService) AppContext.getBean("customerService"); + + @POST + @Path("/matchPerson") + @Produces({"application/json"}) + @Consumes({"application/json"}) + public Response matchPerson(JSONObject params) throws IOException { + try{ + log.info("匹配个人客商参数为:" + params); + Customer customer = new Customer(); + customer.setCusPhone(params.getString("phone")); + String cusNo = customerService.matchCusPerson(customer); + return success(cusNo); + } catch (Exception e) { + log.error(e.getMessage(),e); + return fail(e.getMessage()); + } + } + + @POST + @Path("/matchOrg") + @Produces({"application/json"}) + @Consumes({"application/json"}) + public Response matchOrg(JSONObject params) throws IOException { + try{ + Customer customer = new Customer(); + customer.setOrgNo(params.getString("orgNo")); + return success(customerService.matchCusOrg(customer)); + } catch (Exception e) { + log.error(e.getMessage(),e); + return fail(e.getMessage()); + } + } + + @POST + @Path("/getCusInfo") + @Produces({"application/json"}) + @Consumes({"application/json"}) + public Response getCusInfo(JSONObject params) throws IOException { + try{ + return success(customerService.getCustomerInfo(params.getString("cusNo"))); + } catch (Exception e) { + log.error(e.getMessage(),e); + return fail(e.getMessage()); + } + } +} diff --git a/apps-customize/src/main/java/com/seeyon/ctp/rest/resources/DisChargeResource.java b/apps-customize/src/main/java/com/seeyon/ctp/rest/resources/DisChargeResource.java new file mode 100644 index 0000000..cd1cd78 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/ctp/rest/resources/DisChargeResource.java @@ -0,0 +1,55 @@ +package com.seeyon.ctp.rest.resources; + +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 javax.ws.rs.Consumes; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Response; +import java.io.IOException; + + +/** + * 退租 + */ +@Path("/discharge") +@Produces({"application/json", "application/xml"}) +public class DisChargeResource extends BaseResource{ + + private static final Log log = Log.get(DisChargeResource.class); + private DisCharegeService disCharegeService = (DisCharegeService) AppContext.getBean("disCharegeService"); + + @POST + @Path("/queryPage") + @Produces({"application/json"}) + @Consumes({"application/json"}) + public Response queryPage(JSONObject params) throws IOException { + log.info("分页查询退租申请信息参数为:"+params); + try{ + return success(disCharegeService.pageQuery(params)); + } catch (Exception e) { + log.error(e.getMessage(),e); + return fail(e.getMessage()); + } + } + + @POST + @Path("/apply") + @Produces({"application/json"}) + @Consumes({"application/json"}) + public Response apply(JSONObject params) throws IOException { + log.info("提交退租申请参数为:"+params); + try{ + disCharegeService.saveApplay(params); + return success("提交成功"); + } catch (Exception e) { + log.error(e.getMessage(),e); + return fail(e.getMessage()); + } + } + +} diff --git a/apps-customize/src/main/java/com/seeyon/ctp/rest/resources/FallbackResource.java b/apps-customize/src/main/java/com/seeyon/ctp/rest/resources/FallbackResource.java new file mode 100644 index 0000000..e25ede8 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/ctp/rest/resources/FallbackResource.java @@ -0,0 +1,70 @@ +package com.seeyon.ctp.rest.resources; + +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 javax.ws.rs.Consumes; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Response; +import java.io.IOException; + + +/** + * 留言板 + */ +@Path("/fallback") +@Produces({"application/json", "application/xml"}) +public class FallbackResource extends BaseResource{ + + private static final Log log = Log.get(FallbackResource.class); + private FallbackService fallbackService = (FallbackService) AppContext.getBean("fallbackService"); + + @POST + @Path("/queryPage") + @Produces({"application/json"}) + @Consumes({"application/json"}) + public Response queryPage(JSONObject params) throws IOException { + log.info("分页查询留言信息参数为:"+params); + try{ + return success(fallbackService.pageQuery(params)); + } catch (Exception e) { + log.error(e.getMessage(),e); + return fail(e.getMessage()); + } + } + + @POST + @Path("/detail") + @Produces({"application/json"}) + @Consumes({"application/json"}) + public Response detail(JSONObject params) throws IOException { + log.info("查询详情信息参数为:"+params); + try{ + return success(fallbackService.detail(params)); + } catch (Exception e) { + log.error(e.getMessage(),e); + return fail(e.getMessage()); + } + } + + + @POST + @Path("/submit") + @Produces({"application/json"}) + @Consumes({"application/json"}) + public Response submit(JSONObject params) throws IOException { + log.info("提交留言参数为:"+params); + try{ + fallbackService.saveFallback(params); + return success("提交成功"); + } catch (Exception e) { + log.error(e.getMessage(),e); + return fail(e.getMessage()); + } + } + +} diff --git a/apps-customize/src/main/java/com/seeyon/ctp/rest/resources/FileTransportResource.java b/apps-customize/src/main/java/com/seeyon/ctp/rest/resources/FileTransportResource.java new file mode 100644 index 0000000..49e672c --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/ctp/rest/resources/FileTransportResource.java @@ -0,0 +1,32 @@ +package com.seeyon.ctp.rest.resources; + +import cn.hutool.log.Log; +import com.seeyon.apps.src_rent.file.FileHandlerService; +import com.seeyon.ctp.common.AppContext; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.core.Context; + +/** + * 提供给外部下载OA文件 + */ +@Path("/fileTransport") +public class FileTransportResource extends BaseResource{ + + private static final Log log = Log.get(FileTransportResource.class); + private FileHandlerService fileHandlerService = (FileHandlerService) AppContext.getBean("fileHandlerService"); + + @GET + @Path("/downloadFile") + public void downloadFile(@Context HttpServletRequest request,@Context HttpServletResponse response) { + try { + fileHandlerService.handleFile(request.getParameter("refId"), response); + } catch (Exception e) { + log.error("外部系统下载oa文件失败"); + log.error(e.getMessage(), e); + } + } +} diff --git a/apps-customize/src/main/java/com/seeyon/ctp/rest/resources/NoticeResource.java b/apps-customize/src/main/java/com/seeyon/ctp/rest/resources/NoticeResource.java new file mode 100644 index 0000000..bfa8e15 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/ctp/rest/resources/NoticeResource.java @@ -0,0 +1,52 @@ +package com.seeyon.ctp.rest.resources; + +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 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; + +/** + * 招商公告 + */ +@Path("/notice") +public class NoticeResource extends BaseResource{ + + private static final Log log = Log.get(NoticeResource.class); + private NoticeService noticeService = (NoticeService) AppContext.getBean("noticeService"); + + @POST + @Path("/queryPage") + @Produces({"application/json"}) + @Consumes({"application/json"}) + public Response queryPage(JSONObject params) throws IOException { + log.info("分页查询招商公告信息参数为:"+params); + try{ + return success(noticeService.pageQuery(params)); + } catch (Exception e) { + log.error(e.getMessage(),e); + return fail(e.getMessage()); + } + } + + @POST + @Path("/detail") + @Produces({"application/json"}) + @Consumes({"application/json"}) + public Response queryDetail(JSONObject params) throws IOException { + log.info("查询招商公告详情信息参数为:"+params); + try{ + return success(noticeService.queryNoticeDetail(params)); + } catch (Exception e) { + log.error(e.getMessage(),e); + return fail(e.getMessage()); + } + } +} diff --git a/apps-customize/src/main/java/com/seeyon/ctp/rest/resources/ReserveResource.java b/apps-customize/src/main/java/com/seeyon/ctp/rest/resources/ReserveResource.java new file mode 100644 index 0000000..3ec5ad8 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/ctp/rest/resources/ReserveResource.java @@ -0,0 +1,69 @@ +package com.seeyon.ctp.rest.resources; + +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 javax.ws.rs.Consumes; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Response; +import java.io.IOException; + + +/** + * 预约看房 + */ +@Path("/reserve") +@Produces({"application/json", "application/xml"}) +public class ReserveResource extends BaseResource{ + + private static final Log log = Log.get(ReserveResource.class); + private ReserveService reserveService = (ReserveService) AppContext.getBean("reserveService"); + + @POST + @Path("/queryPage") + @Produces({"application/json"}) + @Consumes({"application/json"}) + public Response queryPage(JSONObject params) throws IOException { + log.info("分页查询预约看房信息参数为:"+params); + try{ + return success(reserveService.pageQuery(params)); + } catch (Exception e) { + log.error(e.getMessage(),e); + return fail(e.getMessage()); + } + } + + @POST + @Path("/countHandling") + @Produces({"application/json"}) + @Consumes({"application/json"}) + public Response countHandling(JSONObject params) throws IOException { + log.info("统计预约处理中申请数量:"+params); + try{ + return success(reserveService.countHandling(params)); + } catch (Exception e) { + log.error(e.getMessage(),e); + return fail(e.getMessage()); + } + } + + @POST + @Path("/apply") + @Produces({"application/json"}) + @Consumes({"application/json"}) + public Response apply(JSONObject params) throws IOException { + log.info("预约看房参数为:"+params); + try{ + reserveService.saveReserve(params); + return success("预约成功"); + } catch (Exception e) { + log.error(e.getMessage(),e); + return fail(e.getMessage()); + } + } + +} diff --git a/apps-customize/src/main/java/com/seeyon/ctp/rest/resources/ViewRecordResource.java b/apps-customize/src/main/java/com/seeyon/ctp/rest/resources/ViewRecordResource.java new file mode 100644 index 0000000..65992a3 --- /dev/null +++ b/apps-customize/src/main/java/com/seeyon/ctp/rest/resources/ViewRecordResource.java @@ -0,0 +1,35 @@ +package com.seeyon.ctp.rest.resources; + +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 javax.ws.rs.*; +import javax.ws.rs.core.Response; +import java.io.IOException; + +/** + * 记录微信小程序租户浏览资产记录 + */ +@Path("/potential") +public class ViewRecordResource extends BaseResource{ + + private static final Log log = Log.get(ViewRecordResource.class); + private ViewRecordService viewRecordService = (ViewRecordService) AppContext.getBean("viewRecordService"); + + @POST + @Path("/add") + @Produces({"application/json"}) + @Consumes({"application/json"}) + public Response add(JSONObject params) throws IOException { + log.info("增加租户浏览记录:"+params); + try{ + viewRecordService.record(params); + return success("预约成功"); + } catch (Exception e) { + log.error(e.getMessage(),e); + return fail(e.getMessage()); + } + } +} diff --git a/apps-customize/src/main/resources/needless_check_login.xml b/apps-customize/src/main/resources/needless_check_login.xml new file mode 100644 index 0000000..f52b410 --- /dev/null +++ b/apps-customize/src/main/resources/needless_check_login.xml @@ -0,0 +1,328 @@ + + + + /esigncallback.do + + callback + + + + /qrCodeForm.do + + index + newMain + + + + /sc.do + + qr + + + + /elearning.do + + error + m3Redirect + message + pcRedirect + + + + /phoneLogin/phoneLogin.do + + getMessageCode + validateMessageCode + + + + /wechat/miniprogram.do + + a8home + bind + bindMemberPhone + login + unbind + + + + /portal/spaceController.do + + showThemSpace + + + + /identification.do + + getSessionId + + + + /fileUpload.do + + showRTE + + + + /fileDownload.do + + showRTE + + + + /form/formUpgrade.do + + toUpgrade + upgrade + viewUpgrade + + + + formtalkFormMapperController.do + + importFormtalkData + + + + /thirdpartyController.do + + access + index + logoutNotify + show + mailAuth + + + + /main.do + + changeLocale + hangup + headerjs + index + login + login4Ucpc + login4Ucpc3 + login4Vjoin + logout + logout4Session + logout4Vjoin + logout4ZX + main + login4QrCode + qrCodeHelp + updateLoginSeed + + + + /trustdo/A8/XRD.do + + getLoginAccount + getLoginAcctoken + webLogin + + + + /share.do + + index + + + + /genericController.do + + index + + + + /edoc/edocUpgradeControllor.do + + upgrade + download + + + + /uploadService.do + + processUploadService + + + + /autoinstall.do + + ieSetDown + regInstallDown + regInstallDown64 + downloadAssistant + + + + /personalBind.do + + getBindTypeByLoginName + isCanUse + retrievePassword + sendVerificationCodeToBindEmail + sendVerificationCodeToBindNum + validateVerificationCode + + + + + + + + + + + /commonimage.do + + showImage + + + + /individualManager.do + + resetPassword + + + + /wechat/dingding.do + + binding + index + main + newIndex + newMain + viewh5Message + + + + /uc/rest.do + + commonPierce + downloadImage + getBgTimeStamp + getLoginsecurityMsg + sendsms + smsrequired + testIp + isQrLogin + getDigitalCodeInfo + + + + portalManager + + sendSMSLoginCode + smsLoginEnabled + + + + loginUserManager + + getLockTime + + + + qrCodeLoginManager + + isLogin + + + + meetingAjaxManager + + meetingPanelData + meetingPanelDisplay + + + + /m3/loginController.do + + transLogin + transLogout + getProfile + + + + /m3/mClientBindController.do + + bindApply + + + + m3ProductManager + + productInfo + productStatus + + + + /m3/homeSkinController.do + + downloadImage + getSkinImageUrl + + + + /m3/transModeController.do + + getTransModeForMobile + + + + /media/media.do + + mediaShow + + + + /ocipEdoc.do + + index + + + + /colView.do + + index + + + + /caAccountManagerController.do + + findKeyNumByLoginName + + + + /fddCallbackController.do + + asynch + synch + + + + /seeyonReport/seeyonReportController.do + + redirectSeeyonReport + + + + /imc.do + + index + logout + + + + + /cloudbuild.do + + download + getDownloadPageInfo + getLatestVersionInfo + getDownloadQrUrl + + + \ No newline at end of file diff --git a/apps-customize/src/main/resources/needless_check_login_recheck.xml b/apps-customize/src/main/resources/needless_check_login_recheck.xml new file mode 100644 index 0000000..1f764a4 --- /dev/null +++ b/apps-customize/src/main/resources/needless_check_login_recheck.xml @@ -0,0 +1,433 @@ + + + + + + /esigncallback.do + com.seeyon.apps.src_rent.controller.EsignCallBackController + + callback + + + + /qrCodeForm.do + com.seeyon.apps.qrCodeForm.controller.QrCodeFormController + + index + newMain + + + + + /sc.do + com.seeyon.cap4.form.modules.smartCode.controller.SmartCodeController + + qr + + + + /media/media.do + com.seeyon.ctp.common.media.controller.MediaController + + mediaShow + + + + /phoneLogin/phoneLogin.do + com.seeyon.ctp.login.controller.PhoneLoginController + + getMessageCode + validateMessageCode + + + + portalManager + com.seeyon.ctp.portal.manager.PortalManagerImpl + + sendSMSLoginCode + smsLoginEnabled + + + + /fileDownload.do + com.seeyon.ctp.common.fileupload.FileUploadController + + showRTE + + + + loginUserManager + com.seeyon.ctp.login.LoginUserManagerImpl + + getLockTime + + + + /main.do + com.seeyon.ctp.login.controller.MainController + + changeLocale + hangup + headerjs + index + login + login4Ucpc + login4Ucpc3 + login4Vjoin + logout + logout4Session + logout4Vjoin + logout4ZX + main + login4QrCode + qrCodeHelp + updateLoginSeed + + + + /trustdo/A8/XRD.do + com.seeyon.apps.trustdo.controller.XRDController + + getLoginAccount + getLoginAcctoken + webLogin + + + + /share.do + com.seeyon.v3x.system.share.controller.ShareController + + index + + + + /edoc/edocUpgradeControllor.do + com.seeyon.v3x.edoc.controller.EdocUpgradeControllor + + upgrade + download + + + + /m3/mClientBindController.do + com.seeyon.apps.m3.bind.controller.M3ClientBindController + + bindApply + + + + /uploadService.do + com.seeyon.ctp.services.FileUploadService + + processUploadService + + + + /uc/rest.do + com.seeyon.apps.zx.controller.ZxRestController + + commonPierce + downloadImage + getBgTimeStamp + getLoginsecurityMsg + sendsms + smsrequired + testIp + isQrLogin + getDigitalCodeInfo + + + + /m3/homeSkinController.do + com.seeyon.apps.m3.skin.controller.M3HomeSkinController + + downloadImage + getSkinImageUrl + + + + /colView.do + com.seeyon.apps.ocip.exchange.collaboration.controller.CollViewController + + index + + + + /autoinstall.do + com.seeyon.apps.autoinstall.controller.AutoInstallController + + ieSetDown + regInstallDown + regInstallDown64 + downloadAssistant + + + + + + + + + + + + /caAccountManagerController.do + com.seeyon.v3x.ca.caaccount.controller.CAAccountManagerController + + findKeyNumByLoginName + + + + /elearning.do + com.seeyon.apps.elearning.controller.ElearningController + + error + m3Redirect + message + pcRedirect + + + + /wechat/miniprogram.do + com.seeyon.apps.weixin.controller.MiniProgramController + + a8home + bind + bindMemberPhone + login + unbind + + + + /portal/spaceController.do + com.seeyon.ctp.portal.space.controller.SpaceController + + showThemSpace + + + + /identification.do + com.seeyon.v3x.identification.controller.IdentificationController + + getSessionId + + + + /fddCallbackController.do + com.seeyon.apps.econtract.fdd.controller.FddCallbackController + + asynch + synch + + + + m3ProductManager + com.seeyon.apps.m3.product.manager.impl.M3ProductManagerImpl + + productInfo + productStatus + + + + /ocipEdoc.do + com.seeyon.apps.ocip.exchange.edoc.OCIPEdocController + + index + + + + /m3/loginController.do + + transLogin + transLogout + getProfile + + + + /fileUpload.do + com.seeyon.ctp.common.fileupload.FileUploadController + + showRTE + processUpload + + + + qrCodeLoginManager + com.seeyon.ctp.login.manager.QrCodeLoginManagerImpl + + isLogin + + + + /form/formUpgrade.do + com.seeyon.ctp.form.service.FormUpgradeController + + toUpgrade + upgrade + viewUpgrade + + + + /seeyonReport/seeyonReportController.do + com.seeyon.apps.seeyonreport.controller.SeeyonReportController + + redirectSeeyonReport + + + + formtalkFormMapperController.do + com.seeyon.apps.formtalk.controller.FormtalkImportController + + importFormtalkData + + + + /thirdpartyController.do + com.seeyon.ctp.portal.sso.thirdpartyintegration.controller.ThirdpartyController + + access + index + logoutNotify + show + mailAuth + + + + /m3/transModeController.do + com.seeyon.apps.m3.transmissionmode.controller.M3TransModeController + + getTransModeForMobile + + + + /genericController.do + com.seeyon.v3x.common.controller.GenericController + + index + + + + /personalBind.do + com.seeyon.v3x.personalaffair.controller.PersonalBindController + + getBindTypeByLoginName + isCanUse + retrievePassword + sendVerificationCodeToBindEmail + sendVerificationCodeToBindNum + validateVerificationCode + + + + /commonimage.do + com.seeyon.apps.common.image.controller.ImageController + + showImage + + + + /individualManager.do + com.seeyon.v3x.personalaffair.controller.IndividualManagerController + + resetPassword + + + + meetingAjaxManager + com.seeyon.apps.meeting.manager.MeetingAjaxManagerImpl + + meetingPanelData + meetingPanelDisplay + + + + /wechat/dingding.do + com.seeyon.apps.weixin.controller.DingDingController + + binding + index + main + newIndex + newMain + viewh5Message + + + + /imc.do + com.seeyon.apps.imc.controller.ImcLoginController + + index + logout + + + + /wechat/feishu.do + com.seeyon.apps.weixin.controller.FeishuController + + newMain + viewh5Message + + + + + + + + + + + + + + + /wechat/pcapp.do + com.seeyon.apps.weixin.controller.PcAppController + + transferPageFromWxCoreServer + gotoPcApp + checkCodeTurnToRightPage + transfer + transferMsg + + + + /wechat/feishu/approvalData.do + com.seeyon.apps.zhifei.feishu.approval.controller.ApprovalDataController + + index + + + + /zhifei/feishu.do + com.seeyon.apps.zhifei.controller.FeishuController + + newMain + viewh5Message + + + + /zhifei/pcapp.do + com.seeyon.apps.zhifei.controller.ZhifeiPcAppController + + transferPageFromWxCoreServer + gotoPcApp + + + + /zhifei/feishu/approvalData.do + com.seeyon.apps.zhifei.feishu.approval.controller.ApprovalDataController + + index + + + + /cloudbuild.do + com.seeyon.apps.cloudbuild.controller.CloudBuildController + + download + getDownloadPageInfo + getLatestVersionInfo + getDownloadQrUrl + + + diff --git a/apps-customize/src/test/PwdEncoder.java b/apps-customize/src/test/PwdEncoder.java new file mode 100644 index 0000000..94d11b9 --- /dev/null +++ b/apps-customize/src/test/PwdEncoder.java @@ -0,0 +1,41 @@ +import com.seeyon.ctp.util.TextEncoder; + +import java.util.HashSet; +import java.util.Set; + +public final class PwdEncoder { + private static final String PWD_Prefix = "/1.0/"; + static final Set WEAK_PASSWORDS = new HashSet(); + + public static String encode(String clearPwd) { + return TextEncoder.encode(clearPwd); + } + + public static String decode(String text) { + return TextEncoder.decode(text); + } + + public static boolean checkWeakPwd(String pwd) { + return pwd == null || pwd.length() < 6 || WEAK_PASSWORDS.contains(pwd); + } + + static { + WEAK_PASSWORDS.add("123456"); + WEAK_PASSWORDS.add("111111"); + WEAK_PASSWORDS.add("222222"); + WEAK_PASSWORDS.add("333333"); + WEAK_PASSWORDS.add("444444"); + WEAK_PASSWORDS.add("555555"); + WEAK_PASSWORDS.add("666666"); + WEAK_PASSWORDS.add("777777"); + WEAK_PASSWORDS.add("888888"); + WEAK_PASSWORDS.add("999999"); + WEAK_PASSWORDS.add("000000"); + WEAK_PASSWORDS.add("123123"); + WEAK_PASSWORDS.add("abc123"); + } + + public static void main(String[] args) { + System.out.println(encode("*Qc123456789+")); + } +} \ No newline at end of file diff --git a/apps-customize/src/test/TestC.java b/apps-customize/src/test/TestC.java new file mode 100644 index 0000000..0c8e814 --- /dev/null +++ b/apps-customize/src/test/TestC.java @@ -0,0 +1,7 @@ +import com.seeyon.apps.src_rent.service.WeAppContractSyncService; + +public class TestC { + public static void main(String[] args) { + WeAppContractSyncService weAppContractSyncService = new WeAppContractSyncService(); + } +} diff --git a/seeyon/WEB-INF/cfgHome/component/src_rent/pluginCfg.xml b/seeyon/WEB-INF/cfgHome/component/src_rent/pluginCfg.xml new file mode 100644 index 0000000..6bbc6a2 --- /dev/null +++ b/seeyon/WEB-INF/cfgHome/component/src_rent/pluginCfg.xml @@ -0,0 +1,6 @@ + + + src_rent + 启辰资产租赁集成 + 20251212 + diff --git a/seeyon/WEB-INF/cfgHome/component/src_rent/spring/spring-bean.xml b/seeyon/WEB-INF/cfgHome/component/src_rent/spring/spring-bean.xml new file mode 100644 index 0000000..016b020 --- /dev/null +++ b/seeyon/WEB-INF/cfgHome/component/src_rent/spring/spring-bean.xml @@ -0,0 +1,12 @@ + + + + + \ No newline at end of file diff --git a/seeyon/WEB-INF/cfgHome/component/src_rent/spring/spring-controller.xml b/seeyon/WEB-INF/cfgHome/component/src_rent/spring/spring-controller.xml new file mode 100644 index 0000000..339c1c1 --- /dev/null +++ b/seeyon/WEB-INF/cfgHome/component/src_rent/spring/spring-controller.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/seeyon/WEB-INF/cfgHome/component/src_rent/spring/spring.xml b/seeyon/WEB-INF/cfgHome/component/src_rent/spring/spring.xml new file mode 100644 index 0000000..ad72735 --- /dev/null +++ b/seeyon/WEB-INF/cfgHome/component/src_rent/spring/spring.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file