| | |
| | |
|
| | | try {
|
| | | List<BrandClass> list = brandClassService.listQuery((pageIndex - 1) * pageSize, pageSize, key, state);
|
| | |
|
| | | if (list == null || list.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
|
| | | return;
|
| | |
| | | @RequestMapping(value = "activationInvite")
|
| | | public void activationInvite(AcceptData acceptData, String callback, Long uid, String inviteCode, PrintWriter out) {
|
| | | try {
|
| | |
|
| | | if (uid == null || inviteCode == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("传递参数不正确"));
|
| | | return;
|
| | |
| | | }
|
| | |
|
| | | String rule = configTaoLiJinService.getValueByKey("new_user_free_buy_list_rule");
|
| | | rule.replace("{链接}", configService.get("customer_service_link"));
|
| | | rule = rule.replace("{链接}", configService.get("customer_service_link"));
|
| | |
|
| | | data.put("state", state);
|
| | | data.put("balance","新人红包:" + balance.setScale(2) + "元");
|
| | |
| | | <select id="getUserInfoByInviteCode" resultMap="BaseResultMap">
|
| | | SELECT * FROM yeshi_ec_user u
|
| | | LEFT JOIN yeshi_ec_user_info_extra uf ON uf.`uie_uid` = u.`id`
|
| | | WHERE uf.`uie_invite_code_vip` = ${inviteCode} OR uf.`uie_invite_code` = ${inviteCode}
|
| | | WHERE uf.`uie_invite_code_vip` = #{inviteCode} OR uf.`uie_invite_code` = #{inviteCode}
|
| | | LIMIT 1
|
| | | </select>
|
| | |
|
| | |
| | | |
| | | <select id="countByInviteCode" resultType="Long"> |
| | | SELECT IFNULL(COUNT(uie_id),0) FROM yeshi_ec_user_info_extra |
| | | WHERE uie_invite_code = ${inviteCode} OR uie_invite_code_vip = ${inviteCode} |
| | | WHERE uie_invite_code = #{inviteCode} OR uie_invite_code_vip = #{inviteCode} |
| | | </select> |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | |
| | | @Override
|
| | | public void saveObject(BrandClass record) throws BrandClassException, Exception{
|
| | | Long gcid = record.getGcid();
|
| | | if (gcid != null) {
|
| | | GoodsClass goodsClass = goodsClassService.selectByPrimaryKey(gcid);
|
| | | if (goodsClass != null) {
|
| | | record.setName(goodsClass.getName());
|
| | | record.setGoodsClass(goodsClass);
|
| | | }
|
| | | }
|
| | | if (gcid != null) |
| | | record.setGoodsClass(new GoodsClass(gcid));
|
| | |
|
| | | String name = record.getName();
|
| | | if (name == null || name.trim().length() == 0) {
|
| | | if (name == null || name.trim().length() == 0)
|
| | | throw new BrandClassException(1, "名称和分类不能同时为空");
|
| | | }
|
| | |
|
| | | Integer state = record.getState();
|
| | | if (state == null) {
|
| | | if (state == null)
|
| | | record.setState(0);
|
| | | }
|
| | | |
| | | record.setUpdateTime(new Date());
|
| | |
|
| | | Long id = record.getId();
|
| | | if (id == null) {
|
| | | record.setOrderBy(brandClassMapper.getMaxOrder() + 1);
|
| | | record.setCreateTime(new Date());
|
| | | record.setUpdateTime(new Date());
|
| | | brandClassMapper.insert(record);
|
| | | } else {
|
| | | BrandClass resultObj = brandClassMapper.selectByPrimaryKey(id);
|
| | | if (resultObj == null) {
|
| | | if (resultObj == null)
|
| | | throw new BrandClassException(1, "修改内容已不存在");
|
| | | }
|
| | | record.setOrderBy(resultObj.getOrderBy());
|
| | | record.setCreateTime(resultObj.getCreateTime());
|
| | | record.setUpdateTime(new Date());
|
| | | brandClassMapper.updateByPrimaryKey(record);
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | @Override
|
| | | public void updateOrder(Long id, Integer moveType) throws BrandClassException, Exception{
|
| | |
|
| | | if (moveType == null || (!moveType.equals(1) && !moveType.equals(-1))) {
|
| | | if (moveType == null || (!moveType.equals(1) && !moveType.equals(-1)))
|
| | | throw new BrandClassException(1, "传递的类型不正确");
|
| | | }
|
| | |
|
| | | if (id == null) {
|
| | | if (id == null) |
| | | throw new BrandClassException(1, "ID不能为空");
|
| | | }
|
| | |
|
| | | BrandClass resultObj = brandClassMapper.selectByPrimaryKey(id);
|
| | | if (resultObj == null) {
|
| | | if (resultObj == null)
|
| | | throw new BrandClassException(1, "操作数据已不存在");
|
| | | }
|
| | |
|
| | | Integer oldOrder = resultObj.getOrderBy();
|
| | | BrandClass changeObj = brandClassMapper.getByAdjoinOrder(oldOrder, moveType);
|
| | |
|
| | | if (changeObj == null ) {
|
| | | if (changeObj == null )
|
| | | throw new BrandClassException(1, "已经在最边缘,无可交换的位置");
|
| | | }
|
| | | |
| | | // 交换排序序号
|
| | | resultObj.setOrderBy(changeObj.getOrderBy());
|
| | | changeObj.setOrderBy(oldOrder);
|
| | |
| | |
|
| | | @Override
|
| | | public int deleteBatchByPrimaryKey(List<Long> list) {
|
| | | // 删除已匹配的分类关系
|
| | | brandClassShopService.deleteBatchByClassId(list);
|
| | | |
| | | return brandClassMapper.deleteBatchByPrimaryKey(list);
|
| | | }
|
| | |
|
| | |
|
| | | @Override
|
| | | public List<BrandClass> listQuery(long start, int count, String key, Integer state) {
|
| | | |
| | | List<BrandClass> listQuery = brandClassMapper.listQuery(start, count, key, state);
|
| | | if (listQuery == null || listQuery.size() == 0) {
|
| | | return listQuery;
|
| | |
| | | public long countQuery(String key, Integer state) {
|
| | | return brandClassMapper.countQuery(key, state);
|
| | | }
|
| | | |
| | |
|
| | |
|
| | | }
|
| | |
| | | public List<TaoBaoGoodsBrief> listPreGoods(String key ,int page) {
|
| | | List<TaoBaoGoodsBrief> goodsList = new ArrayList<>();
|
| | | // 大淘客筛选: 券后价 1-2区间 、综合排序
|
| | | DaTaoKeGoodsResult result = DaTaoKeApiUtil.search(key, null, new BigDecimal(1), new BigDecimal(2), 1, page, 100, 0);
|
| | | // DaTaoKeGoodsResult result = DaTaoKeApiUtil.search(key, null, new BigDecimal(1), new BigDecimal(2), 1, page, 100, 0);
|
| | | DaTaoKeGoodsResult result = DaTaoKeApiUtil.getGoodsList(key, null, new BigDecimal(1), new BigDecimal(2), 1, page, 100, 0);
|
| | |
|
| | | |
| | | if (result != null && result.getGoodsList() != null) {
|
| | | for (DaTaoKeDetailV2 v2 : result.getGoodsList())
|
| | | goodsList.add(TaoBaoUtil.convert(v2));
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public String activateInviteCode(Long uid, String inviteCode) throws UserInfoExtraException {
|
| | | if (uid == null || inviteCode == null)
|
| | | throw new UserInfoExtraException(1, "激活信息不能为空");
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void activationInviteWX(WXAccountInfoDTO wxAccount, Long uid, String code) throws UserInfoExtraException {
|
| | | if (uid == null || code == null)
|
| | | throw new UserInfoExtraException(1, "激活信息不完整");
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void activeInviteWX(Long uid, WeiXinUser weiXinUser) throws UserInfoExtraException {
|
| | | if (uid == null || weiXinUser == null) {
|
| | | throw new UserInfoExtraException(1, "激活信息不完整");
|
| | |
| | | params.put("cids", cids);
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(key))
|
| | | key = "";
|
| | | key = "%";
|
| | | params.put("keyWords", key);
|
| | |
|
| | | if (sort != null)
|
| | |
| | | return daTaoKeGoodsResult;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 商品列表
|
| | | * @param key
|
| | | * @param cidList
|
| | | * @param priceLowerLimit
|
| | | * @param priceUpperLimit
|
| | | * @param couponPriceLowerLimit
|
| | | * @param pageId
|
| | | * @param pageSize
|
| | | * @param sort
|
| | | * @return
|
| | | */
|
| | | public static DaTaoKeGoodsResult getGoodsList(String key, List<Integer> cidList, BigDecimal priceLowerLimit,
|
| | | BigDecimal priceUpperLimit, Integer couponPriceLowerLimit, int pageId, int pageSize, Integer sort) {
|
| | | TaoKeAppInfo app = getRandomApp();
|
| | | DaTaoKeGoodsResult daTaoKeGoodsResult = new DaTaoKeGoodsResult();
|
| | | Map<String, String> params = new TreeMap<>();
|
| | | params.put("version", "v1.1.0");
|
| | | params.put("appKey", app.getAppKey());
|
| | | params.put("pageSize", pageSize + "");
|
| | | params.put("pageId", pageId + "");
|
| | | |
| | | if (priceLowerLimit != null)
|
| | | params.put("priceLowerLimit", priceLowerLimit + "");
|
| | | if (priceUpperLimit != null)
|
| | | params.put("priceUpperLimit", priceUpperLimit + "");
|
| | | |
| | | if (couponPriceLowerLimit != null)
|
| | | params.put("couponPriceLowerLimit", couponPriceLowerLimit + "");
|
| | | |
| | | if (sort != null)
|
| | | params.put("sort", sort +"");
|
| | | |
| | | params.put("sign", getSign(params, app.getAppSecret()));
|
| | | String result = HttpUtil.get("https://openapi.dataoke.com/api/goods/get-goods-list", params, new HashMap<>());
|
| | | JSONObject json = JSONObject.fromObject(result);
|
| | | JSONObject dataJson = json.optJSONObject("data");
|
| | | if (dataJson != null) {
|
| | | JSONArray array = dataJson.optJSONArray("list");
|
| | | if (array != null) {
|
| | | List<DaTaoKeDetailV2> list = parseDaTaoKeDetailV2List(array);
|
| | | daTaoKeGoodsResult.setGoodsList(list);
|
| | | }
|
| | | daTaoKeGoodsResult.setPageId(dataJson.optString("pageId"));
|
| | | daTaoKeGoodsResult.setTotalCount(dataJson.optLong("totalNum"));
|
| | | }
|
| | | return daTaoKeGoodsResult;
|
| | | }
|
| | |
|
| | | private static String getSign(Map<String, String> map, String secretKey) {
|
| | | if (map.size() == 0) {
|