| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- package cn.com.goldenwater.dcproj.service.impl;
- import cn.com.goldenwater.core.service.AbstractCrudService;
- import cn.com.goldenwater.dcproj.dao.BisInspWiuqhHyistDao;
- import cn.com.goldenwater.dcproj.model.BisInspWiuqhHyist;
- import cn.com.goldenwater.dcproj.param.BisInspWiuqhHyistParam;
- import cn.com.goldenwater.dcproj.service.BisInspWiuqhHyistService;
- import cn.com.goldenwater.dcproj.service.BisInspWiuqhRgstrService;
- import cn.com.goldenwater.target.CheckException;
- 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;
- import java.util.Optional;
- /**
- * @author lhc
- * @date 2021-2-3
- */
- @Service
- @Transactional
- public class BisInspWiuqhHyistServiceImpl extends AbstractCrudService<BisInspWiuqhHyist, BisInspWiuqhHyistParam> implements BisInspWiuqhHyistService {
- @Autowired
- private BisInspWiuqhHyistDao bisInspWiuqhHyistDao;
- @Autowired
- private BisInspWiuqhRgstrService bisInspWiuqhRgstrService;
- public BisInspWiuqhHyistServiceImpl(BisInspWiuqhHyistDao bisInspWiuqhHyistDao) {
- super(bisInspWiuqhHyistDao);
- this.bisInspWiuqhHyistDao = bisInspWiuqhHyistDao;
- }
- @Override
- public int insert(BisInspWiuqhHyist bisInspWiuqhHyist) {
- String uuid = UuidUtil.uuid(); // 生成uuid
- bisInspWiuqhHyist.setId(uuid);
- bisInspWiuqhHyist.setIntm(new Date());
- bisInspWiuqhHyist.setUptm(new Date());
- bisInspWiuqhHyist.setDataStat("0");
- return this.bisInspWiuqhHyistDao.insert(bisInspWiuqhHyist);
- }
- @Override
- public int update(BisInspWiuqhHyist bisInspWiuqhHyist) {
- // 获取子表
- BisInspWiuqhHyist child = get(bisInspWiuqhHyist.getRgstrId());
- Optional.ofNullable(child).orElseThrow(() -> new CheckException("未找到此登记表下的子表"));
- // 更新子表
- bisInspWiuqhHyist.setId(child.getId());
- bisInspWiuqhHyist.setUptm(new Date());
- int ret = bisInspWiuqhHyistDao.update(bisInspWiuqhHyist);
- // 更新登记表状态
- Map<String, Object> map = new HashMap<>(3);
- map.put("rgstrId", bisInspWiuqhHyist.getRgstrId());
- map.put("param", "hyist");
- map.put("state", bisInspWiuqhHyist.getState());
- bisInspWiuqhRgstrService.updateState(map);
- return ret;
- }
- @Override
- public int delete(String id) {
- return this.bisInspWiuqhHyistDao.delete(id);
- }
- }
|