|
@@ -1,13 +1,13 @@
|
|
|
package com.fdkankan.ucenter.service.impl;
|
|
|
|
|
|
-import com.fdkankan.ucenter.entity.AgentNewLog;
|
|
|
-import com.fdkankan.ucenter.entity.IncrementType;
|
|
|
-import com.fdkankan.ucenter.entity.UserIncrement;
|
|
|
+import com.fdkankan.ucenter.entity.*;
|
|
|
import com.fdkankan.ucenter.mapper.IAgentNewLogMapper;
|
|
|
import com.fdkankan.ucenter.service.IAgentNewLogService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fdkankan.ucenter.service.IIncrementTypeService;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
/**
|
|
@@ -24,6 +24,12 @@ public class AgentNewLogServiceImpl extends ServiceImpl<IAgentNewLogMapper, Agen
|
|
|
@Autowired
|
|
|
IIncrementTypeService incrementTypeService;
|
|
|
|
|
|
+ @Value("${agent.wherefor.key:wherefor}")
|
|
|
+ private String whereforKey;
|
|
|
+
|
|
|
+ @Value("${agent.wherefor.id:5}")
|
|
|
+ private Integer whereforId;
|
|
|
+
|
|
|
@Override
|
|
|
public void addByUserIncrement(UserIncrement userIncrement) {
|
|
|
if(userIncrement.getAgentId() !=null){
|
|
@@ -41,4 +47,38 @@ public class AgentNewLogServiceImpl extends ServiceImpl<IAgentNewLogMapper, Agen
|
|
|
this.save(log);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void addByOrder(DownloadOrder responseIncrementOrder) {
|
|
|
+ if(StringUtils.isNotBlank(responseIncrementOrder.getAgentKey()) && whereforKey.equals(responseIncrementOrder.getAgentKey())){
|
|
|
+ AgentNewLog log = new AgentNewLog();
|
|
|
+ log.setType(2);
|
|
|
+ log.setAgentId(whereforId);
|
|
|
+ log.setUserId(responseIncrementOrder.getUserId());
|
|
|
+ log.setGiveType(4);
|
|
|
+ log.setCount(responseIncrementOrder.getCount());
|
|
|
+ this.save(log);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Boolean addByOrder(IncrementOrder responseIncrementOrder) {
|
|
|
+ if(StringUtils.isNotBlank(responseIncrementOrder.getAgentKey()) && whereforKey.equals(responseIncrementOrder.getAgentKey())){
|
|
|
+ AgentNewLog log = new AgentNewLog();
|
|
|
+ if(responseIncrementOrder.getIncrementType() != null){
|
|
|
+ IncrementType incrementType = incrementTypeService.getById(responseIncrementOrder.getIncrementType());
|
|
|
+ if(incrementType!=null){
|
|
|
+ log.setType(incrementType.getValidTimeType());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ log.setAgentId(whereforId);
|
|
|
+ log.setUserId(responseIncrementOrder.getUserId());
|
|
|
+ log.setGiveType(4);
|
|
|
+ log.setCount(responseIncrementOrder.getCount());
|
|
|
+ this.save(log);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|