| | |
| | | package com.ks.lucky.pojo.DO; |
| | | |
| | | import org.springframework.data.annotation.Transient; |
| | | import org.yeshi.utils.mybatis.Table; |
| | | |
| | | import javax.validation.Valid; |
| | | import javax.validation.constraints.NotEmpty; |
| | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | @Table("lucky_activity_awards") |
| | | @Valid |
| | | public class LuckyActivityAwards implements Serializable { |
| | | |
| | |
| | | |
| | | import com.google.gson.Gson; |
| | | |
| | | public class JoinInfo { |
| | | import java.io.Serializable; |
| | | |
| | | public class JoinInfo implements Serializable { |
| | | |
| | | /** |
| | | * 支付宝用户ID |
| | |
| | | |
| | | |
| | | /** |
| | | * 是否已经助力过 |
| | | * |
| | | * @param joinId |
| | | * @param appId |
| | | * @param uid |
| | | * @param eventKey |
| | | * @return |
| | | */ |
| | | public boolean isAssisted(@NotNull Long joinId, @NotEmpty Long appId, @NotEmpty String uid, @NotNull ActivityJoinAssistEvent eventKey); |
| | | |
| | | |
| | | /** |
| | | * 获取助力列表 |
| | | * |
| | | * @param activityId |
| | |
| | | * @throws LuckyActivityException |
| | | * @throws LuckyActivityJoinException |
| | | */ |
| | | public void join(@NotNull Long activityId, @NotEmpty Long appId, @NotEmpty String uid, Integer weight, JoinInfo joinInfo) throws LuckyActivityException, LuckyActivityJoinException; |
| | | public void join(@NotNull Long activityId, @NotNull Long appId, @NotEmpty String uid, Integer weight, JoinInfo joinInfo) throws LuckyActivityException, LuckyActivityJoinException; |
| | | |
| | | |
| | | /** |
| | |
| | | |
| | | |
| | | /** |
| | | * 活动简版详情 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | public LuckyActivity getActivity(Long id); |
| | | |
| | | |
| | | /** |
| | | * 获取活动详情 |
| | | * |
| | | * @param id |
| | |
| | | package com.ks.daylucky.aspect; |
| | | |
| | | import com.ks.app.entity.AppInfo; |
| | | import com.ks.daylucky.pojo.DTO.TokenParseResultDTO; |
| | | import com.ks.daylucky.pojo.VO.AcceptData; |
| | | import com.ks.daylucky.service.impl.AppManager; |
| | | import com.ks.daylucky.util.ApiCodeConstant; |
| | | import com.ks.daylucky.util.UserInfoUtil; |
| | | import org.aspectj.lang.ProceedingJoinPoint; |
| | | import org.aspectj.lang.annotation.Around; |
| | | import org.aspectj.lang.annotation.Aspect; |
| | |
| | | return null; |
| | | } |
| | | |
| | | //注入UID |
| | | |
| | | String token = request.getHeader("token"); |
| | | Long uid = null; |
| | | if (!StringUtil.isNullOrEmpty(token)) { |
| | | TokenParseResultDTO tokenParseResultDTO = UserInfoUtil.parseToken(token); |
| | | if (tokenParseResultDTO.getState() == TokenParseResultDTO.TOKEN_STATE_VALID) { |
| | | uid = tokenParseResultDTO.getUid(); |
| | | } |
| | | } |
| | | |
| | | |
| | | for (Object obj : joinPoint.getArgs()) { |
| | | if (obj instanceof AcceptData) { |
| | | //注入应用详情 |
| | | ((AcceptData) obj).setApp(app); |
| | | ((AcceptData) obj).setUid(uid); |
| | | break; |
| | | } |
| | | } |
| | |
| | | package com.ks.daylucky.controller.api.client; |
| | | |
| | | import com.ks.daylucky.pojo.DO.UserInfo; |
| | | import com.ks.daylucky.pojo.DTO.AssistJoinInfoDTO; |
| | | import com.ks.daylucky.pojo.VO.*; |
| | | import com.ks.daylucky.service.UserInfoService; |
| | | import com.ks.daylucky.util.Constant; |
| | | import com.ks.daylucky.util.RSAUtil; |
| | | import com.ks.daylucky.util.UserInfoUtil; |
| | | import com.ks.daylucky.util.activity.ActivityUtil; |
| | | import com.ks.lucky.exception.LuckyActivityException; |
| | | import com.ks.lucky.exception.LuckyActivityJoinAssistException; |
| | | import com.ks.lucky.pojo.DO.ActivityJoinAssistEvent; |
| | | import com.ks.lucky.pojo.DO.LuckyActivityJoinAssist; |
| | | import com.ks.lucky.pojo.DO.LuckyActivity; |
| | | import com.ks.lucky.pojo.DO.LuckyActivityJoinRecord; |
| | | import com.ks.lucky.pojo.DTO.ActivityAssistFriend; |
| | | import com.ks.lucky.pojo.DTO.ActivityFriendAssistInfo; |
| | | import com.ks.lucky.remote.service.LuckyActivityJoinAssistService; |
| | | import com.ks.lucky.remote.service.LuckyActivityJoinService; |
| | | import com.ks.lucky.remote.service.LuckyActivityService; |
| | | import net.sf.json.JSONObject; |
| | | import org.apache.dubbo.config.annotation.Reference; |
| | | import org.springframework.stereotype.Controller; |
| | |
| | | @Reference(version = "1.0.0") |
| | | private LuckyActivityJoinService luckyActivityJoinService; |
| | | |
| | | @Reference(version = "1.0.0") |
| | | private LuckyActivityService luckyActivityService; |
| | | |
| | | @Resource |
| | | private UserInfoService userInfoService; |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping("assist") |
| | | public String assist(AcceptData acceptData, Long activityId, Long joinId, int page) { |
| | | LuckyActivityJoinRecord record = luckyActivityJoinService.getJoinRecord(joinId); |
| | | public String assist(AcceptData acceptData, Long activityId, String joinInfo) { |
| | | AssistJoinInfoDTO dto = ActivityUtil.parseShareJoinInfo(joinInfo); |
| | | if (dto == null) { |
| | | return JsonUtil.loadFalseResult("参与信息解析失败"); |
| | | } |
| | | |
| | | |
| | | LuckyActivityJoinRecord record = luckyActivityJoinService.getJoinInfo(activityId, acceptData.getApp().getId(), acceptData.getUid() + ""); |
| | | //不存在助力 |
| | | if (record == null) { |
| | | return JsonUtil.loadFalseResult(""); |
| | |
| | | |
| | | import com.ks.daylucky.pojo.DO.ActivityScanRecord; |
| | | import com.ks.daylucky.pojo.DO.AppConfig; |
| | | import com.ks.daylucky.pojo.VO.ActivityShareInfoVO; |
| | | import com.ks.daylucky.pojo.DTO.AssistJoinInfoDTO; |
| | | import com.ks.daylucky.pojo.DTO.ConfigKeyEnum; |
| | | import com.ks.daylucky.pojo.VO.AcceptData; |
| | | import com.ks.daylucky.pojo.DTO.ActivityDetailInfoDTO; |
| | | import com.ks.daylucky.pojo.VO.ActivityDetailVO; |
| | | import com.ks.daylucky.pojo.VO.ActivityListItemInfoVO; |
| | | import com.ks.daylucky.service.*; |
| | | import com.ks.daylucky.util.Constant; |
| | | import com.ks.daylucky.util.RSAUtil; |
| | | import com.ks.daylucky.util.activity.ActivityUtil; |
| | | import com.ks.daylucky.util.factory.vo.ActivityDetailVOFactory; |
| | | import com.ks.daylucky.util.factory.vo.ActivityListItemInfoVOFactory; |
| | | import com.ks.lucky.pojo.DO.LuckyActivity; |
| | | import com.ks.lucky.remote.service.LuckyActivityJoinAssistService; |
| | | import com.ks.lucky.remote.service.LuckyActivityJoinService; |
| | | import com.ks.lucky.remote.service.LuckyActivityService; |
| | | import net.sf.json.JSONObject; |
| | | import org.apache.dubbo.config.annotation.Reference; |
| | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.yeshi.utils.JsonUtil; |
| | | import org.yeshi.utils.encrypt.AESUtil; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | |
| | | assistCount = (int) count; |
| | | } |
| | | |
| | | //查询赞助商已经开始的活动数量 |
| | | |
| | | ActivityDetailVO vo = ActivityDetailVOFactory.create(dto, help != null ? help.getValue() : null, assistCount); |
| | | return JsonUtil.loadTrueResult(vo); |
| | | long count = luckyActivityService.countActivity(acceptData.getApp().getId(), dto.getActivity().getSponsorId(), ActivityUtil.getCanShowAcivityStateList(), null); |
| | | |
| | | ActivityDetailVO vo = ActivityDetailVOFactory.create(dto, help != null ? help.getValue() : null, assistCount, (int) count); |
| | | |
| | | //分享信息 |
| | | |
| | | ActivityShareInfoVO shareInfoDTO = new ActivityShareInfoVO(); |
| | | shareInfoDTO.setPath(String.format("/pages/activity-detail/activity-detail?id=%s&joinInfo=%s", activityId, ActivityUtil.getShareJoinInfo(acceptData.getUid(), activityId))); |
| | | shareInfoDTO.setTitle("测试标题"); |
| | | shareInfoDTO.setDesc("测试简介"); |
| | | // shareInfoDTO.setBgImgUrl(); |
| | | vo.setShareInfo(shareInfoDTO); |
| | | |
| | | |
| | | //加入浏览记录 |
| | | ActivityScanRecord record = new ActivityScanRecord(); |
| | | record.setActivityId(activityId); |
| | | record.setUid(acceptData.getUid()); |
| | | activityScanRecordService.addRecord(record); |
| | | |
| | | |
| | | return JsonUtil.loadTrueResult(JsonUtil.getSimpleGson().toJson(vo)); |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | } |
| | | List<ActivityDetailInfoDTO> dtoList = activityService.getActivityDetail(activityIds, acceptData.getApp().getId(), acceptData.getUid(), false); |
| | | |
| | | //TODO 测试 |
| | | for (int i = 0; i < 20; i++) { |
| | | dtoList.add(dtoList.get(0)); |
| | | } |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("data", ActivityListItemInfoVOFactory.create(dtoList)); |
| | | data.put("data", JsonUtil.getSimpleGson().toJson(ActivityListItemInfoVOFactory.create(dtoList))); |
| | | data.put("count", count); |
| | | return JsonUtil.loadTrueResult(data); |
| | | } |
| | |
| | | * @param page |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping("getSponsorActivity") |
| | | public String getSponsorActivity(AcceptData acceptData, Long sponsorId, int page) { |
| | | |
| | |
| | | } |
| | | List<ActivityDetailInfoDTO> dtoList = activityService.getActivityDetail(activityIds, acceptData.getApp().getId(), acceptData.getUid(), false); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("data", ActivityListItemInfoVOFactory.create(dtoList)); |
| | | data.put("data", JsonUtil.getSimpleGson().toJson(ActivityListItemInfoVOFactory.create(dtoList))); |
| | | data.put("count", count); |
| | | return JsonUtil.loadTrueResult(data); |
| | | } |
| | |
| | | * @param page |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping("getScanActivityRecord") |
| | | public String getScanActivityRecord(AcceptData acceptData, int page) { |
| | | |
| | |
| | | } |
| | | List<ActivityDetailInfoDTO> dtoList = activityService.getActivityDetail(activityIds, acceptData.getApp().getId(), acceptData.getUid(), false); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("data", ActivityListItemInfoVOFactory.create(dtoList)); |
| | | data.put("data", JsonUtil.getSimpleGson().toJson(ActivityListItemInfoVOFactory.create(dtoList))); |
| | | data.put("count", count); |
| | | return JsonUtil.loadTrueResult(data); |
| | | } |
| | |
| | | if (list != null && list.size() > 0) { |
| | | Map<Long, UserInfo> userInfoMap = userInfoService.listUserInfoAsMap(UserInfoUtil.getBaseUserList(list)); |
| | | for (ActivitySimpleUser info : list) { |
| | | UserInfo user = userInfoMap.get(info.getUid()); |
| | | UserInfo user = userInfoMap.get(Long.parseLong(info.getUid())); |
| | | if (user != null) { |
| | | voList.add(new SimpleUser(user.getId(), user.getNickName(), user.getPortrait())); |
| | | } |
| | |
| | | List<ActivityDetailInfoDTO> voList = activityService.getActivityDetail(activityIdList, appId, uid, type == 2 ? true : false); |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("data", ActivityListItemInfoVOFactory.create(voList)); |
| | | data.put("data",JsonUtil.getSimpleGson().toJson(ActivityListItemInfoVOFactory.create(voList))); |
| | | data.put("count", count); |
| | | |
| | | return JsonUtil.loadTrueResult(data); |
| | |
| | | import com.ks.daylucky.exception.UserInfoExtraException; |
| | | import com.ks.daylucky.pojo.DO.UserInfo; |
| | | import com.ks.daylucky.pojo.DO.UserMsg; |
| | | import com.ks.daylucky.pojo.DTO.AlipayUserInfo; |
| | | import com.ks.daylucky.pojo.DTO.TokenDTO; |
| | | import com.ks.daylucky.pojo.DTO.UserMsgSettings; |
| | | import com.ks.daylucky.pojo.VO.AcceptData; |
| | |
| | | import com.ks.daylucky.service.UserInfoService; |
| | | import com.ks.daylucky.service.UserMsgService; |
| | | import com.ks.daylucky.util.Constant; |
| | | import com.ks.daylucky.util.RSA2Encryptor; |
| | | import com.ks.daylucky.util.RSAUtil; |
| | | import com.ks.daylucky.util.UserInfoUtil; |
| | | import net.sf.json.JSONObject; |
| | | import org.springframework.stereotype.Controller; |
| | |
| | | user = new UserInfo(); |
| | | user.setAppId(acceptData.getApp().getId()); |
| | | user.setIdentifyCode(identifyCode); |
| | | user.setAlipayUid(identifyCode); |
| | | try { |
| | | Long uid = userInfoService.addUserInfo(user); |
| | | user.setId(uid); |
| | |
| | | return JsonUtil.loadTrueResult(JsonUtil.getApiCommonGson().toJson(user)); |
| | | } |
| | | |
| | | /** |
| | | * 支付宝用户信息上传 |
| | | * |
| | | * @param acceptData |
| | | * @param userInfo |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping("uploadAlipayUserInfo") |
| | | public String uploadAlipayUserInfo(AcceptData acceptData, String userInfo) { |
| | | String decryptStr = RSAUtil.decrypt(userInfo); |
| | | if (StringUtil.isNullOrEmpty(decryptStr)) { |
| | | return JsonUtil.loadFalseResult("用户信息获取失败"); |
| | | } |
| | | AlipayUserInfo alipayUserInfo = JsonUtil.getSimpleGson().fromJson(decryptStr, AlipayUserInfo.class); |
| | | |
| | | UserInfo user = new UserInfo(); |
| | | user.setId(acceptData.getUid()); |
| | | user.setPortrait(alipayUserInfo.getAvatar()); |
| | | user.setNickName(alipayUserInfo.getNickName()); |
| | | user.setAlipayNickName(alipayUserInfo.getNickName()); |
| | | user.setAlipayPortrait(alipayUserInfo.getAvatar()); |
| | | userInfoService.updateUserInfo(user); |
| | | |
| | | user = userInfoService.getUserDetail(user.getId()); |
| | | |
| | | return JsonUtil.loadTrueResult(JsonUtil.getApiCommonGson().toJson(user)); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping("setAlipayUserInfo") |
| | |
| | | @NotNull(message = "应用唯一标识不能为空") |
| | | private String identifyCode; |
| | | |
| | | @Expose |
| | | private String nickName; |
| | | |
| | | @Expose |
| | | private String portrait; |
| | | |
| | | private String mobile; |
New file |
| | |
| | | package com.ks.daylucky.pojo.DTO; |
| | | |
| | | public class AlipayUserInfo { |
| | | |
| | | |
| | | /** |
| | | * avatar : https://tfs.alipayobjects.com/images/partner/TB1UE8YcJdFDuNkUuLAXXXvvFXa |
| | | * nickName : 昵称 |
| | | * gender : m |
| | | * countryCode : CN |
| | | * province : 浙江省 |
| | | * city : 杭州市 |
| | | */ |
| | | |
| | | private String avatar; |
| | | private String nickName; |
| | | private String gender; |
| | | private String countryCode; |
| | | private String province; |
| | | private String city; |
| | | |
| | | |
| | | public String getAvatar() { |
| | | return avatar; |
| | | } |
| | | |
| | | public void setAvatar(String avatar) { |
| | | this.avatar = avatar; |
| | | } |
| | | |
| | | public String getNickName() { |
| | | return nickName; |
| | | } |
| | | |
| | | public void setNickName(String nickName) { |
| | | this.nickName = nickName; |
| | | } |
| | | |
| | | public String getGender() { |
| | | return gender; |
| | | } |
| | | |
| | | public void setGender(String gender) { |
| | | this.gender = gender; |
| | | } |
| | | |
| | | public String getCountryCode() { |
| | | return countryCode; |
| | | } |
| | | |
| | | public void setCountryCode(String countryCode) { |
| | | this.countryCode = countryCode; |
| | | } |
| | | |
| | | public String getProvince() { |
| | | return province; |
| | | } |
| | | |
| | | public void setProvince(String province) { |
| | | this.province = province; |
| | | } |
| | | |
| | | public String getCity() { |
| | | return city; |
| | | } |
| | | |
| | | public void setCity(String city) { |
| | | this.city = city; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.pojo.DTO; |
| | | |
| | | public class AssistJoinInfoDTO { |
| | | private Long uid; |
| | | private Long activityId; |
| | | |
| | | public AssistJoinInfoDTO( Long uid, Long activityId) { |
| | | this.uid = uid; |
| | | this.activityId = activityId; |
| | | } |
| | | |
| | | public Long getUid() { |
| | | return uid; |
| | | } |
| | | |
| | | public void setUid(Long uid) { |
| | | this.uid = uid; |
| | | } |
| | | |
| | | public Long getActivityId() { |
| | | return activityId; |
| | | } |
| | | |
| | | public void setActivityId(Long activityId) { |
| | | this.activityId = activityId; |
| | | } |
| | | } |
| | |
| | | import com.ks.daylucky.pojo.DTO.ActivityJoinConditionEvent; |
| | | import com.ks.daylucky.pojo.VO.common.JumpDetailVO; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | //开奖时间 |
| | | private String actualOpenDate; |
| | | |
| | | //赞助商的其他活动 |
| | | private Integer sponsorActivityCount; |
| | | |
| | | //分享信息 |
| | | private ActivityShareInfoVO shareInfo; |
| | | |
| | | |
| | | public ActivityShareInfoVO getShareInfo() { |
| | | return shareInfo; |
| | | } |
| | | |
| | | public void setShareInfo(ActivityShareInfoVO shareInfo) { |
| | | this.shareInfo = shareInfo; |
| | | } |
| | | |
| | | public Integer getSponsorActivityCount() { |
| | | return sponsorActivityCount; |
| | | } |
| | | |
| | | public void setSponsorActivityCount(Integer sponsorActivityCount) { |
| | | this.sponsorActivityCount = sponsorActivityCount; |
| | | } |
| | | |
| | | public String getActualOpenDate() { |
| | | return actualOpenDate; |
| | |
| | | |
| | | private List<ActivityAwardVO> awardList; |
| | | |
| | | //获取期号 |
| | | private String dateNumber; |
| | | |
| | | public String getDateNumber() { |
| | | return dateNumber; |
| | | } |
| | | |
| | | public void setDateNumber(String dateNumber) { |
| | | this.dateNumber = dateNumber; |
| | | } |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | |
| | | * awardList : [{"id":123,"typeIcon":"类型图标链接","title":"奖品名称","link":"详情链接"}] |
| | | */ |
| | | |
| | | private int id; |
| | | private Long id; |
| | | private String name; |
| | | private String poster; |
| | | private SponsorVO sponsor; |
| | | private List<ActivityAwardVO> awardList; |
| | | |
| | | public int getId() { |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(int id) { |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
New file |
| | |
| | | package com.ks.daylucky.pojo.VO; |
| | | |
| | | public class ActivityShareInfoVO { |
| | | private String path; |
| | | private String title; |
| | | private String desc; |
| | | private String content; |
| | | private String imageUrl; |
| | | private String bgImgUrl; |
| | | |
| | | public String getPath() { |
| | | return path; |
| | | } |
| | | |
| | | public void setPath(String path) { |
| | | this.path = path; |
| | | } |
| | | |
| | | public String getTitle() { |
| | | return title; |
| | | } |
| | | |
| | | public void setTitle(String title) { |
| | | this.title = title; |
| | | } |
| | | |
| | | public String getDesc() { |
| | | return desc; |
| | | } |
| | | |
| | | public void setDesc(String desc) { |
| | | this.desc = desc; |
| | | } |
| | | |
| | | public String getContent() { |
| | | return content; |
| | | } |
| | | |
| | | public void setContent(String content) { |
| | | this.content = content; |
| | | } |
| | | |
| | | public String getImageUrl() { |
| | | return imageUrl; |
| | | } |
| | | |
| | | public void setImageUrl(String imageUrl) { |
| | | this.imageUrl = imageUrl; |
| | | } |
| | | |
| | | public String getBgImgUrl() { |
| | | return bgImgUrl; |
| | | } |
| | | |
| | | public void setBgImgUrl(String bgImgUrl) { |
| | | this.bgImgUrl = bgImgUrl; |
| | | } |
| | | } |
| | |
| | | if (list != null && list.size() > 0) { |
| | | Map<Long, UserInfo> userInfoMap = userInfoService.listUserInfoAsMap(UserInfoUtil.getBaseUserList(list)); |
| | | for (ActivitySimpleUser info : list) { |
| | | UserInfo user = userInfoMap.get(info.getUid()); |
| | | UserInfo user = userInfoMap.get(Long.parseLong(info.getUid())); |
| | | if (user != null) { |
| | | userList.add(new SimpleUser(user.getId(), user.getNickName(), user.getPortrait())); |
| | | } |
New file |
| | |
| | | /** |
| | | * Alipay.com Inc. Copyright (c) 2004-2019 All Rights Reserved. |
| | | */ |
| | | package com.ks.daylucky.util; |
| | | |
| | | import com.alipay.api.AlipayConstants; |
| | | |
| | | /** |
| | | * RSA算法加密器 签名部分采用SHA1算法进行摘要计算 |
| | | */ |
| | | public class RSA2Encryptor extends RSAEncryptor { |
| | | /** |
| | | * RSA2最大加密明文大小(2048/8-11=244) |
| | | */ |
| | | private static final int MAX_ENCRYPT_BLOCK_SIZE = 244; |
| | | /** |
| | | * RSA2最大解密密文大小(2048/8=256) |
| | | */ |
| | | private static final int MAX_DECRYPT_BLOCK_SIZE = 256; |
| | | |
| | | @Override |
| | | protected String getAsymmetricType() { |
| | | return AlipayConstants.SIGN_TYPE_RSA2; |
| | | } |
| | | |
| | | @Override |
| | | protected String getSignAlgorithm() { |
| | | return AlipayConstants.SIGN_SHA256RSA_ALGORITHMS; |
| | | } |
| | | |
| | | @Override |
| | | protected int getMaxDecryptBlockSize() { |
| | | return MAX_DECRYPT_BLOCK_SIZE; |
| | | } |
| | | |
| | | @Override |
| | | protected int getMaxEncryptBlockSize() { |
| | | return MAX_ENCRYPT_BLOCK_SIZE; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | /** |
| | | * Alipay.com Inc. Copyright (c) 2004-2019 All Rights Reserved. |
| | | */ |
| | | package com.ks.daylucky.util; |
| | | |
| | | import com.alipay.api.AlipayConstants; |
| | | import com.alipay.api.internal.util.StreamUtil; |
| | | import com.alipay.api.internal.util.StringUtils; |
| | | import com.alipay.api.internal.util.asymmetric.BaseAsymmetricEncryptor; |
| | | import com.alipay.api.internal.util.codec.Base64; |
| | | |
| | | import javax.crypto.Cipher; |
| | | import java.io.*; |
| | | import java.security.KeyFactory; |
| | | import java.security.PrivateKey; |
| | | import java.security.PublicKey; |
| | | import java.security.Signature; |
| | | import java.security.spec.PKCS8EncodedKeySpec; |
| | | import java.security.spec.X509EncodedKeySpec; |
| | | |
| | | /** |
| | | * RSA算法加密器 签名部分采用SHA1算法进行摘要计算 |
| | | */ |
| | | public class RSAEncryptor extends BaseAsymmetricEncryptor { |
| | | /** |
| | | * RSA最大加密明文大小(1024/8-11=117) |
| | | */ |
| | | private static final int MAX_ENCRYPT_BLOCK_SIZE = 117; |
| | | |
| | | /** |
| | | * RSA最大解密密文大小(1024/8=128) |
| | | */ |
| | | private static final int MAX_DECRYPT_BLOCK_SIZE = 128; |
| | | |
| | | protected String getSignAlgorithm() { |
| | | return AlipayConstants.SIGN_ALGORITHMS; |
| | | } |
| | | |
| | | @Override |
| | | protected String getAsymmetricType() { |
| | | return AlipayConstants.SIGN_TYPE_RSA; |
| | | } |
| | | |
| | | protected int getMaxDecryptBlockSize() { |
| | | return MAX_DECRYPT_BLOCK_SIZE; |
| | | } |
| | | |
| | | protected int getMaxEncryptBlockSize() { |
| | | return MAX_ENCRYPT_BLOCK_SIZE; |
| | | } |
| | | |
| | | @Override |
| | | public String doDecrypt(String cipherTextBase64, String charset, String privateKey) throws Exception { |
| | | int maxDecrypt = getMaxDecryptBlockSize(); |
| | | PrivateKey priKey = getPrivateKeyFromPKCS8(AlipayConstants.SIGN_TYPE_RSA, |
| | | new ByteArrayInputStream(privateKey.getBytes())); |
| | | Cipher cipher = Cipher.getInstance(AlipayConstants.SIGN_TYPE_RSA); |
| | | cipher.init(Cipher.DECRYPT_MODE, priKey); |
| | | byte[] encryptedData = StringUtils.isEmpty(charset) |
| | | ? Base64.decodeBase64(cipherTextBase64.getBytes()) |
| | | : Base64.decodeBase64(cipherTextBase64.getBytes(charset)); |
| | | int inputLen = encryptedData.length; |
| | | ByteArrayOutputStream out = new ByteArrayOutputStream(); |
| | | int offSet = 0; |
| | | byte[] cache; |
| | | int i = 0; |
| | | // 对数据分段解密 |
| | | while (inputLen - offSet > 0) { |
| | | if (inputLen - offSet > maxDecrypt) { |
| | | cache = cipher.doFinal(encryptedData, offSet, maxDecrypt); |
| | | } else { |
| | | cache = cipher.doFinal(encryptedData, offSet, inputLen - offSet); |
| | | } |
| | | out.write(cache, 0, cache.length); |
| | | i++; |
| | | offSet = i * maxDecrypt; |
| | | } |
| | | byte[] decryptedData = out.toByteArray(); |
| | | out.close(); |
| | | |
| | | return StringUtils.isEmpty(charset) ? new String(decryptedData) |
| | | : new String(decryptedData, charset); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | protected String doEncrypt(String plainText, String charset, String publicKey) throws Exception { |
| | | int maxEncrypt = getMaxEncryptBlockSize(); |
| | | PublicKey pubKey = getPublicKeyFromX509(AlipayConstants.SIGN_TYPE_RSA, |
| | | new ByteArrayInputStream(publicKey.getBytes())); |
| | | Cipher cipher = Cipher.getInstance(AlipayConstants.SIGN_TYPE_RSA); |
| | | cipher.init(Cipher.ENCRYPT_MODE, pubKey); |
| | | byte[] data = StringUtils.isEmpty(charset) ? plainText.getBytes() |
| | | : plainText.getBytes(charset); |
| | | int inputLen = data.length; |
| | | ByteArrayOutputStream out = new ByteArrayOutputStream(); |
| | | int offSet = 0; |
| | | byte[] cache; |
| | | int i = 0; |
| | | // 对数据分段加密 |
| | | while (inputLen - offSet > 0) { |
| | | if (inputLen - offSet > maxEncrypt) { |
| | | cache = cipher.doFinal(data, offSet, maxEncrypt); |
| | | } else { |
| | | cache = cipher.doFinal(data, offSet, inputLen - offSet); |
| | | } |
| | | out.write(cache, 0, cache.length); |
| | | i++; |
| | | offSet = i * maxEncrypt; |
| | | } |
| | | byte[] encryptedData = Base64.encodeBase64(out.toByteArray()); |
| | | out.close(); |
| | | |
| | | return StringUtils.isEmpty(charset) ? new String(encryptedData) |
| | | : new String(encryptedData, charset); |
| | | } |
| | | |
| | | @Override |
| | | protected String doSign(String content, String charset, String privateKey) throws Exception { |
| | | PrivateKey priKey = getPrivateKeyFromPKCS8(AlipayConstants.SIGN_TYPE_RSA, |
| | | new ByteArrayInputStream(privateKey.getBytes())); |
| | | |
| | | Signature signature = Signature.getInstance(getSignAlgorithm()); |
| | | |
| | | signature.initSign(priKey); |
| | | |
| | | if (StringUtils.isEmpty(charset)) { |
| | | signature.update(content.getBytes()); |
| | | } else { |
| | | signature.update(content.getBytes(charset)); |
| | | } |
| | | |
| | | byte[] signed = signature.sign(); |
| | | |
| | | return new String(Base64.encodeBase64(signed)); |
| | | } |
| | | |
| | | @Override |
| | | protected boolean doVerify(String content, String charset, String publicKey, String sign) throws Exception { |
| | | PublicKey pubKey = getPublicKeyFromX509("RSA", |
| | | new ByteArrayInputStream(publicKey.getBytes())); |
| | | |
| | | Signature signature = Signature.getInstance(getSignAlgorithm()); |
| | | |
| | | signature.initVerify(pubKey); |
| | | |
| | | if (StringUtils.isEmpty(charset)) { |
| | | signature.update(content.getBytes()); |
| | | } else { |
| | | signature.update(content.getBytes(charset)); |
| | | } |
| | | |
| | | return signature.verify(Base64.decodeBase64(sign.getBytes())); |
| | | } |
| | | |
| | | public static PrivateKey getPrivateKeyFromPKCS8(String algorithm, |
| | | InputStream ins) throws Exception { |
| | | if (ins == null || StringUtils.isEmpty(algorithm)) { |
| | | return null; |
| | | } |
| | | |
| | | KeyFactory keyFactory = KeyFactory.getInstance(algorithm); |
| | | |
| | | byte[] encodedKey = StreamUtil.readText(ins).getBytes(); |
| | | |
| | | encodedKey = Base64.decodeBase64(encodedKey); |
| | | |
| | | return keyFactory.generatePrivate(new PKCS8EncodedKeySpec(encodedKey)); |
| | | } |
| | | |
| | | public static PublicKey getPublicKeyFromX509(String algorithm, |
| | | InputStream ins) throws Exception { |
| | | KeyFactory keyFactory = KeyFactory.getInstance(algorithm); |
| | | |
| | | StringWriter writer = new StringWriter(); |
| | | StreamUtil.io(new InputStreamReader(ins), writer); |
| | | |
| | | byte[] encodedKey = writer.toString().getBytes(); |
| | | |
| | | encodedKey = Base64.decodeBase64(encodedKey); |
| | | |
| | | return keyFactory.generatePublic(new X509EncodedKeySpec(encodedKey)); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.util; |
| | | |
| | | import com.alipay.api.AlipayApiException; |
| | | |
| | | public class RSAUtil { |
| | | private final static String PUBLICK_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAoC0hjT1HsIhAWyILQGLxkS4fCJbyGqH6xi4c/JTizhQZUnufJeMT2S5S4euLdJvU8lVHS1GIbQOJnnFTs/6UH3JWHztqydq7eAFCIv2i6RJ8pI3k2U8nBTWyb3YraxX7UxUTnZNLUyMujoSKmsk4f2litYFR1bqNvvNdGH5LVzGKSkOAuU6TKvDGscuEJ1ESU+MS6NqB047UbYz2TlElbypLZGlVng7U9B2ZXnu/Rb/Q5a0WW5eHSH+IkTIDXSr97FTkX+9ziRLGWX5YANKguldv9Cm96VC3hDa2rXirMhkRtgJGyYiMVNcfB2y0vBouKy17UY1TYVldtTNXOTwH1wIDAQAB"; |
| | | private final static String PRIVATE_KEY = "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCgLSGNPUewiEBbIgtAYvGRLh8IlvIaofrGLhz8lOLOFBlSe58l4xPZLlLh64t0m9TyVUdLUYhtA4mecVOz/pQfclYfO2rJ2rt4AUIi/aLpEnykjeTZTycFNbJvditrFftTFROdk0tTIy6OhIqayTh/aWK1gVHVuo2+810YfktXMYpKQ4C5TpMq8Maxy4QnURJT4xLo2oHTjtRtjPZOUSVvKktkaVWeDtT0HZlee79Fv9DlrRZbl4dIf4iRMgNdKv3sVORf73OJEsZZflgA0qC6V2/0Kb3pULeENrateKsyGRG2AkbJiIxU1x8HbLS8Gi4rLXtRjVNhWV21M1c5PAfXAgMBAAECggEAd2ALUGMqabOyGvltX0gedy/jaxhsSVMNPeQiMFCaFDJAiQufGbJ6GXN/y+YrYfW9p/nMj6KtRWnMh+w4EL6cEC+7Zb13ogbFjvOJIeDcKE5h3JXvx9FI6IYTfSSZyU5xp4LewqKDEev3h7naPu/WjoaxTUqa/enyOCzR5i5B4jHXvwQXPIbNIE2BNzycLXj5cha9SgIj2lvSVXytIF8srmnUBovKVFjfRfSTmwCAuUoLRe0hQa6rnmpQzNgZEMvSQWcAoQVphLPo2oaVXQbiRyKvQL7nW1qncCaFn3YGgHin/AzTvfZhZDYhFeqv9FcEZ7DPEv6dUuxG/FfRBp9EGQKBgQDc6Q25wfH3ziSQW36Op3UvkNkDyZol29g+9YK5u+8AKxSX/nMgrfsRECcoVdKNXXt96Ro/J7iTtczIigaOj8DjaX8uo4drO3de0QRWhbEHOWu+V2t7vGWLAYG+06yu0Tzi+qlf2g/e0U1f8iQpBeLIXfLqHWLSbImLBl9qzsiH2wKBgQC5nm3aNYHn2m2OpMN3q+k/CiGPGuTGFyxQr5j4IYFqL41PTww95lEfJGJR5x8Spj0JLHy/Zybppp2O+ACD0GGyPrvD8JFB7jKeJnZZE0omW5T8NuYk5XQlOeky4NEV+AygFitR2n1p/2xuLFdKR4qmy4zqC2f80MOslgWZM/IOtQKBgDBBiIoHX7/t+/a8xcyLsAGP9pfpNg8HExnNr5y6/N5gisMZBjUhTDLSAHvDI5dV0GAUx3L8TkmV8QHthLknlc8XgHzDpBU8jDreFcCAu8cEOBEAL6573QKcdaclvhcCBfbfIpiZndXiirBmyJddfcifHS0e9jNZGkKQRc+jFBL5AoGAOeihYPhchNbyYxQoH0e0xwQEID9FrD9ChhGiaZcaZuRa86k3qoAWQt75BZBTc2AFnr0QVi56R17BvP7GOlligVdtAN4mkykbBZf+SB/qfDkKK/18o3oqWArPJB5bXL08Qx1nemvtwIn9bAnNWdEkApFybvoMASWoRkmviXJZTBkCgYBnxwEUdhC/ddj0i/GUqqa6fHgMtZi+xAuTYfl4FmDMoXs6CS7mGmnlpU8hDpgC9NC07i96lGWXYv+Zf7VUVpsLsopX2EOSrSQu/u95L/64w4pemgn+ojVoTYL44KEt0eG6oM9CQ9vVx8U1stQOug3Qt42VUFsow6PhhMN4u9uu4A=="; |
| | | |
| | | |
| | | public static String decrypt(String content) { |
| | | try { |
| | | return new RSA2Encryptor().decrypt(content, "UTF-8", PRIVATE_KEY); |
| | | } catch (AlipayApiException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | public static String encrypt(String content) { |
| | | |
| | | try { |
| | | return new RSA2Encryptor().encrypt(content, "UTF-8", PUBLICK_KEY); |
| | | } catch (AlipayApiException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | package com.ks.daylucky.util.activity; |
| | | |
| | | public class ActivityUtil { |
| | | import com.google.gson.Gson; |
| | | import com.ks.daylucky.pojo.DTO.AssistJoinInfoDTO; |
| | | import com.ks.lucky.pojo.DO.LuckyActivity; |
| | | import org.yeshi.utils.JsonUtil; |
| | | import org.yeshi.utils.encrypt.AESUtil; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | public class ActivityUtil { |
| | | private final static String TOKEN_KEY = "@2020_Ks@8#8!!@#"; |
| | | |
| | | /** |
| | | * 返回活动期号 |
| | |
| | | return String.format("NO.%s", id + ""); |
| | | } |
| | | |
| | | /** |
| | | * 获取可以显示出来的活动 |
| | | * |
| | | * @return |
| | | */ |
| | | public static List<Integer> getCanShowAcivityStateList() { |
| | | List<Integer> stateList = new ArrayList<>(); |
| | | |
| | | stateList.add(LuckyActivity.STATE_STARTED); |
| | | stateList.add(LuckyActivity.STATE_FINISH); |
| | | stateList.add(LuckyActivity.STATE_PRE_OPENED); |
| | | stateList.add(LuckyActivity.STATE_OPENED); |
| | | return stateList; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取可以被助力的状态 |
| | | * |
| | | * @return |
| | | */ |
| | | public static List<Integer> getCanAssistStateList() { |
| | | List<Integer> stateList = new ArrayList<>(); |
| | | stateList.add(LuckyActivity.STATE_STARTED); |
| | | return stateList; |
| | | } |
| | | |
| | | |
| | | public static String getShareJoinInfo(Long uid, Long activityId) { |
| | | String str = JsonUtil.getSimpleGson().toJson(new AssistJoinInfoDTO(uid, activityId)); |
| | | String joinInfo = AESUtil.encrypt(str, TOKEN_KEY); |
| | | return joinInfo; |
| | | } |
| | | |
| | | public static AssistJoinInfoDTO parseShareJoinInfo(String str) { |
| | | try { |
| | | String decryptStr = AESUtil.decrypt(str, TOKEN_KEY); |
| | | return new Gson().fromJson(decryptStr, AssistJoinInfoDTO.class); |
| | | } catch (Exception e) { |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import com.ks.daylucky.pojo.VO.ActivityDetailVO; |
| | | import com.ks.daylucky.pojo.VO.LabelVO; |
| | | import com.ks.daylucky.pojo.VO.common.JumpDetailVO; |
| | | import com.ks.daylucky.util.activity.ActivityUtil; |
| | | import com.ks.lucky.pojo.DO.*; |
| | | import com.ks.lucky.pojo.DTO.sponsorad.AlipayLifeAdInfo; |
| | | import net.sf.json.JSONObject; |
| | |
| | | |
| | | public class ActivityDetailVOFactory { |
| | | |
| | | public static ActivityDetailVO create(ActivityDetailInfoDTO dto, String helpLink, Integer assistCount) { |
| | | public static ActivityDetailVO create(ActivityDetailInfoDTO dto, String helpLink, Integer assistCount, int sponsorActivityCount) { |
| | | ActivityDetailVO vo = new ActivityDetailVO(); |
| | | vo.setActivity(create(dto.getActivity())); |
| | | vo.setJoined(dto.getJoin()); |
| | |
| | | |
| | | vo.setHelpLink(helpLink); |
| | | vo.setAssistCount(assistCount); |
| | | vo.setSponsorActivityCount(sponsorActivityCount <= 1 ? 0 : sponsorActivityCount - 1); |
| | | if (dto.getActivity().getActualOpenTime() != null) { |
| | | vo.setActualOpenDate(TimeUtil.getGernalTime(dto.getActivity().getActualOpenTime().getTime(), "yyyy.MM.dd HH:mm")); |
| | | } |
| | |
| | | bean.setPoster(activity.getMaterialPoster()); |
| | | bean.setSponsor(ActivityListItemInfoVOFactory.create(activity.getSponsorInfo().getSponsors())); |
| | | bean.setSponsorAd(create(activity.getSponsorInfo())); |
| | | bean.setDateNumber("活动期号:" + ActivityUtil.getActivityDateNumber(activity.getId())); |
| | | return bean; |
| | | } |
| | | |
| | |
| | | AlipayLifeAdInfo ad = sponsorInfo.getAd().getAlipayLifeAdInfo(); |
| | | bean.setContent(ad.getDesc()); |
| | | bean.setIcon(ad.getIcon()); |
| | | bean.setTitle(ad.getName()); |
| | | JSONObject params = new JSONObject(); |
| | | params.put("sceneId", ad.getSceneId()); |
| | | bean.setJump(new JumpDetailVO(JumpDetailVO.JumpType.alipayLife, "关注生活号", params)); |
| | |
| | | for (LuckyActivityAwards awards : activity.getAwardsList()) { |
| | | list.add(create(awards, p++)); |
| | | } |
| | | bean.setId(activity.getId()); |
| | | bean.setAwardList(list); |
| | | bean.setName(activity.getName()); |
| | | bean.setPoster(activity.getMaterialPoster()); |
| | |
| | | if (awards.getMaterial().getType() == LuckyActivityAwardMaterial.ActivityAwardMaterialType.alipayRedPackage) { |
| | | switch (awards.getAwardWay()) { |
| | | case LuckyActivityAwards.AWARD_WAY_DIVIDE: |
| | | bean.setTypeIcon(""); |
| | | bean.setTypeIcon("https://daylucky-1255749512.cos.ap-nanjing.myqcloud.com/image/icon/icon_award_way_divide.png"); |
| | | break; |
| | | case LuckyActivityAwards.AWARD_WAY_RANDOM: |
| | | bean.setTypeIcon(""); |
| | | bean.setTypeIcon("https://daylucky-1255749512.cos.ap-nanjing.myqcloud.com/image/icon/icon_award_way_random.png"); |
| | | break; |
| | | } |
| | | } else { |
New file |
| | |
| | | package com.ks; |
| | | |
| | | |
| | | import com.ks.daylucky.util.RSAEncryptor; |
| | | import org.junit.jupiter.api.Test; |
| | | |
| | | public class RSATest { |
| | | |
| | | @Test |
| | | public void test1() { |
| | | String userInfo = "C676YiyTl765D1mr3mnFXE+4h3XM2oQoysOuZVzGSikKa4eOWKhrxBiDoppk2cA7OQfHMNWryUsVByqSYsB0xSo6s1kaRmDuLaP30WYdWqoZP9DxQ/Ndgk2Bphe1+6ibVsRyOj0iZFN4//IY/HB04xvmJe8qWXrgrSZGbh4i3NlWUe2qJ5NMHxvcZ9n+ey53jUFvS8hpIbKWqZ4KPqYNtV4shxySAsbixWcO8YxmLp3cIczU4x26kG1IFt8L2/+Bkzij6jHeiDrFrBXizgd4GC3f0LPUZJwWFjqup9NmSottJFx0ZVR6KyWN0j6QAfawmyLzNROb64TPEDXotmcFIg=="; |
| | | |
| | | String privateKeyStr = "MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAIEHGfMJ0/2o5DG1ZIWX+2rLSv9cLF+5TKCEIQkSTYkUK+hmr/W/vNSxQ66J59eT6rcDyPa1nJ4iBgJN0HDKT7GyEeUeV67eS8qt4cTXebttiYRpoD6yLMAiQSTE/tsrwgnga8OI5+Nk8+hq5WkaDrG/bUaVC8NeOk0dE1Pg4QMBAgMBAAECgYB1Nw9S5D3KtfDAW8p7Nuu3RAHY5FKHj53WQNKGHDOF8WZGFWuK9GnGS1dyK2QMSxsyseSSg8BJRB1zYF+Y56HnP8LwPkwjEQTdocdqTq5EC6Lokyjurk3gWcjYAc01Vj2UHcMZmEJx5YsWyVxeUW7dWSm/od7XnG8CsYRJhzexRQJBAMWBd0oLOnzg4y1rOcqPprJfRL/0tDnwToDuTSVUGYlZf1G+oHIvAswoBnZ6uw+VJlL6b18sI5d1fRTECY4X1a8CQQCnPcF+pOEgls6njpvp/ivJjXH7zJ2ylA4DRNwtw10i7mByjNJ6XMPs75ZPVhkNVD+qHL7ml0XYDS/mSzE/sY5PAkEAmHRjPEiGkTaWpcyLA4z3Q+C+FN4y8DZKosNP0WyleZwX52WaPAmFw0lyE6qREmoy9wJRTcmof5U1Q/4+0ewcCQJBAIeOrgU6HeSteGomVMhwpgtj5A0mSHiUO1t4+EL7xMVolLKk5IIcKQ8nEB3Ues/sBwKa9D2yRgGehsHTFuM6x08CQGTUJVaeEpW6HttHnb/ajMFqiUuZ6uLzgqNRbTx+gRStePpnYe/ym7Aim4ZhrxWzwZwX7f5ZPGLMxFd4wGnXbqk="; |
| | | try { |
| | | String result = new RSAEncryptor().doDecrypt(userInfo, "UTF-8", privateKeyStr); |
| | | |
| | | System.out.println(result); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.daylucky; |
| | | |
| | | import com.ks.daylucky.service.ActivityService; |
| | | import com.ks.lib.common.exception.ParamsException; |
| | | import com.ks.lucky.exception.LuckyActivityException; |
| | | import com.ks.lucky.pojo.DO.LuckyActivity; |
| | | import com.ks.lucky.remote.service.LuckyActivityService; |
| | | import org.apache.dubbo.config.annotation.Reference; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | @SpringBootTest |
| | | public class ActivityTest { |
| | | |
| | | @Resource |
| | | private ActivityService activityService; |
| | | |
| | | @Reference(version = "1.0.0") |
| | | private LuckyActivityService luckyActivityService; |
| | | |
| | | |
| | | @Test |
| | | public void add(){ |
| | | LuckyActivity luckyActivity=new LuckyActivity(); |
| | | luckyActivity.setState(LuckyActivity.STATE_NOT_PUBLISH); |
| | | // luckyActivity.set |
| | | |
| | | |
| | | try { |
| | | luckyActivityService.createActivity(luckyActivity); |
| | | } catch (ParamsException e) { |
| | | e.printStackTrace(); |
| | | } catch (LuckyActivityException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | if (bean.getVerifySuccessTime() != null) { |
| | | update.set("verifySuccessTime", bean.getVerifySuccessTime()); |
| | | } |
| | | |
| | | if (bean.getAlipayLifeAdInfo() != null) { |
| | | update.set("alipayLifeAdInfo", bean.getAlipayLifeAdInfo()); |
| | | } |
| | | |
| | | update.set("updateTime", new Date()); |
| | | update(query, update); |
| | | } |
| | |
| | | int setStateByActivityId(@Param("activityId") Long activityId, @Param("state") Integer state, @Param("stateDesc") String stateDesc, @Param("updateTime") Date updateTime); |
| | | |
| | | |
| | | List<LuckyActivityAwardResult> listUserAwardResult(@Param("appId") Long appId, @Param("uid") String uid, @Param("stateList") List<Integer> stateList, @Param("activityStateList") List<Integer> activityStateList, long start, int count); |
| | | List<LuckyActivityAwardResult> listUserAwardResult(@Param("appId") Long appId, @Param("uid") String uid, @Param("stateList") List<Integer> stateList, @Param("activityStateList") List<Integer> activityStateList,@Param("start") long start,@Param("count") int count); |
| | | |
| | | long countUserAwardResult(@Param("appId") Long appId, @Param("uid") String uid, @Param("stateList") List<Integer> stateList, @Param("activityStateList") List<Integer> activityStateList); |
| | | |
| | |
| | | package com.ks.lucky.service.impl; |
| | | |
| | | import com.ks.lucky.dao.LuckyActivityAwardMaterialDao; |
| | | import com.ks.lucky.exception.LuckyActivityAwardException; |
| | | import com.ks.lucky.mapper.LuckyActivityAwardsMapper; |
| | | import com.ks.lucky.pojo.DO.LuckyActivityAwardMaterial; |
| | |
| | | private LuckyActivityAwardsMapper luckyActivityAwardsMapper; |
| | | |
| | | @Resource |
| | | private LuckyActivityAwardMaterialManager luckyActivityAwardMaterialManager; |
| | | private LuckyActivityAwardMaterialDao luckyActivityAwardMaterialDao; |
| | | |
| | | /** |
| | | * 添加奖项 |
| | |
| | | public LuckyActivityAwards getAwardDetail(Long id) { |
| | | LuckyActivityAwards awards = luckyActivityAwardsMapper.selectByPrimaryKey(id); |
| | | if (!StringUtil.isNullOrEmpty(awards.getMaterialId())) { |
| | | LuckyActivityAwardMaterial material = luckyActivityAwardMaterialManager.getAwardMaterialDetail(awards.getMaterialId()); |
| | | LuckyActivityAwardMaterial material = luckyActivityAwardMaterialDao.get(awards.getMaterialId()); |
| | | if (material != null) { |
| | | awards.setMaterial(material); |
| | | } |
| | |
| | | public void deleteAward(Long id) { |
| | | LuckyActivityAwards awards = getAwardDetail(id); |
| | | if (awards.getMaterial() != null) { |
| | | luckyActivityAwardMaterialManager.deleteAwardMaterial(awards.getMaterial().getId()); |
| | | luckyActivityAwardMaterialDao.delete(awards.getMaterial().getId()); |
| | | } |
| | | luckyActivityAwardsMapper.deleteByPrimaryKey(id); |
| | | } |
| | |
| | | public class LuckyActivityAwardMaterialManager { |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 添加奖项物料 |
| | | * |
| | |
| | | @Validated |
| | | public void addRecord(@Valid LuckyActivityUserWeightRecord record) throws ParamsException { |
| | | |
| | | if (record.getCreateTime() != null) { |
| | | if (record.getCreateTime() == null) { |
| | | record.setCreateTime(new Date()); |
| | | } |
| | | luckyActivityUserWeightRecordMapper.insertSelective(record); |
| | |
| | | import com.ks.lucky.pojo.DTO.ActivityAssistFriend; |
| | | import com.ks.lucky.pojo.DTO.ActivityFriendAssistInfo; |
| | | import com.ks.lucky.query.ActivityJoinAssistQuery; |
| | | import com.ks.lucky.query.ActivityJoinRecordQuery; |
| | | import com.ks.lucky.remote.service.LuckyActivityJoinAssistService; |
| | | import com.ks.lucky.service.impl.LuckyActivityJoinManager; |
| | | import com.ks.lucky.service.impl.LuckyActivityUserWeightRecordManager; |
| | |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public boolean isAssisted(@NotNull Long joinId, @NotEmpty Long appId, @NotEmpty String uid, @NotNull ActivityJoinAssistEvent eventKey) { |
| | | ActivityJoinAssistQuery query = new ActivityJoinAssistQuery(); |
| | | query.joinId = joinId; |
| | | query.appId = appId; |
| | | query.uid = uid; |
| | | query.eventKey = eventKey; |
| | | return luckyActivityJoinAssistMapper.count(query) > 0; |
| | | } |
| | | |
| | | @Override |
| | | public List<LuckyActivityJoinAssist> getAssistRecordList(Long activityId, Long appId, String uid, int page, int pageSize) { |
| | | LuckyActivityJoinRecord record = luckyActivityJoinManager.getRecord(activityId, appId, uid); |
| | | if (record == null) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public LuckyActivity getActivity(Long id) { |
| | | return luckyActivityManager.selectByPrimaryKey(id); |
| | | } |
| | | |
| | | @Override |
| | | public LuckyActivity getActivityDetail(Long id) { |
| | | LuckyActivity activity = luckyActivityMapper.selectByPrimaryKey(id); |
| | | if (activity == null) { |
| | |
| | | } |
| | | activity.setSponsorInfo(sponsorInfo); |
| | | |
| | | |
| | | //加载奖项信息 |
| | | List<LuckyActivityAwards> awardsList = luckyActivityAwardManager.getAwardList(activity.getId()); |
| | | activity.setAwardsList(awardsList); |
| | | List<LuckyActivityAwards> awardsDetailList = new ArrayList<>(); |
| | | if (awardsList != null) { |
| | | for (LuckyActivityAwards awards : awardsList) { |
| | | awards = luckyActivityAwardManager.getAwardDetail(awards.getId()); |
| | | if (awards != null) { |
| | | awardsDetailList.add(awards); |
| | | } |
| | | } |
| | | } |
| | | activity.setAwardsList(awardsDetailList); |
| | | |
| | | return activity; |
| | | } |
| | |
| | | |
| | | <select id="listUserAwardResult" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | SELECT r.* FROM `lucky_activity_award_result` r LEFT JOIN `lucky_activity` a ON r.`activity_id`=a.`id` |
| | | where uid=#{uid} and app_id=#{appId} |
| | | where uid=#{uid} and r.app_id=#{appId} |
| | | |
| | | <if test="stateList!=null"> |
| | | <foreach collection="stateList" item="state" open=" and (" close=")" separator=" or "> |
| | |
| | | |
| | | <select id="countUserAwardResult" resultType="java.lang.Long"> |
| | | SELECT count(*) FROM `lucky_activity_award_result` r LEFT JOIN `lucky_activity` a ON r.`activity_id`=a.`id` |
| | | where uid=#{uid} and app_id=#{appId} |
| | | where uid=#{uid} and r.app_id=#{appId} |
| | | |
| | | <if test="stateList!=null"> |
| | | <foreach collection="stateList" item="state" open=" and (" close=")" separator=" or "> |
| | |
| | | <?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.ks.lucky.mapper.LuckyActivityAwardsMapper"> |
| | | <resultMap id="BaseResultMap" type="com.ks.lucky.pojo.DO.LuckyActivityAwards"> |
| | | <id column="id" jdbcType="BIGINT" property="id"/> |
| | | <result column="activity_id" jdbcType="BIGINT" property="activityId"/> |
| | | <result column="level" jdbcType="INTEGER" property="level"/> |
| | | <result column="count" jdbcType="INTEGER" property="count"/> |
| | | <result column="award_name" property="awardName" jdbcType="VARCHAR"/> |
| | | <result column="award_poster" property="awardPoster" jdbcType="VARCHAR"/> |
| | | <result column="award_way" jdbcType="INTEGER" property="awardWay"/> |
| | | <result column="award_params" jdbcType="VARCHAR" property="awardParams"/> |
| | | <result column="material_id" jdbcType="VARCHAR" property="materialId"/> |
| | | <result column="remarks" jdbcType="VARCHAR" property="remarks"/> |
| | | <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> |
| | | <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> |
| | | |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | id, activity_id, level, count, award_way, award_params, material_id, remarks, create_time, |
| | | update_time |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | select |
| | | <sql id="Base_Column_List">id, activity_id, level, count, award_way, award_params, material_id, remarks, create_time, update_time,award_name,award_poster</sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">select |
| | | <include refid="Base_Column_List"/> |
| | | from lucky_activity_awards |
| | | where id = #{id,jdbcType=BIGINT} |
| | | from lucky_activity_awards where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <!-- 非模板--> |
| | | |
| | | |
| | | <sql id="listWhere"> |
| | | <if test="query.activityId!=null"> |
| | | and activity_id=#{query.activityId} |
| | | </if> |
| | | |
| | | <if test="query.minCreateTime!=null"> |
| | | and create_time>=#{query.minCreateTime} |
| | | </if> |
| | | |
| | | <if test="query.maxCreateTime!=null"> |
| | | and #{query.maxCreateTime}>create_time |
| | | </if> |
| | | |
| | | <if test="query.activityId!=null">and activity_id=#{query.activityId}</if> |
| | | <if test="query.minCreateTime!=null">and create_time>=#{query.minCreateTime}</if> |
| | | <if test="query.maxCreateTime!=null">and #{query.maxCreateTime}>create_time</if> |
| | | </sql> |
| | | |
| | | |
| | | <select id="list" resultMap="BaseResultMap"> |
| | | select |
| | | <select id="list" resultMap="BaseResultMap">select |
| | | <include refid="Base_Column_List"/> |
| | | from lucky_activity_awards |
| | | where 1=1 |
| | | <include refid="listWhere"> |
| | | |
| | | </include> |
| | | |
| | | |
| | | from lucky_activity_awards where 1=1 |
| | | <include refid="listWhere"/> |
| | | <if test="query.sortList!=null"> |
| | | <foreach collection="query.sortList" item="item" separator="," open=" order by "> |
| | | #{item} |
| | | </foreach> |
| | | <foreach collection="query.sortList" item="item" separator="," open=" order by ">#{item}</foreach> |
| | | </if> |
| | | limit #{query.start},#{query.count} |
| | | </select> |
| | | |
| | | <select id="count" resultType="java.lang.Long"> |
| | | select |
| | | count(*) |
| | | from lucky_activity_awards |
| | | where 1=1 |
| | | <include refid="listWhere"> |
| | | |
| | | </include> |
| | | <select id="count" resultType="java.lang.Long">select count(*) from lucky_activity_awards where 1=1 |
| | | <include refid="listWhere"/> |
| | | </select> |
| | | |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
| | | delete from lucky_activity_awards |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" useGeneratedKeys="true" keyProperty="id" parameterType="com.ks.lucky.pojo.DO.LuckyActivityAwards"> |
| | | insert into lucky_activity_awards (id, activity_id, level, |
| | | count, award_way, award_params, |
| | | material_id, remarks, create_time, |
| | | update_time) |
| | | values (#{id,jdbcType=BIGINT}, #{activityId,jdbcType=BIGINT}, #{level,jdbcType=INTEGER}, |
| | | #{count,jdbcType=INTEGER}, #{awardWay,jdbcType=INTEGER}, #{awardParams,jdbcType=VARCHAR}, |
| | | #{materialId,jdbcType=VARCHAR}, #{remarks,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, |
| | | #{updateTime,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | <insert id="insertSelective" useGeneratedKeys="true" keyProperty="id" parameterType="com.ks.lucky.pojo.DO.LuckyActivityAwards"> |
| | | insert into lucky_activity_awards |
| | | <delete id="deleteByPrimaryKey" |
| | | parameterType="java.lang.Long">delete from lucky_activity_awards where id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" useGeneratedKeys="true" keyProperty="id" |
| | | parameterType="com.ks.lucky.pojo.DO.LuckyActivityAwards">insert into lucky_activity_awards (id, activity_id, level, count, award_way, award_params, material_id, remarks, create_time, update_time,id,award_name,award_poster) values (#{id,jdbcType=BIGINT}, #{activityId,jdbcType=BIGINT}, #{level,jdbcType=INTEGER}, #{count,jdbcType=INTEGER}, #{awardWay,jdbcType=INTEGER}, #{awardParams,jdbcType=VARCHAR}, #{materialId,jdbcType=VARCHAR}, #{remarks,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},#{id,jdbcType=BIGINT},#{awardName,jdbcType=VARCHAR},#{awardPoster,jdbcType=VARCHAR})</insert> |
| | | <insert id="insertSelective" useGeneratedKeys="true" keyProperty="id" |
| | | parameterType="com.ks.lucky.pojo.DO.LuckyActivityAwards">insert into lucky_activity_awards |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | id, |
| | | </if> |
| | | <if test="activityId != null"> |
| | | activity_id, |
| | | </if> |
| | | <if test="level != null"> |
| | | level, |
| | | </if> |
| | | <if test="count != null"> |
| | | count, |
| | | </if> |
| | | <if test="awardWay != null"> |
| | | award_way, |
| | | </if> |
| | | <if test="awardParams != null"> |
| | | award_params, |
| | | </if> |
| | | <if test="materialId != null"> |
| | | material_id, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | remarks, |
| | | </if> |
| | | <if test="createTime != null"> |
| | | create_time, |
| | | </if> |
| | | <if test="updateTime != null"> |
| | | update_time, |
| | | </if> |
| | | <if test="id != null">id,</if> |
| | | <if test="activityId != null">activity_id,</if> |
| | | <if test="level != null">level,</if> |
| | | <if test="count != null">count,</if> |
| | | <if test="awardWay != null">award_way,</if> |
| | | <if test="awardParams != null">award_params,</if> |
| | | <if test="materialId != null">material_id,</if> |
| | | <if test="remarks != null">remarks,</if> |
| | | <if test="createTime != null">create_time,</if> |
| | | <if test="updateTime != null">update_time,</if> |
| | | <if test="awardName != null">award_name,</if> |
| | | <if test="awardPoster != null">award_poster,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | #{id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="activityId != null"> |
| | | #{activityId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="level != null"> |
| | | #{level,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="count != null"> |
| | | #{count,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="awardWay != null"> |
| | | #{awardWay,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="awardParams != null"> |
| | | #{awardParams,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="materialId != null"> |
| | | #{materialId,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | #{remarks,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="createTime != null"> |
| | | #{createTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="updateTime != null"> |
| | | #{updateTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="activityId != null">#{activityId,jdbcType=BIGINT},</if> |
| | | <if test="level != null">#{level,jdbcType=INTEGER},</if> |
| | | <if test="count != null">#{count,jdbcType=INTEGER},</if> |
| | | <if test="awardWay != null">#{awardWay,jdbcType=INTEGER},</if> |
| | | <if test="awardParams != null">#{awardParams,jdbcType=VARCHAR},</if> |
| | | <if test="materialId != null">#{materialId,jdbcType=VARCHAR},</if> |
| | | <if test="remarks != null">#{remarks,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="awardName != null">#{awardName,jdbcType=VARCHAR},</if> |
| | | <if test="awardPoster != null">#{awardPoster,jdbcType=VARCHAR},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.ks.lucky.pojo.DO.LuckyActivityAwards"> |
| | | update lucky_activity_awards |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.ks.lucky.pojo.DO.LuckyActivityAwards">update |
| | | lucky_activity_awards |
| | | <set> |
| | | <if test="activityId != null"> |
| | | activity_id = #{activityId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="level != null"> |
| | | level = #{level,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="count != null"> |
| | | count = #{count,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="awardWay != null"> |
| | | award_way = #{awardWay,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="awardParams != null"> |
| | | award_params = #{awardParams,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="materialId != null"> |
| | | material_id = #{materialId,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | remarks = #{remarks,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="createTime != null"> |
| | | create_time = #{createTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="updateTime != null"> |
| | | update_time = #{updateTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="activityId != null">activity_id = #{activityId,jdbcType=BIGINT},</if> |
| | | <if test="level != null">level = #{level,jdbcType=INTEGER},</if> |
| | | <if test="count != null">count = #{count,jdbcType=INTEGER},</if> |
| | | <if test="awardWay != null">award_way = #{awardWay,jdbcType=INTEGER},</if> |
| | | <if test="awardParams != null">award_params = #{awardParams,jdbcType=VARCHAR},</if> |
| | | <if test="materialId != null">material_id = #{materialId,jdbcType=VARCHAR},</if> |
| | | <if test="remarks != null">remarks = #{remarks,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">create_time = #{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">update_time = #{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="awardName !=null">award_name =#{awardName,jdbcType=VARCHAR},</if> |
| | | <if test="awardPoster !=null">award_poster =#{awardPoster,jdbcType=VARCHAR},</if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKey" parameterType="com.ks.lucky.pojo.DO.LuckyActivityAwards"> |
| | | update lucky_activity_awards |
| | | set activity_id = #{activityId,jdbcType=BIGINT}, |
| | | level = #{level,jdbcType=INTEGER}, |
| | | count = #{count,jdbcType=INTEGER}, |
| | | award_way = #{awardWay,jdbcType=INTEGER}, |
| | | award_params = #{awardParams,jdbcType=VARCHAR}, |
| | | material_id = #{materialId,jdbcType=VARCHAR}, |
| | | remarks = #{remarks,jdbcType=VARCHAR}, |
| | | create_time = #{createTime,jdbcType=TIMESTAMP}, |
| | | update_time = #{updateTime,jdbcType=TIMESTAMP} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
| | | <update id="updateByPrimaryKey" |
| | | parameterType="com.ks.lucky.pojo.DO.LuckyActivityAwards">update lucky_activity_awards set activity_id = #{activityId,jdbcType=BIGINT}, level = #{level,jdbcType=INTEGER}, count = #{count,jdbcType=INTEGER}, award_way = #{awardWay,jdbcType=INTEGER}, award_params = #{awardParams,jdbcType=VARCHAR}, material_id = #{materialId,jdbcType=VARCHAR}, remarks = #{remarks,jdbcType=VARCHAR}, create_time = #{createTime,jdbcType=TIMESTAMP}, update_time = #{updateTime,jdbcType=TIMESTAMP} ,award_name =#{awardName,jdbcType=VARCHAR} ,award_poster =#{awardPoster,jdbcType=VARCHAR} where id = #{id,jdbcType=BIGINT}</update> |
| | | </mapper> |
| | |
| | | <if test="query.uid!=null">and uid=#{query.uid}</if> |
| | | <if test="query.drawStateList!=null"> |
| | | <foreach collection="query.drawStateList" item="state" open=" and (" close=")" separator=" or "> |
| | | and draw_state=#{state} |
| | | draw_state=#{state} |
| | | </foreach> |
| | | </if> |
| | | <if test="query.minCreateTime!=null">and create_time>=#{query.minCreateTime}</if> |
| | |
| | | <if test="query.uid!=null">and r.uid=#{query.uid}</if> |
| | | <if test="query.drawStateList!=null"> |
| | | <foreach collection="query.drawStateList" item="state" open=" and (" close=")" separator=" or "> |
| | | and draw_state=#{state} |
| | | draw_state=#{state} |
| | | </foreach> |
| | | </if> |
| | | <if test="query.minCreateTime!=null">and r.create_time>=#{query.minCreateTime}</if> |
| | |
| | | from lucky_activity_weight_record |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | |
| | | <!-- 非模板 --> |
| | | |
| | | <sql id="listWhere"> |
| | | <if test="query.appId!=null"> |
| | | and app_id=#{query.appId} |
| | | </if> |
| | | |
| | | <if test="query.uid!=null"> |
| | | and uid=#{query.uid} |
| | | </if> |
| | | |
| | | <if test="query.activityId!=null"> |
| | | and activity_id =#{query.activityId} |
| | | </if> |
| | | |
| | | <if test="query.minCreateTime!=null"> |
| | | and create_time>=#{query.minCreateTime} |
| | | </if> |
| | | |
| | | <if test="query.maxCreateTime!=null"> |
| | | and #{query.maxCreateTime}>create_time |
| | | </if> |
| | | |
| | | </sql> |
| | | |
| | | |
| | | <select id="list" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List"/> |
| | | from lucky_activity_weight_record |
| | | where 1=1 |
| | | <include refid="listWhere"> |
| | | |
| | | </include> |
| | | |
| | | |
| | | <if test="query.sortList!=null"> |
| | | <foreach collection="query.sortList" item="item" separator="," open=" order by "> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | limit #{query.start},#{query.count} |
| | | </select> |
| | | |
| | | <select id="count" resultType="java.lang.Long"> |
| | | select |
| | | count(*) |
| | | from lucky_activity_weight_record |
| | | where 1=1 |
| | | <include refid="listWhere"> |
| | | |
| | | </include> |
| | | </select> |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" > |
| | | delete from lucky_activity_weight_record |
| | | where id = #{id,jdbcType=BIGINT} |
| | |
| | | package com.ks; |
| | | |
| | | import com.ks.lucky.pojo.DO.LuckyActivity; |
| | | import com.ks.lucky.pojo.DO.LuckyActivityAwardResultExtra; |
| | | import com.ks.lucky.pojo.DO.LuckyActivityJoinAssist; |
| | | import com.ks.lucky.pojo.DO.LuckyActivityJoinRecord; |
| | | import com.ks.lucky.pojo.DO.*; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.yeshi.utils.mybatis.ColumnParseUtil; |
| | | |
| | |
| | | |
| | | @Test |
| | | public void test(){ |
| | | ColumnParseUtil.parseColumn(LuckyActivityJoinAssist.class,"D:\\workspace\\DayLucky\\service-lucky\\src\\main\\resources\\mapper\\LuckyActivityJoinAssistMapper.xml"); |
| | | ColumnParseUtil.parseColumn(LuckyActivityAwards.class,"D:\\workspace\\DayLucky\\service-lucky\\src\\main\\resources\\mapper\\LuckyActivityAwardsMapper.xml"); |
| | | } |
| | | } |
| | |
| | | import com.ks.lucky.exception.*; |
| | | import com.ks.lucky.pojo.DO.*; |
| | | import com.ks.lucky.pojo.DTO.ActivityAwardParams; |
| | | import com.ks.lucky.pojo.DTO.sponsorad.AlipayLifeAdInfo; |
| | | import com.ks.lucky.remote.service.*; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | @Test |
| | | public void updateSponsorAd() { |
| | | LuckySponsorAd ad = luckySponsorAdService.getAdDetail("1-1606811078760"); |
| | | AlipayLifeAdInfo adInfo = new AlipayLifeAdInfo(); |
| | | adInfo.setSceneId("48a5df949dd5406193dcdba81f0bb9fd"); |
| | | adInfo.setDesc("【车载香薰多选系列】大自然的味道,健康环保,持久淡香,采用调香环保配方,持久散发清新香味,有效清除难闻或残留异味,清新怡人,缓解压力,优雅别致~家里车上两用喔!"); |
| | | adInfo.setIcon("https://img.alicdn.com/imgextra/i2/3395532365/O1CN01a0o2Rf1TLDK959l53_!!3395532365.jpg_310x310.jpg"); |
| | | adInfo.setName("爆款车载香膏固体香膏70g "); |
| | | adInfo.setMustAttention(true); |
| | | ad.setAlipayLifeAdInfo(adInfo); |
| | | try { |
| | | luckySponsorAdService.updateSponsorAd(ad); |
| | | } catch (LuckySponsorAdException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | @Test |
| | | public void addAwards() { |
| | | LuckyActivityAwardMaterial material = new LuckyActivityAwardMaterial(); |
| | |
| | | @Test |
| | | public void forceStop() { |
| | | try { |
| | | luckyActivityService.forceFinishActivity(7L,"强制结束"); |
| | | luckyActivityService.forceFinishActivity(7L, "强制结束"); |
| | | } catch (LuckyActivityException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |