| | |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.dao.business.InsuranceMapper; |
| | | import com.doumee.dao.business.WorktypeMapper; |
| | | import com.doumee.dao.business.join.DuWorkTypeJoinMapper; |
| | | import com.doumee.dao.business.join.WorktypeJoinMapper; |
| | | import com.doumee.dao.business.model.Insurance; |
| | | import com.doumee.dao.business.model.Solutions; |
| | | import com.doumee.dao.business.model.Worktype; |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.sun.corba.se.spi.orbutil.threadpool.Work; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.checkerframework.checker.units.qual.A; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | private InsuranceMapper insuranceMapper; |
| | | @Autowired |
| | | private WorktypeMapper worktypeMapper; |
| | | @Autowired |
| | | private WorktypeJoinMapper worktypeJoinMapper; |
| | | @Autowired |
| | | private SystemDictDataBiz systemDictDataBiz; |
| | | |
| | |
| | | if(workTypeName.size() != set.size()){ |
| | | throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"对不起,工种录入数据存在相同数据!"); |
| | | } |
| | | List<Worktype> saveList = new ArrayList<>(); |
| | | |
| | | for(Worktype w : worktypeList) { |
| | | if(!isNew){ |
| | | //查询保险公司下是否已存在该工种 |
| | |
| | | w.setInsuranceId(insurance.getId()); |
| | | w.setIsdeleted(Constants.ZERO); |
| | | w.setCreator(newModel.getCreator()); |
| | | w.setCreateDate(insurance.getCreateDate()); |
| | | w.setCreateDate(new Date()); |
| | | w.setDataType(insurance.getDataType()); |
| | | w.setStatus(Constants.ZERO); |
| | | w.setVersion(insurance.getVersion()); |
| | | w.setSortnum(num++); |
| | | worktypeMapper.insert(w); |
| | | saveList.add(w); |
| | | // worktypeMapper.insert(w); |
| | | |
| | | |
| | | //历史版本的工种信息 |
| | |
| | | newType.setDataType(Constants.TWO); |
| | | newType.setVersion(newModel.getVersion()); |
| | | w.setSortnum(num++); |
| | | worktypeMapper.insert(newType); |
| | | saveList.add(newType); |
| | | // worktypeMapper.insert(newType); |
| | | } |
| | | |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(saveList)){ |
| | | worktypeJoinMapper.insertBatchSomeColumn(saveList); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | private void initCreateParam(Insurance insurance) { |
| | |
| | | insuranceMapper.deleteBatchIds(ids); |
| | | } |
| | | |
| | | /*@Override |
| | | public void updateById(Insurance insurance) { |
| | | Insurance model = findById(insurance.getId()); |
| | | if(model == null || !Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO) |
| | | || !Constants.equalsInteger(model.getDataType(),Constants.ZERO)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY ); |
| | | } |
| | | //数据有效性校验 |
| | | initCreateParam(insurance); |
| | | if(insuranceMapper.selectCount(new QueryWrapper<Insurance>().lambda().eq(Insurance::getName,insurance.getName()) |
| | | .eq(Insurance::getIsdeleted,Constants.ZERO) |
| | | .eq(Insurance::getDataType,Constants.ZERO) |
| | | .ne(Insurance::getId,insurance.getId()) |
| | | )>Constants.ZERO){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"保险公司名称已存在"); |
| | | } |
| | | |
| | | LoginUserInfo user= (LoginUserInfo)SecurityUtils.getSubject().getPrincipal(); |
| | | Insurance updateModel = new Insurance(); |
| | | updateModel.setEditor(user.getId()); |
| | | updateModel.setName(insurance.getName()); |
| | | updateModel.setId(model.getId()); |
| | | updateModel.setVersion(UUID.randomUUID().toString()); |
| | | updateModel.setEditDate(new Date()); |
| | | updateModel.setRemark(insurance.getRemark()); |
| | | updateModel.setSortnum(insurance.getSortnum()); |
| | | updateModel.setLogo(insurance.getLogo()); |
| | | updateModel.setEnglishName(insurance.getEnglishName()); |
| | | updateModel.setLinkName(insurance.getLinkName()); |
| | | updateModel.setLinkPhone(insurance.getLinkPhone()); |
| | | updateModel.setPolicy(insurance.getPolicy()); |
| | | updateModel.setAgreement(insurance.getAgreement()); |
| | | updateModel.setClaimsInformation(insurance.getClaimsInformation()); |
| | | insuranceMapper.updateById(updateModel); |
| | | |
| | | //如果修改,则产生一个新的历史版本 ~ |
| | | // Insurance newModel = new Insurance(); |
| | | // BeanUtils.copyProperties(model,newModel); |
| | | // newModel.setId(null); |
| | | // newModel.setVersion(updateModel.getVersion()); |
| | | // newModel.setCreateDate(new Date()); |
| | | // newModel.setName(updateModel.getName()); |
| | | // newModel.setBaseId(insurance.getId()); |
| | | // newModel.setDataType(Constants.TWO); |
| | | // newModel.setLogo(insurance.getLogo()); |
| | | // newModel.setEnglishName(insurance.getEnglishName()); |
| | | // newModel.setLinkName(insurance.getLinkName()); |
| | | // newModel.setLinkPhone(insurance.getLinkPhone()); |
| | | // newModel.setPolicy(insurance.getPolicy()); |
| | | // newModel.setAgreement(insurance.getAgreement()); |
| | | // newModel.setClaimsInformation(insurance.getClaimsInformation()); |
| | | // insuranceMapper.insert(newModel); |
| | | |
| | | Insurance useVersion = insuranceMapper.selectOne(new QueryWrapper<Insurance>().lambda() |
| | | .eq(Insurance::getBaseId,insurance.getId()) |
| | | .eq(Insurance::getDataType,Constants.TWO) |
| | | .last(" limit 1") |
| | | ); |
| | | |
| | | Insurance updateUsrModel = new Insurance(); |
| | | updateUsrModel.setEditor(user.getId()); |
| | | updateUsrModel.setName(insurance.getName()); |
| | | updateUsrModel.setId(useVersion.getId()); |
| | | updateUsrModel.setVersion(UUID.randomUUID().toString()); |
| | | updateUsrModel.setEditDate(new Date()); |
| | | updateUsrModel.setRemark(insurance.getRemark()); |
| | | updateUsrModel.setSortnum(insurance.getSortnum()); |
| | | updateUsrModel.setLogo(insurance.getLogo()); |
| | | updateUsrModel.setEnglishName(insurance.getEnglishName()); |
| | | updateUsrModel.setLinkName(insurance.getLinkName()); |
| | | updateUsrModel.setLinkPhone(insurance.getLinkPhone()); |
| | | updateUsrModel.setPolicy(insurance.getPolicy()); |
| | | updateUsrModel.setAgreement(insurance.getAgreement()); |
| | | updateUsrModel.setClaimsInformation(insurance.getClaimsInformation()); |
| | | |
| | | //删除所有工种数据 |
| | | worktypeMapper.delete(new UpdateWrapper<Worktype>() |
| | | .lambda() |
| | | .in(Worktype::getInsuranceId,insurance.getId()) |
| | | ); |
| | | // insuranceMapper.update(null,new UpdateWrapper<Insurance>() |
| | | // .lambda() |
| | | // .eq(Insurance::getBaseId,insurance.getId()) |
| | | // .eq(Insurance::getDataType,Constants.TWO) |
| | | // .ne(Insurance::getId,newModel.getId()) |
| | | // .set(Insurance::getDataType,Constants.ONE) |
| | | // ); |
| | | worktypeMapper.update(null,new UpdateWrapper<Worktype>() |
| | | .lambda() |
| | | .eq(Worktype::getInsuranceId,useVersion.getId()) |
| | | .eq(Worktype::getDataType,Constants.TWO) |
| | | .set(Worktype::getDataType,Constants.ONE) |
| | | ); |
| | | |
| | | //处理工作信息,新增最新的,同时产生历史版本 |
| | | dealWorkTypeData(updateModel,useVersion,insurance.getWorktypeList(),false); |
| | | }*/ |
| | | |
| | | |
| | | @Override |
| | | public void updateById(Insurance insurance) { |
| | | Insurance model = findById(insurance.getId()); |