|
@@ -11,10 +11,16 @@ import com.ims.eval.dao.IndicatorMapper;
|
|
|
import com.ims.eval.config.CustomException;
|
|
|
import com.ims.eval.entity.Indicator;
|
|
|
import com.ims.eval.entity.IndicatorDictionary;
|
|
|
+import com.ims.eval.entity.YearOperatingCoefficient;
|
|
|
+import com.ims.eval.entity.dto.request.IndicatorDTO;
|
|
|
+import com.ims.eval.entity.dto.request.IndicatorDictionaryDTO;
|
|
|
import com.ims.eval.entity.dto.response.IndicatorResDTO;
|
|
|
+import com.ims.eval.service.IIndicatorDictionaryService;
|
|
|
import com.ims.eval.service.IIndicatorService;
|
|
|
import io.swagger.models.auth.In;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.io.Serializable;
|
|
@@ -34,6 +40,9 @@ public class IndicatorServiceImpl extends ServiceImpl<IndicatorMapper, Indicator
|
|
|
@Resource
|
|
|
private IndicatorDictionaryMapper indicatorDictionaryMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IIndicatorDictionaryService indicatorDictionaryService;
|
|
|
+
|
|
|
@Override
|
|
|
public IPage<Indicator> list(Integer pageNum, Integer pageSize, String id, String indicatorName, String indicatorCode, String binSection, String binStage, String dept, String company) {
|
|
|
|
|
@@ -156,6 +165,77 @@ public class IndicatorServiceImpl extends ServiceImpl<IndicatorMapper, Indicator
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
+ @Transactional
|
|
|
+ @Override
|
|
|
+ public boolean saveGroup(IndicatorDTO dto) {
|
|
|
+ if (null != dto && (null == dto.getId() || "".equals(dto.getId().trim()))) {
|
|
|
+ QueryWrapper<Indicator> qw = new QueryWrapper<>();
|
|
|
+ qw.lambda().eq(Indicator::getIndicatorCode, dto.getIndicatorCode());
|
|
|
+ qw.lambda().eq(Indicator::getBinSection, dto.getBinSection());
|
|
|
+ qw.lambda().eq(Indicator::getBinStage, dto.getBinStage());
|
|
|
+ List<Indicator> list = baseMapper.selectList(qw);
|
|
|
+ if (null != list && list.size() > 0) {
|
|
|
+ throw new CustomException("当前指标code已存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ dto.setCreateTime(new Date());
|
|
|
+ } else {
|
|
|
+ dto.setUpdateTime(new Date());
|
|
|
+ }
|
|
|
+
|
|
|
+ boolean b = super.saveOrUpdate(dto);
|
|
|
+ if (!b) {
|
|
|
+ throw new CustomException("指标保存失败");
|
|
|
+ }
|
|
|
+
|
|
|
+ for (IndicatorDictionaryDTO dto2 : dto.getDtoList()) {
|
|
|
+
|
|
|
+ if (null == dto2.getChildCode() || "".equals(dto2.getChildCode().trim()) || null == dto2.getChildName() || "".equals(dto2.getChildName().trim())) {
|
|
|
+ throw new CustomException("子指标名或编码为空");
|
|
|
+ }
|
|
|
+ for (IndicatorDictionary i : dto2.getList()) {
|
|
|
+ if (null != i && (null == i.getId() || "".equals(i.getId().trim()))) {
|
|
|
+ QueryWrapper<IndicatorDictionary> qw = new QueryWrapper<>();
|
|
|
+ qw.lambda().eq(IndicatorDictionary::getIndicatorId, i.getIndicatorId());
|
|
|
+ qw.lambda().eq(IndicatorDictionary::getChildCode, dto2.getChildCode());
|
|
|
+ qw.lambda().eq(IndicatorDictionary::getOptionCode, i.getOptionCode());
|
|
|
+ List<IndicatorDictionary> list2 = indicatorDictionaryMapper.selectList(qw);
|
|
|
+ if (null != list2 && list2.size() > 0) {
|
|
|
+ throw new CustomException("当前属性code已存在");
|
|
|
+ }
|
|
|
+ i.setIndicatorId(dto.getId());
|
|
|
+ i.setChildCode(dto2.getChildCode());
|
|
|
+ i.setChildName(dto2.getChildName());
|
|
|
+ i.setCreateTime(new Date());
|
|
|
+ i.setOptionName(null == CacheContext.ddNameMap.get(i.getOptionCode()) ? "未知属性" : CacheContext.ddNameMap.get(i.getOptionCode()));
|
|
|
+ } else {
|
|
|
+ i.setIndicatorId(dto.getId());
|
|
|
+ i.setChildCode(dto2.getChildCode());
|
|
|
+ i.setChildName(dto2.getChildName());
|
|
|
+ i.setOptionName(null == CacheContext.ddNameMap.get(i.getOptionCode()) ? "未知属性" : CacheContext.ddNameMap.get(i.getOptionCode()));
|
|
|
+ i.setUpdateTime(new Date());
|
|
|
+ }
|
|
|
+
|
|
|
+ b = indicatorDictionaryService.saveOrUpdate(i);
|
|
|
+ if (!b) {
|
|
|
+ throw new CustomException("指标明细存失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return b;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public IndicatorDTO getById(String id) {
|
|
|
+ //获取指标
|
|
|
+ IndicatorDTO indicatorDTO = baseMapper.selectById(id);
|
|
|
+ //根据指标获取明细组
|
|
|
+ List<IndicatorDictionaryDTO> dtoList = indicatorDictionaryService.list(indicatorDTO.getId(),"","");
|
|
|
+ indicatorDTO.setDtoList(dtoList);
|
|
|
+
|
|
|
+ return indicatorDTO;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public boolean saveOrUpdate(Indicator entity) {
|
|
|
|