This commit is contained in:
PQZ 2025-04-25 10:23:39 +08:00
commit 6147418efe
14 changed files with 194 additions and 37 deletions

View File

@ -228,8 +228,7 @@ public class BusiNoticeController extends BaseController
@RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize)
{
Page<BusiNotice> page = new Page<>(pageNum, pageSize);
IPage<BusiNoticeVo> list = busiNoticeService.appFootprintList(query,page);
List<BusiNoticeVo> list = busiNoticeService.appFootprintList(query);
return success(list);
}

View File

@ -52,6 +52,10 @@ public class BusiNotice extends DlBaseEntity
private String province;
/** 城市 */
private String city;
/**
* 是否急招0否1是
*/
private String isUrgent;
//是否平台结算
private Integer isPlatformFree;
/** 稿费下限 */

View File

@ -43,11 +43,10 @@ public class BusiNoticeSign extends DlBaseEntity
private String nickname;
/** 报名用户头像 */
@Excel(name = "报名用户头像")
@Excel(name = "报名用户头像", cellType = Excel.ColumnType.IMAGE)
private String avatar;
/** 是否超级报名 */
@Excel(name = "是否超级报名")
private String isSuper;
/** 联系方式 */
@ -59,18 +58,18 @@ public class BusiNoticeSign extends DlBaseEntity
private String addrId;
/** 通告合作状态 */
@Excel(name = "通告合作状态")
private String status;
/** 稿件内容 */
private String content;
/** 稿件图片 */
@Excel(name = "稿件图片")
private String images;
/** 已发布的文章链接 */
@Excel(name = "已发布的文章链接")
private String articleRef;
/**
* 动态表单json

View File

@ -49,7 +49,7 @@ public interface BusiNoticeMapper extends BaseMapper<BusiNotice> {
* @param query 查询条件
* @return com.ruoyi.common.core.domain.AjaxResult
**/
IPage<BusiNoticeVo> appFootprintList(@Param("entity") AppNoticeQuery query, Page<BusiNotice> page);
List<BusiNoticeVo> appFootprintList(@Param("entity") AppNoticeQuery query, @Param("num") Integer num);
/**
* 小程序端查询订阅通告列表

View File

@ -37,5 +37,11 @@ public class AppNoticeQuery {
//'进行中', '已关闭'
private String status;
private String noticeId;
//是否急招
private String isUrgent;
//是否平台结算
private String isPlatformFree;
}

View File

@ -79,7 +79,7 @@ public interface IBusiNoticeService extends IService<BusiNotice>
* @param query 查询条件
* @return com.ruoyi.common.core.domain.AjaxResult
**/
IPage<BusiNoticeVo> appFootprintList(AppNoticeQuery query, Page<BusiNotice> page);
List<BusiNoticeVo> appFootprintList(AppNoticeQuery query);
/**

View File

@ -36,6 +36,7 @@ import com.ruoyi.member.domain.MemberApply;
import com.ruoyi.member.domain.MemberUser;
import com.ruoyi.member.service.IMemberApplyService;
import com.ruoyi.member.service.IMemberCardService;
import com.ruoyi.member.service.IMemberCouponService;
import com.ruoyi.member.service.IMemberUserService;
import com.ruoyi.system.service.ISysDictDataService;
import com.ruoyi.system.service.ISysDictTypeService;
@ -83,6 +84,8 @@ public class BusiNoticeServiceImpl extends ServiceImpl<BusiNoticeMapper,BusiNoti
@Resource
private IMemberCardService cardService;
@Autowired
private IMemberCouponService memberCouponService;
@Override
public IPage<BusiNoticeVo> queryListPage(BusiNoticeQuery query, Page<BusiNotice> page) {
@ -216,7 +219,12 @@ public class BusiNoticeServiceImpl extends ServiceImpl<BusiNoticeMapper,BusiNoti
}else {
this.saveVo(data);
}
cardService.dealMemberRights(userId,null,"add_notice",1);
try {
cardService.dealMemberRights(userId,null,"add_notice",1);
}catch (Exception e){
memberCouponService.saveCoupon( userId, "2", data.getId(), 1);
}
if (CollectionUtil.isNotEmpty(data.getCustomForm())) {
cardService.dealMemberRights(userId,null,"report_info_collect",1);
}
@ -346,16 +354,17 @@ public class BusiNoticeServiceImpl extends ServiceImpl<BusiNoticeMapper,BusiNoti
* @return com.ruoyi.common.core.domain.AjaxResult
**/
@Override
public IPage<BusiNoticeVo> appFootprintList(AppNoticeQuery query, Page<BusiNotice> page) {
public List<BusiNoticeVo> appFootprintList(AppNoticeQuery query) {
query.setUserId(SecurityUtils.getUserId());
IPage<BusiNoticeVo> pageList = busiNoticeMapper.appFootprintList(query,page);
List<String> idList = pageList.getRecords().stream().map(BusiNotice::getId).collect(Collectors.toList());
Integer num = cardService.getCardRightsValue(SecurityUtils.getUserId(), "02", "history");
List<BusiNoticeVo> pageList = busiNoticeMapper.appFootprintList(query,num);
List<String> idList = pageList.stream().map(BusiNotice::getId).collect(Collectors.toList());
if(!idList.isEmpty()){
//查博主类型字典
List<BaseCategory> categoryList = baseCategoryService.listByParentCode(DictConstants.BLOGGER_TYPES_KEY,null);
//转map
Map<String,String> categoryMap = categoryList.stream().collect(Collectors.toMap(BaseCategory::getCode,BaseCategory::getTitle));
pageList.getRecords().forEach(item->{
pageList.forEach(item->{
//报名数量浏览量相关字典转换
if(null==item.getViewNum()){
item.setViewNum(0);

View File

@ -65,7 +65,7 @@ public class BusiNoticeSignServiceImpl extends ServiceImpl<BusiNoticeSignMapper,
busiNoticeSign.setUserId(loginUser.getUserId());
busiNoticeSign.setNickname(sysUser.getNickName());
busiNoticeSign.setAvatar(sysUser.getAvatar());
busiNoticeSign.setStatus("0");
busiNoticeSign.setStatus("01");
busiNoticeSign.setFormData(JSONArray.toJSONString(appNoticeSign.getCustomForm()));
busiNoticeSign.setCardId(cardInfo.getString("id"));
busiNoticeSign.setPrice(cardInfo.getBigDecimal("price"));

View File

@ -17,7 +17,7 @@ import java.util.List;
/**
* 用户通告券变动记录Service业务层处理
*
*
* @author vinjor-m
* @date 2025-03-17
*/
@ -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("暂无可用报名次数");
}
}
//查询当前用户最新变动记录

View File

@ -0,0 +1,36 @@
package com.ruoyi.web.controller.cos;
import com.ruoyi.system.service.CosStsService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.security.PermitAll;
import java.util.Map;
/**
* @Description: sts
* @Author: 86187
* @Date: 2025/03/20 16:34
* @Version: 1.0
*/
@RestController
@RequestMapping("/cos")
@RequiredArgsConstructor
public class CosStsController {
private final CosStsService cosStsService;
/**
* 获取cos临时密钥
*
* @return sts
*/
@GetMapping("/sts")
@PermitAll
public Map<String, Object> getCosSts() {
return cosStsService.getTempKeys();
}
}

View File

@ -173,3 +173,11 @@ dl-rights:
# 每月发布通告额度
addNotice: 3
report: 5
#################### 腾讯COS相关配置 ####################
cos:
baseUrl: notice-1348525010.cos.ap-beijing.myqcloud.com
accessKey: AKIDDbyY3Wr9D4i9LK6f085pLfleJlz60hAP
secretKey: 82kJfnu11ulW5TghV5TecVYP3TghXAZl
regionName: ap-beijing
bucketName: notice-1348525010
folderPrefix: /files

View File

@ -9,7 +9,7 @@
select main.id, main.user_id, main.title, main.platform_code, main.province, main.city, main.fee_down, main.fee_up, main.is_self_price, main.gift_detail,
main.gift_price, main.end_date, main.brand, main.is_show_brand, main.need_num, main.fans_down, main.fans_up, main.is_eligible, main.pic, main.collect, main.detail, main.images,
main.blogger_types, main.is_show_tel, main.wechat, main.tel, main.group_image, main.is_use_coupon, main.approval_status, main.approval_user_id, main.approval_time,
main.approval_remark, main.creator, main.create_time, main.updater, main.update_time, main.del_flag,
main.approval_remark, main.creator, main.create_time, main.updater, main.update_time, main.del_flag,main.is_platform_free,main.is_urgent,
uTable.nick_name as userNickName,auditTable.nick_name as approvalUserName,ifnull(noticeView.view_num,0) as viewNum,
bTable.title as platformName
from dl_busi_notice main
@ -25,6 +25,8 @@
<if test="entity.city != null "> and main.city = #{entity.city}</if>
<if test="entity.title != null and entity.title != ''"> and main.title like concat('%', #{entity.title}, '%')</if>
<if test="entity.platformCode != null and entity.platformCode != ''"> and main.platform_code = #{entity.platformCode}</if>
<if test="entity.isUrgent != null and entity.isUrgent != ''"> and main.is_urgent = #{entity.isUrgent}</if>
<if test="entity.isPlatformFree != null and entity.isPlatformFree != ''"> and main.is_platform_free = #{entity.isPlatformFree}</if>
<if test="entity.params.beginFeeDown != null and entity.params.beginFeeDown != ''">
and main.fee_down <![CDATA[>= ]]> #{entity.params.beginFeeDown}
@ -74,7 +76,7 @@ order by dbns.create_time desc
LEFT JOIN sys_user su ON dbn.user_id = su.user_id
left join dl_busi_notice_sign sign on sign.notice_id = dbn.id and sign.del_flag = 0
WHERE
dbn.del_flag = 0
dbn.del_flag = 0 and dbn.end_date &gt;= CURDATE()
AND (dbn.approval_status = '1')
<if test="entity.gift!=null and entity.gift!=''">
AND ( dbn.gift_detail IS NOT NULL AND dbn.gift_detail != '' )
@ -82,6 +84,8 @@ order by dbns.create_time desc
<if test="entity.platformCode!=null and entity.platformCode!=''">
AND ( dbn.platform_code =#{entity.platformCode} )
</if>
<if test="entity.isUrgent != null and entity.isUrgent != ''"> and dbn.is_urgent = #{entity.isUrgent}</if>
<if test="entity.isPlatformFree != null and entity.isPlatformFree != ''"> and dbn.is_platform_free = #{entity.isPlatformFree}</if>
<if test="entity.bloggerType!=null and entity.bloggerType!=''">
AND ( dbn.blogger_types LIKE CONCAT('%',#{entity.bloggerType},'%') )
</if>
@ -109,20 +113,20 @@ order by dbns.create_time desc
</if>
group by dbn.id
ORDER BY
<choose>
<when test="entity.sortBy=='new'">
-- 查最新的 --
dbn.create_time DESC
</when>
<when test="entity.sortBy=='money'">
-- 查高奖励 --
dbn.fee_up DESC
</when>
<otherwise>
-- 默认正序排列 --
dbn.create_time DESC
</otherwise>
</choose>
<choose>
<when test="entity.sortBy=='new'">
-- 查最新的 --
dbn.create_time DESC
</when>
<when test="entity.sortBy=='money'">
-- 查高奖励 --
dbn.fee_up DESC
</when>
<otherwise>
-- 默认正序排列 --
dbn.create_time DESC
</otherwise>
</choose>
</select>
<select id="selectByIdVo" resultType="com.ruoyi.busi.vo.BusiNoticeVo">
@ -159,6 +163,8 @@ order by dbns.create_time desc
<if test="entity.platformCode!=null and entity.platformCode!=''">
AND ( dbn.platform_code =#{entity.platformCode} )
</if>
<if test="entity.isUrgent != null and entity.isUrgent != ''"> and dbn.is_urgent = #{entity.isUrgent}</if>
<if test="entity.isPlatformFree != null and entity.isPlatformFree != ''"> and dbn.is_platform_free = #{entity.isPlatformFree}</if>
<if test="entity.bloggerType!=null and entity.bloggerType!=''">
AND ( dbn.blogger_types LIKE CONCAT('%',#{entity.bloggerType},'%') )
</if>
@ -200,6 +206,7 @@ order by dbns.create_time desc
dbn.create_time ASC
</otherwise>
</choose>
limit #{num}
</select>
<select id="subscribeList" resultType="com.ruoyi.busi.vo.BusiNoticeVo">
SELECT
@ -252,6 +259,8 @@ order by dbns.create_time desc
<if test="entity.feeDown!=null">
AND ( dbn.fee_down &gt;=#{entity.feeDown} )
</if>
<if test="entity.isUrgent != null and entity.isUrgent != ''"> and dbn.is_urgent = #{entity.isUrgent}</if>
<if test="entity.isPlatformFree != null and entity.isPlatformFree != ''"> and dbn.is_platform_free = #{entity.isPlatformFree}</if>
group by dbn.id
ORDER BY

View File

@ -70,13 +70,13 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<!-- JSON工具类 -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<!-- 阿里JSON解析器 -->
<dependency>
<groupId>com.alibaba.fastjson2</groupId>
@ -165,7 +165,12 @@
<artifactId>mybatis-plus</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>com.qcloud</groupId>
<artifactId>cos-sts_api</artifactId>
<version>3.1.0</version>
</dependency>
</dependencies>
</project>
</project>

View File

@ -0,0 +1,82 @@
package com.ruoyi.system.service;
import com.tencent.cloud.CosStsClient;
import com.tencent.cloud.Response;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
/**
* @Description: sts
* @Author: 86187
* @Date: 2025/03/20 16:18
* @Version: 1.0
*/
@Service
public class CosStsService {
// 你的腾讯云账号的 SecretId SecretKey
@Value("${cos.accessKey}")
private String SECRET_ID;
@Value("${cos.secretKey}")
private String SECRET_KEY;
// 存储桶所属的地域例如 "ap-shanghai"
@Value("${cos.regionName}")
private String REGION;
// 你的存储桶名例如 "example-1250000000"
@Value("${cos.bucketName}")
private String BUCKET;
// 临时密钥有效期单位秒最长不超过 2 小时7200
private static final int DURATION_SECONDS = 1800;
public Map<String, Object> getTempKeys() {
TreeMap<String, Object> config = new TreeMap<String, Object>();
try {
// api 密钥 SecretId
config.put("secretId", SECRET_ID);
// api 密钥 SecretKey
config.put("secretKey", SECRET_KEY);
// 临时密钥有效时长单位是秒
config.put("durationSeconds", 1800);
// 换成你的 bucket
config.put("bucket", BUCKET);
// 换成 bucket 所在地区
config.put("region", REGION);
// 可以通过 allowPrefixes 指定前缀数组, 例子 a.jpg 或者 a/* 或者 * (使用通配符*存在重大安全风险, 请谨慎评估使用)
config.put("allowPrefixes", new String[] {
"*"
});
// 密钥的权限列表简单上传和分片需要以下的权限其他权限列表请看 https://cloud.tencent.com/document/product/436/31923
String[] allowActions = new String[] {
// 简单上传
"name/cos:PutObject",
"name/cos:PostObject",
// 分片上传
"name/cos:InitiateMultipartUpload",
"name/cos:ListMultipartUploads",
"name/cos:ListParts",
"name/cos:UploadPart",
"name/cos:CompleteMultipartUpload"
};
config.put("allowActions", allowActions);
Response response = CosStsClient.getCredential(config);
Map<String, Object> result= new HashMap<>();
result.put("credentials", response.credentials);
result.put("startTime", response.startTime);
result.put("expiredTime", response.expiredTime);
return result;
} catch (Exception e) {
e.printStackTrace();
throw new IllegalArgumentException("no valid secret !");
}
}
}