Просмотр исходного кода

1、修复验证密码错误的接口
2、修复菜单保存报错问题
3、数量统计接口中增加未完成的申请数量统计

dzx 1 год назад
Родитель
Сommit
51c0334771

+ 29 - 2
src/main/java/com/xjrsoft/module/organization/controller/UserController.java

@@ -4,6 +4,7 @@ import cn.dev33.satoken.secure.BCrypt;
 import cn.dev33.satoken.session.SaSession;
 import cn.dev33.satoken.stp.StpUtil;
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.convert.Convert;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -17,6 +18,7 @@ import com.xjrsoft.common.enums.DeleteMark;
 import com.xjrsoft.common.enums.EnabledMark;
 import com.xjrsoft.common.enums.GenderDictionaryEnum;
 import com.xjrsoft.common.enums.RoleEnum;
+import com.xjrsoft.common.enums.WorkflowIsRecycleType;
 import com.xjrsoft.common.exception.MyException;
 import com.xjrsoft.common.model.result.R;
 import com.xjrsoft.common.model.result.RT;
@@ -75,10 +77,16 @@ import com.xjrsoft.module.oss.factory.OssFactory;
 import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
 import com.xjrsoft.module.system.entity.File;
 import com.xjrsoft.module.system.service.IFileService;
+import com.xjrsoft.module.workflow.constant.WorkflowConstant;
+import com.xjrsoft.module.workflow.entity.WorkflowExtra;
+import com.xjrsoft.module.workflow.mapper.WorkflowExtraMapper;
 import com.xjrsoft.module.workflow.service.IWorkflowExecuteService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
+import org.camunda.bpm.engine.HistoryService;
+import org.camunda.bpm.engine.history.HistoricProcessInstance;
+import org.camunda.bpm.engine.history.HistoricProcessInstanceQuery;
 import org.springframework.web.bind.annotation.DeleteMapping;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -126,6 +134,8 @@ public class UserController {
 
     private final CommonPropertiesConfig propertiesConfig;
 
+    private final WorkflowExtraMapper workflowExtraMapper;
+
     private final RedisUtil redisUtil;
 
     private final IFileService fileService;
@@ -136,6 +146,8 @@ public class UserController {
     private final IBaseClassService baseClassService;
     private final IWorkflowExecuteService workflowExecuteService;
 
+    private final HistoryService historyService;
+
 
     @GetMapping(value = "/list")
     @ApiOperation(value = "用户列表(不分页)")
@@ -347,6 +359,21 @@ public class UserController {
         PendingCountDto pendingCountDto = new PendingCountDto();
         pendingCountDto.setWfPendingCount(workflowExecuteService.pendingCount());
 
+        HistoricProcessInstanceQuery historicProcessInstanceQuery = historyService.createHistoricProcessInstanceQuery()
+                .variableValueEquals(WorkflowConstant.PROCESS_START_USER_ID_KEY, StpUtil.getLoginIdAsLong())
+                .variableValueEquals(WorkflowConstant.PROCESS_ISRECYCLE_FLAG_KEY, WorkflowIsRecycleType.NO.getCode());
+        List<HistoricProcessInstance> historicProcessInstances = historicProcessInstanceQuery.orderByProcessInstanceStartTime().desc().list();
+
+        //获取到所有流程id
+        List<String> processIds = historicProcessInstances.stream().map(HistoricProcessInstance::getId).collect(Collectors.toList());
+        int myApplicationCount = 0;
+        for (HistoricProcessInstance historicProcessInstance : historicProcessInstances) {
+            if (ObjectUtil.isNotNull(historicProcessInstance.getEndTime())) {
+                myApplicationCount ++;
+            }
+        }
+        pendingCountDto.setMyApplicationCount(myApplicationCount);
+
         return RT.ok(pendingCountDto);
     }
 
@@ -669,10 +696,10 @@ public class UserController {
 
     @GetMapping("/check-password")
     @ApiOperation(value = "验证登录者的密码")
-    public RT<Boolean> checkSignpassword(@Valid @RequestParam String password) {
+    public RT<Boolean> checkSignpassword(@RequestParam String password) {
         long loginIdAsLong = StpUtil.getLoginIdAsLong();
         User user = userService.getById(loginIdAsLong);
-        if (!BCrypt.checkpw(password, user.getSignPassword())) {
+        if (!BCrypt.checkpw(password, user.getPassword())) {
             return RT.error("密码填写错误!");
         }
         return RT.ok(true);

+ 2 - 0
src/main/java/com/xjrsoft/module/organization/vo/PendingCountDto.java

@@ -13,4 +13,6 @@ public class PendingCountDto implements Serializable {
      * 流程待办数量
      */
     private long wfPendingCount;
+
+    private long myApplicationCount;
 }

+ 11 - 6
src/main/java/com/xjrsoft/module/system/controller/MenuController.java

@@ -318,9 +318,16 @@ public class MenuController {
         formList.forEach(menuForm -> menuForm.setMenuId(menu.getId()));
         menuFormService.remove(Wrappers.<MenuForm>query().lambda().eq(MenuForm::getMenuId, menu.getId()));
 
-        List<XjrMenuDeptRelation> menuDeptRelations = BeanUtil.copyToList(dto.getMenuDeptRelations(), XjrMenuDeptRelation.class);
-        menuDeptRelations.forEach(XjrMenuDeptRelation -> XjrMenuDeptRelation.setMenuId(menu.getId()));
-        xjrMenuDeptRelationService.remove(Wrappers.<XjrMenuDeptRelation>query().lambda().eq(XjrMenuDeptRelation::getMenuId, menu.getId()));
+        if(dto.getMenuDeptRelations() != null){
+            List<XjrMenuDeptRelation> menuDeptRelations = BeanUtil.copyToList(dto.getMenuDeptRelations(), XjrMenuDeptRelation.class);
+            menuDeptRelations.forEach(XjrMenuDeptRelation -> XjrMenuDeptRelation.setMenuId(menu.getId()));
+            xjrMenuDeptRelationService.remove(Wrappers.<XjrMenuDeptRelation>query().lambda().eq(XjrMenuDeptRelation::getMenuId, menu.getId()));
+
+            if (CollectionUtils.isNotEmpty(menuDeptRelations)) {
+                xjrMenuDeptRelationService.saveBatch(menuDeptRelations);
+            }
+        }
+
 
         if (CollectionUtils.isNotEmpty(menuButtons)) {
             menuButtonService.saveBatch(menuButtons);
@@ -331,9 +338,7 @@ public class MenuController {
         if (CollectionUtils.isNotEmpty(formList)) {
             menuFormService.saveBatch(formList);
         }
-        if (CollectionUtils.isNotEmpty(menuDeptRelations)) {
-            xjrMenuDeptRelationService.saveBatch(menuDeptRelations);
-        }
+
         return R.ok();
     }