| | |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.UUID; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 保险方案信息表Service实现 |
| | |
| | | @Service |
| | | public class SolutionsServiceImpl implements SolutionsService { |
| | | |
| | | @Autowired |
| | | private MultifileMapper multifileMapper; |
| | | @Autowired |
| | | private SolutionsMapper solutionsMapper; |
| | | @Autowired |
| | |
| | | solutionsMapper.insert(newModel); |
| | | |
| | | dealWorkType(solutions,newModel,solutions.getWorktypeIdList(),true); |
| | | if(Constants.equalsObject(solutions.getType(),Constants.ONE) ){ |
| | | if (solutions.getFanganFile()==null || StringUtils.isBlank(solutions.getFanganFile().getFileurl())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"请上传方案确认书!"); |
| | | } |
| | | |
| | | Multifile file = solutions.getFanganFile(); |
| | | file.setIsdeleted(Constants.ZERO); |
| | | file.setCreateDate(new Date()); |
| | | file.setCreator(user.getId()); |
| | | file.setObjId(solutions.getId()); |
| | | file.setObjType(Constants.MultiFile.SOLUTIONS_CONFIRMATION_LATTER.getKey()); |
| | | file.setType(Constants.formatIntegerNum(file.getType())); |
| | | multifileMapper.insert(file); |
| | | } |
| | | return solutions.getId(); |
| | | } |
| | | |
| | |
| | | .lambda() |
| | | .eq(SolutionWorktype::getSolutionId,solutions.getId()) |
| | | ); |
| | | |
| | | if(Constants.equalsObject(solutions.getType(),Constants.ONE) ){ |
| | | if (solutions.getFanganFile()!=null && StringUtils.isNotBlank(solutions.getFanganFile().getFileurl())){ |
| | | multifileMapper.update(null,new UpdateWrapper<Multifile>().lambda() |
| | | .set(Multifile::getIsdeleted,Constants.ONE) |
| | | .set(Multifile::getEditDate,solutions.getEditDate()) |
| | | .set(Multifile::getEditor,solutions.getEditor()) |
| | | .eq(Multifile::getObjId,solutions.getId()) |
| | | .eq(Multifile::getIsdeleted,Constants.ZERO) |
| | | .eq(Multifile::getObjType,Constants.MultiFile.SOLUTIONS_CONFIRMATION_LATTER.getKey())); |
| | | Multifile file = solutions.getFanganFile(); |
| | | file.setIsdeleted(Constants.ZERO); |
| | | file.setCreateDate(solutions.getEditDate()); |
| | | file.setCreator(solutions.getEditor()); |
| | | file.setObjId(solutions.getId()); |
| | | file.setObjType(Constants.MultiFile.SOLUTIONS_CONFIRMATION_LATTER.getKey()); |
| | | file.setType(Constants.formatIntegerNum(file.getType())); |
| | | multifileMapper.insert(file); |
| | | } |
| | | } |
| | | |
| | | solutionsMapper.update(null,new UpdateWrapper<Solutions>() |
| | | .lambda() |
| | |
| | | wrapper.orderByAsc(SolutionWorktype::getSortnum); |
| | | List<SolutionWorktype> worktypeList = solutionWorktypeJoinMapper.selectJoinList(SolutionWorktype.class,wrapper); |
| | | model.setWorktypeList(worktypeList); |
| | | Multifile f = multifileMapper.selectOne(new QueryWrapper<Multifile>().lambda() |
| | | .eq(Multifile::getObjId,model.getId()) |
| | | .eq(Multifile::getObjType,Constants.MultiFile.SOLUTIONS_CONFIRMATION_LATTER.getKey()) |
| | | .eq(Multifile::getIsdeleted,Constants.ZERO) |
| | | .last("limit 1")); |
| | | model.setFanganFile(f);//方案确认书 |
| | | return model; |
| | | } |
| | | |