mirror of
https://gitee.com/elegant_wings/dbd-meeting.git
synced 2025-06-22 01:19:37 +08:00
工单附件更新
This commit is contained in:
parent
eeb79b6844
commit
0d0b5f2552
@ -1,25 +1,34 @@
|
|||||||
package com.ics.admin.controller;
|
package com.ics.admin.controller;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import com.ics.common.core.domain.R;
|
|
||||||
import com.ics.common.core.controller.BaseController;
|
|
||||||
import com.ics.admin.domain.RepairAttach;
|
import com.ics.admin.domain.RepairAttach;
|
||||||
import com.ics.admin.service.IRepairAttachService;
|
import com.ics.admin.service.IRepairAttachService;
|
||||||
|
import com.ics.admin.vo.RepairAttachVO;
|
||||||
|
import com.ics.common.core.controller.BaseController;
|
||||||
|
import com.ics.common.core.domain.R;
|
||||||
|
import com.ics.common.utils.StringUtils;
|
||||||
|
import com.ics.common.utils.file.FileUploadUtils;
|
||||||
|
import com.ics.system.config.DfsConfig;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
import org.wf.jwtp.annotation.Logical;
|
||||||
import org.wf.jwtp.annotation.RequiresPermissions;
|
import org.wf.jwtp.annotation.RequiresPermissions;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 附件 提供者
|
* 附件
|
||||||
*
|
*
|
||||||
* @author chen
|
* @author chen
|
||||||
* @date 2024-07-31
|
* @date 2024-07-31
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("repairAttach")
|
@RequestMapping("repairAttach")
|
||||||
public class RepairAttachController extends BaseController {
|
public class RepairAttachController extends BaseController {
|
||||||
@ -27,50 +36,127 @@ public class RepairAttachController extends BaseController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IRepairAttachService repairAttachService;
|
private IRepairAttachService repairAttachService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DfsConfig dfsConfig;
|
||||||
|
|
||||||
|
private final static String FILE_VOICE = "voice";
|
||||||
|
|
||||||
|
private final static String FILE_IMG = "img/video";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询附件
|
* 保修上传语音
|
||||||
*/
|
*/
|
||||||
@GetMapping("get/{id}")
|
@RequiresPermissions(value = {"repair:attach:operator", "member:center:view"}, logical = Logical.OR)
|
||||||
public RepairAttach get(@PathVariable("id") Long id) {
|
@PostMapping("upload/voice")
|
||||||
return repairAttachService.selectRepairAttachById(id);
|
public R voiceUpload(MultipartFile file) {
|
||||||
|
return processAttache(file, null, 1, FILE_VOICE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询附件列表
|
* 保修上传图片视频
|
||||||
|
*
|
||||||
|
* @param file
|
||||||
|
* @param repairId 工单id
|
||||||
|
* @param operate 操作 repair\feedback\eval
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("admin:attach:list")
|
@RequiresPermissions(value = {"repair:attach:operator", "member:center:view"}, logical = Logical.OR)
|
||||||
@GetMapping("list")
|
@PostMapping("upload")
|
||||||
public R list(RepairAttach repairAttach) {
|
public R Upload(MultipartFile file, Long repairId, String operate) {
|
||||||
startPage();
|
int nodeId = 0;
|
||||||
return result(repairAttachService.selectRepairAttachList(repairAttach));
|
if (StringUtils.isNotBlank(operate)) {
|
||||||
|
if ("repair".equals(operate)) nodeId = 1;
|
||||||
|
if ("feedback".equals(operate)) nodeId = 9;
|
||||||
|
if ("eval".equals(operate)) nodeId = 13;
|
||||||
|
}
|
||||||
|
if (nodeId == 0) return R.error("无效参数");
|
||||||
|
if ((nodeId == 9 || nodeId == 13) && repairId == null) return R.error("无效参数");
|
||||||
|
return processAttache(file, repairId, nodeId, FILE_IMG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
private R processAttache(MultipartFile file, Long repairId, int nodeId, String type) {
|
||||||
* 新增保存附件
|
String originalFilename = file.getOriginalFilename();
|
||||||
*/
|
long size = file.getSize();
|
||||||
@RequiresPermissions("admin:attach:add")
|
Long userId = getLoginStaffId();
|
||||||
@PostMapping("save")
|
if (userId == null) return R.error("未找到有效微信用户");
|
||||||
public R addSave(@RequestBody RepairAttach repairAttach) {
|
try {
|
||||||
return toAjax(repairAttachService.insertRepairAttach(repairAttach));
|
// 上传文件路径
|
||||||
|
String filePath = dfsConfig.getPath();
|
||||||
|
// 上传并返回新文件名称
|
||||||
|
String url = FileUploadUtils.upload(filePath, file);
|
||||||
|
RepairAttach repairAttach = new RepairAttach();
|
||||||
|
repairAttach.setRepairId(repairId);
|
||||||
|
repairAttach.setNodeId(nodeId);
|
||||||
|
repairAttach.setOriginalFilename(originalFilename);
|
||||||
|
repairAttach.setUrl(url);
|
||||||
|
repairAttach.setFileSize(size);
|
||||||
|
repairAttach.setExt1(type);
|
||||||
|
repairAttach.setDeleteFlag(0);
|
||||||
|
repairAttach.setCreateTime(new Date());
|
||||||
|
repairAttach.setCreateBy(userId.toString());
|
||||||
|
repairAttachService.insertRepairAttach(repairAttach);//插入附件数据
|
||||||
|
return R.ok().put("id", repairAttach.getId())
|
||||||
|
.put("originalFilename", originalFilename)
|
||||||
|
.put("url", dfsConfig.getDomain() + url);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("上传文件失败", e);
|
||||||
|
return R.error(e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改保存附件
|
* 删除附件,用户删除自己的附件
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("admin:attach:edit")
|
@RequiresPermissions(value = {"repair:attach:operator", "member:center:view"}, logical = Logical.OR)
|
||||||
@PostMapping("update")
|
|
||||||
public R editSave(@RequestBody RepairAttach repairAttach) {
|
|
||||||
return toAjax(repairAttachService.updateRepairAttach(repairAttach));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除附件
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("admin:attach:remove")
|
|
||||||
@PostMapping("remove")
|
@PostMapping("remove")
|
||||||
public R remove(String ids) {
|
public R remove(Long id) {
|
||||||
return toAjax(repairAttachService.deleteRepairAttachByIds(ids));
|
Long userId = getLoginStaffId();
|
||||||
|
if (userId == null) return R.error("未找到有效微信用户");
|
||||||
|
return toAjax(repairAttachService.deleteRepairAttachById(id, userId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除附件,管理员删除指定附件
|
||||||
|
*/
|
||||||
|
@RequiresPermissions(value = {"repair:attach:operator"})
|
||||||
|
@PostMapping("delete")
|
||||||
|
public R delete(Long id) {
|
||||||
|
return toAjax(repairAttachService.deleteRepairAttachById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询工单所有附件
|
||||||
|
*/
|
||||||
|
@RequiresPermissions(value = {"repair:attach:operator", "member:center:view"}, logical = Logical.OR)
|
||||||
|
@GetMapping("list")
|
||||||
|
public R list(Long repairId) {
|
||||||
|
List<RepairAttach> list = repairAttachService.getListByRepair(repairId);//工单所有附件
|
||||||
|
List<RepairAttachVO> voices = new ArrayList<>();
|
||||||
|
List<RepairAttachVO> repairs = new ArrayList<>();
|
||||||
|
List<RepairAttachVO> feedbacks = new ArrayList<>();
|
||||||
|
List<RepairAttachVO> evals = new ArrayList<>();
|
||||||
|
for (RepairAttach repairAttach : list) {
|
||||||
|
RepairAttachVO repairAttachVO = new RepairAttachVO(repairAttach.getId(), repairAttach.getUrl());
|
||||||
|
if (repairAttach.getNodeId() == 1) {
|
||||||
|
if (FILE_VOICE.equals(repairAttach.getExt1())) voices.add(repairAttachVO);
|
||||||
|
if (FILE_IMG.equals(repairAttach.getExt1())) repairs.add(repairAttachVO);
|
||||||
|
}
|
||||||
|
if (repairAttach.getNodeId() == 9) feedbacks.add(repairAttachVO);
|
||||||
|
if (repairAttach.getNodeId() == 13) evals.add(repairAttachVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
return R.ok().put("voice", voices)
|
||||||
|
.put("repair", repairs)
|
||||||
|
.put("feedback", feedbacks)
|
||||||
|
.put("eval", evals);
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Ignore
|
||||||
|
// @PostMapping("test")
|
||||||
|
// public R test(Long repairId) {
|
||||||
|
// //repairAttachService.updateRepairAttach(repairId,ids);
|
||||||
|
// return toAjax(repairAttachService.deleteByRepairId(repairId));
|
||||||
|
// //return R.ok();
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ public class Repair extends BaseEntity<Repair> {
|
|||||||
/**
|
/**
|
||||||
* 设备类别id
|
* 设备类别id
|
||||||
*/
|
*/
|
||||||
private Integer typeId;
|
private Long typeId;
|
||||||
/**
|
/**
|
||||||
* 设备类别名称
|
* 设备类别名称
|
||||||
*/
|
*/
|
||||||
@ -46,7 +46,7 @@ public class Repair extends BaseEntity<Repair> {
|
|||||||
/**
|
/**
|
||||||
* 设备id
|
* 设备id
|
||||||
*/
|
*/
|
||||||
private Integer deviceId;
|
private Long deviceId;
|
||||||
/**
|
/**
|
||||||
* 设备名称
|
* 设备名称
|
||||||
*/
|
*/
|
||||||
@ -91,12 +91,12 @@ public class Repair extends BaseEntity<Repair> {
|
|||||||
/**
|
/**
|
||||||
* 派单员id
|
* 派单员id
|
||||||
*/
|
*/
|
||||||
private long perUserId;
|
private Long perUserId;
|
||||||
/**
|
/**
|
||||||
* 派单员姓名
|
* 派单员姓名
|
||||||
*/
|
*/
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String perUserrName;
|
private String perUserName;
|
||||||
/**
|
/**
|
||||||
* 预计完成时间
|
* 预计完成时间
|
||||||
*/
|
*/
|
||||||
@ -130,7 +130,7 @@ public class Repair extends BaseEntity<Repair> {
|
|||||||
/**
|
/**
|
||||||
* 维修人员id
|
* 维修人员id
|
||||||
*/
|
*/
|
||||||
private long repairUserId;
|
private Long repairUserId;
|
||||||
/**
|
/**
|
||||||
* 维修人员姓名
|
* 维修人员姓名
|
||||||
*/
|
*/
|
||||||
@ -197,7 +197,7 @@ public class Repair extends BaseEntity<Repair> {
|
|||||||
/**
|
/**
|
||||||
* 当前日志记录id
|
* 当前日志记录id
|
||||||
*/
|
*/
|
||||||
private long logId;
|
private Long logId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 备注
|
* 备注
|
||||||
|
@ -3,6 +3,7 @@ package com.ics.admin.mapper;
|
|||||||
import com.ics.admin.domain.RepairAttach;
|
import com.ics.admin.domain.RepairAttach;
|
||||||
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;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -24,11 +25,13 @@ public interface RepairAttachMapper extends BaseMapper<RepairAttach> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询附件列表
|
* 查询附件列表
|
||||||
|
* <p>
|
||||||
|
* 环节id 1保修 9维修工反馈附件 13 评价附件
|
||||||
*
|
*
|
||||||
* @param repairAttach 附件
|
* @param repairId 工单id
|
||||||
* @return 附件集合
|
* @return 附件集合
|
||||||
*/
|
*/
|
||||||
List<RepairAttach> selectRepairAttachList(RepairAttach repairAttach);
|
List<RepairAttach> selectRepairAttachList(@Param("repairId") Long repairId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增附件
|
* 新增附件
|
||||||
@ -39,12 +42,21 @@ public interface RepairAttachMapper extends BaseMapper<RepairAttach> {
|
|||||||
int insertRepairAttach(RepairAttach repairAttach);
|
int insertRepairAttach(RepairAttach repairAttach);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改附件
|
* 更新附件数据 将指定附件与指定工单关联
|
||||||
*
|
*
|
||||||
* @param repairAttach 附件
|
* @param repairId 工单id
|
||||||
|
* @param ids 附件id数组
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
int updateRepairAttach(RepairAttach repairAttach);
|
int updateRepairAttachs(@Param("repairId") Long repairId, @Param("ids") String[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除工单附件
|
||||||
|
*
|
||||||
|
* @param repairId 工单ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int deleteByRepairId(Long repairId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除附件
|
* 删除附件
|
||||||
@ -54,11 +66,4 @@ public interface RepairAttachMapper extends BaseMapper<RepairAttach> {
|
|||||||
*/
|
*/
|
||||||
int deleteRepairAttachById(Long id);
|
int deleteRepairAttachById(Long id);
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除附件
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的数据ID
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
int deleteRepairAttachByIds(String[] ids);
|
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,19 @@ public interface RepairRelationalMapper extends BaseMapper<RepairRelational> {
|
|||||||
*/
|
*/
|
||||||
RepairRelational selectRepairRelationalById(Long id);
|
RepairRelational selectRepairRelationalById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据类型id获取 相应的派单员及维修人员
|
||||||
|
* @param typeID 设备类型id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<RepairRelational> selectRepairRelationalByTypeId(Long typeID);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据类型id获取 相应的派单员及
|
||||||
|
* @param typeID 设备类型id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<RepairRelational> selectDispatcherByTypeId(Long typeID);
|
||||||
/**
|
/**
|
||||||
* 查询设备类型与派单员、维修人员的关联关系列表
|
* 查询设备类型与派单员、维修人员的关联关系列表
|
||||||
*
|
*
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
package com.ics.admin.service;
|
package com.ics.admin.service;
|
||||||
|
|
||||||
import com.ics.admin.domain.RepairAttach;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.ics.common.core.domain.IcsCustomerStaff;
|
import com.ics.admin.domain.RepairAttach;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -13,45 +12,39 @@ import java.util.List;
|
|||||||
* @date 2024-07-31
|
* @date 2024-07-31
|
||||||
*/
|
*/
|
||||||
public interface IRepairAttachService extends IService<RepairAttach> {
|
public interface IRepairAttachService extends IService<RepairAttach> {
|
||||||
/**
|
|
||||||
* 查询附件
|
|
||||||
*
|
|
||||||
* @param id 附件ID
|
|
||||||
* @return 附件
|
|
||||||
*/
|
|
||||||
RepairAttach selectRepairAttachById(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询附件列表
|
|
||||||
*
|
|
||||||
* @param repairAttach 附件
|
|
||||||
* @return 附件集合
|
|
||||||
*/
|
|
||||||
List<RepairAttach> selectRepairAttachList(RepairAttach repairAttach);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增附件
|
* 新增附件
|
||||||
*
|
*
|
||||||
* @param repairAttach 附件
|
* @param repairAttach 附件
|
||||||
* @return 结果
|
* @return
|
||||||
*/
|
*/
|
||||||
int insertRepairAttach(RepairAttach repairAttach);
|
int insertRepairAttach(RepairAttach repairAttach);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改附件
|
* 提交表单后更新附件数据,将自动的附件数据关联为指定工单
|
||||||
*
|
*
|
||||||
* @param repairAttach 附件
|
* @param ids 附件id数组
|
||||||
* @return 结果
|
* @param repairId 工单id
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
int updateRepairAttach(RepairAttach repairAttach);
|
int updateRepairAttach(long repairId, String[] ids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除附件
|
* 查询工单所有附件
|
||||||
*
|
*
|
||||||
* @param ids 需要删除的数据ID
|
* @param repairId 工单id
|
||||||
* @return 结果
|
* @return
|
||||||
*/
|
*/
|
||||||
int deleteRepairAttachByIds(String ids);
|
List<RepairAttach> getListByRepair(long repairId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除工单附件
|
||||||
|
*
|
||||||
|
* @param repairId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int deleteByRepairId(long repairId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除附件信息
|
* 删除附件信息
|
||||||
@ -61,4 +54,13 @@ public interface IRepairAttachService extends IService<RepairAttach> {
|
|||||||
*/
|
*/
|
||||||
int deleteRepairAttachById(Long id);
|
int deleteRepairAttachById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除指定用户的指定附件
|
||||||
|
*
|
||||||
|
* @param id 附件id
|
||||||
|
* @param userId 用户id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int deleteRepairAttachById(Long id, Long userId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,19 @@ import java.util.List;
|
|||||||
* @date 2021-03-25
|
* @date 2021-03-25
|
||||||
*/
|
*/
|
||||||
public interface IRepairService extends IService<Repair> {
|
public interface IRepairService extends IService<Repair> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理流程
|
||||||
|
* @return okay 表示处理成功
|
||||||
|
*/
|
||||||
|
String handleFlow(Repair repair, Long currentUserId, Long nextUserId, String[] files, String content, String operate);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 评价
|
||||||
|
*/
|
||||||
|
void eval(Repair repair, Long currentUserId);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询工单
|
* 查询工单
|
||||||
*
|
*
|
||||||
|
@ -1,99 +1,92 @@
|
|||||||
package com.ics.admin.service.impl;
|
package com.ics.admin.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.ics.admin.mapper.IcsCustomerStaffMapper;
|
import com.ics.admin.domain.RepairAttach;
|
||||||
import com.ics.common.core.domain.IcsCustomerStaff;
|
import com.ics.admin.mapper.RepairAttachMapper;
|
||||||
|
import com.ics.admin.service.IRepairAttachService;
|
||||||
|
import com.ics.common.utils.StringUtils;
|
||||||
|
import com.ics.common.utils.file.FileUtils;
|
||||||
|
import com.ics.system.config.DfsConfig;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.ics.admin.mapper.RepairAttachMapper;
|
|
||||||
import com.ics.admin.domain.RepairAttach;
|
import java.util.List;
|
||||||
import com.ics.admin.service.IRepairAttachService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 附件Service业务层处理
|
* 附件Service业务层处理
|
||||||
*
|
*
|
||||||
* @author chen
|
* @author chen
|
||||||
* @date 2024-07-31
|
* @date 2024-07-31
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class RepairAttachServiceImpl extends ServiceImpl<RepairAttachMapper, RepairAttach> implements IRepairAttachService {
|
public class RepairAttachServiceImpl extends ServiceImpl<RepairAttachMapper, RepairAttach> implements IRepairAttachService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RepairAttachMapper repairAttachMapper;
|
private RepairAttachMapper repairAttachMapper;
|
||||||
|
|
||||||
/**
|
@Autowired
|
||||||
* 查询附件
|
private DfsConfig dfsConfig;
|
||||||
*
|
|
||||||
* @param id 附件ID
|
|
||||||
* @return 附件
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public RepairAttach selectRepairAttachById(Long id) {
|
|
||||||
return repairAttachMapper.selectById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询附件列表
|
|
||||||
*
|
|
||||||
* @param repairAttach 附件
|
|
||||||
* @return 附件
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<RepairAttach> selectRepairAttachList(RepairAttach repairAttach) {
|
|
||||||
QueryWrapper queryWrapper = new QueryWrapper();
|
|
||||||
return repairAttachMapper.selectList(queryWrapper);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增附件
|
|
||||||
*
|
|
||||||
* @param repairAttach 附件
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public int insertRepairAttach(RepairAttach repairAttach) {
|
public int insertRepairAttach(RepairAttach repairAttach) {
|
||||||
return repairAttachMapper.insert(repairAttach);
|
return repairAttachMapper.insertRepairAttach(repairAttach);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改附件
|
|
||||||
*
|
|
||||||
* @param repairAttach 附件
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public int updateRepairAttach(RepairAttach repairAttach) {
|
public int updateRepairAttach(long repairId, String[] ids) {
|
||||||
return repairAttachMapper.updateById(repairAttach);
|
return repairAttachMapper.updateRepairAttachs(repairId, ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除附件对象
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的数据ID
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public int deleteRepairAttachByIds(String ids) {
|
public List<RepairAttach> getListByRepair(long repairId) {
|
||||||
String[] idsArray = StrUtil.split(ids,",");
|
return repairAttachMapper.selectRepairAttachList(repairId);
|
||||||
return repairAttachMapper.deleteBatchIds(CollUtil.toList(idsArray));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* 删除附件信息
|
public int deleteByRepairId(long repairId) {
|
||||||
*
|
List<RepairAttach> list = repairAttachMapper.selectRepairAttachList(repairId);
|
||||||
* @param id 附件ID
|
for (RepairAttach repairAttach : list) {
|
||||||
* @return 结果
|
deleteFile(repairAttach.getUrl());
|
||||||
*/
|
}
|
||||||
|
return repairAttachMapper.deleteByRepairId(repairId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int deleteRepairAttachById(Long id) {
|
public int deleteRepairAttachById(Long id) {
|
||||||
return repairAttachMapper.deleteRepairAttachById(id);
|
RepairAttach repairAttach = repairAttachMapper.selectRepairAttachById(id);
|
||||||
|
if (repairAttach != null) {
|
||||||
|
deleteFile(repairAttach.getUrl());
|
||||||
|
return repairAttachMapper.deleteRepairAttachById(id);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int deleteRepairAttachById(Long id, Long userId) {
|
||||||
|
RepairAttach repairAttach = repairAttachMapper.selectRepairAttachById(id);
|
||||||
|
if (repairAttach != null) {
|
||||||
|
if (userId.toString().equals(repairAttach.getCreateBy())) {//用户只能删除自己的附件
|
||||||
|
deleteFile(repairAttach.getUrl());
|
||||||
|
return repairAttachMapper.deleteRepairAttachById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物理删除附件
|
||||||
|
*
|
||||||
|
* @param url 表中url字段
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private boolean deleteFile(String url) {
|
||||||
|
if (StringUtils.isBlank(url)) return false;
|
||||||
|
String filePath = dfsConfig.getPath() + url.substring(8);//去除 /profile
|
||||||
|
return FileUtils.deleteFile(filePath);//物理删除
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,29 +2,29 @@ package com.ics.admin.service.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.ics.admin.domain.Repair;
|
import com.ics.admin.domain.Repair;
|
||||||
import com.ics.admin.domain.RepairLog;
|
import com.ics.admin.domain.RepairLog;
|
||||||
import com.ics.admin.domain.RepairAttach;
|
import com.ics.admin.domain.RepairRelational;
|
||||||
import com.ics.admin.mapper.IcsCustomerStaffMapper;
|
import com.ics.admin.mapper.IcsCustomerStaffMapper;
|
||||||
import com.ics.admin.mapper.RepairMapper;
|
|
||||||
import com.ics.admin.mapper.RepairAttachMapper;
|
import com.ics.admin.mapper.RepairAttachMapper;
|
||||||
import com.ics.admin.service.IRepairLogService;
|
import com.ics.admin.mapper.RepairLogMapper;
|
||||||
|
import com.ics.admin.mapper.RepairMapper;
|
||||||
|
import com.ics.admin.mapper.RepairRelationalMapper;
|
||||||
import com.ics.admin.service.IRepairService;
|
import com.ics.admin.service.IRepairService;
|
||||||
import com.ics.admin.service.IRepairAttachService;
|
import com.ics.admin.utils.FlowConstants;
|
||||||
import com.ics.common.core.domain.IcsCustomerStaff;
|
import com.ics.common.core.domain.IcsCustomerStaff;
|
||||||
import com.ics.common.utils.DateUtils;
|
import com.ics.common.utils.StringUtils;
|
||||||
import com.ics.system.domain.Sn;
|
import com.ics.system.domain.Sn;
|
||||||
import com.ics.system.service.ICurrentUserService;
|
|
||||||
import com.ics.system.service.ISnService;
|
import com.ics.system.service.ISnService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 工单管理Service业务层处理
|
* 工单管理Service业务层处理
|
||||||
@ -32,11 +32,162 @@ import java.util.stream.Collectors;
|
|||||||
* @author ics
|
* @author ics
|
||||||
* @date 2021-03-25
|
* @date 2021-03-25
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class RepairServiceImpl extends ServiceImpl<RepairMapper, Repair> implements IRepairService {
|
public class RepairServiceImpl extends ServiceImpl<RepairMapper, Repair> implements IRepairService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISnService snService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RepairRelationalMapper repairRelationalMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IcsCustomerStaffMapper customerStaffMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RepairMapper repairMapper;
|
private RepairMapper repairMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RepairLogMapper repairLogMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RepairAttachMapper repairAttachMapper;
|
||||||
|
|
||||||
|
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@Override
|
||||||
|
public String handleFlow(Repair repair, Long currentUserId, Long nextUserId, String[] files, String content, String operate) {
|
||||||
|
return processFlow(repair, currentUserId, nextUserId, files, content, operate);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void eval(Repair repair, Long currentUserId) {
|
||||||
|
Repair oldRepair = repairMapper.selectRepairById(repair.getId());
|
||||||
|
oldRepair.setEvalService(repair.getEvalService());
|
||||||
|
oldRepair.setFeedback(repair.getFeedback());
|
||||||
|
oldRepair.setEvalTime(new Date());
|
||||||
|
oldRepair.setEvalUserId(currentUserId);
|
||||||
|
oldRepair.setStatus(13);
|
||||||
|
repairMapper.updateRepair(oldRepair);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String processFlow(Repair repair, Long currentUserId, Long nextUserId, String[] files, String content, String operate) {
|
||||||
|
if (repair == null) return "表单数据为空";
|
||||||
|
IcsCustomerStaff currentUser = customerStaffMapper.selectIcsCustomerStaffById(currentUserId);
|
||||||
|
IcsCustomerStaff nextUser = null;
|
||||||
|
Integer from = -1, to = -1;
|
||||||
|
from = repair.getId() == null || repair.getId() == 0L ? 0 : repair.getStatus();
|
||||||
|
Repair newRepair = from == 0 ? repair : repairMapper.selectRepairById(repair.getId());//优先使用数据库中的表单
|
||||||
|
//保修
|
||||||
|
if (from == 0) {
|
||||||
|
//没有设置维修人员则到派单环节,否则到“修理工是否接收”环节
|
||||||
|
to = repair.getRepairUserId() == null ? 1 : 5;
|
||||||
|
if (repair.getTypeId() == null) return "表单设备类型数据为空";
|
||||||
|
List<RepairRelational> listRelational = repairRelationalMapper.selectDispatcherByTypeId(repair.getTypeId());
|
||||||
|
if (listRelational == null || listRelational.size() == 0) return "根据表单设备类型找不到派单员";
|
||||||
|
nextUser = customerStaffMapper.selectIcsCustomerStaffById(listRelational.get(0).getUserId());//查询派单员
|
||||||
|
if (nextUser == null) return "没有找到派单员账号";
|
||||||
|
repair.setSn(snService.generate(Sn.Type.REPAIR));//编单号
|
||||||
|
repair.setPerUserId(nextUser.getId());//设置派单员
|
||||||
|
repair.setWarn(0);
|
||||||
|
repair.setDeleteFlag(0);
|
||||||
|
repair.setCreateBy(currentUserId.toString());
|
||||||
|
repair.setCreateTime(new Date());
|
||||||
|
if (to == 5) {
|
||||||
|
nextUser = customerStaffMapper.selectIcsCustomerStaffById(repair.getRepairUserId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//派单
|
||||||
|
if (from == 1) {
|
||||||
|
if (FlowConstants.NEXT.equals(operate)) {
|
||||||
|
to = 5;
|
||||||
|
nextUser = customerStaffMapper.selectIcsCustomerStaffById(nextUserId);
|
||||||
|
if (nextUser == null) return "派单没有找到下一步执行人";
|
||||||
|
newRepair.setRepairUserId(nextUser.getId());
|
||||||
|
newRepair.setPreDate(repair.getPreDate());//设置预计完成时间
|
||||||
|
}
|
||||||
|
if (FlowConstants.BACK.equals(operate)) {
|
||||||
|
to = 3;
|
||||||
|
IcsCustomerStaff p = new IcsCustomerStaff();
|
||||||
|
p.setDataType("7");
|
||||||
|
List<IcsCustomerStaff> list = customerStaffMapper.selectIcsCustomerStaffList(p);
|
||||||
|
if (list == null || list.size() == 0) return "没有找到管理员账号";
|
||||||
|
nextUser = list.get(0);
|
||||||
|
}
|
||||||
|
if (FlowConstants.END.equals(operate)) to = 11;
|
||||||
|
}
|
||||||
|
//重新派单
|
||||||
|
if (from == 3) {
|
||||||
|
to = 1;
|
||||||
|
if (repair.getTypeId() == null) return "表单设备类型数据为空";
|
||||||
|
List<RepairRelational> listRelational = repairRelationalMapper.selectDispatcherByTypeId(repair.getTypeId());
|
||||||
|
if (listRelational == null || listRelational.size() == 0) return "根据表单设备类型找不到派单员";
|
||||||
|
nextUser = customerStaffMapper.selectIcsCustomerStaffById(listRelational.get(0).getUserId());//查询派单员
|
||||||
|
if (nextUser == null) return "没有找到派单员账号";
|
||||||
|
newRepair.setTypeId(repair.getTypeId());
|
||||||
|
newRepair.setTypeName(repair.getTypeName());
|
||||||
|
newRepair.setDeviceId(repair.getDeviceId());
|
||||||
|
newRepair.setDeviceName(repair.getDeviceName());
|
||||||
|
repair.setPerUserId(nextUser.getId());//设置派单员
|
||||||
|
}
|
||||||
|
//修理工是否接收
|
||||||
|
if (from == 5) {
|
||||||
|
if (FlowConstants.BACK.equals(operate)) to = 1;
|
||||||
|
if (FlowConstants.NEXT.equals(operate)) to = 7;
|
||||||
|
}
|
||||||
|
//修理反馈
|
||||||
|
if (from == 7) {
|
||||||
|
to = 9;
|
||||||
|
newRepair.setCause(repair.getCause());
|
||||||
|
newRepair.setSolution(repair.getSolution());
|
||||||
|
newRepair.setFailureTypeId(repair.getFailureTypeId());
|
||||||
|
newRepair.setFailureTypeName(repair.getFailureTypeName());
|
||||||
|
newRepair.setResolve(repair.getResolve());
|
||||||
|
newRepair.setEndDate(new Date());
|
||||||
|
}
|
||||||
|
newRepair.setStatus(to);//设置状态
|
||||||
|
processData(newRepair, currentUser, nextUser, from, to, content, files);
|
||||||
|
return FlowConstants.OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void processData(Repair repair, IcsCustomerStaff currentUser, IcsCustomerStaff nextUser, Integer from, Integer to, String content, String[] files) {
|
||||||
|
Date now = new Date();
|
||||||
|
RepairLog oldLog = null;
|
||||||
|
if (from == 0) {
|
||||||
|
repairMapper.insertRepair(repair);
|
||||||
|
if (files != null && files.length > 0) repairAttachMapper.updateRepairAttachs(repair.getId(), files);//处理附件
|
||||||
|
} else {
|
||||||
|
repairMapper.updateRepair(repair);
|
||||||
|
oldLog = repairLogMapper.selectRepairLogById(repair.getLogId());
|
||||||
|
oldLog.setStatus(1);
|
||||||
|
oldLog.setCloseTime(now);
|
||||||
|
if (StringUtils.isNotBlank(content)) oldLog.setContent(content);
|
||||||
|
repairLogMapper.updateRepairLog(oldLog);
|
||||||
|
}
|
||||||
|
//新增日志
|
||||||
|
RepairLog repairLog = new RepairLog();
|
||||||
|
repairLog.setPid(oldLog == null ? 0L : oldLog.getId());
|
||||||
|
repairLog.setRepairId(repair.getId());
|
||||||
|
repairLog.setForm(from);
|
||||||
|
repairLog.setTo(to);
|
||||||
|
repairLog.setSendUserId(currentUser.getId());
|
||||||
|
repairLog.setSendUserName(currentUser.getUsername());
|
||||||
|
repairLog.setRecUserId(nextUser.getId());
|
||||||
|
repairLog.setRecUserName(nextUser.getUsername());
|
||||||
|
repairLog.setStatus(0);
|
||||||
|
repairLog.setDeleteFlag(0);
|
||||||
|
repairLog.setCreateBy(currentUser.getId().toString());
|
||||||
|
repairLog.setCreateTime(now);
|
||||||
|
if (to == 9 || to == 11) {//结束
|
||||||
|
repairLog.setStatus(1);
|
||||||
|
repairLog.setCloseTime(now);
|
||||||
|
}
|
||||||
|
repairLogMapper.insertRepairLog(repairLog);
|
||||||
|
repair.setLogId(repairLog.getId());
|
||||||
|
repairMapper.updateRepair(repair);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询工单
|
* 查询工单
|
||||||
*
|
*
|
||||||
@ -90,7 +241,7 @@ public class RepairServiceImpl extends ServiceImpl<RepairMapper, Repair> impleme
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteRepairByIds(String ids) {
|
public int deleteRepairByIds(String ids) {
|
||||||
String[] idsArray = StrUtil.split(ids,",");
|
String[] idsArray = StrUtil.split(ids, ",");
|
||||||
return repairMapper.deleteBatchIds(CollUtil.toList(idsArray));
|
return repairMapper.deleteBatchIds(CollUtil.toList(idsArray));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,27 @@
|
|||||||
|
package com.ics.admin.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工单附件vo
|
||||||
|
* created at 2024-8-11 13:46
|
||||||
|
*
|
||||||
|
* @author lujiang
|
||||||
|
* @version 1.0.0
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class RepairAttachVO {
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
private String url;
|
||||||
|
|
||||||
|
public RepairAttachVO() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public RepairAttachVO(Long id, String url) {
|
||||||
|
this.id = id;
|
||||||
|
this.url = url;
|
||||||
|
}
|
||||||
|
}
|
@ -1,44 +1,58 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<!DOCTYPE mapper
|
<!DOCTYPE mapper
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.ics.admin.mapper.RepairAttachMapper">
|
<mapper namespace="com.ics.admin.mapper.RepairAttachMapper">
|
||||||
|
|
||||||
<resultMap type="com.ics.admin.domain.RepairAttach" id="RepairAttachResult">
|
<resultMap type="com.ics.admin.domain.RepairAttach" id="RepairAttachResult">
|
||||||
<result property="id" column="id" />
|
<result property="id" column="id"/>
|
||||||
<result property="repairId" column="repair_id" />
|
<result property="repairId" column="repair_id"/>
|
||||||
<result property="nodeId" column="node_id" />
|
<result property="nodeId" column="node_id"/>
|
||||||
<result property="originalFilename" column="original_filename" />
|
<result property="originalFilename" column="original_filename"/>
|
||||||
<result property="filename" column="filename" />
|
<result property="fileName" column="filename"/>
|
||||||
<result property="url" column="url" />
|
<result property="url" column="url"/>
|
||||||
<result property="fileSize" column="filesize" />
|
<result property="fileSize" column="filesize"/>
|
||||||
<result property="ext1" column="ext1" />
|
<result property="ext1" column="ext1"/>
|
||||||
<result property="ext2" column="ext2" />
|
<result property="ext2" column="ext2"/>
|
||||||
<result property="ext3" column="ext3" />
|
<result property="ext3" column="ext3"/>
|
||||||
<result property="deleteFlag" column="delete_flag" />
|
<result property="deleteFlag" column="delete_flag"/>
|
||||||
<result property="createBy" column="create_by" />
|
<result property="createBy" column="create_by"/>
|
||||||
<result property="createTime" column="create_time" />
|
<result property="createTime" column="create_time"/>
|
||||||
<result property="updateBy" column="update_by" />
|
<result property="updateBy" column="update_by"/>
|
||||||
<result property="updateTime" column="update_time" />
|
<result property="updateTime" column="update_time"/>
|
||||||
<result property="tenantId" column="tenant_id" />
|
<result property="tenantId" column="tenant_id"/>
|
||||||
<result property="parkId" column="park_id" />
|
<result property="parkId" column="park_id"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectRepairAttachVo">
|
<sql id="selectRepairAttachVo">
|
||||||
SELECT id, repair_id, node_id, original_filename, filename, url, filesize, ext1, ext2, ext3, delete_flag, create_by, create_time, update_by, update_time, tenant_id, park_id FROM ics_repair_attach
|
SELECT id,
|
||||||
|
repair_id,
|
||||||
|
node_id,
|
||||||
|
original_filename,
|
||||||
|
filename,
|
||||||
|
url,
|
||||||
|
filesize,
|
||||||
|
ext1,
|
||||||
|
ext2,
|
||||||
|
ext3,
|
||||||
|
delete_flag,
|
||||||
|
create_by,
|
||||||
|
create_time,
|
||||||
|
update_by,
|
||||||
|
update_time,
|
||||||
|
tenant_id,
|
||||||
|
park_id
|
||||||
|
FROM ics_repair_attach
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectRepairAttachList" parameterType="RepairAttach" resultMap="RepairAttachResult">
|
|
||||||
<include refid="selectRepairAttachVo"/>
|
|
||||||
<where>
|
|
||||||
<if test="originalFilename != null and originalFilename != ''"> AND original_filename LIKE CONCAT('%', #{originalFilename}, '%')</if>
|
|
||||||
<if test="filename != null and filename != ''"> AND filename LIKE CONCAT('%', #{filename}, '%')</if>
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="selectRepairAttachById" parameterType="Long" resultMap="RepairAttachResult">
|
<select id="selectRepairAttachById" parameterType="Long" resultMap="RepairAttachResult">
|
||||||
<include refid="selectRepairAttachVo"/>
|
<include refid="selectRepairAttachVo"/>
|
||||||
WHERE id = #{id}
|
WHERE id = #{id} and delete_flag = 0
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectRepairAttachList" resultMap="RepairAttachResult">
|
||||||
|
<include refid="selectRepairAttachVo"/>
|
||||||
|
where repair_id= #{repairId} and delete_flag = 0
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertRepairAttach" parameterType="RepairAttach" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertRepairAttach" parameterType="RepairAttach" useGeneratedKeys="true" keyProperty="id">
|
||||||
@ -47,72 +61,51 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="repairId != null ">repair_id,</if>
|
<if test="repairId != null ">repair_id,</if>
|
||||||
<if test="nodeId != null ">node_id,</if>
|
<if test="nodeId != null ">node_id,</if>
|
||||||
<if test="originalFilename != null and originalFilename != ''">original_filename,</if>
|
<if test="originalFilename != null and originalFilename != ''">original_filename,</if>
|
||||||
<if test="filename != null and filename != ''">filename,</if>
|
<if test="fileName != null and fileName != ''">filename,</if>
|
||||||
<if test="url != null and url != ''">url,</if>
|
<if test="url != null and url != ''">url,</if>
|
||||||
<if test="filesize != null ">filesize,</if>
|
<if test="fileSize != null ">fileSize,</if>
|
||||||
<if test="ext1 != null and ext1 != ''">ext1,</if>
|
<if test="ext1 != null and ext1 != ''">ext1,</if>
|
||||||
<if test="ext2 != null and ext2 != ''">ext2,</if>
|
<if test="ext2 != null and ext2 != ''">ext2,</if>
|
||||||
<if test="ext3 != null and ext3 != ''">ext3,</if>
|
<if test="ext3 != null and ext3 != ''">ext3,</if>
|
||||||
<if test="deleteFlag != null and deleteFlag != ''">delete_flag,</if>
|
<if test="deleteFlag != null ">delete_flag,</if>
|
||||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||||
<if test="createTime != null ">create_time,</if>
|
<if test="createTime != null ">create_time,</if>
|
||||||
<if test="updateBy != null and updateBy != ''">update_by,</if>
|
|
||||||
<if test="updateTime != null ">update_time,</if>
|
|
||||||
<if test="tenantId != null ">tenant_id,</if>
|
<if test="tenantId != null ">tenant_id,</if>
|
||||||
<if test="parkId != null ">park_id,</if>
|
<if test="parkId != null ">park_id,</if>
|
||||||
</trim>
|
</trim>
|
||||||
|
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="repairId != null ">#{repairId},</if>
|
<if test="repairId != null ">#{repairId},</if>
|
||||||
<if test="nodeId != null ">#{nodeId},</if>
|
<if test="nodeId != null ">#{nodeId},</if>
|
||||||
<if test="originalFilename != null and originalFilename != ''">#{originalFilename},</if>
|
<if test="originalFilename != null and originalFilename != ''">#{originalFilename},</if>
|
||||||
<if test="filename != null and filename != ''">#{filename},</if>
|
<if test="fileName != null and fileName != ''">#{fileName},</if>
|
||||||
<if test="url != null and url != ''">#{url},</if>
|
<if test="url != null and url != ''">#{url},</if>
|
||||||
<if test="filesize != null ">#{filesize},</if>
|
<if test="fileSize != null ">#{fileSize},</if>
|
||||||
<if test="ext1 != null and ext1 != ''">#{ext1},</if>
|
<if test="ext1 != null and ext1 != ''">#{ext1},</if>
|
||||||
<if test="ext2 != null and ext2 != ''">#{ext2},</if>
|
<if test="ext2 != null and ext2 != ''">#{ext2},</if>
|
||||||
<if test="ext3 != null and ext3 != ''">#{ext3},</if>
|
<if test="ext3 != null and ext3 != ''">#{ext3},</if>
|
||||||
<if test="deleteFlag != null and deleteFlag != ''">#{deleteFlag},</if>
|
<if test="deleteFlag != null ">#{deleteFlag},</if>
|
||||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||||
<if test="createTime != null ">#{createTime},</if>
|
<if test="createTime != null ">#{createTime},</if>
|
||||||
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
|
|
||||||
<if test="updateTime != null ">#{updateTime},</if>
|
|
||||||
<if test="tenantId != null ">#{tenantId},</if>
|
<if test="tenantId != null ">#{tenantId},</if>
|
||||||
<if test="parkId != null ">#{parkId},</if>
|
<if test="parkId != null ">#{parkId},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<update id="updateRepairAttach" parameterType="RepairAttach">
|
<update id="updateRepairAttachs" parameterType="String">
|
||||||
UPDATE ics_repair_attach
|
UPDATE ics_repair_attach set repair_id= #{repairId} where id in
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
<foreach item="id" collection="ids" open="(" separator="," close=")">
|
||||||
<if test="repairId != null ">repair_id = #{repairId},</if>
|
#{id}
|
||||||
<if test="nodeId != null ">node_id = #{nodeId},</if>
|
</foreach>
|
||||||
<if test="originalFilename != null and originalFilename != ''">original_filename = #{originalFilename},</if>
|
|
||||||
<if test="filename != null and filename != ''">filename = #{filename},</if>
|
|
||||||
<if test="url != null and url != ''">url = #{url},</if>
|
|
||||||
<if test="filesize != null ">filesize = #{filesize},</if>
|
|
||||||
<if test="ext1 != null and ext1 != ''">ext1 = #{ext1},</if>
|
|
||||||
<if test="ext2 != null and ext2 != ''">ext2 = #{ext2},</if>
|
|
||||||
<if test="ext3 != null and ext3 != ''">ext3 = #{ext3},</if>
|
|
||||||
<if test="deleteFlag != null and deleteFlag != ''">delete_flag = #{deleteFlag},</if>
|
|
||||||
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
|
|
||||||
<if test="createTime != null ">create_time = #{createTime},</if>
|
|
||||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
|
||||||
<if test="updateTime != null ">update_time = #{updateTime},</if>
|
|
||||||
<if test="tenantId != null ">tenant_id = #{tenantId},</if>
|
|
||||||
<if test="parkId != null ">park_id = #{parkId},</if>
|
|
||||||
</trim>
|
|
||||||
WHERE id = #{id}
|
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteByRepairId" parameterType="Long">
|
||||||
|
DELETE
|
||||||
|
FROM ics_repair_attach
|
||||||
|
WHERE repair_id = #{repairId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
<delete id="deleteRepairAttachById" parameterType="Long">
|
<delete id="deleteRepairAttachById" parameterType="Long">
|
||||||
DELETE FROM ics_repair_attach WHERE id = #{id}
|
DELETE FROM ics_repair_attach WHERE id = #{id}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<delete id="deleteRepairAttachByIds" parameterType="String">
|
|
||||||
DELETE FROM ics_repair_attach where id in
|
|
||||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
||||||
#{id}
|
|
||||||
</foreach>
|
|
||||||
</delete>
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
@ -30,6 +30,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectRepairRelationalByTypeId" parameterType="Long" resultMap="RepairRelationalResult">
|
||||||
|
<include refid="selectRepairRelationalVo"/>
|
||||||
|
WHERE type_id = #{typeId} and delete_flag=0
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectDispatcherByTypeId" parameterType="Long" resultMap="RepairRelationalResult">
|
||||||
|
<include refid="selectRepairRelationalVo"/>
|
||||||
|
WHERE type_id = #{typeId} and kind=1 and delete_flag=0
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="selectRepairRelationalById" parameterType="Long" resultMap="RepairRelationalResult">
|
<select id="selectRepairRelationalById" parameterType="Long" resultMap="RepairRelationalResult">
|
||||||
<include refid="selectRepairRelationalVo"/>
|
<include refid="selectRepairRelationalVo"/>
|
||||||
WHERE id = #{id}
|
WHERE id = #{id}
|
||||||
|
@ -30,7 +30,6 @@ import java.util.Map;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* web层通用数据处理
|
* web层通用数据处理
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class BaseController {
|
public class BaseController {
|
||||||
|
|
||||||
@ -58,7 +57,7 @@ public class BaseController {
|
|||||||
*/
|
*/
|
||||||
protected void startPage() {
|
protected void startPage() {
|
||||||
PageDomain pageDomain = TableSupport.buildPageRequest();
|
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||||
Integer pageNum = pageDomain.getPageNum();
|
Integer pageNum = pageDomain.getPageNum();
|
||||||
Integer pageSize = pageDomain.getPageSize();
|
Integer pageSize = pageDomain.getPageSize();
|
||||||
if (null != pageNum && null != pageSize) {
|
if (null != pageNum && null != pageSize) {
|
||||||
String orderBy = pageDomain.getIsAsc() == null ? "" : SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
|
String orderBy = pageDomain.getIsAsc() == null ? "" : SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
|
||||||
@ -114,21 +113,31 @@ public class BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取微信id
|
* 获取ics_customer_staff表中的id
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Integer getLoginStaffId() {
|
public Long getLoginStaffId() {
|
||||||
Token token = SubjectUtil.getToken(getRequest());
|
Token token = SubjectUtil.getToken(getRequest());
|
||||||
|
//微信登录
|
||||||
|
if (token.getRoles() != null && token.getRoles().length > 0 && "appUser".equals(token.getRoles()[0])) {
|
||||||
|
String currentId = token.getUserId();
|
||||||
|
if (StringUtils.isNotBlank(currentId)) {
|
||||||
|
return Long.valueOf(currentId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//PC登录
|
||||||
String value = valueOperations.get(ACCESS_USERID + ":" + token.getUserId());
|
String value = valueOperations.get(ACCESS_USERID + ":" + token.getUserId());
|
||||||
JSONObject jo = StringUtils.isEmpty(value) ? null : JSON.parseObject(value, JSONObject.class);
|
JSONObject jo = StringUtils.isEmpty(value) ? null : JSON.parseObject(value, JSONObject.class);
|
||||||
if (jo != null && jo.containsKey("staffId")) {
|
if (jo != null && jo.containsKey("staffId")) {
|
||||||
return (Integer)jo.get("staffId");
|
return Long.valueOf(jo.get("staffId").toString());
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取企业id
|
* 获取企业id
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Long getLoginCustomerId() {
|
public Long getLoginCustomerId() {
|
||||||
@ -136,7 +145,7 @@ public class BaseController {
|
|||||||
String value = valueOperations.get(ACCESS_USERID + ":" + token.getUserId());
|
String value = valueOperations.get(ACCESS_USERID + ":" + token.getUserId());
|
||||||
JSONObject jo = StringUtils.isEmpty(value) ? null : JSON.parseObject(value, JSONObject.class);
|
JSONObject jo = StringUtils.isEmpty(value) ? null : JSON.parseObject(value, JSONObject.class);
|
||||||
if (jo != null && jo.containsKey("customerId")) {
|
if (jo != null && jo.containsKey("customerId")) {
|
||||||
return (Long)jo.get("customerId");
|
return (Long) jo.get("customerId");
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user