宜都城投资产数据同步插件 调整插父级资产的策略

This commit is contained in:
2025-01-23 14:07:55 +08:00
parent 2575510aee
commit de12030498
3 changed files with 129 additions and 54 deletions

View File

@@ -44,31 +44,31 @@ public class BzfAssetMode extends AbstractAssetDataMapMode{
}
private void enumMap(Map<String, Object> sourceMap) {
String xqzcpLevelValue = EnumMapUtils.getEnumItemValue(zcRootPcode, agent, "资产等级", "父级");
String zcTypeFwValue = EnumMapUtils.getEnumItemValue(zcRootPcode, agent, "资产类型", "房屋");
// 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 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 house_use = EnumMapUtils.getEnumItemValue(zcRootPcode, agent, "房屋用途", (String) sourceMap.get("house_use"));
String rental_type = EnumMapUtils.getEnumItemValue(zcRootPcode, agent, "租售类型", (String) sourceMap.get("rental_type"));
String xqrental_type = EnumMapUtils.getEnumItemValue(zcRootPcode, agent, "租售类型", "只租不售");
String xqhs = EnumMapUtils.getEnumItemValue(zcRootPcode, agent, "房屋体系", "保租房");
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("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);
sourceMap.put("zcTypeFwValue", zcTypeFwValue);
sourceMap.put("zcTypeLevel2", zcTypeLevel2);
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);
sourceMap.put("house_use", house_use);
sourceMap.put("rental_type", rental_type);
sourceMap.put("house_system", hs);
@@ -85,43 +85,43 @@ public class BzfAssetMode extends AbstractAssetDataMapMode{
//处理小区资产档案信息
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();
}
// 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();
// }
}
private String getCreatorDept(String loginName) {

View File

@@ -16,6 +16,7 @@ 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.EnumMapUtils;
import com.seeyon.apps.src_ydctdatasync.utils.StatementQueryUtil;
import com.seeyon.apps.src_ydctdatasync.utils.TimeUtils;
import com.seeyon.cap4.form.api.FormApi4Cap4;
@@ -24,6 +25,9 @@ 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;
@@ -87,8 +91,9 @@ public class YdzbDataSyncQuartz extends AbstractQuartzTask implements Disposable
@Override
public String taskRun(String arg0) {
if (!"-1".equals(arg0)) {
if ("-1".equals(arg0)) {
log.info("宜都城投资产数据同步任务不执行");
return null;
}
log.info("宜都城投资产数据同步任务开始");
long startTime = System.currentTimeMillis();
@@ -373,8 +378,76 @@ public class YdzbDataSyncQuartz extends AbstractQuartzTask implements Disposable
log.info("国资厂房数据同步完成");
}
private String getCreatorDept(String loginName) {
OrgManager orgManager = (OrgManager) AppContext.getBean("orgManager");
try {
V3xOrgMember member = orgManager.getMemberByLoginName(loginName);
Long departmentId = member.getOrgDepartmentId();
V3xOrgDepartment department = orgManager.getDepartmentById(departmentId);
return department == null ? "" : department.getName();
} catch (BusinessException e) {
return null;
}
}
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 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);
if (resList != null && resList.size() > 0) {
for (Map<String, Object> mapT : resList) {
List<String> params = new ArrayList<>();
String villageQuerySql = "SELECT 1 FROM " + getBizConfigByKey(YdzbdataSyncConstants.zcTable) + " WHERE field0027 = ? and field0023 = ? and field0037 =?;";
params.add(xqzcpLevelValue);
params.add(zcTypeFwValue);
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");
if (list == null || list.isEmpty()) {
//保障性住房小区的资产信息若不存在,则插入
Map<String, String> villageInsertInfo = new HashMap<>();
villageInsertInfo.put("建档部门", getCreatorDept(getBizConfigByKey(YdzbdataSyncConstants.loginName)));//建档部门
villageInsertInfo.put("建档人员", "系统管理员");//建档人员
villageInsertInfo.put("建档日期", df.format(new Date()));//建档日期
villageInsertInfo.put("资产板块", xqzcBlock);//资产板块
villageInsertInfo.put("建档单位", "住保置业");//建档单位
villageInsertInfo.put("资产层级", xqzcpLevelValue);//资产层级
villageInsertInfo.put("数据来源", "住保资产系统(自定义)");//数据来源
villageInsertInfo.put("资产名称", mapT.get("village_name") + "");//资产名称
villageInsertInfo.put("资产状态", xqzcStatus);//资产状态
villageInsertInfo.put("资产性质", xqzcFeature);//资产性质
villageInsertInfo.put("资产类型", zcTypeFwValue);//资产类型
villageInsertInfo.put("资产二级类型", zcTypeLevel2);//资产二级类型
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") + "")); //是否产权抵押
FormExport formExport = new FormExport();
formExport.setValues(FormExportUtil.setFormValue(villageInsertInfo));
getFormFactory().importBusinessFormData(getBizConfigByKey(YdzbdataSyncConstants.loginName), getBizConfigByKey(YdzbdataSyncConstants.zcFormNo), formExport, new String[]{});
}
}
}
}
private void processBzfHouseData(Connection connection) throws SQLException, BusinessException, ServiceException {
log.info("开始同步保障房数据");
handleParentXzData(connection);
String countQuerySql = "SELECT count(*) FROM zb_bzf_house;";
String pageQuerySql = "SELECT * FROM zb_bzf_house limit 100 OFFSET ?;";
BzfAssetMode bzfAssetMode = new BzfAssetMode();

View File

@@ -20,7 +20,9 @@ public class StatementQueryUtil {
try (PreparedStatement preparedStatement = connection.prepareStatement(sql)) {
// 设置参数
for (int i = 0; params != null && i < params.length; i++) {
preparedStatement.setObject(i + 1, params[i]);
if(params[i] != null) {
preparedStatement.setObject(i + 1, params[i]);
}
}
// 执行查询