1;帐分消耗-账户少扣减问题(多线程中,赋值相同导致)sql优化
This commit is contained in:
parent
b328ccff4a
commit
b09432be1f
|
@ -63,4 +63,5 @@ public interface BusAgentInfoMapper
|
||||||
|
|
||||||
BusAgentInfo getAgentByAccount(String agentAccount);
|
BusAgentInfo getAgentByAccount(String agentAccount);
|
||||||
|
|
||||||
|
void updateBusAgentScore(BusAgentInfo busAgentInfo);
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,4 +71,6 @@ public interface IBusAgentInfoService
|
||||||
int insertAgentInfo(LoginUser loginUser, BusAgentInfo busAgentInfo);
|
int insertAgentInfo(LoginUser loginUser, BusAgentInfo busAgentInfo);
|
||||||
|
|
||||||
int updateAgentInfo(BusAgentInfo busAgentInfo);
|
int updateAgentInfo(BusAgentInfo busAgentInfo);
|
||||||
|
|
||||||
|
void updateBusAgentScore(BusAgentInfo busAgentInfo);
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,20 +165,22 @@ public class AiConsumer {
|
||||||
int a = 1;
|
int a = 1;
|
||||||
if("AI".equals(busStoreInfo.getMarketingChannels())){
|
if("AI".equals(busStoreInfo.getMarketingChannels())){
|
||||||
int reduce = busAgentInfo.getAiRealTimeNum() - a;
|
int reduce = busAgentInfo.getAiRealTimeNum() - a;
|
||||||
busAgentInfo.setAiRealTimeNum(reduce);
|
// busAgentInfo.setAiRealTimeNum(reduce);
|
||||||
|
busAgentInfo.setAiRealTimeNum1(a);
|
||||||
record.setIntegralType("AI");
|
record.setIntegralType("AI");
|
||||||
record.setAiIntegralBalance(reduce);
|
record.setAiIntegralBalance(reduce);
|
||||||
returnVisitInfo.setIsCharging("AI-0");
|
returnVisitInfo.setIsCharging("AI-0");
|
||||||
}else if("sms".equals(busStoreInfo.getMarketingChannels())){
|
}else if("sms".equals(busStoreInfo.getMarketingChannels())){
|
||||||
int reduce = busAgentInfo.getAiDurationBalance() - a;
|
int reduce = busAgentInfo.getAiDurationBalance() - a;
|
||||||
busAgentInfo.setAiDurationBalance(reduce);
|
// busAgentInfo.setAiDurationBalance(reduce);
|
||||||
|
busAgentInfo.setAiDurationBalance1(a);
|
||||||
record.setIntegralType("sms");
|
record.setIntegralType("sms");
|
||||||
record.setIntegralBalance(reduce);
|
record.setIntegralBalance(reduce);
|
||||||
returnVisitInfo.setIsCharging("sms-0");
|
returnVisitInfo.setIsCharging("sms-0");
|
||||||
}
|
}
|
||||||
// int reduce = busAgentInfo.getAiDurationBalance() - a;
|
// agentInfoService.updateBusAgentInfo(busAgentInfo);
|
||||||
// busAgentInfo.setAiDurationBalance(reduce);
|
agentInfoService.updateBusAgentScore(busAgentInfo);
|
||||||
agentInfoService.updateBusAgentInfo(busAgentInfo);
|
log.error(busAgentInfo.getAgentAccount()+"扣除"+record.getIntegralType()+"-0帐分"+a);
|
||||||
|
|
||||||
record.setAccount(busAgentInfo.getAgentAccount());
|
record.setAccount(busAgentInfo.getAgentAccount());
|
||||||
record.setIntegralUpdateTime(new Date());
|
record.setIntegralUpdateTime(new Date());
|
||||||
|
@ -201,8 +203,10 @@ public class AiConsumer {
|
||||||
BusAgentInfo busAgentInfo =agentInfo;
|
BusAgentInfo busAgentInfo =agentInfo;
|
||||||
int a = 1;
|
int a = 1;
|
||||||
int reduce = busAgentInfo.getAiDurationBalance() - a;
|
int reduce = busAgentInfo.getAiDurationBalance() - a;
|
||||||
busAgentInfo.setAiDurationBalance(reduce);
|
busAgentInfo.setAiDurationBalance1(a);
|
||||||
agentInfoService.updateBusAgentInfo(busAgentInfo);
|
// agentInfoService.updateBusAgentInfo(busAgentInfo);
|
||||||
|
agentInfoService.updateBusAgentScore(busAgentInfo);
|
||||||
|
log.error(busAgentInfo.getAgentAccount()+"扣除sms帐分"+a);
|
||||||
|
|
||||||
BusIntegralRecord record = new BusIntegralRecord();
|
BusIntegralRecord record = new BusIntegralRecord();
|
||||||
record.setAccount(busAgentInfo.getAgentAccount());
|
record.setAccount(busAgentInfo.getAgentAccount());
|
||||||
|
@ -220,7 +224,7 @@ public class AiConsumer {
|
||||||
fifteenInfo.setLastVisitTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
fifteenInfo.setLastVisitTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||||
fifteenInfoService.insertBusFifteenInfo(fifteenInfo);
|
fifteenInfoService.insertBusFifteenInfo(fifteenInfo);
|
||||||
}else{
|
}else{
|
||||||
log.error("未配置营销渠道=====================");
|
log.error("未配置营销渠道====================="+busStoreInfo.getStoreCode());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -291,8 +291,8 @@ public class AiServiceImpl implements IAiService {
|
||||||
MqDataInfo mqDataInfo = new MqDataInfo();
|
MqDataInfo mqDataInfo = new MqDataInfo();
|
||||||
agentInfo.setAgentName(null);
|
agentInfo.setAgentName(null);
|
||||||
mqDataInfo.setAgentInfo(agentInfo);
|
mqDataInfo.setAgentInfo(agentInfo);
|
||||||
mqDataInfo.setStoreCode(storeInfo.getStoreCode());
|
mqDataInfo.setStoreCode(busStoreInfo.getStoreCode());
|
||||||
mqDataInfo.setChannel(storeInfo.getMarketingChannels());
|
mqDataInfo.setChannel(busStoreInfo.getMarketingChannels());
|
||||||
busOrderInfo.setOrderStatus(null);
|
busOrderInfo.setOrderStatus(null);
|
||||||
busOrderInfo.setStoreName(null);
|
busOrderInfo.setStoreName(null);
|
||||||
busOrderInfo.setRecipientPhone(null);
|
busOrderInfo.setRecipientPhone(null);
|
||||||
|
@ -424,9 +424,9 @@ public class AiServiceImpl implements IAiService {
|
||||||
BusAgentInfo busAgentInfo = agentInfoL.get(0);
|
BusAgentInfo busAgentInfo = agentInfoL.get(0);
|
||||||
int a = (Integer.valueOf(aiInfo.getTalktimes()) / 60) + 1;
|
int a = (Integer.valueOf(aiInfo.getTalktimes()) / 60) + 1;
|
||||||
int reduce = busAgentInfo.getAiRealTimeNum() - a;
|
int reduce = busAgentInfo.getAiRealTimeNum() - a;
|
||||||
busAgentInfo.setAiRealTimeNum(reduce);
|
busAgentInfo.setAiRealTimeNum1(a);
|
||||||
// busAgentInfo.setAiRealTimeNum(0);
|
// agentInfoService.updateBusAgentInfo(busAgentInfo);
|
||||||
agentInfoService.updateBusAgentInfo(busAgentInfo);
|
agentInfoService.updateBusAgentScore(busAgentInfo);
|
||||||
|
|
||||||
BusIntegralRecord record = new BusIntegralRecord();
|
BusIntegralRecord record = new BusIntegralRecord();
|
||||||
record.setAccount(busAgentInfo.getAgentAccount());
|
record.setAccount(busAgentInfo.getAgentAccount());
|
||||||
|
|
|
@ -240,4 +240,9 @@ public class BusAgentInfoServiceImpl implements IBusAgentInfoService
|
||||||
busAgentInfoMapper.updateBusAgentInfo(temp1);
|
busAgentInfoMapper.updateBusAgentInfo(temp1);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateBusAgentScore(BusAgentInfo busAgentInfo) {
|
||||||
|
busAgentInfoMapper.updateBusAgentScore(busAgentInfo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,6 +127,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</trim>
|
</trim>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
<update id="updateBusAgentScore" parameterType="BusAgentInfo">
|
||||||
|
update bus_agent_info
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="aiDurationBalance1 != 0">ai_duration_balance = ai_duration_balance-#{aiDurationBalance1},</if>
|
||||||
|
<if test="aiRealTimeNum1 != 0">ai_real_time_num = ai_real_time_num-#{aiRealTimeNum1},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
<delete id="deleteBusAgentInfoById" parameterType="Long">
|
<delete id="deleteBusAgentInfoById" parameterType="Long">
|
||||||
delete from bus_agent_info where id = #{id}
|
delete from bus_agent_info where id = #{id}
|
||||||
|
|
Loading…
Reference in New Issue