Bladeren bron

Merge remote-tracking branch 'origin/master'

zhijiezhao 2 jaren geleden
bovenliggende
commit
e591b15d3a

+ 99 - 0
src/main/java/com/caimei365/tools/mapper/MessageCenterMapper.java

@@ -0,0 +1,99 @@
+package com.caimei365.tools.mapper;
+
+import com.caimei365.tools.model.po.CmCouponPo;
+import com.caimei365.tools.model.po.CmUserPo;
+import com.caimei365.tools.model.po.MessageCenterPo;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2022/7/7
+ */
+@Mapper
+public interface MessageCenterMapper {
+
+
+    void addMessageCenter(MessageCenterPo messageCenter);
+
+    Integer clubIdCule(Integer userId);
+
+    Integer shopID(Integer userId);
+
+    List<Integer> receiptShopID();
+
+//    UserVo clubList(Integer userId);
+//
+//    CouponVo CouponList(Integer couponType);
+
+    Integer MessageCount(Integer userType,Integer messageType,Integer commonId);
+
+    /**
+     *commonId是通过userType类型来区分供应商和机构
+     */
+    Integer Count(Integer userType,Integer commonId);
+
+    Integer receStatct(Integer shopID);
+
+    /**
+     * 上架费数量
+     */
+    Integer listingFee(Integer shopID);
+
+    /**
+     * 上架费过期数量
+     */
+    Integer listingfeeExpire(Integer shopID);
+
+//    List<MessageCenter> MessageList(Integer userType,Integer messageType,Integer commonId);
+
+    String contractMobile(Integer clubID);
+
+    String contractMobiles(Integer ShopID);
+
+    String getOpenidListByPermission(String unionId);
+
+    String FromUnionId(Integer userID);
+
+    Integer getVipHistoryCount(Integer userID);
+
+    MessageCenterPo MainImage(Integer userType, Integer commonId,Integer orderID);
+
+    MessageCenterPo productImage(Integer productID,Integer shopID);
+
+    Integer productCount(Integer orderID);
+
+    String receiptDate(Integer shopID);
+
+    Double receiptAmount(Integer shopID);
+
+    Integer newReceiptType(Integer shopID);
+
+    Integer updateMessageAsRead(Integer userType,Integer messageType,Integer commonId);
+
+    List<Integer> ClubIds();
+
+    Integer userId(String openid);
+
+    Integer userIds(Integer shopID);
+
+    Integer deleteMessage(String id);
+
+    Integer updateRead(Integer userType,String Id);
+
+    List<CmCouponPo> couponTime();
+
+    CmUserPo clubList(Integer clubId);
+
+    CmUserPo clubLists(Integer userId);
+
+    CmCouponPo CouponList(Integer couponType);
+
+    List<CmCouponPo> CouponLists(Integer userID);
+
+    List<Integer> CouponUserId();
+}

+ 34 - 0
src/main/java/com/caimei365/tools/mapper/OrderClubMapper.java

@@ -0,0 +1,34 @@
+package com.caimei365.tools.mapper;
+
+
+import com.caimei365.tools.model.po.OrderVo;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2021/7/19
+ */
+@Mapper
+public interface OrderClubMapper {
+
+    OrderVo getcartNess(Integer userId);
+
+    List<Integer> userIds();
+
+    List<OrderVo> oredrStatus();
+
+    List<OrderVo>cmorderConfigStatus();
+
+    List<OrderVo>cmorderStatus();
+
+    Integer cmorderconfig(String key);
+
+
+
+
+}

+ 56 - 0
src/main/java/com/caimei365/tools/model/po/CmCouponPo.java

@@ -0,0 +1,56 @@
+package com.caimei365.tools.model.po;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 优惠券管理Entity
+ *
+ * @author plf
+ * @version 2021-08-02
+ */
+@Data
+public class CmCouponPo implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+    private String name;        // 活动主题
+    private BigDecimal couponAmount;        // 优惠券金额(面值)
+    private BigDecimal touchPrice;        // 优惠满减条件金额
+    private Date startDate;        // 使用开始时间(有效期)
+    private Date endDate;        // 使用结束时间(有效期)
+    private Integer receivePeriod;		// 领取期限(天)
+    private Integer receiveFlag;		// 领取期限同开始-结束时间
+    private Integer usePeriod;		// 使用期限(天)
+    private String status;        // 状态 0未生效 1已生效 2已关闭 3已失效
+    private Integer couponType;        // 劵类型 0活动券 1品类券 2用户专享券 3店铺券 4新用户券
+    private Integer vipFlag;        // 超级会员专享优惠券标志:0否,1是
+    private Integer userId;     //机构用户id(用户专享券有效)
+    private Integer shopId;     //供应商id(店铺券有效)
+    private String productType;        // 优惠商品:1全商城商品 2指定商品(活动券有效)
+    private String pcBanner;        //网站活动页banner
+    private String appletsBanner;       //小程序活动页banner
+    private String categoryType;        // 优惠品类:1产品 2仪器(品类券有效)
+    private String couponsMode;        // 领券方式:0正常 1使用兑换码
+    private String productInfo;        //商品json数据
+    private String clubName;           //机构名称
+    private String claimStatus;         //领取状态:1未领取 2已领取
+    private String useStatus;       //使用状态 1未使用 2已使用
+    private String source;      //领取渠道:1小程序 2网站 3订单退回
+    private String shopName;        //供应商名称
+    private Integer codeNum;       //兑换码数量
+    private Integer clubCouponId;      //机构领券id
+    private String couponName;          //优惠券名称
+    private String couponDesc;        //描述
+    private String redemptionCode;      //兑换码
+    private Integer moneyCouponType; //价值优惠券属性 1,意向券,2,定向券
+    private Integer moneyCouponFlag; //是否是价值优惠券,1是,2不是
+    private Double moneyCouponPrice; //价值优惠券购买金额
+    private List<Integer> productIdList;
+    private Integer couponPayWay;  //购买方式 1.直接购买 2.采美豆抵扣
+
+    private Date receiveDate;   // 领取时间
+    private Date useEndDate;    // 使用截止时间
+}

+ 113 - 0
src/main/java/com/caimei365/tools/model/po/CmUserPo.java

@@ -0,0 +1,113 @@
+package com.caimei365.tools.model.po;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 用户Entity
+ *
+ * @author ZCP
+ * @version 2017-10-10
+ */
+@Data
+public class CmUserPo implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+    private Integer userID;        // userID
+    private Integer userOrganizeID;//用户组织ID
+    private String mobile;        // 手机号码
+    private Integer userPermission;        // 用户权限
+    private String email;        // 邮箱
+    private String userName;        // 用户名
+    private Integer source;         //注册来源: 0网站 1小程序
+    private String image;        // image
+    private String password;        // 密码
+//    private String userLevelID;        // 用户会员等级,见表c_userlevel或枚举UserLevel
+    private String name;        // 组织名称
+//    private String nick;        // 昵称
+//    private String sex;        // 性别
+    private String registerUserTypeID;        // 用户类型,见表c_usertype或枚举UserType
+//    private String manufacturerFlag;        // 已废弃 是否是供应商,1是 空或0否
+    private String manufacturerStatus;        // 供应商状态,见表c_shopstatus或枚举ShopStatus
+    private String shopID;        // 供应商Id
+//    private String serviceProviderFlag;        // 已废弃  是否创客,1是 空或0否
+//    private String clubFlag;        //已废弃  是否会所,1是 空或0否
+//    private String masterFlag;        //已废弃  masterFlag
+//    private String normalFlag;        //已废弃  normalFlag
+    private String auditStatus;        // auditStatus
+    private String auditTime;        // auditTime
+    private String auditNote;        // auditNote
+    private String registerTime;        // 注册时间
+    private String registerIP;        // 注册ip
+    private String loginTime;        // 登录时间
+    private String loginFailTime;        // 登录失败次数
+    private String loginIP;        // 登录ip
+    private String validFlag;        // 用户状态,1正常,0冻结
+//    private String emailCheckFlag;        // emailCheckFlag
+//    private String mobileCheckFlag;        // mobileCheckFlag
+    private String clubStatus;        // 会所状态,见表c_clubstatus或枚举ClubStatus
+    private String clubID;        // 会所Id
+    private String agreeFlag;        // agreeFlag
+//    private String activationCode;        // activationCode
+//    private String activationDate;        // activationDate
+    private String serviceProviderStatus;        // 创客状态
+    private String serviceProviderID;        // 创客Id
+//    private String masterStatus;        // masterStatus
+//    private String masterID;        // masterID
+    private Double userMoney;        // 账户余额
+    private Double ableUserMoney;        //账户可用余额
+//    private String point;        // point
+//    private String shopERPFlag;        // shopERPFlag
+//    private String fromUserID;        // 邀请人Id
+//    private String fromUserName;        // 邀请人名称
+    private String logoffTime;        // logoffTime
+    private String appKey;        // appKey
+    private String appSecret;        // appSecret
+//    private String sampleFlag;        // sampleFlag
+    private String scanFlag;        // 扫描标志(4 CRM拉上来的会所)
+//    private String sysroleid;        // sysroleid
+//    private String gender;        // gender
+//    private String age;        // 年龄
+//    private String salerbuyer;        // salerbuyer
+//    private String position;        // position
+//    private String skill;        // skill
+//    private String workage;        // workage
+//    private String wechat;        // 微信号
+//    private String qq;        // QQ号
+//    private String smsFlag;        // 短信是否发送成功
+    private Integer userBeans;        // 采美豆数量
+//    private String privateShopFlag;        // 平台商标志位  0非平台商 1平台商
+//    private String privateClubFlag;        // 平台会所标志位  0非平台会所 1平台会所
+//    private String isMeiDaoAuthorized;        // isMeiDaoAuthorized
+    private String guideFlag;        // 引导层弹出  0需要弹出  1不需要弹出
+    private String nickName;        // 微信昵称
+    private String startTime;     //注册时间开始 查询条件
+    private String endTime;        //注册时间结束  查询条件
+    private String operatorMobile; //
+
+
+    /**
+     * 用户模块重构
+     */
+    private String account;//账号名: 企业账号登录使用
+    private Integer userIdentity;//用户身份
+    private String realName;//真实姓名
+    private Integer companyUserID;//企业用户id
+    private String openID;//微信openID
+    private String bindMobile;//企业绑定手机号
+    private String tipStatus;//弹窗提示状态
+    private String identityDisplay; //前台身份展示
+    private String linkMan;//联系人
+
+    //会所用户信息
+    private String town; // 区
+    private String city; // 市
+    private String province; //省
+    private String address;        // 详细地址
+    private boolean pending = false; //是否有待审核提现
+    private String shortName;   //机构简称
+    private String userIds;  //用户id","隔开
+    private boolean storeStatus = false; //是否存在数据库
+
+   }

+ 110 - 0
src/main/java/com/caimei365/tools/model/po/MessageCenterPo.java

@@ -0,0 +1,110 @@
+package com.caimei365.tools.model.po;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * Description
+ */
+@Data
+public class MessageCenterPo implements Serializable {
+    /**
+     * 消息id
+     */
+    private Integer id;
+    /**
+     * 供应商id
+     */
+    private Integer shopId;
+    /**
+     * 机构id
+     */
+    private Integer clubId;
+    /**
+     * 订单ID
+     */
+    private Integer orderId;
+    /**
+     * 用户类型1.机构2.供应商
+     */
+    private Integer userType;
+    /**
+     * 消息类型1.交易物流2.账户通知3.服务通知4.优惠促销
+     */
+    private Integer messageType;
+    /**
+     * 消息内容
+     */
+    private String content;
+    /**
+     * 操作完成时间
+     */
+    private String time;
+    /**
+     * 账户通知类型 1.注册成功通知 2.购买超级会员成功 3.超级会员到期提醒 4.超级会员到期提醒 5.升级资质机构成功 6.升级资质机构失败 7.成为机构运营人员通知
+     */
+    private Integer accountType;
+    /**
+     * 优惠券类型 1.优惠券待领取通知 2.优惠券过期通知
+     */
+    private Integer couponType;
+    /**
+     * 优惠券金额
+     */
+    private Double couponFee;
+    /**
+     * 主图
+     */
+    private String mainImage;
+    /**
+     * 是否能走线上支付 0可以 1不可以 只能线下
+     */
+    private Integer onlinePayFlag;
+    /**
+     * 商品名称
+     */
+    private String productName;
+    /**
+     * 供应商消息类型 1,账号审核通知,2.成为公司运营人员通知,3.商品上架审核通知,4.新品展示审核通知,5.上架费到期通知 6.商品资质到期通知
+     */
+    private Integer shopMessType;
+    /**
+     * 供应商服务消息类型 1.上架费
+     */
+    private Integer shopTieredType;
+    /**
+     * 交易物流1.下单成功通知  2.订单支付完成 3.退款/货成功通知 4.订单取消通知 5.订单发货通知 6.自动收货通知
+     */
+    private Integer orderMessageType;
+    /**
+     * 0.未读 , 1.已读
+     */
+    private Integer saved;
+    /**
+     * 优惠券类型 1.优惠券待领取通知 2.优惠券过期通知
+     */
+    private Integer couponMessageType;
+    /**
+     * 商品记录数
+     */
+    private Integer productCount;
+    /**
+     * 退货退款类型:1部分退、2全部退
+     */
+    private Integer refundType;
+
+    /**
+     *订单状态
+     */
+    private Integer status;
+    /**
+     * 商品ID
+     */
+    private Integer productId;
+
+    /**
+     * 供应商公司名称
+     */
+    private String shopName;
+}

+ 337 - 0
src/main/java/com/caimei365/tools/model/po/OrderVo.java

@@ -0,0 +1,337 @@
+package com.caimei365.tools.model.po;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2021/7/20
+ */
+@Data
+public class OrderVo implements Serializable {
+    private static final long serialVersionUID = 1L;
+    /**
+     * orderSeen:订单对机构可见度,1可见,2不可见
+     */
+    private Integer orderSeen;
+    /**
+     * 订单号
+     */
+    private Integer orderId;
+    /**
+     * 订单来源:1WWW、2CRM、4客服[适用后台下单]、5外单[适用后台下单]、6小程序[采美,星范]、7呵呵商城小程序、8维沙小程序
+     */
+    private Integer orderSource;
+    /**
+     * 订单编号
+     */
+    private String orderNo;
+    /**
+     * 用户Id
+     */
+    private Integer userId;
+    /**
+     * 机构Id
+     */
+    private Integer clubId;
+    /**
+     * 组织Id
+     */
+    private Integer organizeId;
+    /**
+     * 用户身份:1协销 2会员机构 3供应商 4普通机构
+     */
+    private Integer userIdentity;
+    /**
+     * 机构名称(协销订单列表用)
+     */
+    private String clubName;
+    /**
+     * 超级会员标识,1是,不是
+     */
+    private Integer svipUserFlag;
+    /**
+     * 下单人Id(协销Id,或运营人Id,或用户Id)
+     */
+    private Integer buyUserId;
+    /**
+     * 订单提交时间
+     */
+    private String orderTime;
+    /**
+     * 更新时间
+     */
+    private String updateDate;
+    /**
+     * 订单状态 0 有效  其它无效
+     */
+    private Integer delFlag;
+    /**
+     * 采美豆抵扣运费的抵扣数量
+     */
+    private Integer userBeans;
+    /**
+     * 订单类型 协销订单 0, 普通订单 1
+     */
+    private Integer orderType;
+    /**
+     * 订单提交类型 0:个人自己下单 1:企业自己下单 2:员工帮会所下单 3:协销帮会所下单  4:后台下单 5:采美豆订单
+     */
+    private Integer orderSubmitType;
+    /**
+     * 订单确认标志,0否,1后台确认,2买家确认(适用协销订单并且1或2都算已确认订单,主动订单默认1为确认)
+     */
+    private Integer confirmFlag;
+    /**
+     * 是否能走线上支付 0可以 1不可以 只能线下
+     */
+    private Integer onlinePayFlag;
+    /**
+     * 订单是否可拆分   1可拆分 0不可拆分
+     */
+    private Integer splitFlag;
+    /**
+     * 是否已支付 未支付0 已支付1
+     */
+    private Integer payFlag;
+    /**
+     * (向买家)收款状态:1待收款、2部分收款、3已收款
+     */
+    private Integer receiptStatus;
+    /**
+     * (向供应商)付款状态:1待付款、2部分付款、3已付款
+     */
+    private Integer payStatus;
+    /**
+     * 订单0成本标识:0订单有成本,1订单无成本(订单中所有商品成本为0)
+     */
+    private Integer zeroCostFlag;
+    /**
+     * 发货状态:1待发货、2部分发货、3已发货
+     */
+    private Integer sendOutStatus;
+    /**
+     * 退货退款类型:0未发生退款、1部分退、2全部退
+     */
+    private Integer refundType;
+    /**
+     * 确认付款供应商标识 0未确认,1已确认
+     */
+    private Integer affirmPaymentFlag;
+    /**
+     * 购买总数
+     */
+    private Integer productCount;
+
+    /**
+     * 赠送总数  不计算价格
+     */
+    private Integer presentCount;
+    /**
+     * 促销赠品总数
+     */
+    private Integer promotionalGiftsCount;
+    /**
+     * 是否包含活动商品(受订单未支付自动关闭时间影响)  0 否 1 是
+     */
+    private Integer hasActProduct;
+    /**
+     * 促销满减优惠
+     */
+    private Double promotionFullReduction;
+    /**
+     * 超级会员优惠
+     */
+    private Double svipFullReduction;
+    /**
+     * 二手商品订单标识  0非二手商品订单、 1二手商品订单
+     */
+    private Integer secondHandOrderFlag;
+    /**
+     * 是否开发票 没开发票 0 开个人发票 1 开企业发票2
+     */
+    private Integer invoiceFlag;
+    /**
+     * 免邮标志  运费:-1到付,0包邮,1需要运费,-2仪器到付其它包邮
+     */
+    private Integer postageFlag;
+    /**
+     * -1到付,0包邮,大于0具体金额,-2仪器到付其它包邮(且运费已使用商品形式存储)
+     */
+    private Double postage;
+    /**
+     * 商品总金额 (商品单价乘以数量,再加上税费)
+     */
+    private Double productTotalFee;
+    /**
+     * 小计金额 (商品折后单价乘以数量,再加上税费)
+     */
+    private Double orderTotalFee;
+    /**
+     * 经理折扣
+     */
+    private Double discountFee;
+    /**
+     * 使用优惠券金额
+     */
+    private Double couponAmount;
+    /**
+     * 订单总额(小计金额减去经理折扣后,再加上运费)
+     */
+    private Double payTotalFee;
+    /**
+     * 真实支付金额(订单总额减去抵扣的账户余额)
+     */
+    private Double payableAmount;
+    /**
+     * 余额支付金额
+     */
+    private Double balancePayFee;
+    /**
+     * 0待确认,11待收待发,12待收部发,13待收全发,21部收待发,22部收部发,23部收全发,31已收待发,32已收部发,33已收全发,4交易完成,5订单完成,6已关闭,7交易全退
+     */
+    private Integer status;
+    /**
+     * 订单确认时间
+     */
+    private String confirmTime;
+    /**
+     * 订单支付时间
+     */
+    private String payTime;
+    /**
+     * 返佣订单标识 0非返佣订单,1返佣订单
+     */
+    private Integer rebateFlag;
+    /**
+     * 条款ID
+     */
+    private Integer clauseId;
+    /**
+     * 条款名称
+     */
+    private String clauseName;
+    /**
+     * 子订单ID
+     */
+    private String shopOrderIds;
+    /**
+     * 订单取消原因
+     */
+    private String closeReason;
+    /**
+     * 订单取消时间
+     */
+    private String closeTime;
+    /**
+     * 订单备注
+     */
+    private String note;
+    /**
+     * 已支付成功次数统计(适用线上多笔付款用来确认当前是哪一笔)
+     */
+    private Integer paySuccessCounter;
+    /**
+     * 支付按钮是否消失,true消失
+     */
+    private boolean payButton = false;
+    /**
+     * 待付总金额
+     */
+    private Double pendingPayments;
+    /**
+     * 付款总金额
+     */
+    private Double receiptAmount;
+    /**
+     * 订单标识:#订单号#
+     */
+    private String orderMark;
+    /**
+     * 是否包含充值商品
+     */
+    private boolean rechargeGoods = false;
+    /**
+     * 总税费
+     */
+    private Double expensesOfTaxation;
+    /**
+     * 退款总金额
+     */
+    private Double returnedPurchaseFee;
+    /**
+     * 是否有商品发票属性的限制,为true时只能线下支付
+     */
+    private boolean invoiceStatus = false;
+    /**
+     * 客户名称
+     */
+    private String userName;
+    /**
+     * 收款详情是否可以查看
+     */
+    private Boolean authority = false;
+    /**
+     * 存在退款中的记录 (0:否,1:是)
+     */
+    private String haveReturning;
+    /**
+     * 存在收款中的记录 (0:否,1:是)
+     */
+    private String haveReceipting;
+    /**
+     * 剩余应收金额
+     */
+    private Double surplusAmount;
+    /**
+     * 已支付金额
+     */
+    private Double paidAmount;
+    /**
+     * 待审金额
+     */
+    private Double unCheckAmount;
+    /**
+     * 退货退款价值(抵扣经理折扣后)
+     */
+    private Double returnValue;
+    /**
+     * 退款总额(给买家)
+     */
+    private Double refundFee;
+    /**
+     * 订单状态备注
+     */
+    private String statusName;
+    /**
+     * 总税费
+     */
+    private Double totalAddedValueTax;
+
+    /**
+     * 供应商名称
+     */
+    private String shopName;
+    /**
+     * 收款款项二级类别1.上架费2.订单返佣3.认证通会员4.认证通企划
+     */
+    private Integer newReceiptType;
+    /**
+     * 商品名称
+     */
+    private String proName;
+    /**
+     * 商品数量
+     */
+    private Integer proCount;
+    /**
+     *   下单人电话
+     */
+  private String mobile;
+
+
+}

+ 410 - 0
src/main/java/com/caimei365/tools/service/WeChatService.java

@@ -0,0 +1,410 @@
+package com.caimei365.tools.service;
+import com.alibaba.fastjson.JSONObject;
+import com.caimei365.tools.utils.RequestUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import java.util.Map;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2022/4/12
+ */
+@Service
+public class WeChatService {
+//    @Value("${wx.crm-app-id}")
+//    private String crmAppId;
+//    @Value("${wx.crm-app-secret}")
+//    private String crmAppSecret;
+
+    protected Logger logger = LoggerFactory.getLogger(getClass());
+
+    /**
+     * 微信公众号获取access_token
+     *
+     * @return access_token
+     */
+    public String getAccessToken() throws Exception {
+        String link = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET";
+        link = link.replace("APPID", "wx91c4152b60ca91a3");
+        link = link.replace("APPSECRET", "a563dd2c07c9c815a4e697c8b6cb73dc");
+        String result = RequestUtil.sendGet(link);
+        logger.info("微信公众号获取access_token>>>" + result);
+        Map<String, Object> map = JSONObject.parseObject(result, Map.class);
+        String access_token = (String) map.get("access_token");
+
+        return access_token;
+    }
+
+    /**
+     * 发货消息推送F
+     * @param accessToken
+     * @param openid
+     * @param orderno 订单编号
+     * @param time 发货时间
+     * @param company 快递名称
+     * @param companyno 快递编号
+     * @param pagePath 跳转链接
+     */
+    public void sendTemplateMsgy(String accessToken, String openid, String orderno,String time, String company, String companyno, String pagePath) {
+        JSONObject first = new JSONObject();
+        first.put("value", "尊敬的采美客户,您购买的订单已经发货啦~");
+        JSONObject keyword1 = new JSONObject();
+        keyword1.put("value", orderno);
+        JSONObject keyword2 = new JSONObject();
+        keyword2.put("value", time);
+        JSONObject keyword3 = new JSONObject();
+        keyword3.put("value", company);
+        JSONObject keyword4 = new JSONObject();
+        keyword4.put("value", companyno);
+        JSONObject remark = new JSONObject();
+        remark.put("value", "收到货后请记得确认收货哟~");
+
+        JSONObject data = new JSONObject();
+        data.put("first", first);
+        data.put("keyword1", keyword1);
+        data.put("keyword2", keyword2);
+        data.put("keyword3", keyword3);
+        data.put("keyword4", keyword4);
+        data.put("remark", remark);
+
+        JSONObject miniProgram = new JSONObject();
+        miniProgram.put("appid", "wxf3cd4ae0cdd11c36");
+        miniProgram.put("pagepath", pagePath);
+
+        JSONObject json = new JSONObject();
+        json.put("touser", openid);
+        json.put("template_id", "_Zc6WiUp3hM4yBgT30HkTyA-SmcCN-sjnGpIa6n3rKI");
+        json.put("url", "https://www.caimei365.com/");
+        json.put("miniprogram", miniProgram);
+        json.put("data", data);
+        // json 字符串
+        String jsonString = json.toJSONString();
+        logger.info(">>>>>>>>推送微信模板消息:" + jsonString);
+        try {
+            String requestUrl = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="+accessToken;
+            // 发送请求
+            String result = RequestUtil.httpRequest(requestUrl, "POST", jsonString);
+            logger.info(">>>>>>>>推送结果:" + result);
+        } catch (Exception e) {
+            logger.info(">>>>>>>>>推送微信模板消息失败:",e);
+        }
+    }
+
+    /**
+     * 资质机构认证成功消息推送
+     * @param accessToken
+     * @param openid
+     * @param pagePath 跳转链接
+     */
+    public void sendTemplateMsg(String accessToken, String openid ,String auditTime, String pagePath) {
+        JSONObject first = new JSONObject();
+        first.put("value", "认证成功通知");
+        JSONObject keyword1 = new JSONObject();
+        keyword1.put("value", "恭喜您成功成为采美资质机构");
+        JSONObject keyword2 = new JSONObject();
+        keyword2.put("value", "资质机构");
+        JSONObject keyword3 = new JSONObject();
+        keyword3.put("value", "审核通过");
+        JSONObject keyword4 = new JSONObject();
+        keyword4.put("value", auditTime);
+        JSONObject remark = new JSONObject();
+        remark.put("value", "认证成功后,您将享受到更多的优惠机会。");
+
+        JSONObject data = new JSONObject();
+        data.put("first", first);
+        data.put("keyword1", keyword1);
+        data.put("keyword2", keyword2);
+        data.put("keyword3", keyword3);
+        data.put("keyword4", keyword4);
+        data.put("remark", remark);
+
+        JSONObject miniProgram = new JSONObject();
+        miniProgram.put("appid", "wxf3cd4ae0cdd11c36");
+        miniProgram.put("pagepath", pagePath);
+
+        JSONObject json = new JSONObject();
+        json.put("touser", openid);
+        json.put("template_id", "kfzhVTJ6sNOJSgwk8x7Z9_m8S2LRzDfAGtiUgGyO8Zk");
+        json.put("url", "https://www.caimei365.com/");
+        json.put("miniprogram", miniProgram);
+        json.put("data", data);
+        // json 字符串
+        String jsonString = json.toJSONString();
+        logger.info(">>>>>>>>推送微信模板消息:" + jsonString);
+        try {
+            String requestUrl = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="+accessToken;
+            // 发送请求
+            String result = RequestUtil.httpRequest(requestUrl, "POST", jsonString);
+            logger.info(">>>>>>>>推送结果:" + result);
+        } catch (Exception e) {
+            logger.info(">>>>>>>>>推送微信模板消息失败:",e);
+        }
+    }
+
+    /**
+     * 资质机构认证失败消息推送
+     * @param accessToken
+     * @param openid
+     * @param pagePath 跳转链接
+     */
+    public void sendTemplateMessg(String accessToken, String openid, String auditResult,String auditTime, String pagePath) {
+        JSONObject first = new JSONObject();
+        first.put("value", "认证失败通知");
+        JSONObject keyword1 = new JSONObject();
+        keyword1.put("value", "您升级采美资质机构认证失败");
+        JSONObject keyword2 = new JSONObject();
+        keyword2.put("value", "资质机构");
+        JSONObject keyword3 = new JSONObject();
+        keyword3.put("value", "审核未通过");
+        JSONObject keyword4 = new JSONObject();
+        keyword4.put("value", auditTime);
+        JSONObject keyword5 = new JSONObject();
+        keyword5.put("value", auditResult);
+        JSONObject remark = new JSONObject();
+        remark.put("value", " ");
+
+        JSONObject data = new JSONObject();
+        data.put("first", first);
+        data.put("keyword1", keyword1);
+        data.put("keyword2", keyword2);
+        data.put("keyword3", keyword3);
+        data.put("keyword4", keyword4);
+        data.put("keyword5", keyword5);
+        data.put("remark", remark);
+
+        JSONObject miniProgram = new JSONObject();
+        miniProgram.put("appid", "wxf3cd4ae0cdd11c36");
+        miniProgram.put("pagepath", pagePath);
+
+        JSONObject json = new JSONObject();
+        json.put("touser", openid);
+        json.put("template_id", "btBvh1LIzTPMIpZNPNIupQnMcMw8_ziyQ6CGV68eN7s");
+        json.put("url", "https://www.caimei365.com/");
+        json.put("miniprogram", miniProgram);
+        json.put("data", data);
+        // json 字符串
+        String jsonString = json.toJSONString();
+        logger.info(">>>>>>>>推送微信模板消息:" + jsonString);
+        try {
+            String requestUrl = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="+accessToken;
+            // 发送请求
+            String result = RequestUtil.httpRequest(requestUrl, "POST", jsonString);
+            logger.info(">>>>>>>>推送结果:" + result);
+        } catch (Exception e) {
+            logger.info(">>>>>>>>>推送微信模板消息失败:",e);
+        }
+    }
+
+    /**
+     * 供应商审核失败消息推送
+     * @param accessToken
+     * @param openid
+     * @param pagePath 跳转链接
+     */
+    public void sendTemplate(String accessToken, String openid,String shopName,String auditNote,String auditTime, String pagePath) {
+        JSONObject first = new JSONObject();
+        first.put("value", "您提交的供应商账号注册申请审核失败。");
+        JSONObject keyword1 = new JSONObject();
+        keyword1.put("value", shopName);
+        JSONObject keyword2 = new JSONObject();
+        keyword2.put("value", "账号注册");
+        JSONObject keyword3 = new JSONObject();
+        keyword3.put("value", auditNote);
+        JSONObject keyword4 = new JSONObject();
+        keyword4.put("value", auditTime);
+        JSONObject remark = new JSONObject();
+        remark.put("value", "请修改重新提交审核。");
+
+        JSONObject data = new JSONObject();
+        data.put("first", first);
+        data.put("keyword1", keyword1);
+        data.put("keyword2", keyword2);
+        data.put("keyword3", keyword3);
+        data.put("keyword4", keyword4);
+        data.put("remark", remark);
+
+        JSONObject miniProgram = new JSONObject();
+        miniProgram.put("appid", "wxf3cd4ae0cdd11c36");
+        miniProgram.put("pagepath", pagePath);
+
+        JSONObject json = new JSONObject();
+        json.put("touser", openid);
+        json.put("template_id", "QogD0Mu5zvNo51hqJXXNYiVByuDmYLxg2kxHUMqlyCI");
+        json.put("url", "https://www.caimei365.com/");
+        json.put("miniprogram", miniProgram);
+        json.put("data", data);
+        // json 字符串
+        String jsonString = json.toJSONString();
+        logger.info(">>>>>>>>推送微信模板消息:" + jsonString);
+        try {
+            String requestUrl = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="+accessToken;
+            // 发送请求
+            String result = RequestUtil.httpRequest(requestUrl, "POST", jsonString);
+            logger.info(">>>>>>>>推送结果:" + result);
+        } catch (Exception e) {
+            logger.info(">>>>>>>>>推送微信模板消息失败:",e);
+        }
+    }
+
+    /**
+     * 商品审核未通过消息推送
+     * @param accessToken
+     * @param openid
+     * @param pagePath 跳转链接
+     */
+    public void sendTemp(String accessToken, String openid,String name,String auditTime, String pagePath) {
+        JSONObject first = new JSONObject();
+        first.put("value", "商品审核未通过通知");
+        JSONObject keyword1 = new JSONObject();
+        keyword1.put("value", "抱歉,您发布的商品未通过审核");
+        JSONObject keyword2 = new JSONObject();
+        keyword2.put("value", "审核未通过");
+        JSONObject keyword3 = new JSONObject();
+        keyword3.put("value", auditTime);
+        JSONObject keyword4 = new JSONObject();
+        keyword4.put("value", name);
+        JSONObject remark = new JSONObject();
+        remark.put("value", "请前往采美网站修改商品信息重新发布");
+
+        JSONObject data = new JSONObject();
+        data.put("first", first);
+        data.put("keyword1", keyword1);
+        data.put("keyword2", keyword2);
+        data.put("keyword3", keyword3);
+        data.put("keyword4", keyword4);
+        data.put("remark", remark);
+
+        JSONObject miniProgram = new JSONObject();
+        miniProgram.put("appid", "wxf3cd4ae0cdd11c36");
+        miniProgram.put("pagepath", pagePath);
+
+        JSONObject json = new JSONObject();
+        json.put("touser", openid);
+        json.put("template_id", "oGiOHlJgx0L8rWmq6wqXHUIZjIzuPkiRu2xbqTE26Tg");
+        json.put("url", "https://www.caimei365.com/");
+        json.put("miniprogram", miniProgram);
+        json.put("data", data);
+        // json 字符串
+        String jsonString = json.toJSONString();
+        logger.info(">>>>>>>>推送微信模板消息:" + jsonString);
+        try {
+            String requestUrl = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="+accessToken;
+            // 发送请求
+            String result = RequestUtil.httpRequest(requestUrl, "POST", jsonString);
+            logger.info(">>>>>>>>推送结果:" + result);
+        } catch (Exception e) {
+            logger.info(">>>>>>>>>推送微信模板消息失败:",e);
+        }
+    }
+
+    /**
+     * 商品审核未通过消息推送
+     * @param accessToken
+     * @param openid
+     * @param pagePath 跳转链接
+     */
+    public void messteme(String accessToken, String openid,String name,String qualificationNo,String auditTime,String proName, String pagePath) {
+        JSONObject first = new JSONObject();
+        first.put("value", "您好,您有商品资质证书即将到期。");
+        JSONObject keyword1 = new JSONObject();
+        keyword1.put("value", name);
+        JSONObject keyword2 = new JSONObject();
+        keyword2.put("value", "医疗器械注册证");
+        JSONObject keyword3 = new JSONObject();
+        keyword3.put("value", qualificationNo);
+        JSONObject keyword4 = new JSONObject();
+        keyword4.put("value", auditTime);
+        JSONObject remark = new JSONObject();
+        remark.put("value", proName);
+
+        JSONObject data = new JSONObject();
+        data.put("first", first);
+        data.put("keyword1", keyword1);
+        data.put("keyword2", keyword2);
+        data.put("keyword3", keyword3);
+        data.put("keyword4", keyword4);
+        data.put("remark", remark);
+
+        JSONObject miniProgram = new JSONObject();
+        miniProgram.put("appid", "wxf3cd4ae0cdd11c36");
+        miniProgram.put("pagepath", pagePath);
+
+        JSONObject json = new JSONObject();
+        json.put("touser", openid);
+        json.put("template_id", "gpD9TqBpkgaw3YSM_JPk4WSTwKZY0hxrBCH0SjzNKY4");
+        json.put("url", "https://www.caimei365.com/");
+        json.put("miniprogram", miniProgram);
+        json.put("data", data);
+        // json 字符串
+        String jsonString = json.toJSONString();
+        logger.info(">>>>>>>>推送微信模板消息:" + jsonString);
+        try {
+            String requestUrl = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="+accessToken;
+            // 发送请求
+            String result = RequestUtil.httpRequest(requestUrl, "POST", jsonString);
+            logger.info(">>>>>>>>推送结果:" + result);
+        } catch (Exception e) {
+            logger.info(">>>>>>>>>推送微信模板消息失败:",e);
+        }
+    }
+
+    /**
+     * 商品审核未通过消息推送
+     * @param accessToken
+     * @param openid
+     * @param pagePath 跳转链接
+     */
+    public void messtemes(String accessToken, String openid,String firsts,String newTime,String endTime,Double fee,String pagePath) {
+        JSONObject first = new JSONObject();
+        first.put("value", firsts);
+        JSONObject keyword1 = new JSONObject();
+        keyword1.put("value", "维护费");
+        JSONObject keyword2 = new JSONObject();
+        keyword2.put("value", "年付");
+        JSONObject keyword3 = new JSONObject();
+        keyword3.put("value", newTime);
+        JSONObject keyword4 = new JSONObject();
+        keyword4.put("value", newTime);
+        JSONObject keyword5 = new JSONObject();
+        keyword4.put("value", fee);
+        JSONObject remark = new JSONObject();
+        remark.put("value", "为了更好给您服务,请及时联系采美客服缴费!");
+
+        JSONObject data = new JSONObject();
+        data.put("first", first);
+        data.put("keyword1", keyword1);
+        data.put("keyword2", keyword2);
+        data.put("keyword3", keyword3);
+        data.put("keyword4", keyword4);
+        data.put("keyword5", keyword5);
+        data.put("remark", remark);
+
+        JSONObject miniProgram = new JSONObject();
+        miniProgram.put("appid", "wxf3cd4ae0cdd11c36");
+        miniProgram.put("pagepath", pagePath);
+
+        JSONObject json = new JSONObject();
+        json.put("touser", openid);
+        json.put("template_id", "jYUIq63wP6mGFvkgNHgTOXAgF7j6h_VZKgST_-2fqCo");
+        json.put("url", "https://www.caimei365.com/");
+        json.put("miniprogram", miniProgram);
+        json.put("data", data);
+        // json 字符串
+        String jsonString = json.toJSONString();
+        logger.info(">>>>>>>>推送微信模板消息:" + jsonString);
+        try {
+            String requestUrl = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="+accessToken;
+            // 发送请求
+            String result = RequestUtil.httpRequest(requestUrl, "POST", jsonString);
+            logger.info(">>>>>>>>推送结果:" + result);
+        } catch (Exception e) {
+            logger.info(">>>>>>>>>推送微信模板消息失败:",e);
+        }
+    }
+
+}

+ 714 - 0
src/main/java/com/caimei365/tools/task/ShopMessTask.java

@@ -0,0 +1,714 @@
+package com.caimei365.tools.task;
+
+import com.alibaba.fastjson.JSONObject;
+import com.caimei365.tools.mapper.MessageCenterMapper;
+import com.caimei365.tools.mapper.OrderClubMapper;
+import com.caimei365.tools.model.po.CmCouponPo;
+import com.caimei365.tools.model.po.CmUserPo;
+import com.caimei365.tools.model.po.MessageCenterPo;
+import com.caimei365.tools.model.po.OrderVo;
+import com.caimei365.tools.service.WeChatService;
+import com.caimei365.tools.utils.SmsUtil;
+import lombok.RequiredArgsConstructor;
+import lombok.SneakyThrows;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
+import org.apache.juli.logging.Log;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.Scheduled;
+import redis.clients.jedis.Jedis;
+
+import javax.annotation.Resource;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2022/7/29
+ */
+@Slf4j
+@Configuration
+@EnableScheduling
+@RequiredArgsConstructor
+public class ShopMessTask {
+
+    @Resource
+    private MessageCenterMapper messageCenterMapper;
+
+    @Resource
+    private OrderClubMapper orderClubMapper;
+    @Resource
+    private WeChatService weChatService;
+
+//    @SneakyThrows
+//    public static void main(String[] args) {
+//        Calendar calendar = Calendar.getInstance();
+//
+//        Date d = new Date();
+//        Date time=new Date();
+//        //1.日期格式
+//        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH");
+//        String receiptDate="2022-08-02 19:07:46";
+////        if(!receiptDate.contains(":")){
+////            receiptDate+=" 00:00:01";
+////        }
+//
+//           Date s= sdf.parse(receiptDate);
+//
+//        calendar.setTime(time);
+//        calendar.add(Calendar.HOUR, -1);
+//       String hTime= sdf.format(calendar.getTime());
+//      Integer i=  hTime.compareTo(sdf.format(s));
+//      System.out.println(i);
+//        System.out.println(hTime);
+//        System.out.println(s);
+////if(i==0){
+////
+////}
+////        time = sdf.parse(receiptDate);
+////
+////        calendar.setTime(time);
+//////        calendar.add(Calendar.YEAR, 1);
+////        String dateStrings = sdf.format(calendar.getTime());
+////        //2.到期时间
+////
+////                Date da1 =    da1 = sdf.parse(dateStrings);
+////        //到期时间-当前时间=还剩多少天
+////        Long s = (da1.getTime() - d.getTime()) / 24 / 60 / 60 / 1000;
+////        System.out.println(da1);
+////        System.out.println(d);
+////        System.out.println(s);
+//    }
+
+        @Scheduled(cron = "0 0 15 * * ?")
+//    @Scheduled(cron = "0 0/15 * * * ?")
+    public void Timesjf() {
+        log.info("上架费过期推送开始");
+        //1.获取下午3点的时间
+        List<Integer> shopIDs = messageCenterMapper.receiptShopID();
+        shopIDs.forEach(shopID -> {
+            if (shopID != null) {
+                String receiptDate = messageCenterMapper.receiptDate(shopID);
+                Double receiptAmount = messageCenterMapper.receiptAmount(shopID);
+                Calendar calendar = Calendar.getInstance();
+
+                String firsts = "";
+
+                Date d = new Date();
+                Date time = new Date();
+                //1.日期格式
+                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
+                if (!receiptDate.contains(":")) {
+                    receiptDate += " 00:00:01";
+                }
+                try {
+                    time = sdf.parse(receiptDate);
+                } catch (ParseException e) {
+                    e.printStackTrace();
+                }
+                calendar.setTime(time);
+                calendar.add(Calendar.YEAR, 1);
+                String dateStrings = sdf.format(calendar.getTime());
+                //2.到期时间
+                Date da1 = new Date();
+                try {
+                    da1 = sdf.parse(dateStrings);
+                } catch (ParseException e) {
+                    e.printStackTrace();
+                }
+                //到期时间-当前时间=还剩多少天
+                Long s = (da1.getTime() - d.getTime()) / 24 / 60 / 60 / 1000;
+                //3.输出间隔天数         getTime获取的是毫秒
+                SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                String current = dateFormat.format(new Date());
+                MessageCenterPo messageCenter = new MessageCenterPo();
+                //推送信息中心-上架费服务通知
+                if (s <= 0) {
+                    messageCenter.setShopId(shopID);
+                    messageCenter.setClubId(null);
+                    messageCenter.setUserType(2);
+                    messageCenter.setMessageType(3);
+                    messageCenter.setShopTieredType(1);
+                    messageCenter.setContent("已过期");
+                    messageCenter.setTime(current);
+                    messageCenterMapper.addMessageCenter(messageCenter);
+                } else if (s == 1) {
+                    messageCenter.setShopId(shopID);
+                    messageCenter.setClubId(null);
+                    messageCenter.setUserType(2);
+                    messageCenter.setMessageType(3);
+                    messageCenter.setShopTieredType(1);
+                    messageCenter.setContent("今日后到期");
+                    messageCenter.setTime(current);
+                    messageCenterMapper.addMessageCenter(messageCenter);
+                    String mobile = messageCenterMapper.contractMobiles(shopID);
+                    String content = "您的供应商账号上架费将于今日后到期,到期后将无法发布和编辑商品,同时也会影响到其他采美提供的支持服务。请联系采美工作人员进行续费,联系电话0755-22907771 或15338851365";
+                    String result = SmsUtil.sendSms(3, mobile, content);
+                    JSONObject json = (JSONObject) JSONObject.parse(result);
+                    log.info("发送结果:" + result + ",短信内容:" + content);
+                    if (null != json && json.getInteger("code") == 0) {
+                        log.info(mobile + "发送成功");
+                    } else {
+                        log.error(mobile + "发送失败");
+                    }
+                    firsts = "尊敬的采美供应商用户,您的账号维护费用今天后即将到期!";
+                } else if (s == 7) {
+                    messageCenter.setShopId(shopID);
+                    messageCenter.setClubId(null);
+                    messageCenter.setUserType(2);
+                    messageCenter.setMessageType(3);
+                    messageCenter.setShopTieredType(1);
+                    messageCenter.setContent("7日后到期");
+                    messageCenter.setTime(current);
+                    messageCenterMapper.addMessageCenter(messageCenter);
+                    String mobile = messageCenterMapper.contractMobiles(shopID);
+                    String content = "您的供应商账号上架费将于7日后到期,到期后将无法发布和编辑商品,同时也会影响到其他采美提供的支持服务。请联系采美工作人员进行续费,联系电话0755-22907771 或15338851365";
+                    String result = SmsUtil.sendSms(3, mobile, content);
+                    JSONObject json = (JSONObject) JSONObject.parse(result);
+                    log.info("发送结果:" + result + ",短信内容:" + content);
+                    if (null != json && json.getInteger("code") == 0) {
+                        log.info(mobile + "发送成功");
+                    } else {
+                        log.error(mobile + "发送失败");
+                    }
+                    firsts = "尊敬的采美供应商用户,您的账号维护费用7天后即将到期!";
+                } else if (s == 30) {
+                    messageCenter.setShopId(shopID);
+                    messageCenter.setClubId(null);
+                    messageCenter.setUserType(2);
+                    messageCenter.setMessageType(3);
+                    messageCenter.setShopTieredType(1);
+                    messageCenter.setContent("30日后到期");
+                    messageCenter.setTime(current);
+                    messageCenterMapper.addMessageCenter(messageCenter);
+                    String mobile = messageCenterMapper.contractMobiles(shopID);
+                    String content = "您的供应商账号上架费将于30日后到期,到期后将无法发布和编辑商品,同时也会影响到其他采美提供的支持服务。请联系采美工作人员进行续费,联系电话0755-22907771 或15338851365";
+                    String result = SmsUtil.sendSms(3, mobile, content);
+                    JSONObject json = (JSONObject) JSONObject.parse(result);
+                    log.info("发送结果:" + result + ",短信内容:" + content);
+                    if (null != json && json.getInteger("code") == 0) {
+                        log.info(mobile + "发送成功");
+                    } else {
+                        log.error(mobile + "发送失败");
+                    }
+                    firsts = "尊敬的采美供应商用户,您的账号维护费用30天后即将到期!";
+                }
+                try {
+
+                    Integer userId = messageCenterMapper.userIds(shopID);
+                    String accessToken = weChatService.getAccessToken();
+                    String openid = messageCenterMapper.getOpenidListByPermission(messageCenterMapper.FromUnionId(userId));
+                    String date = s.toString();
+                    // 跳转到【小程序付款-选择支付方式页面】
+                    String pagePath = "https://www.caimei365.com/";
+                    // sendTemplateMsg(openid, 标题, 金额, 收款日期, 备注, 跳转链接
+                    weChatService.messtemes(accessToken, openid, firsts, receiptDate, sdf.format(da1), receiptAmount, pagePath);
+                } catch (Exception e) {
+
+                }
+            }
+            log.info("上架费过期推送结束");
+        });
+    }
+
+
+        @Scheduled(cron = "0 0 10 15 * ?")
+//@Scheduled(cron = "0 0/10 * * * ?")
+    public void gwc() {
+        log.info("------------开始推送购物车相关短信------------------------>");
+        List<Integer> userId = orderClubMapper.userIds();
+        userId.forEach(userIds -> {
+            OrderVo orderVo = orderClubMapper.getcartNess(userIds);
+            if (orderVo.getProName() != null) {
+                String name = orderVo.getProName();
+
+                if (name.length() > 10) {
+                    name = StringUtils.strip(name.substring(0, 11));
+                    name += "...";
+                }
+
+                if (orderVo.getMobile() != null) {
+                    String content = "有件商品" + name + "在您购物车内已经待了很久啦,快戳采美网站链接www.caimei365.com或微信搜索“采美采购商城”小程序登录采美平台去购物车看看吧。关注公众号“采美网”获取更多优惠和精彩资讯。";
+                    String result = SmsUtil.sendSms(3, orderVo.getMobile(), content);
+                    JSONObject json = (JSONObject) JSONObject.parse(result);
+                    log.info("发送结果:" + result + ",短信内容:" + content);
+                    if (null != json && json.getInteger("code") == 0) {
+                        log.info(orderVo.getMobile() + "发送成功");
+                    } else {
+                        log.error(orderVo.getMobile() + "发送失败");
+                    }
+                } else {
+                    log.error("号码为空" + "发送失败");
+                }
+            }
+        });
+
+        log.info("------------推送购物车相关短信-结束----------------------->");
+    }
+
+
+    @Scheduled(cron = "0 0/60 * * * ?")
+    public void ConSumertime() {
+        log.info("》》》》》》》》》》》开始检测优惠券是否生效");
+        List<CmCouponPo> coupons = messageCenterMapper.couponTime();
+        coupons.forEach(cmCoupon -> {
+            List<Integer> clubIds = messageCenterMapper.ClubIds();
+            new Thread(() -> clubIds.forEach(clubId -> {
+                Jedis jedis = null;
+                String constraint = "";
+                if (clubId != null) {
+                    MessageCenterPo messageCenter = new MessageCenterPo();
+                    Date date = new Date();
+                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
+                    CmUserPo user = messageCenterMapper.clubList(clubId);
+                    int coumt = 0;//计数五种消息只推送一条
+                    String catego = "";
+                    Integer ts = (date.compareTo(cmCoupon.getStartDate()));
+                    if (ts >= 0) {
+                        if ("90".equals(user.getClubStatus()) && 0 == cmCoupon.getCouponType()) {
+                            CmCouponPo coupon = messageCenterMapper.CouponList(0);//查询优惠券信息
+                            if (coupon != null) {
+                                String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
+                                messageCenter.setShopId(null);
+                                messageCenter.setClubId(clubId);
+                                messageCenter.setUserType(1);
+                                messageCenter.setMessageType(4);
+                                messageCenter.setContent(null);
+                                messageCenter.setTime(curDateStr);
+                                messageCenter.setCouponType(0);
+                                messageCenter.setCouponMessageType(1);
+                                messageCenter.setCouponFee(coupon.getCouponAmount().doubleValue());
+                                messageCenterMapper.addMessageCenter(messageCenter);
+                                String content = "采美平台送您" + coupon.getCouponAmount() + "元优惠券,众多大牌正品等着您,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台领取下单吧。关注公众号“采美网”获取更多优惠和精彩资讯。";
+                                String result = SmsUtil.sendSms(3, user.getBindMobile(), content);
+                                JSONObject json = (JSONObject) JSONObject.parse(result);
+                                log.info("发送结果:" + result + ",短信内容:" + content);
+                                if (null != json && json.getInteger("code") == 0) {
+                                    log.info(user.getBindMobile() + "发送成功");
+                                } else {
+                                    log.error(user.getBindMobile() + "发送失败");
+                                }
+                                coumt++;
+                            }
+                        }
+                        if ("90".equals(user.getClubStatus()) && coumt == 0 && 1 == cmCoupon.getCouponType()) {
+                            CmCouponPo coupon = messageCenterMapper.CouponList(1);//查询优惠券信息
+                            if (coupon != null) {
+                                String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
+                                messageCenter.setShopId(null);
+                                messageCenter.setClubId(clubId);
+                                messageCenter.setUserType(1);
+                                messageCenter.setMessageType(4);
+                                if (coupon != null && "1".equals(coupon.getCategoryType())) {
+                                    catego = "产品";
+                                }
+                                if (coupon != null && "2".equals(coupon.getCategoryType())) {
+                                    catego = "仪器";
+                                }
+                                messageCenter.setContent(catego);
+                                messageCenter.setTime(curDateStr);
+                                messageCenter.setCouponType(1);
+                                messageCenter.setCouponMessageType(1);
+                                messageCenter.setCouponFee(coupon.getCouponAmount().doubleValue());
+                                messageCenterMapper.addMessageCenter(messageCenter);
+                                String content = "采美平台" + catego + "类商品大优惠,采美平台送您" + coupon.getCouponAmount() + "元优惠券,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台领取吧。关注公众号“采美网”获取更多优惠和精彩资讯。";
+                                String result = SmsUtil.sendSms(3, user.getBindMobile(), content);
+                                JSONObject json = (JSONObject) JSONObject.parse(result);
+                                log.info("发送结果:" + result + ",短信内容:" + content);
+                                if (null != json && json.getInteger("code") == 0) {
+                                    log.info(user.getBindMobile() + "发送成功");
+                                } else {
+                                    log.error(user.getBindMobile() + "发送失败");
+                                }
+                                coumt++;
+                            }
+                        }
+                        if (coumt == 0 && 2 == cmCoupon.getCouponType()) {
+                            CmCouponPo coupon = messageCenterMapper.CouponList(2);//查询优惠券信息
+                            if (coupon != null) {
+                                String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
+                                if (coupon != null && coupon.getUserId() != null) {
+                                    messageCenter.setShopId(null);
+                                    messageCenter.setClubId(clubId);
+                                    messageCenter.setUserType(1);
+                                    messageCenter.setMessageType(4);
+                                    messageCenter.setContent(null);
+                                    messageCenter.setTime(curDateStr);
+                                    messageCenter.setCouponType(2);
+                                    messageCenter.setCouponMessageType(1);
+                                    messageCenter.setCouponFee(coupon.getCouponAmount().doubleValue());
+                                    messageCenterMapper.addMessageCenter(messageCenter);
+
+                                    String content = "为了答谢您对采美平台的支持,采美平台送您" + coupon.getCouponAmount() + "元优惠券,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台领取吧。关注公众号“采美网”获取更多优惠和精彩资讯。";
+                                    String result = SmsUtil.sendSms(3, user.getBindMobile(), content);
+                                    JSONObject json = (JSONObject) JSONObject.parse(result);
+                                    log.info("发送结果:" + result + ",短信内容:" + content);
+                                    if (null != json && json.getInteger("code") == 0) {
+                                        log.info(user.getBindMobile() + "发送成功");
+                                    } else {
+                                        log.error(user.getBindMobile() + "发送失败");
+                                    }
+                                    coumt++;
+                                }
+                            }
+                        }
+                        if ("90".equals(user.getClubStatus()) && coumt == 0 && 3 == cmCoupon.getCouponType()) {
+                            CmCouponPo coupon = messageCenterMapper.CouponList(3);//查询优惠券信息
+                            if (coupon != null) {
+                                String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
+                                messageCenter.setShopId(null);
+                                messageCenter.setClubId(clubId);
+                                messageCenter.setUserType(1);
+                                messageCenter.setMessageType(4);
+                                messageCenter.setContent(user.getName());
+                                messageCenter.setTime(curDateStr);
+                                messageCenter.setCouponType(3);
+                                messageCenter.setCouponMessageType(1);
+                                messageCenter.setCouponFee(coupon.getCouponAmount().doubleValue());
+                                messageCenterMapper.addMessageCenter(messageCenter);
+
+                                String content = "采美平台为了回馈客户,赠送您" + coupon.getCouponAmount() + "元的店铺专属优惠券,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台领取吧。关注公众号“采美网”获取更多优惠和精彩资讯。";
+                                String result = SmsUtil.sendSms(3, user.getBindMobile(), content);
+                                JSONObject json = (JSONObject) JSONObject.parse(result);
+                                log.info("发送结果:" + result + ",短信内容:" + content);
+                                if (null != json && json.getInteger("code") == 0) {
+                                    log.info(user.getBindMobile() + "发送成功");
+                                } else {
+                                    log.error(user.getBindMobile() + "发送失败");
+                                }
+                                coumt++;
+                            }
+                        }
+                        if (coumt == 0 && 4 == cmCoupon.getCouponType()) {
+                            CmCouponPo coupon = messageCenterMapper.CouponList(4);//查询优惠券信息
+                            if (coupon != null) {
+                                String startDate = sdf.format(coupon.getStartDate());
+                                int num = startDate.compareTo(user.getRegisterTime());
+                                if (num > 0) {
+                                    String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
+                                    if (coupon != null && coupon.getUserId() != null) {
+                                        messageCenter.setShopId(null);
+                                        messageCenter.setClubId(clubId);
+                                        messageCenter.setUserType(1);
+                                        messageCenter.setMessageType(4);
+                                        messageCenter.setContent(null);
+                                        messageCenter.setTime(curDateStr);
+                                        messageCenter.setCouponType(4);
+                                        messageCenter.setCouponMessageType(1);
+                                        messageCenter.setCouponFee(coupon.getCouponAmount().doubleValue());
+                                        messageCenterMapper.addMessageCenter(messageCenter);
+
+                                        String content = "恭喜成功注册采美平台。采美平台赠送您" + coupon.getCouponAmount() + "元新用户优惠券,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台领取吧。关注公众号“采美网”获取更多优惠和精彩资讯。";
+                                        String result = SmsUtil.sendSms(3, user.getBindMobile(), content);
+                                        JSONObject json = (JSONObject) JSONObject.parse(result);
+                                        log.info("发送结果:" + result + ",短信内容:" + content);
+                                        if (null != json && json.getInteger("code") == 0) {
+                                            log.info(user.getBindMobile() + "发送成功");
+                                        } else {
+                                            log.error(user.getBindMobile() + "发送失败");
+                                        }
+                                        coumt++;
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }));
+        });
+
+    }
+
+
+    /**
+     * 每天12点推送
+     */
+    @Scheduled(cron = "0 0 12 * * ?")
+//    @Scheduled(cron = "0 0/10 * * * ?")
+    private void Timerw() {
+        log.info(">>>>>7天后下架");
+        List<Integer> userIds = messageCenterMapper.CouponUserId();
+        userIds.forEach(userId -> {
+            List<CmCouponPo> coupons = messageCenterMapper.CouponLists(userId);
+            coupons.forEach(coupon -> {
+                if (userId != null) {
+                    CmUserPo user = messageCenterMapper.clubLists(userId);
+                    String contractMobile = messageCenterMapper.contractMobile(userId);
+                    Date date = new Date();
+                    Date d = coupon.getStartDate();
+                    //1.日期格式
+                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
+                    String endTime = sdf.format(coupon.getEndDate());
+                    //2.某天的日期
+                    Date da1 = null;
+                    try {
+                        da1 = sdf.parse(endTime);
+                    } catch (ParseException e) {
+                        e.printStackTrace();
+                    }
+                    Long s = (da1.getTime() - d.getTime()) / 24 / 60 / 60 / 1000;
+                    Long t = (date.getTime() - da1.getTime()) / 24 / 60 / 60 / 1000;
+                    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                    String current = dateFormat.format(new Date());
+                    MessageCenterPo messageCenter = new MessageCenterPo();
+                    //推送信息中心-账户通知
+                    if (s > 15) {
+                        if (t == 7) {
+                            messageCenter.setShopId(null);
+                            messageCenter.setClubId(Integer.parseInt(user.getClubID()));
+                            messageCenter.setUserType(1);
+                            messageCenter.setMessageType(4);
+                            messageCenter.setCouponType(2);
+                            messageCenter.setCouponMessageType(3);
+                            messageCenter.setContent("7天");
+                            messageCenter.setCouponFee(coupon.getCouponAmount().doubleValue());
+                            messageCenter.setTime(current);
+                            messageCenterMapper.addMessageCenter(messageCenter);
+                            String content = "您有" + coupon.getCouponAmount() + "元优惠券将于7日后过期,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台查看使用吧。关注公众号“采美网”获取更多优惠和精彩资讯。";
+                            String result = SmsUtil.sendSms(3, contractMobile, content);
+                            JSONObject json = (JSONObject) JSONObject.parse(result);
+                            log.info("发送结果:" + result + ",短信内容:" + content);
+                            if (null != json && json.getInteger("code") == 0) {
+                                log.info(user.getBindMobile() + "发送成功");
+                            } else {
+                                log.error(user.getBindMobile() + "发送失败");
+                            }
+                        }
+                    }
+                }
+            });
+        });
+    }
+
+    /**
+     * 每天10点判断
+     */
+    @Scheduled(cron = "0 0 10 * * ?")
+//    @Scheduled(cron = "0 0/2 * * * ?")
+    private void Timeto() {
+        log.info(">>>>>1天后下架");
+        List<Integer> userIds = messageCenterMapper.CouponUserId();
+        userIds.forEach(userId -> {
+            String contractMobile = messageCenterMapper.contractMobile(userId);
+            List<CmCouponPo> coupons = messageCenterMapper.CouponLists(userId);
+            coupons.forEach(coupon -> {
+                if (userId != null) {
+                    CmUserPo user = messageCenterMapper.clubLists(userId);
+                    Date d = new Date();
+                    //1.日期格式
+                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
+                    String endTime = sdf.format(coupon.getEndDate());
+                    //2.某天的日期
+                    Date da1 = null;
+                    try {
+                        da1 = sdf.parse(endTime);
+                    } catch (ParseException e) {
+                        e.printStackTrace();
+                    }
+                    Long s = (da1.getTime() - d.getTime()) / 24 / 60 / 60 / 1000;
+                    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                    String current = dateFormat.format(new Date());
+                    MessageCenterPo messageCenter = new MessageCenterPo();
+                    //推送信息中心-账户通知
+                    if (s == 1) {
+                        messageCenter.setShopId(null);
+                        messageCenter.setClubId(Integer.parseInt(user.getClubID()));
+                        messageCenter.setUserType(1);
+                        messageCenter.setMessageType(4);
+                        messageCenter.setCouponType(2);
+                        messageCenter.setCouponMessageType(3);
+                        messageCenter.setContent("今日");
+                        messageCenter.setCouponFee(coupon.getCouponAmount().doubleValue());
+                        messageCenter.setTime(current);
+                        messageCenterMapper.addMessageCenter(messageCenter);
+                        String content = "您有" + coupon.getCouponAmount() + "元优惠券今日过期,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台查看使用吧。关注公众号“采美网”获取更多优惠和精彩资讯。";
+                        String result = SmsUtil.sendSms(3, contractMobile, content);
+                        JSONObject json = (JSONObject) JSONObject.parse(result);
+                        log.info("发送结果:" + result + ",短信内容:" + content);
+                        if (null != json && json.getInteger("code") == 0) {
+                            log.info(user.getBindMobile() + "发送成功");
+                        } else {
+                            log.error(user.getBindMobile() + "发送失败");
+                        }
+                    }
+
+                }
+            });
+        });
+    }
+
+//    @Scheduled(cron = "0 0/2 * * * ?")
+    @Scheduled(cron = "0 0 15 * * ?")
+    private void Timeth() {
+        log.info(">>>>>三天后下架");
+        List<Integer> userIds = messageCenterMapper.CouponUserId();
+        userIds.forEach(userId -> {
+            String contractMobile = messageCenterMapper.contractMobile(userId);
+            List<CmCouponPo> coupons = messageCenterMapper.CouponLists(userId);
+            coupons.forEach(coupon -> {
+                if (userId != null) {
+                    CmUserPo user = messageCenterMapper.clubLists(userId);
+                    Date date = new Date();
+                    Date d = coupon.getStartDate();
+                    //1.日期格式
+                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
+                    String endTime = sdf.format(coupon.getEndDate());
+                    //2.某天的日期
+                    Date da1 = null;
+                    try {
+                        da1 = sdf.parse(endTime);
+                    } catch (ParseException e) {
+                        e.printStackTrace();
+                    }
+                    Long s = (da1.getTime() - d.getTime()) / 24 / 60 / 60 / 1000;
+                    Long t = (date.getTime() - da1.getTime()) / 24 / 60 / 60 / 1000;
+                    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                    String current = dateFormat.format(new Date());
+                    MessageCenterPo messageCenter = new MessageCenterPo();
+                    //推送信息中心-账户通知
+                    if (t == 3) {
+                        messageCenter.setShopId(null);
+                        messageCenter.setClubId(Integer.parseInt(user.getClubID()));
+                        messageCenter.setUserType(1);
+                        messageCenter.setMessageType(4);
+                        messageCenter.setCouponType(2);
+                        messageCenter.setCouponMessageType(3);
+                        messageCenter.setContent("3天");
+                        messageCenter.setCouponFee(coupon.getCouponAmount().doubleValue());
+                        messageCenter.setTime(current);
+                        messageCenterMapper.addMessageCenter(messageCenter);
+                        String content = "您有" + coupon.getCouponAmount() + "元优惠券3日后过期,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台查看使用吧。关注公众号“采美网”获取更多优惠和精彩资讯。";
+                        String result = SmsUtil.sendSms(3, contractMobile, content);
+                        JSONObject json = (JSONObject) JSONObject.parse(result);
+                        log.info("发送结果:" + result + ",短信内容:" + content);
+                        if (null != json && json.getInteger("code") == 0) {
+                            log.info(user.getBindMobile() + "发送成功");
+                        } else {
+                            log.error(user.getBindMobile() + "发送失败");
+                        }
+                    }
+
+                }
+            });
+        });
+    }
+
+    @Scheduled(cron = "0 0/60 * * * ?")
+    private void config() throws ParseException {
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        SimpleDateFormat dateF = new SimpleDateFormat("yyyy-MM-dd HH");
+        SimpleDateFormat dateR = new SimpleDateFormat("yyyy-MM-dd");
+        String current = dateFormat.format(new Date());
+        //订单超时未确认的时间
+        Integer hour= orderClubMapper.cmorderconfig("confirmOverTime");
+        //待收款 待发货超时
+        Integer hours=orderClubMapper.cmorderconfig("receivableOverTime");
+        //待收款 待发货超时
+        Integer hourmex=orderClubMapper.cmorderconfig("autoReceiptGoodsTime");
+        //前日期
+        Calendar calendar = Calendar.getInstance();
+       String day= dateF.format(new Date());
+        Date receipttime = dateF.parse(day);
+        calendar.setTime(receipttime);
+        calendar.add(Calendar.HOUR, -hour);
+        String hTime=dateF.format(calendar.getTime());
+       List<OrderVo>orderStatuslist= orderClubMapper.oredrStatus();
+        log.info(">>>>订单因超时未付款站内推送");
+       orderStatuslist.forEach(order -> {
+           Date i=new Date();
+           try {
+              i=dateF.parse(order.getOrderTime());
+           } catch (ParseException e) {
+               e.printStackTrace();
+           }
+           Integer num=hTime.compareTo(dateF.format(i));
+           if(num==0){
+        MessageCenterPo messageCenter = new MessageCenterPo();
+        //推送信息中心-交易物流-待确认超时
+            messageCenter.setShopId(null);
+            messageCenter.setClubId(order.getClubId());
+            messageCenter.setUserType(1);
+            messageCenter.setMessageType(1);
+            messageCenter.setOrderId(order.getOrderId());
+            messageCenter.setOrderMessageType(4);
+            messageCenter.setContent("您的订单因超时未付款,系统已自动取消订单!");
+            messageCenter.setTime(current);
+            messageCenterMapper.addMessageCenter(messageCenter);
+           }
+    });
+
+       //待收款 待发货超时
+        Calendar calendars = Calendar.getInstance();
+        String days= dateF.format(new Date());
+        Date receiptime = dateF.parse(days);
+        calendars.setTime(receiptime);
+        calendars.add(Calendar.HOUR, -hours);
+        String hTimes=dateF.format(calendars.getTime());
+        List<OrderVo> cmorderConfigStatus =orderClubMapper.cmorderConfigStatus();
+        log.info(">>>>待收款 待发货超时站内推送!");
+        cmorderConfigStatus.forEach(order -> {
+            Date i=new Date();
+            try {
+                i=dateF.parse(order.getOrderTime());
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
+            Integer num=hTimes.compareTo(dateF.format(i));
+            if(num==0){
+            MessageCenterPo messageCenter = new MessageCenterPo();
+            //推送信息中心-账户通知
+            messageCenter.setShopId(null);
+            messageCenter.setClubId(order.getClubId());
+            messageCenter.setUserType(1);
+            messageCenter.setMessageType(1);
+            messageCenter.setOrderId(order.getOrderId());
+            messageCenter.setOrderMessageType(6);
+            messageCenter.setContent(null);
+            messageCenter.setTime(current);
+            messageCenterMapper.addMessageCenter(messageCenter);
+            }
+        });
+
+        Calendar calendarmax = Calendar.getInstance();
+        String daymax= dateR.format(new Date());
+        Date receiptimemax = dateR.parse(daymax);
+        calendarmax.setTime(receiptimemax);
+        calendarmax.add(Calendar.DATE, -hourmex);
+        String hTimemax=dateR.format(calendarmax.getTime());
+        List<OrderVo> cmorderStatus =orderClubMapper.cmorderConfigStatus();
+        log.info(">>>>订单因超时已被系统自动确认收货站内推送!");
+        cmorderStatus.forEach(order -> {
+            Date i=new Date();
+            try {
+                i=dateR.parse(order.getOrderTime());
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
+            Integer num=hTimemax.compareTo(dateR.format(i));
+            if(num==0){
+                MessageCenterPo messageCenter = new MessageCenterPo();
+                //推送信息中心-账户通知
+                messageCenter.setShopId(null);
+                messageCenter.setClubId(order.getClubId());
+                messageCenter.setUserType(1);
+                messageCenter.setMessageType(1);
+                messageCenter.setOrderId(order.getOrderId());
+                messageCenter.setOrderMessageType(6);
+                messageCenter.setContent("您的订单因超时已被系统自动确认收货!");
+                messageCenter.setTime(current);
+                messageCenterMapper.addMessageCenter(messageCenter);
+            }
+
+        });
+}
+
+}

+ 34 - 3
src/main/java/com/caimei365/tools/task/SuperVipTask.java

@@ -2,6 +2,8 @@ package com.caimei365.tools.task;
 
 import com.alibaba.fastjson.JSONObject;
 import com.caimei365.tools.mapper.BaseMapper;
+import com.caimei365.tools.mapper.MessageCenterMapper;
+import com.caimei365.tools.model.po.MessageCenterPo;
 import com.caimei365.tools.model.po.SuperVipPo;
 import com.caimei365.tools.utils.SmsUtil;
 import lombok.RequiredArgsConstructor;
@@ -11,6 +13,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.scheduling.annotation.Scheduled;
 
 import javax.annotation.Resource;
+import java.text.SimpleDateFormat;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
@@ -28,6 +31,9 @@ public class SuperVipTask {
     @Resource
     private BaseMapper baseMapper;
 
+    @Resource
+    private MessageCenterMapper messageCenterMapper;
+
     /**
      * 每天3点查一次超级会员是否到期,短信推送
      * <p>
@@ -36,12 +42,16 @@ public class SuperVipTask {
      * * 表示所有值。
      * ? 表示不指定值。
      */
-    @Scheduled(cron = "0 0 15 * * ?")
+//    @Scheduled(cron = "0 0 15 * * ?")
+    @Scheduled(cron = "0 0/2 * * * ?")
     public void checkVip() {
         try {
             log.info("开始检测超级会员到期时间");
             Date startTime = getNowTime();
             Date endTime = getEndTime();
+            MessageCenterPo messageCenter = new MessageCenterPo();
+            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            String current = dateFormat.format(new Date());
             //今日到期
             String message = "您的超级会员将于今日后到期,到期后将无法享受专属会员权益,快戳采美网站链接www.caimei365.com 或微信搜索“采美采购商城”小程序登录采美平台续费吧。关注公众号“采美365网”可获取更多优惠和精彩资讯。退订回T";
             List<SuperVipPo> vip = baseMapper.findVip(startTime, endTime);
@@ -57,9 +67,21 @@ public class SuperVipTask {
                             } else {
                                 log.error(mobile + "发送失败");
                             }
-                        }
-                );
+                            //推送信息中心-账户通知
+                            Integer clubId = messageCenterMapper.clubIdCule(v.getUserId());
+                            messageCenter.setShopId(null);
+                            messageCenter.setClubId(clubId);
+                            messageCenter.setUserType(1);
+                            messageCenter.setMessageType(2);
+                            messageCenter.setAccountType(3);
+                            messageCenter.setContent("今日后");
+                            messageCenter.setTime(current);
+                            messageCenterMapper.addMessageCenter(messageCenter);
+
+                        });
             }
+
+
             //7天后到期
             Calendar cal = Calendar.getInstance();
             cal.setTime(startTime);
@@ -82,6 +104,15 @@ public class SuperVipTask {
                             } else {
                                 log.error(mobile + "发送失败");
                             }
+                            Integer clubId = messageCenterMapper.clubIdCule(v.getUserId());
+                            messageCenter.setShopId(null);
+                            messageCenter.setClubId(clubId);
+                            messageCenter.setUserType(1);
+                            messageCenter.setMessageType(2);
+                            messageCenter.setAccountType(3);
+                            messageCenter.setContent("7日后");
+                            messageCenter.setTime(current);
+                            messageCenterMapper.addMessageCenter(messageCenter);
                         }
                 );
             }

+ 188 - 0
src/main/java/com/caimei365/tools/utils/RequestUtil.java

@@ -0,0 +1,188 @@
+package com.caimei365.tools.utils;
+
+import org.springframework.util.StringUtils;
+
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSocketFactory;
+import javax.net.ssl.TrustManager;
+import java.io.*;
+import java.net.URL;
+import java.net.URLConnection;
+import java.nio.charset.StandardCharsets;
+import java.security.cert.X509Certificate;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 请求工具类
+ *
+ * @author : Charles
+ * @date : 2021/3/8
+ */
+public class RequestUtil {
+
+    /**
+     * 向指定URL发送GET方法的请求
+     *
+     * @param url   发送请求的URL,请求参数应该是 name1=value1&name2=value2 的形式。
+     * @return 远程资源的响应结果
+     */
+    public static String sendGet(String url) throws Exception {
+        StringBuilder result = new StringBuilder();
+        BufferedReader in = null;
+        try {
+
+            URL realUrl = new URL(url);
+            // 打开和URL之间的连接
+            URLConnection connection = realUrl.openConnection();
+            // 设置通用的请求属性
+            connection.setRequestProperty("accept", "*/*");
+            connection.setRequestProperty("connection", "Keep-Alive");
+            connection.setRequestProperty("Accept-Charset", "utf-8");
+            connection.setRequestProperty("contentType", "utf-8");
+            connection.setConnectTimeout(5000);
+            // 建立实际的连接
+            connection.connect();
+            // 获取所有响应头字段
+            Map<String, List<String>> map = connection.getHeaderFields();
+            // 定义 BufferedReader输入流来读取URL的响应
+            in = new BufferedReader(new InputStreamReader(
+                    connection.getInputStream()));
+            String line;
+            while ((line = in.readLine()) != null) {
+                result.append(line);
+            }
+        }
+        // 使用finally块来关闭输入流
+        finally {
+            if (in != null) {
+                in.close();
+            }
+        }
+        return result.toString();
+    }
+
+    /**
+     * 向指定 URL 发送POST方法的请求
+     *
+     * @param url 发送请求的 URL
+     * @param paramMap 请求参数
+     * @return 所代表远程资源的响应结果
+     */
+    public static String sendPost(String url, Map<String, ?> paramMap) throws Exception{
+        PrintWriter out = null;
+        BufferedReader in = null;
+        StringBuilder result = new StringBuilder();
+
+        StringBuilder param = new StringBuilder();
+
+        for (String key : paramMap.keySet()) {
+            param.append(key).append("=").append(paramMap.get(key)).append("&");
+        }
+
+        try {
+            URL realUrl = new URL(url);
+            // 打开和URL之间的连接
+            URLConnection conn = realUrl.openConnection();
+            // 设置通用的请求属性
+            conn.setRequestProperty("accept", "*/*");
+            conn.setRequestProperty("connection", "Keep-Alive");
+            conn.setRequestProperty("Accept-Charset", "utf-8");
+            conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
+            // 发送POST请求必须设置如下两行
+            conn.setDoOutput(true);
+            conn.setDoInput(true);
+            // 获取URLConnection对象对应的输出流
+            out = new PrintWriter(conn.getOutputStream());
+            // 发送请求参数
+            out.print(param);
+            // flush输出流的缓冲
+            out.flush();
+            // 定义BufferedReader输入流来读取URL的响应
+            in = new BufferedReader(new InputStreamReader(conn.getInputStream(), StandardCharsets.UTF_8));
+            String line;
+            while ((line = in.readLine()) != null) {
+                result.append(line);
+            }
+        }
+        //使用finally块来关闭输出流、输入流
+        finally{
+            if(out!=null){
+                out.close();
+            }
+            if(in!=null){
+                in.close();
+            }
+        }
+        return result.toString();
+    }
+
+    /**
+     * 向指定 URL 发送请求
+     * @param requestUrl 发送请求的 URL
+     * @param requestMethod 请求方法GET/POST
+     * @param jsonString json字符串参数
+     * @return 远程资源的响应结果
+     */
+    public static String httpRequest(String requestUrl, String requestMethod, String jsonString) {
+        StringBuffer buffer = new StringBuffer();
+        try {
+            // 创建SSLContext对象,并使用我们指定的信任管理器初始化
+            TrustManager[] tm = {
+                    new javax.net.ssl.X509TrustManager(){
+                        @Override
+                        public void checkClientTrusted(X509Certificate[] chain, String authType) {
+                        }
+                        @Override
+                        public void checkServerTrusted(X509Certificate[] chain, String authType) {
+                        }
+                        @Override
+                        public X509Certificate[] getAcceptedIssuers() {
+                            return null;
+                        }
+                    }
+            };
+            SSLContext sslContext = SSLContext.getInstance("SSL", "SunJSSE");
+            sslContext.init(null, tm, new java.security.SecureRandom());
+            // 从上述SSLContext对象中得到SSLSocketFactory对象
+            SSLSocketFactory ssf = sslContext.getSocketFactory();
+
+            URL url = new URL(requestUrl);
+            HttpsURLConnection httpUrlConn = (HttpsURLConnection) url.openConnection();
+            httpUrlConn.setSSLSocketFactory(ssf);
+            httpUrlConn.setDoOutput(true);
+            httpUrlConn.setDoInput(true);
+            httpUrlConn.setUseCaches(false);
+            // 设置请求方式(GET/POST)
+            httpUrlConn.setRequestMethod(requestMethod);
+            if ("GET".equalsIgnoreCase(requestMethod)) {
+                httpUrlConn.connect();
+            }
+            // 当有数据需要提交时
+            if (StringUtils.hasLength(jsonString)) {
+                OutputStream outputStream = httpUrlConn.getOutputStream();
+                // 注意编码格式,防止中文乱码
+                outputStream.write(jsonString.getBytes(StandardCharsets.UTF_8));
+                outputStream.close();
+            }
+
+            // 将返回的输入流转换成字符串
+            InputStream inputStream = httpUrlConn.getInputStream();
+            InputStreamReader inputStreamReader = new InputStreamReader(inputStream, StandardCharsets.UTF_8);
+            BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
+            String str = null;
+            while ((str = bufferedReader.readLine()) != null) {
+                buffer.append(str);
+            }
+            bufferedReader.close();
+            inputStreamReader.close();
+            // 释放资源
+            inputStream.close();
+            httpUrlConn.disconnect();
+            return buffer.toString();
+        } catch (Exception ignored) {}
+        return null;
+    }
+
+}

+ 1 - 0
src/main/java/com/caimei365/tools/utils/SmsUtil.java

@@ -83,6 +83,7 @@ public class SmsUtil {
             list.add("15113936829");
             list.add("15827317748");
             list.add("18476937515");
+            list.add("18175515644");
             if (prof.contains("core.caimei365.com") || list.contains(mobile)) {
                 url = new URL(SMS_URL);
                 HttpURLConnection connection = (HttpURLConnection) url.openConnection();

+ 284 - 0
src/main/resources/mapper/MessageCenter.xml

@@ -0,0 +1,284 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.caimei365.tools.mapper.MessageCenterMapper">
+    <insert id="addMessageCenter">
+        INSERT INTO message_center (shopID, clubID, userType, messageType, content,time,accountType,couponType,couponFee,couponMessageType,ShopMessType,ShopTieredType)
+        VALUES (#{shopId}, #{clubId}, #{userType}, #{messageType}, #{content},#{time},#{accountType},#{couponType},#{couponFee},#{couponMessageType},#{shopMessType},#{shopTieredType})
+    </insert>
+
+    <select id="clubIdCule" resultType="java.lang.Integer">
+        SELECT clubID FROM `user` WHERE userId=#{userId}
+    </select>
+
+    <select id="shopID" resultType="java.lang.Integer">
+        SELECT shopID FROM `shop` WHERE userId=#{userId}
+    </select>
+
+<!--    <select id="shopID" resultType="java.lang.Integer">-->
+<!--        SELECT shopID FROM `shop` WHERE userId=#{userId}-->
+<!--    </select>-->
+
+<!--    <select id="clubList" resultType="com.caimei365.user.model.vo.UserVo">-->
+<!--        SELECT * FROM `user` WHERE userId=#{userId}-->
+<!--    </select>-->
+
+<!--    <select id="CouponList" resultType="com.caimei365.user.model.vo.CouponVo">-->
+<!--        SELECT * FROM cm_coupon WHERE couponType=#{couponType}-->
+<!--         AND NOW() >= startDate-->
+<!--         AND endDate >= NOW()-->
+<!--         AND status=1-->
+<!--         AND delFlag=0-->
+<!--        LIMIT 1-->
+<!--    </select>-->
+
+    <select id="MessageCount" resultType="java.lang.Integer">
+        SELECT COUNT(1) FROM `message_center`
+        <where>
+            <if test="userType == 1">
+                and  clubID=#{commonId}
+            </if>
+            <if test="userType == 2">
+                and  shopID=#{commonId}
+            </if>
+            AND messageType=#{messageType}
+            and userType=#{userType}
+            AND saved=0
+        </where>
+    </select>
+
+    <select id="Count" resultType="java.lang.Integer">
+        SELECT COUNT(1) FROM `message_center`
+        <where>
+            <if test="userType == 1">
+                and  clubID=#{commonId}
+            </if>
+            <if test="userType == 2">
+                and  shopID=#{commonId}
+            </if>
+            and userType=#{userType}
+            AND saved=0
+        </where>
+    </select>
+
+
+    <select id="receStatct" resultType="java.lang.Integer">
+        SELECT COUNT(*) FROM `cm_discern_receipt` WHERE newReceiptType=1 AND shopID=#{shopID} AND receStatct=2
+    </select>
+
+    <select id="listingFee" resultType="java.lang.Integer">
+        SELECT COUNT(*) FROM `cm_discern_receipt` WHERE newReceiptType=1 AND shopID=#{shopID}
+    </select>
+
+    <select id="listingfeeExpire" resultType="java.lang.Integer">
+        SELECT COUNT(*) FROM `cm_discern_receipt` WHERE newReceiptType=1 AND shopID=#{shopID} AND NOW()> DATE_ADD(receiptDate, INTERVAL 1 YEAR)
+    </select>
+
+<!--    <select id="MessageList" resultType="com.caimei365.user.model.vo.MessageCenter">-->
+<!--        SELECT * FROM `message_center`-->
+<!--        <where>-->
+<!--            <if test="messageType !=null">-->
+<!--            AND messageType=#{messageType}-->
+<!--           </if>-->
+<!--            <if test="userType == 1">-->
+<!--                and  clubID=#{commonId}-->
+<!--            </if>-->
+<!--            <if test="userType == 2">-->
+<!--                and  shopID=#{commonId}-->
+<!--            </if>-->
+<!--           and userType=#{userType}-->
+<!--        </where>-->
+<!--        ORDER BY id DESC-->
+<!--    </select>-->
+
+    <select id="contractMobile" resultType="java.lang.String">
+        SELECT contractMobile FROM club WHERE clubID=#{clubID}
+    </select>
+
+    <select id="contractMobiles" resultType="java.lang.String">
+        SELECT contractMobile FROM shop WHERE shopID=#{shopID}
+    </select>
+
+    <select id="getOpenidListByPermission" resultType="java.lang.String">
+        SELECT openid FROM `wechat_user` WHERE unionId= #{unionId}
+    </select>
+
+    <select id="FromUnionId" resultType="java.lang.String">
+        SELECT unionID FROM `cm_order` WHERE userID=#{userID} AND unionID IS NOT NULL  ORDER BY orderID DESC LIMIT 1
+    </select>
+
+    <select id="getVipHistoryCount" resultType="java.lang.Integer">
+        SELECT count(1)
+        FROM cm_svip_history
+        WHERE  userId = #{userId}
+    </select>
+
+    <select id="MainImage" resultType="com.caimei365.tools.model.po.MessageCenterPo">
+        SELECT co.refundType,COUNT(p.productID)AS productCount ,p.mainImage,co.onlinePayFlag,ifnull(p.name,'') as productName,co.orderID as orderID,co.status as status
+        FROM cm_order co
+                 LEFT JOIN bp_order_userinfo bou ON bou.orderId = co.orderID
+                 LEFT JOIN USER u ON u.userID = co.userID
+                 LEFT JOIN club c ON u.userID = c.userID
+                 LEFT JOIN serviceprovider sp ON c.spID = sp.serviceProviderID AND sp.status = 90
+                 LEFT JOIN cm_order_product cop ON co.orderID = cop.orderID
+                 LEFT JOIN product p ON cop.productID = p.productID
+                 LEFT JOIN cm_shop_order cso ON co.orderid=cso.orderID
+        <where>
+
+            <if test="userType == 1">
+              and  c.clubID=#{commonId}
+            </if>
+            <if test="userType == 2">
+              and  p.shopID=#{commonId}
+            </if>
+        and co.orderID=#{orderID}
+        </where>
+        LIMIT 1
+    </select>
+
+    <select id="productImage" resultType="com.caimei365.tools.model.po.MessageCenterPo">
+        SELECT s.name as shopName,p.`shopID`,p.`productID`,p.`name` as productName,p.mainImage
+        FROM product p
+        LEFT JOIN cm_order_product cop ON p.productID = cop.productID
+        LEFT JOIN shop s ON s.shopID = p.shopID
+        <where>
+            <if test="productID != null">
+                and p.productID=#{productID}
+            </if>
+                and p.shopID=#{shopID}
+        </where>
+        LIMIT 1
+    </select>
+
+    <select id="productCount" resultType="java.lang.Integer">
+        SELECT COUNT(productID) FROM cm_order_product
+        WHERE orderID=#{orderID}
+    </select>
+
+
+    <select id="receiptDate" resultType="java.lang.String">
+        SELECT
+            c.dateStrings
+        FROM cm_receipt c
+                 LEFT JOIN cm_discern_receipt a ON c.receiptID = a.id
+                 LEFT JOIN shop s ON s.shopID = a.shopID
+        WHERE
+            a.shopID=10324
+          AND a.newReceiptType=1
+        ORDER BY a.id DESC
+        LIMIT 1
+    </select>
+
+    <select id="receiptAmount" resultType="java.lang.Double">
+        SELECT
+            a.receiptAmount
+        FROM cm_discern_receipt a
+                 LEFT JOIN shop s ON s.shopID = a.shopID
+        where
+            a.shopID=#{shopID}
+          AND a.newReceiptType=1
+        LIMIT 1
+    </select>
+
+<select id="newReceiptType" resultType="java.lang.Integer">
+    SELECT
+        a.newReceiptType
+    FROM cm_discern_receipt a
+             LEFT JOIN shop s ON s.shopID = a.shopID
+    where
+        a.shopID=#{shopID}
+    LIMIT 1
+</select>
+    <update id="updateMessageAsRead">
+        UPDATE message_center SET saved = 1
+        <where>
+      <if test="userType == 1">
+          and  clubID=#{commonId}
+      </if>
+      <if test="userType == 2">
+          and  shopID=#{commonId}
+      </if>
+        <if test="messageType !=null">
+           and messageType = #{messageType}
+        </if>
+          and userType=#{userType}
+        </where>
+    </update>
+
+    <select id="userId" resultType="java.lang.Integer">
+        SELECT userID FROM `cm_mall_operation_user` WHERE openid=#{openid}  LIMIT 1
+    </select>
+
+ <delete id="deleteMessage">
+        DELETE FROM message_center WHERE id = #{id}
+    </delete>
+
+    <update id="updateRead">
+        UPDATE message_center SET saved = 1
+        where userType=#{userType} and id=#{Id}
+    </update>
+
+    <select id="receiptShopID" resultType="java.lang.Integer">
+        SELECT DISTINCT
+            a.shopID
+        FROM cm_discern_receipt a
+                 LEFT JOIN shop s ON s.shopID = a.shopID
+        WHERE
+            a.newReceiptType=1
+    </select>
+
+    <select id="userIds" resultType="java.lang.Integer">
+        SELECT DISTINCT
+            a.userID
+        FROM shop a
+        WHERE
+            a.shopOD=#{shopID}
+    </select>
+
+    <select id="ClubIds" resultType="java.lang.Integer">
+        SELECT clubID FROM `user` WHERE YEAR(loginTime)>YEAR(NOW())-3 AND clubID IS NOT NULL
+#         ORDER BY clubID DESC
+    </select>
+
+    <select id="couponTime" resultType="com.caimei365.tools.model.po.CmCouponPo">
+        SELECT * FROM `cm_coupon` WHERE
+            NOW() >= startDate
+             AND endDate >= NOW()
+             AND STATUS = 1
+             AND delFlag=0
+    </select>
+
+    <select id="clubList" resultType="com.caimei365.tools.model.po.CmUserPo">
+        SELECT * FROM `user` WHERE clubId=#{clubId}  LIMIT 1
+    </select>
+
+    <select id="clubLists" resultType="com.caimei365.tools.model.po.CmUserPo">
+        SELECT * FROM `user` WHERE userId=#{userId}  LIMIT 1
+    </select>
+
+    <select id="CouponList" resultType="com.caimei365.tools.model.po.CmCouponPo">
+        SELECT * FROM cm_coupon WHERE couponType=#{couponType}
+        AND NOW() >= startDate
+        AND endDate >= NOW()
+        AND status=1
+        AND delFlag=0
+        ORDER BY id DESC
+        LIMIT 1
+    </select>
+
+    <select id="CouponUserId" resultType="java.lang.Integer">
+        SELECT DISTINCT `userId`
+        FROM `cm_coupon_club`
+        WHERE useDate IS NULL
+    </select>
+
+    <select id="CouponLists" resultType="com.caimei365.tools.model.po.CmCouponPo">
+        SELECT * FROM cm_coupon a
+        LEFT JOIN cm_coupon_club s ON s.couponId = a.id
+        WHERE  s.userId=#{userID}
+          AND NOW() >= a.startDate
+          AND a.endDate >= NOW()
+          AND a.status=1
+          AND a.delFlag=0
+    </select>
+
+</mapper>

+ 36 - 0
src/main/resources/mapper/OrderClubMapper.xml

@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.caimei365.tools.mapper.OrderClubMapper">
+
+    <select id="userIds" resultType="java.lang.Integer">
+        SELECT  DISTINCT userID FROM cm_cart
+        WHERE
+            YEAR(`addTime`)>YEAR(NOW())-3 AND userID IS NOT NULL
+    </select>
+
+    <select id="getcartNess" resultType="com.caimei365.tools.model.po.OrderVo">
+        SELECT DISTINCT p.`name` AS proName,cm.payFlag AS payFlag,cm.onlinePayFlag AS onlinePayFlag,COUNT(p.name)AS proCount,u.`bindMobile`AS mobile,cm.orderNo AS orderNo
+        FROM `cm_order` cm
+                 LEFT JOIN cm_order_product cmp ON cm.orderID = cmp.orderID
+                 LEFT JOIN  product p ON p.productID=cmp.productID
+                 LEFT JOIN `user` u ON u.`userID` = cm.userId
+        WHERE cm.userID=#{userID}
+    </select>
+
+    <select id="oredrStatus" resultType="com.caimei365.tools.model.po.OrderVo">
+        SELECT * FROM cm_order WHERE `status`=0
+    </select>
+
+    <select id="cmorderconfig" resultType="java.lang.Integer">
+        SELECT `value` FROM `cm_order_config` WHERE `key`=#{key}
+    </select>
+
+    <select id="cmorderConfigStatus" resultType="com.caimei365.tools.model.po.OrderVo">
+        SELECT * FROM cm_order WHERE `receiptStatus`=1 AND sendOutStatus=1 AND payStatus!=1
+    </select>
+
+    <select id="cmorderStatus" resultType="com.caimei365.tools.model.po.OrderVo">
+        SELECT * FROM cm_order WHERE `status`!=4 AND`status`!=5 AND`status`!=33 AND`status`!=6 AND`status`!=7
+    </select>
+
+</mapper>