| | |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public class TbResGeneralInvestigationServiceImpl extends ServiceImpl<TbResGeneralInvestigationMapper, TbResGeneralInvestigation> implements ITbResGeneralInvestigationService { |
| | | |
| | | @Autowired |
| | | private ITbResGeneralInvestigationStateService tbResGeneralInvestigationStateService; |
| | | |
| | | @Override |
| | | @Transactional |
| | | public boolean saveOrUpdateBy(TbResGeneralInvestigation entity) { |
| | | public R saveOrUpdateBy(TbResGeneralInvestigation entity) { |
| | | |
| | | QueryWrapper queryWrapper = new QueryWrapper(); |
| | | queryWrapper.eq("res_guid",entity.getResGuid()); |
| | | queryWrapper.eq("tb_year",entity.getTbYear()); |
| | | queryWrapper.eq("tb_quarter",entity.getTbYear()); |
| | | queryWrapper.eq("\"res_guid\"",entity.getResGuid()); |
| | | queryWrapper.eq("\"tb_year\"",entity.getTbYear()); |
| | | queryWrapper.eq("\"tb_quarter\"",entity.getTbQuarter()); |
| | | TbResGeneralInvestigationState state = tbResGeneralInvestigationStateService.getOne(queryWrapper); |
| | | if (null == state) { |
| | | state = new TbResGeneralInvestigationState(); |
| | | state.setResGuid(entity.getResGuid()); |
| | | state.setTbQuarter(entity.getTbQuarter()); |
| | | state.setTbYear(entity.getTbYear()); |
| | | state.setCreateTime(entity.getCreateTime()); |
| | | state.setCreateUser(entity.getCreateUser()); |
| | | } else { |
| | | if (state.getCheckState() == 1 || state.getCheckState() == 2) { |
| | | return R.fail(entity.getResName() + "本年度已经普查完成,不能在提交了。"); |
| | | } |
| | | } |
| | | |
| | | // 是否普查完成 1是 0否 |
| | | state.setCheckState(entity.getIsInvCom()); |
| | | if (entity.getCheckState() != 0) { |
| | | state.setCheckState(entity.getIsInvCom()); |
| | | } |
| | | |
| | | tbResGeneralInvestigationStateService.saveOrUpdate(state); |
| | | |
| | | return this.saveOrUpdate(entity); |
| | | entity.setTbStateId(state.getGuid()); |
| | | return R.status(this.saveOrUpdate(entity)); |
| | | } |
| | | } |