| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- package cn.com.goldenwater.dcproj.service.impl.ducha;
- import cn.com.goldenwater.dcproj.dao.AttRsBaseDao;
- import cn.com.goldenwater.dcproj.dao.BisInspBaseChkLogDao;
- import cn.com.goldenwater.dcproj.model.AttRsBase;
- import cn.com.goldenwater.dcproj.model.BisInspBaseChkLog;
- import cn.com.goldenwater.dcproj.param.AttRsBaseParam;
- import cn.com.goldenwater.dcproj.param.BisInspBaseChkLogParam;
- import cn.com.goldenwater.dcproj.service.BisInspBaseChkLogService;
- import cn.com.goldenwater.core.service.AbstractCrudService;
- import cn.com.goldenwater.id.util.UuidUtil;
- import com.github.pagehelper.PageHelper;
- import com.github.pagehelper.PageInfo;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import org.springframework.transaction.annotation.Transactional;
- import java.util.HashMap;
- import java.util.List;
- /**
- * @author litf
- * @date 2019-3-13
- */
- @Service
- @Transactional
- public class BisInspBaseChkLogServiceImpl extends AbstractCrudService<BisInspBaseChkLog, BisInspBaseChkLogParam> implements BisInspBaseChkLogService {
- @Autowired
- private BisInspBaseChkLogDao bisInspBaseChkLogDao;
- @Autowired
- private AttRsBaseDao attRsBaseDao;
- public BisInspBaseChkLogServiceImpl(BisInspBaseChkLogDao bisInspBaseChkLogDao) {
- super(bisInspBaseChkLogDao);
- this.bisInspBaseChkLogDao = bisInspBaseChkLogDao;
- }
- @Override
- public List<HashMap<String, Object>> getResByRsCode(String tableName, String rsCode) {
- return bisInspBaseChkLogDao.getResByRsCode(tableName, rsCode);
- }
- @Override
- public AttRsBase getBaseRes(String rsCode) {
- return bisInspBaseChkLogDao.getBaseRes(rsCode);
- }
- @Override
- public int updateChkFlag(String rsCode, String chkIn) {
- return bisInspBaseChkLogDao.updateChkFlag(rsCode, chkIn);
- }
- @Override
- public PageInfo<HashMap<String, Object>> getReviewRes(AttRsBaseParam param) {
- PageHelper.startPage(param.getPageNum(),param.getPageSize());
- PageHelper.orderBy(param.getOrderBy());
- List<HashMap<String, Object>> list = bisInspBaseChkLogDao.getReviewRes(param);
- return new PageInfo<HashMap<String, Object>>(list);
- }
- @Transactional
- @Override
- public String insertRes(BisInspBaseChkLog bisInspBaseChkLog) {
- String uuid = UuidUtil.uuid(); // 生成uuid
- bisInspBaseChkLog.setChkId(uuid);
- if ("0".equals(bisInspBaseChkLog.getChkIn())) {
- // 审核未通过
- int ret = bisInspBaseChkLogDao.insert(bisInspBaseChkLog);
- return uuid;
- } else if ("1".equals(bisInspBaseChkLog.getChkIn())) {
- // 通过审核
- AttRsBase attRsBase = bisInspBaseChkLogDao.getBaseRes(bisInspBaseChkLog.getObjCode());
- if (attRsBase == null) {
- // 添加待审核,更新水库基础表
- AttRsBase res = new AttRsBase();
- res.setRsCode(bisInspBaseChkLog.getObjCode());
- res.setChkState(bisInspBaseChkLog.getChkIn());
- attRsBaseDao.update(res);
- } else {
- // 更新待审核,更新水库基础表和更新备份表
- attRsBase.setChkState(bisInspBaseChkLog.getChkIn());
- attRsBaseDao.update(attRsBase);
- bisInspBaseChkLogDao.updateChkFlag(bisInspBaseChkLog.getObjCode(), bisInspBaseChkLog.getChkIn());
- }
- bisInspBaseChkLogDao.insert(bisInspBaseChkLog);
- }
- return uuid;
- }
- }
|