@@ -1,20 +0,0 @@ | |||||
package com.ningdatech.pmapi.organization.controller; | |||||
import org.springframework.web.bind.annotation.RequestMapping; | |||||
import org.springframework.stereotype.Controller; | |||||
/** | |||||
* <p> | |||||
* 前端控制器 | |||||
* </p> | |||||
* | |||||
* @author Lierbao | |||||
* @since 2023-02-11 | |||||
*/ | |||||
@Controller | |||||
@RequestMapping("/pmapi.organization/ding-employee-info") | |||||
public class DingEmployeeInfoController { | |||||
} |
@@ -1,10 +1,22 @@ | |||||
package com.ningdatech.pmapi.organization.controller; | package com.ningdatech.pmapi.organization.controller; | ||||
import com.ningdatech.basic.model.PageVo; | |||||
import com.ningdatech.pmapi.organization.manage.OrganizationManage; | |||||
import com.ningdatech.pmapi.organization.model.po.ReqOrganizationListPO; | |||||
import com.ningdatech.pmapi.organization.model.vo.ResOrganizationListVO; | |||||
import io.swagger.annotations.Api; | |||||
import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.ApiModelProperty; | ||||
import lombok.RequiredArgsConstructor; | |||||
import lombok.extern.slf4j.Slf4j; | |||||
import org.springframework.stereotype.Controller; | import org.springframework.stereotype.Controller; | ||||
import org.springframework.validation.annotation.Validated; | |||||
import org.springframework.web.bind.annotation.PostMapping; | import org.springframework.web.bind.annotation.PostMapping; | ||||
import org.springframework.web.bind.annotation.RequestBody; | |||||
import org.springframework.web.bind.annotation.RequestMapping; | import org.springframework.web.bind.annotation.RequestMapping; | ||||
import org.springframework.web.bind.annotation.RestController; | |||||
import javax.validation.Valid; | |||||
/** | /** | ||||
* <p> | * <p> | ||||
@@ -14,14 +26,27 @@ import org.springframework.web.bind.annotation.RequestMapping; | |||||
* @author Lierbao | * @author Lierbao | ||||
* @since 2023-02-09 | * @since 2023-02-09 | ||||
*/ | */ | ||||
@Controller | @Slf4j | ||||
@Validated | |||||
@RestController | |||||
@RequiredArgsConstructor | |||||
@Api(value = "DingOrganizationController", tags = "单位管理") | |||||
@RequestMapping("/api/v1/organization") | @RequestMapping("/api/v1/organization") | ||||
public class DingOrganizationController { | public class DingOrganizationController { | ||||
private final OrganizationManage organizationManage; | |||||
@ApiModelProperty("单位成员配置") | @ApiModelProperty("单位成员配置") | ||||
@PostMapping("/member/config") | @PostMapping("/member/config") | ||||
public void organizationManage() { | public void organizationManage() { | ||||
} | } | ||||
@ApiModelProperty("单位列表筛选") | |||||
@PostMapping("/list") | |||||
public PageVo<ResOrganizationListVO> organizationList(@Valid @RequestBody ReqOrganizationListPO reqOrganizationListPO) { | |||||
return organizationManage.organizationList(reqOrganizationListPO); | |||||
} | |||||
} | } |
@@ -57,14 +57,14 @@ public class OrganizationProcdefController { | |||||
@ApiOperation(value = "单位流程配置启用", notes = "单位流程配置启用") | @ApiOperation(value = "单位流程配置启用", notes = "单位流程配置启用") | ||||
@PutMapping("/enable/{processDefId}") | @PutMapping("/enable/{processDefId}") | ||||
public String enableProcess(@PathVariable String processDefId) { | public String enableProcess(@PathVariable String processDefId) { | ||||
orgProcessModelService.enableProcess(processDefId,Boolean.FALSE); | orgProcessModelService.enableProcess(processDefId, Boolean.FALSE); | ||||
return "启用成功"; | return "启用成功"; | ||||
} | } | ||||
@ApiOperation(value = "单位流程配置禁用", notes = "单位流程配置禁用") | @ApiOperation(value = "单位流程配置禁用", notes = "单位流程配置禁用") | ||||
@PutMapping("/disable/{processDefId}") | @PutMapping("/disable/{processDefId}") | ||||
public String disableProcess(@PathVariable String processDefId) { | public String disableProcess(@PathVariable String processDefId) { | ||||
orgProcessModelService.enableProcess(processDefId,Boolean.TRUE); | orgProcessModelService.enableProcess(processDefId, Boolean.TRUE); | ||||
return "禁用成功"; | return "禁用成功"; | ||||
} | } | ||||
@@ -1,8 +1,21 @@ | |||||
package com.ningdatech.pmapi.organization.manage; | package com.ningdatech.pmapi.organization.manage; | ||||
import cn.hutool.core.collection.CollUtil; | |||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils; | |||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||||
import com.ningdatech.basic.model.PageVo; | |||||
import com.ningdatech.pmapi.organization.model.entity.DingOrganization; | |||||
import com.ningdatech.pmapi.organization.model.po.ReqOrganizationListPO; | |||||
import com.ningdatech.pmapi.organization.model.vo.ResOrganizationListVO; | |||||
import com.ningdatech.pmapi.organization.service.IDingOrganizationService; | |||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
import java.util.ArrayList; | |||||
import java.util.List; | |||||
import java.util.stream.Collectors; | |||||
/** | /** | ||||
* @author liuxinxin | * @author liuxinxin | ||||
* @date 2023/1/13 下午2:55 | * @date 2023/1/13 下午2:55 | ||||
@@ -11,7 +24,34 @@ import org.springframework.stereotype.Component; | |||||
@RequiredArgsConstructor | @RequiredArgsConstructor | ||||
public class OrganizationManage { | public class OrganizationManage { | ||||
// private final | private final IDingOrganizationService iDingOrganizationService; | ||||
public PageVo<ResOrganizationListVO> organizationList(ReqOrganizationListPO reqOrganizationListPO) { | |||||
String orgName = reqOrganizationListPO.getOrgName(); | |||||
Page<DingOrganization> page = iDingOrganizationService | |||||
.page(new Page<>(reqOrganizationListPO.getPageNumber(), reqOrganizationListPO.getPageSize()) | |||||
, Wrappers.lambdaQuery(DingOrganization.class) | |||||
.like(StringUtils.isNotBlank(orgName), DingOrganization::getOrganizationName, orgName)); | |||||
long total = page.getTotal(); | |||||
List<DingOrganization> records = page.getRecords(); | |||||
List<ResOrganizationListVO> resVOList = new ArrayList<>(); | |||||
if (CollUtil.isNotEmpty(records)) { | |||||
resVOList = records.stream().map(r -> { | |||||
ResOrganizationListVO resOrganizationListVO = new ResOrganizationListVO(); | |||||
resOrganizationListVO.setOrgCode(r.getOrganizationCode()); | |||||
resOrganizationListVO.setOrgName(r.getOrganizationName()); | |||||
// TODO 补充其他字段 | |||||
return resOrganizationListVO; | |||||
}).collect(Collectors.toList()); | |||||
} | |||||
PageVo<ResOrganizationListVO> pageVo = new PageVo<>(); | |||||
pageVo.setTotal(total); | |||||
pageVo.setRecords(resVOList); | |||||
return pageVo; | |||||
} | |||||
} | } |
@@ -0,0 +1,31 @@ | |||||
package com.ningdatech.pmapi.organization.model.po; | |||||
import com.ningdatech.basic.model.PagePo; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2023/2/16 上午11:50 | |||||
*/ | |||||
@Data | |||||
@ApiModel("组织列表 请求PO") | |||||
public class ReqOrganizationListPO extends PagePo { | |||||
@ApiModelProperty("单位名称") | |||||
private String orgName; | |||||
@ApiModelProperty("浙政钉编码") | |||||
private String orgCode; | |||||
@ApiModelProperty("所属区域id") | |||||
private String regionId; | |||||
@ApiModelProperty("是否为主管单位") | |||||
private Boolean isCompetentUnit; | |||||
@ApiModelProperty("是否为上级条线主管单位") | |||||
private Boolean isSuperiorLineCompetentUnit; | |||||
} |
@@ -0,0 +1,38 @@ | |||||
package com.ningdatech.pmapi.organization.model.vo; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2023/2/16 上午11:50 | |||||
*/ | |||||
@Data | |||||
@ApiModel("组织列表VO") | |||||
public class ResOrganizationListVO { | |||||
public String id; | |||||
@ApiModelProperty("单位名称") | |||||
private String orgName; | |||||
@ApiModelProperty("浙政钉编码") | |||||
private String orgCode; | |||||
@ApiModelProperty("财政编码") | |||||
private String fiscalCode; | |||||
@ApiModelProperty("所属区域id") | |||||
private String regionId; | |||||
@ApiModelProperty("所属区域") | |||||
private String regionName; | |||||
@ApiModelProperty("是否为主管单位") | |||||
private Boolean isCompetentUnit; | |||||
@ApiModelProperty("是否为上级条线主管单位") | |||||
private Boolean isSuperiorLineCompetentUnit; | |||||
} |
@@ -66,8 +66,9 @@ public class TodoCenterController { | |||||
*/ | */ | ||||
@GetMapping("/progress/{instanceId}/{nodeId}") | @GetMapping("/progress/{instanceId}/{nodeId}") | ||||
public ApiResponse<ProcessProgressDetailVo> getProcessDetail(@PathVariable String instanceId, | public ApiResponse<ProcessProgressDetailVo> getProcessDetail(@PathVariable String instanceId, | ||||
@PathVariable(required = false) String nodeId) { | @PathVariable(required = false) String nodeId, | ||||
return ApiResponse.ofSuccess(todoCenterManage.getProcessDetail(nodeId, instanceId)); | @PathVariable Long projectId) { | ||||
return ApiResponse.ofSuccess(todoCenterManage.getProcessDetail(nodeId, instanceId, projectId)); | |||||
} | } | ||||
/** | /** | ||||
@@ -458,17 +458,23 @@ public class TodoCenterManage { | |||||
* @param param 参数 | * @param param 参数 | ||||
*/ | */ | ||||
private void doSealPass(Task task, Long userId, ReqProcessHandlerDTO param) { | private void doSealPass(Task task, Long userId, ReqProcessHandlerDTO param) { | ||||
String processInstanceId = task.getProcessInstanceId(); | |||||
// 获取当前申报项目 | |||||
Project declaredProject = projectService | |||||
.getOne(Wrappers.lambdaQuery(Project.class).eq(Project::getInstCode, task.getProcessInstanceId())); | |||||
String projectName = declaredProject.getProjectName(); | |||||
Map<String, Object> var = new HashMap<>(16); | Map<String, Object> var = new HashMap<>(16); | ||||
var.put("approve_" + task.getId(), param.getAction()); | var.put("approve_" + task.getId(), param.getAction()); | ||||
// 保存审核意见 | |||||
if (hasComment(param.getAuditInfo())) { | |||||
// 执行自定义的保存评论的功能 | |||||
managementService.executeCommand(new SaveCommentCmd(param.getTaskId(), param.getInstanceId(), | |||||
String.valueOf(userId), JSONObject.toJSONString(param.getAuditInfo()))); | |||||
} | |||||
// TODO 判断项目申报单位级别,区县单位申报有上级主管单位意见栏,市级单位没有 | // TODO 判断项目申报单位级别,区县单位申报有上级主管单位意见栏,市级单位没有 | ||||
// TODO 市级单位:为大数据局;区县单位:为大数据中心(根据附件区分?) | // TODO 市级单位:为大数据局;区县单位:为大数据中心(根据附件区分?) | ||||
// 获取当前申报项目 | |||||
Project declaredProject = projectService | |||||
.getOne(Wrappers.lambdaQuery(Project.class).eq(Project::getInstCode, task.getProcessInstanceId())); | |||||
// 更新项目状态到下一个状态 | |||||
updatePassProjectStatus(userId, declaredProject); | |||||
taskService.complete(param.getTaskId(), var); | taskService.complete(param.getTaskId(), var); | ||||
} | } | ||||
@@ -554,7 +560,7 @@ public class TodoCenterManage { | |||||
// 获取浙政钉用户ID | // 获取浙政钉用户ID | ||||
UserInfo auditUserInfo = userInfoService.getById(Long.valueOf(nextUserId)); | UserInfo auditUserInfo = userInfoService.getById(Long.valueOf(nextUserId)); | ||||
WorkNoticeInfo sendWorkNoticeInfo = getSendWorkNoticeInfo(auditUserInfo); | WorkNoticeInfo sendWorkNoticeInfo = getSendWorkNoticeInfo(auditUserInfo); | ||||
String msg = String.format(PASS_MSG_TEMPLATE, null, projectName); | String msg = String.format(PASS_MSG_TEMPLATE, sendWorkNoticeInfo.getOrganizationName(), projectName); | ||||
zwddClient.sendWorkNotice(sendWorkNoticeInfo.getReceiverUserId(),sendWorkNoticeInfo.getBizMsgId(),msg); | zwddClient.sendWorkNotice(sendWorkNoticeInfo.getReceiverUserId(),sendWorkNoticeInfo.getBizMsgId(),msg); | ||||
} else { | } else { | ||||
// 若没有,向发起人发送浙政钉工作通知:【项目名称】已通过【流程名称】,请及时开始下一步操作。 | // 若没有,向发起人发送浙政钉工作通知:【项目名称】已通过【流程名称】,请及时开始下一步操作。 | ||||
@@ -579,7 +585,7 @@ public class TodoCenterManage { | |||||
* @author CMM | * @author CMM | ||||
* @since 2023/02/15 14:04 | * @since 2023/02/15 14:04 | ||||
*/ | */ | ||||
private WorkNoticeInfo getSendWorkNoticeInfo(UserInfo auditUserInfo) { | public WorkNoticeInfo getSendWorkNoticeInfo(UserInfo auditUserInfo) { | ||||
WorkNoticeInfo workNoticeInfo = new WorkNoticeInfo(); | WorkNoticeInfo workNoticeInfo = new WorkNoticeInfo(); | ||||
Long accountId = auditUserInfo.getAccountId(); | Long accountId = auditUserInfo.getAccountId(); | ||||
if (Objects.isNull(accountId)){ | if (Objects.isNull(accountId)){ | ||||
@@ -785,6 +791,17 @@ public class TodoCenterManage { | |||||
.singleResult(); | .singleResult(); | ||||
// 获取前一个审核节点审核人信息 | // 获取前一个审核节点审核人信息 | ||||
String beforeUserId = lastInstance.getAssignee(); | String beforeUserId = lastInstance.getAssignee(); | ||||
// 获取当前审核节点审核人信息 | |||||
String currentUserId = task.getAssignee(); | |||||
//HashSet<String> userSet = new HashSet<>(); | |||||
//userSet.add(beforeUserId); | |||||
//userSet.add(currentUserId); | |||||
//Map<Long, UserInfoVO> userMap = userInfoService.getUserMapByIds(userSet); | |||||
//UserInfoVO beforeUserInfoVO = userMap.get(Long.valueOf(beforeUserId)); | |||||
//UserInfoVO currentUserInfoVO = userMap.get(Long.valueOf(currentUserId)); | |||||
//String beforeUserOrgCode = beforeUserInfoVO.getOrganizationCode(); | |||||
//String currentUserOrgCode = currentUserInfoVO.getOrganizationCode(); | |||||
//Boolean orgFlag = currentUserOrgCode.equals(beforeUserOrgCode) ? true : false; | |||||
// TODO 判断前一个审核人的部门和当前登录用户的部门是否是同一个,如果是同一个才可以撤回,否则抛出异常 | // TODO 判断前一个审核人的部门和当前登录用户的部门是否是同一个,如果是同一个才可以撤回,否则抛出异常 | ||||
Boolean orgFlag = true; | Boolean orgFlag = true; | ||||
@@ -897,7 +914,7 @@ public class TodoCenterManage { | |||||
* @param instanceId 流程实例ID | * @param instanceId 流程实例ID | ||||
* @return 流程进度及表单详情 | * @return 流程进度及表单详情 | ||||
*/ | */ | ||||
public ProcessProgressDetailVo getProcessDetail(String nodeId, String instanceId) { | public ProcessProgressDetailVo getProcessDetail(String nodeId, String instanceId, Long projectId) { | ||||
HistoricProcessInstance instance = historyService.createHistoricProcessInstanceQuery() | HistoricProcessInstance instance = historyService.createHistoricProcessInstanceQuery() | ||||
.processInstanceId(instanceId) | .processInstanceId(instanceId) | ||||
.singleResult(); | .singleResult(); | ||||
@@ -973,16 +990,8 @@ public class TodoCenterManage { | |||||
.progress(taskRecords) | .progress(taskRecords) | ||||
.build(); | .build(); | ||||
//res.setStartUser(userInfoVO); | //res.setStartUser(userInfoVO); | ||||
if (Objects.isNull(instance.getEndActivityId())) { | Project project = projectService.getById(projectId); | ||||
res.setStatus(ProcessStatusEnum.UNDER_REVIEW.name()); | res.setStatus(ProcessStatusEnum.getDescByCode(project.getProcessStatus())); | ||||
} else if (HisProInsEndActId.BACK.equals(instance.getEndActivityId())) { | |||||
// TODO 被退回的审核节点状态这里只是暂时这么判断,具体怎么保存这个退回状态,后面讨论 | |||||
res.setStatus(ProcessStatusEnum.BE_BACKED.name()); | |||||
} else if (HisProInsEndActId.REJECT.equals(instance.getEndActivityId())) { | |||||
res.setStatus(ProcessStatusEnum.BE_REJECTED.name()); | |||||
} else if (HisProInsEndActId.END.equals(instance.getEndActivityId())) { | |||||
res.setStatus(ProcessStatusEnum.APPROVED.name()); | |||||
} | |||||
return res; | return res; | ||||
} | } | ||||
@@ -0,0 +1,18 @@ | |||||
package com.ningdatech.pmapi.user.constant; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2023/2/15 下午5:13 | |||||
*/ | |||||
public enum UserAvailableEnum { | |||||
/** | |||||
* 启用 | |||||
*/ | |||||
ENABLE, | |||||
/** | |||||
* 禁用 | |||||
*/ | |||||
DISABLE | |||||
} |
@@ -4,7 +4,8 @@ package com.ningdatech.pmapi.user.controller; | |||||
import com.ningdatech.basic.model.PageVo; | import com.ningdatech.basic.model.PageVo; | ||||
import com.ningdatech.pmapi.user.manage.UserInfoManage; | import com.ningdatech.pmapi.user.manage.UserInfoManage; | ||||
import com.ningdatech.pmapi.user.model.po.ReqUserDetailEditPO; | import com.ningdatech.pmapi.user.model.po.ReqUserDetailEditPO; | ||||
import com.ningdatech.pmapi.user.model.po.ReqUserDisablePO; | 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.po.ReqUserInfoListPO; | ||||
import com.ningdatech.pmapi.user.model.vo.ResUserDetailVO; | import com.ningdatech.pmapi.user.model.vo.ResUserDetailVO; | ||||
import com.ningdatech.pmapi.user.model.vo.ResUserInfoListVO; | import com.ningdatech.pmapi.user.model.vo.ResUserInfoListVO; | ||||
@@ -38,14 +39,14 @@ public class UserInfoController { | |||||
@ApiOperation(value = "用户禁用/启用", notes = "用户禁用/启用") | @ApiOperation(value = "用户禁用/启用", notes = "用户禁用/启用") | ||||
@PostMapping("/disable-enable") | @PostMapping("/disable-enable") | ||||
public void disableOrEnable(@Valid @RequestBody ReqUserDisablePO reqUserDisablePO) { | public void disableOrEnable(@Valid @RequestBody ReqUserDisableOrEnablePO reqUserDisableOrEnablePO) { | ||||
userInfoManage.disableOrEnable(reqUserDisablePO); | userInfoManage.disableOrEnable(reqUserDisableOrEnablePO); | ||||
} | } | ||||
@ApiOperation(value = "用户详情", notes = "用户详情") | @ApiOperation(value = "用户详情", notes = "用户详情") | ||||
@PostMapping("/detail") | @PostMapping("/detail") | ||||
public ResUserDetailVO userInfoDetail(@Valid @RequestBody ReqUserInfoListPO reqUserInfoListPO) { | public ResUserDetailVO userInfoDetail(@Valid @RequestBody ReqUserDetailPO reqUserDetailPO) { | ||||
return userInfoManage.userInfoDetail(reqUserInfoListPO); | return userInfoManage.userInfoDetail(reqUserDetailPO); | ||||
} | } | ||||
@ApiOperation(value = "用户详情编辑", notes = "用户详情编辑") | @ApiOperation(value = "用户详情编辑", notes = "用户详情编辑") | ||||
@@ -54,5 +55,10 @@ public class UserInfoController { | |||||
userInfoManage.userInfoDetailEdit(reqUserDetailEditPO); | userInfoManage.userInfoDetailEdit(reqUserDetailEditPO); | ||||
} | } | ||||
@ApiOperation(value = "获取当前登陆用户详情信息", notes = "用户详情") | |||||
@PostMapping("/current-user-info") | |||||
public ResUserDetailVO currentUserInfo() { | |||||
return userInfoManage.currentUserInfo(); | |||||
} | |||||
} | } |
@@ -2,8 +2,10 @@ package com.ningdatech.pmapi.user.entity; | |||||
import com.baomidou.mybatisplus.annotation.TableName; | import com.baomidou.mybatisplus.annotation.TableName; | ||||
import io.swagger.annotations.ApiModel; | import io.swagger.annotations.ApiModel; | ||||
import lombok.AllArgsConstructor; | |||||
import lombok.Builder; | import lombok.Builder; | ||||
import lombok.Data; | import lombok.Data; | ||||
import lombok.NoArgsConstructor; | |||||
import java.io.Serializable; | import java.io.Serializable; | ||||
import java.time.LocalDateTime; | import java.time.LocalDateTime; | ||||
@@ -19,6 +21,8 @@ import java.time.LocalDateTime; | |||||
@TableName("nd_user_info") | @TableName("nd_user_info") | ||||
@Builder | @Builder | ||||
@Data | @Data | ||||
@AllArgsConstructor | |||||
@NoArgsConstructor | |||||
@ApiModel(value = "NdUserInfo对象", description = "") | @ApiModel(value = "NdUserInfo对象", description = "") | ||||
public class UserInfo implements Serializable { | public class UserInfo implements Serializable { | ||||
@@ -44,4 +48,6 @@ public class UserInfo implements Serializable { | |||||
private String available; | private String available; | ||||
private String employeeCode; | |||||
} | } |
@@ -1,23 +1,34 @@ | |||||
package com.ningdatech.pmapi.user.manage; | package com.ningdatech.pmapi.user.manage; | ||||
import cn.hutool.core.collection.CollUtil; | |||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||
import com.ningdatech.basic.exception.BizException; | |||||
import com.ningdatech.basic.model.PageVo; | import com.ningdatech.basic.model.PageVo; | ||||
import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo; | import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo; | ||||
import com.ningdatech.pmapi.organization.service.IDingEmployeeInfoService; | import com.ningdatech.pmapi.organization.service.IDingEmployeeInfoService; | ||||
import com.ningdatech.pmapi.organization.service.IDingOrganizationService; | import com.ningdatech.pmapi.organization.service.IDingOrganizationService; | ||||
import com.ningdatech.pmapi.sys.model.entity.UserRole; | |||||
import com.ningdatech.pmapi.sys.service.IUserRoleService; | |||||
import com.ningdatech.pmapi.user.constant.UserAvailableEnum; | |||||
import com.ningdatech.pmapi.user.entity.UserInfo; | |||||
import com.ningdatech.pmapi.user.model.po.ReqUserDetailEditPO; | import com.ningdatech.pmapi.user.model.po.ReqUserDetailEditPO; | ||||
import com.ningdatech.pmapi.user.model.po.ReqUserDisablePO; | 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.po.ReqUserInfoListPO; | ||||
import com.ningdatech.pmapi.user.model.vo.ResUserDetailVO; | import com.ningdatech.pmapi.user.model.vo.ResUserDetailVO; | ||||
import com.ningdatech.pmapi.user.model.vo.ResUserInfoListVO; | import com.ningdatech.pmapi.user.model.vo.ResUserInfoListVO; | ||||
import com.ningdatech.pmapi.user.model.vo.UserRoleVO; | |||||
import com.ningdatech.pmapi.user.service.IUserInfoService; | import com.ningdatech.pmapi.user.service.IUserInfoService; | ||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
import org.springframework.transaction.annotation.Transactional; | |||||
import java.time.LocalDateTime; | |||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import java.util.List; | import java.util.List; | ||||
import java.util.Objects; | |||||
import java.util.stream.Collectors; | import java.util.stream.Collectors; | ||||
/** | /** | ||||
@@ -31,6 +42,7 @@ public class UserInfoManage { | |||||
private final IDingOrganizationService iDingOrganizationService; | private final IDingOrganizationService iDingOrganizationService; | ||||
private final IDingEmployeeInfoService iDingEmployeeInfoService; | private final IDingEmployeeInfoService iDingEmployeeInfoService; | ||||
private final IUserInfoService iUserInfoService; | private final IUserInfoService iUserInfoService; | ||||
private final IUserRoleService iUserRoleService; | |||||
public PageVo<ResUserInfoListVO> list(ReqUserInfoListPO reqUserInfoListPO) { | public PageVo<ResUserInfoListVO> list(ReqUserInfoListPO reqUserInfoListPO) { | ||||
LambdaQueryWrapper<DingEmployeeInfo> wrapper = Wrappers.lambdaQuery(DingEmployeeInfo.class) | LambdaQueryWrapper<DingEmployeeInfo> wrapper = Wrappers.lambdaQuery(DingEmployeeInfo.class) | ||||
@@ -67,16 +79,82 @@ public class UserInfoManage { | |||||
return pageVo; | return pageVo; | ||||
} | } | ||||
public void disableOrEnable(ReqUserDisablePO reqUserDisablePO) { | public void disableOrEnable(ReqUserDisableOrEnablePO reqUserDisableOrEnablePO) { | ||||
Long userId = generateUserId(reqUserDisableOrEnablePO.getEmployeeCode()); | |||||
UserInfo userInfo = iUserInfoService.getById(userId); | |||||
userInfo.setAvailable(reqUserDisableOrEnablePO.getOperation()); | |||||
iUserInfoService.updateById(userInfo); | |||||
} | |||||
public ResUserDetailVO userInfoDetail(ReqUserDetailPO reqUserDetailPO) { | |||||
Long userId = generateUserId(reqUserDetailPO.getEmployeeCode()); | |||||
UserInfo userInfo = iUserInfoService.getById(userId); | |||||
if (Objects.isNull(userInfo)) { | |||||
return null; | |||||
} | |||||
ResUserDetailVO resUserDetailVO = new ResUserDetailVO(); | |||||
resUserDetailVO.setRealName(userInfo.getRealName()); | |||||
resUserDetailVO.setUserId(userInfo.getId()); | |||||
resUserDetailVO.setPhoneNo(userInfo.getMobile()); | |||||
resUserDetailVO.setStatus(userInfo.getAvailable()); | |||||
resUserDetailVO.setUserRoleInfoList(new ArrayList<>()); | |||||
return resUserDetailVO; | |||||
} | |||||
@Transactional(rollbackFor = Exception.class) | |||||
public void userInfoDetailEdit(ReqUserDetailEditPO reqUserDetailEditPO) { | |||||
Long userId = generateUserId(reqUserDetailEditPO.getEmployeeCode()); | |||||
UserInfo userInfo = iUserInfoService.getById(userId); | |||||
if (Objects.isNull(userInfo)) { | |||||
return; | |||||
} | |||||
userInfo.setMobile(reqUserDetailEditPO.getPhoneNo()); | |||||
userInfo.setAvailable(reqUserDetailEditPO.getStatus()); | |||||
iUserInfoService.updateById(userInfo); | |||||
List<UserRoleVO> userRoleInfoList = reqUserDetailEditPO.getUserRoleInfoList(); | |||||
iUserRoleService.remove(Wrappers.lambdaQuery(UserRole.class).eq(UserRole::getUserId, userId)); | |||||
if (CollUtil.isNotEmpty(userRoleInfoList)) { | |||||
List<UserRole> userRoleList = userRoleInfoList.stream().map(r -> { | |||||
UserRole saveRecord = new UserRole(); | |||||
saveRecord.setRoleId(r.getId()); | |||||
saveRecord.setUserId(userId); | |||||
return saveRecord; | |||||
}).collect(Collectors.toList()); | |||||
iUserRoleService.saveBatch(userRoleList); | |||||
} | |||||
} | } | ||||
public ResUserDetailVO userInfoDetail(ReqUserInfoListPO reqUserInfoListPO) { | private Long generateUserId(String employeeCode) { | ||||
return null; | UserInfo userInfo = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) | ||||
.eq(UserInfo::getEmployeeCode, employeeCode)); | |||||
if (Objects.isNull(userInfo)) { | |||||
List<DingEmployeeInfo> dingEmployeeInfoList = iDingEmployeeInfoService.list(Wrappers.lambdaQuery(DingEmployeeInfo.class) | |||||
.eq(DingEmployeeInfo::getMainJob, "true")); | |||||
if (CollUtil.isEmpty(dingEmployeeInfoList)) { | |||||
throw new BizException("员工账号不存在"); | |||||
} | |||||
DingEmployeeInfo dingEmployeeInfo = dingEmployeeInfoList.get(0); | |||||
userInfo = UserInfo.builder() | |||||
.accountId(dingEmployeeInfo.getAccountId()) | |||||
.username(dingEmployeeInfo.getEmployeeName()) | |||||
.realName(dingEmployeeInfo.getEmployeeName()) | |||||
.employeeCode(dingEmployeeInfo.getEmployeeCode()) | |||||
.available(UserAvailableEnum.DISABLE.name()) | |||||
.createBy(-1L) | |||||
.updateBy(-1L) | |||||
.createOn(LocalDateTime.now()) | |||||
.updateOn(LocalDateTime.now()) | |||||
.build(); | |||||
iUserInfoService.save(userInfo); | |||||
} | |||||
return userInfo.getId(); | |||||
} | } | ||||
public void userInfoDetailEdit(ReqUserDetailEditPO reqUserDetailEditPO) { | |||||
public ResUserDetailVO currentUserInfo() { | |||||
return null; | |||||
} | } | ||||
} | } |
@@ -1,33 +0,0 @@ | |||||
package com.ningdatech.pmapi.user.model.base; | |||||
import com.baomidou.mybatisplus.annotation.TableField; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
import javax.validation.constraints.Size; | |||||
import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2022/8/22 下午4:12 | |||||
*/ | |||||
@Data | |||||
@ApiModel("用户角色信息") | |||||
public class UserRoleInfo { | |||||
@ApiModelProperty(value = "名称") | |||||
private String name; | |||||
@ApiModelProperty(value = "枚举code") | |||||
private String code; | |||||
@ApiModelProperty(value = "描述") | |||||
@Size(max = 100, message = "描述长度不能超过100") | |||||
@TableField(value = "describe", condition = LIKE) | |||||
private String describe; | |||||
@ApiModelProperty(value = "排序") | |||||
private Integer roleSort; | |||||
} |
@@ -1,10 +1,11 @@ | |||||
package com.ningdatech.pmapi.user.model.po; | package com.ningdatech.pmapi.user.model.po; | ||||
import com.ningdatech.pmapi.user.model.base.UserRoleInfo; | import com.ningdatech.pmapi.user.model.vo.UserRoleVO; | ||||
import io.swagger.annotations.ApiModel; | import io.swagger.annotations.ApiModel; | ||||
import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.ApiModelProperty; | ||||
import lombok.Data; | import lombok.Data; | ||||
import javax.validation.constraints.NotBlank; | |||||
import java.util.List; | import java.util.List; | ||||
/** | /** | ||||
@@ -12,18 +13,24 @@ import java.util.List; | |||||
* @date 2023/2/15 上午8:43 | * @date 2023/2/15 上午8:43 | ||||
*/ | */ | ||||
@Data | @Data | ||||
@ApiModel("获取用户详情编辑请求") | @ApiModel("用户详情编辑请求") | ||||
public class ReqUserDetailEditPO { | public class ReqUserDetailEditPO { | ||||
@ApiModelProperty("userId") | @ApiModelProperty("userId") | ||||
private Long userId; | private Long userId; | ||||
@NotBlank(message = "浙政钉 用户编码 不能为空") | |||||
@ApiModelProperty("浙政钉 用户编码") | |||||
private String employeeCode; | |||||
@NotBlank(message = "用户手机号不能为空") | |||||
@ApiModelProperty("手机号") | @ApiModelProperty("手机号") | ||||
private String phoneNo; | private String phoneNo; | ||||
@ApiModelProperty("状态 启用/禁用") | @NotBlank(message = "状态不能为空") | ||||
private Boolean status; | @ApiModelProperty("状态 启用 ENABLE/禁用 DISABLE") | ||||
private String status; | |||||
@ApiModelProperty("用户角色信息列表") | @ApiModelProperty("用户角色信息列表") | ||||
private List<UserRoleInfo> userRoleInfoList; | private List<UserRoleVO> userRoleInfoList; | ||||
} | } |
@@ -4,7 +4,7 @@ import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.ApiModelProperty; | ||||
import lombok.Data; | import lombok.Data; | ||||
import javax.validation.constraints.NotNull; | import javax.validation.constraints.NotBlank; | ||||
/** | /** | ||||
* @author liuxinxin | * @author liuxinxin | ||||
@@ -14,7 +14,11 @@ import javax.validation.constraints.NotNull; | |||||
@ApiModel("获取用户详情请求") | @ApiModel("获取用户详情请求") | ||||
public class ReqUserDetailPO { | public class ReqUserDetailPO { | ||||
@NotNull(message = "用户id 不能为空") | |||||
@ApiModelProperty("用户id") | @ApiModelProperty("用户id") | ||||
private Long userId; | private Long userId; | ||||
@NotBlank(message = "浙政钉 用户编码 不能为空") | |||||
@ApiModelProperty("浙政钉 用户编码") | |||||
private String employeeCode; | |||||
} | } |
@@ -13,7 +13,7 @@ import javax.validation.constraints.NotBlank; | |||||
@Data | @Data | ||||
@ApiModel("用户禁用/启用 PO") | @ApiModel("用户禁用/启用 PO") | ||||
public class ReqUserDisablePO { | public class ReqUserDisableOrEnablePO { | ||||
@ApiModelProperty("用户id") | @ApiModelProperty("用户id") | ||||
private Long userId; | private Long userId; | ||||
@@ -22,8 +22,9 @@ public class ReqUserDisablePO { | |||||
@ApiModelProperty("浙政钉 用户编码") | @ApiModelProperty("浙政钉 用户编码") | ||||
private String employeeCode; | private String employeeCode; | ||||
@NotBlank(message = "浙政钉 用户编码 不能为空") | @NotBlank(message = "操作 不能为空") | ||||
@ApiModelProperty("操作 true: 启用 / false 禁用") | @ApiModelProperty("操作 启用 ENABLE/禁用 DISABLE") | ||||
private Boolean operation; | private String operation; | ||||
} | } |
@@ -1,7 +1,7 @@ | |||||
package com.ningdatech.pmapi.user.model.po; | package com.ningdatech.pmapi.user.model.po; | ||||
import com.ningdatech.basic.model.PagePo; | import com.ningdatech.basic.model.PagePo; | ||||
import com.ningdatech.pmapi.sys.model.entity.Role; | import com.ningdatech.pmapi.user.model.vo.UserRoleVO; | ||||
import io.swagger.annotations.ApiModel; | import io.swagger.annotations.ApiModel; | ||||
import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.ApiModelProperty; | ||||
import lombok.Data; | import lombok.Data; | ||||
@@ -28,8 +28,11 @@ public class ReqUserInfoListPO extends PagePo { | |||||
@ApiModelProperty("所属区域") | @ApiModelProperty("所属区域") | ||||
private Long regionId; | private Long regionId; | ||||
@ApiModelProperty("所属区域名称") | |||||
private Long regionName; | |||||
@ApiModelProperty("用户角色") | @ApiModelProperty("用户角色") | ||||
private List<Role> userRoleList; | private List<UserRoleVO> userRoleList; | ||||
@ApiModelProperty("状态") | @ApiModelProperty("状态") | ||||
private String status; | private String status; | ||||
@@ -1,6 +1,5 @@ | |||||
package com.ningdatech.pmapi.user.model.vo; | package com.ningdatech.pmapi.user.model.vo; | ||||
import com.ningdatech.pmapi.user.model.base.UserRoleInfo; | |||||
import io.swagger.annotations.ApiModel; | import io.swagger.annotations.ApiModel; | ||||
import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.ApiModelProperty; | ||||
import lombok.Data; | import lombok.Data; | ||||
@@ -18,12 +17,15 @@ public class ResUserDetailVO { | |||||
@ApiModelProperty("userId") | @ApiModelProperty("userId") | ||||
private Long userId; | private Long userId; | ||||
@ApiModelProperty("用户姓名") | |||||
private String realName; | |||||
@ApiModelProperty("手机号") | @ApiModelProperty("手机号") | ||||
private String phoneNo; | private String phoneNo; | ||||
@ApiModelProperty("状态 启用/禁用") | @ApiModelProperty("状态 启用 ENABLE/禁用 DISABLE") | ||||
private Boolean status; | private String status; | ||||
@ApiModelProperty("用户角色信息列表") | @ApiModelProperty("用户角色信息列表") | ||||
private List<UserRoleInfo> userRoleInfoList; | private List<UserRoleVO> userRoleInfoList; | ||||
} | } |
@@ -0,0 +1,21 @@ | |||||
package com.ningdatech.pmapi.user.model.vo; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2023/2/15 下午5:47 | |||||
*/ | |||||
@Data | |||||
@ApiModel("用户角色VO") | |||||
public class UserRoleVO { | |||||
@ApiModelProperty(value = "角色id") | |||||
private Long id; | |||||
@ApiModelProperty(value = "名称") | |||||
private String name; | |||||
} |
@@ -0,0 +1,37 @@ | |||||
package com.ningdatech.pmapi.todocenter; | |||||
import com.ningdatech.pmapi.AppTests; | |||||
import com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo; | |||||
import com.ningdatech.pmapi.todocenter.manage.TodoCenterManage; | |||||
import com.ningdatech.pmapi.user.entity.UserInfo; | |||||
import com.ningdatech.zwdd.client.ZwddClient; | |||||
import lombok.extern.slf4j.Slf4j; | |||||
import org.junit.Test; | |||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import static com.ningdatech.pmapi.todocenter.constant.WorkNotice.PASS_MSG_TEMPLATE; | |||||
/** | |||||
* 待办中心测试 | |||||
* | |||||
* @author CMM | |||||
* @since 2023/02/15 22:03 | |||||
*/ | |||||
@Slf4j | |||||
public class TodoCenterTest extends AppTests { | |||||
@Autowired | |||||
private TodoCenterManage todoCenterManage; | |||||
@Autowired | |||||
private ZwddClient zwddClient; | |||||
@Test | |||||
public void sendWorkNoticeTest(){ | |||||
// String msg = String.format(PASS_MSG_TEMPLATE, "发改委", "0216-4-测试项目"); | |||||
String msg = "发改委的0216-6-测试项目需要您审核"; | |||||
log.info("开始发送工作通知"); | |||||
zwddClient.sendWorkNotice("846085","0216-7",msg); | |||||
// zwddClient.sendWorkNotice("829728","0216-5",msg); | |||||
log.info("发送工作通知结束"); | |||||
} | |||||
} |