|
|
@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
package com.ssf.mysqloracletest.task;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
|
|
|
|
|
import com.ssf.mysqloracletest.domain.MetaImpUserModelInfo;
|
|
|
|
|
|
|
|
import com.ssf.mysqloracletest.domain.SwzdryView;
|
|
|
|
|
|
|
|
import com.ssf.mysqloracletest.service.MetaImpUserInfoService;
|
|
|
|
|
|
|
|
import com.ssf.mysqloracletest.service.MetaImpUserModelInfoService;
|
|
|
|
|
|
|
|
import com.ssf.mysqloracletest.service.SwzdryViewService;
|
|
|
|
|
|
|
|
import com.ssf.mysqloracletest.utils.ConfigParam;
|
|
|
|
|
|
|
|
import com.ssf.mysqloracletest.utils.NumKit;
|
|
|
|
|
|
|
|
import com.ssf.mysqloracletest.utils.StringKit;
|
|
|
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
|
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import java.util.concurrent.CountDownLatch;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Component
|
|
|
|
|
|
|
|
@RequiredArgsConstructor
|
|
|
|
|
|
|
|
public class MetaImpUserModelInfoTask {
|
|
|
|
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(MetaImpUserModelInfoTask.class);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final SwzdryViewService swzdryViewService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final MetaImpUserModelInfoService metaimpUserModelInfoService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final int oncesCounts = NumKit.checkInt(ConfigParam.oncesCounts) == 0 ? 1000 : NumKit.checkInt(ConfigParam.oncesCounts);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Scheduled(initialDelay = 100, fixedDelay = 3000)
|
|
|
|
|
|
|
|
public void transswzdry() {
|
|
|
|
|
|
|
|
if (!"true".equals(ConfigParam.SwzdrySwitch)) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
int countTStrh = swzdryViewService.count();
|
|
|
|
|
|
|
|
if (countTStrh > 0) {
|
|
|
|
|
|
|
|
int count = countTStrh / oncesCounts;
|
|
|
|
|
|
|
|
CountDownLatch latch = new CountDownLatch(countTStrh);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i <= count; i++) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
|
|
|
|
|
|
|
|
QueryWrapper<SwzdryView> wrapper = new QueryWrapper<>();
|
|
|
|
|
|
|
|
List<SwzdryView> list = swzdryViewService.list(wrapper);
|
|
|
|
|
|
|
|
for (SwzdryView Info : list) {
|
|
|
|
|
|
|
|
MetaImpUserModelInfo modelInfo = new MetaImpUserModelInfo();
|
|
|
|
|
|
|
|
modelInfo.setWarning_id(Info.getZDRYYJXXID());
|
|
|
|
|
|
|
|
modelInfo.setDataType(Integer.parseInt(Info.getDTXXLB()));
|
|
|
|
|
|
|
|
modelInfo.setImpUserSubType(Info.getZDRYXL());
|
|
|
|
|
|
|
|
modelInfo.setImpUserName(Info.getZDRYXM());
|
|
|
|
|
|
|
|
modelInfo.setImpUserIdCard(Info.getZDRYSFZH());
|
|
|
|
|
|
|
|
modelInfo.setLongitude(new BigDecimal(Info.getHDFSDJDZB()));
|
|
|
|
|
|
|
|
modelInfo.setLatitude(new BigDecimal(Info.getHDFSDWDZB()));
|
|
|
|
|
|
|
|
modelInfo.setActivityTime(Info.getHDFSSJ());
|
|
|
|
|
|
|
|
modelInfo.setActivityDeviceAddress(Info.getHDFSCSDM());
|
|
|
|
|
|
|
|
modelInfo.setActivityDeviceCode(Info.getHDFSCSDM());
|
|
|
|
|
|
|
|
modelInfo.setActivityPoliceStationCode(Info.getHDFSDSSGAJGDM());
|
|
|
|
|
|
|
|
modelInfo.setActivityPoliceStationName(Info.getHDFSDSSGAJGMC());
|
|
|
|
|
|
|
|
modelInfo.setActivityMessage(Info.getHDXGXX());
|
|
|
|
|
|
|
|
modelInfo.setSignPoliceman(Info.getYJJSMJ());
|
|
|
|
|
|
|
|
modelInfo.setSignPolicemanIdCard(Info.getYJJSMJSFZH());
|
|
|
|
|
|
|
|
modelInfo.setSignStatus(Integer.parseInt(Info.getQSZT()));// 签收状态 0:未签收 1:已签收
|
|
|
|
|
|
|
|
modelInfo.setDisposalStatus(Integer.parseInt(Info.getFKZT()));// 反馈状态 0:未反馈 1:已反馈
|
|
|
|
|
|
|
|
modelInfo.setSignPoliceStation(Info.getYJJSDWMC());
|
|
|
|
|
|
|
|
modelInfo.setSignPoliceCode(Info.getYJJSDW());
|
|
|
|
|
|
|
|
String yjfbsjString = Info.getYJFBSJ();
|
|
|
|
|
|
|
|
Date yjfbsjDate = dateFormat.parse(yjfbsjString);
|
|
|
|
|
|
|
|
modelInfo.setWarningTime(StringKit.toString(yjfbsjDate));
|
|
|
|
|
|
|
|
modelInfo.setIsImpAddress(Info.getSFZDDW());
|
|
|
|
|
|
|
|
modelInfo.setKey1(Info.getKEY1());
|
|
|
|
|
|
|
|
modelInfo.setKey2(Info.getKEY2());
|
|
|
|
|
|
|
|
modelInfo.setKey3(Info.getKEY3());
|
|
|
|
|
|
|
|
modelInfo.setKey4(Info.getKEY4());
|
|
|
|
|
|
|
|
modelInfo.setKey5(Info.getKEY5());
|
|
|
|
|
|
|
|
modelInfo.setKey6(Info.getKEY6());
|
|
|
|
|
|
|
|
modelInfo.setKey7(Info.getKEY7());
|
|
|
|
|
|
|
|
modelInfo.setKey8(Info.getKEY8());
|
|
|
|
|
|
|
|
modelInfo.setKey9(Info.getKEY9());
|
|
|
|
|
|
|
|
modelInfo.setKey10(Info.getKEY10());
|
|
|
|
|
|
|
|
modelInfo.setKey11(Info.getKEY11());
|
|
|
|
|
|
|
|
modelInfo.setKey12(Info.getKEY12());
|
|
|
|
|
|
|
|
modelInfo.setKey13(Info.getKEY13());
|
|
|
|
|
|
|
|
modelInfo.setKey14(Info.getKEY14());
|
|
|
|
|
|
|
|
modelInfo.setKey15(Info.getKEY15());
|
|
|
|
|
|
|
|
modelInfo.setKey16(Info.getKEY16());
|
|
|
|
|
|
|
|
modelInfo.setValue1(Info.getVALUE1());
|
|
|
|
|
|
|
|
modelInfo.setValue2(Info.getVALUE2());
|
|
|
|
|
|
|
|
modelInfo.setValue3(Info.getVALUE3());
|
|
|
|
|
|
|
|
modelInfo.setValue4(Info.getVALUE4());
|
|
|
|
|
|
|
|
modelInfo.setValue5(Info.getVALUE5());
|
|
|
|
|
|
|
|
modelInfo.setValue6(Info.getVALUE6());
|
|
|
|
|
|
|
|
modelInfo.setValue7(Info.getVALUE7());
|
|
|
|
|
|
|
|
modelInfo.setValue8(Info.getVALUE8());
|
|
|
|
|
|
|
|
modelInfo.setValue9(Info.getVALUE9());
|
|
|
|
|
|
|
|
modelInfo.setValue10(Info.getVALUE10());
|
|
|
|
|
|
|
|
modelInfo.setValue11(Info.getVALUE11());
|
|
|
|
|
|
|
|
modelInfo.setValue12(Info.getVALUE12());
|
|
|
|
|
|
|
|
modelInfo.setValue13(Info.getVALUE13());
|
|
|
|
|
|
|
|
modelInfo.setValue14(Info.getVALUE14());
|
|
|
|
|
|
|
|
modelInfo.setValue15(Info.getVALUE15());
|
|
|
|
|
|
|
|
modelInfo.setValue16(Info.getVALUE16());
|
|
|
|
|
|
|
|
//确定一个数据是否唯一
|
|
|
|
|
|
|
|
MetaImpUserModelInfo one = metaimpUserModelInfoService.lambdaQuery().eq(MetaImpUserModelInfo::getWarning_id, Info.getZDRYYJXXID()).one();
|
|
|
|
|
|
|
|
if (one == null) {
|
|
|
|
|
|
|
|
boolean save = metaimpUserModelInfoService.save(modelInfo);
|
|
|
|
|
|
|
|
if (save) {
|
|
|
|
|
|
|
|
logger.info("MODEL:-:" + Info.getZDRYYJXXID() + ":插入成功");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
UpdateWrapper<MetaImpUserModelInfo> wrapper1 = new UpdateWrapper<>();
|
|
|
|
|
|
|
|
wrapper1.eq("warning_id", Info.getZDRYYJXXID());
|
|
|
|
|
|
|
|
boolean update = metaimpUserModelInfoService.update(modelInfo, wrapper1);
|
|
|
|
|
|
|
|
if (update) {
|
|
|
|
|
|
|
|
logger.info("MODEL:-:" + Info.getZDRYYJXXID() + ":更新成功");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
logger.info(StringKit.getTrace(e));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
latch.countDown();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
// Wait for all threads to complete
|
|
|
|
|
|
|
|
latch.await();
|
|
|
|
|
|
|
|
} catch (InterruptedException e) {
|
|
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
logger.info(StringKit.getTrace(e));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|