提交 ee54e456 authored 作者: zgy's avatar zgy

修改订单查询的bug

上级 8a1faa3c
...@@ -47,7 +47,6 @@ public class TokenVerification { ...@@ -47,7 +47,6 @@ public class TokenVerification {
"&&!execution(* com.diaoyun.zion.chinafrica.controller.GoodsTypeController.*(..))" + "&&!execution(* com.diaoyun.zion.chinafrica.controller.GoodsTypeController.*(..))" +
"&&!execution(* com.diaoyun.zion.chinafrica.controller.VersionController.*(..))" + "&&!execution(* com.diaoyun.zion.chinafrica.controller.VersionController.*(..))" +
"&&!execution(* com.diaoyun.zion.chinafrica.controller.TbCfFeeController.*(..))" + "&&!execution(* com.diaoyun.zion.chinafrica.controller.TbCfFeeController.*(..))" +
"&&!execution(* com.diaoyun.zion.chinafrica.controller.TbCfOrderController.*(..))" +
"&&!execution(* com.diaoyun.zion.chinafrica.controller.PayPalController.*(..))" + "&&!execution(* com.diaoyun.zion.chinafrica.controller.PayPalController.*(..))" +
"&&!execution(* com.diaoyun.zion.chinafrica.controller.ShopifyController.*(..))" "&&!execution(* com.diaoyun.zion.chinafrica.controller.ShopifyController.*(..))"
) )
......
...@@ -175,4 +175,16 @@ public class ShopifyController { ...@@ -175,4 +175,16 @@ public class ShopifyController {
public Result delReply(@ApiParam("回复ID") @RequestParam("replyId") String replyId) { public Result delReply(@ApiParam("回复ID") @RequestParam("replyId") String replyId) {
return tbCfReplyService.delReply(replyId); return tbCfReplyService.delReply(replyId);
} }
/**
* 通过商品标题搜索
*
* @param title
* @return
*/
@ApiOperation("搜索商品")
@GetMapping("/search")
public Result searchProducts(@ApiParam("商品标题") @RequestParam("title") String title) {
return shopifyService.searchProductByTitle(title);
}
} }
...@@ -52,7 +52,7 @@ public class TbCfOrderController { ...@@ -52,7 +52,7 @@ public class TbCfOrderController {
public Result<PageInfo> getUserOrderList(@ApiParam(value = "页数") @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, public Result<PageInfo> getUserOrderList(@ApiParam(value = "页数") @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
@ApiParam(value = "每页大小") @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, @ApiParam(value = "每页大小") @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@ApiParam(value = "订单状态") @RequestParam(value = "orderStatus", required = false) Integer orderStatus @ApiParam(value = "订单状态") @RequestParam(value = "orderStatus", required = false) Integer orderStatus
) { ) throws InterruptedException {
return tbCfOrderService.getUserOrderList(pageNum, pageSize, orderStatus); return tbCfOrderService.getUserOrderList(pageNum, pageSize, orderStatus);
} }
......
...@@ -18,6 +18,7 @@ public interface TbCfUserInfoDao extends BaseDao<TbCfUserInfoEntity> { ...@@ -18,6 +18,7 @@ public interface TbCfUserInfoDao extends BaseDao<TbCfUserInfoEntity> {
/** /**
* 根据nickname获取用户信息 * 根据nickname获取用户信息
*
* @param nickname * @param nickname
* @return * @return
*/ */
...@@ -25,19 +26,25 @@ public interface TbCfUserInfoDao extends BaseDao<TbCfUserInfoEntity> { ...@@ -25,19 +26,25 @@ public interface TbCfUserInfoDao extends BaseDao<TbCfUserInfoEntity> {
/** /**
* 根据用户名、昵称查找 * 根据用户名、昵称查找
*
* @param account * @param account
* @return * @return
*/ */
TbCfUserInfoEntity findByAccount(String account); TbCfUserInfoEntity findByAccount(String account);
TbCfUserInfoEntity findAccount(String account);
/** /**
* 根据手机号查找 * 根据手机号查找
*
* @param phone * @param phone
* @return * @return
*/ */
TbCfUserInfoEntity checkUserByPhone(String phone); TbCfUserInfoEntity checkUserByPhone(String phone);
/** /**
* 更改用户密码 * 更改用户密码
*
* @param userId * @param userId
* @param newPassword * @param newPassword
* @return * @return
...@@ -46,6 +53,7 @@ public interface TbCfUserInfoDao extends BaseDao<TbCfUserInfoEntity> { ...@@ -46,6 +53,7 @@ public interface TbCfUserInfoDao extends BaseDao<TbCfUserInfoEntity> {
/** /**
* 根据邮箱查询用户信息 * 根据邮箱查询用户信息
*
* @return * @return
*/ */
TbCfUserInfoEntity findByEmail(String email); TbCfUserInfoEntity findByEmail(String email);
......
...@@ -11,8 +11,13 @@ import org.springframework.web.bind.annotation.RequestParam; ...@@ -11,8 +11,13 @@ import org.springframework.web.bind.annotation.RequestParam;
* @Description: * @Description:
*/ */
public interface ShopifyService { public interface ShopifyService {
public Result queryShopifyProducts(); Result queryShopifyProducts();
public Result queryProductsByType(String product_type,String product_id);
public Result queryProductsDetails(String product_id); Result queryProductsByType(String product_type, String product_id);
public Result queryAllProducts(String product_id);
Result queryProductsDetails(String product_id);
Result queryAllProducts(String product_id);
Result searchProductByTitle(String title);
} }
...@@ -95,7 +95,7 @@ public interface TbCfOrderService { ...@@ -95,7 +95,7 @@ public interface TbCfOrderService {
* @param orderStatus 订单状态 OrderStatusEnum * @param orderStatus 订单状态 OrderStatusEnum
* @return * @return
*/ */
Result getUserOrderList(Integer pageNum, Integer pageSize,Integer orderStatus); Result getUserOrderList(Integer pageNum, Integer pageSize,Integer orderStatus) throws InterruptedException;
/** /**
* 取消订单 * 取消订单
......
...@@ -121,7 +121,7 @@ public interface TbCfUserInfoService { ...@@ -121,7 +121,7 @@ public interface TbCfUserInfoService {
* @return * @return
*/ */
TbCfUserInfoEntity findByAccount(String account); TbCfUserInfoEntity findByAccount(String account);
TbCfUserInfoEntity findAccount(String account);
/** /**
* 更改用户密码 * 更改用户密码
* @param newPassword * @param newPassword
......
...@@ -7,6 +7,7 @@ import com.diaoyun.zion.master.base.Result; ...@@ -7,6 +7,7 @@ import com.diaoyun.zion.master.base.Result;
import com.diaoyun.zion.master.common.RedisCache; import com.diaoyun.zion.master.common.RedisCache;
import com.diaoyun.zion.master.enums.ResultCodeEnum; import com.diaoyun.zion.master.enums.ResultCodeEnum;
import com.diaoyun.zion.master.util.HttpClientUtil; import com.diaoyun.zion.master.util.HttpClientUtil;
import net.sf.json.JSON;
import net.sf.json.JSONArray; import net.sf.json.JSONArray;
import net.sf.json.JSONObject; import net.sf.json.JSONObject;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -58,7 +59,7 @@ public class ShopifyServiceImpl implements ShopifyService { ...@@ -58,7 +59,7 @@ public class ShopifyServiceImpl implements ShopifyService {
params.put("limit", ShopifyConstant.SHOPIFY_LIMIT); params.put("limit", ShopifyConstant.SHOPIFY_LIMIT);
String data = HttpClientUtil.createConnection(ShopifyConstant.productTypeUrl(), params, "UTF-8"); String data = HttpClientUtil.createConnection(ShopifyConstant.productTypeUrl(), params, "UTF-8");
list.add(data); list.add(data);
redisCache.set(KeyConstant.SHOPIFY_ITEMS, list, 86400); redisCache.set(KeyConstant.SHOPIFY_ITEMS, list, 3600);
} }
System.out.println(list); System.out.println(list);
JSONArray jsonArr = JSONArray.fromObject(list); JSONArray jsonArr = JSONArray.fromObject(list);
...@@ -88,13 +89,13 @@ public class ShopifyServiceImpl implements ShopifyService { ...@@ -88,13 +89,13 @@ public class ShopifyServiceImpl implements ShopifyService {
} }
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("product_type", product_type); params.put("product_type", product_type);
params.put("limit", /*ShopifyConstant.SHOPIFY_PAGE_SIZE*/ "250"); //params.put("limit", ShopifyConstant.SHOPIFY_PAGE_SIZE);
params.put("since_id", product_id); params.put("since_id", product_id);
try { try {
String data = HttpClientUtil.createConnection(ShopifyConstant.productTypeUrl(), params, "UTF-8"); String data = HttpClientUtil.createConnection(ShopifyConstant.productTypeUrl(), params, "UTF-8");
JSONObject jsonObject = JSONObject.fromObject(data); JSONObject jsonObject = JSONObject.fromObject(data);
result.setData(jsonObject); result.setData(jsonObject);
//redisCache.set(KeyConstant.SHOPIFY_TYPE_ITEMS + product_type + product_id, data, 86400); redisCache.set(KeyConstant.SHOPIFY_TYPE_ITEMS + product_type + product_id, data, 3600);
} catch (IOException e) { } catch (IOException e) {
result.setCode(ResultCodeEnum.QUERY_ERROR.getCode()).setMessage(e.getMessage()); result.setCode(ResultCodeEnum.QUERY_ERROR.getCode()).setMessage(e.getMessage());
logger.error(e.getMessage(), e); logger.error(e.getMessage(), e);
...@@ -122,7 +123,7 @@ public class ShopifyServiceImpl implements ShopifyService { ...@@ -122,7 +123,7 @@ public class ShopifyServiceImpl implements ShopifyService {
params.put("ids", product_id); params.put("ids", product_id);
String data = HttpClientUtil.createConnection(ShopifyConstant.productTypeUrl(), params, "UTF-8"); String data = HttpClientUtil.createConnection(ShopifyConstant.productTypeUrl(), params, "UTF-8");
jsonProduct = JSONObject.fromObject(data); jsonProduct = JSONObject.fromObject(data);
redisCache.set(KeyConstant.SHOPIFY_ITEM + product_id, data, 86400); redisCache.set(KeyConstant.SHOPIFY_ITEM + product_id, data, 3600);
} }
result.setData(jsonProduct); result.setData(jsonProduct);
} catch (IOException e) { } catch (IOException e) {
...@@ -150,7 +151,7 @@ public class ShopifyServiceImpl implements ShopifyService { ...@@ -150,7 +151,7 @@ public class ShopifyServiceImpl implements ShopifyService {
return result; return result;
} }
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("limit", ShopifyConstant.SHOPIFY_PAGE_SIZE); //params.put("limit", ShopifyConstant.SHOPIFY_PAGE_SIZE);
params.put("since_id", product_id); params.put("since_id", product_id);
String data = HttpClientUtil.createConnection(ShopifyConstant.productTypeUrl(), params, "UTF-8"); String data = HttpClientUtil.createConnection(ShopifyConstant.productTypeUrl(), params, "UTF-8");
redisCache.set(KeyConstant.SHOPIFY_ITEMS_ALL + product_id, data); redisCache.set(KeyConstant.SHOPIFY_ITEMS_ALL + product_id, data);
...@@ -188,5 +189,27 @@ public class ShopifyServiceImpl implements ShopifyService { ...@@ -188,5 +189,27 @@ public class ShopifyServiceImpl implements ShopifyService {
return list; return list;
} }
/**
* 根据商品标题搜索
*
* @param title
* @return
*/
public Result searchProductByTitle(String title) {
Result result = new Result();
try {
Map<String, Object> params = new HashMap<>();
params.put("title", title);
String data = HttpClientUtil.createConnection(ShopifyConstant.productTypeUrl(), params, "UTF-8");
JSONObject jsonObject = JSONObject.fromObject(data);
result.setData(jsonObject);
} catch (Exception e) {
result.setCode(ResultCodeEnum.QUERY_ERROR.getCode()).setMessage(e.getMessage());
logger.error(e.getMessage(), e);
return result;
}
return result;
}
} }
...@@ -386,6 +386,10 @@ public class TbCfUserInfoServiceImpl implements TbCfUserInfoService { ...@@ -386,6 +386,10 @@ public class TbCfUserInfoServiceImpl implements TbCfUserInfoService {
return tbCfUserInfoEntity; return tbCfUserInfoEntity;
} }
public TbCfUserInfoEntity findAccount(String account) {
TbCfUserInfoEntity tbCfUserInfoEntity = tbCfUserInfoDao.findAccount(account);
return tbCfUserInfoEntity;
}
@Override @Override
public Result updatePassWord(String newPassword, String oldPassword) { public Result updatePassWord(String newPassword, String oldPassword) {
Result result = new Result(); Result result = new Result();
......
...@@ -16,8 +16,7 @@ public class MyUserDetails implements UserDetailsService { ...@@ -16,8 +16,7 @@ public class MyUserDetails implements UserDetailsService {
@Override @Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
final TbCfUserInfoEntity user = tbCfUserInfoService.findByAccount(username); final TbCfUserInfoEntity user = tbCfUserInfoService.findAccount(username);
if (user == null) { if (user == null) {
throw new UsernameNotFoundException("User '" + username + "' not found or disable"); throw new UsernameNotFoundException("User '" + username + "' not found or disable");
} }
......
...@@ -115,7 +115,7 @@ ...@@ -115,7 +115,7 @@
AND name LIKE concat('%',#{name},'%') AND name LIKE concat('%',#{name},'%')
</if> </if>
</select> </select>
<select id="checkUserByPhone" resultType="com.diaoyun.zion.chinafrica.entity.TbCfUserInfoEntity" > <select id="checkUserByPhone" resultType="com.diaoyun.zion.chinafrica.entity.TbCfUserInfoEntity">
select * from tb_cf_user_info select * from tb_cf_user_info
WHERE phone=#{phone} WHERE phone=#{phone}
</select> </select>
...@@ -210,15 +210,19 @@ ...@@ -210,15 +210,19 @@
<!--根据userId 账号 email nick 查找用户--> <!--根据userId 账号 email nick 查找用户-->
<select id="findByAccount" resultType="com.diaoyun.zion.chinafrica.entity.TbCfUserInfoEntity"> <select id="findByAccount" resultType="com.diaoyun.zion.chinafrica.entity.TbCfUserInfoEntity">
select * from tb_cf_user_info where enable_flag=1 and (user_id=#{userId} or account=#{account} select * from tb_cf_user_info where enable_flag=1 and (user_id=#{userId} or account=#{account}
or email =#{account} or nick =#{account}); or email =#{account} or nick =#{account})
</select> </select>
<!--根据userId 账号 email nick 查找用户-->
<select id="findAccount" resultType="com.diaoyun.zion.chinafrica.entity.TbCfUserInfoEntity">
select * from tb_cf_user_info where enable_flag=1 and account=#{account}
</select>
<!--根据userId 账号 email 查找用户--> <!--根据userId 账号 email 查找用户-->
<select id="findByEmail" resultType="com.diaoyun.zion.chinafrica.entity.TbCfUserInfoEntity"> <select id="findByEmail" resultType="com.diaoyun.zion.chinafrica.entity.TbCfUserInfoEntity">
select * from tb_cf_user_info where enable_flag=1 and account=#{email} or email =#{email}; select * from tb_cf_user_info where enable_flag=1 and account=#{email} or email =#{email}
</select> </select>
<!--修改密码--> <!--修改密码-->
<update id="updatePassWord" > <update id="updatePassWord">
update tb_cf_user_info set password=#{newPassword} where user_id=#{userId} update tb_cf_user_info set password=#{newPassword} where user_id=#{userId}
</update> </update>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论