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