Browse Source

修复电话结果回填

tags/24080901
WendyYang 1 year ago
parent
commit
0307293a00
7 changed files with 68 additions and 105 deletions
  1. +2
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/task/ExpertCallResultRewriteTask.java
  2. +10
    -6
      pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/UserRole.java
  3. +12
    -10
      pmapi/src/main/java/com/ningdatech/pmapi/user/controller/UserInfoController.java
  4. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/user/entity/UserAuth.java
  5. +14
    -12
      pmapi/src/main/java/com/ningdatech/pmapi/user/entity/UserInfo.java
  6. +0
    -41
      pmapi/src/main/java/com/ningdatech/pmapi/user/entity/UserRole.java
  7. +29
    -34
      pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java

+ 2
- 1
pmapi/src/main/java/com/ningdatech/pmapi/meeting/task/ExpertCallResultRewriteTask.java View File

@@ -1,5 +1,6 @@
package com.ningdatech.pmapi.meeting.task;

import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -120,7 +121,7 @@ public class ExpertCallResultRewriteTask {
// 极端情况下获取不到submitKey异常情况
continue;
}
Integer minutes = callbackMinutes.getOrDefault(expert.getRuleId(), MINUTES_CALL_RESULT_FEEDBACK);
Integer minutes = ObjectUtil.defaultIfNull(callbackMinutes.get(expert.getRuleId()), MINUTES_CALL_RESULT_FEEDBACK);
Optional<Integer> status = getStatusByMsgRecordDetail(msgRecordDetail, minutes, expert.getCreateOn());
if (status.isPresent()) {
MeetingExpert update = new MeetingExpert();


+ 10
- 6
pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/UserRole.java View File

@@ -1,9 +1,6 @@
package com.ningdatech.pmapi.sys.model.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
@@ -13,6 +10,8 @@ import lombok.ToString;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
* <p>
@@ -29,9 +28,9 @@ import javax.validation.constraints.NotNull;
@Accessors(chain = true)
@TableName("nd_user_role")
@ApiModel(value = "UserRole", description = "角色分配")
public class UserRole {
public class UserRole implements Serializable {

private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 2210188203287234336L;

@TableId(value = "id", type = IdType.AUTO)
private Long id;
@@ -52,6 +51,11 @@ public class UserRole {
@TableField("user_id")
private Long userId;

@TableField(fill = FieldFill.INSERT)
private LocalDateTime createOn;

@TableField(fill = FieldFill.INSERT)
private Long createBy;

@Builder
public UserRole(Long roleId, Long userId) {


+ 12
- 10
pmapi/src/main/java/com/ningdatech/pmapi/user/controller/UserInfoController.java View File

@@ -3,7 +3,10 @@ package com.ningdatech.pmapi.user.controller;

import com.ningdatech.basic.model.PageVo;
import com.ningdatech.pmapi.user.manage.UserInfoManage;
import com.ningdatech.pmapi.user.model.po.*;
import com.ningdatech.pmapi.user.model.po.ReqUserDetailEditPO;
import com.ningdatech.pmapi.user.model.po.ReqUserDetailPO;
import com.ningdatech.pmapi.user.model.po.ReqUserDisableOrEnablePO;
import com.ningdatech.pmapi.user.model.po.ReqUserInfoListPO;
import com.ningdatech.pmapi.user.model.vo.ResUserDetailVO;
import com.ningdatech.pmapi.user.model.vo.ResUserInfoListVO;
import io.swagger.annotations.Api;
@@ -14,7 +17,6 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;

/**
@@ -31,26 +33,26 @@ public class UserInfoController {

@ApiOperation(value = "用户列表搜索", notes = "用户列表搜索")
@PostMapping("/list")
public PageVo<ResUserInfoListVO> userInfoList(@Valid @RequestBody ReqUserInfoListPO reqUserInfoListPO) {
return userInfoManage.list(reqUserInfoListPO);
public PageVo<ResUserInfoListVO> userInfoList(@Valid @RequestBody ReqUserInfoListPO req) {
return userInfoManage.list(req);
}

@ApiOperation(value = "用户禁用/启用", notes = "用户禁用/启用")
@PostMapping("/disable-enable")
public void disableOrEnable(@Valid @RequestBody ReqUserDisableOrEnablePO reqUserDisableOrEnablePO) {
userInfoManage.disableOrEnable(reqUserDisableOrEnablePO);
public void disableOrEnable(@Valid @RequestBody ReqUserDisableOrEnablePO req) {
userInfoManage.disableOrEnable(req);
}

@ApiOperation(value = "用户详情", notes = "用户详情")
@PostMapping("/detail")
public ResUserDetailVO userInfoDetail(@Valid @RequestBody ReqUserDetailPO reqUserDetailPO) {
return userInfoManage.userInfoDetail(reqUserDetailPO);
public ResUserDetailVO userInfoDetail(@Valid @RequestBody ReqUserDetailPO req) {
return userInfoManage.userInfoDetail(req);
}

@ApiOperation(value = "用户详情编辑", notes = "用户详情编辑")
@PostMapping("/detail/edit")
public void userInfoDetailEdit(@Valid @RequestBody ReqUserDetailEditPO reqUserDetailEditPO) {
userInfoManage.userInfoDetailEdit(reqUserDetailEditPO);
public void userInfoDetailEdit(@Valid @RequestBody ReqUserDetailEditPO req) {
userInfoManage.userInfoDetailEdit(req);
}

@ApiOperation(value = "获取当前登陆用户详情信息", notes = "用户详情")


+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/user/entity/UserAuth.java View File

@@ -17,7 +17,7 @@ import java.time.LocalDateTime;
*/
@TableName("nd_user_auth")
@Data
@ApiModel(value = "NdUserAuth对象", description = "")
@ApiModel(value = "NdUserAuth对象")
public class UserAuth implements Serializable {

private static final long serialVersionUID = 1L;


+ 14
- 12
pmapi/src/main/java/com/ningdatech/pmapi/user/entity/UserInfo.java View File

@@ -1,8 +1,6 @@
package com.ningdatech.pmapi.user.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Builder;
@@ -25,7 +23,7 @@ import java.time.LocalDateTime;
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "NdUserInfo对象", description = "")
@ApiModel(value = "NdUserInfo对象")
public class UserInfo implements Serializable {

private static final long serialVersionUID = 1L;
@@ -33,14 +31,6 @@ public class UserInfo implements Serializable {
@TableId(type = IdType.AUTO)
private Long id;

private LocalDateTime createOn;

private LocalDateTime updateOn;

private Long createBy;

private Long updateBy;

private String username;

private String mobile;
@@ -53,4 +43,16 @@ public class UserInfo implements Serializable {

private String employeeCode;

@TableField(fill = FieldFill.INSERT)
private LocalDateTime createOn;

@TableField(fill = FieldFill.INSERT_UPDATE)
private LocalDateTime updateOn;

@TableField(fill = FieldFill.INSERT)
private Long createBy;

@TableField(fill = FieldFill.INSERT_UPDATE)
private Long updateBy;

}

+ 0
- 41
pmapi/src/main/java/com/ningdatech/pmapi/user/entity/UserRole.java View File

@@ -1,41 +0,0 @@
package com.ningdatech.pmapi.user.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
* <p>
* 用户角色表
* </p>
*
* @author Liuxinxin
* @since 2023-01-05
*/
@Data
@TableName("nd_user_role")
@ApiModel(value = "UserRole对象", description = "用户角色表")
public class UserRole implements Serializable {

private static final long serialVersionUID = 1L;

@TableId(value = "id", type = IdType.AUTO)
private Long id;

@ApiModelProperty("用户 ID")
private Long userId;

@ApiModelProperty("角色 ID")
private Long roleId;

@TableField(fill = FieldFill.INSERT)
private LocalDateTime createOn;

@TableField(fill = FieldFill.INSERT)
private Long createBy;

}

+ 29
- 34
pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java View File

@@ -56,18 +56,18 @@ public class UserInfoManage {

private final RegionCacheHelper regionCacheHelper;

public PageVo<ResUserInfoListVO> list(ReqUserInfoListPO reqUserInfoListPO) {
public PageVo<ResUserInfoListVO> list(ReqUserInfoListPO req) {
PageVo<ResUserInfoListVO> pageVo = new PageVo<>();

String phoneNo = reqUserInfoListPO.getPhoneNo();
String orgCode = reqUserInfoListPO.getOrgCode();
String name = reqUserInfoListPO.getName();
String phoneNo = req.getPhoneNo();
String orgCode = req.getOrgCode();
String name = req.getName();

List<String> roleCompliantEmployeeCodeList = getRoleCompliantEmployeeCodeList(reqUserInfoListPO.getUserRoleList());
List<String> roleCompliantEmployeeCodeList = getRoleCompliantEmployeeCodeList(req.getUserRoleList());
if (roleCompliantEmployeeCodeList != null && roleCompliantEmployeeCodeList.size() == 0) {
return pageVo;
}
List<String> orgNameCompliantOrgCodeList = getOrgNameCompliantOrgCodeList(reqUserInfoListPO.getOrgName());
List<String> orgNameCompliantOrgCodeList = getOrgNameCompliantOrgCodeList(req.getOrgName());
if (orgNameCompliantOrgCodeList != null && orgNameCompliantOrgCodeList.size() == 0) {
return pageVo;
}
@@ -80,7 +80,7 @@ public class UserInfoManage {
.in(Objects.nonNull(roleCompliantEmployeeCodeList), DingEmployeeInfo::getEmployeeCode, roleCompliantEmployeeCodeList)
.in(Objects.nonNull(orgNameCompliantOrgCodeList), DingEmployeeInfo::getOrganizationCode, orgNameCompliantOrgCodeList);

Page<DingEmployeeInfo> page = iDingEmployeeInfoService.page(new Page<>(reqUserInfoListPO.getPageNumber(), reqUserInfoListPO.getPageSize()), wrapper);
Page<DingEmployeeInfo> page = iDingEmployeeInfoService.page(new Page<>(req.getPageNumber(), req.getPageSize()), wrapper);
List<DingEmployeeInfo> records = page.getRecords();
long total = page.getTotal();
List<ResUserInfoListVO> result = new ArrayList<>();
@@ -102,16 +102,16 @@ public class UserInfoManage {

Map<String, UserInfo> finalEmployeeCodeAvailableMap = employeeCodeAvailableMap;
records.forEach(r -> {
ResUserInfoListVO resListVO = new ResUserInfoListVO();
resListVO.setName(r.getEmployeeName());
ResUserInfoListVO item = new ResUserInfoListVO();
item.setName(r.getEmployeeName());
String organizationCode = r.getOrganizationCode();
if (StringUtils.isNotBlank(organizationCode) && orgMap.containsKey(organizationCode)) {
resListVO.setOrgName(orgMap.get(organizationCode).getOrganizationName());
resListVO.setOrgCode(organizationCode);
item.setOrgName(orgMap.get(organizationCode).getOrganizationName());
item.setOrgCode(organizationCode);
String regionCode = orgMap.get(organizationCode).getDivisionCode();
resListVO.setRegionCode(regionCode);
item.setRegionCode(regionCode);
if (Objects.nonNull(regionCode)) {
resListVO.setRegionName(regionCacheHelper.getDisplayName(regionCode, RegionConst.RL_COUNTY));
item.setRegionName(regionCacheHelper.getDisplayName(regionCode, RegionConst.RL_COUNTY));
}
}
// TODO 从用户信息中获取
@@ -119,22 +119,16 @@ public class UserInfoManage {
// resListVO.setRegionId();
UserInfo userInfo = finalEmployeeCodeAvailableMap.get(r.getEmployeeCode());
// 装配用户状态 及 userId
userStatusAssembler(resListVO, userInfo);
userStatusAssembler(item, userInfo);

if (Objects.isNull(userInfo)) {
resListVO.setUpdateTime(r.getUpdateOn());
item.setUpdateTime(r.getUpdateOn());
} else {
resListVO.setUpdateTime(userInfo.getUpdateOn());
item.setUpdateTime(userInfo.getUpdateOn());
}
// 从用户信息中获取
resListVO.setEmployeeCode(r.getEmployeeCode());
List<UserRoleVO> userRoles = getUserRoleVOList(resListVO.getUserId());
resListVO.setUserRoleList(userRoles);
LocalDateTime roleModifyTime;
if (CollUtil.isNotEmpty(userRoles) && (roleModifyTime = userRoles.get(userRoles.size() - 1).getCreateOn()).isAfter(resListVO.getUpdateTime())) {
resListVO.setUpdateTime(roleModifyTime);
}
result.add(resListVO);
item.setEmployeeCode(r.getEmployeeCode());
item.setUserRoleList(getUserRoleVOList(item.getUserId()));
result.add(item);
});
}
pageVo.setTotal(total);
@@ -149,10 +143,9 @@ public class UserInfoManage {
List<DingOrganization> dingOrganizationList = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class)
.like(DingOrganization::getOrganizationName, orgName));

List<String> orgCodeList = dingOrganizationList.stream()
return dingOrganizationList.stream()
.map(DingOrganization::getOrganizationCode)
.collect(Collectors.toList());
return orgCodeList;
}

/**
@@ -176,8 +169,8 @@ public class UserInfoManage {
// TODO 这里过滤的非浙政钉用户的专家 后续需要增加补充逻辑
return iUserInfoService.list(Wrappers.lambdaQuery(UserInfo.class)
.in(UserInfo::getId, compliantUserIdList))
.stream().filter(r -> StringUtils.isNotBlank(r.getEmployeeCode()))
.map(UserInfo::getEmployeeCode).collect(Collectors.toList());
.stream().map(UserInfo::getEmployeeCode)
.filter(StringUtils::isNotBlank).collect(Collectors.toList());

}

@@ -209,17 +202,17 @@ public class UserInfoManage {
return userRoleInfoList;
}
List<UserRole> userRoleList = iUserRoleService.list(Wrappers.lambdaQuery(UserRole.class)
.eq(UserRole::getUserId, userId));
.eq(UserRole::getUserId, userId).orderByAsc(UserRole::getCreateOn));
if (CollUtil.isNotEmpty(userRoleList)) {
List<Long> roleIdList = userRoleList.stream().map(UserRole::getRoleId).collect(Collectors.toList());
List<Role> roleList = iRoleService.list(Wrappers.lambdaQuery(Role.class).in(Role::getId, roleIdList));
userRoleInfoList = roleList.stream().map(r -> {
List<Role> roleList = iRoleService.listByIds(roleIdList);
roleList.forEach(r -> {
UserRoleVO userRoleVO = new UserRoleVO();
userRoleVO.setId(r.getId());
userRoleVO.setName(r.getName());
userRoleVO.setCreateOn(r.getCreateOn());
return userRoleVO;
}).collect(Collectors.toList());
userRoleInfoList.add(userRoleVO);
});
}
return userRoleInfoList;
}
@@ -281,6 +274,8 @@ public class UserInfoManage {
}
}
userInfo.setAvailable(reqUserDetailEditPO.getStatus());
userInfo.setUpdateOn(LocalDateTime.now());
userInfo.setUpdateBy(LoginUserUtil.getUserId());
iUserInfoService.updateById(userInfo);

List<UserRoleVO> userRoleInfoList = reqUserDetailEditPO.getUserRoleInfoList();


Loading…
Cancel
Save