|
@@ -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;
|
|
|
}
|