宜都城投资产数据同步插件 优化代码,优化日志输出
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package com.seeyon.apps.src_ydctdatasync.config;
|
||||
|
||||
import com.seeyon.apps.common.config.ICstConfigApi;
|
||||
import com.seeyon.apps.common.plugin.vo.ConfigVo;
|
||||
import com.seeyon.apps.src_ydctdatasync.constants.YdzbdataSyncConstants;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
|
||||
import static com.seeyon.apps.src_ydctdatasync.constants.YdzbdataSyncConstants.getPluginId;
|
||||
|
||||
public class YdctPluginConfigProvider {
|
||||
protected ICstConfigApi cstConfigApi = (ICstConfigApi) AppContext.getBean("cstConfigApi");
|
||||
private boolean prod;
|
||||
public boolean isProd() {
|
||||
return prod;
|
||||
}
|
||||
|
||||
public void setProd(boolean prod) {
|
||||
this.prod = prod;
|
||||
}
|
||||
|
||||
public String getBizConfigByKey(YdzbdataSyncConstants key) {
|
||||
ConfigVo config = cstConfigApi.getConfig(getPluginId());
|
||||
if(prod) {
|
||||
return config.getParamVal(key.name());
|
||||
}else {
|
||||
return key.getDefaultValue();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,7 +12,8 @@ public enum YdzbdataSyncConstants {
|
||||
feeTable("formmain_0018","费用表表名"),
|
||||
feeFormNo("zcbd2","费用表单编号"),
|
||||
zcRootEnumPCode("9039506777142151368","资产档案枚举编码"),
|
||||
ksTable("","客商表单表名")
|
||||
ksTable("","客商表单表名"),
|
||||
ksSubTable("","客商从表表单表名")
|
||||
;
|
||||
YdzbdataSyncConstants(String defaultValue, String description) {
|
||||
this.defaultValue = defaultValue;
|
||||
@@ -22,14 +23,14 @@ public enum YdzbdataSyncConstants {
|
||||
private String defaultValue;
|
||||
private String description;
|
||||
|
||||
public String getDefaultValue() {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public String getDefaultValue() {
|
||||
return defaultValue;
|
||||
}
|
||||
public static String getPluginId() {
|
||||
return plugin.defaultValue;
|
||||
}
|
||||
|
||||
@@ -17,4 +17,13 @@ public class KsQueryDao {
|
||||
List<Map<String,Object>> list = (List<Map<String, Object>>) agent.execute(sql,params);
|
||||
return list == null || list.size() == 0 ? null : list.get(0);
|
||||
}
|
||||
|
||||
public Map<String,Object> queryOneBankInfo(String accountName,String clause,String table,MyJdbcAgent agent) throws BusinessException, SQLException {;
|
||||
String sql = "SELECT * FROM " + table + clause +";";
|
||||
List<String> params = new ArrayList<>();
|
||||
params.add(accountName);
|
||||
params.add("中国工商银行");
|
||||
List<Map<String,Object>> list = (List<Map<String, Object>>) agent.execute(sql,params);
|
||||
return list == null || list.size() == 0 ? null : list.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,42 +1,54 @@
|
||||
package com.seeyon.apps.src_ydctdatasync.datamap;
|
||||
|
||||
import com.seeyon.apps.src_ydctdatasync.dao.MyJdbcAgent;
|
||||
import com.seeyon.apps.src_ydctdatasync.utils.DeptGetUtils;
|
||||
import com.seeyon.apps.src_ydctdatasync.utils.EnumMapUtils;
|
||||
import com.seeyon.apps.src_ydctdatasync.utils.TimeUtils;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
import com.seeyon.ctp.common.exceptions.BusinessException;
|
||||
import com.seeyon.ctp.organization.bo.V3xOrgMember;
|
||||
import com.seeyon.ctp.organization.manager.OrgManager;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public abstract class AbstractAssetDataMapMode extends AbstractDataMapMode{
|
||||
|
||||
protected MyJdbcAgent agent;
|
||||
protected String zcRootPcode;
|
||||
protected String formNo;
|
||||
protected String ksTableName;
|
||||
|
||||
public String getZcRootPcode() {
|
||||
return zcRootPcode;
|
||||
public String getFormNo() {
|
||||
return formNo;
|
||||
}
|
||||
|
||||
public void setZcRootPcode(String zcRootPcode) {
|
||||
this.zcRootPcode = zcRootPcode;
|
||||
public void setFormNo(String formNo) {
|
||||
this.formNo = formNo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preProcess(Map<String, Object> map) {
|
||||
public void preProcess(Map<String, Object> map) throws SQLException {
|
||||
Object houseStatus = map.get("house_status");
|
||||
Object propertyMortgage = map.get("property_mortgage");
|
||||
String zcLevelValue = EnumMapUtils.getMasterTableEnumItemValue(formNo, "资产层级", "子级");
|
||||
String landNature = map.get("land_nature") + "";
|
||||
String zcStatus = houseStatus == null ? "" : EnumMapUtils.getEnumItemValue(zcRootPcode,agent,"资产状态", houseStatus +"");
|
||||
String isPublicAsset = EnumMapUtils.getEnumItemValue(zcRootPcode,agent,"是否共用产权","不共用");
|
||||
String assetBacked = propertyMortgage == null ? "" : EnumMapUtils.getEnumItemValue(zcRootPcode,agent,"是否产权抵押", propertyMortgage+"");
|
||||
map.put("land_nature","3".equals(landNature) ? "" : EnumMapUtils.getEnumItemValue(zcRootPcode,agent,"土地性质",landNature));
|
||||
String zcBlock = EnumMapUtils.getMasterTableEnumItemValue(formNo, "资产板块", "03不动产");
|
||||
String zcStatus = houseStatus == null ? "" : EnumMapUtils.getMasterTableEnumItemValue(formNo, "资产状态", houseStatus +"");
|
||||
String isPublicAsset = EnumMapUtils.getMasterTableEnumItemValue(formNo, "是否共用产权","不共用");
|
||||
String assetBacked = propertyMortgage == null ? "" : EnumMapUtils.getMasterTableEnumItemValue(formNo, "是否产权抵押", propertyMortgage+"");
|
||||
map.put("land_nature","3".equals(landNature) ? "" : EnumMapUtils.getMasterTableEnumItemValue(formNo, "土地性质",landNature));
|
||||
map.put("house_status",zcStatus);
|
||||
map.put("isPublicAsset",isPublicAsset);
|
||||
map.put("assetBacked",assetBacked);
|
||||
map.put("zcLevelValue",zcLevelValue);
|
||||
map.put("zcBlock",zcBlock);
|
||||
}
|
||||
|
||||
public abstract void fillParentZcInfo(Map<String, Object> map) throws SQLException;
|
||||
|
||||
public String getKsTableName() {
|
||||
return ksTableName;
|
||||
}
|
||||
@@ -46,14 +58,17 @@ public abstract class AbstractAssetDataMapMode extends AbstractDataMapMode{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void commonAttrTransfer(Object target, Object source) {
|
||||
public void commonAttrTransfer(Object target, Object source) throws SQLException {
|
||||
Map<String, Object> targetMap = (Map<String, Object>) target;
|
||||
Map<String, Object> sourceMap = (Map<String, Object>) source;
|
||||
fillParentZcInfo(sourceMap);
|
||||
targetMap.put("住保系统编码",sourceMap.get("house_id")); //填充住保系统编码
|
||||
targetMap.put("资产编号",sourceMap.get("house_id")); //填充资产编号
|
||||
StringBuilder stringBuilder = new StringBuilder("");
|
||||
if(sourceMap.get("village_name") != null) {
|
||||
stringBuilder.append(sourceMap.get("village_name"));
|
||||
}else {
|
||||
stringBuilder.append(sourceMap.get("父级资产名称"));
|
||||
}
|
||||
if(sourceMap.get("building_name") != null) {
|
||||
if(sourceMap.get("village_name") != null) {
|
||||
@@ -79,8 +94,8 @@ public abstract class AbstractAssetDataMapMode extends AbstractDataMapMode{
|
||||
targetMap.put("产权证号",sourceMap.get("property_certificate_no"));//填充产权证号
|
||||
targetMap.put("产权人",sourceMap.get("property_owner"));//填充产权人
|
||||
try {
|
||||
targetMap.put("资产获取日期",df.format(TimeUtils.convertLocalDateTime2Date(sourceMap.get("house_receipt_date"))));//填充资产获取日期
|
||||
targetMap.put("登记时间",df.format(TimeUtils.convertLocalDateTime2Date(sourceMap.get("property_registration_time"))));//填充登记时间
|
||||
targetMap.put("资产获取日期",TimeUtils.formatExcludeNull(TimeUtils.convertLocalDateTime2Date(sourceMap.get("house_receipt_date")),df));//填充资产获取日期
|
||||
targetMap.put("登记时间",TimeUtils.formatExcludeNull(TimeUtils.convertLocalDateTime2Date(sourceMap.get("property_registration_time")),df));//填充登记时间
|
||||
}catch (NullPointerException e) {
|
||||
|
||||
}
|
||||
@@ -92,7 +107,33 @@ public abstract class AbstractAssetDataMapMode extends AbstractDataMapMode{
|
||||
targetMap.put("账面价值",sourceMap.get("paper_value"));//填充账面价值
|
||||
targetMap.put("租赁基准价格",sourceMap.get("rent_benchmark"));//填充租赁基准价格
|
||||
targetMap.put("所属小区",sourceMap.get("located_street"));//填充所属小区
|
||||
targetMap.put("资产层级",sourceMap.get("zcLevelValue")); //填充资产层级
|
||||
targetMap.put("资产板块",sourceMap.get("zcBlock")); //填充资产板块
|
||||
targetMap.put("数据来源","住保资产系统历史数据"); //数据来源
|
||||
targetMap.put("资产性质",EnumMapUtils.getMasterTableEnumItemValue(formNo, "资产性质", "非流动资产"));
|
||||
// targetMap.put("field0061",sourceMap.get(""));//填充管理单位编号
|
||||
//填充父级资产信息
|
||||
targetMap.put("关联父级资产名称",sourceMap.get("父级资产名称"));
|
||||
targetMap.put("父级资产编号",sourceMap.get("父级资产编号"));
|
||||
targetMap.put("父级资产类型",sourceMap.get("父级资产类型"));
|
||||
targetMap.put("父级资产二级类型",sourceMap.get("父级资产二级类型"));
|
||||
targetMap.put("父级资产性质",sourceMap.get("父级资产性质"));
|
||||
targetMap.put("父级租售类型",sourceMap.get("父级租售类型"));
|
||||
targetMap.put("父级资产状态",sourceMap.get("父级资产状态"));
|
||||
targetMap.put("建档人员","艾为玮");
|
||||
targetMap.put("建档部门", DeptGetUtils.getDeptIdByName("综合科"));//建档部门
|
||||
targetMap.put("建档单位", DeptGetUtils.getDeptIdByName("宜都市住保运营管理有限公司"));//建档部门
|
||||
}
|
||||
|
||||
private String getCreatorDept(String loginName) {
|
||||
OrgManager orgManager = (OrgManager) AppContext.getBean("orgManager");
|
||||
try {
|
||||
V3xOrgMember member = orgManager.getMemberByLoginName(loginName);
|
||||
Long departmentId = member.getOrgDepartmentId();
|
||||
return departmentId == null ? "" : departmentId + "";
|
||||
} catch (BusinessException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public MyJdbcAgent getAgent() {
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
package com.seeyon.apps.src_ydctdatasync.datamap;
|
||||
|
||||
import com.seeyon.apps.src_ydctdatasync.config.YdctPluginConfigProvider;
|
||||
import com.seeyon.apps.src_ydctdatasync.dao.MyJdbcAgent;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
|
||||
public abstract class AbstractContractDataMapMode extends AbstractDataMapMode{
|
||||
|
||||
protected MyJdbcAgent agent;
|
||||
protected String zcRootPcode;
|
||||
protected String ksTableName;
|
||||
|
||||
protected YdctPluginConfigProvider ydctPluginConfigProvider = (YdctPluginConfigProvider) AppContext.getBean("ydctPluginConfigProvider");
|
||||
public String getZcRootPcode() {
|
||||
return zcRootPcode;
|
||||
}
|
||||
@@ -36,4 +38,12 @@ public abstract class AbstractContractDataMapMode extends AbstractDataMapMode{
|
||||
public void setAgent(MyJdbcAgent agent) {
|
||||
this.agent = agent;
|
||||
}
|
||||
|
||||
public YdctPluginConfigProvider getYdctPluginConfigProvider() {
|
||||
return ydctPluginConfigProvider;
|
||||
}
|
||||
|
||||
public void setYdctPluginConfigProvider(YdctPluginConfigProvider ydctPluginConfigProvider) {
|
||||
this.ydctPluginConfigProvider = ydctPluginConfigProvider;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,21 @@
|
||||
package com.seeyon.apps.src_ydctdatasync.datamap;
|
||||
|
||||
import cn.hutool.log.Log;
|
||||
import com.seeyon.apps.src_ydctdatasync.config.YdctPluginConfigProvider;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
|
||||
public abstract class AbstractDataMapMode {
|
||||
public static Log log = Log.get(AbstractDataMapMode.class);
|
||||
protected YdctPluginConfigProvider ydctPluginConfigProvider = (YdctPluginConfigProvider) AppContext.getBean("ydctPluginConfigProvider");
|
||||
/**
|
||||
* 表级别的前置处理,适用于一张表的整体逻辑
|
||||
*/
|
||||
public abstract void preProcess(Map<String, Object> map);
|
||||
public abstract void preProcess(Map<String, Object> map) throws SQLException;
|
||||
|
||||
/**
|
||||
* 返回字段级别的处理逻辑映射,每个字段对应一个处理函数
|
||||
@@ -25,21 +33,21 @@ public abstract class AbstractDataMapMode {
|
||||
* @param target 目标对象
|
||||
* @param source 源对象
|
||||
*/
|
||||
public abstract void transfer(Object target, Object source);
|
||||
public abstract void transfer(Object target, Object source) throws SQLException;
|
||||
|
||||
/**
|
||||
* 实现记录级别的共有字段的映射
|
||||
* @param target 目标对象
|
||||
* @param source 源对象
|
||||
*/
|
||||
public abstract void commonAttrTransfer(Object target, Object source);
|
||||
public abstract void commonAttrTransfer(Object target, Object source) throws SQLException;
|
||||
|
||||
/**
|
||||
* 数据映射,包含字段级和记录级的处理逻辑
|
||||
* @param target 目标对象
|
||||
* @param source 源对象
|
||||
*/
|
||||
protected void dataMapping(Object target, Object source) {
|
||||
protected void dataMapping(Object target, Object source) throws SQLException {
|
||||
if (source instanceof Map && target instanceof Map) {
|
||||
Map<String, Object> sourceMap = (Map<String, Object>) source;
|
||||
Map<String, Object> targetMap = (Map<String, Object>) target;
|
||||
@@ -68,4 +76,5 @@ public abstract class AbstractDataMapMode {
|
||||
protected Object defaultFieldProcessor(Object fieldValue) {
|
||||
return fieldValue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,45 +1,118 @@
|
||||
package com.seeyon.apps.src_ydctdatasync.datamap;
|
||||
|
||||
import com.seeyon.apps.src_ydctdatasync.dao.MyJdbcAgent;
|
||||
import com.seeyon.ctp.util.JDBCAgent;
|
||||
import com.seeyon.apps.src_ydctdatasync.utils.DeptGetUtils;
|
||||
import com.seeyon.apps.src_ydctdatasync.utils.EnumMapUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.Map;
|
||||
|
||||
public abstract class AbstractFeeDataMapMode extends AbstractDataMapMode{
|
||||
|
||||
protected MyJdbcAgent agent;
|
||||
protected String zcRootPcode;
|
||||
protected String formNo;
|
||||
protected String ksTableName;
|
||||
protected String ksSubTableName;
|
||||
|
||||
public String getZcRootPcode() {
|
||||
return zcRootPcode;
|
||||
public String getFormNo() {
|
||||
return formNo;
|
||||
}
|
||||
|
||||
public void setZcRootPcode(String zcRootPcode) {
|
||||
this.zcRootPcode = zcRootPcode;
|
||||
public void setFormNo(String formNo) {
|
||||
this.formNo = formNo;
|
||||
}
|
||||
|
||||
public String getKsTableName() {
|
||||
return ksTableName;
|
||||
}
|
||||
|
||||
public void setKsTableName(String ksTableName) {
|
||||
this.ksTableName = ksTableName;
|
||||
}
|
||||
|
||||
public String getKsSubTableName() {
|
||||
return ksSubTableName;
|
||||
}
|
||||
|
||||
public void setKsSubTableName(String ksSubTableName) {
|
||||
this.ksSubTableName = ksSubTableName;
|
||||
}
|
||||
|
||||
private Long getLong(Object value) {
|
||||
try {
|
||||
return Long.parseLong(value + "");
|
||||
}catch (Exception e) {
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void postProcess(Map<String, Object> map) {
|
||||
Long sourceTypeId = getLong(map.get("来源方式"));
|
||||
Long voucherTypeId = getLong(map.get("是否对公"));
|
||||
Long voucherTypeNoId = getLong(EnumMapUtils.getMasterTableEnumItemValue(formNo,"是否对公", "否"));
|
||||
Long sourceOnlineId = getLong(EnumMapUtils.getMasterTableEnumItemValue(formNo,"来源方式", "住保资产线上集成"));
|
||||
Long serviceFeeYes = getLong(EnumMapUtils.getMasterTableEnumItemValue(formNo,"是否有手续费", "是"));
|
||||
if(sourceOnlineId != null && sourceOnlineId.equals(sourceTypeId)
|
||||
&& voucherTypeNoId != null
|
||||
&& voucherTypeNoId.equals(voucherTypeId)) {
|
||||
map.put("是否有手续费",serviceFeeYes);
|
||||
}
|
||||
if(serviceFeeYes != null && serviceFeeYes.equals(map.get("是否有手续费"))) {
|
||||
map.put("手续费率",new BigDecimal("0.0054").setScale(4, RoundingMode.HALF_UP));
|
||||
}else {
|
||||
map.put("手续费率",BigDecimal.ZERO.setScale(4,RoundingMode.HALF_UP));
|
||||
}
|
||||
BigDecimal sxfl = (BigDecimal)map.get("手续费率");
|
||||
if(BigDecimal.ZERO.compareTo(sxfl) == -1) {
|
||||
if(map.get("实收或退金额") != null) {
|
||||
BigDecimal bigDecimal = new BigDecimal((String)map.get("实收或退金额"));
|
||||
map.put("手续费",bigDecimal.multiply(sxfl).setScale(2,RoundingMode.HALF_UP).toString());
|
||||
}else {
|
||||
map.put("手续费",BigDecimal.ZERO.setScale(2,RoundingMode.HALF_UP).toString());
|
||||
}
|
||||
}else {
|
||||
map.put("手续费",BigDecimal.ZERO.setScale(2,RoundingMode.HALF_UP));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preProcess(Map<String, Object> map) {
|
||||
|
||||
String recordBill = EnumMapUtils.getMasterTableEnumItemValue(formNo,"是否入账","未入");
|
||||
map.put("sjly",EnumMapUtils.getMasterTableEnumItemValue(formNo,"来源方式","住保资产线上集成"));
|
||||
map.put("recordBill",recordBill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void commonAttrTransfer(Object target, Object source) {
|
||||
Map<String, Object> targetMap = (Map<String, Object>) target;
|
||||
Map<String, Object> sourceMap = (Map<String, Object>) source;
|
||||
targetMap.put("数据来源","住保系统集成获取的收支数据"); //填充数据来源
|
||||
targetMap.put("住保-合同编号",sourceMap.get("contract_no")); //填充合同编号
|
||||
targetMap.put("合同ID",sourceMap.get("contract_id")); //填充合同ID
|
||||
targetMap.put("来源方式",sourceMap.get("sjly")); //填充数据来源
|
||||
targetMap.put("合同编号",sourceMap.get("contract_no")); //填充合同编号
|
||||
targetMap.put("经办人员","艾为玮"); //填充经办人
|
||||
targetMap.put("经办部门",DeptGetUtils.getDeptIdByName("综合科")); //填充经办部门
|
||||
targetMap.put("经办单位", DeptGetUtils.getDeptIdByName("宜都市住保运营管理有限公司")); //填充经办单位
|
||||
targetMap.put("住保系统编码",sourceMap.get("house_id")); //住保系统编码
|
||||
targetMap.put("住保-小区",sourceMap.get("village_name")); //填充小区
|
||||
targetMap.put("住保-楼栋",sourceMap.get("building_name")); //填充楼栋
|
||||
targetMap.put("住保-单元",sourceMap.get("unit_name")); //填充单元
|
||||
targetMap.put("住保-房号",sourceMap.get("house_number")); //填充房号
|
||||
targetMap.put("住保-租户联系方式",sourceMap.get("tenant_phone_number")); //填充租户联系方式
|
||||
targetMap.put("小区",sourceMap.get("village_name") == null || "".equals(sourceMap.get("village_name")) ? sourceMap.get("小区") : sourceMap.get("village_name")); //填充小区
|
||||
targetMap.put("楼栋",sourceMap.get("building_name")); //填充楼栋
|
||||
targetMap.put("单元",sourceMap.get("unit_name")); //填充单元
|
||||
targetMap.put("房号",sourceMap.get("house_number")); //填充房号
|
||||
targetMap.put("是否入账",sourceMap.get("recordBill")); //填充是否入账
|
||||
targetMap.put("联系方式",sourceMap.get("tenant_phone_number")); //填充租户联系方式
|
||||
targetMap.put("订单描述说明",sourceMap.get("recharge_desc")); //填充订单说明
|
||||
targetMap.put("OA付款单位","宜都市住保运营管理有限公司"); //填充OA付款单位,默认宜都市住保运营管理有限公司
|
||||
targetMap.put("OA收款单位","宜都市住保运营管理有限公司"); //填充OA收款单位,默认宜都市住保运营管理有限公司
|
||||
targetMap.put("住保-租户姓名-支付人",sourceMap.get("tenant_name"));//填充支付人
|
||||
targetMap.put("OA付款单位编号","DW00808"); //填充OA付款单位编号
|
||||
targetMap.put("OA付款银行","工行三峡宜都支行营业室(一般户)"); //填充OA付款银行
|
||||
targetMap.put("OA付款账号","1807072019200077435"); //填充OA付款账号
|
||||
targetMap.put("OA收款单位编号","DW00808"); //填充OA收款单位编号
|
||||
targetMap.put("OA收款银行","工行三峡宜都支行营业室(一般户)"); //填充OA收款银行
|
||||
targetMap.put("OA收款账号","1807072019200077435"); //填充OA收款账号
|
||||
targetMap.put("OA付款银行账户","宜都市住保运营管理有限公司"); //填充OA付款银行账户
|
||||
targetMap.put("OA收款银行账户","宜都市住保运营管理有限公司");//填充OA收款银行账户
|
||||
targetMap.put("租户",sourceMap.get("tenant_name"));//填充支付人
|
||||
|
||||
}
|
||||
|
||||
public MyJdbcAgent getAgent() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.seeyon.apps.src_ydctdatasync.datamap;
|
||||
|
||||
import com.seeyon.apps.src_ydctdatasync.dao.FormExportUtil;
|
||||
import com.seeyon.apps.src_ydctdatasync.constants.YdzbdataSyncConstants;
|
||||
import com.seeyon.apps.src_ydctdatasync.utils.EnumMapUtils;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
import com.seeyon.ctp.common.exceptions.BusinessException;
|
||||
@@ -10,11 +10,8 @@ import com.seeyon.ctp.organization.manager.OrgManager;
|
||||
import com.seeyon.v3x.services.form.FormFactory;
|
||||
import com.seeyon.v3x.services.form.bean.FormExport;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
@@ -23,7 +20,6 @@ import java.util.function.Function;
|
||||
public class BzfAssetMode extends AbstractAssetDataMapMode{
|
||||
|
||||
private FormFactory formFactory;
|
||||
private String formNo;
|
||||
public FormFactory getFormFactory() {
|
||||
if (formFactory == null) {
|
||||
formFactory = (FormFactory) AppContext.getBean("formFactory");
|
||||
@@ -31,42 +27,20 @@ public class BzfAssetMode extends AbstractAssetDataMapMode{
|
||||
return formFactory;
|
||||
}
|
||||
|
||||
public String getFormNo() {
|
||||
return formNo;
|
||||
}
|
||||
|
||||
public void setFormNo(String formNo) {
|
||||
this.formNo = formNo;
|
||||
}
|
||||
|
||||
public void setFormFactory(FormFactory formFactory) {
|
||||
this.formFactory = formFactory;
|
||||
}
|
||||
|
||||
private void enumMap(Map<String, Object> sourceMap) {
|
||||
// String xqzcpLevelValue = EnumMapUtils.getEnumItemValue(zcRootPcode, agent, "资产等级", "父级");
|
||||
String zcTypeFwValue = EnumMapUtils.getEnumItemValue(zcRootPcode, agent, "资产分类(资产系统)", "房屋");
|
||||
String zcTypeLevel2 = EnumMapUtils.getEnumItemValue(zcRootPcode, agent, "资产分类(资产系统)", "保障性住房");
|
||||
// String xqzcBlock = EnumMapUtils.getEnumItemValue(zcRootPcode, agent, "资产分类(资产系统)", "03不动产");
|
||||
// String xqzcStatus = EnumMapUtils.getEnumItemValue(zcRootPcode, agent, "资产状态", "待出租");
|
||||
// String xqzcFeature = EnumMapUtils.getEnumItemValue(zcRootPcode, agent, "资产性质", "非流动资产");
|
||||
// String xqzz = EnumMapUtils.getEnumItemValue(zcRootPcode, agent, "房屋用途", "住宅");
|
||||
// String xqrental_type = EnumMapUtils.getEnumItemValue(zcRootPcode, agent, "租售类型", "只租不售");
|
||||
// String xqhs = EnumMapUtils.getEnumItemValue(zcRootPcode, agent, "房屋体系", "保租房");
|
||||
String zcTypeFwValue = EnumMapUtils.getMasterTableEnumItemValue(formNo, "资产类型", "房屋");
|
||||
String zcTypeLevel2 = EnumMapUtils.getMasterTableEnumItemValue(formNo, "资产二级类型", "保障性住房");
|
||||
|
||||
String house_use = EnumMapUtils.getEnumItemValue(zcRootPcode, agent, "房屋用途", (String) sourceMap.get("house_use"));
|
||||
String rental_type = EnumMapUtils.getEnumItemValue(zcRootPcode, agent, "租售类型", (String) sourceMap.get("rental_type"));
|
||||
String hs = EnumMapUtils.getEnumItemValue(zcRootPcode, agent, "房屋体系", (String) sourceMap.get("house_system"));
|
||||
String house_type = EnumMapUtils.getEnumItemValue(zcRootPcode, agent, "户型", (String) sourceMap.get("house_type"));
|
||||
String has_lift = EnumMapUtils.getEnumItemValue(zcRootPcode, agent, "有无电梯", (String) sourceMap.get("has_lift"));
|
||||
String raise_way = EnumMapUtils.getEnumItemValue(zcRootPcode, agent, "筹集方式", (String) sourceMap.get("raise_way"));
|
||||
// sourceMap.put("xqzcpLevel", xqzcpLevelValue);
|
||||
// sourceMap.put("xqzcBlock", xqzcBlock);
|
||||
// sourceMap.put("xqzcStatus", xqzcStatus);
|
||||
// sourceMap.put("xqzcFeature", xqzcFeature);
|
||||
// sourceMap.put("xqrental_type", xqrental_type);
|
||||
// sourceMap.put("xqhs", xqhs);
|
||||
// sourceMap.put("xqzz", xqzz);
|
||||
String house_use = EnumMapUtils.getMasterTableEnumItemValue(formNo, "用途", (String) sourceMap.get("house_use"));
|
||||
String rental_type = EnumMapUtils.getMasterTableEnumItemValue(formNo, "租售类型", (String) sourceMap.get("rental_type"));
|
||||
String hs = EnumMapUtils.getMasterTableEnumItemValue(formNo, "房屋体系", (String) sourceMap.get("house_system"));
|
||||
String house_type = EnumMapUtils.getMasterTableEnumItemValue(formNo, "户型", (String) sourceMap.get("house_type"));
|
||||
String has_lift = EnumMapUtils.getMasterTableEnumItemValue(formNo, "有无电梯", (String) sourceMap.get("has_lift"));
|
||||
String raise_way = EnumMapUtils.getMasterTableEnumItemValue(formNo, "筹集方式", (String) sourceMap.get("raise_way"));
|
||||
sourceMap.put("zcTypeFwValue", zcTypeFwValue);
|
||||
sourceMap.put("zcTypeLevel2", zcTypeLevel2);
|
||||
sourceMap.put("house_use", house_use);
|
||||
@@ -78,50 +52,42 @@ public class BzfAssetMode extends AbstractAssetDataMapMode{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preProcess(Map<String, Object> sourceMap) {
|
||||
public void preProcess(Map<String, Object> sourceMap) throws SQLException {
|
||||
FormExport formExport = new FormExport();
|
||||
String loginName = sourceMap.get("loginName") + "";
|
||||
//查询客商档案以及填充
|
||||
//处理小区资产档案信息
|
||||
super.preProcess(sourceMap);
|
||||
enumMap(sourceMap);
|
||||
// try {
|
||||
// List<String> params = new ArrayList<>();
|
||||
// params.add(sourceMap.get("xqzcpLevel") + "");
|
||||
// params.add(sourceMap.get("zcTypeFwValue") + "");
|
||||
// params.add(sourceMap.get("village_name") + "");
|
||||
// String table = (String) sourceMap.get("zcTable");
|
||||
// String villageQuerySql = "SELECT 1 FROM "+ table +" WHERE field0027 = ? and field0023 = ? and field0037 =?;";
|
||||
// List<Map<String, Object>> resList = (List<Map<String, Object>>) agent.execute(villageQuerySql, params);
|
||||
// DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
// if(resList == null || resList.isEmpty()) {
|
||||
// //保障性住房小区的资产信息若不存在,则插入
|
||||
// Map<String,String> villageInsertInfo = new HashMap<>();
|
||||
// villageInsertInfo.put("建档部门",getCreatorDept(loginName));//建档部门
|
||||
// villageInsertInfo.put("建档人员","系统管理员");//建档人员
|
||||
// villageInsertInfo.put("建档日期",df.format(new Date()));//建档日期
|
||||
// villageInsertInfo.put("资产板块",sourceMap.get("xqzcBlock")+"");//资产板块
|
||||
// villageInsertInfo.put("建档单位","住保置业");//建档单位
|
||||
// villageInsertInfo.put("资产层级",sourceMap.get("xqzcpLevel")+"");//资产层级
|
||||
// villageInsertInfo.put("数据来源","住保资产系统(自定义)");//数据来源
|
||||
// villageInsertInfo.put("资产名称",sourceMap.get("village_name") + "");//资产名称
|
||||
// villageInsertInfo.put("资产状态",sourceMap.get("xqzcStatus") + "");//资产状态
|
||||
// villageInsertInfo.put("资产性质",sourceMap.get("xqzcFeature") + "");//资产性质
|
||||
// villageInsertInfo.put("资产类型",sourceMap.get("zcTypeFwValue") + "");//资产类型
|
||||
// villageInsertInfo.put("资产二级类型",sourceMap.get("zcTypeLevel2") + "");//资产二级类型
|
||||
// villageInsertInfo.put("资产种类","保障性住房");//资产种类
|
||||
// villageInsertInfo.put("所属小区",sourceMap.get("village_name") +"");//小区
|
||||
// villageInsertInfo.put("用途",sourceMap.get("xqzz") +"");//用途
|
||||
// villageInsertInfo.put("租售类型",sourceMap.get("xqrental_type") +"");//租售类型
|
||||
// villageInsertInfo.put("房屋体系",sourceMap.get("xqhs") +"");//房屋体系
|
||||
// villageInsertInfo.put("土地性质",sourceMap.get("land_nature") +"");//土地性质
|
||||
// villageInsertInfo.put("是否产权抵押",sourceMap.get("assetBacked") +""); //是否产权抵押
|
||||
// formExport.setValues(FormExportUtil.setFormValue(villageInsertInfo));
|
||||
// getFormFactory().importBusinessFormData(loginName, formNo ,formExport, new String[] {});
|
||||
// }
|
||||
// }catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillParentZcInfo(Map<String, Object> map) throws SQLException {
|
||||
String villageQuerySql = "SELECT * FROM " + ydctPluginConfigProvider.getBizConfigByKey(YdzbdataSyncConstants.zcTable) + " WHERE field0027 = ? and field0023 = ? and field0037 =?;";
|
||||
String villageName = (String) map.get("village_name");
|
||||
List<String> params = new ArrayList<>();
|
||||
params.add(EnumMapUtils.getMasterTableEnumItemValue(formNo, "资产层级", "父级"));
|
||||
params.add((String) map.get("zcTypeFwValue"));
|
||||
params.add(villageName);
|
||||
List<Map<String, Object>> list = (List<Map<String, Object>>) agent.execute(villageQuerySql, params);
|
||||
if (list == null || list.isEmpty()) {
|
||||
throw new RuntimeException("父级资产信息不存在");
|
||||
}
|
||||
Map<String, Object> objectMap = list.get(0);
|
||||
Object pZcName = objectMap.get("field0037"); //父级资产名称
|
||||
Object pZcNo = objectMap.get("field0031"); //父级资产编号
|
||||
Object pZcType = objectMap.get("field0023"); //父级资产类型
|
||||
Object pZcLevel2 = objectMap.get("field0024"); //父资产二级类型
|
||||
Object pZcFeature = objectMap.get("field0039"); //父级资产性质
|
||||
Object pZcRentalType = objectMap.get("field0053"); //父级租售类型
|
||||
Object pZcStatus = objectMap.get("field0038"); //父级资产状态
|
||||
map.put("父级资产名称",pZcName);
|
||||
map.put("父级资产编号",pZcNo);
|
||||
map.put("父级资产类型",pZcType);
|
||||
map.put("父级资产二级类型",pZcLevel2);
|
||||
map.put("父级资产性质",pZcFeature);
|
||||
map.put("父级租售类型",pZcRentalType);
|
||||
map.put("父级资产状态",pZcStatus);
|
||||
}
|
||||
|
||||
private String getCreatorDept(String loginName) {
|
||||
@@ -147,7 +113,7 @@ public class BzfAssetMode extends AbstractAssetDataMapMode{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transfer(Object target, Object source) {
|
||||
public void transfer(Object target, Object source) throws SQLException {
|
||||
commonAttrTransfer(target,source);
|
||||
Map<String, Object> targetMap = (Map<String, Object>) target;
|
||||
Map<String, Object> sourceMap = (Map<String, Object>) source;
|
||||
@@ -164,7 +130,7 @@ public class BzfAssetMode extends AbstractAssetDataMapMode{
|
||||
targetMap.put("租售类型",sourceMap.get("rental_type"));//填充租售类型
|
||||
targetMap.put("筹集方式",sourceMap.get("raise_way"));//填充筹集方式
|
||||
targetMap.put("土地性质",sourceMap.get("land_nature"));//填充土地性质
|
||||
|
||||
targetMap.put("资产种类","保障性住房");
|
||||
targetMap.put("房号",sourceMap.get("room_number"));//填充房号
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import com.seeyon.apps.src_ydctdatasync.utils.TimeUtils;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
@@ -15,27 +14,39 @@ public class ContractBillMode extends AbstractFeeDataMapMode{
|
||||
|
||||
@Override
|
||||
public void preProcess(Map<String, Object> map) {
|
||||
String recordBill = EnumMapUtils.getEnumItemValue(zcRootPcode,agent,"是否入账","未入");
|
||||
String incomeOrCost = EnumMapUtils.getEnumItemValue(zcRootPcode,agent,"收支类型","收");
|
||||
super.preProcess(map);
|
||||
String incomeOrCost = EnumMapUtils.getMasterTableEnumItemValue(formNo,"收支类型","收");
|
||||
String billType = (String) map.get("bill_type");
|
||||
String is_voucher = (String) map.get("is_voucher");
|
||||
if("宽带".equals(billType)) {
|
||||
map.put("bill_type","宽带费");
|
||||
} else if("宽带或物业费".equals(billType)) {
|
||||
}else if("宽带或物业费".equals(billType)) {
|
||||
map.put("bill_type","物业费");
|
||||
} else if("月租金".equals(billType)) {
|
||||
}else if("月租金".equals(billType)) {
|
||||
map.put("bill_type","租金");
|
||||
} else if("物业".equals(billType)) {
|
||||
}else if("物业".equals(billType)) {
|
||||
map.put("bill_type","物业费");
|
||||
} else if("水电余额".equals(billType)) {
|
||||
}else if("水电余额".equals(billType)) {
|
||||
map.put("bill_type","水电费");
|
||||
}else if("余额充值".equals(billType)) {
|
||||
map.put("bill_type","水电费");
|
||||
}else if("押金".equals(billType)) {
|
||||
map.put("bill_type","押金");
|
||||
}
|
||||
String feeType = EnumMapUtils.getEnumItemValue(zcRootPcode,agent,"住保-费用类型", map.get("bill_type") + "");
|
||||
String feeType = EnumMapUtils.getMasterTableEnumItemValue(formNo,"费用类型", map.get("bill_type") + "");
|
||||
if("".equals(feeType)) {
|
||||
feeType = EnumMapUtils.getEnumItemValue(zcRootPcode,agent,"住保-费用类型", "其他");
|
||||
feeType = EnumMapUtils.getMasterTableEnumItemValue(formNo,"费用类型", "其他");
|
||||
}
|
||||
map.put("recordBill",recordBill);
|
||||
map.put("bill_type",feeType);
|
||||
map.put("incomeOrCost",incomeOrCost);
|
||||
map.put("是否对公",EnumMapUtils.getMasterTableEnumItemValue(formNo,"是否对公", is_voucher));
|
||||
if(map.get("asset_type_name") != null ) {
|
||||
if(map.get("asset_type_name").equals("国资门面")) {
|
||||
map.put("小区","国有资产");
|
||||
}else if (map.get("asset_type_name").equals("国资土地")){
|
||||
map.put("小区","国有土地");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -54,17 +65,23 @@ public class ContractBillMode extends AbstractFeeDataMapMode{
|
||||
Map<String, Object> targetMap = (Map<String, Object>) target;
|
||||
Map<String, Object> sourceMap = (Map<String, Object>) source;
|
||||
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
targetMap.put("是否入账",sourceMap.get("recordBill")); //填充是否入账
|
||||
targetMap.put("收支类型",sourceMap.get("incomeOrCost")); //填充收支类型
|
||||
targetMap.put("住保-费用类型",sourceMap.get("bill_type")); //填充费用类型
|
||||
targetMap.put("住保-主键",sourceMap.get("bill_id")); //主键
|
||||
targetMap.put("应收金额",sourceMap.get("bill_amount")); //填充应收金额
|
||||
targetMap.put("本次实收金额",sourceMap.get("bill_amount")); //填充本次实收金额
|
||||
try {
|
||||
targetMap.put("住保-账单生成日期",df.format(TimeUtils.convertLocalDateTime2Date(sourceMap.get("trade_reconciliation_time")))); //填充账单生成日期
|
||||
}catch (NullPointerException e) {
|
||||
targetMap.put("费用类型",sourceMap.get("bill_type")); //填充费用类型
|
||||
targetMap.put("住保主键","cb_" + sourceMap.get("bill_id")); //主键
|
||||
targetMap.put("应收或退金额",sourceMap.get("bill_amount") == null ? "0" : sourceMap.get("bill_amount") + ""); //填充应收金额
|
||||
targetMap.put("实收或退金额",sourceMap.get("bill_amount") == null ? "0" : sourceMap.get("bill_amount") + ""); //填充本次实收金额
|
||||
|
||||
targetMap.put("是否对公",sourceMap.get("是否对公"));//是否对公支付付
|
||||
targetMap.put("住保支付订单状态","");
|
||||
try {
|
||||
targetMap.put("实收或退日期",TimeUtils.formatExcludeNull(TimeUtils.convertLocalDateTime2Date(sourceMap.get("trade_reconciliation_time")),df));
|
||||
targetMap.put("住保账单生成日期",TimeUtils.formatExcludeNull(TimeUtils.convertLocalDateTime2Date(sourceMap.get("trade_reconciliation_time")),df)); //填充账单生成日期
|
||||
targetMap.put("到账日期",TimeUtils.formatExcludeNull(TimeUtils.convertLocalDateTime2Date(sourceMap.get("trade_reconciliation_time")),df)); //填充到账日期
|
||||
targetMap.put("经办日期",TimeUtils.formatExcludeNull(TimeUtils.convertLocalDateTime2Date(sourceMap.get("trade_reconciliation_time")),df)); //填充账经办日期
|
||||
}catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
postProcess(targetMap);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,13 +1,21 @@
|
||||
package com.seeyon.apps.src_ydctdatasync.datamap;
|
||||
|
||||
import com.seeyon.apps.src_ydctdatasync.constants.YdzbdataSyncConstants;
|
||||
import com.seeyon.apps.src_ydctdatasync.dao.KsQueryDao;
|
||||
import com.seeyon.apps.src_ydctdatasync.utils.EnumMapUtils;
|
||||
import com.seeyon.apps.src_ydctdatasync.utils.DeptGetUtils;
|
||||
import com.seeyon.apps.src_ydctdatasync.utils.FormColumn;
|
||||
import com.seeyon.apps.src_ydctdatasync.utils.FormDataOperator;
|
||||
import com.seeyon.apps.src_ydctdatasync.utils.FormFieldVo;
|
||||
import com.seeyon.apps.src_ydctdatasync.utils.FormWhereCondition;
|
||||
import com.seeyon.apps.src_ydctdatasync.utils.TimeUtils;
|
||||
import com.seeyon.ctp.common.exceptions.BusinessException;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
@@ -15,22 +23,21 @@ public class ContractMode extends AbstractContractDataMapMode {
|
||||
|
||||
@Override
|
||||
public void preProcess(Map<String, Object> map) {
|
||||
String zcType = EnumMapUtils.getEnumItemValue(zcRootPcode,agent,"资产类型","房屋");
|
||||
String zcBlock = EnumMapUtils.getEnumItemValue(zcRootPcode,agent,"资产分类(资产系统)","03不动产");
|
||||
// String zcType = EnumMapUtils.getEnumItemValue(zcRootPcode,agent,"资产类型","房屋");
|
||||
// String zcBlock = EnumMapUtils.getEnumItemValue(zcRootPcode,agent,"资产分类(资产系统)","03不动产");
|
||||
// String contractStatus = EnumMapUtils.getEnumItemValue(zcRootPcode,agent,"合同状态", map.get("contract_state") +"");
|
||||
// String zcTypeLevel2 = (String) map.get("asset_type_name");
|
||||
// if(zcTypeLevel2.equals("保障房")){
|
||||
// map.put("asset_type_name","保障性住房");
|
||||
// }else if(zcTypeLevel2.equals("国资门面")) {
|
||||
// map.put("asset_type_name","住宅");
|
||||
// }else {
|
||||
// map.put("asset_type_name","厂房");
|
||||
// }
|
||||
// map.put("zcType",zcType);
|
||||
// map.put("zcBlock",zcBlock);
|
||||
// map.put("asset_type_name",EnumMapUtils.getEnumItemValue(zcRootPcode,agent,"资产分类(资产系统)", map.get("asset_type_name") +""));
|
||||
String ksName = (String) map.get("b_name");
|
||||
String zcTypeLevel2 = (String) map.get("asset_type_name");
|
||||
if(zcTypeLevel2.equals("保障房")){
|
||||
map.put("asset_type_name","保障性住房");
|
||||
}else if(zcTypeLevel2.equals("国资门面")) {
|
||||
map.put("asset_type_name","住宅");
|
||||
}else {
|
||||
map.put("asset_type_name","厂房");
|
||||
}
|
||||
map.put("zcType",zcType);
|
||||
map.put("zcBlock",zcBlock);
|
||||
// map.put("contract_state",contractStatus);
|
||||
map.put("asset_type_name",EnumMapUtils.getEnumItemValue(zcRootPcode,agent,"资产分类(资产系统)", map.get("asset_type_name") +""));
|
||||
KsQueryDao ksQueryDao = new KsQueryDao();
|
||||
try {
|
||||
Map<String, Object> ksMap = ksQueryDao.queryByName(ksName, " where field0006 = ?", ksTableName,agent);
|
||||
@@ -39,7 +46,51 @@ public class ContractMode extends AbstractContractDataMapMode {
|
||||
ksMap.put("signCorpNo",map.get("field0029"));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error(e);
|
||||
}
|
||||
fillZcInfo(map);
|
||||
}
|
||||
|
||||
private void fillZcInfo(Map<String, Object> map) {
|
||||
FormDataOperator formDataOperator = new FormDataOperator();
|
||||
String formNo = getYdctPluginConfigProvider().getBizConfigByKey(YdzbdataSyncConstants.zcFormNo);
|
||||
List<FormWhereCondition> conditions = new ArrayList<>();
|
||||
conditions.add(FormWhereCondition.build().display("住保系统编码").value(map.get("house_id")));
|
||||
List<String> queryColumns = Arrays.asList("资产名称","资产板块","资产类型","资产二级类型","所属小区","楼栋","单元","房号","住保资产编号");
|
||||
try {
|
||||
List<FormColumn> formColumns = formDataOperator.queryFormDataCondition(formNo, queryColumns, conditions);
|
||||
if(formColumns != null) {
|
||||
FormColumn formColumn = formColumns.get(0);
|
||||
for (FormFieldVo vo : formColumn.getVos()) {
|
||||
map.put(vo.getDisplayName(),vo.getValue());
|
||||
if(vo.getDisplayName().equals("住保资产编号")) {
|
||||
map.put("OA资产编号",vo.getValue());
|
||||
}
|
||||
if(vo.getDisplayName().equals("资产板块")) {
|
||||
map.put("不动产板块",vo.getValue());
|
||||
}
|
||||
if(vo.getDisplayName().equals("资产二级类型")) {
|
||||
map.put("资产二级类型",vo.getValue());
|
||||
}
|
||||
if(vo.getDisplayName().equals("资产名称")) {
|
||||
map.put("资产名称",vo.getValue());
|
||||
}
|
||||
if(vo.getDisplayName().equals("所属小区")) {
|
||||
map.put("小区",vo.getValue());
|
||||
}
|
||||
if(vo.getDisplayName().equals("楼栋")) {
|
||||
map.put("楼栋",vo.getValue());
|
||||
}
|
||||
if(vo.getDisplayName().equals("单元")) {
|
||||
map.put("单元",vo.getValue());
|
||||
}
|
||||
if(vo.getDisplayName().equals("房号")) {
|
||||
map.put("房号",vo.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (BusinessException e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,14 +114,18 @@ public class ContractMode extends AbstractContractDataMapMode {
|
||||
targetMap.put("subTable",subTableMap);
|
||||
targetMap.put("住保-主键",sourceMap.get("contract_id")); //填充合同ID
|
||||
targetMap.put("合同编号",sourceMap.get("contract_no")); //填充合同编号
|
||||
targetMap.put("签订单位编号",sourceMap.get("signCorpNo")); //填充签订单位编号
|
||||
targetMap.put("签订单位",sourceMap.get("a_name"));//填充签订单位
|
||||
targetMap.put("合同金额",sourceMap.get("contract_total_amount"));//合同金额
|
||||
try {
|
||||
targetMap.put("合同开始日期",df.format(TimeUtils.convertLocalDateTime2Date(sourceMap.get("tenant_start_time"))));//合同开始日期
|
||||
targetMap.put("合同截止日期",df.format(TimeUtils.convertLocalDateTime2Date(sourceMap.get("tenant_end_time"))));//合同截止日期
|
||||
}catch (NullPointerException e) {
|
||||
targetMap.put("经办部门",-3718203145642815745L); //经办部门
|
||||
targetMap.put("经办人员",-6990529418051370812L); //经办人员
|
||||
targetMap.put("经办单位", DeptGetUtils.getDeptIdByName("宜都市住保运营管理有限公司"));
|
||||
targetMap.put("签订单位编号","DW00808");//填充签订单位编号
|
||||
|
||||
try {
|
||||
targetMap.put("合同开始日期",TimeUtils.formatExcludeNull(TimeUtils.convertLocalDateTime2Date(sourceMap.get("tenant_start_time")),df));//合同开始日期
|
||||
targetMap.put("合同截止日期",TimeUtils.formatExcludeNull(TimeUtils.convertLocalDateTime2Date(sourceMap.get("tenant_end_time")),df));//合同截止日期
|
||||
}catch (NullPointerException e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
targetMap.put("U8C客商编号",sourceMap.get("u8ccode"));//U8C客商编号
|
||||
targetMap.put("客商名称",sourceMap.get("b_name"));//客商名称
|
||||
@@ -82,9 +137,9 @@ public class ContractMode extends AbstractContractDataMapMode {
|
||||
targetMap.put("剩余未收租金",sourceMap.get("contract_remaining_amount"));//剩余未收租金
|
||||
|
||||
//填充子表
|
||||
subTableMap.put("不动产板块",sourceMap.get("zcBlock"));//资产板块
|
||||
subTableMap.put("资产类型",sourceMap.get("zcType"));//资产类型
|
||||
subTableMap.put("资产二级类型",sourceMap.get("asset_type_name"));//资产二级类型
|
||||
subTableMap.put("不动产板块",sourceMap.get("不动产板块"));//资产板块
|
||||
subTableMap.put("资产类型",sourceMap.get("资产类型"));//资产类型
|
||||
subTableMap.put("资产二级类型",sourceMap.get("资产二级类型"));//资产二级类型
|
||||
subTableMap.put("所属小区",sourceMap.get("village_name")); //填充小区名
|
||||
subTableMap.put("楼栋",sourceMap.get("building_name")); //填充楼栋
|
||||
subTableMap.put("单元",sourceMap.get("unit_name")); //填充单元
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
package com.seeyon.apps.src_ydctdatasync.datamap;
|
||||
|
||||
import com.seeyon.apps.src_ydctdatasync.constants.YdzbdataSyncConstants;
|
||||
import com.seeyon.apps.src_ydctdatasync.utils.EnumMapUtils;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
@@ -9,18 +13,47 @@ public class GzcfAssetMode extends AbstractAssetDataMapMode{
|
||||
|
||||
|
||||
@Override
|
||||
public void preProcess(Map<String, Object> map) {
|
||||
public void preProcess(Map<String, Object> map) throws SQLException {
|
||||
super.preProcess(map);
|
||||
String has_lift = EnumMapUtils.getEnumItemValue(zcRootPcode,agent,"有无电梯", map.get("has_lift") + "");
|
||||
String zcTypeFwValue = EnumMapUtils.getEnumItemValue(zcRootPcode,agent,"资产类型","房屋");
|
||||
String zcTypeLevel2 = EnumMapUtils.getEnumItemValue(zcRootPcode,agent,"资产分类(资产系统)","厂房");
|
||||
String house_use = EnumMapUtils.getEnumItemValue(zcRootPcode,agent,"房屋用途", map.get("house_use") + "");
|
||||
String has_lift = EnumMapUtils.getMasterTableEnumItemValue(formNo,"有无电梯", map.get("has_lift") + "");
|
||||
String zcTypeFwValue = EnumMapUtils.getMasterTableEnumItemValue(formNo,"资产类型","房屋");
|
||||
String zcTypeLevel2 = EnumMapUtils.getMasterTableEnumItemValue(formNo,"资产二级类型","厂房");
|
||||
String house_use = EnumMapUtils.getMasterTableEnumItemValue(formNo,"用途", map.get("house_use") + "");
|
||||
map.put("zcTypeFwValue",zcTypeFwValue);
|
||||
map.put("zcTypeLevel2",zcTypeLevel2);
|
||||
map.put("has_lift",has_lift);
|
||||
map.put("house_use",house_use);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillParentZcInfo(Map<String, Object> map) throws SQLException {
|
||||
String villageQuerySql = "SELECT * FROM " + ydctPluginConfigProvider.getBizConfigByKey(YdzbdataSyncConstants.zcTable) + " WHERE field0027 = ? and field0023 = ? and field0037 =?;";
|
||||
String villageName = "国有资产厂房";
|
||||
List<String> params = new ArrayList<>();
|
||||
params.add(EnumMapUtils.getMasterTableEnumItemValue(formNo, "资产层级", "父级"));
|
||||
params.add((String) map.get("zcTypeFwValue"));
|
||||
params.add(villageName);
|
||||
List<Map<String, Object>> list = (List<Map<String, Object>>) agent.execute(villageQuerySql, params);
|
||||
if (list == null || list.isEmpty()) {
|
||||
throw new RuntimeException("父级资产信息不存在");
|
||||
}
|
||||
Map<String, Object> objectMap = list.get(0);
|
||||
Object pZcName = objectMap.get("field0037"); //父级资产名称
|
||||
Object pZcNo = objectMap.get("field0031"); //父级资产编号
|
||||
Object pZcType = objectMap.get("field0023"); //父级资产类型
|
||||
Object pZcLevel2 = objectMap.get("field0024"); //父资产二级类型
|
||||
Object pZcFeature = objectMap.get("field0039"); //父级资产性质
|
||||
Object pZcRentalType = objectMap.get("field0053"); //父级租售类型
|
||||
Object pZcStatus = objectMap.get("field0038"); //父级资产状态
|
||||
map.put("父级资产名称",pZcName);
|
||||
map.put("父级资产编号",pZcNo);
|
||||
map.put("父级资产类型",pZcType);
|
||||
map.put("父级资产二级类型",pZcLevel2);
|
||||
map.put("父级资产性质",pZcFeature);
|
||||
map.put("父级租售类型",pZcRentalType);
|
||||
map.put("父级资产状态",pZcStatus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Function<Object, Object>> getFieldProcessors() {
|
||||
return null;
|
||||
@@ -32,7 +65,7 @@ public class GzcfAssetMode extends AbstractAssetDataMapMode{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transfer(Object target, Object source) {
|
||||
public void transfer(Object target, Object source) throws SQLException {
|
||||
commonAttrTransfer(target,source);
|
||||
Map<String, Object> targetMap = (Map<String, Object>) target;
|
||||
Map<String, Object> sourceMap = (Map<String, Object>) source;
|
||||
|
||||
@@ -1,27 +1,60 @@
|
||||
package com.seeyon.apps.src_ydctdatasync.datamap;
|
||||
|
||||
|
||||
import com.seeyon.apps.src_ydctdatasync.constants.YdzbdataSyncConstants;
|
||||
import com.seeyon.apps.src_ydctdatasync.utils.EnumMapUtils;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class GzfwAssetMode extends AbstractAssetDataMapMode{
|
||||
|
||||
@Override
|
||||
public void preProcess(Map<String, Object> map) {
|
||||
public void preProcess(Map<String, Object> map) throws SQLException {
|
||||
super.preProcess(map);
|
||||
String zcTypeFwValue = EnumMapUtils.getEnumItemValue(zcRootPcode,agent,"资产类型","房屋");
|
||||
String zcTypeLevel2 = EnumMapUtils.getEnumItemValue(zcRootPcode,agent,"资产分类(资产系统)","住宅");
|
||||
String has_lift = EnumMapUtils.getEnumItemValue(zcRootPcode,agent,"有无电梯", map.get("has_lift") + "");
|
||||
String house_use = EnumMapUtils.getEnumItemValue(zcRootPcode,agent,"房屋用途", map.get("house_use") + "");
|
||||
String zcTypeFwValue = EnumMapUtils.getMasterTableEnumItemValue(formNo,"资产类型","房屋");
|
||||
String zcTypeLevel2 = EnumMapUtils.getMasterTableEnumItemValue(formNo,"资产二级类型","住宅");
|
||||
String has_lift = EnumMapUtils.getMasterTableEnumItemValue(formNo,"有无电梯", map.get("has_lift") + "");
|
||||
String house_use = EnumMapUtils.getMasterTableEnumItemValue(formNo,"用途", map.get("house_use") + "");
|
||||
map.put("zcTypeFwValue",zcTypeFwValue);
|
||||
map.put("zcTypeLevel2",zcTypeLevel2);
|
||||
map.put("has_lift",has_lift);
|
||||
map.put("house_use",house_use);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillParentZcInfo(Map<String, Object> map) throws SQLException {
|
||||
String villageQuerySql = "SELECT * FROM " + ydctPluginConfigProvider.getBizConfigByKey(YdzbdataSyncConstants.zcTable) + " WHERE field0027 = ? and field0023 = ? and field0037 =?;";
|
||||
String villageName = "国有资产房屋";
|
||||
List<String> params = new ArrayList<>();
|
||||
params.add(EnumMapUtils.getMasterTableEnumItemValue(formNo, "资产层级", "父级"));
|
||||
params.add((String) map.get("zcTypeFwValue"));
|
||||
params.add(villageName);
|
||||
List<Map<String, Object>> list = (List<Map<String, Object>>) agent.execute(villageQuerySql, params);
|
||||
if (list == null || list.isEmpty()) {
|
||||
throw new RuntimeException("父级资产信息不存在");
|
||||
}
|
||||
Map<String, Object> objectMap = list.get(0);
|
||||
Object pZcName = objectMap.get("field0037"); //父级资产名称
|
||||
Object pZcNo = objectMap.get("field0031"); //父级资产编号
|
||||
Object pZcType = objectMap.get("field0023"); //父级资产类型
|
||||
Object pZcLevel2 = objectMap.get("field0024"); //父资产二级类型
|
||||
Object pZcFeature = objectMap.get("field0039"); //父级资产性质
|
||||
Object pZcRentalType = objectMap.get("field0053"); //父级租售类型
|
||||
Object pZcStatus = objectMap.get("field0038"); //父级资产状态
|
||||
map.put("父级资产名称",pZcName);
|
||||
map.put("父级资产编号",pZcNo);
|
||||
map.put("父级资产类型",pZcType);
|
||||
map.put("父级资产二级类型",pZcLevel2);
|
||||
map.put("父级资产性质",pZcFeature);
|
||||
map.put("父级租售类型",pZcRentalType);
|
||||
map.put("父级资产状态",pZcStatus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Function<Object, Object>> getFieldProcessors() {
|
||||
return Collections.emptyMap();
|
||||
@@ -33,7 +66,7 @@ public class GzfwAssetMode extends AbstractAssetDataMapMode{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transfer(Object target, Object source) {
|
||||
public void transfer(Object target, Object source) throws SQLException {
|
||||
commonAttrTransfer(target,source);
|
||||
Map<String, Object> targetMap = (Map<String, Object>) target;
|
||||
Map<String, Object> sourceMap = (Map<String, Object>) source;
|
||||
|
||||
@@ -1,22 +1,56 @@
|
||||
package com.seeyon.apps.src_ydctdatasync.datamap;
|
||||
|
||||
import com.seeyon.apps.src_ydctdatasync.constants.YdzbdataSyncConstants;
|
||||
import com.seeyon.apps.src_ydctdatasync.utils.EnumMapUtils;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class GztdAssetMode extends AbstractAssetDataMapMode{
|
||||
|
||||
@Override
|
||||
public void preProcess(Map<String, Object> map) {
|
||||
public void preProcess(Map<String, Object> map) throws SQLException {
|
||||
super.preProcess(map);
|
||||
String zcTypeFwValue = EnumMapUtils.getEnumItemValue(zcRootPcode,agent,"资产类型","土地");
|
||||
String zcTypeLevel2 = EnumMapUtils.getEnumItemValue(zcRootPcode,agent,"资产分类(资产系统)","自用出让地");
|
||||
String zcTypeFwValue = EnumMapUtils.getMasterTableEnumItemValue(formNo,"资产类型","土地");
|
||||
String zcTypeLevel2 = EnumMapUtils.getMasterTableEnumItemValue(formNo,"资产二级类型","自用出让地");
|
||||
map.put("zcTypeFwValue",zcTypeFwValue);
|
||||
map.put("zcTypeLevel2",zcTypeLevel2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillParentZcInfo(Map<String, Object> map) throws SQLException {
|
||||
String villageQuerySql = "SELECT * FROM " + ydctPluginConfigProvider.getBizConfigByKey(YdzbdataSyncConstants.zcTable) + " WHERE field0027 = ? and field0023 = ? and field0037 =?;";
|
||||
String villageName = "国有资产土地";
|
||||
List<String> params = new ArrayList<>();
|
||||
params.add(EnumMapUtils.getMasterTableEnumItemValue(formNo, "资产层级", "父级"));
|
||||
params.add((String) map.get("zcTypeFwValue"));
|
||||
params.add(villageName);
|
||||
List<Map<String, Object>> list = (List<Map<String, Object>>) agent.execute(villageQuerySql, params);
|
||||
if (list == null || list.isEmpty()) {
|
||||
throw new RuntimeException("父级资产信息不存在");
|
||||
}
|
||||
Map<String, Object> objectMap = list.get(0);
|
||||
Object pZcName = objectMap.get("field0037"); //父级资产名称
|
||||
Object pZcNo = objectMap.get("field0031"); //父级资产编号
|
||||
Object pZcType = objectMap.get("field0023"); //父级资产类型
|
||||
Object pZcLevel2 = objectMap.get("field0024"); //父资产二级类型
|
||||
Object pZcFeature = objectMap.get("field0039"); //父级资产性质
|
||||
Object pZcRentalType = objectMap.get("field0053"); //父级租售类型
|
||||
Object pZcStatus = objectMap.get("field0038"); //父级资产状态
|
||||
map.put("父级资产名称",pZcName);
|
||||
map.put("父级资产编号",pZcNo);
|
||||
map.put("父级资产类型",pZcType);
|
||||
map.put("父级资产二级类型",pZcLevel2);
|
||||
map.put("父级资产性质",pZcFeature);
|
||||
map.put("父级租售类型",pZcRentalType);
|
||||
map.put("父级资产状态",pZcStatus);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Function<Object, Object>> getFieldProcessors() {
|
||||
return Collections.emptyMap();
|
||||
@@ -28,7 +62,7 @@ public class GztdAssetMode extends AbstractAssetDataMapMode{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transfer(Object target, Object source) {
|
||||
public void transfer(Object target, Object source) throws SQLException {
|
||||
commonAttrTransfer(target,source);
|
||||
Map<String, Object> targetMap = (Map<String, Object>) target;
|
||||
Map<String, Object> sourceMap = (Map<String, Object>) source;
|
||||
|
||||
@@ -6,7 +6,6 @@ import com.seeyon.apps.src_ydctdatasync.utils.TimeUtils;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
@@ -15,10 +14,11 @@ public class HydropowerRechargeDataMapMode extends AbstractFeeDataMapMode{
|
||||
@Override
|
||||
public void preProcess(Map<String, Object> map) {
|
||||
super.preProcess(map);
|
||||
String incomeOrCost = EnumMapUtils.getEnumItemValue(zcRootPcode,agent,"收支类型","收");
|
||||
String feeType = EnumMapUtils.getEnumItemValue(zcRootPcode,agent,"住保-费用类型", (String) map.get("水电费"));
|
||||
String incomeOrCost = EnumMapUtils.getMasterTableEnumItemValue(formNo,"收支类型","收");
|
||||
String feeType = EnumMapUtils.getMasterTableEnumItemValue(formNo,"费用类型", "水电费");
|
||||
map.put("incomeOrCost",incomeOrCost);
|
||||
map.put("feeType",feeType);
|
||||
map.put("是否对公",EnumMapUtils.getMasterTableEnumItemValue(formNo,"是否对公", "否"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -37,19 +37,25 @@ public class HydropowerRechargeDataMapMode extends AbstractFeeDataMapMode{
|
||||
Map<String, Object> targetMap = (Map<String, Object>) target;
|
||||
Map<String, Object> sourceMap = (Map<String, Object>) source;
|
||||
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
targetMap.put("住保主键","hr_" + sourceMap.get("recharge_id")); //主键
|
||||
targetMap.put("收支类型",sourceMap.get("incomeOrCost")); //填充收支类型
|
||||
|
||||
targetMap.put("费用类型",sourceMap.get("feeType")); //填充费用类型
|
||||
|
||||
targetMap.put("应收或退金额",sourceMap.get("recharge_amount") == null ? "0" : sourceMap.get("recharge_amount") + ""); //填充应收金额
|
||||
targetMap.put("实收或退金额",sourceMap.get("recharge_amount") == null ? "0" : sourceMap.get("recharge_amount") + ""); //填充本次实收金额
|
||||
|
||||
targetMap.put("是否对公",sourceMap.get("是否对公"));//是否对公支付
|
||||
|
||||
try {
|
||||
targetMap.put("到账日期",df.format(TimeUtils.convertLocalDateTime2Date(sourceMap.get("recharge_time")))); //填充到账日期
|
||||
targetMap.put("住保-账单生成日期",df.format(TimeUtils.convertLocalDateTime2Date(sourceMap.get("recharge_time")))); //填充账单生成日期
|
||||
targetMap.put("实收日期",df.format(TimeUtils.convertLocalDateTime2Date(sourceMap.get("recharge_time")))); //填充实收日期
|
||||
}catch (NullPointerException e) {
|
||||
|
||||
targetMap.put("实收或退日期",TimeUtils.formatExcludeNull(TimeUtils.convertLocalDateTime2Date(sourceMap.get("recharge_time")),df));
|
||||
targetMap.put("住保账单生成日期",TimeUtils.formatExcludeNull(TimeUtils.convertLocalDateTime2Date(sourceMap.get("recharge_time")),df)); //填充账单生成日期
|
||||
targetMap.put("到账日期",TimeUtils.formatExcludeNull(TimeUtils.convertLocalDateTime2Date(sourceMap.get("recharge_time")),df)); //填充到账日期
|
||||
targetMap.put("经办日期",TimeUtils.formatExcludeNull(TimeUtils.convertLocalDateTime2Date(sourceMap.get("recharge_time")),df)); //填充账经办日期
|
||||
}catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
targetMap.put("住保-主键",sourceMap.get("recharge_id")); //主键
|
||||
targetMap.put("住保-费用类型",sourceMap.get("feeType")); //填充费用类型
|
||||
targetMap.put("住保-支付订单状态",sourceMap.get("recharge_status")); //填充订单状态
|
||||
|
||||
postProcess(targetMap);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,10 +3,8 @@ package com.seeyon.apps.src_ydctdatasync.datamap;
|
||||
import com.seeyon.apps.src_ydctdatasync.utils.EnumMapUtils;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
@@ -15,8 +13,9 @@ public class RefundDataMapMode extends AbstractFeeDataMapMode{
|
||||
@Override
|
||||
public void preProcess(Map<String, Object> map) {
|
||||
super.preProcess(map);
|
||||
String incomeOrCost = EnumMapUtils.getEnumItemValue(zcRootPcode,agent,"收支类型","支");
|
||||
String incomeOrCost = EnumMapUtils.getMasterTableEnumItemValue(formNo,"收支类型","支");
|
||||
String refundType = (String) map.get("refund_type");
|
||||
String is_voucher = (String) map.get("is_voucher");
|
||||
if("宽带".equals(refundType)) {
|
||||
map.put("refund_type","宽带费");
|
||||
}else if("宽带或物业费".equals(refundType)) {
|
||||
@@ -27,13 +26,25 @@ public class RefundDataMapMode extends AbstractFeeDataMapMode{
|
||||
map.put("refund_type","物业费");
|
||||
}else if("水电余额".equals(refundType)) {
|
||||
map.put("refund_type","水电费");
|
||||
}else if("余额充值".equals(refundType)) {
|
||||
map.put("refund_type","水电费");
|
||||
}else if("押金".equals(refundType)) {
|
||||
map.put("refund_type","押金");
|
||||
}
|
||||
String feeType = EnumMapUtils.getEnumItemValue(zcRootPcode,agent,"住保-费用类型", (String) map.get("refund_type"));
|
||||
String feeType = EnumMapUtils.getMasterTableEnumItemValue(formNo,"费用类型", (String) map.get("refund_type"));
|
||||
if("".equals(feeType)) {
|
||||
feeType = EnumMapUtils.getEnumItemValue(zcRootPcode,agent,"住保-费用类型", "其他");
|
||||
feeType = EnumMapUtils.getMasterTableEnumItemValue(formNo,"费用类型", "其他");
|
||||
}
|
||||
map.put("incomeOrCost",incomeOrCost);
|
||||
map.put("refund_type",feeType);
|
||||
map.put("是否对公",EnumMapUtils.getMasterTableEnumItemValue(formNo,"是否对公", is_voucher));
|
||||
if(map.get("asset_type_name") != null ) {
|
||||
if(map.get("asset_type_name").equals("国资门面")) {
|
||||
map.put("小区","国有资产");
|
||||
}else if (map.get("asset_type_name").equals("国资土地")){
|
||||
map.put("小区","国有土地");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -52,13 +63,22 @@ public class RefundDataMapMode extends AbstractFeeDataMapMode{
|
||||
Map<String, Object> targetMap = (Map<String, Object>) target;
|
||||
Map<String, Object> sourceMap = (Map<String, Object>) source;
|
||||
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
targetMap.put("收支类型",sourceMap.get("incomeOrCost")); //填充收支类型
|
||||
targetMap.put("住保-费用类型",sourceMap.get("refund_type")); //填充费用类型
|
||||
targetMap.put("住保-支付订单状态",sourceMap.get("refund_status")); //填充订单状态
|
||||
targetMap.put("订单描述说明",sourceMap.get("recharge_desc")); //填充订单说明
|
||||
targetMap.put("本次实付金额",sourceMap.get("refund_amount")); //填充本次实付金额
|
||||
targetMap.put("住保-主键",sourceMap.get("refund_id")); //主键
|
||||
targetMap.put("住保-退还账单时间",sourceMap.get("refund_bill_time")); //填充退还账单时间
|
||||
targetMap.put("实付日期",sourceMap.get("refund_time")); //填充实付日期
|
||||
targetMap.put("费用类型",sourceMap.get("refund_type")); //填充费用类型
|
||||
targetMap.put("订单描述说明",sourceMap.get("refund_desc")); //填充订单说明
|
||||
targetMap.put("住保主键","rd_" + sourceMap.get("refund_id")); //主键
|
||||
targetMap.put("收支类型",sourceMap.get("incomeOrCost"));
|
||||
targetMap.put("应收或退金额",sourceMap.get("refund_amount") == null ? "0" : sourceMap.get("re,..fund_amount") + "");
|
||||
targetMap.put("实收或退金额",sourceMap.get("refund_amount") == null ? "0" : sourceMap.get("refund_amount") + "");
|
||||
targetMap.put("是否对公",sourceMap.get("是否对公"));//是否对公支付付
|
||||
try {
|
||||
targetMap.put("住保退还账单时间",sourceMap.get("refund_bill_time")); //填充退还账单时间
|
||||
targetMap.put("实收或退日期",sourceMap.get("refund_time"));
|
||||
targetMap.put("住保账单生成日期",sourceMap.get("refund_time")); //填充账单生成日期
|
||||
targetMap.put("到账日期",sourceMap.get("refund_time")); //填充到账日期
|
||||
targetMap.put("经办日期",sourceMap.get("refund_time")); //填充账经办日期
|
||||
}catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
postProcess(targetMap);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package com.seeyon.apps.src_ydctdatasync.quartz;
|
||||
|
||||
import cn.hutool.log.Log;
|
||||
import com.seeyon.apps.common.config.ICstConfigApi;
|
||||
import com.seeyon.apps.common.plugin.vo.ConfigVo;
|
||||
import com.seeyon.apps.ext.quartz.AbstractQuartzTask;
|
||||
import com.seeyon.apps.src_ydctdatasync.config.YdctPluginConfigProvider;
|
||||
import com.seeyon.apps.src_ydctdatasync.constants.YdzbdataSyncConstants;
|
||||
import com.seeyon.apps.src_ydctdatasync.dao.FormExportUtil;
|
||||
import com.seeyon.apps.src_ydctdatasync.dao.MyJdbcAgent;
|
||||
@@ -16,20 +15,21 @@ import com.seeyon.apps.src_ydctdatasync.datamap.GztdAssetMode;
|
||||
import com.seeyon.apps.src_ydctdatasync.datamap.HydropowerRechargeDataMapMode;
|
||||
import com.seeyon.apps.src_ydctdatasync.datamap.RefundDataMapMode;
|
||||
import com.seeyon.apps.src_ydctdatasync.datasource.DataSource;
|
||||
import com.seeyon.apps.src_ydctdatasync.utils.ClauseFactor;
|
||||
import com.seeyon.apps.src_ydctdatasync.utils.EnumMapUtils;
|
||||
import com.seeyon.apps.src_ydctdatasync.utils.FormColumn;
|
||||
import com.seeyon.apps.src_ydctdatasync.utils.FormDataOperator;
|
||||
import com.seeyon.apps.src_ydctdatasync.utils.FormUpdateField;
|
||||
import com.seeyon.apps.src_ydctdatasync.utils.FormWhereCondition;
|
||||
import com.seeyon.apps.src_ydctdatasync.utils.StatementQueryUtil;
|
||||
import com.seeyon.apps.src_ydctdatasync.utils.TimeUtils;
|
||||
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.organization.bo.V3xOrgDepartment;
|
||||
import com.seeyon.ctp.organization.bo.V3xOrgMember;
|
||||
import com.seeyon.ctp.organization.manager.OrgManager;
|
||||
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 org.springframework.beans.factory.DisposableBean;
|
||||
@@ -40,34 +40,27 @@ import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
import static com.seeyon.apps.src_ydctdatasync.constants.YdzbdataSyncConstants.getPluginId;
|
||||
import java.util.UUID;
|
||||
;
|
||||
|
||||
public class YdzbDataSyncQuartz extends AbstractQuartzTask implements DisposableBean {
|
||||
|
||||
private static Log log = Log.get(YdzbDataSyncQuartz.class);
|
||||
protected ICstConfigApi cstConfigApi = (ICstConfigApi) AppContext.getBean("cstConfigApi");
|
||||
private FormFactory formFactory;
|
||||
private DataSource ydzbThirdDataSource = (DataSource) AppContext.getBean("ydzbThirdDataSource");
|
||||
private DataSource myCusDataSource = new DataSource((javax.sql.DataSource)AppContext.getBean("dataSource"));
|
||||
private DataSource myCusDataSource = new DataSource((javax.sql.DataSource) AppContext.getBean("dataSource"));
|
||||
private YdctPluginConfigProvider ydctPluginConfigProvider = (YdctPluginConfigProvider) AppContext.getBean("ydctPluginConfigProvider");
|
||||
private MyJdbcAgent agent = new MyJdbcAgent(myCusDataSource);
|
||||
private boolean prod;
|
||||
private FormApi4Cap4 formApi4Cap4 = null;
|
||||
public boolean isProd() {
|
||||
return prod;
|
||||
}
|
||||
|
||||
public void setProd(boolean prod) {
|
||||
this.prod = prod;
|
||||
}
|
||||
public FormApi4Cap4 getFormApi4Cap4() {
|
||||
if (this.formApi4Cap4 == null) {
|
||||
this.formApi4Cap4 = (FormApi4Cap4)AppContext.getBean("formApi4Cap4");
|
||||
this.formApi4Cap4 = (FormApi4Cap4) AppContext.getBean("formApi4Cap4");
|
||||
}
|
||||
|
||||
return this.formApi4Cap4;
|
||||
@@ -97,37 +90,8 @@ public class YdzbDataSyncQuartz extends AbstractQuartzTask implements Disposable
|
||||
}
|
||||
log.info("宜都城投资产数据同步任务开始");
|
||||
long startTime = System.currentTimeMillis();
|
||||
try (Connection connection = ydzbThirdDataSource.getConnection()){
|
||||
CountDownLatch countDownLatch = new CountDownLatch(3);
|
||||
//线程1
|
||||
new Thread(()->{
|
||||
try {
|
||||
try (Connection connection = ydzbThirdDataSource.getConnection()) {
|
||||
processZcData(connection);
|
||||
countDownLatch.countDown();
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (BusinessException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (ServiceException e) {
|
||||
throw new RuntimeException(e);
|
||||
}finally {
|
||||
countDownLatch.countDown();
|
||||
}
|
||||
}).start();
|
||||
//线程2
|
||||
new Thread(()->{
|
||||
try {
|
||||
processContractData(connection);
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (BusinessException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (ServiceException e) {
|
||||
throw new RuntimeException(e);
|
||||
}finally {
|
||||
countDownLatch.countDown();
|
||||
}
|
||||
}).start();
|
||||
DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date startDate = null;
|
||||
Date endDate = null;
|
||||
@@ -135,38 +99,26 @@ public class YdzbDataSyncQuartz extends AbstractQuartzTask implements Disposable
|
||||
if (!"".equals(arg0) && arg0 != null) {
|
||||
String[] splits = arg0.split(",");
|
||||
for (int i = 0; i < splits.length; i++) {
|
||||
if(i == 0) {
|
||||
if (i == 0) {
|
||||
startDate = df.parse(splits[i]);
|
||||
}
|
||||
if(i == 1) {
|
||||
if (i == 1) {
|
||||
endDate = df.parse(splits[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
log.error(e.getMessage(),e);
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
Date finalStartDate = startDate;
|
||||
Date finalEndDate = endDate;
|
||||
//线程3
|
||||
new Thread(()->{
|
||||
try {
|
||||
processFeeData(connection, finalStartDate, finalEndDate);
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (BusinessException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (ServiceException e) {
|
||||
throw new RuntimeException(e);
|
||||
}finally {
|
||||
countDownLatch.countDown();
|
||||
}
|
||||
}).start();
|
||||
countDownLatch.await();
|
||||
log.info("宜都城投资产数据同步任务结束,耗时:"+ (System.currentTimeMillis() - startTime)+ " ms");
|
||||
processContractData(connection);
|
||||
log.info("宜都城投资产数据同步任务结束,耗时:" + (System.currentTimeMillis() - startTime) + " ms");
|
||||
} catch (Exception e) {
|
||||
log.error("宜都城投资产数据同步任务执行失败");
|
||||
log.error(e.getMessage(),e);
|
||||
log.error(e.getMessage(), e);
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -180,114 +132,149 @@ public class YdzbDataSyncQuartz extends AbstractQuartzTask implements Disposable
|
||||
contractMode.setAgent(agent);
|
||||
contractMode.setKsTableName(getBizConfigByKey(YdzbdataSyncConstants.ksTable));
|
||||
contractMode.setZcRootPcode(getBizConfigByKey(YdzbdataSyncConstants.zcRootEnumPCode));
|
||||
long count = StatementQueryUtil.queryCount(countQuerySql,connection, null);
|
||||
int totalPage = (int)Math.ceil((double)count / 100);
|
||||
for(int i = 0; i < totalPage;i++) {
|
||||
List<Map<String, Object>> contractDataList = StatementQueryUtil.queryList(pageQuerySql, connection, i*100);
|
||||
long count = StatementQueryUtil.queryCount(countQuerySql, connection, null);
|
||||
int totalPage = (int) Math.ceil((double) count / 100);
|
||||
for (int i = 0; i < totalPage; i++) {
|
||||
List<Map<String, Object>> contractDataList = StatementQueryUtil.queryList(pageQuerySql, connection, i * 100);
|
||||
for (Map<String, Object> rowMap : contractDataList) {
|
||||
Map<String, Object> targetMap = new HashMap<>();
|
||||
contractMode.preProcess(rowMap);
|
||||
contractMode.transfer(targetMap,rowMap);
|
||||
Map<String,Object> subMap = (Map<String,Object>)targetMap.get("subTable");
|
||||
contractMode.transfer(targetMap, rowMap);
|
||||
Map<String, Object> subMap = (Map<String, Object>) targetMap.get("subTable");
|
||||
targetMap.remove("subTable");
|
||||
List<FormWhereCondition> conditions = new ArrayList<>();
|
||||
conditions.add(FormWhereCondition.build().value(targetMap.get("合同编号")).display("合同编号"));
|
||||
upsertData(getBizConfigByKey(YdzbdataSyncConstants.contractFormNo),
|
||||
convert2StringValue(targetMap),
|
||||
getBizConfigByKey(YdzbdataSyncConstants.contractTable),
|
||||
convert2StringValue(subMap),
|
||||
" WHERE field0003 = ?", (String) targetMap.get("合同编号"));
|
||||
conditions);
|
||||
}
|
||||
}
|
||||
log.info("合同表数据同步结束");
|
||||
}
|
||||
|
||||
//处理费用数据
|
||||
private void processFeeData(Connection connection,Date startDate,Date endDate) throws SQLException, BusinessException, ServiceException {
|
||||
if(startDate == null) {
|
||||
private void processFeeData(Connection connection, Date startDate, Date endDate) throws SQLException, BusinessException, ServiceException {
|
||||
if (startDate == null) {
|
||||
startDate = TimeUtils.startOfYesterday();
|
||||
}else {
|
||||
} else {
|
||||
startDate = TimeUtils.startOf(startDate);
|
||||
}
|
||||
if(endDate == null) {
|
||||
if (endDate == null) {
|
||||
endDate = TimeUtils.startOf(new Date());
|
||||
}else {
|
||||
} else {
|
||||
endDate = TimeUtils.startOf(endDate);
|
||||
}
|
||||
log.info("开始同步费用数据");
|
||||
processContractBillData(connection,startDate,endDate);
|
||||
processRefundData(connection,startDate,endDate);
|
||||
processHydpowerRechargeData(connection,startDate,endDate);
|
||||
processContractBillData(connection, startDate, endDate);
|
||||
processRefundData(connection, startDate, endDate);
|
||||
processHydpowerRechargeData(connection, startDate, endDate);
|
||||
log.info("费用数据同步结束");
|
||||
}
|
||||
|
||||
//处理合同费用
|
||||
private void processContractBillData(Connection connection,Date startDate,Date endDate) throws SQLException, BusinessException, ServiceException {
|
||||
private void processContractBillData(Connection connection, Date startDate, Date endDate) throws SQLException, BusinessException, ServiceException {
|
||||
log.info("开始同步合同费用数据");
|
||||
String countQuerySql = "SELECT count(*) FROM zb_contract_bill where trade_reconciliation_time >= ? and trade_reconciliation_time <= ?;";
|
||||
String pageQuerySql = "SELECT * FROM zb_contract_bill where trade_reconciliation_time >= ? and trade_reconciliation_time <= ? limit 100 OFFSET ?;";
|
||||
String countQuerySql = "SELECT count(*) FROM zb_contract_bill where trade_reconciliation_time >= ? and trade_reconciliation_time <= ? and is_voucher = ?;";
|
||||
String pageQuerySql = "SELECT * FROM zb_contract_bill where trade_reconciliation_time >= ? and trade_reconciliation_time <= ? and is_voucher = ? limit 100 OFFSET ?;";
|
||||
ContractBillMode contractBillMode = new ContractBillMode();
|
||||
contractBillMode.setAgent(agent);
|
||||
contractBillMode.setZcRootPcode(getBizConfigByKey(YdzbdataSyncConstants.zcRootEnumPCode));
|
||||
long count = StatementQueryUtil.queryCount(countQuerySql,connection,startDate,endDate);
|
||||
int totalPage = (int)Math.ceil((double)count / 100);
|
||||
for(int i = 0; i < totalPage;i++) {
|
||||
List<Map<String, Object>> dataList = StatementQueryUtil.queryList(pageQuerySql, connection, startDate,endDate,i*100);
|
||||
contractBillMode.setKsTableName(getBizConfigByKey(YdzbdataSyncConstants.ksTable));
|
||||
contractBillMode.setKsSubTableName(getBizConfigByKey(YdzbdataSyncConstants.ksSubTable));
|
||||
contractBillMode.setFormNo(getBizConfigByKey(YdzbdataSyncConstants.feeFormNo));
|
||||
long count = StatementQueryUtil.queryCount(countQuerySql, connection, startDate, endDate,"否");
|
||||
int totalPage = (int) Math.ceil((double) count / 100);
|
||||
for (int i = 0; i < totalPage; i++) {
|
||||
List<Map<String, Object>> dataList = StatementQueryUtil.queryList(pageQuerySql, connection, startDate, endDate, "否",i * 100);
|
||||
for (Map<String, Object> rowMap : dataList) {
|
||||
Map<String, Object> targetMap = new HashMap<>();
|
||||
if(rowMap.get("bill_amount") != null && Double.parseDouble((String)rowMap.get("bill_amount")) == 0d) {
|
||||
continue;
|
||||
}
|
||||
contractBillMode.preProcess(rowMap);
|
||||
contractBillMode.transfer(targetMap,rowMap);
|
||||
insertData(getBizConfigByKey(YdzbdataSyncConstants.feeFormNo),convert2StringValue(targetMap));
|
||||
contractBillMode.transfer(targetMap, rowMap);
|
||||
List<FormWhereCondition> conditions = new ArrayList<>();
|
||||
conditions.add(FormWhereCondition.build().value(targetMap.get("住保主键")).display("住保主键"));
|
||||
conditions.add(FormWhereCondition.build().display("是否入账")
|
||||
.value(EnumMapUtils.getMasterTableEnumItemValue(getBizConfigByKey(YdzbdataSyncConstants.feeFormNo),"是否入账","未入")));
|
||||
upsertData(getBizConfigByKey(YdzbdataSyncConstants.feeFormNo),
|
||||
convert2StringValue(targetMap),
|
||||
null,
|
||||
conditions);
|
||||
|
||||
}
|
||||
}
|
||||
log.info("合同费用数据同步完成");
|
||||
}
|
||||
|
||||
private Map<String,String> convert2StringValue(Map<String,Object> oriMap) {
|
||||
Map<String,String> resMap = new HashMap<>();
|
||||
private Map<String, String> convert2StringValue(Map<String, Object> oriMap) {
|
||||
Map<String, String> resMap = new HashMap<>();
|
||||
for (String key : oriMap.keySet()) {
|
||||
resMap.put(key,oriMap.get(key)+"");
|
||||
resMap.put(key, oriMap.get(key) + "");
|
||||
}
|
||||
return resMap;
|
||||
}
|
||||
|
||||
//处理水电费
|
||||
private void processHydpowerRechargeData(Connection connection,Date startDate,Date endDate) throws SQLException, BusinessException, ServiceException {
|
||||
private void processHydpowerRechargeData(Connection connection, Date startDate, Date endDate) throws SQLException, BusinessException, ServiceException {
|
||||
log.info("开始同步水电费数据");
|
||||
String countQuerySql = "SELECT count(*) FROM zb_hydropower_recharge where recharge_time >= ? and recharge_time <=?;";
|
||||
String pageQuerySql = "SELECT * FROM zb_hydropower_recharge where recharge_time >= ? and recharge_time <= ? limit 100 OFFSET ?;";
|
||||
String countQuerySql = "SELECT count(*) FROM zb_hydropower_recharge where recharge_status = '支付完成' and recharge_time >= ? and recharge_time <=?;";
|
||||
String pageQuerySql = "SELECT * FROM zb_hydropower_recharge where recharge_status = '支付完成' and recharge_time >= ? and recharge_time <= ? limit 100 OFFSET ?;";
|
||||
HydropowerRechargeDataMapMode rechargeDataMapMode = new HydropowerRechargeDataMapMode();
|
||||
rechargeDataMapMode.setAgent(agent);
|
||||
rechargeDataMapMode.setZcRootPcode(getBizConfigByKey(YdzbdataSyncConstants.zcRootEnumPCode));
|
||||
long count = StatementQueryUtil.queryCount(countQuerySql,connection, startDate,endDate);
|
||||
int totalPage = (int)Math.ceil((double)count / 100);
|
||||
for(int i = 0; i < totalPage;i++) {
|
||||
List<Map<String, Object>> dataList = StatementQueryUtil.queryList(pageQuerySql, connection, startDate,endDate,i*100);
|
||||
rechargeDataMapMode.setKsTableName(getBizConfigByKey(YdzbdataSyncConstants.ksTable));
|
||||
rechargeDataMapMode.setKsSubTableName(getBizConfigByKey(YdzbdataSyncConstants.ksSubTable));
|
||||
rechargeDataMapMode.setFormNo(getBizConfigByKey(YdzbdataSyncConstants.feeFormNo));
|
||||
long count = StatementQueryUtil.queryCount(countQuerySql, connection, startDate, endDate);
|
||||
int totalPage = (int) Math.ceil((double) count / 100);
|
||||
for (int i = 0; i < totalPage; i++) {
|
||||
List<Map<String, Object>> dataList = StatementQueryUtil.queryList(pageQuerySql, connection, startDate, endDate,i * 100);
|
||||
for (Map<String, Object> rowMap : dataList) {
|
||||
Map<String, Object> targetMap = new HashMap<>();
|
||||
rechargeDataMapMode.preProcess(rowMap);
|
||||
rechargeDataMapMode.transfer(targetMap,rowMap);
|
||||
insertData(getBizConfigByKey(YdzbdataSyncConstants.feeFormNo),convert2StringValue(targetMap));
|
||||
rechargeDataMapMode.transfer(targetMap, rowMap);
|
||||
List<FormWhereCondition> conditions = new ArrayList<>();
|
||||
conditions.add(FormWhereCondition.build().value(targetMap.get("住保主键")).display("住保主键"));
|
||||
conditions.add(FormWhereCondition.build().display("是否入账")
|
||||
.value(EnumMapUtils.getMasterTableEnumItemValue(getBizConfigByKey(YdzbdataSyncConstants.feeFormNo),"是否入账","未入")));
|
||||
upsertData(getBizConfigByKey(YdzbdataSyncConstants.feeFormNo),
|
||||
convert2StringValue(targetMap),
|
||||
null,
|
||||
conditions);
|
||||
}
|
||||
}
|
||||
log.info("水电费数据同步完成");
|
||||
}
|
||||
|
||||
//处理退费
|
||||
private void processRefundData(Connection connection,Date startDate,Date endDate) throws SQLException, BusinessException, ServiceException {
|
||||
private void processRefundData(Connection connection, Date startDate, Date endDate) throws SQLException, BusinessException, ServiceException {
|
||||
log.info("开始同步退费数据");
|
||||
String countQuerySql = "SELECT count(*) FROM zb_refund where create_time >= ? and create_time <= ?;";
|
||||
String pageQuerySql = "SELECT * FROM zb_refund where create_time >= ? and create_time <= ? limit 100 OFFSET ?;";
|
||||
String countQuerySql = "SELECT count(*) FROM zb_refund where create_time >= ? and create_time <= ? and is_voucher = ?;";
|
||||
String pageQuerySql = "SELECT * FROM zb_refund where create_time >= ? and create_time <= ? and is_voucher = ? limit 100 OFFSET ?;";
|
||||
RefundDataMapMode refundDataMapMode = new RefundDataMapMode();
|
||||
refundDataMapMode.setAgent(agent);
|
||||
refundDataMapMode.setZcRootPcode(getBizConfigByKey(YdzbdataSyncConstants.zcRootEnumPCode));
|
||||
long count = StatementQueryUtil.queryCount(countQuerySql,connection, startDate,endDate);
|
||||
int totalPage = (int)Math.ceil((double)count / 100);
|
||||
for(int i = 0; i < totalPage;i++) {
|
||||
List<Map<String, Object>> dataList = StatementQueryUtil.queryList(pageQuerySql,connection, startDate,endDate,i*100);
|
||||
refundDataMapMode.setKsTableName(getBizConfigByKey(YdzbdataSyncConstants.ksTable));
|
||||
refundDataMapMode.setKsSubTableName(getBizConfigByKey(YdzbdataSyncConstants.ksSubTable));
|
||||
refundDataMapMode.setFormNo(getBizConfigByKey(YdzbdataSyncConstants.feeFormNo));
|
||||
long count = StatementQueryUtil.queryCount(countQuerySql, connection, startDate, endDate,"否");
|
||||
int totalPage = (int) Math.ceil((double) count / 100);
|
||||
for (int i = 0; i < totalPage; i++) {
|
||||
List<Map<String, Object>> dataList = StatementQueryUtil.queryList(pageQuerySql, connection, startDate, endDate,"否", i * 100);
|
||||
for (Map<String, Object> rowMap : dataList) {
|
||||
if("退款异常".equals(rowMap.get("refund_status"))) {
|
||||
continue;
|
||||
}
|
||||
Map<String, Object> targetMap = new HashMap<>();
|
||||
refundDataMapMode.preProcess(rowMap);
|
||||
refundDataMapMode.transfer(targetMap,rowMap);
|
||||
insertData(getBizConfigByKey(YdzbdataSyncConstants.feeFormNo),convert2StringValue(targetMap));
|
||||
refundDataMapMode.transfer(targetMap, rowMap);
|
||||
List<FormWhereCondition> conditions = new ArrayList<>();
|
||||
conditions.add(FormWhereCondition.build().value(targetMap.get("住保主键")).display("住保主键"));
|
||||
conditions.add(FormWhereCondition.build().display("是否入账")
|
||||
.value(EnumMapUtils.getMasterTableEnumItemValue(getBizConfigByKey(YdzbdataSyncConstants.feeFormNo),"是否入账","未入")));
|
||||
upsertData(getBizConfigByKey(YdzbdataSyncConstants.feeFormNo),
|
||||
convert2StringValue(targetMap),
|
||||
null,
|
||||
conditions);
|
||||
}
|
||||
}
|
||||
log.info("退费数据同步结束");
|
||||
@@ -309,20 +296,21 @@ public class YdzbDataSyncQuartz extends AbstractQuartzTask implements Disposable
|
||||
String pageQuerySql = "SELECT * FROM zb_gztd_house limit 100 OFFSET ?;";
|
||||
GztdAssetMode gztdAssetMode = new GztdAssetMode();
|
||||
gztdAssetMode.setAgent(agent);
|
||||
gztdAssetMode.setZcRootPcode(getBizConfigByKey(YdzbdataSyncConstants.zcRootEnumPCode));
|
||||
long count = StatementQueryUtil.queryCount(countQuerySql,connection, null);
|
||||
int totalPage = (int)Math.ceil((double)count / 100);
|
||||
for(int i = 0; i < totalPage;i++) {
|
||||
List<Map<String, Object>> dataList = StatementQueryUtil.queryList(pageQuerySql, connection, i*100);
|
||||
gztdAssetMode.setFormNo(getBizConfigByKey(YdzbdataSyncConstants.zcFormNo));
|
||||
long count = StatementQueryUtil.queryCount(countQuerySql, connection, null);
|
||||
int totalPage = (int) Math.ceil((double) count / 100);
|
||||
for (int i = 0; i < totalPage; i++) {
|
||||
List<Map<String, Object>> dataList = StatementQueryUtil.queryList(pageQuerySql, connection, i * 100);
|
||||
for (Map<String, Object> rowMap : dataList) {
|
||||
Map<String, Object> targetMap = new HashMap<>();
|
||||
gztdAssetMode.preProcess(rowMap);
|
||||
gztdAssetMode.transfer(targetMap,rowMap);
|
||||
gztdAssetMode.transfer(targetMap, rowMap);
|
||||
List<FormWhereCondition> conditions = new ArrayList<>();
|
||||
conditions.add(FormWhereCondition.build().value(targetMap.get("资产编号")).display("资产编号"));
|
||||
upsertData(getBizConfigByKey(YdzbdataSyncConstants.zcFormNo),
|
||||
convert2StringValue(targetMap),
|
||||
getBizConfigByKey(YdzbdataSyncConstants.zcTable),
|
||||
" WHERE field0031 = ?",
|
||||
targetMap.get("资产编号") +"");
|
||||
null,
|
||||
conditions);
|
||||
}
|
||||
}
|
||||
log.info("国资土地数据同步完成");
|
||||
@@ -334,20 +322,21 @@ public class YdzbDataSyncQuartz extends AbstractQuartzTask implements Disposable
|
||||
String pageQuerySql = "SELECT * FROM zb_gzfw_house limit 100 OFFSET ?;";
|
||||
GzfwAssetMode gzfwAssetMode = new GzfwAssetMode();
|
||||
gzfwAssetMode.setAgent(agent);
|
||||
gzfwAssetMode.setZcRootPcode(getBizConfigByKey(YdzbdataSyncConstants.zcRootEnumPCode));
|
||||
long count = StatementQueryUtil.queryCount(countQuerySql,connection, null);
|
||||
int totalPage = (int)Math.ceil((double)count / 100);
|
||||
for(int i = 0; i < totalPage;i++) {
|
||||
List<Map<String, Object>> dataList = StatementQueryUtil.queryList(pageQuerySql, connection, i*100);
|
||||
gzfwAssetMode.setFormNo(getBizConfigByKey(YdzbdataSyncConstants.zcFormNo));
|
||||
long count = StatementQueryUtil.queryCount(countQuerySql, connection, null);
|
||||
int totalPage = (int) Math.ceil((double) count / 100);
|
||||
for (int i = 0; i < totalPage; i++) {
|
||||
List<Map<String, Object>> dataList = StatementQueryUtil.queryList(pageQuerySql, connection, i * 100);
|
||||
for (Map<String, Object> rowMap : dataList) {
|
||||
Map<String, Object> targetMap = new HashMap<>();
|
||||
gzfwAssetMode.preProcess(rowMap);
|
||||
gzfwAssetMode.transfer(targetMap,rowMap);
|
||||
gzfwAssetMode.transfer(targetMap, rowMap);
|
||||
List<FormWhereCondition> conditions = new ArrayList<>();
|
||||
conditions.add(FormWhereCondition.build().value(targetMap.get("资产编号")).display("资产编号"));
|
||||
upsertData(getBizConfigByKey(YdzbdataSyncConstants.zcFormNo),
|
||||
convert2StringValue(targetMap),
|
||||
getBizConfigByKey(YdzbdataSyncConstants.zcTable),
|
||||
" WHERE field0031 = ?",
|
||||
targetMap.get("资产编号") + "");
|
||||
null,
|
||||
conditions);
|
||||
}
|
||||
}
|
||||
log.info("国资房屋数据同步结束");
|
||||
@@ -359,20 +348,21 @@ public class YdzbDataSyncQuartz extends AbstractQuartzTask implements Disposable
|
||||
String pageQuerySql = "SELECT * FROM zb_gzcf_house limit 100 OFFSET ?;";
|
||||
GzcfAssetMode gzcfAssetMode = new GzcfAssetMode();
|
||||
gzcfAssetMode.setAgent(agent);
|
||||
gzcfAssetMode.setZcRootPcode(getBizConfigByKey(YdzbdataSyncConstants.zcRootEnumPCode));
|
||||
long count = StatementQueryUtil.queryCount(countQuerySql,connection, null);
|
||||
int totalPage = (int)Math.ceil((double)count / 100);
|
||||
for(int i = 0; i < totalPage;i++) {
|
||||
List<Map<String, Object>> dataList = StatementQueryUtil.queryList(pageQuerySql, connection, i*100);
|
||||
gzcfAssetMode.setFormNo(getBizConfigByKey(YdzbdataSyncConstants.zcFormNo));
|
||||
long count = StatementQueryUtil.queryCount(countQuerySql, connection, null);
|
||||
int totalPage = (int) Math.ceil((double) count / 100);
|
||||
for (int i = 0; i < totalPage; i++) {
|
||||
List<Map<String, Object>> dataList = StatementQueryUtil.queryList(pageQuerySql, connection, i * 100);
|
||||
for (Map<String, Object> rowMap : dataList) {
|
||||
Map<String, Object> targetMap = new HashMap<>();
|
||||
gzcfAssetMode.preProcess(rowMap);
|
||||
gzcfAssetMode.transfer(targetMap,rowMap);
|
||||
gzcfAssetMode.transfer(targetMap, rowMap);
|
||||
List<FormWhereCondition> conditions = new ArrayList<>();
|
||||
conditions.add(FormWhereCondition.build().value(targetMap.get("资产编号")).display("资产编号"));
|
||||
upsertData(getBizConfigByKey(YdzbdataSyncConstants.zcFormNo),
|
||||
convert2StringValue(targetMap),
|
||||
getBizConfigByKey(YdzbdataSyncConstants.zcTable),
|
||||
" WHERE field0031 = ?",
|
||||
targetMap.get("资产编号") + "");
|
||||
null,
|
||||
conditions);
|
||||
}
|
||||
}
|
||||
log.info("国资厂房数据同步完成");
|
||||
@@ -392,19 +382,19 @@ public class YdzbDataSyncQuartz extends AbstractQuartzTask implements Disposable
|
||||
|
||||
private void handleParentXzData(Connection connection) throws ServiceException, SQLException {
|
||||
log.info("开始同步父级小区数据");
|
||||
String queryXq = "select zh.village_name,zh.land_nature,zh.property_mortgage from zb_bzf_house zh where land_nature is not null and property_mortgage is not null group By zh.village_name,zh.land_nature,zh.property_mortgage;";
|
||||
String queryXq = "select zh.village_name from zb_bzf_house zh group By zh.village_name;";
|
||||
|
||||
String rootCode = getBizConfigByKey(YdzbdataSyncConstants.zcRootEnumPCode);
|
||||
String xqzcpLevelValue = EnumMapUtils.getEnumItemValue(rootCode, agent, "资产等级", "父级");
|
||||
String zcTypeFwValue = EnumMapUtils.getEnumItemValue(rootCode, agent, "资产分类(资产系统)", "房屋");
|
||||
String zcTypeLevel2 = EnumMapUtils.getEnumItemValue(rootCode, agent, "资产分类(资产系统)", "保障性住房");
|
||||
String xqzcBlock = EnumMapUtils.getEnumItemValue(rootCode, agent, "资产分类(资产系统)", "03不动产");
|
||||
String xqzcStatus = EnumMapUtils.getEnumItemValue(rootCode, agent, "资产状态", "待出租");
|
||||
String xqzcFeature = EnumMapUtils.getEnumItemValue(rootCode, agent, "资产性质", "非流动资产");
|
||||
String xqzz = EnumMapUtils.getEnumItemValue(rootCode, agent, "房屋用途", "住宅");
|
||||
String xqrental_type = EnumMapUtils.getEnumItemValue(rootCode, agent, "租售类型", "只租不售");
|
||||
String xqhs = EnumMapUtils.getEnumItemValue(rootCode, agent, "房屋体系", "保租房");
|
||||
List<Map<String, Object>> resList = StatementQueryUtil.queryList(queryXq,connection,null);
|
||||
String formNo= getBizConfigByKey(YdzbdataSyncConstants.zcFormNo);
|
||||
String xqzcpLevelValue = EnumMapUtils.getMasterTableEnumItemValue(formNo,"资产层级", "父级");
|
||||
String zcTypeFwValue = EnumMapUtils.getMasterTableEnumItemValue(formNo,"资产类型", "房屋");
|
||||
String zcTypeLevel2 = EnumMapUtils.getMasterTableEnumItemValue(formNo,"资产二级类型", "保障性住房");
|
||||
String xqzcBlock = EnumMapUtils.getMasterTableEnumItemValue(formNo, "资产板块", "03不动产");
|
||||
String xqzcStatus = EnumMapUtils.getMasterTableEnumItemValue(formNo, "资产状态", "待出租");
|
||||
String xqzcFeature = EnumMapUtils.getMasterTableEnumItemValue(formNo, "资产性质", "非流动资产");
|
||||
String xqzz = EnumMapUtils.getMasterTableEnumItemValue(formNo, "用途", "住宅");
|
||||
String xqrental_type = EnumMapUtils.getMasterTableEnumItemValue(formNo, "租售类型", "只租不售");
|
||||
String xqhs = EnumMapUtils.getMasterTableEnumItemValue(formNo, "房屋体系", "保租房");
|
||||
List<Map<String, Object>> resList = StatementQueryUtil.queryList(queryXq, connection, null);
|
||||
if (resList != null && resList.size() > 0) {
|
||||
for (Map<String, Object> mapT : resList) {
|
||||
List<String> params = new ArrayList<>();
|
||||
@@ -414,9 +404,14 @@ public class YdzbDataSyncQuartz extends AbstractQuartzTask implements Disposable
|
||||
params.add(mapT.get("village_name") + "");
|
||||
List<Map<String, Object>> list = (List<Map<String, Object>>) agent.execute(villageQuerySql, params);
|
||||
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String landNature = getParentXqLandNature(formNo,mapT.get("village_name") + "", connection);
|
||||
String hasList = getParentXqHasLift(formNo,mapT.get("village_name") + "", connection);
|
||||
String propertyMortgage = getParentXqPropertyMortgage(formNo,mapT.get("village_name") + "", connection);
|
||||
String raiseWay = getParentXqRaiseWay(formNo,mapT.get("village_name") + "", connection);
|
||||
if (list == null || list.isEmpty()) {
|
||||
//保障性住房小区的资产信息若不存在,则插入
|
||||
Map<String, String> villageInsertInfo = new HashMap<>();
|
||||
villageInsertInfo.put("资产编号", "p_" + UUID.randomUUID().toString());
|
||||
villageInsertInfo.put("建档部门", getCreatorDept(getBizConfigByKey(YdzbdataSyncConstants.loginName)));//建档部门
|
||||
villageInsertInfo.put("建档人员", "系统管理员");//建档人员
|
||||
villageInsertInfo.put("建档日期", df.format(new Date()));//建档日期
|
||||
@@ -430,12 +425,20 @@ public class YdzbDataSyncQuartz extends AbstractQuartzTask implements Disposable
|
||||
villageInsertInfo.put("资产类型", zcTypeFwValue);//资产类型
|
||||
villageInsertInfo.put("资产二级类型", zcTypeLevel2);//资产二级类型
|
||||
villageInsertInfo.put("资产种类", "保障性住房");//资产种类
|
||||
villageInsertInfo.put("数据来源", "住保系统集成获取收支数据"); //数据来源
|
||||
villageInsertInfo.put("所属小区", mapT.get("village_name") + "");//小区
|
||||
villageInsertInfo.put("用途", xqzz);//用途
|
||||
villageInsertInfo.put("租售类型", xqrental_type);//租售类型
|
||||
villageInsertInfo.put("房屋体系", xqhs);//房屋体系
|
||||
villageInsertInfo.put("土地性质", EnumMapUtils.getEnumItemValue(rootCode, agent, "土地资产", mapT.get("land_nature") + ""));//土地性质
|
||||
villageInsertInfo.put("是否产权抵押", EnumMapUtils.getEnumItemValue(rootCode, agent, "是否产权抵押", mapT.get("property_mortgage") + "")); //是否产权抵押
|
||||
villageInsertInfo.put("筹集方式", raiseWay); // 筹集方式
|
||||
villageInsertInfo.put("有无电梯", hasList); //有无电梯
|
||||
villageInsertInfo.put("土地性质", landNature);//土地性质
|
||||
villageInsertInfo.put("是否产权抵押", propertyMortgage); //是否产权抵押
|
||||
villageInsertInfo.put("楼栋", "无");
|
||||
villageInsertInfo.put("单元", "无");
|
||||
villageInsertInfo.put("房号", "无");
|
||||
villageInsertInfo.put("具体楼层", "无");
|
||||
villageInsertInfo.put("房屋朝向", "无");
|
||||
FormExport formExport = new FormExport();
|
||||
formExport.setValues(FormExportUtil.setFormValue(villageInsertInfo));
|
||||
getFormFactory().importBusinessFormData(getBizConfigByKey(YdzbdataSyncConstants.loginName), getBizConfigByKey(YdzbdataSyncConstants.zcFormNo), formExport, new String[]{});
|
||||
@@ -445,6 +448,47 @@ public class YdzbDataSyncQuartz extends AbstractQuartzTask implements Disposable
|
||||
|
||||
}
|
||||
|
||||
private String getParentXqLandNature(String formNo,String villageName, Connection connection) throws SQLException {
|
||||
String queryXq = "select zh.land_nature from zb_bzf_house zh where zh.village_name = ? and zh.land_nature is not null limit 1 offset 0;";
|
||||
List<Map<String, Object>> resList = StatementQueryUtil.queryList(queryXq, connection, villageName);
|
||||
if (resList != null && resList.size() > 0) {
|
||||
|
||||
return EnumMapUtils.getMasterTableEnumItemValue(formNo, "土地性质", (String) resList.get(0).get("land_nature"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String getParentXqHasLift(String formNo,String villageName, Connection connection) throws SQLException {
|
||||
String queryXq = "select zh.has_lift from zb_bzf_house zh where zh.village_name = ? and zh.has_lift is not null limit 1 offset 0;";
|
||||
List<Map<String, Object>> resList = StatementQueryUtil.queryList(queryXq, connection, villageName);
|
||||
if (resList != null && resList.size() > 0) {
|
||||
|
||||
return EnumMapUtils.getMasterTableEnumItemValue(formNo, "有无电梯", (String) resList.get(0).get("has_lift"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String getParentXqPropertyMortgage(String formNo,String villageName, Connection connection) throws SQLException {
|
||||
String queryXq = "select zh.property_mortgage from zb_bzf_house zh where zh.village_name = ? and zh.property_mortgage is not null limit 1 offset 0;";
|
||||
List<Map<String, Object>> resList = StatementQueryUtil.queryList(queryXq, connection, villageName);
|
||||
if (resList != null && resList.size() > 0) {
|
||||
|
||||
return EnumMapUtils.getMasterTableEnumItemValue(formNo, "是否产权抵押", (String) resList.get(0).get("property_mortgage"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String getParentXqRaiseWay(String formNo,String villageName, Connection connection) throws SQLException {
|
||||
String queryXq = "select zh.raise_way from zb_bzf_house zh where zh.village_name = ? and zh.raise_way is not null limit 1 offset 0;";
|
||||
List<Map<String, Object>> resList = StatementQueryUtil.queryList(queryXq, connection, villageName);
|
||||
if (resList != null && resList.size() > 0) {
|
||||
|
||||
return EnumMapUtils.getMasterTableEnumItemValue(formNo, "筹集方式", (String) resList.get(0).get("raise_way"));
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
private void processBzfHouseData(Connection connection) throws SQLException, BusinessException, ServiceException {
|
||||
log.info("开始同步保障房数据");
|
||||
handleParentXzData(connection);
|
||||
@@ -453,154 +497,68 @@ public class YdzbDataSyncQuartz extends AbstractQuartzTask implements Disposable
|
||||
BzfAssetMode bzfAssetMode = new BzfAssetMode();
|
||||
bzfAssetMode.setAgent(agent);
|
||||
bzfAssetMode.setFormNo(getBizConfigByKey(YdzbdataSyncConstants.zcFormNo));
|
||||
bzfAssetMode.setZcRootPcode(getBizConfigByKey(YdzbdataSyncConstants.zcRootEnumPCode));
|
||||
long count = StatementQueryUtil.queryCount(countQuerySql,connection, null);
|
||||
int totalPage = (int)Math.ceil((double)count / 100);
|
||||
for(int i = 0; i < totalPage;i++) {
|
||||
List<Map<String, Object>> dataList = StatementQueryUtil.queryList(pageQuerySql, connection, i*100);
|
||||
long count = StatementQueryUtil.queryCount(countQuerySql, connection, null);
|
||||
int totalPage = (int) Math.ceil((double) count / 100);
|
||||
for (int i = 0; i < totalPage; i++) {
|
||||
List<Map<String, Object>> dataList = StatementQueryUtil.queryList(pageQuerySql, connection, i * 100);
|
||||
for (Map<String, Object> rowMap : dataList) {
|
||||
Map<String, Object> targetMap = new HashMap<>();
|
||||
Map<String,Object> temp = new HashMap<>();
|
||||
Map<String, Object> temp = new HashMap<>();
|
||||
temp.putAll(rowMap);
|
||||
temp.put("loginName",getBizConfigByKey(YdzbdataSyncConstants.loginName));
|
||||
temp.put("zcTable",getBizConfigByKey(YdzbdataSyncConstants.zcTable));
|
||||
temp.put("loginName", getBizConfigByKey(YdzbdataSyncConstants.loginName));
|
||||
temp.put("zcTable", getBizConfigByKey(YdzbdataSyncConstants.zcTable));
|
||||
bzfAssetMode.preProcess(temp);
|
||||
bzfAssetMode.transfer(targetMap,temp);
|
||||
bzfAssetMode.transfer(targetMap, temp);
|
||||
List<FormWhereCondition> conditions = new ArrayList<>();
|
||||
conditions.add(FormWhereCondition.build().value(targetMap.get("资产编号")).display("资产编号"));
|
||||
upsertData(getBizConfigByKey(YdzbdataSyncConstants.zcFormNo),
|
||||
convert2StringValue(targetMap),
|
||||
getBizConfigByKey(YdzbdataSyncConstants.zcTable),
|
||||
" WHERE field0031 = ?",
|
||||
targetMap.get("资产编号") + "");
|
||||
null,
|
||||
conditions);
|
||||
}
|
||||
}
|
||||
log.info("保障房数据同步结束");
|
||||
}
|
||||
|
||||
private void upsertData(String formNo,Map<String, String> targetMap,String table,String whereSql,String param) throws BusinessException, SQLException, ServiceException {
|
||||
//不存在则插入,存在则更新
|
||||
List<String> params = new ArrayList<>();
|
||||
params.add(param);
|
||||
String querySql = "SELECT * FROM " + table + " "+ whereSql +";";
|
||||
Map<String,Object> existData = null;
|
||||
List<Map<String, Object>> resList = (List<Map<String, Object>>) agent.execute(querySql, params);
|
||||
existData = resList == null || resList.size() == 0 ? null : resList.get(0);
|
||||
if (existData != null && existData.size() > 0) {
|
||||
FormBean cap4FormBean = this.getFormApi4Cap4().getFormByFormCode(formNo);
|
||||
Map<String, Object> temp = new HashMap<>();
|
||||
for (FormTableBean tableBean : cap4FormBean.getTableList()) {
|
||||
if (tableBean.getDbTableName().contains("formmain")) {
|
||||
for (String key : targetMap.keySet()) {
|
||||
FormFieldBean fieldBean = tableBean.getFieldMap4Display().get(key);
|
||||
temp.put(fieldBean.getColumnName(), targetMap.get(key));
|
||||
}
|
||||
}
|
||||
}
|
||||
for (String key : temp.keySet()) {
|
||||
existData.put(key, temp.get(key) + "");
|
||||
}
|
||||
Map<String, Object> updateSqlMap = generateUpdateSql(existData, table, " WHERE ID = ?", param);
|
||||
agent.execute((String) updateSqlMap.get("sql"), (List) updateSqlMap.get("params"));
|
||||
} else {
|
||||
private void insertData(String formNo, Map<String, String> targetMap) throws BusinessException, SQLException, ServiceException {
|
||||
FormExport formExport = new FormExport();
|
||||
formExport.setValues(FormExportUtil.setFormValue(targetMap));
|
||||
getFormFactory().importBusinessFormData(getBizConfigByKey(YdzbdataSyncConstants.loginName), formNo, formExport, new String[]{});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void insertData(String formNo,Map<String, String> targetMap) throws BusinessException, SQLException, ServiceException {
|
||||
FormExport formExport = new FormExport();
|
||||
formExport.setValues(FormExportUtil.setFormValue(targetMap));
|
||||
getFormFactory().importBusinessFormData(getBizConfigByKey(YdzbdataSyncConstants.loginName), formNo,formExport, new String[] {});
|
||||
}
|
||||
|
||||
private void upsertData(String formNo,Map<String, String> targetMap,String table,Map<String, String> subTableMap,String whereSql,String param) throws BusinessException, SQLException, ServiceException {
|
||||
private void upsertData(String formNo, Map<String, String> targetMap,Map<String, String> subTableMap, List<FormWhereCondition> conditions) throws BusinessException, SQLException, ServiceException {
|
||||
//不存在则插入,存在则更新
|
||||
List<String> params = new ArrayList<>();
|
||||
params.add(param);
|
||||
String querySql = "SELECT * FROM " + table +" " + whereSql +";";
|
||||
Map<String,Object> existData = null;
|
||||
List<Map<String, Object>> resList = (List<Map<String, Object>>) agent.execute(querySql, params);
|
||||
existData = resList == null || resList.size() == 0 ? null : resList.get(0);
|
||||
if (existData != null && existData.size() > 0) {
|
||||
FormBean cap4FormBean = this.getFormApi4Cap4().getFormByFormCode(formNo);
|
||||
Map<String, Object> temp = new HashMap<>();
|
||||
for (FormTableBean tableBean : cap4FormBean.getTableList()) {
|
||||
if (tableBean.getDbTableName().contains("formmain")) {
|
||||
FormDataOperator formDataOperator = new FormDataOperator();
|
||||
List<FormColumn> formColumns = formDataOperator.queryFormDataCondition(formNo, null, Arrays.asList(conditions.get(0)));
|
||||
if (formColumns != null && formColumns.size() > 0) {
|
||||
List<FormUpdateField> updateFields = new ArrayList<>();
|
||||
for (String key : targetMap.keySet()) {
|
||||
FormFieldBean fieldBean = tableBean.getFieldMap4Display().get(key);
|
||||
temp.put(fieldBean.getColumnName(), targetMap.get(key));
|
||||
updateFields.add(FormUpdateField.build().display(key).value(targetMap.get(key)));
|
||||
}
|
||||
List<FormWhereCondition> whereConditions = new ArrayList<>();
|
||||
whereConditions.add(FormWhereCondition.build().display("ID").value(formColumns.get(0).getId()).clauseFactor(ClauseFactor.EQ));
|
||||
if(conditions.size() > 1) {
|
||||
whereConditions.add(conditions.get(0));
|
||||
}
|
||||
}
|
||||
for (String key : temp.keySet()) {
|
||||
existData.put(key, temp.get(key) + "");
|
||||
}
|
||||
Map<String, Object> updateSqlMap = generateUpdateSql(existData, table, " WHERE ID = ?", param);
|
||||
agent.execute((String) updateSqlMap.get("sql"), (List) updateSqlMap.get("params"));
|
||||
formDataOperator.updateMasterForm(formNo,updateFields,whereConditions);
|
||||
} else {
|
||||
FormExport formExport = new FormExport();
|
||||
formExport.setValues(FormExportUtil.setFormValue(targetMap));
|
||||
if(subTableMap != null) {
|
||||
formExport.setSubordinateForms(FormExportUtil.setSubordinateFormValue(subTableMap));
|
||||
}
|
||||
getFormFactory().importBusinessFormData(getBizConfigByKey(YdzbdataSyncConstants.loginName), formNo, formExport, new String[]{});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private Map<String, Object> generateUpdateSql(Map<String, Object> fieldValues, String tableName, String whereClause,Object clauseValue) {
|
||||
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");
|
||||
}
|
||||
if (whereClause == null || whereClause.trim().isEmpty()) {
|
||||
throw new IllegalArgumentException("Where clause cannot be null or empty");
|
||||
}
|
||||
StringBuilder sqlBuilder = new StringBuilder("UPDATE ").append(tableName).append(" SET ");
|
||||
List<Object> params = new ArrayList<>();
|
||||
// Build the SET clause
|
||||
int fieldCount = 0;
|
||||
for (Map.Entry<String, Object> entry : fieldValues.entrySet()) {
|
||||
if(entry.getValue() == null || "".equals(entry.getValue()) || "null".equals(entry.getValue())) {
|
||||
continue;
|
||||
}
|
||||
if(entry.getKey().equals("ID")) {
|
||||
if(whereClause.contains("ID")) {
|
||||
clauseValue = entry.getValue();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (fieldCount > 0) {
|
||||
sqlBuilder.append(", ");
|
||||
}
|
||||
sqlBuilder.append(entry.getKey()).append(" = ?");
|
||||
params.add(entry.getValue());
|
||||
fieldCount++;
|
||||
}
|
||||
params.add(clauseValue);
|
||||
// Append the WHERE clause
|
||||
sqlBuilder.append(whereClause);
|
||||
// Create result map
|
||||
sqlBuilder.append(";");
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("sql", sqlBuilder.toString());
|
||||
result.put("params", params);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() throws Exception {
|
||||
ydzbThirdDataSource.close();
|
||||
myCusDataSource.close();
|
||||
}
|
||||
|
||||
private String getBizConfigByKey(YdzbdataSyncConstants key) {
|
||||
ConfigVo config = cstConfigApi.getConfig(getPluginId());
|
||||
if(prod) {
|
||||
return config.getParamVal(key.name());
|
||||
}else {
|
||||
return key.getDefaultValue();
|
||||
}
|
||||
private String getBizConfigByKey(YdzbdataSyncConstants ydzbdataSyncConstants) {
|
||||
return ydctPluginConfigProvider.getBizConfigByKey(ydzbdataSyncConstants);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.seeyon.apps.src_ydctdatasync.utils;
|
||||
|
||||
public enum ClauseFactor {
|
||||
EQ, //相等
|
||||
GT, //大于
|
||||
GE, //大于等于
|
||||
LT, //小于
|
||||
LE, //小于等于
|
||||
NULL, //空
|
||||
NOT_NULL, //非空
|
||||
LIKE, //模糊
|
||||
AND,
|
||||
OR
|
||||
;
|
||||
|
||||
public boolean isNullType() {
|
||||
return this == NULL || this == NOT_NULL;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.seeyon.apps.src_ydctdatasync.utils;
|
||||
|
||||
import com.seeyon.ctp.util.JDBCAgent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DeptGetUtils {
|
||||
|
||||
public static String getDeptIdByName(String deptName) {
|
||||
String querySql = "SELECT ID FROM org_unit where IS_ENABLE = 1 AND `NAME` = ? limit 1";
|
||||
JDBCAgent agent = new JDBCAgent();
|
||||
try {
|
||||
List<Object> params = new ArrayList<>();
|
||||
params.add(deptName);
|
||||
agent.execute(querySql,params);
|
||||
return agent.resultSetToMap().get("id") + "";
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}finally {
|
||||
agent.close();
|
||||
}
|
||||
}
|
||||
|
||||
public static String getPostByNameAndAccount(String name,String account) {
|
||||
String querySql = "SELECT ID FROM org_post where `NAME` = ? and `ORG_ACCOUNT_ID` = ? AND `STATUS` = 1 limit 1";
|
||||
JDBCAgent agent = new JDBCAgent();
|
||||
try {
|
||||
List<Object> params = new ArrayList<>();
|
||||
params.add(name);
|
||||
params.add(account);
|
||||
agent.execute(querySql,params);
|
||||
return agent.resultSetToMap().get("id") + "";
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}finally {
|
||||
agent.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,24 +1,50 @@
|
||||
package com.seeyon.apps.src_ydctdatasync.utils;
|
||||
|
||||
import com.seeyon.apps.src_ydctdatasync.dao.MyJdbcAgent;
|
||||
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.po.ctpenumnew.CtpEnumBean;
|
||||
import com.seeyon.ctp.common.po.ctpenumnew.CtpEnumItem;
|
||||
import com.seeyon.ctp.util.JDBCAgent;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class EnumMapUtils {
|
||||
public static String getEnumItemValue(String rootPCode, MyJdbcAgent agent, String groupValue, String targetValue) {
|
||||
|
||||
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 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 {
|
||||
List<Map<String, Object>> list = (List<Map<String, Object>>) agent.execute(queryIdSql, Arrays.asList(rootPCode,groupValue));
|
||||
agent.execute(queryIdSql, Arrays.asList(rootPCode,groupValue));
|
||||
List<Map<String, Object>> list = (List<Map<String, Object>>) agent.resultSetToList();
|
||||
if(list == null || list.size() == 0) {
|
||||
return "";
|
||||
}
|
||||
@@ -26,6 +52,8 @@ public class EnumMapUtils {
|
||||
enumId = (Long)map.get("ID");
|
||||
} catch (Exception e) {
|
||||
return "";
|
||||
}finally {
|
||||
agent.close();
|
||||
}
|
||||
EnumManager enumManagerNew = (EnumManager) AppContext.getBean("enumManagerNew");
|
||||
CtpEnumBean ctpEnumBean = enumManagerNew.getEnum(enumId);
|
||||
@@ -43,4 +71,22 @@ public class EnumMapUtils {
|
||||
}
|
||||
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<CtpEnumItem> ctpEnumItems = ctpEnumBean.getItems();
|
||||
if(ctpEnumBean.getItems() == null) {
|
||||
return "";
|
||||
}
|
||||
for (CtpEnumItem enumItem : ctpEnumItems) {
|
||||
if(enumItem.getShowvalue().equals(showValue)) {
|
||||
return enumItem.getId() + "";
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.seeyon.apps.src_ydctdatasync.utils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class FormColumn {
|
||||
private String id;
|
||||
private List<FormFieldVo> vos;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public List<FormFieldVo> getVos() {
|
||||
return vos;
|
||||
}
|
||||
|
||||
public void setVos(List<FormFieldVo> vos) {
|
||||
this.vos = vos;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,524 @@
|
||||
package com.seeyon.apps.src_ydctdatasync.utils;
|
||||
|
||||
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.util.JDBCAgent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class FormDataOperator {
|
||||
|
||||
public void updateMasterForm(String formNo, List<FormUpdateField> updateFieldVos, List<FormWhereCondition> 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<FormUpdateField> 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(conditionVo.getDisplay());
|
||||
}
|
||||
continue;
|
||||
}
|
||||
conditionVo.setFieldName(bean.getColumnName());
|
||||
}
|
||||
List<FormWhereCondition> conditions = conditionVos.stream().filter(c -> c.getFieldName() != null).collect(Collectors.toList());
|
||||
Map<String, Object> map = generateSql(updateFields, masterTableBean.getTableName(), conditions);
|
||||
JDBCAgent agent = new JDBCAgent();
|
||||
try {
|
||||
agent.execute((String) map.get("sql"), (List<Object>) map.get("params"));
|
||||
return;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
agent.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public List<FormColumn> queryFormDataCondition(String formNo, List<String> queryColumnVos, List<FormWhereCondition> conditionVos) throws BusinessException {
|
||||
FormApi4Cap4 formApi4Cap4 = (FormApi4Cap4) AppContext.getBean("formApi4Cap4");
|
||||
FormBean cap4FormBean = formApi4Cap4.getFormByFormCode(formNo);
|
||||
List<String> queryColumns = new ArrayList<>();
|
||||
FormTableBean masterTableBean = cap4FormBean.getMasterTableBean();
|
||||
String tableName = masterTableBean.getTableName();
|
||||
Map<String, FormFieldBean> fieldMap4Name = masterTableBean.getFieldMap4Name();
|
||||
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) {
|
||||
continue;
|
||||
}
|
||||
conditionVo.setFieldName(fieldBeanByDisplay.getColumnName());
|
||||
}
|
||||
|
||||
Map<String, Object> generateSql = generateSql(queryColumns, conditionVos, tableName);
|
||||
String sql = (String) generateSql.get("sql");
|
||||
List<Object> params = (List<Object>) generateSql.get("params");
|
||||
JDBCAgent jdbcAgent = new JDBCAgent();
|
||||
List<FormColumn> columns = new ArrayList<>();
|
||||
try {
|
||||
jdbcAgent.execute(sql, params);
|
||||
List list = jdbcAgent.resultSetToList();
|
||||
for (Object o : list) {
|
||||
FormColumn column = new FormColumn();
|
||||
Map<String, Object> columnMap = (Map<String, Object>) o;
|
||||
List<FormFieldVo> vos = new ArrayList<>();
|
||||
for (String key : columnMap.keySet()) {
|
||||
FormFieldVo fieldVo = new FormFieldVo();
|
||||
if (fieldMap4Name.containsKey(key)) {
|
||||
FormFieldBean fieldBean = fieldMap4Name.get(key);
|
||||
fieldVo.setDisplayName(fieldBean.getDisplay());
|
||||
fieldVo.setValue(columnMap.get(key));
|
||||
vos.add(fieldVo);
|
||||
}
|
||||
}
|
||||
column.setVos(vos);
|
||||
if (columnMap.get("id") != null) {
|
||||
column.setId(columnMap.get("id") + "");
|
||||
}
|
||||
columns.add(column);
|
||||
}
|
||||
return columns;
|
||||
} catch (Exception e) {
|
||||
System.out.println(e.getMessage());
|
||||
} finally {
|
||||
jdbcAgent.close();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private Map<String, Object> generateSql(List<String> queryColumn, List<FormWhereCondition> conditions, String tableName) {
|
||||
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<Object> params = new ArrayList<>();
|
||||
sqlBuilder.append(buildWhereClause(conditions,params));
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("sql", sqlBuilder.toString());
|
||||
result.put("params", params);
|
||||
return result;
|
||||
}
|
||||
|
||||
private Map<String, Object> generateSql(List<FormUpdateField> fieldValues, String tableName,List<FormWhereCondition> 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<Object> 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<String, Object> result = new HashMap<>();
|
||||
result.put("sql", sqlBuilder.toString());
|
||||
result.put("params", params);
|
||||
return result;
|
||||
}
|
||||
|
||||
public Map<String,List<Object>> getMainFormTableAttachments(String formNo,Map<String,Object> sourceMap) throws BusinessException {
|
||||
FormApi4Cap4 formApi4Cap4 = (FormApi4Cap4) AppContext.getBean("formApi4Cap4");
|
||||
FormBean cap4FormBean = formApi4Cap4.getFormByFormCode(formNo);
|
||||
FormTableBean masterTableBean = cap4FormBean.getMasterTableBean();
|
||||
Map<String,List<Object>> attachmentTempMap = new HashMap<>();
|
||||
Set<String> 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<Object>)sourceMap.get(key));
|
||||
removeKey.add(key);
|
||||
}
|
||||
}
|
||||
for (String key : removeKey) {
|
||||
sourceMap.remove(key);
|
||||
}
|
||||
return attachmentTempMap;
|
||||
}
|
||||
|
||||
public Map<String,List<Object>> getSubFormTableAttachments(String formNo,Map<String,Object> sourceMap) throws BusinessException {
|
||||
FormApi4Cap4 formApi4Cap4 = (FormApi4Cap4) AppContext.getBean("formApi4Cap4");
|
||||
FormBean cap4FormBean = formApi4Cap4.getFormByFormCode(formNo);
|
||||
List<FormTableBean> subTableBean = cap4FormBean.getSubTableBean();
|
||||
Map<String,List<Object>> 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<Map<String,Object>> tableData = (List<Map<String,Object>>)sourceMap.get(tableName);
|
||||
Set<String> removeKey = new HashSet<>();
|
||||
for (Map<String, Object> 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<Object>)sourceMap.get(key));
|
||||
removeKey.add(key);
|
||||
}
|
||||
}
|
||||
for (String key : removeKey) {
|
||||
rowData.remove(key);
|
||||
}
|
||||
removeKey.clear();
|
||||
}
|
||||
return attachmentTempMap;
|
||||
}
|
||||
|
||||
public void addSubTableRecord(String subTableName,List<Object> data,String formNo,String formId) {
|
||||
JDBCAgent agent = new JDBCAgent();
|
||||
try {
|
||||
FormApi4Cap4 formApi4Cap4 = (FormApi4Cap4) AppContext.getBean("formApi4Cap4");
|
||||
FormBean cap4FormBean = formApi4Cap4.getFormByFormCode(formNo);
|
||||
List<FormTableBean> tableBean = cap4FormBean.getSubTableBean();
|
||||
for (FormTableBean bean : tableBean) {
|
||||
if(!bean.getTableName().equals(subTableName)) {
|
||||
continue;
|
||||
}
|
||||
for (Object column : data) {
|
||||
Map<String,Object> map = (Map<String,Object>) column;
|
||||
Map<String,Object> 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<String, Object> insertSql = generateInsertSql(tempMap, subTableName);
|
||||
agent.execute((String)insertSql.get("sql"),(List<Object>)insertSql.get("params"));
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
} finally {
|
||||
agent.close();
|
||||
}
|
||||
}
|
||||
|
||||
public void rebuildSubTableRecord(String subTableName,List<Object> 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<FormTableBean> tableBean = cap4FormBean.getSubTableBean();
|
||||
for (FormTableBean bean : tableBean) {
|
||||
if(!bean.getTableName().equals(subTableName)) {
|
||||
continue;
|
||||
}
|
||||
for (Object column : data) {
|
||||
Map<String,Object> map = (Map<String,Object>) column;
|
||||
Map<String,Object> 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<String, Object> insertSql = generateInsertSql(tempMap, subTableName);
|
||||
agent.execute((String)insertSql.get("sql"),(List<Object>)insertSql.get("params"));
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
} finally {
|
||||
agent.close();
|
||||
}
|
||||
}
|
||||
|
||||
public void handleEnumDeptEtc(Map<String,Object> map,String formNo) throws BusinessException {
|
||||
FormApi4Cap4 formApi4Cap4 = (FormApi4Cap4) AppContext.getBean("formApi4Cap4");
|
||||
FormBean cap4FormBean = formApi4Cap4.getFormByFormCode(formNo);
|
||||
FormTableBean masterTableBean = cap4FormBean.getMasterTableBean();
|
||||
for (String key : map.keySet()) {
|
||||
FormFieldBean fieldBean = masterTableBean.getFieldBeanByDisplay(key);
|
||||
if(fieldBean == null) {
|
||||
continue;
|
||||
}
|
||||
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<String,Object> map,String formNo) throws BusinessException {
|
||||
FormApi4Cap4 formApi4Cap4 = (FormApi4Cap4) AppContext.getBean("formApi4Cap4");
|
||||
FormBean cap4FormBean = formApi4Cap4.getFormByFormCode(formNo);
|
||||
List<FormTableBean> subTableBean = cap4FormBean.getSubTableBean();
|
||||
for (FormTableBean tableBean : subTableBean) {
|
||||
String tableName = null;
|
||||
for (String key : map.keySet()) {
|
||||
tableName = key;
|
||||
}
|
||||
if(!tableBean.getTableName().equals(tableName)) {
|
||||
continue;
|
||||
}
|
||||
List<Map<String,Object>> subDatas = (List<Map<String, Object>>) map.get(tableName);
|
||||
for (Map<String, Object> 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<String, Object> generateInsertSql(Map<String, Object> 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<Object> params = new ArrayList<>();
|
||||
// 拼接字段名
|
||||
StringBuilder columns = new StringBuilder();
|
||||
// 拼接字段值
|
||||
StringBuilder values = new StringBuilder();
|
||||
for (Map.Entry<String, Object> 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<String, Object> 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<FormWhereCondition> conditions, List<Object> 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());
|
||||
}
|
||||
// 添加参数值
|
||||
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 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.seeyon.apps.src_ydctdatasync.utils;
|
||||
|
||||
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<ValueExport> setFormValue(Map<String, Object> map ){
|
||||
// 创建返回值对象
|
||||
List<ValueExport> valueExports = new ArrayList<ValueExport>();
|
||||
ValueExport valueExport ;
|
||||
// 获取参数信息(显示名称)
|
||||
Set<String> 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<Map<显示名称,数据值>>
|
||||
*/
|
||||
public List<SubordinateFormExport> setSubordinateFormValue(List<Map<String, Object>> lists){
|
||||
List<SubordinateFormExport> subordinateFormExports = new ArrayList<SubordinateFormExport>();
|
||||
SubordinateFormExport subordinateFormExport = new SubordinateFormExport();
|
||||
List<RecordExport> recordExports = new ArrayList<RecordExport>();
|
||||
List<ValueExport> 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<SubordinateFormExport> setAllSubordinateFormValue(List<Map<String,Object>> lists){
|
||||
List<SubordinateFormExport> subordinateFormExports = new ArrayList<SubordinateFormExport>();
|
||||
for (Map<String, Object> list : lists) {
|
||||
SubordinateFormExport subordinateFormExport = new SubordinateFormExport();
|
||||
List<RecordExport> recordExports = new ArrayList<RecordExport>();
|
||||
for (String key : list.keySet()) {
|
||||
List<Map<String,Object>> columns = (List<Map<String, Object>>) list.get(key);
|
||||
for(int i = 0 ; i < columns.size() ; i++) {
|
||||
List<ValueExport> valueExports = setFormValue(columns.get(i));
|
||||
RecordExport recordExport = new RecordExport();
|
||||
recordExport.setRecord(valueExports);
|
||||
recordExports.add(recordExport);
|
||||
}
|
||||
}
|
||||
subordinateFormExport.setValues(recordExports);
|
||||
subordinateFormExports.add(subordinateFormExport);
|
||||
}
|
||||
return subordinateFormExports;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.seeyon.apps.src_ydctdatasync.utils;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.seeyon.apps.src_ydctdatasync.utils;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
package com.seeyon.apps.src_ydctdatasync.utils;
|
||||
|
||||
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 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;
|
||||
}
|
||||
}
|
||||
@@ -136,6 +136,9 @@ public class TimeUtils {
|
||||
}
|
||||
|
||||
public static Date convertLocalDateTime2Date(Object date) {
|
||||
if(date == null) {
|
||||
return null;
|
||||
}
|
||||
if(date instanceof Date) {
|
||||
return (Date)date;
|
||||
}else if(date instanceof LocalDateTime) {
|
||||
@@ -544,4 +547,22 @@ public class TimeUtils {
|
||||
calendar.add(Calendar.MONTH, +1);
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
public static String formatExcludeNull(Date date,DateFormat formater) {
|
||||
if(date == null) {
|
||||
return null;
|
||||
}
|
||||
return formater.format(date);
|
||||
}
|
||||
|
||||
public static Date parseExcludeNull(Object date, DateFormat formater) {
|
||||
if(date == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return formater.parse((String)date);
|
||||
} catch (ParseException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
||||
<beans default-autowire="byName">
|
||||
<bean id="ydzbDataSyncQuartz" class="com.seeyon.apps.src_ydctdatasync.quartz.YdzbDataSyncQuartz">
|
||||
<property name="prod" value="true"/>
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
@@ -6,10 +6,13 @@
|
||||
<property name="config">
|
||||
<bean class="com.seeyon.apps.src_ydctdatasync.config.DataSourceConfig">
|
||||
<property name="driver" value="com.mysql.jdbc.Driver"/>
|
||||
<property name="url" value="jdbc:mysql://127.0.0.1:3306/ydzb_oa?serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true"/>
|
||||
<property name="url" value="jdbc:mysql://10.13.24.40:3316/ydzb_oa?serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true"/>
|
||||
<property name="username" value="root"/>
|
||||
<property name="password" value="123456"/>
|
||||
<property name="password" value="Ydzb!@#123"/>
|
||||
</bean>
|
||||
</property>
|
||||
</bean>
|
||||
<bean id="ydctPluginConfigProvider" class="com.seeyon.apps.src_ydctdatasync.config.YdctPluginConfigProvider">
|
||||
<property name="prod" value="true"/>
|
||||
</bean>
|
||||
</beans>
|
||||
@@ -1,17 +1,17 @@
|
||||
import com.seeyon.ctp.util.LightWeightEncoder;
|
||||
|
||||
/**
|
||||
* 功能描述:<br>
|
||||
* <pre>
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @Author: FanGaowei
|
||||
* @Date: 2023/12/21
|
||||
*/
|
||||
public class Test {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(LightWeightEncoder.encodeString("https://www.baidu.com"));
|
||||
}
|
||||
}
|
||||
//import com.seeyon.ctp.util.LightWeightEncoder;
|
||||
//
|
||||
///**
|
||||
// * 功能描述:<br>
|
||||
// * <pre>
|
||||
// *
|
||||
// * </pre>
|
||||
// *
|
||||
// * @Author: FanGaowei
|
||||
// * @Date: 2023/12/21
|
||||
// */
|
||||
//public class Test {
|
||||
//
|
||||
// public static void main(String[] args) {
|
||||
// System.out.println(LightWeightEncoder.encodeString("https://www.baidu.com"));
|
||||
// }
|
||||
//}
|
||||
|
||||
7
v5/apps-customize/src/test/java/Test2.java
Normal file
7
v5/apps-customize/src/test/java/Test2.java
Normal file
@@ -0,0 +1,7 @@
|
||||
import com.seeyon.apps.src_ydctdatasync.quartz.YdzbDataSyncQuartz;
|
||||
|
||||
public class Test2 {
|
||||
public static void main(String[] args) {
|
||||
YdzbDataSyncQuartz quartz = new YdzbDataSyncQuartz();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user