From 8abdc42ded6b9ce2b8575062cb4fac96af17355a Mon Sep 17 00:00:00 2001 From: ls <1793460677@qq.com> Date: Thu, 20 Mar 2025 13:37:30 +0800 Subject: [PATCH] =?UTF-8?q?add:=20=E8=81=94=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/boge/config/ShiroConfig.java | 2 + .../flow/controller/FlwDeployController.java | 10 +-- .../controller/FlwInstanceController.java | 5 +- .../flow/service/FlwDeployService.java | 2 +- .../service/impl/FlwDeployServiceImpl.java | 9 ++- .../service/impl/FlwInstanceServiceImpl.java | 10 ++- .../modules/sys/entity/SysUserEntity.java | 2 + .../sys/service/impl/SysUserServiceImpl.java | 14 ++-- .../tickets/controller/TicketsController.java | 5 +- .../boge/modules/tickets/dao/TicketsDao.java | 9 ++- .../boge/modules/tickets/dto/TicketsDTO.java | 78 +++++++++++++++++++ .../modules/tickets/entity/TicketsEntity.java | 6 +- .../tickets/service/TicketsService.java | 5 +- .../service/impl/TicketsServiceImpl.java | 53 ++++++++++++- .../resources/mapper/tickets/TicketsDao.xml | 10 ++- 15 files changed, 184 insertions(+), 36 deletions(-) diff --git a/base-fast/src/main/java/com/boge/config/ShiroConfig.java b/base-fast/src/main/java/com/boge/config/ShiroConfig.java index 0d68b5f..832fe0d 100644 --- a/base-fast/src/main/java/com/boge/config/ShiroConfig.java +++ b/base-fast/src/main/java/com/boge/config/ShiroConfig.java @@ -50,6 +50,7 @@ public class ShiroConfig { shiroFilter.setFilters(filters); Map filterMap = new LinkedHashMap<>(); + filterMap.put("/tickets/tickets/info/**", "anon"); filterMap.put("/webjars/**", "anon"); filterMap.put("/druid/**", "anon"); filterMap.put("/app/**", "anon"); @@ -66,6 +67,7 @@ public class ShiroConfig { filterMap.put("/js/**", "anon"); filterMap.put("/img/**", "anon"); filterMap.put("/fonts/**", "anon"); + filterMap.put("/**", "oauth2"); shiroFilter.setFilterChainDefinitionMap(filterMap); diff --git a/base-fast/src/main/java/com/boge/modules/flow/controller/FlwDeployController.java b/base-fast/src/main/java/com/boge/modules/flow/controller/FlwDeployController.java index 3670aed..5eb6f35 100644 --- a/base-fast/src/main/java/com/boge/modules/flow/controller/FlwDeployController.java +++ b/base-fast/src/main/java/com/boge/modules/flow/controller/FlwDeployController.java @@ -69,13 +69,11 @@ public class FlwDeployController { * @param id * @return */ - @RequestMapping(value = "/flowDef/{id}") - public R flowDef(@PathVariable("id") String id){ - if(id == null){ - return R.error("流程定义ID不能为空!"); - } + @RequestMapping(value = "/flowDef") + public R flowDef(){ + // 我们通过BpmnModel对象来处理 - R r = deployService.flowDef(id); + R r = deployService.flowDef(); return r; } diff --git a/base-fast/src/main/java/com/boge/modules/flow/controller/FlwInstanceController.java b/base-fast/src/main/java/com/boge/modules/flow/controller/FlwInstanceController.java index a318bf7..1ee72eb 100644 --- a/base-fast/src/main/java/com/boge/modules/flow/controller/FlwInstanceController.java +++ b/base-fast/src/main/java/com/boge/modules/flow/controller/FlwInstanceController.java @@ -28,10 +28,7 @@ public class FlwInstanceController { */ @RequestMapping("/startFlowInstance") public R startFlowInstance(@RequestParam Map params){ - Object id = params.get("id"); - if(id == null){ - return R.error("流程定义ID必须要传递"); - } + instanceService.startFlowInstance(params); return R.ok(); } diff --git a/base-fast/src/main/java/com/boge/modules/flow/service/FlwDeployService.java b/base-fast/src/main/java/com/boge/modules/flow/service/FlwDeployService.java index 71abdbc..792735f 100644 --- a/base-fast/src/main/java/com/boge/modules/flow/service/FlwDeployService.java +++ b/base-fast/src/main/java/com/boge/modules/flow/service/FlwDeployService.java @@ -16,5 +16,5 @@ public interface FlwDeployService { String flowXML(String id); - R flowDef(String id); + R flowDef(); } diff --git a/base-fast/src/main/java/com/boge/modules/flow/service/impl/FlwDeployServiceImpl.java b/base-fast/src/main/java/com/boge/modules/flow/service/impl/FlwDeployServiceImpl.java index b029232..3d2cce4 100644 --- a/base-fast/src/main/java/com/boge/modules/flow/service/impl/FlwDeployServiceImpl.java +++ b/base-fast/src/main/java/com/boge/modules/flow/service/impl/FlwDeployServiceImpl.java @@ -21,6 +21,7 @@ import org.flowable.engine.repository.ProcessDefinition; import org.flowable.engine.repository.ProcessDefinitionQuery; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.GetMapping; @@ -47,6 +48,10 @@ public class FlwDeployServiceImpl extends FlowServiceNoFactory implements FlwDep @Autowired private SysRoleService roleService; + @Value("${ProcessInstance.defId}") + private String defId; + + /** * 查询分页的数据 * @@ -176,8 +181,8 @@ public class FlwDeployServiceImpl extends FlowServiceNoFactory implements FlwDep } @Override - public R flowDef(String id) { - BpmnModel bpmnModel = repositoryService.getBpmnModel(id); + public R flowDef() { + BpmnModel bpmnModel = repositoryService.getBpmnModel(defId); List> list = new ArrayList<>(); // 从BpmnModel对象中获取相关的 userTask 信息 Process mainProcess = bpmnModel.getMainProcess(); diff --git a/base-fast/src/main/java/com/boge/modules/flow/service/impl/FlwInstanceServiceImpl.java b/base-fast/src/main/java/com/boge/modules/flow/service/impl/FlwInstanceServiceImpl.java index acb669a..717862e 100644 --- a/base-fast/src/main/java/com/boge/modules/flow/service/impl/FlwInstanceServiceImpl.java +++ b/base-fast/src/main/java/com/boge/modules/flow/service/impl/FlwInstanceServiceImpl.java @@ -89,7 +89,7 @@ public class FlwInstanceServiceImpl extends FlowServiceNoFactory implements FlwI SysUserEntity loginUser = ShiroUtils.getUserEntity(); // 获取需要发起的流程信息 String ticketsId = (String) params.get("ticketsId"); - + Long userId = Long.valueOf((String) params.get("user1")); Map variable = new HashMap<>(); // 结合传递过来的数据动态的绑定流程变量 Set keys = params.keySet(); @@ -99,12 +99,14 @@ public class FlwInstanceServiceImpl extends FlowServiceNoFactory implements FlwI identityService.setAuthenticatedUserId(ShiroUtils.getUserId().toString()); // 启动流程 ProcessInstance processInstance = runtimeService.startProcessInstanceById(defId, variable); - SysUserEntity user = sysUserService.getById(Long.valueOf((String) params.get("user1"))); + SysUserEntity user = sysUserService.getById(userId); //更新工单审批id TicketsEntity ticketsEntity = new TicketsEntity(); ticketsEntity.setTicketsId(Long.valueOf(ticketsId)); ticketsEntity.setStatus(TicketsStatusEnums.CHECKED.getCode()); ticketsEntity.setProcessInstance(processInstance.getProcessInstanceId()); + ticketsEntity.setDeptPeople(user.getNickname()); + ticketsEntity.setAssignUserId(userId); ticketsService.updateById(ticketsEntity); if (StrUtil.isEmpty(user.getWexinId())){ @@ -328,8 +330,8 @@ public class FlwInstanceServiceImpl extends FlowServiceNoFactory implements FlwI @Override public R completeTaskById(Map params) { - String processInstance = (String) params.get("process_instance"); - String ticketsId = (String) params.get("ticketsId"); + String processInstance = (String) params.get("processInstance"); + Integer ticketsId = (Integer) params.get("ticketsId"); if(StringUtils.isBlank(processInstance)){ return R.error("流程Id不能为空"); } diff --git a/base-fast/src/main/java/com/boge/modules/sys/entity/SysUserEntity.java b/base-fast/src/main/java/com/boge/modules/sys/entity/SysUserEntity.java index 867ed8b..34c72b5 100644 --- a/base-fast/src/main/java/com/boge/modules/sys/entity/SysUserEntity.java +++ b/base-fast/src/main/java/com/boge/modules/sys/entity/SysUserEntity.java @@ -96,4 +96,6 @@ public class SysUserEntity implements Serializable { private String wexinId; + + } diff --git a/base-fast/src/main/java/com/boge/modules/sys/service/impl/SysUserServiceImpl.java b/base-fast/src/main/java/com/boge/modules/sys/service/impl/SysUserServiceImpl.java index 10c07a0..a4d08ac 100644 --- a/base-fast/src/main/java/com/boge/modules/sys/service/impl/SysUserServiceImpl.java +++ b/base-fast/src/main/java/com/boge/modules/sys/service/impl/SysUserServiceImpl.java @@ -89,10 +89,10 @@ public class SysUserServiceImpl extends ServiceImpl i user.setPassword(new Sha256Hash(user.getPassword(), salt).toHex()); user.setSalt(salt); this.save(user); - + //检查角色是否越权 checkRole(user); - + //保存用户与角色关系 sysUserRoleService.saveOrUpdate(user.getUserId(), user.getRoleIdList()); } @@ -106,10 +106,10 @@ public class SysUserServiceImpl extends ServiceImpl i user.setPassword(new Sha256Hash(user.getPassword(), user.getSalt()).toHex()); } this.updateById(user); - + //检查角色是否越权 //checkRole(user); - + //保存用户与角色关系 sysUserRoleService.saveOrUpdate(user.getUserId(), user.getRoleIdList()); } @@ -143,7 +143,7 @@ public class SysUserServiceImpl extends ServiceImpl i /*if(user.getCreateUserId() == Constant.SUPER_ADMIN){ return ; }*/ - + //查询用户创建的角色列表 List roleIdList = sysRoleService.queryRoleIdList(user.getCreateUserId()); @@ -152,4 +152,6 @@ public class SysUserServiceImpl extends ServiceImpl i throw new RRException("新增用户所选角色,不是本人创建"); } } -} \ No newline at end of file + + +} diff --git a/base-fast/src/main/java/com/boge/modules/tickets/controller/TicketsController.java b/base-fast/src/main/java/com/boge/modules/tickets/controller/TicketsController.java index 9fc6143..afce79c 100644 --- a/base-fast/src/main/java/com/boge/modules/tickets/controller/TicketsController.java +++ b/base-fast/src/main/java/com/boge/modules/tickets/controller/TicketsController.java @@ -3,6 +3,7 @@ package com.boge.modules.tickets.controller; import java.util.Arrays; import java.util.Map; +import com.boge.modules.tickets.dto.TicketsDTO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; @@ -48,9 +49,9 @@ public class TicketsController { @RequestMapping("/info/{ticketsId}") //@RequiresPermissions("tickets:tickets:info") public R info(@PathVariable("ticketsId") String ticketsId){ - TicketsEntity tickets = ticketsService.getById(ticketsId); + TicketsDTO ticketsDTO = ticketsService.getTicketsById(ticketsId); - return R.ok().put("tickets", tickets); + return R.ok().put("tickets", ticketsDTO); } /** diff --git a/base-fast/src/main/java/com/boge/modules/tickets/dao/TicketsDao.java b/base-fast/src/main/java/com/boge/modules/tickets/dao/TicketsDao.java index 88dca4d..2761149 100644 --- a/base-fast/src/main/java/com/boge/modules/tickets/dao/TicketsDao.java +++ b/base-fast/src/main/java/com/boge/modules/tickets/dao/TicketsDao.java @@ -1,17 +1,20 @@ package com.boge.modules.tickets.dao; +import com.boge.modules.tickets.dto.TicketsDTO; import com.boge.modules.tickets.entity.TicketsEntity; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Mapper; /** - * - * + * + * * @author ls * @email dengpbs@163.com * @date 2025-03-05 14:29:12 */ @Mapper public interface TicketsDao extends BaseMapper { - + + + TicketsDTO getTicketsDTOById(String ticketsId); } diff --git a/base-fast/src/main/java/com/boge/modules/tickets/dto/TicketsDTO.java b/base-fast/src/main/java/com/boge/modules/tickets/dto/TicketsDTO.java index e69de29..57b6b5a 100644 --- a/base-fast/src/main/java/com/boge/modules/tickets/dto/TicketsDTO.java +++ b/base-fast/src/main/java/com/boge/modules/tickets/dto/TicketsDTO.java @@ -0,0 +1,78 @@ +package com.boge.modules.tickets.dto; + +import lombok.Data; + +import java.util.Date; + +@Data +public class TicketsDTO { + /** + * 工单id + */ + private Long ticketsId; + /** + * 小车类型 + */ + private Integer carType; + + /** + * 小车类型 + */ + private String carName; + + /** + * 异常类型 + */ + private String errorType; + + /** + * 合同编号 + */ + private String contractNumber; + /** + * 客户id + */ + private Long clientId; + + /** + * 客户名称 + */ + private String clientName; + /** + * 故障描述 + */ + private String description; + /** + * 部门对接人 + */ + private String deptPeople; + /** + * 客户联系电话 + */ + private String deptPhone; + /** + * 创建者ID + */ + private Long createUserId; + /** + * 创建时间 + */ + private Date createTime; + /** + * 是否验收 + */ + private Integer isCheck; + /** + * 工单状态 + */ + private Integer status; + /** + * 工单关闭时间 + */ + private Date updateTime; + + /** + * 审批流id + */ + private String processInstance; +} diff --git a/base-fast/src/main/java/com/boge/modules/tickets/entity/TicketsEntity.java b/base-fast/src/main/java/com/boge/modules/tickets/entity/TicketsEntity.java index 5bd5c48..c5b6c8a 100644 --- a/base-fast/src/main/java/com/boge/modules/tickets/entity/TicketsEntity.java +++ b/base-fast/src/main/java/com/boge/modules/tickets/entity/TicketsEntity.java @@ -78,6 +78,8 @@ public class TicketsEntity implements Serializable { */ private String processInstance; - - + /** + * 指派人ID + */ + private Long assignUserId; } diff --git a/base-fast/src/main/java/com/boge/modules/tickets/service/TicketsService.java b/base-fast/src/main/java/com/boge/modules/tickets/service/TicketsService.java index 03fbf6f..6fe77aa 100644 --- a/base-fast/src/main/java/com/boge/modules/tickets/service/TicketsService.java +++ b/base-fast/src/main/java/com/boge/modules/tickets/service/TicketsService.java @@ -2,12 +2,13 @@ package com.boge.modules.tickets.service; import com.baomidou.mybatisplus.extension.service.IService; import com.boge.common.utils.PageUtils; +import com.boge.modules.tickets.dto.TicketsDTO; import com.boge.modules.tickets.entity.TicketsEntity; import java.util.Map; /** - * + * * * @author ls * @email dengpbs@163.com @@ -16,5 +17,7 @@ import java.util.Map; public interface TicketsService extends IService { PageUtils queryPage(Map params); + + TicketsDTO getTicketsById(String ticketsId); } diff --git a/base-fast/src/main/java/com/boge/modules/tickets/service/impl/TicketsServiceImpl.java b/base-fast/src/main/java/com/boge/modules/tickets/service/impl/TicketsServiceImpl.java index 1d3091f..9ae34c4 100644 --- a/base-fast/src/main/java/com/boge/modules/tickets/service/impl/TicketsServiceImpl.java +++ b/base-fast/src/main/java/com/boge/modules/tickets/service/impl/TicketsServiceImpl.java @@ -1,7 +1,23 @@ package com.boge.modules.tickets.service.impl; +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.boge.common.utils.ShiroUtils; +import com.boge.modules.car.entity.CarEntity; +import com.boge.modules.car.service.CarService; +import com.boge.modules.dict.dao.Dict; +import com.boge.modules.dict.dao.mapper.SysDictMapper; +import com.boge.modules.sys.entity.SysUserEntity; +import com.boge.modules.sys.service.SysUserRoleService; +import com.boge.modules.sys.service.impl.SysUserServiceImpl; +import com.boge.modules.tickets.dto.TicketsDTO; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; + +import java.util.List; import java.util.Map; + import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -16,14 +32,43 @@ import com.boge.modules.tickets.service.TicketsService; @Service("ticketsService") public class TicketsServiceImpl extends ServiceImpl implements TicketsService { + @Autowired + TicketsDao ticketsDao; + + @Autowired + private SysDictMapper sysDictMapper; + @Autowired + private SysUserServiceImpl sysUserService; + + @Autowired + private SysUserRoleService sysUserRoleService; + @Override public PageUtils queryPage(Map params) { - IPage page = this.page( - new Query().getPage(params), - new QueryWrapper() + SysUserEntity loginUser = ShiroUtils.getUserEntity(); + QueryWrapper ticketsEntityQueryWrapper = new QueryWrapper<>(); + if (ObjectUtil.isNotEmpty(loginUser)){ + List longs = sysUserRoleService.queryRoleIdList(loginUser.getUserId()); + //判断是否是超级管理员 + if (longs.contains(2L)){ + ticketsEntityQueryWrapper.orderBy(true, true,"create_time"); + }else { + ticketsEntityQueryWrapper.eq("assign_user_id", loginUser.getUserId()) + .orderBy(true, true,"create_time");; + } + } + + IPage page = this.page(new Query().getPage(params), + ticketsEntityQueryWrapper ); return new PageUtils(page); } -} \ No newline at end of file + @Override + public TicketsDTO getTicketsById(String ticketsId) { + TicketsDTO tickets = ticketsDao.getTicketsDTOById(ticketsId); + return tickets; + } + +} diff --git a/base-fast/src/main/resources/mapper/tickets/TicketsDao.xml b/base-fast/src/main/resources/mapper/tickets/TicketsDao.xml index 7c4403f..83c1745 100644 --- a/base-fast/src/main/resources/mapper/tickets/TicketsDao.xml +++ b/base-fast/src/main/resources/mapper/tickets/TicketsDao.xml @@ -8,7 +8,7 @@ - + @@ -19,6 +19,14 @@ +