Commit e2976ccb by 王欣伟

Merge branch 'v1.6.0' of http://192.168.3.233:8090/eshiled-new/ne-shield-standar…

…d-interfaces into v1.6.0

 Conflicts:
	src/test/java/cn/com/glsx/stdinterface/modules/service/WorkOrderServiceTest.java
2 parents fd5d6634 6a742402
Showing 23 changed files with 605 additions and 706 deletions
package cn.com.glsx.stdinterface.common.enums;
/**
* 参数转换枚举类
*
* @author Yanglinlong
* @date 2021/12/20 14:36
*/
public class TypeConverseEunm {
/**
* 报警类型枚举类
*/
public enum FenceAlarmTypeEnum {
DRIVE_IN(1, "驶入报警"),
DRIVE_OUT(2, "驶出报警"),
DRIVE_IN_OUT(3, "驶入驶出报警");
private final Integer alarmType;
private final String alarmTypeStr;
FenceAlarmTypeEnum(Integer alarmType, String alarmTypeStr) {
this.alarmType = alarmType;
this.alarmTypeStr = alarmTypeStr;
}
public static String getStrByAlarmType(Integer alarmType) {
for (FenceAlarmTypeEnum alarmTypeEnum : FenceAlarmTypeEnum.values()) {
if (alarmTypeEnum.getAlarmType().equals(alarmType)) {
return alarmTypeEnum.getAlarmTypeStr();
}
}
return null;
}
public Integer getAlarmType() {
return alarmType;
}
public String getAlarmTypeStr() {
return alarmTypeStr;
}
}
/**
* 报警类型枚举类
*/
public enum TriggerTypeEnum {
TRIGGER_IN(1, "驶入状态"),
TRIGGER_OUT(2, "驶出状态");
private final Integer triggerType;
private final String triggerTypeStr;
TriggerTypeEnum(Integer triggerType, String triggerTypeStr) {
this.triggerType = triggerType;
this.triggerTypeStr = triggerTypeStr;
}
public static String getStrByAlarmType(Integer alarmType) {
for (TriggerTypeEnum triggerTypeEnum : TriggerTypeEnum.values()) {
if (triggerTypeEnum.getTriggerType().equals(alarmType)) {
return triggerTypeEnum.getTriggerTypeStr();
}
}
return null;
}
public Integer getTriggerType() {
return triggerType;
}
public String getTriggerTypeStr() {
return triggerTypeStr;
}
}
/**
* 是否需要安装类型枚举类
*/
public enum NeedInstallTypeEnum {
NEED_INSTALL("Y", "需要安装"),
UN_NEED_INSTALL("N", "不需要安装");
private final String needInstallType;
private final String needInstallTypeStr;
NeedInstallTypeEnum(String needInstallType, String needInstallTypeStr) {
this.needInstallType = needInstallType;
this.needInstallTypeStr = needInstallTypeStr;
}
public static String getStrByAlarmType(Integer alarmType) {
for (NeedInstallTypeEnum needInstallTypeEnum : NeedInstallTypeEnum.values()) {
if (needInstallTypeEnum.getNeedInstallType().equals(alarmType)) {
return needInstallTypeEnum.getNeedInstallTypeStr();
}
}
return null;
}
public String getNeedInstallType() {
return needInstallType;
}
public String getNeedInstallTypeStr() {
return needInstallTypeStr;
}
}
}
package cn.com.glsx.stdinterface.modules.controller;
import cn.com.glsx.stdinterface.api.JourneyClient;
import cn.com.glsx.stdinterface.dto.DeviceJourneyDTO;
import cn.com.glsx.stdinterface.modules.service.JourneyService;
import com.glsx.plat.core.web.R;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* 新e盾|里程控制层
*
* @author xiangyanlin
* @since 2022-04-07 16:51:36
*/
@RestController
@RequestMapping("/journey")
public class JourneyController implements JourneyClient {
/**
* 服务对象
*/
@Resource
private JourneyService journeyService;
@PostMapping(value = "/saveDeviceJourney")
@Override
public R saveDeviceJourney(DeviceJourneyDTO deviceJourneyDTO) {
journeyService.saveDeviceJourney(deviceJourneyDTO);
return R.ok();
}
}
package cn.com.glsx.stdinterface.modules.entity;
import com.glsx.plat.mybatis.base.BaseEntity;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.Table;
import java.util.Date;
@Data
@Table(name = "t_device_journey")
public class DeviceJourney extends BaseEntity{
/**
* 设备序列号
*/
private String sn;
/**
* 车辆、设备关系id
*/
@Column(name = "vd_id")
private Long vdId;
/**
* 里程开始时间
*/
@Column(name = "begin_time")
private Date beginTime;
/**
* 里程结束时间
*/
@Column(name = "end_time")
private Date endTime;
/**
* 里程开始地址
*/
@Column(name = "begin_address")
private String beginAddress;
/**
* 里程结束地址
*/
@Column(name = "end_address")
private String endAddress;
/**
* 行驶里程km
*/
private Integer mileage;
}
\ No newline at end of file
package cn.com.glsx.stdinterface.modules.entity;
import com.glsx.plat.mybatis.base.BaseEntity;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.Table;
@Data
@Table(name = "t_device_journey_overview")
public class DeviceJourneyOverview extends BaseEntity {
/**
* 设备序列号
*/
private String sn;
/**
* 车辆、设备关系id
*/
@Column(name = "vd_id")
private Long vdId;
/**
* 总行驶次数
*/
@Column(name = "total_journey_count")
private Integer totalJourneyCount;
/**
* 总里程km
*/
private Integer distance;
}
\ No newline at end of file
package cn.com.glsx.stdinterface.modules.mapper;
import cn.com.glsx.stdinterface.modules.entity.DeviceJourney;
import com.glsx.plat.mybatis.mapper.CommonBaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
/**
* 新e盾|里程表
*
* @author xiangyanlin
* @since 2022-04-07 16:51:36
*/
@Mapper
public interface DeviceJourneyMapper extends CommonBaseMapper<DeviceJourney> {
/**
* 根据开始时间和sn查找
* @param sn 设备号
* @param beginTime 开始时间
* @return 设备行程信息
*/
DeviceJourney selectBySnAndBeginTime(@Param("sn")String sn, @Param("beginTime")Date beginTime);
}
\ No newline at end of file
package cn.com.glsx.stdinterface.modules.mapper;
import cn.com.glsx.stdinterface.modules.entity.DeviceJourneyOverview;
import com.glsx.plat.mybatis.mapper.CommonBaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* 新e盾|里程表总览
*
* @author xiangyanlin
* @since 2022-04-07 16:51:36
*/
@Mapper
public interface DeviceJourneyOverviewMapper extends CommonBaseMapper<DeviceJourneyOverview> {
/**
*
* 如果不存在就新增。 如果存在则累加总行程 总次数
* @param deviceJourneyOverview 传入新的行程值
*/
void insertOrSumDistanceAndCount(DeviceJourneyOverview deviceJourneyOverview);
}
\ No newline at end of file
package cn.com.glsx.stdinterface.modules.remote;
import cn.com.glsx.notify.api.NotifyCenterFeignClient;
import cn.com.glsx.notify.dto.MailTemplateMessageDTO;
import cn.com.glsx.notify.dto.request.MailMessageRequest;
import cn.com.glsx.notify.dto.request.SmsMessageRequest;
import cn.hutool.json.JSONUtil;
import com.glsx.plat.core.web.R;
import lombok.extern.slf4j.Slf4j;
......@@ -20,13 +21,25 @@ public class NotifyCenterService {
private NotifyCenterFeignClient notifyCenterFeignClient;
/**
* 调用短信发送服务
*
* @param messageRequest 邮件发送服务实体类
*/
public void sendSms(SmsMessageRequest messageRequest) {
log.info("发送短信参数===" + JSONUtil.toJsonStr(messageRequest));
R r = notifyCenterFeignClient.sendSms(messageRequest);
log.info("发送短信结果返回===" + JSONUtil.toJsonStr(r));
}
/**
* 调用远程邮件发送服务
*
* @param messageDTO 邮件发送服务实体类
* @param messageRequest 邮件发送服务实体类
*/
public void sendMailOnlyContent(MailTemplateMessageDTO messageDTO) {
log.info("发送邮件参数===" + JSONUtil.toJsonStr(messageDTO));
R r = notifyCenterFeignClient.sendMailOnlyContent(messageDTO);
public void sendMailOnlyContent(MailMessageRequest messageRequest) {
log.info("发送邮件参数===" + JSONUtil.toJsonStr(messageRequest));
R r = notifyCenterFeignClient.sendMailOnlyContent(messageRequest);
log.info("发送邮件结果返回===" + JSONUtil.toJsonStr(r));
}
}
package cn.com.glsx.stdinterface.modules.remote;
import cn.com.glsx.devicemonitor.api.dto.response.DeviceSearchDTO;
import cn.com.glsx.devicemonitor.api.dto.request.DeviceStatusRequest;
import cn.com.glsx.devicemonitor.api.dto.response.DeviceStatusModel;
import cn.com.glsx.devicemonitor.api.feign.DeviceFeignService;
import cn.hutool.json.JSONUtil;
......@@ -31,9 +31,7 @@ public class RemoteFeignDeviceService {
public Map<String, DeviceStatusModel> listDeviceStatusBySns(Collection<String> sns) {
log.info("调用监控服务获取设备在线和离线的状态===" + JSONUtil.toJsonStr(sns));
DeviceSearchDTO deviceSearchDTO = new DeviceSearchDTO();
deviceSearchDTO.setSns(sns);
R<List<DeviceStatusModel>> listDeviceStatusBySnsR = deviceFeignService.listDeviceStatusBySns(deviceSearchDTO);
R<List<DeviceStatusModel>> listDeviceStatusBySnsR = deviceFeignService.listDeviceStatusBySns(new DeviceStatusRequest(sns));
List<DeviceStatusModel> listDeviceStatusBySnsDataList = listDeviceStatusBySnsR.getDataList(new TypeToken<List<DeviceStatusModel>>() {
}.getType());
......@@ -43,4 +41,5 @@ public class RemoteFeignDeviceService {
}
return deviceStatusBsDataMap;
}
}
......@@ -5,11 +5,11 @@ import cn.com.glsx.stdinterface.enums.WorkOrderSourceEnum;
import cn.com.glsx.stdinterface.modules.entity.WorkOrder;
import cn.com.glsx.stdinterface.modules.entity.WorkOrderVehicle;
import cn.com.glsx.stdinterface.modules.model.BhgResultObject;
import cn.com.glsx.stdinterface.modules.util.MD5Util;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONObject;
import com.glsx.plat.common.utils.DateUtils;
import com.glsx.plat.common.utils.HttpUtils;
import com.glsx.plat.common.utils.MD5Util;
import com.glsx.plat.common.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
......
......@@ -11,9 +11,7 @@ import cn.com.glsx.stdinterface.modules.entity.FakeOfflineVin;
import cn.com.glsx.stdinterface.modules.entity.Vehicle;
import cn.com.glsx.stdinterface.modules.mapper.FakeOfflineFenceSnMapper;
import cn.com.glsx.stdinterface.modules.mapper.FakeOfflineVinMapper;
import cn.com.glsx.stdinterface.modules.mapper.VehicleDeviceMapper;
import cn.com.glsx.stdinterface.modules.mapper.VehicleMapper;
import cn.com.glsx.stdinterface.modules.remote.RemoteFeignDeviceService;
import cn.hutool.json.JSONUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -41,12 +39,6 @@ public class FakeOfficeService {
@Autowired
private VehicleMapper vehicleMapper;
@Autowired
private VehicleDeviceMapper vehicleDeviceMapper;
@Autowired
private RemoteFeignDeviceService remoteFeignDeviceService;
/**
* 保存假性离线数据
*
......
package cn.com.glsx.stdinterface.modules.service;
import cn.com.glsx.stdinterface.dto.DeviceJourneyDTO;
import cn.com.glsx.stdinterface.modules.entity.DeviceJourney;
import cn.com.glsx.stdinterface.modules.entity.DeviceJourneyOverview;
import cn.com.glsx.stdinterface.modules.entity.Vehicle;
import cn.com.glsx.stdinterface.modules.entity.VehicleDevice;
import cn.com.glsx.stdinterface.modules.mapper.DeviceJourneyMapper;
import cn.com.glsx.stdinterface.modules.mapper.DeviceJourneyOverviewMapper;
import cn.com.glsx.stdinterface.modules.mapper.VehicleDeviceMapper;
import cn.com.glsx.stdinterface.modules.mapper.VehicleMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Date;
import java.util.Objects;
/**
* 新e盾|里程服务实现类
*
* @author xiangyanlin
* @since 2022-04-07 16:51:41
*/
@Slf4j
@Service
public class JourneyService {
@Resource
private DeviceJourneyMapper deviceJourneyMapper;
@Resource
private DeviceJourneyOverviewMapper deviceJourneyOverviewMapper;
@Resource
private VehicleMapper vehicleMapper;
@Resource
private VehicleDeviceMapper vehicleDeviceMapper;
/**
* 行程数据新增
*/
@Transactional(rollbackFor = Exception.class)
public void saveDeviceJourney(DeviceJourneyDTO deviceJourneyDTO) {
if (Objects.isNull(deviceJourneyDTO)) {
return;
}
DeviceJourney journey = deviceJourneyMapper.selectBySnAndBeginTime(deviceJourneyDTO.getSn(), deviceJourneyDTO.getBeginTime());
if(Objects.nonNull(journey)) {
log.warn("该设备同样的开始时间行程数据已经存在" +
"sn: " + deviceJourneyDTO.getSn() + "beginTime:" + deviceJourneyDTO.getBeginTime());
return;
}
//从车辆信息中获取创建人信息
Vehicle vehicle = getVehicleBySn(deviceJourneyDTO.getSn());
if (Objects.isNull(vehicle)) {
log.warn("该设备没有绑定车辆" + deviceJourneyDTO.getSn());
return;
}
deviceJourneyDTO.setCreatedBy(vehicle.getCreatedBy());
deviceJourneyDTO.setUpdatedBy(vehicle.getUpdatedBy());
//从关联表从获取关联id
VehicleDevice vehicleDevice = vehicleDeviceMapper.getVdIdbySn(deviceJourneyDTO.getSn());
Long vnId = null;
if(Objects.nonNull(vehicleDevice)) {
vnId = vehicleDevice.getId();
}
//行程信息入库
DeviceJourney deviceJourney = convertTo(deviceJourneyDTO, vnId);
deviceJourneyMapper.insert(deviceJourney);
//更新总行程次数 总里程
DeviceJourneyOverview overview = buildOverviewWitheJourney(deviceJourneyDTO, vnId);
deviceJourneyOverviewMapper.insertOrSumDistanceAndCount(overview);
}
public DeviceJourneyOverview buildOverviewWitheJourney(DeviceJourneyDTO deviceJourneyDTO, Long vnId) {
DeviceJourneyOverview deviceJourneyOverview = new DeviceJourneyOverview();
deviceJourneyOverview.setSn(deviceJourneyDTO.getSn());
deviceJourneyOverview.setVdId(vnId);
//每条数据加一
deviceJourneyOverview.setTotalJourneyCount(1);
deviceJourneyOverview.setDistance(deviceJourneyDTO.getMileage());
deviceJourneyOverview.setId(deviceJourneyDTO.getId());
deviceJourneyOverview.setCreatedBy(deviceJourneyDTO.getCreatedBy());
deviceJourneyOverview.setUpdatedBy(deviceJourneyDTO.getUpdatedBy());
deviceJourneyOverview.setCreatedDate(new Date());
deviceJourneyOverview.setUpdatedDate(new Date());
return deviceJourneyOverview;
}
/**
* 转换为数据库对象
*/
public DeviceJourney convertTo(DeviceJourneyDTO deviceJourneyDTO, Long vnId) {
DeviceJourney deviceJourney = new DeviceJourney();
deviceJourney.setSn(deviceJourneyDTO.getSn());
//获取关联id
deviceJourney.setVdId(vnId);
deviceJourney.setBeginTime(deviceJourneyDTO.getBeginTime());
deviceJourney.setEndTime(deviceJourneyDTO.getEndTime());
deviceJourney.setBeginAddress(deviceJourneyDTO.getBeginAddress());
deviceJourney.setEndAddress(deviceJourneyDTO.getEndAddress());
deviceJourney.setMileage(deviceJourneyDTO.getMileage());
deviceJourney.setId(deviceJourneyDTO.getId());
deviceJourney.setCreatedBy(deviceJourneyDTO.getCreatedBy());
deviceJourney.setUpdatedBy(deviceJourneyDTO.getUpdatedBy());
deviceJourney.setCreatedDate(new Date());
deviceJourney.setUpdatedDate(new Date());
return deviceJourney;
}
/**
* 通过设备号获取绑定车辆的 createBy
*
* @param sn 设备号
* @return 用户Id
*/
private Vehicle getVehicleBySn(String sn) {
return vehicleMapper.getVehicleBySn(sn);
}
}
package cn.com.glsx.stdinterface.modules.service;
import cn.com.glsx.stdinterface.modules.util.RopHttpUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
/**
* @author zhouhaibao
* @version 1.0
* @description: 短信发送服务
* @date 2021/11/14 14:23
*/
@Slf4j
@Service
@RefreshScope
public class MessageService {
@Value("${sendMessageUrl}")
private String sendMessageUrl;
@Value("${sendMessageMethod}")
private String sendMessageMethod;
/**
* 发送短信
*
* @param phone 电话号码,批量用逗号隔开
* @param source 来源
* @param type 类型
* @param context 发送内容
*/
@Async
public void sendMessage(String phone, String source, String type, String context) {
MultiValueMap<String, String> params = new LinkedMultiValueMap<>(5);
try {
params.add("phone", phone);
params.add("source", source);
params.add("messageSource", source);
params.add("type", type);
params.add("context", context);
String post = RopHttpUtil.postE(params, String.class, sendMessageUrl + "?method=" + sendMessageMethod, sendMessageMethod);
log.info("发送短信结果{}", post);
} catch (Exception e) {
log.error("发送短信到{}异常,{}", phone, e.getMessage());
//throw new StdInterfaceException("444444", e.getMessage());
}
}
// public static void main(String[] args) {
// MessageService messageService = new MessageService();
// messageService.sendMessage("18682185876", "eshield_workOrder_warm", "1", "this is a test!");
// }
}
......@@ -3,7 +3,6 @@ package cn.com.glsx.stdinterface.modules.service;
import cn.com.glsx.devicemonitor.api.dto.request.DeviceBO;
import cn.com.glsx.devicemonitor.api.dto.request.DeviceLocationItem;
import cn.com.glsx.devicemonitor.api.dto.request.DeviceLocationRequest;
import cn.com.glsx.devicemonitor.api.dto.request.GpsBsLastBatchRequest;
import cn.com.glsx.devicemonitor.api.dto.response.DeviceDTO;
import cn.com.glsx.devicemonitor.api.dto.response.GpsBsData;
import cn.com.glsx.devicemonitor.api.dto.response.GpsLocation;
......@@ -11,8 +10,10 @@ import cn.com.glsx.devicemonitor.api.enums.DeviceTypeRelationEnum;
import cn.com.glsx.devicemonitor.api.enums.DeviceWireTypeEnum;
import cn.com.glsx.devicemonitor.api.feign.DeviceFeignService;
import cn.com.glsx.devicemonitor.api.feign.GpsBsFeignService;
import cn.com.glsx.notify.dto.MailTemplateMessageDTO;
import cn.com.glsx.notify.dto.request.MailMessageRequest;
import cn.com.glsx.notify.dto.request.SmsMessageRequest;
import cn.com.glsx.stdinterface.common.constants.Constants;
import cn.com.glsx.stdinterface.common.enums.TypeConverseEunm;
import cn.com.glsx.stdinterface.common.exception.StdInterfaceException;
import cn.com.glsx.stdinterface.dto.*;
import cn.com.glsx.stdinterface.enums.BizServiceTypeEnum;
......@@ -109,9 +110,6 @@ public class WorkOrderService {
private ApiUserService apiUserService;
@Autowired
private MessageService messageService;
@Autowired
private NotifyCenterService notifyCenterService;
@Autowired
......@@ -475,41 +473,64 @@ public class WorkOrderService {
title.append("(").append(rootOrg).append(") 手动安装单-").append(order.getPartnerOrderNo()).append("-").append(woVehicle.getVin()).append("\n");
//创建邮件正文
StringBuilder content = new StringBuilder();
content.append("租赁公司-").append(rootOrg).append(";\n");
content.append("申请编号-").append(order.getPartnerOrderNo()).append(";\n");
content.append("区域-").append(order.getProvince().concat("/").concat(order.getCity()).concat("/").concat(order.getDistrict())).append(";\n");
content.append("设备组合-").append(buildDeviceCompose(woVehicle.getDeviceCompose())).append(";\n");
content.append("导入时间-").append(DateUtil.formatDate(order.getCreatedDate())).append(";\n");
content.append("分公司-无").append(";\n");
content.append("店面名称-").append(order.getShopName()).append(";\n");
content.append("店面联系电话-").append(order.getShopTelephone()).append(";\n");
content.append("要求安装日期-").append(DateUtil.formatDate(order.getServiceTime())).append(";\n");
if (StringUtils.isEmpty(woVehicle.getLesseeName())) {
content.append("客户姓名-无").append(";\n");
content.append("业务工单号:").append(order.getPartnerOrderNo()).append(";\n");
content.append("店面名称:").append(order.getShopName()).append(";\n");
content.append("联系人:").append(order.getShopContactor()).append(";\n");
content.append("联系电话:").append(order.getShopTelephone()).append(";\n");
content.append("是否需要安装:").append(order.getNeedInstall().equalsIgnoreCase(TypeConverseEunm.NeedInstallTypeEnum.NEED_INSTALL.getNeedInstallType()) ? TypeConverseEunm.NeedInstallTypeEnum.NEED_INSTALL.getNeedInstallTypeStr() : TypeConverseEunm.NeedInstallTypeEnum.UN_NEED_INSTALL.getNeedInstallTypeStr()).append(";\n");
content.append("期望安装日期:").append(DateUtil.formatDate(order.getServiceTime())).append(";\n");
content.append("安装区域:").append(order.getProvince().concat(order.getCity()).concat(order.getDistrict())).append(";\n");
content.append("联系地址:").append(order.getShopAddress()).append(";\n");
content.append("详细地址:").append(order.getProvince().concat(order.getCity()).concat(order.getDistrict()).concat(order.getServiceAddress())).append(";\n");
if (StringUtils.isEmpty(order.getServiceLinkerPhone())) {
content.append("安装联系电话:").append("--").append(";\n");
} else {
content.append("安装联系电话:").append(order.getServiceLinkerPhone()).append(";\n");
}
if (StringUtils.isEmpty(order.getServiceLinker())) {
content.append("姓名:").append("--").append(";\n");
} else {
content.append("姓名:").append(order.getServiceLinker()).append(";\n");
}
content.append("性别:").append("--").append(";\n");
content.append("联系电话:").append(order.getServiceLinkerPhone()).append(";\n");
if (StringUtils.isEmpty(woVehicle.getPlateNo())) {
content.append("车牌号:").append("--").append(";\n");
} else {
content.append("客户姓名-").append(woVehicle.getLesseeName()).append(";\n");
content.append("车牌号:").append(woVehicle.getPlateNo()).append(";\n");
}
content.append("车架号:").append(woVehicle.getVin()).append(";\n");
if (StringUtils.isEmpty(woVehicle.getBrandName())) {
content.append("车架品牌:").append("--").append(";\n");
} else {
content.append("车架品牌:").append(woVehicle.getBrandName()).append(";\n");
}
content.append("车架号-").append(woVehicle.getVin()).append(";\n");
content.append("颜色-无").append(";\n");
if (StringUtils.isEmpty(woVehicle.getSubBrandName()) && StringUtils.isEmpty(woVehicle.getSeriesName()) && StringUtils.isEmpty(woVehicle.getTypeName())) {
content.append("车型-无").append(";\n");
content.append("车型:").append("--").append(";\n");
} else {
String modelType = (woVehicle.getSubBrandName() == null ? "--" : woVehicle.getSubBrandName())
.concat("/").concat(woVehicle.getSeriesName() == null ? "--" : woVehicle.getSeriesName())
.concat("/").concat(woVehicle.getTypeName() == null ? "--" : woVehicle.getTypeName());
content.append("车型-").append(modelType).append(";\n");
content.append("车型:").append(modelType).append(";\n");
}
content.append("贷款期限-无").append(";\n");
content.append("租凭方式-无").append(";\n");
content.append("安装地址-").append(order.getServiceAddress()).append(";\n");
if (StringUtils.isEmpty(order.getRemark())) {
content.append("备注—无").append(";\n");
if (StringUtils.isEmpty(woVehicle.getEngineNo())) {
content.append("发动机号:").append("--").append(";\n");
} else {
content.append("备注—").append(order.getRemark()).append(";\n");
content.append("发动机号:").append(woVehicle.getEngineNo()).append(";\n");
}
content.append("安装方式—广联安装").append(";\n");
MailTemplateMessageDTO messageDTO = new MailTemplateMessageDTO();
content.append("排量:").append("--").append(";\n");
content.append("颜色:").append("默认").append(";\n");
if (StringUtils.isEmpty(order.getServiceExplain())) {
content.append("备注:").append("--").append(";\n");
} else {
content.append("备注:").append(order.getServiceExplain()).append(";\n");
}
MailMessageRequest messageDTO = new MailMessageRequest();
String sendMail = PropertiesUtils.getProperty("mail.toMail.addr");
messageDTO.setTo(sendMail);
messageDTO.setTitle(title.toString());
......@@ -1337,15 +1358,23 @@ public class WorkOrderService {
public void finishedNotifyTarget(WorkOrder workOrder, Vehicle vehicle) {
String receiveNumbers = workOrder.getNotifyTarget();
if (StringUtils.isNullOrEmpty(receiveNumbers)) {
log.info("未填写手机号码,且非仲利的工单,本次不发送短信");
log.info("未填写手机号码,且非仲利的工单,不发送短信");
return;
}
if (vehicle != null && StringUtils.isNotEmpty(workOrder.getPartnerOrderNo())) {
String ownerName = StringUtils.isNullOrEmpty(vehicle.getOwnerName()) ? " 空 " : vehicle.getOwnerName();
String messageContent = "【嘀嘀虎】您好,您的服务订单 " + workOrder.getPartnerOrderNo() + "(车主:" + ownerName + ")," + "已完成,上门时间:" + DateUtils.formatNormal(new Date()) + "。广联赛讯";
Map<String, Object> args = Maps.newLinkedHashMap();
args.put("arg1", workOrder.getPartnerOrderNo());
args.put("arg2", ownerName);
args.put("arg3", DateUtils.formatNormal(new Date()));
String[] phoneNumberArr = receiveNumbers.split(";");
for (String phoneNumber : phoneNumberArr) {
messageService.sendMessage(phoneNumber, "eshield_workOrder_warm", "1", messageContent);
SmsMessageRequest messageRequest = new SmsMessageRequest();
messageRequest.setPhone(phoneNumber);
messageRequest.setTemplate("SMS_TEMPLATE_ORDER_FINISHED");
messageRequest.setArgs(args);
notifyCenterService.sendSms(messageRequest);
}
}
}
......@@ -1467,10 +1496,7 @@ public class WorkOrderService {
* @return
*/
public Map<String, GpsBsData> getLastGpsBsBatchBySns(List<String> snList) {
GpsBsLastBatchRequest gpsBsLastBatchRequest = new GpsBsLastBatchRequest();
gpsBsLastBatchRequest.setSnList(snList);
gpsBsLastBatchRequest.setDeviceTypeRelationEnum(DeviceTypeRelationEnum.GPS);
R<List<GpsBsData>> lastGpsBsBatch = gpsBsFeignService.getLastGpsBsBatch(gpsBsLastBatchRequest);
R<List<GpsBsData>> lastGpsBsBatch = gpsBsFeignService.getLastGpsBsBatch(snList);
List<GpsBsData> gpsBsDataList = lastGpsBsBatch.getDataList(new TypeToken<List<GpsBsData>>() {
}.getType());
......
package cn.com.glsx.stdinterface.modules.util;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
import javax.crypto.KeyGenerator;
import javax.crypto.Mac;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
import java.security.MessageDigest;
public class Coder {
public static final String KEY_SHA = "SHA";
public static final String KEY_MD5 = "MD5";
/**
* MAC算法可选以下多种算法
*
* <pre>
* HmacMD5
* HmacSHA1
* HmacSHA256
* HmacSHA384
* HmacSHA512
* </pre>
*/
public static final String KEY_MAC = "HmacMD5";
/**
* BASE64解密
*
* @param key
* @return
* @throws Exception
*/
public static byte[] decryptBASE64(String key) throws Exception {
return (new BASE64Decoder()).decodeBuffer(key);
}
/**
* BASE64加密
*
* @param key
* @return
* @throws Exception
*/
public static String encryptBASE64(byte[] key) throws Exception {
return (new BASE64Encoder()).encodeBuffer(key);
}
/**
* MD5加密
*
* @param data
* @return
* @throws Exception
*/
public static byte[] encryptMD5(byte[] data) throws Exception {
MessageDigest md5 = MessageDigest.getInstance(KEY_MD5);
md5.update(data);
return md5.digest();
}
/**
* SHA加密
*
* @param data
* @return
* @throws Exception
*/
public static byte[] encryptSHA(byte[] data) throws Exception {
MessageDigest sha = MessageDigest.getInstance(KEY_SHA);
sha.update(data);
return sha.digest();
}
/**
* 初始化HMAC密钥
*
* @return
* @throws Exception
*/
public static String initMacKey() throws Exception {
KeyGenerator keyGenerator = KeyGenerator.getInstance(KEY_MAC);
SecretKey secretKey = keyGenerator.generateKey();
return encryptBASE64(secretKey.getEncoded());
}
/**
* HMAC加密
*
* @param data
* @param key
* @return
* @throws Exception
*/
public static byte[] encryptHMAC(byte[] data, String key) throws Exception {
SecretKey secretKey = new SecretKeySpec(decryptBASE64(key), KEY_MAC);
Mac mac = Mac.getInstance(secretKey.getAlgorithm());
mac.init(secretKey);
return mac.doFinal(data);
}
}
package cn.com.glsx.stdinterface.modules.util;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
/**
* @author zhouhaibao
* @version 1.0
* @description: TODO
* @date 2021/11/23 21:38
*/
public class GopUtils {
/**
* 使用<code>secret</code>对paramValues按以下算法进行签名: <br/>
* uppercase(hex(sha1(secretkey1value1key2value2...secret))
* <p>
* 需要签名的参数名
*
* @param paramValues 参数列表
* @param secret
* @return
*/
public static String sign(Map<String, String> paramValues, String secret) {
return sign(paramValues, null, secret);
}
/**
* 对paramValues进行签名,其中ignoreParamNames这些参数不参与签名
*
* @param paramValues
* @param ignoreParamNames
* @param secret
* @return
*/
public static String sign(Map<String, String> paramValues, List<String> ignoreParamNames, String secret) {
//try {
StringBuilder sb = new StringBuilder();
List<String> paramNames = new ArrayList<String>(paramValues.size());
paramNames.addAll(paramValues.keySet());
if (ignoreParamNames != null && ignoreParamNames.size() > 0) {
for (String ignoreParamName : ignoreParamNames) {
paramNames.remove(ignoreParamName);
}
}
Collections.sort(paramNames);
sb.append(secret);
for (String paramName : paramNames) {
sb.append(paramName).append(paramValues.get(paramName));
}
sb.append(secret);
/*byte[] sha1Digest = getSHA1Digest(sb.toString());
return byte2hex(sha1Digest);*/
return MD5Util.convert32(sb.toString());
/*} catch (IOException e) {
throw new GopException(e);
}*/
}
}
package cn.com.glsx.stdinterface.modules.util;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Map;
public class MD5Util {
private static final String hexDigits[] = {"0", "1", "2", "3", "4", "5",
"6", "7", "8", "9", "a", "b", "c", "d", "e", "f"};
private static String byteArrayToHexString(byte b[]) {
StringBuffer resultSb = new StringBuffer();
for (int i = 0; i < b.length; i++) {
resultSb.append(byteToHexString(b[i]));
}
return resultSb.toString();
}
private static String byteToHexString(byte b) {
int n = b;
if (n < 0)
n += 256;
int d1 = n / 16;
int d2 = n % 16;
return hexDigits[d1] + hexDigits[d2];
}
public static String encode(String origin) {
return encode(origin, "UTF-8");
}
public static String encode(String origin, String charsetname) {
String resultString = null;
try {
resultString = new String(origin);
MessageDigest md = MessageDigest.getInstance("MD5");
if (charsetname == null || "".equals(charsetname))
resultString = byteArrayToHexString(md.digest(resultString
.getBytes()));
else
resultString = byteArrayToHexString(md.digest(resultString
.getBytes(charsetname)));
} catch (Exception exception) {
}
return resultString;
}
/**
* md5加密方法
*
* @param str
* @return
*/
public static String encrypt(String str) {
try {
byte b[] = Coder.encryptMD5(str.getBytes("utf-8"));
StringBuffer buf = new StringBuffer();
String stmp = "";
for (int n = 0; n < b.length; n++) {
stmp = Integer.toHexString(b[n] & 0XFF);
if (stmp.length() == 1)
buf.append("0").append(stmp);
else
buf.append(stmp);
}
return buf.toString();
} catch (Exception e) {
e.printStackTrace();
}
return "";
}
public static String MD516(String sourceStr) {
String result = "";
try {
MessageDigest md = MessageDigest.getInstance("MD5");
try {
md.update(sourceStr.getBytes("GBK"));
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
byte b[] = md.digest();
int i;
StringBuffer buf = new StringBuffer("");
for (int offset = 0; offset < b.length; offset++) {
i = b[offset];
if (i < 0)
i += 256;
if (i < 16)
buf.append("0");
buf.append(Integer.toHexString(i));
}
result = buf.toString();
result = result.toString().substring(8, 24);
} catch (NoSuchAlgorithmException e) {
System.out.println(e);
}
return result;
}
/**
* 获取MD5加密的sign
*
* @param params
* @return
*/
public static String getParamsMD5Sign(Map<Object, Object> params) {
StringBuffer paramsStr = new StringBuffer();
for (Map.Entry<Object, Object> param : params.entrySet()) {
paramsStr.append(param.getKey()).append(param.getValue());
}
return MD5Util.encrypt(paramsStr.toString()).toUpperCase();
}
/**
* 32位MD5加密算法
*
* @param s
* @return
*/
public static String convert32(String s) {
char hexChars[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
try {
byte[] bytes = s.getBytes("UTF-8");
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(bytes);
bytes = md.digest();
int j = bytes.length;
char[] chars = new char[j * 2];
int k = 0;
for (int i = 0; i < bytes.length; i++) {
byte b = bytes[i];
chars[k++] = hexChars[b >>> 4 & 0xf];
chars[k++] = hexChars[b & 0xf];
}
return new String(chars);
} catch (Exception e) {
return null;
}
}
/**
* 16位MD5加密算法
*
* @param s
* @return
*/
public static String convert16(String s) {
char hexChars[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
try {
byte[] bytes = s.getBytes();
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(bytes);
bytes = md.digest();
int j = bytes.length;
char[] chars = new char[j * 2];
int k = 0;
for (int i = 0; i < bytes.length; i++) {
byte b = bytes[i];
chars[k++] = hexChars[b >>> 4 & 0xf];
chars[k++] = hexChars[b & 0xf];
}
return new String(chars).substring(8, 24);
} catch (Exception e) {
return null;
}
}
}
package cn.com.glsx.stdinterface.modules.util;
import org.apache.commons.lang.StringUtils;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.DefaultUriBuilderFactory;
import org.springframework.web.util.UriBuilder;
import java.net.URI;
import java.util.Map;
import java.util.Map.Entry;
/**
* @author zhouhaibao
* @version 1.0
* @description: http调用rop端服务
* @date 2021/7/30 11:26
*/
public class RopHttpUtil {
private final static String appKey = "48e5e13229b82c1b4e6e8c96151f0637";
private final static String secret = "c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b";
private static void addBaseParam(MultiValueMap<String, String> paramsMap, String method) {
paramsMap.add("v", "1.0.0");
paramsMap.add("method", method);
paramsMap.add("name", "zhouhb");
}
private static void addBaseParamE(MultiValueMap<String, String> paramsMap, String method) {
paramsMap.add("v", "1.0.0");
paramsMap.add("method", method);
}
public static <T> T get(MultiValueMap<String, String> paramsMap, Class<T> responseType, String baseurl, String method) throws Exception {
addBaseParam(paramsMap, method);
MultiValueMap<String, String> params = getSysParams();
params.putAll(paramsMap);
for (Entry<String, String> entry : params.toSingleValueMap().entrySet()) {
if (StringUtils.isEmpty(entry.getValue())) {
params.remove(entry.getKey());
}
}
String sign = RopUtils.sign(params.toSingleValueMap(), secret);
params.add("sign", sign);
RestTemplate rest = new RestTemplate();
RopUriTemplateHandler uriTemplateHandler = new RopUriTemplateHandler(baseurl);
uriTemplateHandler.setDefaultUriVariables(params.toSingleValueMap());
rest.setUriTemplateHandler(uriTemplateHandler);
T forObject = rest.getForObject(baseurl, responseType, params.toSingleValueMap());
return forObject;
}
public static <T> T post(MultiValueMap<String, String> paramsMap, Class<T> responseType, String baseurl, String method) throws Exception {
addBaseParam(paramsMap, method);
MultiValueMap<String, String> params = getSysParams();
params.putAll(paramsMap);
for (Entry<String, String> entry : params.toSingleValueMap().entrySet()) {
if (StringUtils.isEmpty(entry.getValue())) {
params.remove(entry.getKey());
}
}
String sign = RopUtils.sign(params.toSingleValueMap(), secret);
params.add("sign", sign);
return new RestTemplate().postForObject(baseurl, params, responseType);
}
public static <T> T postE(MultiValueMap<String, String> paramsMap, Class<T> responseType, String baseurl, String method) throws Exception {
addBaseParamE(paramsMap, method);
MultiValueMap<String, String> params = getSysParamsE();
params.putAll(paramsMap);
for (Entry<String, String> entry : params.toSingleValueMap().entrySet()) {
if (StringUtils.isEmpty(entry.getValue())) {
params.remove(entry.getKey());
}
}
String sign = GopUtils.sign(params.toSingleValueMap(), secret);
params.add("sign", sign);
return new RestTemplate().postForObject(baseurl, params, responseType);
}
public static MultiValueMap<String, String> getSysParams() {
MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>(16);
params.add("appKey", appKey);
params.add("format", "json");
return params;
}
public static MultiValueMap<String, String> getSysParamsE() {
MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>(16);
params.add("app_key", appKey);
params.add("format", "json");
params.add("timestamp", System.currentTimeMillis() + "");
return params;
}
static class RopUriTemplateHandler extends DefaultUriBuilderFactory {
public RopUriTemplateHandler(String baseUriTemplate) {
super(baseUriTemplate);
}
@Override
public URI expand(String uriTemplate, Map<String, ?> uriVars) {
UriBuilder builder = uriString(uriTemplate);
if (uriVars != null && !uriVars.isEmpty()) {
MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>();
for (Entry<String, ?> entry : uriVars.entrySet()) {
params.add(entry.getKey(), entry.getValue().toString());
}
builder.queryParams(params);
}
return builder.build(uriVars);
}
}
}
package cn.com.glsx.stdinterface.modules.util;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.security.GeneralSecurityException;
import java.security.MessageDigest;
import java.util.*;
public class RopUtils {
private static final Logger logger = LoggerFactory.getLogger(RopUtils.class);
public RopUtils() {
}
public static String sign(Map<String, String> paramValues, String secret) {
return sign(paramValues, (List) null, secret);
}
public static String sign(Map<String, String> paramValues, List<String> ignoreParamNames, String secret) {
try {
StringBuilder sb = new StringBuilder();
List<String> paramNames = new ArrayList(paramValues.size());
paramNames.addAll(paramValues.keySet());
Iterator var5;
String paramName;
if (ignoreParamNames != null && ignoreParamNames.size() > 0) {
var5 = ignoreParamNames.iterator();
while (var5.hasNext()) {
paramName = (String) var5.next();
paramNames.remove(paramName);
}
}
Collections.sort(paramNames);
sb.append(secret);
var5 = paramNames.iterator();
while (var5.hasNext()) {
paramName = (String) var5.next();
sb.append(paramName).append((String) paramValues.get(paramName));
}
sb.append(secret);
byte[] sha1Digest = getSHA1Digest(sb.toString());
return byte2hex(sha1Digest);
} catch (IOException var7) {
logger.info("异常信息", var7);
return null;
}
}
public static String utf8Encoding(String value, String sourceCharsetName) {
try {
return new String(value.getBytes(sourceCharsetName), "UTF-8");
} catch (UnsupportedEncodingException var3) {
throw new IllegalArgumentException(var3);
}
}
private static byte[] getSHA1Digest(String data) throws IOException {
Object var1 = null;
try {
MessageDigest md = MessageDigest.getInstance("SHA-1");
byte[] bytes = md.digest(data.getBytes("UTF-8"));
return bytes;
} catch (GeneralSecurityException var3) {
throw new IOException(var3);
}
}
private static byte[] getMD5Digest(String data) throws IOException {
Object var1 = null;
try {
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] bytes = md.digest(data.getBytes("UTF-8"));
return bytes;
} catch (GeneralSecurityException var3) {
throw new IOException(var3);
}
}
private static String byte2hex(byte[] bytes) {
StringBuilder sign = new StringBuilder();
for (int i = 0; i < bytes.length; ++i) {
String hex = Integer.toHexString(bytes[i] & 255);
if (hex.length() == 1) {
sign.append("0");
}
sign.append(hex.toUpperCase());
}
return sign.toString();
}
public static String getUUID() {
UUID uuid = UUID.randomUUID();
return uuid.toString().toUpperCase();
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.com.glsx.stdinterface.modules.mapper.DeviceJourneyMapper">
<resultMap id="BaseResultMap" type="cn.com.glsx.stdinterface.modules.entity.DeviceJourney">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="sn" jdbcType="VARCHAR" property="sn" />
<result column="vd_id" jdbcType="INTEGER" property="vdId" />
<result column="begin_time" jdbcType="TIMESTAMP" property="beginTime" />
<result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
<result column="begin_address" jdbcType="VARCHAR" property="beginAddress" />
<result column="end_address" jdbcType="VARCHAR" property="endAddress" />
<result column="mileage" jdbcType="INTEGER" property="mileage" />
<result column="del_flag" jdbcType="TINYINT" property="delFlag" />
<result column="created_date" jdbcType="TIMESTAMP" property="createdDate" />
<result column="created_by" jdbcType="INTEGER" property="createdBy" />
<result column="updated_date" jdbcType="TIMESTAMP" property="updatedDate" />
<result column="updated_by" jdbcType="INTEGER" property="updatedBy" />
</resultMap>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
-->
id, sn, vd_id, begin_time, end_time, begin_address, end_address, mileage, del_flag,
created_date, created_by, updated_date, updated_by
</sql>
<select id="selectBySnAndBeginTime" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from t_device_journey
<where>
and sn = #{sn}
and begin_time = #{beginTime}
</where>
limit 1
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.com.glsx.stdinterface.modules.mapper.DeviceJourneyOverviewMapper">
<resultMap id="BaseResultMap" type="cn.com.glsx.stdinterface.modules.entity.DeviceJourneyOverview">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="sn" jdbcType="VARCHAR" property="sn"/>
<result column="vd_id" jdbcType="INTEGER" property="vdId"/>
<result column="total_journey_count" jdbcType="INTEGER" property="totalJourneyCount"/>
<result column="distance" jdbcType="VARCHAR" property="distance"/>
<result column="del_flag" jdbcType="TINYINT" property="delFlag"/>
<result column="created_date" jdbcType="TIMESTAMP" property="createdDate"/>
<result column="created_by" jdbcType="INTEGER" property="createdBy"/>
<result column="updated_date" jdbcType="TIMESTAMP" property="updatedDate"/>
<result column="updated_by" jdbcType="INTEGER" property="updatedBy"/>
</resultMap>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
-->
id, sn, vd_id, total_journey_count, distance, del_flag, created_date, created_by,
updated_date, updated_by
</sql>
<insert id="insertOrSumDistanceAndCount" parameterType="cn.com.glsx.stdinterface.modules.entity.DeviceJourneyOverview">
insert into t_device_journey_overview (sn, vd_id, total_journey_count, distance, created_date, created_by, updated_date, updated_by)
values (#{sn}, #{vdId}, #{totalJourneyCount},#{distance}, #{createdDate},#{createdBy}, #{updatedDate}, #{updatedBy})
ON DUPLICATE key
update
total_journey_count =total_journey_count + #{totalJourneyCount},
distance = distance + #{distance}
</insert>
</mapper>
\ No newline at end of file
package cn.com.glsx.stdinterface.modules.mapper;
import static org.junit.jupiter.api.Assertions.*;
/**
* sql测试
* @author xiangyanlin
* @date 2022/4/8
*/
class DeviceJourneyOverviewMapperTest {
}
\ No newline at end of file
package cn.com.glsx.stdinterface.modules.service;
import cn.com.glsx.Application;
import cn.com.glsx.notify.dto.MailTemplateMessageDTO;
import cn.com.glsx.stdinterface.dto.VehicleDto;
import cn.com.glsx.stdinterface.dto.WorkOrderAddrVerifyBO;
import cn.com.glsx.stdinterface.dto.WorkOrderAddrVerifyDTO;
import cn.com.glsx.stdinterface.modules.entity.Vehicle;
import cn.com.glsx.stdinterface.modules.entity.WorkOrder;
import cn.com.glsx.stdinterface.modules.entity.WorkOrderDocs;
import cn.com.glsx.stdinterface.modules.mapper.WorkOrderDocsMapper;
import cn.com.glsx.stdinterface.modules.model.CommonApiRequest;
import cn.com.glsx.stdinterface.modules.model.WorkOrderInfoBO;
import cn.com.glsx.stdinterface.modules.remote.NotifyCenterService;
import cn.com.glsx.stdinterface.modules.util.Sm4EncryptUtils;
import cn.hutool.core.date.DateUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
......@@ -24,9 +12,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource;
import java.util.List;
@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
......@@ -39,12 +24,12 @@ public class VehicleServiceTest {
public void testddd() {
String sn = "1190909618";
Vehicle vehicle = vehicleService.getVehicleInfoBySn(sn);
if (vehicle!=null) {
if (vehicle != null) {
VehicleDto vehicleDto = new VehicleDto();
vehicleDto.setId(vehicle.getId());
vehicleDto.setVin(vehicle.getVin());
vehicleDto.setCreateBy(vehicle.getCreatedBy());
vehicleDto.setCreateDate((vehicle.getCreatedDate()!=null)? DateUtil.format(vehicle.getCreatedDate(), "yyyy-MM-dd HH:mm:ss"):"");
vehicleDto.setCreateDate((vehicle.getCreatedDate() != null) ? DateUtil.format(vehicle.getCreatedDate(), "yyyy-MM-dd HH:mm:ss") : "");
System.out.println("==" + JSONObject.toJSONString(vehicleDto));
}
System.out.println("end");
......
......@@ -3,6 +3,8 @@ package cn.com.glsx.stdinterface.modules.service;
import cn.com.glsx.Application;
import cn.com.glsx.notify.dto.MailTemplateMessageDTO;
import cn.com.glsx.stdinterface.dto.WorkOrderActivateBO;
import cn.com.glsx.notify.dto.request.MailMessageRequest;
import cn.com.glsx.notify.dto.request.SmsMessageRequest;
import cn.com.glsx.stdinterface.dto.WorkOrderAddrVerifyBO;
import cn.com.glsx.stdinterface.dto.WorkOrderAddrVerifyDTO;
import cn.com.glsx.stdinterface.modules.entity.Vehicle;
......@@ -16,8 +18,10 @@ import cn.com.glsx.stdinterface.modules.remote.NotifyCenterService;
import cn.com.glsx.stdinterface.modules.util.Sm4EncryptUtils;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONObject;
import com.glsx.plat.common.utils.DateUtils;
import com.glsx.plat.mybatis.base.BaseEntity;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
......@@ -26,7 +30,9 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
......@@ -103,8 +109,22 @@ public class WorkOrderServiceTest {
}
@Test
public void testSendSms() {
Map<String, Object> args = Maps.newLinkedHashMap();
args.put("arg1", "AP0235930039");
args.put("arg2", "张三丰");
args.put("arg3", DateUtils.formatNormal(new Date()));
SmsMessageRequest messageRequest = new SmsMessageRequest();
messageRequest.setPhone("18682185876");
messageRequest.setTemplate("SMS_TEMPLATE_ORDER_FINISHED");
messageRequest.setArgs(args);
notifyCenterService.sendSms(messageRequest);
}
@Test
public void testSendMail() {
MailTemplateMessageDTO messageDTO = new MailTemplateMessageDTO();
MailMessageRequest messageDTO = new MailMessageRequest();
messageDTO.setTo("592761523@qq.com");
messageDTO.setTitle("(广联赛讯) 手动安装单-482035297744388096-string");
messageDTO.setContent("租赁公司-广联赛讯;申请编号-482035297744388096;区域-无;设备组合-string;导入时间-2022-02-22;分公司-无;店面名称-string;店面联系电话-string;要求安装日期-2022-02-22;客户姓名-string;车架号-string;颜色-无;车型-null;贷款期限-无;租凭方式-无;安装地址-string;备注—无;安装方式—广联安装;");
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!