浏览代码

牙刷绑定获取积分

wangxiaoming 6 年之前
父节点
当前提交
5feba52f1d

+ 2 - 4
tooth-common-tool/src/main/java/com/iamberry/wechat/tools/ResultInfo.java

@@ -355,9 +355,7 @@ public class ResultInfo {
 	/**
 	 * 获取RST系统产品信息接口地址
 	 */
-//	public static String GET_MACHINE_INFO = "https://rst.iamberry.com/mcahine/getMachineInfo?barCode=";
-	public static String GET_MACHINE_INFO = "http://my.com:9797/mcahine/getMachineInfo?barCode=";
-//	public static String GET_TOOTH_INFO = "https://rst.iamberry.com/mcahine/listToothInfo";
-	public static String GET_TOOTH_INFO = "http://my.com:9797/mcahine/listToothInfo";
+	public static String GET_MACHINE_INFO = "";
+	public static String GET_TOOTH_INFO = "";
 
 }

+ 3 - 0
tooth-common-tool/src/main/java/com/iamberry/wechat/tools/loadResultUtil.java

@@ -86,6 +86,9 @@ public class loadResultUtil {
 			ResultInfo.participate_in_success = prop.getProperty("participate_in_success");			// 618活动  参与成功
 			ResultInfo.helping_success = prop.getProperty("helping_success");			//618活动  助力成功
 			ResultInfo.help_url = prop.getProperty("ACTIVITY_URL");			//618活动  助力成功
+
+			ResultInfo.GET_MACHINE_INFO = prop.getProperty("GET_MACHINE_INFO");			//产品-RST
+			ResultInfo.GET_TOOTH_INFO = prop.getProperty("GET_TOOTH_INFO");			//产品-RST
 		} catch (IOException e) {
 			new RuntimeException(e.getMessage());
 		}

+ 15 - 14
tooth-wechat-service/src/main/java/com/iamberry/wechat/service/apparatus/ApparatusServiceImpl.java

@@ -1,24 +1,20 @@
 package com.iamberry.wechat.service.apparatus;
 
 import com.github.pagehelper.PageHelper;
-import com.iamberry.wechat.core.entity.ResultMsg;
 import com.iamberry.wechat.core.entity.admin.ShopSystemRule;
 import com.iamberry.wechat.core.entity.apparatus.Apparatus;
 import com.iamberry.wechat.core.entity.integral.IntegralConfig;
-import com.iamberry.wechat.core.entity.integral.MemberIntegral;
+import com.iamberry.wechat.core.entity.integral.StayIntegral;
 import com.iamberry.wechat.core.entity.integral.UseIntegral;
 import com.iamberry.wechat.core.entity.member.Member;
-import com.iamberry.wechat.core.entity.integral.StayIntegral;
 import com.iamberry.wechat.core.entity.page.PageRequest;
 import com.iamberry.wechat.core.entity.page.PagedResult;
 import com.iamberry.wechat.core.entity.product.ProductRelatedRstProduce;
 import com.iamberry.wechat.face.apparatus.ApparatusService;
-import com.iamberry.wechat.face.integral.UseIntegralService;
 import com.iamberry.wechat.service.mapper.ApparatusMapper;
 import com.iamberry.wechat.service.mapper.MemberMapper;
 import com.iamberry.wechat.service.mapper.SystemMapper;
 import com.iamberry.wechat.service.mapper.UseIntegralMapper;
-import com.iamberry.wechat.tools.ResultInfo;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -27,7 +23,6 @@ import org.springframework.transaction.annotation.Transactional;
 import util.PageUtil;
 
 import java.util.Calendar;
-import java.util.Date;
 import java.util.List;
 
 /**
@@ -47,6 +42,8 @@ public class ApparatusServiceImpl implements ApparatusService {
     private UseIntegralMapper useIntegralMapper;
     @Autowired
     private MemberMapper memberMapper;
+    @Autowired
+    private ApparatusService apparatusService;
 
 
 
@@ -75,7 +72,7 @@ public class ApparatusServiceImpl implements ApparatusService {
         //获取会员信息,判断是否已经注册会员
         Member memberInfo = memberMapper.getMemberByUserOpenId(member.getUserOpenid());
         if(memberInfo == null){
-            return false;
+            throw new RuntimeException("获取会员信息失败");
         }
 
         if(memberInfo.getUserBirthDate() != null){
@@ -88,17 +85,17 @@ public class ApparatusServiceImpl implements ApparatusService {
             //这里判断是否是会员 1.会员 2.普通用户
             if(memberInfo.getUserIdentity() == 2){
                 //赠送新注册积分
-                addStayIntegral(member.getUserOpenid(),1,0,"",apparatus.getColorId());
+                apparatusService.addStayIntegral(member.getUserOpenid(),1,0,"",apparatus.getColorId());
             }
             //赠送400新增牙刷积分
-            addStayIntegral(member.getUserOpenid(),2,0,"",apparatus.getColorId());
+            apparatusService.addStayIntegral(member.getUserOpenid(),2,0,"",apparatus.getColorId());
            //修改用户信息
             member.setUserIdentity(1);
             if(memberMapper.updateMemberByUserId(member) < 1){
-                return false;
+                throw new RuntimeException("修改用户信息失败");
             }
         } else {
-            return false;
+            throw new RuntimeException("绑定牙刷失败");
         }
         return true;
     }
@@ -147,7 +144,7 @@ public class ApparatusServiceImpl implements ApparatusService {
     @Transactional
     public boolean addStayIntegral(String openId,Integer IntegralType,Integer orderAllIntegral,String orderId,Integer cololId){
         if(openId == null||openId.equals("") || IntegralType < 1){
-            return false;
+            throw new RuntimeException("入账积分类型为空或openid为空");
         }
         IntegralConfig integralConfig = null;
         StayIntegral stayIntegral = new StayIntegral();
@@ -193,7 +190,7 @@ public class ApparatusServiceImpl implements ApparatusService {
                  break;
         }
         if(integralConfig == null){
-            return false;
+            throw new RuntimeException("积分数量为空");
         }
         stayIntegral.setUserOpenId(openId);
         stayIntegral.setConfigId(integralConfig.getIntegralConfigId());
@@ -218,9 +215,13 @@ public class ApparatusServiceImpl implements ApparatusService {
                 useIntegral.setIntegralRemarks(integralConfig.getIntegralConfigName());
                 //添加积分获取日志信息
                 if(useIntegralMapper.addUseIntegral(useIntegral) < 1){
-                    return false;
+                    throw new RuntimeException("添加积分日志失败");
                 }
+            }else{
+                throw new RuntimeException("修改用户待入账积分失败");
             }
+        }else{
+            throw new RuntimeException("增加待入账失败");
         }
         return true;
     }

+ 7 - 2
tooth-wechat-web/src/main/java/com/iamberry/wechat/handles/apparatus/ApparatusHandler.java

@@ -229,9 +229,14 @@ public class ApparatusHandler {
         apparatus.setApparatusWarrantyDate(updateDate(format.parse(buyDate),renewRule.getRuleNum().intValue()));
         apparatus.setApparatusStore(Integer.valueOf(apparatusStore));
         //注册会员
-        boolean flag = apparatusService.registerMember(apparatus,member);
+        boolean flag = false;
+        try{
+            flag = apparatusService.registerMember(apparatus,member);
+        }catch (Exception e){
+            e.printStackTrace();
+            logger.info("绑定牙刷失败;"+memberInfo.getUserOpenid()+"==code:"+code);
+        }
         if (flag) {
-
             if(!isRegistered){
                 logger.info("新用户注册推送信息,用户openid为"+memberInfo.getUserOpenid());
                 Date date = new Date();

+ 8 - 0
tooth-wechat-web/src/main/resources/ResultInfo.properties

@@ -83,3 +83,11 @@ birthday_template=xx
 
 participate_in_success=lSO6fFO3zaJxNFINTrgn5hz04ieeSGBb4SU9o5WwR8I
 helping_success=vQJrb-IFzwWj18UcmiLeD55_7v7jNgxFj6WuVnr8UTM
+
+#RST
+#GET_MACHINE_INFO=http://my.com:9797/mcahine/getMachineInfo?barCode=
+#GET_TOOTH_INFO=http://my.com:9797/mcahine/listToothInfo
+#RST - test
+GET_MACHINE_INFO=https://rst.iamberry.com/mcahine/getMachineInfo?barCode=
+GET_TOOTH_INFO=https://rst.iamberry.com/mcahine/listToothInfo
+