package cn.com.goldenwater.dcproj.service.impl.ducha; import cn.com.goldenwater.dcproj.dao.BisInspHystpDutyDao; import cn.com.goldenwater.dcproj.model.BisInspHystpDuty; import cn.com.goldenwater.dcproj.param.BisInspHystpDutyParam; import cn.com.goldenwater.dcproj.service.BisInspHystpDutyService; import cn.com.goldenwater.core.service.AbstractCrudService; import cn.com.goldenwater.dcproj.service.BisInspHystpService; 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.HashMap; import java.util.List; import java.util.Date; import java.util.Map; /** * @author lhc * @date 2022-3-23 */ @Service @Transactional public class BisInspHystpDutyServiceImpl extends AbstractCrudService implements BisInspHystpDutyService { @Autowired private BisInspHystpDutyDao bisInspHystpDutyDao; @Autowired private BisInspHystpService bisInspHystpService; public BisInspHystpDutyServiceImpl(BisInspHystpDutyDao bisInspHystpDutyDao) { super(bisInspHystpDutyDao); this.bisInspHystpDutyDao = bisInspHystpDutyDao; } @Override public int insert(BisInspHystpDuty bisInspHystpDuty) { String uuid = UuidUtil.uuid(); // 生成uuid bisInspHystpDuty.setId(uuid); bisInspHystpDuty.setIntm(new Date()); bisInspHystpDuty.setUptm(new Date()); bisInspHystpDuty.setDataStat("0"); return this.bisInspHystpDutyDao.insert(bisInspHystpDuty); } @Override public int update(BisInspHystpDuty bisInspHystpDuty) { // 获取子表 BisInspHystpDuty child = get(bisInspHystpDuty.getRgstrId()); if (child == null) { throw new CheckException("未找到此登记表下的子表"); } // 更新子表 bisInspHystpDuty.setId(child.getId()); bisInspHystpDuty.setUptm(new Date()); int ret = bisInspHystpDutyDao.update(bisInspHystpDuty); // 更新登记表状态 Map map = new HashMap<>(3); map.put("rgstrId", bisInspHystpDuty.getRgstrId()); map.put("param", "duty"); map.put("state", bisInspHystpDuty.getState()); bisInspHystpService.updateState(map); return ret; } @Override public int delete(String id) { return this.bisInspHystpDutyDao.delete(id); } }