|
@@ -1,5 +1,6 @@
|
|
|
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 com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
@@ -15,19 +16,18 @@ import com.huimv.farm.damsubsidy.mapper.BillIsolatedMapper;
|
|
|
import com.huimv.farm.damsubsidy.mapper.BillLandingInspectionMapper;
|
|
|
import com.huimv.farm.damsubsidy.service.IBillIsolatedService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
-
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.io.BufferedInputStream;
|
|
|
import java.io.ByteArrayOutputStream;
|
|
|
import java.io.InputStream;
|
|
|
-import java.text.DateFormat;
|
|
|
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;
|
|
@@ -59,36 +59,88 @@ public class BillIsolatedServiceImpl extends ServiceImpl<BillIsolatedMapper, Bil
|
|
|
String endIsolated = paramsMap.get("endIsolated");
|
|
|
|
|
|
BillIsolated billIsolated = new BillIsolated();
|
|
|
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
billIsolated.setInspectionName(TokenSign.getUserName(httpServletRequest)+"的隔离信息");
|
|
|
billIsolated.setInspectionNum(inspectionNum);
|
|
|
- billIsolated.setStrIsolated(LocalDate.parse(strIsolated));
|
|
|
+ billIsolated.setStrIsolated(LocalDateTime.parse(strIsolated,formatter));
|
|
|
billIsolated.setDayIsolated(Integer.parseInt(dayIsolated));
|
|
|
- billIsolated.setEndIsolated(LocalDate.parse(endIsolated));
|
|
|
-
|
|
|
- BillLandingInspection billLandingInspection = landingInspectionMapper.selectOne(new QueryWrapper<BillLandingInspection>().eq("inspectionNum", inspectionNum).ne("inspection_sch", 5));
|
|
|
- String input = billLandingInspection.getEartags();
|
|
|
-
|
|
|
- String start = input.substring(0, input.indexOf("-"));
|
|
|
- String end = input.substring(input.indexOf("-") + 1);
|
|
|
- String substring = start.substring(0, start.length() - end.length());
|
|
|
- String begin = start.substring(end.length()+1);
|
|
|
- List<Integer> numbers = new ArrayList<>();
|
|
|
- for (int i = Integer.parseInt(begin); i <= Integer.parseInt(end); i++) {
|
|
|
- numbers.add(i);
|
|
|
- }
|
|
|
- for (Integer number : numbers) {
|
|
|
- String earatgNo = substring + number.toString();
|
|
|
- BaseAnimal baseAnimal = new BaseAnimal();
|
|
|
- baseAnimal.setEaratgNo(earatgNo);
|
|
|
- baseAnimal.setAnimalType(billLandingInspection.getAnimalType());
|
|
|
- baseAnimal.setInspectionNum(billLandingInspection.getInspectionNum());
|
|
|
- baseAnimal.setCreateUser(TokenSign.getUserName(httpServletRequest));
|
|
|
- baseAnimal.setCreateTime(new Date());
|
|
|
- baseAnimalMapper.insert(baseAnimal);
|
|
|
+ billIsolated.setEndIsolated(LocalDateTime.parse(endIsolated,formatter));
|
|
|
+ billIsolated.setCreateTime(DateTime.now());
|
|
|
+ billIsolated.setCreateUser(TokenSign.getUserName(httpServletRequest));
|
|
|
+
|
|
|
+ BillLandingInspection billLandingInspection = landingInspectionMapper.selectOne(new QueryWrapper<BillLandingInspection>().eq("inspection_num", inspectionNum).ne("inspection_sch", 5));
|
|
|
+ String eartags = billLandingInspection.getEartags();
|
|
|
+
|
|
|
+ if (eartags.contains(";")){
|
|
|
+ String[] eartag = eartags.split(";");
|
|
|
+ for (String input : eartag) {
|
|
|
+ if (input.contains("-")){
|
|
|
+ String start = input.substring(0, input.indexOf("-"));
|
|
|
+ String end = input.substring(input.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 baseAnimal = new BaseAnimal();
|
|
|
+ baseAnimal.setEaratgNo(earatgNo);
|
|
|
+ baseAnimal.setAnimalType(billLandingInspection.getAnimalType());
|
|
|
+ baseAnimal.setInspectionNum(billLandingInspection.getInspectionNum());
|
|
|
+ baseAnimal.setBelongToUser(TokenSign.getUserName(httpServletRequest));
|
|
|
+ baseAnimal.setCreateUser(TokenSign.getUserName(httpServletRequest));
|
|
|
+ baseAnimal.setCreateTime(new Date());
|
|
|
+ baseAnimalMapper.insert(baseAnimal);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ BaseAnimal baseAnimal = new BaseAnimal();
|
|
|
+ baseAnimal.setEaratgNo(input);
|
|
|
+ baseAnimal.setAnimalType(billLandingInspection.getAnimalType());
|
|
|
+ baseAnimal.setInspectionNum(billLandingInspection.getInspectionNum());
|
|
|
+ baseAnimal.setBelongToUser(TokenSign.getUserName(httpServletRequest));
|
|
|
+ baseAnimal.setCreateUser(TokenSign.getUserName(httpServletRequest));
|
|
|
+ baseAnimal.setCreateTime(new Date());
|
|
|
+ baseAnimalMapper.insert(baseAnimal);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ if (eartags.contains("-")){
|
|
|
+ String start = eartags.substring(0, eartags.indexOf("-"));
|
|
|
+ String end = eartags.substring(eartags.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 baseAnimal = new BaseAnimal();
|
|
|
+ baseAnimal.setEaratgNo(earatgNo);
|
|
|
+ baseAnimal.setAnimalType(billLandingInspection.getAnimalType());
|
|
|
+ baseAnimal.setInspectionNum(billLandingInspection.getInspectionNum());
|
|
|
+ baseAnimal.setBelongToUser(TokenSign.getUserName(httpServletRequest));
|
|
|
+ baseAnimal.setCreateUser(TokenSign.getUserName(httpServletRequest));
|
|
|
+ baseAnimal.setCreateTime(new Date());
|
|
|
+ baseAnimalMapper.insert(baseAnimal);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ BaseAnimal baseAnimal = new BaseAnimal();
|
|
|
+ baseAnimal.setEaratgNo(eartags);
|
|
|
+ baseAnimal.setAnimalType(billLandingInspection.getAnimalType());
|
|
|
+ baseAnimal.setInspectionNum(billLandingInspection.getInspectionNum());
|
|
|
+ baseAnimal.setBelongToUser(TokenSign.getUserName(httpServletRequest));
|
|
|
+ baseAnimal.setCreateUser(TokenSign.getUserName(httpServletRequest));
|
|
|
+ baseAnimal.setCreateTime(new Date());
|
|
|
+ baseAnimalMapper.insert(baseAnimal);
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
billLandingInspection.setInspectionSch(2);
|
|
|
billLandingInspection.setReviewed(TokenSign.getUserName(httpServletRequest));
|
|
|
- billLandingInspection.setReviewedTime(LocalDate.now());
|
|
|
+ billLandingInspection.setReviewedTime(DateTime.now());
|
|
|
landingInspectionMapper.updateById(billLandingInspection);
|
|
|
this.save(billIsolated);
|
|
|
|
|
@@ -114,7 +166,7 @@ public class BillIsolatedServiceImpl extends ServiceImpl<BillIsolatedMapper, Bil
|
|
|
BillIsolated billIsolated = this.getById(id);
|
|
|
billIsolated.setDayIsolated(billIsolated.getDayIsolated()+Integer.parseInt(day));
|
|
|
billIsolated.setEndIsolated(billIsolated.getEndIsolated().plusDays(Integer.parseInt(day)));
|
|
|
- this.save(billIsolated);
|
|
|
+ this.updateById(billIsolated);
|
|
|
return Result.SUCCESS();
|
|
|
}
|
|
|
|
|
@@ -155,7 +207,7 @@ public class BillIsolatedServiceImpl extends ServiceImpl<BillIsolatedMapper, Bil
|
|
|
}
|
|
|
isolation.setIsDead(1);
|
|
|
isolation.setDeaths(deaths);
|
|
|
- String[] eartag = deaths.split(",");
|
|
|
+ String[] eartag = deaths.split(";");
|
|
|
for (String s : eartag) {
|
|
|
if (!s.contains("-")){
|
|
|
BaseAnimal baseAnimal = baseAnimalMapper.selectOne(new QueryWrapper<BaseAnimal>().eq("earatg_no", s));
|