Browse Source

订单表增加一个佣金字段

Althars123 2 years ago
parent
commit
e538418998

+ 6 - 0
sdjk-service/src/main/java/com/miaxis/wx/domain/WxOrder.java

@@ -183,5 +183,11 @@ public class WxOrder extends BaseBusinessEntity {
     @ApiModelProperty(value = "推荐人id")
     private Long referralUserId;
 
+    /** 订单总金额,单位为分。 */
+    @Excel(name = "佣金金额。")
+    @TableField("commission_price")
+    @ApiModelProperty(value = "佣金金额,单位为分。")
+    private Integer commissionPrice;
+
 
 }

+ 8 - 3
sdjk-service/src/main/java/com/miaxis/wx/service/impl/WxGzhServiceImpl.java

@@ -119,8 +119,8 @@ public class WxGzhServiceImpl implements IWxGzhService {
             // 区分消息类型
             String msgType = jsonObjectData.getStr("MsgType");
             //获取用户信息
-//            String userInfoResult = wxSendService.userInfo(this.getGzhToken(), fromUserName, "zh_CN");
-//            JSONObject jsonObj = JSONObject.parseObject(userInfoResult);
+           String userInfoResult = wxSendService.userInfo(this.getGzhToken(), fromUserName, "zh_CN");
+           JSONObject jsonObj = JSONObject.parseObject(userInfoResult);
 
             // 普通消息
             if (MessageUtil.MESSAGE_TEXT.equals(msgType)) { // 文本消息
@@ -136,7 +136,12 @@ public class WxGzhServiceImpl implements IWxGzhService {
                 if (MessageUtil.MESSAGE_SUBSCRIBE.equals(event)) { // 关注事件 或 扫描二维码关注事件
                     log.info("3.1...");
                     String res = wxSendService.userInfo( this.getGzhToken(), fromUserName, "zh_CN");
-
+                    JSONObject jsonObject = JSONObject.parseObject(res);
+                    String unionId = jsonObject.getString("unionid");
+                    UserInfo user = userService.getStudentByUnionid(unionId);
+                    UserInfo userInfo = new UserInfo();
+                    userInfo.setGzhOpenid(fromUserName);
+                    userInfo.setUnionId(unionId);
                     //存在Ticket为扫码关注
                     if (org.apache.commons.lang3.StringUtils.isNotEmpty(jsonObjectData.getStr("Ticket"))){
                         log.info("3.1.2..");

+ 2 - 0
sdjk-system/src/main/java/com/miaxis/system/mapper/SysUserMapper.java

@@ -129,4 +129,6 @@ public interface SysUserMapper
     UserInfo getStudentByUnionId(String identification);
 
     void recharge(@Param("userId")Long userId, @Param("rechargeNumber")Integer rechargeNumber);
+
+    UserInfo getStudentByUnionid(String unionId);
 }

+ 2 - 0
sdjk-system/src/main/java/com/miaxis/system/service/ISysUserService.java

@@ -192,4 +192,6 @@ public interface ISysUserService
     void recharge(Integer rechargeNumber,Long userId);
 
     Map getAgentRemainingNumber();
+
+    UserInfo getStudentByUnionid(String unionId);
 }

+ 5 - 0
sdjk-system/src/main/java/com/miaxis/system/service/impl/SysUserServiceImpl.java

@@ -503,4 +503,9 @@ public class SysUserServiceImpl implements ISysUserService
         dataMap.put("agentRemainingNubmer",sysUser.getAgentRemainingNumber());
         return dataMap;
     }
+
+    @Override
+    public UserInfo getStudentByUnionid(String unionId) {
+        return userMapper.getStudentByUnionid(unionId);
+    }
 }

+ 4 - 0
sdjk-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -238,5 +238,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			#{userId}
         </foreach>
  	</delete>
+	<select id="getStudentByUnionid" parameterType="String" resultType="com.miaxis.common.core.domain.entity.UserInfo">
+		select * from user_info
+		where union_id = #{unionId}
+	</select>
 
 </mapper>