|
@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateTime;
|
|
import cn.hutool.core.date.DateUtil;
|
|
import cn.hutool.core.date.DateUtil;
|
|
import cn.hutool.core.lang.UUID;
|
|
import cn.hutool.core.lang.UUID;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.huimv.farm.damsubsidy.common.token.TokenSign;
|
|
import com.huimv.farm.damsubsidy.common.token.TokenSign;
|
|
import com.huimv.farm.damsubsidy.common.utils.Result;
|
|
import com.huimv.farm.damsubsidy.common.utils.Result;
|
|
import com.huimv.farm.damsubsidy.common.utils.ResultCode;
|
|
import com.huimv.farm.damsubsidy.common.utils.ResultCode;
|
|
@@ -54,6 +55,7 @@ public class BillIsolatedServiceImpl extends ServiceImpl<BillIsolatedMapper, Bil
|
|
@Transactional
|
|
@Transactional
|
|
public Result addIsolation(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
|
|
public Result addIsolation(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
|
|
String inspectionNum = paramsMap.get("inspectionNum");
|
|
String inspectionNum = paramsMap.get("inspectionNum");
|
|
|
|
+ String isolatedPosition = paramsMap.get("isolatedPosition");
|
|
String strIsolated = paramsMap.get("strIsolated");
|
|
String strIsolated = paramsMap.get("strIsolated");
|
|
String dayIsolated = paramsMap.get("dayIsolated");
|
|
String dayIsolated = paramsMap.get("dayIsolated");
|
|
String endIsolated = paramsMap.get("endIsolated");
|
|
String endIsolated = paramsMap.get("endIsolated");
|
|
@@ -62,11 +64,13 @@ public class BillIsolatedServiceImpl extends ServiceImpl<BillIsolatedMapper, Bil
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
billIsolated.setInspectionName(TokenSign.getUserName(httpServletRequest)+"的隔离信息");
|
|
billIsolated.setInspectionName(TokenSign.getUserName(httpServletRequest)+"的隔离信息");
|
|
billIsolated.setInspectionNum(inspectionNum);
|
|
billIsolated.setInspectionNum(inspectionNum);
|
|
|
|
+ billIsolated.setIsolatedPosition(isolatedPosition);
|
|
billIsolated.setStrIsolated(LocalDateTime.parse(strIsolated,formatter));
|
|
billIsolated.setStrIsolated(LocalDateTime.parse(strIsolated,formatter));
|
|
billIsolated.setDayIsolated(Integer.parseInt(dayIsolated));
|
|
billIsolated.setDayIsolated(Integer.parseInt(dayIsolated));
|
|
billIsolated.setEndIsolated(LocalDateTime.parse(endIsolated,formatter));
|
|
billIsolated.setEndIsolated(LocalDateTime.parse(endIsolated,formatter));
|
|
billIsolated.setCreateTime(DateTime.now());
|
|
billIsolated.setCreateTime(DateTime.now());
|
|
billIsolated.setCreateUser(TokenSign.getUserName(httpServletRequest));
|
|
billIsolated.setCreateUser(TokenSign.getUserName(httpServletRequest));
|
|
|
|
+ this.save(billIsolated);
|
|
|
|
|
|
BillLandingInspection billLandingInspection = landingInspectionMapper.selectOne(new QueryWrapper<BillLandingInspection>().eq("inspection_num", inspectionNum).ne("inspection_sch", 5));
|
|
BillLandingInspection billLandingInspection = landingInspectionMapper.selectOne(new QueryWrapper<BillLandingInspection>().eq("inspection_num", inspectionNum).ne("inspection_sch", 5));
|
|
String eartags = billLandingInspection.getEartags();
|
|
String eartags = billLandingInspection.getEartags();
|
|
@@ -85,6 +89,10 @@ public class BillIsolatedServiceImpl extends ServiceImpl<BillIsolatedMapper, Bil
|
|
}
|
|
}
|
|
for (Integer number : numbers) {
|
|
for (Integer number : numbers) {
|
|
String earatgNo = number.toString();
|
|
String earatgNo = number.toString();
|
|
|
|
+ Integer num = baseAnimalMapper.selectCount(new QueryWrapper<BaseAnimal>().eq("earatg_no", earatgNo));
|
|
|
|
+ if (num != 0){
|
|
|
|
+ return new Result(10001,"耳标号重复",false);
|
|
|
|
+ }
|
|
BaseAnimal baseAnimal = new BaseAnimal();
|
|
BaseAnimal baseAnimal = new BaseAnimal();
|
|
baseAnimal.setEaratgNo(earatgNo);
|
|
baseAnimal.setEaratgNo(earatgNo);
|
|
baseAnimal.setAnimalType(billLandingInspection.getAnimalType());
|
|
baseAnimal.setAnimalType(billLandingInspection.getAnimalType());
|
|
@@ -95,6 +103,10 @@ public class BillIsolatedServiceImpl extends ServiceImpl<BillIsolatedMapper, Bil
|
|
baseAnimalMapper.insert(baseAnimal);
|
|
baseAnimalMapper.insert(baseAnimal);
|
|
}
|
|
}
|
|
}else {
|
|
}else {
|
|
|
|
+ Integer num = baseAnimalMapper.selectCount(new QueryWrapper<BaseAnimal>().eq("earatg_no", input));
|
|
|
|
+ if (num != 0){
|
|
|
|
+ return new Result(10001,"耳标号重复",false);
|
|
|
|
+ }
|
|
BaseAnimal baseAnimal = new BaseAnimal();
|
|
BaseAnimal baseAnimal = new BaseAnimal();
|
|
baseAnimal.setEaratgNo(input);
|
|
baseAnimal.setEaratgNo(input);
|
|
baseAnimal.setAnimalType(billLandingInspection.getAnimalType());
|
|
baseAnimal.setAnimalType(billLandingInspection.getAnimalType());
|
|
@@ -117,6 +129,10 @@ public class BillIsolatedServiceImpl extends ServiceImpl<BillIsolatedMapper, Bil
|
|
}
|
|
}
|
|
for (Integer number : numbers) {
|
|
for (Integer number : numbers) {
|
|
String earatgNo = number.toString();
|
|
String earatgNo = number.toString();
|
|
|
|
+ Integer num = baseAnimalMapper.selectCount(new QueryWrapper<BaseAnimal>().eq("earatg_no", earatgNo));
|
|
|
|
+ if (num != 0){
|
|
|
|
+ return new Result(10001,"耳标号重复",false);
|
|
|
|
+ }
|
|
BaseAnimal baseAnimal = new BaseAnimal();
|
|
BaseAnimal baseAnimal = new BaseAnimal();
|
|
baseAnimal.setEaratgNo(earatgNo);
|
|
baseAnimal.setEaratgNo(earatgNo);
|
|
baseAnimal.setAnimalType(billLandingInspection.getAnimalType());
|
|
baseAnimal.setAnimalType(billLandingInspection.getAnimalType());
|
|
@@ -127,6 +143,10 @@ public class BillIsolatedServiceImpl extends ServiceImpl<BillIsolatedMapper, Bil
|
|
baseAnimalMapper.insert(baseAnimal);
|
|
baseAnimalMapper.insert(baseAnimal);
|
|
}
|
|
}
|
|
}else {
|
|
}else {
|
|
|
|
+ Integer num = baseAnimalMapper.selectCount(new QueryWrapper<BaseAnimal>().eq("earatg_no", eartags));
|
|
|
|
+ if (num != 0){
|
|
|
|
+ return new Result(10001,"耳标号重复",false);
|
|
|
|
+ }
|
|
BaseAnimal baseAnimal = new BaseAnimal();
|
|
BaseAnimal baseAnimal = new BaseAnimal();
|
|
baseAnimal.setEaratgNo(eartags);
|
|
baseAnimal.setEaratgNo(eartags);
|
|
baseAnimal.setAnimalType(billLandingInspection.getAnimalType());
|
|
baseAnimal.setAnimalType(billLandingInspection.getAnimalType());
|
|
@@ -138,11 +158,11 @@ public class BillIsolatedServiceImpl extends ServiceImpl<BillIsolatedMapper, Bil
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- billLandingInspection.setInspectionSch(2);
|
|
|
|
|
|
+ billLandingInspection.setInspectionSch(3);
|
|
billLandingInspection.setReviewed(TokenSign.getUserName(httpServletRequest));
|
|
billLandingInspection.setReviewed(TokenSign.getUserName(httpServletRequest));
|
|
billLandingInspection.setReviewedTime(DateTime.now());
|
|
billLandingInspection.setReviewedTime(DateTime.now());
|
|
landingInspectionMapper.updateById(billLandingInspection);
|
|
landingInspectionMapper.updateById(billLandingInspection);
|
|
- this.save(billIsolated);
|
|
|
|
|
|
+
|
|
|
|
|
|
return Result.SUCCESS();
|
|
return Result.SUCCESS();
|
|
|
|
|
|
@@ -151,11 +171,14 @@ public class BillIsolatedServiceImpl extends ServiceImpl<BillIsolatedMapper, Bil
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public Result listIsolation(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
|
|
public Result listIsolation(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
|
|
|
|
+ String pageNum = paramsMap.get("pageNum");
|
|
|
|
+ String pageSize = paramsMap.get("pageSize");
|
|
String type = paramsMap.get("type");
|
|
String type = paramsMap.get("type");
|
|
|
|
+ Page<BillIsolated> page = new Page(Integer.parseInt(pageNum),Integer.parseInt(pageSize));
|
|
if (type.equals("1")){
|
|
if (type.equals("1")){
|
|
- return new Result(ResultCode.SUCCESS,this.list(new QueryWrapper<BillIsolated>().ge("str_isolated",LocalDate.now()).le("end_isolated",LocalDate.now())));
|
|
|
|
|
|
+ return new Result(ResultCode.SUCCESS,this.page(page,new QueryWrapper<BillIsolated>().ge("str_isolated",LocalDate.now()).le("end_isolated",LocalDate.now())));
|
|
}else {
|
|
}else {
|
|
- return new Result(ResultCode.SUCCESS,this.list(new QueryWrapper<BillIsolated>().lt("end_isolated",LocalDate.now())));
|
|
|
|
|
|
+ return new Result(ResultCode.SUCCESS,this.page(page,new QueryWrapper<BillIsolated>().lt("end_isolated",LocalDate.now())));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -198,6 +221,7 @@ public class BillIsolatedServiceImpl extends ServiceImpl<BillIsolatedMapper, Bil
|
|
BillIsolated isolation = this.getById(id);
|
|
BillIsolated isolation = this.getById(id);
|
|
isolation.setIsolatedPicUrl(content);
|
|
isolation.setIsolatedPicUrl(content);
|
|
isolation.setIsolatedSch(2);
|
|
isolation.setIsolatedSch(2);
|
|
|
|
+
|
|
if ("1".equals(isDead)){
|
|
if ("1".equals(isDead)){
|
|
BillIsolated billIsolated = this.getById(id);
|
|
BillIsolated billIsolated = this.getById(id);
|
|
List<BaseAnimal> baseAnimals = baseAnimalMapper.selectList(new QueryWrapper<BaseAnimal>().eq("inspection_num", billIsolated.getInspectionNum()));
|
|
List<BaseAnimal> baseAnimals = baseAnimalMapper.selectList(new QueryWrapper<BaseAnimal>().eq("inspection_num", billIsolated.getInspectionNum()));
|
|
@@ -207,25 +231,48 @@ public class BillIsolatedServiceImpl extends ServiceImpl<BillIsolatedMapper, Bil
|
|
}
|
|
}
|
|
isolation.setIsDead(1);
|
|
isolation.setIsDead(1);
|
|
isolation.setDeaths(deaths);
|
|
isolation.setDeaths(deaths);
|
|
- String[] eartag = deaths.split(";");
|
|
|
|
- for (String s : eartag) {
|
|
|
|
- if (!s.contains("-")){
|
|
|
|
- BaseAnimal baseAnimal = baseAnimalMapper.selectOne(new QueryWrapper<BaseAnimal>().eq("earatg_no", s));
|
|
|
|
- baseAnimal.setAnimalStatus(4);
|
|
|
|
|
|
+ if (deaths.contains(";")){
|
|
|
|
+ String[] eartag = deaths.split(";");
|
|
|
|
+ for (String s : eartag) {
|
|
|
|
+ if (!s.contains("-")){
|
|
|
|
+ BaseAnimal baseAnimal = baseAnimalMapper.selectOne(new QueryWrapper<BaseAnimal>().eq("earatg_no", s));
|
|
|
|
+ baseAnimal.setIsDie(1);
|
|
|
|
+ baseAnimalMapper.updateById(baseAnimal);
|
|
|
|
+ }else {
|
|
|
|
+ String start = s.substring(0, s.indexOf("-"));
|
|
|
|
+ String end = s.substring(s.indexOf("-") + 1);
|
|
|
|
+ String substring = start.substring(0, start.length() - end.length());
|
|
|
|
+ String finish = substring+end;
|
|
|
|
+ List<Integer> numbers = new ArrayList<>();
|
|
|
|
+ for (int i = Integer.parseInt(start); i <= Integer.parseInt(finish); i++) {
|
|
|
|
+ numbers.add(i);
|
|
|
|
+ }
|
|
|
|
+ for (Integer number : numbers) {
|
|
|
|
+ String earatgNo = number.toString();
|
|
|
|
+ BaseAnimal animal = baseAnimalMapper.selectOne(new QueryWrapper<BaseAnimal>().eq("earatg_no", earatgNo));
|
|
|
|
+ animal.setIsDie(1);
|
|
|
|
+ baseAnimalMapper.updateById(animal);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ if (!deaths.contains("-")){
|
|
|
|
+ BaseAnimal baseAnimal = baseAnimalMapper.selectOne(new QueryWrapper<BaseAnimal>().eq("earatg_no", deaths));
|
|
|
|
+ baseAnimal.setIsDie(1);
|
|
baseAnimalMapper.updateById(baseAnimal);
|
|
baseAnimalMapper.updateById(baseAnimal);
|
|
}else {
|
|
}else {
|
|
- String start = s.substring(0, s.indexOf("-"));
|
|
|
|
- String end = s.substring(s.indexOf("-") + 1);
|
|
|
|
|
|
+ String start = deaths.substring(0, deaths.indexOf("-"));
|
|
|
|
+ String end = deaths.substring(deaths.indexOf("-") + 1);
|
|
String substring = start.substring(0, start.length() - end.length());
|
|
String substring = start.substring(0, start.length() - end.length());
|
|
- String begin = start.substring(end.length()+1);
|
|
|
|
|
|
+ String finish = substring+end;
|
|
List<Integer> numbers = new ArrayList<>();
|
|
List<Integer> numbers = new ArrayList<>();
|
|
- for (int i = Integer.parseInt(begin); i <= Integer.parseInt(end); i++) {
|
|
|
|
|
|
+ for (int i = Integer.parseInt(start); i <= Integer.parseInt(finish); i++) {
|
|
numbers.add(i);
|
|
numbers.add(i);
|
|
}
|
|
}
|
|
for (Integer number : numbers) {
|
|
for (Integer number : numbers) {
|
|
- String earatgNo = substring + number.toString();
|
|
|
|
|
|
+ String earatgNo = number.toString();
|
|
BaseAnimal animal = baseAnimalMapper.selectOne(new QueryWrapper<BaseAnimal>().eq("earatg_no", earatgNo));
|
|
BaseAnimal animal = baseAnimalMapper.selectOne(new QueryWrapper<BaseAnimal>().eq("earatg_no", earatgNo));
|
|
- animal.setIsLoated(4);
|
|
|
|
|
|
+ animal.setIsDie(1);
|
|
baseAnimalMapper.updateById(animal);
|
|
baseAnimalMapper.updateById(animal);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -234,7 +281,7 @@ public class BillIsolatedServiceImpl extends ServiceImpl<BillIsolatedMapper, Bil
|
|
isolation.setIsDead(0);
|
|
isolation.setIsDead(0);
|
|
}
|
|
}
|
|
BillLandingInspection billLandingInspection = landingInspectionMapper.selectOne(new QueryWrapper<BillLandingInspection>().eq("inspection_num", isolation.getInspectionNum()));
|
|
BillLandingInspection billLandingInspection = landingInspectionMapper.selectOne(new QueryWrapper<BillLandingInspection>().eq("inspection_num", isolation.getInspectionNum()));
|
|
- billLandingInspection.setInspectionSch(3);
|
|
|
|
|
|
+ billLandingInspection.setInspectionSch(4);
|
|
landingInspectionMapper.updateById(billLandingInspection);
|
|
landingInspectionMapper.updateById(billLandingInspection);
|
|
this.save(isolation);
|
|
this.save(isolation);
|
|
return Result.SUCCESS();
|
|
return Result.SUCCESS();
|