| | |
| | | String relationId = null;
|
| | |
|
| | | try {
|
| | | TaoKeApiUtil.getRelationId(accessToken, TaoBaoConstant.TAOBAO_AUTH_APPKEY,
|
| | | relationId= TaoKeApiUtil.getRelationId(accessToken, TaoBaoConstant.TAOBAO_AUTH_APPKEY,
|
| | | TaoBaoConstant.TAOBAO_AUTH_APPSECRET);// 渠道ID
|
| | | } catch (TaoBaoAuthException e) {
|
| | | if (e.getCode() == TaoBaoAuthException.CODE_NOT_REAL_NAME)
|
| | |
| | |
|
| | | @Resource
|
| | | private UserMoneyDetailService userMoneyDetailService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private UserInfoDeleteRecordService userInfoDeleteRecordService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private UserAccountService userAccountService;
|
| | | private UserAccountService userAccountService;
|
| | |
|
| | | /**
|
| | | * 查询用户信息列表 正常用户/异常用户
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "forbiddenUser")
|
| | | public void forbiddenUser(String callback, Long uid, HttpServletRequest request, PrintWriter out) {
|
| | | public void forbiddenUser(String callback, Long uid, HttpServletRequest request, PrintWriter out) {
|
| | | try {
|
| | |
|
| | | if (uid == null) {
|
| | |
| | | if (admin == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("登录失效,请登录"));
|
| | | return;
|
| | | } |
| | | |
| | | }
|
| | |
|
| | | String reason = "后台封禁,操作人:" + admin.getId() + "-" + admin.getName();
|
| | | userAccountService.forbiddenUserAll(uid, reason);
|
| | |
|
| | | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("用户封禁成功"));
|
| | |
|
| | | } catch (Exception e) {
|
| | |
| | | }
|
| | |
|
| | | try {
|
| | |
|
| | | List<UserMoneyDetail> userMoneyDetailsList = userMoneyDetailService.listByUidWithState(uid, pageIndex,
|
| | | pageSize);
|
| | | if (userMoneyDetailsList == null || userMoneyDetailsList.size() == 0) {
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | List<AccountDetails> detailList = new ArrayList<>();
|
| | | for (UserMoneyDetail detail : userMoneyDetailsList)
|
| | | detailList.add(AccountDetailsFactory.create(detail));
|
| | |
|
| | | long count = userMoneyDetailService.countByUidWithState(uid);
|
| | |
|
| | | int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
|
| | |
|
| | | Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd HH:mm:ss").create();
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("pe", pe);
|
| | | data.put("result_list", GsonUtil.toJsonExpose(detailList));
|
| | | data.put("result_list", gson.toJson(userMoneyDetailsList));
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | |
|
| | |
| | | List<Map<String, Object>> countWeiQaunOrderMoney(@Param("dateType") Integer dateType, @Param("year") String year, |
| | | @Param("startTime") String startTime, @Param("endTime") String endTime); |
| | | |
| | | /** |
| | | * 根据状态检索 |
| | | * |
| | | * @param state |
| | | * @param start |
| | | * @param count |
| | | * @return |
| | | */ |
| | | List<TaoBaoWeiQuanOrder> listByState(@Param("state") String state, @Param("start") long start, |
| | | @Param("count") int count); |
| | | |
| | | } |
| | |
| | | from yeshi_ec_taobao_weiqaun_order where tmo_order_id =#{orderId} and |
| | | tmo_state=#{state} |
| | | </select> |
| | | |
| | | |
| | | |
| | | |
| | | <select id="selectByOrderItemId" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_taobao_weiqaun_order where tmo_order_item_id =#{0} |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="listByState" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_taobao_weiqaun_order |
| | | <if test="state!=null"> |
| | | where tmo_state like '${state}%' |
| | | </if> |
| | | order by tmo_createtime desc limit #{start},#{count} |
| | | </select> |
| | | |
| | | |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_taobao_weiqaun_order where tmo_id = #{id,jdbcType=BIGINT} |
| | |
| | | </set> |
| | | where tmo_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | |
| | | |
| | | |
| | | <sql id="Column_DateType"> |
| | | <if test="dateType == 1"> |
| | | DATE_FORMAT(t.`tmo_createtime`,'%Y-%m-%d') AS 'showDate' |
| | | DATE_FORMAT(t.`tmo_weiquan_time`,'%Y-%m-%d') AS 'showDate' |
| | | </if> |
| | | <if test="dateType == 2"> |
| | | DATE_FORMAT(t.`tmo_createtime`,'%m') AS 'showDate' |
| | | DATE_FORMAT(t.`tmo_weiquan_time`,'%m') AS 'showDate' |
| | | </if> |
| | | <if test="dateType == 3"> |
| | | DATE_FORMAT(t.`tmo_createtime`,'%Y') AS 'showDate' |
| | | DATE_FORMAT(t.`tmo_weiquan_time`,'%Y') AS 'showDate' |
| | | </if> |
| | | </sql> |
| | | |
| | | <sql id="Count_Select_DateType"> |
| | | <if test="startTime != null and startTime != '' "> |
| | | AND DATE_FORMAT(t.`tmo_createtime`,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}' |
| | | AND DATE_FORMAT(t.`tmo_weiquan_time`,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}' |
| | | </if> |
| | | <if test="endTime != null and endTime != '' "> |
| | | AND DATE_FORMAT(t.`tmo_createtime`,'%Y-%m-%d') <![CDATA[ <= ]]>'${endTime}' |
| | | AND DATE_FORMAT(t.`tmo_weiquan_time`,'%Y-%m-%d') <![CDATA[ <= ]]>'${endTime}' |
| | | </if> |
| | | <if test="year != null and year != '' "> |
| | | AND DATE_FORMAT(t.`tmo_createtime`,'%Y') = '${year}' |
| | | AND DATE_FORMAT(t.`tmo_weiquan_time`,'%Y') = '${year}' |
| | | </if> |
| | | </sql> |
| | | |
| | | <sql id="Count_Group_DateType"> |
| | | <if test="dateType == 1"> |
| | | GROUP BY DATE_FORMAT(t.`tmo_createtime`,'%Y-%m-%d') |
| | | GROUP BY DATE_FORMAT(t.`tmo_weiquan_time`,'%Y-%m-%d') |
| | | </if> |
| | | <if test="dateType == 2"> |
| | | GROUP BY DATE_FORMAT(t.`tmo_createtime`,'%Y-%m') |
| | | GROUP BY DATE_FORMAT(t.`tmo_weiquan_time`,'%Y-%m') |
| | | </if> |
| | | <if test="dateType == 3"> |
| | | GROUP BY DATE_FORMAT(t.`tmo_createtime`,'%Y') |
| | | GROUP BY DATE_FORMAT(t.`tmo_weiquan_time`,'%Y') |
| | | </if> |
| | | </sql> |
| | | <select id="countWeiQaunOrderNumber" resultType="java.util.HashMap"> |
| | | SELECT IFNULL(COUNT(t.`tmo_id`),0) AS showValue,<include refid="Column_DateType"/> |
| | | SELECT IFNULL(COUNT(t.`tmo_id`),0) AS showValue, |
| | | <include refid="Column_DateType" /> |
| | | FROM yeshi_ec_taobao_weiqaun_order t |
| | | WHERE t.`tmo_createtime`IS NOT NULL <include refid="Count_Select_DateType"/> |
| | | <include refid="Count_Group_DateType"/> |
| | | ORDER BY t.`tmo_createtime` |
| | | WHERE t.`tmo_createtime`IS NOT |
| | | NULL |
| | | <include refid="Count_Select_DateType" /> |
| | | <include refid="Count_Group_DateType" /> |
| | | ORDER BY t.`tmo_weiquan_time` |
| | | </select> |
| | | |
| | | |
| | | <select id="countWeiQaunOrderMoney" resultType="java.util.HashMap"> |
| | | SELECT CAST(SUM(t.`tmo_fan_money`)AS DECIMAL(19,2)) AS showValue,<include refid="Column_DateType"/> |
| | | SELECT CAST(SUM(t.`tmo_fan_money`)AS DECIMAL(19,2)) AS showValue, |
| | | <include refid="Column_DateType" /> |
| | | FROM yeshi_ec_taobao_weiqaun_order t |
| | | WHERE t.`tmo_createtime` IS NOT NULL <include refid="Count_Select_DateType"/> |
| | | <include refid="Count_Group_DateType"/> |
| | | ORDER BY t.`tmo_createtime` |
| | | WHERE t.`tmo_createtime` IS NOT |
| | | NULL |
| | | <include refid="Count_Select_DateType" /> |
| | | <include refid="Count_Group_DateType" /> |
| | | ORDER BY t.`tmo_weiquan_time` |
| | | </select> |
| | | </mapper> |
| | |
| | | public List<Map<String, Object>> countWeiQaunOrderNumber(Integer dateType, String year, String startTime,
|
| | | String endTime) throws Exception{
|
| | | return taoBaoWeiQuanOrderMapper.countWeiQaunOrderNumber(dateType, year, startTime, endTime);
|
| | | |
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | weiQuanDrawBack.setUser(child.getUserInfo());
|
| | | taoBaoWeiQuanDrawBackMapper.insertSelective(weiQuanDrawBack);// 加入返还记录
|
| | |
|
| | | // 判断资金是否足够扣款
|
| | | UserInfo user = userInfoMapper.selectByPKey(uid);
|
| | | if (user != null && user.getMyHongBao().compareTo(drawBackMoney) < 0)// 资金不足
|
| | | {
|
| | | try {
|
| | | addDebt(uid, child.getId(), drawBackMoney);
|
| | | } catch (UserMoneyDebtException e) {
|
| | | throw new TaoBaoWeiQuanException(101, "资金借贷异常");
|
| | | // 如果资金大于0才扣除
|
| | |
|
| | | if (drawBackMoney != null && drawBackMoney.compareTo(new BigDecimal(0)) > 0) {
|
| | |
|
| | | // 判断资金是否足够扣款
|
| | | UserInfo user = userInfoMapper.selectByPKey(uid);
|
| | | if (user != null && user.getMyHongBao().compareTo(drawBackMoney) < 0)// 资金不足
|
| | | {
|
| | | try {
|
| | | addDebt(uid, child.getId(), drawBackMoney);
|
| | | } catch (UserMoneyDebtException e) {
|
| | | throw new TaoBaoWeiQuanException(101, "资金借贷异常");
|
| | | }
|
| | | continue;
|
| | | }
|
| | | continue;
|
| | | }
|
| | |
|
| | | UserMoneyDetail userMoneyDetail = null;
|
| | | // 新版资金记录
|
| | | try {
|
| | | userMoneyDetail = UserMoneyDetailFactory.createInviteWeiQuan(uid, weiQuanDrawBack,
|
| | | drawBackMoney);
|
| | | } catch (UserMoneyDetailException e) {
|
| | | UserMoneyDetail userMoneyDetail = null;
|
| | | // 新版资金记录
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | userMoneyDetail = UserMoneyDetailFactory.createInviteWeiQuan(uid, weiQuanDrawBack,
|
| | | drawBackMoney);
|
| | | } catch (UserMoneyDetailException e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | userMoneyService.subUserMoney(uid, drawBackMoney, userMoneyDetail);
|
| | |
|
| | | // 新版通知
|
| | | userMoneyMsgNotificationService.inviteOrderWeiQuan(uid, orderId, drawBackMoney,
|
| | | userInfoMapper.selectByPrimaryKey(uid).getMyHongBao());
|
| | | }
|
| | |
|
| | | userMoneyService.subUserMoney(uid, drawBackMoney, userMoneyDetail);
|
| | |
|
| | | // 新版通知
|
| | | userMoneyMsgNotificationService.inviteOrderWeiQuan(uid, orderId, drawBackMoney,
|
| | | userInfoMapper.selectByPrimaryKey(uid).getMyHongBao());
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | .selectByOrderIdAndOrderItemId(order.getOrderId(), order.getOrderItemId());
|
| | | if (taoBaoWeiQuanOrder != null) {
|
| | | // 已经是最新的状态了
|
| | | if (taoBaoWeiQuanOrder.getState().contains("维权成功")
|
| | | || taoBaoWeiQuanOrder.getState().contains("维权失败"))
|
| | | if (taoBaoWeiQuanOrder.getState().contains("维权成功") || taoBaoWeiQuanOrder.getState().contains("维权失败"))
|
| | | return;
|
| | | // 更新金额,状态与时间
|
| | | TaoBaoWeiQuanOrder update = new TaoBaoWeiQuanOrder();
|
| | |
| | | return taoBaoWeiQuanOrderMapper.selectByOrderItemId(tradeId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<TaoBaoWeiQuanOrder> listByState(String state, int page, int pageSize) {
|
| | | return taoBaoWeiQuanOrderMapper.listByState(state, (page - 1) * pageSize, pageSize);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | return list;
|
| | | }
|
| | |
|
| | | private void updateGoods(Long id) {
|
| | | DaTaoKeDetail detail = daTaoKeDetailMapper.selectByPrimaryKey(id);
|
| | | if (detail != null)
|
| | | return;
|
| | | detail = DaTaoKeApiUtil.getGoodsDetailV1(id);
|
| | | if (detail != null) {
|
| | | List<DaTaoKeDetail> list = new ArrayList<>();
|
| | | list.add(detail);
|
| | | addGoodsList(list);
|
| | | }
|
| | | }
|
| | |
|
| | | @Cacheable(value = "daTaoKeGoodsCache", key = "'getDingDongQiangData-'+#time")
|
| | | @Override
|
| | | public List<DaTaoKeDetail> getDingDongQiangData(String time) {
|
| | |
| | | return null;
|
| | | Map<String, DingDongQiangDTO> map = new HashMap<>();
|
| | | for (DingDongQiangDTO dto : list)
|
| | |
|
| | | map.put(dto.getTime(), dto);
|
| | |
|
| | | DingDongQiangDTO dto = map.get(time);
|
| | |
| | | for (DaTaoKeDetail td : dto.getGoodsList())
|
| | | idList.add(td.getId());
|
| | | List<DaTaoKeDetail> finalList = listByIds(idList);
|
| | | if (finalList.size() != idList.size()) {
|
| | | for (Long id : idList)
|
| | | updateGoods(id);
|
| | | finalList = listByIds(idList);
|
| | | }
|
| | |
|
| | | for (DaTaoKeDetail detail : finalList) {
|
| | | detail.setQuanReceive(
|
| | | detail.getQuanSurplus() + detail.getQuanReceive() - (int) (200 + Math.random() * 1000));
|
| | |
| | | * @return
|
| | | */
|
| | | public TaoBaoWeiQuanOrder listByorderItemId(String tradeId);
|
| | | |
| | | |
| | | /**
|
| | | * 根据状态检索
|
| | | * @param state
|
| | | * @param page
|
| | | * @param pageSize
|
| | | * @return
|
| | | */
|
| | | public List<TaoBaoWeiQuanOrder> listByState(String state,int page,int pageSize);
|
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.entity.taobao.TaoKeAppInfo;
|
| | | import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetail;
|
| | | import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetailV2;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | |
| | | resultJson.optJSONObject("data").optString("update_time"), list);
|
| | | }
|
| | |
|
| | | public static DaTaoKeDetail getGoodsDetailV1(Long id) {
|
| | | String url = String.format("http://api.dataoke.com/index.php?r=Port/index&type=total&appkey=%s&v=2&id=%s",
|
| | | Math.random() > 0.5 ? API_KEY : API_KEY_2, id + "");
|
| | | String result = request(url);
|
| | | JSONObject resultJson = JSONObject.fromObject(result);
|
| | | return gson.fromJson(resultJson.optJSONArray("result").optJSONObject(0).toString(), DaTaoKeDetail.class);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取大淘客品牌优选 品牌id
|
| | | *
|
| | |
| | | accountDetails.setType(AccountDetailsFactory.TUIKUAN);
|
| | | else
|
| | | accountDetails.setType(AccountDetailsFactory.QITA);
|
| | | accountDetails.setTitle(map.get(accountDetails.getType()));
|
| | | accountDetails.setTitle(accountDetails.getTitle());
|
| | | accountDetails.setUserInfo(userMoneyDetail.getUserInfo());
|
| | | return accountDetails;
|
| | | }
|
| | |
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | public static void getCouponByAuctionId(Long auctionId) {
|
| | | Map<String, String> map = new HashMap<>();
|
| | | map.put("method", "taobao.tbk.itemid.coupon.get");
|
| | | map.put("platform", 2 + "");
|
| | | map.put("pid", TaoBaoConstant.TAOBAO_RELATION_AS_SPECIAL_PID);
|
| | | map.put("num_iids", auctionId + "");
|
| | | TaoKeAppInfo app = new TaoKeAppInfo();
|
| | | app.setAppKey(TaoBaoConstant.TAOBAO_AUTH_APPKEY);
|
| | | app.setAppSecret(TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
|
| | | try {
|
| | | JSONObject json = TaoKeBaseUtil.baseRequest(map, app);
|
| | | System.out.print(json);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | class QuanInfo {
|