| | |
| | | package com.doumee.service.business.impl; |
| | | |
| | | import com.doumee.biz.system.SystemDictDataBiz; |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.model.LoginUserInfo; |
| | |
| | | private InsuranceMapper insuranceMapper; |
| | | @Autowired |
| | | private WorktypeMapper worktypeMapper; |
| | | @Autowired |
| | | private SystemDictDataBiz systemDictDataBiz; |
| | | |
| | | @Override |
| | | @Transactional |
| | |
| | | if(worktypeList.size()==0){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,工种不能为空!"); |
| | | } |
| | | if(StringUtils.isNotBlank(insurance.getEnglishName()) && insurance.getEnglishName().length()>100){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,英文名超长!"); |
| | | } |
| | | if(StringUtils.isNotBlank(insurance.getLinkName()) && insurance.getLinkName().length()>10){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,联系人名称超长!"); |
| | | } |
| | | if(StringUtils.isNotBlank(insurance.getLinkPhone()) && insurance.getLinkPhone().length()!=11){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,请输入正确的手机号!"); |
| | | } |
| | | insurance.setWorktypeList(worktypeList); |
| | | } |
| | | |
| | |
| | | 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); |
| | | |
| | | //如果修改,则产生一个新的历史版本 ~ |
| | |
| | | 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); |
| | | |
| | | //删除所有工种数据 |
| | |
| | | if (pageWrap.getModel().getBaseId() != null) { |
| | | queryWrapper.lambda().eq(Insurance::getBaseId, pageWrap.getModel().getBaseId()); |
| | | } |
| | | /* for(PageWrap.SortData sortData: pageWrap.getSorts()) { |
| | | if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) { |
| | | queryWrapper.orderByDesc(sortData.getProperty()); |
| | | } else { |
| | | queryWrapper.orderByAsc(sortData.getProperty()); |
| | | } |
| | | |
| | | }*/ |
| | | queryWrapper.lambda().orderByAsc(Insurance::getSortnum); |
| | | return PageData.from(insuranceMapper.selectPage(page, queryWrapper)); |
| | | PageData<Insurance> pageData = PageData.from(insuranceMapper.selectPage(page, queryWrapper)); |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(pageData.getRecords())){ |
| | | String path = systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode() |
| | | +systemDictDataBiz.queryByCode(Constants.OSS,Constants.INSURANCE).getCode(); |
| | | for (Insurance insurance:pageData.getRecords()) { |
| | | if (StringUtils.isNotBlank(insurance.getLogo())) { |
| | | insurance.setLogoFullUrl(path + insurance.getLogo() ); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return pageData; |
| | | } |
| | | |
| | | @Override |