1 文件已重命名
36个文件已修改
3个文件已添加
| | |
| | | <orderEntry type="library" name="Maven: com.opencsv:opencsv:4.3.2" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.commons:commons-text:1.3" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.commons:commons-collections4:4.2" level="project" /> |
| | | <orderEntry type="library" name="Maven: ch.ethz.ganymed:ganymed-ssh2:build210" level="project" /> |
| | | <orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.11" level="project" /> |
| | | <orderEntry type="library" name="Maven: net.sf.ehcache:ehcache-core:2.6.11" level="project" /> |
| | | <orderEntry type="library" name="Maven: net.sf.ehcache:ehcache-web:2.0.4" level="project" /> |
| | |
| | | <orderEntry type="library" name="Maven: com.opencsv:opencsv:4.3.2" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.commons:commons-text:1.3" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.commons:commons-collections4:4.2" level="project" /> |
| | | <orderEntry type="library" name="Maven: ch.ethz.ganymed:ganymed-ssh2:build210" level="project" /> |
| | | <orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.11" level="project" /> |
| | | <orderEntry type="library" name="Maven: net.sf.ehcache:ehcache-core:2.6.11" level="project" /> |
| | | <orderEntry type="library" name="Maven: net.sf.ehcache:ehcache-web:2.0.4" level="project" /> |
| | |
| | | <orderEntry type="library" name="Maven: com.opencsv:opencsv:4.3.2" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.commons:commons-text:1.3" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.commons:commons-collections4:4.2" level="project" /> |
| | | <orderEntry type="library" name="Maven: ch.ethz.ganymed:ganymed-ssh2:build210" level="project" /> |
| | | <orderEntry type="module" module-name="facade-goods" /> |
| | | <orderEntry type="module" module-name="facede-common" /> |
| | | <orderEntry type="module-library"> |
| | |
| | | <!-- 任务执行 -->
|
| | | <id>env-pro-job</id>
|
| | | <properties>
|
| | |
|
| | | <profiles.active>env-pro-job</profiles.active>
|
| | | </properties>
|
| | | </profile>
|
| | |
| | |
|
| | | String result = null;
|
| | | try {
|
| | | result = convertLinkManager.convertLinkFromText(content, Long.parseLong(uid), share);
|
| | | result = convertLinkManager.convertLinkFromText(content, Long.parseLong(uid), share,true);
|
| | | } catch (NumberFormatException e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("用户ID转换出错"));
|
| | | }catch (Exception e) {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | @RequestMapping(value = "listTaoBaoOrderNoUpdate")
|
| | | public void listTaoBaoOrderUnUpdate(AdminAcceptData acceptData, String callback, String key, Integer pageIndex, PrintWriter out) {
|
| | |
|
| | | try {
|
| | | if (pageIndex == null || pageIndex < 0) {
|
| | | pageIndex = 1;
|
| | | }
|
| | |
|
| | | List<TaoBaoOrder> orderList = null;
|
| | | Long count = null;
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(key)) {
|
| | | orderList = taoBaoOrderService.getTaoBaoOrderByOrderId(key);
|
| | | count = (long) orderList.size();
|
| | | } else {
|
| | | orderList = taoBaoOrderService.listAllOrder(pageIndex, Constant.PAGE_SIZE);
|
| | | count = taoBaoOrderService.countAllOrder();
|
| | | }
|
| | |
|
| | | int pageSize = Constant.PAGE_SIZE;
|
| | |
|
| | | int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
|
| | |
|
| | | Gson gson = new GsonBuilder().registerTypeAdapter(Date.class, new JsonSerializer<Date>() {
|
| | | @Override
|
| | | public JsonElement serialize(Date value, Type theType, JsonSerializationContext context) {
|
| | | if (value == null) {
|
| | | return new JsonPrimitive("");
|
| | | } else {
|
| | | return new JsonPrimitive(TimeUtil.getGernalTime(value.getTime(), "yyyy-MM-dd HH:mm:ss"));
|
| | | }
|
| | | }
|
| | | }).create();
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("pe", pe);
|
| | | data.put("result_list", gson.toJson(orderList));
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | |
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("查询失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | @RequestMapping(value = "updateTaoBaoOrder")
|
| | | public void updateTaoBaoOrder(AdminAcceptData acceptData, String callback, String ids, PrintWriter out) {
|
| | | try {
|
| | |
| | | Set<String> orderIds = new HashSet<>();
|
| | |
|
| | | for (int i = 0; i < idsArray.size(); i++) {
|
| | | TaoBaoOrder taoBaoOrder = taoBaoOrderService.selectByPrimaryKey(idsArray.optLong(i));
|
| | | orderIds.add(taoBaoOrder.getOrderId());
|
| | | orderIds.add(idsArray.optString(i));
|
| | | }
|
| | |
|
| | | Long[] startTimes = new Long[orderIds.size()];
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | BusinessSystem system =getSystem(acceptData);
|
| | | BusinessSystem system = getSystem(acceptData);
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult("系统不存在"));
|
| | | return;
|
| | |
| | | out.print(JsonUtil.loadFalseResult(1, "没有绑定电话号码"));
|
| | | return;
|
| | | }
|
| | |
|
| | | String code = redisManager.getSMSVCode(user.getPhone(), SMSHistory.TYPE_LOGIN);
|
| | | if (code == null || !code.equalsIgnoreCase(vcode)) {
|
| | | out.print(JsonUtil.loadFalseResult(90001, "验证码错误"));
|
| | | return;
|
| | | if (!Constant.IS_TEST) {
|
| | | String code = redisManager.getSMSVCode(user.getPhone(), SMSHistory.TYPE_LOGIN);
|
| | | if (code == null || !code.equalsIgnoreCase(vcode)) {
|
| | | out.print(JsonUtil.loadFalseResult(90001, "验证码错误"));
|
| | | return;
|
| | | }
|
| | | }
|
| | | redisManager.clearSMSFrequencyLimit(user.getPhone(), SMSHistory.TYPE_LOGIN);
|
| | | redisManager.saveBindAlipayAccountSMSState(user.getPhone());
|
| | |
| | | try {
|
| | | String key = RedisKeyEnum.convertLinkDocResultTemp.getKey() + uid + "-"
|
| | | + StringUtil.Md5(UUID.randomUUID().toString());
|
| | | String result = convertLinkManager.convertLinkFromText(text, uid, true);
|
| | | String result = convertLinkManager.convertLinkFromText(text, uid, true,true);
|
| | | redisManager.cacheCommonString(key, result, 60);
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("id", key);
|
| | |
| | | } |
| | | |
| | | if (list.size() == 0) { |
| | | out.print(JsonUtil.loadFalseResult("该信息已下架")); |
| | | out.print(JsonUtil.loadFalseResult("操作失败")); |
| | | return; |
| | | } |
| | | |
| | |
| | | String newText = text; // 非通用券需要验证 |
| | | if (comment != null && (comment.getNeedSpin() == null || comment.getNeedSpin())) { |
| | | try { |
| | | newText = convertLinkManager.convertLinkFromText(text, uid, true); |
| | | newText = convertLinkManager.convertLinkFromText(text, uid, true,true); |
| | | } catch (ConvertLinkExceptionException e) { |
| | | if (e.getCode() != ConvertLinkExceptionException.CODE_NONE) { |
| | | out.print(JsonUtil.loadFalseResult("评论生成失败")); |
| | |
| | | String newText = text; |
| | | if (shareInfo.getNeedSpin() != null && shareInfo.getNeedSpin()) { |
| | | try { |
| | | newText = convertLinkManager.convertLinkFromText(text, uid, true); |
| | | newText = convertLinkManager.convertLinkFromText(text, uid, true,true); |
| | | } catch (ConvertLinkExceptionException e) { |
| | | if (e.getCode() != ConvertLinkExceptionException.CODE_NONE) { |
| | | out.print(JsonUtil.loadFalseResult("评论生成失败")); |
| | |
| | | String newText = text; |
| | | if (shareInfo.getNeedSpin() != null && shareInfo.getNeedSpin()) { |
| | | try { |
| | | newText = convertLinkManager.convertLinkFromText(text, uid, true); |
| | | newText = convertLinkManager.convertLinkFromText(text, uid, true,true); |
| | | } catch (ConvertLinkExceptionException e) { |
| | | if (e.getCode() != ConvertLinkExceptionException.CODE_NONE) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("评论生成失败")); |
| | |
| | | if (shareInfo.getNeedSpin() != null && shareInfo.getNeedSpin()) { |
| | | try { |
| | | String erCodeContent = ""; |
| | | newText = convertLinkManager.convertLinkFromText(text, uid, true); |
| | | newText = convertLinkManager.convertLinkFromText(text, uid, true,true); |
| | | // 获取口令 |
| | | List<String> tokenList = TaoBaoUtil.getTokenListFromTextWithKuoHao(newText); |
| | | if (tokenList != null && tokenList.size() > 0) { |
| | |
| | | String newText = text; // 非通用券需要验证 |
| | | if (comment != null && (comment.getNeedSpin() == null || comment.getNeedSpin())) { |
| | | try { |
| | | newText = convertLinkManager.convertLinkFromText(text, uid, true); |
| | | newText = convertLinkManager.convertLinkFromText(text, uid, true,true); |
| | | } catch (ConvertLinkExceptionException e) { |
| | | if (e.getCode() != ConvertLinkExceptionException.CODE_NONE) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("评论生成失败")); |
| | |
| | |
|
| | | import com.yeshi.fanli.entity.SystemEnum;
|
| | | import com.yeshi.fanli.entity.SystemFunction;
|
| | | import com.yeshi.fanli.exception.user.UserExtraTaoBaoInfoException;
|
| | | import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService;
|
| | | import com.yeshi.fanli.util.*;
|
| | | import com.yeshi.fanli.vo.taobao.TaoBaoUser;
|
| | | import org.springframework.stereotype.Controller;
|
| | |
| | |
|
| | | @Resource
|
| | | private OrderMoneyDailyCountService orderMoneyDailyCountService;
|
| | | @Resource
|
| | | private UserExtraTaoBaoInfoService userExtraTaoBaoInfoService;
|
| | |
|
| | |
|
| | | /**
|
| | |
| | | }
|
| | | return money;
|
| | | }
|
| | |
|
| | |
|
| | | @RequestMapping("getTaoBaoShareParams")
|
| | | public void getTaoBaoShareParams(AcceptData acceptData, Long uid, PrintWriter out) {
|
| | | if (uid == null) {
|
| | | out.print(JsonUtil.loadFalseResult("用户未登录"));
|
| | | return;
|
| | | }
|
| | | String relationId = userExtraTaoBaoInfoService.getRelationIdByUid(uid);
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("relationId", relationId);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | | }
|
| | |
| | | // VIP数据预览
|
| | | MoneyStatisticVO vo = null;
|
| | | String redisContent = previewInfoService.getRedisContent(uid, PreviewEnum.moneyInfo);
|
| | | //数据预览,填的假数据
|
| | | if (!StringUtil.isNullOrEmpty(redisContent)) {
|
| | | vo = new Gson().fromJson(redisContent, MoneyStatisticVO.class);
|
| | | if (vo != null) {
|
| | |
| | | }
|
| | |
|
| | | if (vo == null) {
|
| | | vo = createMoneyStatistic(uid, acceptData);
|
| | | vo = getMoneyStatisticInfo(uid, acceptData);
|
| | | }
|
| | |
|
| | | Gson gson = getGson();
|
| | | out.print(JsonUtil.loadTrueResult(gson.toJson(vo)));
|
| | | }
|
| | |
|
| | | private MoneyStatisticVO createMoneyStatistic(Long uid, AcceptData acceptData) {
|
| | | private MoneyStatisticVO getMoneyStatisticInfo(Long uid, AcceptData acceptData) {
|
| | | UserInfo user = userInfoService.getUserById(uid);
|
| | |
|
| | | MoneyStatisticVO vo = new MoneyStatisticVO();
|
New file |
| | |
| | | package com.yeshi.fanli.dto.taobao; |
| | | |
| | | import java.util.Date; |
| | | |
| | | public class TaoBaoOrderSearchFilter { |
| | | private String orderId;//订单号 |
| | | private String state;//状态 |
| | | private Date minCreateTime; |
| | | private Date maxCreateTime; |
| | | |
| | | private Date minSettleTime; |
| | | private Date maxSettleTime; |
| | | } |
| | |
| | |
|
| | | import java.math.BigDecimal;
|
| | |
|
| | | import org.springframework.data.annotation.Transient;
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | |
| | |
|
| | | @Column(name = "extraInfo")
|
| | | private String extraInfoStr;//附加信息JSON格式
|
| | | |
| | |
|
| | | @Transient
|
| | | @Expose
|
| | | private String system;//系统名称
|
| | |
|
| | | public String getSystem() {
|
| | | return system;
|
| | | }
|
| | |
|
| | | public void setSystem(String system) {
|
| | | this.system = system;
|
| | | }
|
| | |
|
| | | public ExtractOrderStatisticDTO getExtraInfo() {
|
| | | return extraInfo;
|
| | | }
|
| | |
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum; |
| | | import com.yeshi.fanli.service.inter.config.AppVersionService; |
| | | import com.yeshi.fanli.service.inter.config.ConfigService; |
| | | import com.yeshi.fanli.util.AppMarketUtil; |
| | | import com.yeshi.fanli.util.StringUtil; |
| | | import org.springframework.stereotype.Component; |
| | | import org.yeshi.utils.AppMarketUtil; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | |
| | | desc = desc.replaceFirst("\\[链接\\]", link);
|
| | | }
|
| | |
|
| | | desc = convertLinkManager.convertJDLinkFromText(desc, 0L, true);
|
| | | desc = convertLinkManager.convertJDLinkFromText(desc, 0L, true,false);
|
| | | info.setContent(desc);
|
| | |
|
| | | List<JDGoods> goodsList = JDApiUtil.queryGoodsDetail(goods.getSkuList());
|
| | |
| | | } |
| | | } else if (i == 0 && kind == 1) { |
| | | try { |
| | | convertLinkManager.convertLinkFromText(content, Constant.LINK_TOKEN_VERIFY_UID, true); |
| | | convertLinkManager.convertLinkFromText(content, Constant.LINK_TOKEN_VERIFY_UID, true,false); |
| | | } catch (Exception e) { |
| | | throw new GoodsEvaluateException(1, "不包含可转链的口令与链接"); |
| | | } |
| | |
| | | String content = commentInfo.getContent(); |
| | | if (!StringUtil.isNullOrEmpty(content) && commentInfo.getNeedSpin()) { |
| | | try { |
| | | convertLinkManager.convertLinkFromText(content, Constant.LINK_TOKEN_VERIFY_UID, true); |
| | | convertLinkManager.convertLinkFromText(content, Constant.LINK_TOKEN_VERIFY_UID, true,false); |
| | | } catch (ConvertLinkExceptionException e) { |
| | | if (ConvertLinkExceptionException.CODE_NONE != e.getCode()) { |
| | | throw new GoodsEvaluateException(1, "包含不可转链的口令与链接"); |
| | |
| | | List<String> activityIdList = convertLinkManager.getTaoBaoOfficialActivityId(content); |
| | | for (String st : activityIdList) |
| | | content = content.replace(st, ""); |
| | | |
| | | content=content.replace("{relationId}",""); |
| | | commentInfoNew.setContent(content); |
| | | } |
| | | } |
| | |
| | | List<String> activityIdList = convertLinkManager.getTaoBaoOfficialActivityId(content); |
| | | for (String st : activityIdList) |
| | | content = content.replace(st, ""); |
| | | content=content.replace("{relationId}",""); |
| | | |
| | | commentInfoNew.setContent(content); |
| | | } |
| | | |
| | |
| | | // 转链
|
| | | String convertContent = null;
|
| | | try {
|
| | | convertContent = convertLinkManager.convertLinkFromText(info.getContent(), uid, true);
|
| | | convertContent = convertLinkManager.convertLinkFromText(info.getContent(), uid, true,false);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | LogHelper.errorDetailInfo(e);
|
| | |
| | | String quanToken = "";
|
| | | if (!StringUtil.isNullOrEmpty(goods.getCouponLink())) {// 通过立即推广方式获取淘口令成功
|
| | | quanToken = convertLinkManager.createTaoBaoToken(uid, goods.getPictUrl(), goods.getTitle(),
|
| | | goods.getCouponLink());
|
| | | goods.getCouponLink(),false);
|
| | | } else if (!StringUtil.isNullOrEmpty(goods.getAuctionUrl())) {
|
| | | quanToken = convertLinkManager.createTaoBaoToken(uid, goods.getPictUrl(), goods.getTitle(),
|
| | | goods.getAuctionUrl());
|
| | | goods.getAuctionUrl(),false);
|
| | | }
|
| | | return quanToken;
|
| | | }
|
| | |
| | |
|
| | | if (record.getNeedSpin()) {
|
| | | try {
|
| | | convertLinkManager.convertLinkFromText(record.getComment(), Constant.LINK_TOKEN_VERIFY_UID, true);
|
| | | convertLinkManager.convertLinkFromText(record.getComment(), Constant.LINK_TOKEN_VERIFY_UID, true,false);
|
| | | } catch (ConvertLinkExceptionException e) {
|
| | | if (ConvertLinkExceptionException.CODE_NONE != e.getCode()) {
|
| | | throw new SpecialException(1, "包含不可转链的口令与链接");
|
| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import com.yeshi.fanli.entity.SystemEnum;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | |
| | |
|
| | | @Service
|
| | | public class BindingAccountServiceImpl implements BindingAccountService {
|
| | | @Resource
|
| | | private BindingAccountMapper bindingAccountMapper;
|
| | | @Resource
|
| | | private AlipayAccountValidNormalHistoryMapper alipayAccountValidNormalHistoryMapper;
|
| | | @Resource
|
| | | private UserInfoMapper userInfoMapper;
|
| | | @Resource
|
| | | private UserAccountBindingHistoryService userAccountBindingHistoryService;
|
| | | @Resource
|
| | | private UserMoneyDetailMapper userMoneyDetailMapper;
|
| | | @Resource
|
| | | private UserMoneyService userMoneyService;
|
| | | @Resource
|
| | | private UserMoneyMsgNotificationService userMoneyMsgNotificationService;
|
| | | @Resource
|
| | | private UserMoneyDebtService userMoneyDebtService;
|
| | | @Resource
|
| | | private BindingAccountMapper bindingAccountMapper;
|
| | | @Resource
|
| | | private AlipayAccountValidNormalHistoryMapper alipayAccountValidNormalHistoryMapper;
|
| | | @Resource
|
| | | private UserInfoMapper userInfoMapper;
|
| | | @Resource
|
| | | private UserAccountBindingHistoryService userAccountBindingHistoryService;
|
| | | @Resource
|
| | | private UserMoneyDetailMapper userMoneyDetailMapper;
|
| | | @Resource
|
| | | private UserMoneyService userMoneyService;
|
| | | @Resource
|
| | | private UserMoneyMsgNotificationService userMoneyMsgNotificationService;
|
| | | @Resource
|
| | | private UserMoneyDebtService userMoneyDebtService;
|
| | |
|
| | | public List<BindingAccount> getBindingAccountByUid(long uid) {
|
| | | return bindingAccountMapper.selectByUid(uid);
|
| | | }
|
| | | public List<BindingAccount> getBindingAccountByUid(long uid) {
|
| | | return bindingAccountMapper.selectByUid(uid);
|
| | | }
|
| | |
|
| | | public void addBindingAccount(BindingAccount addAccount) throws BindingAccountException {
|
| | | BindingAccount account = bindingAccountMapper.selectByUidAndType(addAccount.getUserInfo().getId(),
|
| | | addAccount.getType());
|
| | | public void addBindingAccount(BindingAccount addAccount) throws BindingAccountException {
|
| | | BindingAccount account = bindingAccountMapper.selectByUidAndType(addAccount.getUserInfo().getId(),
|
| | | addAccount.getType());
|
| | |
|
| | | if (account == null) {
|
| | | bindingAccountMapper.insertSelective(addAccount);
|
| | | } else {
|
| | | throw new BindingAccountException(Constant.BA_EXIST);
|
| | | }
|
| | | }
|
| | | if (account == null) {
|
| | | bindingAccountMapper.insertSelective(addAccount);
|
| | | } else {
|
| | | throw new BindingAccountException(Constant.BA_EXIST);
|
| | | }
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | public Integer deleteBindingAccount(BindingAccount account) {
|
| | | BindingAccount oldAccount = bindingAccountMapper.selectByUidAndType(account.getUserInfo().getId(),
|
| | | account.getType());
|
| | | if (oldAccount != null)
|
| | | bindingAccountMapper.deleteByPrimaryKey(oldAccount.getId());
|
| | | return 1;
|
| | | }
|
| | | @Transactional
|
| | | public Integer deleteBindingAccount(BindingAccount account) {
|
| | | BindingAccount oldAccount = bindingAccountMapper.selectByUidAndType(account.getUserInfo().getId(),
|
| | | account.getType());
|
| | | if (oldAccount != null)
|
| | | bindingAccountMapper.deleteByPrimaryKey(oldAccount.getId());
|
| | | return 1;
|
| | | }
|
| | |
|
| | | public BindingAccount getBindingAccountByUidAndType(long uid, int type) {
|
| | | BindingAccount account = bindingAccountMapper.selectByUidAndType(uid, type);
|
| | | return account;
|
| | | }
|
| | | public BindingAccount getBindingAccountByUidAndType(long uid, int type) {
|
| | | BindingAccount account = bindingAccountMapper.selectByUidAndType(uid, type);
|
| | | return account;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BindingAccount changeAlipayBinding(Long uid, String name, String account) {
|
| | | BindingAccount bindingAccount = getBindingAccountByUidAndType(uid, BindingAccount.TYPE_ALIPAY);
|
| | | if (bindingAccount == null)// 创建账号
|
| | | {
|
| | | bindingAccount = new BindingAccount();
|
| | | bindingAccount.setAccount(account);
|
| | | bindingAccount.setName(name);
|
| | | bindingAccount.setType(BindingAccount.TYPE_ALIPAY);
|
| | | bindingAccount.setUserInfo(new UserInfo(uid));
|
| | | bindingAccountMapper.insertSelective(bindingAccount);
|
| | | } else {
|
| | | bindingAccount.setName(name);
|
| | | bindingAccount.setAccount(account);
|
| | | bindingAccountMapper.updateByPrimaryKeySelective(bindingAccount);
|
| | | }
|
| | | return bindingAccount;
|
| | | }
|
| | | @Override
|
| | | public BindingAccount changeAlipayBinding(Long uid, String name, String account) {
|
| | | BindingAccount bindingAccount = getBindingAccountByUidAndType(uid, BindingAccount.TYPE_ALIPAY);
|
| | | if (bindingAccount == null)// 创建账号
|
| | | {
|
| | | bindingAccount = new BindingAccount();
|
| | | bindingAccount.setAccount(account);
|
| | | bindingAccount.setName(name);
|
| | | bindingAccount.setType(BindingAccount.TYPE_ALIPAY);
|
| | | bindingAccount.setUserInfo(new UserInfo(uid));
|
| | | bindingAccountMapper.insertSelective(bindingAccount);
|
| | | } else {
|
| | | bindingAccount.setName(name);
|
| | | bindingAccount.setAccount(account);
|
| | | bindingAccountMapper.updateByPrimaryKeySelective(bindingAccount);
|
| | | }
|
| | | return bindingAccount;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int deleteByPrimaryKey(Long id) {
|
| | | return bindingAccountMapper.deleteByPrimaryKey(id);
|
| | | }
|
| | | @Override
|
| | | public int deleteByPrimaryKey(Long id) {
|
| | | return bindingAccountMapper.deleteByPrimaryKey(id);
|
| | | }
|
| | |
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | | @Override
|
| | | public void validAlipayAccount(Long uid, String account, String name)
|
| | | throws AlipayTransferException, AlipayApiException, AlipayAccountException {
|
| | | if (uid == null)
|
| | | throw new AlipayAccountException(AlipayAccountException.CODE_NO_PARAMS, "用户ID不能为空");
|
| | | if (StringUtil.isNullOrEmpty(account))
|
| | | throw new AlipayAccountException(AlipayAccountException.CODE_NO_PARAMS, "账号不能为空");
|
| | | if (StringUtil.isNullOrEmpty(name))
|
| | | throw new AlipayAccountException(AlipayAccountException.CODE_NO_PARAMS, "真实姓名不能为空");
|
| | | //
|
| | | List<BindingAccount> bindingAccountList = bindingAccountMapper.selectByAccount(account);
|
| | | if (bindingAccountList != null && bindingAccountList.size() > 0) {
|
| | | if (bindingAccountList.get(0).getUserInfo().getId().longValue() != uid)
|
| | | throw new AlipayAccountException(AlipayAccountException.CODE_ALREADY_BIND,
|
| | | "该支付宝账号已被其他账号绑定,请更换其他的支付宝账号来绑定");
|
| | | }
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | @Override
|
| | | public void validAlipayAccount(Long uid, String account, String name)
|
| | | throws AlipayTransferException, AlipayApiException, AlipayAccountException {
|
| | | if (uid == null)
|
| | | throw new AlipayAccountException(AlipayAccountException.CODE_NO_PARAMS, "用户ID不能为空");
|
| | | if (StringUtil.isNullOrEmpty(account))
|
| | | throw new AlipayAccountException(AlipayAccountException.CODE_NO_PARAMS, "账号不能为空");
|
| | | if (StringUtil.isNullOrEmpty(name))
|
| | | throw new AlipayAccountException(AlipayAccountException.CODE_NO_PARAMS, "真实姓名不能为空");
|
| | |
|
| | | AlipayAccountValidNormalHistory latest = alipayAccountValidNormalHistoryMapper.selectLatestByUid(uid);
|
| | | if (latest != null) {
|
| | | Calendar caLatest = Calendar.getInstance();
|
| | | caLatest.setTimeInMillis(latest.getCreateTime().getTime());
|
| | | Calendar nowLatest = Calendar.getInstance();
|
| | | if (caLatest.get(Calendar.MONTH) == nowLatest.get(Calendar.MONTH))// 上次更改和现在是同一个月
|
| | | throw new AlipayAccountException(AlipayAccountException.CODE_TIMES_LIMIT, "每月只能更换绑定一次支付宝账号,请次月再试。");
|
| | | }
|
| | | List<BindingAccount> bindingAccountList = bindingAccountMapper.selectByAccount(account);
|
| | |
|
| | | UserInfo userInfo = userInfoMapper.selectByPrimaryKeyForUpdate(uid);
|
| | | if (userInfo.getMyHongBao().compareTo(new BigDecimal("0")) <= 0)
|
| | | throw new AlipayAccountException(AlipayAccountException.CODE_NO_MONEY, "你的账户无余额,无需绑定提现帐号。");
|
| | | if (bindingAccountList != null && bindingAccountList.size() > 0) {
|
| | | UserInfo user = userInfoMapper.selectByPrimaryKey(uid);
|
| | | SystemEnum systemEnum = user.getSystem();
|
| | |
|
| | | // 需要转账验证
|
| | | BigDecimal money = new BigDecimal("0.1");
|
| | | transferAlipayWithVerify(account, name);
|
| | | for (int i = 0; i < bindingAccountList.size(); i++) {
|
| | | UserInfo u = userInfoMapper.selectByPrimaryKey(bindingAccountList.get(i).getUserInfo().getId());
|
| | | //同一系统下绑定账号不能重复
|
| | | if (u.getSystem() == systemEnum && bindingAccountList.get(i).getUserInfo().getId().longValue() != uid) {
|
| | | throw new AlipayAccountException(AlipayAccountException.CODE_ALREADY_BIND,
|
| | | "该支付宝账号已被其他账号绑定,请更换其他的支付宝账号来绑定");
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | // 转账成功
|
| | | // 插入转账成功表
|
| | | AlipayAccountValidNormalHistory history = new AlipayAccountValidNormalHistory();
|
| | | history.setAccount(account);
|
| | | history.setCreateTime(new Date());
|
| | | history.setName(name);
|
| | | history.setUid(uid);
|
| | | alipayAccountValidNormalHistoryMapper.insertSelective(history);
|
| | | UserMoneyDetail userMoneyDetail = null;
|
| | | // 新版资金
|
| | | try {
|
| | | userMoneyDetail = UserMoneyDetailFactory.createExtractAccountValid(history, money);
|
| | | } catch (UserMoneyDetailException e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | | AlipayAccountValidNormalHistory latest = alipayAccountValidNormalHistoryMapper.selectLatestByUid(uid);
|
| | | if (latest != null) {
|
| | | Calendar caLatest = Calendar.getInstance();
|
| | | caLatest.setTimeInMillis(latest.getCreateTime().getTime());
|
| | | Calendar nowLatest = Calendar.getInstance();
|
| | | if (caLatest.get(Calendar.MONTH) == nowLatest.get(Calendar.MONTH))// 上次更改和现在是同一个月
|
| | | throw new AlipayAccountException(AlipayAccountException.CODE_TIMES_LIMIT, "每月只能更换绑定一次支付宝账号,请次月再试。");
|
| | | }
|
| | |
|
| | | // 余额充足
|
| | | if (userInfo.getMyHongBao().compareTo(money) >= 0) {
|
| | | // 扣款
|
| | | userMoneyService.subUserMoney(uid, money, userMoneyDetail);
|
| | | userMoneyMsgNotificationService.alipayAccountValid(history,"1个月",latest!=null);
|
| | | } else {// 余额不足,暂时不扣款,加入借贷关系
|
| | | UserMoneyDebt debt = new UserMoneyDebt();
|
| | | debt.setCreateTime(new Date());
|
| | | debt.setLeftMoney(money);
|
| | | debt.setOriginMoney(money);
|
| | | debt.setSourceId(history.getId());
|
| | | debt.setType(UserMoneyDebtTypeEnum.extractVerify);
|
| | | debt.setUid(uid);
|
| | | try {
|
| | | userMoneyDebtService.addUserMoneyDebt(debt);
|
| | | } catch (UserMoneyDebtException e) {
|
| | | LogHelper.errorDetailInfo(e, "验证ID:" + history.getId(), "");
|
| | | }
|
| | | UserInfo userInfo = userInfoMapper.selectByPrimaryKeyForUpdate(uid);
|
| | | if (userInfo.getMyHongBao().compareTo(new BigDecimal("0")) <= 0)
|
| | | throw new AlipayAccountException(AlipayAccountException.CODE_NO_MONEY, "你的账户无余额,无需绑定提现帐号。");
|
| | |
|
| | | }
|
| | | // 需要转账验证
|
| | | BigDecimal money = new BigDecimal("0.1");
|
| | | transferAlipayWithVerify(account, name);
|
| | |
|
| | | }
|
| | | // 转账成功
|
| | | // 插入转账成功表
|
| | | AlipayAccountValidNormalHistory history = new AlipayAccountValidNormalHistory();
|
| | | history.setAccount(account);
|
| | | history.setCreateTime(new Date());
|
| | | history.setName(name);
|
| | | history.setUid(uid);
|
| | | alipayAccountValidNormalHistoryMapper.insertSelective(history);
|
| | | UserMoneyDetail userMoneyDetail = null;
|
| | | // 新版资金
|
| | | try {
|
| | | userMoneyDetail = UserMoneyDetailFactory.createExtractAccountValid(history, money);
|
| | | } catch (UserMoneyDetailException e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | private void transferAlipayWithVerify(String account, String name)
|
| | | throws AlipayTransferException, AlipayApiException {
|
| | | String outBizNo=StringUtil.Md5(account)+TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyyMMdd");
|
| | | String appName = Constant.systemCommonConfig.getProjectChineseName();
|
| | | AlipayUtil.transfer(outBizNo, account, name, new BigDecimal("0.1"), appName + "支付宝验证", "来自" + appName + "的支付宝验证打款");
|
| | | }
|
| | | // 余额充足
|
| | | if (userInfo.getMyHongBao().compareTo(money) >= 0) {
|
| | | // 扣款
|
| | | userMoneyService.subUserMoney(uid, money, userMoneyDetail);
|
| | | userMoneyMsgNotificationService.alipayAccountValid(history, "1个月", latest != null);
|
| | | } else {// 余额不足,暂时不扣款,加入借贷关系
|
| | | UserMoneyDebt debt = new UserMoneyDebt();
|
| | | debt.setCreateTime(new Date());
|
| | | debt.setLeftMoney(money);
|
| | | debt.setOriginMoney(money);
|
| | | debt.setSourceId(history.getId());
|
| | | debt.setType(UserMoneyDebtTypeEnum.extractVerify);
|
| | | debt.setUid(uid);
|
| | | try {
|
| | | userMoneyDebtService.addUserMoneyDebt(debt);
|
| | | } catch (UserMoneyDebtException e) {
|
| | | LogHelper.errorDetailInfo(e, "验证ID:" + history.getId(), "");
|
| | | }
|
| | |
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | | @Override
|
| | | public BindingAccount changeAlipayBindingWithVerify(Long uid, String name, String account)
|
| | | throws AlipayTransferException, AlipayApiException, AlipayAccountException {
|
| | | BindingAccount bindingAccount = bindingAccountMapper.selectByUidAndType(uid, BindingAccount.TYPE_ALIPAY);
|
| | | if (bindingAccount != null) {
|
| | | // 验证是否7天内更换了手机号
|
| | | UserAccountBindingHistory history = userAccountBindingHistoryService.getLatestHistory(uid,
|
| | | UserAccountBindingHistory.TYPE_PHONE);
|
| | | // 手机号更换绑定的7天内不能提现
|
| | | if (history != null && !history.getFirst()
|
| | | && (System.currentTimeMillis() - history.getCreateTime().getTime()) < 1000 * 60 * 60 * 24 * 7L) {
|
| | | throw new AlipayAccountException(111, "修改手机号后,7天内无法更换提现账号");
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | try {
|
| | | validAlipayAccount(uid, account, name);
|
| | | } catch (AlipayTransferException e1) {
|
| | | throw new AlipayTransferException(e1.getCode(), e1.getSubCode(), e1.getMsg());
|
| | | } catch (AlipayApiException e1) {
|
| | | throw new AlipayApiException(e1.getErrCode(), e1.getErrMsg());
|
| | | } catch (AlipayAccountException e1) {
|
| | | throw new AlipayAccountException(e1.getCode(), e1.getMsg());
|
| | | }
|
| | | }
|
| | |
|
| | | if (bindingAccount == null)// 创建账号
|
| | | {
|
| | | bindingAccount = new BindingAccount();
|
| | | bindingAccount.setAccount(account);
|
| | | bindingAccount.setName(name);
|
| | | bindingAccount.setType(BindingAccount.TYPE_ALIPAY);
|
| | | bindingAccount.setUserInfo(new UserInfo(uid));
|
| | | bindingAccountMapper.insertSelective(bindingAccount);
|
| | | } else {
|
| | | BindingAccount updateBindingAccount = new BindingAccount();
|
| | | updateBindingAccount.setId(bindingAccount.getId());
|
| | | updateBindingAccount.setName(name);
|
| | | updateBindingAccount.setAccount(account);
|
| | | bindingAccountMapper.updateByPrimaryKeySelective(updateBindingAccount);
|
| | | bindingAccount.setName(updateBindingAccount.getName());
|
| | | bindingAccount.setAccount(updateBindingAccount.getAccount());
|
| | | }
|
| | | private void transferAlipayWithVerify(String account, String name)
|
| | | throws AlipayTransferException, AlipayApiException {
|
| | | String outBizNo = StringUtil.Md5(account) + TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyyMMdd");
|
| | | String appName = Constant.systemCommonConfig.getProjectChineseName();
|
| | | AlipayUtil.transfer(outBizNo, account, name, new BigDecimal("0.1"), appName + "支付宝验证", "来自" + appName + "的支付宝验证打款");
|
| | | }
|
| | |
|
| | | return bindingAccount;
|
| | | }
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | @Override
|
| | | public BindingAccount changeAlipayBindingWithVerify(Long uid, String name, String account)
|
| | | throws AlipayTransferException, AlipayApiException, AlipayAccountException {
|
| | | BindingAccount bindingAccount = bindingAccountMapper.selectByUidAndType(uid, BindingAccount.TYPE_ALIPAY);
|
| | | if (bindingAccount != null) {
|
| | | // 验证是否7天内更换了手机号
|
| | | UserAccountBindingHistory history = userAccountBindingHistoryService.getLatestHistory(uid,
|
| | | UserAccountBindingHistory.TYPE_PHONE);
|
| | | // 手机号更换绑定的7天内不能提现
|
| | | if (history != null && !history.getFirst()
|
| | | && (System.currentTimeMillis() - history.getCreateTime().getTime()) < 1000 * 60 * 60 * 24 * 7L) {
|
| | | throw new AlipayAccountException(111, "修改手机号后,7天内无法更换提现账号");
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public boolean canVerifyAlipayAccount(Long uid) throws BindingAccountException {
|
| | | UserInfo userInfo = userInfoMapper.selectByPrimaryKeyForUpdate(uid);
|
| | | if (userInfo.getMyHongBao().compareTo(new BigDecimal("0")) <= 0) {
|
| | | BindingAccount bindingAccount = bindingAccountMapper.selectByUidAndType(uid, BindingAccount.TYPE_ALIPAY);
|
| | | if (bindingAccount != null)
|
| | | throw new BindingAccountException(1, "当前账户没有余额,无需修改,请有余额后修改。");
|
| | | else
|
| | | throw new BindingAccountException(1, "当前账户没有余额,请有余额后绑定。");
|
| | | }
|
| | | AlipayAccountValidNormalHistory latest = alipayAccountValidNormalHistoryMapper.selectLatestByUid(uid);
|
| | | if (latest != null) {
|
| | | if (TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM")
|
| | | .equalsIgnoreCase(TimeUtil.getGernalTime(latest.getCreateTime().getTime(), "yyyy-MM")))// 上次更改和现在是同一年同一个月
|
| | | throw new BindingAccountException(2, "每月仅可修改1次提现账号,请下月再试吧。");
|
| | | }
|
| | | return true;
|
| | | }
|
| | | try {
|
| | | validAlipayAccount(uid, account, name);
|
| | | } catch (AlipayTransferException e1) {
|
| | | throw new AlipayTransferException(e1.getCode(), e1.getSubCode(), e1.getMsg());
|
| | | } catch (AlipayApiException e1) {
|
| | | throw new AlipayApiException(e1.getErrCode(), e1.getErrMsg());
|
| | | } catch (AlipayAccountException e1) {
|
| | | throw new AlipayAccountException(e1.getCode(), e1.getMsg());
|
| | | }
|
| | |
|
| | | if (bindingAccount == null)// 创建账号
|
| | | {
|
| | | bindingAccount = new BindingAccount();
|
| | | bindingAccount.setAccount(account);
|
| | | bindingAccount.setName(name);
|
| | | bindingAccount.setType(BindingAccount.TYPE_ALIPAY);
|
| | | bindingAccount.setUserInfo(new UserInfo(uid));
|
| | | bindingAccountMapper.insertSelective(bindingAccount);
|
| | | } else {
|
| | | BindingAccount updateBindingAccount = new BindingAccount();
|
| | | updateBindingAccount.setId(bindingAccount.getId());
|
| | | updateBindingAccount.setName(name);
|
| | | updateBindingAccount.setAccount(account);
|
| | | bindingAccountMapper.updateByPrimaryKeySelective(updateBindingAccount);
|
| | | bindingAccount.setName(updateBindingAccount.getName());
|
| | | bindingAccount.setAccount(updateBindingAccount.getAccount());
|
| | | }
|
| | |
|
| | | return bindingAccount;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public boolean canVerifyAlipayAccount(Long uid) throws BindingAccountException {
|
| | | UserInfo userInfo = userInfoMapper.selectByPrimaryKeyForUpdate(uid);
|
| | | if (userInfo.getMyHongBao().compareTo(new BigDecimal("0")) <= 0) {
|
| | | BindingAccount bindingAccount = bindingAccountMapper.selectByUidAndType(uid, BindingAccount.TYPE_ALIPAY);
|
| | | if (bindingAccount != null)
|
| | | throw new BindingAccountException(1, "当前账户没有余额,无需修改,请有余额后修改。");
|
| | | else
|
| | | throw new BindingAccountException(1, "当前账户没有余额,请有余额后绑定。");
|
| | | }
|
| | | AlipayAccountValidNormalHistory latest = alipayAccountValidNormalHistoryMapper.selectLatestByUid(uid);
|
| | | if (latest != null) {
|
| | | if (TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM")
|
| | | .equalsIgnoreCase(TimeUtil.getGernalTime(latest.getCreateTime().getTime(), "yyyy-MM")))// 上次更改和现在是同一年同一个月
|
| | | throw new BindingAccountException(2, "每月仅可修改1次提现账号,请下月再试吧。");
|
| | | }
|
| | | return true;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import com.yeshi.fanli.entity.SystemEnum;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | |
| | | @Service
|
| | | public class ExtractAuditRecordServiceImpl implements ExtractAuditRecordService {
|
| | |
|
| | | @Resource
|
| | | private ExtractAuditRecordMapper extractAuditRecordMapper;
|
| | | |
| | | @Resource
|
| | | private CountUserInfoDao countUserInfoDao;
|
| | | @Resource
|
| | | private ExtractAuditRecordMapper extractAuditRecordMapper;
|
| | |
|
| | | @Override
|
| | | public List<ExtractAuditRecord> getList(int pageIndex, int pageSize, String key, String startTime, String endTime) {
|
| | | return extractAuditRecordMapper.getList((pageIndex - 1) * pageSize, pageSize, key, startTime, endTime);
|
| | | }
|
| | | @Resource
|
| | | private UserInfoService userInfoService;
|
| | |
|
| | | @Override
|
| | | public int getCount(String key, String startTime, String endTime) {
|
| | | return extractAuditRecordMapper.getCount(key, startTime, endTime);
|
| | | }
|
| | | @Override
|
| | | public List<ExtractAuditRecord> getList(int pageIndex, int pageSize, String key, String startTime, String endTime) {
|
| | | return extractAuditRecordMapper.getList((pageIndex - 1) * pageSize, pageSize, key, startTime, endTime);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<ExtractAuditRecord> getMyAuditedAllList(int pageIndex, int pageSize, String key, Integer state,
|
| | | Long adminId) {
|
| | | return extractAuditRecordMapper.getMyAuditedAllList((pageIndex - 1) * pageSize, pageSize, key, state, adminId);
|
| | | }
|
| | | @Override
|
| | | public int getCount(String key, String startTime, String endTime) {
|
| | | return extractAuditRecordMapper.getCount(key, startTime, endTime);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int getMyAuditedAllCount(String key, Integer state, Long adminId) {
|
| | | return extractAuditRecordMapper.getMyAuditedAllCount(key, state, adminId);
|
| | | }
|
| | | @Override
|
| | | public List<ExtractAuditRecord> getMyAuditedAllList(int pageIndex, int pageSize, String key, Integer state,
|
| | | Long adminId) {
|
| | | return extractAuditRecordMapper.getMyAuditedAllList((pageIndex - 1) * pageSize, pageSize, key, state, adminId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<ExtractAuditRecord> getMyAuditedTimeSlotList(int pageIndex, int pageSize, String key, Integer state,
|
| | | Long adminId, Integer days) {
|
| | | List<ExtractAuditRecord> list = extractAuditRecordMapper.getMyAuditedTimeSlotList((pageIndex - 1) * pageSize,
|
| | | pageSize, key, state, adminId, days);
|
| | | Gson gson = new Gson();
|
| | | if (list != null)
|
| | | for (ExtractAuditRecord record : list) {
|
| | | if (!StringUtil.isNullOrEmpty(record.getExtraInfoStr())) {
|
| | | record.setExtraInfo(gson.fromJson(record.getExtraInfoStr(), ExtractOrderStatisticDTO.class));
|
| | | }
|
| | | }
|
| | | return list;
|
| | | }
|
| | | @Override
|
| | | public int getMyAuditedAllCount(String key, Integer state, Long adminId) {
|
| | | return extractAuditRecordMapper.getMyAuditedAllCount(key, state, adminId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int getMyAuditedTimeSlotCount(String key, Integer state, Long adminId, Integer days) {
|
| | | return extractAuditRecordMapper.getMyAuditedTimeSlotCount(key, state, adminId, days);
|
| | | }
|
| | | @Override
|
| | | public List<ExtractAuditRecord> getMyAuditedTimeSlotList(int pageIndex, int pageSize, String key, Integer state,
|
| | | Long adminId, Integer days) {
|
| | | List<ExtractAuditRecord> list = extractAuditRecordMapper.getMyAuditedTimeSlotList((pageIndex - 1) * pageSize,
|
| | | pageSize, key, state, adminId, days);
|
| | | Gson gson = new Gson();
|
| | | if (list != null)
|
| | | for (ExtractAuditRecord record : list) {
|
| | | if (!StringUtil.isNullOrEmpty(record.getExtraInfoStr())) {
|
| | | record.setExtraInfo(gson.fromJson(record.getExtraInfoStr(), ExtractOrderStatisticDTO.class));
|
| | | SystemEnum system = userInfoService.getUserSystem(record.getExtract().getUserInfo().getId());
|
| | | record.setSystem(system.getName());
|
| | | }
|
| | | }
|
| | | return list;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int getMyAuditedCountWeek(Long adminId) {
|
| | | return extractAuditRecordMapper.getMyAuditedCountWeek(adminId);
|
| | | }
|
| | | @Override
|
| | | public int getMyAuditedTimeSlotCount(String key, Integer state, Long adminId, Integer days) {
|
| | | return extractAuditRecordMapper.getMyAuditedTimeSlotCount(key, state, adminId, days);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int getMyAuditedCountMonth(Long adminId) {
|
| | | return extractAuditRecordMapper.getMyAuditedCountMonth(adminId);
|
| | | }
|
| | | @Override
|
| | | public int getMyAuditedCountWeek(Long adminId) {
|
| | | return extractAuditRecordMapper.getMyAuditedCountWeek(adminId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int getMyAuditedCountToday(Long adminId) {
|
| | | return extractAuditRecordMapper.getMyAuditedCountToday(adminId);
|
| | | }
|
| | | @Override
|
| | | public int getMyAuditedCountMonth(Long adminId) {
|
| | | return extractAuditRecordMapper.getMyAuditedCountMonth(adminId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<ExtractAuditRecord> getByUidList(int pageIndex, int pageSize, Long uid) {
|
| | | List<ExtractAuditRecord> list = extractAuditRecordMapper.getByUidList((pageIndex - 1) * pageSize, pageSize, uid);
|
| | | |
| | | Gson gson = new Gson();
|
| | | if (list != null)
|
| | | for (ExtractAuditRecord record : list) {
|
| | | if (!StringUtil.isNullOrEmpty(record.getExtraInfoStr())) {
|
| | | record.setExtraInfo(gson.fromJson(record.getExtraInfoStr(), ExtractOrderStatisticDTO.class));
|
| | | }
|
| | | }
|
| | | return list;
|
| | | }
|
| | | @Override
|
| | | public int getMyAuditedCountToday(Long adminId) {
|
| | | return extractAuditRecordMapper.getMyAuditedCountToday(adminId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int getByUidCount(Long key) {
|
| | | return extractAuditRecordMapper.getByUidCount(key);
|
| | | }
|
| | | @Override
|
| | | public List<ExtractAuditRecord> getByUidList(int pageIndex, int pageSize, Long uid) {
|
| | | List<ExtractAuditRecord> list = extractAuditRecordMapper.getByUidList((pageIndex - 1) * pageSize, pageSize, uid);
|
| | |
|
| | | @Override
|
| | | public List<ExtractAuditRecord> getListbyExtractId(Long extractId) {
|
| | | return extractAuditRecordMapper.getListbyExtractId(extractId);
|
| | | }
|
| | | Gson gson = new Gson();
|
| | | if (list != null)
|
| | | for (ExtractAuditRecord record : list) {
|
| | | if (!StringUtil.isNullOrEmpty(record.getExtraInfoStr())) {
|
| | | record.setExtraInfo(gson.fromJson(record.getExtraInfoStr(), ExtractOrderStatisticDTO.class));
|
| | | }
|
| | | }
|
| | | return list;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<ExtractAuditRecord> getbyExtractId(Long extractId) {
|
| | | return extractAuditRecordMapper.getbyExtractId(extractId);
|
| | | }
|
| | | @Override
|
| | | public int getByUidCount(Long key) {
|
| | | return extractAuditRecordMapper.getByUidCount(key);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public Long countAuditNumberByDay(int state, String preDay) {
|
| | | return extractAuditRecordMapper.countAuditTotal(state, preDay);
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public BigDecimal countApplyMoneyByDay(String preDay) {
|
| | | return extractAuditRecordMapper.countApplyExtractMoney(preDay);
|
| | | }
|
| | | |
| | | @Override
|
| | | public Long countApplyNumberByDay(String preDay) {
|
| | | return extractAuditRecordMapper.countApplyNumberByDay(preDay);
|
| | | }
|
| | | |
| | | @Override
|
| | | public List<ExtractAuditRecord> getListbyExtractId(Long extractId) {
|
| | | return extractAuditRecordMapper.getListbyExtractId(extractId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<ExtractAuditRecord> getbyExtractId(Long extractId) {
|
| | | return extractAuditRecordMapper.getbyExtractId(extractId);
|
| | | }
|
| | |
|
| | |
|
| | | @Override
|
| | | public Long countAuditNumberByDay(int state, String preDay) {
|
| | | return extractAuditRecordMapper.countAuditTotal(state, preDay);
|
| | | }
|
| | |
|
| | |
|
| | | @Override
|
| | | public BigDecimal countApplyMoneyByDay(String preDay) {
|
| | | return extractAuditRecordMapper.countApplyExtractMoney(preDay);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public Long countApplyNumberByDay(String preDay) {
|
| | | return extractAuditRecordMapper.countApplyNumberByDay(preDay);
|
| | | }
|
| | |
|
| | |
|
| | | }
|
| | |
| | | @Service
|
| | | public class SMSServiceImpl implements SMSService {
|
| | |
|
| | | @Resource
|
| | | private SMSHistoryMapper smsHistoryMapper;
|
| | | @Resource
|
| | | private SMSHistoryMapper smsHistoryMapper;
|
| | |
|
| | | @Resource
|
| | | private RedisManager redisManager;
|
| | | @Resource
|
| | | private RedisManager redisManager;
|
| | |
|
| | | @Override
|
| | | public String sendLoginVCode(SystemEnum system, String phone, int codeLength) throws SMSException {
|
| | | boolean limit = redisManager.isSmsFrequencyLimit(phone, SMSHistory.TYPE_LOGIN);
|
| | | if (limit)
|
| | | throw new SMSException(1001, "请过60秒再试");
|
| | | @Override
|
| | | public String sendLoginVCode(SystemEnum system, String phone, int codeLength) throws SMSException {
|
| | | boolean limit = redisManager.isSmsFrequencyLimit(phone, SMSHistory.TYPE_LOGIN);
|
| | | if (limit)
|
| | | throw new SMSException(1001, "请过60秒再试");
|
| | |
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.emptyKey, StringUtil.Md5("sms-login-tencent-latest-" + phone));
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.emptyKey, StringUtil.Md5("sms-login-tencent-latest-" + phone));
|
| | |
|
| | | String msgCode = StringUtil.getVerifyCode(codeLength);
|
| | | // 验证码模板
|
| | | String msg = Constant.smsConfig.getSmsLogin().replace("[签名]", system.getSmsAlias()).replace("[验证码]",
|
| | | msgCode);
|
| | | // 发送短信
|
| | | // 发送间隔2分钟内的采用阿里云短信发送
|
| | | String cacheString = redisManager.getCommonString(key);
|
| | | if (StringUtil.isNullOrEmpty(cacheString) || Integer.parseInt(cacheString) < 2) {
|
| | | TencentSMSUtil.sendSingleMsg(phone, msg);
|
| | | redisManager.increase(key);
|
| | | redisManager.expire(key, 120);
|
| | | } else {
|
| | | redisManager.removeCommonString(key);
|
| | | // 发送阿里云短信
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("code", msgCode);
|
| | | AliyunSMSUtil.sendSingleMsg(phone, Constant.smsConfig.getAliyunLoginTemplatecode(), data.toString());
|
| | | }
|
| | | // 缓存
|
| | | redisManager.sendSms(phone, SMSHistory.TYPE_LOGIN);
|
| | | redisManager.saveSMSVCode(phone, SMSHistory.TYPE_LOGIN, msgCode);
|
| | | String msgCode = StringUtil.getVerifyCode(codeLength);
|
| | |
|
| | | SMSHistory smsHistory = new SMSHistory();
|
| | | smsHistory.setContent(msg);
|
| | | smsHistory.setCreateTime(new Date());
|
| | | smsHistory.setPhone(phone);
|
| | | smsHistory.setType(SMSHistory.TYPE_LOGIN);
|
| | | smsHistoryMapper.insertSelective(smsHistory);
|
| | | return msgCode;
|
| | | }
|
| | | // 验证码模板
|
| | | String msg = Constant.smsConfig.getSmsLogin().replace("[签名]", system.getSmsAlias()).replace("[验证码]",
|
| | | msgCode);
|
| | | if (Constant.IS_TEST)
|
| | | System.out.println(msg);
|
| | | // 发送短信
|
| | | // 发送间隔2分钟内的采用阿里云短信发送
|
| | | String cacheString = redisManager.getCommonString(key);
|
| | | if (StringUtil.isNullOrEmpty(cacheString) || Integer.parseInt(cacheString) < 2) {
|
| | | TencentSMSUtil.sendSingleMsg(phone, msg);
|
| | | redisManager.increase(key);
|
| | | redisManager.expire(key, 120);
|
| | | } else {
|
| | | redisManager.removeCommonString(key);
|
| | | // 发送阿里云短信
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("code", msgCode);
|
| | | AliyunSMSUtil.sendSingleMsg(phone, Constant.smsConfig.getAliyunLoginTemplatecode(), data.toString());
|
| | | }
|
| | | // 缓存
|
| | | redisManager.sendSms(phone, SMSHistory.TYPE_LOGIN);
|
| | | redisManager.saveSMSVCode(phone, SMSHistory.TYPE_LOGIN, msgCode);
|
| | |
|
| | | @Override
|
| | | public void sendBindVCode(SystemEnum system,String phone, int codeLength) throws SMSException {
|
| | | boolean limit = redisManager.isSmsFrequencyLimit(phone, SMSHistory.TYPE_BIND);
|
| | | if (limit)
|
| | | throw new SMSException(1001, "请过60秒再试");
|
| | | String msgCode = StringUtil.getVerifyCode(codeLength);
|
| | | SMSHistory smsHistory = new SMSHistory();
|
| | | smsHistory.setContent(msg);
|
| | | smsHistory.setCreateTime(new Date());
|
| | | smsHistory.setPhone(phone);
|
| | | smsHistory.setType(SMSHistory.TYPE_LOGIN);
|
| | | smsHistoryMapper.insertSelective(smsHistory);
|
| | | return msgCode;
|
| | | }
|
| | |
|
| | | // 验证码模板
|
| | | String msg = Constant.smsConfig.getSmsBind().replace("[签名]", system.getSmsAlias()).replace("[验证码]",
|
| | | msgCode);
|
| | | // 发送短信
|
| | | TencentSMSUtil.sendSingleMsg(phone, msg);
|
| | | @Override
|
| | | public void sendBindVCode(SystemEnum system, String phone, int codeLength) throws SMSException {
|
| | | boolean limit = redisManager.isSmsFrequencyLimit(phone, SMSHistory.TYPE_BIND);
|
| | | if (limit)
|
| | | throw new SMSException(1001, "请过60秒再试");
|
| | | String msgCode = StringUtil.getVerifyCode(codeLength);
|
| | |
|
| | | // 缓存
|
| | | redisManager.sendSms(phone, SMSHistory.TYPE_BIND);
|
| | | redisManager.saveSMSVCode(phone, SMSHistory.TYPE_BIND, msgCode);
|
| | | // 验证码模板
|
| | | String msg = Constant.smsConfig.getSmsBind().replace("[签名]", system.getSmsAlias()).replace("[验证码]",
|
| | | msgCode);
|
| | | // 发送短信
|
| | | TencentSMSUtil.sendSingleMsg(phone, msg);
|
| | |
|
| | | SMSHistory smsHistory = new SMSHistory();
|
| | | smsHistory.setContent(msg);
|
| | | smsHistory.setCreateTime(new Date());
|
| | | smsHistory.setPhone(phone);
|
| | | smsHistory.setType(SMSHistory.TYPE_BIND);
|
| | | smsHistoryMapper.insertSelective(smsHistory);
|
| | | }
|
| | | // 缓存
|
| | | redisManager.sendSms(phone, SMSHistory.TYPE_BIND);
|
| | | redisManager.saveSMSVCode(phone, SMSHistory.TYPE_BIND, msgCode);
|
| | |
|
| | | @Override
|
| | | public void sendRemoveVCode(SystemEnum system,String phone, int codeLength) throws SMSException {
|
| | | boolean limit = redisManager.isSmsFrequencyLimit(phone, SMSHistory.TYPE_REMVOE);
|
| | | if (limit)
|
| | | throw new SMSException(1001, "请过60秒再试");
|
| | | String msgCode = StringUtil.getVerifyCode(codeLength);
|
| | | SMSHistory smsHistory = new SMSHistory();
|
| | | smsHistory.setContent(msg);
|
| | | smsHistory.setCreateTime(new Date());
|
| | | smsHistory.setPhone(phone);
|
| | | smsHistory.setType(SMSHistory.TYPE_BIND);
|
| | | smsHistoryMapper.insertSelective(smsHistory);
|
| | | }
|
| | |
|
| | | // 验证码模板
|
| | | String msg = Constant.smsConfig.getSmsBind().replace("[签名]", system.getSmsAlias()).replace("[验证码]",
|
| | | msgCode);
|
| | | // 发送短信
|
| | | TencentSMSUtil.sendSingleMsg(phone, msg);
|
| | | @Override
|
| | | public void sendRemoveVCode(SystemEnum system, String phone, int codeLength) throws SMSException {
|
| | | boolean limit = redisManager.isSmsFrequencyLimit(phone, SMSHistory.TYPE_REMVOE);
|
| | | if (limit)
|
| | | throw new SMSException(1001, "请过60秒再试");
|
| | | String msgCode = StringUtil.getVerifyCode(codeLength);
|
| | |
|
| | | // 缓存
|
| | | redisManager.sendSms(phone, SMSHistory.TYPE_REMVOE);
|
| | | redisManager.saveSMSVCode(phone, SMSHistory.TYPE_REMVOE, msgCode);
|
| | | // 验证码模板
|
| | | String msg = Constant.smsConfig.getSmsBind().replace("[签名]", system.getSmsAlias()).replace("[验证码]",
|
| | | msgCode);
|
| | | // 发送短信
|
| | | TencentSMSUtil.sendSingleMsg(phone, msg);
|
| | |
|
| | | SMSHistory smsHistory = new SMSHistory();
|
| | | smsHistory.setContent(msg);
|
| | | smsHistory.setCreateTime(new Date());
|
| | | smsHistory.setPhone(phone);
|
| | | smsHistory.setType(SMSHistory.TYPE_REMVOE);
|
| | | smsHistoryMapper.insertSelective(smsHistory);
|
| | | }
|
| | | |
| | | @Override
|
| | | public void sendExtractVCode(SystemEnum system,String phone) throws SMSException {
|
| | | boolean limit = redisManager.isSmsFrequencyLimit(phone, SMSHistory.TYPE_EXTRACT);
|
| | | if (limit)
|
| | | throw new SMSException(1001, "请过60秒再试");
|
| | | String msgCode = StringUtil.getRandomCode(6);
|
| | | String msg = Constant.smsConfig.getSmsExtract().replace("[签名]",system.getSmsAlias())
|
| | | .replace("[验证码]", msgCode);
|
| | | // 发送短信
|
| | | TencentSMSUtil.sendSingleMsg(phone, msg);
|
| | | // 缓存
|
| | | redisManager.sendSms(phone, SMSHistory.TYPE_EXTRACT);
|
| | | redisManager.saveSMSVCode(phone, SMSHistory.TYPE_EXTRACT, msgCode);
|
| | | }
|
| | | // 缓存
|
| | | redisManager.sendSms(phone, SMSHistory.TYPE_REMVOE);
|
| | | redisManager.saveSMSVCode(phone, SMSHistory.TYPE_REMVOE, msgCode);
|
| | |
|
| | | @Override
|
| | | public void sendExtractSuccessMsg(SystemEnum system,String phone, BigDecimal money) throws SMSException {
|
| | | String msg = Constant.smsConfig.getSmsExtractSuccess().replace("[签名]", system.getSmsAlias())
|
| | | .replace("[金额]", money.toString());
|
| | | // 发送短信
|
| | | TencentSMSUtil.sendSingleMsg(phone, msg);
|
| | | }
|
| | | SMSHistory smsHistory = new SMSHistory();
|
| | | smsHistory.setContent(msg);
|
| | | smsHistory.setCreateTime(new Date());
|
| | | smsHistory.setPhone(phone);
|
| | | smsHistory.setType(SMSHistory.TYPE_REMVOE);
|
| | | smsHistoryMapper.insertSelective(smsHistory);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void sendExtractFailMsg(SystemEnum system,String phone, BigDecimal money) throws SMSException {
|
| | | String msg = Constant.smsConfig.getSmsExtractFail().replace("[签名]", system.getSmsAlias())
|
| | | .replace("[金额]", money.toString());
|
| | | // 发送短信
|
| | | TencentSMSUtil.sendSingleMsg(phone, msg);
|
| | | }
|
| | | @Override
|
| | | public void sendExtractVCode(SystemEnum system, String phone) throws SMSException {
|
| | | boolean limit = redisManager.isSmsFrequencyLimit(phone, SMSHistory.TYPE_EXTRACT);
|
| | | if (limit)
|
| | | throw new SMSException(1001, "请过60秒再试");
|
| | | String msgCode = StringUtil.getRandomCode(6);
|
| | | String msg = Constant.smsConfig.getSmsExtract().replace("[签名]", system.getSmsAlias())
|
| | | .replace("[验证码]", msgCode);
|
| | | // 发送短信
|
| | | TencentSMSUtil.sendSingleMsg(phone, msg);
|
| | | // 缓存
|
| | | redisManager.sendSms(phone, SMSHistory.TYPE_EXTRACT);
|
| | | redisManager.saveSMSVCode(phone, SMSHistory.TYPE_EXTRACT, msgCode);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void sendExtractSuccessMsg(SystemEnum system, String phone, BigDecimal money) throws SMSException {
|
| | | String msg = Constant.smsConfig.getSmsExtractSuccess().replace("[签名]", system.getSmsAlias())
|
| | | .replace("[金额]", money.toString());
|
| | | // 发送短信
|
| | | TencentSMSUtil.sendSingleMsg(phone, msg);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void sendExtractFailMsg(SystemEnum system, String phone, BigDecimal money) throws SMSException {
|
| | | String msg = Constant.smsConfig.getSmsExtractFail().replace("[签名]", system.getSmsAlias())
|
| | | .replace("[金额]", money.toString());
|
| | | // 发送短信
|
| | | TencentSMSUtil.sendSingleMsg(phone, msg);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | for (CommentInfo commentInfo : comments) {
|
| | | String comment = null;
|
| | | try {
|
| | | comment = convertLinkManager.convertLinkFromText(commentInfo.getContent(), uid, true);
|
| | | comment = convertLinkManager.convertLinkFromText(commentInfo.getContent(), uid, true,false);
|
| | | hasToken = true;
|
| | | } catch (ConvertLinkExceptionException e) {
|
| | | if (e.getCode() != ConvertLinkExceptionException.CODE_NONE) {
|
| | |
| | | */
|
| | | public List<TaoBaoOrder> getTaoBaoOrderByOrderId(String orderId);
|
| | |
|
| | |
|
| | |
|
| | |
|
| | | /**
|
| | | * 统计当日预估收益
|
| | | *
|
| | |
| | | import com.yeshi.goods.facade.utils.taobao.HaoDanKuApiUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | | import org.yeshi.utils.UrlUtils;
|
| | |
|
| | | /**
|
| | | * 转链组件
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | * @author Administrator
|
| | | */
|
| | | @Component
|
| | | public class ConvertLinkManager {
|
| | |
|
| | | @Resource
|
| | | private UserExtraTaoBaoInfoService userExtraTaoBaoInfoService;
|
| | | @Resource
|
| | | private UserExtraTaoBaoInfoService userExtraTaoBaoInfoService;
|
| | |
|
| | | @Resource
|
| | | private TaoBaoBuyRelationMapService taoBaoBuyRelationMapService;
|
| | | @Resource
|
| | | private TaoBaoBuyRelationMapService taoBaoBuyRelationMapService;
|
| | |
|
| | | @Resource
|
| | | private RedisManager redisManager;
|
| | | @Resource
|
| | | private RedisManager redisManager;
|
| | |
|
| | | @Resource
|
| | | private TaoBaoTokenAuctionIdMapManager taoBaoTokenAuctionIdMapManager;
|
| | | @Resource
|
| | | private TaoBaoTokenAuctionIdMapManager taoBaoTokenAuctionIdMapManager;
|
| | |
|
| | | /**
|
| | | * |
| | | * @Title: convertJDLinkFromText @Description:转链文本中的京东短链 @param text @param
|
| | | * uid @param share @return @throws Exception String 返回类型 @throws
|
| | | */
|
| | | /**
|
| | | * @Title: convertJDLinkFromText @Description:转链文本中的京东短链 @param text @param
|
| | | * uid @param share @return @throws Exception String 返回类型 @throws
|
| | | */
|
| | |
|
| | | public String convertJDLinkFromText(String text, Long uid, boolean share) throws Exception {
|
| | | public String convertJDLinkFromText(String text, Long uid, boolean share, boolean simpleTKToken) throws Exception {
|
| | |
|
| | | StringBuilder builder = new StringBuilder(text);
|
| | | String newText = builder.toString();
|
| | | // 京东转链
|
| | | // 提取京东所有的链接
|
| | | List<String> jdShortLink = JDUtil.getJDShortLinksFromText(text);
|
| | | Set<String> linkSet = new HashSet<>();
|
| | | Map<String, String> linkMap = new HashMap<>();
|
| | | if (jdShortLink != null && jdShortLink.size() > 0) {
|
| | | linkSet.addAll(jdShortLink);
|
| | | for (String shortLink : linkSet) {
|
| | | String link = null;
|
| | | if (share)
|
| | | link = JDApiUtil.convertLinkWithSubUnionId(shortLink, null, JDApiUtil.POSITION_SHARE + "",
|
| | | uid + "");
|
| | | else
|
| | | link = JDApiUtil.convertLinkWithSubUnionId(shortLink, null, JDApiUtil.POSITION_FANLI + "",
|
| | | uid + "");
|
| | | if (!StringUtil.isNullOrEmpty(link)) {
|
| | | linkMap.put(shortLink, link);
|
| | | }
|
| | | }
|
| | | }
|
| | | StringBuilder builder = new StringBuilder(text);
|
| | | String newText = builder.toString();
|
| | | // 京东转链
|
| | | // 提取京东所有的链接
|
| | | List<String> jdShortLink = JDUtil.getJDShortLinksFromText(text);
|
| | | Set<String> linkSet = new HashSet<>();
|
| | | Map<String, String> linkMap = new HashMap<>();
|
| | | if (jdShortLink != null && jdShortLink.size() > 0) {
|
| | | linkSet.addAll(jdShortLink);
|
| | | for (String shortLink : linkSet) {
|
| | | String link = null;
|
| | | if (share)
|
| | | link = JDApiUtil.convertLinkWithSubUnionId(shortLink, null, JDApiUtil.POSITION_SHARE + "",
|
| | | uid + "");
|
| | | else
|
| | | link = JDApiUtil.convertLinkWithSubUnionId(shortLink, null, JDApiUtil.POSITION_FANLI + "",
|
| | | uid + "");
|
| | | if (!StringUtil.isNullOrEmpty(link)) {
|
| | | linkMap.put(shortLink, link);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | for (String link : linkSet) {
|
| | | if (linkMap.get(link) == null)
|
| | | throw new Exception("京东转链失败");
|
| | | newText = newText.replace(link, linkMap.get(link));
|
| | | }
|
| | | for (String link : linkSet) {
|
| | | if (linkMap.get(link) == null)
|
| | | throw new Exception("京东转链失败");
|
| | | newText = newText.replace(link, linkMap.get(link));
|
| | | }
|
| | |
|
| | | return newText;
|
| | | }
|
| | | return newText;
|
| | | }
|
| | |
|
| | | public String convertPDDLinkFromText(String text, Long uid, boolean share) throws Exception {
|
| | | public String convertPDDLinkFromText(String text, Long uid, boolean share) throws Exception {
|
| | |
|
| | | StringBuilder builder = new StringBuilder(text);
|
| | | String newText = builder.toString();
|
| | | // 京东转链
|
| | | // 提取京东所有的链接
|
| | | List<String> pddShortLink = PinDuoDuoUtil.getPDDShortLinksFromText(text);
|
| | | Set<String> linkSet = new HashSet<>();
|
| | | Map<String, String> linkMap = new HashMap<>();
|
| | | if (pddShortLink != null && pddShortLink.size() > 0) {
|
| | | linkSet.addAll(pddShortLink);
|
| | | for (String shortLink : linkSet) {
|
| | | String goodsId = PinDuoDuoUtil.getPDDGoodsId(shortLink);
|
| | | if (!StringUtil.isNullOrEmpty(goodsId)) {
|
| | | PDDPromotionUrl pddUrl = PinDuoDuoApiUtil.convert(Long.parseLong(goodsId),
|
| | | share ? PinDuoDuoApiUtil.PID_SHARE : PinDuoDuoApiUtil.PID_FANLI, uid + "",false);
|
| | | if (pddUrl != null) {
|
| | | linkMap.put(shortLink, pddUrl.getShortUrl());
|
| | | }
|
| | | }
|
| | | StringBuilder builder = new StringBuilder(text);
|
| | | String newText = builder.toString();
|
| | | // 京东转链
|
| | | // 提取京东所有的链接
|
| | | List<String> pddShortLink = PinDuoDuoUtil.getPDDShortLinksFromText(text);
|
| | | Set<String> linkSet = new HashSet<>();
|
| | | Map<String, String> linkMap = new HashMap<>();
|
| | | if (pddShortLink != null && pddShortLink.size() > 0) {
|
| | | linkSet.addAll(pddShortLink);
|
| | | for (String shortLink : linkSet) {
|
| | | String goodsId = PinDuoDuoUtil.getPDDGoodsId(shortLink);
|
| | | if (!StringUtil.isNullOrEmpty(goodsId)) {
|
| | | PDDPromotionUrl pddUrl = PinDuoDuoApiUtil.convert(Long.parseLong(goodsId),
|
| | | share ? PinDuoDuoApiUtil.PID_SHARE : PinDuoDuoApiUtil.PID_FANLI, uid + "", false);
|
| | | if (pddUrl != null) {
|
| | | linkMap.put(shortLink, pddUrl.getShortUrl());
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | for (String link : linkSet) {
|
| | | if (linkMap.get(link) == null)
|
| | | throw new Exception("拼多多转链失败");
|
| | | newText = newText.replace(link, linkMap.get(link));
|
| | | }
|
| | | for (String link : linkSet) {
|
| | | if (linkMap.get(link) == null)
|
| | | throw new Exception("拼多多转链失败");
|
| | | newText = newText.replace(link, linkMap.get(link));
|
| | | }
|
| | |
|
| | | return newText;
|
| | | }
|
| | | return newText;
|
| | | }
|
| | |
|
| | | // 获取淘宝官方活动ID内容
|
| | | public List<String> getTaoBaoOfficialActivityId(String text) {
|
| | | // 获取淘宝官方活动ID内容
|
| | | public List<String> getTaoBaoOfficialActivityId(String text) {
|
| | |
|
| | | // {淘宝活动:13123123}
|
| | | String regex = "(\\{\u6dd8\u5b9d\u6d3b\u52a8\\:){1}+[0-9]{5,20}\\}{1}";
|
| | | Pattern pattern = Pattern.compile(regex);
|
| | | Matcher m = pattern.matcher(text);
|
| | | List<String> urlList = new ArrayList<>();
|
| | | while (m.find()) {
|
| | | urlList.add(m.group());
|
| | | }
|
| | | // {淘宝活动:13123123}
|
| | | String regex = "(\\{\u6dd8\u5b9d\u6d3b\u52a8\\:){1}+[0-9]{5,20}\\}{1}";
|
| | | Pattern pattern = Pattern.compile(regex);
|
| | | Matcher m = pattern.matcher(text);
|
| | | List<String> urlList = new ArrayList<>();
|
| | | while (m.find()) {
|
| | | urlList.add(m.group());
|
| | | }
|
| | |
|
| | | return urlList;
|
| | | return urlList;
|
| | |
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * |
| | | * @Title: convertTBLinkFromText @Description: 转链文本中的淘口令 @param text @param
|
| | | * uid @param share @return @throws Exception String 返回类型 @throws
|
| | | */
|
| | | private String convertTBLinkFromText(String text, Long uid, boolean share) throws Exception {
|
| | | /**
|
| | | *
|
| | | * @Title: convertTBLinkFromText @Description: 转链文本中的淘口令 @param text @param
|
| | | * uid @param share @return @throws Exception String 返回类型 @throws
|
| | | */
|
| | | /**
|
| | | * @param text
|
| | | * @param uid
|
| | | * @param share
|
| | | * @param simpleToken -是否采用简版淘口令
|
| | | * @return
|
| | | * @throws Exception
|
| | | */
|
| | | private String convertTBLinkFromText(String text, Long uid, boolean share, boolean simpleToken) throws Exception {
|
| | |
|
| | | StringBuilder builder = new StringBuilder(text);
|
| | | String newText = builder.toString();
|
| | | StringBuilder builder = new StringBuilder(text);
|
| | | String newText = builder.toString();
|
| | |
|
| | | // 解析淘口令
|
| | | List<String> tokenList = TaoBaoUtil.getTokenListFromTextWithKuoHao(newText);
|
| | | if (tokenList != null && tokenList.size() > 0) {
|
| | | // 解析淘口令
|
| | | List<String> tokenList = TaoBaoUtil.getTokenListFromTextWithKuoHao(newText);
|
| | | if (tokenList != null && tokenList.size() > 0) {
|
| | |
|
| | | String relationId = null;
|
| | | if (share) {
|
| | | relationId = userExtraTaoBaoInfoService.getRelationIdByUid(uid);
|
| | | if (StringUtil.isNullOrEmpty(relationId))
|
| | | throw new Exception("淘宝未授权");
|
| | | }
|
| | | String relationId = null;
|
| | | if (share) {
|
| | | relationId = userExtraTaoBaoInfoService.getRelationIdByUid(uid);
|
| | | if (StringUtil.isNullOrEmpty(relationId))
|
| | | throw new Exception("淘宝未授权");
|
| | | }
|
| | |
|
| | | Set<String> tokenSet = new HashSet<>();
|
| | | tokenSet.addAll(tokenList);
|
| | | Map<String, String> tokenMap = new HashMap<>();
|
| | | for (String token : tokenSet) {
|
| | | Long auctionId = taoBaoTokenAuctionIdMapManager.getAuctionIdByToken(token);
|
| | | if (auctionId == null)
|
| | | throw new Exception("从淘口令获取商品失败");
|
| | | TaoBaoGoodsBrief simpleGoods = TaoKeApiUtil.getSimpleGoodsInfo(auctionId);
|
| | | if (simpleGoods == null)
|
| | | throw new Exception("商品信息获取失败");
|
| | | String link = null;
|
| | | if (share) {
|
| | | //暂时调用好单库API
|
| | | link=HaoDanKuApiUtil.getInstance().convertLink(auctionId, TaoBaoConstant.TAOBAO_RELATION_PID_DEFAULT, null,null,relationId);
|
| | | Set<String> tokenSet = new HashSet<>();
|
| | | tokenSet.addAll(tokenList);
|
| | | Map<String, String> tokenMap = new HashMap<>();
|
| | | for (String token : tokenSet) {
|
| | | Long auctionId = taoBaoTokenAuctionIdMapManager.getAuctionIdByToken(token);
|
| | | if (auctionId == null)
|
| | | throw new Exception("从淘口令获取商品失败");
|
| | | TaoBaoGoodsBrief simpleGoods = TaoKeApiUtil.getSimpleGoodsInfo(auctionId);
|
| | | if (simpleGoods == null)
|
| | | throw new Exception("商品信息获取失败");
|
| | | String link = null;
|
| | | if (share) {
|
| | | //暂时调用好单库API
|
| | | link = HaoDanKuApiUtil.getInstance().convertLink(auctionId, TaoBaoConstant.TAOBAO_RELATION_PID_DEFAULT, null, null, relationId);
|
| | | // TaoBaoGoodsBrief goods = TaoKeApiUtil.specialConvertCoupon(auctionId,
|
| | | // new TaoKeAppInfo(TaoBaoConstant.TAOBAO_AUTH_APPKEY, TaoBaoConstant.TAOBAO_AUTH_APPSECRET,
|
| | | // TaoBaoConstant.TAOBAO_RELATION_PID_DEFAULT));
|
| | |
| | | // if (StringUtil.isNullOrEmpty(link)) {
|
| | | // link = goods.getAuctionUrl();
|
| | | // }
|
| | | if (StringUtil.isNullOrEmpty(link))
|
| | | throw new Exception("商品转链失败");
|
| | | link += "&relationId=" + relationId;
|
| | | } else {
|
| | | String specialId=userExtraTaoBaoInfoService.getSpecialIdByUid(uid);
|
| | | if (StringUtil.isNullOrEmpty(link))
|
| | | throw new Exception("商品转链失败");
|
| | | link += "&relationId=" + relationId;
|
| | | } else {
|
| | | String specialId = userExtraTaoBaoInfoService.getSpecialIdByUid(uid);
|
| | |
|
| | |
|
| | | if (simpleGoods.getMaterialLibType() != null && simpleGoods.getMaterialLibType() == 1) {
|
| | | TaoBaoGoodsBrief goods = TaoKeApiUtil.specialConvertCoupon(auctionId,
|
| | | new TaoKeAppInfo(TaoBaoConstant.TAOBAO_AUTH_APPKEY,
|
| | | TaoBaoConstant.TAOBAO_AUTH_APPSECRET,
|
| | | TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT),specialId,null);
|
| | | if (goods == null)
|
| | | throw new Exception("商品转链失败");
|
| | | if (simpleGoods.getMaterialLibType() != null && simpleGoods.getMaterialLibType() == 1) {
|
| | | TaoBaoGoodsBrief goods = TaoKeApiUtil.specialConvertCoupon(auctionId,
|
| | | new TaoKeAppInfo(TaoBaoConstant.TAOBAO_AUTH_APPKEY,
|
| | | TaoBaoConstant.TAOBAO_AUTH_APPSECRET,
|
| | | TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT), specialId, null);
|
| | | if (goods == null)
|
| | | throw new Exception("商品转链失败");
|
| | |
|
| | | link = goods.getCouponLink();
|
| | | if (StringUtil.isNullOrEmpty(link)) {
|
| | | link = goods.getAuctionUrl();
|
| | | }
|
| | | } else {
|
| | | String sRelationId = taoBaoBuyRelationMapService.getRelationId(uid);
|
| | | link = goods.getCouponLink();
|
| | | if (StringUtil.isNullOrEmpty(link)) {
|
| | | link = goods.getAuctionUrl();
|
| | | }
|
| | | } else {
|
| | | String sRelationId = taoBaoBuyRelationMapService.getRelationId(uid);
|
| | |
|
| | | TaoBaoGoodsBrief goods = TaoKeApiUtil.specialConvertCoupon(auctionId,
|
| | | new TaoKeAppInfo(TaoBaoConstant.TAOBAO_AUTH_APPKEY,
|
| | | TaoBaoConstant.TAOBAO_AUTH_APPSECRET,
|
| | | TaoBaoConstant.TAOBAO_RELATION_AS_SPECIAL_PID),specialId,null);
|
| | | if (goods == null)
|
| | | throw new Exception("商品转链失败");
|
| | | TaoBaoGoodsBrief goods = TaoKeApiUtil.specialConvertCoupon(auctionId,
|
| | | new TaoKeAppInfo(TaoBaoConstant.TAOBAO_AUTH_APPKEY,
|
| | | TaoBaoConstant.TAOBAO_AUTH_APPSECRET,
|
| | | TaoBaoConstant.TAOBAO_RELATION_AS_SPECIAL_PID), specialId, null);
|
| | | if (goods == null)
|
| | | throw new Exception("商品转链失败");
|
| | |
|
| | | link = goods.getCouponLink();
|
| | | if (StringUtil.isNullOrEmpty(link)) {
|
| | | link = goods.getAuctionUrl();
|
| | | }
|
| | | if (StringUtil.isNullOrEmpty(link))
|
| | | throw new Exception("商品转链失败");
|
| | | link += "&relationId=" + sRelationId;
|
| | | }
|
| | | }
|
| | | link = goods.getCouponLink();
|
| | | if (StringUtil.isNullOrEmpty(link)) {
|
| | | link = goods.getAuctionUrl();
|
| | | }
|
| | | if (StringUtil.isNullOrEmpty(link))
|
| | | throw new Exception("商品转链失败");
|
| | | link += "&relationId=" + sRelationId;
|
| | | }
|
| | | }
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(link)) {
|
| | | throw new Exception("商品转链失败");
|
| | | }
|
| | | if (StringUtil.isNullOrEmpty(link)) {
|
| | | throw new Exception("商品转链失败");
|
| | | }
|
| | |
|
| | | String newToken = TaoKeApiUtil.getTKToken(simpleGoods.getPictUrl(), simpleGoods.getTitle(), link);
|
| | | if (StringUtil.isNullOrEmpty(newToken)) {
|
| | | throw new Exception("口令转链失败");
|
| | | }
|
| | | tokenMap.put(token, TaoBaoUtil.filterTaoToken(newToken));
|
| | | }
|
| | | String newToken = TaoKeApiUtil.getTKToken(simpleGoods.getPictUrl(), simpleGoods.getTitle(), link, simpleToken);
|
| | | if (StringUtil.isNullOrEmpty(newToken)) {
|
| | | throw new Exception("口令转链失败");
|
| | | }
|
| | | tokenMap.put(token, TaoBaoUtil.filterTaoToken(newToken));
|
| | | }
|
| | |
|
| | | for (String token : tokenSet) {
|
| | | if (tokenMap.get(token) == null)
|
| | | throw new Exception("淘宝部分转链失败");
|
| | | newText = newText.replace(token, tokenMap.get(token));
|
| | | }
|
| | | }
|
| | | for (String token : tokenSet) {
|
| | | if (tokenMap.get(token) == null)
|
| | | throw new Exception("淘宝部分转链失败");
|
| | | newText = newText.replace(token, tokenMap.get(token));
|
| | | }
|
| | | }
|
| | |
|
| | | // 解析淘宝官方活动ID
|
| | | List<String> list = getTaoBaoOfficialActivityId(newText);
|
| | | if (list.size() > 0) {
|
| | | String relationId = null;
|
| | | if (share) {
|
| | | relationId = userExtraTaoBaoInfoService.getRelationIdByUid(uid);
|
| | | if (StringUtil.isNullOrEmpty(relationId))
|
| | | throw new Exception("淘宝未授权");
|
| | | }
|
| | | for (String st : list) {
|
| | | String activityid = st.replace("{淘宝活动:", "").replace("}", "");
|
| | | if (!StringUtil.isNullOrEmpty(activityid)) {
|
| | | String adzoneId = TaoBaoConstant.TAOBAO_RELATION_PID_DEFAULT.split("_")[3];
|
| | | TaoKeOfficialActivityConvertResultDTO dto = TaoKeApiUtil.officialActivityConvert(adzoneId,
|
| | | activityid, relationId);
|
| | | String link = dto.getShort_click_url();
|
| | | if (StringUtil.isNullOrEmpty(link)) {
|
| | | link = dto.getClick_url();
|
| | | }
|
| | | // 解析淘宝官方活动ID
|
| | | List<String> list = getTaoBaoOfficialActivityId(newText);
|
| | | if (list.size() > 0) {
|
| | | String relationId = null;
|
| | | if (share) {
|
| | | relationId = userExtraTaoBaoInfoService.getRelationIdByUid(uid);
|
| | | if (StringUtil.isNullOrEmpty(relationId))
|
| | | throw new Exception("淘宝未授权");
|
| | | }
|
| | | for (String st : list) {
|
| | | String activityid = st.replace("{淘宝活动:", "").replace("}", "");
|
| | | if (!StringUtil.isNullOrEmpty(activityid)) {
|
| | | String adzoneId = TaoBaoConstant.TAOBAO_RELATION_PID_DEFAULT.split("_")[3];
|
| | | TaoKeOfficialActivityConvertResultDTO dto = TaoKeApiUtil.officialActivityConvert(adzoneId,
|
| | | activityid, relationId);
|
| | | String link = dto.getShort_click_url();
|
| | | if (StringUtil.isNullOrEmpty(link)) {
|
| | | link = dto.getClick_url();
|
| | | }
|
| | |
|
| | | String token = TaoKeApiUtil.getTKToken("http://", "淘宝官方活动", link);
|
| | | newText = newText.replace(st, TaoBaoUtil.filterTaoToken(token));
|
| | | }
|
| | | }
|
| | | }
|
| | | String token = TaoKeApiUtil.getTKToken("http://", "淘宝官方活动", link, simpleToken);
|
| | | newText = newText.replace(st, TaoBaoUtil.filterTaoToken(token));
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | return newText;
|
| | | }
|
| | | return newText;
|
| | | }
|
| | |
|
| | | /**
|
| | | * |
| | | * @Title: convertLinkFromText @Description: 从文本转链 @param text @return
|
| | | * String 返回类型 @throws
|
| | | */
|
| | | public String convertLinkFromText(String text, Long uid, boolean share)
|
| | | throws ConvertLinkExceptionException, Exception {
|
| | | String newText = convertJDLinkFromText(text, uid, share);
|
| | | newText = convertPDDLinkFromText(newText, uid, share);
|
| | | newText = convertTBLinkFromText(newText, uid, share);
|
| | | if (text.equalsIgnoreCase(newText))
|
| | | throw new ConvertLinkExceptionException(ConvertLinkExceptionException.CODE_NONE, "不包含可转链的口令与链接");
|
| | | return newText;
|
| | | }
|
| | | /**
|
| | | * @Title: convertLinkFromText @Description: 从文本转链 @param text @return
|
| | | * String 返回类型 @throws
|
| | | */
|
| | | public String convertLinkFromText(String text, Long uid, boolean share, boolean simpleToken)
|
| | | throws ConvertLinkExceptionException, Exception {
|
| | | String newText = convertJDLinkFromText(text, uid, share, simpleToken);
|
| | | newText = convertPDDLinkFromText(newText, uid, share);
|
| | | newText = convertTBLinkFromText(newText, uid, share, simpleToken);
|
| | |
|
| | | /**
|
| | | * 创建口令 @Title: createTaoBaoToken @Description: @param uid 用户ID @param
|
| | | * picturl @param title @param link @return String 返回类型 @throws
|
| | | */
|
| | | public String createTaoBaoToken(Long uid, String picturl, String title, String link) {
|
| | | List<String> urls = UrlUtils.parseUrlsFromText(text);
|
| | | if (urls != null)
|
| | | for (String url : urls) {
|
| | | if (url.contains("{relationId}")) {
|
| | | String relationId = userExtraTaoBaoInfoService.getRelationIdByUid(uid);
|
| | | if (StringUtil.isNullOrEmpty(relationId)) {
|
| | | throw new Exception("淘宝未授权");
|
| | | }
|
| | | newText = newText.replace(url, url.replace("{relationId}", relationId));
|
| | | }
|
| | | }
|
| | | if (text.equalsIgnoreCase(newText))
|
| | | throw new ConvertLinkExceptionException(ConvertLinkExceptionException.CODE_NONE, "不包含可转链的口令与链接");
|
| | | return newText;
|
| | | }
|
| | |
|
| | | String token = TaoKeApiUtil.getTKToken(picturl, title, link);
|
| | | if (!StringUtil.isNullOrEmpty(token)) {
|
| | | // 缓存30分钟
|
| | | redisManager.cacheCommonString(
|
| | | RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoUserTKToken, uid + "-" + StringUtil.Md5(token)), "1",
|
| | | 60 * 30);
|
| | | }
|
| | | return token;
|
| | | }
|
| | | /**
|
| | | * 创建口令 @Title: createTaoBaoToken @Description: @param uid 用户ID @param
|
| | | * picturl @param title @param link @return String 返回类型 @throws
|
| | | */
|
| | | public String createTaoBaoToken(Long uid, String picturl, String title, String link, boolean simpleToken) {
|
| | | String token = TaoKeApiUtil.getTKToken(picturl, title, link, simpleToken);
|
| | | if (!StringUtil.isNullOrEmpty(token)) {
|
| | | // 缓存30分钟
|
| | | redisManager.cacheCommonString(
|
| | | RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoUserTKToken, uid + "-" + StringUtil.Md5(token)), "1",
|
| | | 60 * 30);
|
| | | }
|
| | | return token;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | |
| | | if (!StringUtil.isNullOrEmpty(tbLink.getCouponLink())) {// 通过立即推广方式获取淘口令成功 |
| | | String quanToken = convertLinkManager.createTaoBaoToken(uid, goods.getPictUrl(), goods.getTitle(), |
| | | tbLink.getCouponLink()); |
| | | tbLink.getCouponLink(),false); |
| | | if (!StringUtil.isNullOrEmpty(quanToken)) { |
| | | tbLink.setTaoToken(quanToken); |
| | | } |
| | | } else if (!StringUtil.isNullOrEmpty(tbLink.getClickUrl())) { |
| | | String quanToken = convertLinkManager.createTaoBaoToken(uid, goods.getPictUrl(), goods.getTitle(), |
| | | tbLink.getClickUrl()); |
| | | tbLink.getClickUrl(),false); |
| | | if (!StringUtil.isNullOrEmpty(quanToken)) { |
| | | tbLink.setTaoToken(quanToken); |
| | | } |
| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dto.mq.order.body.OrderWeiQuanMQMsg;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
|
| | | import com.yeshi.fanli.service.inter.order.OrderProcessService;
|
| | | import com.yeshi.fanli.service.inter.order.tb.TaoBaoWeiQuanOrderService;
|
| | | import org.springframework.stereotype.Component;
|
| | |
|
| | | import com.aliyun.openservices.ons.api.Action;
|
| | |
| | |
|
| | | /**
|
| | | * 订单到账消费
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | * @author Administrator
|
| | | */
|
| | | @Component
|
| | | public class OrderMessageListener implements MessageListener {
|
| | |
|
| | | @Resource
|
| | | private HongBaoV2SettleTempService hongBaoV2SettleTempService;
|
| | | @Resource
|
| | | private OrderProcessService orderProcessService;
|
| | |
|
| | | @Resource
|
| | | private HongBaoV2Service hongBaoV2Service;
|
| | | @Resource
|
| | | private TaoBaoWeiQuanOrderService taoBaoWeiQuanOrderService;
|
| | |
|
| | | @Resource
|
| | | private HongBaoOrderService hongBaoOrderService;
|
| | | @Override
|
| | | public Action consume(Message message, ConsumeContext context) {
|
| | | LogHelper.mqInfo("consumer:OrderMessageListener", message.getMsgID(), message.getTopic(), message.getTag(),
|
| | | new String(message.getBody()));
|
| | | if (MQTopicName.TOPIC_ORDER.name().equalsIgnoreCase(message.getTopic())) {
|
| | | if (OrderTopicTagEnum.taoBaoOrderWeiQuan.name().equalsIgnoreCase(message.getTag())) {
|
| | | OrderWeiQuanMQMsg dto = new Gson().fromJson(new String(message.getBody()), OrderWeiQuanMQMsg.class);
|
| | | if (dto != null) {
|
| | | TaoBaoWeiQuanOrder taoBaoWeiQuanOrder = taoBaoWeiQuanOrderService.selectByTradeId(dto.getTradeId());
|
| | | orderProcessService.weiQuanOrder(taoBaoWeiQuanOrder);
|
| | | }
|
| | | return Action.CommitMessage;
|
| | | }
|
| | | }
|
| | |
|
| | | @Resource
|
| | | private Producer producer;
|
| | |
|
| | | private int getHongBaoType(int type) {
|
| | | switch (type) {
|
| | | case HongBaoV2.TYPE_YIJI:
|
| | | case HongBaoV2.TYPE_ERJI:
|
| | | case HongBaoV2.TYPE_SHARE_YIJI:
|
| | | case HongBaoV2.TYPE_SHARE_ERJI:
|
| | | return OrderMoneyRecievedMQMsg.TYPE_INVITE;
|
| | | case HongBaoV2.TYPE_SHARE_GOODS:
|
| | | return OrderMoneyRecievedMQMsg.TYPE_SHARE;
|
| | | case HongBaoV2.TYPE_ZIGOU:
|
| | | return OrderMoneyRecievedMQMsg.TYPE_ZIGOU;
|
| | | }
|
| | | return 0;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public Action consume(Message message, ConsumeContext context) {
|
| | | LogHelper.mqInfo("consumer:OrderMessageListener", message.getMsgID(), message.getTopic(), message.getTag(),
|
| | | new String(message.getBody()));
|
| | | if (MQTopicName.TOPIC_ORDER.name().equalsIgnoreCase(message.getTopic())) {
|
| | | if (OrderTopicTagEnum.taoBaoOrderWeiQuan.name().equalsIgnoreCase(message.getTag())) {
|
| | | String key = message.getKey();
|
| | | // 订单维权
|
| | | //TODO 维权增加
|
| | | |
| | | return Action.CommitMessage;
|
| | | }
|
| | | }
|
| | |
|
| | | return Action.CommitMessage;
|
| | | }
|
| | | return Action.CommitMessage;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | * @return
|
| | | * @throws TaobaoGoodsDownException
|
| | | */
|
| | | public static TaoBaoGoodsBrief searchGoodsDetail(Long id, String specialId,String relationId) throws TaobaoGoodsDownException {
|
| | | public static TaoBaoGoodsBrief searchGoodsDetail(Long id, String specialId, String relationId) throws TaobaoGoodsDownException {
|
| | | TaoBaoGoodsBrief goods = getSimpleGoodsInfo(id);
|
| | | if (goods == null)
|
| | | return null;
|
| | |
| | | }
|
| | |
|
| | | public static TaoBaoGoodsBrief searchGoodsDetail(Long id) throws TaobaoGoodsDownException {
|
| | | return searchGoodsDetail(id, null,null);
|
| | | return searchGoodsDetail(id, null, null);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | return null;
|
| | | }
|
| | |
|
| | | public static String getTKToken(String logo, String text, String url, boolean simpleToken) {
|
| | | if (simpleToken) {
|
| | | return getSimpleTKToken(logo, text, url);
|
| | | } else {
|
| | | return getTKToken(logo, text, url);
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | public static String getSimpleTKToken(String logo, String text, String url) {
|
| | | if (text == null)
|
| | | return null;
|
| | | if (text.length() < 5)
|
| | | text = "好货:" + text;
|
| | |
|
| | | Map<String, String> map = new HashMap<>();
|
| | | map.put("method", "taobao.tbk.tpwd.create");
|
| | | map.put("url", url);
|
| | | map.put("text", text);
|
| | | map.put("logo", logo);
|
| | | String resultStr = TaoKeBaseUtil.baseRequestForThreeTimes(map, true);
|
| | |
|
| | | JSONObject data = JSONObject.fromObject(resultStr);
|
| | | if (data.optJSONObject("tbk_tpwd_create_response").optJSONObject("data") != null)
|
| | | return data.optJSONObject("tbk_tpwd_create_response").optJSONObject("data").optString("password_simple");
|
| | | return null;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取券详细信息
|
| | | *
|
| | |
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import com.yeshi.fanli.dto.order.OrderQuery;
|
| | | import com.yeshi.fanli.dto.taobao.TaoBaoOrderResultDTO;
|
| | | import com.yeshi.fanli.dto.taobao.WeiQuanOrderResult;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | |
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | |
|
| | | @Deprecated
|
| | | public static List<TaoBaoOrder> queryTaoBaoOrder(OrderQuery orderQuery, String appKey, String appSecret) {
|
| | |
|
| | | Map<String, String> map = new HashMap<>();
|
| | | map.put("method", "taobao.tbk.order.get");
|
| | | map.put("fields",
|
| | | "tb_trade_parent_id,tb_trade_id,num_iid,item_title,item_num,price,pay_price,seller_nick,seller_shop_title,commission,commission_rate,unid,create_time,earning_time,tk_status,tk3rd_pub_id,tk3rd_site_id,tk3rd_adzone_id,relation_id,tb_trade_parent_id,tb_trade_id,num_iid,item_title,item_num,price,pay_price,seller_nick,seller_shop_title,commission,commission_rate,unid,create_time,earning_time,tk3rd_pub_id,tk3rd_site_id,tk3rd_adzone_id,special_id,click_time,relation_id,special_id");
|
| | | if (orderQuery.startTime != null)
|
| | | map.put("start_time", orderQuery.startTime);
|
| | | if (orderQuery.span != null)
|
| | | map.put("span", orderQuery.span + "");
|
| | | map.put("page_no", orderQuery.pageNo + "");
|
| | | map.put("page_size", orderQuery.pageSize + "");
|
| | |
|
| | | if (orderQuery.tkStatus != null)
|
| | | map.put("tk_status", orderQuery.tkStatus + "");
|
| | | if (orderQuery.orderQueryType != null)
|
| | | map.put("order_query_type", orderQuery.orderQueryType);
|
| | | if (orderQuery.orderScene != null)
|
| | | map.put("order_scene", orderQuery.orderScene + "");
|
| | |
|
| | | if (orderQuery.orderCountType != null)
|
| | | map.put("order_count_type", orderQuery.orderCountType + "");
|
| | |
|
| | | TaoKeAppInfo app = new TaoKeAppInfo();
|
| | | app.setAppKey(appKey);
|
| | | app.setAppSecret(appSecret);
|
| | | try {
|
| | | JSONObject json = TaoKeBaseUtil.baseRequest(map, app);
|
| | | System.out.println(json);
|
| | | } catch (TaoKeApiException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | try {
|
| | | Thread.sleep(1000);
|
| | | } catch (InterruptedException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | return null;
|
| | | }
|
| | | }
|
| | |
| | | mongo.dbname=flq
|
| | | mongo.port=27017
|
| | | mongo.port=27016
|
| | | #开发环境
|
| | | mongo.host=192.168.1.253
|
| | | mongo.username=admin
|
| | | mongo.password=123456
|
| | | #mongo.host=192.168.1.253
|
| | | #mongo.username=admin
|
| | | #mongo.password=123456
|
| | |
|
| | | #mongo.host=193.112.35.168
|
| | | #mongo.username=yeshi
|
| | | #mongo.password=Yeshi2016@
|
| | | mongo.host=193.112.35.168
|
| | | mongo.username=yeshi
|
| | | mongo.password=Yeshi2016@
|
| | |
|
| | | mongo.connectionsPerHost=8
|
| | | mongo.threadsAllowedToBlockForConnectionMultiplier=4
|
| | |
| | | redis.addr=192.168.1.253
|
| | | redis.addr=192.168.3.253
|
| | | redis.port=6379
|
| | | redis.auth=123456
|
| | | #redis.addr=193.112.34.40
|
| | |
| | | AND co.`co_third_create_time`>#{minTime} AND |
| | | <![CDATA[ (co.`co_estimate`>= ${money} OR co.`co_eIncome`> ${money})]]> |
| | | </if> |
| | | |
| | | <if test="payment != null">AND |
| | | co.co_payment <![CDATA[<]]> |
| | | #{payment} |
| | | </if> |
| | | |
| | | ORDER BY co.co_third_create_time DESC LIMIT ${start},${count} ) A LEFT |
| | | JOIN yeshi_ec_user u ON u.id = A.hb_uid |
| | | </select> |
| | |
| | | </property>
|
| | | </bean>
|
| | |
|
| | | <!-- 红包消息订阅 -->
|
| | | <bean id="orderMessageListener"
|
| | | class="com.yeshi.fanli.util.rocketmq.consumer.order.OrderMessageListener"></bean>
|
| | | <!-- Group ID 订阅同一个 Topic,可以创建多个 ConsumerBean -->
|
| | | <bean id="orderConsumer" class="com.aliyun.openservices.ons.api.bean.ConsumerBean"
|
| | | init-method="start" destroy-method="shutdown">
|
| | | <property name="properties"> <!--消费者配置信息 -->
|
| | | <props>
|
| | | <prop key="AccessKey">${rocketmq.AccessKey}</prop>
|
| | | <prop key="SecretKey">${rocketmq.SecretKey}</prop>
|
| | | <prop key="GROUP_ID">GID_ORDER</prop>
|
| | | <prop key="NAMESRV_ADDR">${rocketmq.NAMESRV_ADDR}</prop>
|
| | | <prop key="ConsumeThreadNums">50</prop>
|
| | | </props>
|
| | | </property>
|
| | | <property name="subscriptionTable">
|
| | | <map>
|
| | | <entry value-ref="orderMessageListener">
|
| | | <key>
|
| | | <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
|
| | | <property name="topic" value="TOPIC_ORDER" />
|
| | | <property name="expression" value="taoBaoOrderWeiQuan" />
|
| | | </bean>
|
| | | </key>
|
| | | </entry>
|
| | | </map>
|
| | | </property>
|
| | | </bean>
|
| | |
|
| | |
|
| | | <!-- 测试消息订阅 -->
|
| | | <bean id="testRocketMQCosumerListener"
|
| | |
| | |
|
| | | import com.yeshi.fanli.entity.brand.BrandClassSystemMap;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoManage;
|
| | | import com.yeshi.fanli.entity.bus.user.Order;
|
| | | import com.yeshi.fanli.entity.common.Config;
|
| | | import com.yeshi.fanli.entity.config.CommonConfig;
|
| | | import com.yeshi.fanli.entity.pdd.PDDOrder;
|
| | | import com.yeshi.fanli.entity.push.PushGoods;
|
| | | import com.yeshi.fanli.entity.system.BusinessSystem;
|
| | | import org.junit.Test;
|
| | |
| | |
|
| | | @Test
|
| | | public void test1() {
|
| | | ColumnParseUtil.parseColumn(HongBaoManage.class,
|
| | | "D:\\workspace\\fanli\\fanli-server\\fanli\\src\\main\\resource\\mapping\\HongBaoManageMapper.xml");
|
| | | ColumnParseUtil.parseColumn(Order.class,
|
| | | "D:\\workspace\\fanli\\fanli-server\\fanli\\src\\main\\resource\\mapping\\order\\OrderMapper.xml");
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import com.yeshi.fanli.dto.order.OrderQuery;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeOrderApiUtil;
|
| | | import org.junit.Test;
|
| | | import org.yeshi.utils.HttpUtil;
|
| | |
|
| | |
| | | + "https://u.jd.com/d9fcGr\n" + "⚡京东秒杀\n" + "https://u.jd.com/WSIi1z\n" + "【记得与更多好友分享[愉快]】";
|
| | | ConvertLinkManager convertLinkManager = BeanUtil.getBean(ConvertLinkManager.class);
|
| | | try {
|
| | | System.out.println(convertLinkManager.convertLinkFromText(text, 437032L, true));
|
| | | System.out.println(convertLinkManager.convertLinkFromText(text, 437032L, true,false));
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | |
|
| | | @Test
|
| | | public void test12() {
|
| | |
|
| | | try {
|
| | |
|
| | | BufferedReader br = new BufferedReader(new InputStreamReader(
|
| | | new FileInputStream(new File("C:/Users/Administrator/Desktop/新建文本文档 (2).txt"))));
|
| | | String text = "";
|
| | |
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | @Test
|
| | | public void test18(){
|
| | |
|
| | | OrderQuery q=new OrderQuery();
|
| | | q.startTime="2020-01-01";
|
| | | q.pageNo=1;
|
| | | q.pageSize=20;
|
| | | TaoKeOrderApiUtil.queryTaoBaoOrder(q,TaoBaoConstant.TAOBAO_AUTH_APPKEY,TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | <version>4.3.2</version>
|
| | | </dependency>
|
| | |
|
| | | <!-- https://mvnrepository.com/artifact/ch.ethz.ganymed/ganymed-ssh2 -->
|
| | | <dependency>
|
| | | <groupId>ch.ethz.ganymed</groupId>
|
| | | <artifactId>ganymed-ssh2</artifactId>
|
| | | <version>build210</version>
|
| | | </dependency>
|
| | |
|
| | |
|
| | | </dependencies>
|
| | | </project>
|
File was renamed from fanli/src/main/java/com/yeshi/fanli/util/AppMarketUtil.java |
| | |
| | | package com.yeshi.fanli.util; |
| | | package org.yeshi.utils; |
| | | |
| | | import net.sf.json.JSONArray; |
| | | import net.sf.json.JSONObject; |
| | | import org.jsoup.Jsoup; |
| | | import org.jsoup.nodes.Document; |
| | | import org.yeshi.utils.HttpUtil; |
| | | |
| | | import java.io.IOException; |
| | | import java.net.URLEncoder; |
| | | |
| | | /** |
New file |
| | |
| | | package org.yeshi.utils; |
| | | |
| | | import ch.ethz.ssh2.Connection; |
| | | import ch.ethz.ssh2.Session; |
| | | import ch.ethz.ssh2.StreamGobbler; |
| | | |
| | | import java.io.*; |
| | | |
| | | /** |
| | | * 远程Linux系统命令执行 |
| | | */ |
| | | public class LinuxRemoteCommandUtil { |
| | | |
| | | private static String DEFAULTCHART = "UTF-8"; |
| | | |
| | | /** |
| | | * 登录主机 |
| | | * |
| | | * @return 登录成功返回true,否则返回false |
| | | */ |
| | | public static Connection login(String ip, |
| | | String userName, |
| | | String userPwd) { |
| | | boolean flg = false; |
| | | Connection conn = null; |
| | | try { |
| | | conn = new Connection(ip); |
| | | conn.connect();//连接 |
| | | flg = conn.authenticateWithPassword(userName, userPwd);//认证 |
| | | if (flg) { |
| | | return conn; |
| | | } |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return conn; |
| | | } |
| | | |
| | | /** |
| | | * 远程执行shll脚本或者命令 |
| | | * |
| | | * @param cmd 即将执行的命令 |
| | | * @return 命令执行完后返回的结果值 |
| | | */ |
| | | public static String execute(Connection conn, String cmd) { |
| | | String result = ""; |
| | | try { |
| | | if (conn != null) { |
| | | Session session = conn.openSession();//打开一个会话 |
| | | session.execCommand(cmd);//执行命令 |
| | | result = processStdout(session.getStdout(), DEFAULTCHART); |
| | | //如果为得到标准输出为空,说明脚本执行出错了 |
| | | if (StringUtil.isNullOrEmpty(result)) { |
| | | result = processStdout(session.getStderr(), DEFAULTCHART); |
| | | } |
| | | conn.close(); |
| | | session.close(); |
| | | } |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 解析脚本执行返回的结果集 |
| | | * |
| | | * @param in 输入流对象 |
| | | * @param charset 编码 |
| | | * @return 以纯文本的格式返回 |
| | | */ |
| | | private static String processStdout(InputStream in, String charset) { |
| | | InputStream stdout = new StreamGobbler(in); |
| | | StringBuffer buffer = new StringBuffer(); |
| | | try { |
| | | BufferedReader br = new BufferedReader(new InputStreamReader(stdout, charset)); |
| | | String line = null; |
| | | while ((line = br.readLine()) != null) { |
| | | buffer.append(line + "\n"); |
| | | } |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return buffer.toString(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * |
| | | * @param ip |
| | | * @param userName |
| | | * @param pwd |
| | | * @param cmd |
| | | * @throws Exception |
| | | */ |
| | | public static void execute(String ip, String userName, String pwd, String cmd) throws Exception { |
| | | Connection connection = login(ip, userName, pwd); |
| | | if (connection == null) |
| | | throw new Exception("登录失败"); |
| | | execute(connection, cmd); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package org.yeshi.utils; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | |
| | | public class UrlUtils { |
| | | |
| | | /** |
| | | * 解析文本中的链接 |
| | | * |
| | | * @param text |
| | | * @return |
| | | */ |
| | | public static List<String> parseUrlsFromText(String text) { |
| | | List<String> urlList = new ArrayList<>(); |
| | | String URL_REGEX = "(((http|https)://)|(www\\.))[a-zA-Z0-9\\._-]+\\.[a-zA-Z]{2,6}(:[0-9]{1,4})?(/[a-zA-Z0-9\\&%_\\./-~-]*)?"; |
| | | Pattern p = Pattern.compile(URL_REGEX); |
| | | Matcher matcher = p.matcher(text); |
| | | while (matcher.find()) { |
| | | String url = matcher.group(); |
| | | if (!StringUtil.isNullOrEmpty(url)) { |
| | | urlList.add(url); |
| | | } |
| | | } |
| | | return urlList; |
| | | } |
| | | } |
| | |
| | | <orderEntry type="library" name="Maven: org.apache.commons:commons-text:1.3" level="project" /> |
| | | <orderEntry type="library" name="Maven: commons-beanutils:commons-beanutils:1.9.3" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.commons:commons-collections4:4.2" level="project" /> |
| | | <orderEntry type="library" name="Maven: ch.ethz.ganymed:ganymed-ssh2:build210" level="project" /> |
| | | <orderEntry type="library" name="Maven: net.sf.ehcache:ehcache-core:2.6.11" level="project" /> |
| | | <orderEntry type="library" name="Maven: net.sf.ehcache:ehcache-web:2.0.4" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.springframework:spring-context:4.3.0.RELEASE" level="project" /> |