|
|
@@ -1,18 +1,23 @@
|
|
|
package com.lc.ibps.platform.plan.job;
|
|
|
|
|
|
import com.lc.ibps.base.core.util.AppUtil;
|
|
|
+import com.lc.ibps.base.core.util.BeanUtils;
|
|
|
import com.lc.ibps.base.core.util.JacksonUtil;
|
|
|
import com.lc.ibps.base.core.util.string.StringUtil;
|
|
|
import com.lc.ibps.base.framework.table.ICommonDao;
|
|
|
+import com.lc.ibps.base.saas.token.ITenantTokenService;
|
|
|
+import com.lc.ibps.base.web.context.ContextUtil;
|
|
|
+import com.lc.ibps.bpmn.api.IBpmInstService;
|
|
|
+import com.lc.ibps.cloud.entity.APIResult;
|
|
|
import com.lc.ibps.components.quartz.BaseJob2;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.quartz.JobDataMap;
|
|
|
import org.quartz.JobExecutionContext;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
-import java.time.LocalDate;
|
|
|
-import java.time.format.DateTimeFormatter;
|
|
|
import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
public class BinXiangJob extends BaseJob2 {
|
|
|
@@ -36,12 +41,45 @@ public class BinXiangJob extends BaseJob2 {
|
|
|
String sql ="SELECT bing_xiang_id_,COUNT(id_) total FROM t_dsfbxwdjl " +
|
|
|
" WHERE (CONVERT(wen_du_,SIGNED) > CONVERT(wen_du_shang_xian,SIGNED) OR CONVERT(wen_du_,SIGNED) < CONVERT(wen_du_xia_xian_,SIGNED) )" +
|
|
|
" AND DATE(cai_ji_shi_jian_)= CURDATE() GROUP BY bing_xiang_id_ HAVING total >= 4";
|
|
|
+ Map<String, Object> bx = commonDao.queryOne(sql);
|
|
|
+ if (BeanUtils.isNotEmpty(bx)){
|
|
|
+ //根据返回的冰箱ID,再去查当天温度记录,确定是否有连续4个点失控。
|
|
|
+ String sql2 = "select *from t_dsfbxwdjl where bing_xiang_id_='%s' ORDER BY cai_ji_shi_jian_";
|
|
|
+ sql2 = String.format(sql2,bx.get("bing_xiang_id_"));
|
|
|
+ List<Map<String, Object>> list = (List<Map<String, Object>>) commonDao.query(sql2);
|
|
|
+ if (BeanUtils.isNotEmpty(list)){
|
|
|
+ for (Map<String,Object> map : list){
|
|
|
+ int control = 0;
|
|
|
+ double wenDu = (double) map.get("wen_du_");
|
|
|
+ double max = (double) map.get("wen_du_shang_xian");
|
|
|
+ double min = (double) map.get("wen_du_xia_xian_");
|
|
|
+ if (wenDu>max){
|
|
|
|
|
|
- //根据返回的冰箱ID,再去查当天温度记录,确定是否有连续4个点失控。
|
|
|
- //如果有,走温度失控流程。
|
|
|
-
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //如果有,走温度失控流程。
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+ private void startFlowStep() {
|
|
|
+ String fetchSql = "SELECT id_ FROM t_bmfxgjjl WHERE shi_fou_guo_shen_ IS NULL";
|
|
|
+ List<Map<String, Object>> list = (List<Map<String, Object>>) commonDao.query(fetchSql);
|
|
|
+ if (BeanUtils.isEmpty(list)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ IBpmInstService bpmInstService = AppUtil.getBean(IBpmInstService.class);
|
|
|
+ if (StringUtils.isBlank(ContextUtil.getCurrentAccessToken())) {
|
|
|
+ ITenantTokenService tenantTokenService = AppUtil.getBean(ITenantTokenService.class);
|
|
|
+ String accessToken = tenantTokenService.getAccessToken();
|
|
|
+ ContextUtil.setCurrentAccessToken(accessToken);
|
|
|
+ }
|
|
|
+ for (Map<String, Object> objectMap : list) {
|
|
|
+ APIResult<String> result = bpmInstService.startFlowFromList(new String[]{(String)objectMap.get("id_")}, "bmfxgjjl", "Process_0jl7e02");
|
|
|
+ result.getState();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
private void createDailyRecord(String[] planTime){
|
|
|
String sql = "SELECT * FROM t_dsfbxwdjl a, (SELECT bing_xiang_id_,MAX(cai_ji_shi_jian_) cai_ji_shi_jian_ FROM t_dsfbxwdjl " +
|