短信存储
This commit is contained in:
parent
c90560fbaa
commit
b5af5fc71b
|
|
@ -120,4 +120,14 @@ public class MaterialConstants {
|
|||
*/
|
||||
public static final String QR_BOX_PREFIX = "BOX";
|
||||
|
||||
/**
|
||||
* 短信发送失败
|
||||
*/
|
||||
public static final String SEND_FAILURE = "0";
|
||||
|
||||
/**
|
||||
* 短信发送成功
|
||||
*/
|
||||
public static final String SEND_SUCCESS = "1";
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,46 @@
|
|||
package com.bonus.common.biz.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 短信发送结果存储vo
|
||||
* @author ma_sh
|
||||
*/
|
||||
@Data
|
||||
public class SmsSendResult implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 469203039368157600L;
|
||||
|
||||
/** 主键id */
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "短信发送模块")
|
||||
private String moduleTitle;
|
||||
|
||||
@ApiModelProperty(value = "短信接收人id")
|
||||
private Long receiverId;
|
||||
|
||||
@ApiModelProperty(value = "短信接收人电话")
|
||||
private String receiverPhone;
|
||||
|
||||
@ApiModelProperty(value = "短信发送内容")
|
||||
private String content;
|
||||
|
||||
@ApiModelProperty(value = "短信发送状态,0 失败,1 成功")
|
||||
private String sendStatus;
|
||||
|
||||
@ApiModelProperty(value = "短信发送时间")
|
||||
private Date sendTime;
|
||||
|
||||
public SmsSendResult(String moduleTitle, Long receiverId, String receiverPhone, String content, Date sendTime) {
|
||||
this.moduleTitle = moduleTitle;
|
||||
this.receiverId = receiverId;
|
||||
this.receiverPhone = receiverPhone;
|
||||
this.content = content;
|
||||
this.sendTime = sendTime;
|
||||
}
|
||||
}
|
||||
|
|
@ -104,4 +104,10 @@ public interface SignProcessMapper
|
|||
*/
|
||||
int delProcess(Long id);
|
||||
|
||||
/**
|
||||
* 根据mobileList查询用户id
|
||||
* @param phone
|
||||
* @return
|
||||
*/
|
||||
Long getUserIdsByMobile(String phone);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.material.purchase.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
|
|
@ -8,7 +9,9 @@ import cn.hutool.json.JSONObject;
|
|||
import com.ah.sbd.SmsTool;
|
||||
import com.ah.sbd.utils.param.BatchSmsByContentParam;
|
||||
import com.ah.sbd.utils.param.SmsParam;
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.bonus.common.biz.constant.BmConfigItems;
|
||||
import com.bonus.common.biz.domain.SmsSendResult;
|
||||
import com.bonus.common.biz.enums.PurchaseTaskStatusEnum;
|
||||
import com.bonus.common.biz.enums.TmTaskTypeEnum;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
|
|
@ -24,6 +27,7 @@ import com.bonus.material.purchase.domain.PurchaseSignRecord;
|
|||
import com.bonus.material.purchase.domain.dto.PurchaseNoticePersonDto;
|
||||
import com.bonus.material.task.domain.TmTask;
|
||||
import com.bonus.material.task.mapper.TmTaskMapper;
|
||||
import com.bonus.material.warningAnalysis.mapper.UseMaintenanceWarningMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.bonus.material.purchase.mapper.PurchaseNoticePersonMapper;
|
||||
import com.bonus.material.purchase.domain.PurchaseNoticePerson;
|
||||
|
|
@ -32,6 +36,9 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static com.bonus.common.biz.constant.MaterialConstants.SEND_FAILURE;
|
||||
import static com.bonus.common.biz.constant.MaterialConstants.SEND_SUCCESS;
|
||||
|
||||
/**
|
||||
* 新购短信通知人员Service业务层处理
|
||||
*
|
||||
|
|
@ -56,6 +63,9 @@ public class PurchaseNoticePersonServiceImpl implements IPurchaseNoticePersonSer
|
|||
@Resource
|
||||
private SignProcessMapper signProcessMapper;
|
||||
|
||||
@Resource
|
||||
private UseMaintenanceWarningMapper mapper;
|
||||
|
||||
/**
|
||||
* 查询新购短信通知人员
|
||||
*
|
||||
|
|
@ -114,9 +124,24 @@ public class PurchaseNoticePersonServiceImpl implements IPurchaseNoticePersonSer
|
|||
// String splitPhoneNumber = String.join(",", purchaseNoticePersonDto.getPhoneNumbers());
|
||||
List<String> mobileList = purchaseNoticePersonDto.getPhoneNumbers();
|
||||
try {
|
||||
List<SmsSendResult> sendResults = new ArrayList<>();
|
||||
// 省公司短信发送
|
||||
JSONObject sendResult = SmsTool.sendSms(new BatchSmsByContentParam(mobileList, purchaseNoticePersonDto.getContent()), BmConfigItems.ANHUI_COMPANY_SMS_KEY);
|
||||
//String sendResult = SmsUtils.smsToken(splitPhoneNumber, purchaseNoticePersonDto.getContent(),"");
|
||||
// 根据mobileList查询用户id
|
||||
if (CollectionUtils.isNotEmpty(mobileList)) {
|
||||
for (String phone : mobileList) {
|
||||
Long userId = signProcessMapper.getUserIdsByMobile(phone);
|
||||
sendResults.add(new SmsSendResult("新购工器具验收短信通知", userId, phone,
|
||||
purchaseNoticePersonDto.getContent(), DateUtils.getNowDate()));
|
||||
}
|
||||
// 根据sendResult赋值短信发送成功与否状态
|
||||
String status = (sendResult != null && !sendResult.isEmpty()) ? SEND_SUCCESS : SEND_FAILURE;
|
||||
sendResults.forEach(item -> item.setSendStatus(status));
|
||||
|
||||
//将集合结果插入数据库中
|
||||
mapper.insertSmsSendResult(sendResults);
|
||||
}
|
||||
if (sendResult != null) {
|
||||
// 发送短信后修改任务状态
|
||||
if (purchaseNoticePersonDto.getIsPartFlag() != null && purchaseNoticePersonDto.getIsPartFlag() == 0) {
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import io.swagger.annotations.ApiModelProperty;
|
|||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
||||
|
||||
/**
|
||||
* 报废任务详细对象 scrap_apply_details
|
||||
|
|
@ -140,12 +141,12 @@ public class ScrapApplyDetails extends BaseEntity {
|
|||
@ApiModelProperty(value = "购置价")
|
||||
private BigDecimal buyPrice;
|
||||
|
||||
@Excel(name = "当前库存",sort=4)
|
||||
@Excel(name = "当前库存",sort=4, cellType = Excel.ColumnType.NUMERIC, align = HorizontalAlignment.RIGHT)
|
||||
@ApiModelProperty(value = "库存数量")
|
||||
private BigDecimal storageNum;
|
||||
|
||||
/** 报废数量 */
|
||||
@Excel(name = "报废数量",sort=5)
|
||||
@Excel(name = "报废数量",sort=5, cellType = Excel.ColumnType.NUMERIC, align = HorizontalAlignment.RIGHT)
|
||||
@ApiModelProperty(value = "报废数量")
|
||||
private BigDecimal scrapNum;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,9 @@ import com.ah.sbd.utils.param.BatchSmsByContentParam;
|
|||
import com.ah.sbd.utils.param.SmsParam;
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.bonus.common.biz.constant.BmConfigItems;
|
||||
import com.bonus.common.biz.domain.SmsSendResult;
|
||||
import com.bonus.common.biz.domain.lease.LeaseApplyInfo;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.material.back.domain.BackApplyInfo;
|
||||
import com.bonus.material.back.service.IBackApplyInfoService;
|
||||
|
|
@ -24,6 +26,9 @@ import java.time.format.DateTimeFormatter;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.bonus.common.biz.constant.MaterialConstants.SEND_FAILURE;
|
||||
import static com.bonus.common.biz.constant.MaterialConstants.SEND_SUCCESS;
|
||||
|
||||
/**
|
||||
* 任务定时推送相关人员任务控制器
|
||||
* @author ma_sh
|
||||
|
|
@ -91,6 +96,7 @@ public class ScheduledCheckWarning {
|
|||
|
||||
if(monthList !=null && monthList.size()>0){
|
||||
for (UseMaintenanceWarningBean bean : monthList) {
|
||||
List<SmsSendResult> sendResults = new ArrayList<>();
|
||||
//根据皖送平台工程id查询项目经理、总工,获取手机号
|
||||
UseMaintenanceWarningBean projectManager = mapper.getProjectManager(bean);
|
||||
String leaderPhone = projectManager.getLeaderPhone();
|
||||
|
|
@ -106,14 +112,20 @@ public class ScheduledCheckWarning {
|
|||
UseMaintenanceWarningBean item1 = mapper.getUserPhoneById(item);
|
||||
if(StringUtils.isNotBlank(item1.getClzPhone())){
|
||||
mobileList.add(new SmsParam(item1.getClzPhone(), content));
|
||||
sendResults.add(new SmsSendResult("工器具临近检验有效期30天短信通知", item1.getUserId(), item1.getClzPhone(),
|
||||
content, DateUtils.getNowDate()));
|
||||
}
|
||||
}
|
||||
}
|
||||
if(StringUtils.isNotBlank(leaderPhone)){
|
||||
mobileList.add(new SmsParam(leaderPhone, content));
|
||||
sendResults.add(new SmsSendResult("工器具临近检验有效期30天短信通知", projectManager.getLeaderId(), projectManager.getLeaderPhone(),
|
||||
content, DateUtils.getNowDate()));
|
||||
}
|
||||
if(StringUtils.isNotBlank(engPhone)){
|
||||
mobileList.add(new SmsParam(engPhone, content));
|
||||
sendResults.add(new SmsSendResult("工器具临近检验有效期30天短信通知", projectManager.getEngId(), projectManager.getEngPhone(),
|
||||
content, DateUtils.getNowDate()));
|
||||
}
|
||||
System.out.println("短信发送成功: " + mobileList);
|
||||
if (CollectionUtils.isNotEmpty(mobileList)){
|
||||
|
|
@ -125,6 +137,12 @@ public class ScheduledCheckWarning {
|
|||
log.error("短信发送失败,发送结果为空!");
|
||||
System.out.println("短信发送失败,发送结果为空!");
|
||||
}
|
||||
// 根据sendResult赋值短信发送成功与否状态
|
||||
String status = (sendResult != null && !sendResult.isEmpty()) ? SEND_SUCCESS : SEND_FAILURE;
|
||||
sendResults.forEach(item -> item.setSendStatus(status));
|
||||
|
||||
//将集合结果插入数据库中
|
||||
mapper.insertSmsSendResult(sendResults);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -136,6 +154,7 @@ public class ScheduledCheckWarning {
|
|||
List<UseMaintenanceWarningBean> dayList = mapper.getWarningLastDayList(new UseMaintenanceWarningBean());
|
||||
if(dayList !=null && dayList.size()>0){
|
||||
for (UseMaintenanceWarningBean bean2 : dayList) {
|
||||
List<SmsSendResult> sendResults = new ArrayList<>();
|
||||
//根据工程所属分公司查询施工管理科副科长、分公司分管领导,获取手机号
|
||||
|
||||
String content2 = "截止当天" + bean2.getProjectName() +","+ bean2.getTypeName() +"共"+ bean2.getWarnNum() + "件工器具已临检检验有效期15天,请尽快退回机具(物流)分公司复检,明细请登录机具管理系统查看";
|
||||
|
|
@ -150,6 +169,8 @@ public class ScheduledCheckWarning {
|
|||
UseMaintenanceWarningBean item = mapper.getUserPhoneById(useMaintenanceWarningBean);
|
||||
if(item.getClzPhone() != null){
|
||||
mobileList2.add(new SmsParam(item.getClzPhone(), content2));
|
||||
sendResults.add(new SmsSendResult("工器具临近检验有效期15天短信通知", item.getUserId(), item.getClzPhone(),
|
||||
content2, DateUtils.getNowDate()));
|
||||
}
|
||||
}
|
||||
// 送二
|
||||
|
|
@ -160,6 +181,8 @@ public class ScheduledCheckWarning {
|
|||
UseMaintenanceWarningBean item = mapper.getUserPhoneById(useMaintenanceWarningBean);
|
||||
if(item.getClzPhone() != null){
|
||||
mobileList2.add(new SmsParam(item.getClzPhone(), content2));
|
||||
sendResults.add(new SmsSendResult("工器具临近检验有效期15天短信通知", item.getUserId(), item.getClzPhone(),
|
||||
content2, DateUtils.getNowDate()));
|
||||
}
|
||||
}
|
||||
System.out.println("短信发送成功: " + mobileList2);
|
||||
|
|
@ -172,6 +195,12 @@ public class ScheduledCheckWarning {
|
|||
log.error("短信发送失败,发送结果为空!");
|
||||
System.out.println("短信发送失败,发送结果为空!");
|
||||
}
|
||||
// 根据sendResult赋值短信发送成功与否状态
|
||||
String status = (sendResult != null && !sendResult.isEmpty()) ? SEND_SUCCESS : SEND_FAILURE;
|
||||
sendResults.forEach(item -> item.setSendStatus(status));
|
||||
|
||||
//将集合结果插入数据库中
|
||||
mapper.insertSmsSendResult(sendResults);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -5,11 +5,14 @@ import com.ah.sbd.SmsTool;
|
|||
import com.ah.sbd.utils.param.SmsParam;
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.bonus.common.biz.constant.BmConfigItems;
|
||||
import com.bonus.common.biz.domain.SmsSendResult;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.core.utils.sms.SmsUtils;
|
||||
import com.bonus.material.back.domain.BackApplyInfo;
|
||||
import com.bonus.material.back.mapper.BackApplyInfoMapper;
|
||||
import com.bonus.material.back.service.IBackApplyInfoService;
|
||||
import com.bonus.material.warningAnalysis.mapper.UseMaintenanceWarningMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.scheduling.config.ScheduledTaskRegistrar;
|
||||
import org.springframework.scheduling.support.CronTrigger;
|
||||
|
|
@ -19,8 +22,12 @@ import javax.annotation.PostConstruct;
|
|||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.bonus.common.biz.constant.MaterialConstants.SEND_FAILURE;
|
||||
import static com.bonus.common.biz.constant.MaterialConstants.SEND_SUCCESS;
|
||||
|
||||
/**
|
||||
* 任务定时推送相关人员任务控制器
|
||||
* @author ma_sh
|
||||
|
|
@ -37,6 +44,9 @@ public class ScheduledTasks {
|
|||
@Resource
|
||||
private ScheduledTaskRegistrar scheduledTaskRegistrar;
|
||||
|
||||
@Resource
|
||||
private UseMaintenanceWarningMapper mapper;
|
||||
|
||||
/**
|
||||
* 定时任务执行频率,每3天上午9点执行一次
|
||||
*/
|
||||
|
|
@ -90,6 +100,7 @@ public class ScheduledTasks {
|
|||
}
|
||||
}
|
||||
if (hasNullBackSignUrl) {
|
||||
List<SmsSendResult> sendResults = new ArrayList<>();
|
||||
// 统一发送一条短信
|
||||
String phoneNumber = "15527030643";
|
||||
String content = "您好,李勇!您还有退料单未签字,请及时登录系统查看处理,感谢配合!";
|
||||
|
|
@ -105,6 +116,14 @@ public class ScheduledTasks {
|
|||
log.error("短信发送失败,发送结果为空!");
|
||||
System.out.println("短信发送失败,发送结果为空!");
|
||||
}
|
||||
sendResults.add(new SmsSendResult("退料单未签字短信通知", null, phoneNumber,
|
||||
content, DateUtils.getNowDate()));
|
||||
// 根据sendResult赋值短信发送成功与否状态
|
||||
String status = (sendResult != null && !sendResult.isEmpty()) ? SEND_SUCCESS : SEND_FAILURE;
|
||||
sendResults.forEach(item -> item.setSendStatus(status));
|
||||
|
||||
//将集合结果插入数据库中
|
||||
mapper.insertSmsSendResult(sendResults);
|
||||
} catch (Exception e) {
|
||||
log.error("短信发送过程中发生异常: {}", e.getMessage());
|
||||
System.out.println("短信发送过程中发生异常: " + e.getMessage());
|
||||
|
|
|
|||
|
|
@ -5,11 +5,14 @@ import com.ah.sbd.SmsTool;
|
|||
import com.ah.sbd.utils.param.SmsParam;
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.bonus.common.biz.constant.BmConfigItems;
|
||||
import com.bonus.common.biz.domain.SmsSendResult;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.material.clz.domain.TeamVo;
|
||||
import com.bonus.material.clz.domain.lease.MaterialLeaseApplyDetails;
|
||||
import com.bonus.material.clz.mapper.MaterialLeaseInfoMapper;
|
||||
import com.bonus.material.warningAnalysis.domain.UseMaintenanceWarningBean;
|
||||
import com.bonus.material.warningAnalysis.mapper.UseMaintenanceWarningMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.scheduling.config.ScheduledTaskRegistrar;
|
||||
import org.springframework.scheduling.support.CronTrigger;
|
||||
|
|
@ -23,6 +26,9 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.bonus.common.biz.constant.MaterialConstants.SEND_FAILURE;
|
||||
import static com.bonus.common.biz.constant.MaterialConstants.SEND_SUCCESS;
|
||||
|
||||
/**
|
||||
* 班组退场查询是否存在未退还机具定时器
|
||||
* @author ma_sh
|
||||
|
|
@ -39,6 +45,9 @@ public class TeamBackTasks {
|
|||
@Resource
|
||||
private ScheduledTaskRegistrar scheduledTaskRegistrar;
|
||||
|
||||
@Resource
|
||||
private UseMaintenanceWarningMapper mapper;
|
||||
|
||||
/**
|
||||
* 定时任务执行频率,每2天上午9点执行一次
|
||||
*/
|
||||
|
|
@ -87,6 +96,7 @@ public class TeamBackTasks {
|
|||
|
||||
// 遍历列表,检查每个 BackApplyInfo 的 BackSignUrl 是否为空
|
||||
for (MaterialLeaseApplyDetails materialLeaseApplyDetails : list) {
|
||||
List<SmsSendResult> sendResults = new ArrayList<>();
|
||||
// 先根据班组名称和i8工程id查询班组是否退场
|
||||
List<TeamVo> infoList = materialLeaseInfoMapper.getJcTeamInfo(materialLeaseApplyDetails);
|
||||
if (CollectionUtils.isNotEmpty(infoList)) {
|
||||
|
|
@ -100,6 +110,8 @@ public class TeamBackTasks {
|
|||
UseMaintenanceWarningBean item1 = materialLeaseInfoMapper.getUserPhoneById(useMaintenanceWarningBean);
|
||||
if (StringUtils.isNotBlank(item1.getClzPhone())) {
|
||||
mobileList.add(new SmsParam(item1.getClzPhone(), content));
|
||||
sendResults.add(new SmsSendResult("班组退场,工器具未退回短信通知", item1.getUserId(), item1.getClzPhone(),
|
||||
content, DateUtils.getNowDate()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -113,6 +125,13 @@ public class TeamBackTasks {
|
|||
log.error("短信发送失败,发送结果为空!");
|
||||
System.out.println("短信发送失败,发送结果为空!");
|
||||
}
|
||||
|
||||
// 根据sendResult赋值短信发送成功与否状态
|
||||
String status = (sendResult != null && !sendResult.isEmpty()) ? SEND_SUCCESS : SEND_FAILURE;
|
||||
sendResults.forEach(item -> item.setSendStatus(status));
|
||||
|
||||
//将集合结果插入数据库中
|
||||
mapper.insertSmsSendResult(sendResults);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,9 +6,12 @@ import com.ah.sbd.utils.param.SmsParam;
|
|||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.alibaba.nacos.common.utils.StringUtils;
|
||||
import com.bonus.common.biz.constant.BmConfigItems;
|
||||
import com.bonus.common.biz.domain.SmsSendResult;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.material.back.domain.BackApplyInfo;
|
||||
import com.bonus.material.task.domain.TmTask;
|
||||
import com.bonus.material.task.service.ITmTaskService;
|
||||
import com.bonus.material.warningAnalysis.mapper.UseMaintenanceWarningMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.scheduling.config.ScheduledTaskRegistrar;
|
||||
import org.springframework.scheduling.support.CronTrigger;
|
||||
|
|
@ -22,6 +25,9 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.bonus.common.biz.constant.MaterialConstants.SEND_FAILURE;
|
||||
import static com.bonus.common.biz.constant.MaterialConstants.SEND_SUCCESS;
|
||||
|
||||
/**
|
||||
* 待入库定时任务
|
||||
* @Author ma_sh
|
||||
|
|
@ -39,6 +45,9 @@ public class WashHouseScheduledTasks {
|
|||
@Resource
|
||||
private ScheduledTaskRegistrar scheduledTaskRegistrar;
|
||||
|
||||
@Resource
|
||||
private UseMaintenanceWarningMapper mapper;
|
||||
|
||||
/**
|
||||
* 定时任务执行频率,每3天上午9点执行一次
|
||||
*/
|
||||
|
|
@ -83,6 +92,8 @@ public class WashHouseScheduledTasks {
|
|||
List<Long> purchaseList = tmTaskService.selectPurchaseInfo(info);
|
||||
// 查询修试待入库任务
|
||||
List<Long> repairList = tmTaskService.selectRepairInfo(info);
|
||||
// 短信发送结果集
|
||||
List<SmsSendResult> sendResults = new ArrayList<>();
|
||||
// 1. 处理【只有新购任务】的情况(purchaseList非空,repairList为空)
|
||||
if (CollectionUtils.isNotEmpty(purchaseList) && CollectionUtils.isEmpty(repairList)) {
|
||||
List<BackApplyInfo> purchaseInfoList = tmTaskService.selectApplyInfo(purchaseList);
|
||||
|
|
@ -95,6 +106,8 @@ public class WashHouseScheduledTasks {
|
|||
if (StringUtils.isNotBlank(phone)) {
|
||||
String content = "您好!您所属班组还有新购待入库任务需要进行处理,请及时登录系统查看处理,感谢配合!";
|
||||
mobileList.add(new SmsParam(phone, content));
|
||||
sendResults.add(new SmsSendResult("新购待入库任务短信通知", 118L, phone,
|
||||
content, DateUtils.getNowDate()));
|
||||
}
|
||||
}
|
||||
// 1.2 部门336有新购任务
|
||||
|
|
@ -105,6 +118,8 @@ public class WashHouseScheduledTasks {
|
|||
if (StringUtils.isNotBlank(phone)) {
|
||||
String content = "您好!您所属班组还有新购待入库任务需要进行处理,请及时登录系统查看处理,感谢配合!";
|
||||
mobileList.add(new SmsParam(phone, content));
|
||||
sendResults.add(new SmsSendResult("新购待入库任务短信通知", 455L, phone,
|
||||
content, DateUtils.getNowDate()));
|
||||
}
|
||||
}
|
||||
// 1.3 部门106或335有新购任务
|
||||
|
|
@ -115,6 +130,8 @@ public class WashHouseScheduledTasks {
|
|||
if (StringUtils.isNotBlank(phone)) {
|
||||
String content = "您好!您所属班组还有新购待入库任务需要进行处理,请及时登录系统查看处理,感谢配合!";
|
||||
mobileList.add(new SmsParam(phone, content));
|
||||
sendResults.add(new SmsSendResult("新购待入库任务短信通知", 1549L, phone,
|
||||
content, DateUtils.getNowDate()));
|
||||
}
|
||||
}
|
||||
// 1.4 部门334有新购任务
|
||||
|
|
@ -125,6 +142,8 @@ public class WashHouseScheduledTasks {
|
|||
if (StringUtils.isNotBlank(phone)) {
|
||||
String content = "您好!您所属班组还有新购待入库任务需要进行处理,请及时登录系统查看处理,感谢配合!";
|
||||
mobileList.add(new SmsParam(phone, content));
|
||||
sendResults.add(new SmsSendResult("新购待入库任务短信通知", 65L, phone,
|
||||
content, DateUtils.getNowDate()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -142,6 +161,8 @@ public class WashHouseScheduledTasks {
|
|||
if (StringUtils.isNotBlank(phone)) {
|
||||
String content = "您好!您所属班组还有修试待入库任务需要进行处理,请及时登录系统查看处理,感谢配合!";
|
||||
mobileList.add(new SmsParam(phone, content));
|
||||
sendResults.add(new SmsSendResult("修试待入库任务短信通知", 118L, phone,
|
||||
content, DateUtils.getNowDate()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -153,6 +174,8 @@ public class WashHouseScheduledTasks {
|
|||
if (StringUtils.isNotBlank(phone)) {
|
||||
String content = "您好!您所属班组还有修试待入库任务需要进行处理,请及时登录系统查看处理,感谢配合!";
|
||||
mobileList.add(new SmsParam(phone, content));
|
||||
sendResults.add(new SmsSendResult("修试待入库任务短信通知", 455L, phone,
|
||||
content, DateUtils.getNowDate()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -164,6 +187,8 @@ public class WashHouseScheduledTasks {
|
|||
if (StringUtils.isNotBlank(phone)) {
|
||||
String content = "您好!您所属班组还有修试待入库任务需要进行处理,请及时登录系统查看处理,感谢配合!";
|
||||
mobileList.add(new SmsParam(phone, content));
|
||||
sendResults.add(new SmsSendResult("修试待入库任务短信通知", 1549L, phone,
|
||||
content, DateUtils.getNowDate()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -175,6 +200,8 @@ public class WashHouseScheduledTasks {
|
|||
if (StringUtils.isNotBlank(phone)) {
|
||||
String content = "您好!您所属班组还有修试待入库任务需要进行处理,请及时登录系统查看处理,感谢配合!";
|
||||
mobileList.add(new SmsParam(phone, content));
|
||||
sendResults.add(new SmsSendResult("修试待入库任务短信通知", 65L, phone,
|
||||
content, DateUtils.getNowDate()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -194,6 +221,8 @@ public class WashHouseScheduledTasks {
|
|||
if (StringUtils.isNotBlank(phone)) {
|
||||
String content = "您好!您所属班组还有新购及修试待入库任务需要进行处理,请及时登录系统查看处理,感谢配合!";
|
||||
mobileList.add(new SmsParam(phone, content));
|
||||
sendResults.add(new SmsSendResult("新购及修试待入库任务短信通知", 118L, phone,
|
||||
content, DateUtils.getNowDate()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -206,6 +235,8 @@ public class WashHouseScheduledTasks {
|
|||
if (StringUtils.isNotBlank(phone)) {
|
||||
String content = "您好!您所属班组还有新购及修试待入库任务需要进行处理,请及时登录系统查看处理,感谢配合!";
|
||||
mobileList.add(new SmsParam(phone, content));
|
||||
sendResults.add(new SmsSendResult("新购及修试待入库任务短信通知", 455L, phone,
|
||||
content, DateUtils.getNowDate()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -218,6 +249,8 @@ public class WashHouseScheduledTasks {
|
|||
if (StringUtils.isNotBlank(phone)) {
|
||||
String content = "您好!您所属班组还有新购及修试待入库任务需要进行处理,请及时登录系统查看处理,感谢配合!";
|
||||
mobileList.add(new SmsParam(phone, content));
|
||||
sendResults.add(new SmsSendResult("新购及修试待入库任务短信通知", 1549L, phone,
|
||||
content, DateUtils.getNowDate()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -230,6 +263,8 @@ public class WashHouseScheduledTasks {
|
|||
if (StringUtils.isNotBlank(phone)) {
|
||||
String content = "您好!您所属班组还有新购及修试待入库任务需要进行处理,请及时登录系统查看处理,感谢配合!";
|
||||
mobileList.add(new SmsParam(phone, content));
|
||||
sendResults.add(new SmsSendResult("新购及修试待入库任务短信通知", 65L, phone,
|
||||
content, DateUtils.getNowDate()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -252,6 +287,12 @@ public class WashHouseScheduledTasks {
|
|||
log.error("短信发送失败,发送结果为空!");
|
||||
System.out.println("短信发送失败,发送结果为空!");
|
||||
}
|
||||
// 根据sendResult赋值短信发送成功与否状态
|
||||
String status = (sendResult != null && !sendResult.isEmpty()) ? SEND_SUCCESS : SEND_FAILURE;
|
||||
sendResults.forEach(item -> item.setSendStatus(status));
|
||||
|
||||
//将集合结果插入数据库中
|
||||
mapper.insertSmsSendResult(sendResults);
|
||||
} else {
|
||||
log.info("没有待入库的单子");
|
||||
System.out.println("没有待入库的单子");
|
||||
|
|
@ -261,23 +302,4 @@ public class WashHouseScheduledTasks {
|
|||
System.out.println("待入库定时任务执行时间:" + LocalDateTime.now().format(FORMATTER));
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送短信
|
||||
* @param phoneNumber 手机号码
|
||||
* @param content 短信内容
|
||||
*/
|
||||
private void sendSms(String phoneNumber, String content) {
|
||||
try {
|
||||
//String sendResult = SmsUtils.smsToken(phoneNumber, content, "");
|
||||
// 省公司短信发送
|
||||
JSONObject sendResult = SmsTool.sendSms(new SmsParam(phoneNumber, content), BmConfigItems.ANHUI_COMPANY_SMS_KEY);
|
||||
if (sendResult != null) {
|
||||
log.info("短信发送成功: {}", sendResult);
|
||||
} else {
|
||||
log.error("短信发送失败,发送结果为空!");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("短信发送过程中发生异常", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -123,9 +123,15 @@ public class UseMaintenanceWarningBean extends BaseEntity {
|
|||
@ApiModelProperty(value = "项目经理手机号")
|
||||
private String leaderPhone;
|
||||
|
||||
@ApiModelProperty(value = "项目经理id")
|
||||
private Long leaderId;
|
||||
|
||||
@ApiModelProperty(value = "项目总工手机号")
|
||||
private String engPhone;
|
||||
|
||||
@ApiModelProperty(value = "项目总工id")
|
||||
private Long engId;
|
||||
|
||||
@ApiModelProperty(value = "材料员手机号")
|
||||
private String clzPhone;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.material.warningAnalysis.mapper;
|
||||
|
||||
import com.bonus.common.biz.domain.SmsSendResult;
|
||||
import com.bonus.material.warningAnalysis.domain.UseMaintenanceWarningBean;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -38,4 +39,11 @@ public interface UseMaintenanceWarningMapper
|
|||
* @return
|
||||
*/
|
||||
List<UseMaintenanceWarningBean> getOverTimeListList(UseMaintenanceWarningBean bean);
|
||||
|
||||
/**
|
||||
* 将集合结果插入数据库中
|
||||
* @param sendResults
|
||||
* @return
|
||||
*/
|
||||
int insertSmsSendResult(List<SmsSendResult> sendResults);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -214,4 +214,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN sys_user su ON su.user_id = par.auditor
|
||||
WHERE par.audit_status = '1' and par.task_id = #{taskId}
|
||||
</select>
|
||||
<select id="getUserIdsByMobile" resultType="java.lang.Long">
|
||||
SELECT user_id
|
||||
FROM sys_user
|
||||
WHERE phonenumber = #{phone}
|
||||
LIMIT 1
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -3,6 +3,13 @@
|
|||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.material.warningAnalysis.mapper.UseMaintenanceWarningMapper">
|
||||
<insert id="insertSmsSendResult">
|
||||
insert into sms_send_result(module_title, receiver_id, receiver_phone, content, send_status, send_time)
|
||||
values
|
||||
<foreach collection="list" item="item" open="(" separator="," close=")">
|
||||
#{item.moduleTitle},#{item.receiverId},#{item.receiverPhone},#{item.content},#{item.sendStatus},#{item.sendTime}
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<select id="getList" resultType="com.bonus.material.warningAnalysis.domain.UseMaintenanceWarningBean">
|
||||
SELECT
|
||||
|
|
@ -115,12 +122,16 @@
|
|||
|
||||
SELECT
|
||||
dc.id as projectId,
|
||||
su1.user_id as leaderId,
|
||||
du1.mobile as leaderPhone,
|
||||
du2.mobile as engPhone
|
||||
du2.mobile as engPhone,
|
||||
su2.user_id as engId
|
||||
FROM
|
||||
`data_center`.dx_fb_son dc
|
||||
LEFT JOIN `data_center`.dc_user du1 ON dc.project_leader_id = du1.id
|
||||
LEFT JOIN sys_user su1 ON du1.account = su1.user_name
|
||||
LEFT JOIN `data_center`.dc_user du2 ON dc.project_engineer_id = du2.id
|
||||
LEFT JOIN sys_user su2 ON du2.account = su2.user_name
|
||||
WHERE dc.id = #{projectId}
|
||||
</select>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue