Browse Source

add: 联调

master
ls 1 week ago
parent
commit
8abdc42ded
  1. 2
      base-fast/src/main/java/com/boge/config/ShiroConfig.java
  2. 10
      base-fast/src/main/java/com/boge/modules/flow/controller/FlwDeployController.java
  3. 5
      base-fast/src/main/java/com/boge/modules/flow/controller/FlwInstanceController.java
  4. 2
      base-fast/src/main/java/com/boge/modules/flow/service/FlwDeployService.java
  5. 9
      base-fast/src/main/java/com/boge/modules/flow/service/impl/FlwDeployServiceImpl.java
  6. 10
      base-fast/src/main/java/com/boge/modules/flow/service/impl/FlwInstanceServiceImpl.java
  7. 2
      base-fast/src/main/java/com/boge/modules/sys/entity/SysUserEntity.java
  8. 14
      base-fast/src/main/java/com/boge/modules/sys/service/impl/SysUserServiceImpl.java
  9. 5
      base-fast/src/main/java/com/boge/modules/tickets/controller/TicketsController.java
  10. 9
      base-fast/src/main/java/com/boge/modules/tickets/dao/TicketsDao.java
  11. 78
      base-fast/src/main/java/com/boge/modules/tickets/dto/TicketsDTO.java
  12. 6
      base-fast/src/main/java/com/boge/modules/tickets/entity/TicketsEntity.java
  13. 5
      base-fast/src/main/java/com/boge/modules/tickets/service/TicketsService.java
  14. 53
      base-fast/src/main/java/com/boge/modules/tickets/service/impl/TicketsServiceImpl.java
  15. 10
      base-fast/src/main/resources/mapper/tickets/TicketsDao.xml

2
base-fast/src/main/java/com/boge/config/ShiroConfig.java

@ -50,6 +50,7 @@ public class ShiroConfig {
shiroFilter.setFilters(filters); shiroFilter.setFilters(filters);
Map<String, String> filterMap = new LinkedHashMap<>(); Map<String, String> filterMap = new LinkedHashMap<>();
filterMap.put("/tickets/tickets/info/**", "anon");
filterMap.put("/webjars/**", "anon"); filterMap.put("/webjars/**", "anon");
filterMap.put("/druid/**", "anon"); filterMap.put("/druid/**", "anon");
filterMap.put("/app/**", "anon"); filterMap.put("/app/**", "anon");
@ -66,6 +67,7 @@ public class ShiroConfig {
filterMap.put("/js/**", "anon"); filterMap.put("/js/**", "anon");
filterMap.put("/img/**", "anon"); filterMap.put("/img/**", "anon");
filterMap.put("/fonts/**", "anon"); filterMap.put("/fonts/**", "anon");
filterMap.put("/**", "oauth2"); filterMap.put("/**", "oauth2");
shiroFilter.setFilterChainDefinitionMap(filterMap); shiroFilter.setFilterChainDefinitionMap(filterMap);

10
base-fast/src/main/java/com/boge/modules/flow/controller/FlwDeployController.java

@ -69,13 +69,11 @@ public class FlwDeployController {
* @param id * @param id
* @return * @return
*/ */
@RequestMapping(value = "/flowDef/{id}") @RequestMapping(value = "/flowDef")
public R flowDef(@PathVariable("id") String id){ public R flowDef(){
if(id == null){
return R.error("流程定义ID不能为空!");
}
// 我们通过BpmnModel对象来处理 // 我们通过BpmnModel对象来处理
R r = deployService.flowDef(id); R r = deployService.flowDef();
return r; return r;
} }

5
base-fast/src/main/java/com/boge/modules/flow/controller/FlwInstanceController.java

@ -28,10 +28,7 @@ public class FlwInstanceController {
*/ */
@RequestMapping("/startFlowInstance") @RequestMapping("/startFlowInstance")
public R startFlowInstance(@RequestParam Map<String, Object> params){ public R startFlowInstance(@RequestParam Map<String, Object> params){
Object id = params.get("id");
if(id == null){
return R.error("流程定义ID必须要传递");
}
instanceService.startFlowInstance(params); instanceService.startFlowInstance(params);
return R.ok(); return R.ok();
} }

2
base-fast/src/main/java/com/boge/modules/flow/service/FlwDeployService.java

@ -16,5 +16,5 @@ public interface FlwDeployService {
String flowXML(String id); String flowXML(String id);
R flowDef(String id); R flowDef();
} }

9
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.flowable.engine.repository.ProcessDefinitionQuery;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -47,6 +48,10 @@ public class FlwDeployServiceImpl extends FlowServiceNoFactory implements FlwDep
@Autowired @Autowired
private SysRoleService roleService; private SysRoleService roleService;
@Value("${ProcessInstance.defId}")
private String defId;
/** /**
* 查询分页的数据 * 查询分页的数据
* *
@ -176,8 +181,8 @@ public class FlwDeployServiceImpl extends FlowServiceNoFactory implements FlwDep
} }
@Override @Override
public R flowDef(String id) { public R flowDef() {
BpmnModel bpmnModel = repositoryService.getBpmnModel(id); BpmnModel bpmnModel = repositoryService.getBpmnModel(defId);
List<Map<String, Object>> list = new ArrayList<>(); List<Map<String, Object>> list = new ArrayList<>();
// 从BpmnModel对象中获取相关的 userTask 信息 // 从BpmnModel对象中获取相关的 userTask 信息
Process mainProcess = bpmnModel.getMainProcess(); Process mainProcess = bpmnModel.getMainProcess();

10
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(); SysUserEntity loginUser = ShiroUtils.getUserEntity();
// 获取需要发起的流程信息 // 获取需要发起的流程信息
String ticketsId = (String) params.get("ticketsId"); String ticketsId = (String) params.get("ticketsId");
Long userId = Long.valueOf((String) params.get("user1"));
Map<String, Object> variable = new HashMap<>(); Map<String, Object> variable = new HashMap<>();
// 结合传递过来的数据动态的绑定流程变量 // 结合传递过来的数据动态的绑定流程变量
Set<String> keys = params.keySet(); Set<String> keys = params.keySet();
@ -99,12 +99,14 @@ public class FlwInstanceServiceImpl extends FlowServiceNoFactory implements FlwI
identityService.setAuthenticatedUserId(ShiroUtils.getUserId().toString()); identityService.setAuthenticatedUserId(ShiroUtils.getUserId().toString());
// 启动流程 // 启动流程
ProcessInstance processInstance = runtimeService.startProcessInstanceById(defId, variable); ProcessInstance processInstance = runtimeService.startProcessInstanceById(defId, variable);
SysUserEntity user = sysUserService.getById(Long.valueOf((String) params.get("user1"))); SysUserEntity user = sysUserService.getById(userId);
//更新工单审批id //更新工单审批id
TicketsEntity ticketsEntity = new TicketsEntity(); TicketsEntity ticketsEntity = new TicketsEntity();
ticketsEntity.setTicketsId(Long.valueOf(ticketsId)); ticketsEntity.setTicketsId(Long.valueOf(ticketsId));
ticketsEntity.setStatus(TicketsStatusEnums.CHECKED.getCode()); ticketsEntity.setStatus(TicketsStatusEnums.CHECKED.getCode());
ticketsEntity.setProcessInstance(processInstance.getProcessInstanceId()); ticketsEntity.setProcessInstance(processInstance.getProcessInstanceId());
ticketsEntity.setDeptPeople(user.getNickname());
ticketsEntity.setAssignUserId(userId);
ticketsService.updateById(ticketsEntity); ticketsService.updateById(ticketsEntity);
if (StrUtil.isEmpty(user.getWexinId())){ if (StrUtil.isEmpty(user.getWexinId())){
@ -328,8 +330,8 @@ public class FlwInstanceServiceImpl extends FlowServiceNoFactory implements FlwI
@Override @Override
public R completeTaskById(Map<String, Object> params) { public R completeTaskById(Map<String, Object> params) {
String processInstance = (String) params.get("process_instance"); String processInstance = (String) params.get("processInstance");
String ticketsId = (String) params.get("ticketsId"); Integer ticketsId = (Integer) params.get("ticketsId");
if(StringUtils.isBlank(processInstance)){ if(StringUtils.isBlank(processInstance)){
return R.error("流程Id不能为空"); return R.error("流程Id不能为空");
} }

2
base-fast/src/main/java/com/boge/modules/sys/entity/SysUserEntity.java

@ -96,4 +96,6 @@ public class SysUserEntity implements Serializable {
private String wexinId; private String wexinId;
} }

14
base-fast/src/main/java/com/boge/modules/sys/service/impl/SysUserServiceImpl.java

@ -89,10 +89,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserDao, SysUserEntity> i
user.setPassword(new Sha256Hash(user.getPassword(), salt).toHex()); user.setPassword(new Sha256Hash(user.getPassword(), salt).toHex());
user.setSalt(salt); user.setSalt(salt);
this.save(user); this.save(user);
//检查角色是否越权 //检查角色是否越权
checkRole(user); checkRole(user);
//保存用户与角色关系 //保存用户与角色关系
sysUserRoleService.saveOrUpdate(user.getUserId(), user.getRoleIdList()); sysUserRoleService.saveOrUpdate(user.getUserId(), user.getRoleIdList());
} }
@ -106,10 +106,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserDao, SysUserEntity> i
user.setPassword(new Sha256Hash(user.getPassword(), user.getSalt()).toHex()); user.setPassword(new Sha256Hash(user.getPassword(), user.getSalt()).toHex());
} }
this.updateById(user); this.updateById(user);
//检查角色是否越权 //检查角色是否越权
//checkRole(user); //checkRole(user);
//保存用户与角色关系 //保存用户与角色关系
sysUserRoleService.saveOrUpdate(user.getUserId(), user.getRoleIdList()); sysUserRoleService.saveOrUpdate(user.getUserId(), user.getRoleIdList());
} }
@ -143,7 +143,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserDao, SysUserEntity> i
/*if(user.getCreateUserId() == Constant.SUPER_ADMIN){ /*if(user.getCreateUserId() == Constant.SUPER_ADMIN){
return ; return ;
}*/ }*/
//查询用户创建的角色列表 //查询用户创建的角色列表
List<Long> roleIdList = sysRoleService.queryRoleIdList(user.getCreateUserId()); List<Long> roleIdList = sysRoleService.queryRoleIdList(user.getCreateUserId());
@ -152,4 +152,6 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserDao, SysUserEntity> i
throw new RRException("新增用户所选角色,不是本人创建"); throw new RRException("新增用户所选角色,不是本人创建");
} }
} }
}
}

5
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.Arrays;
import java.util.Map; import java.util.Map;
import com.boge.modules.tickets.dto.TicketsDTO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
@ -48,9 +49,9 @@ public class TicketsController {
@RequestMapping("/info/{ticketsId}") @RequestMapping("/info/{ticketsId}")
//@RequiresPermissions("tickets:tickets:info") //@RequiresPermissions("tickets:tickets:info")
public R info(@PathVariable("ticketsId") String ticketsId){ 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);
} }
/** /**

9
base-fast/src/main/java/com/boge/modules/tickets/dao/TicketsDao.java

@ -1,17 +1,20 @@
package com.boge.modules.tickets.dao; package com.boge.modules.tickets.dao;
import com.boge.modules.tickets.dto.TicketsDTO;
import com.boge.modules.tickets.entity.TicketsEntity; import com.boge.modules.tickets.entity.TicketsEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
/** /**
* *
* *
* @author ls * @author ls
* @email dengpbs@163.com * @email dengpbs@163.com
* @date 2025-03-05 14:29:12 * @date 2025-03-05 14:29:12
*/ */
@Mapper @Mapper
public interface TicketsDao extends BaseMapper<TicketsEntity> { public interface TicketsDao extends BaseMapper<TicketsEntity> {
TicketsDTO getTicketsDTOById(String ticketsId);
} }

78
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;
}

6
base-fast/src/main/java/com/boge/modules/tickets/entity/TicketsEntity.java

@ -78,6 +78,8 @@ public class TicketsEntity implements Serializable {
*/ */
private String processInstance; private String processInstance;
/**
* 指派人ID
*/
private Long assignUserId;
} }

5
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.baomidou.mybatisplus.extension.service.IService;
import com.boge.common.utils.PageUtils; import com.boge.common.utils.PageUtils;
import com.boge.modules.tickets.dto.TicketsDTO;
import com.boge.modules.tickets.entity.TicketsEntity; import com.boge.modules.tickets.entity.TicketsEntity;
import java.util.Map; import java.util.Map;
/** /**
* *
* *
* @author ls * @author ls
* @email dengpbs@163.com * @email dengpbs@163.com
@ -16,5 +17,7 @@ import java.util.Map;
public interface TicketsService extends IService<TicketsEntity> { public interface TicketsService extends IService<TicketsEntity> {
PageUtils queryPage(Map<String, Object> params); PageUtils queryPage(Map<String, Object> params);
TicketsDTO getTicketsById(String ticketsId);
} }

53
base-fast/src/main/java/com/boge/modules/tickets/service/impl/TicketsServiceImpl.java

@ -1,7 +1,23 @@
package com.boge.modules.tickets.service.impl; 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 org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -16,14 +32,43 @@ import com.boge.modules.tickets.service.TicketsService;
@Service("ticketsService") @Service("ticketsService")
public class TicketsServiceImpl extends ServiceImpl<TicketsDao, TicketsEntity> implements TicketsService { public class TicketsServiceImpl extends ServiceImpl<TicketsDao, TicketsEntity> implements TicketsService {
@Autowired
TicketsDao ticketsDao;
@Autowired
private SysDictMapper sysDictMapper;
@Autowired
private SysUserServiceImpl sysUserService;
@Autowired
private SysUserRoleService sysUserRoleService;
@Override @Override
public PageUtils queryPage(Map<String, Object> params) { public PageUtils queryPage(Map<String, Object> params) {
IPage<TicketsEntity> page = this.page( SysUserEntity loginUser = ShiroUtils.getUserEntity();
new Query<TicketsEntity>().getPage(params), QueryWrapper<TicketsEntity> ticketsEntityQueryWrapper = new QueryWrapper<>();
new QueryWrapper<TicketsEntity>() if (ObjectUtil.isNotEmpty(loginUser)){
List<Long> 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<TicketsEntity> page = this.page(new Query<TicketsEntity>().getPage(params),
ticketsEntityQueryWrapper
); );
return new PageUtils(page); return new PageUtils(page);
} }
} @Override
public TicketsDTO getTicketsById(String ticketsId) {
TicketsDTO tickets = ticketsDao.getTicketsDTOById(ticketsId);
return tickets;
}
}

10
base-fast/src/main/resources/mapper/tickets/TicketsDao.xml

@ -8,7 +8,7 @@
<result property="ticketsId" column="tickets_id"/> <result property="ticketsId" column="tickets_id"/>
<result property="carType" column="car_type"/> <result property="carType" column="car_type"/>
<result property="errorType" column="error_type"/> <result property="errorType" column="error_type"/>
<result property="contractNumber" column="contract_number"/> <result property="contractId" column="contract_number"/>
<result property="clientId" column="client_id"/> <result property="clientId" column="client_id"/>
<result property="description" column="description"/> <result property="description" column="description"/>
<result property="deptPeople" column="dept_people"/> <result property="deptPeople" column="dept_people"/>
@ -19,6 +19,14 @@
<result property="status" column="status"/> <result property="status" column="status"/>
<result property="updateTime" column="update_time"/> <result property="updateTime" column="update_time"/>
</resultMap> </resultMap>
<select id="getTicketsDTOById" resultType="com.boge.modules.tickets.dto.TicketsDTO" parameterType="java.lang.String">
select * from sys_tickets as a
left join sys_client as b on a.client_id = b.client_id
left join sys_car as c on a.car_type = c.car_id
left join sys_contract as d on a.contract_id = d.contract_id
where a.tickets_id = #{ticketsId}
</select>
</mapper> </mapper>

Loading…
Cancel
Save