diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/technicalConfirm/QuotJsqrController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/technicalConfirm/QuotJsqrController.java index 308ddb6..be8a07a 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/technicalConfirm/QuotJsqrController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/technicalConfirm/QuotJsqrController.java @@ -2,8 +2,11 @@ package com.ruoyi.web.controller.technicalConfirm; import javax.servlet.http.HttpServletResponse; +import com.ruoyi.common.constant.CacheConstants; import com.ruoyi.common.constant.WebsocketConst; import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.core.redis.RedisLock; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.poi.ExcelUtil; @@ -12,6 +15,7 @@ import com.ruoyi.quot.service.IQuotService; import com.ruoyi.system.service.ISysNoticeService; import com.ruoyi.technicalConfirm.domain.QuotJsqr; import com.ruoyi.technicalConfirm.domain.QuotJsqrXzDetail; +import com.ruoyi.technicalConfirm.domain.QuotJsqrXzRemark; import com.ruoyi.technicalConfirm.service.IQuotJsqrService; import com.ruoyi.web.utils.SendNotice.NoticeUtil; import org.springframework.security.access.prepost.PreAuthorize; @@ -51,6 +55,12 @@ public class QuotJsqrController extends BaseController @Autowired private ISysNoticeService noticeService; + @Autowired + private RedisCache redisCache; + + @Autowired + private RedisLock redisLock; + /** * 查询报价单-技术确认单列表 */ @@ -116,8 +126,11 @@ public class QuotJsqrController extends BaseController @PostMapping("/doOperate") public AjaxResult doOperate(HttpServletResponse response, @RequestBody QuotJsqrXzDetail info) { + String currentUser = getLoginUser().getUser().getNickName(); + QuotJsqr quotJsqr = new QuotJsqr(); String quotJsqrId = info.getQuotJsqrId(); + QuotJsqr quotJsqrEntity = quotJsqrService.selectQuotJsqrByQuotJsqrId(quotJsqrId); quotJsqr.setQuotJsqrId(quotJsqrId); String quotJsxzGroup = info.getQuotJsxzGroup();//组名 @@ -133,6 +146,14 @@ public class QuotJsqrController extends BaseController quotJsqr.setQuotJsqrTlRemark(info.getQuotJsqrTlRemark()); String quotJsqrTlRemark = info.getQuotJsqrTlRemark(); + + if("2".equals(quotJsqrEntity.getQuotJsqrTlOperateState())){ + return error("特缆协助操作人已通过,请勿重复操作"); + } + if("3".equals(quotJsqrEntity.getQuotJsqrTlOperateState())){ + return error("特缆协助操作人已被驳回,请勿重复操作"); + } + if("3".equals(state)){//驳回 if(StringUtils.isEmpty(quotJsqrTlRemark)){ return error("特缆协助说明不能为空"); @@ -143,6 +164,13 @@ public class QuotJsqrController extends BaseController return error("特缆反馈附件 或 特缆协助说明 至少填写一项"); } } + + // 清空redis 协助说明key + String hvalue = redisCache.getCacheMapValue("quotJsqrXzRemark",quotJsqrEntity.getQuotJsqrCode()+"_TL"); + if(StringUtils.isNotEmpty(hvalue) && currentUser.equals(hvalue)){ + redisCache.deleteCacheMapValue("quotJsqrXzRemark",quotJsqrEntity.getQuotJsqrCode()+"_TL"); + redisLock.unLock(quotJsqrEntity.getQuotJsqrCode()+"_TL",currentUser); + } } if("checker".equals(type)){//审核人通过、驳回 quotJsqr.setQuotJsqrTlCheckUserName(getLoginUser().getUser().getNickName()); @@ -183,6 +211,14 @@ public class QuotJsqrController extends BaseController quotJsqr.setQuotJsqrDyRemark(info.getQuotJsqrDyRemark()); String quotJsqrDyRemark = info.getQuotJsqrDyRemark(); + + if("2".equals(quotJsqrEntity.getQuotJsqrDyOperateState())){ + return error("低压协助操作人已通过,请勿重复操作"); + } + if("3".equals(quotJsqrEntity.getQuotJsqrDyOperateState())){ + return error("低压协助操作人已被驳回,请勿重复操作"); + } + if("3".equals(state)){//驳回 if(StringUtils.isEmpty(quotJsqrDyRemark)){ return error("低压协助说明不能为空"); @@ -193,6 +229,13 @@ public class QuotJsqrController extends BaseController return error("低压反馈附件 或 低压协助说明 至少填写一项"); } } + + // 清空redis 协助说明key + String hvalue = redisCache.getCacheMapValue("quotJsqrXzRemark",quotJsqrEntity.getQuotJsqrCode()+"_DY"); + if(StringUtils.isNotEmpty(hvalue) && currentUser.equals(hvalue)){ + redisCache.deleteCacheMapValue("quotJsqrXzRemark",quotJsqrEntity.getQuotJsqrCode()+"_DY"); + redisLock.unLock(quotJsqrEntity.getQuotJsqrCode()+"_DY",currentUser); + } } if("checker".equals(type)){//审核人通过、驳回 quotJsqr.setQuotJsqrDyCheckUserName(getLoginUser().getUser().getNickName()); @@ -233,6 +276,14 @@ public class QuotJsqrController extends BaseController quotJsqr.setQuotJsqrZyRemark(info.getQuotJsqrZyRemark()); String quotJsqrZyRemark = info.getQuotJsqrZyRemark(); + + if("2".equals(quotJsqrEntity.getQuotJsqrZyOperateState())){ + return error("中压协助操作人已通过,请勿重复操作"); + } + if("3".equals(quotJsqrEntity.getQuotJsqrZyOperateState())){ + return error("中压协助操作人已被驳回,请勿重复操作"); + } + if("3".equals(state)){//驳回 if(StringUtils.isEmpty(quotJsqrZyRemark)){ return error("中压协助说明不能为空"); @@ -243,6 +294,13 @@ public class QuotJsqrController extends BaseController return error("中压反馈附件 或 低压协助说明 至少填写一项"); } } + + // 清空redis 协助说明key + String hvalue = redisCache.getCacheMapValue("quotJsqrXzRemark",quotJsqrEntity.getQuotJsqrCode()+"_ZY"); + if(StringUtils.isNotEmpty(hvalue) && currentUser.equals(hvalue)){ + redisCache.deleteCacheMapValue("quotJsqrXzRemark",quotJsqrEntity.getQuotJsqrCode()+"_ZY"); + redisLock.unLock(quotJsqrEntity.getQuotJsqrCode()+"_ZY",currentUser); + } } if("checker".equals(type)){//审核人通过、驳回 quotJsqr.setQuotJsqrZyCheckUserName(getLoginUser().getUser().getNickName()); @@ -284,6 +342,14 @@ public class QuotJsqrController extends BaseController quotJsqr.setQuotJsqrQtRemark(info.getQuotJsqrQtRemark()); String quotJsqrQtRemark = info.getQuotJsqrQtRemark(); + + if("2".equals(quotJsqrEntity.getQuotJsqrQtOperateState())){ + return error("其他协助操作人已通过,请勿重复操作"); + } + if("3".equals(quotJsqrEntity.getQuotJsqrQtOperateState())){ + return error("其他协助操作人已被驳回,请勿重复操作"); + } + if("3".equals(state)){//驳回 if(StringUtils.isEmpty(quotJsqrQtRemark)){ return error("其他协助说明不能为空"); @@ -294,6 +360,13 @@ public class QuotJsqrController extends BaseController return error("其他反馈附件 或 其他协助说明 至少填写一项"); } } + + // 清空redis 协助说明key + String hvalue = redisCache.getCacheMapValue("quotJsqrXzRemark",quotJsqrEntity.getQuotJsqrCode()+"_QT"); + if(StringUtils.isNotEmpty(hvalue) && currentUser.equals(hvalue)){ + redisCache.deleteCacheMapValue("quotJsqrXzRemark",quotJsqrEntity.getQuotJsqrCode()+"_QT"); + redisLock.unLock(quotJsqrEntity.getQuotJsqrCode()+"_QT",currentUser); + } } if("checker".equals(type)){//审核人通过、驳回 quotJsqr.setQuotJsqrQtCheckUserName(getLoginUser().getUser().getNickName()); @@ -411,4 +484,45 @@ public class QuotJsqrController extends BaseController List userIds = noticeService.getSendEmp(WebsocketConst.MSG_SEND_QUOT_BJZ); NoticeUtil.sendNoticesBusiness(loginUser,"有报价单已完成技术协助","单号:"+quotJsqr.getQuotCode(),userIds); } + + /** + * 监听协助说明,有数据输入则加入redis + */ + @PostMapping("/setRedisJsxz") + public AjaxResult setRedisJsxz(HttpServletResponse response, @RequestBody QuotJsqrXzRemark info) + { + String currentUser = getLoginUser().getUser().getNickName(); + String type = info.getType(); + String quotJsqrCode = info.getQuotJsqrCode(); + String remark = info.getRemark(); + + if(StringUtils.isNotBlank(remark)){ + // 判断 redis 中有无 quotJsqrXzRemark key + Boolean lock = redisLock.getLock(quotJsqrCode+"_"+type, 10,currentUser); + if(lock){ + String hvalue = redisCache.getCacheMapValue("quotJsqrXzRemark",quotJsqrCode+"_"+type); + if(StringUtils.isEmpty(hvalue)){ + redisCache.setCacheMapValue("quotJsqrXzRemark",quotJsqrCode+"_"+type,currentUser); + }else if(!hvalue.equals(currentUser)){ + return error("当前有其他用户【"+hvalue+"】正在录入"); + } + }else{ + String hvalue = redisCache.getCacheMapValue("quotJsqrXzRemark",quotJsqrCode+"_"+type); + if(StringUtils.isNotEmpty(hvalue)){ + if(!currentUser.equals(hvalue)){ + return error("当前有其他用户【"+hvalue+"】正在录入"); + } + }else{ + return error("当前有其他用户【"+redisCache.getCacheMapValue("quotJsqrXzRemark",quotJsqrCode+"_"+type)+"】正在录入"); + } + } + }else{// 清空 协助说明时清空redis对应的值 + String hvalue = redisCache.getCacheMapValue("quotJsqrXzRemark",quotJsqrCode+"_"+type); + if(StringUtils.isNotEmpty(hvalue) && currentUser.equals(hvalue)){ + redisCache.deleteCacheMapValue("quotJsqrXzRemark",quotJsqrCode+"_"+type); + redisLock.unLock(quotJsqrCode+"_"+type,currentUser); + } + } + return success(); + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/technicalConfirm/domain/QuotJsqrXzRemark.java b/ruoyi-system/src/main/java/com/ruoyi/technicalConfirm/domain/QuotJsqrXzRemark.java new file mode 100644 index 0000000..86eb8e4 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/technicalConfirm/domain/QuotJsqrXzRemark.java @@ -0,0 +1,31 @@ +package com.ruoyi.technicalConfirm.domain; + +public class QuotJsqrXzRemark { + private String type; + private String quotJsqrCode; + private String remark; + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getQuotJsqrCode() { + return quotJsqrCode; + } + + public void setQuotJsqrCode(String quotJsqrCode) { + this.quotJsqrCode = quotJsqrCode; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } +} diff --git a/ruoyi-ui/src/api/technicalConfirm/technicalConfirm.js b/ruoyi-ui/src/api/technicalConfirm/technicalConfirm.js index a03d850..1e1a05f 100644 --- a/ruoyi-ui/src/api/technicalConfirm/technicalConfirm.js +++ b/ruoyi-ui/src/api/technicalConfirm/technicalConfirm.js @@ -60,3 +60,12 @@ export function commitQuot(data) { data: data }) } + +// 监听协助说明,有数据输入则加入redis +export function setRedisJsxz(param) { + return request({ + url: '/jsqr/jsqr/setRedisJsxz', + method: 'post', + data: param + }) +} diff --git a/ruoyi-ui/src/views/technicalConfirm/technicalConfirm/jsxzInfo.vue b/ruoyi-ui/src/views/technicalConfirm/technicalConfirm/jsxzInfo.vue index c98080e..26bca08 100644 --- a/ruoyi-ui/src/views/technicalConfirm/technicalConfirm/jsxzInfo.vue +++ b/ruoyi-ui/src/views/technicalConfirm/technicalConfirm/jsxzInfo.vue @@ -802,7 +802,7 @@ }