package cn.com.goldenwater.dcproj.service.impl; import cn.com.goldenwater.dcproj.dao.BisInspFundChecDao; import cn.com.goldenwater.dcproj.model.BisInspFundChec; import cn.com.goldenwater.dcproj.param.BisInspFundChecParam; import cn.com.goldenwater.dcproj.service.BisInspFundChecService; import cn.com.goldenwater.core.service.AbstractCrudService; import cn.com.goldenwater.dcproj.service.BisInspFundRgstrService; 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 lisen * @date 2021-6-19 */ @Service @Transactional public class BisInspFundChecServiceImpl extends AbstractCrudService implements BisInspFundChecService { @Autowired private BisInspFundChecDao bisInspFundChecDao; @Autowired private BisInspFundRgstrService bisInspFundRgstrService; public BisInspFundChecServiceImpl(BisInspFundChecDao bisInspFundChecDao) { super(bisInspFundChecDao); this.bisInspFundChecDao = bisInspFundChecDao; } @Override public int insert(BisInspFundChec bisInspFundChec) { String uuid = UuidUtil.uuid(); // 生成uuid bisInspFundChec.setId(uuid); bisInspFundChec.setIntm(new Date()); bisInspFundChec.setUptm(new Date()); bisInspFundChec.setDataStat("0"); return this.bisInspFundChecDao.insert(bisInspFundChec); } @Override public int update(BisInspFundChec bisInspFundChec) { // 获取子表 BisInspFundChec fundChec = get(bisInspFundChec.getRgstrId()); if (fundChec == null) { throw new CheckException("未找到此登记表下的子表"); } // 更新子表 bisInspFundChec.setId(bisInspFundChec.getId()); bisInspFundChec.setUptm(new Date()); int ret = bisInspFundChecDao.update(bisInspFundChec); // 更新登记表状态 Map map = new HashMap<>(3); map.put("rgstrId", bisInspFundChec.getRgstrId()); map.put("param", "chec"); map.put("state", bisInspFundChec.getState()); bisInspFundRgstrService.updateState(map); return ret; } @Override public int delete(String id) { return this.bisInspFundChecDao.delete(id); } }