master
wangning 7 years ago
parent ff05fadea3
commit b239a9a02e

@ -178,7 +178,7 @@ public class CustomerImpressionServiceImpl implements CustomerImpressionService
clientCustomersMapper.updateAfterPaymentFinish(clientCustomerInfo); clientCustomersMapper.updateAfterPaymentFinish(clientCustomerInfo);
} }
} finally { } finally {
locker.unlock(customer_id); locker.unlock(CUSTOMER_IMPRESSION_PREFIX+customer_id);
} }
} catch (Exception e) { } catch (Exception e) {
logger.debug("Reduce Customer Impression Error Redis Value =" + redisValue, e); logger.debug("Reduce Customer Impression Error Redis Value =" + redisValue, e);

@ -48,4 +48,7 @@ public interface ClientRateMapper {
JSONObject latestChannelCleanDays(@Param("rate_name")String rate_name, @Param("client_id")int client_id); JSONObject latestChannelCleanDays(@Param("rate_name")String rate_name, @Param("client_id")int client_id);
JSONObject latestExpiryConfig(@Param("client_id")int client_id,@Param("rate_name") String rate_name);
} }

@ -61,8 +61,9 @@ public class PostponeClientTask {
expiryClients.put(p.getInteger("client_id"), p); expiryClients.put(p.getInteger("client_id"), p);
}); });
expiryClients.values().forEach(p -> { expiryClients.values().forEach(p -> {
List<JSONObject> adminAccounts = clientAccountMapper.listAdminAccounts(p.getIntValue("client_id")); int client_id = p.getIntValue("client_id");
List<JSONObject> clientRates = clientRateMapper.maxChannelExpiryTime(p.getIntValue("client_id"), null); List<JSONObject> adminAccounts = clientAccountMapper.listAdminAccounts(client_id);
List<JSONObject> clientRates = clientRateMapper.maxChannelExpiryTime(client_id, null);
JSONObject wechatRate = clientRateMapper.latestChannelCleanDays("Wechat", p.getIntValue("client_id")); JSONObject wechatRate = clientRateMapper.latestChannelCleanDays("Wechat", p.getIntValue("client_id"));
int cleanDays = 1; int cleanDays = 1;
if (wechatRate.getInteger("clean_days") != null) { if (wechatRate.getInteger("clean_days") != null) {
@ -72,16 +73,17 @@ public class PostponeClientTask {
} }
int finalCleanDays = cleanDays; int finalCleanDays = cleanDays;
clientRates.forEach(o -> { clientRates.forEach(o -> {
o.remove("client_rate_id"); JSONObject record = clientRateMapper.latestExpiryConfig(client_id,o.getString("rate_name"));
o.put("active_time", tomorrow); record.remove("client_rate_id");
o.put("manager_id", 0); record.put("active_time", now);
o.put("expiry_time", yearTomorrow); record.put("manager_id", 0);
o.put("create_time", now); record.put("expiry_time", yearTomorrow);
o.put("update_time", now); record.put("create_time", now);
o.put("clean_days", finalCleanDays); record.put("update_time", now);
o.put("manager_name", "System"); record.put("clean_days", finalCleanDays);
o.put("remark", "费率到期系统自动延期1年"); record.put("manager_name", "System");
clientRateMapper.saveRate(o); record.put("remark", "费率到期系统自动延期1年");
clientRateMapper.saveRate(record);
}); });
adminAccounts.forEach(o -> { adminAccounts.forEach(o -> {

@ -137,4 +137,12 @@
order by cr.expiry_time desc order by cr.expiry_time desc
limit 1 limit 1
</select> </select>
<select id="latestExpiryConfig" resultType="com.alibaba.fastjson.JSONObject">
SELECT * FROM
sys_client_rates
WHERE client_id = #{client_id} and rate_name =#{rate_name}
order by expiry_time desc
limit 1
</select>
</mapper> </mapper>
Loading…
Cancel
Save