Sfoglia il codice sorgente

Merge remote-tracking branch 'origin/master'

lizhenhao 2 anni fa
parent
commit
8b4f63c2a9
15 ha cambiato i file con 375 aggiunte e 3 eliminazioni
  1. 6 2
      jeeplus-platform/jeeplus-admin/src/main/java/com/jeeplus/sys/controller/LoginController.java
  2. 46 1
      jeeplus-platform/jeeplus-admin/src/main/java/com/jeeplus/sys/controller/UserController.java
  3. 7 0
      jeeplus-platform/jeeplus-admin/src/main/java/com/jeeplus/sys/mapper/OfficeMapper.java
  4. 8 0
      jeeplus-platform/jeeplus-admin/src/main/java/com/jeeplus/sys/mapper/UserMapper.java
  5. 11 0
      jeeplus-platform/jeeplus-admin/src/main/java/com/jeeplus/sys/mapper/xml/OfficeMapper.xml
  6. 13 0
      jeeplus-platform/jeeplus-admin/src/main/java/com/jeeplus/sys/mapper/xml/UserMapper.xml
  7. 4 0
      jeeplus-platform/jeeplus-admin/src/main/java/com/jeeplus/sys/service/OfficeService.java
  8. 9 0
      jeeplus-platform/jeeplus-admin/src/main/java/com/jeeplus/sys/service/UserService.java
  9. 2 0
      jeeplus-platform/jeeplus-admin/src/main/java/com/jeeplus/sys/service/dto/UserDTO.java
  10. 19 0
      jeeplus-plugins/jeeplus-flowable/src/main/java/com/jeeplus/flowable/controller/FlowableProcessController.java
  11. 44 0
      jeeplus-plugins/jeeplus-flowable/src/main/java/com/jeeplus/flowable/controller/MyNoticeController.java
  12. 7 0
      jeeplus-plugins/jeeplus-flowable/src/main/java/com/jeeplus/flowable/mapper/MyNoticeListMapper.java
  13. 65 0
      jeeplus-plugins/jeeplus-flowable/src/main/java/com/jeeplus/flowable/model/MyNoticeList.java
  14. 113 0
      jeeplus-plugins/jeeplus-flowable/src/main/java/com/jeeplus/flowable/service/MyNoticeService.java
  15. 21 0
      jeeplus-plugins/jeeplus-flowable/src/main/java/com/jeeplus/flowable/vo/NoticeVo.java

+ 6 - 2
jeeplus-platform/jeeplus-admin/src/main/java/com/jeeplus/sys/controller/LoginController.java

@@ -114,9 +114,13 @@ public class LoginController {
         List<UserDTO> loginUserList = userService.getUserIdByLoginOrMobile(username);
         if(null != loginUserList){
             if (loginUserList.size()>1){
-                throw new DisabledException ( "登录名重复,请使用手机号登录" );
+                throw new DisabledException ( "登录名存在重复,请使用手机号进行登录或联系管理员" );
             }else{
-                username = loginUserList.get(0).getLoginName();
+                if(loginUserList.size()==0){
+                    throw new DisabledException ( "未找到登陆人员信息" );
+                }else{
+                    username = loginUserList.get(0).getLoginName();
+                }
             }
         }
 

+ 46 - 1
jeeplus-platform/jeeplus-admin/src/main/java/com/jeeplus/sys/controller/UserController.java

@@ -22,6 +22,7 @@ import com.jeeplus.core.excel.utils.EasyPoiUtil;
 import com.jeeplus.core.query.QueryWrapperGenerator;
 import com.jeeplus.security.util.SecurityUtils;
 import com.jeeplus.sys.constant.CommonConstants;
+import com.jeeplus.sys.domain.Office;
 import com.jeeplus.sys.domain.User;
 import com.jeeplus.sys.service.OfficeService;
 import com.jeeplus.sys.service.RoleService;
@@ -37,6 +38,7 @@ import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.ResponseEntity;
 import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.security.core.parameters.P;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
@@ -46,6 +48,7 @@ import javax.validation.Valid;
 import javax.validation.Validator;
 import java.io.File;
 import java.io.IOException;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -92,6 +95,37 @@ public class UserController {
     @ApiOperation(value = "查询用户")
     public ResponseEntity queryById(@RequestParam("id") String id) {
         UserDTO userDTO = userService.get ( id );
+        //根据office.id 查询部门的所有父节点信息
+        if(null != userDTO.getOfficeDTO() && StringUtils.isNotBlank(userDTO.getOfficeDTO().getId())){
+            OfficeDTO office = officeService.getOfficeById(userDTO.getOfficeDTO().getId());
+            //将office的父节点信息进行分割并查询赋值
+            if(null != office){
+                List<String> officeIdList = Arrays.asList(office.getParentIds().split(","));
+                Integer sort = 0;
+                if(null != officeIdList && officeIdList.size()>0){
+                    for (String officeId : officeIdList) {
+                        if(StringUtils.isNotBlank(officeId) && !"0".equals(officeId)){
+                            sort ++ ;
+                            OfficeDTO officeChild = officeService.getOfficeById(officeId);
+                            if(null != officeChild) {
+                                switch (sort){
+                                    case 1:
+                                        userDTO.setCompanyDTO(officeChild);
+                                        break;
+                                    case 2:
+                                        userDTO.setCorporationDTO(officeChild);
+                                        break;
+                                    case 3:
+                                        userDTO.setOfficeDTO(officeChild);
+                                        break;
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+
+        }
         return ResponseEntity.ok ( userDTO );
     }
 
@@ -104,7 +138,7 @@ public class UserController {
      */
     @ApiLog("用户数据列表")
     @ApiOperation(value = "用户数据列表")
-    @PreAuthorize("hasAuthority('sys:user:list')")
+    //@PreAuthorize("hasAuthority('sys:user:list')")
     @GetMapping("list")
     public ResponseEntity list(UserDTO userDTO, Page <UserDTO> page) throws Exception {
         QueryWrapper <UserDTO> queryWrapper = QueryWrapperGenerator.buildQueryCondition ( userDTO, UserDTO.class );
@@ -148,7 +182,18 @@ public class UserController {
     @ApiOperation(value = "修改个人资料")
     @PostMapping("saveInfo")
     public ResponseEntity saveInfo(@RequestBody UserDTO userDTO) {
+        //修改用户信息
+        //判断参数中手机号是否存在
+        if(StringUtils.isNotBlank(userDTO.getMobile())){
+            //如果手机号存在,则根据手机号查询除当前更改人以外是否还存在手机号重复的情况,如果存在,则不允许更改
+            List<UserDTO> userList = userService.getUserInfoByMobile(userDTO);
+            if (null != userList && userList.size()>0){
+                return ResponseEntity.badRequest ( ).body ( "修改个人资料失败! 该手机号已存在,无法修改!" );
+            }
+        }
         userService.updateById ( UserWrapper.INSTANCE.toEntity ( userDTO ) );
+
+        //更新缓存信息
         UserUtils.deleteCache ( UserUtils.getCurrentUserDTO ( ) );
         return ResponseEntity.ok ( "修改个人资料成功!" );
     }

+ 7 - 0
jeeplus-platform/jeeplus-admin/src/main/java/com/jeeplus/sys/mapper/OfficeMapper.java

@@ -21,6 +21,13 @@ import java.util.List;
 public interface OfficeMapper extends TreeMapper<Office> {
 
     OfficeDTO getOfficeByName(@Param("officeName") String officeName, @Param("parentName") String parentName);
+
+    /**
+     * 根据id查询office信息
+     * @param id
+     * @return
+     */
+    OfficeDTO getOfficeById(String id);
     /**
      * 根据部门名称 查询部门及所有子部门信息
      * @param officeName

+ 8 - 0
jeeplus-platform/jeeplus-admin/src/main/java/com/jeeplus/sys/mapper/UserMapper.java

@@ -140,4 +140,12 @@ public interface UserMapper extends BaseMapper<User> {
      */
     List<UserDTO> getUserIdByLoginOrMobile(String userName);
 
+    /**
+     * 根据用户手机号和当前人id查询非当前登录人的信息
+     *
+     * @param userDTO
+     * @return
+     */
+    List <UserDTO> getUserInfoByMobile(UserDTO userDTO);
+
 }

+ 11 - 0
jeeplus-platform/jeeplus-admin/src/main/java/com/jeeplus/sys/mapper/xml/OfficeMapper.xml

@@ -79,4 +79,15 @@
 		WHERE a.parameter_id=(select s.id from sys_parameter s where s.parameter=#{parameter})
 	    and a.falt = '1' and del_flag = '0'
 	</select>
+
+
+    <select id="getOfficeById" resultType="com.jeeplus.sys.service.dto.OfficeDTO">
+        select
+        <include refid="officeColumns"/>
+        from sys_office a
+        <where>
+            a.id = #{id}
+            and a.del_flag = 0
+        </where>
+    </select>
 </mapper>

+ 13 - 0
jeeplus-platform/jeeplus-admin/src/main/java/com/jeeplus/sys/mapper/xml/UserMapper.xml

@@ -245,4 +245,17 @@
 		</where>
 	</select>
 
+
+	<select id="getUserInfoByMobile" resultType="com.jeeplus.sys.service.dto.UserDTO">
+		SELECT
+		<include refid="userOfficeColumns"/>
+		FROM sys_user a
+		<include refid="userJoins"/>
+		<where>
+			a.del_flag = 0
+			and a.mobile = #{mobile}
+			and a.id != #{id}
+		</where>
+	</select>
+
 </mapper>

+ 4 - 0
jeeplus-platform/jeeplus-admin/src/main/java/com/jeeplus/sys/service/OfficeService.java

@@ -225,4 +225,8 @@ public class OfficeService extends TreeService<OfficeMapper, Office> {
         root.setChildren (trees);
         return Lists.newArrayList (root);
     }
+
+    public OfficeDTO getOfficeById(String id){
+        return officeMapper.getOfficeById(id);
+    }
 }

+ 9 - 0
jeeplus-platform/jeeplus-admin/src/main/java/com/jeeplus/sys/service/UserService.java

@@ -373,4 +373,13 @@ public class UserService  extends ServiceImpl<UserMapper, User> {
 		officeIds.add(officeId);
 		return userMapper.selectList(new QueryWrapper<User>().lambda().in(User::getOfficeId,officeIds));
 	}
+
+
+	/**
+	 * 根据用户手机号和当前人id查询非当前登录人的信息
+	 * @param userDTO
+	 */
+	public List<UserDTO> getUserInfoByMobile(UserDTO userDTO) {
+		return userMapper.getUserInfoByMobile(userDTO);
+	}
 }

+ 2 - 0
jeeplus-platform/jeeplus-admin/src/main/java/com/jeeplus/sys/service/dto/UserDTO.java

@@ -275,4 +275,6 @@ public class  UserDTO extends BaseDTO {
     private String loginLocation;   //登录地点
     private String token;   //人员token
 
+    private OfficeDTO corporationDTO;   //公司信息
+
 }

+ 19 - 0
jeeplus-plugins/jeeplus-flowable/src/main/java/com/jeeplus/flowable/controller/FlowableProcessController.java

@@ -61,6 +61,25 @@ public class FlowableProcessController {
     /**
      * 流程定义列表
      */
+    @GetMapping("getById")
+    public ResponseEntity getById( Page<Map> page,String id) {
+        /*
+         * 保存两个对象,一个是ProcessDefinition(流程定义),一个是Deployment(流程部署)
+         */
+        page = flowProcessService.processList(page, "");
+        List<Map> records = page.getRecords();
+        Map resultMap = new HashMap();
+        for (Map map : records) {
+            if(id.equals(map.get("id"))){
+                resultMap = map;
+            }
+        }
+        return ResponseEntity.ok ( resultMap );
+    }
+
+    /**
+     * 流程定义列表
+     */
     @GetMapping("list")
     public ResponseEntity processListData( Page<Map> page, String category) {
         /*

+ 44 - 0
jeeplus-plugins/jeeplus-flowable/src/main/java/com/jeeplus/flowable/controller/MyNoticeController.java

@@ -0,0 +1,44 @@
+package com.jeeplus.flowable.controller;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.jeeplus.flowable.model.Flow;
+import com.jeeplus.flowable.model.MyNoticeList;
+import com.jeeplus.flowable.service.MyNoticeService;
+import com.jeeplus.flowable.vo.NoticeVo;
+import com.jeeplus.flowable.vo.ProcessVo;
+import com.jeeplus.flowable.vo.TaskVo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.flowable.task.api.Task;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+
+@RestController
+@Api(value = "我的通知")
+@RequestMapping("/flowable/notice")
+public class MyNoticeController {
+
+    @Resource
+    private MyNoticeService service;
+
+    @GetMapping("/list")
+    @ApiOperation(value = "待办列表")
+    public ResponseEntity noticeList(Page<MyNoticeList> page, String type) {
+        Page<MyNoticeList> voPage = service.noticeList(page, type);
+        return ResponseEntity.ok (voPage);
+    }
+
+    @ApiOperation(value = "新增")
+    @GetMapping("/add")
+    public String add(String taskId, String title, String defId, String taskName, String createUser, String createTime, String noticeName) throws Exception{
+        return service.add(taskId, title, defId, taskName, createUser, createTime, noticeName);
+    }
+
+    @ApiOperation(value = "修改已读状态")
+    @GetMapping("/update")
+    public String update(String taskId, String noticeId) {
+        return service.update(taskId, noticeId);
+    }
+}

+ 7 - 0
jeeplus-plugins/jeeplus-flowable/src/main/java/com/jeeplus/flowable/mapper/MyNoticeListMapper.java

@@ -0,0 +1,7 @@
+package com.jeeplus.flowable.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.jeeplus.flowable.model.MyNoticeList;
+
+public interface MyNoticeListMapper extends BaseMapper<MyNoticeList> {
+}

+ 65 - 0
jeeplus-plugins/jeeplus-flowable/src/main/java/com/jeeplus/flowable/model/MyNoticeList.java

@@ -0,0 +1,65 @@
+package com.jeeplus.flowable.model;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.jeeplus.core.domain.BaseEntity;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+@TableName(value = "my_notice_list")
+public class MyNoticeList extends BaseEntity {
+
+    /**
+     * 流程id
+     */
+    private String taskId;
+
+    /**
+     * 实例标题
+     */
+    private String title;
+
+    /**
+     * 流程id
+     */
+    private String defId;
+
+    /**
+     * 流程名称
+     */
+    private String taskName;
+
+    /**
+     * 当前环节
+     */
+    private String link;
+
+    /**
+     * 创建人名称
+     */
+    private String createUser;
+
+    /**
+     * 创建时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+
+    /**
+     * 通知人名称
+     */
+    private String noticeName;
+
+    /**
+     * 读取状态
+     */
+    private String type;
+
+    /**
+     * 重复数量
+     */
+    private Integer repetitionCount;
+
+}

+ 113 - 0
jeeplus-plugins/jeeplus-flowable/src/main/java/com/jeeplus/flowable/service/MyNoticeService.java

@@ -0,0 +1,113 @@
+package com.jeeplus.flowable.service;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.jeeplus.core.domain.BaseEntity;
+import com.jeeplus.flowable.mapper.MyNoticeListMapper;
+import com.jeeplus.flowable.model.Flow;
+import com.jeeplus.flowable.model.MyNoticeList;
+import com.jeeplus.flowable.utils.ProcessDefCache;
+import com.jeeplus.flowable.vo.NoticeVo;
+import com.jeeplus.flowable.vo.TaskVo;
+import com.jeeplus.sys.service.dto.UserDTO;
+import com.jeeplus.sys.utils.StringUtils;
+import com.jeeplus.sys.utils.UserUtils;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import org.flowable.engine.TaskService;
+import org.flowable.task.api.Task;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+@Service
+@Transactional
+public class MyNoticeService {
+
+    @Resource
+    private FlowProcessService flowProcessService;
+
+    @Resource
+    private MyNoticeListMapper mapper;
+
+    /**
+     * 获取待办任务列表
+     *
+     * @return
+     */
+    public Page<MyNoticeList> noticeList(Page<MyNoticeList> page, String type){
+        // 获取当前登录人名称查询出未查看通知列表
+        String userName = UserUtils.getCurrentUserDTO ().getName ();
+        LambdaQueryWrapper<MyNoticeList> wrapper = new LambdaQueryWrapper<MyNoticeList>();
+        wrapper.eq(MyNoticeList::getNoticeName, userName).orderByDesc(BaseEntity::getCreateDate);
+        if (StringUtils.isNotEmpty(type)) {
+            wrapper.eq(MyNoticeList::getType, Integer.parseInt(type));
+        }
+        Page<MyNoticeList> listPage = mapper.selectPage(page, wrapper);
+        if (CollectionUtils.isNotEmpty(listPage.getRecords())) {
+            for (MyNoticeList notice : listPage.getRecords()) {
+                notice.setType("0".equals(notice.getType())? "未读":"已读");
+            }
+        }
+        return listPage;
+    }
+
+    public String add(String taskId, String title, String defId, String taskName, String createName, String createDate, String noticeName) throws Exception{
+        MyNoticeList notice = new MyNoticeList();
+        //是否已保存
+        LambdaQueryWrapper<MyNoticeList> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(BaseEntity::getDelFlag, 0).eq(MyNoticeList::getTaskId, taskId).eq(MyNoticeList::getNoticeName, noticeName).eq(MyNoticeList::getType, 0);
+        MyNoticeList one = mapper.selectOne(wrapper);
+        if (one != null) {
+            one.setRepetitionCount(one.getRepetitionCount() + 1);
+            mapper.updateById(one);
+        }
+        //获取当前登录人信息
+        UserDTO userDTO = UserUtils.getCurrentUserDTO();
+        //生成id
+        String id = UUID.randomUUID().toString().replace("-", "");
+        notice.setId(id);
+        notice.setCreateBy(userDTO.getId());
+        notice.setCreateDate(new Date());
+        notice.setUpdateBy(userDTO.getId());
+        notice.setUpdateDate(new Date());
+        notice.setDelFlag(0);
+        notice.setTaskId(taskId);
+        notice.setTitle(title);
+        notice.setDefId(defId);
+        if (StringUtils.isNotEmpty(taskName)) {
+            notice.setTaskName(taskName);
+        } else {
+            Page<Map> page = flowProcessService.processList(new Page<Map>(), "");
+            List<Map> records = page.getRecords();
+            Map resultMap = new HashMap();
+            for (Map<String, String> map : records) {
+                if(defId.equals(map.get("id"))){
+                    notice.setTaskName(map.get("name"));
+                }
+            }
+        }
+        notice.setLink("结束");
+        notice.setCreateUser(createName);
+        // 创建时间格式化处理
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        notice.setCreateTime(format.parse(createDate));
+        notice.setNoticeName(noticeName);
+        notice.setType("0");
+        notice.setRepetitionCount(1);
+        mapper.insert(notice);
+        return "操作成功";
+    }
+
+    public String update(String taskId, String noticeId) {
+        LambdaQueryWrapper<MyNoticeList> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(BaseEntity::getDelFlag, 0).eq(MyNoticeList::getTaskId, taskId).eq(MyNoticeList::getNoticeName, noticeId).eq(MyNoticeList::getType, 0);
+        MyNoticeList one = mapper.selectOne(wrapper);
+        one.setType("1");
+        mapper.updateById(one);
+        return "操作成功";
+    }
+}

+ 21 - 0
jeeplus-plugins/jeeplus-flowable/src/main/java/com/jeeplus/flowable/vo/NoticeVo.java

@@ -0,0 +1,21 @@
+package com.jeeplus.flowable.vo;
+
+import lombok.Data;
+
+import java.util.Map;
+
+@Data
+public class NoticeVo {
+
+    private String processDefinitionName; // 流程名称
+    private int version; // 流程版本
+    private Map vars; // 流程变量
+    private TaskVo task; //流程当前节点
+    private int code; // 流程状态码
+    private String status; //流程状态
+    private String noticeId;//通知人
+    private String noticeName;//通知人姓名
+    private String type;//读取状态
+    private Integer repetitionCount;//重复数量
+
+}