| 
					
				 | 
			
			
				@@ -20,6 +20,7 @@ import org.slf4j.Logger; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.slf4j.LoggerFactory; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.stereotype.Controller; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.transaction.annotation.Transactional; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.web.bind.annotation.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import javax.annotation.Resource; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -129,12 +130,14 @@ public class AppUserInfoController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @RequestMapping(value = "/addAppUserInfo", method = RequestMethod.POST) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @ResponseBody 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Transactional 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public String addAppUserInfo(@RequestBody AppUserInfoRequest request){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Gson gson =new Gson(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         ResultData resultData=null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         try{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            logger.info("前端传入参数:" +request.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             AppUserInfo appUserInfo =new AppUserInfo(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //CustomerPoints customerPoints =  new CustomerPoints(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            CustomerPoints customerPoints =  new CustomerPoints(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             String openId = "";     //此参数用于查询该用户是否已注册过 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if(request.getUserType()!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //1-微信公众号 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -143,63 +146,67 @@ public class AppUserInfoController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     appUserInfo.setBlogToken(request.getBlogToken()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     openId = request.getBlogOpenid(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     appUserInfo.setBlogOpenid(openId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    //customerPoints.setBlogOpenId(openId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    customerPoints.setBlogOpenId(openId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                  //2-微信小程序 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 }else if(request.getUserType().equals("2") &&StringUtils.isNotBlank(request.getMinaOpenid())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     appUserInfo.setUserType(request.getUserType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     appUserInfo.setMinaToken(request.getMinaToken()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     openId = request.getMinaOpenid(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     appUserInfo.setMinaOpenid(openId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    //customerPoints.setMinaOpenId(openId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    customerPoints.setMinaOpenId(openId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if(StringUtils.isNotBlank(request.getBlogNickName())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 appUserInfo.setBlogNickName(request.getBlogNickName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                //customerPoints.setCustomerName(request.getBlogNickName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                customerPoints.setCustomerName(request.getBlogNickName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if(StringUtils.isNotBlank(request.getMobilePhone())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 appUserInfo.setMobilePhone(request.getMobilePhone()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                //customerPoints.setMobilePhone(request.getMobilePhone()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                customerPoints.setMobilePhone(request.getMobilePhone()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if(StringUtils.isNotBlank(request.getBlogProfilePhoto())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 appUserInfo.setBlogProfilePhoto(request.getBlogProfilePhoto()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if(StringUtils.isNotBlank(request.getUnionId())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 appUserInfo.setUnionId(request.getUnionId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                //customerPoints.setUnionId(request.getUnionId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                customerPoints.setUnionId(request.getUnionId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             appUserInfo.setRegisteDate(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             appUserInfo.setUpdateDate(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //customerPoints.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            customerPoints.setUnionId(request.getUnionId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            customerPoints.setPoints(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            customerPoints.setConsumptionPoints(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            customerPoints.setAccumulatePoints(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            customerPoints.setInvalidPoints(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            customerPoints.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            customerPoints.setUnionId(request.getUnionId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            customerPoints.setPoints(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            customerPoints.setConsumptionPoints(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            customerPoints.setAccumulatePoints(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            customerPoints.setInvalidPoints(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            customerPoints.setStationId(request.getStationId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            customerPoints.setStationName(request.getStationName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if(StringUtils.isNotBlank(request.getSexFlag())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 appUserInfo.setSexFlag(request.getSexFlag()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            logger.info("插入数据库用户信息参数:"+appUserInfo.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             Map<String, Object> params = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             params.put("openId", openId);                   //注册用户openId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             params.put("userType", request.getUserType());  //用户类型 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //判断该用户是否已存在 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             int count = appUserInfoService.isExistAppUser(params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if(count > 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                boolean boo = customerPointsService.isExistCustomerPointsInfo(customerPoints); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                if(!boo){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                    customerPointsService.insertCustomerPointsInfo(customerPoints); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                if(appUserInfoService.getUserUnionId(appUserInfo)==null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                    appUserInfoService.updateUnionId(appUserInfo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                boolean boo = customerPointsService.isExistCustomerPointsInfo(customerPoints); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if(!boo){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    customerPointsService.insertCustomerPointsInfo(customerPoints); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                String userUnionId = appUserInfoService.getUserUnionId(appUserInfo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if(!StringUtils.isNotBlank(userUnionId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    appUserInfoService.updateUnionId(appUserInfo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 resultData = ResultData.error(CodeMsg.USER_EXSIST); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 appUserInfoService.AddAppUserInfo(appUserInfo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                customerPointsService.insertCustomerPointsInfo(customerPoints); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                customerPointsService.insertCustomerPointsInfo(customerPoints); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 resultData = ResultData.success(CodeMsg.SUCCESS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }catch (Exception e){ 
			 |