智能回复
This commit is contained in:
		
							parent
							
								
									f243e118a6
								
							
						
					
					
						commit
						067192c825
					
				| 
						 | 
					@ -169,7 +169,7 @@ public class DevInfoController extends BaseController {
 | 
				
			||||||
     * 新增设备信息--包含附件上传
 | 
					     * 新增设备信息--包含附件上传
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    //@RequiresPermissions("equip:info:add")
 | 
					    //@RequiresPermissions("equip:info:add")
 | 
				
			||||||
    @ApiOperation(value = "新增装备--含附件上传")
 | 
					    @ApiOperation(value = "新增装备(包含草稿)--含附件上传")
 | 
				
			||||||
    @PostMapping
 | 
					    @PostMapping
 | 
				
			||||||
    public AjaxResult add(@RequestBody @Valid DevInfo devInfo) {
 | 
					    public AjaxResult add(@RequestBody @Valid DevInfo devInfo) {
 | 
				
			||||||
        return devInfoService.insertDevInfo(devInfo);
 | 
					        return devInfoService.insertDevInfo(devInfo);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -297,32 +297,6 @@ public class DevInfoServiceImpl implements DevInfoService {
 | 
				
			||||||
            return AjaxResult.error("设备信息不能为空");
 | 
					            return AjaxResult.error("设备信息不能为空");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        String code = "";
 | 
					        String code = "";
 | 
				
			||||||
        try {
 | 
					 | 
				
			||||||
            if (devInfo.getMaId() != null) {
 | 
					 | 
				
			||||||
                code = devInfoMapper.getCodeByMaId(devInfo.getMaId());
 | 
					 | 
				
			||||||
                // 更新设备信息--原本草稿相关内容删除
 | 
					 | 
				
			||||||
                int deleted = devInfoMapper.deleteDevInfoByMaId(devInfo.getMaId(), MaStatusEnum.UNDER_RENT.getCode());
 | 
					 | 
				
			||||||
                if (deleted == 0) {
 | 
					 | 
				
			||||||
                    return AjaxResult.error("传入设备ID,但设备不存在,请刷新后重试");
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
                // 删除原草稿附件
 | 
					 | 
				
			||||||
                BmFileInfo bmFileInfo = new BmFileInfo()
 | 
					 | 
				
			||||||
                        .setTaskType(MaterialConstants.MATERIAL_FILE_TYPE_CODE)
 | 
					 | 
				
			||||||
                        .setModelId(devInfo.getMaId());
 | 
					 | 
				
			||||||
                bmFileInfoMapper.deleteBmFileInfoByBizInfo(bmFileInfo);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        } catch (DataAccessException e) {
 | 
					 | 
				
			||||||
            System.err.println("数据库操作异常: " + e.getMessage());
 | 
					 | 
				
			||||||
            throw new ServiceException("数据库操作异常: " + e.getMessage());
 | 
					 | 
				
			||||||
        } catch (IllegalArgumentException e) {
 | 
					 | 
				
			||||||
            System.err.println("非法参数异常: {}" + e.getMessage());
 | 
					 | 
				
			||||||
            throw new ServiceException("非法参数异常: " + e.getMessage());
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      /*  DevInfo deviceNameCount = devInfoMapper.getDeviceNameCount(devInfo.getDeviceName());
 | 
					 | 
				
			||||||
        if (deviceNameCount != null && deviceNameCount.getMaId() > 0) {
 | 
					 | 
				
			||||||
            return AjaxResult.error("设备名称已存在,请修改后重试!");
 | 
					 | 
				
			||||||
        }*/
 | 
					 | 
				
			||||||
        for (int i = 0; i < devInfo.getExaminationPdfs().size(); i++) {
 | 
					        for (int i = 0; i < devInfo.getExaminationPdfs().size(); i++) {
 | 
				
			||||||
            //获取用户信息
 | 
					            //获取用户信息
 | 
				
			||||||
            Long userId = SecurityUtils.getLoginUser().getUserid();
 | 
					            Long userId = SecurityUtils.getLoginUser().getUserid();
 | 
				
			||||||
| 
						 | 
					@ -456,6 +430,7 @@ public class DevInfoServiceImpl implements DevInfoService {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return null;
 | 
					        return null;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private AjaxResult uploadFile(DevInfo devInfo, Long userId) {
 | 
					    private AjaxResult uploadFile(DevInfo devInfo, Long userId) {
 | 
				
			||||||
        if (userId == null) {
 | 
					        if (userId == null) {
 | 
				
			||||||
            return AjaxResult.error("用户信息获取失败,请刷新后重试");
 | 
					            return AjaxResult.error("用户信息获取失败,请刷新后重试");
 | 
				
			||||||
| 
						 | 
					@ -535,7 +510,7 @@ public class DevInfoServiceImpl implements DevInfoService {
 | 
				
			||||||
            devInfoMapper.insertDevInfoProperties(devInfo.getMaId(), devInfo.getDevInfoProperties());
 | 
					            devInfoMapper.insertDevInfoProperties(devInfo.getMaId(), devInfo.getDevInfoProperties());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        int i = devInfoMapper.updateDevInfo(devInfo);
 | 
					        int i = devInfoMapper.updateDevInfo(devInfo);
 | 
				
			||||||
        if (i > 0){
 | 
					        if (i > 0) {
 | 
				
			||||||
            BmFileInfo bmFileInfo = new BmFileInfo()
 | 
					            BmFileInfo bmFileInfo = new BmFileInfo()
 | 
				
			||||||
                    .setTaskType(MaterialConstants.MATERIAL_FILE_TYPE_CODE)
 | 
					                    .setTaskType(MaterialConstants.MATERIAL_FILE_TYPE_CODE)
 | 
				
			||||||
                    .setModelId(devInfo.getMaId());
 | 
					                    .setModelId(devInfo.getMaId());
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,55 @@
 | 
				
			||||||
 | 
					package com.bonus.material.reply.controller;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.bonus.common.core.web.controller.BaseController;
 | 
				
			||||||
 | 
					import com.bonus.common.core.web.domain.AjaxResult;
 | 
				
			||||||
 | 
					import com.bonus.material.reply.entity.BmReply;
 | 
				
			||||||
 | 
					import com.bonus.material.reply.service.ReplyService;
 | 
				
			||||||
 | 
					import io.swagger.annotations.Api;
 | 
				
			||||||
 | 
					import io.swagger.annotations.ApiOperation;
 | 
				
			||||||
 | 
					import org.springframework.web.bind.annotation.*;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import javax.annotation.Resource;
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @Author:liang.chao
 | 
				
			||||||
 | 
					 * @Date:2024/12/16 - 11:15
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					@RestController
 | 
				
			||||||
 | 
					@RequestMapping("/reply")
 | 
				
			||||||
 | 
					@Api(value = "快捷回复", tags = "快捷回复")
 | 
				
			||||||
 | 
					public class ReplyController extends BaseController {
 | 
				
			||||||
 | 
					    @Resource
 | 
				
			||||||
 | 
					    private ReplyService replyService;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @GetMapping("/list")
 | 
				
			||||||
 | 
					    @ApiOperation("获取公司列表")
 | 
				
			||||||
 | 
					    public AjaxResult list(BmReply bmReply) {
 | 
				
			||||||
 | 
					        startPage();
 | 
				
			||||||
 | 
					        List<BmReply> list = replyService.list(bmReply);
 | 
				
			||||||
 | 
					        return success(getDataTable(list));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @PostMapping("/add")
 | 
				
			||||||
 | 
					    @ApiOperation("新增快捷回复")
 | 
				
			||||||
 | 
					    public AjaxResult add(@RequestBody BmReply bmReply) {
 | 
				
			||||||
 | 
					        Integer i = replyService.add(bmReply);
 | 
				
			||||||
 | 
					        if (i > 0) {
 | 
				
			||||||
 | 
					            return AjaxResult.success("新增成功");
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            return AjaxResult.error("新增失败");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    @PostMapping("/edit")
 | 
				
			||||||
 | 
					    @ApiOperation("修改快捷回复")
 | 
				
			||||||
 | 
					    public AjaxResult edit(@RequestBody BmReply bmReply) {
 | 
				
			||||||
 | 
					        Integer i = replyService.edit(bmReply);
 | 
				
			||||||
 | 
					        if (i > 0) {
 | 
				
			||||||
 | 
					            return AjaxResult.success("修改成功");
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            return AjaxResult.error("修改失败");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,43 @@
 | 
				
			||||||
 | 
					package com.bonus.material.reply.entity;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import io.swagger.annotations.ApiModelProperty;
 | 
				
			||||||
 | 
					import lombok.Data;
 | 
				
			||||||
 | 
					import org.springframework.format.annotation.DateTimeFormat;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.Date;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @Author:liang.chao
 | 
				
			||||||
 | 
					 * @Date:2024/12/16 - 11:26
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					@Data
 | 
				
			||||||
 | 
					public class BmReply {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @ApiModelProperty(value = "id")
 | 
				
			||||||
 | 
					    private Integer id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @ApiModelProperty(value = "回复标题")
 | 
				
			||||||
 | 
					    private String replyTitle;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @ApiModelProperty(value = "回复内容")
 | 
				
			||||||
 | 
					    private String replyContent;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @ApiModelProperty(value = "创建人")
 | 
				
			||||||
 | 
					    private Integer creater;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @ApiModelProperty(value = "创建时间")
 | 
				
			||||||
 | 
					    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
 | 
				
			||||||
 | 
					    private Date createrTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @ApiModelProperty(value = "修改人")
 | 
				
			||||||
 | 
					    private Integer updater;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @ApiModelProperty(value = "修改时间")
 | 
				
			||||||
 | 
					    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
 | 
				
			||||||
 | 
					    private Date updaterTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String startTime;
 | 
				
			||||||
 | 
					    private String endTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String nickName;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,17 @@
 | 
				
			||||||
 | 
					package com.bonus.material.reply.mapper;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.bonus.material.reply.entity.BmReply;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @Author:liang.chao
 | 
				
			||||||
 | 
					 * @Date:2024/12/16 - 12:00
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					public interface ReplyMapper {
 | 
				
			||||||
 | 
					    List<BmReply> list(BmReply bmReply);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Integer add(BmReply bmReply);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Integer edit(BmReply bmReply);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,17 @@
 | 
				
			||||||
 | 
					package com.bonus.material.reply.service;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.bonus.material.reply.entity.BmReply;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @Author:liang.chao
 | 
				
			||||||
 | 
					 * @Date:2024/12/16 - 11:30
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					public interface ReplyService {
 | 
				
			||||||
 | 
					    List<BmReply> list(BmReply bmReply);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Integer add(BmReply bmReply);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Integer edit(BmReply bmReply);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,38 @@
 | 
				
			||||||
 | 
					package com.bonus.material.reply.service.impl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.bonus.common.security.utils.SecurityUtils;
 | 
				
			||||||
 | 
					import com.bonus.material.reply.entity.BmReply;
 | 
				
			||||||
 | 
					import com.bonus.material.reply.mapper.ReplyMapper;
 | 
				
			||||||
 | 
					import com.bonus.material.reply.service.ReplyService;
 | 
				
			||||||
 | 
					import org.springframework.stereotype.Service;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import javax.annotation.Resource;
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @Author:liang.chao
 | 
				
			||||||
 | 
					 * @Date:2024/12/16 - 11:30
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					@Service
 | 
				
			||||||
 | 
					public class ReplyServiceImpl implements ReplyService {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Resource
 | 
				
			||||||
 | 
					    private ReplyMapper replyMapper;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public List<BmReply> list(BmReply bmReply) {
 | 
				
			||||||
 | 
					        return replyMapper.list(bmReply);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public Integer add(BmReply bmReply) {
 | 
				
			||||||
 | 
					        bmReply.setCreater(SecurityUtils.getLoginUser().getUserid().intValue());
 | 
				
			||||||
 | 
					        return replyMapper.add(bmReply);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public Integer edit(BmReply bmReply) {
 | 
				
			||||||
 | 
					        bmReply.setUpdater(SecurityUtils.getLoginUser().getUserid().intValue());
 | 
				
			||||||
 | 
					        return replyMapper.edit(bmReply);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,51 @@
 | 
				
			||||||
 | 
					<?xml version="1.0" encoding="UTF-8" ?>
 | 
				
			||||||
 | 
					<!DOCTYPE mapper
 | 
				
			||||||
 | 
					PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
				
			||||||
 | 
					"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 | 
				
			||||||
 | 
					<mapper namespace="com.bonus.material.reply.mapper.ReplyMapper">
 | 
				
			||||||
 | 
					    <insert id="add" useGeneratedKeys="true" keyProperty="id">
 | 
				
			||||||
 | 
					        insert into bm_reply(reply_title, reply_content, creater, creater_time)
 | 
				
			||||||
 | 
					        values(#{replyTitle}, #{replyContent}, #{creater}, now())
 | 
				
			||||||
 | 
					    </insert>
 | 
				
			||||||
 | 
					    <update id="edit">
 | 
				
			||||||
 | 
					        update bm_reply
 | 
				
			||||||
 | 
					        <set>
 | 
				
			||||||
 | 
					            <if test="replyTitle != null and replyTitle != ''">
 | 
				
			||||||
 | 
					                reply_title = #{replyTitle},
 | 
				
			||||||
 | 
					            </if>
 | 
				
			||||||
 | 
					            <if test="replyContent != null and replyContent != ''">
 | 
				
			||||||
 | 
					                reply_content = #{replyContent},
 | 
				
			||||||
 | 
					            </if>
 | 
				
			||||||
 | 
					            <if test="updater != null">
 | 
				
			||||||
 | 
					                updater = #{updater},
 | 
				
			||||||
 | 
					            </if>
 | 
				
			||||||
 | 
					            updater_time = now()
 | 
				
			||||||
 | 
					        </set>
 | 
				
			||||||
 | 
					        where id = #{id}
 | 
				
			||||||
 | 
					    </update>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <select id="list" resultType="com.bonus.material.reply.entity.BmReply">
 | 
				
			||||||
 | 
					        select
 | 
				
			||||||
 | 
					        br.id,
 | 
				
			||||||
 | 
					        br.reply_title,
 | 
				
			||||||
 | 
					        br.reply_content,
 | 
				
			||||||
 | 
					        br.creater,
 | 
				
			||||||
 | 
					        su.nick_name,
 | 
				
			||||||
 | 
					        br.creater_time,
 | 
				
			||||||
 | 
					        br.updater,
 | 
				
			||||||
 | 
					        br.updater_time
 | 
				
			||||||
 | 
					        from bm_reply br
 | 
				
			||||||
 | 
					        left join sys_user su on su.user_id = br.creater
 | 
				
			||||||
 | 
					        <where>
 | 
				
			||||||
 | 
					            <if test="replyTitle != null and replyTitle != ''">
 | 
				
			||||||
 | 
					                and br.replyTitle like concat('%',#{replyTitle},'%')
 | 
				
			||||||
 | 
					            </if>
 | 
				
			||||||
 | 
					            <if test="nickName != null and nickName != ''">
 | 
				
			||||||
 | 
					                and su.nick_name like concat('%',#{nickName},'%')
 | 
				
			||||||
 | 
					            </if>
 | 
				
			||||||
 | 
					            <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
 | 
				
			||||||
 | 
					                AND br.creater_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
 | 
				
			||||||
 | 
					            </if>
 | 
				
			||||||
 | 
					        </where>
 | 
				
			||||||
 | 
					    </select>
 | 
				
			||||||
 | 
					</mapper>
 | 
				
			||||||
		Loading…
	
		Reference in New Issue