|
@@ -60,11 +60,11 @@ public class ApparatusServiceImpl implements ApparatusService {
|
|
|
//这里判断是否是会员 1.会员 2.普通用户
|
|
|
if(memberInfo.getUserIdentity() == 2){
|
|
|
//赠送新注册积分
|
|
|
- addStayIntegral(member.getUserOpenid(),1,0.0);
|
|
|
+ addStayIntegral(member.getUserOpenid(),1,0.0,0);
|
|
|
|
|
|
}
|
|
|
//赠送400新增牙刷积分
|
|
|
- addStayIntegral(member.getUserOpenid(),2,0.0);
|
|
|
+ addStayIntegral(member.getUserOpenid(),2,0.0,0);
|
|
|
//修改用户信息
|
|
|
member.setUserIdentity(1);
|
|
|
if(memberMapper.updateMemberByUserId(member) < 1){
|
|
@@ -112,28 +112,40 @@ public class ApparatusServiceImpl implements ApparatusService {
|
|
|
* @param openId
|
|
|
* @param IntegralType 1.新注册会员送一百积分 2.新增牙刷赠送400积分 3.购买牙刷,赠送订单金额乘以2的积分
|
|
|
* @param orderAmount 订单金额 IntegralType为3时有值
|
|
|
+ * @param orderId 订单id IntegralType为3时有值
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public boolean addStayIntegral(String openId,Integer IntegralType,Double orderAmount){
|
|
|
+ public boolean addStayIntegral(String openId,Integer IntegralType,Double orderAmount,Integer orderId){
|
|
|
if(openId == null||openId.equals("") || IntegralType < 1){
|
|
|
return false;
|
|
|
}
|
|
|
IntegralConfig integralConfig = null;
|
|
|
+ IntegralConfig registeredConfig = null;
|
|
|
+ IntegralConfig buyConfig = null;
|
|
|
+ IntegralConfig newConfig = null;
|
|
|
StayIntegral stayIntegral = new StayIntegral();
|
|
|
Integer stayNumber = 0;
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
switch (IntegralType){
|
|
|
case 1:
|
|
|
//新注册会员积分数量
|
|
|
integralConfig = getIntegralId(247);
|
|
|
stayNumber = integralConfig.getIntegralConfigNumber();
|
|
|
-
|
|
|
+ //规则表查询新注册会员和新增牙刷积分到账时间(多少天到账)
|
|
|
+ registeredConfig = getIntegralId(251);
|
|
|
+ calendar.set(Calendar.DAY_OF_MONTH,calendar.get(Calendar.DAY_OF_MONTH)+registeredConfig.getIntegralConfigNumber());
|
|
|
+ stayIntegral.setStayRecordedTime(calendar.getTime());
|
|
|
break;
|
|
|
case 2:
|
|
|
//新增加牙刷赠送积分数量
|
|
|
integralConfig = getIntegralId(248);
|
|
|
stayNumber = integralConfig.getIntegralConfigNumber();
|
|
|
+ //规则表查询新注册会员和新增牙刷积分到账时间(多少天到账)
|
|
|
+ newConfig = getIntegralId(251);
|
|
|
+ calendar.set(Calendar.DAY_OF_MONTH,calendar.get(Calendar.DAY_OF_MONTH)+newConfig.getIntegralConfigNumber());
|
|
|
+ stayIntegral.setStayRecordedTime(calendar.getTime());
|
|
|
break;
|
|
|
case 3:
|
|
|
if(orderAmount == 0){
|
|
@@ -141,6 +153,11 @@ public class ApparatusServiceImpl implements ApparatusService {
|
|
|
}
|
|
|
integralConfig = getIntegralId(250);
|
|
|
stayNumber = (int)(orderAmount * 2);
|
|
|
+ stayIntegral.setOrderId(orderId);
|
|
|
+ //规则表查询新注册会员和新增牙刷积分到账时间(多少天到账)
|
|
|
+ buyConfig = getIntegralId(252);
|
|
|
+ calendar.set(Calendar.DAY_OF_MONTH,calendar.get(Calendar.DAY_OF_MONTH)+buyConfig.getIntegralConfigNumber());
|
|
|
+ stayIntegral.setStayRecordedTime(calendar.getTime());
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
@@ -148,14 +165,11 @@ public class ApparatusServiceImpl implements ApparatusService {
|
|
|
if(integralConfig == null){
|
|
|
return false;
|
|
|
}
|
|
|
- //规则表查询积分到账时间(多少天到账)
|
|
|
- integralConfig = getIntegralId(251);
|
|
|
+
|
|
|
stayIntegral.setUserOpenid(openId);
|
|
|
stayIntegral.setConfigId(integralConfig.getIntegralConfigId());
|
|
|
stayIntegral.setStayNumber(stayNumber);
|
|
|
- Calendar calendar = Calendar.getInstance();
|
|
|
- calendar.set(Calendar.DAY_OF_MONTH,calendar.get(Calendar.DAY_OF_MONTH)+integralConfig.getIntegralConfigNumber());
|
|
|
- stayIntegral.setStayRecordedTime(calendar.getTime());
|
|
|
+
|
|
|
stayIntegral.setStayStatus(1);
|
|
|
Integer msg = memberMapper.insertStayIntegral(stayIntegral);
|
|
|
if(msg > 0){
|