|
@@ -3,6 +3,7 @@ package com.huimv.farm.damsubsidy.service.impl;
|
|
|
import cn.hutool.core.date.DateTime;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.lang.UUID;
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.huimv.farm.damsubsidy.common.token.TokenSign;
|
|
@@ -26,13 +27,12 @@ import javax.servlet.http.HttpServletRequest;
|
|
|
import java.io.BufferedInputStream;
|
|
|
import java.io.ByteArrayOutputStream;
|
|
|
import java.io.InputStream;
|
|
|
+import java.text.ParseException;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -53,22 +53,29 @@ public class BillIsolatedServiceImpl extends ServiceImpl<BillIsolatedMapper, Bil
|
|
|
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public Result addIsolation(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
|
|
|
+ public Result addIsolation(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) throws ParseException {
|
|
|
String inspectionNum = paramsMap.get("inspectionNum");
|
|
|
String isolatedPosition = paramsMap.get("isolatedPosition");
|
|
|
String strIsolated = paramsMap.get("strIsolated");
|
|
|
String dayIsolated = paramsMap.get("dayIsolated");
|
|
|
|
|
|
+ Integer integer = this.count(new QueryWrapper<BillIsolated>().eq("inspection_num", inspectionNum));
|
|
|
+ if (integer != 0){
|
|
|
+ return new Result(10001,"检疫证号重复!",false);
|
|
|
+ }
|
|
|
BillIsolated billIsolated = new BillIsolated();
|
|
|
- DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
- LocalDateTime time = LocalDateTime.parse(strIsolated, formatter);
|
|
|
- LocalDateTime endDay = time.plusDays(Long.valueOf(dayIsolated));
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ Date startTime = dateFormat.parse(strIsolated);
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.setTime(startTime);
|
|
|
+ calendar.add(Calendar.DATE, Integer.valueOf(dayIsolated));
|
|
|
+ Date endTime = calendar.getTime();
|
|
|
billIsolated.setInspectionName(TokenSign.getUserName(httpServletRequest)+"的隔离信息");
|
|
|
billIsolated.setInspectionNum(inspectionNum);
|
|
|
billIsolated.setIsolatedPosition(isolatedPosition);
|
|
|
- billIsolated.setStrIsolated(time);
|
|
|
+ billIsolated.setStrIsolated(startTime);
|
|
|
billIsolated.setDayIsolated(Integer.parseInt(dayIsolated));
|
|
|
- billIsolated.setEndIsolated(endDay);
|
|
|
+ billIsolated.setEndIsolated(endTime);
|
|
|
billIsolated.setCreateTime(DateTime.now());
|
|
|
billIsolated.setCreateUser(TokenSign.getUserName(httpServletRequest));
|
|
|
this.save(billIsolated);
|
|
@@ -187,9 +194,16 @@ public class BillIsolatedServiceImpl extends ServiceImpl<BillIsolatedMapper, Bil
|
|
|
public Result delayedIsolation(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
|
|
|
String id = paramsMap.get("id");
|
|
|
String day = paramsMap.get("day");
|
|
|
+ if (day.contains(".")){
|
|
|
+ return new Result(10001,"请输入整数",false);
|
|
|
+ }
|
|
|
BillIsolated billIsolated = this.getById(id);
|
|
|
billIsolated.setDayIsolated(billIsolated.getDayIsolated()+Integer.parseInt(day));
|
|
|
- billIsolated.setEndIsolated(billIsolated.getEndIsolated().plusDays(Integer.parseInt(day)));
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.setTime(billIsolated.getEndIsolated());
|
|
|
+ calendar.add(Calendar.DATE, Integer.valueOf(day));
|
|
|
+ Date endTime = calendar.getTime();
|
|
|
+ billIsolated.setEndIsolated(endTime);
|
|
|
this.updateById(billIsolated);
|
|
|
return Result.SUCCESS();
|
|
|
}
|
|
@@ -237,6 +251,9 @@ public class BillIsolatedServiceImpl extends ServiceImpl<BillIsolatedMapper, Bil
|
|
|
for (String s : eartag) {
|
|
|
if (!s.contains("-")){
|
|
|
BaseAnimal baseAnimal = baseAnimalMapper.selectOne(new QueryWrapper<BaseAnimal>().eq("earatg_no", s));
|
|
|
+ if (ObjectUtil.isEmpty(baseAnimal)){
|
|
|
+ return new Result(10001,"耳标号不存在",false);
|
|
|
+ }
|
|
|
baseAnimal.setIsDie(1);
|
|
|
baseAnimalMapper.updateById(baseAnimal);
|
|
|
}else {
|
|
@@ -251,6 +268,9 @@ public class BillIsolatedServiceImpl extends ServiceImpl<BillIsolatedMapper, Bil
|
|
|
for (Integer number : numbers) {
|
|
|
String earatgNo = number.toString();
|
|
|
BaseAnimal animal = baseAnimalMapper.selectOne(new QueryWrapper<BaseAnimal>().eq("earatg_no", earatgNo));
|
|
|
+ if (ObjectUtil.isEmpty(animal)){
|
|
|
+ return new Result(10001,"耳标号不存在",false);
|
|
|
+ }
|
|
|
animal.setIsDie(1);
|
|
|
baseAnimalMapper.updateById(animal);
|
|
|
}
|
|
@@ -259,6 +279,9 @@ public class BillIsolatedServiceImpl extends ServiceImpl<BillIsolatedMapper, Bil
|
|
|
}else {
|
|
|
if (!deaths.contains("-")){
|
|
|
BaseAnimal baseAnimal = baseAnimalMapper.selectOne(new QueryWrapper<BaseAnimal>().eq("earatg_no", deaths));
|
|
|
+ if (ObjectUtil.isEmpty(baseAnimal)){
|
|
|
+ return new Result(10001,"耳标号不存在",false);
|
|
|
+ }
|
|
|
baseAnimal.setIsDie(1);
|
|
|
baseAnimalMapper.updateById(baseAnimal);
|
|
|
}else {
|
|
@@ -273,6 +296,9 @@ public class BillIsolatedServiceImpl extends ServiceImpl<BillIsolatedMapper, Bil
|
|
|
for (Integer number : numbers) {
|
|
|
String earatgNo = number.toString();
|
|
|
BaseAnimal animal = baseAnimalMapper.selectOne(new QueryWrapper<BaseAnimal>().eq("earatg_no", earatgNo));
|
|
|
+ if (ObjectUtil.isEmpty(animal)){
|
|
|
+ return new Result(10001,"耳标号不存在",false);
|
|
|
+ }
|
|
|
animal.setIsDie(1);
|
|
|
baseAnimalMapper.updateById(animal);
|
|
|
}
|
|
@@ -284,7 +310,7 @@ public class BillIsolatedServiceImpl extends ServiceImpl<BillIsolatedMapper, Bil
|
|
|
BillLandingInspection billLandingInspection = landingInspectionMapper.selectOne(new QueryWrapper<BillLandingInspection>().eq("inspection_num", isolation.getInspectionNum()));
|
|
|
billLandingInspection.setInspectionSch(4);
|
|
|
landingInspectionMapper.updateById(billLandingInspection);
|
|
|
- this.save(isolation);
|
|
|
+ this.updateById(isolation);
|
|
|
return Result.SUCCESS();
|
|
|
}
|
|
|
|