|
|
|
@ -18,6 +18,7 @@ import com.hnac.hzims.safeproduct.mapper.HygienePlanMapper;
|
|
|
|
|
import com.hnac.hzims.safeproduct.service.IHygienePlanService; |
|
|
|
|
import com.hnac.hzims.safeproduct.service.IHygieneRecordService; |
|
|
|
|
import com.hnac.hzims.safeproduct.service.IHygieneZoneService; |
|
|
|
|
import com.hnac.hzims.safeproduct.utils.BaseUtil; |
|
|
|
|
import com.hnac.hzims.safeproduct.vo.HygienePlanDetailVO; |
|
|
|
|
import com.hnac.hzims.safeproduct.vo.HygieneMonthVO; |
|
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
@ -126,7 +127,7 @@ public class HygienePlanServiceImpl extends ServiceImpl<HygienePlanMapper, Hygie
|
|
|
|
|
} |
|
|
|
|
String[] scores = zone.getCheckItemScore().split(",|,"); |
|
|
|
|
// 校验检查项总成绩是否为标准总成绩
|
|
|
|
|
getSumScore(scores, hygienePlanDTO.getStandardScore()); |
|
|
|
|
BaseUtil.getSumScore(scores, hygienePlanDTO.getStandardScore()); |
|
|
|
|
} |
|
|
|
|
// 校验通过则批量新增责任区数据
|
|
|
|
|
return R.status(hygieneZoneService.saveBatch(zoneList)); |
|
|
|
@ -155,13 +156,23 @@ public class HygienePlanServiceImpl extends ServiceImpl<HygienePlanMapper, Hygie
|
|
|
|
|
List<HygieneZoneEntity> zoneList = hygienePlanDTO.getZoneList(); |
|
|
|
|
// 若计划修改成功,修改关联责任区数据
|
|
|
|
|
if (updatePlan) { |
|
|
|
|
for (HygieneZoneEntity zone : zoneList) { |
|
|
|
|
String[] scores = zone.getCheckItemScore().split(",|,"); |
|
|
|
|
// 校验检查项总成绩是否为标准总成绩
|
|
|
|
|
getSumScore(scores, hygienePlanDTO.getStandardScore()); |
|
|
|
|
// 删除旧数据
|
|
|
|
|
boolean removeZone = hygieneZoneService.removeReferenceZone(hygienePlanDTO.getId()); |
|
|
|
|
if (removeZone) { |
|
|
|
|
hygienePlan = getPlanByName(hygienePlanDTO.getName()); |
|
|
|
|
// 增加新数据
|
|
|
|
|
for (HygieneZoneEntity zone : zoneList) { |
|
|
|
|
// 传计划id
|
|
|
|
|
if (hygienePlan != null) { |
|
|
|
|
zone.setHygienePlanId(hygienePlan.getId()); |
|
|
|
|
} |
|
|
|
|
String[] scores = zone.getCheckItemScore().split(",|,"); |
|
|
|
|
// 校验检查项总成绩是否为标准总成绩
|
|
|
|
|
BaseUtil.getSumScore(scores, hygienePlanDTO.getStandardScore()); |
|
|
|
|
} |
|
|
|
|
// 校验通过则批量修改责任区数据
|
|
|
|
|
return R.status(hygieneZoneService.saveBatch(zoneList)); |
|
|
|
|
} |
|
|
|
|
// 校验通过则批量修改责任区数据
|
|
|
|
|
return R.status(hygieneZoneService.updateBatchById(zoneList)); |
|
|
|
|
} |
|
|
|
|
return R.status(Boolean.FALSE); |
|
|
|
|
} |
|
|
|
@ -210,24 +221,6 @@ public class HygienePlanServiceImpl extends ServiceImpl<HygienePlanMapper, Hygie
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 计算累计分值 |
|
|
|
|
* @param scores 各项分值 |
|
|
|
|
* @param standardScore 标准总分值 |
|
|
|
|
*/ |
|
|
|
|
private void getSumScore(String[] scores, Integer standardScore) { |
|
|
|
|
int sum = 0; |
|
|
|
|
for (String score : scores) { |
|
|
|
|
sum += Integer.parseInt(score); |
|
|
|
|
if (sum > standardScore) { |
|
|
|
|
throw new ServiceException("累计分值超过标准总分值"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (sum < standardScore) { |
|
|
|
|
throw new ServiceException("标准总分值未全部分配"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 根据编码查询卫生自查计划 |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|