Commit a8450e23 by guojuxing

基础服务到期发短信提醒、余额欠费提醒

parent 4865592f
......@@ -86,4 +86,14 @@ public interface BillingAccountApiService {
* @throws
*/
ServiceResponse<Integer> deductAccount(double totalFee, Integer enterpriseId);
/**
* 余额欠费提醒发短信
* @Title: balanceTask

* @Description:

* @author guojuxing
* @param param

* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>


*/
ServiceResponse<Void> balanceTask(String param);
}
......@@ -230,4 +230,14 @@ public interface EnterpriseApiService {
* @return
*/
ServiceResponse<Void> overdueReminder(String param);
/**
* 商户基础服务到期提醒
* @Title: expireReminder

* @Description:

* @author guojuxing
* @param param

* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>


*/
ServiceResponse<Void> expireReminder(String param);
}
......@@ -16,6 +16,7 @@ import com.gic.enterprise.entity.TabEnterprise;
import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.response.EnterpriseServiceResponse;
import com.gic.enterprise.service.*;
import com.gic.marketing.process.api.service.sms.SmsSendApiService;
import com.gic.redis.data.util.RedisUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -52,6 +53,8 @@ public class BillingAccountApiServiceImpl implements BillingAccountApiService {
private BillingOrderApiService billingOrderApiService;
@Autowired
private Config config;
@Autowired
private SmsSendApiService smsSendApiService;
@Override
public ServiceResponse<BillingAccountDTO> getByEnterpriseId(Integer enterpriseId) {
......@@ -248,6 +251,27 @@ public class BillingAccountApiServiceImpl implements BillingAccountApiService {
}
}
@Override
public ServiceResponse<Void> balanceTask(String param) {
//查询所有的商户
List<EnterpriseDTO> enterpriseDTOList = enterpriseService.listEnterprise();
for (EnterpriseDTO enterpriseDTO : enterpriseDTOList) {
Integer enterpriseId = enterpriseDTO.getEnterpriseId();
TabBillingAccount account = this.billingAccountService.getByEnterpriseId(enterpriseId);
if (account.getAccountBalance() <= 0) {
String[] smsArr = new String[]{enterpriseDTO.getEnterpriseName(), String.valueOf(-account.getAccountBalance())};
ServiceResponse<UserDTO> userResult = userApiService.getUserByEnterpriseId(enterpriseId);
UserDTO userDTO = userResult.getResult();
ServiceResponse<Void> smsSendResult = smsSendApiService.sendPlatformSms("GICJFZX001",
enterpriseId, userDTO.getPhoneAreaCode(), userDTO.getPhoneNumber(), smsArr);
if (!smsSendResult.isSuccess()) {
LOGGER.warn(smsSendResult.getMessage());
}
}
}
return ServiceResponse.success();
}
private void sendTotoItem(Integer enterpriseId) {
TodoItemDTO todoItemDTO = new TodoItemDTO();
UserDTO userDTO = userApiService.getUserByEnterpriseId(enterpriseId).getResult();
......
......@@ -3,6 +3,8 @@ package com.gic.enterprise.service.outer.impl;
import java.text.SimpleDateFormat;
import java.util.*;
import com.gic.enterprise.constant.BillingAuditStatusEnum;
import com.gic.marketing.process.api.service.sms.SmsSendApiService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.LogManager;
......@@ -85,6 +87,8 @@ public class EnterpriseApiServiceImpl implements EnterpriseApiService {
private PushMessageApiService pushMessageApiService;
@Autowired
private DataConfigApiService dataConfigApiService;
@Autowired
private SmsSendApiService smsSendApiService;
@Override
@Transactional(rollbackFor = Exception.class)
......@@ -582,6 +586,16 @@ public class EnterpriseApiServiceImpl implements EnterpriseApiService {
if(days <= 7){
this.pushMessageApiService.pushMessage(enterpriseDTO.getEnterpriseId(), "系统消息",
"GIC版本即将过期", "您的GIC版本即将在"+ days +"天到期,为了不影响业务的开展,请及时续费");
//发送超级管理员短信通知
String[] smsArr = new String[]{enterpriseDTO.getEnterpriseName()};
ServiceResponse<UserDTO> userResult = userApiService.getUserByEnterpriseId(enterpriseDTO.getEnterpriseId());
UserDTO userDTO = userResult.getResult();
ServiceResponse<Void> smsSendResult = smsSendApiService.sendPlatformSms("GICJFZX002",
userDTO.getEnterpriseId(), userDTO.getPhoneAreaCode(), userDTO.getPhoneNumber(), smsArr);
if (!smsSendResult.isSuccess()) {
LOGGER.warn(smsSendResult.getMessage());
}
}
}catch (Exception e){
e.printStackTrace();
......@@ -590,6 +604,31 @@ public class EnterpriseApiServiceImpl implements EnterpriseApiService {
return null;
}
@Override
public ServiceResponse<Void> expireReminder(String param) {
List<EnterpriseDTO> list = this.enterpriseService.listEnterprise();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String today = sdf.format(new Date());
for (EnterpriseDTO enterpriseDTO : list) {
if (StringUtils.isNotBlank(enterpriseDTO.getVersionCode())) {
Date expireDate = enterpriseDTO.getAuditTime();
if (today.compareTo(sdf.format(expireDate)) >= 0) {
//过期时间小于等于今天,发短信
//发送超级管理员短信通知
String[] smsArr = new String[]{enterpriseDTO.getEnterpriseName()};
ServiceResponse<UserDTO> userResult = userApiService.getUserByEnterpriseId(enterpriseDTO.getEnterpriseId());
UserDTO userDTO = userResult.getResult();
ServiceResponse<Void> smsSendResult = smsSendApiService.sendPlatformSms("GICJFZX003",
userDTO.getEnterpriseId(), userDTO.getPhoneAreaCode(), userDTO.getPhoneNumber(), smsArr);
if (!smsSendResult.isSuccess()) {
LOGGER.warn(smsSendResult.getMessage());
}
}
}
}
return ServiceResponse.success();
}
private String getVersionNameFromJson(String jsonStr) {
JSONObject jsonObject = JSONObject.parseObject(jsonStr);
JSONObject version = jsonObject.getJSONObject("version");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment