| | |
| | | package com.doumee.service.business.impl; |
| | | |
| | | import com.doumee.core.model.LoginUserInfo; |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.dao.business.InsuranceApplyMapper; |
| | | import com.doumee.dao.business.dto.InsuranceApplyQueryDTO; |
| | | import com.doumee.dao.business.join.InsuranceApplyJoinMapper; |
| | | import com.doumee.dao.business.model.Company; |
| | | import com.doumee.dao.business.model.InsuranceApply; |
| | | import com.doumee.dao.business.model.Solutions; |
| | | import com.doumee.dao.system.model.SystemUser; |
| | | import com.doumee.service.business.InsuranceApplyService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | 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.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | |
| | | /** |
| | | * 投保申请信息表Service实现 |
| | | * @author 江蹄蹄 |
| | | * @date 2024/01/15 11:15 |
| | | * @date 2024/01/16 10:03 |
| | | */ |
| | | @Service |
| | | public class InsuranceApplyServiceImpl implements InsuranceApplyService { |
| | | |
| | | @Autowired |
| | | private InsuranceApplyMapper insuranceApplyMapper; |
| | | |
| | | @Autowired |
| | | private InsuranceApplyJoinMapper insuranceApplyJoinMapper; |
| | | |
| | | @Override |
| | | public Integer create(InsuranceApply insuranceApply) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public PageData<InsuranceApply> findPage(PageWrap<InsuranceApply> pageWrap) { |
| | | public PageData<InsuranceApply> findPage(PageWrap<InsuranceApplyQueryDTO> pageWrap) { |
| | | LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | IPage<InsuranceApply> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); |
| | | QueryWrapper<InsuranceApply> queryWrapper = new QueryWrapper<>(); |
| | | MPJLambdaWrapper<InsuranceApply> queryWrapper = new MPJLambdaWrapper<>(); |
| | | Utils.MP.blankToNull(pageWrap.getModel()); |
| | | if (pageWrap.getModel().getId() != null) { |
| | | queryWrapper.lambda().eq(InsuranceApply::getId, pageWrap.getModel().getId()); |
| | | } |
| | | if (pageWrap.getModel().getCreator() != null) { |
| | | queryWrapper.lambda().eq(InsuranceApply::getCreator, pageWrap.getModel().getCreator()); |
| | | } |
| | | if (pageWrap.getModel().getCreateDate() != null) { |
| | | queryWrapper.lambda().ge(InsuranceApply::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getCreateDate())); |
| | | queryWrapper.lambda().le(InsuranceApply::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getCreateDate())); |
| | | } |
| | | if (pageWrap.getModel().getEditor() != null) { |
| | | queryWrapper.lambda().eq(InsuranceApply::getEditor, pageWrap.getModel().getEditor()); |
| | | } |
| | | if (pageWrap.getModel().getEditDate() != null) { |
| | | queryWrapper.lambda().ge(InsuranceApply::getEditDate, Utils.Date.getStart(pageWrap.getModel().getEditDate())); |
| | | queryWrapper.lambda().le(InsuranceApply::getEditDate, Utils.Date.getEnd(pageWrap.getModel().getEditDate())); |
| | | } |
| | | if (pageWrap.getModel().getIsdeleted() != null) { |
| | | queryWrapper.lambda().eq(InsuranceApply::getIsdeleted, pageWrap.getModel().getIsdeleted()); |
| | | } |
| | | if (pageWrap.getModel().getRemark() != null) { |
| | | queryWrapper.lambda().eq(InsuranceApply::getRemark, pageWrap.getModel().getRemark()); |
| | | } |
| | | if (pageWrap.getModel().getSortnum() != null) { |
| | | queryWrapper.lambda().eq(InsuranceApply::getSortnum, pageWrap.getModel().getSortnum()); |
| | | queryWrapper.selectAll(InsuranceApply.class); |
| | | queryWrapper.selectAs(Company::getName,InsuranceApply::getCompanyName); |
| | | queryWrapper.selectAs(Solutions::getName,InsuranceApply::getSolutionsName); |
| | | queryWrapper.eq(InsuranceApply::getIsdeleted,Constants.ZERO); |
| | | |
| | | |
| | | if(loginUserInfo.getType().equals(Constants.ONE)){ |
| | | queryWrapper.eq(InsuranceApply::getCompanyId, loginUserInfo.getCompanyId()); |
| | | } |
| | | if (pageWrap.getModel().getSolutionId() != null) { |
| | | queryWrapper.lambda().eq(InsuranceApply::getSolutionId, pageWrap.getModel().getSolutionId()); |
| | | queryWrapper.eq(InsuranceApply::getSolutionId, pageWrap.getModel().getSolutionId()); |
| | | } |
| | | if (pageWrap.getModel().getCompanyId() != null) { |
| | | queryWrapper.lambda().eq(InsuranceApply::getCompanyId, pageWrap.getModel().getCompanyId()); |
| | | if (pageWrap.getModel().getEndTimeS() != null) { |
| | | queryWrapper.ge(InsuranceApply::getEndTime, Utils.Date.getStart(pageWrap.getModel().getEndTimeS())); |
| | | } |
| | | if (pageWrap.getModel().getApplyEndTime() != null) { |
| | | queryWrapper.lambda().ge(InsuranceApply::getApplyEndTime, Utils.Date.getStart(pageWrap.getModel().getApplyEndTime())); |
| | | queryWrapper.lambda().le(InsuranceApply::getApplyEndTime, Utils.Date.getEnd(pageWrap.getModel().getApplyEndTime())); |
| | | if (pageWrap.getModel().getEndTimeE() != null) { |
| | | queryWrapper.le(InsuranceApply::getEndTime, Utils.Date.getEnd(pageWrap.getModel().getEndTimeE())); |
| | | } |
| | | if (pageWrap.getModel().getApplyStartTime() != null) { |
| | | queryWrapper.lambda().ge(InsuranceApply::getApplyStartTime, Utils.Date.getStart(pageWrap.getModel().getApplyStartTime())); |
| | | queryWrapper.lambda().le(InsuranceApply::getApplyStartTime, Utils.Date.getEnd(pageWrap.getModel().getApplyStartTime())); |
| | | if (pageWrap.getModel().getStartTimeS() != null) { |
| | | queryWrapper.ge(InsuranceApply::getStartTime, Utils.Date.getStart(pageWrap.getModel().getStartTimeS())); |
| | | } |
| | | if (pageWrap.getModel().getEndTime() != null) { |
| | | queryWrapper.lambda().ge(InsuranceApply::getEndTime, Utils.Date.getStart(pageWrap.getModel().getEndTime())); |
| | | queryWrapper.lambda().le(InsuranceApply::getEndTime, Utils.Date.getEnd(pageWrap.getModel().getEndTime())); |
| | | } |
| | | if (pageWrap.getModel().getStartTime() != null) { |
| | | queryWrapper.lambda().ge(InsuranceApply::getStartTime, Utils.Date.getStart(pageWrap.getModel().getStartTime())); |
| | | queryWrapper.lambda().le(InsuranceApply::getStartTime, Utils.Date.getEnd(pageWrap.getModel().getStartTime())); |
| | | } |
| | | if (pageWrap.getModel().getCheckDate() != null) { |
| | | queryWrapper.lambda().ge(InsuranceApply::getCheckDate, Utils.Date.getStart(pageWrap.getModel().getCheckDate())); |
| | | queryWrapper.lambda().le(InsuranceApply::getCheckDate, Utils.Date.getEnd(pageWrap.getModel().getCheckDate())); |
| | | } |
| | | if (pageWrap.getModel().getCheckInfo() != null) { |
| | | queryWrapper.lambda().eq(InsuranceApply::getCheckInfo, pageWrap.getModel().getCheckInfo()); |
| | | } |
| | | if (pageWrap.getModel().getCheckUserId() != null) { |
| | | queryWrapper.lambda().eq(InsuranceApply::getCheckUserId, pageWrap.getModel().getCheckUserId()); |
| | | if (pageWrap.getModel().getStartTimeE() != null) { |
| | | queryWrapper.le(InsuranceApply::getStartTime, Utils.Date.getEnd(pageWrap.getModel().getStartTimeE())); |
| | | } |
| | | if (pageWrap.getModel().getCode() != null) { |
| | | queryWrapper.lambda().eq(InsuranceApply::getCode, pageWrap.getModel().getCode()); |
| | | queryWrapper.eq(InsuranceApply::getCode, pageWrap.getModel().getCode()); |
| | | } |
| | | if (pageWrap.getModel().getStatus() != null) { |
| | | queryWrapper.lambda().eq(InsuranceApply::getStatus, pageWrap.getModel().getStatus()); |
| | | queryWrapper.eq(InsuranceApply::getStatus, pageWrap.getModel().getStatus()); |
| | | } |
| | | for(PageWrap.SortData sortData: pageWrap.getSorts()) { |
| | | if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) { |
| | |
| | | queryWrapper.orderByAsc(sortData.getProperty()); |
| | | } |
| | | } |
| | | return PageData.from(insuranceApplyMapper.selectPage(page, queryWrapper)); |
| | | return PageData.from(insuranceApplyJoinMapper.selectJoinPage(page,InsuranceApply.class, queryWrapper)); |
| | | } |
| | | |
| | | @Override |