bug修复
This commit is contained in:
parent
cf66d1dd04
commit
b377c3b650
@ -133,9 +133,7 @@ public class BusiNoticeController extends BaseController
|
||||
@Log(title = "通告", businessType = BusinessType.INSERT)
|
||||
@PostMapping("saveOrUpdate")
|
||||
public AjaxResult saveOrUpdate(@RequestBody BusiNotice busiNotice) throws Exception {
|
||||
JSONObject res = new JSONObject();
|
||||
res.put("noticeId", busiNoticeService.saveOrUpdateVo(busiNotice));
|
||||
return success(res);
|
||||
return success(busiNoticeService.saveOrUpdateVo(busiNotice));
|
||||
}
|
||||
|
||||
|
||||
|
@ -162,6 +162,8 @@ public class BusiNotice extends DlBaseEntity
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
|
||||
@Excel(name = "审核时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date approvalTime;
|
||||
//三方链接
|
||||
private String thirdUrl;
|
||||
|
||||
/** 审核备注 */
|
||||
@Excel(name = "审核备注")
|
||||
|
@ -46,8 +46,8 @@ public interface IBusiNoticeService extends IService<BusiNotice>
|
||||
* 更新
|
||||
* @param data 保存参数
|
||||
*/
|
||||
void updateByIdVo(BusiNotice data);
|
||||
String saveOrUpdateVo(BusiNotice data) throws Exception;
|
||||
JSONObject updateByIdVo(BusiNotice data);
|
||||
JSONObject saveOrUpdateVo(BusiNotice data) throws Exception;
|
||||
void removeByIdsVo(List<String> ids);
|
||||
|
||||
/**
|
||||
|
@ -122,6 +122,7 @@ public class BusiNoticeServiceImpl extends ServiceImpl<BusiNoticeMapper,BusiNoti
|
||||
data.setUserId(SecurityUtils.getUserId());
|
||||
if (StringUtils.isNotEmpty(data.getApprovalStatus())&&data.getApprovalStatus().equals("8")){
|
||||
//草稿数据直接保存
|
||||
data.setCreateTime(new Date());
|
||||
this.save(data);
|
||||
result.put("code",100);
|
||||
result.put("msg","草稿数据暂存成功");
|
||||
@ -137,13 +138,10 @@ public class BusiNoticeServiceImpl extends ServiceImpl<BusiNoticeMapper,BusiNoti
|
||||
data.setApprovalTime(new Date());
|
||||
//遍历 list的每条数据与data对比,如果两条数据相似度大于70% 提出预警
|
||||
for (BusiNotice busiNotice : list) {
|
||||
String tempTitle1 = data.getTitle().replaceAll("<br>","");
|
||||
String tempTitle2 = busiNotice.getTitle().replaceAll("<br>","");
|
||||
String tempDetail1 = data.getDetail().replaceAll("<br>","");
|
||||
String tempDetail2 = busiNotice.getDetail().replaceAll("<br>","");
|
||||
double v1 = NoticeUtils.computeJaccardSimilarity(tempTitle1, tempTitle2);
|
||||
String tempDetail1 = data.getDetail().replaceAll("<br>","").replaceAll("\n","");
|
||||
String tempDetail2 = busiNotice.getDetail().replaceAll("<br>","").replaceAll("\n","");
|
||||
double v2 = NoticeUtils.computeJaccardSimilarity(tempDetail1, tempDetail2);
|
||||
if (v1>=0.7&&v2>=0.7){
|
||||
if (v2>=0.7){
|
||||
//title 和 detail 相似度大于70% 待审核
|
||||
data.setApprovalStatus("0");
|
||||
data.setApprovalTime(null);
|
||||
@ -156,7 +154,7 @@ public class BusiNoticeServiceImpl extends ServiceImpl<BusiNoticeMapper,BusiNoti
|
||||
//删除结尾的最后一个逗号
|
||||
data.setSimilarityIds(data.getSimilarityIds().substring(0, data.getSimilarityIds().length() - 1));
|
||||
}
|
||||
|
||||
data.setCreateTime(new Date());
|
||||
this.save(data);
|
||||
if(data.getApprovalStatus().equals("1")){
|
||||
//如果审核通过
|
||||
@ -167,13 +165,11 @@ public class BusiNoticeServiceImpl extends ServiceImpl<BusiNoticeMapper,BusiNoti
|
||||
memberPoints.setFromCode("fbgg");
|
||||
memberPointsService.savePoints(memberPoints);
|
||||
}
|
||||
|
||||
try {
|
||||
cardService.dealMemberRights2(data.getUserId(),null,"add_notice",1);
|
||||
}catch (Exception e){
|
||||
//若是急招扣除对应急招券
|
||||
if (StringUtils.isNotEmpty(data.getIsUrgent())&&data.getIsUrgent().equals("1")){
|
||||
memberCouponService.saveCoupon( data.getUserId(), "2", data.getId(), 1);
|
||||
}
|
||||
|
||||
cardService.dealMemberRights2(data.getUserId(),null,"add_notice",1);
|
||||
if (CollectionUtil.isNotEmpty(data.getCustomForm())) {
|
||||
cardService.dealMemberRights2(data.getUserId(),null,"report_info_collect",1);
|
||||
}
|
||||
@ -200,7 +196,7 @@ public class BusiNoticeServiceImpl extends ServiceImpl<BusiNoticeMapper,BusiNoti
|
||||
|
||||
|
||||
@Override
|
||||
public void updateByIdVo(BusiNotice data) {
|
||||
public JSONObject updateByIdVo(BusiNotice data) {
|
||||
|
||||
//获取当前登录用户
|
||||
data.setUserId(SecurityUtils.getUserId());
|
||||
@ -247,12 +243,12 @@ public class BusiNoticeServiceImpl extends ServiceImpl<BusiNoticeMapper,BusiNoti
|
||||
busiNoticeFormService.save(noticeForm);
|
||||
}
|
||||
}
|
||||
|
||||
return new JSONObject();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public String saveOrUpdateVo(BusiNotice data) throws Exception {
|
||||
public JSONObject saveOrUpdateVo(BusiNotice data) throws Exception {
|
||||
if(ObjectUtil.isNotEmpty(data.getCityId())){
|
||||
//转换城市名称
|
||||
LambdaQueryWrapper<BaseCity> queryWrapper =new LambdaQueryWrapper<>();
|
||||
@ -266,11 +262,11 @@ public class BusiNoticeServiceImpl extends ServiceImpl<BusiNoticeMapper,BusiNoti
|
||||
data.setProvince(parentCity.getName());
|
||||
}
|
||||
if (StringUtils.isNotEmpty(data.getId())){
|
||||
this.updateByIdVo(data);
|
||||
return this.updateByIdVo(data);
|
||||
}else {
|
||||
this.saveVo(data);
|
||||
return this.saveVo(data);
|
||||
}
|
||||
return data.getId();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -19,18 +19,29 @@ public class NoticeUtils {
|
||||
* @return 相似度值,范围在0到1之间,值越大相似度越高
|
||||
*/
|
||||
public static double computeJaccardSimilarity(String str1, String str2) {
|
||||
Set<String> set1 = Arrays.stream(str1.split("\\s+")) // 分词,这里按空格分割,可以根据需要调整正则表达式
|
||||
.collect(Collectors.toSet());
|
||||
Set<String> set2 = Arrays.stream(str2.split("\\s+")) // 分词,这里按空格分割,可以根据需要调整正则表达式
|
||||
.collect(Collectors.toSet());
|
||||
if (str1 == null || str2 == null || (str1.isEmpty() && str2.isEmpty())) {
|
||||
return 1.0; // 空字符串认为完全相同
|
||||
}
|
||||
if (str1.isEmpty() || str2.isEmpty()) {
|
||||
return 0.0; // 一个为空另一个非空,认为完全不同
|
||||
}
|
||||
|
||||
Set<String> set1 = Arrays.stream(str1.split("\\s+")).collect(Collectors.toSet());
|
||||
Set<String> set2 = Arrays.stream(str2.split("\\s+")).collect(Collectors.toSet());
|
||||
|
||||
Set<String> intersection = new HashSet<>(set1);
|
||||
intersection.retainAll(set2); // 取交集
|
||||
intersection.retainAll(set2);
|
||||
|
||||
Set<String> union = new HashSet<>(set1);
|
||||
union.addAll(set2); // 取并集
|
||||
union.removeAll(intersection); // 从并集中移除交集部分(因为我们只计算交集的元素)
|
||||
return (double) intersection.size() / union.size(); // 返回相似度比例
|
||||
union.addAll(set2); // 正确的并集
|
||||
|
||||
if (union.isEmpty()) {
|
||||
return 0.0; // 安全处理,避免除以零
|
||||
}
|
||||
|
||||
return (double) intersection.size() / union.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* 翻译通告的博主类型字典
|
||||
* @author vinjor-M
|
||||
|
@ -56,7 +56,7 @@ public class MemberCouponServiceImpl extends ServiceImpl<MemberCouponMapper,Memb
|
||||
if ("2".equals(type)){
|
||||
int initNum = getCoupon(userId);
|
||||
if (initNum == 0) {
|
||||
throw new Exception("暂无可用报名次数");
|
||||
throw new Exception("暂无可用急招券");
|
||||
}
|
||||
}
|
||||
//查询当前用户最新变动记录
|
||||
|
@ -83,6 +83,7 @@ public class MemberPointsServiceImpl extends ServiceImpl<MemberPointsMapper, Mem
|
||||
}
|
||||
memberPoints.setBalance(newBalance);
|
||||
}
|
||||
memberPoints.setStatus("01");
|
||||
save(memberPoints);
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ public class MemberRightsServiceImpl extends ServiceImpl<MemberRightsMapper, Mem
|
||||
MemberRights max = maxRights.get(0);
|
||||
if (!("02".equals(max.getRightsType()) && max.getRightsValue() == 0)) {
|
||||
int result = max.getRemaining() - deplete;
|
||||
if (result == 0) {
|
||||
if (result < 0) {
|
||||
throw new Exception("今日次数已达上限");
|
||||
}
|
||||
max.setRemaining(result);
|
||||
@ -126,22 +126,22 @@ public class MemberRightsServiceImpl extends ServiceImpl<MemberRightsMapper, Mem
|
||||
/**
|
||||
* 取出权益最大值
|
||||
* @author PQZ
|
||||
* @date 18:03 2025/4/24
|
||||
* @date 18:03 2025/4/24
|
||||
* @param rights {@link MemberRights}
|
||||
* @return java.util.List<com.ruoyi.member.domain.MemberRights>
|
||||
**/
|
||||
private List<MemberRights> getRightsValueZeroOrMax(List<MemberRights> rights) {
|
||||
// 先找 rightsValue==0 的数据
|
||||
// 先找 rightsValue==0 的数据
|
||||
List<MemberRights> zeroList = rights.stream()
|
||||
.filter(r -> r.getRightsValue() == 0)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (!zeroList.isEmpty()) {
|
||||
// 有 0 的返回所有 0 的数据
|
||||
// 有 0 的返回所有 0 的数据
|
||||
return zeroList;
|
||||
}
|
||||
|
||||
// 没 0,再找最大值
|
||||
// 没 0,再找最大值
|
||||
int max = rights.stream()
|
||||
.mapToInt(MemberRights::getRightsValue)
|
||||
.max()
|
||||
|
@ -318,7 +318,7 @@ order by dbns.create_time desc
|
||||
AND (dbn.approval_status = '1')
|
||||
<if test="entity.searchValue!=null and entity.searchValue!='' ">
|
||||
AND (dbn.title LIKE CONCAT('%',#{entity.searchValue},'%') OR
|
||||
dbn.gift_detail LIKE CONCAT('%',#{entity.searchValue},'%'))
|
||||
dbn.detail LIKE CONCAT('%',#{entity.searchValue},'%'))
|
||||
</if>
|
||||
<if test="entity.reportStatus!=null and entity.reportStatus!='' ">
|
||||
<choose>
|
||||
@ -362,7 +362,7 @@ order by dbns.create_time desc
|
||||
dbn.del_flag = 0 and dbn.approval_status !=8 and dbn.user_id = #{entity.userId}
|
||||
<if test="entity.searchValue!=null and entity.searchValue!='' ">
|
||||
AND (dbn.title LIKE CONCAT('%',#{entity.searchValue},'%') OR
|
||||
dbn.gift_detail LIKE CONCAT('%',#{entity.searchValue},'%'))
|
||||
dbn.detail LIKE CONCAT('%',#{entity.searchValue},'%'))
|
||||
</if>
|
||||
<if test="entity.status!=null and entity.status!='' ">
|
||||
<choose>
|
||||
|
Loading…
Reference in New Issue
Block a user