Commit d317424c authored by chenzhao's avatar chenzhao

增加还款短信及工单通知

parent 0414d0ec
......@@ -34,6 +34,7 @@ public interface RepaymentMapper extends BaseMapper<Repayment> {
* @return
*/
List<String> getTodoUserIds(@Param("companyOrgCode") String companyOrgCode, @Param("roleId") String roleId);
List<String> getTodoTelephones(@Param("userIds") List<String> userIds);
String getSequenceNbrByName(@Param("groupName") String groupName);
}
......@@ -43,6 +43,18 @@
GROUP BY USER_ID;
</select>
<select id="getTodoTelephones" resultType="java.lang.String">
SELECT LOGIN_ID FROM auth_login_info login
WHERE
ID_TYPE = 'mobile' and IS_DELETED = '0'
<if test="">
and USER_ID in
<foreach collection="userIds" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
</select>
<select id="getSequenceNbrByName" resultType="java.lang.String">
SELECT SEQUENCE_NBR from privilege_group where GROUP_NAME=#{groupName} LIMIT 1
</select>
......
......@@ -45,7 +45,7 @@ public class HYGFMaintenanceTicketsServiceImpl extends BaseService<HYGFMaintenan
EmqKeeper emqKeeper;
@Autowired
TdHygfJpInverterWarnMapper tdHygfJpInverterWarnMapper;
@Value("${hygf.sms.tempCode}")
@Value("${hygf.sms.maintenanceCode}")
private String smsTempCode;
@Autowired
HYGFMaintenanceTicketsMapper hygfMaintenanceTicketsMapper;
......@@ -92,8 +92,11 @@ public class HYGFMaintenanceTicketsServiceImpl extends BaseService<HYGFMaintenan
if (ObjectUtil.isNotEmpty(data)) {
HashMap<String, String> params = new HashMap<>(3);
params.put("code","123456");
//电站名称:${1},地址:${2},逆变器sn:${3},故障事件:${4}
params.put("1",hygfMaintenanceTicketsDto.getStationName());
params.put("2",hygfMaintenanceTicketsDto.getStationAddress());
params.put("3",hygfMaintenanceTicketsDto.getInverterSn());
params.put("4",hygfMaintenanceTicketsDto.getWarningContent());
params.put("mobile",data.getTelephone());
params.put("smsCode", smsTempCode);
try {
......@@ -141,9 +144,12 @@ public class HYGFMaintenanceTicketsServiceImpl extends BaseService<HYGFMaintenan
hygfMaintenanceTicketsDto.setMaintenancePersonName(maintenance.getName());
hygfMaintenanceTicketsDto.setMaintenancePersonPhone(maintenance.getTelephone());
HashMap<String, String> params = new HashMap<>(3);
HashMap<String, String> params = new HashMap<>(6);
params.put("code","123456");
params.put("1",hygfMaintenanceTicketsDto.getStationName());
params.put("2",hygfMaintenanceTicketsDto.getStationAddress());
params.put("3",hygfMaintenanceTicketsDto.getInverterSn());
params.put("4",hygfMaintenanceTicketsDto.getWarningContent());
params.put("mobile",maintenance.getTelephone());
params.put("smsCode", smsTempCode);
try {
......
......@@ -24,8 +24,10 @@ import com.yeejoin.amos.boot.module.hygf.api.mapper.RepaymentMapper;
import com.yeejoin.amos.boot.module.hygf.api.service.IRepaymentService;
import com.yeejoin.amos.boot.module.hygf.biz.vo.RepaymentExcelVO;
import com.yeejoin.amos.boot.module.hygf.biz.vo.RouthPathVO;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
......@@ -38,11 +40,9 @@ import javax.servlet.http.HttpServletResponse;
import java.text.DecimalFormat;
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
......@@ -61,6 +61,8 @@ public class RepaymentServiceImpl extends BaseService<RepaymentDto, Repayment, R
RepaymentMapper repaymentMapper;
@Autowired
JpStationMapper jpStationMapper;
@Value("${hygf.sms.repaymentCode}")
private String smsTempCode;
@Autowired
CommonServiceImpl commonService;
......@@ -172,6 +174,24 @@ public class RepaymentServiceImpl extends BaseService<RepaymentDto, Repayment, R
String sequenceNbr = repaymentMapper.getSequenceNbrByName("户用光伏-投融");
List<String> todoUserIds = repaymentMapper.getTodoUserIds("%" + repayment.getRegionalCompaniesCode() + "%", sequenceNbr);
toDoTasksService.addToDoTasksByUserIds(todoUserIds, toDoTasks);
if (CollectionUtil.isNotEmpty(todoUserIds)){
List<String> todoTelephones = repaymentMapper.getTodoTelephones(todoUserIds);
HashMap<String, String> params = new HashMap<>(6);
for (String todoTelephone : todoTelephones) {
params.put("1",repayment.getCompanyName());
params.put("2",repayment.getRent().toString());
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
params.put("3", repayment.getRepayDate().format(formatter));
params.put("4",repayment.getPeriod());
params.put("mobile",todoTelephone);
params.put("smsCode", smsTempCode);
try {
Systemctl.smsClient.sendCommonSms(params).getResult();
} catch (Exception e) {
throw new BadRequest(todoTelephone+"发送短信失败:" + e.getMessage());
}
}
}
}
if (betweenDay < 0) {
//关闭定时任务
......
......@@ -137,6 +137,8 @@ regulator.unit.code=86*258
dealer.appcode=studio_normalapp_5133538
hygf.sms.tempCode=SMS_HYGF_0001
hygf.sms.maintenanceCode=SMS_HYGF_0005
hygf.sms.repaymentCode=SMS_HYGF_0006
# �������������
sms.huawei.url=https://smsapi.cn-north-4.myhuaweicloud.com:443/sms/batchSendSms/v1
......
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