更新检测相关功能

This commit is contained in:
许允枞 2024-11-02 18:04:35 +08:00
parent d3b94ada16
commit 327bc236c5
7 changed files with 102 additions and 41 deletions

View File

@ -23,8 +23,7 @@ import cn.iocoder.yudao.module.core.controller.BaseController;
*/
@RestController
@RequestMapping("/admin-api/system/info")
public class InspectionInfoController extends BaseController
{
public class InspectionInfoController extends BaseController {
@Autowired
private IInspectionInfoService inspectionInfoService;
@ -37,11 +36,10 @@ public class InspectionInfoController extends BaseController
@PreAuthorize("@ss.hasPermi('system:info:list')")
@GetMapping("/list")
public CommonResult list(InspectionInfo inspectionInfo,
@RequestParam(value = "pageNum" ,required = false ,defaultValue = "1") Integer pageNum,
@RequestParam(value ="pageSize" ,required = false ,defaultValue = "10") Integer pageSize)
{
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
Page<InspectionInfo> page = new Page<>(pageNum, pageSize);
IPage<InspectionInfo> list = inspectionInfoService.selectInspectionInfoList(page,inspectionInfo);
IPage<InspectionInfo> list = inspectionInfoService.selectInspectionInfoList(page, inspectionInfo);
return success(list);
}
@ -51,11 +49,10 @@ public class InspectionInfoController extends BaseController
@PreAuthorize("@ss.hasPermi('system:info:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, InspectionInfo inspectionInfo,
@RequestParam(value = "pageNum" ,required = false ,defaultValue = "1") Integer pageNum,
@RequestParam(value ="pageSize" ,required = false ,defaultValue = "10") Integer pageSize)
{
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
Page<InspectionInfo> page = new Page<>(pageNum, pageSize);
IPage<InspectionInfo> list = inspectionInfoService.selectInspectionInfoList(page,inspectionInfo);
IPage<InspectionInfo> list = inspectionInfoService.selectInspectionInfoList(page, inspectionInfo);
ExcelUtil<InspectionInfo> util = new ExcelUtil<InspectionInfo>(InspectionInfo.class);
util.exportExcel(response, list.getRecords(), "【请填写功能名称】数据");
}
@ -65,8 +62,7 @@ public class InspectionInfoController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('system:info:query')")
@GetMapping(value = "/{id}")
public CommonResult getInfo(@PathVariable("id") Long id)
{
public CommonResult getInfo(@PathVariable("id") Long id) {
return success(inspectionInfoService.selectInspectionInfoById(id));
}
@ -83,7 +79,7 @@ public class InspectionInfoController extends BaseController
* 清账
*/
@PostMapping("/settleAccounts")
public CommonResult settleAccounts(Long InspectionId){
public CommonResult settleAccounts(Long InspectionId) {
inspectionInfoService.settleAccounts(InspectionId);
return success();
}
@ -96,42 +92,45 @@ public class InspectionInfoController extends BaseController
@PostMapping("/del")
public CommonResult remove(@RequestParam("id") Long id)
{
public CommonResult remove(@RequestParam("id") Long id) {
return toAjax(inspectionInfoService.deleteInspectionInfoByIds(id));
}
/**
* 根据当前登陆人获取可以选择的工单
*
* @return
*/
@GetMapping("geStelectInspection")
public CommonResult geStelectInspection(@RequestParam(value = "pageNum" ,required = false ,defaultValue = "1") Integer pageNum,
@RequestParam(value ="pageSize" ,required = false ,defaultValue = "10") Integer pageSize){
public CommonResult geStelectInspection(InspectionInfo inspectionInfo,
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
Page<InspectionInfo> page = new Page<>(pageNum, pageSize);
return success(inspectionInfoService.geStelectInspection(page));
return success(inspectionInfoService.geStelectInspection(page,inspectionInfo));
}
/**
* 获取工单详情
*
* @param inspectionId 工单id
* @param workNodeId 节点id geStelectInspection这个方法中返回了
* @param workNodeId 节点id geStelectInspection这个方法中返回了
* @return
*/
@GetMapping("getInspectionInfo")
public CommonResult getInspectionInfo(Integer inspectionId, Integer workNodeId){
return success(inspectionInfoService.getWorkNode(inspectionId,workNodeId));
public CommonResult getInspectionInfo(Integer inspectionId, Integer workNodeId) {
return success(inspectionInfoService.getWorkNode(inspectionId, workNodeId));
}
/**
* 员工接单
*
* @param inspectionId 工单id
* @param workNodeId 节点id geStelectInspection这个方法中返回了
* @param workNodeId 节点id geStelectInspection这个方法中返回了
* @return
*/
@PostMapping("orderTaking")
public CommonResult orderTaking(Integer inspectionId, Integer workNodeId){
inspectionWorkNodeService.updateInspectionWorkNode(inspectionId,workNodeId);
public CommonResult orderTaking(Integer inspectionId, Integer workNodeId) {
inspectionWorkNodeService.updateInspectionWorkNode(inspectionId, workNodeId);
return success("接单成功");
}
}

View File

@ -153,4 +153,6 @@ public class InspectionInfo extends TenantBaseDO
/** 流程节点id*/
@TableField(exist = false)
private String workNodeId;
@TableField(exist = false)
private Long dealUserId;
}

View File

@ -92,5 +92,5 @@ public interface InspectionInfoMapper extends BaseMapper<InspectionInfo>
* @param page
* @return
*/
IPage<InspectionInfo> selectByUser(@Param("page") IPage page, @Param("roleIds") List<Long> roleIds);
IPage<InspectionInfo> selectByUser(@Param("page") IPage page, @Param("roleIds") List<Long> roleIds,@Param("inspectionInfo") InspectionInfo inspectionInfo);
}

View File

@ -80,7 +80,7 @@ public interface IInspectionInfoService extends IService<InspectionInfo>
* 根据当前登陆人获取可以选择的工单
* @return
*/
IPage<InspectionInfo> geStelectInspection(IPage page);
IPage<InspectionInfo> geStelectInspection(IPage page,InspectionInfo inspectionInfo);
/**
* 获取工单详情

View File

@ -379,13 +379,17 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
* @return
*/
@Override
public IPage<InspectionInfo> geStelectInspection(IPage page) {
public IPage<InspectionInfo> geStelectInspection(IPage page,InspectionInfo inspectionInfo) {
//获取当前登录人
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
//获取当前登陆人的角色
List<UserRoleDO> byUserId = roleService.getByUserId(loginUser.getId());
List<Long> roleIds = byUserId.stream().map(UserRoleDO::getRoleId).collect(Collectors.toList());
return baseMapper.selectByUser(page,roleIds);
if("2".equals(inspectionInfo.getStatus())){
//进行中
inspectionInfo.setDealUserId(loginUser.getId());
}
return baseMapper.selectByUser(page,roleIds,inspectionInfo);
}
/**

View File

@ -81,6 +81,18 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
*/
@Override
public void updateImageAndStep(InspectionWorkNode inspectionWorkNode) {
switch (inspectionWorkNode.getSelectType()) {
case 1:
//退办理
returnInspectionInfo(inspectionWorkNode);
return;
case 2:
//选择重审
break;
case 3:
//项目完成
break;
}
//根据流程id获取流程
InspectionWorkNode workNode = this.getById(inspectionWorkNode.getId());
@ -150,4 +162,30 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
}
return false;
}
/**
* 退办理
* @param inspectionWorkNode
*/
public void returnInspectionInfo(InspectionWorkNode inspectionWorkNode){
//通过工单id获取工单
InspectionInfo info = inspectionInfoService.getById(inspectionWorkNode.getInspectionInfoId());
info.setIsPass("0");
info.setEndTime(DateUtil.date());
info.setStatus("1");
inspectionInfoService.updateById(info);
}
/**
* 重审
* @param inspectionWorkNode
*/
public void retrial(InspectionWorkNode inspectionWorkNode) {
//通过流程节点id查询流程
InspectionWorkNode workNode = this.getById(inspectionWorkNode.getId());
//通过工单id获取工单
InspectionInfo info = inspectionInfoService.getById(inspectionWorkNode.getInspectionInfoId());
info.setIsRetrial("1");
info.setNowOrderNum(workNode.getOrderNum());
}
}

View File

@ -268,20 +268,38 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectByUser" resultType="cn.iocoder.yudao.module.inspection.entity.InspectionInfo">
SELECT
ii.*,
iwn.id AS workNodeId
ii.*,
iwn.id AS workNodeId
FROM
inspection_info ii
JOIN
inspection_work_node iwn ON ii.id = iwn.inspection_info_id
WHERE
ii.status = '0' -- 工单正在进行中
AND ii.now_order_num = iwn.order_num -- 当前工单步骤与流程节点顺序一致
AND iwn.status = '0' -- 流程节点状态为待开始
AND iwn.role_id IN
<foreach collection="roleIds" item="roleId" open="(" separator="," close=")">
#{roleId}
</foreach>
inspection_info ii
JOIN
inspection_work_node iwn ON ii.id = iwn.inspection_info_id
<where>
-- ii.status = '0' -- 工单正在进行中
-- ii.now_order_num = iwn.order_num -- 当前工单步骤与流程节点顺序一致
-- AND iwn.status = '0' -- 流程节点状态为待开始
AND iwn.role_id IN
<foreach collection="roleIds" item="roleId" open="(" separator="," close=")">
#{roleId}
</foreach>
<if test="inspectionInfo.carNum != null">
AND ii.car_num like concat('%',#{inspectionInfo.carNum},'%')
</if>
-- 待接受
<if test="inspectionInfo.status == 1">
AND ii.status = '0' AND iwn.status = '0' AND ii.now_order_num = iwn.order_num
</if>
-- 进行中
<if test="inspectionInfo.status == 2">
AND ii.status = '0' AND iwn.status = '1' AND iwn.deal_user_id = #{inspectionInfo.dealUserId}
</if>
-- 已完成
<if test="inspectionInfo.status == 3">
AND iwn.status = '2' AND iwn.deal_user_id = #{inspectionInfo.dealUserId}
</if>
</where>
</select>
</mapper>