diff --git a/bweb/src/main/java/com/bweb/controller/TestController.java b/bweb/src/main/java/com/bweb/controller/TestController.java index cdccc1a..23bc72b 100644 --- a/bweb/src/main/java/com/bweb/controller/TestController.java +++ b/bweb/src/main/java/com/bweb/controller/TestController.java @@ -30,6 +30,7 @@ import com.hfkj.service.pay.huift.TradeService; import com.jd.open.api.sdk.domain.vopsp.CategoryInfoGoodsProvider.response.getCategoryInfoList.GetCategoryInfoGoodsResp; import com.jd.open.api.sdk.domain.vopsp.SkuInfoGoodsProvider.response.getSkuDetailInfo.GetSkuPoolInfoGoodsResp; import com.jd.open.api.sdk.domain.vopxx.MsgRecordProvider.response.queryTransByVopNormal.VopBizTransMessage; +import com.jd.open.api.sdk.response.vopdd.VopOrderQueryOrderDetailResponse; import com.jd.open.api.sdk.response.vopdz.VopAddressConvertFourAreaByDetailStrResponse; import com.jd.open.api.sdk.response.vopxx.VopMessageQueryTransByVopNormalResponse; import io.swagger.annotations.Api; @@ -170,7 +171,45 @@ public class TestController { } } + @RequestMapping(value="/queryOrderDetailByJd",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "queryOrderDetailByJd") + public ResponseData queryOrderDetailByJd(@RequestParam(value = "childOrderNo" , required = true) String childOrderNo, + @RequestParam(value = "thirdOrderNo" , required = true) Long thirdOrderNo) { + try { + + VopOrderQueryOrderDetailResponse orderDetailResponse = JdPostService.queryOrderDetail(jdService.getToken(),thirdOrderNo, childOrderNo); + + return ResponseMsgUtil.success(orderDetailResponse); + + } catch (Exception e) { + log.error("error!",e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/sign",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "sign") + public ResponseData sign(@RequestParam(value = "phone" , required = true) String phone, + @RequestParam(value = "appid" , required = true) String appid, + @RequestParam(value = "appSecret" , required = true) String appSecret) { + try { + + Map map = new HashMap<>(); + map.put("appid" , appid); + map.put("phone" , phone); + String sign = SignatureUtil.createSign(map , appSecret); + + return ResponseMsgUtil.success(sign); + + } catch (Exception e) { + log.error("error!",e); + return ResponseMsgUtil.exception(e); + } + } + // 查询上游订单 @RequestMapping(value="/getSkuDetailInfo",method = RequestMethod.GET) @ResponseBody diff --git a/bweb/src/main/java/com/bweb/controller/goods/GoodsTypeController.java b/bweb/src/main/java/com/bweb/controller/goods/GoodsTypeController.java index 3b5895c..b4f6b40 100644 --- a/bweb/src/main/java/com/bweb/controller/goods/GoodsTypeController.java +++ b/bweb/src/main/java/com/bweb/controller/goods/GoodsTypeController.java @@ -87,8 +87,10 @@ public class GoodsTypeController { public ResponseData getList() { try { + Map map = new HashMap<>(); + map.put("status" , 1); - List list = goodsTypeService.getList(new HashMap<>()); + List list = goodsTypeService.getList(map); List goodsTypeModels = goodsTypeService.getGoodsTypeModelList(list); diff --git a/cweb/src/main/java/com/cweb/controller/discount/DiscountController.java b/cweb/src/main/java/com/cweb/controller/discount/DiscountController.java index b607f09..9a09016 100644 --- a/cweb/src/main/java/com/cweb/controller/discount/DiscountController.java +++ b/cweb/src/main/java/com/cweb/controller/discount/DiscountController.java @@ -9,6 +9,7 @@ import com.hfkj.common.exception.ErrorHelp; import com.hfkj.common.exception.SysCode; import com.hfkj.common.security.SessionObject; import com.hfkj.common.security.UserCenter; +import com.hfkj.common.utils.DateUtil; import com.hfkj.common.utils.ResponseMsgUtil; import com.hfkj.entity.*; import com.hfkj.haioil.HaiOilService; @@ -147,23 +148,37 @@ public class DiscountController { // 用户session UserSessionObject userSession = userCenter.getSessionModel(UserSessionObject.class); + int num = 0; + Map map = new HashMap<>(); - map.put("status" , 1); - map.put("phone" , userSession.getUser().getPhone()); - JSONObject object = HaiOilService.queryListByPhone(map); - int num = 0; - if (object.getString("return_code").equals("000000")) { - JSONArray array = object.getJSONObject("return_data").getJSONArray("dataList"); - num += array.size(); + if (userSession.getUser().getPhone() != null) { + + map.put("status" , 1); + map.put("phone" , userSession.getUser().getPhone()); + JSONObject object = HaiOilService.queryListByPhone(map); + if (object.getString("return_code").equals("000000")) { + JSONArray array = object.getJSONObject("return_data").getJSONArray("dataList"); + num += array.size(); + } } + map.put("userId", userSession.getUser().getId()); map.put("status", 1); List list = discountUserRelService.getList(map); + for (CouponDiscountUserRel discountUserRel : list) { + if (DateUtil.exceedingCurrentTime(discountUserRel.getUseEndTime())) { + num++; + } else { + discountUserRel.setStatus(0); + discountUserRelService.update(discountUserRel); + } + } + num += list.size(); return ResponseMsgUtil.success(num); diff --git a/cweb/src/main/java/com/cweb/controller/goods/GoodsController.java b/cweb/src/main/java/com/cweb/controller/goods/GoodsController.java index 5b93551..a0f8c2c 100644 --- a/cweb/src/main/java/com/cweb/controller/goods/GoodsController.java +++ b/cweb/src/main/java/com/cweb/controller/goods/GoodsController.java @@ -71,7 +71,6 @@ public class GoodsController { try { Map map = new HashMap<>(); - map.put("status" , 1); map.put("type" , type); List list = goodsTypeService.getList(map); diff --git a/order/src/main/java/com/order/controller/OrderController.java b/order/src/main/java/com/order/controller/OrderController.java index 89f13ce..197aeca 100644 --- a/order/src/main/java/com/order/controller/OrderController.java +++ b/order/src/main/java/com/order/controller/OrderController.java @@ -364,22 +364,22 @@ public class OrderController { GoodsUserAddress userAddress = goodsUserAddressService.queryDetail(body.getLong("addressId")); if (userAddress.getProvinceId() == null) { -// VopAddressConvertFourAreaByDetailStrResponse response = JdPostService.convertFourAreaByDetailStr(jdService.getToken() , userAddress.getRegionName() + userAddress.getAddress()); -// -// if (response != null && response.getOpenRpcResult().getSuccess()) { -// userAddress.setProvinceId(response.getOpenRpcResult().getResult().getProvinceId()); -// userAddress.setProvinceName(response.getOpenRpcResult().getResult().getProvinceName()); -// userAddress.setCityId(response.getOpenRpcResult().getResult().getCityId()); -// userAddress.setCityName(response.getOpenRpcResult().getResult().getCityName()); -// userAddress.setCountyId(response.getOpenRpcResult().getResult().getCountyId()); -// userAddress.setCountyName(response.getOpenRpcResult().getResult().getCountyName()); -// userAddress.setTownId(response.getOpenRpcResult().getResult().getTownId()); -// userAddress.setTownName(response.getOpenRpcResult().getResult().getTownName()); -// userAddress.setUpdateTime(new Date()); -// deliveryAddressService.update(userAddress); -// } else { -// throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, response.getOpenRpcResult().getResultMessage()); -// } + VopAddressConvertFourAreaByDetailStrResponse response = JdPostService.convertFourAreaByDetailStr(jdService.getToken() , userAddress.getRegionName() + userAddress.getAddress()); + + if (response != null && response.getOpenRpcResult().getSuccess()) { + userAddress.setProvinceId(response.getOpenRpcResult().getResult().getProvinceId()); + userAddress.setProvinceName(response.getOpenRpcResult().getResult().getProvinceName()); + userAddress.setCityId(response.getOpenRpcResult().getResult().getCityId()); + userAddress.setCityName(response.getOpenRpcResult().getResult().getCityName()); + userAddress.setCountyId(response.getOpenRpcResult().getResult().getCountyId()); + userAddress.setCountyName(response.getOpenRpcResult().getResult().getCountyName()); + userAddress.setTownId(response.getOpenRpcResult().getResult().getTownId()); + userAddress.setTownName(response.getOpenRpcResult().getResult().getTownName()); + userAddress.setUpdateTime(new Date()); + deliveryAddressService.update(userAddress); + } else { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, response.getOpenRpcResult().getResultMessage()); + } } List skuInfoList = new ArrayList<>(); diff --git a/service/src/main/java/com/hfkj/common/utils/DateUtil.java b/service/src/main/java/com/hfkj/common/utils/DateUtil.java index 0b77791..e22ed48 100644 --- a/service/src/main/java/com/hfkj/common/utils/DateUtil.java +++ b/service/src/main/java/com/hfkj/common/utils/DateUtil.java @@ -781,6 +781,22 @@ public class DateUtil { } } + public static boolean exceedingCurrentTime(Date time) { + // 获取当前时间 + Date currentDate = new Date(); + + // 判断时间是否大于当前时间 + + Calendar calendar1 = Calendar.getInstance(); + calendar1.setTime(currentDate); + + Calendar calendar2 = Calendar.getInstance(); + calendar2.setTime(time); + + // 时间大于当前时间 为true + return calendar1.compareTo(calendar2) < 0; + } + public static void main(String[] args) throws Exception { String a = "51130319931105651X"; diff --git a/service/src/main/java/com/hfkj/dao/GoodsMsgMapperExt.java b/service/src/main/java/com/hfkj/dao/GoodsMsgMapperExt.java index f6b05c9..cdab966 100644 --- a/service/src/main/java/com/hfkj/dao/GoodsMsgMapperExt.java +++ b/service/src/main/java/com/hfkj/dao/GoodsMsgMapperExt.java @@ -67,6 +67,7 @@ public interface GoodsMsgMapperExt { " a.goods_brand_name as goodsBrandName," + " a.title as title," + " a.list_img as listImg," + + " a.sale_num as saleNum," + " b.sale_price as salePrice, " + " b.sale_price as price, " + " b.third_price as thirdPrice," + @@ -85,12 +86,13 @@ public interface GoodsMsgMapperExt { " and a.show_type = #{param.showType} " + " and b.id in #{item} " + " and a.goods_brand = #{param.goodsBrand} " + - " b.sale_price asc" + - " b.sale_price desc" + - " , a.sale_num desc" + + " group by a.id) c" + - " ORDER BY c.updateTime desc" + - " ORDER BY c.createtime desc" + + " ORDER BY c.updateTime desc" + + " ORDER BY c.createtime asc" + + " ORDER BY c.salePrice asc" + + " ORDER BY c.salePrice desc" + + " ORDER BY c.saleNum desc" + " limit #{param.limit}" + "") List getGoodsListCrest(@Param("param") Map param); diff --git a/service/src/main/java/com/hfkj/service/goods/impl/BsOrderGoodsServiceImpl.java b/service/src/main/java/com/hfkj/service/goods/impl/BsOrderGoodsServiceImpl.java index dc4be80..5bd1854 100644 --- a/service/src/main/java/com/hfkj/service/goods/impl/BsOrderGoodsServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/goods/impl/BsOrderGoodsServiceImpl.java @@ -315,7 +315,7 @@ public class BsOrderGoodsServiceImpl implements BsOrderGoodsService { } @Override - public void confirmReceipt(Long orderGoodsId) { + public void confirmReceipt(Long orderGoodsId){ BsOrderGoods orderGoods = queryDetail(orderGoodsId); if (orderGoods == null || diff --git a/service/src/main/java/com/hfkj/service/order/impl/BsOrderServiceImpl.java b/service/src/main/java/com/hfkj/service/order/impl/BsOrderServiceImpl.java index a1985a5..8beeac1 100644 --- a/service/src/main/java/com/hfkj/service/order/impl/BsOrderServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/order/impl/BsOrderServiceImpl.java @@ -706,7 +706,6 @@ public class BsOrderServiceImpl implements BsOrderService { totalSalePrice = totalSalePrice.add(jsonObject.getBigDecimal("salePrice")); totalDrawModePrice = totalDrawModePrice.add(jsonObject.getBigDecimal("fastDrawModePrice")); } - } } }