|
@@ -185,103 +185,24 @@ public class BillIsolatedServiceImpl extends ServiceImpl<BillIsolatedMapper, Bil
|
|
|
isolation.setIsolatedPicUrl(content);
|
|
|
isolation.setIsolatedSch(2);
|
|
|
|
|
|
- deaths = deaths.replace(",",",");
|
|
|
- deaths = deaths.replace(", ",",");
|
|
|
- deaths = deaths.replace(", ",",");
|
|
|
+ EartagResult eartagCollection = EartagUtil.getEartagCollection(deaths);
|
|
|
+ if (!eartagCollection.getSuccess()){
|
|
|
+ return new Result(10001,eartagCollection.getMsg(),false);
|
|
|
+ }
|
|
|
+ List<String> eartagList = eartagCollection.getEartagList();
|
|
|
if ("1".equals(isDead)){
|
|
|
isolation.setIsDead(1);
|
|
|
isolation.setDeaths(deaths);
|
|
|
- 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));
|
|
|
- if (ObjectUtil.isEmpty(baseAnimal)){
|
|
|
- return new Result(10001,"耳标号"+s+"不存在",false);
|
|
|
- }
|
|
|
- baseAnimal.setIsDie(1);
|
|
|
- if (baseAnimalMapper.updateById(baseAnimal) != 1) {
|
|
|
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
- return new Result(10001,"操作失败",false);
|
|
|
- }
|
|
|
- }else {
|
|
|
- String start = s.substring(0, s.indexOf("-"));
|
|
|
- if (start.length() != 15){
|
|
|
- return new Result(10001,"耳标号"+s+"格式错误需输入15位数字",false);
|
|
|
- }
|
|
|
- String end = s.substring(s.indexOf("-") + 1);
|
|
|
- if (end.length() != 3){
|
|
|
- return new Result(10001,"耳标号"+s+"格式错误,-后需输入3位数字",false);
|
|
|
- }
|
|
|
- String substring1 = s.substring(start.length() - end.length(), start.length());
|
|
|
- String substring = start.substring(0, start.length() - end.length());
|
|
|
- System.out.println(substring);
|
|
|
- if (Integer.parseInt(substring1) >Integer.parseInt(end) ){
|
|
|
- return new Result(10001,"耳标号"+s+"格式错误,包含-号耳标号需递增",false);
|
|
|
- }
|
|
|
- List<String> eartagNos = new ArrayList<>();
|
|
|
- for (int i = Integer.valueOf(substring1) ; i <= Integer.valueOf(end); i++){
|
|
|
- String earTag = getEndEartag(substring,i);
|
|
|
- eartagNos.add(earTag);
|
|
|
- }
|
|
|
- for (String number : eartagNos) {
|
|
|
- BaseAnimal animal = baseAnimalMapper.selectOne(new QueryWrapper<BaseAnimal>().eq("earatg_no", number));
|
|
|
- if (ObjectUtil.isEmpty(animal)){
|
|
|
- return new Result(10001,"耳标号"+number+"不存在",false);
|
|
|
- }
|
|
|
- animal.setIsDie(1);
|
|
|
- //TODO 加回滚
|
|
|
- if (baseAnimalMapper.updateById(animal) != 1) {
|
|
|
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
- return new Result(10001,"操作失败",false);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ for (String number : eartagList) {
|
|
|
+ BaseAnimal animal = baseAnimalMapper.selectOne(new QueryWrapper<BaseAnimal>().eq("earatg_no", number));
|
|
|
+ if (ObjectUtil.isEmpty(animal)){
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ return new Result(10001,"耳标号"+number+"不存在",false);
|
|
|
}
|
|
|
- }else {
|
|
|
- if (!deaths.contains("-")){
|
|
|
- BaseAnimal baseAnimal = baseAnimalMapper.selectOne(new QueryWrapper<BaseAnimal>().eq("earatg_no", deaths));
|
|
|
- if (ObjectUtil.isEmpty(baseAnimal)){
|
|
|
- return new Result(10001,"耳标号"+deaths+"不存在",false);
|
|
|
- }
|
|
|
- baseAnimal.setIsDie(1);
|
|
|
- //TODO 加回滚
|
|
|
- if (baseAnimalMapper.updateById(baseAnimal) != 1) {
|
|
|
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
- return new Result(10001,"操作失败",false);
|
|
|
- }
|
|
|
- }else {
|
|
|
- String start = deaths.substring(0, deaths.indexOf("-"));
|
|
|
- if (start.length() != 15){
|
|
|
- return new Result(10001,"耳标号"+deaths+"格式错误需输入15位数字",false);
|
|
|
- }
|
|
|
- String end = deaths.substring(deaths.indexOf("-") + 1);
|
|
|
- if (end.length() != 3){
|
|
|
- return new Result(10001,"耳标号"+deaths+"格式错误,-后需输入3位数字",false);
|
|
|
- }
|
|
|
- String substring1 = deaths.substring(start.length() - end.length(), start.length());
|
|
|
- String substring = start.substring(0, start.length() - end.length());
|
|
|
- if (Integer.parseInt(substring1) >Integer.parseInt(end)){
|
|
|
- return new Result(10001,"耳标号"+deaths+"格式错误,包含-号耳标号需递增",false);
|
|
|
- }
|
|
|
- List<String> eartagNos = new ArrayList<>();
|
|
|
- for (int i = Integer.valueOf(substring1) ; i <= Integer.valueOf(end); i++){
|
|
|
- String earTag = getEndEartag(substring,i);
|
|
|
- eartagNos.add(earTag);
|
|
|
- }
|
|
|
- for (String number : eartagNos) {
|
|
|
- // TODO
|
|
|
- BaseAnimal animal = baseAnimalMapper.selectOne(new QueryWrapper<BaseAnimal>().eq("earatg_no", number));
|
|
|
- if (ObjectUtil.isEmpty(animal)){
|
|
|
- return new Result(10001,"耳标号"+number+"不存在",false);
|
|
|
- }
|
|
|
- animal.setIsDie(1);
|
|
|
- //TODO 加回滚
|
|
|
- if (baseAnimalMapper.updateById(animal) != 1) {
|
|
|
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
- return new Result(10001,"操作失败",false);
|
|
|
- }
|
|
|
- }
|
|
|
+ animal.setIsDie(1);
|
|
|
+ if (baseAnimalMapper.updateById(animal) != 1) {
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ return new Result(10001,"操作失败",false);
|
|
|
}
|
|
|
}
|
|
|
}else {
|
|
@@ -290,7 +211,10 @@ public class BillIsolatedServiceImpl extends ServiceImpl<BillIsolatedMapper, Bil
|
|
|
List<BaseAnimal> baseAnimals = baseAnimalMapper.selectList(new QueryWrapper<BaseAnimal>().eq("inspection_num", isolation.getInspectionNum()));
|
|
|
for (BaseAnimal baseAnimal : baseAnimals) {
|
|
|
baseAnimal.setAnimalStatus(1);
|
|
|
- baseAnimalMapper.updateById(baseAnimal);
|
|
|
+ if (baseAnimalMapper.updateById(baseAnimal) != 1) {
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ return new Result(10001,"操作失败",false);
|
|
|
+ }
|
|
|
}
|
|
|
BillLandingInspection billLandingInspection = landingInspectionMapper.selectOne(new QueryWrapper<BillLandingInspection>().eq("inspection_num", isolation.getInspectionNum()));
|
|
|
billLandingInspection.setReviewedTime(DateTime.now());
|