Commit f0a225a7 by 吴博

feat:[1003882] 小程序签到

parent 65dc5284
......@@ -22,4 +22,7 @@ public interface GiftCouponService {
ResponseEntity<ResponseDto<GiftCouponVo>> getCouponBaseInfo(@RequestParam("couponId") Long couponId) throws BizException;
@ApiOperation(value = "签到奖励获取书币兑换券", httpMethod = "POST")
@RequestMapping(value = "/getCoupon4Sign", method = RequestMethod.GET)
ResponseEntity<ResponseDto<GiftCouponVo>> getCoupon4Sign();
}
......@@ -5,6 +5,8 @@ import com.pcloud.common.entity.BaseEntity;
import lombok.Data;
import java.util.List;
/**
* 专享礼券包表(GiftCouponPackage)实体类
*
......@@ -68,5 +70,54 @@ public class GiftCouponVo extends BaseEntity {
*/
private AppletThirdResourcesVo appletThirdResources;
/**
* 资源编号
*/
private String resourceNumber;
/**
* 资源价格
*/
private String price;
/**
* 资源描述
*/
private String resourceDesc;
/**
* 划线价
*/
private String crossedPrice;
/**
* 作品还是应用
*/
private String serveType;
/**
* 应用或者作品id
*/
private Long serveId;
private String linkUrl;
/**
* 第三方资源链接id
*/
private Long thirdResourceId;
/**
* 资源描述返回数组
*/
private List<String> desc;
/**
* 作品或者应用信息
*/
private ServeInfoDTO serveInfoDTO;
}
\ No newline at end of file
......@@ -54,6 +54,7 @@ import com.pcloud.common.utils.DateUtils;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.cache.redis.JedisClusterUtils;
import com.pcloud.common.utils.string.StringUtil;
import com.pcloud.readercenter.common.enums.YesOrNoNumEnum;
import com.pcloud.usercenter.party.adviser.dto.AdviserBaseInfoDto;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.MapUtils;
......@@ -61,6 +62,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import com.pcloud.readercenter.rmall.service.RmallBookMoneyRecordService;
import com.pcloud.readercenter.rmall.entity.RmallBookMoneyRecord;
import java.io.File;
import java.io.IOException;
......@@ -78,6 +81,8 @@ import java.util.Optional;
import java.util.Random;
import java.util.stream.Collectors;
import static com.pcloud.book.util.common.ThreadPoolUtils.RMALL_SIGN_IN;
/**
* 小程序用户书架
*/
......@@ -116,6 +121,8 @@ public class AppletUserBookcaseBizImpl implements AppletUserBookcaseBiz {
private BookDao bookDao;
@Autowired
private AppletThirdResourcesDao appletThirdResourcesDao;
@Autowired
private RmallBookMoneyRecordService rmallBookMoneyRecordService;
@Override
@ParamLog("小程序用户添加书架")
......@@ -138,6 +145,17 @@ public class AppletUserBookcaseBizImpl implements AppletUserBookcaseBiz {
}
}
}
//查询这本书书架中有没有
AppletUserBookcase userBook = appletUserBookcaseDao.getUserReadType(wechatUserId, appletUserBookcase.getBookId(), appletUserBookcase.getAdviserId(), appletUserBookcase.getChannelId());
if (null == userBook) {
RMALL_SIGN_IN.execute(()->{
//收藏埋点
RmallBookMoneyRecord rmallBookMoneyRecord = new RmallBookMoneyRecord();
rmallBookMoneyRecord.setWechatUserId(serveCollect.getWechatUserId());
rmallBookMoneyRecord.setRecordType(MoneyReceiveTypeEnum.NEW_BOOK.key);
rmallBookMoneyRecordService.insert(rmallBookMoneyRecord);
});
}
//数据库去重
appletUserBookcaseDao.insert(appletUserBookcase);
JedisClusterUtils.del(AppletConstants.USER_BOOK_CASE + wechatUserId);
......
......@@ -37,6 +37,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.pcloud.readercenter.rmall.service.RmallBookMoneyRecordService;
import com.pcloud.readercenter.rmall.entity.RmallBookMoneyRecord;
import java.util.ArrayList;
import java.util.HashMap;
......@@ -48,6 +50,8 @@ import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.stream.Collectors;
import static com.pcloud.book.util.common.ThreadPoolUtils.RMALL_SIGN_IN;
/**
* (ServeCollect)表服务实现类
*
......@@ -69,6 +73,8 @@ public class ServeCollectBizImpl implements ServeCollectBiz {
private QrcodeSceneConsr qrcodeSceneConsr;
@Autowired
private AppletNewsBiz appletNewsBiz;
@Autowired
private RmallBookMoneyRecordService rmallBookMoneyRecordService;
@Override
......@@ -260,6 +266,15 @@ public class ServeCollectBizImpl implements ServeCollectBiz {
paramCheck(serveCollect);
fillParam(serveCollect);
serveCollectDao.insert(serveCollect);
RMALL_SIGN_IN.execute(()->{
//收藏埋点
if (null == serveCollect.getIsDelete() || YesOrNoNumEnum.NO.getValue().equals(serveCollect.getIsDelete())){
RmallBookMoneyRecord rmallBookMoneyRecord = new RmallBookMoneyRecord();
rmallBookMoneyRecord.setWechatUserId(serveCollect.getWechatUserId());
rmallBookMoneyRecord.setRecordType(MoneyReceiveTypeEnum.COLLECTION.key);
rmallBookMoneyRecordService.insert(rmallBookMoneyRecord);
}
});
return serveCollect.getId();
}
......
......@@ -322,7 +322,7 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
tempMap = Maps.newHashMap();
tempMap.put("thing2", cultivateNotifySend.getTitle());
tempMap.put("time3", DateUtils.getLongDateStr());
tempMap.put("thing7", "小睿有1条新通知提醒一下小主");
tempMap.put("thing7", "您有一条新未读消息");
appletTemplateMessage.setData(tempMap);
templateConsr.sendAppletMessageQueue(appletTemplateMessage);
}
......
......@@ -49,4 +49,10 @@ public interface GiftCouponPackageBiz {
void batchUpdateGift(BatchUpdateDTO batchUpdateDTO);
List<GiftPackageDTO> listGiftPackage4Wechat(Long wechatUserId);
/**
* 签到奖励获取书币兑换券
* @return
*/
GiftPackageDTO getCoupon4Sign();
}
......@@ -582,6 +582,23 @@ public class GiftCouponPackageBizImpl implements GiftCouponPackageBiz {
return result;
}
@Override
public GiftPackageDTO getCoupon4Sign() {
GiftPackageDTO coupon4Sign = giftCouponPackageDao.getCoupon4Sign();
if (null == coupon4Sign) {
return new GiftPackageDTO();
}
coupon4Sign.setDesc(StringUtils.isEmpty(coupon4Sign.getResourceDesc()) ? new ArrayList<>() : Arrays.stream(coupon4Sign.getResourceDesc().split(",")).collect(Collectors.toList()));
List<GiftPackageDTO> giftPackageDTOS = Arrays.asList(coupon4Sign);
//设置分类
fillCategory(giftPackageDTOS);
//设置应用作品信息
fillAppProductInfo(giftPackageDTOS);
//设置课程券第三方链接
coupon4Sign.setAppletThirdResources(null == coupon4Sign.getThirdResourceId() ? null : appletThirdResourcesDao.getByResourcesId(coupon4Sign.getThirdResourceId()));
return coupon4Sign;
}
private List<Long> setSelectIds(Map<String, Object> map) {
List<Long> list=giftCategoryDao.getByParams(map);
Random index = new Random();
......
......@@ -44,4 +44,6 @@ public interface GiftCouponPackageDao extends BaseDao<GiftCouponPackage> {
Integer getByResourceNumber(String resourceNumber,Long packageId);
List<GiftPackageDTO> getGiftByIds(List<Long> packageIds);
GiftPackageDTO getCoupon4Sign();
}
\ No newline at end of file
......@@ -90,4 +90,9 @@ public class GiftCouponPackageDaoImpl extends BaseDaoImpl<GiftCouponPackage> imp
map.put("packageIds", packageIds);
return super.getSqlSession().selectList(getStatement("getGiftByIds"),map);
}
@Override
public GiftPackageDTO getCoupon4Sign() {
return getSqlSession().selectOne(getStatement("getCoupon4Sign"));
}
}
......@@ -186,4 +186,7 @@ public class GiftPackageDTO{
private Long agentId;
@ApiModelProperty("是否作为签到奖励")
private Integer isReward;
}
......@@ -118,4 +118,7 @@ public class GiftCouponPackage extends BaseEntity {
@ApiModelProperty("适用分类")
List<GiftCategory> GiftCategoryList;
@ApiModelProperty("是否作为签到奖励")
private Integer isReward;
}
\ No newline at end of file
......@@ -39,4 +39,12 @@ public class GiftCouponServiceImpl implements GiftCouponService {
giftCouponVo.setAppletThirdResources(appletThirdResources);
return ResponseHandleUtil.toResponse(giftCouponVo);
}
@Override
public ResponseEntity<ResponseDto<GiftCouponVo>> getCoupon4Sign() {
GiftPackageDTO giftPackage = giftCouponPackageBiz.getCoupon4Sign();
GiftCouponVo giftCouponVo = new GiftCouponVo();
BeanUtils.copyProperties(giftPackage,giftCouponVo);
return ResponseHandleUtil.toResponse(giftCouponVo);
}
}
......@@ -60,4 +60,8 @@ public class ThreadPoolUtils {
public static final ExecutorService FILL_APPLET_RECORD = new ThreadPoolExecutor(8,8,0L, TimeUnit.SECONDS,
new LinkedBlockingQueue<>(), new ThreadFactoryBuilder().setNameFormat("fill-applet-record-%d").build(), new ThreadPoolExecutor.CallerRunsPolicy());
public static final ExecutorService RMALL_SIGN_IN = new ThreadPoolExecutor(8,8,0L, TimeUnit.SECONDS,
new LinkedBlockingQueue<>(), new ThreadFactoryBuilder().setNameFormat("rmall_sign_in-%d").build(), new ThreadPoolExecutor.CallerRunsPolicy());
}
......@@ -29,6 +29,7 @@
<result property="serveId" column="serve_id" jdbcType="BIGINT" />
<result property="thirdResourceId" column="third_resource_id" jdbcType="BIGINT" />
<result property="onShelves" column="on_shelves" jdbcType="BOOLEAN" />
<result property="isReward" column="is_reward" jdbcType="TINYINT" />
</resultMap>
<resultMap type="com.pcloud.book.giftcoupon.dto.GiftPackageDTO" id="GiftCouplePackageDtoMap">
......@@ -56,12 +57,13 @@
<result property="serveId" column="serve_id" jdbcType="BIGINT" />
<result property="thirdResourceId" column="third_resource_id" jdbcType="BIGINT" />
<result property="onShelves" column="on_shelves" jdbcType="BOOLEAN" />
<result property="isReward" column="is_reward" jdbcType="TINYINT" />
</resultMap>
<sql id="Base_Column_List">
id, cover_pic, title, valid_date_begin, valid_date_end, denomination, stock, receive_limit, create_time, update_time, is_delete,
coupon_type,instructions,use_type,exchange_address, url_number, agent_id,resource_number,resource_desc,
price,crossed_price,rec_to_page,serve_type,serve_id,third_resource_id,link_url,on_shelves
price,crossed_price,rec_to_page,serve_type,serve_id,third_resource_id,link_url,on_shelves,is_reward
</sql>
<!--查询单个-->
......@@ -129,10 +131,10 @@
<insert id="insert" parameterType="com.pcloud.book.giftcoupon.entity.GiftCouponPackage" keyProperty="id" useGeneratedKeys="true">
insert into book.gift_coupon_package(cover_pic, title, valid_date_begin, valid_date_end, denomination, stock, receive_limit, create_time, update_time, is_delete,
coupon_type,instructions,use_type,exchange_address,url_number, agent_id,resource_number,resource_desc,
price,crossed_price,rec_to_page,serve_type,serve_id,third_resource_id,link_url,on_shelves)
price,crossed_price,rec_to_page,serve_type,serve_id,third_resource_id,link_url,on_shelves, is_reward)
values (#{coverPic}, #{title}, #{validDateBegin}, #{validDateEnd}, #{denomination}, #{stock}, #{receiveLimit}, now(), now(), 0,
#{couponType},#{instructions},#{useType},#{exchangeAddress}, #{urlNumber}, #{agentId},#{resourceNumber},#{resourceDesc},#{price}
,#{crossedPrice},#{recToPage},#{serveType},#{serveId},#{thirdResourceId},#{linkUrl},#{onShelves})
,#{crossedPrice},#{recToPage},#{serveType},#{serveId},#{thirdResourceId},#{linkUrl},#{onShelves}, #{isReward})
</insert>
<!--通过主键修改数据-->
......@@ -202,6 +204,9 @@
<if test="onShelves != null">
on_shelves = #{onShelves},
</if>
<if test="isReward != null">
is_reward = #{isReward},
</if>
update_time = now()
</set>
where id = #{id}
......@@ -230,7 +235,8 @@
a.url_number urlNumber,
a.resource_number resourceNumber,
a.rec_to_page recToPage,
a.on_shelves onShelves
a.on_shelves onShelves,
a.is_reward isReward
from
gift_coupon_package a
where a.is_delete=0
......@@ -458,7 +464,8 @@
a.resource_desc resourceDesc,
a.price price,
a.crossed_price crossedPrice,
a.on_shelves onShelves
a.on_shelves onShelves,
a.is_reward isReward
from
gift_coupon_package a
where a.id in
......@@ -466,5 +473,37 @@
${item}
</foreach>
</select>
<select id="getCoupon4Sign" resultType="com.pcloud.book.giftcoupon.dto.GiftPackageDTO">
select
a.id id,
a.title title,
a.cover_pic coverPic,
a.denomination denomination,
a.receive_limit receiveLimit,
a.stock stock,
a.valid_date_begin validDateBegin,
a.valid_date_end validDateEnd,
a.coupon_type couponType,
a.instructions instructions,
a.use_type useType,
a.exchange_address exchangeAddress,
a.url_number urlNumber,
a.resource_number resourceNumber,
a.rec_to_page recToPage,
a.resource_desc resourceDesc,
a.price price,
a.crossed_price crossedPrice,
a.on_shelves onShelves,
a.is_reward isReward
from
gift_coupon_package a
where
a.is_reward = 1
and
on_shelves = 1
and
NOW() <![CDATA[ < ]]> a.valid_date_end
ORDER BY RAND() LIMIT 1
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment