|
@@ -18,6 +18,7 @@ import com.huimv.apiservice.entity.vo.*;
|
|
|
import com.huimv.apiservice.service.PigService;
|
|
|
import com.huimv.common.exception.RRException;
|
|
|
import com.huimv.common.utils.PageUtils;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -73,7 +74,6 @@ public class PigServiceImpl extends ServiceImpl<PigDao, YearPigBaseEntity> imple
|
|
|
|
|
|
boolean health = baseMapper.selectHealthStatus(pigEarTagNo);
|
|
|
result.put("healthStatus", health ? "健康" : "不健康");
|
|
|
-
|
|
|
result.put("sleepStatus", sleepStatus);
|
|
|
result.put("sportStatus", sportStatus);
|
|
|
|
|
@@ -196,9 +196,12 @@ public class PigServiceImpl extends ServiceImpl<PigDao, YearPigBaseEntity> imple
|
|
|
throw new RRException("品种名称不存在,请检查!", 1001);
|
|
|
}
|
|
|
|
|
|
- Integer periodId = periodDao.selectIdByPeriodNumber(period);
|
|
|
- if (periodId == null) {
|
|
|
- throw new RRException("栏期编号不存在,请检查!", 1001);
|
|
|
+ Integer periodId = null;
|
|
|
+ if (StringUtils.isNotEmpty(period)) {
|
|
|
+ periodId = periodDao.selectIdByPeriodNumber(period);
|
|
|
+ if (periodId == null) {
|
|
|
+ throw new RRException("栏期编号不存在,请检查!", 1001);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -288,14 +291,24 @@ public class PigServiceImpl extends ServiceImpl<PigDao, YearPigBaseEntity> imple
|
|
|
|
|
|
checkPigEarTagNo(pigEarTagNo);
|
|
|
|
|
|
- if (!status.equals(1) && !status.equals(2) && !status.equals(3)) {
|
|
|
- throw new RRException("出栏状态有误,请检查!", 1001);
|
|
|
+// if (!status.equals(1) && !status.equals(2) && !status.equals(3)) {
|
|
|
+// throw new RRException("出栏状态有误,请检查!", 1001);
|
|
|
+// }
|
|
|
+ LambdaQueryWrapper<YearPigBaseEntity> pigBaseLambdaQuery = Wrappers.lambdaQuery();
|
|
|
+ pigBaseLambdaQuery.eq(YearPigBaseEntity::getEartag, pigEarTagNo);
|
|
|
+ YearPigBaseEntity yearPigBaseEntity = baseMapper.selectOne(pigBaseLambdaQuery);
|
|
|
+ Integer outFenceStatus = yearPigBaseEntity.getOutFenceStatus();
|
|
|
+ if (outFenceStatus != null) {
|
|
|
+ if (outFenceStatus.equals(1) || outFenceStatus.equals(2) || outFenceStatus.equals(3)) {
|
|
|
+ throw new RRException("该猪已出栏,不可重复出栏!", 1001);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
LambdaUpdateWrapper<YearPigBaseEntity> pigBaseLambdaUpdate = Wrappers.lambdaUpdate();
|
|
|
pigBaseLambdaUpdate.eq(YearPigBaseEntity::getEartag, pigEarTagNo)
|
|
|
.set(YearPigBaseEntity::getDeleted, true)
|
|
|
.set(YearPigBaseEntity::getFosterStatus, false)
|
|
|
+ .set(YearPigBaseEntity::getOutFenceTime,new Date())
|
|
|
.set(YearPigBaseEntity::getOutFenceStatus, status);
|
|
|
|
|
|
update(pigBaseLambdaUpdate);
|