Compare commits

...

3 Commits

Author SHA1 Message Date
zyq 3f5504d44c 调整定时任务执行时间 2024-03-07 11:39:31 +08:00
zyq f8566c7907 添加注释说明 2024-03-07 11:38:41 +08:00
zyq b7865c8299 添加牛只离场信息查询方法 2024-03-07 11:37:55 +08:00
3 changed files with 40 additions and 15 deletions

View File

@ -24,6 +24,11 @@ import java.util.Map;
*/ */
public class Entry { public class Entry {
/**
* 定义牧场标识创耀信与牧场标识关系一牧云
* @param value
* @return
*/
public static Long getKey(String value){ public static Long getKey(String value){
Map<Long, String> map = new HashMap<>(); Map<Long, String> map = new HashMap<>();
map.put(23L,"1abe187269fd4fae8f6998371cf8076b");//奶一 23 map.put(23L,"1abe187269fd4fae8f6998371cf8076b");//奶一 23
@ -52,7 +57,11 @@ public class Entry {
return key; return key;
} }
/**
* 定义牧场名称与牧场标识关系一牧云
* @param value
* @return
*/
public static String getKeyName(String value){ public static String getKeyName(String value){
Map<String, String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
map.put("奶一牧场","1abe187269fd4fae8f6998371cf8076b");//奶一 23 map.put("奶一牧场","1abe187269fd4fae8f6998371cf8076b");//奶一 23
@ -81,6 +90,10 @@ public class Entry {
return key; return key;
} }
/**
* 定义牧场名称与牧场标识关系创耀信
* @return
*/
public static Map<String, Integer> sourceCow(){ public static Map<String, Integer> sourceCow(){
Map<String, Integer> map = new HashMap<>(); Map<String, Integer> map = new HashMap<>();
map.put("奶一牧场",23);//奶一 map.put("奶一牧场",23);//奶一
@ -111,19 +124,19 @@ public class Entry {
public static void synsData(String[] args){ public static void synsData(String[] args){
String[] farmIds = args[1].split(","); String[] farmIds = args[1].split(",");
for(String farmId : farmIds){ for(String farmId : farmIds){
EventLog.info("......["+args[4]+"]-["+args[5]+"]......"); EventLog.info("------["+args[4]+"]-["+args[5]+"]------");
EventLog.info("牛场标识:创耀信["+getKey(farmId)+"],一牧云["+farmId+"]...开始..."); EventLog.info("......牛场标识:创耀信["+getKey(farmId)+"],一牧云["+farmId+"]...开始......");
String str = HttpRequest.get("http://dairyapp.yimucloud.com:8085/dweb/login/apiLogin?platForm=DWeb&orgCode=DG64001&sign=pVibK5VxEpU=").execute().body(); String str = HttpRequest.get("http://dairyapp.yimucloud.com:8085/dweb/login/apiLogin?platForm=DWeb&orgCode=DG64001&sign=pVibK5VxEpU=").execute().body();
JSONObject obj = new JSONObject(str); JSONObject obj = new JSONObject(str);
JSONObject result = obj.getJSONObject("result"); JSONObject result = obj.getJSONObject("result");
String token = result.getStr("token");//获取token String token = result.getStr("token");//获取token
String[] eventIds = args[2].split(","); String[] eventIds = args[2].split(",");
for(String eventId : eventIds){ for(String eventId : eventIds){
EventLog.info("事件标识:["+eventId+"]...开始..."); EventLog.info("......事件标识:["+eventId+"]...开始......");
int total = 0; int total = 0;
int count = 1; int count = 1;
for(int i=1;i<=count;i++){ for(int i=1;i<=count;i++){
EventLog.info("第["+i+"]页开始..."); EventLog.info("第["+i+"]页开始......");
String url = "http://dairyapp.yimucloud.com:8085/dweb/party/event/getEventSingleInfoList?"; String url = "http://dairyapp.yimucloud.com:8085/dweb/party/event/getEventSingleInfoList?";
url = url + "farmId="+farmId; url = url + "farmId="+farmId;
url = url + "&pageNo="+i; url = url + "&pageNo="+i;
@ -142,7 +155,7 @@ public class Entry {
} }
for (int j = 0; j < arrayList.size(); j++) { for (int j = 0; j < arrayList.size(); j++) {
JSONObject param = arrayList.getJSONObject(j); JSONObject param = arrayList.getJSONObject(j);
EventLog.info("第("+(j+1)+")头...["+param.get("COW_NAME")+"]...["+param.get("EVENT_DATE")+"]..."); EventLog.info("第("+(j+1)+")头...["+param.get("COW_NAME")+"]...["+param.get("EVENT_DATE")+"]......");
//转群转圈 //转群转圈
if("101".equals(eventId)){ if("101".equals(eventId)){
com.alibaba.fastjson2.JSONObject reJSON = EventJson.setParamTurn(param); com.alibaba.fastjson2.JSONObject reJSON = EventJson.setParamTurn(param);
@ -325,19 +338,19 @@ public class Entry {
} }
} }
} }
EventLog.info("第["+i+"]页结束..."); EventLog.info("第["+i+"]页结束......");
} }
EventLog.info("事件["+eventId+"]总量:["+total+"]头..."); EventLog.info("......事件["+eventId+"]总量:["+total+"]头......");
EventLog.info("事件标识:["+eventId+"]...结束..."); EventLog.info("......事件标识:["+eventId+"]...结束......");
EventLog.info("等待2秒后继续..."); EventLog.info("......2秒后继续......");
try { try {
Thread.sleep(2000L); Thread.sleep(2000L);
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
EventLog.info("牛场标识:创耀信["+getKey(farmId)+"],一牧云["+farmId+"]...结束..."); EventLog.info("......牛场标识:创耀信["+getKey(farmId)+"],一牧云["+farmId+"]...结束......");
EventLog.info("......["+args[4]+"]-["+args[5]+"]......"); EventLog.info("------["+args[4]+"]-["+args[5]+"]------");
} }
} }
@ -348,11 +361,11 @@ public class Entry {
public static void editData(String[] args){ public static void editData(String[] args){
String[] farmIds = args[1].split(","); String[] farmIds = args[1].split(",");
for(String farmId : farmIds){ for(String farmId : farmIds){
EventLog.info("......["+args[2]+"]-["+args[3]+"]......"); EventLog.info("------["+args[2]+"]-["+args[3]+"]------");
EventLog.info("......牛场["+farmId+"]判决开始......"); EventLog.info("......牛场["+farmId+"]判决开始......");
Edit.dealEdit(farmId,args[2],args[3]); Edit.dealEdit(farmId,args[2],args[3]);
EventLog.info("......牛场["+farmId+"]判决结束......"); EventLog.info("......牛场["+farmId+"]判决结束......");
EventLog.info("......["+args[2]+"]-["+args[3]+"]......"); EventLog.info("------["+args[2]+"]-["+args[3]+"]------");
} }
} }

View File

@ -175,4 +175,16 @@ public class EventFind {
String sql = "select curr_cowshed_name as cowshed,out_cows_type_name as cowType from t_event_turn_group where source_cow='"+sourceCow+"' and cow_no='"+cowNo+"' and out_cows_type_name ='哺乳犊牛' order by event_date limit 1"; String sql = "select curr_cowshed_name as cowshed,out_cows_type_name as cowType from t_event_turn_group where source_cow='"+sourceCow+"' and cow_no='"+cowNo+"' and out_cows_type_name ='哺乳犊牛' order by event_date limit 1";
return Db.findFirst(sql); return Db.findFirst(sql);
} }
/**
* 根据牛场ID日期查询离场牛只信息
* @param sourceCow
* @param startDate
* @param endDate
* @return
*/
public static List<Record> getOffCowByData(String sourceCow,String startDate,String endDate){
String sql = "select cow_no as cowNo,event_date as eventDate,out_type as outType,oper_name as operName,create_time as createTime from t_event_out_group where source_cow='"+sourceCow+"' and date_format(event_date,'%Y-%m-%d') between date_format('"+startDate+"','%Y-%m-%d') and date_format('"+endDate+"','%Y-%m-%d')";
return Db.find(sql);
}
} }

View File

@ -1,5 +1,5 @@
cron4j=task cron4j=task
task.cron=15 22 * * * task.cron=0 0 * * *
task.class=com.cyx.cron.MyTask task.class=com.cyx.cron.MyTask
task.daemon=true task.daemon=true
task.enable=true task.enable=true