从业人员数据清洗,重点人员和处警人员逻辑修改

develop
hanrenchun 11 months ago
parent 6cb1e9f03b
commit 7f8a739b16

@ -14,8 +14,9 @@ cyrySwitch=false
JjxxSwitch=false JjxxSwitch=false
#------------------------?????---------------------------- #------------------------?????----------------------------
NewNsydwSwitch=false NewNsydwSwitch=false
metaImpUserSwitch=false metaImpUserSwitch=true
NewNalarminfoSwitch=true NewNalarminfoSwitch=false
metaHandleAlarmSwitch=false
metaActualUnitUserInfoSwitch=false

@ -0,0 +1,106 @@
package com.ssf.mysqloracletest.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
*
* @TableName meta_actual_unit_user_info
*/
@TableName(value ="meta_actual_unit_user_info")
@Data
public class MetaActualUnitUserInfo implements Serializable {
/**
*
*/
@TableId(type = IdType.AUTO)
private Long id;
/**
* id
*/
private Long unitId;
/**
*
*/
private String unitName;
/**
*
*/
private String staffPic;
/**
*
*/
private String staffName;
/**
*
*/
private String identityId;
/**
*
*/
private String contactInfo;
/**
*
*/
private Integer sex;
/**
*
*/
private Integer staffType;
/**
*
*/
private Integer staffState;
/**
*
*/
private String metaCreateTime;
/**
*
*/
private String metaUpdateTime;
/**
*
*/
private Date createTime;
/**
*
*/
private Integer createBy;
/**
*
*/
private Date updateTime;
/**
*
*/
private Integer updateBy;
/**
* 0:,1:
*/
private Integer isActive;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}

@ -1,5 +1,7 @@
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;
import java.io.Serializable; import java.io.Serializable;
@ -8,23 +10,38 @@ import java.io.Serializable;
* @TableName v_sy_sydw_cyry * @TableName v_sy_sydw_cyry
*/ */
@Data @Data
@TableName(value = "v_sy_sydw_cyry")
public class VSySydwCyryMysql implements Serializable { public class VSySydwCyryMysql implements Serializable {
/** /**
* *
*/ */
@TableField(value = "ID")
private String ID; private String ID;
@TableField(value = "DWID")
private String DWID; private String DWID;
@TableField(value = "GJ")
private String GJ; private String GJ;
@TableField(value = "ZJLX")
private String ZJLX; private String ZJLX;
@TableField(value = "ZJHM")
private String ZJHM; private String ZJHM;
@TableField(value = "XM")
private String XM; private String XM;
@TableField(value = "XB")
private String XB; private String XB;
@TableField(value = "MZ")
private String MZ; private String MZ;
@TableField(value = "LXDH")
private String LXDH; private String LXDH;
@TableField(value = "ZT")
private String ZT; private String ZT;
@TableField(value = "RYFL")
private String RYFL; private String RYFL;
@TableField(value = "YSBZK_RKSJ")
private String YSBZK_RKSJ; private String YSBZK_RKSJ;
@TableField(value = "YSBZK_GXSJ")
private String YSBZK_GXSJ; private String YSBZK_GXSJ;
@TableField(value = "DWMC")
private String DWMC; private String DWMC;
} }

@ -0,0 +1,18 @@
package com.ssf.mysqloracletest.mapper;
import com.ssf.mysqloracletest.domain.MetaActualUnitUserInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @author 28758
* @description meta_actual_unit_user_info()Mapper
* @createDate 2023-12-02 10:31:32
* @Entity com.ssf.mysqloracletest.domain.MetaActualUnitUserInfo
*/
public interface MetaActualUnitUserInfoMapper extends BaseMapper<MetaActualUnitUserInfo> {
}

@ -1,5 +1,6 @@
package com.ssf.mysqloracletest.mapper; package com.ssf.mysqloracletest.mapper;
import com.ssf.mysqloracletest.domain.VSySydwCyryOracle;
import com.ssf.mysqloracletest.domain.VSySydwmMysql; import com.ssf.mysqloracletest.domain.VSySydwmMysql;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ssf.mysqloracletest.domain.VSySydzMysql; import com.ssf.mysqloracletest.domain.VSySydzMysql;
@ -12,7 +13,7 @@ import org.apache.ibatis.annotations.Mapper;
* @Entity com.ssf.mysqloracletest.domain.VSySydw * @Entity com.ssf.mysqloracletest.domain.VSySydw
*/ */
@Mapper @Mapper
public interface VSySydwMysqlMapper { public interface VSySydwMysqlMapper extends BaseMapper<VSySydwmMysql> {
public VSySydwmMysql selectVSySydwByZJLID(String ZJLID); public VSySydwmMysql selectVSySydwByZJLID(String ZJLID);
public int insertVSySydw(VSySydwmMysql bean); public int insertVSySydw(VSySydwmMysql bean);

@ -0,0 +1,13 @@
package com.ssf.mysqloracletest.service;
import com.ssf.mysqloracletest.domain.MetaActualUnitUserInfo;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author 28758
* @description meta_actual_unit_user_info()Service
* @createDate 2023-12-02 10:31:32
*/
public interface MetaActualUnitUserInfoService extends IService<MetaActualUnitUserInfo> {
}

@ -1,5 +1,7 @@
package com.ssf.mysqloracletest.service; package com.ssf.mysqloracletest.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ssf.mysqloracletest.domain.VSySydwCyryMysql;
import com.ssf.mysqloracletest.domain.VSySydwmMysql; import com.ssf.mysqloracletest.domain.VSySydwmMysql;
import com.ssf.mysqloracletest.domain.VSySydzMysql; import com.ssf.mysqloracletest.domain.VSySydzMysql;
@ -8,7 +10,7 @@ import com.ssf.mysqloracletest.domain.VSySydzMysql;
* @description v_sy_sydwService * @description v_sy_sydwService
* @createDate 2023-11-29 22:43:38 * @createDate 2023-11-29 22:43:38
*/ */
public interface VSySydwMysqlService { public interface VSySydwMysqlService extends IService<VSySydwmMysql> {
public VSySydwmMysql selectVSySydwByZJLID(String ZJLID); public VSySydwmMysql selectVSySydwByZJLID(String ZJLID);
public int insertVSySydw(VSySydwmMysql sydw); public int insertVSySydw(VSySydwmMysql sydw);

@ -0,0 +1,22 @@
package com.ssf.mysqloracletest.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ssf.mysqloracletest.domain.MetaActualUnitUserInfo;
import com.ssf.mysqloracletest.service.MetaActualUnitUserInfoService;
import com.ssf.mysqloracletest.mapper.MetaActualUnitUserInfoMapper;
import org.springframework.stereotype.Service;
/**
* @author 28758
* @description meta_actual_unit_user_info()Service
* @createDate 2023-12-02 10:31:32
*/
@Service
public class MetaActualUnitUserInfoServiceImpl extends ServiceImpl<MetaActualUnitUserInfoMapper, MetaActualUnitUserInfo>
implements MetaActualUnitUserInfoService{
}

@ -1,7 +1,10 @@
package com.ssf.mysqloracletest.service.impl; package com.ssf.mysqloracletest.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ssf.mysqloracletest.domain.VSySydwCyryMysql;
import com.ssf.mysqloracletest.domain.VSySydwmMysql; import com.ssf.mysqloracletest.domain.VSySydwmMysql;
import com.ssf.mysqloracletest.mapper.VSySydwCyryMysqlMapper;
import com.ssf.mysqloracletest.mapper.VSySydwMysqlMapper; import com.ssf.mysqloracletest.mapper.VSySydwMysqlMapper;
import com.ssf.mysqloracletest.mapper.VSySyfwMysqlMapper; import com.ssf.mysqloracletest.mapper.VSySyfwMysqlMapper;
import com.ssf.mysqloracletest.service.VSySydwMysqlService; import com.ssf.mysqloracletest.service.VSySydwMysqlService;
@ -17,7 +20,7 @@ import org.springframework.stereotype.Service;
@Service @Service
@DS("mysql") @DS("mysql")
@RequiredArgsConstructor @RequiredArgsConstructor
public class VSySydwMysqlServiceImpl implements VSySydwMysqlService { public class VSySydwMysqlServiceImpl extends ServiceImpl<VSySydwMysqlMapper, VSySydwmMysql> implements VSySydwMysqlService {
private final VSySydwMysqlMapper vSySydwMysqlMapper; private final VSySydwMysqlMapper vSySydwMysqlMapper;

@ -0,0 +1,139 @@
package com.ssf.mysqloracletest.task;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.ssf.mysqloracletest.domain.MetaActualUnitUserInfo;
import com.ssf.mysqloracletest.domain.MetaImpUserInfo;
import com.ssf.mysqloracletest.domain.VSySydwCyryMysql;
import com.ssf.mysqloracletest.service.MetaActualUnitUserInfoService;
import com.ssf.mysqloracletest.service.MetaImpUserInfoService;
import com.ssf.mysqloracletest.service.VSySydwCyryMysqlService;
import com.ssf.mysqloracletest.utils.ConfigParam;
import com.ssf.mysqloracletest.utils.NumKit;
import com.ssf.mysqloracletest.utils.StringKit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
*
*/
@Component
public class MetaActualUnitUserInfoTask {
private static final Logger logger = LoggerFactory.getLogger(MetaActualUnitUserInfoTask.class);
@Resource
private VSySydwCyryMysqlService vSySydwCyryMysqlService;
@Resource
private MetaActualUnitUserInfoService metaActualUnitUserInfoService;
final int oncesCounts = NumKit.checkInt(ConfigParam.oncesCounts) == 0 ? 1000 : NumKit.checkInt(ConfigParam.oncesCounts);
private boolean cyryTag = false;
/**
*
* //
*/
@Scheduled(initialDelay = 100, fixedDelay = 3000)
public void transcyry() {
if (cyryTag) {
return;
}
if (!"true".equals(ConfigParam.metaActualUnitUserInfoSwitch)) {
return;
}
try {
int countcyry = vSySydwCyryMysqlService.count();
logger.info("countcyry:" + countcyry);
if (countcyry > 0) {
cyryTag = true;
int count = countcyry / oncesCounts;
CountDownLatch latch = new CountDownLatch(count);
ExecutorService cyryPool = Executors.newFixedThreadPool(50);
for (int i = 0; i <= count; i++) {
Map cyryMap = new HashMap();
cyryMap.put("rowStart", i * oncesCounts);
cyryMap.put("rowEnd", (i + 1) * oncesCounts);
cyryPool.submit(() -> {
try {
List<VSySydwCyryMysql> list = vSySydwCyryMysqlService.lambdaQuery().list();
for (VSySydwCyryMysql cyry : list) {
MetaActualUnitUserInfo metaActualUnitUserInfo = new MetaActualUnitUserInfo();
if (cyry.getDWID()!=null) {
metaActualUnitUserInfo.setUnitId(Long.parseLong(cyry.getDWID()));
}
metaActualUnitUserInfo.setUnitName(cyry.getDWMC());
metaActualUnitUserInfo.setStaffName(cyry.getXM());
metaActualUnitUserInfo.setIdentityId(cyry.getZJHM());
metaActualUnitUserInfo.setContactInfo(cyry.getLXDH());
if (cyry.getXB()!=null) {
metaActualUnitUserInfo.setSex(Integer.parseInt(cyry.getXB()));
}
if (cyry.getRYFL()!=null) {
metaActualUnitUserInfo.setStaffType(Integer.parseInt(cyry.getRYFL()));
}
if ("Y".equals(cyry.getZT())){
metaActualUnitUserInfo.setStaffState(1);
}else if ("N".equals(cyry.getZT())){
metaActualUnitUserInfo.setStaffState(2);
}
metaActualUnitUserInfo.setMetaCreateTime(cyry.getYSBZK_RKSJ());
metaActualUnitUserInfo.setMetaUpdateTime(cyry.getYSBZK_GXSJ());
//确定一个数据是否唯一
MetaActualUnitUserInfo one = metaActualUnitUserInfoService.lambdaQuery().eq(MetaActualUnitUserInfo::getIdentityId, cyry.getZJHM())
.eq(MetaActualUnitUserInfo::getStaffType, cyry.getRYFL()).one();
if (one == null) {
metaActualUnitUserInfoService.save(metaActualUnitUserInfo);
logger.info("cyry-" + cyry.getZJHM() + ":插入成功");
} else {
UpdateWrapper<MetaActualUnitUserInfo> metaActualUnitUserInfoUpdateWrapper = new UpdateWrapper<>();
metaActualUnitUserInfoUpdateWrapper.eq("identity_id", cyry.getZJHM());
metaActualUnitUserInfoUpdateWrapper.eq("staff_type", cyry.getRYFL());
metaActualUnitUserInfoService.update(metaActualUnitUserInfo,metaActualUnitUserInfoUpdateWrapper);
logger.info("cyry-" + cyry.getZJHM() + ":更新成功");
}
}
} catch (Exception e) {
logger.info("cyrys:" + e.getMessage());
}
latch.countDown();
});
logger.info("cyryMap数据总量:" + countcyry + "," + "当前处理下标:" + cyryMap.get("rowStart") + "/" + cyryMap.get("rowEnd"));
}
try {
// Wait for all threads to complete
latch.await();
} catch (InterruptedException e) {
e.printStackTrace();
}
// 关闭线程池
cyryPool.shutdown();
}
} catch (Exception e) {
logger.info(StringKit.getTrace(e));
}
}
}

@ -91,7 +91,9 @@ public class MetaHandleAlarmTask {
metaHandleAlarmInfoService.save(metaHandleAlarmInfo); metaHandleAlarmInfoService.save(metaHandleAlarmInfo);
logger.info("cjxx-" + cjxx.getCJBH() + ":插入成功"); logger.info("cjxx-" + cjxx.getCJBH() + ":插入成功");
} else { } else {
metaHandleAlarmInfoService.update(metaHandleAlarmInfo,new UpdateWrapper<>(metaHandleAlarmInfo)); UpdateWrapper<MetaHandleAlarmInfo> metaHandleAlarmInfoUpdateWrapper = new UpdateWrapper<>();
metaHandleAlarmInfoUpdateWrapper.eq("alarm_code", cjxx.getCJBH());
metaHandleAlarmInfoService.update(metaHandleAlarmInfo,metaHandleAlarmInfoUpdateWrapper);
logger.info("cjxx-" + cjxx.getCJBH() + ":更新成功"); logger.info("cjxx-" + cjxx.getCJBH() + ":更新成功");
} }
} }

@ -1,5 +1,7 @@
package com.ssf.mysqloracletest.task; package com.ssf.mysqloracletest.task;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.ssf.mysqloracletest.domain.MetaImpUserInfo; import com.ssf.mysqloracletest.domain.MetaImpUserInfo;
import com.ssf.mysqloracletest.domain.ZhxfZdrygkRyjbxxViewMysql; import com.ssf.mysqloracletest.domain.ZhxfZdrygkRyjbxxViewMysql;
@ -78,9 +80,22 @@ public class MetaImpUserInfoTask {
MetaImpUserInfo metaImpUserInfo = new MetaImpUserInfo(); MetaImpUserInfo metaImpUserInfo = new MetaImpUserInfo();
metaImpUserInfo.setUserName(zdry.getXM()); metaImpUserInfo.setUserName(zdry.getXM());
metaImpUserInfo.setIdCard(zdry.getZJHM()); metaImpUserInfo.setIdCard(zdry.getZJHM());
if (zdry.getXB()!=null) {
metaImpUserInfo.setSex(Integer.parseInt(zdry.getXB())); metaImpUserInfo.setSex(Integer.parseInt(zdry.getXB()));
}
metaImpUserInfo.setPhone(zdry.getSJHM()); metaImpUserInfo.setPhone(zdry.getSJHM());
metaImpUserInfo.setImpUserType(zdry.getZDRRYLBBJ()); String s = "000000";
if (zdry.getZDRYXL()!=null && !zdry.getZDRYXL().contains(",")){
String substring = zdry.getZDRYXL().substring(0, 4);
substring=substring+ s;
metaImpUserInfo.setImpUserType(substring);
}else if (zdry.getZDRYXL().contains(",")){
String[] split = zdry.getZDRYXL().split(",");
String substring = split[0].substring(0, 4);
String substring1 = split[1].substring(0, 4);
substring = substring+s+","+substring1+s;
metaImpUserInfo.setImpUserType(substring);
}
metaImpUserInfo.setImpUserSubType(zdry.getZDRYXL()); metaImpUserInfo.setImpUserSubType(zdry.getZDRYXL());
metaImpUserInfo.setHouseHoldRegister(zdry.getHJDQH()); metaImpUserInfo.setHouseHoldRegister(zdry.getHJDQH());
metaImpUserInfo.setHouseHoldAddress(zdry.getHJDXZ()); metaImpUserInfo.setHouseHoldAddress(zdry.getHJDXZ());
@ -94,7 +109,9 @@ public class MetaImpUserInfoTask {
metaImpUserInfoService.save(metaImpUserInfo); metaImpUserInfoService.save(metaImpUserInfo);
logger.info("zdry-" + zdry.getZJHM() + ":插入成功"); logger.info("zdry-" + zdry.getZJHM() + ":插入成功");
} else { } else {
metaImpUserInfoService.update(metaImpUserInfo,new UpdateWrapper<>(metaImpUserInfo)); UpdateWrapper<MetaImpUserInfo> metaImpUserInfoUpdateWrapper = new UpdateWrapper<>();
metaImpUserInfoUpdateWrapper.eq("id_card", zdry.getZJHM());
metaImpUserInfoService.update(metaImpUserInfo,metaImpUserInfoUpdateWrapper);
logger.info("zdry-" + zdry.getZJHM() + ":更新成功"); logger.info("zdry-" + zdry.getZJHM() + ":更新成功");
} }
} }

@ -26,6 +26,7 @@ public class ConfigParam {
public static String metaImpUserSwitch = StringKit.toString(PropertiesUtil.queryPropertiesByKey("metaImpUserSwitch")); public static String metaImpUserSwitch = StringKit.toString(PropertiesUtil.queryPropertiesByKey("metaImpUserSwitch"));
public static String metaHandleAlarmSwitch = StringKit.toString(PropertiesUtil.queryPropertiesByKey("metaHandleAlarmSwitch")); public static String metaHandleAlarmSwitch = StringKit.toString(PropertiesUtil.queryPropertiesByKey("metaHandleAlarmSwitch"));
public static String metaActualUnitUserInfoSwitch = StringKit.toString(PropertiesUtil.queryPropertiesByKey("metaActualUnitUserInfoSwitch"));
//将数据洗进 --->业务表的开关---------------------------------------------------------------------------------------------------------- //将数据洗进 --->业务表的开关----------------------------------------------------------------------------------------------------------
public static String NewNsydwSwitch = StringKit.toString(PropertiesUtil.queryPropertiesByKey("NewNsydwSwitch")); public static String NewNsydwSwitch = StringKit.toString(PropertiesUtil.queryPropertiesByKey("NewNsydwSwitch"));

Loading…
Cancel
Save