Merge remote-tracking branch 'origin/master'

This commit is contained in:
ant 2024-07-29 18:17:55 +08:00
commit 33f1b52a3b
9 changed files with 119 additions and 13 deletions

View File

@ -11,6 +11,8 @@ import java.time.LocalDateTime;
@Data
public class EmployeeVO {
private Long userId;
private Long projectId;
/**

View File

@ -71,4 +71,7 @@ public class WrkProjectPaymentVO {
*/
private String paymentMonth;
private Long userId;
}

View File

@ -76,4 +76,23 @@ public class WrkAuditRule extends BaseEntity {
*/
@TableField(value = "dept_id")
private Long deptId;
/**
* 分钟数量
*/
@TableField(value = "number")
private Integer number;
/**
* 单位
*/
@TableField(value = "number_type")
private Integer numberType;
/**
* 条数
*/
@TableField(value = "number_wrk")
private Integer numberWrk;
}

View File

@ -52,11 +52,6 @@ public class WrkAuditRuleDTO {
@TableField(value = "remark")
private String remark;
/**
* 规则内容
*/
@TableField(value = "content")
private String content;
/**
* 所属部门
@ -64,5 +59,23 @@ public class WrkAuditRuleDTO {
@TableField(value = "dept_id")
private Long deptId;
/**
* 分钟数量
*/
@TableField(value = "number")
private Integer number;
/**
* 单位
*/
@TableField(value = "number_type")
private Integer numberType;
/**
* 条数
*/
@TableField(value = "number_wrk")
private Integer numberWrk;
}

View File

@ -31,12 +31,14 @@ import com.chushang.common.mybatis.utils.WrapperUtils;
import com.chushang.datascope.annotation.DataScope;
import com.chushang.inspection.ins.GeneratedInsFactory;
import com.chushang.inspection.project.dto.AuditDTO;
import com.chushang.inspection.project.po.InspectionConfig;
import com.chushang.inspection.project.po.InspectionData;
import com.chushang.inspection.project.query.ProjectQuery;
import com.chushang.inspection.project.service.InspectionDataService;
import com.chushang.inspection.project.service.PollingTaskService;
import com.chushang.inspection.project.vo.CountVO;
import com.chushang.inspection.project.vo.EmployeeVO;
import com.chushang.inspection.project.vo.ProjectVO;
import com.chushang.inspection.terminal.po.FiveStore;
import com.chushang.inspection.terminal.po.Store;
import com.chushang.inspection.terminal.po.Terminal;
@ -793,7 +795,28 @@ public class WrkInfoServiceImpl extends ServiceImpl<WrkInfoMapper, WrkInfo> impl
public List<EmployeeVO> empData(ProjectQuery projectQuery) {
CommonParam commonParam = CommonParam.buildPageRequest();
Page<WrkInfo> page = new Page<>(commonParam.getPage(), commonParam.getLimit());
return baseMapper.empData(projectQuery,page);
List<EmployeeVO> employeeVOList = baseMapper.empData(projectQuery, page);
Set<Long> deptIds = employeeVOList.stream().map(EmployeeVO::getDeptId).collect(Collectors.toSet());
Set<Long> userIds = employeeVOList.stream().map(EmployeeVO::getUserId).collect(Collectors.toSet());
// 查询全部部门
Map<Long, String> deptNameMap
= remoteDeptService.getDeptNameByIds(deptIds, SecurityConstants.INNER);
Map<Long, SysUser> userNameByIds = userFeignService.getUserNameByIds(userIds, SecurityConstants.INNER);
// 被派单次数
LambdaQueryWrapper<WrkInfo> configSql = WrapperUtils.builder();
configSql.in(WrkInfo::getUserId, userIds);
// 查询全部工单
for (EmployeeVO employeeVO:employeeVOList){
employeeVO.setDeptName(deptNameMap.get(employeeVO.getDeptId()));
employeeVO.setProjectConcat(userNameByIds.get(employeeVO.getUserId()).getNickName());
employeeVO.setProjectPhone(userNameByIds.get(employeeVO.getUserId()).getPhone());
}
return employeeVOList;
}
/**

View File

@ -302,9 +302,7 @@
</select>
<select id="empData" resultType="com.chushang.inspection.project.vo.EmployeeVO">
SELECT account_manager as projectConcat ,account_phone as projectPhone,
count(user_id) as dispatchNum,
count(case when wrk_status = 3 then 1 when wrk_status = 4 then 1 end) as aduitNum
SELECT user_id as userId,dept_id as deptId,count(user_id) as dispatchNum,count(CASE WHEN state = 4 OR state = 7 THEN 1 ELSE 0 END) as aduitNum
FROM wrk_info
where del_state = 0
<if test="query.projectConcat != null and query.projectConcat != ''">

View File

@ -5,6 +5,7 @@
<select id="payMentData" resultType="com.chushang.inspection.project.vo.WrkProjectPaymentVO">
select
t2.project_name as projectName,
t2.user_id as userId,
t2.project_id as projectId,
t2.project_concat as projectConcat,
t2.project_phone as projectPhone,
@ -33,4 +34,33 @@
</where>
</select>
<select id="selectCountByUserId" resultType="com.chushang.inspection.project.vo.CountVO">
select
t1.contract_amount as contractAmount,
t2.dept_id as deptId,
t1.project_id as projectId,
t2.project_name as projectName,
from
wrk_info t1 inner join wrk_project t2 on t1.project_id = t2.project_id
<where>
<if test="query.projectName != null and query.projectName != ''">
AND t2.project_name like concat('%', #{query.projectName}, '%')
</if>
<if test="query.projectConcat != null">
AND t2.project_concat = #{query.projectConcat}
</if>
<if test="query.projectPhone != null">
AND t2.project_phone = #{query.projectPhone}
</if>
<if test="query.deptId != null">
AND t2.dept_id = #{query.deptId}
</if>
<if test="1 == 1">
${query.sqlParam.get('dataScope')}
</if>
</where>
</select>
</mapper>

View File

@ -58,4 +58,8 @@ public interface RemoteUserService {
@GetMapping("/nickname")
Result<Map<String, Long>> getIdByNicknames(@RequestParam(value = "nickNames") Set<String> nickNames, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
@GetMapping("/querynamebyid")
Map<Long, SysUser> getUserNameByIds(@RequestParam(value = "userIds") Set<Long> userIds,
@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}

View File

@ -1,20 +1,21 @@
package com.chushang.system.remote;
import cn.hutool.core.collection.CollectionUtil;
import com.chushang.common.core.util.StringUtils;
import com.chushang.common.core.web.Result;
import com.chushang.security.entity.po.DataScopeEntity;
import com.chushang.security.annotation.InnerAuth;
import com.chushang.security.entity.po.SysDept;
import com.chushang.security.entity.vo.LoginUser;
import com.chushang.security.entity.po.SysUser;
import com.chushang.system.feign.RemoteUserService;
import com.chushang.system.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@RestController
@RequestMapping(value = "/user/remote")
@ -81,4 +82,17 @@ public class RemoteUserController implements RemoteUserService {
return Result.ok(sysUserService.getIdByNicknames(nickNames));
}
@Override
@GetMapping(value = "/querynamebyid")
@InnerAuth
public Map<Long, SysUser> getUserNameByIds(Set<Long> userIds, String source) {
if (CollectionUtil.isEmpty(userIds)) return Map.of();
List<SysUser> sysUsers = sysUserService.listByIds(userIds);
if (CollectionUtil.isNotEmpty(sysUsers)){
return sysUsers.stream().collect(Collectors.toMap(SysUser::getUserId, Function.identity() ));
}
return Map.of();
}
}