[Asm] 纯文本查看 复制代码
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xmyr.automaticscript.common.Constants;
import com.xmyr.automaticscript.dto.JdTrialProductDTO;
import com.xmyr.automaticscript.entity.User;
import com.xmyr.automaticscript.entity.jd.JdTrialProduct;
import com.xmyr.automaticscript.mapper.JdTrialProductMapper;
import com.xmyr.automaticscript.service.IUserService;
import com.xmyr.automaticscript.service.impl.jd.JdTrialProductServiceImpl;
import com.xmyr.automaticscript.service.jd.IJdMallService;
import com.xmyr.automaticscript.service.jd.IJdTrialProductService;
import com.xmyr.automaticscript.service.jpk.IJpkService;
import com.xmyr.automaticscript.utils.JdApplyTrialUtils;
import com.xmyr.automaticscript.vo.jd.JdFreeTrialProductVO;
import com.xmyr.automaticscript.vo.jd.JdTrialProductVO;
import java.io.IOException;
import java.lang.invoke.SerializedLambda;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
@Service
public class JdTrialProductServiceImpl extends ServiceImpl<JdTrialProductMapper, JdTrialProduct> implements IJdTrialProductService {
private static final Logger log = LoggerFactory.getLogger(JdTrialProductServiceImpl.class);
@Value("${spring.profiles.active}")
private String profilesActive;
@Autowired
private JdApplyTrialUtils jdApplyTrialUtils;
@Autowired
private IUserService userService;
@Autowired
private IJpkService jpkService;
@Autowired
@Lazy
private IJdMallService jdMallService;
public Boolean addProduct(JdTrialProductDTO dto) {
if (!StringUtils.hasText(dto.getSku()))
return Boolean.valueOf(false);
LambdaQueryWrapper<JdTrialProduct> jdTrialProductLambdaQueryWrapper = new LambdaQueryWrapper();
jdTrialProductLambdaQueryWrapper.eq(JdTrialProduct::getSku, dto.getSku());
List<JdTrialProduct> dbJdTrialProductList = list((Wrapper)jdTrialProductLambdaQueryWrapper);
if (dbJdTrialProductList.size() > 0) {
log.info("{}, dto.getSku());
return Boolean.valueOf(false);
}
JdTrialProduct jdTrialProduct = new JdTrialProduct();
BeanUtils.copyProperties(dto, jdTrialProduct);
LambdaQueryWrapper<JdTrialProduct> lqw = new LambdaQueryWrapper();
((LambdaQueryWrapper)lqw.eq(JdTrialProduct::getFindType, Integer.valueOf(2)))
.lt(JdTrialProduct::getTrialActivityId, Integer.valueOf(10000));
lqw.orderByDesc(JdTrialProduct::getTrialActivityId);
lqw.last(" limit 0,1");
JdTrialProduct maxJdTrialProduct = (JdTrialProduct)getOne((Wrapper)lqw);
jdTrialProduct.setTrialActivityId(Long.valueOf(maxJdTrialProduct.getTrialActivityId().longValue() + 1L));
if (dto.getActivityTimeArr() != null) {
jdTrialProduct.setActivityStartTime(dto.getActivityTimeArr()[0]);
jdTrialProduct.setActivityEndTime(dto.getActivityTimeArr()[1]);
}
JSONObject infoJSONObject = this.jdMallService.getInfoBySku(dto.getSku());
Long shopId = null;
if (infoJSONObject.containsKey("shopInfo")) {
JSONObject shopInfoJSONObject = infoJSONObject.getJSONObject("shopInfo");
if (shopInfoJSONObject.containsKey("shop")) {
JSONObject shopJSONObject = shopInfoJSONObject.getJSONObject("shop");
if (shopJSONObject.containsKey("shopId"))
shopId = shopJSONObject.getLong("shopId");
}
}
jdTrialProduct.setShopInfo("{\"shopId\":" + shopId + "}");
String skuTitle = "";
if (infoJSONObject.containsKey("wareInfo")) {
JSONObject wareInfoJSONObject = infoJSONObject.getJSONObject("wareInfo");
if (wareInfoJSONObject.containsKey("wname"))
skuTitle = wareInfoJSONObject.getString("wname");
}
jdTrialProduct.setSkuTitle(skuTitle);
BigDecimal jdPrice = BigDecimal.TEN;
if (infoJSONObject.containsKey("price")) {
JSONObject priceJSONObject = infoJSONObject.getJSONObject("price");
if (priceJSONObject.containsKey("op"))
jdPrice = priceJSONObject.getBigDecimal("op");
}
jdTrialProduct.setJdPrice(jdPrice);
String skuImgUrl = "";
if (infoJSONObject.containsKey("wareInfo")) {
JSONObject wareInfoJSONObject = infoJSONObject.getJSONObject("wareInfo");
if (wareInfoJSONObject.containsKey("imageurl"))
skuImgUrl = wareInfoJSONObject.getString("imageurl");
}
jdTrialProduct.setSkuImg(skuImgUrl);
jdTrialProduct.setType(Integer.valueOf(1));
jdTrialProduct.setFindType(Integer.valueOf(2));
jdTrialProduct.setActivityType(Integer.valueOf(21));
jdTrialProduct.setTagList("[]");
jdTrialProduct.setOrderPriceTip(");
jdTrialProduct.setApplyState(Integer.valueOf(0));
jdTrialProduct.setProbability(new BigDecimal(100));
jdTrialProduct.setCreateTime(new Date());
jdTrialProduct.setUpdateTime(new Date());
String materialUrl = "https://item.jd.com/" + dto.getSku() + ".html";
String goodsLink = this.jpkService.getGoodsLink(materialUrl);
if (StringUtils.hasText(goodsLink)) {
jdTrialProduct.setShortUrl(goodsLink);
} else {
jdTrialProduct.setShortUrl(materialUrl);
}
return Boolean.valueOf(save(jdTrialProduct));
}
public Boolean updateProduct(JdTrialProductDTO dto) {
JdTrialProduct updateProduct = new JdTrialProduct();
updateProduct.setId(dto.getId());
updateProduct.setSkuTitle(dto.getSkuTitle());
updateProduct.setActivityStartTime(dto.getActivityTimeArr()[0]);
updateProduct.setTrialPrice(dto.getTrialPrice());
updateProduct.setJdPrice(dto.getJdPrice());
updateProduct.setSupplyNum(dto.getSupplyNum());
updateProduct.setNotified(Integer.valueOf(0));
return Boolean.valueOf(updateById(updateProduct));
}
public String applyFreeTrialProduct(Long userId) throws Exception {
try {
User user = (User)this.userService.getById(userId);
List<JdTrialProduct> jdTrialProductList = listTodayFreeProduct(false);
int applySuccessNum = 1;
for (int i = 0; i < jdTrialProductList.size(); i++) {
String nowDateStr = Constants.DATE_FORMAT.sdf1.format(new Date());
if (nowDateStr.contains("23:59")) {
log.info(");
break;
}
Long trialActivityId = ((JdTrialProduct)jdTrialProductList.get(i)).getTrialActivityId();
this.userService.update((Wrapper)((LambdaUpdateWrapper)(new LambdaUpdateWrapper()).set(User::getStartActivityId, trialActivityId))
.eq(User::getId, userId));
String resMsg = this.jdApplyTrialUtils.openBrowerTpApplyJD(trialActivityId, user);
if (resMsg.contains(") || resMsg.contains("))
break;
if (resMsg.contains(")) {
log.info(");
break;
}
if (StringUtils.hasText(resMsg))
if (".equals(resMsg)) {
log.info("{}, Integer.valueOf(applySuccessNum));
applySuccessNum++;
if (applySuccessNum == user.getMaxAllowApplyNum().intValue())
break;
}
}
} catch (Exception e) {
log.error(e.getMessage());
}
return ";
}
public Boolean removeNotActive() {
LambdaQueryWrapper<JdTrialProduct> lambdaQueryWrapper = new LambdaQueryWrapper();
((LambdaQueryWrapper)lambdaQueryWrapper.le(JdTrialProduct::getActivityEndTime, new Date()))
.eq(JdTrialProduct::getFindType, Integer.valueOf(2));
return Boolean.valueOf(remove((Wrapper)lambdaQueryWrapper));
}
public List<JdTrialProduct> listJdTrialProductInfoVOByCategoryTabId(Long tabId, Integer maxPage, BigDecimal minJdPrice, BigDecimal maxJdPrice, Integer isOnlyFree) {
List<JdTrialProduct> jdTrialProductList = new ArrayList<>();
int page = 1;
for (int i = 0; i < maxPage.intValue(); i++) {
String url = "https://api.m.jd.com/client.action?ext=%7B%22prstate%22%3A%220%22%7D&appid=newtry&functionId=try_feedsList&uuid=fd482c4a0dc6a849846f151249441f9594fa7cf7&clientVersion=11.1.4&client=wh5&osVersion=15.0.1&area=12_988_3444_53580&networkType=4g&body=%7B%22tabId%22%3A%22" + tabId + "%22%2C%22page%22%3A" + page + "%2C%22version%22%3A2%2C%22source%22%3A%22default%22%2C%22client%22%3A%22app%22%7D&h5st=" + Constants.DATE_FORMAT.sdf1.format(new Date()) + "%3B0084765139430493%3B8f1e3%3Btk02w8a9b1b8418nVCrtEz5DF9sE88miGRls1IJzdDNTGChpWy3c01VAVnl2%2F1lQmJut3cMQ%2F8sIg%2BnjUaQkzOQ%2BZj3r%3B937d6b4176efb1db74e2fbae1fcb929c23eeb574ad947d4338ec2421dc5e6cf8%3B3.1%3B1659666111050%3B7414c4e56278580a133b60b72a30beb2764d2e61c66a5620e8e838e06644d1bf774833cd07ccf84ad345117cd09f284bd39b17eee6417aff7449c0de8c6d8c5bfff85fb69264c670d2fa3bbbd0a90a6d6e0887e874dffd13173367c8dba73cf8742af60de486571240a32d8db616d7bcd4b603c86e0e2dff44d9cc42883c70960ed81d054af84c477f6875d852891ff9";
HttpPost httpPost = new HttpPost(url);
String cookie = "warehistory=\"10042778271669,10046700206773,\"; __jda=122270672.1658218416888975560341.1658218416.1659598034.1659674803.8; __jdv=76161171|baidu|-|organic|notset|1659438126970; shshshfp=d72a89e790cf42f96ba0d98d06799af5; shshshfpa=e0f003bf-b36d-0b71-f734-19510e2caa83-1658218418; shshshfpb=hKtAtVjDZd0i9IEcWC-nk7Q; autoOpenApp_downCloseDate_autoOpenApp_autoPromptly=1658218443471_1; areaId=12; ipLoc-djd=12-988-993-58088; __jdu=1658218416888975560341; PCSYCityID=CN_320000_320500_0; jcap_dvzw_fp=U47RNmXI3XPi9YBsE9lR3E2auyPv9tubV5Tgo-orfdcRVcWnVfhBL2-isJKTutjOWq9lSA==; whwswswws=; TrackID=1lLsQ87UzI00lpQ_Wq-ms5Nig89wnyQxbjT2xeCEAegCu-LoNHcwoWCGSB7XQrdm5VEQkSYV6MXNuJ3DLnaE0ivPTHQ7wm3kDjFzuvlTDz0E3y8udSsUqrruFNpOCx0ys; pinId=HUsE7t77ZfkZXCyUu9WFkrV9-x-f3wj7; pin=jd_7f025329f289e; unick=jd_130834mgl; _tp=rOagJz4aVQr%2BGYo%2BQHOZfZCZTOcmtwKnJJMjKT3X7CM%3D; _pst=jd_7f025329f289e; user-key=33f68cbc-3814-4fc4-bc46-4281a9fb5aeb; unpl=JF8EAKBnNSttURxcUEtVExtES10AWwlaQ0cLaTNQBFxcGwYBTFFMRkN7XlVdXhRKHh9uZBRUVFNIVQ4aBisSEXteV19ZC0oVCmpXNWReWHtVNRsFHxsTS1RRXloBQh4LaWMBU1xaTlQ1KwUbGyB7bVddXAxLHgFsYTVVbVhMVQMZAh4XEEltHzBcRUsQB2ZkBV1YWExdDBIKHRYUTFxWW104SicA; __jdc=122270672; wlfstk_smdl=h2kp3tvfwulat7cfh3qm331zoj6mcu0t; __jdb=122270672.9.1658218416888975560341|8.1659674803; wxa_level=1; retina=1; cid=9; wqmnx1=MDEyNjM5NHMuL2RkczI2NzdwYS4yMmxpUCBsT2w2KGkpL28xaTcyYTNPTyZI; jxsid=16596748117627599547; appCode=ms0ca95114; webp=1; mba_muid=1658218416888975560341; mba_sid=16596748138636610750743361579.7; visitkey=54828158590626066; __wga=1659674861678.1659674818207.1659674818207.1659674818207.3.1; PPRD_P=UUID.1658218416888975560341; jxsid_s_t=1659674861714; jxsid_s_u=https%3A//trade.m.jd.com/order/orderlist_jdm.shtml; shshshsID=34c185e1e58a3176a9770e86854db263_4_1659674861858; sc_width=428; _gia_s_local_fingerprint=517d024fb5324d3fadebe43072b126d9; equipmentId=CSKASYYQKS2KYHOTNTQR6D7UQBB23CT4MUYGYYICYYUCX3S3CMY3REYHB2YZOCBPERI5R54G6RZODNHMGNS5BX3YA4; fingerprint=517d024fb5324d3fadebe43072b126d9; deviceVersion=604.1; deviceOS=ios; deviceOSVersion=14.6; deviceName=Safari; 3AB9D23F7A4B3C9B=CSKASYYQKS2KYHOTNTQR6D7UQBB23CT4MUYGYYICYYUCX3S3CMY3REYHB2YZOCBPERI5R54G6RZODNHMGNS5BX3YA4; TrackerID=iFCIIja6AGpYE6iKeo9ntJvAhucMCwd2Vk2ARVtmVYRQHlye_gCjb8EsZ-vl2OA9ibsNMyOzr4nWmyWEBAfmFks7YQQ80ZRa19nuhcXrWFVGfbp1UaXoMl0ll8bw4Li6vkJPi4cmtSUmJ_X3wqrV9w; pt_key=AAJi7KDmADAyaHotVF_rRzzUZ8fIRf-kywvdN7Td5sLF8gg6GTIDLixOhNj8bmxo3DhYJ4RQn0g; pt_pin=jd_7f025329f289e; pt_token=6ur3flxf; pwdt_id=jd_7f025329f289e; sfstoken=tk01md2081bfaa8sMSszZk1NY2krRuHI0GZbIlythlcamFf7LsAumWai1lHnHoK7JaVzgf+X6cN46F9oV4D8LLOlKA1C; __jd_ref_cls=MOdCenter_OrderList_Tab";
httpPost.setHeader("Host", "api.m.jd.com");
httpPost.setHeader("Origin", "https://prodev.m.jd.com");
httpPost.setHeader("User-Agent", "JD4iPhone/168210%20(iPhone;%20iOS;%20Scale/3.00)");
httpPost.setHeader("Cookie", cookie);
try {
Thread.sleep(1000L);
CloseableHttpClient closeableHttpClient = HttpClients.createDefault();
try {
CloseableHttpResponse closeableHttpResponse = closeableHttpClient.execute((HttpUriRequest)httpPost);
String result = EntityUtils.toString(closeableHttpResponse.getEntity());
log.info("{}{}{}", new Object[] { tabId, Integer.valueOf(page), result });
if (StringUtils.hasText(result)) {
JSONObject resJSONObject = JSONObject.parseObject(result);
JSONObject dataJSONObject = resJSONObject.getJSONObject("data");
JSONArray feedListJSONArray = dataJSONObject.getJSONArray("feedList");
for (int j = 0; j < feedListJSONArray.size(); j++) {
JSONObject jsonObject = feedListJSONArray.getJSONObject(j);
log.info("{},{}", tabId, jsonObject.toJSONString());
JdTrialProduct jdTrialProduct = (JdTrialProduct)jsonObject.toJavaObject(JdTrialProduct.class);
jdTrialProduct.setCategoryId(tabId);
if (jdTrialProduct.getType().intValue() == 1) {
long count = count((Wrapper)(new LambdaUpdateWrapper()).eq(JdTrialProduct::getTrialActivityId, jdTrialProduct.getTrialActivityId()));
if (count == 0L) {
if (jdTrialProduct.getJdPrice() == null)
jdTrialProduct.setJdPrice(BigDecimal.valueOf(19.99D));
BigDecimal probability = BigDecimal.ONE;
if (jdTrialProduct.getApplyNum() != null && jdTrialProduct.getSupplyNum() != null &&
jdTrialProduct.getApplyNum().compareTo(BigDecimal.ZERO) > 0) {
probability = jdTrialProduct.getSupplyNum().divide(jdTrialProduct.getApplyNum(), 8, RoundingMode.CEILING);
probability = (probability.compareTo(new BigDecimal(1)) > 0) ? BigDecimal.ONE : probability;
}
jdTrialProduct.setProbability(probability.multiply(new BigDecimal(100)));
jdTrialProduct.setFindType(Integer.valueOf(1));
jdTrialProduct.setCreateTime(new Date());
jdTrialProduct.setUpdateTime(jdTrialProduct.getCreateTime());
jdTrialProductList.add(jdTrialProduct);
}
}
}
page++;
} else {
break;
}
} catch (Exception e) {
e.printStackTrace();
}
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
log.info("{}{}", tabId, Integer.valueOf(jdTrialProductList.size()));
saveBatch(jdTrialProductList);
return jdTrialProductList;
}
public JdTrialProduct getByTrialActivityId(Long trialActivityId) {
return list((Wrapper)(new LambdaUpdateWrapper()).eq(JdTrialProduct::getTrialActivityId, trialActivityId)).get(0);
}
public String getJdInfoByTrialActivityId(Long trialActivityId) {
String url = "https://api.m.jd.com/client.action?appid=newtry&functionId=try_detail&uuid=16601241231411776677919&clientVersion=&client=wh5&osVersion=&area=&networkType=&body=%7B%22activityId%22%3A%22" + trialActivityId + "%22%7D&h5st=20220810173533280%3B0622150979884267%3Ba8ade%3Btk02wc2f51cd618nkBuXZnhTNlkUfEQWB1l8gCru90u2syCMRI03xppy5jhlPfb%2FBFXTxGaHrgDVzLgFjrezi0SALm8c%3Be6d9a34650d8fa4f96fe782aa087e8df0a2f57fec2f8e6ec33741d6b6cf3e1eb%3B3.1%3B1660124133280%3B24c9ee85e67cf80746dd82817ecbeafc7a829b35c7f446a4c7d476cc9faa1d8810201580cda7d22fa50eeda67865c7825021165847880be0c46815e4cc113b33a01ab28b2bd02fc3c22e1659d97a7cba0ed4567359c00fbed9079680af4bbe3c";
String cookie = "joyya=1660185327.0.18.1kkfxhx; __jda=122270672.1660184549019537344540.1660184549.1660184549.1660184549.1; __jdb=122270672.4.1660184549019537344540|1.1660184549; __jdv=122270672%7Cdirect%7C-%7Cnone%7C-%7C1660184549019; __jdc=122270672; mba_muid=1660184549019537344540; mba_sid=16601845490192401979169985172.4; b_dw=293; b_dh=1057; b_dpr=1; b_webp=1; b_avif=1; cid=9; shshshfpb=xSK-OFdS0u03qmaLFl9IcJw; autoOpenApp_downCloseDate_auto=1660184549568_1800000";
HttpGet httpGet = new HttpGet(url);
try {
httpGet.setHeader("Accept", "application/json, text/plain, */*");
httpGet.setHeader("Accept-Encoding", "gzip, deflate, br");
httpGet.setHeader("Accept-Language", "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2");
httpGet.setHeader("Connection", "keep-alive");
httpGet.setHeader("Cookie", cookie);
httpGet.setHeader("Host", "api.m.jd.com");
httpGet.setHeader("Origin", "https://prodev.m.jd.com");
httpGet.setHeader("Referer", "https://prodev.m.jd.com/");
httpGet.setHeader("Sec-Fetch-Dest", "empty");
httpGet.setHeader("Sec-Fetch-Mode", "cors");
httpGet.setHeader("Sec-Fetch-Site", "same-site");
httpGet.setHeader("TE", "trailers");
httpGet.setHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:103.0) Gecko/20100101 Firefox/103.0");
HttpEntity httpEntity = HttpClients.createDefault().execute((HttpUriRequest)httpGet).getEntity();
String result = EntityUtils.toString(httpEntity);
if (!StringUtils.hasText(result))
result = getJdInfoByTrialActivityId(trialActivityId);
return result;
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public String applyByTrialActivityId(Long trialActivityId, Long userId) throws Exception {
User user = (User)this.userService.getById(userId);
String msg = this.jdApplyTrialUtils.openBrowerTpApplyJD(trialActivityId, user);
return msg;
}
public String saveOrUpdateByActivityId(Long trialActivityId) {
String url = "https://api.m.jd.com/client.action?appid=newtry&functionId=try_detail&uuid=16601241231411776677919&clientVersion=&client=wh5&osVersion=&area=&networkType=&body=%7B%22activityId%22%3A%22" + trialActivityId + "%22%7D&h5st=20220810173533280%3B0622150979884267%3Ba8ade%3Btk02wc2f51cd618nkBuXZnhTNlkUfEQWB1l8gCru90u2syCMRI03xppy5jhlPfb%2FBFXTxGaHrgDVzLgFjrezi0SALm8c%3Be6d9a34650d8fa4f96fe782aa087e8df0a2f57fec2f8e6ec33741d6b6cf3e1eb%3B3.1%3B1660124133280%3B24c9ee85e67cf80746dd82817ecbeafc7a829b35c7f446a4c7d476cc9faa1d8810201580cda7d22fa50eeda67865c7825021165847880be0c46815e4cc113b33a01ab28b2bd02fc3c22e1659d97a7cba0ed4567359c00fbed9079680af4bbe3c";
String cookie = "joyya=1660185327.0.18.1kkfxhx; __jda=122270672.1660184549019537344540.1660184549.1660184549.1660184549.1; __jdb=122270672.4.1660184549019537344540|1.1660184549; __jdv=122270672%7Cdirect%7C-%7Cnone%7C-%7C1660184549019; __jdc=122270672; mba_muid=1660184549019537344540; mba_sid=16601845490192401979169985172.4; b_dw=293; b_dh=1057; b_dpr=1; b_webp=1; b_avif=1; cid=9; shshshfpb=xSK-OFdS0u03qmaLFl9IcJw; autoOpenApp_downCloseDate_auto=1660184549568_1800000";
HttpGet httpGet = new HttpGet(url);
try {
httpGet.setHeader("Accept", "application/json, text/plain, */*");
httpGet.setHeader("Accept-Encoding", "gzip, deflate, br");
httpGet.setHeader("Accept-Language", "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2");
httpGet.setHeader("Connection", "keep-alive");
httpGet.setHeader("Cookie", cookie);
httpGet.setHeader("Host", "api.m.jd.com");
httpGet.setHeader("Origin", "https://prodev.m.jd.com");
httpGet.setHeader("Referer", "https://prodev.m.jd.com/");
httpGet.setHeader("Sec-Fetch-Dest", "empty");
httpGet.setHeader("Sec-Fetch-Mode", "cors");
httpGet.setHeader("Sec-Fetch-Site", "same-site");
httpGet.setHeader("TE", "trailers");
httpGet.setHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:103.0) Gecko/20100101 Firefox/103.0");
HttpEntity httpEntity = HttpClients.createDefault().execute((HttpUriRequest)httpGet).getEntity();
String result = EntityUtils.toString(httpEntity);
if (!StringUtils.hasText(result))
result = getJdInfoByTrialActivityId(trialActivityId);
JSONObject resJSONObject = JSONObject.parseObject(result);
JSONObject dataJSONObject = resJSONObject.getJSONObject("data");
JdTrialProduct jdTrialProduct = (JdTrialProduct)dataJSONObject.toJavaObject(JdTrialProduct.class);
jdTrialProduct.setTrialActivityId(dataJSONObject.getLong("activityId"));
jdTrialProduct.setSkuTitle(dataJSONObject.getString("trialName"));
jdTrialProduct.setJdPrice(dataJSONObject.getBigDecimal("price"));
jdTrialProduct.setSku(dataJSONObject.getString("trialSkuId"));
jdTrialProduct.setActivityType(dataJSONObject.getInteger("activityType"));
String skuImg = dataJSONObject.getString("largeImage");
if (StringUtils.hasText(skuImg))
jdTrialProduct.setSkuImg(skuImg.contains("http") ? skuImg : ("https:" + skuImg));
jdTrialProduct.setTrialPrice(dataJSONObject.getBigDecimal("orderPrice"));
jdTrialProduct.setSupplyNum(dataJSONObject.getBigDecimal("supplyCount"));
jdTrialProduct.setApplyNum(dataJSONObject.getBigDecimal("applyCount"));
BigDecimal probability = BigDecimal.ONE;
if (jdTrialProduct.getApplyNum() != null && jdTrialProduct.getSupplyNum() != null &&
jdTrialProduct.getApplyNum().compareTo(BigDecimal.ZERO) > 0) {
probability = jdTrialProduct.getSupplyNum().divide(jdTrialProduct.getApplyNum(), 8, RoundingMode.CEILING);
probability = (probability.compareTo(new BigDecimal(1)) > 0) ? BigDecimal.ONE : probability;
}
jdTrialProduct.setProbability(probability.multiply(new BigDecimal(100)));
jdTrialProduct.setType(Integer.valueOf(1));
jdTrialProduct.setFindType(Integer.valueOf(2));
jdTrialProduct.setCreateTime(new Date());
jdTrialProduct.setUpdateTime(jdTrialProduct.getCreateTime());
String materialUrl = "https://prodev.m.jd.com/mall/active/3mpGVQDhvLsMvKfZZumWPQyWt83L/index.html?activityId=" + jdTrialProduct.getTrialActivityId() + "&tttparams=JZJoC1eyJncHNfYXJlYSI6IjEyXzk4OF8zNDQ0XzQ4MDE0IiwicHJzdGF0ZSI6IjAiLCJ1bl9hcmVhIjoiMTJfOTg4XzM0NDRfNTM1ODAiLCJkTGF0IjoiIiwiZ0xhdCI6IjMxLjMzODgiLCJnTG5nIjoiMTIwLjc1OSIsImxuZyI6IjEyMC43NTg2MjYiLCJsYXQiOiIzMS4zMzg2MTEiLCJkTG5nIjoiIiwibW9kZWwiOiJpUGhvbmUxMCwzIn60%3D&sid=132f6a3ea9e08790526254be3c59609w&un_area=12_988_3444_53580&_ts=1662251730704&utm_source=iosapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=Wxfriends&ad_od=share&utm_user=plusmember";
String goodsLink = this.jpkService.getGoodsLink(materialUrl);
if (StringUtils.hasText(goodsLink)) {
jdTrialProduct.setShortUrl(goodsLink);
} else {
jdTrialProduct.setShortUrl(materialUrl);
}
if (jdTrialProduct.getTrialActivityId() != null) {
JdTrialProduct dbTrialProduct = getByTrialActivityId(trialActivityId);
if (dbTrialProduct == null) {
save(jdTrialProduct);
} else {
jdTrialProduct.setId(dbTrialProduct.getId());
updateById(jdTrialProduct);
}
}
return result;
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public String batchApplyOnlyShowByUserId(Long userId) throws Exception {
int applySuccessNum = 1;
List<JdTrialProduct> forEachList = new ArrayList<>();
User user = (User)this.userService.getById(userId);
if (user == null)
return ";
if (user.getNeedLogin().intValue() == 1)
return ";
List<JdTrialProduct> allList = list((Wrapper)((LambdaUpdateWrapper)(new LambdaUpdateWrapper()).eq(JdTrialProduct::getFindType, Integer.valueOf(1)))
.eq(JdTrialProduct::getTrialPrice, BigDecimal.ZERO));
if (user.getIsSort().intValue() == 0) {
forEachList = allList;
} else if (user.getIsSort().intValue() == 1) {
log.info("{},+ allList.size());
List<JdTrialProduct> afterSortWaitApplyList = (List<JdTrialProduct>)allList.stream().sorted(Comparator.comparing(JdTrialProduct::getJdPrice).reversed()).collect(Collectors.toList());
forEachList = afterSortWaitApplyList;
log.info(");
}
for (JdTrialProduct jdTrialProduct : forEachList) {
if (user.getMaxAllowApplyNum().intValue() <= applySuccessNum)
break;
log.info("{}==={}=={}=={},=={}==,{}", new Object[] { jdTrialProduct.getCategoryId(), jdTrialProduct.getSkuTitle(), jdTrialProduct.getJdPrice(), jdTrialProduct.getApplyNum(), jdTrialProduct.getSupplyNum(), jdTrialProduct.getProbability() });
String resMsg = applyByTrialActivityId(jdTrialProduct.getTrialActivityId(), userId);
if (resMsg.contains(") || resMsg.contains("))
break;
if (resMsg.contains(")) {
log.info(");
break;
}
if (!StringUtils.hasText(resMsg))
continue;
if (".equals(resMsg)) {
log.info("{}, Integer.valueOf(applySuccessNum));
applySuccessNum++;
}
}
return "+ applySuccessNum + ";
}
public int syncNewData() {
int syncNum = 0;
QueryWrapper<JdTrialProduct> qw = new QueryWrapper();
qw.select(new String[] { "Max(trial_activity_id) as maxTrialActivityId" });
Map<String, Object> map = getMap((Wrapper)qw);
Long maxTrialActivityId = Long.valueOf(Long.valueOf((new StringBuilder()).append(map.get("maxTrialActivityId")).append("").toString()).longValue() + 1L);
for (int i = 1; i < 150; i++) {
String info = getJdInfoByTrialActivityId(maxTrialActivityId);
if (!".equals(info)) {
JSONObject resJSONObject = JSONObject.parseObject(info);
JSONObject dataJSONObject = resJSONObject.getJSONObject("data");
JdTrialProduct jdTrialProduct = (JdTrialProduct)dataJSONObject.toJavaObject(JdTrialProduct.class);
jdTrialProduct.setTrialActivityId(dataJSONObject.getLong("activityId"));
jdTrialProduct.setSkuTitle(dataJSONObject.getString("trialName"));
jdTrialProduct.setJdPrice(dataJSONObject.getBigDecimal("price"));
jdTrialProduct.setSku(dataJSONObject.getString("trialSkuId"));
jdTrialProduct.setActivityType(dataJSONObject.getInteger("activityType"));
String skuImg = dataJSONObject.getString("largeImage");
if (StringUtils.hasText(skuImg))
jdTrialProduct.setSkuImg(skuImg.contains("http") ? skuImg : ("https:" + skuImg));
jdTrialProduct.setTrialPrice(dataJSONObject.getBigDecimal("orderPrice"));
jdTrialProduct.setSupplyNum(dataJSONObject.getBigDecimal("supplyCount"));
jdTrialProduct.setApplyNum(dataJSONObject.getBigDecimal("applyCount"));
BigDecimal probability = BigDecimal.ONE;
if (jdTrialProduct.getApplyNum() != null && jdTrialProduct.getSupplyNum() != null &&
jdTrialProduct.getApplyNum().compareTo(BigDecimal.ZERO) > 0) {
probability = jdTrialProduct.getSupplyNum().divide(jdTrialProduct.getApplyNum(), 8, RoundingMode.CEILING);
probability = (probability.compareTo(new BigDecimal(1)) > 0) ? BigDecimal.ONE : probability;
}
jdTrialProduct.setProbability(probability.multiply(new BigDecimal(100)));
jdTrialProduct.setType(Integer.valueOf(1));
jdTrialProduct.setFindType(Integer.valueOf(2));
jdTrialProduct.setCreateTime(new Date());
jdTrialProduct.setUpdateTime(jdTrialProduct.getCreateTime());
String url = "https://prodev.m.jd.com/mall/active/3mpGVQDhvLsMvKfZZumWPQyWt83L/index.html?activityId=" + jdTrialProduct.getTrialActivityId() + "&tttparams=JZJoC1eyJncHNfYXJlYSI6IjEyXzk4OF8zNDQ0XzQ4MDE0IiwicHJzdGF0ZSI6IjAiLCJ1bl9hcmVhIjoiMTJfOTg4XzM0NDRfNTM1ODAiLCJkTGF0IjoiIiwiZ0xhdCI6IjMxLjMzODgiLCJnTG5nIjoiMTIwLjc1OSIsImxuZyI6IjEyMC43NTg2MjYiLCJsYXQiOiIzMS4zMzg2MTEiLCJkTG5nIjoiIiwibW9kZWwiOiJpUGhvbmUxMCwzIn60%3D&sid=132f6a3ea9e08790526254be3c59609w&un_area=12_988_3444_53580&_ts=1662251730704&utm_source=iosapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=Wxfriends&ad_od=share&utm_user=plusmember";
String goodsLink = this.jpkService.getGoodsLink(url);
if (StringUtils.hasText(goodsLink)) {
jdTrialProduct.setShortUrl(goodsLink);
} else {
jdTrialProduct.setShortUrl(url);
}
if (jdTrialProduct.getTrialActivityId() != null) {
if (save(jdTrialProduct))
Long long_1 = maxTrialActivityId, long_2 = maxTrialActivityId = Long.valueOf(maxTrialActivityId.longValue() + 1L);
} else {
break;
}
}
syncNum++;
}
return syncNum;
}
public Page<JdTrialProductVO> listNotFreeTrialProduct(Page<JdTrialProduct> page, JdTrialProductVO queryVo) {
Page<JdTrialProductVO> jdTrialProductVOPage = new Page();
List<JdTrialProductVO> trialProductVOList = new ArrayList<>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String activityStartTimeStr = queryVo.getActivityStartTimeStr();
if (!StringUtils.hasText(activityStartTimeStr))
activityStartTimeStr = sdf.format(new Date());
try {
Date date = sdf.parse(activityStartTimeStr);
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(5, 1);
Date tomDate = calendar.getTime();
String tomDateStr = sdf.format(tomDate);
calendar.setTime(new Date());
calendar.add(12, -5);
Date beforeTenMinuteDate = calendar.getTime();
String[] activityStartTimeStrArr = activityStartTimeStr.split("-");
String[] tomDateStrArr = tomDateStr.split("-");
LambdaQueryWrapper<JdTrialProduct> lqw = new LambdaQueryWrapper();
if (StringUtils.hasText(queryVo.getSecretOrder())) {
lqw.eq(JdTrialProduct::getSecretOrder, queryVo.getSecretOrder());
} else {
if (queryVo.getOnlyOne().booleanValue())
queryVo.setTrialPrice(BigDecimal.ONE);
List<Integer> activeTypeNotInList = new ArrayList<>();
activeTypeNotInList.add(Integer.valueOf(1));
activeTypeNotInList.add(Integer.valueOf(22));
((LambdaQueryWrapper)((LambdaQueryWrapper)((LambdaQueryWrapper)((LambdaQueryWrapper)((LambdaQueryWrapper)lqw.like(StringUtils.hasText(queryVo.getSkuTitle()), JdTrialProduct::getSkuTitle, queryVo.getSkuTitle()))
.gt(JdTrialProduct::getTrialPrice, BigDecimal.ZERO))
.le((queryVo.getTrialPrice() != null), JdTrialProduct::getTrialPrice, queryVo.getTrialPrice()))
.le((queryVo.getSupplyNum() != null), JdTrialProduct::getSupplyNum, queryVo.getSupplyNum()))
.ge((queryVo.getJdPrice() != null), JdTrialProduct::getJdPrice, queryVo.getJdPrice()))
.ge(JdTrialProduct::getActivityStartTime, beforeTenMinuteDate);
if ("dev".equals(this.profilesActive)) {
lqw.notIn(JdTrialProduct::getActivityType, activeTypeNotInList);
} else {
lqw.notIn(JdTrialProduct::getActivityType, activeTypeNotInList);
}
lqw.eq((queryVo.getNotified() != null), JdTrialProduct::getNotified, queryVo.getNotified());
lqw.and(q -> (LambdaQueryWrapper)((LambdaQueryWrapper)((LambdaQueryWrapper)q.likeRight(JdTrialProduct::getActivityStartTime, activityStartTimeStrArr[0] + "-" + activityStartTimeStrArr[1] + "-" + activityStartTimeStrArr[2])).or()).eq(JdTrialProduct::getActivityStartTime, tomDateStrArr[0] + "-" + tomDateStrArr[1] + "-" + tomDateStrArr[2] + " 00:00:00"));
((LambdaQueryWrapper)lqw.orderByAsc(JdTrialProduct::getActivityStartTime))
.orderByDesc(JdTrialProduct::getJdPrice);
}
Page<JdTrialProduct> jdTrialProductPage = (Page<JdTrialProduct>)page((IPage)page, (Wrapper)lqw);
jdTrialProductPage.getRecords().stream().forEach(jdTrialProduct -> {
JdTrialProductVO vo = new JdTrialProductVO();
BeanUtils.copyProperties(jdTrialProduct, vo);
trialProductVOList.add(vo);
});
jdTrialProductVOPage.setRecords(trialProductVOList);
jdTrialProductVOPage.setTotal(jdTrialProductPage.getTotal());
jdTrialProductVOPage.setCurrent(jdTrialProductPage.getCurrent());
jdTrialProductVOPage.setPages(jdTrialProductPage.getPages());
} catch (ParseException e) {
throw new RuntimeException(e);
}
return jdTrialProductVOPage;
}
public JdTrialProductVO getNewest() throws Exception {
JdTrialProductVO jdTrialProductVO = new JdTrialProductVO();
LambdaQueryWrapper<JdTrialProduct> lwq = new LambdaQueryWrapper();
lwq.orderByDesc(JdTrialProduct::getTrialActivityId);
lwq.last(" LIMIT 0,1");
JdTrialProduct jdTrialProduct = (JdTrialProduct)getOne((Wrapper)lwq);
BeanUtils.copyProperties(jdTrialProduct, jdTrialProductVO);
return jdTrialProductVO;
}
public void updateDbData() {
LambdaQueryWrapper<JdTrialProduct> lqw = new LambdaQueryWrapper();
lqw.isNull(JdTrialProduct::getActivityType);
list((Wrapper)lqw).stream().forEach(jdTrialProduct -> {
JdTrialProduct update = new JdTrialProduct();
String info = getJdInfoByTrialActivityId(jdTrialProduct.getTrialActivityId());
JSONObject resJSONObject = JSONObject.parseObject(info);
JSONObject dataJSONObject = resJSONObject.getJSONObject("data");
update.setId(jdTrialProduct.getId());
update.setActivityType(dataJSONObject.getInteger("activityType"));
updateById(update);
});
}
public Page<JdFreeTrialProductVO> pageFreeTrialProduct(Page<JdTrialProduct> page, Long userId, JdFreeTrialProductVO queryVO) {
Page<JdFreeTrialProductVO> jdFreeTrialProductVOPage = new Page();
List<JdFreeTrialProductVO> jdFreeTrialProductVOList = new ArrayList<>();
Calendar calendar = Calendar.getInstance();
calendar.add(5, 1);
String addOneDateStr = Constants.DATE_FORMAT.sdf0.format(calendar.getTime());
String[] addOneDateStrArr = addOneDateStr.split(" ");
LambdaQueryWrapper<JdTrialProduct> lqw = new LambdaQueryWrapper();
((LambdaQueryWrapper)((LambdaQueryWrapper)((LambdaQueryWrapper)((LambdaQueryWrapper)((LambdaQueryWrapper)lqw.like(StringUtils.hasText(queryVO.getSkuTitle()), JdTrialProduct::getSkuTitle, queryVO.getSkuTitle()))
.le((queryVO.getApplyNum() != null), JdTrialProduct::getApplyNum, queryVO.getApplyNum()))
.eq(JdTrialProduct::getActivityType, Integer.valueOf(1)))
.le(JdTrialProduct::getActivityStartTime, new Date()))
.gt(JdTrialProduct::getActivityEndTime, new Date()))
.lt(JdTrialProduct::getActivityEndTime, addOneDateStrArr[0] + " 00:40:00");
if (queryVO.getIsApplyNumAsc().booleanValue()) {
lqw.orderByAsc(JdTrialProduct::getApplyNum);
} else if (queryVO.getIsProbabilityDesc().booleanValue()) {
lqw.orderByDesc(JdTrialProduct::getProbability);
} else {
((LambdaQueryWrapper)((LambdaQueryWrapper)((LambdaQueryWrapper)lqw.orderByAsc(JdTrialProduct::getApplyState))
.orderByAsc(JdTrialProduct::getActivityEndTime))
.orderByDesc(JdTrialProduct::getJdPrice))
.orderByAsc(JdTrialProduct::getTrialPrice);
}
Page<JdTrialProduct> jdTrialProductPage = (Page<JdTrialProduct>)page((IPage)page, (Wrapper)lqw);
jdTrialProductPage.getRecords().stream().forEach(jdTrialProduct -> {
JdFreeTrialProductVO vo = new JdFreeTrialProductVO();
BeanUtils.copyProperties(jdTrialProduct, vo);
User user = (User)this.userService.getById(userId);
// if (user.getEndTime().before(new Date()))
// vo.setShortUrl("https://www.baidu.com");
jdFreeTrialProductVOList.add(vo);
});
jdFreeTrialProductVOPage.setRecords(jdFreeTrialProductVOList);
jdFreeTrialProductVOPage.setTotal(jdTrialProductPage.getTotal());
jdFreeTrialProductVOPage.setCurrent(jdTrialProductPage.getCurrent());
jdFreeTrialProductVOPage.setPages(jdTrialProductPage.getPages());
return jdFreeTrialProductVOPage;
}
public Long getDelayTime(Long trialActivityId) {
String url = "https://api.m.jd.com/client.action?appid=newtry&functionId=try_detail&uuid=16601241231411776677919&clientVersion=&client=wh5&osVersion=&area=&networkType=&body=%7B%22activityId%22%3A%22" + trialActivityId + "%22%7D&h5st=20220810173533280%3B0622150979884267%3Ba8ade%3Btk02wc2f51cd618nkBuXZnhTNlkUfEQWB1l8gCru90u2syCMRI03xppy5jhlPfb%2FBFXTxGaHrgDVzLgFjrezi0SALm8c%3Be6d9a34650d8fa4f96fe782aa087e8df0a2f57fec2f8e6ec33741d6b6cf3e1eb%3B3.1%3B1660124133280%3B24c9ee85e67cf80746dd82817ecbeafc7a829b35c7f446a4c7d476cc9faa1d8810201580cda7d22fa50eeda67865c7825021165847880be0c46815e4cc113b33a01ab28b2bd02fc3c22e1659d97a7cba0ed4567359c00fbed9079680af4bbe3c";
String cookie = "joyya=1660185327.0.18.1kkfxhx; __jda=122270672.1660184549019537344540.1660184549.1660184549.1660184549.1; __jdb=122270672.4.1660184549019537344540|1.1660184549; __jdv=122270672%7Cdirect%7C-%7Cnone%7C-%7C1660184549019; __jdc=122270672; mba_muid=1660184549019537344540; mba_sid=16601845490192401979169985172.4; b_dw=293; b_dh=1057; b_dpr=1; b_webp=1; b_avif=1; cid=9; shshshfpb=xSK-OFdS0u03qmaLFl9IcJw; autoOpenApp_downCloseDate_auto=1660184549568_1800000";
HttpGet httpGet = new HttpGet(url);
try {
httpGet.setHeader("Accept", "application/json, text/plain, */*");
httpGet.setHeader("Accept-Encoding", "gzip, deflate, br");
httpGet.setHeader("Accept-Language", "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2");
httpGet.setHeader("Connection", "keep-alive");
httpGet.setHeader("Cookie", cookie);
httpGet.setHeader("Host", "api.m.jd.com");
httpGet.setHeader("Origin", "https://prodev.m.jd.com");
httpGet.setHeader("Referer", "https://prodev.m.jd.com/");
httpGet.setHeader("Sec-Fetch-Dest", "empty");
httpGet.setHeader("Sec-Fetch-Mode", "cors");
httpGet.setHeader("Sec-Fetch-Site", "same-site");
httpGet.setHeader("TE", "trailers");
httpGet.setHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:103.0) Gecko/20100101 Firefox/103.0");
HttpEntity httpEntity = HttpClients.createDefault().execute((HttpUriRequest)httpGet).getEntity();
String result = EntityUtils.toString(httpEntity);
if (!StringUtils.hasText(result))
result = getJdInfoByTrialActivityId(trialActivityId);
JSONObject resJSONObject = JSONObject.parseObject(result);
JSONObject dataJSONObject = resJSONObject.getJSONObject("data");
if (dataJSONObject == null || !dataJSONObject.containsKey("nowTime")) {
log.info(");
return Long.valueOf(0L);
}
Long jdNowTime = dataJSONObject.getLong("nowTime");
return Long.valueOf((new Date()).getTime() - jdNowTime.longValue());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public List<JdTrialProduct> listTodayFreeProduct(boolean isUpdate) {
Calendar calendar = Calendar.getInstance();
calendar.add(5, 1);
String addOneDateStr = Constants.DATE_FORMAT.sdf0.format(calendar.getTime());
String[] addOneDateStrArr = addOneDateStr.split(" ");
LambdaQueryWrapper<JdTrialProduct> lqw = new LambdaQueryWrapper();
if (isUpdate)
lqw.and(q -> (LambdaQueryWrapper)((LambdaQueryWrapper)((LambdaQueryWrapper)q.isNull(JdTrialProduct::getApplyNum)).or()).le(JdTrialProduct::getApplyNum, Integer.valueOf(100)));
((LambdaQueryWrapper)((LambdaQueryWrapper)((LambdaQueryWrapper)lqw.eq(JdTrialProduct::getActivityType, Integer.valueOf(1)))
.le(JdTrialProduct::getActivityStartTime, new Date()))
.gt(JdTrialProduct::getActivityEndTime, new Date()))
.lt(JdTrialProduct::getActivityEndTime, addOneDateStrArr[0] + " 00:40:00");
((LambdaQueryWrapper)((LambdaQueryWrapper)lqw.orderByAsc(JdTrialProduct::getApplyState))
.orderByDesc(JdTrialProduct::getJdPrice))
.orderByAsc(JdTrialProduct::getTrialPrice);
List<JdTrialProduct> jdTrialProductList = list((Wrapper)lqw);
log.info("{}", Integer.valueOf(jdTrialProductList.size()));
return jdTrialProductList;
}
public void updateTodayFreeProduct() {
listTodayFreeProduct(true).stream().forEach(jdTrialProduct -> saveOrUpdateByActivityId(jdTrialProduct.getTrialActivityId()));
}
public List<JdTrialProductVO> listZDYProduct(JdTrialProductVO queryVo) {
List<JdTrialProductVO> jdTrialProductVOList = new ArrayList<>();
List<JdTrialProduct> jdTrialProductList = list((Wrapper)((LambdaQueryWrapper)((LambdaQueryWrapper)(new LambdaQueryWrapper())
.eq(JdTrialProduct::getOrderPriceTip, "))
.like(StringUtils.hasText(queryVo.getSku()), JdTrialProduct::getSku, queryVo.getSku()))
.like(StringUtils.hasText(queryVo.getSkuTitle()), JdTrialProduct::getSkuTitle, queryVo.getSkuTitle()));
jdTrialProductList.stream().forEach(jdTrialProduct -> {
JdTrialProductVO jdTrialProductVO = new JdTrialProductVO();
BeanUtils.copyProperties(jdTrialProduct, jdTrialProductVO);
jdTrialProductVO.setActivityTimeArr(new Date[] { jdTrialProduct.getActivityStartTime(), jdTrialProduct.getActivityEndTime() });
jdTrialProductVOList.add(jdTrialProductVO);
});
return jdTrialProductVOList;
}
}