| | |
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.text.SimpleDateFormat;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | |
| | | import com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail.MsgTypeMoneyTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.TokenRecord;
|
| | | import com.yeshi.fanli.entity.bus.user.TokenRecord.TokenTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.redpack.RedPackDetail;
|
| | | import com.yeshi.fanli.entity.redpack.RedPackDetail.RedPackDetailTypeEnum;
|
| | | import com.yeshi.fanli.entity.redpack.RedPackGiveRecord;
|
| | |
| | | import com.yeshi.fanli.service.inter.redpack.RedPackForbidService;
|
| | | import com.yeshi.fanli.service.inter.redpack.RedPackGiveRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.TokenRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TokenUtil;
|
| | |
| | | import com.yeshi.fanli.util.factory.RedPackDetailFactory;
|
| | | import com.yeshi.fanli.util.rocketmq.MQMsgBodyFactory;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | | import com.yeshi.fanli.vo.redpack.RedPackGiveVO;
|
| | |
|
| | | @Service
|
| | | public class RedPackGiveRecordServiceImpl implements RedPackGiveRecordService {
|
| | |
| | |
|
| | | @Resource(name = "producer")
|
| | | private Producer producer;
|
| | | |
| | | @Resource
|
| | | private UserInfoService userInfoService;
|
| | |
|
| | | @Override
|
| | | public RedPackGiveRecord selectByPrimaryKey(Long id) {
|
| | |
| | | return giveRecord;
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public List<RedPackGiveVO> getGiveList(int page, int pageSzie, Long uid) {
|
| | | List<RedPackGiveVO> list = redPackGiveRecordMapper.getGiveList((page-1)*pageSzie, pageSzie, uid);
|
| | | if (list == null) {
|
| | | list = new ArrayList<RedPackGiveVO>();
|
| | | }
|
| | | |
| | | if (list.isEmpty()) {
|
| | | return list;
|
| | | }
|
| | | |
| | | String tips = redPackConfigService.getValueByKey("give_tips");
|
| | | String appLink = redPackConfigService.getValueByKey("app_down_link");
|
| | | String projectChineseName = Constant.systemCommonConfig.getProjectChineseName();
|
| | |
|
| | | for (RedPackGiveVO record: list) {
|
| | | Long receiveUid = record.getReceiveUid();
|
| | | if (receiveUid != null) {
|
| | | UserInfo userInfo = userInfoService.selectByPKey(receiveUid);
|
| | | record.setReceiveName(userInfo.getNickName());
|
| | | record.setReceivePortrait(userInfo.getPortrait());
|
| | | record.setReceiveTip("领取了你的红包");
|
| | | }
|
| | | TokenRecord token = tokenRecordService.getByTypeAndIdentify(TokenTypeEnum.redPack.name(), |
| | | record.getId().toString());
|
| | | |
| | | String desc = tips;
|
| | | while (desc.contains("{APP名称}")) {
|
| | | desc = desc.replace("{APP名称}", projectChineseName);
|
| | | }
|
| | | desc = desc.replace("{口令}", token.getToken()).replace("{下载链接}", appLink).replace("{面额}", record.getAmount().setScale(2).toString());
|
| | | record.setDesc(desc);
|
| | | }
|
| | | |
| | | return list;
|
| | | }
|
| | | |
| | | @Override
|
| | | public long countGiveList(Long uid) {
|
| | | return redPackGiveRecordMapper.countGiveList(uid);
|
| | | }
|
| | | |
| | | }
|