Commit ff4ced8a by 郑勇

feat: [1003726] 首页改版-新人礼包模块部分

parent ba04f363
package com.pcloud.book.giftcoupon.dto;
import java.util.List;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class ServeInfoDTO {
@ApiModelProperty("应用/资讯/作品id")
private Long serveId;
@ApiModelProperty("应用/资讯/作品类型")
private String serveType;
@ApiModelProperty("链接url")
private String linkUrl;
@ApiModelProperty("应用/资讯/作品图片")
private String servePic;
@ApiModelProperty("应用/资讯/作品名称")
private String serveName;
@ApiModelProperty("应用/资讯/作品类型名称")
private String serveTypeName;
@ApiModelProperty("应用/资讯/作品类型编码")
private String serveTypeCode;
@ApiModelProperty("结果链接")
private String resultUrl;
@ApiModelProperty("商品应用中有第三方链接")
private Boolean hasThirdLink;
}
package com.pcloud.book.giftcoupon.vo;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class AppletThirdResourcesVo extends BaseEntity {
@ApiModelProperty("第三方资源编号")
private String number;
@ApiModelProperty("类型 0:小程序, 1:链接")
private Long type;
@ApiModelProperty("第三方资源名称")
private String name;
@ApiModelProperty("小程序id")
private String appletsId;
@ApiModelProperty("来源")
private String source;
@ApiModelProperty("宣传图片")
private String resourceImgUrl;
@ApiModelProperty("链接")
private String url;
@ApiModelProperty("备注")
private String remark;
@ApiModelProperty("创建人")
private Long creator;
@ApiModelProperty("修改人")
private Long updator;
@ApiModelProperty("第三方资源路径 默认0:客服窗口 1:公众号文章素材")
private Integer routeCode;
@ApiModelProperty("引导语,限制30字符")
private String guide;
@ApiModelProperty("素材地址")
private String materialUrl;
@ApiModelProperty("顶图")
private String topImgUrl;
@ApiModelProperty("浮动图")
private String floatImgUrl;
@ApiModelProperty("按钮图")
private String buttonImgUrl;
@ApiModelProperty("位置 1 顶部 2 底部")
private Integer showType;
}
\ No newline at end of file
package com.pcloud.book.giftcoupon.vo; package com.pcloud.book.giftcoupon.vo;
import com.pcloud.book.giftcoupon.dto.ServeInfoDTO;
import com.pcloud.common.entity.BaseEntity; import com.pcloud.common.entity.BaseEntity;
import lombok.Data; import lombok.Data;
...@@ -56,6 +57,16 @@ public class GiftCouponVo extends BaseEntity { ...@@ -56,6 +57,16 @@ public class GiftCouponVo extends BaseEntity {
* 兑换地址 * 兑换地址
*/ */
private String exchangeAddress; private String exchangeAddress;
/**
* 跳转外链编号
*/
private String urlNumber;
/**
* 课程券第三方链接对象
*/
private AppletThirdResourcesVo appletThirdResources;
} }
\ No newline at end of file
...@@ -6,6 +6,8 @@ import com.pcloud.book.applet.entity.AppletThirdResources; ...@@ -6,6 +6,8 @@ import com.pcloud.book.applet.entity.AppletThirdResources;
import com.pcloud.book.applet.entity.AppletThirdResourcesClick; import com.pcloud.book.applet.entity.AppletThirdResourcesClick;
import com.pcloud.common.page.PageBeanNew; import com.pcloud.common.page.PageBeanNew;
import java.util.List;
public interface AppletThirdResourcesBiz { public interface AppletThirdResourcesBiz {
AppletThirdResourcesDTO getAnalysisDetail(Long thirdResourcesId); AppletThirdResourcesDTO getAnalysisDetail(Long thirdResourcesId);
...@@ -26,6 +28,8 @@ public interface AppletThirdResourcesBiz { ...@@ -26,6 +28,8 @@ public interface AppletThirdResourcesBiz {
AppletThirdResources getAppletsById(Long id); AppletThirdResources getAppletsById(Long id);
List<AppletThirdResources> getAppletsByIds(List<Long> ids);
void createThirdResources(AppletThirdResourcesDTO thirdResourcesDTO); void createThirdResources(AppletThirdResourcesDTO thirdResourcesDTO);
PageBeanNew<ThirdResourceRecordDTO> listThirdResourceRecord(String queryName, Integer currentPage, Integer numPerPage, String wechatUser, Long thirdResourceId, Integer recordType); PageBeanNew<ThirdResourceRecordDTO> listThirdResourceRecord(String queryName, Integer currentPage, Integer numPerPage, String wechatUser, Long thirdResourceId, Integer recordType);
......
...@@ -220,6 +220,11 @@ public class AppletThirdResourcesBizImpl implements AppletThirdResourcesBiz { ...@@ -220,6 +220,11 @@ public class AppletThirdResourcesBizImpl implements AppletThirdResourcesBiz {
} }
@Override @Override
public List<AppletThirdResources> getAppletsByIds(List<Long> ids) {
return thirdResourcesDao.getAppletsByIds(ids);
}
@Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void createThirdResources(AppletThirdResourcesDTO thirdResourcesDTO) { public void createThirdResources(AppletThirdResourcesDTO thirdResourcesDTO) {
AppletThirdResources thirdResources = new AppletThirdResources(); AppletThirdResources thirdResources = new AppletThirdResources();
......
...@@ -15,4 +15,8 @@ public interface AppletThirdResourcesDao extends BaseDao<AppletThirdResources> { ...@@ -15,4 +15,8 @@ public interface AppletThirdResourcesDao extends BaseDao<AppletThirdResources> {
List<AppletThirdResources> getThirdResourcesByNewsId(Long newsId); List<AppletThirdResources> getThirdResourcesByNewsId(Long newsId);
Map<Long, AppletConfigPointDTO> getConfigPoint(List<Long> thirdResourcesId); Map<Long, AppletConfigPointDTO> getConfigPoint(List<Long> thirdResourcesId);
List<AppletThirdResources> getAppletsByIds(List<Long> ids);
AppletThirdResources getByResourcesId(Long id);
} }
...@@ -103,4 +103,6 @@ public interface AppletUserBookcaseDao extends BaseDao<AppletUserBookcase> { ...@@ -103,4 +103,6 @@ public interface AppletUserBookcaseDao extends BaseDao<AppletUserBookcase> {
AppletUserBookcase getUserReadBook(Long wechatUserId); AppletUserBookcase getUserReadBook(Long wechatUserId);
BaseTempletClassify getBookClassifyInfo(Long bookId, Long channelId, Long adviserId); BaseTempletClassify getBookClassifyInfo(Long bookId, Long channelId, Long adviserId);
BaseTempletClassify getLastReadBookInfo(Long wechatUserId);
} }
...@@ -34,4 +34,17 @@ public class AppletThirdResourcesDaoImpl extends BaseDaoImpl<AppletThirdResource ...@@ -34,4 +34,17 @@ public class AppletThirdResourcesDaoImpl extends BaseDaoImpl<AppletThirdResource
return getSessionTemplate().selectMap(getStatement("getConfigPoint"), map, "thirdResourcesId"); return getSessionTemplate().selectMap(getStatement("getConfigPoint"), map, "thirdResourcesId");
} }
@Override
public List<AppletThirdResources> getAppletsByIds(List<Long> ids) {
Map<String, Object> map = new HashMap<>();
map.put("ids", ids);
return getSessionTemplate().selectList(getStatement("getAppletsByIds"), map);
}
@Override
public AppletThirdResources getByResourcesId(Long id) {
Map<String, Object> map = new HashMap<>();
map.put("id", id);
return getSessionTemplate().selectOne(getStatement("getByResourcesId"), map);
}
} }
...@@ -141,4 +141,11 @@ public class AppletUserBookcaseDaoImpl extends BaseDaoImpl<AppletUserBookcase> i ...@@ -141,4 +141,11 @@ public class AppletUserBookcaseDaoImpl extends BaseDaoImpl<AppletUserBookcase> i
map.put("bookId", bookId); map.put("bookId", bookId);
return getSessionTemplate().selectOne(getStatement("getBookClassifyInfo"),map); return getSessionTemplate().selectOne(getStatement("getBookClassifyInfo"),map);
} }
@Override
public BaseTempletClassify getLastReadBookInfo(Long wechatUserId) {
Map<String, Long> map = new HashMap<>();
map.put("wechatUserId", wechatUserId);
return getSessionTemplate().selectOne(getStatement("getLastReadBookInfo"),map);
}
} }
...@@ -25,4 +25,6 @@ public class ThirdResourceRecordDTO { ...@@ -25,4 +25,6 @@ public class ThirdResourceRecordDTO {
) )
private Date createTime; private Date createTime;
private Long thirdResourceId; private Long thirdResourceId;
private Long giftPackageId;
} }
...@@ -28,4 +28,6 @@ public class AppletThirdResourcesClick extends BaseEntity { ...@@ -28,4 +28,6 @@ public class AppletThirdResourcesClick extends BaseEntity {
private Long rightsSettingClassifyId; private Long rightsSettingClassifyId;
@ApiModelProperty("权益分类id") @ApiModelProperty("权益分类id")
private Long newsId; private Long newsId;
@ApiModelProperty("奖包券id")
private Long giftPackageId;
} }
\ No newline at end of file
package com.pcloud.book.giftcoupon.biz; package com.pcloud.book.giftcoupon.biz;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.giftcoupon.dto.BatchReceiveDTO; import com.pcloud.book.giftcoupon.dto.BatchReceiveDTO;
import com.pcloud.book.giftcoupon.dto.BatchUpdateDTO;
import com.pcloud.book.giftcoupon.dto.GiftPackageDTO; import com.pcloud.book.giftcoupon.dto.GiftPackageDTO;
import com.pcloud.book.giftcoupon.dto.MyGiftPackageDTO; import com.pcloud.book.giftcoupon.dto.MyGiftPackageDTO;
import com.pcloud.book.giftcoupon.entity.GiftCouponPackage; import com.pcloud.book.giftcoupon.entity.GiftCouponPackage;
import com.pcloud.book.giftcoupon.entity.GiftReceive; import com.pcloud.book.giftcoupon.entity.GiftReceive;
import com.pcloud.common.page.PageBeanNew; import com.pcloud.common.page.PageBeanNew;
import java.util.List;
public interface GiftCouponPackageBiz { public interface GiftCouponPackageBiz {
void createGiftPackage(GiftCouponPackage giftCouponPackage); void createGiftPackage(GiftCouponPackage giftCouponPackage);
void updateGiftPackage(GiftCouponPackage giftCouponPackage); void updateGiftPackage(GiftCouponPackage giftCouponPackage);
GiftCouponPackage getGiftPackage(Long id); GiftPackageDTO getGiftPackage(Long id);
void deleteGiftPackage(Long id); void deleteGiftPackage(Long id);
void createGiftReceive(GiftReceive giftReceive); void createGiftReceive(GiftReceive giftReceive) throws BookBizException;
PageBeanNew<GiftPackageDTO> list4GiftPackage(String title, Integer state,Integer couponType, Integer currentPage, Integer numPerPage, Long agentId); PageBeanNew<GiftPackageDTO> list4GiftPackage(String title, Integer state,Integer couponType, Integer currentPage, Integer numPerPage, Long agentId,Boolean onShelves);
PageBeanNew<MyGiftPackageDTO> list4MyGiftPackage(Integer state,Long wechatUserId,Integer currentPage, Integer numPerPage); PageBeanNew<GiftPackageDTO> list4MyGiftPackage(Integer state,Long wechatUserId,Integer currentPage, Integer numPerPage);
void useGiftCoupon(Long wechatUserId, Long receiveId); void useGiftCoupon(Long wechatUserId, Long receiveId);
...@@ -41,4 +45,8 @@ public interface GiftCouponPackageBiz { ...@@ -41,4 +45,8 @@ public interface GiftCouponPackageBiz {
* * @param null * * @param null
*/ */
PageBeanNew<GiftPackageDTO> listGiftPackage4Analysis(String title, Integer state, Integer couponType, Integer currentPage, Integer numPerPage, Integer linkOnly,Integer clickQty, Long agentId); PageBeanNew<GiftPackageDTO> listGiftPackage4Analysis(String title, Integer state, Integer couponType, Integer currentPage, Integer numPerPage, Integer linkOnly,Integer clickQty, Long agentId);
void batchUpdateGift(BatchUpdateDTO batchUpdateDTO);
List<GiftPackageDTO> listGiftPackage4Wechat(Long wechatUserId);
} }
package com.pcloud.book.giftcoupon.check; package com.pcloud.book.giftcoupon.check;
import com.pcloud.book.base.exception.BookBizException; import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.giftcoupon.dao.GiftCouponPackageDao;
import com.pcloud.book.giftcoupon.entity.GiftCouponPackage; import com.pcloud.book.giftcoupon.entity.GiftCouponPackage;
import com.pcloud.book.giftcoupon.entity.GiftReceive; import com.pcloud.book.giftcoupon.entity.GiftReceive;
import com.pcloud.book.giftcoupon.enums.CouponTypeEnum; import com.pcloud.book.giftcoupon.enums.CouponTypeEnum;
import com.pcloud.common.utils.DateUtils; import com.pcloud.common.utils.DateUtils;
import com.pcloud.common.utils.string.StringUtil; import com.pcloud.common.utils.string.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Date; import java.util.Date;
...@@ -24,6 +26,9 @@ public class GiftParamCheck { ...@@ -24,6 +26,9 @@ public class GiftParamCheck {
private final Integer COUPON_MAX_RECEIVE=5; private final Integer COUPON_MAX_RECEIVE=5;
private final Integer COUPON_MIN_RECEIVE=1; private final Integer COUPON_MIN_RECEIVE=1;
@Autowired
private GiftCouponPackageDao giftCouponPackageDao;
public void checkGiftAddParam(GiftCouponPackage giftCouponPackage) { public void checkGiftAddParam(GiftCouponPackage giftCouponPackage) {
if (null == giftCouponPackage) { if (null == giftCouponPackage) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "参数为空"); throw new BookBizException(BookBizException.PARAM_IS_NULL, "参数为空");
...@@ -32,29 +37,32 @@ public class GiftParamCheck { ...@@ -32,29 +37,32 @@ public class GiftParamCheck {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "请选择礼券类型"); throw new BookBizException(BookBizException.PARAM_IS_NULL, "请选择礼券类型");
} }
if (StringUtil.isEmpty(giftCouponPackage.getTitle())) { if (StringUtil.isEmpty(giftCouponPackage.getTitle())) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "称为空"); throw new BookBizException(BookBizException.PARAM_IS_NULL, "资源简称为空");
} }
if (giftCouponPackage.getTitle().length()>COUPON_MAX_TITLE_LENGTH) { if (giftCouponPackage.getTitle().length()>COUPON_MAX_TITLE_LENGTH) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "标题名称最多"+COUPON_MAX_TITLE_LENGTH+"个字"); throw new BookBizException(BookBizException.PARAM_IS_NULL, "标题名称最多"+COUPON_MAX_TITLE_LENGTH+"个字");
} }
if(CouponTypeEnum.BOOK_COIN_COUPON.value.equals(giftCouponPackage.getCouponType())) { if(CouponTypeEnum.BOOK_COIN_COUPON.value.equals(giftCouponPackage.getCouponType())) {
if (null == giftCouponPackage.getDenomination()) { /* if (null == giftCouponPackage.getDenomination()) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "面额为空"); throw new BookBizException(BookBizException.PARAM_IS_NULL, "面额为空");
} }
if (giftCouponPackage.getDenomination() > COUPON_MAX_DENOMINATION) { if (giftCouponPackage.getDenomination() > COUPON_MAX_DENOMINATION) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "面额最多"+COUPON_MAX_DENOMINATION); throw new BookBizException(BookBizException.PARAM_IS_NULL, "面额最多"+COUPON_MAX_DENOMINATION);
} }*/
} }
if(CouponTypeEnum.COURSE_COUPON.value.equals(giftCouponPackage.getCouponType())){ if(CouponTypeEnum.COURSE_COUPON.value.equals(giftCouponPackage.getCouponType())){
if(null==giftCouponPackage.getUseType()){ if(null==giftCouponPackage.getUseType()){
throw new BookBizException(BookBizException.PARAM_IS_NULL, "使用方式为空"); throw new BookBizException(BookBizException.PARAM_IS_NULL, "使用方式为空");
} }
if(StringUtil.isBlank(giftCouponPackage.getExchangeAddress())){ if(null==giftCouponPackage.getThirdResourceId()){
throw new BookBizException(BookBizException.PARAM_IS_NULL, "选择外链为空");
}
/* if(StringUtil.isBlank(giftCouponPackage.getExchangeAddress())){
throw new BookBizException(BookBizException.PARAM_IS_NULL, "兑换地址为空"); throw new BookBizException(BookBizException.PARAM_IS_NULL, "兑换地址为空");
} }
if(giftCouponPackage.getExchangeAddress().length()>COUPON_MAX_ADDRESS_LENGTH){ if(giftCouponPackage.getExchangeAddress().length()>COUPON_MAX_ADDRESS_LENGTH){
throw new BookBizException(BookBizException.PARAM_IS_NULL, "兑换地址太长,最多"+COUPON_MAX_ADDRESS_LENGTH+"个字"); throw new BookBizException(BookBizException.PARAM_IS_NULL, "兑换地址太长,最多"+COUPON_MAX_ADDRESS_LENGTH+"个字");
} }*/
} }
if (null == giftCouponPackage.getStock()) { if (null == giftCouponPackage.getStock()) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "库存为空"); throw new BookBizException(BookBizException.PARAM_IS_NULL, "库存为空");
...@@ -65,11 +73,21 @@ public class GiftParamCheck { ...@@ -65,11 +73,21 @@ public class GiftParamCheck {
if (null == giftCouponPackage.getReceiveLimit()) { if (null == giftCouponPackage.getReceiveLimit()) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "领取上限为空"); throw new BookBizException(BookBizException.PARAM_IS_NULL, "领取上限为空");
} }
if (giftCouponPackage.getReceiveLimit()>COUPON_MAX_RECEIVE) { if(CouponTypeEnum.BOOK_COIN_COUPON.value.equals(giftCouponPackage.getCouponType()) || CouponTypeEnum.COURSE_COUPON.value.equals(giftCouponPackage.getCouponType())) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "领取上限最多"+COUPON_MAX_RECEIVE+"张"); if (giftCouponPackage.getReceiveLimit() > COUPON_MAX_RECEIVE) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "领取上限最多" + COUPON_MAX_RECEIVE + "张");
}
if (giftCouponPackage.getReceiveLimit() < COUPON_MIN_RECEIVE) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "领取上限最低" + COUPON_MIN_RECEIVE + "张");
}
} }
if (giftCouponPackage.getReceiveLimit()<COUPON_MIN_RECEIVE) { if(CouponTypeEnum.APP_PRODUCT.value.equals(giftCouponPackage.getCouponType())){
throw new BookBizException(BookBizException.PARAM_IS_NULL, "领取上限最低"+COUPON_MIN_RECEIVE+"张"); if (giftCouponPackage.getReceiveLimit() > COUPON_MIN_RECEIVE) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "领取上限最多" + COUPON_MIN_RECEIVE + "张");
}
if(null==giftCouponPackage.getServeId()){
throw new BookBizException(BookBizException.PARAM_IS_NULL, "请选择应用或者作品");
}
} }
if (StringUtil.isEmpty(giftCouponPackage.getValidDateBegin()) || StringUtil.isEmpty(giftCouponPackage.getValidDateEnd())) { if (StringUtil.isEmpty(giftCouponPackage.getValidDateBegin()) || StringUtil.isEmpty(giftCouponPackage.getValidDateEnd())) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "有效期为空"); throw new BookBizException(BookBizException.PARAM_IS_NULL, "有效期为空");
...@@ -83,6 +101,18 @@ public class GiftParamCheck { ...@@ -83,6 +101,18 @@ public class GiftParamCheck {
if(StringUtil.isBlank(giftCouponPackage.getInstructions())){ if(StringUtil.isBlank(giftCouponPackage.getInstructions())){
throw new BookBizException(BookBizException.PARAM_IS_NULL, "使用说明不能为空"); throw new BookBizException(BookBizException.PARAM_IS_NULL, "使用说明不能为空");
} }
if(null==giftCouponPackage.getRecToPage()){
giftCouponPackage.setRecToPage(true);
}
if(null==giftCouponPackage.getOnShelves()){
giftCouponPackage.setOnShelves(true);
}
if(StringUtil.isNotBlank(giftCouponPackage.getResourceNumber())){
Integer i= giftCouponPackageDao.getByResourceNumber(giftCouponPackage.getResourceNumber(),giftCouponPackage.getId());
if(i>0){
throw new BookBizException(BookBizException.PARAM_IS_NULL, "已存在相同的资源编号");
}
}
} }
public void checkGiftReceiveAddParam(GiftReceive giftReceive) { public void checkGiftReceiveAddParam(GiftReceive giftReceive) {
...@@ -95,8 +125,8 @@ public class GiftParamCheck { ...@@ -95,8 +125,8 @@ public class GiftParamCheck {
if (null==giftReceive.getGiftPackageId()) { if (null==giftReceive.getGiftPackageId()) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "奖券包id为空"); throw new BookBizException(BookBizException.PARAM_IS_NULL, "奖券包id为空");
} }
if (null==giftReceive.getRightsSettingId()) { /*if (null==giftReceive.getRightsSettingId()) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "权益id为空"); throw new BookBizException(BookBizException.PARAM_IS_NULL, "权益id为空");
} }*/
} }
} }
package com.pcloud.book.giftcoupon.dao;
import com.pcloud.book.applet.dto.AppletNewsCategoryDTO;
import com.pcloud.book.applet.entity.AppletNewsCategory;
import com.pcloud.book.giftcoupon.dto.GiftCategoryDTO;
import com.pcloud.book.giftcoupon.dto.GiftPackageDTO;
import com.pcloud.book.giftcoupon.entity.GiftCategory;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
import java.util.Map;
public interface GiftCategoryDao extends BaseDao<GiftCategory> {
void batchCreate(List<GiftCategory> categoryList);
void deleteByPackageId(Long giftPackageId);
List<GiftCategoryDTO> getByPackageId(Long giftPackageId);
List<Long> getTemplateIds(List<Long> packageIds);
List<Long> getLabels(List<Long> packageIds);
List<GiftCategoryDTO> getByPackageIds(List<Long> packageIds);
void deleteByPackageIds(List<Long> packageIds);
List<Long> getByParams(Map<String, Object> map);
List<Long> getOtherByParams(Map<String, Object> map1);
}
package com.pcloud.book.giftcoupon.dao; package com.pcloud.book.giftcoupon.dao;
import com.pcloud.book.giftcoupon.dto.GiftPackageDTO;
import com.pcloud.book.giftcoupon.entity.GiftCouponPackage; import com.pcloud.book.giftcoupon.entity.GiftCouponPackage;
import com.pcloud.common.core.dao.BaseDao; import com.pcloud.common.core.dao.BaseDao;
...@@ -35,4 +36,12 @@ public interface GiftCouponPackageDao extends BaseDao<GiftCouponPackage> { ...@@ -35,4 +36,12 @@ public interface GiftCouponPackageDao extends BaseDao<GiftCouponPackage> {
* * @param null * * @param null
*/ */
Boolean urlNumberExist(String exchangeAddress, String urlNumber, Long id, Long agentId); Boolean urlNumberExist(String exchangeAddress, String urlNumber, Long id, Long agentId);
void batchUpdateGift(Map<String, Object> paramMap);
GiftPackageDTO getByPackageId(Long id);
Integer getByResourceNumber(String resourceNumber,Long packageId);
List<GiftPackageDTO> getGiftByIds(List<Long> packageIds);
} }
\ No newline at end of file
...@@ -36,4 +36,7 @@ public interface GiftReceiveDao extends BaseDao<GiftReceive> { ...@@ -36,4 +36,7 @@ public interface GiftReceiveDao extends BaseDao<GiftReceive> {
List<GiftCouponPackage> getOverLimitCoupon(List<Long> giftPackageIds,Long wechatUserId); List<GiftCouponPackage> getOverLimitCoupon(List<Long> giftPackageIds,Long wechatUserId);
Integer getGiftAllReceiveCount(Long wechatUserId);
List<Long> getReceivedIds(List<Long> packageIds, Long wechatUserId);
} }
\ No newline at end of file
package com.pcloud.book.giftcoupon.dao.impl;
import com.pcloud.book.giftcoupon.dao.GiftCategoryDao;
import com.pcloud.book.giftcoupon.dto.GiftCategoryDTO;
import com.pcloud.book.giftcoupon.dto.GiftPackageDTO;
import com.pcloud.book.giftcoupon.entity.GiftCategory;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
@Component
public class GiftCategoryDaoImpl extends BaseDaoImpl<GiftCategory> implements GiftCategoryDao {
@Override
public void batchCreate(List<GiftCategory> categoryList) {
getSessionTemplate().insert(getStatement("batchCreate"), categoryList);
}
@Override
public void deleteByPackageId(Long giftPackageId) {
getSessionTemplate().delete(getStatement("deleteByPackageId"), giftPackageId);
}
@Override
public List<GiftCategoryDTO> getByPackageId(Long giftPackageId) {
return getSessionTemplate().selectList(getStatement("getByPackageId"),giftPackageId);
}
@Override
public List<Long> getTemplateIds(List<Long> packageIds) {
return getSessionTemplate().selectList(getStatement("getTemplateIds"),packageIds);
}
@Override
public List<Long> getLabels(List<Long> packageIds) {
return getSessionTemplate().selectList(getStatement("getLabels"),packageIds);
}
@Override
public List<GiftCategoryDTO> getByPackageIds(List<Long> packageIds) {
return getSessionTemplate().selectList(getStatement("getByPackageIds"),packageIds);
}
@Override
public void deleteByPackageIds(List<Long> packageIds) {
getSessionTemplate().delete(getStatement("deleteByPackageIds"),packageIds);
}
@Override
public List<Long> getByParams(Map<String, Object> map) {
return getSessionTemplate().selectList(getStatement("getByParams"),map);
}
@Override
public List<Long> getOtherByParams(Map<String, Object> map) {
return getSessionTemplate().selectList(getStatement("getOtherByParams"),map);
}
}
package com.pcloud.book.giftcoupon.dao.impl; package com.pcloud.book.giftcoupon.dao.impl;
import com.pcloud.book.giftcoupon.dao.GiftCouponPackageDao; import com.pcloud.book.giftcoupon.dao.GiftCouponPackageDao;
import com.pcloud.book.giftcoupon.dto.GiftPackageDTO;
import com.pcloud.book.giftcoupon.entity.GiftCouponPackage; import com.pcloud.book.giftcoupon.entity.GiftCouponPackage;
import com.pcloud.common.core.dao.BaseDaoImpl; import com.pcloud.common.core.dao.BaseDaoImpl;
...@@ -64,4 +65,29 @@ public class GiftCouponPackageDaoImpl extends BaseDaoImpl<GiftCouponPackage> imp ...@@ -64,4 +65,29 @@ public class GiftCouponPackageDaoImpl extends BaseDaoImpl<GiftCouponPackage> imp
map.put("agentId", agentId); map.put("agentId", agentId);
return getSessionTemplate().selectOne(getStatement("urlNumberExist"), map); return getSessionTemplate().selectOne(getStatement("urlNumberExist"), map);
} }
@Override
public void batchUpdateGift(Map<String, Object> paramMap) {
getSessionTemplate().update(getStatement("batchUpdateGift"), paramMap);
}
@Override
public GiftPackageDTO getByPackageId(Long id) {
return super.getSqlSession().selectOne(getStatement("getByPackageId"),id);
}
@Override
public Integer getByResourceNumber(String resourceNumber,Long packageId) {
Map<String, Object> map = new HashMap<>();
map.put("resourceNumber", resourceNumber);
map.put("packageId", packageId);
return super.getSqlSession().selectOne(getStatement("getByResourceNumber"),map);
}
@Override
public List<GiftPackageDTO> getGiftByIds(List<Long> packageIds) {
Map<String, Object> map = new HashMap<>();
map.put("packageIds", packageIds);
return super.getSqlSession().selectList(getStatement("getGiftByIds"),map);
}
} }
...@@ -69,4 +69,18 @@ public class GiftReceiveDaoImpl extends BaseDaoImpl<GiftReceive> implements Gift ...@@ -69,4 +69,18 @@ public class GiftReceiveDaoImpl extends BaseDaoImpl<GiftReceive> implements Gift
return super.getSqlSession().selectList(super.getStatement("getOverLimitCoupon"), map); return super.getSqlSession().selectList(super.getStatement("getOverLimitCoupon"), map);
} }
@Override
public Integer getGiftAllReceiveCount(Long wechatUserId) {
Map<String,Object> map=new HashMap<>();
map.put("wechatUserId",wechatUserId);
return super.getSqlSession().selectOne(super.getStatement("getGiftAllReceiveCount"), map);
}
@Override
public List<Long> getReceivedIds(List<Long> packageIds, Long wechatUserId) {
Map<String,Object> map=new HashMap<>();
map.put("wechatUserId",wechatUserId);
map.put("giftPackageIds",packageIds);
return super.getSqlSession().selectList(super.getStatement("getReceivedIds"), map);
}
} }
package com.pcloud.book.giftcoupon.dto;
import com.pcloud.book.giftcoupon.entity.GiftCategory;
import com.pcloud.book.rightsSetting.entity.BaseTempletClassify;
import java.util.List;
import javax.validation.constraints.NotNull;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class BatchUpdateDTO {
@ApiModelProperty("1-上下架,2-批量配置分类")
@NotNull(message = "批量操作字段不能为空")
private Integer operateType;
@ApiModelProperty("上下架")
private Boolean onShelves;
@ApiModelProperty("分类")
private List<BaseTempletClassify> categoryList;
@ApiModelProperty("id集合")
@NotNull(message = "礼包券id不能为空")
private List<Long> packageIds;
}
package com.pcloud.book.giftcoupon.dto;
import java.util.List;
import lombok.Data;
@Data
public class ExceptionDTO {
String errorMsg;
public ExceptionDTO(String errorMsg) {
this.errorMsg = errorMsg;
}
}
package com.pcloud.book.giftcoupon.dto;
import com.pcloud.common.dto.BaseDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true)
@Data
@ApiModel("小程序资讯类别")
public class GiftCategoryDTO extends BaseDto {
@ApiModelProperty("主键")
private Long id;
@ApiModelProperty("第一级类型标识")
private Long firstClassify;
private String firstClassifyName;
@ApiModelProperty("第二级类型标识")
private Long secondClassify;
private String secondClassifyName;
@ApiModelProperty("年级标签id")
private Long gradeLabelId;
private String gradeLabelName;
@ApiModelProperty("科目标签id")
private Long subjectLabelId;
private String subjectLabelName;
private Long giftPackageId;
}
package com.pcloud.book.giftcoupon.dto; package com.pcloud.book.giftcoupon.dto;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.pcloud.book.applet.dto.AppletNewsCategoryDTO;
import com.pcloud.book.applet.entity.AppletThirdResources;
import java.util.Date; import java.util.Date;
import java.util.List;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@Data @Data
public class GiftPackageDTO { public class GiftPackageDTO{
/** /**
* 封面图 *主键id
*/ */
private Long id; private Long id;
/** /**
...@@ -25,7 +29,7 @@ public class GiftPackageDTO { ...@@ -25,7 +29,7 @@ public class GiftPackageDTO {
* 有效期开始时间 * 有效期开始时间
*/ */
@JsonFormat( @JsonFormat(
pattern = "yyyy-MM-dd", pattern = "yyyy-MM-dd HH:mm:ss",
timezone = "GMT+8" timezone = "GMT+8"
) )
private Date validDateBegin; private Date validDateBegin;
...@@ -33,7 +37,7 @@ public class GiftPackageDTO { ...@@ -33,7 +37,7 @@ public class GiftPackageDTO {
* 有效期结束时间 * 有效期结束时间
*/ */
@JsonFormat( @JsonFormat(
pattern = "yyyy-MM-dd", pattern = "yyyy-MM-dd HH:mm:ss",
timezone = "GMT+8" timezone = "GMT+8"
) )
private Date validDateEnd; private Date validDateEnd;
...@@ -58,6 +62,11 @@ public class GiftPackageDTO { ...@@ -58,6 +62,11 @@ public class GiftPackageDTO {
private Integer receiveNum; private Integer receiveNum;
/** /**
* 未使用数量
*/
private Integer notUsedNum;
/**
* 券类型(2-书币券,1-课程券) * 券类型(2-书币券,1-课程券)
*/ */
private Integer couponType; private Integer couponType;
...@@ -87,4 +96,94 @@ public class GiftPackageDTO { ...@@ -87,4 +96,94 @@ public class GiftPackageDTO {
*/ */
private String clickPVUV; private String clickPVUV;
/**
* 资源编号
*/
private String resourceNumber;
/**
* 资源价格
*/
private String price;
/**
* 资源描述
*/
private String resourceDesc;
/**
* 划线价
*/
private String crossedPrice;
/**
* 是否推荐到首页
*/
private Boolean recToPage;
/**
* 作品还是应用
*/
private String serveType;
/**
* 应用或者作品id
*/
private Long serveId;
private String linkUrl;
/**
* 第三方资源链接id
*/
private Long thirdResourceId;
/**
* 资源描述返回数组
*/
private List<String> desc;
/**
* 作品或者应用信息
*/
private ServeInfoDTO serveInfoDTO;
/**
* 课程券第三方链接对象
*/
private AppletThirdResources appletThirdResources;
/**
* 是否上架
*/
private Boolean onShelves;
@ApiModelProperty("适用类型")
private List<GiftCategoryDTO> categoryList;
/**
* 使用时间
*/
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm",
timezone = "GMT+8"
)
private Date useTime;
/**
* 领取id
*/
private Long receiveId;
/**
* 失效状态 (1-已使用,2-已过期)
*/
private Integer failureState;
@ApiModelProperty("是否领取过")
private Boolean hasReceived;
private Long agentId;
} }
package com.pcloud.book.giftcoupon.dto; package com.pcloud.book.giftcoupon.dto;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.pcloud.book.applet.entity.AppletThirdResources;
import java.util.Date; import java.util.Date;
import java.util.List;
import lombok.Data; import lombok.Data;
@Data @Data
public class MyGiftPackageDTO { public class MyGiftPackageDTO{
/** /**
* 券id * 券id
...@@ -85,5 +87,68 @@ public class MyGiftPackageDTO { ...@@ -85,5 +87,68 @@ public class MyGiftPackageDTO {
*/ */
private Integer failureState; private Integer failureState;
/**
* 资源描述
*/
private String resourceDesc;
/**
* 划线价
*/
private String crossedPrice;
/**
* 应用于分类(分类id用逗号连接)
*/
private String applyType;
/**
* 是否推荐到首页
*/
private Boolean recToPage;
/**
* 作品还是应用
*/
private String serveType;
/**
* 应用或者作品id
*/
private Long serveId;
private String linkUrl;
/**
* 第三方资源链接id
*/
private Long thirdResourceId;
/**
* 应用于分类(分类中文用分号连接)
*/
private String applyTypeTemplate;
/**
* 资源描述返回数组
*/
private List<String> desc;
/**
* 作品或者应用信息
*/
private ServeInfoDTO serveInfoDTO;
/**
* 课程券第三方链接对象
*/
private AppletThirdResources appletThirdResources;
/**
* 是否上架
*/
private Boolean onShelves;
} }
package com.pcloud.book.giftcoupon.entity;
import com.pcloud.book.rightsSetting.entity.BaseTempletClassify;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel("小程序资讯类别")
public class GiftCategory extends BaseTempletClassify {
@ApiModelProperty("主键")
private Long id;
@ApiModelProperty("礼券id")
private Long giftPackageId;
@ApiModelProperty("创建人")
private Long creator;
@ApiModelProperty("创建时间")
private Date createTime;
}
package com.pcloud.book.giftcoupon.entity; package com.pcloud.book.giftcoupon.entity;
import com.pcloud.book.applet.entity.AppletNewsCategory;
import com.pcloud.common.entity.BaseEntity; import com.pcloud.common.entity.BaseEntity;
import java.util.Date; import java.util.Date;
import java.util.List;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
/** /**
...@@ -64,4 +67,55 @@ public class GiftCouponPackage extends BaseEntity { ...@@ -64,4 +67,55 @@ public class GiftCouponPackage extends BaseEntity {
private String urlNumber; private String urlNumber;
private Long agentId; private Long agentId;
/**
* 资源编号
*/
private String resourceNumber;
/**
* 资源价格
*/
private String price;
/**
* 资源描述
*/
private String resourceDesc;
/**
* 划线价
*/
private String crossedPrice;
/**
* 是否推荐到首页
*/
private Boolean recToPage;
/**
* 作品还是应用
*/
private String serveType;
private String linkUrl;
/**
* 应用或者作品id
*/
private Long serveId;
/**
* 第三方资源链接id
*/
private Long thirdResourceId;
/**
* 是否上架
*/
private Boolean onShelves;
@ApiModelProperty("适用分类")
List<GiftCategory> GiftCategoryList;
} }
\ No newline at end of file
...@@ -12,7 +12,11 @@ public enum CouponTypeEnum { ...@@ -12,7 +12,11 @@ public enum CouponTypeEnum {
/** /**
* 书币券 * 书币券
*/ */
BOOK_COIN_COUPON(2); BOOK_COIN_COUPON(2),
/**
* 应用作品
*/
APP_PRODUCT(3);
public final Integer value; public final Integer value;
......
...@@ -13,6 +13,8 @@ import com.pcloud.book.cultivate.entity.CultivateBookUser; ...@@ -13,6 +13,8 @@ import com.pcloud.book.cultivate.entity.CultivateBookUser;
import com.pcloud.book.cultivate.entity.CultivateRobotClassify; import com.pcloud.book.cultivate.entity.CultivateRobotClassify;
import com.pcloud.book.giftcoupon.biz.GiftCouponPackageBiz; import com.pcloud.book.giftcoupon.biz.GiftCouponPackageBiz;
import com.pcloud.book.giftcoupon.dto.BatchReceiveDTO; import com.pcloud.book.giftcoupon.dto.BatchReceiveDTO;
import com.pcloud.book.giftcoupon.dto.BatchUpdateDTO;
import com.pcloud.book.giftcoupon.dto.ExceptionDTO;
import com.pcloud.book.giftcoupon.dto.GiftPackageDTO; import com.pcloud.book.giftcoupon.dto.GiftPackageDTO;
import com.pcloud.book.giftcoupon.dto.GiftReceiveDTO; import com.pcloud.book.giftcoupon.dto.GiftReceiveDTO;
import com.pcloud.book.giftcoupon.dto.MyGiftPackageDTO; import com.pcloud.book.giftcoupon.dto.MyGiftPackageDTO;
...@@ -27,6 +29,7 @@ import com.pcloud.common.utils.SessionUtil; ...@@ -27,6 +29,7 @@ import com.pcloud.common.utils.SessionUtil;
import com.pcloud.common.utils.cookie.Cookie; import com.pcloud.common.utils.cookie.Cookie;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.CookieValue; import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
...@@ -100,12 +103,22 @@ public class GiftCouponPackageFacade { ...@@ -100,12 +103,22 @@ public class GiftCouponPackageFacade {
@RequestParam(value = "title",required = false) @ApiParam("礼包券名称") String title, @RequestParam(value = "title",required = false) @ApiParam("礼包券名称") String title,
@RequestParam(value = "state",required = false) @ApiParam("状态") Integer state, @RequestParam(value = "state",required = false) @ApiParam("状态") Integer state,
@RequestParam(value = "couponType",required = false) @ApiParam("券类型") Integer couponType, @RequestParam(value = "couponType",required = false) @ApiParam("券类型") Integer couponType,
@RequestParam(value = "onShelves",required = false) @ApiParam("上下架") Boolean onShelves,
@RequestParam(value = "currentPage", required = false) Integer currentPage, @RequestParam(value = "currentPage", required = false) Integer currentPage,
@RequestParam(value = "numPerPage", required = false) Integer numPerPage @RequestParam(value = "numPerPage", required = false) Integer numPerPage
) throws BizException, PermissionException { ) throws BizException, PermissionException {
Map<String, Object> map = SessionUtil.getToken4Redis(token); Map<String, Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID); Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
return new ResponseDto<>(giftCouponPackageBiz.list4GiftPackage(title,state,couponType,currentPage,numPerPage,agentId)); return new ResponseDto<>(giftCouponPackageBiz.list4GiftPackage(title,state,couponType,currentPage,numPerPage,agentId,onShelves));
}
@ApiOperation("小程序首页礼券包")
@GetMapping("/listGiftPackage4Wechat")
public ResponseDto<List<GiftPackageDTO>> listGiftPackage4Wechat(
@CookieValue(value = "userInfo") String userInfo
) throws BizException, PermissionException {
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
return new ResponseDto<>(giftCouponPackageBiz.listGiftPackage4Wechat(wechatUserId));
} }
@ApiOperation("新增礼券包领取") @ApiOperation("新增礼券包领取")
...@@ -116,7 +129,11 @@ public class GiftCouponPackageFacade { ...@@ -116,7 +129,11 @@ public class GiftCouponPackageFacade {
) throws BizException, PermissionException { ) throws BizException, PermissionException {
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID); Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
GiftReceive.setWechatUserId(wechatUserId); GiftReceive.setWechatUserId(wechatUserId);
giftCouponPackageBiz.createGiftReceive(GiftReceive); try {
giftCouponPackageBiz.createGiftReceive(GiftReceive);
}catch (BookBizException e){
return new ResponseDto<>(e.getCode(),e.getMsg(),new ExceptionDTO(e.getMsg()));
}
return new ResponseDto<>(); return new ResponseDto<>();
} }
...@@ -133,7 +150,7 @@ public class GiftCouponPackageFacade { ...@@ -133,7 +150,7 @@ public class GiftCouponPackageFacade {
@ApiOperation("我的礼券包列表") @ApiOperation("我的礼券包列表")
@GetMapping("/list4MyGiftPackage") @GetMapping("/list4MyGiftPackage")
public ResponseDto<PageBeanNew<MyGiftPackageDTO>> list4MyGiftPackage( public ResponseDto<PageBeanNew<GiftPackageDTO>> list4MyGiftPackage(
@CookieValue(value = "userInfo") String userInfo , @CookieValue(value = "userInfo") String userInfo ,
@RequestParam(value = "state", required = false) Integer state, @RequestParam(value = "state", required = false) Integer state,
@RequestParam(value = "currentPage", required = false) Integer currentPage, @RequestParam(value = "currentPage", required = false) Integer currentPage,
...@@ -180,4 +197,14 @@ public class GiftCouponPackageFacade { ...@@ -180,4 +197,14 @@ public class GiftCouponPackageFacade {
return new ResponseDto<>(giftCouponPackageBiz.listGiftPackage4Analysis(title, state, couponType, currentPage, numPerPage, linkOnly,clickQty, agentId)); return new ResponseDto<>(giftCouponPackageBiz.listGiftPackage4Analysis(title, state, couponType, currentPage, numPerPage, linkOnly,clickQty, agentId));
} }
@ApiOperation("礼券包批量操作")
@PostMapping("/batchUpdateGift")
public ResponseDto<?> batchUpdateGift(
@RequestHeader("token") String token,
@RequestBody @Validated BatchUpdateDTO batchUpdateDTO
) throws BizException, PermissionException {
Map<String, Object> map = SessionUtil.getToken4Redis(token);
giftCouponPackageBiz.batchUpdateGift(batchUpdateDTO);
return new ResponseDto<>();
}
} }
package com.pcloud.book.giftcoupon.service.impl; package com.pcloud.book.giftcoupon.service.impl;
import com.pcloud.book.giftcoupon.biz.GiftCouponPackageBiz; import com.pcloud.book.giftcoupon.biz.GiftCouponPackageBiz;
import com.pcloud.book.giftcoupon.dto.GiftPackageDTO;
import com.pcloud.book.giftcoupon.entity.GiftCouponPackage; import com.pcloud.book.giftcoupon.entity.GiftCouponPackage;
import com.pcloud.book.giftcoupon.service.GiftCouponService; import com.pcloud.book.giftcoupon.service.GiftCouponService;
import com.pcloud.book.giftcoupon.vo.AppletThirdResourcesVo;
import com.pcloud.book.giftcoupon.vo.GiftCouponVo; import com.pcloud.book.giftcoupon.vo.GiftCouponVo;
import com.pcloud.common.dto.ResponseDto; import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException; import com.pcloud.common.exceptions.BizException;
...@@ -27,9 +29,14 @@ public class GiftCouponServiceImpl implements GiftCouponService { ...@@ -27,9 +29,14 @@ public class GiftCouponServiceImpl implements GiftCouponService {
@Override @Override
@RequestMapping(value = "/getCouponBaseInfo", method = RequestMethod.GET) @RequestMapping(value = "/getCouponBaseInfo", method = RequestMethod.GET)
public ResponseEntity<ResponseDto<GiftCouponVo>> getCouponBaseInfo(@RequestParam("couponId") Long couponId) throws BizException { public ResponseEntity<ResponseDto<GiftCouponVo>> getCouponBaseInfo(@RequestParam("couponId") Long couponId) throws BizException {
GiftCouponPackage giftPackage = giftCouponPackageBiz.getGiftPackage(couponId); GiftPackageDTO giftPackage = giftCouponPackageBiz.getGiftPackage(couponId);
GiftCouponVo giftCouponVo=new GiftCouponVo(); GiftCouponVo giftCouponVo=new GiftCouponVo();
BeanUtils.copyProperties(giftPackage,giftCouponVo); BeanUtils.copyProperties(giftPackage,giftCouponVo);
AppletThirdResourcesVo appletThirdResources=new AppletThirdResourcesVo();
if(null!=giftPackage.getAppletThirdResources()){
BeanUtils.copyProperties(giftPackage.getAppletThirdResources(),appletThirdResources);
}
giftCouponVo.setAppletThirdResources(appletThirdResources);
return ResponseHandleUtil.toResponse(giftCouponVo); return ResponseHandleUtil.toResponse(giftCouponVo);
} }
} }
...@@ -66,4 +66,10 @@ public interface RightsNowItemDao extends BaseDao<RightsNowItem> { ...@@ -66,4 +66,10 @@ public interface RightsNowItemDao extends BaseDao<RightsNowItem> {
* * @param null * * @param null
*/ */
List<RightsNowItem> getItemListByRightsSettingId(Long rightsSettingId, Integer rightsNowItemType, Integer readType, Integer openState, String serveType); List<RightsNowItem> getItemListByRightsSettingId(Long rightsSettingId, Integer rightsNowItemType, Integer readType, Integer openState, String serveType);
/**
* 删除已经下架的礼券包
* @param packageIds
*/
void deletePackageIds(List<Long> packageIds);
} }
...@@ -106,4 +106,8 @@ public class RightsNowItemDaoImpl extends BaseDaoImpl<RightsNowItem> implements ...@@ -106,4 +106,8 @@ public class RightsNowItemDaoImpl extends BaseDaoImpl<RightsNowItem> implements
return getSessionTemplate().selectList(getStatement("getItemListByRightsSettingId"), map); return getSessionTemplate().selectList(getStatement("getItemListByRightsSettingId"), map);
} }
@Override
public void deletePackageIds(List<Long> packageIds) {
getSessionTemplate().delete(getStatement("deletePackageIds"), packageIds);
}
} }
...@@ -97,6 +97,63 @@ ...@@ -97,6 +97,63 @@
from applet_third_resources where id=#{id} from applet_third_resources where id=#{id}
</select> </select>
<select id="getByResourcesId" parameterType="map" resultType="com.pcloud.book.applet.entity.AppletThirdResources">
select
a.id AS id,
a.resource_number AS number,
a.resource_type AS type,
a.resource_name AS name,
a.app_Id AS appletsId,
a.resource_source AS source,
a.resource_img_url AS resourceImgUrl,
a.resource_url AS url,
a.remark AS remark,
a.create_time AS creator,
a.update_time AS updator,
a.creator AS createTime,
a.updator AS updateTime,
a.route_code AS routeCode,
a.guide AS guide,
b.material_url AS materialUrl,
a.top_img_url topImgUrl,
a.float_img_url floatImgUrl,
a.button_img_url buttonImgUrl,
a.show_type showType
from applet_third_resources a
left join biz_material b on a.id = b.biz_id and b.biz_type = 1
where a.id=#{id}
</select>
<select id="getAppletsByIds" parameterType="map" resultType="com.pcloud.book.applet.entity.AppletThirdResources">
select
a.id AS id,
a.resource_number AS number,
a.resource_type AS type,
a.resource_name AS name,
a.app_Id AS appletsId,
a.resource_source AS source,
a.resource_img_url AS resourceImgUrl,
a.resource_url AS url,
a.remark AS remark,
a.create_time AS creator,
a.update_time AS updator,
a.creator AS createTime,
a.updator AS updateTime,
a.route_code AS routeCode,
a.guide AS guide,
b.material_url AS materialUrl,
a.top_img_url topImgUrl,
a.float_img_url floatImgUrl,
a.button_img_url buttonImgUrl,
a.show_type showType
from applet_third_resources a
left join biz_material b on a.id = b.biz_id and b.biz_type = 1
where a.id in
<foreach collection="ids" item="item" index="index" separator="," close=")" open="(">
#{item}
</foreach>
</select>
<select id="getThirdResourcesByNewsId" parameterType="Long" resultType="com.pcloud.book.applet.entity.AppletThirdResources"> <select id="getThirdResourcesByNewsId" parameterType="Long" resultType="com.pcloud.book.applet.entity.AppletThirdResources">
SELECT SELECT
relation.from_id fromId, relation.from_id fromId,
......
...@@ -28,7 +28,8 @@ ...@@ -28,7 +28,8 @@
channel_id, channel_id,
page, page,
rights_setting_classify_id, rights_setting_classify_id,
news_id news_id,
gift_package_id
) )
values ( values (
#{wechatUserId}, #{wechatUserId},
...@@ -43,7 +44,8 @@ ...@@ -43,7 +44,8 @@
#{channelId}, #{channelId},
#{page}, #{page},
#{rightsSettingClassifyId}, #{rightsSettingClassifyId},
#{newsId} #{newsId},
#{giftPackageId}
) )
</insert> </insert>
...@@ -105,7 +107,8 @@ ...@@ -105,7 +107,8 @@
a.booK_id bookId, a.booK_id bookId,
a.adviser_id adviserId, a.adviser_id adviserId,
c.book_name bookName, c.book_name bookName,
c.isbn c.isbn,
a.gift_package_id giftPackageId
from from
applet_thirdresources_click_record a applet_thirdresources_click_record a
left join left join
......
...@@ -308,4 +308,20 @@ ...@@ -308,4 +308,20 @@
LIMIT 1 LIMIT 1
</select> </select>
<select id="getLastReadBookInfo" parameterType="map" resultType="com.pcloud.book.rightsSetting.entity.BaseTempletClassify">
SELECT b.TEMPLET_ID firstClassify,
b.SECOND_TEMPLET_ID secondClassify,
b.GRA_LABEL_ID gradeLabelId,
b.SUB_LABEL_ID subjectLabelId,
b.vol_label_id volLabelId
FROM applet_user_bookcase a
LEFT JOIN book_adviser b ON a.book_id = b.BOOK_ID
AND a.channel_id = b.CHANNEL_ID
AND a.adviser_id = b.ADVISER_ID
WHERE b.IS_DELETE = 0
AND a.wechat_user_id = #{wechatUserId}
ORDER BY a.create_time DESC
LIMIT 1
</select>
</mapper> </mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.pcloud.book.giftcoupon.dao.impl.GiftCategoryDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.giftcoupon.entity.GiftCategory">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="gift_package_id" property="giftPackageId" jdbcType="BIGINT"/>
<result column="creator" property="creator" jdbcType="BIGINT"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="first_classify" property="firstClassify" jdbcType="BIGINT"/>
<result column="second_classify" property="secondClassify" jdbcType="BIGINT"/>
<result column="grade_label_id" property="gradeLabelId" jdbcType="BIGINT"/>
<result column="subject_label_id" property="subjectLabelId" jdbcType="BIGINT"/>
</resultMap>
<sql id="Base_Column_List">
id, gift_package_id, creator, create_time, first_classify,second_classify, grade_label_id, subject_label_id
</sql>
<insert id="insert" parameterType="com.pcloud.book.giftcoupon.entity.GiftCategory" useGeneratedKeys="true"
keyProperty="id">
insert into gift_category (
gift_package_id, creator, create_time, first_classify,second_classify, grade_label_id, subject_label_id
)
values (
#{giftPackageId}, #{creator}, NOW(), #{firstClassify}, #{secondClassify}, #{gradeLabelId}, #{subjectLabelId}
)
</insert>
<insert id="batchCreate" parameterType="list" keyProperty="id" useGeneratedKeys="true">
insert into gift_category (
gift_package_id, creator, create_time, first_classify,second_classify, grade_label_id, subject_label_id)
values
<foreach collection="list" item="item" index="index" separator=",">
( #{item.giftPackageId}, #{item.creator}, NOW(), #{item.firstClassify}, #{item.secondClassify},
#{item.gradeLabelId}, #{item.subjectLabelId} )
</foreach>
</insert>
<select id="getByPackageId" parameterType="long" resultType="com.pcloud.book.giftcoupon.dto.GiftCategoryDTO">
select
category.id,
category.gift_package_id,
category.first_classify firstClassify,
category.second_classify secondClassify,
category.grade_label_id gradeLabelId,
category.subject_label_id subjectLabelId,
label.name gradeLabelName,
label2.name subjectLabelName
from gift_category category
LEFT JOIN book_label label ON category.grade_label_id = label.id AND label.type=1
LEFT JOIN book_label label2 ON category.subject_label_id = label2.id AND label2.type=2
where gift_package_id=#{giftPackageId}
</select>
<select id="getByPackageIds" parameterType="list" resultType="com.pcloud.book.giftcoupon.dto.GiftCategoryDTO">
select
category.id,
category.gift_package_id giftPackageId,
category.first_classify firstClassify,
category.second_classify secondClassify,
category.grade_label_id gradeLabelId,
category.subject_label_id subjectLabelId
from gift_category category
where gift_package_id in
<foreach collection="list" item="item" index="index" open="(" separator="," close=")">
${item}
</foreach>
</select>
<delete id="deleteByPackageId" parameterType="long">
DELETE FROM gift_category
WHERE gift_package_id = #{giftPackageId}
</delete>
<select id="getTemplateIds" parameterType="list" resultType="Long">
select first_classify from
gift_category
where gift_package_id in
<foreach collection="list" item="item" index="index" open="(" separator="," close=")">
${item}
</foreach>
and first_classify>0
union
select second_classify from
gift_category
where gift_package_id in
<foreach collection="list" item="item" index="index" open="(" separator="," close=")">
${item}
</foreach>
and second_classify>0
</select>
<select id="getLabels" parameterType="list" resultType="Long">
select grade_label_id from
gift_category
where gift_package_id in
<foreach collection="list" item="item" index="index" open="(" separator="," close=")">
${item}
</foreach>
and grade_label_id>0
union
select subject_label_id from
gift_category
where gift_package_id in
<foreach collection="list" item="item" index="index" open="(" separator="," close=")">
${item}
</foreach>
and subject_label_id>0
</select>
<delete id="deleteByPackageIds" parameterType="list">
DELETE FROM gift_category
WHERE gift_package_id in
<foreach collection="list" item="item" index="index" open="(" separator="," close=")">
${item}
</foreach>
</delete>
<select id="getByParams" parameterType="map" resultType="Long">
select
a.id
from
gift_coupon_package a
INNER JOIN (
select DISTINCT gift_package_id from
gift_category
where
first_classify =#{firstClassify}
<if test="gradeLabelId!=null">
AND grade_label_id = #{gradeLabelId}
</if>
<if test="gradeLabelId==null">
AND grade_label_id is null
</if>
<if test="subjectLabelId!=null">
AND subject_label_id = #{subjectLabelId}
</if>
<if test="subjectLabelId==null">
AND subject_label_id is null
</if>
)t on a.id=t.gift_package_id
where a.is_delete=0
and a.stock>0
and a.on_shelves=1
and a.rec_to_page=1
and now() <![CDATA[ < ]]> a.valid_date_end
</select>
<select id="getOtherByParams" parameterType="map" resultType="Long">
select
a.id
from
gift_coupon_package a
where a.is_delete=0
and a.stock>0
and a.on_shelves=1
and now() <![CDATA[ < ]]> a.valid_date_end
and a.id not in
(
select DISTINCT gift_package_id from
gift_category
)
</select>
</mapper>
\ No newline at end of file
...@@ -19,11 +19,49 @@ ...@@ -19,11 +19,49 @@
<result property="exchangeAddress" column="exchange_address" jdbcType="VARCHAR"/> <result property="exchangeAddress" column="exchange_address" jdbcType="VARCHAR"/>
<result property="urlNumber" column="url_number" jdbcType="VARCHAR" /> <result property="urlNumber" column="url_number" jdbcType="VARCHAR" />
<result property="agentId" column="agent_id" jdbcType="BIGINT" /> <result property="agentId" column="agent_id" jdbcType="BIGINT" />
<result property="resourceNumber" column="resource_number" jdbcType="VARCHAR"/>
<result property="resourceDesc" column="resource_desc" jdbcType="VARCHAR"/>
<result property="price" column="price" jdbcType="VARCHAR"/>
<result property="crossedPrice" column="crossed_price" jdbcType="VARCHAR"/>
<result property="recToPage" column="rec_to_page" jdbcType="BOOLEAN" />
<result property="serveType" column="serve_type" jdbcType="VARCHAR" />
<result property="linkUrl" column="link_url" jdbcType="VARCHAR" />
<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" />
</resultMap>
<resultMap type="com.pcloud.book.giftcoupon.dto.GiftPackageDTO" id="GiftCouplePackageDtoMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="coverPic" column="cover_pic" jdbcType="VARCHAR"/>
<result property="title" column="title" jdbcType="VARCHAR"/>
<result property="validDateBegin" column="valid_date_begin" jdbcType="TIMESTAMP"/>
<result property="validDateEnd" column="valid_date_end" jdbcType="TIMESTAMP"/>
<result property="denomination" column="denomination" jdbcType="INTEGER"/>
<result property="stock" column="stock" jdbcType="INTEGER"/>
<result property="receiveLimit" column="receive_limit" jdbcType="INTEGER"/>
<result property="couponType" column="coupon_type" jdbcType="INTEGER"/>
<result property="instructions" column="instructions" jdbcType="VARCHAR"/>
<result property="useType" column="use_type" jdbcType="INTEGER"/>
<result property="exchangeAddress" column="exchange_address" jdbcType="VARCHAR"/>
<result property="urlNumber" column="url_number" jdbcType="VARCHAR" />
<result property="agentId" column="agent_id" jdbcType="BIGINT" />
<result property="resourceNumber" column="resource_number" jdbcType="VARCHAR"/>
<result property="resourceDesc" column="resource_desc" jdbcType="VARCHAR"/>
<result property="price" column="price" jdbcType="VARCHAR"/>
<result property="crossedPrice" column="crossed_price" jdbcType="VARCHAR"/>
<result property="recToPage" column="rec_to_page" jdbcType="BOOLEAN" />
<result property="serveType" column="serve_type" jdbcType="VARCHAR" />
<result property="linkUrl" column="link_url" jdbcType="VARCHAR" />
<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" />
</resultMap> </resultMap>
<sql id="Base_Column_List"> <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, 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 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
</sql> </sql>
<!--查询单个--> <!--查询单个-->
...@@ -90,9 +128,11 @@ ...@@ -90,9 +128,11 @@
<!--新增所有列--> <!--新增所有列-->
<insert id="insert" parameterType="com.pcloud.book.giftcoupon.entity.GiftCouponPackage" keyProperty="id" useGeneratedKeys="true"> <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, 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) 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)
values (#{coverPic}, #{title}, #{validDateBegin}, #{validDateEnd}, #{denomination}, #{stock}, #{receiveLimit}, now(), now(), 0, values (#{coverPic}, #{title}, #{validDateBegin}, #{validDateEnd}, #{denomination}, #{stock}, #{receiveLimit}, now(), now(), 0,
#{couponType},#{instructions},#{useType},#{exchangeAddress}, #{urlNumber}, #{agentId}) #{couponType},#{instructions},#{useType},#{exchangeAddress}, #{urlNumber}, #{agentId},#{resourceNumber},#{resourceDesc},#{price}
,#{crossedPrice},#{recToPage},#{serveType},#{serveId},#{thirdResourceId},#{linkUrl},#{onShelves})
</insert> </insert>
<!--通过主键修改数据--> <!--通过主键修改数据-->
...@@ -138,6 +178,30 @@ ...@@ -138,6 +178,30 @@
<if test="urlNumber != null"> <if test="urlNumber != null">
url_number = #{urlNumber}, url_number = #{urlNumber},
</if> </if>
resource_number = #{resourceNumber},
<if test="resourceDesc != null">
resource_desc = #{resourceDesc},
</if>
price = #{price},
crossed_price = #{crossedPrice},
<if test="recToPage != null">
rec_to_page = #{recToPage},
</if>
<if test="serveType != null">
serve_type = #{serveType},
</if>
<if test="serveId != null">
serve_id = #{serveId},
</if>
<if test="linkUrl != null">
link_url = #{linkUrl},
</if>
<if test="thirdResourceId != null">
third_resource_id = #{thirdResourceId},
</if>
<if test="onShelves != null">
on_shelves = #{onShelves},
</if>
update_time = now() update_time = now()
</set> </set>
where id = #{id} where id = #{id}
...@@ -163,13 +227,16 @@ ...@@ -163,13 +227,16 @@
a.instructions instructions, a.instructions instructions,
a.use_type useType, a.use_type useType,
a.exchange_address exchangeAddress, a.exchange_address exchangeAddress,
a.url_number urlNumber a.url_number urlNumber,
a.resource_number resourceNumber,
a.rec_to_page recToPage,
a.on_shelves onShelves
from from
gift_coupon_package a gift_coupon_package a
where a.is_delete=0 where a.is_delete=0
and a.stock>0 and a.stock>0
<if test="title !=null and title !=''"> <if test="title !=null and title !=''">
and a.title like concat('%',#{title},'%') and (a.title like concat('%',#{title},'%') or a.resource_number like concat('%',#{title},'%'))
</if> </if>
<if test="state !=null and state==1"> <if test="state !=null and state==1">
and now() <![CDATA[ < ]]> a.valid_date_begin and now() <![CDATA[ < ]]> a.valid_date_begin
...@@ -186,6 +253,9 @@ ...@@ -186,6 +253,9 @@
<if test="couponType !=null"> <if test="couponType !=null">
and a.coupon_type=#{couponType} and a.coupon_type=#{couponType}
</if> </if>
<if test="onShelves !=null">
and a.on_shelves=#{onShelves}
</if>
and a.receive_limit>0 and a.receive_limit>0
<choose> <choose>
<when test="agentId != null"> <when test="agentId != null">
...@@ -195,7 +265,6 @@ ...@@ -195,7 +265,6 @@
and a.agent_id = 0 and a.agent_id = 0
</otherwise> </otherwise>
</choose> </choose>
GROUP BY a.id
order by a.update_time desc order by a.update_time desc
</select> </select>
...@@ -343,5 +412,61 @@ ...@@ -343,5 +412,61 @@
order by a.update_time desc order by a.update_time desc
</select> </select>
<update id="batchUpdateGift" parameterType="map">
update gift_coupon_package
set on_shelves=#{onShelves},
update_time=now()
where id in
<foreach collection="packageIds" item="item" index="index" open="(" separator="," close=")">
${item}
</foreach>
</update>
<select id="getByPackageId" parameterType="Long" resultMap="GiftCouplePackageDtoMap">
select
<include refid="Base_Column_List"/>
from book.gift_coupon_package
where id = #{id}
and is_delete=0
</select>
<select id="getByResourceNumber" parameterType="map" resultType="Integer">
select ifnull(count(1),0)
from gift_coupon_package
where resource_number=#{resourceNumber}
<if test="packageId !=null">
and id !=#{packageId}
</if>
</select>
<select id="getGiftByIds" parameterType="map" 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,
if(NOW()<![CDATA[ < ]]> a.valid_date_begin,1,if(NOW() between a.valid_date_begin and a.valid_date_end,2,3)) state,
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
from
gift_coupon_package a
where a.id in
<foreach collection="packageIds" item="item" index="index" open="(" separator="," close=")">
${item}
</foreach>
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -128,7 +128,7 @@ ...@@ -128,7 +128,7 @@
where id=#{receiveId} where id=#{receiveId}
</select> </select>
<select id="list4MyGiftPackage" parameterType="map" resultType="com.pcloud.book.giftcoupon.dto.MyGiftPackageDTO"> <select id="list4MyGiftPackage" parameterType="map" resultType="com.pcloud.book.giftcoupon.dto.GiftPackageDTO">
select select
b.id receiveId, b.id receiveId,
b.use_time useTime, b.use_time useTime,
...@@ -141,8 +141,16 @@ ...@@ -141,8 +141,16 @@
a.coupon_type couponType, a.coupon_type couponType,
a.instructions instructions, a.instructions instructions,
a.use_type useType, a.use_type useType,
a.resource_desc resourceDesc,
a.price price,
a.crossed_price crossedPrice,
a.exchange_address exchangeAddress, a.exchange_address exchangeAddress,
if(b.use_time>0,1,2) failureState if(b.use_time>0,1,2) failureState,
a.serve_id serveId,
a.serve_type serveType,
a.link_url linkUrl,
a.third_resource_id thirdResourceId,
a.on_shelves onShelves
from from
gift_receive b LEFT JOIN gift_coupon_package a gift_receive b LEFT JOIN gift_coupon_package a
on a.id=b.gift_package_id on a.id=b.gift_package_id
...@@ -198,5 +206,24 @@ ...@@ -198,5 +206,24 @@
GROUP BY a.gift_package_id HAVING count(a.id)>=b.receive_limit GROUP BY a.gift_package_id HAVING count(a.id)>=b.receive_limit
</select> </select>
<select id="getGiftAllReceiveCount" parameterType="map" resultType="Integer">
select ifnull(count(1),0)
from gift_receive a
left join gift_coupon_package b
on a.gift_package_id=b.id
where a.wechat_user_id=#{wechatUserId}
and a.use_time is null
and b.valid_date_end > now()
</select>
<select id="getReceivedIds" parameterType="map" resultType="Long">
select distinct gift_package_id
from gift_receive
where wechat_user_id=#{wechatUserId}
and gift_package_id in
<foreach collection="giftPackageIds" item="item" index="index" open="(" separator="," close=")">
${item}
</foreach>
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -304,4 +304,17 @@ ...@@ -304,4 +304,17 @@
ORDER BY d.id ORDER BY d.id
</select> </select>
<delete id="deletePackageIds" parameterType="list">
delete
from
rights_now_item
where
serve_type = "GIFT"
and
gift_coupon_package_id in
<foreach collection="list" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
</mapper> </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