增加子账号操作

master
bynt 3 years ago
parent b7e633a087
commit 8ba6d06eb5

1
.gitignore vendored

@ -5,6 +5,7 @@ log/
logs/ logs/
### JetBrains template ### JetBrains template
.idea .idea
*.iml *.iml

@ -75,6 +75,11 @@ public class SellerAccountController {
} }
/**
* id
* @param accountId
* @return
*/
@GetMapping("/subAccount") @GetMapping("/subAccount")
@ApiOperation("父类查找子类集合") @ApiOperation("父类查找子类集合")
public CommonResult<List<SubAccountsVo>> getSubAccount(@RequestParam Long accountId) { public CommonResult<List<SubAccountsVo>> getSubAccount(@RequestParam Long accountId) {
@ -109,4 +114,14 @@ public class SellerAccountController {
return sellerAccountService.marketOrderTime(sellerAccountDTO); return sellerAccountService.marketOrderTime(sellerAccountDTO);
} }
@GetMapping("/getSubAccount")
@ApiOperation("获取子账号列表")
public CommonResult<SubAccountsVo> getSubAccount(@SellerUser SellerAccountDTO sellerAccountDTO) {
if (sellerAccountDTO == null) {
return new CommonResult<SubAccountsVo>().accountException();
}
return new CommonResult<SubAccountsVo>().success
(sellerAccountService.queryAccountByParentIdAndStatus(sellerAccountDTO.getParentId()));
}
} }

@ -2,10 +2,8 @@ package com.hchbox.controller;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.hchbox.entity.slaver.JdpTrade; import com.hchbox.entity.slaver.JdpTrade;
import com.hchbox.hander.TaoBaoHandler;
import com.hchbox.service.JdpTradeService; import com.hchbox.service.JdpTradeService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@ -13,7 +11,6 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @author Enzo * @author Enzo

@ -3,6 +3,7 @@ package com.hchbox;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.hchbox.api.TaoBaoApiClient;
import com.hchbox.config.MiProperties; import com.hchbox.config.MiProperties;
import com.hchbox.constant.TaoBaoDataMethodConstants; import com.hchbox.constant.TaoBaoDataMethodConstants;
import com.hchbox.entity.slaver.JdpTrade; import com.hchbox.entity.slaver.JdpTrade;
@ -13,8 +14,12 @@ import com.hchbox.uitl.TaoBaoEncryption;
import com.hchbox.util.CacheManagerUtil; import com.hchbox.util.CacheManagerUtil;
import com.taobao.api.ApiException; import com.taobao.api.ApiException;
import com.taobao.api.SecretException; import com.taobao.api.SecretException;
import com.taobao.api.TaobaoClient;
import com.taobao.api.domain.Trade; import com.taobao.api.domain.Trade;
import com.taobao.api.internal.util.TaobaoUtils; import com.taobao.api.internal.util.TaobaoUtils;
import com.taobao.api.request.JushitaJdpUsersGetRequest;
import com.taobao.api.response.JushitaJdpUsersGetResponse;
import com.taobao.api.response.ShopSellerGetResponse;
import com.taobao.api.response.TradeFullinfoGetResponse; import com.taobao.api.response.TradeFullinfoGetResponse;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@ -117,7 +122,9 @@ public class SlaverTest {
@Test @Test
public void getAccount() { public void getAccount() {
topTradeRepository.countByTid(2148563198943032631L); JushitaJdpUsersGetRequest req = new JushitaJdpUsersGetRequest();
JushitaJdpUsersGetResponse taoBaoResponse = TaoBaoApiClient.createTaoBaoResponse(req, miProperties, "50008100e30jK5wbSc8ckukKQhTQE6Ejt6l0WCiFQi1c897360XhQXFHMzjyzzpSep");
taoBaoResponse.getTotalResults();
} }
@ -144,7 +151,7 @@ public class SlaverTest {
@Test @Test
public void findUserList() { public void findUserList() {
taoBaoRdsPushService.turnOnPushService("50008400241xjDTcDePNGtjMCsvtS9byhUEIpESqjccFrgkxXi6Fe16809637nng5v",30L); taoBaoRdsPushService.turnOnPushService("50008501339rkqzU1HKxcsSCZgfw9kvVEFHtLWmTvAj5BrpAWqq11d46634A7sUO8u",2L);
} }
@Test @Test

@ -31,6 +31,10 @@ public class SendTemplate implements Serializable {
@ApiModelProperty(value = "用户id") @ApiModelProperty(value = "用户id")
private Long userId; private Long userId;
@Column(name = "template_name")
@ApiModelProperty(value = "模板名称")
private String templateName;
@CreationTimestamp @CreationTimestamp
@Column(name = "create_time") @Column(name = "create_time")
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")

@ -39,9 +39,10 @@ public interface SellerAccountRepository extends JpaRepository<SellerAccount, Lo
/** /**
* 使 * 使
* *
* @param status * @param status
* @param parentId
* @return * @return
*/ */
@Query("from SellerAccount where status = ?1 and parentId = ?2") @Query("from SellerAccount where status = ?1 and parentId = ?2")

@ -35,4 +35,22 @@ public interface JdpTradeRepository extends JpaRepository<JdpTrade, Integer>, Jp
*/ */
@Query(value = "select j from JdpTrade j where j.sellerNick = ?1 and j.jdpModified between ?2 and ?3") @Query(value = "select j from JdpTrade j where j.sellerNick = ?1 and j.jdpModified between ?2 and ?3")
List<JdpTrade> findJdpTradeByTimeAndNickname(String nickname, Date startTime, DateTime endTime); List<JdpTrade> findJdpTradeByTimeAndNickname(String nickname, Date startTime, DateTime endTime);
/**
*
* @param nickname
* @return
*/
@Query(value = "select count(j) from JdpTrade j where j.sellerNick = ?1")
Integer countSizeBySellerNick(String nickname);
/**
*
* @param nickname
* @param created
* @return
*/
@Query(value = "select count(j) from JdpTrade j where j.sellerNick = ?1 and j.created > ?2")
Integer countSizeBySellerNickAndTime(String nickname,Date created);
} }

@ -28,4 +28,19 @@ public interface JdpTradeService {
*/ */
List<JdpTrade> findJdpOrderByTimeAndNickName(String nickname, Date startTime, DateTime endTime); List<JdpTrade> findJdpOrderByTimeAndNickName(String nickname, Date startTime, DateTime endTime);
/**
*
* @param nickname
* @return
*/
Integer numberQueriesBySellerNick(String nickname);
/**
*
* @param nickname
* @param parse
* @return
*/
Integer numberQueriesBySellerNick(String nickname, DateTime parse);
} }

@ -92,10 +92,10 @@ public interface SellerAccountService {
/** /**
* id * id
* * @param parentId
* @return * @return
*/ */
List<SellerAccount> queryAccountByParentId(); List<SellerAccount> queryAccountByParentIdAndStatus(Long parentId);
/** /**
* id * id
@ -180,4 +180,5 @@ public interface SellerAccountService {
* @return * @return
*/ */
Boolean updateAccountStatusAndExpiration(Long id, int status, DateTime date); Boolean updateAccountStatusAndExpiration(Long id, int status, DateTime date);
} }

@ -76,6 +76,9 @@ public class AppSettingServiceImpl implements AppSettingService {
appSetting.setIsDeliveryRemind(vo.getDeliverRemind()); appSetting.setIsDeliveryRemind(vo.getDeliverRemind());
appSetting.setIsDistribution(vo.getEnableDistribution()); appSetting.setIsDistribution(vo.getEnableDistribution());
appSetting.setMemoContent(EmojiUtil.toAlias(vo.getSendMessage())); appSetting.setMemoContent(EmojiUtil.toAlias(vo.getSendMessage()));
if (!CollectionUtils.isEmpty(vo.getSendAccountId())) {
appSetting.setSendAccountIds(Joiner.on(StrUtil.COMMA).skipNulls().join(vo.getSendAccountId()));
}
if (!CollectionUtils.isEmpty(vo.getNotSendProduct())) { if (!CollectionUtils.isEmpty(vo.getNotSendProduct())) {
appSetting.setNotSendMerchandise(Joiner.on(StrUtil.COMMA).skipNulls().join(vo.getNotSendProduct())); appSetting.setNotSendMerchandise(Joiner.on(StrUtil.COMMA).skipNulls().join(vo.getNotSendProduct()));
} }
@ -107,6 +110,9 @@ public class AppSettingServiceImpl implements AppSettingService {
if (byUserIdAndType.getNotSendMerchandise() != null) { if (byUserIdAndType.getNotSendMerchandise() != null) {
appConfigVo.setNotSendProduct(Convert.toList(Long.class, byUserIdAndType.getNotSendMerchandise().split(StrUtil.COMMA))); appConfigVo.setNotSendProduct(Convert.toList(Long.class, byUserIdAndType.getNotSendMerchandise().split(StrUtil.COMMA)));
} }
if (byUserIdAndType.getSendAccountIds() != null) {
appConfigVo.setSendAccountId(Convert.toList(Long.class, byUserIdAndType.getSendAccountIds().split(StrUtil.COMMA)));
}
if (byUserIdAndType.getNotSendFlagStr() != null) { if (byUserIdAndType.getNotSendFlagStr() != null) {
appConfigVo.setNotSendFlag(Convert.toList(Integer.class, byUserIdAndType.getNotSendFlagStr().split(StrUtil.COMMA))); appConfigVo.setNotSendFlag(Convert.toList(Integer.class, byUserIdAndType.getNotSendFlagStr().split(StrUtil.COMMA)));
} }

@ -28,7 +28,18 @@ public class JdpTradeServiceImpl implements JdpTradeService {
} }
@Override @Override
public List<JdpTrade> findJdpOrderByTimeAndNickName(String nickname, Date startTime, DateTime endTime) { public List<JdpTrade> findJdpOrderByTimeAndNickName(String nickname, Date startTime, DateTime endTime) {
return jdpTradeRepository.findJdpTradeByTimeAndNickname(nickname, startTime, endTime); return jdpTradeRepository.findJdpTradeByTimeAndNickname(nickname, startTime, endTime);
} }
@Override
public Integer numberQueriesBySellerNick(String nickname) {
return jdpTradeRepository.countSizeBySellerNick(nickname);
}
@Override
public Integer numberQueriesBySellerNick(String nickname, DateTime parse) {
return jdpTradeRepository.countSizeBySellerNickAndTime(nickname, parse);
}
} }

@ -14,6 +14,7 @@ import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONArray; import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject; import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.google.common.collect.Lists;
import com.hchbox.config.MiProperties; import com.hchbox.config.MiProperties;
import com.hchbox.constant.AuthConstants; import com.hchbox.constant.AuthConstants;
import com.hchbox.constant.DefaultNumberConstants; import com.hchbox.constant.DefaultNumberConstants;
@ -242,6 +243,7 @@ public class SellerAccountServiceImpl implements SellerAccountService {
account.setIsSubAccount(Boolean.TRUE); account.setIsSubAccount(Boolean.TRUE);
return getSaveMapCommonResult(request, account); return getSaveMapCommonResult(request, account);
} }
subAccount.setShopTitle(shop.getTitle());
subAccount.setIsSubAccount(Boolean.TRUE); subAccount.setIsSubAccount(Boolean.TRUE);
subAccount.setLastLoginTime(DateUtil.date()); subAccount.setLastLoginTime(DateUtil.date());
subAccount.setSessionKey(loginVo.getAccessToken()); subAccount.setSessionKey(loginVo.getAccessToken());
@ -312,9 +314,12 @@ public class SellerAccountServiceImpl implements SellerAccountService {
} }
@Override @Override
public List<SellerAccount> queryAccountByParentId() { public List<SellerAccount> queryAccountByParentIdAndStatus(Long parentId) {
return sellerAccountRepository.findByParentIdAndStatus(DefaultNumberConstants.ONE_NUMBER, List<SellerAccount> byParentIdAndStatus = sellerAccountRepository.findByParentIdAndStatus(DefaultNumberConstants.ONE_NUMBER, parentId);
(long) DefaultNumberConstants.ZERO_NUMBER); if (!CollectionUtils.isEmpty(byParentIdAndStatus)){
return Convert.toList(SellerAccount.class, byParentIdAndStatus);
}
return Lists.newArrayList();
} }
@Override @Override

@ -1,16 +1,14 @@
package com.hchbox.service.impl; package com.hchbox.service.impl;
import cn.hutool.extra.emoji.EmojiUtil; import cn.hutool.extra.emoji.EmojiUtil;
import cn.hutool.json.JSONUtil;
import com.hchbox.constant.DefaultNumberConstants; import com.hchbox.constant.DefaultNumberConstants;
import com.hchbox.dto.SellerAccountDTO; import com.hchbox.dto.SellerAccountDTO;
import com.hchbox.entity.master.Blacklist;
import com.hchbox.entity.master.SendTemplate; import com.hchbox.entity.master.SendTemplate;
import com.hchbox.model.param.CommonResult; import com.hchbox.model.param.CommonResult;
import com.hchbox.repository.master.SendTemplateRepository; import com.hchbox.repository.master.SendTemplateRepository;
import com.hchbox.service.SendTemplateService; import com.hchbox.service.SendTemplateService;
import com.hchbox.util.PageUtil; import com.hchbox.util.PageUtil;
import com.hchbox.util.QueryHelp;
import com.hchbox.vo.taobao.TemplateSearchVo;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
@ -30,6 +28,7 @@ public class SendTemplateServiceImpl implements SendTemplateService {
@Override @Override
public boolean saveTemplate(SellerAccountDTO sellerAccountDTO, SendTemplate sendTemplate) { public boolean saveTemplate(SellerAccountDTO sellerAccountDTO, SendTemplate sendTemplate) {
log.info("============= the template as {} ============", JSONUtil.toJsonStr(sendTemplate));
sendTemplate.setUserId(sellerAccountDTO.getParentId() sendTemplate.setUserId(sellerAccountDTO.getParentId()
!= DefaultNumberConstants.ZERO_NUMBER ? != DefaultNumberConstants.ZERO_NUMBER ?
sellerAccountDTO.getParentId() : sellerAccountDTO.getParentId() :

@ -60,11 +60,11 @@ public class TaskMessageServiceImpl implements TaskMessageService {
private final BlacklistService blacklistService; private final BlacklistService blacklistService;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public CommonResult<String> createTaskSendMessage(SubmitSendMessageVo submitSendMessageVo, SellerAccountDTO sellerAccount) { public CommonResult<String> createTaskSendMessage(SubmitSendMessageVo submitSendMessageVo, SellerAccountDTO sellerAccount) {
List<String> list = new ArrayList<>();
HashMap<String, Object> hashMap = new HashMap<>(DefaultNumberConstants.SIXTEEN_NUMBER);
// Validated 已做校验 // Validated 已做校验
int sendSize = submitSendMessageVo.getBuyerInfoList().size(); int sendSize = submitSendMessageVo.getBuyerInfoList().size();
// 超出时间范围 // 超出时间范围
@ -113,7 +113,18 @@ public class TaskMessageServiceImpl implements TaskMessageService {
message, submitSendMessageVo.getBuyerInfoList(), message, submitSendMessageVo.getBuyerInfoList(),
submitSendMessageVo.getOrderTidList()); submitSendMessageVo.getOrderTidList());
}); });
return new CommonResult<String>().success(submitSendMessageVo.getBuyerInfoList()); submitSendMessageVo.getBuyerInfoList().forEach(info -> {
if (submitSendMessageVo.getMessageInfo().contains(RemindTemplates.BUYER_NICK)) {
list.add(RemindTemplates.prepareMsg(submitSendMessageVo.getMessageInfo(), info));
}
if (submitSendMessageVo.getMessageInfo().contains(RemindTemplates.SHOP_NAME)) {
list.add(RemindTemplates.prepareMsg(submitSendMessageVo.getMessageInfo(), sellerAccount.getShopTitle()));
}
});
hashMap.put("sendList", list);
hashMap.put("buyerInfoList", submitSendMessageVo.getBuyerInfoList());
return new CommonResult<String>().success(hashMap);
} }
return new CommonResult<String>(). return new CommonResult<String>().
forbidden(ResponseCode.SAVE_INFORMATION_FAILED.getDesc()); forbidden(ResponseCode.SAVE_INFORMATION_FAILED.getDesc());
@ -198,11 +209,11 @@ public class TaskMessageServiceImpl implements TaskMessageService {
// 拼接参数 // 拼接参数
String concat = sellerAccountDTO.getId().toString() String concat = sellerAccountDTO.getId().toString()
.concat(StrUtil.DASHED) .concat(StrUtil.DASHED)
.concat(format .concat(format
.concat(StrUtil.DASHED) .concat(StrUtil.DASHED)
.concat(String.valueOf(minuteInt))); .concat(String.valueOf(minuteInt)));
Map<String,String> sendMessageCache = cacheManagerUtil.getCache(MessageConstants.SEND_MESSAGE_KEY, concat); Map<String, String> sendMessageCache = cacheManagerUtil.getCache(MessageConstants.SEND_MESSAGE_KEY, concat);
// 删除缓存 // 删除缓存
if (!CollectionUtils.isEmpty(sendMessageCache)) { if (!CollectionUtils.isEmpty(sendMessageCache)) {
cacheManagerUtil.evictCache(MessageConstants.SEND_MESSAGE_KEY, concat); cacheManagerUtil.evictCache(MessageConstants.SEND_MESSAGE_KEY, concat);

@ -6,6 +6,7 @@ import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.emoji.EmojiUtil; import cn.hutool.extra.emoji.EmojiUtil;
import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.dynamic.datasource.annotation.DS;
@ -349,7 +350,7 @@ public class TopTradeServiceImpl implements TopTradeService {
} }
// 2. 查询可发送子账号 // 2. 查询可发送子账号
List<String> subNickList = sellerAccountService.findSubAccountBySellerNick(sellerAccount.getId()); List<String> subNickList = sellerAccountService.findSubAccountBySellerNick(sellerAccount.getId());
if (CollectionUtils.isEmpty(subNickList)) { if (CollectionUtils.isEmpty(subNickList) || StrUtil.isBlank(setting.getSendAccountIds())) {
log.error("================= the sub-account collection is empty ================="); log.error("================= the sub-account collection is empty =================");
return Boolean.TRUE; return Boolean.TRUE;
} }
@ -380,12 +381,12 @@ public class TopTradeServiceImpl implements TopTradeService {
private void sendMessageRemind(Integer type, String buyerNick, Long tid, String orderStatus, String template, AppSetting setting, List<String> sendNickList, SellerAccountDTO sellerAccountDTO) { private void sendMessageRemind(Integer type, String buyerNick, Long tid, String orderStatus, String template, AppSetting setting, List<String> sendNickList, SellerAccountDTO sellerAccountDTO) {
TopTrade trade = topTradeRepository.findByTid(1434820972683809364L); TopTrade trade = topTradeRepository.findByTid(tid);
if (trade != null) { if (trade != null) {
// 修改订单状态 // 修改订单状态
updateOrderStatus(type, buyerNick, orderStatus, trade); updateOrderStatus(type, buyerNick, orderStatus, trade);
List<TopOrder> orderList = topOrderRegistry.findByTid(1434820972683809364L); List<TopOrder> orderList = topOrderRegistry.findByTid(tid);
if (!CollectionUtils.isEmpty(orderList)) { if (!CollectionUtils.isEmpty(orderList)) {
trade.setOrders(orderList); trade.setOrders(orderList);
} }
@ -428,8 +429,12 @@ public class TopTradeServiceImpl implements TopTradeService {
// 创建任务详情信息 // 创建任务详情信息
createTaskMessageInfo(prepareMsg, setting, sendNickList, trade, taskMessageId); createTaskMessageInfo(prepareMsg, setting, sendNickList, trade, taskMessageId);
List<Long> longs = Convert.toList(Long.class, setting.getSendAccountIds().split(StrUtil.COMMA));
// 放入缓存 // 放入缓存
String timeFormat = sellerAccountDTO.getId() String timeFormat = RandomUtil.randomEle(longs)
.toString() .toString()
.concat(StrUtil.DASHED) .concat(StrUtil.DASHED)
.concat(TimeUtil.timeFormat()); .concat(TimeUtil.timeFormat());

@ -2,8 +2,10 @@ package com.hchbox.task;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.hchbox.constant.DefaultNumberConstants; import com.hchbox.constant.DefaultNumberConstants;
import com.hchbox.constant.TimeConstants;
import com.hchbox.entity.master.SellerAccount; import com.hchbox.entity.master.SellerAccount;
import com.hchbox.repository.master.SellerAccountRepository; import com.hchbox.repository.master.SellerAccountRepository;
import com.hchbox.service.JdpTradeService;
import com.hchbox.service.SellerAccountService; import com.hchbox.service.SellerAccountService;
import com.hchbox.service.TaoBaoRdsPushService; import com.hchbox.service.TaoBaoRdsPushService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@ -14,6 +16,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Objects;
/** /**
* @author Enzo * @author Enzo
@ -30,10 +33,13 @@ public class AccountTask {
private final TaoBaoRdsPushService taoBaoRdsPushService; private final TaoBaoRdsPushService taoBaoRdsPushService;
private final JdpTradeService jdpTradeService;
/** /**
* *
*/ */
@Scheduled(cron = " 0 1 0 * * ?") @Scheduled(cron = "0 1 0 * * ?")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void deleteAccountAfterExpirationTime() { public void deleteAccountAfterExpirationTime() {
List<SellerAccount> sellerAccounts = List<SellerAccount> sellerAccounts =
@ -62,4 +68,31 @@ public class AccountTask {
} }
} }
@Scheduled(cron = "0 0 1 * * ?")
public void updateAccountMassNum() {
List<SellerAccount> sellerAccounts =
sellerAccountRepository.findAllByParentId((long) DefaultNumberConstants.ZERO_NUMBER);
for (SellerAccount account : sellerAccounts) {
Integer countNum = jdpTradeService.numberQueriesBySellerNick(account.getNickname());
if (account.getId().equals(DefaultNumberConstants.COLORFUL_PUZZLE_NUMBER)) {
countNum = jdpTradeService.numberQueriesBySellerNick(account.getNickname(),
DateUtil.parse(TimeConstants.COLORFUL_PUZZLE_DATE));
}
if (countNum > DefaultNumberConstants.ZERO_NUMBER) {
sellerAccountService.updateMessageCount(account.getId(), countNum);
if (account.getMassNum() != null
&& account.getMassNum() > DefaultNumberConstants.ZERO_NUMBER
&& countNum > account.getMassNum()) {
// 删除数据推送
taoBaoRdsPushService.deletePushUser(account.getNickname());
// 修改账号状态
sellerAccountService.updateAccountStatusAndExpiration
(account.getId(), DefaultNumberConstants.MINUS_ONE_NUMBER, DateUtil.date());
}
}
}
}
} }

@ -24,6 +24,7 @@ import lombok.Getter;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.Setter; import lombok.Setter;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
@ -67,6 +68,10 @@ public class SyncTask {
private Date lastUpdateTime; private Date lastUpdateTime;
@Value("${system.flag}")
private Boolean flag;
/** /**
* 10 * 10
*/ */
@ -74,21 +79,23 @@ public class SyncTask {
@Scheduled(cron = "0 0/10 * * * *") @Scheduled(cron = "0 0/10 * * * *")
// @Scheduled(cron = "0 0/1 * * * *") // @Scheduled(cron = "0 0/1 * * * *")
public void pullOrdersRegularly() throws ApiException, SecretException, NoSuchFieldException, IllegalAccessException { public void pullOrdersRegularly() throws ApiException, SecretException, NoSuchFieldException, IllegalAccessException {
long startTime = System.currentTimeMillis(); if (flag != null && flag) {
log.info("====== [ the pull order start the time as {} ] ======", startTime); long startTime = System.currentTimeMillis();
DateTime date = DateUtil.date(); log.info("====== [ the pull order start the time as {} ] ======", startTime);
if (count.get() > DefaultNumberConstants.ZERO_NUMBER) { DateTime date = DateUtil.date();
// 超时判断时间 if (count.get() > DefaultNumberConstants.ZERO_NUMBER) {
if (lastUpdateTime != null && DateUtil.offsetMinute // 超时判断时间
(date, -DefaultNumberConstants.FIFTEEN_NUMBER).before(lastUpdateTime)) { if (lastUpdateTime != null && DateUtil.offsetMinute
return; (date, -DefaultNumberConstants.FIFTEEN_NUMBER).before(lastUpdateTime)) {
return;
}
// 初始化参数
count.addAndGet(DefaultNumberConstants.ZERO_NUMBER);
} }
// 初始化参数 syncOrder(date);
count.addAndGet(DefaultNumberConstants.ZERO_NUMBER); long endTime = System.currentTimeMillis();
log.info("====== [ the pull order end time consuming as {} ] ======", endTime - startTime);
} }
syncOrder(date);
long endTime = System.currentTimeMillis();
log.info("====== [ the pull order end time consuming as {} ] ======", endTime - startTime);
} }
@ -145,22 +152,6 @@ public class SyncTask {
memberService.synMemberByTrade(syncTask); memberService.synMemberByTrade(syncTask);
} }
} }
// 修改同步数量
int messageCount = sellerAccount.getMessageCount() != null ?
sellerAccount.getMessageCount() : DefaultNumberConstants.ZERO_NUMBER;
int totalAmount = messageCount + trades.size();
sellerAccountService.updateMessageCount(sellerAccount.getId(), totalAmount);
if (sellerAccount.getMassNum() != null
&& sellerAccount.getMassNum() > DefaultNumberConstants.ZERO_NUMBER
&& totalAmount > sellerAccount.getMassNum()) {
log.info("======================== the massNum as {} trades size as {} ==================",
sellerAccount.getMassNum(), trades.size());
// 删除数据推送
taoBaoRdsPushService.deletePushUser(sellerNick);
// 修改账号状态
sellerAccountService.updateAccountStatusAndExpiration
(sellerAccount.getId(), DefaultNumberConstants.MINUS_ONE_NUMBER, DateUtil.date());
}
} }
} }
} }

@ -127,4 +127,24 @@ public class RemindTemplates {
} }
/**
* 使
*
* @param template template
* @return
*/
public static String prepareMsg(String template, String replaceString) {
if (StringUtils.isBlank(template)) {
return template;
}
// 订单预付款
template = template.replace(RemindTemplates.BUYER_NICK, replaceString);
// 订单预付款
template = template.replace(RemindTemplates.SHOP_NAME, replaceString);
return template;
}
} }

@ -2,11 +2,13 @@ package com.hchbox.module.entity;
import com.hchbox.model.entity.BaseTrade; import com.hchbox.model.entity.BaseTrade;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import javax.persistence.*; import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable; import java.io.Serializable;
/** /**

@ -117,4 +117,11 @@ public class DefaultNumberConstants {
public static final String NAT_DELIM = "%"; public static final String NAT_DELIM = "%";
/**
*
*/
public static final Long COLORFUL_PUZZLE_NUMBER = 12576L;
} }

@ -22,5 +22,14 @@ public class TimeConstants {
public static final String YYYY_MM_DD_HH = "yyyy-MM-dd HH"; public static final String YYYY_MM_DD_HH = "yyyy-MM-dd HH";
/**
*
*/
public static final String COLORFUL_PUZZLE_DATE = "2021-11-23 00:00:00";
} }

@ -218,9 +218,9 @@ public class BaseAppSetting implements Serializable {
@ApiModelProperty("好评订单不发送") @ApiModelProperty("好评订单不发送")
private Boolean enableGoodOrder; private Boolean enableGoodOrder;
@Column(name = "send_account_id") @Column(name = "send_account_ids")
@ApiModelProperty("发送账号信息") @ApiModelProperty("发送账号信息")
private Long sendAccountId; private String sendAccountIds;
} }

@ -4,7 +4,6 @@ package com.hchbox.vo;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.persistence.Column;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;

@ -113,7 +113,7 @@ public class AppConfigVo {
private List<Integer> notSendFlag; private List<Integer> notSendFlag;
@ApiModelProperty("发送账号id") @ApiModelProperty("发送账号id")
private Long sendAccountId; private List<Long> sendAccountId;
@ApiModelProperty(value = "发送开始时间小时") @ApiModelProperty(value = "发送开始时间小时")
private Integer sendHourStart; private Integer sendHourStart;

@ -13,6 +13,7 @@ import java.util.Date;
@Data @Data
public class SubAccountsVo { public class SubAccountsVo {
private Long id;
private Long parentId; private Long parentId;
private String nickname; private String nickname;
private Integer status; private Integer status;

@ -33,7 +33,7 @@ spring:
nacos: nacos:
discovery: discovery:
server-addr: ${NACOS_HOST:172.26.59.86}:${NACOS_PORT:8848} server-addr: ${NACOS_HOST:172.26.59.86}:${NACOS_PORT:8848}
# server-addr: ${NACOS_HOST:118.178.137.129}:${NACOS_PORT:8848} #server-addr: ${NACOS_HOST:172.26.59.87}:${NACOS_PORT:8848}
gateway: gateway:
#网关动态路由 #网关动态路由

Loading…
Cancel
Save