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

修改订单查询的bug

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