|
@@ -28,6 +28,7 @@ import com.huimv.farm.test.Print3;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.ServletOutputStream;
|
|
@@ -107,6 +108,7 @@ public class BillSubsidyServiceImpl extends ServiceImpl<BillSubsidyMapper, BillS
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = RuntimeException.class)
|
|
|
public Result edit(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
|
|
|
Integer type = Integer.parseInt(paramsMap.get("type"));
|
|
|
String id = paramsMap.get("id");
|
|
@@ -125,7 +127,10 @@ public class BillSubsidyServiceImpl extends ServiceImpl<BillSubsidyMapper, BillS
|
|
|
List<BaseAnimal> baseAnimals = animalMapper.selectList(animalQueryWrapper);
|
|
|
for (BaseAnimal baseAnimal : baseAnimals) {
|
|
|
baseAnimal.setIsLoated(0);
|
|
|
- animalMapper.updateById(baseAnimal);
|
|
|
+ if (animalMapper.updateById(baseAnimal) != 1) {
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ return new Result(10001,"操作失败",false);
|
|
|
+ }
|
|
|
}
|
|
|
billSubsidy.setRefuseReason(refuseReason);
|
|
|
billSubsidy.setSubsidySch(2);
|
|
@@ -146,6 +151,7 @@ public class BillSubsidyServiceImpl extends ServiceImpl<BillSubsidyMapper, BillS
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = RuntimeException.class)
|
|
|
public Result edit2(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
|
|
|
Integer type = Integer.parseInt(paramsMap.get("type"));
|
|
|
String id = paramsMap.get("id");
|
|
@@ -173,7 +179,10 @@ public class BillSubsidyServiceImpl extends ServiceImpl<BillSubsidyMapper, BillS
|
|
|
for (BaseAnimal baseAnimal : baseAnimals) {
|
|
|
baseAnimal.setIsLoated(0);
|
|
|
baseAnimal.setAnimalStatus(1);
|
|
|
- animalMapper.updateById(baseAnimal);
|
|
|
+ if (animalMapper.updateById(baseAnimal) != 1) {
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ return new Result(10001,"操作失败",false);
|
|
|
+ }
|
|
|
}
|
|
|
subsidyMapper.updateById(billSubsidy);
|
|
|
return new Result(ResultCode.SUCCESS, billSubsidy);
|
|
@@ -222,7 +231,7 @@ public class BillSubsidyServiceImpl extends ServiceImpl<BillSubsidyMapper, BillS
|
|
|
private BillBuyInfoMapper billBuyInfoMapper;
|
|
|
|
|
|
@Override
|
|
|
- @Transactional
|
|
|
+ @Transactional(rollbackFor = RuntimeException.class)
|
|
|
public Result addApplication(HttpServletRequest httpServletRequest, BillSubsidy billSubsidy) {
|
|
|
Integer type = sysUserMapper.selectOne(new QueryWrapper<SysUser>().eq("id", TokenSign.getMemberIdByJwtToken(httpServletRequest))).getUserType();
|
|
|
|
|
@@ -272,7 +281,10 @@ public class BillSubsidyServiceImpl extends ServiceImpl<BillSubsidyMapper, BillS
|
|
|
if (!eartag.contains("-")) {
|
|
|
BaseAnimal animal = baseAnimalMapper.selectOne(new QueryWrapper<BaseAnimal>().eq("earatg_no", eartag));
|
|
|
animal.setIsLoated(1);
|
|
|
- baseAnimalMapper.updateById(animal);
|
|
|
+ if (baseAnimalMapper.updateById(animal) != 1) {
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ return new Result(10001,"操作失败",false);
|
|
|
+ }
|
|
|
} else {
|
|
|
String start = eartag.substring(0, eartag.indexOf("-"));
|
|
|
String end = eartag.substring(eartag.indexOf("-") + 1);
|
|
@@ -286,7 +298,10 @@ public class BillSubsidyServiceImpl extends ServiceImpl<BillSubsidyMapper, BillS
|
|
|
String earatgNo = number.toString();
|
|
|
BaseAnimal animal = baseAnimalMapper.selectOne(new QueryWrapper<BaseAnimal>().eq("earatg_no", earatgNo));
|
|
|
animal.setIsLoated(1);
|
|
|
- baseAnimalMapper.updateById(animal);
|
|
|
+ if (baseAnimalMapper.updateById(animal) != 1) {
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ return new Result(10001,"操作失败",false);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -372,6 +387,7 @@ public class BillSubsidyServiceImpl extends ServiceImpl<BillSubsidyMapper, BillS
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = RuntimeException.class)
|
|
|
public Result editApplication(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
|
|
|
String id = paramsMap.get("id");
|
|
|
String type = paramsMap.get("type");
|
|
@@ -394,7 +410,10 @@ public class BillSubsidyServiceImpl extends ServiceImpl<BillSubsidyMapper, BillS
|
|
|
.eq("belong_to_user", TokenSign.getMemberIdByJwtToken(httpServletRequest)));
|
|
|
for (BaseAnimal baseAnimal : baseAnimals) {
|
|
|
baseAnimal.setIsLoated(0);
|
|
|
- baseAnimalMapper.updateById(baseAnimal);
|
|
|
+ if (baseAnimalMapper.updateById(baseAnimal) != 1) {
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ return new Result(10001,"操作失败",false);
|
|
|
+ }
|
|
|
}
|
|
|
this.removeById(billSubsidy);
|
|
|
return Result.SUCCESS();
|