| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- package cn.com.goldenwater.dcproj.service.impl;
- import cn.com.goldenwater.dcproj.dao.BisInspWtuntRgstrDao;
- import cn.com.goldenwater.dcproj.dao.BisInspWtuntRgstrSteelDao;
- import cn.com.goldenwater.dcproj.dao.BisInspWtuntRgstrSteelReoDao;
- import cn.com.goldenwater.dcproj.model.BisInspWtuntRgstr;
- import cn.com.goldenwater.dcproj.model.BisInspWtuntRgstrSteel;
- import cn.com.goldenwater.dcproj.model.BisInspWtuntRgstrSteelReo;
- import cn.com.goldenwater.dcproj.model.BisInspWtuntRgstrVo;
- import cn.com.goldenwater.dcproj.param.BisInspWtuntRgstrSteelParam;
- import cn.com.goldenwater.dcproj.param.BisInspWtuntRgstrSteelReoParam;
- import cn.com.goldenwater.dcproj.service.BisInspWtuntRgstrService;
- import cn.com.goldenwater.dcproj.service.BisInspWtuntRgstrSteelReoService;
- import cn.com.goldenwater.dcproj.service.BisInspWtuntRgstrSteelService;
- import cn.com.goldenwater.core.service.AbstractCrudService;
- import cn.com.goldenwater.dcproj.utils.Constant;
- import cn.com.goldenwater.id.util.UuidUtil;
- import org.apache.commons.collections.CollectionUtils;
- import org.apache.commons.lang3.StringUtils;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import org.springframework.transaction.annotation.Transactional;
- import java.util.Date;
- import java.util.List;
- /**
- * @author lune
- * @date 2020-8-17
- */
- @Service
- @Transactional(rollbackFor = Exception.class)
- public class BisInspWtuntRgstrSteelServiceImpl extends AbstractCrudService<BisInspWtuntRgstrSteel, BisInspWtuntRgstrSteelParam> implements BisInspWtuntRgstrSteelService {
- @Autowired
- private BisInspWtuntRgstrSteelDao bisInspWtuntRgstrSteelDao;
- @Autowired
- private BisInspWtuntRgstrDao bisInspWtuntRgstrDao;
- @Autowired
- private BisInspWtuntRgstrSteelReoDao bisInspWtuntRgstrSteelReoDao;
- public BisInspWtuntRgstrSteelServiceImpl(BisInspWtuntRgstrSteelDao bisInspWtuntRgstrSteelDao) {
- super(bisInspWtuntRgstrSteelDao);
- this.bisInspWtuntRgstrSteelDao = bisInspWtuntRgstrSteelDao;
- }
- @Override
- public void insertSteel(BisInspWtuntRgstrVo bisInspWtuntRgstrVo) {
- //钢铁
- BisInspWtuntRgstrSteel bisInspWtuntRgstrSteel = bisInspWtuntRgstrVo.getBisInspWtuntRgstrSteel();
- String rgstrId = bisInspWtuntRgstrSteel.getRgstrId();
- bisInspWtuntRgstrSteel.setUptm(new Date());
- if (StringUtils.isBlank(bisInspWtuntRgstrSteel.getId())) {
- BisInspWtuntRgstrSteelParam steelParam = new BisInspWtuntRgstrSteelParam();
- steelParam.setRgstrId(rgstrId);
- List<BisInspWtuntRgstrSteel> list = bisInspWtuntRgstrSteelDao.findList(steelParam);
- if (CollectionUtils.isEmpty(list)) {
- bisInspWtuntRgstrSteel.setId(UuidUtil.uuid());
- bisInspWtuntRgstrSteel.setIntm(new Date());
- bisInspWtuntRgstrSteelDao.insert(bisInspWtuntRgstrSteel);
- } else {
- bisInspWtuntRgstrSteel.setId(list.get(0).getId());
- bisInspWtuntRgstrSteelDao.update(bisInspWtuntRgstrSteel);
- }
- } else {
- bisInspWtuntRgstrSteelDao.update(bisInspWtuntRgstrSteel);
- }
- List<BisInspWtuntRgstrSteelReo> bisInspWtuntRgstrSteelReoList = bisInspWtuntRgstrVo.getBisInspWtuntRgstrSteelReo();
- for (BisInspWtuntRgstrSteelReo bisInspWtuntRgstrSteelReo : bisInspWtuntRgstrSteelReoList) {
- bisInspWtuntRgstrSteelReo.setUptm(new Date());
- //主要责任
- if (StringUtils.isBlank(bisInspWtuntRgstrSteelReo.getId())) {
- bisInspWtuntRgstrSteelReo.setId(UuidUtil.uuid());
- bisInspWtuntRgstrSteelReo.setRgstrId(rgstrId);
- bisInspWtuntRgstrSteelReo.setIntm(new Date());
- bisInspWtuntRgstrSteelReoDao.insert(bisInspWtuntRgstrSteelReo);
- } else {
- bisInspWtuntRgstrSteelReoDao.update(bisInspWtuntRgstrSteelReo);
- }
- }
- //修改登记表督查状态
- if (StringUtils.isNotBlank(rgstrId)) {
- BisInspWtuntRgstr wtuntRgstr = bisInspWtuntRgstrDao.get(rgstrId);
- if (!Constant.STRING_TWO.equals(wtuntRgstr.getState())) {
- wtuntRgstr.setUptm(new Date());
- wtuntRgstr.setState(Constant.STRING_ONE);
- wtuntRgstr.setWtuntStat(bisInspWtuntRgstrSteel.getStatus());
- bisInspWtuntRgstrDao.update(wtuntRgstr);
- }
- }
- }
- }
|