diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/controller/DevInfoController.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/controller/DevInfoController.java index f47af44..b8bb748 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/controller/DevInfoController.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/controller/DevInfoController.java @@ -169,7 +169,7 @@ public class DevInfoController extends BaseController { * 新增设备信息--包含附件上传 */ //@RequiresPermissions("equip:info:add") - @ApiOperation(value = "新增装备--含附件上传") + @ApiOperation(value = "新增装备(包含草稿)--含附件上传") @PostMapping public AjaxResult add(@RequestBody @Valid DevInfo devInfo) { return devInfoService.insertDevInfo(devInfo); diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/impl/DevInfoServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/impl/DevInfoServiceImpl.java index 73ee4b9..a3ea5df 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/impl/DevInfoServiceImpl.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/impl/DevInfoServiceImpl.java @@ -297,32 +297,6 @@ public class DevInfoServiceImpl implements DevInfoService { return AjaxResult.error("设备信息不能为空"); } 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++) { //获取用户信息 Long userId = SecurityUtils.getLoginUser().getUserid(); @@ -456,6 +430,7 @@ public class DevInfoServiceImpl implements DevInfoService { } return null; } + private AjaxResult uploadFile(DevInfo devInfo, Long userId) { if (userId == null) { return AjaxResult.error("用户信息获取失败,请刷新后重试"); @@ -535,7 +510,7 @@ public class DevInfoServiceImpl implements DevInfoService { devInfoMapper.insertDevInfoProperties(devInfo.getMaId(), devInfo.getDevInfoProperties()); } int i = devInfoMapper.updateDevInfo(devInfo); - if (i > 0){ + if (i > 0) { BmFileInfo bmFileInfo = new BmFileInfo() .setTaskType(MaterialConstants.MATERIAL_FILE_TYPE_CODE) .setModelId(devInfo.getMaId()); diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/reply/controller/ReplyController.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/reply/controller/ReplyController.java new file mode 100644 index 0000000..44cf6f7 --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/reply/controller/ReplyController.java @@ -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 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("修改失败"); + } + } + +} diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/reply/entity/BmReply.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/reply/entity/BmReply.java new file mode 100644 index 0000000..a7f4457 --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/reply/entity/BmReply.java @@ -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; +} diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/reply/mapper/ReplyMapper.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/reply/mapper/ReplyMapper.java new file mode 100644 index 0000000..96dffec --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/reply/mapper/ReplyMapper.java @@ -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 list(BmReply bmReply); + + Integer add(BmReply bmReply); + + Integer edit(BmReply bmReply); +} diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/reply/service/ReplyService.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/reply/service/ReplyService.java new file mode 100644 index 0000000..57ae288 --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/reply/service/ReplyService.java @@ -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 list(BmReply bmReply); + + Integer add(BmReply bmReply); + + Integer edit(BmReply bmReply); +} diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/reply/service/impl/ReplyServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/reply/service/impl/ReplyServiceImpl.java new file mode 100644 index 0000000..afc203e --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/reply/service/impl/ReplyServiceImpl.java @@ -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 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); + } +} diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/reply/ReplyMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/reply/ReplyMapper.xml new file mode 100644 index 0000000..31cc7da --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/reply/ReplyMapper.xml @@ -0,0 +1,51 @@ + + + + + insert into bm_reply(reply_title, reply_content, creater, creater_time) + values(#{replyTitle}, #{replyContent}, #{creater}, now()) + + + update bm_reply + + + reply_title = #{replyTitle}, + + + reply_content = #{replyContent}, + + + updater = #{updater}, + + updater_time = now() + + where id = #{id} + + + + \ No newline at end of file