From 51ee3c4db2eb49062d3236bf44f95dc22f8f6ac9 Mon Sep 17 00:00:00 2001 From: puhanshu <a9236326> Date: 星期五, 14 一月 2022 17:59:03 +0800 Subject: [PATCH] 商业街bug修改 --- springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/microCommercialStreet/McsOrderVO.java | 3 + springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/McsCouponMapper.xml | 3 + springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/entity/McsOrder.java | 2 + springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/DateUtils.java | 20 ++++++++++ springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/filter/StoreValidFilter.java | 14 ++++++ springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/microCommercialStreet/McsCouponVO.java | 6 +++ springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsGameServiceImpl.java | 2 springcloud_k8s_panzhihuazhihuishequ/zuul/src/main/java/com/panzhihua/zuul/filters/JWTAuthenticationTokenFilter.java | 7 +++ springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsOrderServiceImpl.java | 14 +++++++ springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsInformationServiceImpl.java | 2 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsMerchantServiceImpl.java | 3 + springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/McsOrderMapper.xml | 1 springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/api/McsOrderApi.java | 1 13 files changed, 73 insertions(+), 5 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/microCommercialStreet/McsCouponVO.java b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/microCommercialStreet/McsCouponVO.java index bcc9ba2..de61745 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/microCommercialStreet/McsCouponVO.java +++ b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/microCommercialStreet/McsCouponVO.java @@ -55,4 +55,10 @@ @ApiModelProperty("游戏封面") private String cover; + + @ApiModelProperty("奖励类型(1.免费产品 2.免费服务)") + private Integer awardType; + + @ApiModelProperty("戳戳币分配方式(1.随机分配 2.平均分配)") + private Integer allocation; } diff --git a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/microCommercialStreet/McsOrderVO.java b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/microCommercialStreet/McsOrderVO.java index e529233..52a67b1 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/microCommercialStreet/McsOrderVO.java +++ b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/microCommercialStreet/McsOrderVO.java @@ -93,6 +93,9 @@ @ApiModelProperty("订单取消剩余倒计时") private Long cancelCountdown; + @ApiModelProperty("支付方式") + private String paymentMethod; + @ApiModelProperty(value = "用户真实ip", hidden = true) private String clientIp; } diff --git a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/DateUtils.java b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/DateUtils.java index 09eec8b..32e88b0 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/DateUtils.java +++ b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/DateUtils.java @@ -819,6 +819,26 @@ } /** + * 计算剩余天数,不足一天按一天算 + * @param expireDate + * @return + */ + public static int retrieveRemainingDays(Date expireDate) { + Date nowDate = new Date(); + Calendar startDate = Calendar.getInstance(); + startDate.setTime(nowDate); + Calendar endDate = Calendar.getInstance(); + endDate.setTime(expireDate); + Calendar date = (Calendar) startDate.clone(); + int daysBetween = 0; + while (date.before(endDate)) { + date.add(Calendar.DAY_OF_MONTH, 1); + daysBetween++; + } + return daysBetween; + } + + /** * 获取当前月第一天 * * @return diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/entity/McsOrder.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/entity/McsOrder.java index b6c5b2a..0d2cb56 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/entity/McsOrder.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/entity/McsOrder.java @@ -91,4 +91,6 @@ private Date createTime; private String merchantName; + + private String paymentMethod; } diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsGameServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsGameServiceImpl.java index db83cb2..f3fc3c2 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsGameServiceImpl.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsGameServiceImpl.java @@ -330,7 +330,7 @@ TopStatisticsVO topStatisticsVO = new TopStatisticsVO(); topStatisticsVO.setExpireAt(mcsMerchant.getExpireAt()); if (nonNull(mcsMerchant.getExpireAt())) { - int surplusLitDays = DateUtils.differentDays(new Date(), mcsMerchant.getExpireAt()); + int surplusLitDays = DateUtils.retrieveRemainingDays(mcsMerchant.getExpireAt()); topStatisticsVO.setSurplusLitDays(surplusLitDays > 0 ? surplusLitDays : 0); } Integer appliedCount = this.baseMapper.selectAppliedCount(mcsMerchant.getId()); diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsInformationServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsInformationServiceImpl.java index e9072ee..5952e34 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsInformationServiceImpl.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsInformationServiceImpl.java @@ -132,7 +132,7 @@ TopStatisticsVO topStatisticsVO = new TopStatisticsVO(); topStatisticsVO.setExpireAt(mcsMerchant.getExpireAt()); if (nonNull(mcsMerchant.getExpireAt())) { - int surplusLitDays = DateUtils.differentDays(new Date(), mcsMerchant.getExpireAt()); + int surplusLitDays = DateUtils.retrieveRemainingDays(mcsMerchant.getExpireAt()); topStatisticsVO.setSurplusLitDays(surplusLitDays > 0 ? surplusLitDays : 0); } diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsMerchantServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsMerchantServiceImpl.java index 3d20c0a..6ca64de 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsMerchantServiceImpl.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsMerchantServiceImpl.java @@ -6,6 +6,7 @@ import static org.apache.commons.lang3.StringUtils.isNotEmpty; import java.util.Arrays; +import java.util.Calendar; import java.util.Date; import java.util.List; import java.util.Random; @@ -441,7 +442,7 @@ Integer idleTotal = publishLimit - publishCount; merchantVO.setIdleTotal(idleTotal > 0 ? idleTotal : 0); if (nonNull(merchantVO.getExpireAt())) { - int surplusLitDays = DateUtils.differentDays(new Date(), merchantVO.getExpireAt()); + int surplusLitDays = DateUtils.retrieveRemainingDays(merchantVO.getExpireAt()); merchantVO.setSurplusLitDays(surplusLitDays > 0 ? surplusLitDays : 0); } } diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsOrderServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsOrderServiceImpl.java index 3624ae3..a14e3e5 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsOrderServiceImpl.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsOrderServiceImpl.java @@ -11,6 +11,8 @@ import com.panzhihua.common.utlis.SmsUtil; import com.panzhihua.common.utlis.StringUtils; import com.panzhihua.common.utlis.WxPayUtils; +import com.panzhihua.service_community.dao.McsMerchantDAO; +import com.panzhihua.service_community.entity.McsMerchant; import com.panzhihua.service_community.entity.McsOrder; import com.panzhihua.service_community.dao.McsOrderDao; import com.panzhihua.service_community.service.McsMerchantService; @@ -52,6 +54,8 @@ private RabbitTemplate rabbitTemplate; @Resource private McsMerchantService mcsMerchantService; + @Resource + private McsMerchantDAO mcsMerchantDAO; private static String H5_LOGIN_APPID="wx475fcd33c8030df8"; @Override @@ -61,8 +65,17 @@ @Override public R insert(McsOrderVO mcsOrderVO) { + McsMerchant mcsMerchant = mcsMerchantDAO.selectOne(new QueryWrapper<McsMerchant>().lambda() + .eq(McsMerchant::getUserId, mcsOrderVO.getUserId())); McsOrder mcsOrder=new McsOrder(); BeanUtils.copyProperties(mcsOrderVO,mcsOrder); + if (nonNull(mcsMerchant)) { + if (mcsMerchant.getIsDel()) { + mcsMerchantDAO.deleteById(mcsMerchant.getId()); + } else { + mcsOrder.setMerchantId(mcsMerchant.getId()); + } + } mcsOrder.setStatus(0); mcsOrder.setCreateTime(new Date()); mcsOrder.setOrderNo(DateUtils.getCurrentDateStrNoSignal()); @@ -131,6 +144,7 @@ mcsOrderBase.setStatus(1); mcsOrderBase.setPayNo(mcsOrderVO.getPayNo()); mcsOrderBase.setPayTime(mcsOrderVO.getPayTime()); + mcsOrderBase.setPaymentMethod("微信支付"); int i=this.baseMapper.updateById(mcsOrderBase); if(i>0){ R r = mcsMerchantService.updateOrAddMcsMerchantAfterOrder(mcsOrderBase.getMerchantName(), mcsOrderBase.getConfigId(), mcsOrderBase.getUserId()); diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/McsCouponMapper.xml b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/McsCouponMapper.xml index 8b0f586..61ab3bd 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/McsCouponMapper.xml +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/McsCouponMapper.xml @@ -55,7 +55,8 @@ </select> <select id="pageJoinGameList" resultType="com.panzhihua.common.model.vos.community.microCommercialStreet.McsCouponVO"> - SELECT t1.*, t2.type, t2.`name`, t2.expire_at, t2.cover, t2.id AS gameId, IF(t3.id IS NULL,2,1) AS isEvaluate, t3.id AS evaluateId + SELECT t1.*, t2.type, t2.`name`, t2.expire_at, t2.cover, t2.id AS gameId, t2.award_type, t2.allocation, + IF(t3.id IS NULL,2,1) AS isEvaluate, t3.id AS evaluateId FROM mcs_coupon t1 LEFT JOIN mcs_game t2 ON t1.game_id = t2.id LEFT JOIN mcs_evaluate t3 ON t1.id = t3.coupon_id diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/McsOrderMapper.xml b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/McsOrderMapper.xml index 471750a..ce6cd03 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/McsOrderMapper.xml +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/McsOrderMapper.xml @@ -13,6 +13,7 @@ <result property="merchantId" column="merchant_id"/> <result property="payNo" column="pay_no"/> <result property="userId" column="user_id"/> + <result property="paymentMethod" column="payment_method"/> </resultMap> <select id="pageList" resultType="com.panzhihua.common.model.vos.community.microCommercialStreet.McsOrderVO"> diff --git a/springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/api/McsOrderApi.java b/springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/api/McsOrderApi.java index 314ddd6..8792897 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/api/McsOrderApi.java +++ b/springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/api/McsOrderApi.java @@ -80,6 +80,7 @@ @ApiOperation("新增数据") @PostMapping public R insert(@RequestBody McsOrderVO mcsOrderVO) { + mcsOrderVO.setUserId(this.getUserId()); return communityService.insertMscOrder(mcsOrderVO); } diff --git a/springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/filter/StoreValidFilter.java b/springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/filter/StoreValidFilter.java index e1d73b0..e6c06b3 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/filter/StoreValidFilter.java +++ b/springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/filter/StoreValidFilter.java @@ -1,6 +1,8 @@ package com.panzhihua.shop_backstage.filter; import java.io.IOException; +import java.util.ArrayList; +import java.util.List; import javax.annotation.Resource; import javax.servlet.Filter; @@ -57,7 +59,17 @@ boolean getConfig = uri.contains("/config/all"); boolean isUpload = "/convenient/upload/file".equals(uri); - if (isDoc || isUpload || isLogin || mcsGetCode || wxNotify || mcsBindPhone || getConfig) { + List<String> noLoginUrl = new ArrayList<>(); + + noLoginUrl.add("/api/shopbackstage/microcommercialstreet/merchant/get"); + noLoginUrl.add("/api/shopbackstage/microcommercialstreet/index/topData"); + noLoginUrl.add("/api/shopbackstage/microcommercialstreet/information/pageH5"); + noLoginUrl.add("/api/shopbackstage/microcommercialstreet/game/pageH5"); + noLoginUrl.add("/api/shopbackstage/microcommercialstreet/game/get"); + noLoginUrl.add("/api/shopbackstage/microcommercialstreet/info/get"); + noLoginUrl.add("/api/shopbackstage/microcommercialstreet/merchant/pageH5"); + + if (isDoc || isUpload || isLogin || mcsGetCode || wxNotify || mcsBindPhone || getConfig || noLoginUrl.contains(uri)) { //放过swagger请求 } else { String userInfo = request.getHeader(TokenConstant.TOKEN_USERINFO); diff --git a/springcloud_k8s_panzhihuazhihuishequ/zuul/src/main/java/com/panzhihua/zuul/filters/JWTAuthenticationTokenFilter.java b/springcloud_k8s_panzhihuazhihuishequ/zuul/src/main/java/com/panzhihua/zuul/filters/JWTAuthenticationTokenFilter.java index b476d66..116acd2 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/zuul/src/main/java/com/panzhihua/zuul/filters/JWTAuthenticationTokenFilter.java +++ b/springcloud_k8s_panzhihuazhihuishequ/zuul/src/main/java/com/panzhihua/zuul/filters/JWTAuthenticationTokenFilter.java @@ -283,6 +283,13 @@ noLoginUrl.add("/api/shopbackstage/microcommercialstreet/bindPhone"); noLoginUrl.add("/api/shopbackstage/microcommercialstreet/bind/verifyCode"); noLoginUrl.add("/api/shopbackstage/microcommercialstreet/config/all"); + noLoginUrl.add("/api/shopbackstage/microcommercialstreet/merchant/get"); + noLoginUrl.add("/api/shopbackstage/microcommercialstreet/index/topData"); + noLoginUrl.add("/api/shopbackstage/microcommercialstreet/information/pageH5"); + noLoginUrl.add("/api/shopbackstage/microcommercialstreet/game/pageH5"); + noLoginUrl.add("/api/shopbackstage/microcommercialstreet/game/get"); + noLoginUrl.add("/api/shopbackstage/microcommercialstreet/info/get"); + noLoginUrl.add("/api/shopbackstage/microcommercialstreet/merchant/pageH5"); if (noLoginUrl.contains(requestURI)) { List<SimpleGrantedAuthority> authorities = new ArrayList<>(); authorities.add(new SimpleGrantedAuthority(SecurityConstants.ROLE_APPLETS)); -- Gitblit v1.7.1