附件 扩展类型字段

This commit is contained in:
lujiang 2024-09-18 15:24:10 +08:00
parent 20ef56dd8a
commit 60722ba5e7
11 changed files with 45 additions and 34 deletions

View File

@ -36,7 +36,7 @@ public class RepairAttachController extends BaseController {
private DfsConfig dfsConfig;
/**
* 修上传语音
* 修上传语音
*/
@RequiresPermissions(value = {"repair:attach:operator", "member:center:view"}, logical = Logical.OR)
@PostMapping("upload/voice")
@ -45,7 +45,7 @@ public class RepairAttachController extends BaseController {
}
/**
* 修上传图片视频
* 修上传图片视频
*
* @param file
* @param repairId 工单id
@ -81,6 +81,7 @@ public class RepairAttachController extends BaseController {
// 上传并返回新文件名称
String url = FileUploadUtils.upload(filePath, file);
RepairAttach repairAttach = new RepairAttach();
repairAttach.setTypeId(0);
repairAttach.setRepairId(repairId);
repairAttach.setNodeId(nodeId);
repairAttach.setOriginalFilename(originalFilename);

View File

@ -201,7 +201,7 @@ public class RepairController extends BaseController {
public R get(@RequestBody Map<String, Long> map) {
Long id = map.get("id");
Repair repair = repairService.selectRepairById(id);
Map<String, Object> files=repairAttachService.getAttachMapbyRepairId(id);
Map<String, Object> files=repairAttachService.getAttachMapbyRepairId(id,0);
List<RepairLog> logList = repairLogService.selectRepairLogListByRepairId(id);
return R.ok().put("repair", repair)
.put("files", files)

View File

@ -14,6 +14,12 @@ import lombok.Data;
@TableName("ics_repair_attach")
public class RepairAttach extends BaseEntity<RepairAttach> {
private static final long serialVersionUID = -202408082136L;
/**
* 附件类型 0,工单附件1会议预约附件
*/
private Integer typeId = 0;
/**
* 工单id
*/

View File

@ -18,7 +18,7 @@ public class RepairRemind extends BaseEntity<RepairRemind> {
private static final long serialVersionUID = -202408172114L;
/**
* 提醒类型
* 提醒类型 0,工单提醒1会议预约提醒
*/
private Integer typeId;

View File

@ -30,14 +30,14 @@ public interface RepairAttachMapper {
* @param repairId 工单id
* @return 附件集合
*/
List<RepairAttach> selectRepairAttachList(@Param("repairId") Long repairId);
List<RepairAttach> selectRepairAttachList(@Param("repairId") Long repairId, @Param("typeId") Integer typeId);
/**
* 获取工单报修的第一张图片url
* @param repairId 工单id
* @return
*/
String getRepairFirstImg(@Param("repairId") Long repairId);
String getRepairFirstImg(@Param("repairId") Long repairId, @Param("typeId") Integer typeId);
/**
* 新增附件
@ -54,7 +54,7 @@ public interface RepairAttachMapper {
* @param ids 附件id数组
* @return 结果
*/
int updateRepairAttachs(@Param("repairId") Long repairId, @Param("ids") String[] ids);
int updateRepairAttachs(@Param("repairId") Long repairId, @Param("typeId") Integer typeId, @Param("ids") String[] ids);
/**
* 删除工单附件
@ -62,7 +62,7 @@ public interface RepairAttachMapper {
* @param repairId 工单ID
* @return 结果
*/
int deleteByRepairId(Long repairId);
int deleteByRepairId(@Param("repairId") Long repairId, @Param("typeId") Integer typeId);
/**
* 删除附件

View File

@ -34,7 +34,7 @@ public interface IRepairAttachService {
* @param repairId 工单id
* @return
*/
int updateRepairAttach(long repairId, String[] ids);
int updateRepairAttach(long repairId, Integer typeId, String[] ids);
/**
* 查询工单所有附件
@ -42,7 +42,7 @@ public interface IRepairAttachService {
* @param repairId 工单id
* @return
*/
List<RepairAttach> getListByRepair(Long repairId);
List<RepairAttach> getListByRepair(Long repairId, Integer typeId);
/**
* 查询工单所有附件,并分类组合成map
@ -50,7 +50,7 @@ public interface IRepairAttachService {
* @param repairId 工单id
* @return
*/
Map<String, Object> getAttachMapbyRepairId(Long repairId);
Map<String, Object> getAttachMapbyRepairId(Long repairId, Integer typeId);
/**
* 删除工单附件
@ -58,7 +58,7 @@ public interface IRepairAttachService {
* @param repairId
* @return
*/
int deleteByRepairId(long repairId);
int deleteByRepairId(long repairId, Integer typeId);
/**
* 删除附件信息

View File

@ -38,19 +38,19 @@ public class RepairAttachServiceImpl implements IRepairAttachService {
}
@Override
public int updateRepairAttach(long repairId, String[] ids) {
return repairAttachMapper.updateRepairAttachs(repairId, ids);
public int updateRepairAttach(long repairId, Integer typeId, String[] ids) {
return repairAttachMapper.updateRepairAttachs(repairId, typeId, ids);
}
@Override
public List<RepairAttach> getListByRepair(Long repairId) {
return repairAttachMapper.selectRepairAttachList(repairId);
public List<RepairAttach> getListByRepair(Long repairId, Integer typeId) {
return repairAttachMapper.selectRepairAttachList(repairId, typeId);
}
@Override
public Map<String, Object> getAttachMapbyRepairId(Long repairId) {
List<RepairAttach> list =repairAttachMapper.selectRepairAttachList(repairId);
public Map<String, Object> getAttachMapbyRepairId(Long repairId, Integer typeId) {
List<RepairAttach> list = repairAttachMapper.selectRepairAttachList(repairId, typeId);
List<RepairAttachVO> voices = new ArrayList<>();
List<RepairAttachVO> repairs = new ArrayList<>();
List<RepairAttachVO> feedbacks = new ArrayList<>();
@ -73,12 +73,12 @@ public class RepairAttachServiceImpl implements IRepairAttachService {
}
@Override
public int deleteByRepairId(long repairId) {
List<RepairAttach> list = repairAttachMapper.selectRepairAttachList(repairId);
public int deleteByRepairId(long repairId, Integer typeId) {
List<RepairAttach> list = repairAttachMapper.selectRepairAttachList(repairId, typeId);
for (RepairAttach repairAttach : list) {
deleteFile(repairAttach.getUrl());
}
return repairAttachMapper.deleteByRepairId(repairId);
return repairAttachMapper.deleteByRepairId(repairId, typeId);
}

View File

@ -295,7 +295,7 @@ public class RepairServiceImpl implements IRepairService {
RepairLog oldLog = null;
if (from == 0) {
repairMapper.insertRepair(repair);
if (files != null && files.length > 0) repairAttachMapper.updateRepairAttachs(repair.getId(), files);//处理附件
if (files != null && files.length > 0) repairAttachMapper.updateRepairAttachs(repair.getId(),0,files);//处理附件
//处理工单提醒--start
for (RepairRemind repairRemind : rList) {
repairRemind.setRepairId(repair.getId());
@ -391,7 +391,7 @@ public class RepairServiceImpl implements IRepairService {
IcsCustomerStaff evalUser = customerStaffMapper.selectIcsCustomerStaffById(repair.getEvalUserId());
repair.setEvalUserName(evalUser.getUsername());
}
String url = repairAttachMapper.getRepairFirstImg(repair.getId());
String url = repairAttachMapper.getRepairFirstImg(repair.getId(),0);
repair.setExt1(url);
IcsCustomerStaff createUser = customerStaffMapper.selectIcsCustomerStaffById(Long.valueOf(repair.getCreateBy()));
repair.setExt2(createUser.getUsername());
@ -444,7 +444,7 @@ public class RepairServiceImpl implements IRepairService {
@Override
public int deleteRepairById(Long id) {
//删除附件
repairAttachService.deleteByRepairId(id);
repairAttachService.deleteByRepairId(id,0);
//删除日志
repairLogMapper.deleteRepairLogByRId(id);
return repairMapper.deleteRepairById(id);
@ -456,7 +456,7 @@ public class RepairServiceImpl implements IRepairService {
String[] idsArray = StrUtil.split(ids, ",");
for (int i = 0; i < idsArray.length; i++) {
Long id = Long.valueOf(idsArray[0]);
repairAttachService.deleteByRepairId(id);
repairAttachService.deleteByRepairId(id,0);
//删除日志
repairLogMapper.deleteRepairLogByRId(id);
repairMapper.deleteRepairById(id);

View File

@ -6,6 +6,7 @@
<resultMap type="com.ics.admin.domain.RepairAttach" id="RepairAttachResult">
<result property="id" column="id"/>
<result property="typeId" column="type_id" />
<result property="repairId" column="repair_id"/>
<result property="nodeId" column="node_id"/>
<result property="originalFilename" column="original_filename"/>
@ -26,6 +27,7 @@
<sql id="selectRepairAttachVo">
SELECT id,
type_id,
repair_id,
node_id,
original_filename,
@ -50,18 +52,19 @@
WHERE id = #{id} and delete_flag = 0
</select>
<select id="selectRepairAttachList" parameterType="Long" resultMap="RepairAttachResult">
<select id="selectRepairAttachList" resultMap="RepairAttachResult">
<include refid="selectRepairAttachVo"/>
where repair_id= #{repairId} and delete_flag = 0
where repair_id= #{repairId} and type_id = #{typeId} and delete_flag = 0
</select>
<select id="getRepairFirstImg" parameterType="Long" resultType="String">
select url from ics_repair_attach where repair_id=#{repairId} and node_id=1 and delete_flag=0 and ext1='img' order by id limit 1
<select id="getRepairFirstImg" resultType="String">
select url from ics_repair_attach where repair_id=#{repairId} and node_id=1 and type_id = #{typeId} and delete_flag=0 and ext1='img' order by id limit 1
</select>
<insert id="insertRepairAttach" parameterType="com.ics.admin.domain.RepairAttach" useGeneratedKeys="true" keyProperty="id">
INSERT INTO ics_repair_attach
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="typeId != null ">type_id,</if>
<if test="repairId != null ">repair_id,</if>
<if test="nodeId != null ">node_id,</if>
<if test="originalFilename != null and originalFilename != ''">original_filename,</if>
@ -79,6 +82,7 @@
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="typeId != null ">#{typeId},</if>
<if test="repairId != null ">#{repairId},</if>
<if test="nodeId != null ">#{nodeId},</if>
<if test="originalFilename != null and originalFilename != ''">#{originalFilename},</if>
@ -97,16 +101,16 @@
</insert>
<update id="updateRepairAttachs">
UPDATE ics_repair_attach set repair_id= #{repairId} where id in
UPDATE ics_repair_attach set repair_id= #{repairId} where type_id = #{typeId} and id in
<foreach item="id" collection="ids" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<delete id="deleteByRepairId" parameterType="Long">
<delete id="deleteByRepairId">
DELETE
FROM ics_repair_attach
WHERE repair_id = #{repairId}
WHERE repair_id = #{repairId} and type_id = #{typeId}
</delete>
<delete id="deleteRepairAttachById" parameterType="Long">

View File

@ -6,7 +6,7 @@
<resultMap type="com.ics.admin.domain.RepairRemind" id="RepairRemindResult">
<result property="id" column="id" />
<result property="typeId" column="type_id" />
<result property="typeId" column="type_id"/>
<result property="repairId" column="repair_id" />
<result property="userId" column="user_id" />
<result property="content" column="content" />

View File

@ -22,6 +22,6 @@ public class RepairRemindPushTask {
public void remindPush() {
RepairRemindPushService repairRemindPushService = SpringUtils.getBean(RepairRemindPushService.class);
int num = repairRemindPushService.pushWxTemplateMsg();
log.info("推送公众号" + num + "工单提醒");
log.info("推送公众号" + num + "提醒");
}
}