|
@@ -4,14 +4,10 @@ import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fdkankan.dingtalk.DingTalkSendUtils;
|
|
|
-import com.fdkankan.task.entity.Repair;
|
|
|
-import com.fdkankan.task.entity.TbCameraInstance;
|
|
|
-import com.fdkankan.task.entity.TbSceneNum;
|
|
|
+import com.fdkankan.task.entity.*;
|
|
|
import com.fdkankan.task.jobhandler.sale.SaleXxlJobUtil;
|
|
|
import com.fdkankan.task.jobhandler.util.Utils;
|
|
|
-import com.fdkankan.task.mapper.RepairMapper;
|
|
|
-import com.fdkankan.task.mapper.TbCameraInstanceMapper;
|
|
|
-import com.fdkankan.task.mapper.TbSceneNumMapper;
|
|
|
+import com.fdkankan.task.mapper.*;
|
|
|
import com.mybatisflex.annotation.UseDataSource;
|
|
|
import com.mybatisflex.core.datasource.DataSourceKey;
|
|
|
import com.mybatisflex.core.query.QueryWrapper;
|
|
@@ -23,10 +19,7 @@ import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
-import java.util.Date;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.UUID;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* XxlJob开发示例(Bean模式)
|
|
@@ -156,4 +149,63 @@ public class ZfbXxlJob {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ TbBuildingMapper tbBuildingMapper;
|
|
|
+ @Autowired
|
|
|
+ TbHouseMapper tbHouseMapper;
|
|
|
+
|
|
|
+
|
|
|
+ @XxlJob("updateBuild")
|
|
|
+ @UseDataSource("new-zfb")
|
|
|
+ public void updateBuild(){
|
|
|
+ String taskId = UUID.randomUUID().toString().replace("-", "");
|
|
|
+ logger.info("newZfbGenNewCode---------------start,taskId:{}",taskId);
|
|
|
+ try {
|
|
|
+ HashMap<String,TbBuilding> buildMap = new HashMap<>();
|
|
|
+ List<TbBuilding> tbBuildings = tbBuildingMapper.selectAll();
|
|
|
+ List<TbBuilding> DelLit = new ArrayList<>();
|
|
|
+ for (TbBuilding tbBuilding : tbBuildings) {
|
|
|
+ String key = tbBuilding.getName()+","+tbBuilding.getCity()+","+tbBuilding.getDistrict();
|
|
|
+ if(buildMap.get(key) == null){
|
|
|
+ buildMap.put(tbBuilding.getName()+","+tbBuilding.getCity()+","+tbBuilding.getDistrict(),tbBuilding);
|
|
|
+ }else {
|
|
|
+ QueryWrapper queryWrapper = QueryWrapper.create()
|
|
|
+ .where("building_id =" +tbBuilding.getId());
|
|
|
+ List<TbHouse> tbHouses = tbHouseMapper.selectListByQuery(queryWrapper);
|
|
|
+ for (TbHouse tbHouse : tbHouses) {
|
|
|
+ tbHouse.setBuildingId(buildMap.get(key).getId());
|
|
|
+ tbHouseMapper.update(tbHouse);
|
|
|
+ }
|
|
|
+ DelLit.add(tbBuilding);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (TbBuilding buildId : DelLit) {
|
|
|
+
|
|
|
+ tbBuildingMapper.delete(buildId);
|
|
|
+ }
|
|
|
+
|
|
|
+ }catch (Exception e){
|
|
|
+ logger.info("newZfbGenNewCode-error,taskId:{},{}",taskId,e);
|
|
|
+ }finally {
|
|
|
+ logger.info("zfbGenOldCode---------------end,taskId::{}",taskId);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void main(String[] args) {
|
|
|
+ JSONArray jsonArray = new JSONArray();
|
|
|
+ String userName = "13967143520";
|
|
|
+ String[] res = {
|
|
|
+ "THETAYP41148397.OSC",
|
|
|
+ "THETAYP41133486.OSC"
|
|
|
+ };
|
|
|
+ for (String re : res) {
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ jsonObject.put("childName",re);
|
|
|
+ jsonObject.put("userName",userName);
|
|
|
+ jsonArray.add(jsonObject);
|
|
|
+ }
|
|
|
+ System.out.println(jsonArray);
|
|
|
+ }
|
|
|
}
|