Эх сурвалжийг харах

feat: 发微信通知demo

wrj 11 сар өмнө
parent
commit
00126289b4

+ 6 - 0
nightFragrance-admin/src/main/java/com/ylx/web/controller/massage/CouponReceiveController.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ylx.massage.domain.CouponReceive;
 import com.ylx.massage.domain.CouponReceive;
 import com.ylx.common.core.domain.R;
 import com.ylx.common.core.domain.R;
+import com.ylx.massage.domain.vo.CouponReceiveVo;
 import com.ylx.massage.service.CouponReceiveService;
 import com.ylx.massage.service.CouponReceiveService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
@@ -68,6 +69,11 @@ public class CouponReceiveController {
         return R.ok(this.couponReceiveService.submit(couponReceive));
         return R.ok(this.couponReceiveService.submit(couponReceive));
     }
     }
 
 
+    @PostMapping("myCoupon")
+    @ApiOperation("我的优惠卷")
+    public R<List<CouponReceiveVo>> myCoupon(@RequestBody CouponReceive couponReceive) {
+        return R.ok(this.couponReceiveService.getByOpenId(couponReceive.getOpenid()));
+    }
     /**
     /**
      * 删除数据
      * 删除数据
      *
      *

+ 2 - 2
nightFragrance-admin/src/main/java/com/ylx/web/controller/massage/TAddressController.java

@@ -84,7 +84,7 @@ public class TAddressController extends BaseController {
     @PostMapping("save")
     @PostMapping("save")
     @ApiOperation("新增地址")
     @ApiOperation("新增地址")
     public R insert(@RequestBody TAddress tAddress) {
     public R insert(@RequestBody TAddress tAddress) {
-        return R.ok(this.tAddressService.save(tAddress));
+        return R.ok(this.tAddressService.insertAddress(tAddress));
     }
     }
 
 
     /**
     /**
@@ -96,7 +96,7 @@ public class TAddressController extends BaseController {
     @PostMapping("/update")
     @PostMapping("/update")
     @ApiOperation("修改地址")
     @ApiOperation("修改地址")
     public R update(@RequestBody TAddress tAddress) {
     public R update(@RequestBody TAddress tAddress) {
-        return R.ok(this.tAddressService.updateById(tAddress));
+        return R.ok(this.tAddressService.updateAddress(tAddress));
     }
     }
 
 
     /**
     /**

+ 1 - 1
nightFragrance-admin/src/main/java/com/ylx/web/controller/massage/TJsController.java

@@ -271,7 +271,7 @@ public class TJsController extends BaseController {
 
 
         WxMaSubscribeMessage.MsgData msgData = new WxMaSubscribeMessage.MsgData();
         WxMaSubscribeMessage.MsgData msgData = new WxMaSubscribeMessage.MsgData();
         msgData.setName("key2");
         msgData.setName("key2");
-        msgData.setValue("你好,f");
+        msgData.setValue("");
         //添加你配置要且要展示的内容
         //添加你配置要且要展示的内容
         subscribeDataList.add(subscribeData);
         subscribeDataList.add(subscribeData);
 
 

+ 6 - 6
nightFragrance-admin/src/main/resources/application-dev.yml

@@ -204,19 +204,19 @@ fare:
 wx:
 wx:
   base-url: https://api.weixin.qq.com/
   base-url: https://api.weixin.qq.com/
   # AppID(小程序ID)
   # AppID(小程序ID)
-#  app-id: wxb2ae0f4ee11e8705
-  app-id: wxe8661ef542cd963c
+  app-id: wxb2ae0f4ee11e8705
+#  app-id: wxe8661ef542cd963c
   # AppSecret(小程序密钥)
   # AppSecret(小程序密钥)
-#  app-secret: 28504227c2662cfb1b39a5baf750bb59
-  app-secret: 7439a36812c1850d060567bce51159ec
+  app-secret: 28504227c2662cfb1b39a5baf750bb59
+#  app-secret: 7439a36812c1850d060567bce51159ec
   # 商户号
   # 商户号
   mch-id: 1675015090
   mch-id: 1675015090
   # 商户秘钥
   # 商户秘钥
   mch-key: 39C9AIJ1RQKT3I8V16BYZ6LLBI0H30NB
   mch-key: 39C9AIJ1RQKT3I8V16BYZ6LLBI0H30NB
   # 异步回调地址
   # 异步回调地址
-  notify-url: https://7a75cfa.r7.cpolar.top/wx/pay/payNotify
+  notify-url: https://48131076.r21.cpolar.top/wx/pay/payNotify
   # 异步退款回调地址
   # 异步退款回调地址
-  refund-Notify: https://7a75cfa.r7.cpolar.top/wx/pay/refundNotify
+  refund-Notify: https://48131076.r21.cpolar.top/wx/pay/refundNotify
   # 证书地址
   # 证书地址
   cert-path: D:/1675015090_20240424_cert/apiclient_cert.pem
   cert-path: D:/1675015090_20240424_cert/apiclient_cert.pem
   # 证书秘钥地址
   # 证书秘钥地址

+ 4 - 0
nightFragrance-massage/src/main/java/com/ylx/massage/domain/vo/CouponReceiveVo.java

@@ -30,4 +30,8 @@ public class CouponReceiveVo extends Coupon {
     @ApiModelProperty("过期时间")
     @ApiModelProperty("过期时间")
     private Date expirationTime;
     private Date expirationTime;
 
 
+    //过期时间
+    @ApiModelProperty("过期时间String")
+    private String expirationTimeString;
+
 }
 }

+ 4 - 0
nightFragrance-massage/src/main/java/com/ylx/massage/service/TAddressService.java

@@ -19,5 +19,9 @@ public interface TAddressService extends IService<TAddress> {
     public TAddress getByOpenId(String openId);
     public TAddress getByOpenId(String openId);
 
 
     Boolean defaultAddress(TAddress tAddress);
     Boolean defaultAddress(TAddress tAddress);
+
+    Object insertAddress(TAddress tAddress);
+
+    Object updateAddress(TAddress tAddress);
 }
 }
 
 

+ 6 - 2
nightFragrance-massage/src/main/java/com/ylx/massage/service/impl/CouponReceiveServiceImpl.java

@@ -41,7 +41,7 @@ public class CouponReceiveServiceImpl extends ServiceImpl<CouponReceiveMapper, C
             return null;
             return null;
         }
         }
         queryWrapper.eq(CouponReceive::getOpenid, couponReceive.getOpenid()).eq(CouponReceive::getCouponId, couponReceive.getCouponId());
         queryWrapper.eq(CouponReceive::getOpenid, couponReceive.getOpenid()).eq(CouponReceive::getCouponId, couponReceive.getCouponId());
-        //限制没人只能领x张
+        //限制领取数量
         List<CouponReceive> one = this.list(queryWrapper);
         List<CouponReceive> one = this.list(queryWrapper);
         if (coupon.getUserLimit() <= one.size()) {
         if (coupon.getUserLimit() <= one.size()) {
             return null;
             return null;
@@ -53,7 +53,11 @@ public class CouponReceiveServiceImpl extends ServiceImpl<CouponReceiveMapper, C
 
 
     @Override
     @Override
     public List<CouponReceiveVo> getByOpenId(String openid) {
     public List<CouponReceiveVo> getByOpenId(String openid) {
-        return couponReceiveMapper.getByOpenId(openid);
+        List<CouponReceiveVo> CouponReceiveVos = couponReceiveMapper.getByOpenId(openid);
+        CouponReceiveVos.forEach(couponReceiveVo -> {
+            couponReceiveVo.setExpirationTimeString(DateTimeUtils.formatDate(couponReceiveVo.getExpirationTime(), DateTimeUtils.DATE_FORMAT));
+        });
+        return CouponReceiveVos;
     }
     }
 
 
     @Override
     @Override

+ 32 - 1
nightFragrance-massage/src/main/java/com/ylx/massage/service/impl/TAddressServiceImpl.java

@@ -28,7 +28,7 @@ public class TAddressServiceImpl extends ServiceImpl<TAddressMapper, TAddress> i
     @Override
     @Override
     @Transactional(rollbackFor = Exception.class)
     @Transactional(rollbackFor = Exception.class)
     public Boolean defaultAddress(TAddress tAddress) {
     public Boolean defaultAddress(TAddress tAddress) {
-        if(StringUtils.isBlank(tAddress.getOpenid())){
+        if (StringUtils.isBlank(tAddress.getOpenid())) {
             throw new RuntimeException("openid不能为空");
             throw new RuntimeException("openid不能为空");
         }
         }
         TAddress oldAddress = this.getByOpenId(tAddress.getOpenid());
         TAddress oldAddress = this.getByOpenId(tAddress.getOpenid());
@@ -39,5 +39,36 @@ public class TAddressServiceImpl extends ServiceImpl<TAddressMapper, TAddress> i
         tAddress.setType(1);
         tAddress.setType(1);
         return this.updateById(tAddress);
         return this.updateById(tAddress);
     }
     }
+
+    @Override
+    public Object insertAddress(TAddress tAddress) {
+        if (StringUtils.isBlank(tAddress.getOpenid())) {
+            throw new RuntimeException("openid不能为空");
+        }
+        //查询默认地址
+        TAddress oldAddress = this.getByOpenId(tAddress.getOpenid());
+        tAddress.setType(1);
+        if (oldAddress != null) {
+            tAddress.setType(0);
+        }
+        return this.save(tAddress);
+    }
+
+    @Override
+    public Object updateAddress(TAddress tAddress) {
+        if (StringUtils.isBlank(tAddress.getOpenid())) {
+            throw new RuntimeException("openid不能为空");
+        }
+        if (StringUtils.isBlank(tAddress.getId())) {
+            throw new RuntimeException("地址id不能为空");
+        }
+        //查询默认地址
+        TAddress oldAddress = this.getByOpenId(tAddress.getOpenid());
+        tAddress.setType(1);
+        if (oldAddress != null) {
+            tAddress.setType(0);
+        }
+        return this.updateById(tAddress);
+    }
 }
 }
 
 

+ 2 - 0
nightFragrance-massage/src/main/java/com/ylx/massage/service/impl/TOrderServiceImpl.java

@@ -201,6 +201,7 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
             }
             }
         }
         }
 
 
+        orderNew.setPayType(order.getPayType());
         //判断支付方式
         //判断支付方式
         if (order.getPayType().equals(MassageConstants.INTEGER_ONE)) {
         if (order.getPayType().equals(MassageConstants.INTEGER_ONE)) {
             //微信支付
             //微信支付
@@ -258,6 +259,7 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
             xiangmuService.update(wrapper);
             xiangmuService.update(wrapper);
         });
         });
         TOrder orderParam = new TOrder();
         TOrder orderParam = new TOrder();
+        orderParam.setPayType(orderNew.getPayType());
         orderParam.setcId(orderNew.getcId());
         orderParam.setcId(orderNew.getcId());
         orderParam.setnStatus(OrderStatusEnum.WAIT_JD.getCode());
         orderParam.setnStatus(OrderStatusEnum.WAIT_JD.getCode());
         //加钟的订单支付完直接服务中
         //加钟的订单支付完直接服务中

+ 1 - 1
nightFragrance-massage/src/main/java/com/ylx/massage/task/massageTask.java

@@ -13,7 +13,7 @@ import org.springframework.stereotype.Component;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
 import java.util.Date;
 import java.util.Date;
-import java.util.List;
+
 
 
 /**
 /**
  * @author jianlong
  * @author jianlong