package cn.com.goldenwater.dcproj.service.impl; import cn.com.goldenwater.core.service.AbstractCrudService; import cn.com.goldenwater.dcproj.dao.BisInspRsfcoqhPresDao; import cn.com.goldenwater.dcproj.model.BisInspRsfcoqhPres; import cn.com.goldenwater.dcproj.param.BisInspRsfcoqhPresParam; import cn.com.goldenwater.dcproj.service.BisInspRsfcoqhPresService; import cn.com.goldenwater.dcproj.service.BisInspRsfcoqhRgstrService; import cn.com.goldenwater.id.util.UuidUtil; 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.HashMap; import java.util.Map; /** * @author lhc * @date 2021-6-10 */ @Service @Transactional public class BisInspRsfcoqhPresServiceImpl extends AbstractCrudService implements BisInspRsfcoqhPresService { @Autowired private BisInspRsfcoqhPresDao bisInspRsfcoqhPresDao; @Autowired private BisInspRsfcoqhRgstrService bisInspRsfcoqhRgstrService; public BisInspRsfcoqhPresServiceImpl(BisInspRsfcoqhPresDao bisInspRsfcoqhPresDao) { super(bisInspRsfcoqhPresDao); this.bisInspRsfcoqhPresDao = bisInspRsfcoqhPresDao; } @Override public int insert(BisInspRsfcoqhPres bisInspRsfcoqhPres) { BisInspRsfcoqhPres checkRgstr = bisInspRsfcoqhPresDao.get(bisInspRsfcoqhPres.getRgstrId()); if (checkRgstr != null) { bisInspRsfcoqhPres.setId(checkRgstr.getId()); return update(bisInspRsfcoqhPres); } updateRgstrState(bisInspRsfcoqhPres); String uuid = UuidUtil.uuid(); bisInspRsfcoqhPres.setId(uuid); bisInspRsfcoqhPres.setIntm(new Date()); bisInspRsfcoqhPres.setUptm(new Date()); bisInspRsfcoqhPres.setDataStat("0"); return this.bisInspRsfcoqhPresDao.insert(bisInspRsfcoqhPres); } @Override public int update(BisInspRsfcoqhPres bisInspRsfcoqhPres) { bisInspRsfcoqhPres.setUptm(new Date()); updateRgstrState(bisInspRsfcoqhPres); return this.bisInspRsfcoqhPresDao.update(bisInspRsfcoqhPres); } /** * 修改登记表状态 * @param bisInspRsfcoqhPres */ private void updateRgstrState(BisInspRsfcoqhPres bisInspRsfcoqhPres) { // 更新登记表状态 Map map = new HashMap<>(3); map.put("rgstrId", bisInspRsfcoqhPres.getRgstrId()); map.put("param", "pres"); map.put("state", bisInspRsfcoqhPres.getState()); bisInspRsfcoqhRgstrService.updateState(map); } @Override public int delete(String id) { return this.bisInspRsfcoqhPresDao.delete(id); } }