|
@@ -6,10 +6,7 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.huimv.eartag2.common.dao.entity.*;
|
|
|
import com.huimv.eartag2.common.dao.repo.*;
|
|
|
//import com.huimv.eartag2.common.service.IDevice;
|
|
|
-import com.huimv.eartag2.common.utils.BizConst;
|
|
|
-import com.huimv.eartag2.common.utils.DateUtil;
|
|
|
-import com.huimv.eartag2.common.utils.Result;
|
|
|
-import com.huimv.eartag2.common.utils.ResultCode;
|
|
|
+import com.huimv.eartag2.common.utils.*;
|
|
|
import com.huimv.eartag2.manage.service.ICacheService;
|
|
|
import com.huimv.eartag2.manage.service.IDeviceService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -58,8 +55,48 @@ public class DeviceServiceImpl implements IDeviceService {
|
|
|
private EartagEartagOnlineRepo eartagOnlineRepo;
|
|
|
@Autowired
|
|
|
private EartagDeviceEartagCountRepo deviceEartagCountRepo;
|
|
|
+ @Autowired
|
|
|
+ private EartagEnvRepo eartagEnvRepo;
|
|
|
|
|
|
+ /**
|
|
|
+ * @Method : listDeviceEnvtempByDeviceCode
|
|
|
+ * @Description :
|
|
|
+ * @Params : [deviceCode]
|
|
|
+ * @Return : com.huimv.eartag2.common.utils.Result
|
|
|
+ *
|
|
|
+ * @Author : ZhuoNing
|
|
|
+ * @Date : 2022/3/8
|
|
|
+ * @Time : 20:55
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Result listDeviceEnvtempByDeviceCode(String deviceCode) throws ParseException {
|
|
|
+ DateUtil du = new DateUtil();
|
|
|
+ String todayDateText = du.getTodayDateText();
|
|
|
+ //
|
|
|
+ List<EartagEnvEntity> eartagEnvEntityList = eartagEnvRepo.getDeviceEnvtempByDeviceCode(deviceCode,todayDateText);
|
|
|
+ if(eartagEnvEntityList.size()==0){
|
|
|
+ return new Result(BizConst.CODE_ENVTEMP_FLOW_NO_EXIST,BizConst.MSG_ENVTEMP_FLOW_NO_EXIST,false);
|
|
|
+ }else{
|
|
|
+ JSONArray dataJa = new JSONArray();
|
|
|
+ for(EartagEnvEntity eartagEnvEntity:eartagEnvEntityList){
|
|
|
+ JSONObject eartagEnvJo = JSONUtil.convertEntityToJSONObject(eartagEnvEntity);
|
|
|
+ eartagEnvJo.put("addTime",du.formatDatetimeText(eartagEnvJo.getDate("addTime")));
|
|
|
+ dataJa.add(eartagEnvJo);
|
|
|
+ }
|
|
|
+ return new Result(ResultCode.SUCCESS,dataJa);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ /**
|
|
|
+ * @Method : listOnlineDevice
|
|
|
+ * @Description :
|
|
|
+ * @Params : [farmId, deviceCode, alias, addDate, pageNo, pageSize]
|
|
|
+ * @Return : com.huimv.eartag2.common.utils.Result
|
|
|
+ *
|
|
|
+ * @Author : ZhuoNing
|
|
|
+ * @Date : 2022/3/8
|
|
|
+ * @Time : 20:55
|
|
|
+ */
|
|
|
@Override
|
|
|
public Result listOnlineDevice(String farmId, String deviceCode, String alias, String addDate, Integer pageNo, Integer pageSize) throws ParseException {
|
|
|
DateUtil dateUtil = new DateUtil();
|