Compare commits

...

2 Commits

Author SHA1 Message Date
xd cf14e00ff8 Merge branch 'main' of http://jialcheerful.club:3000/xd/JNBusiness 2024-06-25 14:42:39 +08:00
xd 5167cce29a '1112222' 2024-06-25 14:41:59 +08:00
4 changed files with 190 additions and 1 deletions

View File

@ -2,8 +2,11 @@ package com.ruoyi.web.controller.technicalConfirm;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.constant.WebsocketConst; import com.ruoyi.common.constant.WebsocketConst;
import com.ruoyi.common.core.domain.model.LoginUser; 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.DateUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil; 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.system.service.ISysNoticeService;
import com.ruoyi.technicalConfirm.domain.QuotJsqr; import com.ruoyi.technicalConfirm.domain.QuotJsqr;
import com.ruoyi.technicalConfirm.domain.QuotJsqrXzDetail; import com.ruoyi.technicalConfirm.domain.QuotJsqrXzDetail;
import com.ruoyi.technicalConfirm.domain.QuotJsqrXzRemark;
import com.ruoyi.technicalConfirm.service.IQuotJsqrService; import com.ruoyi.technicalConfirm.service.IQuotJsqrService;
import com.ruoyi.web.utils.SendNotice.NoticeUtil; import com.ruoyi.web.utils.SendNotice.NoticeUtil;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
@ -51,6 +55,12 @@ public class QuotJsqrController extends BaseController
@Autowired @Autowired
private ISysNoticeService noticeService; private ISysNoticeService noticeService;
@Autowired
private RedisCache redisCache;
@Autowired
private RedisLock redisLock;
/** /**
* 查询报价单-技术确认单列表 * 查询报价单-技术确认单列表
*/ */
@ -116,8 +126,11 @@ public class QuotJsqrController extends BaseController
@PostMapping("/doOperate") @PostMapping("/doOperate")
public AjaxResult doOperate(HttpServletResponse response, @RequestBody QuotJsqrXzDetail info) public AjaxResult doOperate(HttpServletResponse response, @RequestBody QuotJsqrXzDetail info)
{ {
String currentUser = getLoginUser().getUser().getNickName();
QuotJsqr quotJsqr = new QuotJsqr(); QuotJsqr quotJsqr = new QuotJsqr();
String quotJsqrId = info.getQuotJsqrId(); String quotJsqrId = info.getQuotJsqrId();
QuotJsqr quotJsqrEntity = quotJsqrService.selectQuotJsqrByQuotJsqrId(quotJsqrId);
quotJsqr.setQuotJsqrId(quotJsqrId); quotJsqr.setQuotJsqrId(quotJsqrId);
String quotJsxzGroup = info.getQuotJsxzGroup();//组名 String quotJsxzGroup = info.getQuotJsxzGroup();//组名
@ -133,6 +146,14 @@ public class QuotJsqrController extends BaseController
quotJsqr.setQuotJsqrTlRemark(info.getQuotJsqrTlRemark()); quotJsqr.setQuotJsqrTlRemark(info.getQuotJsqrTlRemark());
String quotJsqrTlRemark = 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("3".equals(state)){//驳回
if(StringUtils.isEmpty(quotJsqrTlRemark)){ if(StringUtils.isEmpty(quotJsqrTlRemark)){
return error("特缆协助说明不能为空"); return error("特缆协助说明不能为空");
@ -143,6 +164,13 @@ public class QuotJsqrController extends BaseController
return error("特缆反馈附件 或 特缆协助说明 至少填写一项"); 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)){//审核人通过驳回 if("checker".equals(type)){//审核人通过驳回
quotJsqr.setQuotJsqrTlCheckUserName(getLoginUser().getUser().getNickName()); quotJsqr.setQuotJsqrTlCheckUserName(getLoginUser().getUser().getNickName());
@ -183,6 +211,14 @@ public class QuotJsqrController extends BaseController
quotJsqr.setQuotJsqrDyRemark(info.getQuotJsqrDyRemark()); quotJsqr.setQuotJsqrDyRemark(info.getQuotJsqrDyRemark());
String quotJsqrDyRemark = 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("3".equals(state)){//驳回
if(StringUtils.isEmpty(quotJsqrDyRemark)){ if(StringUtils.isEmpty(quotJsqrDyRemark)){
return error("低压协助说明不能为空"); return error("低压协助说明不能为空");
@ -193,6 +229,13 @@ public class QuotJsqrController extends BaseController
return error("低压反馈附件 或 低压协助说明 至少填写一项"); 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)){//审核人通过驳回 if("checker".equals(type)){//审核人通过驳回
quotJsqr.setQuotJsqrDyCheckUserName(getLoginUser().getUser().getNickName()); quotJsqr.setQuotJsqrDyCheckUserName(getLoginUser().getUser().getNickName());
@ -233,6 +276,14 @@ public class QuotJsqrController extends BaseController
quotJsqr.setQuotJsqrZyRemark(info.getQuotJsqrZyRemark()); quotJsqr.setQuotJsqrZyRemark(info.getQuotJsqrZyRemark());
String quotJsqrZyRemark = 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("3".equals(state)){//驳回
if(StringUtils.isEmpty(quotJsqrZyRemark)){ if(StringUtils.isEmpty(quotJsqrZyRemark)){
return error("中压协助说明不能为空"); return error("中压协助说明不能为空");
@ -243,6 +294,13 @@ public class QuotJsqrController extends BaseController
return error("中压反馈附件 或 低压协助说明 至少填写一项"); 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)){//审核人通过驳回 if("checker".equals(type)){//审核人通过驳回
quotJsqr.setQuotJsqrZyCheckUserName(getLoginUser().getUser().getNickName()); quotJsqr.setQuotJsqrZyCheckUserName(getLoginUser().getUser().getNickName());
@ -284,6 +342,14 @@ public class QuotJsqrController extends BaseController
quotJsqr.setQuotJsqrQtRemark(info.getQuotJsqrQtRemark()); quotJsqr.setQuotJsqrQtRemark(info.getQuotJsqrQtRemark());
String quotJsqrQtRemark = 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("3".equals(state)){//驳回
if(StringUtils.isEmpty(quotJsqrQtRemark)){ if(StringUtils.isEmpty(quotJsqrQtRemark)){
return error("其他协助说明不能为空"); return error("其他协助说明不能为空");
@ -294,6 +360,13 @@ public class QuotJsqrController extends BaseController
return error("其他反馈附件 或 其他协助说明 至少填写一项"); 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)){//审核人通过驳回 if("checker".equals(type)){//审核人通过驳回
quotJsqr.setQuotJsqrQtCheckUserName(getLoginUser().getUser().getNickName()); quotJsqr.setQuotJsqrQtCheckUserName(getLoginUser().getUser().getNickName());
@ -411,4 +484,45 @@ public class QuotJsqrController extends BaseController
List<String> userIds = noticeService.getSendEmp(WebsocketConst.MSG_SEND_QUOT_BJZ); List<String> userIds = noticeService.getSendEmp(WebsocketConst.MSG_SEND_QUOT_BJZ);
NoticeUtil.sendNoticesBusiness(loginUser,"有报价单已完成技术协助","单号:"+quotJsqr.getQuotCode(),userIds); 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();
}
} }

View File

@ -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;
}
}

View File

@ -60,3 +60,12 @@ export function commitQuot(data) {
data: data data: data
}) })
} }
// 监听协助说明有数据输入则加入redis
export function setRedisJsxz(param) {
return request({
url: '/jsqr/jsqr/setRedisJsxz',
method: 'post',
data: param
})
}

View File

@ -802,7 +802,7 @@
} }
</style> </style>
<script> <script>
import { getJsqr, doOperate, commitQuot } from "@/api/technicalConfirm/technicalConfirm"; import { getJsqr, doOperate, commitQuot, setRedisJsxz } from "@/api/technicalConfirm/technicalConfirm";
import { getToken } from "@/utils/auth"; import { getToken } from "@/utils/auth";
import { quotFileList,quotFileDelete } from "@/api/quot/quot"; import { quotFileList,quotFileDelete } from "@/api/quot/quot";
@ -1470,7 +1470,42 @@
// //
downloadFile(fileUrl){ downloadFile(fileUrl){
window.open(fileUrl, "_blank"); window.open(fileUrl, "_blank");
}
},
watch: {
// redis
'form.quotJsqrTlRemark':function(newValue, oldValue) {
let param = {}
param.quotJsqrCode = this.form.quotJsqrCode;
param.type = "TL";// DY ZY TL QT
param.remark = this.form.quotJsqrTlRemark;
setRedisJsxz(param).then(response => {
})
}, },
'form.quotJsqrDyRemark':function(newValue, oldValue) {
let param = {}
param.quotJsqrCode = this.form.quotJsqrCode;
param.type = "DY";// DY ZY TL QT
param.remark = this.form.quotJsqrDyRemark;
setRedisJsxz(param).then(response => {
})
},
'form.quotJsqrZyRemark':function(newValue, oldValue) {
let param = {}
param.quotJsqrCode = this.form.quotJsqrCode;
param.type = "ZY";// DY ZY TL QT
param.remark = this.form.quotJsqrZyRemark;
setRedisJsxz(param).then(response => {
})
},
'form.quotJsqrQtRemark':function(newValue, oldValue) {
let param = {}
param.quotJsqrCode = this.form.quotJsqrCode;
param.type = "QT";// DY ZY TL QT
param.remark = this.form.quotJsqrQtRemark;
setRedisJsxz(param).then(response => {
})
}
} }
} }
</script> </script>