ai扣减代理账分
This commit is contained in:
parent
770952af82
commit
464ee406fd
|
@ -5,10 +5,10 @@ import com.alibaba.fastjson2.JSONArray;
|
|||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.ruoyi.business.domain.BusAgentInfo;
|
||||
import com.ruoyi.business.domain.BusAiInfo;
|
||||
import com.ruoyi.business.domain.BusOrderInfo;
|
||||
import com.ruoyi.business.domain.BusStoreInfo;
|
||||
import com.ruoyi.business.mapper.BusAgentInfoMapper;
|
||||
import com.ruoyi.business.service.IAiService;
|
||||
import com.ruoyi.business.service.IBusAgentInfoService;
|
||||
import com.ruoyi.business.service.IBusAiInfoService;
|
||||
import com.ruoyi.business.service.*;
|
||||
import com.ruoyi.common.utils.HttpClientUtilT;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -28,6 +28,12 @@ public class AiServiceImpl implements IAiService
|
|||
{
|
||||
@Autowired
|
||||
private IBusAiInfoService aiInfoService;
|
||||
@Autowired
|
||||
private IBusOrderInfoService orderInfoService;
|
||||
@Autowired
|
||||
private IBusStoreInfoService storeInfoService;
|
||||
@Autowired
|
||||
private IBusAgentInfoService agentInfoService;
|
||||
|
||||
@Override
|
||||
public void login(String phoneNo, String virtualPhone) {
|
||||
|
@ -94,6 +100,8 @@ public class AiServiceImpl implements IAiService
|
|||
aiInfo.setSource(source);
|
||||
try {
|
||||
aiInfoService.insertBusAiInfo(aiInfo);
|
||||
long saveId = aiInfo.getId();
|
||||
reduceIntegral(saveId);
|
||||
}catch (Exception e) {
|
||||
System.out.println(id+"duplicate");
|
||||
}
|
||||
|
@ -108,4 +116,23 @@ public class AiServiceImpl implements IAiService
|
|||
System.out.println("login接口返回错误: " + jsonObject.toString());
|
||||
}
|
||||
}
|
||||
|
||||
private void reduceIntegral(long aiId){
|
||||
BusAiInfo aiInfo = aiInfoService.selectBusAiInfoById(aiId);
|
||||
BusOrderInfo orderInfo = new BusOrderInfo();
|
||||
orderInfo.setPrivcyPhone(aiInfo.getPhone());
|
||||
List<BusOrderInfo> temp = orderInfoService.selectBusOrderInfoList(orderInfo);
|
||||
if(temp.size() > 0){
|
||||
BusStoreInfo storeInfo = new BusStoreInfo();
|
||||
storeInfo.setStoreCode(temp.get(0).getStoreCode());
|
||||
List<BusStoreInfo> tempStore = storeInfoService.selectBusStoreInfoList(storeInfo);
|
||||
if (tempStore.size() > 0){
|
||||
BusAgentInfo agentInfo = agentInfoService.selectBusAgentInfoById(tempStore.get(0).getBindId());
|
||||
int a = (Integer.valueOf(aiInfo.getTalktimes())/60)+1;
|
||||
int reduce = Integer.valueOf(agentInfo.getIntegral()) - a;
|
||||
agentInfo.setIntegral(String.valueOf(reduce));
|
||||
agentInfoService.updateBusAgentInfo(agentInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue