|
@@ -1,11 +1,16 @@
|
|
|
package com.fdkankan.task.jobhandler.zfb;
|
|
|
|
|
|
+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.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.mybatisflex.annotation.UseDataSource;
|
|
|
import com.mybatisflex.core.datasource.DataSourceKey;
|
|
@@ -18,6 +23,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;
|
|
@@ -104,5 +110,50 @@ public class ZfbXxlJob {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ @Autowired
|
|
|
+ TbCameraInstanceMapper tbCameraInstanceMapper;
|
|
|
|
|
|
+ @XxlJob("oldZfbCameraAdd")
|
|
|
+ @UseDataSource("old-zfb")
|
|
|
+ public void oldZfbCameraAdd(){
|
|
|
+ String taskId = UUID.randomUUID().toString().replace("-", "");
|
|
|
+ logger.info("oldZfbCameraAdd---------------start,taskId:{}",taskId);
|
|
|
+ try {
|
|
|
+ String param = XxlJobHelper.getJobParam(); // 获取参数
|
|
|
+ if(StringUtils.isNotBlank(param)){
|
|
|
+ JSONArray jsonArray = JSON.parseArray(param);
|
|
|
+ for (Object object : jsonArray) {
|
|
|
+ JSONObject jsonObject = (JSONObject) object;
|
|
|
+ String childName = jsonObject.getString("childName");
|
|
|
+ String userName = jsonObject.getString("userName");
|
|
|
+ QueryWrapper queryWrapper = QueryWrapper.create()
|
|
|
+ .where("child_name ='"+childName+"'");
|
|
|
+ List<TbCameraInstance> tbCameraInstances = tbCameraInstanceMapper.selectListByQuery(queryWrapper);
|
|
|
+ if(!tbCameraInstances.isEmpty()){
|
|
|
+ logger.info("oldZfbCameraAdd-已存在-error:{}",childName);
|
|
|
+ }
|
|
|
+ TbCameraInstance tbCameraInstance = new TbCameraInstance();
|
|
|
+ tbCameraInstance.setChildName(childName);
|
|
|
+ tbCameraInstance.setActiveTime(new Date());
|
|
|
+ tbCameraInstance.setCameraTypeId(1);
|
|
|
+ tbCameraInstance.setChildPassword("4dkankan@4dage");
|
|
|
+ tbCameraInstance.setWifiName(childName);
|
|
|
+ tbCameraInstance.setWifiPassword("12345678");
|
|
|
+ tbCameraInstance.setBalance("99999999");
|
|
|
+ tbCameraInstance.setUserName(userName);
|
|
|
+ tbCameraInstance.setOwn(0);
|
|
|
+ tbCameraInstance.setCountry(0);
|
|
|
+ tbCameraInstance.setAgency("4dage");
|
|
|
+ tbCameraInstanceMapper.insert(tbCameraInstance);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }catch (Exception e){
|
|
|
+ logger.info("oldZfbCameraAdd-error,taskId:{},{}",taskId,e);
|
|
|
+ }finally {
|
|
|
+ logger.info("oldZfbCameraAdd---------------end,taskId::{}",taskId);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|