2edb0619aa0129a8da5a1c75d70dc505ce3dded2.svn-base 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. package cn.com.goldenwater.dcproj.service.impl.ducha;
  2. import cn.com.goldenwater.dcproj.dao.BisInspHystpOthrDao;
  3. import cn.com.goldenwater.dcproj.model.BisInspHystpOthr;
  4. import cn.com.goldenwater.dcproj.param.BisInspHystpOthrParam;
  5. import cn.com.goldenwater.dcproj.service.BisInspHystpOthrService;
  6. import cn.com.goldenwater.core.service.AbstractCrudService;
  7. import cn.com.goldenwater.dcproj.service.BisInspHystpService;
  8. import cn.com.goldenwater.target.CheckException;
  9. import com.github.pagehelper.PageHelper;
  10. import org.springframework.beans.factory.annotation.Autowired;
  11. import org.springframework.stereotype.Service;
  12. import org.springframework.transaction.annotation.Transactional;
  13. import cn.com.goldenwater.id.util.UuidUtil;
  14. import java.util.HashMap;
  15. import java.util.List;
  16. import java.util.Date;
  17. import java.util.Map;
  18. /**
  19. * @author lhc
  20. * @date 2022-3-23
  21. */
  22. @Service
  23. @Transactional
  24. public class BisInspHystpOthrServiceImpl extends AbstractCrudService<BisInspHystpOthr, BisInspHystpOthrParam> implements BisInspHystpOthrService {
  25. @Autowired
  26. private BisInspHystpOthrDao bisInspHystpOthrDao;
  27. @Autowired
  28. private BisInspHystpService bisInspHystpService;
  29. public BisInspHystpOthrServiceImpl(BisInspHystpOthrDao bisInspHystpOthrDao) {
  30. super(bisInspHystpOthrDao);
  31. this.bisInspHystpOthrDao = bisInspHystpOthrDao;
  32. }
  33. @Override
  34. public int insert(BisInspHystpOthr bisInspHystpOthr) {
  35. String uuid = UuidUtil.uuid(); // 生成uuid
  36. bisInspHystpOthr.setId(uuid);
  37. bisInspHystpOthr.setIntm(new Date());
  38. bisInspHystpOthr.setUptm(new Date());
  39. bisInspHystpOthr.setDataStat("0");
  40. return this.bisInspHystpOthrDao.insert(bisInspHystpOthr);
  41. }
  42. @Override
  43. public int update(BisInspHystpOthr bisInspHystpOthr) {
  44. BisInspHystpOthr child = get(bisInspHystpOthr.getRgstrId());
  45. if (child == null) {
  46. throw new CheckException("未找到此登记表下的子表");
  47. }
  48. // 更新子表
  49. bisInspHystpOthr.setId(child.getId());
  50. bisInspHystpOthr.setUptm(new Date());
  51. int ret = bisInspHystpOthrDao.update(bisInspHystpOthr);
  52. // 更新登记表状态
  53. Map<String, Object> map = new HashMap<>(3);
  54. map.put("rgstrId", bisInspHystpOthr.getRgstrId());
  55. map.put("param", "othr");
  56. map.put("state", bisInspHystpOthr.getState());
  57. bisInspHystpService.updateState(map);
  58. return ret;
  59. }
  60. @Override
  61. public int delete(String id) {
  62. return this.bisInspHystpOthrDao.delete(id);
  63. }
  64. }