Merge remote-tracking branch 'origin/develop' into develop

develop
hanrenchun 10 months ago
commit dac20b147c

@ -151,5 +151,7 @@ public class VSySyfwMysql {
private String YSBZK_GXSJ; private String YSBZK_GXSJ;
@TableField(value = "STATUS") @TableField(value = "STATUS")
private String STATUS; private String STATUS;
} }

@ -1,138 +1,143 @@
package com.ssf.mysqloracletest.domain; package com.ssf.mysqloracletest.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
@Data @Data
@TableName(value = "v_sy_syfw")
public class VSySyfwOracle { public class VSySyfwOracle {
private String ZJLID;
@TableField(value = "ZJLID")
private String ZJLID;
@TableField(value = "YSXTJRZJ")
private String YSXTJRZJ; private String YSXTJRZJ;
@TableField(value = "XXSC_PDBZ")
private String XXSC_PDBZ; private String XXSC_PDBZ;
@TableField(value = "DAH")
private String DAH; private String DAH;
@TableField(value = "JCWH")
private String JCWH; private String JCWH;
@TableField(value = "FWID")
private String FWID; private String FWID;
@TableField(value = "FWLX")
private String FWLX; private String FWLX;
@TableField(value = "FWDZ")
private String FWDZ; private String FWDZ;
@TableField(value = "FWXZ")
private String FWXZ; private String FWXZ;
@TableField(value = "FWLB")
private String FWLB; private String FWLB;
@TableField(value = "FWJG")
private String FWJG; private String FWJG;
@TableField(value = "FJS")
private String FJS; private String FJS;
@TableField(value = "MJ")
private String MJ; private String MJ;
@TableField(value = "CZYT")
private String CZYT; private String CZYT;
@TableField(value = "DJRQ")
private String DJRQ; private String DJRQ;
//姓名 @TableField(value = "XM")
private String XM; private String XM;
@TableField(value = "SFZH")
private String SFZH; private String SFZH;
@TableField(value = "XB")
private String XB; private String XB;
@TableField(value = "HJDQX")
private String HJDQX; private String HJDQX;
@TableField(value = "HJDXZ")
private String HJDXZ; private String HJDXZ;
@TableField(value = "XZDQX")
private String XZDQX; private String XZDQX;
@TableField(value = "XZDXZ")
private String XZDXZ; private String XZDXZ;
@TableField(value = "DWMC")
private String DWMC; private String DWMC;
@TableField(value = "DWXZ")
private String DWXZ; private String DWXZ;
@TableField(value = "LXDH")
private String LXDH; private String LXDH;
@TableField(value = "LRRID")
private String LRRID; private String LRRID;
@TableField(value = "LRR")
private String LRR; private String LRR;
@TableField(value = "LRSJ")
private String LRSJ; private String LRSJ;
@TableField(value = "XGRID")
private String XGRID; private String XGRID;
@TableField(value = "XGRXM")
private String XGRXM; private String XGRXM;
@TableField(value = "XGSJ")
private String XGSJ; private String XGSJ;
@TableField(value = "TBBS")
private String TBBS; private String TBBS;
@TableField(value = "TBSJ")
private String TBSJ; private String TBSJ;
@TableField(value = "MEMO")
private String MEMO; private String MEMO;
@TableField(value = "BZ")
private String BZ; private String BZ;
@TableField(value = "DQRQ")
private String DQRQ; private String DQRQ;
@TableField(value = "SJFWID")
private String SJFWID; private String SJFWID;
@TableField(value = "DYHCODE")
private String DYHCODE; private String DYHCODE;
@TableField(value = "PCSDM")
private String PCSDM; private String PCSDM;
@TableField(value = "JWQID")
private String JWQID; private String JWQID;
@TableField(value = "SSYS")
private String SSYS; private String SSYS;
@TableField(value = "SNO")
private String SNO; private String SNO;
@TableField(value = "ZXRQ")
private String ZXRQ; private String ZXRQ;
@TableField(value = "ZXYY")
private String ZXYY; private String ZXYY;
@TableField(value = "LKBZDZID")
private String LKBZDZID; private String LKBZDZID;
@TableField(value = "LKBZDZMC")
private String LKBZDZMC; private String LKBZDZMC;
@TableField(value = "FWZT")
private String FWZT; private String FWZT;
@TableField(value = "CZFWBM")
private String CZFWBM; private String CZFWBM;
@TableField(value = "CZFWQM")
private String CZFWQM; private String CZFWQM;
@TableField(value = "TBMEMO")
private String TBMEMO; private String TBMEMO;
@TableField(value = "SFCZ")
private String SFCZ; private String SFCZ;
@TableField(value = "JZLX")
private String JZLX; private String JZLX;
@TableField(value = "FWDJ")
private String FWDJ; private String FWDJ;
@TableField(value = "ZDFW")
private String ZDFW; private String ZDFW;
@TableField(value = "ZDRY")
private String ZDRY; private String ZDRY;
@TableField(value = "SFQZ")
private String SFQZ; private String SFQZ;
@TableField(value = "ZJLX")
private String ZJLX; private String ZJLX;
@TableField(value = "ZFLX")
private String ZFLX; private String ZFLX;
@TableField(value = "CWS")
private String CWS; private String CWS;
@TableField(value = "CZRZJLX")
private String CZRZJLX; private String CZRZJLX;
@TableField(value = "CZRZJHM")
private String CZRZJHM; private String CZRZJHM;
@TableField(value = "CZRXM")
private String CZRXM; private String CZRXM;
@TableField(value = "CZRLXDH")
private String CZRLXDH; private String CZRLXDH;
@TableField(value = "CDC_JYM")
private String CDC_JYM; private String CDC_JYM;
@TableField(value = "YSBZK_RKSJ")
private String YSBZK_RKSJ; private String YSBZK_RKSJ;
@TableField(value = "YSBZK_GXSJ")
private String YSBZK_GXSJ; private String YSBZK_GXSJ;
} }

@ -7,17 +7,15 @@ import com.ssf.mysqloracletest.domain.VSySyfwMysql;
import com.ssf.mysqloracletest.service.MetaRentalHousingInfoService; import com.ssf.mysqloracletest.service.MetaRentalHousingInfoService;
import com.ssf.mysqloracletest.service.VSySyfwMysqlService; import com.ssf.mysqloracletest.service.VSySyfwMysqlService;
import com.ssf.mysqloracletest.utils.ConfigParam; import com.ssf.mysqloracletest.utils.ConfigParam;
import com.ssf.mysqloracletest.utils.NumKit;
import com.ssf.mysqloracletest.utils.StringKit; import com.ssf.mysqloracletest.utils.StringKit;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
@ -25,133 +23,175 @@ import java.util.concurrent.Executors;
@Component @Component
public class RentalHousingTask { public class RentalHousingTask {
private static final Logger logger = LoggerFactory.getLogger(RentalHousingTask.class); private static final Logger logger = LoggerFactory.getLogger(RentalHousingTask.class);
@Resource @Resource
private VSySyfwMysqlService syfwMysqlService; private VSySyfwMysqlService syfwMysqlService;
@Resource @Resource
private MetaRentalHousingInfoService rentalHousingInfoService; private MetaRentalHousingInfoService rentalHousingInfoService;
final int oncesCounts = NumKit.checkInt(ConfigParam.oncesCounts) == 0 ? 10000 : NumKit.checkInt(ConfigParam.oncesCounts);
private boolean rentalhouseTag = false;
@Scheduled(initialDelay = 100, fixedDelay = 3000) @Scheduled(initialDelay = 100, fixedDelay = 3000)
public void transRentalHouse() { public void transRentalHouse() {
if (rentalhouseTag) {
return;
}
if (!"true".equals(ConfigParam.RentalHouseSwitch)) { if (!"true".equals(ConfigParam.RentalHouseSwitch)) {
return; return;
} }
try { try {
int countRentalHouse = syfwMysqlService.countSyfw(); QueryWrapper<VSySyfwMysql> queryWrapper = new QueryWrapper<>();
logger.info("countRentalHouse:" + countRentalHouse); queryWrapper.isNull("STATUS");
Page<VSySyfwMysql> page = new Page<>(1, 1000);
if (countRentalHouse > 0) { List<VSySyfwMysql> resultList = syfwMysqlService.page(page, queryWrapper).getRecords();
rentalhouseTag = true;
CountDownLatch latch = new CountDownLatch(resultList.size());
int count = countRentalHouse / oncesCounts; ExecutorService SyfwPool = Executors.newFixedThreadPool(5);
CountDownLatch latch = new CountDownLatch(count);
ExecutorService RentalHousePool = Executors.newFixedThreadPool(5); for (VSySyfwMysql bean: resultList) {
SyfwPool.submit(() -> {
for (int i = 0; i <= count; i++) { cleanSyfw(bean);
Map HouseMap = new HashMap(); logger.info("清洗完成");
HouseMap.put("rowStart", i * oncesCounts); latch.countDown();
HouseMap.put("rowEnd", (i + 1) * oncesCounts); });
RentalHousePool.submit(() -> { }
try {
//List<VSySyfwMysql> RentalHouses = syfwMysqlService.lambdaQuery().isNull(VSySyfwMysql::getSTATUS).list(); try {
// 创建分页参数 //Wait for all threads to complete
Page<VSySyfwMysql> page = new Page<>(1, 1000); latch.await();
// 构建查询条件 } catch (InterruptedException e) {
QueryWrapper<VSySyfwMysql> queryWrapper = new QueryWrapper<>(); e.printStackTrace();
queryWrapper.isNull("STATUS"); }
// 进行分页查询 //关闭线程池
syfwMysqlService.page(page, queryWrapper); SyfwPool.shutdown();
// 获取分页查询结果 } catch (Exception e) {
List<VSySyfwMysql> rentalHouses = page.getRecords(); logger.info(StringKit.getTrace(e));
if (rentalHouses == null) { }
return; }
}
for (VSySyfwMysql House : rentalHouses) { private void cleanSyfw(VSySyfwMysql bean) {
MetaRentalHousingInfo metaRentalHousingInfo = new MetaRentalHousingInfo(); VSySyfwMysql syfwMysqlCp = new VSySyfwMysql();
//rental_housing_address出租房屋地址<-----FWDZ房屋地址 try {
metaRentalHousingInfo.setRentalHousingAddress(House.getFWDZ()); BeanUtils.copyProperties(bean, syfwMysqlCp);
//homeowner房主<-----XM MetaRentalHousingInfo metaRentalHousingInfo = new MetaRentalHousingInfo();
metaRentalHousingInfo.setHomeowner(House.getXM()); //rental_housing_address出租房屋地址<-----FWDZ房屋地址
//homeowner_id_card房主身份证<-----SFZH metaRentalHousingInfo.setRentalHousingAddress(syfwMysqlCp.getFWDZ());
metaRentalHousingInfo.setHomeownerIdCard(House.getSFZH()); //homeowner房主<-----XM
//homeowner_house_hold_register房主户籍地区县<-----HJDQX户籍辖区 metaRentalHousingInfo.setHomeowner(syfwMysqlCp.getXM());
metaRentalHousingInfo.setHomeownerHouseHoldRegister(House.getHJDQX()); //homeowner_id_card房主身份证<-----SFZH
//homeowner_house_hold_address户籍地址详情<-----HJDXZ户籍地详址 metaRentalHousingInfo.setHomeownerIdCard(syfwMysqlCp.getSFZH());
metaRentalHousingInfo.setHomeownerHouseHoldAddress(House.getHJDXZ()); //homeowner_house_hold_register房主户籍地区县<-----HJDQX户籍辖区
//homeowner_habitation_register房主现居住地区县<-----XZDQX现住地辖区 metaRentalHousingInfo.setHomeownerHouseHoldRegister(syfwMysqlCp.getHJDQX());
metaRentalHousingInfo.setHomeownerHabitationRegister(House.getXZDQX()); //homeowner_house_hold_address户籍地址详情<-----HJDXZ户籍地详址
//homeowner_habitation_address房主现居住地<-----XZDXZ现住地详址 metaRentalHousingInfo.setHomeownerHouseHoldAddress(syfwMysqlCp.getHJDXZ());
metaRentalHousingInfo.setHomeownerHabitationAddress(House.getXZDXZ()); //homeowner_habitation_register房主现居住地区县<-----XZDQX现住地辖区
//homeowner_phone房主联系方式<-----LXDH联系电话 metaRentalHousingInfo.setHomeownerHabitationRegister(syfwMysqlCp.getXZDQX());
metaRentalHousingInfo.setHomeownerPhone(House.getLXDH()); //homeowner_habitation_address房主现居住地<-----XZDXZ现住地详址
//state_flag表示状态:0有效1无效<-----BZ metaRentalHousingInfo.setHomeownerHabitationAddress(syfwMysqlCp.getXZDXZ());
metaRentalHousingInfo.setStateFlag(Integer.parseInt(House.getBZ())); //homeowner_phone房主联系方式<-----LXDH联系电话
//rental_housing_end_date出租房到期时间<-----DQRQ metaRentalHousingInfo.setHomeownerPhone(syfwMysqlCp.getLXDH());
metaRentalHousingInfo.setRentalHousingEndDate(House.getDQRQ()); //state_flag表示状态:0有效1无效<-----BZ
//police_station_code派出所代码<-----PCSDM metaRentalHousingInfo.setStateFlag(Integer.parseInt(syfwMysqlCp.getBZ()));
metaRentalHousingInfo.setPoliceStationCode(House.getPCSDM()); //rental_housing_end_date出租房到期时间<-----DQRQ
//police_district_code警务区编码<-----JWQID metaRentalHousingInfo.setRentalHousingEndDate(syfwMysqlCp.getDQRQ());
metaRentalHousingInfo.setPoliceDistrictCode(House.getJWQID()); //police_station_code派出所代码<-----PCSDM
//floating_population_standard_address_id流动人口标准地址id<-----LKBZDZID metaRentalHousingInfo.setPoliceStationCode(syfwMysqlCp.getPCSDM());
metaRentalHousingInfo.setFloatingPopulationStandardAddressId(House.getLKBZDZID()); //police_district_code警务区编码<-----JWQID
//floating_population_standard_address流动人口标准地址<-----LKBZDZMC metaRentalHousingInfo.setPoliceDistrictCode(syfwMysqlCp.getJWQID());
metaRentalHousingInfo.setFloatingPopulationStandardAddress(House.getLKBZDZMC()); //floating_population_standard_address_id流动人口标准地址id<-----LKBZDZID
//rental_housing_status出租房状态<-----FWZT metaRentalHousingInfo.setFloatingPopulationStandardAddressId(syfwMysqlCp.getLKBZDZID());
metaRentalHousingInfo.setRentalHousingStatus(Integer.parseInt(House.getFWZT())); //floating_population_standard_address流动人口标准地址<-----LKBZDZMC
//is_rental_housing是否出租<-----SFCZY,N metaRentalHousingInfo.setFloatingPopulationStandardAddress(syfwMysqlCp.getLKBZDZMC());
metaRentalHousingInfo.setIsRentalHousing(Integer.parseInt(House.getSFCZ())); //rental_housing_status出租房状态<-----FWZT
//residential_type居住类型<-----JZLX metaRentalHousingInfo.setRentalHousingStatus(Integer.parseInt(syfwMysqlCp.getFWZT()));
metaRentalHousingInfo.setResidentialType(Integer.parseInt(House.getJZLX())); //is_rental_housing是否出租<-----SFCZY,N
//rental_housing_grade房屋等级<-----FWDJ try {
metaRentalHousingInfo.setRentalHousingGrade(Integer.parseInt(House.getFWDJ())); if ("Y".equals(syfwMysqlCp.getSFCZ())) {
//imp_rental_housing重点房屋<-----ZDFW metaRentalHousingInfo.setIsRentalHousing(1);
metaRentalHousingInfo.setImpRentalHousing(Integer.parseInt(House.getZDFW())); } else if ("N".equals(syfwMysqlCp.getSFCZ())) {
//imp_user_rental_housing重点人员<-----ZDRY metaRentalHousingInfo.setIsRentalHousing(0);
metaRentalHousingInfo.setImpUserRentalHousing(Integer.parseInt(House.getZDRY())); } else {
//is_group_rental_housing是否群租房<-----SFQZ // 处理其他情况,如果有的话
metaRentalHousingInfo.setIsGroupRentalHousing(Integer.parseInt(House.getSFQZ())); metaRentalHousingInfo.setIsRentalHousing(null);
//rental_housing_type住房类型<-----ZFLX
metaRentalHousingInfo.setRentalHousingType(Integer.parseInt(House.getZFLX()));
//renting_house_user_name租房人姓名<----- CZRXM
metaRentalHousingInfo.setRentingHouseUserName(House.getCZRXM());
//renting_house_user_phone租房人联系方式<-----CZRLXDH
metaRentalHousingInfo.setRentingHouseUserPhone(House.getCZRLXDH());
//renting_house_user_id_card租房人证件号码<-----CZRZJHM
metaRentalHousingInfo.setRentingHouseUserIdCard(House.getCZRZJHM());
//将STATUS设成1
House.setSTATUS("1");
logger.info("插入成功");
}
} catch (Exception e) {
logger.info("rentalHouses"+ StringKit.getTrace(e));
}
latch.countDown();
});
logger.info("rentalhouseTag数据总理:" + countRentalHouse + "," + "当前处理下标:" + HouseMap.get("rowStart") + "/" + HouseMap.get("rowEnd"));
} }
} catch (NumberFormatException e) {
// 处理转换异常
System.err.println("无法将字符串转换为整数:" + e.getMessage());
}
//residential_type居住类型<-----JZLX
if (syfwMysqlCp.getJZLX() != null) {
metaRentalHousingInfo.setResidentialType(Integer.parseInt(syfwMysqlCp.getJZLX()));
} else {
metaRentalHousingInfo.setResidentialType(null);
}
//rental_housing_grade房屋等级<-----FWDJ
if (syfwMysqlCp.getFWDJ() != null) {
metaRentalHousingInfo.setRentalHousingGrade(Integer.parseInt(syfwMysqlCp.getFWDJ()));
} else {
metaRentalHousingInfo.setRentalHousingGrade(null);
}
//imp_rental_housing重点房屋<-----ZDFW
if (syfwMysqlCp.getZDFW() != null) {
if (syfwMysqlCp.getZDFW().equals("21")) {
metaRentalHousingInfo.setImpRentalHousing(21);
} else if (syfwMysqlCp.getZDFW().equals("22")) {
metaRentalHousingInfo.setImpRentalHousing(22);
}
} else {
metaRentalHousingInfo.setImpRentalHousing(null);
}
//imp_user_rental_housing重点人员<-----ZDRY
if (syfwMysqlCp.getZDRY() != null) {
if (syfwMysqlCp.getZDRY().equals("27")) {
metaRentalHousingInfo.setImpUserRentalHousing(27);
} else if (syfwMysqlCp.getZDRY().equals("35")) {
metaRentalHousingInfo.setImpUserRentalHousing(35);
}
} else {
metaRentalHousingInfo.setImpUserRentalHousing(null);
}
try { //is_group_rental_housing是否群租房<-----SFQZ
//Wait for all threads to complete try {
latch.await(); if ("Y".equals(syfwMysqlCp.getSFQZ())) {
} catch (InterruptedException e) { metaRentalHousingInfo.setIsGroupRentalHousing(1);
e.printStackTrace(); } else if ("N".equals(syfwMysqlCp.getSFQZ())) {
metaRentalHousingInfo.setIsGroupRentalHousing(0);
} else {
metaRentalHousingInfo.setIsGroupRentalHousing(null);
} }
//关闭线程池 } catch (NumberFormatException e) {
RentalHousePool.shutdown(); // 处理转换异常
System.err.println("无法将字符串转换为整数:" + e.getMessage());
}
//rental_housing_type住房类型<-----ZFLX
if (syfwMysqlCp.getZFLX() != null) {
metaRentalHousingInfo.setRentalHousingType(Integer.parseInt(syfwMysqlCp.getZFLX()));
} else {
metaRentalHousingInfo.setRentalHousingType(null);
}
//renting_house_user_name租房人姓名<----- CZRXM
metaRentalHousingInfo.setRentingHouseUserName(syfwMysqlCp.getCZRXM());
//renting_house_user_phone租房人联系方式<-----CZRLXDH
metaRentalHousingInfo.setRentingHouseUserPhone(syfwMysqlCp.getCZRLXDH());
//renting_house_user_id_card租房人证件号码<-----CZRZJHM
metaRentalHousingInfo.setRentingHouseUserIdCard(syfwMysqlCp.getCZRZJHM());
boolean b = rentalHousingInfoService.save(metaRentalHousingInfo);
if (b) {
syfwMysqlCp.setSTATUS("1");
syfwMysqlService.updateVSySyfwById(syfwMysqlCp);
logger.info("状态修改为1");
} }
} catch (Exception e) { } catch (Exception e) {
logger.info(StringKit.getTrace(e)); logger.info(StringKit.getTrace(e));
syfwMysqlCp.setSTATUS("2");
syfwMysqlService.updateVSySyfwById(syfwMysqlCp);
logger.info("状态修改为2");
} }
} }
} }

@ -223,7 +223,8 @@
<if test="CDC_JYM != null and CDC_JYM != '' ">#{CDC_JYM},</if> <if test="CDC_JYM != null and CDC_JYM != '' ">#{CDC_JYM},</if>
<if test="YSBZK_RKSJ != null and YSBZK_RKSJ != '' ">#{YSBZK_RKSJ},</if> <if test="YSBZK_RKSJ != null and YSBZK_RKSJ != '' ">#{YSBZK_RKSJ},</if>
<if test="YSBZK_GXSJ != null and YSBZK_GXSJ != '' ">#{YSBZK_GXSJ},</if> <if test="YSBZK_GXSJ != null and YSBZK_GXSJ != '' ">#{YSBZK_GXSJ},</if>
c </trim> <if test="STATUS != null and STATUS != '' ">#{STATUS},</if>
</trim>
</insert> </insert>
<update id="updateVSySyfwById" parameterType="com.ssf.mysqloracletest.domain.VSySyfwMysql"> <update id="updateVSySyfwById" parameterType="com.ssf.mysqloracletest.domain.VSySyfwMysql">
@ -297,14 +298,13 @@ c </trim>
<if test="YSBZK_RKSJ != null and YSBZK_RKSJ != '' ">YSBZK_RKSJ=#{YSBZK_RKSJ},</if> <if test="YSBZK_RKSJ != null and YSBZK_RKSJ != '' ">YSBZK_RKSJ=#{YSBZK_RKSJ},</if>
<if test="YSBZK_GXSJ != null and YSBZK_GXSJ != '' ">YSBZK_GXSJ=#{YSBZK_GXSJ},</if> <if test="YSBZK_GXSJ != null and YSBZK_GXSJ != '' ">YSBZK_GXSJ=#{YSBZK_GXSJ},</if>
<if test="STATUS != null and STATUS != '' ">STATUS=#{STATUS},</if> <if test="STATUS != null and STATUS != '' ">STATUS=#{STATUS},</if>
</trim> </trim>
where ZJLID = #{ZJLID} where ZJLID = #{ZJLID}
</update> </update>
<select id="countSyfw" resultType="int"> <select id="countSyfw" resultType="int">
select count(*) select count(*)
from V_SY_SYFW from V_SY_SYFW limit 1
</select> </select>
</mapper> </mapper>
Loading…
Cancel
Save