1.优化微信通知文案
2.按照卫星时间倒序返回火点信息
This commit is contained in:
parent
91d9451f7b
commit
68b514d815
@ -18,6 +18,7 @@ import com.xkrs.service.FirePointService;
|
||||
import com.xkrs.service.StreetService;
|
||||
import com.xkrs.websocket.service.WebSocketServer;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -104,7 +105,7 @@ public class FirePointController {
|
||||
@GetMapping("/queryshandongfirepointlist")
|
||||
public String queryShanDongFirePointList() {
|
||||
Locale locale = LocaleContextHolder.getLocale();
|
||||
List<ShanDongFirePointEntity> shanDongFirePointList = shanDongFirePointDao.findAll();
|
||||
List<ShanDongFirePointEntity> shanDongFirePointList = shanDongFirePointDao.findAll(Sort.by(Sort.Direction.DESC, "satelliteTime"));
|
||||
if (shanDongFirePointList.isEmpty()) {
|
||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时还没有火点数据", locale);
|
||||
}
|
||||
@ -155,7 +156,7 @@ public class FirePointController {
|
||||
Predicate[] predicates = new Predicate[list.size()];
|
||||
return criteriaBuilder.and(list.toArray(predicates));
|
||||
};
|
||||
List<ShanDongFirePointEntity> shanDongFirePointList = shanDongFirePointDao.findAll(specification);
|
||||
List<ShanDongFirePointEntity> shanDongFirePointList = shanDongFirePointDao.findAll(specification, Sort.by(Sort.Direction.DESC, "satelliteTime"));
|
||||
if (shanDongFirePointList.isEmpty()) {
|
||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时还没有火点数据", locale);
|
||||
}
|
||||
|
@ -203,16 +203,8 @@ public class FirePointServiceImpl implements FirePointService {
|
||||
log.info("-------发现新山东火点");
|
||||
ShanDongFirePointEntity savedFirePointEntity = shanDongFirePointDao.save(firePointEntity);
|
||||
try {//微信消息通知工作组
|
||||
java.text.DecimalFormat decimalFormat = new DecimalFormat("#.000000");
|
||||
String formatLongitude = decimalFormat.format(firePointEntity.getLongitude());
|
||||
String formatLatitude = decimalFormat.format(firePointEntity.getLatitude());
|
||||
String countyName = firePointEntity.getCountyName();
|
||||
String content = firePointEntity.getSatelliteType() + "发现1个火点。\nlongitude:" + formatLongitude + ";\nlatitude:" + formatLatitude + ";\ncountyName:" + countyName;
|
||||
try {
|
||||
WDWxSendMsgUtil.sendMsg("18447024917@chatroom", content, 0);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
String messageContent = getMessageContent(firePointEntity);
|
||||
WDWxSendMsgUtil.sendMsg("18447024917@chatroom", messageContent, 0);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -350,14 +342,10 @@ public class FirePointServiceImpl implements FirePointService {
|
||||
}
|
||||
}
|
||||
if (weixinIdList.size() > 0) {
|
||||
java.text.DecimalFormat decimalFormat = new DecimalFormat("#.000000");
|
||||
String formatLongitude = decimalFormat.format(firePointEntity.getLongitude());
|
||||
String formatLatitude = decimalFormat.format(firePointEntity.getLatitude());
|
||||
String countyName = firePointEntity.getCountyName();
|
||||
String content = firePointEntity.getSatelliteType() + "发现1个火点。\nlongitude:" + formatLongitude + ";\nlatitude:" + formatLatitude + ";\ncountyName:" + countyName;
|
||||
String messageContent = getMessageContent(firePointEntity);
|
||||
for (String weixinId : weixinIdList) {
|
||||
try {
|
||||
WDWxSendMsgUtil.sendMsg(weixinId, content, 0);
|
||||
WDWxSendMsgUtil.sendMsg(weixinId, messageContent, 0);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -365,6 +353,26 @@ public class FirePointServiceImpl implements FirePointService {
|
||||
}
|
||||
}
|
||||
|
||||
private String getMessageContent(FirePointEntity firePointEntity) {
|
||||
java.text.DecimalFormat decimalFormat = new DecimalFormat("#.000000");
|
||||
String satelliteTime = firePointEntity.getSatelliteTime();
|
||||
String formatLongitude = decimalFormat.format(firePointEntity.getLongitude());
|
||||
String formatLatitude = decimalFormat.format(firePointEntity.getLatitude());
|
||||
String countyName = firePointEntity.getCountyName();
|
||||
String content = firePointEntity.getSatelliteType() + "发现1个火点。\n卫星时间:" + satelliteTime + ";\nlongitude:" + formatLongitude + ";\nlatitude:" + formatLatitude + ";\ncountyName:" + countyName;
|
||||
return content;
|
||||
}
|
||||
|
||||
private String getMessageContent(ShanDongFirePointEntity firePointEntity) {
|
||||
java.text.DecimalFormat decimalFormat = new DecimalFormat("#.000000");
|
||||
String satelliteTime = firePointEntity.getSatelliteTime();
|
||||
String formatLongitude = decimalFormat.format(firePointEntity.getLongitude());
|
||||
String formatLatitude = decimalFormat.format(firePointEntity.getLatitude());
|
||||
String countyName = firePointEntity.getCountyName();
|
||||
String content = firePointEntity.getSatelliteType() + "发现1个待审核火点。\n卫星时间:" + satelliteTime + ";\nlongitude:" + formatLongitude + ";\nlatitude:" + formatLatitude + ";\ncountyName:" + countyName;
|
||||
return content;
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送短信消息
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user