| | |
| | | package com.doumee.service.business.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.model.LoginUserInfo; |
| | |
| | | |
| | | @Autowired |
| | | private SolutionsMapper solutionsMapper; |
| | | |
| | | /** |
| | | * 平台退回申请 |
| | | * @param insuranceApply |
| | | * @return |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class,BusinessException.class}) |
| | | public Integer back(ApplyChange param) { |
| | | if(param.getId() == null ||StringUtils.isBlank(param.getCheckInfo())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | ApplyChange model = applyChangeMapper.selectById(param.getId()); |
| | | |
| | | if(model == null ||!Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | if(Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.UPLOAD.getKey())){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,该申请状态已流转,当前不支持该操作~"); |
| | | } |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | ApplyChange update = new ApplyChange(); |
| | | update.setEditDate(new Date()); |
| | | update.setEditor(user.getId()); |
| | | update.setStatus(Constants.ApplyChangeStatus.PALTFORM_CHECK_PASS_NO.getKey()); |
| | | update.setCheckDate(update.getEditDate()); |
| | | update.setCheckInfo(param.getCheckInfo()); |
| | | update.setCheckUserId(user.getId()); |
| | | update.setId(model.getId()); |
| | | applyChangeMapper.updateById(update); |
| | | |
| | | Constants.ApplyLogType applyLogType = Constants.ApplyLogType.PLATFORM_RETURN; |
| | | String info =applyLogType.getInfo(); |
| | | info = info.replace("${param}", update.getCheckInfo()); |
| | | ApplyLog log = new ApplyLog(update,applyLogType.getName(),info,update.getId(),applyLogType.getKey(), JSONObject.toJSONString(model), JSONObject.toJSONString(update)); |
| | | applyLogMapper.insert(log); |
| | | return 1; |
| | | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class,BusinessException.class}) |
| | |
| | | @Override |
| | | public PageData<ApplyChange> findPage(PageWrap<ApplyChange> pageWrap) { |
| | | IPage<ApplyChange> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); |
| | | QueryWrapper<ApplyChange> queryWrapper = new QueryWrapper<>(); |
| | | MPJLambdaWrapper<ApplyChange> queryWrapper = new MPJLambdaWrapper<>(); |
| | | Utils.MP.blankToNull(pageWrap.getModel()); |
| | | if (pageWrap.getModel().getId() != null) { |
| | | queryWrapper.lambda().eq(ApplyChange::getId, pageWrap.getModel().getId()); |
| | | } |
| | | if (pageWrap.getModel().getCreator() != null) { |
| | | queryWrapper.lambda().eq(ApplyChange::getCreator, pageWrap.getModel().getCreator()); |
| | | } |
| | | if (pageWrap.getModel().getCreateDate() != null) { |
| | | queryWrapper.lambda().ge(ApplyChange::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getCreateDate())); |
| | | queryWrapper.lambda().le(ApplyChange::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getCreateDate())); |
| | | } |
| | | if (pageWrap.getModel().getEditor() != null) { |
| | | queryWrapper.lambda().eq(ApplyChange::getEditor, pageWrap.getModel().getEditor()); |
| | | } |
| | | if (pageWrap.getModel().getEditDate() != null) { |
| | | queryWrapper.lambda().ge(ApplyChange::getEditDate, Utils.Date.getStart(pageWrap.getModel().getEditDate())); |
| | | queryWrapper.lambda().le(ApplyChange::getEditDate, Utils.Date.getEnd(pageWrap.getModel().getEditDate())); |
| | | } |
| | | if (pageWrap.getModel().getIsdeleted() != null) { |
| | | queryWrapper.lambda().eq(ApplyChange::getIsdeleted, pageWrap.getModel().getIsdeleted()); |
| | | } |
| | | if (pageWrap.getModel().getRemark() != null) { |
| | | queryWrapper.lambda().eq(ApplyChange::getRemark, pageWrap.getModel().getRemark()); |
| | | } |
| | | if (pageWrap.getModel().getSortnum() != null) { |
| | | queryWrapper.lambda().eq(ApplyChange::getSortnum, pageWrap.getModel().getSortnum()); |
| | | } |
| | | if (pageWrap.getModel().getApplyId() != null) { |
| | | queryWrapper.lambda().eq(ApplyChange::getApplyId, pageWrap.getModel().getApplyId()); |
| | | } |
| | | if (pageWrap.getModel().getCode() != null) { |
| | | queryWrapper.lambda().eq(ApplyChange::getCode, pageWrap.getModel().getCode()); |
| | | } |
| | | if (pageWrap.getModel().getApplyStartTime() != null) { |
| | | queryWrapper.lambda().ge(ApplyChange::getApplyStartTime, Utils.Date.getStart(pageWrap.getModel().getApplyStartTime())); |
| | | queryWrapper.lambda().le(ApplyChange::getApplyStartTime, Utils.Date.getEnd(pageWrap.getModel().getApplyStartTime())); |
| | | } |
| | | if (pageWrap.getModel().getStatus() != null) { |
| | | queryWrapper.lambda().eq(ApplyChange::getStatus, pageWrap.getModel().getStatus()); |
| | | } |
| | | if (pageWrap.getModel().getValidTime() != null) { |
| | | queryWrapper.lambda().ge(ApplyChange::getValidTime, Utils.Date.getStart(pageWrap.getModel().getValidTime())); |
| | | queryWrapper.lambda().le(ApplyChange::getValidTime, Utils.Date.getEnd(pageWrap.getModel().getValidTime())); |
| | | } |
| | | if (pageWrap.getModel().getValidCode() != null) { |
| | | queryWrapper.lambda().eq(ApplyChange::getValidCode, pageWrap.getModel().getValidCode()); |
| | | } |
| | | if (pageWrap.getModel().getType() != null) { |
| | | queryWrapper.lambda().eq(ApplyChange::getType, pageWrap.getModel().getType()); |
| | | } |
| | | ApplyChange model = pageWrap.getModel() ; |
| | | queryWrapper |
| | | .selectAll(ApplyChange.class) |
| | | .selectAs(InsuranceApply::getCode,ApplyChange::getApplyCode) |
| | | .select("( select count(1) from apply_chagne_detail ad where t.id = ad.APPLY_CHANGE_ID and ad.TYPE = 0 )",ApplyChange::getAddNum) |
| | | .select("( select count(1) from apply_chagne_detail ad where t.id = ad.APPLY_CHANGE_ID and ad.TYPE = 1 )",ApplyChange::getDelNum) |
| | | .select("( select count(1) from apply_chagne_detail ad where t.id = ad.APPLY_CHANGE_ID and ad.TYPE = 2 )",ApplyChange::getChangeNum) |
| | | .select("( select ifnull(sum(ad.FEE),0) from apply_chagne_detail ad where t.id = ad.APPLY_CHANGE_ID )",ApplyChange::getChangeMoney) |
| | | .leftJoin(InsuranceApply.class,InsuranceApply::getId,ApplyChange::getApplyId) |
| | | .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId) |
| | | .eq(!Objects.isNull(model.getType()),ApplyChange::getType,model.getType()) |
| | | .eq(!Objects.isNull(model.getStatus()),ApplyChange::getStatus,model.getStatus()) |
| | | .eq(!Objects.isNull(model.getCompanyId()),InsuranceApply::getCompanyId,model.getCompanyId()) |
| | | .eq(!Objects.isNull(model.getSolutionsId()),ApplyChange::getSolutionsId,model.getSolutionsId()) |
| | | .ge(StringUtils.isNotBlank(model.getCreateDateS()),ApplyChange::getCreateDate, model.getCreateDateS()+" 00:00:00" ) |
| | | .le(StringUtils.isNotBlank(model.getCreateDateE()),ApplyChange::getCreateDate, model.getCreateDateE()+" 23:59:59" ); |
| | | |
| | | for(PageWrap.SortData sortData: pageWrap.getSorts()) { |
| | | if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) { |
| | | queryWrapper.orderByDesc(sortData.getProperty()); |
| | |
| | | queryWrapper.orderByAsc(sortData.getProperty()); |
| | | } |
| | | } |
| | | return PageData.from(applyChangeMapper.selectPage(page, queryWrapper)); |
| | | PageData<ApplyChange> pageData = PageData.from(applyChangeJoinMapper.selectJoinPage(page,ApplyChange.class, queryWrapper)); |
| | | return pageData; |
| | | } |
| | | |
| | | @Override |