添加初始化角色;调整任务技术模块;调整任务工单需求模块;调整登陆用户权限问题

This commit is contained in:
DB 2023-12-01 14:26:11 +08:00
parent 9cf9a60a63
commit cbb4a1f62d
35 changed files with 1202 additions and 1043 deletions

View File

@ -17,10 +17,13 @@ public enum InitRoleEnum {
*/
SUPER_MALL_ROLE("2", "SuperMallAdmin", "SuperMallAdmin", -1, UserType.MALL_USER),
/**
* 企微注册初始化角色
* 企微注册初始化技术员工角色
*/
WX_CP_INIT_ROLE("3", "企微注册通用角色", "RegisterRole", 0, UserType.OAM_USER),
;
WX_CP_INIT_TECHNOLOGY_ROLE("3", "企微注册初始化技术员工角色", "RegisterTechnologyRole", 0, UserType.OAM_USER),
/**
* 企微注册初始化运营员工角色
*/
WX_CP_INIT_OPERATION_ROLE("4", "企微注册初始化运营员工角色", "RegisterOperationRole", 1, UserType.OAM_USER),;
/**
* 主键

View File

@ -24,13 +24,27 @@ public class SysConfigInfoBo implements Serializable {
* 任务审核员工手机号
*/
@NotBlank(message = "任务审核员工手机号不能为空")
@ApiModelProperty(value = "任务审核员工手机号",required = true)
@ApiModelProperty(value = "任务审核员工手机号", required = true)
private String auditStaffPhone;
/**
* 核销管理员工手机号
*/
@NotBlank(message = "核销管理员工手机号不能为空")
@ApiModelProperty(value = "核销管理员工手机号",required = true)
@ApiModelProperty(value = "核销管理员工手机号", required = true)
private String cancelAfterVerificationStaffPhone;
/**
* 需求转任务主体品牌
*/
@NotBlank(message = "需求转任务主体品牌不能为空")
@ApiModelProperty(value = "需求转任务主体品牌", required = true)
private String oamDemandToTaskBrand;
/**
* 需求转任务主体校区
*/
@NotBlank(message = "需求转任务主体校区不能为空")
@ApiModelProperty(value = "需求转任务主体校区", required = true)
private String oamDemandToTaskStore;
}

View File

@ -8,27 +8,24 @@ import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDate;
/**
* Description:
* date: 2023/5/16 17:33
*
* @Author ST
* 任务审核对象
* @author DB
* @since 2023-12-01 10:36:14
* @version 1.0.0
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "TaskAudit对象", description = "任务审核对象")
public class TaskAuditCommentsBo implements Serializable {
private static final long serialVersionUID = 1L;
public class TaskAuditCommentsBo {
/**
* 主键
*/
@NotBlank(message = "主键不能为空")
@ApiModelProperty(value = "主键",required = true)
@ApiModelProperty(value = "主键", required = true)
private String id;
/**
@ -41,7 +38,7 @@ public class TaskAuditCommentsBo implements Serializable {
* 预期完成日期
*/
@ApiModelProperty("预期完成日期")
@JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private LocalDate expectedCompletionDate;
/**
@ -50,10 +47,4 @@ public class TaskAuditCommentsBo implements Serializable {
@ApiModelProperty("任务评级(0:A;1:B;2:C;3:D;4:E)")
private Integer taskRating;
/**
* 任务状态(-1:驳回;0:待审核;1:待接受;2:进行中;3:已完成;4:逾期;)
*/
@NotNull(message = "任务状态不能为空")
@ApiModelProperty(value = "任务状态(-1:驳回;0:待审核;1:待接受;2:进行中;3:已完成;4:逾期;)",required = true)
private Integer taskStatus;
}

View File

@ -1,73 +0,0 @@
package com.cpop.oam.business.bo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDate;
/**
* OAM-任务表Bo
*
* @author DB.lost
* @since 2023-05-15
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "Task对象", description = "OAM-任务表")
public class TaskBo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@ApiModelProperty("主键")
private String id;
/**
* 任务名
*/
@NotBlank(message = "任务名不能为空")
@ApiModelProperty(value = "任务名",required = true)
private String taskName;
/**
* 任务类型(0:迭代;1:需求;2:投诉)
*/
@NotNull(message = "任务类型不能为空")
@ApiModelProperty(value = "任务类型(0:迭代;1:需求;2:投诉)",required = true)
private Integer taskType;
/**
* 任务内容
*/
@NotBlank(message = "任务内容不能为空")
@ApiModelProperty(value = "任务内容",required = true)
private String taskContent;
/**
* 附件地址
*/
@ApiModelProperty("附件地址")
private String attachmentUrl;
/**
* 备注
*/
@ApiModelProperty("备注")
private String remark;
/**
* 预期完成日期
*/
@ApiModelProperty("预期完成日期")
@JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8")
private LocalDate expectedCompletionDate;
}

View File

@ -7,7 +7,7 @@ import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import com.cpop.core.annontation.StringArrayConvert;
/**
* OAM-任务-需求表Bo
@ -18,9 +18,7 @@ import java.io.Serializable;
@Data
@Accessors(chain = true)
@ApiModel(value = "TaskDemand对象", description = "OAM-任务-需求表")
public class TaskDemandBo implements Serializable {
private static final long serialVersionUID = 1L;
public class TaskDemandBo {
/**
* 主键
@ -28,62 +26,32 @@ public class TaskDemandBo implements Serializable {
@ApiModelProperty("主键")
private String id;
/**
* 需求类型(0:;1:;2:;3:)
*/
@ApiModelProperty("需求类型(0:轻;1:缓;2:急;3:重)")
private Integer demandType;
/**
* 需求状态(0:待接收;1:处理中;2:已解决)
*/
@ApiModelProperty("需求状态(0:待接收;1:处理中;2:已解决)")
private Integer demandStatus;
/**
* 任务名
*/
@NotBlank(message = "任务名不能为空")
@ApiModelProperty("任务名")
private String taskName;
/**
* 任务类型(0:迭代;1:需求;2:投诉)
*/
@NotNull(message = "任务类型不能为空")
@ApiModelProperty("任务类型(0:迭代;1:需求;2:投诉)")
private Integer taskType;
/**
* 品牌id
*/
@NotBlank(message = "品牌不能为空")
@ApiModelProperty("品牌id")
@ApiModelProperty(value = "品牌id", required = true)
private String brandId;
/**
* 校区id
*/
@NotBlank(message = "校区不能为空")
@ApiModelProperty("校区id")
private String campusId;
@ApiModelProperty(value = "校区id", required = true)
private String storeId;
/**
* 任务内容
*/
@NotBlank(message = "任务内容不能为空")
@ApiModelProperty("任务内容")
@ApiModelProperty(value = "任务内容", required = true)
private String taskContent;
/**
* 附件地址
*/
@StringArrayConvert
@ApiModelProperty("附件地址")
private String attachmentUrl;
/**
* 备注
*/
@ApiModelProperty("备注")
private String remark;
}

View File

@ -16,26 +16,24 @@ import java.io.Serializable;
@Data
@Accessors(chain = true)
@ApiModel(value = "SysDept对象", description = "部门表")
public class TaskDemandPageBo implements Serializable {
private static final long serialVersionUID = 1L;
public class TaskDemandPageBo {
/**
* 任务
* 任务内容
*/
@ApiModelProperty("任务")
private String taskName;
@ApiModelProperty("任务内容")
private String taskContent;
/**
* 校区
* 品牌或校区
*/
@ApiModelProperty("校区")
private String campusName;
@ApiModelProperty("品牌或校区")
private String brandOrStore;
/**
* 任务状态
*/
@ApiModelProperty("任务状态")
@ApiModelProperty(value = "任务查询状态(待评估:0;待领取:1;处理中:2;已解决:3)", required = true)
private Integer taskStatus;
}

View File

@ -1,34 +0,0 @@
package com.cpop.oam.business.bo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* Description:
* date: 2023/5/16 15:27
*
* @Author ST
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "Task分页列表对象", description = "OAM-任务管理")
public class TaskPageBo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 任务类型(0:迭代;1:需求;2:投诉)
*/
@ApiModelProperty("任务类型(0:迭代;1:需求;2:投诉)")
private Integer taskType;
/**
* 任务评级(0:A;1:B;2:C;3:D;4:E)
*/
@ApiModelProperty("任务评级(0:A;1:B;2:C;3:D;4:E)")
private Integer taskRating;
}

View File

@ -6,6 +6,7 @@ import lombok.Data;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
import com.cpop.core.annontation.StringArrayConvert;
/**
* TaskWorkOrderRecord对象
@ -22,20 +23,21 @@ public class TaskWorkOrderRecordBo {
* 任务工单id
*/
@NotBlank(message = "任务工单id不能为空")
@ApiModelProperty("任务工单id")
@ApiModelProperty(value = "任务工单id", required = true)
private String taskWorkOrderId;
/**
* 记录内容
*/
@NotBlank(message = "记录内容不能为空")
@ApiModelProperty("记录内容")
@ApiModelProperty(value = "记录内容", required = true)
private String recordText;
/**
* 附件地址
*/
@ApiModelProperty("附件地址")
@StringArrayConvert
@ApiModelProperty(value = "附件地址", required = true)
private String attachmentUrl;
}

View File

@ -4,15 +4,25 @@ import com.cpop.core.base.R;
import com.cpop.oam.business.bo.TaskDemandBo;
import com.cpop.oam.business.bo.TaskDemandPageBo;
import com.cpop.oam.business.service.TaskDemandService;
import com.cpop.oam.business.vo.BrandListVo;
import com.cpop.oam.business.vo.StoreListVo;
import com.cpop.oam.business.vo.TaskDemandPageVo;
import com.cpop.system.business.service.BrandService;
import com.cpop.system.business.service.StoreService;
import com.mybatisflex.core.paginate.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import static com.cpop.system.business.entity.table.BrandTableDef.BRAND;
import static com.cpop.system.business.entity.table.StoreTableDef.STORE;
/**
* OAM-任务-需求表 控制层
*
@ -20,22 +30,27 @@ import org.springframework.web.bind.annotation.*;
* @since 2023-09-18
*/
@RestController
@Api(tags = "任务管理模块-需求任务")
@Api(tags = "工单模块-需求")
@RequestMapping("/taskDemand")
public class TaskDemandController {
@Autowired
private TaskDemandService taskDemandService;
@Autowired
private BrandService brandService;
@Autowired
private StoreService storeService;
/**
* @Description: 任务管理-需求管理分页列表
* @param bo 请求参数
* @return: R<PageVo<DemandPageListVo>>
* @Author: DB
* @Date: 2023/5/30 15:44
**/
* 工单模块-需求-需求分页列表
* @author DB
* @param bo 查询参数
* @since 2023-11-30 17:26:24
*/
@PreAuthorize("@aps.hasPermission('oamTask:taskDemand:list')")
@ApiOperation("任务管理模块-需求任务分页列表")
@ApiOperation("工单模块-需求-需求分页列表")
@GetMapping("/getTaskDemandPage")
public R<Page<TaskDemandPageVo>> getTaskDemandPage(TaskDemandPageBo bo) {
Page<TaskDemandPageVo> pageVo = taskDemandService.getTaskDemandPage(bo);
@ -43,18 +58,77 @@ public class TaskDemandController {
}
/**
* @Description: 任务管理-需求管理-新增需求任务
* 工单模块-需求-新增需求
* @author DB
* @param bo 请求参数
* @return: R<Void>
* @Author: DB
* @Date: 2023/5/30 16:53
**/
* @since 2023-11-30 17:27:24
*/
@PreAuthorize("@aps.hasPermission('oamTask:taskDemand:insert')")
@ApiOperation("任务管理模块-新增需求任务")
@ApiOperation("工单模块-需求-新增需求")
@PostMapping("/insertDemandTask")
public R<Void> insertDemandTask(@RequestBody @Validated TaskDemandBo bo) {
public R<Void> insertDemandTask(@RequestBody @Validated
TaskDemandBo bo) {
taskDemandService.insertTaskDemand(bo);
return R.ok();
}
/**
* 工单模块-需求-修改需求
* @author DB
* @param bo 请求参数
* @since 2023-11-30 18:26:42
*/
@PreAuthorize("@aps.hasPermission('oamTask:taskDemand:update')")
@ApiOperation("工单模块-需求-修改需求")
@PutMapping("/updateDemandTask")
public R<Void> updateDemandTask(@RequestBody @Validated
TaskDemandBo bo) {
taskDemandService.updateDemandTask(bo);
return R.ok();
}
/**
* 工单模块-需求-删除需求
* @author DB
* @param demandId 需求id
* @since 2023-11-30 20:30:54
*/
@PreAuthorize("@aps.hasPermission('oamTask:taskDemand:remove')")
@ApiOperation("工单模块-需求-删除需求")
@DeleteMapping("/removeDemandTask/{demandId}")
public R<Void> removeDemandTask(@PathVariable @ApiParam(value = "需求id")
String demandId) {
taskDemandService.removeDemandTask(demandId);
return R.ok();
}
/**
* 任务管理模块-工单管理-获取品牌列表
* @author DB
* @param brandName 品牌名
* @since 2023-11-30 17:59:29
*/
@ApiOperation("工单模块-工单提交-获取品牌列表")
@GetMapping("/getBrandList")
public R<List<BrandListVo>> getBrandList(@ApiParam("品牌名")
String brandName) {
List<BrandListVo> list =
brandService.queryChain().and(BRAND.BRAND_NAME.like(brandName)).listAs(BrandListVo.class);
return R.ok(list);
}
/**
* 工单模块-工单提交-获取校区/店铺列表
* @author DB
* @param brandId 品牌id
* @since 2023-11-30 18:00:08
*/
@ApiOperation("工单模块-工单提交-获取校区/店铺列表")
@GetMapping("/getStoreList")
public R<List<StoreListVo>> getStoreList(@ApiParam("品牌id")
String brandId) {
List<StoreListVo> list = storeService.queryChain().and(STORE.BRAND_ID.eq(brandId)).listAs(StoreListVo.class);
return R.ok(list);
}
}

View File

@ -1,9 +1,7 @@
package com.cpop.oam.business.controller.backstage;
import com.mybatisflex.core.paginate.Page;
import com.cpop.core.annontation.OperationLog;
import com.cpop.core.base.R;
import com.cpop.core.base.enums.OperationLogEnum;
import com.cpop.oam.business.bo.*;
import com.cpop.oam.business.service.StaffService;
import com.cpop.oam.business.service.TaskService;
@ -11,12 +9,14 @@ import com.cpop.oam.business.service.TaskStaffGroupService;
import com.cpop.oam.business.vo.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import com.cpop.oam.business.service.TaskWorkOrderService;
/**
* OAM-任务表 控制层
@ -25,9 +25,12 @@ import java.util.List;
* @since 2023-09-15
*/
@RestController
@Api(tags = "任务管理模块")
@RequestMapping("/task")
public class TaskController {
@Api(tags = "技术模块-技术")
@RequestMapping("/taskTechnology")
public class TaskTechnologyController {
@Autowired
private TaskWorkOrderService taskWorkOrderService;
@Autowired
private TaskService taskService;
@ -39,93 +42,145 @@ public class TaskController {
private StaffService staffService;
/**
* @Description: 查询OAM-任务分页列表
* 技术模块-今日事务-获取个人工单列表
* @author DB
* @since 2023-11-30 19:41:32
*/
@PreAuthorize("@aps.hasPermission('oamTask:taskTechnology:list')")
@ApiOperation("技术模块-今日事务-获取个人工单列表")
@GetMapping("/getPersonWorkOrder")
public R<List<TaskWorkOrderPersonVo>> getPersonWorkOrder() {
List<TaskWorkOrderPersonVo> list = taskWorkOrderService.getPersonWorkOrder();
return R.ok(list);
}
/**
* 工单模块-今日事务-工单记录列表
* @author DB
* @param workOrderId 工单id
* @since 2023-11-29 11:25:28
*/
@PreAuthorize("@aps.hasPermission('oamTask:workOrder:record')")
@ApiOperation("技术模块-今日事务-工单记录列表")
@GetMapping("/getWorkOrderRecordList/{workOrderId}")
public R<List<TaskWorkOrderRecordListVo>> getWorkOrderRecordList(@PathVariable @ApiParam("工单id")
String workOrderId) {
List<TaskWorkOrderRecordListVo> list = taskWorkOrderService.getWorkOrderRecordList(workOrderId);
return R.ok(list);
}
/**
* 工单模块-今日事务-新增工单记录
* @author DB
* @param bo 请求参数
* @return: R<PageVo<PersonTaskPageListVo>>
* @Author: DB
* @Date: 2023/5/16 15:24
**/
* @since 2023-11-29 11:33:35
*/
@PreAuthorize("@aps.hasPermission('oamTask:workOrder:record')")
@ApiOperation("技术模块-今日事务-新增工单记录")
@PostMapping("/insertWorkOrderRecord")
public R<Void> insertWorkOrderRecord(@RequestBody @Validated
TaskWorkOrderRecordBo bo) {
taskWorkOrderService.insertWorkOrderRecord(bo);
return R.ok();
}
/**
* 技术模块-任务归档-获取任务归档分页
* @author DB
* @param subject 主体
* @param taskContent 任务内容
* @since 2023-11-30 21:11:47
*/
@PreAuthorize("@aps.hasPermission('oamTask:taskArchiving:list')")
@ApiOperation("技术模块-任务归档-获取任务归档分页")
@GetMapping("/getTaskArchivingPage")
public R<Page<TaskArchivingPagVo>> getTaskArchivingPage(@ApiParam(value = "主体")
String subject, @ApiParam(value = "任务内容")
String taskContent, @RequestParam("isFinish") @ApiParam(value = "是否已归档", required = true)
Boolean isFinish) {
Page<TaskArchivingPagVo> page = taskService.getTaskArchivingPage(subject, taskContent, isFinish);
return R.ok(page);
}
/**
* 技术模块-任务归档-设置任务归档
* @author DB
* @param taskId 任务id
* @since 2023-11-30 21:49:05
*/
@PreAuthorize("@aps.hasPermission('oamTask:taskArchiving:update')")
@ApiOperation("技术模块-任务归档-设置任务归档")
@PutMapping("/setTaskArchiving/{taskId}")
public R<Void> setTaskArchiving(@PathVariable @ApiParam("任务id")
String taskId) {
taskService.setTaskArchiving(taskId);
return R.ok();
}
/**
* 技术模块-任务领取-获取领取任务分页
* @author DB
* @param subject 主体
* @param taskContent 任务内容
* @param toBeEvaluated 是否待评估
* @since 2023-11-30 22:21:58
*/
@PreAuthorize("@aps.hasPermission('oamTask:task:list')")
@ApiOperation("任务分页列表")
@GetMapping("/getTaskPage")
public R<Page<TaskPageVo>> getTaskPage(TaskPageBo bo) {
Page<TaskPageVo> list = taskService.getTaskPage(bo);
@ApiOperation("技术模块-任务领取-获取领取任务分页")
@GetMapping("/getToBeClaimedPage")
public R<Page<TaskToBeClaimedPageVo>> getToBeClaimedPage(@ApiParam(value = "主体")
String subject, @ApiParam(value = "任务内容")
String taskContent, @RequestParam("toBeEvaluated") @ApiParam(value = "是否待评估", required = true)
Boolean toBeEvaluated) {
Page<TaskToBeClaimedPageVo> list = taskService.getToBeClaimedPage(subject, taskContent, toBeEvaluated);
return R.ok(list);
}
/**
* @Description: OAM-新增迭代任务
* @param bo 请求参数
* @return: R<Void>
* @Author: DB
* @Date: 2023/5/16 15:58
**/
@PreAuthorize("@aps.hasPermission('oamTask:task:insert')")
@ApiOperation("新增迭代任务")
* 技术模块-任务领取-新增迭代任务
* @author DB
* @param bo 请求
* @since 2023-12-01 09:45:08
*/
@PreAuthorize("@aps.hasPermission('oamTask:iterateTask:insert')")
@ApiOperation("技术模块-任务领取-新增迭代任务")
@PostMapping("/insertIterationTask")
public R<Void> insertIterationTask(@RequestBody @Validated TaskBo bo) {
taskService.insertTask(bo);
public R<Void> insertIterationTask(@RequestBody @Validated
TaskIterationBo bo) {
taskService.insertIterationTask(bo);
return R.ok();
}
/**
* @Description: 查询OAM-任务审核分页列表
* @return: R<Page<OamTaskAuditPageVo>>
* @Author: DB
* @Date: 2023/5/16 15:24
**/
@PreAuthorize("@aps.hasPermission('oamTask:taskAudit:list')")
@ApiOperation("任务审核分页列表")
@GetMapping("/getTaskAuditPage")
public R<Page<TaskAuditPageVo>> getTaskAuditPage() {
Page<TaskAuditPageVo> list = taskService.getTaskAuditPage();
return R.ok(list);
}
/**
* @Description: 设置任务审核意见
* @param bo 请求参数
* @return: R<Void>
* @Author: DB
* @Date: 2023/5/16 17:36
**/
@PreAuthorize("@aps.hasPermission('oamTask:taskAudit:update')")
@ApiOperation("设置任务审核意见")
@PutMapping("/setTaskAuditComments")
public R<Void> setTaskAuditComments(@RequestBody TaskAuditCommentsBo bo) {
taskService.setTaskAuditComments(bo);
return R.ok();
}
/**
* @Description: 查询OAM-任务审核驳回列表
* @return: R<Page<OamTaskAuditPageVo>>
* @Author: DB
* @Date: 2023/5/16 15:24
**/
@PreAuthorize("@aps.hasPermission('oamTask:taskAudit:list')")
@ApiOperation("任务审核驳回列表")
@GetMapping("/getTaskRejectPage")
public R<Page<TaskAuditPageVo>> getTaskRejectPage() {
Page<TaskAuditPageVo> list = taskService.getTaskRejectPage();
return R.ok(list);
}
/**
* @Description: 技术人员领取任务
* @param id 任务主键
* @return: R<Void>
* @Author: DB
* @Date: 2023/5/16 17:10
**/
@PreAuthorize("@aps.hasPermission('oamTask:task:update')")
@ApiOperation("技术人员领取任务")
* 技术模块-任务领取-技术人员领取任务
* @author DB
* @param id 任务id
* @since 2023-12-01 10:15:28
*/
@PreAuthorize("@aps.hasPermission('oamTask:iterateTask:update')")
@ApiOperation("技术模块-任务领取-技术人员领取任务")
@PutMapping("/claimTask/{id}")
public R<Void> claimTask(@PathVariable String id) {
public R<Void> claimTask(@PathVariable @ApiParam("任务id")
String id) {
taskService.claimTask(id);
return R.ok();
}
/**
* 技术模块-任务领取-任务审核
* @author DB
* @param bo 请求参数
* @since 2023-12-01 10:35:31
*/
@PreAuthorize("@aps.hasPermission('oamTask:taskAudit:update')")
@ApiOperation("技术模块-任务领取-任务审核")
@PutMapping("/setTaskAuditComments")
public R<Void> setTaskAuditComments(@RequestBody @Validated
TaskAuditCommentsBo bo) {
taskService.setTaskAuditComments(bo);
return R.ok();
}
/**
* @Description: 删除任务
* @param id 主键
@ -136,7 +191,8 @@ public class TaskController {
@PreAuthorize("@aps.hasPermission('oamTask:task:remove')")
@ApiOperation("删除任务")
@DeleteMapping("/removeTask/{id}")
public R<Void> removeTask(@PathVariable String id) {
public R<Void> removeTask(@PathVariable
String id) {
taskService.removeById(id);
return R.ok();
}
@ -163,7 +219,8 @@ public class TaskController {
**/
@ApiOperation("任务成员组列表")
@GetMapping("/getTaskStaffGroupList")
public R<List<TaskStaffGroupVo>> getTaskStaffGroupList(@Validated TaskStaffGroupListBo bo) {
public R<List<TaskStaffGroupVo>> getTaskStaffGroupList(@Validated
TaskStaffGroupListBo bo) {
List<TaskStaffGroupVo> list = taskStaffGroupService.getTaskStaffGroupList(bo);
return R.ok(list);
}
@ -190,7 +247,8 @@ public class TaskController {
**/
@ApiOperation("新增任务小组成员")
@PostMapping("/insertTaskStaffGroup")
public R<Void> insertTaskStaffGroup(@RequestBody @Validated TaskStaffGroupBo bo) {
public R<Void> insertTaskStaffGroup(@RequestBody @Validated
TaskStaffGroupBo bo) {
taskStaffGroupService.insertTaskStaffGroup(bo);
return R.ok();
}
@ -204,7 +262,8 @@ public class TaskController {
**/
@ApiOperation("修改员工任务绩点")
@PutMapping("/updateStaffGradePoint")
public R<Void> updateStaffGradePoint(@RequestBody @Validated TaskStaffGroupBo bo) {
public R<Void> updateStaffGradePoint(@RequestBody @Validated
TaskStaffGroupBo bo) {
taskStaffGroupService.updateStaffGradePoint(bo);
return R.ok();
}
@ -218,7 +277,8 @@ public class TaskController {
**/
@ApiOperation("删除成员组")
@DeleteMapping("/removeTaskStaffGroup/{id}")
public R<Void> removeTaskStaffGroup(@PathVariable String id) {
public R<Void> removeTaskStaffGroup(@PathVariable
String id) {
taskStaffGroupService.removeTaskStaffGroupById(id);
return R.ok();
}
@ -232,7 +292,8 @@ public class TaskController {
**/
@ApiOperation("修改任务进度")
@PutMapping("/updateTaskItem")
public R<Void> updateTaskItem(@RequestBody @Validated TaskItemBo bo) {
public R<Void> updateTaskItem(@RequestBody @Validated
TaskItemBo bo) {
taskService.updateTaskItem(bo);
return R.ok();
}
@ -246,7 +307,8 @@ public class TaskController {
**/
@ApiOperation("修改任务负责人")
@PutMapping("/updateTaskResponsibleStaff")
public R<Void> updateTaskResponsibleStaff(@RequestBody @Validated TransferTaskBo bo) {
public R<Void> updateTaskResponsibleStaff(@RequestBody @Validated
TransferTaskBo bo) {
taskService.updateTaskResponsibleStaff(bo);
return R.ok();
}
@ -261,7 +323,8 @@ public class TaskController {
@PreAuthorize("@aps.hasPermission('oamTask:task:update')")
@ApiOperation("完成任务")
@PutMapping("/finishTask/{id}")
public R<Void> finishTask(@PathVariable String id) {
public R<Void> finishTask(@PathVariable
String id) {
taskService.finishTask(id);
return R.ok();
}

View File

@ -33,7 +33,7 @@ import static com.cpop.system.business.entity.table.StoreTableDef.STORE;
* @since 2023-09-18
*/
@RestController
@Api(tags = "工单模块")
@Api(tags = "工单模块-工单")
@RequestMapping("/taskWorkOrder")
public class TaskWorkOrderController {
@ -202,12 +202,10 @@ public class TaskWorkOrderController {
}
/**
* @descriptions 任务管理模块-工单管理-获取品牌列表
* 任务管理模块-工单管理-获取品牌列表
* @author DB
* @date 2023/11/28 12:34
* @param brandName
* 品牌名
* @return: com.cpop.core.base.R<java.util.List<com.cpop.jambox.business.vo.BrandListVo>>
* @param brandName 品牌名
* @since 2023-11-30 17:59:29
*/
@ApiOperation("工单模块-工单提交-获取品牌列表")
@GetMapping("/getBrandList")
@ -219,12 +217,10 @@ public class TaskWorkOrderController {
}
/**
* @descriptions 任务管理模块-工单管理-获取校区/店铺列表
* 工单模块-工单提交-获取校区/店铺列表
* @author DB
* @date 2023/11/28 12:38
* @param brandId
* 品牌id
* @return: com.cpop.core.base.R<java.util.List<com.cpop.oam.business.vo.StoreListVo>>
* @param brandId 品牌id
* @since 2023-11-30 18:00:08
*/
@ApiOperation("工单模块-工单提交-获取校区/店铺列表")
@GetMapping("/getStoreList")

View File

@ -30,13 +30,17 @@ public class WxCpPortalController {
private OamWxCpService oamWxCpService;
@GetMapping(produces = "text/plain;charset=utf-8")
public String authGet(@PathVariable Integer agentId,
@RequestParam(name = "msg_signature", required = false) String signature,
@RequestParam(name = "timestamp", required = false) String timestamp,
@RequestParam(name = "nonce", required = false) String nonce,
@RequestParam(name = "echostr", required = false) String echostr) {
public String authGet(@PathVariable
Integer agentId, @RequestParam(name = "msg_signature", required = false)
String signature, @RequestParam(name = "timestamp", required = false)
String timestamp, @RequestParam(name = "nonce", required = false)
String nonce, @RequestParam(name = "echostr", required = false)
String echostr) {
this.logger.info("\n接收到来自微信服务器的认证消息signature = [{}], timestamp = [{}], nonce = [{}], echostr = [{}]",
signature, timestamp, nonce, echostr);
signature,
timestamp,
nonce,
echostr);
if (StringUtils.isAnyBlank(signature, timestamp, nonce, echostr)) {
throw new IllegalArgumentException("请求参数非法,请核实!");
}
@ -51,17 +55,21 @@ public class WxCpPortalController {
}
@PostMapping(produces = "application/xml; charset=UTF-8")
public String post(@PathVariable Integer agentId,
@RequestBody String requestBody,
@RequestParam("msg_signature") String signature,
@RequestParam("timestamp") String timestamp,
@RequestParam("nonce") String nonce) {
public String post(@PathVariable
Integer agentId, @RequestBody
String requestBody, @RequestParam("msg_signature")
String signature, @RequestParam("timestamp")
String timestamp, @RequestParam("nonce")
String nonce) {
this.logger.info("\n接收微信请求[signature=[{}], timestamp=[{}], nonce=[{}], requestBody=[\n{}\n] ",
signature, timestamp, nonce, requestBody);
signature,
timestamp,
nonce,
requestBody);
final WxCpService wxCpService = WxCpConfiguration.getCpService(agentId);
WxCpXmlMessage inMessage = WxCpXmlMessage.fromEncryptedXml(requestBody, wxCpService.getWxCpConfigStorage(),
timestamp, nonce, signature);
WxCpXmlMessage inMessage = WxCpXmlMessage
.fromEncryptedXml(requestBody, wxCpService.getWxCpConfigStorage(), timestamp, nonce, signature);
this.logger.debug("\n消息解密后内容为\n{} ", JsonUtils.toJson(inMessage));
WxCpXmlOutMessage outMessage = this.route(agentId, inMessage);
if (outMessage == null) {
@ -82,18 +90,18 @@ public class WxCpPortalController {
}
/**
* @descriptions 企微的o2认证可查询用户敏感信息
* 企微的o2认证可查询用户敏感信息
* @author DB
* @date 2023/11/17 14:42
* @since 2023/11/17 14:42
* @param agentId 企业微信服务应用id
* @param code 授权码
* @param state 信息 注册
* @return: java.lang.String
*/
@GetMapping(produces = "text/plain;charset=utf-8", value = "/registerCode")
public void registerCode(@PathVariable Integer agentId,
@RequestParam("code") String code,
@RequestParam("state") String state) {
public void registerCode(@PathVariable
Integer agentId, @RequestParam("code")
String code, @RequestParam("state")
String state) {
oamWxCpService.registerCode(agentId, code);
}

View File

@ -10,8 +10,8 @@ import lombok.*;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.sql.Date;
import java.time.LocalDateTime;
import java.time.LocalDate;
/**
* OAM-任务表 实体类
@ -34,11 +34,6 @@ public class Task extends BaseEntity implements Serializable {
@Id
private String id;
/**
* 任务名
*/
private String taskName;
/**
* 任务类型(0:迭代;1:需求;2:投诉/工单)
*/
@ -50,7 +45,7 @@ public class Task extends BaseEntity implements Serializable {
private String responsibleStaffId;
/**
* 任务状态(-1:失败;0:待审核;1:待接受;2:进行中;3:已完成;4:逾期;5:暂停;6:逾期完成;7:接收超时)
* 任务状态(-1:失败;0:待审核;1:待接受;2:进行中;3:已完成;4:逾期;5:暂停;6:逾期完成;7:接收超时;8:待部署;9:待归档)
*/
private Integer taskStatus;
@ -84,21 +79,42 @@ public class Task extends BaseEntity implements Serializable {
*/
private String remark;
/**
* 是否加急
*/
private Integer isUrgent;
/**
* 预期完成日期
*/
private Date expectedCompletionDate;
private LocalDate expectedCompletionDate;
/**
* 完成日期
*/
private Date completionDate;
private LocalDate completionDate;
/**
* 任务接收时间
*/
private LocalDateTime taskReceiptTime;
/**主体 */
private String subject;
/**测试转部署文件 */
private String testToFinishUrl;
/**
* 转测试时间
*/
private LocalDateTime toTestTime;
/**
* 转部署时间
*/
private LocalDateTime toFinishTime;
/**
* 是否删除(0否1是)
*/

View File

@ -19,7 +19,7 @@ import java.math.BigDecimal;
* @since 2023-09-18
*/
@Data
@EqualsAndHashCode(callSuper=false)
@EqualsAndHashCode(callSuper = false)
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ -38,11 +38,6 @@ public class TaskDemand extends BaseEntity implements Serializable {
*/
private String taskId;
/**
* 商户id
*/
private String mechanismId;
/**
* 品牌id
*/
@ -51,12 +46,7 @@ public class TaskDemand extends BaseEntity implements Serializable {
/**
* 校区id
*/
private String campusId;
/**
* 需求类型(0:;1:;2:;3:)
*/
private Integer demandType;
private String storeId;
/**
* 记录员工id
@ -83,10 +73,6 @@ public class TaskDemand extends BaseEntity implements Serializable {
*/
private BigDecimal payable;
/**
* 是否删除(0否1是)
*/

View File

@ -16,20 +16,34 @@ import com.cpop.oam.business.vo.TaskDemandPageVo;
public interface TaskDemandService extends IService<TaskDemand> {
/**
* @Description: 任务管理-需求管理分页列表
* @param bo 请求参数
* @return: R<PageVo<DemandPageListVo>>
* @Author: DB
* @Date: 2023/5/30 15:44
**/
* 工单模块-需求-需求分页列表
* @author DB
* @param bo 查询参数
* @since 2023-11-30 17:26:24
*/
Page<TaskDemandPageVo> getTaskDemandPage(TaskDemandPageBo bo);
/**
* @Description: 任务管理-需求管理-新增需求任务
* 工单模块-需求-新增需求
* @author DB
* @param bo 请求参数
* @return: R<Void>
* @Author: DB
* @Date: 2023/5/30 16:53
**/
* @since 2023-11-30 17:27:24
*/
void insertTaskDemand(TaskDemandBo bo);
/**
* 工单模块-需求-修改需求
* @author DB
* @param bo 请求参数
* @since 2023-11-30 18:26:42
*/
void updateDemandTask(TaskDemandBo bo);
/**
* 工单模块-需求-删除需求
* @author DB
* @param demandId 需求id
* @since 2023-11-30 20:30:54
*/
void removeDemandTask(String demandId);
}

View File

@ -1,13 +1,13 @@
package com.cpop.oam.business.service;
import com.cpop.oam.business.vo.TaskArchivingPagVo;
import com.cpop.oam.business.vo.TaskToBeClaimedPageVo;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.service.IService;
import com.cpop.oam.business.bo.*;
import com.cpop.oam.business.entity.Task;
import com.cpop.oam.business.vo.PersonTaskPageVo;
import com.cpop.oam.business.vo.TaskAuditPageVo;
import com.cpop.oam.business.vo.TaskMonthStatisticsVo;
import com.cpop.oam.business.vo.TaskPageVo;
/**
* OAM-任务表 服务层
@ -18,57 +18,56 @@ import com.cpop.oam.business.vo.TaskPageVo;
public interface TaskService extends IService<Task> {
/**
* @Description: 查询OAM-任务分页列表
* @param bo 请求参数
* @return: R<PageVo<PersonTaskPageListVo>>
* @Author: DB
* @Date: 2023/5/16 15:24
**/
Page<TaskPageVo> getTaskPage(TaskPageBo bo);
* 技术模块-任务归档-获取任务归档分页
* @author DB
* @param subject 主体
* @param taskContent 任务内容
* @since 2023-11-30 21:11:47
*/
Page<TaskArchivingPagVo> getTaskArchivingPage(String subject, String taskContent, Boolean isFinish);
/**
* @Description: OAM-新增任务
* @param bo 请求参数
* @return: R<Void>
* @Author: DB
* @Date: 2023/5/16 15:58
**/
void insertTask(TaskBo bo);
* 技术模块-任务归档-设置任务归档
* @author DB
* @param taskId 任务id
* @since 2023-11-30 21:49:05
*/
void setTaskArchiving(String taskId);
/**
* @Description: 查询OAM-任务审核分页列表
* @return: R<Page<OamTaskAuditPageVo>>
* @Author: DB
* @Date: 2023/5/16 15:24
**/
Page<TaskAuditPageVo> getTaskAuditPage();
* 技术模块-任务领取-获取领取任务分页
* @author DB
* @param subject 主体
* @param taskContent 任务内容
* @param toBeEvaluated 是否待评估
* @since 2023-11-30 22:21:58
*/
Page<TaskToBeClaimedPageVo> getToBeClaimedPage(String subject, String taskContent, Boolean toBeEvaluated);
/**
* @Description: 设置任务审核意见
* @param bo 请求参数
* @return: R<Void>
* @Author: DB
* @Date: 2023/5/16 17:36
**/
void setTaskAuditComments(TaskAuditCommentsBo bo);
* 技术模块-任务领取-新增迭代任务
* @author DB
* @param bo 请求
* @since 2023-12-01 09:45:08
*/
void insertIterationTask(TaskIterationBo bo);
/**
* @Description: 查询OAM-任务审核驳回列表
* @return: R<Page<OamTaskAuditPageVo>>
* @Author: DB
* @Date: 2023/5/16 15:24
**/
Page<TaskAuditPageVo> getTaskRejectPage();
/**
* @Description: 技术人员领取任务
* @param id 任务主键
* @return: R<Void>
* @Author: DB
* @Date: 2023/5/16 17:10
**/
* 技术模块-任务领取-技术人员领取任务
* @author DB
* @param id 任务id
* @since 2023-12-01 10:15:28
*/
void claimTask(String id);
/**
* 技术模块-任务领取-任务审核
* @author DB
* @param bo 请求参数
* @since 2023-12-01 10:35:31
*/
void setTaskAuditComments(TaskAuditCommentsBo bo);
/**
* @Description: 查询OAM-个人任务分页列表
* @return: R<PageVo<PersonTaskPageListVo>>
@ -112,4 +111,5 @@ public interface TaskService extends IService<Task> {
* @Date: 2023/5/15 16:42
**/
TaskMonthStatisticsVo getTaskMonthStatistics(TaskMonthStatisticsBo bo);
}

View File

@ -12,11 +12,4 @@ import com.cpop.oam.business.entity.TaskWorkOrderRecord;
*/
public interface TaskWorkOrderRecordService extends IService<TaskWorkOrderRecord> {
/**
* @descriptions 新增任务-工单-记录
* @author DB
* @date 2023/09/18 17:31
* @param orderRecordDto 请求参数
*/
void insertTaskWorkOrderRecord(TaskWorkOrderRecordDto orderRecordDto);
}

View File

@ -1,5 +1,6 @@
package com.cpop.oam.business.service;
import com.cpop.oam.business.vo.TaskWorkOrderPersonVo;
import com.cpop.oam.business.vo.TaskWorkOrderReceiveDealPauseVo;
import com.cpop.oam.business.vo.WorkOrderDutyVo;
import com.mybatisflex.core.paginate.Page;
@ -108,4 +109,10 @@ public interface TaskWorkOrderService extends IService<TaskWorkOrder> {
*/
void workOrderFinish(String workOrderId);
/**
* 技术模块-技术-获取个人工单列表
* @author DB
* @since 2023-11-30 19:41:32
*/
List<TaskWorkOrderPersonVo> getPersonWorkOrder();
}

View File

@ -13,6 +13,7 @@ import com.cpop.oam.business.service.CommonService;
import com.cpop.oam.business.vo.ConfigInfoVo;
import com.cpop.oam.framework.constant.OamConfigKey;
import com.cpop.oam.framework.enums.OamConfigEnum;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
@ -42,15 +43,16 @@ public class CommonServiceImpl implements CommonService {
*/
@Override
public void loadingConfigCache() {
List<String> keys = Arrays.asList(OamConfigKey.WORK_WX_INFO);
//加载OAM配置参数
String[] keys = ArrayUtils.addAll(OamConfigKey.WORK_WX_INFO, OamConfigKey.DEMAND_TO_TASK);
// 加载OAM配置参数
List<SysConfig> configsList = DbChain.table(SYS_CONFIG)
.select(SYS_CONFIG.ALL_COLUMNS)
.where(SYS_CONFIG.CONFIG_KEY.in(keys))
.listAs(SysConfig.class);
if (!configsList.isEmpty()){
.select(SYS_CONFIG.ALL_COLUMNS)
.where(SYS_CONFIG.CONFIG_KEY.in(keys))
.listAs(SysConfig.class);
if (!configsList.isEmpty()) {
for (SysConfig config : configsList) {
SpringUtils.getBean(RedisService.class).setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
SpringUtils.getBean(RedisService.class)
.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
}
}
}
@ -94,19 +96,19 @@ public class CommonServiceImpl implements CommonService {
public ConfigInfoVo getSysConfigInfo() {
RedisService redisService = SpringUtils.getBean(RedisService.class);
CoreService coreService = SpringUtils.getBean(CoreService.class);
//获取企业微信信息
// 获取企业微信信息
Map<String, String> configMap = new HashMap<>(8);
Arrays.asList(OamConfigKey.WORK_WX_INFO).forEach(item -> {
String cacheInfo = redisService.getCacheObject(getCacheKey(item));
if (StringUtils.isNotBlank(cacheInfo)) {
//获取枚举
// 获取枚举
OamConfigEnum sysConfigEnum = OamConfigEnum.matchKey(item);
configMap.put(sysConfigEnum.getField(), cacheInfo);
} else {
//查询系统
// 查询系统
SysConfig sysConfig = coreService.selectConfigByKey(item);
if (null !=sysConfig) {
//获取枚举
if (null != sysConfig) {
// 获取枚举
OamConfigEnum sysConfigEnum = OamConfigEnum.matchKey(item);
configMap.put(sysConfigEnum.getField(), sysConfig.getConfigValue());
}
@ -127,25 +129,28 @@ public class CommonServiceImpl implements CommonService {
@Override
public void setSysConfigInfo(SysConfigInfoBo bo) {
CoreService coreService = SpringUtils.getBean(CoreService.class);
//遍历属性名与值
// 遍历属性名与值
try {
for (Field field : bo.getClass().getDeclaredFields()) {
field.setAccessible(true);
//获取枚举
// 获取枚举
OamConfigEnum sysConfigEnum = OamConfigEnum.matchField(field.getName());
if (null != sysConfigEnum) {
SysConfig sysConfig = new SysConfig();
sysConfig.setConfigName(sysConfigEnum.getName())
.setConfigKey(sysConfigEnum.getKey())
.setConfigValue(field.get(bo).toString());
//修改
if (DbChain.table(SYS_CONFIG).where(SYS_CONFIG.CONFIG_KEY.eq(sysConfig.getConfigKey())).count() > 0) {
.setConfigKey(sysConfigEnum.getKey())
.setConfigValue(field.get(bo).toString());
// 修改
if (DbChain.table(SYS_CONFIG)
.where(SYS_CONFIG.CONFIG_KEY.eq(sysConfig.getConfigKey()))
.count() > 0) {
coreService.updateConfig(sysConfig);
} else {
coreService.insertConfig(sysConfig);
}
//更新缓存
SpringUtils.getBean(RedisService.class).setCacheObject(getCacheKey(sysConfigEnum.getKey()), sysConfig.getConfigValue());
// 更新缓存
SpringUtils.getBean(RedisService.class)
.setCacheObject(getCacheKey(sysConfigEnum.getKey()), sysConfig.getConfigValue());
}
}
} catch (IllegalAccessException e) {

View File

@ -58,22 +58,27 @@ public class OamWxCpServiceImpl implements OamWxCpService {
*/
@Override
public void syncWxCpDept() {
//企业微信互通应用
// 企业微信互通应用
WxCpService cpService = WxCpConfiguration.getCpService(1000024);
try {
//获取所有数据
// 获取所有数据
List<WxCpDepart> list = cpService.getDepartmentService().list(null);
//过滤出最顶级部门
WxCpDepart wxCpDepart = list.stream().filter(item -> item.getParentId() == 0).collect(Collectors.toList()).get(0);
//先存
// 过滤出最顶级部门
WxCpDepart wxCpDepart =
list.stream().filter(item -> item.getParentId() == 0).collect(Collectors.toList()).get(0);
// 先存
Dept dept = new Dept();
dept.setWxCpId(wxCpDepart.getId()).setWxCpParentId(wxCpDepart.getParentId()).setOrderNo(wxCpDepart.getOrder().intValue()).setName(wxCpDepart.getName());
dept.setWxCpId(wxCpDepart.getId())
.setWxCpParentId(wxCpDepart.getParentId())
.setOrderNo(wxCpDepart.getOrder().intValue())
.setName(wxCpDepart.getName());
if (wxCpDepart.getDepartmentLeader().length > 0) {
dept.setLeader(wxCpDepart.getDepartmentLeader()[0]);
}
SpringUtils.getBean(DeptService.class).save(dept);
//递归保存余下部门
List<WxCpDepart> filterWxDeptList = list.stream().filter(item -> item.getParentId() != 0).collect(Collectors.toList());
// 递归保存余下部门
List<WxCpDepart> filterWxDeptList =
list.stream().filter(item -> item.getParentId() != 0).collect(Collectors.toList());
recursionSonDept(filterWxDeptList, dept);
} catch (WxErrorException e) {
throw new ServiceException(e.getMessage());
@ -94,14 +99,18 @@ public class OamWxCpServiceImpl implements OamWxCpService {
while (iterator.hasNext()) {
WxCpDepart next = iterator.next();
if (next.getParentId().equals(parentDept.getWxCpId())) {
//先存
// 先存
Dept dept = new Dept();
dept.setWxCpId(next.getId()).setWxCpParentId(next.getParentId()).setOrderNo(next.getOrder().intValue()).setParentId(parentDept.getId()).setName(next.getName());
dept.setWxCpId(next.getId())
.setWxCpParentId(next.getParentId())
.setOrderNo(next.getOrder().intValue())
.setParentId(parentDept.getId())
.setName(next.getName());
deptList.add(dept);
iterator.remove();
}
}
//当子部门不为空的时候保存部门
// 当子部门不为空的时候保存部门
if (!deptList.isEmpty()) {
SpringUtils.getBean(DeptService.class).saveBatch(deptList);
deptList.forEach(item -> {
@ -122,34 +131,36 @@ public class OamWxCpServiceImpl implements OamWxCpService {
WxCpService cpService = WxCpConfiguration.getCpService(1000024);
try {
List<WxCpUser> wxCpUsers = cpService.getUserService().listByDepartment(1L, true, 0);
if (!wxCpUsers.isEmpty()){
//批量插入用户
Map<SysUser,WxCpUser> userWxCpUserMap = new HashMap<>();
if (!wxCpUsers.isEmpty()) {
// 批量插入用户
Map<SysUser, WxCpUser> userWxCpUserMap = new HashMap<>();
wxCpUsers.forEach(item -> {
SysUser sysUser = new SysUser();
sysUser.setId(IdUtils.fastSimpleUUID())
.setStatus(item.getStatus() == 1)
.setUserType(UserType.OAM_USER.toString())
.setCreateUserId("1");
.setStatus(item.getStatus() == 1)
.setUserType(UserType.OAM_USER.toString())
.setCreateUserId("1");
sysUser.setUpdateUserId("1");
userWxCpUserMap.put(sysUser, item);
});
Db.executeBatch(userWxCpUserMap.keySet(), CoreMapper.class, CoreMapper::insertSysUser);
List<Staff> staffList = new ArrayList<>();
//批量创建用户
// 批量创建用户
userWxCpUserMap.forEach((key, value) -> {
Staff staff = new Staff();
staff.setName(value.getName()).setUserId(key.getId()).setWxCpUserId(value.getUserId());
staffList.add(staff);
});
SpringUtils.getBean(StaffService.class).saveBatch(staffList);
//获取所有部门信息
List<Dept> deptList = SpringUtils.getBean(DeptService.class).queryChain().where(DEPT.WX_CP_ID.isNotNull()).list();
//部门id映射
// 获取所有部门信息
List<Dept> deptList =
SpringUtils.getBean(DeptService.class).queryChain().where(DEPT.WX_CP_ID.isNotNull()).list();
// 部门id映射
Map<Long, String> deptMap = deptList.stream().collect(Collectors.toMap(Dept::getWxCpId, Dept::getId));
Map<String, String> userIdToStaffIdMap = staffList.stream().collect(Collectors.toMap(Staff::getUserId, Staff::getId));
Map<String, String> userIdToStaffIdMap =
staffList.stream().collect(Collectors.toMap(Staff::getUserId, Staff::getId));
List<StaffMidDept> staffMidDeptList = new ArrayList<>();
//批量创建用户
// 批量创建用户
userWxCpUserMap.forEach((key, value) -> {
for (Long wxDeptId : value.getDepartIds()) {
StaffMidDept staffMidDept = new StaffMidDept();
@ -175,21 +186,23 @@ public class OamWxCpServiceImpl implements OamWxCpService {
public WxCpLoginVo loginUserInfoByCode(HttpServletRequest httpServletRequest, String code) {
WxCpService cpService = WxCpConfiguration.getCpService(1000024);
try {
//获取用户信息
// 获取用户信息
WxCpOAuth2Service oauth2Service = cpService.getOauth2Service();
//此处只能获取企业微信的userId
// 此处只能获取企业微信的userId
WxCpOauth2UserInfo userInfo = oauth2Service.getUserInfo(1000024, code);
String wxCpUserId = userInfo.getUserId();
//查询用户信息
// 查询用户信息
Row row = Db.selectOneByQuery("cp_sys_user",
QueryWrapper.create().select(SYS_USER.ALL_COLUMNS)
.leftJoin(STAFF).on(STAFF.USER_ID.eq(SYS_USER.ID))
.where(STAFF.WX_CP_USER_ID.eq(wxCpUserId)));
if (null == row){
QueryWrapper.create()
.select(SYS_USER.ALL_COLUMNS)
.leftJoin(STAFF)
.on(STAFF.USER_ID.eq(SYS_USER.ID))
.where(STAFF.WX_CP_USER_ID.eq(wxCpUserId)));
if (null == row) {
throw new ServiceException("请先在企微上的Oam应用中进行注册");
}
SysUser sysUser = RowUtil.toEntity(row, SysUser.class);
return new WxCpLoginVo(sysUser.getUserName(),sysUser.getRsaPassword());
return new WxCpLoginVo(sysUser.getUserName(), sysUser.getRsaPassword());
} catch (WxErrorException e) {
throw new ServiceException(e.getMessage());
}
@ -207,30 +220,30 @@ public class OamWxCpServiceImpl implements OamWxCpService {
@Transactional(rollbackFor = Exception.class)
public void registerCode(Integer agentId, String code) {
WxCpService cpService = WxCpConfiguration.getCpService(agentId);
//获取用户信息
// 获取用户信息
WxCpOAuth2Service oauth2Service = cpService.getOauth2Service();
try {
WxCpOauth2UserInfo userInfo = oauth2Service.getUserInfo(agentId, code);
//获取用户敏感信息
// 获取用户敏感信息
WxCpUserDetail userDetail = oauth2Service.getUserDetail(userInfo.getUserTicket());
//此时可以获取敏感信息
if (StringUtils.isBlank(userDetail.getMobile())){
// 此时可以获取敏感信息
if (StringUtils.isBlank(userDetail.getMobile())) {
throw new ServiceException("请重新扫码并授权敏感信息!");
}
//读取员工信息
// 读取员工信息
StaffService staffService = SpringUtils.getBean(StaffService.class);
long count = staffService.queryChain().where(STAFF.WX_CP_USER_ID.eq(userDetail.getUserId())).count();
if (count > 0) {
throw new ServiceException("您已通过注册,请扫码或直接通过用户名密码登陆!");
}
//获取部门信息
// 获取部门信息
WxCpUser wxCpUser = cpService.getUserService().getById(userInfo.getUserId());
List<Dept> deptList = SpringUtils.getBean(DeptService.class).list();
Map<Long, Dept> wxCpDeptMap = deptList.stream().collect(Collectors.toMap(Dept::getWxCpId, item -> item));
//创建员工
// 创建员工
StaffBo staffBo = new StaffBo();
String deptIds = "";
//调整部门数据
// 调整部门数据
for (Long departId : wxCpUser.getDepartIds()) {
Dept dept = wxCpDeptMap.get(departId);
if (dept != null) {
@ -242,15 +255,26 @@ public class OamWxCpServiceImpl implements OamWxCpService {
}
}
String encrypt = SpringUtils.getBean(RsaUtils.class).encrypt(userDetail.getMobile());
//读取用户通用信息
staffBo.setUserName(userDetail.getMobile()).setName(wxCpUser.getName()).setNickName(wxCpUser.getAlias()).setAvatar(userDetail.getAvatar()).setEmail(userDetail.getBizMail()).setPhoneNumber(userDetail.getMobile())
.setSex(!StringUtils.equals(userDetail.getGender(), "1")).setStatus(true).setStaffType(2).setWxCpUserId(wxCpUser.getUserId())
//密码默认为手机号
.setPassword(encrypt)
//设置部门
.setDeptId(deptIds)
.setRoleId(InitRoleEnum.WX_CP_INIT_ROLE.getId());
//保存员工
// 读取用户通用信息
staffBo.setUserName(userDetail.getMobile())
.setName(wxCpUser.getName())
.setNickName(wxCpUser.getAlias())
.setAvatar(userDetail.getAvatar())
.setEmail(userDetail.getBizMail())
.setPhoneNumber(userDetail.getMobile())
.setSex(!StringUtils.equals(userDetail.getGender(), "1"))
.setStatus(true)
.setStaffType(StringUtils.equals(wxCpUser.getMainDepartment(), "5") ? 0 : 1)
.setWxCpUserId(wxCpUser.getUserId())
// 密码默认为手机号
.setPassword(encrypt)
// 设置部门
.setDeptId(deptIds)
// 区分技术员工和运营员工
.setRoleId(StringUtils.equals(wxCpUser.getMainDepartment(), "5")
? InitRoleEnum.WX_CP_INIT_TECHNOLOGY_ROLE.getId()
: InitRoleEnum.WX_CP_INIT_OPERATION_ROLE.getId());
// 保存员工
staffService.insertStaff(staffBo);
} catch (WxErrorException e) {
throw new ServiceException(e.getMessage());

View File

@ -1,5 +1,6 @@
package com.cpop.oam.business.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.cpop.api.tencent.wxWork.handler.WebHookSendHandler;
import com.cpop.common.utils.StringUtils;
import com.cpop.common.utils.bean.BeanUtils;
@ -33,11 +34,13 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import static com.cpop.core.base.table.table.SysUserTableDef.SYS_USER;
import static com.cpop.oam.business.entity.table.StaffTableDef.STAFF;
import static com.cpop.oam.business.entity.table.TaskDemandTableDef.TASK_DEMAND;
import static com.cpop.oam.business.entity.table.TaskTableDef.TASK;
import static com.cpop.system.business.entity.table.BrandTableDef.BRAND;
import static com.cpop.system.business.entity.table.StoreTableDef.STORE;
import org.springframework.transaction.annotation.Transactional;
/**
* OAM-任务-需求表 服务层实现
@ -49,110 +52,188 @@ import static com.cpop.system.business.entity.table.StoreTableDef.STORE;
public class TaskDemandServiceImpl extends ServiceImpl<TaskDemandMapper, TaskDemand> implements TaskDemandService {
/**
* @Description: 任务管理-需求管理分页列表
* @param bo 请求参数
* @return: R<PageVo<DemandPageListVo>>
* @Author: DB
* @Date: 2023/5/30 15:44
**/
* 工单模块-需求-需求分页列表
* @author DB
* @param bo 查询参数
* @since 2023-11-30 17:26:24
*/
@Override
public Page<TaskDemandPageVo> getTaskDemandPage(TaskDemandPageBo bo) {
//分页主体应该是任务
// 分页主体应该是任务
QueryWrapper queryWrapper = QueryWrapper.create();
if (null != bo.getTaskStatus()) {
if (bo.getTaskStatus() == 1) {
queryWrapper.and(TASK.TASK_STATUS.in(1, 2, 4));
} else {
queryWrapper.and(TASK.TASK_STATUS.eq(bo.getTaskStatus()));
switch (bo.getTaskStatus()) {
// 待评估
case 0:
queryWrapper.and(TASK.TASK_STATUS.eq(0));
break;
// 待领取
case 1:
queryWrapper.and(TASK.TASK_STATUS.eq(1));
// 处理中
case 2:
queryWrapper.and(TASK.TASK_STATUS.in(2, 4));
break;
// 已完成
default:
queryWrapper.and(TASK.TASK_STATUS.in(3, 6));
}
} else {
queryWrapper.and(TASK.TASK_STATUS.eq(0));
}
//重新定义列表
// 重新定义列表
PageDomain pageDomain = SqlUtils.getInstance().getPageDomain();
return SpringUtils.getBean(TaskService.class).getMapper().paginateAs(pageDomain.getPageNum(), pageDomain.getPageSize(),
queryWrapper.select(TASK.ALL_COLUMNS)
.select(TASK_DEMAND.DEMAND_TYPE.as(TaskDemandPageVo::getDemandType),TASK_DEMAND.RECORD_STAFF_ID,TASK_DEMAND.BRAND_ID,TASK_DEMAND.CAMPUS_ID)
.select(STORE.STORE_NAME.as(TaskDemandPageVo::getCampusName))
.select(BRAND.BRAND_NAME.as(TaskDemandPageVo::getBrandName))
.select(STAFF.NAME.as(TaskDemandPageVo::getRecordStaffName))
.from(TASK)
//任务需求表
.leftJoin(TASK_DEMAND).on(TASK_DEMAND.TASK_ID.eq(TASK.ID))
//校区表
.leftJoin(STORE).on(STORE.ID.eq(TASK_DEMAND.CAMPUS_ID))
//品牌表
.leftJoin(BRAND).on(BRAND.ID.eq(STORE.BRAND_ID))
//员工表
.leftJoin(STAFF).on(STAFF.ID.eq(TASK_DEMAND.RECORD_STAFF_ID))
.where(TASK.TASK_TYPE.eq(1))
.and(TASK.TASK_NAME.like(bo.getTaskName()))
.and(STORE.STORE_NAME.like(bo.getCampusName())),
TaskDemandPageVo.class);
return this.mapper.paginateAs(Page.of(pageDomain.getPageNum(), pageDomain.getPageSize()),
queryWrapper
.select(TASK_DEMAND.ID,
TASK_DEMAND.BRAND_ID,
TASK_DEMAND.STORE_ID,
TASK_DEMAND.RECORD_STAFF_ID,
TASK_DEMAND.CREATE_TIME,
TASK_DEMAND.UPDATE_USER_ID,
TASK_DEMAND.UPDATE_TIME)
// 品牌
.select(BRAND.BRAND_NAME)
// 校区
.select(STORE.STORE_NAME)
// 任务
.select(TASK.TASK_CONTENT,
TASK.IS_URGENT,
TASK.ATTACHMENT_URL,
TASK.EXPECTED_COMPLETION_DATE,
TASK.TASK_RATING,
TASK.RESPONSIBLE_STAFF_ID,
TASK.TASK_RECEIPT_TIME,
TASK.COMPLETION_DATE,
TASK.TEST_TO_FINISH_URL)
.from(TASK_DEMAND)
// 任务需求表
.leftJoin(TASK)
.on(TASK.ID.eq(TASK_DEMAND.TASK_ID))
// 校区表
.leftJoin(STORE)
.on(STORE.ID.eq(TASK_DEMAND.STORE_ID))
// 品牌表
.leftJoin(BRAND)
.on(BRAND.ID.eq(TASK_DEMAND.BRAND_ID))
.where(TASK.TASK_TYPE.eq(1))
.and(TASK.TASK_CONTENT.like(bo.getTaskContent()))
.and(STORE.STORE_NAME.like(bo.getBrandOrStore()).or(BRAND.BRAND_NAME.like(bo.getBrandOrStore()))),
TaskDemandPageVo.class,
// 记录员工名
item -> item.field(TaskDemandPageVo::getRecordStaffName)
.queryWrapper(recordStaffName -> queryWrapper.create()
.select(STAFF.NAME.as(TaskDemandPageVo::getRecordStaffName))
.from(STAFF)
.where(STAFF.ID.eq(recordStaffName.getRecordStaffId()))),
// 更新人员
item -> item.field(TaskDemandPageVo::getUpdateStaffName)
.queryWrapper(updateStaffName -> queryWrapper.create()
.select(STAFF.NAME.as(TaskDemandPageVo::getUpdateStaffName))
.from(STAFF)
.leftJoin(SYS_USER)
.on(SYS_USER.ID.eq(STAFF.USER_ID))
.where(SYS_USER.ID.eq(updateStaffName.getUpdateUserId()))
.and(SYS_USER.USER_TYPE.eq(UserType.OAM_USER.toString()))
.limit(1)),
// 任务接收员工
item -> item.field(TaskDemandPageVo::getResponsibleStaffName).queryWrapper(responsibleStaffName -> {
if (StringUtils.isNoneBlank(responsibleStaffName.getResponsibleStaffName())) {
return queryWrapper.create()
.select(STAFF.NAME.as(TaskDemandPageVo::getResponsibleStaffName))
.from(STAFF)
.where(STAFF.ID.eq(responsibleStaffName.getResponsibleStaffName()));
} else {
return null;
}
}));
}
/**
* @Description: 任务管理-需求管理-新增需求任务
* 工单模块-需求-新增需求
* @author DB
* @param bo 请求参数
* @return: R<Void>
* @Author: DB
* @Date: 2023/5/30 16:53
**/
* @since 2023-11-30 17:27:24
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void insertTaskDemand(TaskDemandBo bo) {
//添加任务
// 添加任务
Task task = BeanUtils.mapToClass(bo, Task.class);
//默认待审核
task.setTaskStatus(0);
//默认开发中
task.setTaskItem(0);
// 默认待审核
task.setTaskStatus(0).setTaskItem(0).setTaskType(1);
TaskService taskService = SpringUtils.getBean(TaskService.class);
taskService.save(task);
//添加需求
// 添加需求
TaskDemand entity = new TaskDemand();
BeanUtils.copyBeanProp(entity, bo);
entity.setTaskId(task.getId());
//当前操作员工是否是主要负责人不是抛出异常
LoginUser loginUser = SecurityUtils.getInstance().getLoginUser();
//读取员工信息
RedisService redisService = SpringUtils.getBean(RedisService.class);
OamStaffLoginInfo loginInfo = redisService.getCacheObject(UserType.OAM_USER.getKey() + loginUser.getUsername());
entity.setRecordStaffId(loginInfo.getId());
// 当前操作员工
JSONObject loginUserInfo = SecurityUtils.getInstance().getLoginUserInfo();
entity.setRecordStaffId(loginUserInfo.getString("id"));
this.save(entity);
//获取审核管理员手机号
// 获取审核管理员手机号
RedisService redisService = SpringUtils.getBean(RedisService.class);
String auditStaffPhone = redisService.getCacheObject(OamConfigEnum.AUDIT_STAFF_PHONE.getKey());
if (StringUtils.isBlank(auditStaffPhone)) {
SysConfig sysConfig = SpringUtils.getBean(CoreService.class).selectConfigByKey(OamConfigEnum.AUDIT_STAFF_PHONE.getKey());
SysConfig sysConfig =
SpringUtils.getBean(CoreService.class).selectConfigByKey(OamConfigEnum.AUDIT_STAFF_PHONE.getKey());
auditStaffPhone = sysConfig.getConfigValue();
redisService.setCacheObject(OamConfigEnum.AUDIT_STAFF_PHONE.getKey(), auditStaffPhone);
}
if (StringUtils.isNotBlank(auditStaffPhone)) {
//企微通知审核管理员
List<String> phoneList = new ArrayList<String>();
phoneList.add(auditStaffPhone);
//同时通知发起人
if (StringUtils.isNotBlank(loginUser.getUser().getPhoneNumber())) {
phoneList.add(loginUser.getUser().getPhoneNumber());
}
String demandType;
switch (bo.getDemandType()) {
case 0:
demandType = "";
break;
case 1:
demandType = "";
break;
case 2:
demandType = "";
break;
default:
demandType = "";
}
try {
SpringUtils.getBean(WebHookSendHandler.class).webHookSendText(WebHookKeyConstant.ORDER_INFO_BOT, phoneList, "==========您有一条新的《" + demandType + "》需求任务需要审核==========", false);
} catch (IOException e) {
throw new ServiceException("发送消息通知失败!");
}
// 企微通知审核管理员
List<String> phoneList = new ArrayList<String>();
phoneList.add(auditStaffPhone);
// 同时通知发起人
phoneList.add(loginUserInfo.getString("phoneNumber"));
try {
SpringUtils.getBean(WebHookSendHandler.class)
.webHookSendText(WebHookKeyConstant.ORDER_INFO_BOT,
phoneList,
"==========您有一条新的需求任务需要审核==========" + "\n" + task.getTaskContent(),
false);
} catch (IOException e) {
throw new ServiceException("发送需求任务消息通知失败!");
}
}
/**
* 工单模块-需求-修改需求
* @author DB
* @param bo 请求参数
* @since 2023-11-30 18:26:42
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void updateDemandTask(TaskDemandBo bo) {
TaskDemand taskDemand = this.getById(bo.getId());
// 更新需求
this.updateChain()
.set(TASK_DEMAND.BRAND_ID, bo.getBrandId())
.set(TASK_DEMAND.STORE_ID, bo.getStoreId())
.where(TASK_DEMAND.ID.eq(bo.getId()))
.update();
// 更新任务
SpringUtils.getBean(TaskService.class)
.updateChain()
.set(TASK.TASK_CONTENT, bo.getTaskContent())
.set(TASK.ATTACHMENT_URL, bo.getAttachmentUrl())
.where(TASK.ID.eq(taskDemand.getTaskId()))
.update();
}
/**
* 工单模块-需求-删除需求
* @author DB
* @param demandId 需求id
* @since 2023-11-30 20:30:54
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void removeDemandTask(String demandId) {
// 获取任务
TaskDemand demand = this.getById(demandId);
this.removeById(demandId);
SpringUtils.getBean(TaskService.class).removeById(demand.getTaskId());
}
}

View File

@ -1,6 +1,8 @@
package com.cpop.oam.business.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.cpop.oam.business.vo.TaskArchivingPagVo;
import com.cpop.oam.business.vo.TaskToBeClaimedPageVo;
import com.cpop.system.framework.ws.server.WebSocketServer;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
@ -30,9 +32,7 @@ import com.cpop.oam.business.service.StaffService;
import com.cpop.oam.business.service.TaskService;
import com.cpop.oam.business.service.TaskStaffGroupService;
import com.cpop.oam.business.vo.PersonTaskPageVo;
import com.cpop.oam.business.vo.TaskAuditPageVo;
import com.cpop.oam.business.vo.TaskMonthStatisticsVo;
import com.cpop.oam.business.vo.TaskPageVo;
import com.cpop.oam.framework.constant.WebHookKeyConstant;
import com.cpop.oam.framework.enums.OamConfigEnum;
import org.springframework.stereotype.Service;
@ -51,8 +51,11 @@ import java.util.Set;
import java.util.stream.Collectors;
import static com.cpop.oam.business.entity.table.StaffTableDef.STAFF;
import static com.cpop.oam.business.entity.table.TaskDemandTableDef.TASK_DEMAND;
import static com.cpop.oam.business.entity.table.TaskStaffGroupTableDef.TASK_STAFF_GROUP;
import static com.cpop.oam.business.entity.table.TaskTableDef.TASK;
import static com.mybatisflex.core.query.QueryMethods.groupConcat;
import org.springframework.transaction.annotation.Transactional;
/**
* OAM-任务表 服务层实现
@ -64,45 +67,130 @@ import static com.cpop.oam.business.entity.table.TaskTableDef.TASK;
public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements TaskService {
/**
* @Description: 查询OAM-任务分页列表
* @param bo 请求参数
* @return: R<PageVo<PersonTaskPageListVo>>
* @Author: DB
* @Date: 2023/5/16 15:24
**/
* 技术模块-任务归档-获取任务归档分页
* @author DB
* @param subject 品主体牌名
* @param taskContent 任务内容
* @since 2023-11-30 21:11:47
*/
@Override
public Page<TaskPageVo> getTaskPage(TaskPageBo bo) {
public Page<TaskArchivingPagVo> getTaskArchivingPage(String subject, String taskContent, Boolean isFinish) {
// 获取当前员工
JSONObject loginUserInfo = SecurityUtils.getInstance().getLoginUserInfo();
PageDomain pageDomain = SqlUtils.getInstance().getPageDomain();
return this.mapper.paginateAs(pageDomain.getPageNum(),
pageDomain.getPageSize(),
return this.mapper.paginateAs(Page.of(pageDomain.getPageNum(), pageDomain.getPageSize()),
QueryWrapper.create()
.where(TASK.TASK_STATUS.eq(1))
.and(TASK.TASK_TYPE.eq(bo.getTaskType()))
.and(TASK.TASK_RATING.eq(bo.getTaskRating()))
.orderBy(TASK.EXPECTED_COMPLETION_DATE.asc()),
TaskPageVo.class);
.select(TASK.ID,
TASK.RESPONSIBLE_STAFF_ID,
TASK.TASK_CONTENT,
TASK.TASK_RATING,
TASK.TASK_RECEIPT_TIME,
TASK.TEST_TO_FINISH_URL,
TASK.TO_TEST_TIME,
TASK.TO_FINISH_TIME,
TASK.SUBJECT)
.select(TASK_STAFF_GROUP.GRADE_POINT)
.from(TASK)
.leftJoin(TASK_STAFF_GROUP)
.on(TASK_STAFF_GROUP.TASK_ID.eq(TASK.ID))
.where(TASK_STAFF_GROUP.STAFF_ID.eq(loginUserInfo.getString("id")))
.and(TASK.TASK_STATUS.eq(isFinish ? 8 : 9).and(TASK.TASK_CONTENT.like(taskContent)))
.and(TASK.SUBJECT.like(subject)),
TaskArchivingPagVo.class,
// 负责人
item -> item.field(TaskArchivingPagVo::getResponsibleStaffName)
.queryWrapper(
recordStaff -> queryChain().select(STAFF.NAME.as(TaskArchivingPagVo::getResponsibleStaffName))
.from(STAFF)
.where(STAFF.ID.eq(recordStaff.getResponsibleStaffId()))),
// 小组成员
item -> item.field(TaskArchivingPagVo::getTaskGroupStaffs)
.queryWrapper(taskGroupStaffs -> queryChain()
.select(groupConcat(STAFF.NAME).as(TaskArchivingPagVo::getTaskGroupStaffs))
.from(STAFF)
.leftJoin(TASK_STAFF_GROUP)
.on(TASK_STAFF_GROUP.TASK_ID.eq(TASK.ID))
.where(TASK_STAFF_GROUP.STAFF_ID.eq(taskGroupStaffs.getId()))
.groupBy(TASK.ID)));
}
/**
* @Description: OAM-新增任务
* @param bo 请求参数
* @return: R<Void>
* @Author: DB
* @Date: 2023/5/16 15:58
**/
* 技术模块-任务归档-设置任务归档
* @author DB
* @param taskId 任务id
* @since 2023-11-30 21:49:05
*/
@Override
public void insertTask(TaskBo bo) {
public void setTaskArchiving(String taskId) {
this.updateChain()
.set(TASK.TASK_STATUS, 9)
.set(TASK.TO_FINISH_TIME, LocalDateTime.now())
.where(TASK.ID.eq(taskId))
.update();
}
/**
* 技术模块-任务领取-获取领取任务分页
* @author DB
* @param subject 主体
* @param taskContent 任务内容
* @param toBeEvaluated 是否待评估
* @since 2023-11-30 22:21:58
*/
@Override
public Page<TaskToBeClaimedPageVo> getToBeClaimedPage(String subject, String taskContent, Boolean toBeEvaluated) {
// 获取当前员工
PageDomain pageDomain = SqlUtils.getInstance().getPageDomain();
return this.mapper.paginateAs(Page.of(pageDomain.getPageNum(), pageDomain.getPageSize()),
QueryWrapper.create()
.select(TASK.ID,
TASK.TASK_TYPE,
TASK.SUBJECT,
TASK.TASK_CONTENT,
TASK.ATTACHMENT_URL,
TASK.TASK_RATING,
TASK.CREATE_TIME)
.select(TASK_STAFF_GROUP.GRADE_POINT)
.from(TASK)
.leftJoin(TASK_STAFF_GROUP)
.on(TASK_STAFF_GROUP.TASK_ID.eq(TASK.ID))
.where(TASK.TASK_STATUS.eq(toBeEvaluated ? 0 : 1))
.and(TASK.TASK_CONTENT.like(taskContent))
.and(TASK.SUBJECT.like(subject))
.orderBy(TASK.IS_URGENT.desc(), TASK.CREATE_TIME.desc()),
TaskToBeClaimedPageVo.class,
// 对接人
item -> item.field(TaskToBeClaimedPageVo::getDockingStaff).queryWrapper(dockingStaff -> {
if (dockingStaff.getTaskType() == 1) {
return queryChain().select(STAFF.NAME.as(TaskToBeClaimedPageVo::getDockingStaff))
.select(STAFF.NAME)
.from(STAFF)
.leftJoin(TASK_DEMAND)
.on(TASK_DEMAND.RECORD_STAFF_ID.eq(STAFF.ID))
.where(TASK_DEMAND.TASK_ID.eq(dockingStaff.getId()));
} else {
return null;
}
}));
}
/**
* 技术模块-任务领取-新增迭代任务
* @author DB
* @param bo 请求
* @since 2023-12-01 09:45:08
*/
@Override
public void insertIterationTask(TaskIterationBo bo) {
Task entity = BeanUtils.mapToClass(bo, Task.class);
// 默认待审核
entity.setTaskStatus(0);
// 默认开发中
entity.setTaskItem(0);
// 默认待审核 默认开发中
entity.setTaskStatus(0).setTaskItem(0).setTaskType(0);
this.save(entity);
// 获取审核管理员手机号
CoreService coreService = SpringUtils.getBean(CoreService.class);
RedisService redisService = SpringUtils.getBean(RedisService.class);
String auditStaffPhone = redisService.getCacheObject(OamConfigEnum.AUDIT_STAFF_PHONE.getKey());
if (StringUtils.isBlank(auditStaffPhone)) {
CoreService coreService = SpringUtils.getBean(CoreService.class);
SysConfig sysConfig = coreService.selectConfigByKey(OamConfigEnum.AUDIT_STAFF_PHONE.getKey());
auditStaffPhone = sysConfig.getConfigValue();
if (StringUtils.isBlank(auditStaffPhone)) {
@ -116,113 +204,55 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
SpringUtils.getBean(WebHookSendHandler.class)
.webHookSendText(WebHookKeyConstant.PRODUCT_BOT,
phoneList,
"==========您有一条新的迭代任务需要审核==========",
"==========您有一条新的迭代任务需要审核==========" + "\n" + entity.getTaskContent(),
false);
} catch (IOException e) {
throw new ServiceException("发送通知失败!");
throw new ServiceException("发送迭代任务通知失败!");
}
}
/**
* @Description: 查询OAM-任务审核分页列表
* @return: R<Page<OamTaskAuditPageVo>>
* @Author: DB
* @Date: 2023/5/16 15:24
**/
@Override
public Page<TaskAuditPageVo> getTaskAuditPage() {
PageDomain pageDomain = SqlUtils.getInstance().getPageDomain();
return this.mapper.paginateAs(pageDomain.getPageNum(),
pageDomain.getPageSize(),
QueryWrapper.create().where(TASK.TASK_STATUS.eq(0)).orderBy(TASK.CREATE_TIME.desc()),
TaskAuditPageVo.class);
}
/**
* @Description: 设置任务审核意见
* @param bo 请求参数
* @return: R<Void>
* @Author: DB
* @Date: 2023/5/16 17:36
**/
@Override
public void setTaskAuditComments(TaskAuditCommentsBo bo) {
Task entity = BeanUtils.mapToClass(bo, Task.class);
this.updateById(entity);
// 如果通过,可以通过websocket进行通信
if (bo.getTaskStatus() == 1) {
// 获取任务信息
Task task = this.getById(bo.getId());
SpringUtils.getBean(WebSocketServer.class).sendInfo("您的任务" + task.getTaskName() + "已通过,请注意接收:", task.getResponsibleStaffId());
}
}
/**
* @Description: 查询OAM-任务审核驳回列表
* @return: R<Page<OamTaskAuditPageVo>>
* @Author: DB
* @Date: 2023/5/16 15:24
**/
@Override
public Page<TaskAuditPageVo> getTaskRejectPage() {
// 获取当前用户信息
PageDomain pageDomain = SqlUtils.getInstance().getPageDomain();
return this.mapper.paginateAs(pageDomain.getPageNum(),
pageDomain.getPageSize(),
QueryWrapper.create().where(TASK.TASK_STATUS.eq(-1)).orderBy(TASK.CREATE_TIME.desc()),
TaskAuditPageVo.class);
}
/**
* @Description: 技术人员领取任务
* @param id 任务主键
* @return: R<Void>
* @Author: DB
* @Date: 2023/5/16 17:10
**/
* 技术模块-任务领取-技术人员领取任务
* @author DB
* @param id 任务id
* @since 2023-12-01 10:15:28
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void claimTask(String id) {
// 查询任务
Task task = this.getById(id);
// 进行中
task.setTaskStatus(2);
// 接受时间
task.setTaskReceiptTime(LocalDateTime.now());
// 进行中 接受时间
task.setTaskStatus(2).setTaskReceiptTime(LocalDateTime.now());
// 如果任务没有设置预期完成时间则按照任务评级进行设置默认
if (null == task.getExpectedCompletionDate()) {
if (task.getExpectedCompletionDate() == null) {
// 获取任务评级
Integer taskRating = task.getTaskRating();
Date expectedCompletionDate;
LocalDate now = LocalDate.now();
switch (taskRating) {
case 0:
// 30天
expectedCompletionDate = DateUtils.addDateDays(new Date(), 30);
task.setExpectedCompletionDate(new java.sql.Date(expectedCompletionDate.getTime()));
task.setExpectedCompletionDate(now.plusDays(30));
break;
case 1:
// 21天
expectedCompletionDate = DateUtils.addDateDays(new Date(), 21);
task.setExpectedCompletionDate(new java.sql.Date(expectedCompletionDate.getTime()));
task.setExpectedCompletionDate(now.plusDays(21));
break;
case 2:
// 15天
expectedCompletionDate = DateUtils.addDateDays(new Date(), 15);
task.setExpectedCompletionDate(new java.sql.Date(expectedCompletionDate.getTime()));
task.setExpectedCompletionDate(now.plusDays(15));
break;
case 3:
// 7天
expectedCompletionDate = DateUtils.addDateDays(new Date(), 7);
task.setExpectedCompletionDate(new java.sql.Date(expectedCompletionDate.getTime()));
task.setExpectedCompletionDate(now.plusDays(7));
break;
case 4:
// 3天
expectedCompletionDate = DateUtils.addDateDays(new Date(), 3);
task.setExpectedCompletionDate(new java.sql.Date(expectedCompletionDate.getTime()));
task.setExpectedCompletionDate(now.plusDays(3));
break;
default:
// 1天
expectedCompletionDate = DateUtils.addDateDays(new Date(), 1);
task.setExpectedCompletionDate(new java.sql.Date(expectedCompletionDate.getTime()));
task.setExpectedCompletionDate(now.plusDays(1));
break;
}
}
@ -262,6 +292,29 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
SpringUtils.getBean(TaskStaffGroupService.class).save(taskStaffGroup);
}
/**
* 技术模块-任务领取-任务审核
* @author DB
* @param bo 请求参数
* @since 2023-12-01 10:35:31
*/
@Override
public void setTaskAuditComments(TaskAuditCommentsBo bo) {
Task entity = BeanUtils.mapToClass(bo, Task.class);
entity.setTaskStatus(1);
this.updateById(entity);
// 通知所有人
try {
SpringUtils.getBean(WebHookSendHandler.class)
.webHookSendText(WebHookKeyConstant.PRODUCT_BOT,
new ArrayList<>(),
"==========任务审核通过==========" + "\n" + entity.getTaskContent(),
true);
} catch (IOException e) {
throw new ServiceException("发送任务审核通过通知失败!");
}
}
/**
* @Description: 查询OAM-个人任务分页列表
* @return: R<PageVo<PersonTaskPageListVo>>
@ -393,7 +446,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
public void finishTask(String id) {
// 查询任务相关信息
Task task = this.getById(id);
if (null == task) {
if (task == null) {
throw new ServiceException("获取任务失败,请联系相关人员!");
}
if (task.getTaskItem() != 3) {
@ -401,7 +454,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
}
// 判断完成任务日期
LocalDate now = LocalDate.now();
LocalDate expectedCompletionDate = task.getExpectedCompletionDate().toLocalDate();
LocalDate expectedCompletionDate = task.getExpectedCompletionDate();
long day = now.until(expectedCompletionDate, ChronoUnit.DAYS);
// 逾期完成
if (day < 0) {
@ -409,7 +462,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
} else {
task.setTaskStatus(3);
}
task.setCompletionDate(java.sql.Date.valueOf(now));
task.setCompletionDate(now);
this.updateById(task);
}
@ -511,19 +564,18 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
}
allTheDateOfMonth.forEach(item -> {
LocalDate localDate = item.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
List<String> taskNames = new ArrayList<>();
List<String> taskContents = new ArrayList<>();
TaskMonthStatisticsVo.DataStatisticsVo dataStatisticsVo = statisticsVo.new DataStatisticsVo();
// 如果日期大于等于接受任务日期,并且小于等于预期完成日期,则插入
taskList.forEach(task -> {
// 接受时间
LocalDate date = task.getTaskReceiptTime().toLocalDate();
if (localDate.compareTo(date) >= 0
&& localDate.compareTo(task.getExpectedCompletionDate().toLocalDate()) <= 0) {
taskNames.add(task.getTaskName());
if (localDate.compareTo(date) >= 0 && localDate.compareTo(task.getExpectedCompletionDate()) <= 0) {
taskContents.add(task.getTaskContent());
}
});
dataStatisticsVo.setDate(localDate);
dataStatisticsVo.setTaskNames(taskNames);
dataStatisticsVo.setTaskContents(taskContents);
statisticsVo.getVos().add(dataStatisticsVo);
});
return statisticsVo;

View File

@ -41,7 +41,8 @@ import static com.cpop.oam.business.entity.table.TaskStaffGroupTableDef.TASK_STA
* @since 2023-09-18
*/
@Service("taskStaffGroupService")
public class TaskStaffGroupServiceImpl extends ServiceImpl<TaskStaffGroupMapper, TaskStaffGroup> implements TaskStaffGroupService {
public class TaskStaffGroupServiceImpl extends ServiceImpl<TaskStaffGroupMapper, TaskStaffGroup>
implements TaskStaffGroupService {
/**
* @Description: 查询OAM-任务成员组列表
@ -52,12 +53,12 @@ public class TaskStaffGroupServiceImpl extends ServiceImpl<TaskStaffGroupMapper,
@Override
public List<TaskStaffGroupVo> getTaskStaffGroupList(TaskStaffGroupListBo bo) {
return this.listAs(QueryWrapper.create()
.select(TASK_STAFF_GROUP.ALL_COLUMNS)
.select(STAFF.NAME.as(TaskStaffGroupVo::getStaffName))
.from(TASK_STAFF_GROUP)
.leftJoin(STAFF).on(STAFF.ID.eq(TASK_STAFF_GROUP.STAFF_ID))
.where(TASK_STAFF_GROUP.TASK_ID.eq(bo.getTaskId())),
TaskStaffGroupVo.class);
.select(TASK_STAFF_GROUP.ALL_COLUMNS)
.select(STAFF.NAME.as(TaskStaffGroupVo::getStaffName))
.from(TASK_STAFF_GROUP)
.leftJoin(STAFF)
.on(STAFF.ID.eq(TASK_STAFF_GROUP.STAFF_ID))
.where(TASK_STAFF_GROUP.TASK_ID.eq(bo.getTaskId())), TaskStaffGroupVo.class);
}
/**
@ -70,48 +71,52 @@ public class TaskStaffGroupServiceImpl extends ServiceImpl<TaskStaffGroupMapper,
@Override
@Transactional(rollbackFor = Exception.class)
public void insertTaskStaffGroup(TaskStaffGroupBo bo) {
//获取任务
// 获取任务
TaskService taskService = SpringUtils.getBean(TaskService.class);
Task task = taskService.getById(bo.getTaskId());
//当前操作员工是否是主要负责人不是抛出异常
// 当前操作员工是否是主要负责人不是抛出异常
LoginUser loginUser = SecurityUtils.getInstance().getLoginUser();
//读取员工信息
// 读取员工信息
RedisService redisService = SpringUtils.getBean(RedisService.class);
JSONObject cacheObject = redisService.getCacheObject(UserType.OAM_USER.getKey() + loginUser.getUsername());
OamStaffLoginInfo loginInfo = cacheObject.getJSONObject("user").toJavaObject(OamStaffLoginInfo.class);
if (!StringUtils.equals(task.getResponsibleStaffId(), loginInfo.getId())) {
throw new ServiceException("当前操作员工不是当前任务主要负责人,不允许操作当前任务!");
}
//查询当前添加的员工是否存在在此任务中
// 查询当前添加的员工是否存在在此任务中
long count = this.count(QueryWrapper.create()
.where(TASK_STAFF_GROUP.TASK_ID.eq(bo.getTaskId()))
.and(TASK_STAFF_GROUP.STAFF_ID.eq(bo.getStaffId())));
.where(TASK_STAFF_GROUP.TASK_ID.eq(bo.getTaskId()))
.and(TASK_STAFF_GROUP.STAFF_ID.eq(bo.getStaffId())));
if (count > 0) {
throw new ServiceException("当前员工已存在任务中,请添加其他员工或调整此员工绩点");
}
//获取此任务下关联的主要负责人信息
TaskStaffGroup responsibleStaff = this.getOne(QueryWrapper.create()
.where(TASK_STAFF_GROUP.TASK_ID.eq(bo.getTaskId()))
.and(TASK_STAFF_GROUP.STAFF_ID.eq(task.getResponsibleStaffId())));
// 获取此任务下关联的主要负责人信息
TaskStaffGroup responsibleStaff = this.getOne(QueryWrapper.create()
.where(TASK_STAFF_GROUP.TASK_ID.eq(bo.getTaskId()))
.and(TASK_STAFF_GROUP.STAFF_ID.eq(task.getResponsibleStaffId())));
int balance = responsibleStaff.getGradePoint() - bo.getGradePoint();
if (balance < 0) {
throw new ServiceException("主要负责人绩点不足,请重新调整!");
} else {
responsibleStaff.setGradePoint(responsibleStaff.getGradePoint() - bo.getGradePoint());
}
//存入数据
// 存入数据
TaskStaffGroup taskStaffGroup = BeanUtils.mapToClass(bo, TaskStaffGroup.class);
this.save(taskStaffGroup);
this.updateById(responsibleStaff);
//企微通知绩点调整人员
// 企微通知绩点调整人员
List<String> phoneList = new ArrayList<String>();
phoneList.add(loginInfo.getPhoneNumber());
//获取新增员工信息
// 获取新增员工信息
StaffInfoVo staffInfo = SpringUtils.getBean(StaffService.class).getStaffInfo(bo.getStaffId());
phoneList.add(staffInfo.getPhoneNumber());
try {
SpringUtils.getBean(WebHookSendHandler.class).webHookSendText(WebHookKeyConstant.PRODUCT_BOT, phoneList, loginInfo.getName() + "您的绩点调整为" + responsibleStaff.getGradePoint()
+ "\n" + staffInfo.getName() + "您新加入任务:" + task.getTaskName() + "绩点为:" + bo.getGradePoint(), false);
SpringUtils.getBean(WebHookSendHandler.class)
.webHookSendText(WebHookKeyConstant.PRODUCT_BOT,
phoneList,
loginInfo.getName() + "您的绩点调整为" + responsibleStaff.getGradePoint() + "\n" + staffInfo.getName()
+ "您新加入任务:" + task.getTaskContent() + "绩点为:" + bo.getGradePoint(),
false);
} catch (IOException e) {
throw new ServiceException("发送通知失败!");
}
@ -126,15 +131,15 @@ public class TaskStaffGroupServiceImpl extends ServiceImpl<TaskStaffGroupMapper,
**/
@Override
public void updateStaffGradePoint(TaskStaffGroupBo bo) {
//获取任务主负责人相关绩点
// 获取任务主负责人相关绩点
TaskService taskService = SpringUtils.getBean(TaskService.class);
Task task = taskService.getById(bo.getTaskId());
if (null == task){
if (null == task) {
throw new ServiceException("获取任务失败!请联系相关人员!");
}
//当前操作员工是否是主要负责人不是抛出异常
// 当前操作员工是否是主要负责人不是抛出异常
LoginUser loginUser = SecurityUtils.getInstance().getLoginUser();
//读取员工信息
// 读取员工信息
RedisService redisService = SpringUtils.getBean(RedisService.class);
JSONObject cacheObject = redisService.getCacheObject(UserType.OAM_USER.getKey() + loginUser.getUsername());
OamStaffLoginInfo loginInfo = cacheObject.getJSONObject("user").toJavaObject(OamStaffLoginInfo.class);
@ -144,44 +149,49 @@ public class TaskStaffGroupServiceImpl extends ServiceImpl<TaskStaffGroupMapper,
if (StringUtils.equals(bo.getStaffId(), task.getResponsibleStaffId())) {
throw new ServiceException("不允许直接修改主要负责人绩点");
}
//获取此任务下关联的主要负责人信息
TaskStaffGroup responsibleStaffTaskInfo = this.getOne(QueryWrapper.create()
.where(TASK_STAFF_GROUP.TASK_ID.eq(bo.getTaskId()))
.and(TASK_STAFF_GROUP.STAFF_ID.eq(task.getResponsibleStaffId())));
//自身原绩点
// 获取此任务下关联的主要负责人信息
TaskStaffGroup responsibleStaffTaskInfo = this.getOne(QueryWrapper.create()
.where(TASK_STAFF_GROUP.TASK_ID.eq(bo.getTaskId()))
.and(TASK_STAFF_GROUP.STAFF_ID.eq(task.getResponsibleStaffId())));
// 自身原绩点
TaskStaffGroup oldStaffTaskInfo = this.getById(bo.getId());
//增加
// 增加
if (bo.getGradePoint() > oldStaffTaskInfo.getGradePoint()) {
//判断主负责人绩点够不够减
if (responsibleStaffTaskInfo.getGradePoint() < (bo.getGradePoint() - oldStaffTaskInfo.getGradePoint())){
// 判断主负责人绩点够不够减
if (responsibleStaffTaskInfo.getGradePoint() < (bo.getGradePoint() - oldStaffTaskInfo.getGradePoint())) {
throw new ServiceException("当前主负责人绩点不够,请重新调整!");
}
//添加的绩点
// 添加的绩点
int addGradePoint = bo.getGradePoint() - oldStaffTaskInfo.getGradePoint();
responsibleStaffTaskInfo.setGradePoint(responsibleStaffTaskInfo.getGradePoint() - addGradePoint);
//更新主负责人绩点
// 更新主负责人绩点
this.updateById(responsibleStaffTaskInfo);
} else {
//减少的绩点
int reduceGradePoint = oldStaffTaskInfo.getGradePoint()-bo.getGradePoint();
// 减少的绩点
int reduceGradePoint = oldStaffTaskInfo.getGradePoint() - bo.getGradePoint();
responsibleStaffTaskInfo.setGradePoint(responsibleStaffTaskInfo.getGradePoint() + reduceGradePoint);
//更新主负责人绩点
// 更新主负责人绩点
this.updateById(responsibleStaffTaskInfo);
}
//更新绩点
this.updateChain().set(TASK_STAFF_GROUP.GRADE_POINT, bo.getGradePoint())
.where(TASK_STAFF_GROUP.TASK_ID.eq(bo.getTaskId()))
.and(TASK_STAFF_GROUP.STAFF_ID.eq(bo.getStaffId()))
.update();
//企微通知绩点调整人员
// 更新绩点
this.updateChain()
.set(TASK_STAFF_GROUP.GRADE_POINT, bo.getGradePoint())
.where(TASK_STAFF_GROUP.TASK_ID.eq(bo.getTaskId()))
.and(TASK_STAFF_GROUP.STAFF_ID.eq(bo.getStaffId()))
.update();
// 企微通知绩点调整人员
List<String> phoneList = new ArrayList<String>();
phoneList.add(loginInfo.getPhoneNumber());
//获取新增员工信息
// 获取新增员工信息
StaffInfoVo staffInfo = SpringUtils.getBean(StaffService.class).getStaffInfo(bo.getStaffId());
phoneList.add(staffInfo.getPhoneNumber());
try {
SpringUtils.getBean(WebHookSendHandler.class).webHookSendText(WebHookKeyConstant.PRODUCT_BOT, phoneList, loginInfo.getName() + "您的绩点调整为" + responsibleStaffTaskInfo.getGradePoint()
+ "\n" + staffInfo.getName() + "您的绩点调整为:" + bo.getGradePoint(), false);
SpringUtils.getBean(WebHookSendHandler.class)
.webHookSendText(WebHookKeyConstant.PRODUCT_BOT,
phoneList,
loginInfo.getName() + "您的绩点调整为" + responsibleStaffTaskInfo.getGradePoint() + "\n"
+ staffInfo.getName() + "您的绩点调整为:" + bo.getGradePoint(),
false);
} catch (IOException e) {
throw new ServiceException("发送通知失败!");
}
@ -196,26 +206,26 @@ public class TaskStaffGroupServiceImpl extends ServiceImpl<TaskStaffGroupMapper,
**/
@Override
public void removeTaskStaffGroupById(String id) {
//获取任务
// 获取任务
TaskStaffGroup taskStaffGroup = this.getById(id);
TaskService taskService = SpringUtils.getBean(TaskService.class);
Task task = taskService.getById(taskStaffGroup.getTaskId());
//当前操作员工是否是主要负责人不是抛出异常
// 当前操作员工是否是主要负责人不是抛出异常
LoginUser loginUser = SecurityUtils.getInstance().getLoginUser();
//读取员工信息
// 读取员工信息
RedisService redisService = SpringUtils.getBean(RedisService.class);
OamStaffLoginInfo loginInfo = redisService.getCacheObject(UserType.OAM_USER.getKey() + loginUser.getUsername());
if (!StringUtils.equals(task.getResponsibleStaffId(), loginInfo.getId())) {
throw new ServiceException("当前操作员工不是当前任务主要负责人,不允许操作当前任务!");
}
//不允许删除主要负责人
if (StringUtils.equals(taskStaffGroup.getStaffId(),task.getResponsibleStaffId())){
// 不允许删除主要负责人
if (StringUtils.equals(taskStaffGroup.getStaffId(), task.getResponsibleStaffId())) {
throw new ServiceException("任务主要负责人不允许删除!");
}
//添加绩点给主要负责人
// 添加绩点给主要负责人
TaskStaffGroup responsibleStaffInfo = this.getOne(QueryWrapper.create()
.where(TASK_STAFF_GROUP.TASK_ID.eq(taskStaffGroup.getTaskId()))
.and(TASK_STAFF_GROUP.STAFF_ID.eq(task.getResponsibleStaffId())));
.where(TASK_STAFF_GROUP.TASK_ID.eq(taskStaffGroup.getTaskId()))
.and(TASK_STAFF_GROUP.STAFF_ID.eq(task.getResponsibleStaffId())));
responsibleStaffInfo.setGradePoint(responsibleStaffInfo.getGradePoint() + taskStaffGroup.getGradePoint());
this.updateById(responsibleStaffInfo);
this.removeById(id);

View File

@ -1,21 +1,10 @@
package com.cpop.oam.business.service.impl;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.cpop.api.tencent.wxWork.handler.WebHookSendHandler;
import com.cpop.common.utils.bean.BeanUtils;
import com.cpop.core.base.exception.ServiceException;
import com.cpop.core.utils.SpringUtils;
import com.cpop.oam.business.dto.TaskWorkOrderRecordDto;
import com.cpop.oam.business.entity.TaskWorkOrderRecord;
import com.cpop.oam.business.mapper.TaskWorkOrderRecordMapper;
import com.cpop.oam.business.service.TaskWorkOrderRecordService;
import com.cpop.oam.framework.constant.WebHookKeyConstant;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
* 任务-工单-记录表 服务层实现
@ -24,28 +13,7 @@ import java.util.List;
* @since 2023-09-18
*/
@Service("taskWorkOrderRecordService")
public class TaskWorkOrderRecordServiceImpl extends ServiceImpl<TaskWorkOrderRecordMapper, TaskWorkOrderRecord> implements TaskWorkOrderRecordService {
public class TaskWorkOrderRecordServiceImpl extends ServiceImpl<TaskWorkOrderRecordMapper, TaskWorkOrderRecord>
implements TaskWorkOrderRecordService {
/**
* @descriptions 新增任务-工单-记录
* @author DB
* @date 2023/09/18 17:31
* @param bo 请求参数
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void insertTaskWorkOrderRecord(TaskWorkOrderRecordDto bo) {
TaskWorkOrderRecord entity = new TaskWorkOrderRecord();
BeanUtils.copyBeanProp(entity, bo);
this.save(entity);
//发送企业微信信息通知
List<String> phoneList = new ArrayList<String>();
phoneList.add(bo.getResponsibleStaffPhone());
phoneList.add(bo.getRecordStaffPhone());
try {
SpringUtils.getBean(WebHookSendHandler.class).webHookSendText(WebHookKeyConstant.ORDER_INFO_BOT, phoneList, "有新的工单信息请注意回复\n" + bo.getRecordText(), false);
} catch (IOException e) {
throw new ServiceException("发送消息通知失败!");
}
}
}

View File

@ -3,9 +3,12 @@ package com.cpop.oam.business.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.cpop.common.utils.StringUtils;
import com.cpop.core.base.entity.PageDomain;
import com.cpop.oam.business.bo.TaskDemandBo;
import com.cpop.oam.business.dto.TaskWorkOrderReceiveDealPauseDto;
import com.cpop.oam.business.vo.TaskWorkOrderPersonVo;
import com.cpop.oam.business.vo.TaskWorkOrderReceiveDealPauseVo;
import com.cpop.oam.business.vo.WorkOrderDutyVo;
import com.cpop.oam.framework.enums.OamConfigEnum;
import com.cpop.oam.framework.tasks.WorkOrderAcceptOverTimeTask;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
@ -13,11 +16,7 @@ import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.cpop.api.tencent.wxWork.handler.WebHookSendHandler;
import com.cpop.common.utils.DateUtils;
import com.cpop.common.utils.bean.BeanUtils;
import com.cpop.core.base.entity.LoginUser;
import com.cpop.core.base.entity.loginInfo.OamStaffLoginInfo;
import com.cpop.core.base.enums.UserType;
import com.cpop.core.base.exception.ServiceException;
import com.cpop.core.service.RedisService;
import com.cpop.core.utils.QuartzUtils;
import com.cpop.core.utils.SecurityUtils;
import com.cpop.core.utils.SpringUtils;
@ -53,13 +52,13 @@ import java.util.stream.Collectors;
import static com.cpop.core.base.table.table.SysUserTableDef.SYS_USER;
import static com.cpop.oam.business.entity.table.DutyTableDef.DUTY;
import static com.cpop.oam.business.entity.table.StaffTableDef.STAFF;
import static com.cpop.oam.business.entity.table.TaskStaffGroupTableDef.TASK_STAFF_GROUP;
import static com.cpop.oam.business.entity.table.TaskTableDef.TASK;
import static com.cpop.oam.business.entity.table.TaskWorkOrderRecordTableDef.TASK_WORK_ORDER_RECORD;
import static com.cpop.oam.business.entity.table.TaskWorkOrderTableDef.TASK_WORK_ORDER;
import static com.cpop.system.business.entity.table.BrandTableDef.BRAND;
import static com.cpop.system.business.entity.table.StoreTableDef.STORE;
import com.cpop.core.utils.sql.SqlUtils;
import com.cpop.core.service.RedisService;
/**
* 任务-工单表 服务层实现
@ -234,7 +233,6 @@ public class TaskWorkOrderServiceImpl extends ServiceImpl<TaskWorkOrderMapper, T
BeanUtils.copyBeanProp(task, bo);
// 默认待接受
task.setTaskStatus(1)
.setTaskName("工单")
// 默认开发中
.setTaskItem(0)
.setTaskWeight(10)
@ -255,6 +253,13 @@ public class TaskWorkOrderServiceImpl extends ServiceImpl<TaskWorkOrderMapper, T
TaskStaffGroup taskStaffGroup = new TaskStaffGroup();
taskStaffGroup.setTaskId(task.getId()).setStaffId(duty.getTechnologyStaffId()).setGradePoint(0);
taskStaffGroupService.save(taskStaffGroup);
// 添加工单记录
TaskWorkOrderRecord workOrderRecord = new TaskWorkOrderRecord();
workOrderRecord.setTaskWorkOrderId(entity.getId())
.setRecordText(bo.getTaskContent())
.setRecordStaffId(loginUserInfo.getString("id"))
.setAttachmentUrl(bo.getAttachmentUrl());
SpringUtils.getBean(TaskWorkOrderRecordService.class).save(workOrderRecord);
// 通知值班员工
StaffService staffService = SpringUtils.getBean(StaffService.class);
StaffInfoVo technologyStaffInfo = staffService.getStaffInfo(duty.getTechnologyStaffId());
@ -266,7 +271,7 @@ public class TaskWorkOrderServiceImpl extends ServiceImpl<TaskWorkOrderMapper, T
SpringUtils.getBean(WebHookSendHandler.class)
.webHookSendText(WebHookKeyConstant.ORDER_INFO_BOT,
phoneList,
"==========您有一条新的工单需要处理==========" + "\n" + task.getTaskName() + "\n" + task.getTaskContent(),
"==========您有一条新的工单需要处理==========\n" + task.getTaskContent(),
false);
} catch (IOException e) {
throw new ServiceException("发送消息通知失败!");
@ -373,7 +378,8 @@ public class TaskWorkOrderServiceImpl extends ServiceImpl<TaskWorkOrderMapper, T
.listAs(
QueryWrapper.create()
.select(TASK_WORK_ORDER_RECORD.ALL_COLUMNS)
.select(STAFF.NAME.as(TaskWorkOrderRecordListVo::getRecordStaffName))
.select(STAFF.NAME.as(TaskWorkOrderRecordListVo::getRecordStaffName),
STAFF.STAFF_TYPE.as(TaskWorkOrderRecordListVo::getRecordStaffType))
.select(SYS_USER.AVATAR.as(TaskWorkOrderRecordListVo::getAvatar))
.from(TASK_WORK_ORDER_RECORD)
// 员工表
@ -403,30 +409,28 @@ public class TaskWorkOrderServiceImpl extends ServiceImpl<TaskWorkOrderMapper, T
Task task = taskService.getOne(QueryWrapper.create().where(TASK.ID.eq(taskWorkOrder.getTaskId())));
// 插入工单记录
TaskWorkOrderRecord taskWorkOrderRecord = BeanUtils.mapToClass(bo, TaskWorkOrderRecord.class);
// 获取记录员工;当前操作员工是否是主要负责人不是抛出异常
LoginUser loginUser = SecurityUtils.getInstance().getLoginUser();
// 读取员工信息
RedisService redisService = SpringUtils.getBean(RedisService.class);
JSONObject cacheObject = redisService.getCacheObject(UserType.OAM_USER.getKey() + loginUser.getUsername());
OamStaffLoginInfo loginInfo = cacheObject.getJSONObject("user").toJavaObject(OamStaffLoginInfo.class);
taskWorkOrderRecord.setRecordStaffId(loginInfo.getId());
JSONObject loginUserInfo = SecurityUtils.getInstance().getLoginUserInfo();
taskWorkOrderRecord.setRecordStaffId(loginUserInfo.getString("id"));
// 插入记录
SpringUtils.getBean(TaskWorkOrderRecordService.class).save(taskWorkOrderRecord);
// 负责人手机号
StaffInfoVo responsibleStaff =
SpringUtils.getBean(StaffService.class).getStaffInfo(task.getResponsibleStaffId());
List<String> phoneList = new ArrayList<>();
phoneList.add(responsibleStaff.getPhoneNumber());
phoneList.add(loginInfo.getPhoneNumber());
// 通知记录
try {
SpringUtils.getBean(WebHookSendHandler.class)
.webHookSendText(WebHookKeyConstant.ORDER_INFO_BOT,
phoneList,
task.getTaskName() + "\n" + task.getTaskContent() + "\n工单有新回复:\n" + bo.getRecordText(),
false);
} catch (IOException e) {
throw new ServiceException("发送消息通知失败!");
if (StringUtils.isNotBlank(task.getResponsibleStaffId())) {
// 负责人手机号
StaffInfoVo responsibleStaff =
SpringUtils.getBean(StaffService.class).getStaffInfo(task.getResponsibleStaffId());
List<String> phoneList = new ArrayList<>();
phoneList.add(responsibleStaff.getPhoneNumber());
phoneList.add(loginUserInfo.getString("phoneNumber"));
// 通知记录
try {
SpringUtils.getBean(WebHookSendHandler.class)
.webHookSendText(WebHookKeyConstant.ORDER_INFO_BOT,
phoneList,
task.getTaskContent() + "\n工单有新回复:\n" + bo.getRecordText(),
false);
} catch (IOException e) {
throw new ServiceException("发送消息通知失败!");
}
}
}
@ -460,14 +464,14 @@ public class TaskWorkOrderServiceImpl extends ServiceImpl<TaskWorkOrderMapper, T
SpringUtils.getBean(WebHookSendHandler.class)
.webHookSendText(WebHookKeyConstant.ORDER_INFO_BOT,
phoneList,
task.getTaskName() + "\n" + task.getTaskContent() + "\n您有一条工单需要接收\n",
task.getTaskContent() + "\n您有一条工单需要接收\n",
false);
break;
default:
SpringUtils.getBean(WebHookSendHandler.class)
.webHookSendText(WebHookKeyConstant.ORDER_INFO_BOT,
phoneList,
task.getTaskName() + "\n" + task.getTaskContent() + "\n您有一条工单需要尽快处理\n",
task.getTaskContent() + "\n您有一条工单需要尽快处理\n",
false);
}
} catch (IOException e) {
@ -490,8 +494,17 @@ public class TaskWorkOrderServiceImpl extends ServiceImpl<TaskWorkOrderMapper, T
if (!StringUtils.equals(workOrder.getRecordStaffId(), loginUserInfo.getString("id"))) {
throw new ServiceException("当前操作员工不是当前工单提交人,请联系提交人操作");
}
// TODO: 工单转需求
// 获取任务
Task task = SpringUtils.getBean(TaskService.class).getById(workOrder.getTaskId());
TaskDemandBo taskDemandBo = new TaskDemandBo();
RedisService redisService = SpringUtils.getBean(RedisService.class);
String brandId = redisService.getCacheObject(OamConfigEnum.DEMAND_TO_TASK_BRAND.getKey());
String storeId = redisService.getCacheObject(OamConfigEnum.DEMAND_TO_TASK_STORE.getKey());
taskDemandBo.setAttachmentUrl(task.getAttachmentUrl())
.setBrandId(brandId)
.setStoreId(storeId)
.setTaskContent(task.getTaskContent());
SpringUtils.getBean(TaskDemandService.class).insertTaskDemand(taskDemandBo);
}
/**
@ -525,7 +538,7 @@ public class TaskWorkOrderServiceImpl extends ServiceImpl<TaskWorkOrderMapper, T
SpringUtils.getBean(WebHookSendHandler.class)
.webHookSendText(WebHookKeyConstant.ORDER_INFO_BOT,
phoneList,
task.getTaskName() + "\n" + task.getTaskContent() + "\n工单已暂停到:"
task.getTaskContent() + "\n工单已暂停到:"
+ bo.getPauseExpireTime().format(DateTimeFormatter.ofPattern(DateUtils.YYYY_MM_DD_HH_MM_SS)),
false);
} catch (IOException e) {
@ -564,15 +577,15 @@ public class TaskWorkOrderServiceImpl extends ServiceImpl<TaskWorkOrderMapper, T
TaskService taskService = SpringUtils.getBean(TaskService.class);
Task task = taskService.getOne(QueryWrapper.create().where(TASK.ID.eq(taskWorkOrder.getTaskId())));
// 超时设置逾期
if (finishTime.compareTo(task.getTaskReceiptTime()) > 0
|| Duration.between(finishTime, task.getTaskReceiptTime()).toMillis() >= 4800000) {
// 工单暂停期间完成
if (Duration.between(finishTime, task.getTaskReceiptTime()).toMillis() >= 4800000
|| Duration.between(finishTime, taskWorkOrder.getPauseExpireTime()).toMillis() >= 4800000) {
// 工单正常与暂停期间完成
task.setTaskStatus(3);
} else {
task.setTaskStatus(6);
}
task.setTaskItem(3);
task.setCompletionDate(Date.valueOf(LocalDate.now()));
task.setCompletionDate(LocalDate.now());
taskService.updateById(task);
// 更新工单
this.updateById(taskWorkOrder);
@ -601,10 +614,7 @@ public class TaskWorkOrderServiceImpl extends ServiceImpl<TaskWorkOrderMapper, T
// 通知记录
try {
SpringUtils.getBean(WebHookSendHandler.class)
.webHookSendText(WebHookKeyConstant.ORDER_INFO_BOT,
phoneList,
task.getTaskName() + "\n" + task.getTaskContent() + "\n工单办结",
false);
.webHookSendText(WebHookKeyConstant.ORDER_INFO_BOT, phoneList, task.getTaskContent() + "\n工单办结", false);
} catch (IOException e) {
throw new ServiceException("发送消息通知失败!");
}
@ -618,4 +628,54 @@ public class TaskWorkOrderServiceImpl extends ServiceImpl<TaskWorkOrderMapper, T
}
}
/**
* 技术模块-技术-获取个人工单列表
* @author DB
* @since 2023-11-30 19:41:32
*/
@Override
public List<TaskWorkOrderPersonVo> getPersonWorkOrder() {
// 获取当前用户
JSONObject loginUserInfo = SecurityUtils.getInstance().getLoginUserInfo();
// 获取当天技术值班
// 获取值班员工
DutyService dutyService = SpringUtils.getBean(DutyService.class);
Duty duty = dutyService.getOne(QueryWrapper.create().where(DUTY.DUTY_DATE.eq(DateUtils.getDate())));
if (duty == null) {
throw new ServiceException("当天没有值班员工,请联系相关人员添加值班信息!");
}
// 判断当前用户是不是值班用户
QueryWrapper queryWrapper = QueryWrapper.create();
if (!StringUtils.equals(duty.getTechnologyStaffId(), loginUserInfo.getString("id"))) {
// 获取未接受的工单
queryWrapper.or(TASK.TASK_STATUS.in(1, 7));
}
return this.mapper.selectListByQueryAs(
queryWrapper
.select(TASK_WORK_ORDER.ID,
TASK_WORK_ORDER.PHONE_NUMBER,
TASK_WORK_ORDER.RECORD_STAFF_ID,
TASK_WORK_ORDER.CREATE_TIME.as("createTime"),
TASK_WORK_ORDER.RECEIVING_TIME)
// 任务
.select(TASK.TASK_CONTENT, TASK.TASK_STATUS, TASK.TASK_RECEIPT_TIME)
// 品牌
.select(BRAND.BRAND_NAME)
// 校区
.select(STORE.STORE_NAME)
.where(TASK.RESPONSIBLE_STAFF_ID.eq(loginUserInfo.getString("id")))
.leftJoin(TASK)
.on(TASK.ID.eq(TASK_WORK_ORDER.TASK_ID))
.leftJoin(BRAND)
.on(BRAND.ID.eq(TASK_WORK_ORDER.BRAND_ID))
.leftJoin(STORE)
.on(STORE.ID.eq(TASK_WORK_ORDER.STORE_ID)),
TaskWorkOrderPersonVo.class,
// 提交人
item -> item.field(TaskWorkOrderPersonVo::getRecordStaffName)
.queryWrapper(recordStaff -> queryChain().select(STAFF.NAME.as("recordStaffName"))
.from(STAFF)
.where(STAFF.ID.eq(recordStaff.getRecordStaffId()))));
}
}

View File

@ -29,12 +29,6 @@ public class PersonTaskPageVo implements Serializable {
@ApiModelProperty("主键")
private String id;
/**
* 任务名
*/
@ApiModelProperty("任务名")
private String taskName;
/**
* 任务类型(0:迭代;1:需求;2:投诉)
*/
@ -99,20 +93,20 @@ public class PersonTaskPageVo implements Serializable {
* 预期完成日期
*/
@ApiModelProperty("预期完成日期")
@JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private LocalDate expectedCompletionDate;
/**
* 完成日期
*/
@ApiModelProperty("完成日期")
@JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private LocalDate completionDate;
/**
* 任务接收时间
*/
@ApiModelProperty("任务接收时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Timestamp taskReceiptTime;
}

View File

@ -1,81 +0,0 @@
package com.cpop.oam.business.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
/**
* Description:
* date: 2023/5/22 9:28
*
* @Author DB
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "Task分页对象", description = "OAM-任务列表")
public class TaskAuditPageVo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@ApiModelProperty("主键")
private String id;
/**
* 任务名
*/
@ApiModelProperty("任务名")
private String taskName;
/**
* 任务类型(0:迭代;1:需求;2:投诉)
*/
@ApiModelProperty("任务类型(0:迭代;1:需求;2:投诉)")
private Integer taskType;
/**
* 任务内容
*/
@ApiModelProperty("任务内容")
private String taskContent;
/**
* 任务评级(0:A;1:B;2:C;3:D;4:E)
*/
@ApiModelProperty("任务评级(0:A;1:B;2:C;3:D;4:E)")
private Integer taskRating;
/**
* 附件地址
*/
@ApiModelProperty("附件地址")
private String attachmentUrl;
/**
* 备注
*/
@ApiModelProperty("备注")
private String remark;
/**
* 预期完成日期
*/
@ApiModelProperty("预期完成日期")
@JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8")
private LocalDate expectedCompletionDate;
/**
* 创建时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
@ApiModelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@ -6,21 +6,20 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.time.LocalDate;
import com.cpop.core.annontation.StringArrayConvert;
/**
* Description:
* date: 2023/5/30 15:44
*
* @Author ST
* 需求分页对象
* @author DB
* @since 2023-11-30 16:01:47
* @version 1.0.0
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "需求管理分页对象", description = "需求管理")
public class TaskDemandPageVo implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModel(value = "需求分页对象", description = "需求管理")
public class TaskDemandPageVo {
/**
* 主键
@ -29,10 +28,28 @@ public class TaskDemandPageVo implements Serializable {
private String id;
/**
* 任务名
* 品牌/机构ID
*/
@ApiModelProperty("任务名")
private String taskName;
@ApiModelProperty("品牌/机构ID")
private String brandId;
/**
* 品牌/机构
*/
@ApiModelProperty("品牌/机构")
private String brandName;
/**
* 校区/店铺ID
*/
@ApiModelProperty("校区/店铺ID")
private String storeId;
/**
* 校区/店铺
*/
@ApiModelProperty("校区/店铺")
private String storeName;
/**
* 任务内容
@ -43,61 +60,85 @@ public class TaskDemandPageVo implements Serializable {
/**
* 附件地址
*/
@StringArrayConvert
@ApiModelProperty("附件地址")
private String attachmentUrl;
/**
* 备注
* 记录员工Id
*/
@ApiModelProperty("备注")
private String remark;
/**
* 品牌
*/
@ApiModelProperty("品牌id")
private String brandId;
/**
* 品牌
*/
@ApiModelProperty("品牌")
private String brandName;
/**
* 校区
*/
@ApiModelProperty("校区id")
private String campusId;
/**
* 校区
*/
@ApiModelProperty("校区")
private String campusName;
/**
* 创建时间
*/
@ApiModelProperty("创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
private Timestamp createTime;
/**
* 需求类型
*/
@ApiModelProperty("需求类型")
private Integer demandType;
/**
* 记录员工id
*/
@ApiModelProperty("记录员工id")
@ApiModelProperty("记录员工Id")
private String recordStaffId;
/**
* 记录员工名
*/
@ApiModelProperty("记录员工名")
private String recordStaffName;
/**
* 创建时间
*/
@ApiModelProperty("创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime createTime;
/**
* 更新人
*/
@ApiModelProperty("更新人")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private String updateUserId;
/**
* 更新人
*/
@ApiModelProperty("更新人")
private String updateStaffName;
/**
* 更新时间
*/
@ApiModelProperty("更新时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime updateTime;
/**预期完成时间 */
@ApiModelProperty("预期完成时间")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private LocalDate expectedCompletionDate;
/**
* 是否加急
*/
@ApiModelProperty("是否加急")
private Integer isUrgent;
/**任务评级(0:A;1:B;2:C;3:D;4:E) */
@ApiModelProperty("任务评级(0:A;1:B;2:C;3:D;4:E)")
private Integer taskRating;
/**任务接收员工Id */
@ApiModelProperty("领取人Id")
private String responsibleStaffId;
/**任务接收员工 */
@ApiModelProperty("领取人")
private String responsibleStaffName;
/**任务领取时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty("任务领取时间")
private LocalDateTime taskReceiptTime;
/**完成日期 */
@ApiModelProperty("完成日期")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private LocalDate completionDate;
/**测试转部署文件 */
@ApiModelProperty("测试转部署文件")
@StringArrayConvert
private String testToFinishUrl;
}

View File

@ -73,16 +73,14 @@ public class TaskMonthStatisticsVo implements Serializable {
/**
* 日期
*/
@JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@ApiModelProperty(value = "日期")
private LocalDate date;
/**
* 日期
* 任务内容
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "任务名")
private List<String> taskNames;
@ApiModelProperty(value = "任务内容")
private List<String> taskContents;
}
}

View File

@ -1,74 +0,0 @@
package com.cpop.oam.business.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.time.LocalDate;
/**
* Description:
* date: 2023/5/16 15:48
*
* @Author ST
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "Task分页对象", description = "OAM-任务列表")
public class TaskPageVo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@ApiModelProperty("主键")
private String id;
/**
* 任务名
*/
@ApiModelProperty("任务名")
private String taskName;
/**
* 任务类型(0:迭代;1:需求;2:投诉)
*/
@ApiModelProperty("任务类型(0:迭代;1:需求;2:投诉)")
private Integer taskType;
/**
* 任务内容
*/
@ApiModelProperty("任务内容")
private String taskContent;
/**
* 任务评级(0:A;1:B;2:C;3:D;4:E)
*/
@ApiModelProperty("任务评级(0:A;1:B;2:C;3:D;4:E)")
private Integer taskRating;
/**
* 附件地址
*/
@ApiModelProperty("附件地址")
private String attachmentUrl;
/**
* 备注
*/
@ApiModelProperty("备注")
private String remark;
/**
* 预期完成日期
*/
@ApiModelProperty("预期完成日期")
@JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8")
private LocalDate expectedCompletionDate;
}

View File

@ -7,6 +7,7 @@ import lombok.Data;
import lombok.experimental.Accessors;
import java.sql.Timestamp;
import com.cpop.core.annontation.StringArrayConvert;
/**
* 任务-工单记录-记录
@ -43,6 +44,12 @@ public class TaskWorkOrderRecordListVo {
@ApiModelProperty("记录员工id")
private String recordStaffName;
/**
* 员工类型(0:技术人员;1:售后人员;2:管理人员)
*/
@ApiModelProperty("员工类型(0:技术人员;1:售后人员;2:管理人员)")
private String recordStaffType;
/**
* 记录内容
*/
@ -52,6 +59,7 @@ public class TaskWorkOrderRecordListVo {
/**
* 附件地址
*/
@StringArrayConvert
@ApiModelProperty("附件地址")
private String attachmentUrl;

View File

@ -10,11 +10,11 @@ import javax.annotation.PostConstruct;
import static org.springframework.integration.config.xml.IntegrationNamespaceUtils.ROLE;
/**
* 初始化配置
* @author DB
* @createTime 2023/11/10 12:25
* @description 初始化配置
* @since 2023-11-30 15:33:30
* @version 1.0.0
*/
@Component
public class InitConfig {
@ -23,18 +23,18 @@ public class InitConfig {
* 初始化
*/
@PostConstruct
public void init(){
//检查角色初始化
public void init() {
// 检查角色初始化
RoleService roleService = SpringUtils.getBean(RoleService.class);
for (InitRoleEnum value : InitRoleEnum.values()) {
Role role = roleService.queryChain().where("id = ?", value.getId()).one();
if (role == null){
if (role == null) {
Role newRole = new Role();
newRole.setId(value.getId())
.setRoleName(value.getRoleName())
.setRoleValue(value.getRoleValue())
.setOrderNo(value.getOrderNo())
.setUserType(value.getUserType());
.setRoleName(value.getRoleName())
.setRoleValue(value.getRoleValue())
.setOrderNo(value.getOrderNo())
.setUserType(value.getUserType());
roleService.save(newRole);
}
}

View File

@ -14,4 +14,9 @@ public interface OamConfigKey {
* 企业微信配置信息
*/
String[] WORK_WX_INFO = {"OamAuditStaffPhone", "OamCancelAfterVerificationStaffPhone"};
/**
* 需求转任务配置信息
*/
String[] DEMAND_TO_TASK = {"DemandToTaskBrand", "DemandToTaskStore"};
}

View File

@ -11,24 +11,36 @@ public enum OamConfigEnum {
/**
* 任务审核员工手机号
*/
AUDIT_STAFF_PHONE("任务审核员工手机号", "OamAuditStaffPhone","auditStaffPhone", true),
AUDIT_STAFF_PHONE("任务审核员工手机号", "OamAuditStaffPhone", "auditStaffPhone", true),
/**
* 核销管理员手机号
*/
CANCEL_AFTER_VERIFICATION_STAFF_PHONE("核销管理员手机号", "OamCancelAfterVerificationStaffPhone", "cancelAfterVerificationStaffPhone",true);
CANCEL_AFTER_VERIFICATION_STAFF_PHONE("核销管理员手机号", "OamCancelAfterVerificationStaffPhone",
"cancelAfterVerificationStaffPhone", true),
/**
* 需求转任务主体品牌
*/
DEMAND_TO_TASK_BRAND("需求转任务主体品牌", "DemandToTaskBrand", "oamDemandToTaskBrand", true),
/**
* 需求转任务主体校区
*/
DEMAND_TO_TASK_STORE("需求转任务主体校区", "DemandToTaskStore", "oamDemandToTaskStore", true);
/**
* 配置名
*/
private final String name;
/**
* 配置键
*/
private final String key;
/**
* 属性
*/
private final String field;
/**
* 配置类型(是否系统内置)
*/

View File

@ -1,8 +1,11 @@
package com.cpop.system.business.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.cpop.common.constant.Constants;
import com.cpop.core.base.entity.LoginUser;
import com.cpop.core.utils.SecurityUtils;
import com.cpop.system.business.entity.Menu;
import com.cpop.system.business.entity.Role;
import com.cpop.system.business.service.LoginService;
import com.cpop.system.business.service.MenuService;
import com.cpop.system.business.vo.LoginUserInfoVo;
@ -15,6 +18,15 @@ import java.util.List;
import java.util.Set;
import com.cpop.core.utils.SpringUtils;
import com.cpop.system.framework.ws.server.WebSocketServer;
import com.cpop.system.business.service.RoleService;
import static com.cpop.system.business.entity.table.MenuTableDef.MENU;
import static com.cpop.system.business.entity.table.RoleMenuTableDef.ROLE_MENU;
import static com.cpop.system.business.entity.table.RoleTableDef.ROLE;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.compress.archivers.dump.DumpArchiveEntry.PERMISSION;
import java.util.HashSet;
/**
* @author DB
@ -35,31 +47,49 @@ public class LoginServiceImpl implements LoginService {
**/
@Override
public LoginUserInfoVo getUserInfo() {
//获取当前登录用户信息
// 获取当前登录用户信息
LoginUser loginUser = SecurityUtils.getInstance().getLoginUser();
//获取申请员工信息
// 获取申请员工信息
JSONObject loginStaffInfo = SecurityUtils.getInstance().getLoginUserInfo();
return new LoginUserInfoVo()
.setUserId(loginUser.getUserId())
.setUsername(loginUser.getUsername())
.setRealName(loginStaffInfo.getString("name"))
.setAvatar(loginStaffInfo.getString("avatar"))
.setPermissions(loginUser.getPermissions())
.setRoles(Collections.singleton("Cpop"))
.setHomePath("");
return new LoginUserInfoVo().setUserId(loginUser.getUserId())
.setUsername(loginUser.getUsername())
.setRealName(loginStaffInfo.getString("name"))
.setAvatar(loginStaffInfo.getString("avatar"))
.setPermissions(loginUser.getPermissions())
.setRoles(Collections.singleton("Cpop"))
.setHomePath("");
}
/**
* @author LOST.yuan
* @Description 获取权限码
* @date 17:30 2022/10/19
* @return {@link List<String>}
**/
* 获取权限码
* @author DB
* @since 2023-11-30 14:32:57
* @version 1.0.0
*/
@Override
public Set<String> getPermCode() {
//获取当前登录用户信息
LoginUser loginUser = SecurityUtils.getInstance().getLoginUser();
return loginUser.getPermissions();
// 获取当前登录用户信息
JSONObject loginUser = SecurityUtils.getInstance().getLoginUserInfo();
if (StringUtils.equals(Constants.SUPER_ADMIN, loginUser.getString("userName"))) {
Set<String> permCodes = new HashSet<>();
permCodes.add("*:*:*");
return permCodes;
} else {
List<Menu> menuPermissions = SpringUtils.getBean(MenuService.class)
.queryChain()
.select(MENU.PERMISSION)
.leftJoin(ROLE_MENU)
.on(ROLE_MENU.MENU_ID.eq(MENU.ID))
.leftJoin(ROLE)
.on(ROLE.ID.eq(ROLE_MENU.ROLE_ID))
.where(ROLE.ID.eq(loginUser.getString("roleId")))
.and(MENU.TYPE.in(1, 2))
.and(MENU.PERMISSION.isNotNull())
.list();
return menuPermissions.stream().map(Menu::getPermission).collect(Collectors.toSet());
}
}
/**