审核管理-审核信息查询、分配业务修改
This commit is contained in:
parent
d3dcc6b5c2
commit
bbb18774f3
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.chushang.inspection.project.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @auther: zhao
|
||||||
|
* @date: 2024/6/17 18:17
|
||||||
|
* 描述:分配信息
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AssignmentDTO {
|
||||||
|
/**
|
||||||
|
* 审核 工单ID
|
||||||
|
*/
|
||||||
|
@NotNull(message = "工单不能为空")
|
||||||
|
private Long wrkId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分配用户ID
|
||||||
|
*/
|
||||||
|
@NotNull(message = "分配用户不能为空")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分配部门ID
|
||||||
|
*/
|
||||||
|
private Long deptId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分配用户名称
|
||||||
|
*/
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,51 @@
|
||||||
|
package com.chushang.inspection.project.query;
|
||||||
|
|
||||||
|
import com.chushang.common.mybatis.annotation.Condition;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @auther: zhao
|
||||||
|
* @date: 2024/6/17 18:17
|
||||||
|
* 描述:分配信息查询
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class WrkInfoAuditQuery {
|
||||||
|
/**
|
||||||
|
* 审核 工单ID
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Condition(name = "wrk_id", type = Condition.ConditionType.eq)
|
||||||
|
private Long wrkId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分配用户ID
|
||||||
|
*/
|
||||||
|
@Condition(name = "user_id", type = Condition.ConditionType.eq)
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分配用户名称
|
||||||
|
*/
|
||||||
|
@Condition(name = "user_name", type = Condition.ConditionType.like)
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门ID
|
||||||
|
*/
|
||||||
|
@Condition(name = "dept_id", type = Condition.ConditionType.eq)
|
||||||
|
private Long deptId;
|
||||||
|
|
||||||
|
@Condition(name = "create_time", type = Condition.ConditionType.between)
|
||||||
|
private List<LocalDateTime> createTimes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审核状态
|
||||||
|
*/
|
||||||
|
@Condition(name = "audit_state", type = Condition.ConditionType.eq)
|
||||||
|
private Integer auditState;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -139,4 +139,7 @@ public class ReviewedQuery extends CommonParam {
|
||||||
@Condition(name = "terminal_status", type = Condition.ConditionType.eq, tableName = "itr")
|
@Condition(name = "terminal_status", type = Condition.ConditionType.eq, tableName = "itr")
|
||||||
private Integer terminalStatus;
|
private Integer terminalStatus;
|
||||||
|
|
||||||
|
@Condition(name = "dept_id", type = Condition.ConditionType.eq, tableName = "i")
|
||||||
|
private Integer deptId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,17 @@ public class WrkAuditRuleQuery extends CommonParam {
|
||||||
*/
|
*/
|
||||||
@Condition(name = "status", type = Condition.ConditionType.eq)
|
@Condition(name = "status", type = Condition.ConditionType.eq)
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
/**
|
||||||
|
* 部门ID
|
||||||
|
*/
|
||||||
|
@Condition(name = "dept_id", type = Condition.ConditionType.eq)
|
||||||
|
private Long deptId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 规则时间
|
||||||
|
*/
|
||||||
|
@Condition(name = "rule_time", type = Condition.ConditionType.eq)
|
||||||
|
private String ruleTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 规则名称
|
* 规则名称
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.chushang.inspection.work.vo;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DatePattern;
|
||||||
|
import com.chushang.common.dict.annotation.DictFormat;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class WorkInfoAuditVo implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审核人名称
|
||||||
|
*/
|
||||||
|
private String auditName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审核时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
|
||||||
|
private LocalDateTime auditTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分配时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
|
||||||
|
private LocalDateTime allocateTime;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -49,4 +49,6 @@ public class WrkInfoDetailsVO implements java.io.Serializable{
|
||||||
*/
|
*/
|
||||||
private FiveStoreVO fiveStoreDetails;
|
private FiveStoreVO fiveStoreDetails;
|
||||||
|
|
||||||
|
private WorkInfoAuditVo wrkInfoAudit;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,15 @@ package com.chushang.inspection.work.controller;
|
||||||
import com.chushang.common.core.web.AjaxResult;
|
import com.chushang.common.core.web.AjaxResult;
|
||||||
import com.chushang.common.log.annotation.SysLog;
|
import com.chushang.common.log.annotation.SysLog;
|
||||||
import com.chushang.common.log.enums.BusinessType;
|
import com.chushang.common.log.enums.BusinessType;
|
||||||
|
import com.chushang.inspection.project.dto.AssignmentDTO;
|
||||||
import com.chushang.inspection.project.dto.AuditDTO;
|
import com.chushang.inspection.project.dto.AuditDTO;
|
||||||
import com.chushang.inspection.project.service.WrkAuditService;
|
import com.chushang.inspection.project.service.WrkAuditService;
|
||||||
|
import com.chushang.inspection.work.po.WrkInfoAudit;
|
||||||
import com.chushang.inspection.work.service.WrkInfoAuditService;
|
import com.chushang.inspection.work.service.WrkInfoAuditService;
|
||||||
import com.chushang.inspection.work.service.WrkInfoService;
|
import com.chushang.inspection.work.service.WrkInfoService;
|
||||||
import com.chushang.security.annotation.RequiresPermissions;
|
import com.chushang.security.annotation.RequiresPermissions;
|
||||||
import lombok.extern.java.Log;
|
import lombok.extern.java.Log;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
|
@ -19,12 +22,14 @@ import javax.annotation.Resource;
|
||||||
* @author xxxxx
|
* @author xxxxx
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/wrk/audit")
|
@RequestMapping("/wrk/info/audit")
|
||||||
public class WrkInfoAuditController {
|
public class WrkInfoAuditController {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private WrkInfoService wrkInfoService;
|
private WrkInfoService wrkInfoService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private WrkInfoAuditService wrkInfoAuditService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 工单审核
|
* 工单审核
|
||||||
|
|
@ -36,4 +41,17 @@ public class WrkInfoAuditController {
|
||||||
wrkInfoService.audit(audit);
|
wrkInfoService.audit(audit);
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工单分配
|
||||||
|
*/
|
||||||
|
@PostMapping ("/assignment")
|
||||||
|
@RequiresPermissions("wrk:info:assignment")
|
||||||
|
@SysLog(value = "工单分配", businessType = BusinessType.AUDIT)
|
||||||
|
public AjaxResult assignment(@Validated @RequestBody AssignmentDTO assignmentDTO) {
|
||||||
|
WrkInfoAudit wrkInfoAudit = new WrkInfoAudit();
|
||||||
|
BeanUtils.copyProperties(assignmentDTO,wrkInfoAudit);
|
||||||
|
wrkInfoAuditService.assignmentWrkInfo(wrkInfoAudit);
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,5 +18,7 @@ public interface WrkAuditRuleService extends IService<WrkAuditRule> {
|
||||||
|
|
||||||
int saveOrUpdate(WrkAuditRuleDTO dto);
|
int saveOrUpdate(WrkAuditRuleDTO dto);
|
||||||
|
|
||||||
|
WrkAuditRule queryWrkAuditRule(WrkAuditRuleQuery query);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,23 @@
|
||||||
package com.chushang.inspection.work.service;
|
package com.chushang.inspection.work.service;
|
||||||
|
|
||||||
|
import com.chushang.common.core.web.Result;
|
||||||
import com.chushang.inspection.project.dto.AuditDTO;
|
import com.chushang.inspection.project.dto.AuditDTO;
|
||||||
|
import com.chushang.inspection.project.query.WrkInfoAuditQuery;
|
||||||
import com.chushang.inspection.work.po.WrkInfoAudit;
|
import com.chushang.inspection.work.po.WrkInfoAudit;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @auther: zhao
|
* @auther: zhao
|
||||||
* @date: 2024/6/27 18:13
|
* @date: 2024/6/27 18:13
|
||||||
*/
|
*/
|
||||||
public interface WrkInfoAuditService extends IService<WrkInfoAudit> {
|
public interface WrkInfoAuditService extends IService<WrkInfoAudit> {
|
||||||
|
|
||||||
|
Result<Integer> assignmentWrkInfo(WrkInfoAudit entity);
|
||||||
|
|
||||||
|
List<WrkInfoAudit> queryWrkInfoAudits(WrkInfoAuditQuery wrkInfoAuditQuery);
|
||||||
|
|
||||||
|
Long queryAssignmentCount(WrkInfoAuditQuery wrkInfoAuditQuery);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -135,4 +135,15 @@ public class WrkAuditRuleServiceImpl extends ServiceImpl<WrkAuditRuleMapper, Wrk
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WrkAuditRule queryWrkAuditRule(WrkAuditRuleQuery query) {
|
||||||
|
CommonParam commonParam = CommonParam.buildPageRequest();
|
||||||
|
LambdaQueryWrapper<WrkAuditRule> queryWrapper = WrapperUtils.builder(query, commonParam);
|
||||||
|
List<WrkAuditRule> wrkAuditRules = this.baseMapper.selectList(queryWrapper);
|
||||||
|
if (CollectionUtil.isEmpty(wrkAuditRules)){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return wrkAuditRules.get(0);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,41 @@
|
||||||
package com.chushang.inspection.work.service.impl;
|
package com.chushang.inspection.work.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.chushang.common.core.constant.SecurityConstants;
|
||||||
|
import com.chushang.common.core.exception.CheckedException;
|
||||||
|
import com.chushang.common.core.util.DateUtils;
|
||||||
|
import com.chushang.common.core.util.StringUtils;
|
||||||
|
import com.chushang.common.core.web.Result;
|
||||||
|
import com.chushang.common.dict.feign.RemoteDictDataService;
|
||||||
|
import com.chushang.common.mybatis.utils.WrapperUtils;
|
||||||
import com.chushang.inspection.project.dto.AuditDTO;
|
import com.chushang.inspection.project.dto.AuditDTO;
|
||||||
|
import com.chushang.inspection.project.query.WrkInfoAuditQuery;
|
||||||
|
import com.chushang.inspection.work.po.WrkAuditRule;
|
||||||
|
import com.chushang.inspection.work.po.WrkInfo;
|
||||||
|
import com.chushang.inspection.work.query.WrkAuditRuleQuery;
|
||||||
|
import com.chushang.inspection.work.service.WrkAuditRuleService;
|
||||||
import com.chushang.inspection.work.service.WrkInfoAuditService;
|
import com.chushang.inspection.work.service.WrkInfoAuditService;
|
||||||
|
import com.chushang.inspection.work.service.WrkInfoService;
|
||||||
|
import com.chushang.security.entity.po.SysDept;
|
||||||
|
import com.chushang.security.entity.po.SysUser;
|
||||||
|
import com.chushang.security.utils.SecurityUtils;
|
||||||
|
import com.chushang.system.entity.dto.ListUserDTO;
|
||||||
|
import com.chushang.system.feign.RemoteDeptService;
|
||||||
|
import com.chushang.system.feign.RemoteUserService;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.chushang.inspection.work.mapper.WrkInfoAuditMapper;
|
import com.chushang.inspection.work.mapper.WrkInfoAuditMapper;
|
||||||
import com.chushang.inspection.work.po.WrkInfoAudit;
|
import com.chushang.inspection.work.po.WrkInfoAudit;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.time.DayOfWeek;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @auther: zhao
|
* @auther: zhao
|
||||||
|
|
@ -13,4 +43,144 @@ import com.chushang.inspection.work.po.WrkInfoAudit;
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class WrkInfoAuditServiceImpl extends ServiceImpl<WrkInfoAuditMapper, WrkInfoAudit> implements WrkInfoAuditService {
|
public class WrkInfoAuditServiceImpl extends ServiceImpl<WrkInfoAuditMapper, WrkInfoAudit> implements WrkInfoAuditService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private WrkAuditRuleService wrkAuditRuleService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RemoteUserService remoteUserService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
@Lazy
|
||||||
|
private WrkInfoService wrkInfoService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RemoteDeptService deptService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分配工单
|
||||||
|
* @param entity
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public Result<Integer> assignmentWrkInfo(WrkInfoAudit entity) {
|
||||||
|
Boolean updateResult = false;
|
||||||
|
validateWrkInfoAudit(entity);
|
||||||
|
validateDept(entity);
|
||||||
|
LocalDateTime localDateTime = LocalDateTime.now();
|
||||||
|
validateAssignmentCount(entity, localDateTime);
|
||||||
|
entity.setCreateTime(localDateTime);
|
||||||
|
entity.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
entity.setAuditState(1);
|
||||||
|
entity.setAuditTime(localDateTime);
|
||||||
|
entity.setRemark("初始分配给"+entity.getUserName()+"审核");
|
||||||
|
Integer result = this.baseMapper.insert(entity);
|
||||||
|
if (result > 0) {
|
||||||
|
WrkInfo wrkInfo = new WrkInfo();
|
||||||
|
wrkInfo.setWrkId(entity.getWrkId());
|
||||||
|
wrkInfo.setWrkStatus(2);
|
||||||
|
wrkInfo.setUpdateTime(localDateTime);
|
||||||
|
wrkInfo.setUpdateBy(SecurityUtils.getUsername());
|
||||||
|
updateResult = wrkInfoService.updateById(wrkInfo);
|
||||||
|
}
|
||||||
|
return Result.ok(updateResult==true?1:0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<WrkInfoAudit> queryWrkInfoAudits(WrkInfoAuditQuery wrkInfoAuditQuery) {
|
||||||
|
LambdaQueryWrapper<WrkInfoAudit> queryWrapper = WrapperUtils.builder(wrkInfoAuditQuery,null);
|
||||||
|
return this.baseMapper.selectList(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long queryAssignmentCount(WrkInfoAuditQuery wrkInfoAuditQuery){
|
||||||
|
LambdaQueryWrapper<WrkInfoAudit> queryWrapper = WrapperUtils.builder(wrkInfoAuditQuery,null);
|
||||||
|
return baseMapper.selectCount(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<SysUser> fetchSysUsers(Long deptId) {
|
||||||
|
ListUserDTO listUserDTO = new ListUserDTO();
|
||||||
|
listUserDTO.setDeptId(deptId);
|
||||||
|
Result<List<SysUser>> result = remoteUserService.getSysUsers(listUserDTO);
|
||||||
|
return result.getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
private WrkAuditRule fetchWrkAuditRule(Long deptId) {
|
||||||
|
WrkAuditRuleQuery wrkAuditRuleQuery = new WrkAuditRuleQuery();
|
||||||
|
wrkAuditRuleQuery.setDeptId(deptId);
|
||||||
|
wrkAuditRuleQuery.setStatus(1);
|
||||||
|
wrkAuditRuleQuery.setRuleTime(LocalDate.now().getDayOfWeek().getValue() + "");
|
||||||
|
return wrkAuditRuleService.queryWrkAuditRule(wrkAuditRuleQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<LocalDateTime> createTimeRange(WrkAuditRule wrkAuditRule, LocalDateTime localDateTime) {
|
||||||
|
List<LocalDateTime> createTimes = new ArrayList<>(2);
|
||||||
|
// LocalDateTime localDateTime = LocalDateTime.now();
|
||||||
|
Integer numberType = wrkAuditRule.getNumberType();
|
||||||
|
Integer number = wrkAuditRule.getNumber();
|
||||||
|
LocalDateTime timeAgo = calculateTimeAgo(localDateTime, numberType, number);
|
||||||
|
createTimes.add(timeAgo);
|
||||||
|
createTimes.add(localDateTime);
|
||||||
|
return createTimes;
|
||||||
|
}
|
||||||
|
private LocalDateTime calculateTimeAgo(LocalDateTime localDateTime, Integer numberType, Integer number) {
|
||||||
|
switch (numberType) {
|
||||||
|
case 1: // 分钟
|
||||||
|
return localDateTime.minusMinutes(number);
|
||||||
|
case 2: // 小时
|
||||||
|
return localDateTime.minusHours(number);
|
||||||
|
case 3: // 天
|
||||||
|
return localDateTime.minusDays(number);
|
||||||
|
case 4: // 周
|
||||||
|
return localDateTime.minusWeeks(number);
|
||||||
|
case 5: // 月
|
||||||
|
return localDateTime.minusMonths(number);
|
||||||
|
case 6: // 季度
|
||||||
|
return localDateTime.minusMonths(number * 3);
|
||||||
|
default:
|
||||||
|
throw new CheckedException("无效的参数");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateWrkInfoAudit(WrkInfoAudit entity) {
|
||||||
|
Result<SysUser> userInfo = remoteUserService.getInfoById(entity.getUserId(), SecurityConstants.INNER);
|
||||||
|
if (StringUtils.isEmpty(entity.getUserName())) {
|
||||||
|
entity.setUserName(userInfo.getData().getUsername());
|
||||||
|
}
|
||||||
|
if (entity.getDeptId() == null) {
|
||||||
|
entity.setDeptId(userInfo.getData().getDeptId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void validateDept(WrkInfoAudit entity) {
|
||||||
|
WrkInfo wrkInfo = wrkInfoService.getById(entity.getWrkId());
|
||||||
|
if (wrkInfo == null) {
|
||||||
|
throw new CheckedException("工单不存在");
|
||||||
|
}
|
||||||
|
if (!wrkInfo.getDeptId().equals(entity.getDeptId())) {
|
||||||
|
SysDept dept = deptService.getDeptById(entity.getDeptId(), SecurityConstants.INNER);
|
||||||
|
if (dept == null || !dept.getParentId().equals(entity.getDeptId())) {
|
||||||
|
throw new CheckedException("此业务员不属于分配工单所属部门");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateAssignmentCount(WrkInfoAudit entity, LocalDateTime localDateTime) {
|
||||||
|
List<SysUser> sysUsers = fetchSysUsers(entity.getDeptId());
|
||||||
|
if (sysUsers != null && sysUsers.size() > 1) {
|
||||||
|
WrkAuditRule wrkAuditRule = fetchWrkAuditRule(entity.getDeptId());
|
||||||
|
if (wrkAuditRule != null) {
|
||||||
|
List<LocalDateTime> createTimes = createTimeRange(wrkAuditRule,localDateTime);
|
||||||
|
WrkInfoAuditQuery query = new WrkInfoAuditQuery();
|
||||||
|
query.setUserId(entity.getUserId());
|
||||||
|
query.setCreateTimes(createTimes);
|
||||||
|
query.setAuditState(1);
|
||||||
|
Long assignmentCount = queryAssignmentCount(query);
|
||||||
|
if (assignmentCount > wrkAuditRule.getNumberWrk()) {
|
||||||
|
throw new CheckedException("此业务员当日工单已超过分配数量上限");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -160,6 +160,11 @@
|
||||||
<result column="inspection_status" property="inspectionStatus"/>
|
<result column="inspection_status" property="inspectionStatus"/>
|
||||||
<result column="inspection_time" property="inspectionTime"/>
|
<result column="inspection_time" property="inspectionTime"/>
|
||||||
</association>
|
</association>
|
||||||
|
<association property="wrkInfoAudit" javaType="com.chushang.inspection.work.vo.WorkInfoAuditVo">
|
||||||
|
<result column="audit_name" property="auditName"/>
|
||||||
|
<result column="audit_time" property="auditTime"/>
|
||||||
|
<result column="allocate_time" property="allocateTime"/>
|
||||||
|
</association>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<select id="listInsTemplate" resultMap="wrkInfoDetailsVOResult">
|
<select id="listInsTemplate" resultMap="wrkInfoDetailsVOResult">
|
||||||
<include refid="wrkInfoDetailSql"/>
|
<include refid="wrkInfoDetailSql"/>
|
||||||
|
|
@ -240,12 +245,21 @@
|
||||||
itr.`terminal_address`,
|
itr.`terminal_address`,
|
||||||
itr.`terminal_version`,
|
itr.`terminal_version`,
|
||||||
itr.`terminal_property`,
|
itr.`terminal_property`,
|
||||||
itr.`terminal_status`
|
itr.`terminal_status`,
|
||||||
|
wia.user_id audit_user_id,
|
||||||
|
wia.user_name audit_name,
|
||||||
|
CASE WHEN wia.audit_state = 2 THEN wia.create_time ELSE NULL END allocate_time ,
|
||||||
|
CASE WHEN wia.audit_state = 3 THEN wia.audit_time ELSE NULL END audit_time
|
||||||
FROM `wrk_info` i
|
FROM `wrk_info` i
|
||||||
LEFT JOIN wrk_info_store_record isr ON i.wrk_id = isr.wrk_id
|
LEFT JOIN wrk_info_store_record isr ON i.wrk_id = isr.wrk_id
|
||||||
LEFT JOIN wrk_info_terminal_record itr ON i.wrk_id = itr.wrk_id
|
LEFT JOIN wrk_info_terminal_record itr ON i.wrk_id = itr.wrk_id
|
||||||
LEFT JOIN wrk_info_terminal_ins_record itir ON i.wrk_id = itir.wrk_id
|
LEFT JOIN wrk_info_terminal_ins_record itir ON i.wrk_id = itir.wrk_id
|
||||||
|
LEFT JOIN wrk_info_audit wia ON i.wrk_id = wia.wrk_id
|
||||||
WHERE i.del_state = 0
|
WHERE i.del_state = 0
|
||||||
|
<if test="query.wrkStatus == 0">
|
||||||
|
AND wia.wrk_id is NULL
|
||||||
|
</if>
|
||||||
|
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="countByProjectIds" resultType="com.chushang.inspection.project.vo.CountVO">
|
<select id="countByProjectIds" resultType="com.chushang.inspection.project.vo.CountVO">
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.chushang.system.feign;
|
package com.chushang.system.feign;
|
||||||
|
|
||||||
import com.chushang.common.core.constant.SecurityConstants;
|
import com.chushang.common.core.constant.SecurityConstants;
|
||||||
|
import com.chushang.security.entity.po.SysDept;
|
||||||
import com.chushang.system.constants.SystemConstants;
|
import com.chushang.system.constants.SystemConstants;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
|
@ -26,5 +27,7 @@ public interface RemoteDeptService {
|
||||||
Map<Long, String> getDeptNameByIds(@RequestParam(value = "deptIds") Set<Long> deptIds,
|
Map<Long, String> getDeptNameByIds(@RequestParam(value = "deptIds") Set<Long> deptIds,
|
||||||
@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||||
|
|
||||||
|
@GetMapping("/dept/{deptId}")
|
||||||
|
SysDept getDeptById(@RequestParam(value = "deptId") Long deptId,
|
||||||
|
@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,4 +38,10 @@ public class RemoteDeptController implements RemoteDeptService {
|
||||||
}
|
}
|
||||||
return Map.of();
|
return Map.of();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/dept/{deptId}")
|
||||||
|
public SysDept getDeptById(Long deptId, String source) {
|
||||||
|
if (deptId != null) return deptService.getById(deptId);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -268,7 +268,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||||
List<SysUser> list = list(new LambdaQueryWrapper<SysUser>()
|
List<SysUser> list = list(new LambdaQueryWrapper<SysUser>()
|
||||||
.like(StringUtils.isNotEmpty(listUser.getPhone()),SysUser::getPhone, listUser.getPhone()).
|
.like(StringUtils.isNotEmpty(listUser.getPhone()),SysUser::getPhone, listUser.getPhone()).
|
||||||
like(StringUtils.isNotEmpty(listUser.getUsername()),SysUser::getUsername, listUser.getUsername()).
|
like(StringUtils.isNotEmpty(listUser.getUsername()),SysUser::getUsername, listUser.getUsername()).
|
||||||
like(StringUtils.isNotEmpty(listUser.getNickName()),SysUser::getNickName, listUser.getNickName()));
|
like(StringUtils.isNotEmpty(listUser.getNickName()),SysUser::getNickName, listUser.getNickName())
|
||||||
|
.eq(listUser.getDeptId() != null,SysUser::getDeptId, listUser.getDeptId()));
|
||||||
if (CollUtil.isEmpty(list)) {
|
if (CollUtil.isEmpty(list)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue