| | |
| | | package com.project.enforce.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import cn.hutool.core.convert.Convert; |
| | | import com.project.common.utils.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import com.project.enforce.domain.vo.EnforceOrderVo; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.project.common.annotation.DataScope; |
| | | import com.project.common.constant.CheckLevelCodeConstants; |
| | | import com.project.common.core.domain.entity.SysRole; |
| | | import com.project.common.core.domain.entity.SysUser; |
| | | import com.project.common.exception.base.BaseException; |
| | | import com.project.common.utils.SecurityUtils; |
| | | import com.project.common.utils.StringUtils; |
| | | import com.project.enforce.domain.EnforceOrder; |
| | | import com.project.enforce.domain.bo.editBo.EnforceOrderBo; |
| | | import com.project.enforce.domain.bo.queryBo.EnforceOrderQueryBo; |
| | | import com.project.enforce.domain.EnforceOrder; |
| | | import com.project.enforce.domain.vo.EnforceOrderVo; |
| | | import com.project.enforce.mapper.EnforceOrderMapper; |
| | | import com.project.enforce.service.IEnforceOrderService; |
| | | import com.project.system.service.ISysDeptService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 执法单Service业务层处理 |
| | |
| | | @RequiredArgsConstructor(onConstructor_ = @Autowired) |
| | | public class EnforceOrderServiceImpl extends ServiceImpl<EnforceOrderMapper, EnforceOrder> implements IEnforceOrderService { |
| | | |
| | | private final ISysDeptService deptService; |
| | | |
| | | |
| | | @Override//列表查询 |
| | | @DataScope(deptAlias = "apply_dept_id", userAlias = "apply_user_id") |
| | | public List<EnforceOrderVo> queryList(EnforceOrderQueryBo bo) |
| | | { |
| | | QueryWrapper<EnforceOrder> qw = getQw(bo); |
| | | qw.apply(bo.getParams().get("dataScope") != null, bo.getParams().get("dataScope").toString());//数据权限控制 |
| | | List<EnforceOrder> list = this.list(qw); |
| | | return Convert.toList(EnforceOrderVo.class , list); |
| | | } |
| | | |
| | | @Override//待审核列表 |
| | | public List<EnforceOrderVo> queryCheckList(EnforceOrderQueryBo bo) |
| | | { |
| | | SysUser loginUser = SecurityUtils.getLoginUser().getUser(); |
| | | if (!"01".equals(loginUser.getUserType())) { |
| | | throw new BaseException("您没有审批权限,请重试!"); |
| | | } |
| | | List<String> roleKeys = loginUser.getRoles().stream().map(SysRole::getRoleKey).collect(Collectors.toList()); |
| | | if (roleKeys.contains(CheckLevelCodeConstants.CHECK_LEVEL_ONE) && roleKeys.contains(CheckLevelCodeConstants.CHECK_LEVEL_TWO)){ |
| | | bo.setCheckLevel(null); |
| | | } else if (roleKeys.contains(CheckLevelCodeConstants.CHECK_LEVEL_ONE)){ |
| | | bo.setCheckLevel(0); |
| | | } else if (roleKeys.contains(CheckLevelCodeConstants.CHECK_LEVEL_TWO)) { |
| | | bo.setCheckLevel(1); |
| | | } else { |
| | | throw new BaseException("您没有审批权限,请重试!"); |
| | | } |
| | | bo.setCheckDeptId(deptService.getCheckDeptIdByLoginDeptId(loginUser.getDeptId())); |
| | | |
| | | return this.baseMapper.selectCheckList(bo); |
| | | } |
| | | |
| | | @Override//id查询 |
| | |
| | | //保存前校验 |
| | | private void validEntityBeforeSave(EnforceOrder entity) |
| | | { |
| | | //做一些数据校验,如唯一约束 |
| | | if (entity.getOrderId()==null){ |
| | | entity.setCheckDeptId(deptService.getCheckDeptIdByLoginDeptId(entity.getApplyDeptId())); |
| | | } |
| | | } |
| | | |
| | | //获取查询参数 |
| | |
| | | { |
| | | QueryWrapper<EnforceOrder> qw = Wrappers.query(); |
| | | |
| | | qw.eq(StringUtils.isNotEmpty(bo.getOrderNo()), "order_no", bo.getOrderNo()); |
| | | qw.eq(bo.getCompanyId() != null, "company_id", bo.getCompanyId()); |
| | | qw.like(StringUtils.isNotEmpty(bo.getCompanyName()), "company_name", bo.getCompanyName()); |
| | | qw.eq(StringUtils.isNotEmpty(bo.getCompanyCode()), "company_code", bo.getCompanyCode()); |
| | | qw.eq(StringUtils.isNotEmpty(bo.getCompanyUser()), "company_user", bo.getCompanyUser()); |
| | | qw.eq(StringUtils.isNotEmpty(bo.getCompanyPhone()), "company_phone", bo.getCompanyPhone()); |
| | | qw.eq(StringUtils.isNotEmpty(bo.getCompanyAddress()), "company_address", bo.getCompanyAddress()); |
| | | qw.eq(StringUtils.isNotEmpty(bo.getRegionCode()), "region_code", bo.getRegionCode()); |
| | | qw.like(StringUtils.isNotEmpty(bo.getRegionName()), "region_name", bo.getRegionName()); |
| | | qw.eq(StringUtils.isNotEmpty(bo.getEnforceReason()), "enforce_reason", bo.getEnforceReason()); |
| | | qw.eq(bo.getApplyId() != null, "apply_id", bo.getApplyId()); |
| | | qw.eq(bo.getApplyUser() != null, "apply_user", bo.getApplyUser()); |
| | | qw.eq(bo.getApplyPhone() != null, "apply_phone", bo.getApplyPhone()); |
| | | qw.eq(bo.getApplyDeptId() != null, "apply_dept_id", bo.getApplyDeptId()); |
| | | qw.like(bo.getApplyDeptName() != null, "apply_dept_name", bo.getApplyDeptName()); |
| | | qw.eq(bo.getApplyTime() != null, "apply_time", bo.getApplyTime()); |
| | | qw.eq(bo.getWarnStatus() != null, "warn_status", bo.getWarnStatus()); |
| | | qw.eq(StringUtils.isNotEmpty(bo.getWarnReason()), "warn_reason", bo.getWarnReason()); |
| | | qw.eq(bo.getOrderStatus() != null, "order_status", bo.getOrderStatus()); |
| | | qw.eq(bo.getCheckId() != null, "check_id", bo.getCheckId()); |
| | | qw.eq(bo.getCheckUser() != null, "check_user", bo.getCheckUser()); |
| | | qw.eq(bo.getCheckPhone() != null, "check_phone", bo.getCheckPhone()); |
| | | qw.eq(bo.getCheckDeptId() != null, "check_dept_id", bo.getCheckDeptId()); |
| | | qw.like(bo.getCheckDeptName() != null, "check_dept_name", bo.getCheckDeptName()); |
| | | qw.eq(bo.getCheckTime() != null, "check_time", bo.getCheckTime()); |
| | | qw.eq(bo.getCheckStatus() != null, "check_status", bo.getCheckStatus()); |
| | | qw.eq(StringUtils.isNotEmpty(bo.getCheckReason()), "check_reason", bo.getCheckReason()); |
| | | qw.eq(bo.getExecuteId() != null, "execute_id", bo.getExecuteId()); |
| | | qw.eq(bo.getExecuteUser() != null, "execute_user", bo.getExecuteUser()); |
| | | qw.eq(bo.getExecutePhone() != null, "execute_phone", bo.getExecutePhone()); |
| | | qw.eq(bo.getExecuteDeptId() != null, "execute_dept_id", bo.getExecuteDeptId()); |
| | | qw.like(bo.getExecuteDeptName() != null, "execute_dept_name", bo.getExecuteDeptName()); |
| | | qw.eq(bo.getExecuteTime() != null, "execute_time", bo.getExecuteTime()); |
| | | qw.eq(bo.getRegionStatus() != null, "region_status", bo.getRegionStatus()); |
| | | qw.eq(StringUtils.isNotEmpty(bo.getRegionReason()), "region_reason", bo.getRegionReason()); |
| | | qw.eq(StringUtils.isNotEmpty(bo.getRegionImgs()), "region_imgs", bo.getRegionImgs()); |
| | | qw.eq(StringUtils.isNotEmpty(bo.getRegionVideos()), "region_videos", bo.getRegionVideos()); |
| | | qw.eq(bo.getIsNoticeCompany() != null, "is_notice_company", bo.getIsNoticeCompany()); |
| | | qw.eq(bo.getIsShow() != null, "is_show", bo.getIsShow()); |
| | | qw.eq(bo.getIsEva() != null, "is_eva", bo.getIsEva()); |
| | | qw.eq(bo.getTotalScore() != null, "total_score", bo.getTotalScore()); |
| | | qw.eq(StringUtils.isNotEmpty(bo.getOrderNo()), "order_no", bo.getOrderNo()); |
| | | qw.eq(bo.getCompanyId() != null, "company_id", bo.getCompanyId()); |
| | | qw.like(StringUtils.isNotEmpty(bo.getCompanyName()), "company_name", bo.getCompanyName()); |
| | | qw.eq(StringUtils.isNotEmpty(bo.getCompanyCode()), "company_code", bo.getCompanyCode()); |
| | | qw.eq(StringUtils.isNotEmpty(bo.getCompanyUser()), "company_user", bo.getCompanyUser()); |
| | | qw.eq(StringUtils.isNotEmpty(bo.getCompanyPhone()), "company_phone", bo.getCompanyPhone()); |
| | | qw.eq(StringUtils.isNotEmpty(bo.getCompanyAddress()), "company_address", bo.getCompanyAddress()); |
| | | qw.eq(StringUtils.isNotEmpty(bo.getRegionCode()), "region_code", bo.getRegionCode()); |
| | | qw.like(StringUtils.isNotEmpty(bo.getRegionName()), "region_name", bo.getRegionName()); |
| | | qw.eq(StringUtils.isNotEmpty(bo.getEnforceReason()), "enforce_reason", bo.getEnforceReason()); |
| | | qw.eq(bo.getApplyId() != null, "apply_id", bo.getApplyId()); |
| | | qw.eq(StringUtils.isNotEmpty(bo.getApplyUser()), "apply_user", bo.getApplyUser()); |
| | | qw.eq(StringUtils.isNotEmpty(bo.getApplyPhone()), "apply_phone", bo.getApplyPhone()); |
| | | qw.eq(bo.getApplyDeptId() != null, "apply_dept_id", bo.getApplyDeptId()); |
| | | qw.like(StringUtils.isNotEmpty(bo.getApplyDeptName()), "apply_dept_name", bo.getApplyDeptName()); |
| | | qw.eq(bo.getApplyTime() != null, "apply_time", bo.getApplyTime()); |
| | | qw.eq(bo.getUserNum() != null, "user_num", bo.getUserNum()); |
| | | qw.eq(bo.getWarnStatus() != null, "warn_status", bo.getWarnStatus()); |
| | | qw.eq(StringUtils.isNotEmpty(bo.getWarnReason()), "warn_reason", bo.getWarnReason()); |
| | | qw.eq(bo.getOrderStatus() != null, "order_status", bo.getOrderStatus()); |
| | | qw.eq(bo.getCheckDeptId() != null, "check_dept_id", bo.getCheckDeptId()); |
| | | qw.like(StringUtils.isNotEmpty(bo.getCheckDeptName()), "check_dept_name", bo.getCheckDeptName()); |
| | | qw.eq(bo.getCheckStatus() != null, "check_status", bo.getCheckStatus()); |
| | | qw.eq(StringUtils.isNotEmpty(bo.getCheckReason()), "check_reason", bo.getCheckReason()); |
| | | qw.eq(bo.getCheckLevel() != null, "check_level", bo.getCheckLevel()); |
| | | qw.eq(bo.getExecuteId() != null, "execute_id", bo.getExecuteId()); |
| | | qw.eq(StringUtils.isNotEmpty(bo.getExecuteUser()), "execute_user", bo.getExecuteUser()); |
| | | qw.eq(StringUtils.isNotEmpty(bo.getExecutePhone()), "execute_phone", bo.getExecutePhone()); |
| | | qw.eq(bo.getExecuteDeptId() != null, "execute_dept_id", bo.getExecuteDeptId()); |
| | | qw.like(StringUtils.isNotEmpty(bo.getExecuteDeptName()), "execute_dept_name", bo.getExecuteDeptName()); |
| | | qw.eq(bo.getExecuteTime() != null, "execute_time", bo.getExecuteTime()); |
| | | qw.eq(bo.getRegionStatus() != null, "region_status", bo.getRegionStatus()); |
| | | qw.eq(StringUtils.isNotEmpty(bo.getRegionReason()), "region_reason", bo.getRegionReason()); |
| | | qw.eq(StringUtils.isNotEmpty(bo.getRegionImgs()), "region_imgs", bo.getRegionImgs()); |
| | | qw.eq(StringUtils.isNotEmpty(bo.getRegionVideos()), "region_videos", bo.getRegionVideos()); |
| | | qw.eq(bo.getIsNoticeCompany() != null, "is_notice_company", bo.getIsNoticeCompany()); |
| | | qw.eq(bo.getIsShow() != null, "is_show", bo.getIsShow()); |
| | | qw.eq(bo.getIsEva() != null, "is_eva", bo.getIsEva()); |
| | | qw.eq(bo.getTotalScore() != null, "total_score", bo.getTotalScore()); |
| | | if (StringUtils.isNotEmpty(bo.getIsAsc()) && StringUtils.isNotEmpty(bo.getOrderByColumn())){ |
| | | if ("acs".equals(bo.getIsAsc())) { |
| | | qw.orderByAsc(bo.getOrderByColumn()); |