| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- package cn.com.goldenwater.dcproj.service.impl;
- import cn.com.goldenwater.dcproj.dao.BisInspQaScore1SdDao;
- import cn.com.goldenwater.dcproj.model.BisInspQaScore1Sd;
- import cn.com.goldenwater.dcproj.model.GwComFile;
- import cn.com.goldenwater.dcproj.param.BisInspQaScore1SdParam;
- import cn.com.goldenwater.dcproj.service.BisInspQaScore1SdService;
- import cn.com.goldenwater.core.service.AbstractCrudService;
- import cn.com.goldenwater.dcproj.service.GwComFileService;
- import cn.com.goldenwater.dcproj.utils.StringUtils;
- import cn.com.goldenwater.target.CheckException;
- import com.github.pagehelper.PageHelper;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import org.springframework.transaction.annotation.Transactional;
- import cn.com.goldenwater.id.util.UuidUtil;
- import java.util.List;
- import java.util.Date;
- import java.util.Optional;
- /**
- * @author lhc
- * @date 2024-4-7
- */
- @Service
- @Transactional
- public class BisInspQaScore1SdServiceImpl extends AbstractCrudService<BisInspQaScore1Sd, BisInspQaScore1SdParam> implements BisInspQaScore1SdService {
- @Autowired
- private BisInspQaScore1SdDao bisInspQaScore1SdDao;
- @Autowired
- private GwComFileService gwComFileService;
- public BisInspQaScore1SdServiceImpl(BisInspQaScore1SdDao bisInspQaScore1SdDao) {
- super(bisInspQaScore1SdDao);
- this.bisInspQaScore1SdDao = bisInspQaScore1SdDao;
- }
- @Override
- public BisInspQaScore1Sd get(String key) {
- BisInspQaScore1Sd score = super.get(key);
- Optional.ofNullable(score).ifPresent(s -> {
- List<GwComFile> gwComFileList = gwComFileService.findFileByBiz(s.getId());
- s.setGwComFileList(gwComFileList);
- });
- return score;
- }
- @Override
- public int insert(BisInspQaScore1Sd bisInspQaScore1Sd) {
- if (StringUtils.isBlank(bisInspQaScore1Sd.getCaseId())) {
- throw new CheckException("caseId为空");
- }
- if (StringUtils.isBlank(bisInspQaScore1Sd.getScoreName())) {
- throw new CheckException("scoreName为空");
- }
- BisInspQaScore1Sd score = getByCaseScore(bisInspQaScore1Sd.getCaseId(), bisInspQaScore1Sd.getScoreName());
- if (score != null) {
- return update(bisInspQaScore1Sd);
- }
- // 生成uuid
- String uuid = UuidUtil.uuid();
- bisInspQaScore1Sd.setId(uuid);
- bisInspQaScore1Sd.setIntm(new Date());
- bisInspQaScore1Sd.setUptm(new Date());
- bisInspQaScore1Sd.setDataStat("0");
- int ret = this.bisInspQaScore1SdDao.insert(bisInspQaScore1Sd);
- gwComFileService.updateBiz(bisInspQaScore1Sd.getGwComFileList(), bisInspQaScore1Sd.getId());
- return ret;
- }
- @Override
- public int update(BisInspQaScore1Sd bisInspQaScore1Sd) {
- bisInspQaScore1Sd.setUptm(new Date());
- return this.bisInspQaScore1SdDao.update(bisInspQaScore1Sd);
- }
- @Override
- public int delete(String id) {
- return this.bisInspQaScore1SdDao.delete(id);
- }
- @Override
- public BisInspQaScore1Sd getByCaseScore(String caseId, String scoreName) {
- BisInspQaScore1Sd score = bisInspQaScore1SdDao.getByCaseScore(caseId, scoreName);
- Optional.ofNullable(score).ifPresent(s -> {
- List<GwComFile> gwComFileList = gwComFileService.findFileByBiz(s.getId());
- s.setGwComFileList(gwComFileList);
- });
- return score;
- }
- }
|