This commit is contained in:
liuchengqian 2023-03-06 15:02:14 +08:00
parent b2cb99885d
commit d171bff036
3 changed files with 30 additions and 25 deletions

View File

@ -24,7 +24,6 @@ public class DispatchFirePointController {
@GetMapping("/debug")
public String debug() {
// List<SysUserEntity> sysUserEntityList = sysUserDao.findAll();
// for (SysUserEntity sysUserEntity : sysUserEntityList) {
// String addTime = sysUserEntity.getAddTime();
@ -50,7 +49,6 @@ public class DispatchFirePointController {
return "OKkkkkkkk";
}
/**
* 普通渠道推送火点到秸秆系统
*/

View File

@ -16,8 +16,6 @@ public class FirePointConvertUtils {
AllFirePointVo allFirePointVo = new AllFirePointVo();
allFirePointVo.setId(entity.getId());
allFirePointVo.setFireCode(entity.getFireCode());
allFirePointVo.setCountyCode(entity.getCountyCode());
allFirePointVo.setCountyName(entity.getCountyName());
allFirePointVo.setSatelliteTime(entity.getSatelliteTime());
allFirePointVo.setLongitude(entity.getLongitude());
allFirePointVo.setLatitude(entity.getLatitude());
@ -26,11 +24,18 @@ public class FirePointConvertUtils {
allFirePointVo.setConfidence(entity.getConfidence());
allFirePointVo.setFireImage(entity.getFireImage());
allFirePointVo.setSatelliteImage(entity.getSatelliteImage());
allFirePointVo.setTownCode(entity.getTownCode());
allFirePointVo.setTownName(entity.getTownName());
allFirePointVo.setAddTime(entity.getAddTime());
allFirePointVo.setFirePointAddress(entity.getFirePointAddress());
allFirePointVo.setRemark(entity.getRemark());
allFirePointVo.setPlaceHolder(entity.getPlaceHolder());
allFirePointVo.setProCode(entity.getProCode());
allFirePointVo.setProName(entity.getProName());
allFirePointVo.setCityCode(entity.getCityCode());
allFirePointVo.setCityName(entity.getCityName());
allFirePointVo.setCountyCode(entity.getCountyCode());
allFirePointVo.setCountyName(entity.getCountyName());
allFirePointVo.setTownCode(entity.getTownCode());
allFirePointVo.setTownName(entity.getTownName());
return allFirePointVo;
}
@ -38,8 +43,6 @@ public class FirePointConvertUtils {
AllFirePointVo allFirePointVo = new AllFirePointVo();
allFirePointVo.setId(entity.getId());
allFirePointVo.setFireCode(entity.getFireCode());
allFirePointVo.setCountyCode(entity.getCountyCode());
allFirePointVo.setCountyName(entity.getCountyName());
allFirePointVo.setSatelliteTime(entity.getSatelliteTime());
allFirePointVo.setLongitude(entity.getLongitude());
allFirePointVo.setLatitude(entity.getLatitude());
@ -48,11 +51,18 @@ public class FirePointConvertUtils {
allFirePointVo.setConfidence(entity.getConfidence());
allFirePointVo.setFireImage(entity.getFireImage());
allFirePointVo.setSatelliteImage(entity.getSatelliteImage());
allFirePointVo.setTownCode(entity.getTownCode());
allFirePointVo.setTownName(entity.getTownName());
allFirePointVo.setAddTime(entity.getAddTime());
allFirePointVo.setFirePointAddress(entity.getFirePointAddress());
allFirePointVo.setRemark(entity.getRemark());
allFirePointVo.setPlaceHolder(entity.getPlaceHolder());
allFirePointVo.setProCode(entity.getProCode());
allFirePointVo.setProName(entity.getProName());
allFirePointVo.setCityCode(entity.getCityCode());
allFirePointVo.setCityName(entity.getCityName());
allFirePointVo.setCountyCode(entity.getCountyCode());
allFirePointVo.setCountyName(entity.getCountyName());
allFirePointVo.setTownCode(entity.getTownCode());
allFirePointVo.setTownName(entity.getTownName());
return allFirePointVo;
}

View File

@ -24,8 +24,10 @@ import java.util.List;
public class FirePointPushManager {
public static Logger log = LoggerFactory.getLogger(FirePointPushManager.class);
@Resource
private SysUserDao sysUserDao;
@Resource
private CountyCodeWeiXinDao countyCodeWeiXinDao;
@ -79,14 +81,13 @@ public class FirePointPushManager {
log.info(stringBuilder.toString());
}
}
}
/**
* 发送微信消息
*/
private void sendWeChatGroupMessage(AllFirePointVo firePointEntity) {
private void sendWeChatGroupMessage(AllFirePointVo firePoint) {
List<CountyCodeWeiXinEntity> countyCodeWeiXinList = countyCodeWeiXinDao.findAll();
if (countyCodeWeiXinList.isEmpty()) {
return;
@ -96,7 +97,7 @@ public class FirePointPushManager {
try {
if ((countyCodeWeiXin.getSendState() != null) && (countyCodeWeiXin.getSendState() != 0)) {
String formatCutCode = FirePointCodeUtils.getFormatCutCode(countyCodeWeiXin.getCountyCode());
if (firePointEntity.getTownCode().startsWith(formatCutCode)) {
if (firePoint.getTownCode().startsWith(formatCutCode)) {
weixinIdList.add(countyCodeWeiXin.getWeixinId());
}
}
@ -106,7 +107,14 @@ public class FirePointPushManager {
}
if (weixinIdList.size() > 0) {
StringBuilder stringBuilder = new StringBuilder("发送微信消息通知:\n");
String messageContent = getMessageContent(firePointEntity);
java.text.DecimalFormat decimalFormat = new DecimalFormat("#.000000");
String satelliteTime = firePoint.getSatelliteTime();
String formatLongitude = decimalFormat.format(firePoint.getLongitude());
String formatLatitude = decimalFormat.format(firePoint.getLatitude());
String countyName = firePoint.getCountyName();
String streetName = firePoint.getTownName();
String landType = firePoint.getLandType();
String messageContent = firePoint.getSatelliteType() + "发现1个火点。\n卫星时间" + satelliteTime + "\nlongitude" + formatLongitude + "\nlatitude" + formatLatitude + "\ncountyName" + countyName + "\nstreetName" + streetName + "\nlandType" + landType;
for (String weixinId : weixinIdList) {
stringBuilder.append(weixinId).append("\n");
try {
@ -120,15 +128,4 @@ public class FirePointPushManager {
}
}
private String getMessageContent(AllFirePointVo firePoint) {
java.text.DecimalFormat decimalFormat = new DecimalFormat("#.000000");
String satelliteTime = firePoint.getSatelliteTime();
String formatLongitude = decimalFormat.format(firePoint.getLongitude());
String formatLatitude = decimalFormat.format(firePoint.getLatitude());
String countyName = firePoint.getCountyName();
String streetName = firePoint.getTownName();
String landType = firePoint.getLandType();
return firePoint.getSatelliteType() + "发现1个火点。\n卫星时间" + satelliteTime + "\nlongitude" + formatLongitude + "\nlatitude" + formatLatitude + "\ncountyName" + countyName + "\nstreetName" + streetName + "\nlandType" + landType;
}
}