修复抖音订单更新问题/修复用户注销却自动封禁的bug
| | |
| | | return daTaoKeGoodsResult; |
| | | } |
| | | |
| | | |
| | | public static JSONArray tbSearch(String key) { |
| | | TaoKeAppInfo app = getRandomApp(); |
| | | Map<String, String> params = new TreeMap<>(); |
| | | params.put("version", "v2.1.0"); |
| | | params.put("appKey", app.getAppKey()); |
| | | params.put("pageSize", 20 + ""); |
| | | params.put("pageNo", 1 + ""); |
| | | |
| | | if (StringUtil.isNullOrEmpty(key)) |
| | | key = ""; |
| | | params.put("keyWords", key); |
| | | params.put("sign", getSign(params, app.getAppSecret())); |
| | | String result = requestGet("https://openapi.dataoke.com/api/tb-service/get-tb-service", params); |
| | | |
| | | JSONObject json = JSONObject.fromObject(result); |
| | | if (json.optInt("code") != 0) { |
| | | return null; |
| | | } |
| | | |
| | | JSONArray array = json.optJSONArray("data"); |
| | | return array; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 商品列表 |
| | | * |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取商品重要信息 |
| | | * |
| | |
| | | |
| | | |
| | | /** |
| | | * @return java.lang.String |
| | | * @author hxh |
| | | * @description 解析口令中的商品ID |
| | | * @date 10:01 2022/9/26 |
| | | * @param: content |
| | | * @return java.lang.String |
| | | **/ |
| | | public static String parseGoodsIdFromToken(String content) { |
| | | try { |
| | |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | tbSearch("飘柔铃兰蓬香持久留香柔顺洗发水/露控油蓬松300g女官方正品"); |
| | | } |
| | | } |
| | |
| | | return; |
| | | } |
| | | |
| | | List<TaoBaoGoodsBrief> listAddGoods = new ArrayList<TaoBaoGoodsBrief>(); |
| | | List<TaoBaoGoodsBrief> listAddGoods = new ArrayList<>(); |
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief : listTaoBaoGoods) { |
| | | String auctionId = taoBaoGoodsBrief.getAuctionId(); |
| | | if (listTaoBaoId.contains(auctionId)) { |
| | |
| | | if (taoBaoGoodsBrief == null) { |
| | | continue; |
| | | } |
| | | if (!"0".equalsIgnoreCase(taoBaoGoodsBrief.getAuctionId())) { |
| | | listGid.add(taoBaoGoodsBrief.getAuctionId()); |
| | | } else { |
| | | listGid.add(taoBaoGoodsBrief.getId() + ""); |
| | | } |
| | | } |
| | | |
| | | // API网络接口验证是否在售 |
| | |
| | | import com.yeshi.goods.facade.utils.taobao.DaTaoKeApiUtil; |
| | | import net.sf.json.JSONArray; |
| | | import net.sf.json.JSONObject; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.core.task.TaskExecutor; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | |
| | | @Controller |
| | | @RequestMapping("api/v2/search") |
| | | public class SearchControllerV2 { |
| | | |
| | | Logger logger = LoggerFactory.getLogger(SearchControllerV2.class); |
| | | |
| | | @Resource |
| | | private ConfigService configService; |
| | |
| | | } |
| | | |
| | | // 淘宝api搜索商品 |
| | | //TODO 测试注释 |
| | | TaoBaoSearchResult result = taoBaoGoodsCacheUtil.getSearchResult(sf); // TaoBaoUtil.search(sf, specialId, null); |
| | | if (result == null) { |
| | | result = TaoBaoUtil.search(sf, specialId, null); |
| | | if (result != null && result.getTaoBaoGoodsBriefs() != null && result.getTaoBaoGoodsBriefs().size() > 1) { |
| | | for (TaoBaoGoodsBrief g : result.getTaoBaoGoodsBriefs()) { |
| | | if (StringUtil.isNullOrEmpty(g.getAuctionId())) { |
| | | logger.error("搜索结果有空ID的情况 关键字{}", key); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //如果是单个商品,且里面的商品ID为空,就需要借助大淘客搜索 |
| | | if (result.getTaoBaoGoodsBriefs() != null && result.getTaoBaoGoodsBriefs().size() == 1 && StringUtil.isNullOrEmpty(result.getTaoBaoGoodsBriefs().get(0).getAuctionId())) { |
| | | //有一个商品且里面的商品ID为空的情况 |
| | | JSONArray darray = DaTaoKeApiUtil.tbSearch(key); |
| | | if (darray != null && darray.size() > 0) { |
| | | String auctionId = darray.optJSONObject(0).optString("item_id"); |
| | | result.getTaoBaoGoodsBriefs().set(0, TaoKeApiUtil.searchGoodsDetail(auctionId)); |
| | | } |
| | | } |
| | | taoBaoGoodsCacheUtil.saveSearchResult(sf, result); |
| | | } |
| | | TaoBaoSearchResult finalResult = result; |
| | |
| | | redisManager.clearSMSVCode(phone, SMSHistory.TYPE_REMVOE); |
| | | } |
| | | |
| | | userAccountService.forbiddenUserAll(uid, "用户主动注销账户"); |
| | | userAccountService.unRegisterUser(uid, "用户主动注销账户"); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("注销成功")); |
| | | } |
| | | |
| | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.money.AccountDetailHongBaoMap; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface AccountDetailHongBaoMapMapper extends BaseMapper<AccountDetailHongBaoMap> { |
| | | |
| | | /** |
| | |
| | | */ |
| | | AccountDetailHongBaoMap selectByHongBaoId(Long hongBaoId); |
| | | |
| | | List<AccountDetailHongBaoMap> listByAccountDetailID(Long aid); |
| | | |
| | | } |
| | |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.ks.lijin.query.BaseDaoQuery; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | |
| | | |
| | | public interface CommonOrderGoodsMapper extends BaseMapper<CommonOrderGoods> { |
| | | |
| | | |
| | | List<CommonOrderGoods> list(@Param("query") DaoQuery daoQuery); |
| | | |
| | | /** |
| | | * 根据订单号、订单类型查询商品 |
| | | * |
| | | * @param list |
| | | * 订单对象 |
| | | * @param list 订单对象 |
| | | * @return |
| | | */ |
| | | List<CommonOrderGoods> listByOrderNoAndType(List<CommonOrder> list); |
| | |
| | | |
| | | /** |
| | | * 根据ID列表查询 |
| | | * |
| | | * @param ids |
| | | * @return List<CommonOrderGoods> 返回类型 |
| | | * @throws |
| | | * @Title: listByByPrimaryKeys |
| | | * @Description: |
| | | * @param ids |
| | | * @return |
| | | * List<CommonOrderGoods> 返回类型 |
| | | * @throws |
| | | */ |
| | | List<CommonOrderGoods> listByByPrimaryKeys(@Param("ids") List<Long> ids); |
| | | |
| | | class DaoQuery extends BaseDaoQuery { |
| | | public String goodsId; |
| | | public Integer goodsType; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import com.ks.lijin.query.BaseDaoQuery; |
| | | import com.yeshi.common.MongodbBaseDao; |
| | | import com.yeshi.fanli.entity.bus.msg.MsgOverViews; |
| | | import com.yeshi.fanli.entity.bus.msg.MsgTypeEnum; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.mapping.Field; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Repository; |
| | |
| | | if (daoQuery.uid != null) { |
| | | whereList.add(Criteria.where("uid").is(daoQuery.uid)); |
| | | } |
| | | if (daoQuery.identityCode != null) { |
| | | whereList.add(Criteria.where("identityCode").is(daoQuery.identityCode)); |
| | | } |
| | | if (daoQuery.msgType != null) { |
| | | whereList.add(Criteria.where("msgType").is(daoQuery.msgType)); |
| | | } |
| | | |
| | | |
| | | Criteria[] wheres = new Criteria[whereList.size()]; |
| | | whereList.toArray(wheres); |
| | | return wheres; |
| | |
| | | |
| | | public static class DaoQuery extends BaseDaoQuery { |
| | | public Long uid; |
| | | public MsgTypeEnum msgType; |
| | | public Long identityCode; |
| | | } |
| | | } |
| | |
| | | import com.yeshi.fanli.service.inter.order.OrderProcessService; |
| | | import com.yeshi.fanli.service.inter.order.dividents.TeamDividentsSourceUserService; |
| | | import com.yeshi.fanli.service.manger.order.TeamDividentsManager; |
| | | import org.yeshi.utils.StringUtil; |
| | | import org.yeshi.utils.TimeUtil; |
| | | |
| | | //分享赚到账 |
| | |
| | | @XxlJob("startOrderShareIncomeHandler") |
| | | public ReturnT<String> startPreOrderTeamIncome(String param) throws Exception { |
| | | String day = TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM") + "-25"; |
| | | if (!StringUtil.isNullOrEmpty(param)) { |
| | | day = param; |
| | | } |
| | | |
| | | //25号之前不能到账本月的 |
| | | long times = TimeUtil.convertToTimeTemp(day, "yyyy-MM-dd"); |
| | | if (times > System.currentTimeMillis()) { |
| | | throw new Exception("25号之前不能到账本月的"); |
| | | } |
| | | Date preSendTime = new Date(TimeUtil.convertToTimeTemp(day, "yyyy-MM-dd")); |
| | | orderProcessService.fanliShare(preSendTime); |
| | | return ReturnT.SUCCESS; |
| | |
| | | return ReturnT.SUCCESS; |
| | | } |
| | | |
| | | private void updateOrder(DYOrderFilter filter) { |
| | | public void updateOrder(DYOrderFilter filter) { |
| | | if (filter.getSize() == null) { |
| | | filter.setSize(50); |
| | | } |
| | | filter.setTime_type("update"); |
| | | DYOrderResult result = CSJCPSApiUtil.orderList(filter); |
| | | if (result != null && result.getOrders() != null) { |
| | | saveDYOrders(result.getOrders()); |
| | |
| | | } else { |
| | | cog.setGoodsId(taoBaoOrder.getAuctionId() + ""); |
| | | cog.setGoodsType(Constant.SOURCE_TYPE_TAOBAO); |
| | | cog.setTitle(taoBaoOrder.getTitle()); |
| | | newCommonOrder.setCommonOrderGoods(cog); |
| | | } |
| | | newCommonOrder.setStateWholeOrder(wholeOrderState); |
| | |
| | | } |
| | | cog.setCreateTime(new Date()); |
| | | cog.setUpdateTime(new Date()); |
| | | //覆盖原来的商品ID |
| | | cog.setGoodsId(newCommonOrder.getCommonOrderGoods().getGoodsId()); |
| | | commonOrderGoodsMapper.insertSelective(cog); |
| | | } |
| | | newCommonOrder.setUserInfo(new UserInfo(uid)); |
| | |
| | | } |
| | | dyOrderDao.save(order); |
| | | } else {// 更新 |
| | | order.setOrder_id(old.getId()); |
| | | order.setId(old.getId()); |
| | | order.setUpdateTime(new Date()); |
| | | dyOrderDao.updateByPrimaryKey(order); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void unRegisterUser(Long uid,String reason) { |
| | | UserInfo currentInfo = userInfoService.selectByPKey(uid); |
| | | if (currentInfo == null) { |
| | | return; |
| | | } |
| | | if (currentInfo.getState() != UserInfo.STATE_NORMAL) { |
| | | return; |
| | | } |
| | | |
| | | currentInfo.setState(UserInfo.STATE_FORBIDDEN); |
| | | currentInfo.setStateDesc(reason); |
| | | userInfoService.updateByPrimaryKeySelective(currentInfo); |
| | | |
| | | // 插入记录 |
| | | userInfoDeleteRecordService.addDeleteRecord(uid, UserInfo.STATE_DELETE, reason); |
| | | } |
| | | |
| | | @Override |
| | | public void forbiddenUser(Long uid, String reason) { |
| | | UserInfo currentInfo = userInfoService.selectByPKey(uid); |
| | | if (currentInfo == null) { |
| | |
| | | */ |
| | | public void forbiddenUserAll(Long uid, String reason); |
| | | |
| | | |
| | | /** |
| | | * 注销账户 |
| | | * |
| | | * @param uid |
| | | */ |
| | | public void unRegisterUser(Long uid,String reason); |
| | | |
| | | /** |
| | | * 删除账户 |
| | | * |
| | |
| | | commonOrder.setCount(1); |
| | | commonOrder.setCreateTime(new Date()); |
| | | if (order.getFlow_point().equalsIgnoreCase(DYOrder.FLOW_POINT_SETTLE)) { |
| | | commonOrder.seteIncome(new BigDecimal(order.getEstimated_commission()).divide(new BigDecimal(100), 2, RoundingMode.DOWN)); |
| | | commonOrder.seteIncome(new BigDecimal(order.getEstimated_commission()).add(new BigDecimal(order.getEstimated_tech_service_fee())).divide(new BigDecimal(100), 2, RoundingMode.DOWN)); |
| | | commonOrder.setSettlement(new BigDecimal(order.getPay_goods_amount()).divide(new BigDecimal(100), 2, RoundingMode.FLOOR)); |
| | | commonOrder.setSettleTime( |
| | | new Date(TimeUtil.convertToTimeTemp(order.getSettle_time(), "yyyy-MM-dd HH:mm:ss"))); |
| | |
| | | new Date(TimeUtil.convertToTimeTemp(order.getPay_success_time(), "yyyy-MM-dd HH:mm:ss"))); |
| | | commonOrder.setUpdateTime(new Date()); |
| | | commonOrder.setTradeId(order.getOrder_id()); |
| | | commonOrder.setEstimate(new BigDecimal(order.getEstimated_commission()).divide(new BigDecimal(100), 2, RoundingMode.DOWN)); |
| | | commonOrder.setEstimate(new BigDecimal(order.getEstimated_commission()).add(new BigDecimal(order.getEstimated_tech_service_fee())).divide(new BigDecimal(100), 2, RoundingMode.DOWN)); |
| | | commonOrder.setChildSourceType("抖音"); |
| | | return commonOrder; |
| | | } |
| | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.yeshi.utils.StringUtil; |
| | | import org.yeshi.utils.TimeUtil; |
| | | |
| | | import java.io.IOException; |
| | | import java.lang.reflect.Type; |
| | |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | goodsDetails(Arrays.asList(new Long[]{3549871967593209780L})); |
| | | getOrderDetail("4984015762658606759", 1); |
| | | DYOrderFilter filter=new DYOrderFilter(); |
| | | filter.setTime_type("update"); |
| | | filter.setOrder_type(1); |
| | | filter.setSize(50); |
| | | filter.setCursor("0"); |
| | | filter.setStart_time(TimeUtil.convertToTimeTemp("2022-12-18","yyyy-MM-dd")/1000); |
| | | filter.setEnd_time(TimeUtil.convertToTimeTemp("2022-12-19","yyyy-MM-dd")/1000); |
| | | |
| | | DYOrderResult result = orderList(filter); |
| | | System.out.println(result); |
| | | // goodsDetails(Arrays.asList(new Long[]{3549871967593209780L})); |
| | | // DYOrder order = getOrderDetail("5005828634543277401", 1); |
| | | |
| | | } |
| | | |
| | |
| | | **/ |
| | | private Integer order_type; |
| | | |
| | | /** |
| | | * pay-按照⽀付时 |
| | | * 间查询特定时间范 |
| | | * 围内的订单 |
| | | * update-按照订单 |
| | | * 更新时间查询特定 |
| | | * 时间范围内的订单 |
| | | **/ |
| | | private String time_type; |
| | | |
| | | public Integer getSize() { |
| | | return size; |
| | | } |
| | |
| | | public void setOrder_type(Integer order_type) { |
| | | this.order_type = order_type; |
| | | } |
| | | |
| | | public String getTime_type() { |
| | | return time_type; |
| | | } |
| | | |
| | | public void setTime_type(String time_type) { |
| | | this.time_type = time_type; |
| | | } |
| | | } |
| | |
| | | |
| | | static { |
| | | TDMQUtil.getInstance().init(secretId, secretKey, Constant.TDMQ_PUBLIC); |
| | | |
| | | |
| | | TEAM_DIVIDENTS_PRE += "-" + Constant.systemCommonConfig.getProjectName(); |
| | | FANLI_TEAM_INCOME_ORDER_PRE += "-" + Constant.systemCommonConfig.getProjectName(); |
| | | TEAM_DIVIDENTS += "-" + Constant.systemCommonConfig.getProjectName(); |
| | |
| | | import com.yeshi.goods.facade.dto.taobao.TaoBaoShopInfoDTO; |
| | | import com.yeshi.goods.facade.entity.taobao.TaoBaoGoodsBrief; |
| | | import com.yeshi.goods.facade.entity.taobao.TaoBaoHead; |
| | | import com.yeshi.goods.facade.utils.taobao.DaTaoKeApiUtil; |
| | | import net.sf.json.JSONArray; |
| | | import net.sf.json.JSONObject; |
| | | import org.yeshi.utils.JsonUtil; |
| | |
| | | .optJSONArray("n_tbk_item"); |
| | | if (array != null && array.size() > 0) { |
| | | JSONObject item = array.optJSONObject(0); |
| | | return parseSimpleGoodsInfo(item); |
| | | TaoBaoGoodsBrief goods = parseSimpleGoodsInfo(item); |
| | | if(goods!=null){ |
| | | goods.setAuctionId(id); |
| | | } |
| | | return goods; |
| | | } |
| | | return null; |
| | | } |
| | |
| | | map.put("method", "taobao.tbk.dg.material.optional"); |
| | | map.put("page_size", filter.getPageSize() == 0 ? "20" : filter.getPageSize() + ""); |
| | | map.put("page_no", (filter.getPage() <= 0 ? 1 : filter.getPage()) + ""); |
| | | //1-动态ID转链场景,2-消费者比价场景(不填默认为1) |
| | | // map.put("biz_scene_id","2"); |
| | | // map.put("promotion_type","1"); |
| | | |
| | | if (!StringUtil.isNullOrEmpty(specialId) && !StringUtil.isNullOrEmpty(relationId)) { |
| | | map.put("special_id", specialId); |
| | | } else if (!StringUtil.isNullOrEmpty(specialId)) { |
| | |
| | | } |
| | | |
| | | // 解析物料 |
| | | private static TaoBaoGoodsBrief parseWuLiaoItem(JSONObject item) { |
| | | public static TaoBaoGoodsBrief parseWuLiaoItem(JSONObject item) { |
| | | TaoBaoGoodsBrief goods = new TaoBaoGoodsBrief(); |
| | | goods.setPictUrl(item.optString("pict_url")); |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | // 淘礼金创建 |
| | | //{"result":{"msg_code":"FAIL_CHECK_ITEM_DAILY_SEND_NUM_CHECK_ERROR","msg_info":"今日该商品淘礼金创建数已超上限,请您明日再试","success":false},"request_id":"10p30v02qadkq"} |
| | | //{"result":{"msg_code":"ASSET_ACCOUNT_BALANCE_NOT_ENOUGH","msg_info":"账户预算不足","success":false},"request_id":"5caz9izr7jqp"} |
| | |
| | | } |
| | | |
| | | /** |
| | | * @return com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinReport |
| | | * @author hxh |
| | | * @description 淘礼金报告 接口文档:https://open.taobao.com/api.htm?source=search&docId=58736&docType=2 |
| | | * @date 10:57 2022/1/11 |
| | | * @param: rightsId |
| | | * @return com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinReport |
| | | **/ |
| | | public static UserTaoLiJinReport getTaoLiJinEffective(String rightsId,String pid) { |
| | | Map<String, String> map = new HashMap<>(); |
| | |
| | | } |
| | | |
| | | public static void main(String[] args) throws TaoBaoTokenParseException, TaobaoGoodsDownException { |
| | | |
| | | String token="【淘宝】https://m.tb.cn/h.Ud07Ald?tk=NIWE2xNaOzs CZ0001 「超细高分子细滑牙线棒一次性牙签牙线便携牙线盒牙线签6盒300支」\n" + |
| | | "点击链接直接打开 或者 淘宝搜索直接打开"; |
| | | TokenConvertResult convertResult=tokenConvert(token); |
| | | getSimpleGoodsInfo(convertResult.getNum_iid()); |
| | | |
| | | |
| | | |
| | | |
| | | TaoBaoGoodsBrief goods = getSimpleGoodsInfo("qYtrU8tgk7CWt0-GmgDAKHqqGm3XDwHZj"); |
| | | System.out.println(goods.getAuctionId()); |
| | | } |
| | | |
| | | } |
| | |
| | | from yeshi_ec_account_details_hongbao_map where ahm_hongbao_id =#{0} |
| | | </select> |
| | | |
| | | <select id="listByAccountDetailID" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_account_details_hongbao_map where ahm_account_details_id =#{0} |
| | | </select> |
| | | |
| | | |
| | | |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_account_details_hongbao_map where ahm_id = |
| | |
| | | from yeshi_ec_common_order_goods where cog_goods_id = #{goodsId} and |
| | | cog_goods_type=#{goodsType} |
| | | </select> |
| | | |
| | | <select id="list" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List"/> |
| | | from yeshi_ec_common_order_goods where 1=1 |
| | | <if test="query.goodsId!=null"> |
| | | and cog_goods_id=#{query.goodsId} |
| | | </if> |
| | | <if test="query.goodsType!=null"> |
| | | and cog_goods_type=#{query.goodsType} |
| | | </if> |
| | | |
| | | <if test="query.sortList!=null"> |
| | | <foreach collection="query.sortList" item="item" open=" order by " separator=","> |
| | | ${item} |
| | | </foreach> |
| | | </if> |
| | | |
| | | limit #{query.start},#{query.count} |
| | | </select> |
| | | |
| | | |
| | | <select id="listNoTitle" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |