Compare commits
11 Commits
master
...
branch_fir
Author | SHA1 | Date | |
---|---|---|---|
3d9286ed3b | |||
e47c724a30 | |||
560105d2ca | |||
aba3b12135 | |||
aac7a6d750 | |||
7ff3b089d6 | |||
a0d1c6422a | |||
125aec00a9 | |||
8aa7fd11eb | |||
97a8e9c6c2 | |||
bfd418e174 |
@ -83,6 +83,10 @@ public class CustomAuthenticationProvider implements AuthenticationProvider {
|
|||||||
throw new DisabledException("用户状态不正常,请联系管理员");
|
throw new DisabledException("用户状态不正常,请联系管理员");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (DateTimeUtil.dateTimeToString(LocalDateTime.now()).compareTo(userEntity.getOverTime()) > 0) {
|
||||||
|
throw new DisabledException("该账号已过期,请联系管理员");
|
||||||
|
}
|
||||||
|
|
||||||
// 认证逻辑
|
// 认证逻辑
|
||||||
String encryptPassword = encry256(password + userEntity.getSalt());
|
String encryptPassword = encry256(password + userEntity.getSalt());
|
||||||
if (encryptPassword.equals(userEntity.getPassword())) {
|
if (encryptPassword.equals(userEntity.getPassword())) {
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
package com.xkrs.common.config;
|
|
||||||
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.security.config.annotation.web.messaging.MessageSecurityMetadataSourceRegistry;
|
|
||||||
import org.springframework.security.config.annotation.web.socket.AbstractSecurityWebSocketMessageBrokerConfigurer;
|
|
||||||
|
|
||||||
import static org.springframework.messaging.simp.SimpMessageType.MESSAGE;
|
|
||||||
import static org.springframework.messaging.simp.SimpMessageType.SUBSCRIBE;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author xkrs
|
|
||||||
*/
|
|
||||||
@Configuration
|
|
||||||
public class WebSocketSecurityConfig extends AbstractSecurityWebSocketMessageBrokerConfigurer {
|
|
||||||
@Override
|
|
||||||
protected void configureInbound(MessageSecurityMetadataSourceRegistry messages) {
|
|
||||||
messages
|
|
||||||
.nullDestMatcher().authenticated()
|
|
||||||
.simpSubscribeDestMatchers("/user/queue/errors").permitAll()
|
|
||||||
.simpTypeMatchers(MESSAGE, SUBSCRIBE).denyAll()
|
|
||||||
.anyMessage().denyAll();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -44,7 +44,7 @@ public class FirePointQo {
|
|||||||
/**
|
/**
|
||||||
* 植被类型
|
* 植被类型
|
||||||
*/
|
*/
|
||||||
private String landType;
|
private String landtype;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 置信度
|
* 置信度
|
||||||
@ -64,7 +64,7 @@ public class FirePointQo {
|
|||||||
/**
|
/**
|
||||||
* 乡镇街道区划编码
|
* 乡镇街道区划编码
|
||||||
*/
|
*/
|
||||||
private String townCode;
|
private String towncode;
|
||||||
|
|
||||||
public FirePointQo() {
|
public FirePointQo() {
|
||||||
}
|
}
|
||||||
@ -125,12 +125,12 @@ public class FirePointQo {
|
|||||||
this.satelliteType = satelliteType;
|
this.satelliteType = satelliteType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLandType() {
|
public String getLandtype() {
|
||||||
return landType;
|
return landtype;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLandType(String landType) {
|
public void setLandtype(String landtype) {
|
||||||
this.landType = landType;
|
this.landtype = landtype;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getConfidence() {
|
public String getConfidence() {
|
||||||
@ -157,29 +157,16 @@ public class FirePointQo {
|
|||||||
this.satelliteImage = satelliteImage;
|
this.satelliteImage = satelliteImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTownCode() {
|
public String getTowncode() {
|
||||||
return townCode;
|
return towncode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTownCode(String townCode) {
|
public void setTowncode(String towncode) {
|
||||||
this.townCode = townCode;
|
this.towncode = towncode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "FirePointQo{" +
|
return "FirePointQo{" + "fireCode='" + fireCode + '\'' + ", countyCode=" + countyCode + ", countyName='" + countyName + '\'' + ", satelliteTimeTs=" + satelliteTimeTs + ", longitude=" + longitude + ", latitude=" + latitude + ", satelliteType='" + satelliteType + '\'' + ", landtype='" + landtype + '\'' + ", confidence='" + confidence + '\'' + ", fireImage='" + fireImage + '\'' + ", satelliteImage='" + satelliteImage + '\'' + ", towncode='" + towncode + '\'' + '}';
|
||||||
"fireCode='" + fireCode + '\'' +
|
|
||||||
", countyCode=" + countyCode +
|
|
||||||
", countyName='" + countyName + '\'' +
|
|
||||||
", satelliteTimeTs=" + satelliteTimeTs +
|
|
||||||
", longitude=" + longitude +
|
|
||||||
", latitude=" + latitude +
|
|
||||||
", satelliteType='" + satelliteType + '\'' +
|
|
||||||
", landType='" + landType + '\'' +
|
|
||||||
", confidence='" + confidence + '\'' +
|
|
||||||
", fireImage='" + fireImage + '\'' +
|
|
||||||
", satelliteImage='" + satelliteImage + '\'' +
|
|
||||||
", townCode='" + townCode + '\'' +
|
|
||||||
'}';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -90,14 +90,15 @@ public class FirePointServiceImpl implements FirePointService {
|
|||||||
@CacheEvict(value = "FirePointServiceCache", allEntries = true)
|
@CacheEvict(value = "FirePointServiceCache", allEntries = true)
|
||||||
@Override
|
@Override
|
||||||
public boolean insertFirePoint(FirePointQo firePointQo) {
|
public boolean insertFirePoint(FirePointQo firePointQo) {
|
||||||
if ("水体".equals(firePointQo.getLandType())) {
|
if ("水体".equals(firePointQo.getLandtype())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ("Himawari 8".equals(firePointQo.getSatelliteType())) {
|
if ("Himawari 8".equals(firePointQo.getSatelliteType())) {
|
||||||
if ("N".equals(firePointQo.getConfidence()) || "L".equals(firePointQo.getConfidence())) {
|
if ("L".equals(firePointQo.getConfidence()) || "N".equals(firePointQo.getConfidence())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FirePointEntity firePointEntity = new FirePointEntity();
|
FirePointEntity firePointEntity = new FirePointEntity();
|
||||||
firePointEntity.setFireCode(firePointQo.getFireCode());
|
firePointEntity.setFireCode(firePointQo.getFireCode());
|
||||||
firePointEntity.setCountyCode(firePointQo.getCountyCode().toString());
|
firePointEntity.setCountyCode(firePointQo.getCountyCode().toString());
|
||||||
@ -106,7 +107,7 @@ public class FirePointServiceImpl implements FirePointService {
|
|||||||
firePointEntity.setLongitude(firePointQo.getLongitude());
|
firePointEntity.setLongitude(firePointQo.getLongitude());
|
||||||
firePointEntity.setLatitude(firePointQo.getLatitude());
|
firePointEntity.setLatitude(firePointQo.getLatitude());
|
||||||
firePointEntity.setSatelliteType(firePointQo.getSatelliteType());
|
firePointEntity.setSatelliteType(firePointQo.getSatelliteType());
|
||||||
firePointEntity.setLandType(firePointQo.getLandType());
|
firePointEntity.setLandType(firePointQo.getLandtype());
|
||||||
firePointEntity.setConfidence(firePointQo.getConfidence());
|
firePointEntity.setConfidence(firePointQo.getConfidence());
|
||||||
firePointEntity.setAddTime(dateTimeToString(LocalDateTime.now()));
|
firePointEntity.setAddTime(dateTimeToString(LocalDateTime.now()));
|
||||||
firePointEntity.setFireType("0");
|
firePointEntity.setFireType("0");
|
||||||
@ -120,6 +121,8 @@ public class FirePointServiceImpl implements FirePointService {
|
|||||||
}
|
}
|
||||||
log.info("-------发现新火点");
|
log.info("-------发现新火点");
|
||||||
firePointDao.save(firePointEntity);
|
firePointDao.save(firePointEntity);
|
||||||
|
//发送消息通知
|
||||||
|
sendBroadcast(firePointEntity);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -291,18 +294,7 @@ public class FirePointServiceImpl implements FirePointService {
|
|||||||
String countyName = firePointEntity.getCountyName();
|
String countyName = firePointEntity.getCountyName();
|
||||||
String streetName = firePointEntity.getStreetName();
|
String streetName = firePointEntity.getStreetName();
|
||||||
String landType = firePointEntity.getLandType();
|
String landType = firePointEntity.getLandType();
|
||||||
return firePointEntity.getSatelliteType() + "发现1个火点。\n卫星时间:" + satelliteTime + ";\nlongitude:" + formatLongitude + ";\nlatitude:" + formatLatitude + ";\ncountyName:" + countyName + ";\nstreetName:" + streetName + ";\nlandType:" + landType;
|
return "星巡-全国火情播报系统\n" + firePointEntity.getSatelliteType() + "发现1个火点。\n卫星时间:" + satelliteTime + ";\nlongitude:" + formatLongitude + ";\nlatitude:" + formatLatitude + ";\ncountyName:" + countyName + ";\nstreetName:" + streetName + ";\nlandType:" + landType;
|
||||||
}
|
|
||||||
|
|
||||||
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 streetName = firePointEntity.getStreetName();
|
|
||||||
String landType = firePointEntity.getLandType();
|
|
||||||
return firePointEntity.getSatelliteType() + "发现1个待审核火点。\n卫星时间:" + satelliteTime + ";\nlongitude:" + formatLongitude + ";\nlatitude:" + formatLatitude + ";\ncountyName:" + countyName + ";\nstreetName:" + streetName + ";\nlandType:" + landType;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -111,15 +111,15 @@ public class StreetServiceImpl implements StreetService {
|
|||||||
// RegionBean countyBean = new RegionBean();
|
// RegionBean countyBean = new RegionBean();
|
||||||
// countyBean.setCode(county.get("code"));
|
// countyBean.setCode(county.get("code"));
|
||||||
// countyBean.setName(county.get("name"));
|
// countyBean.setName(county.get("name"));
|
||||||
//// List<Map<String, String>> streetList = selectStreetList(county.get("name"));
|
// List<Map<String, String>> streetList = selectStreetList(county.get("code"));
|
||||||
//// List<RegionBean> streetBeanList = new ArrayList<>();
|
// List<RegionBean> streetBeanList = new ArrayList<>();
|
||||||
//// for (Map<String, String> street : streetList) {
|
// for (Map<String, String> street : streetList) {
|
||||||
//// RegionBean streetBean = new RegionBean();
|
// RegionBean streetBean = new RegionBean();
|
||||||
//// streetBean.setCode(street.get("code"));
|
// streetBean.setCode(street.get("code"));
|
||||||
//// streetBean.setName(street.get("name"));
|
// streetBean.setName(street.get("name"));
|
||||||
//// streetBeanList.add(streetBean);
|
// streetBeanList.add(streetBean);
|
||||||
//// }
|
// }
|
||||||
//// countyBean.setChildren(streetBeanList);
|
// countyBean.setChildren(streetBeanList);
|
||||||
// countyBeanList.add(countyBean);
|
// countyBeanList.add(countyBean);
|
||||||
// }
|
// }
|
||||||
// cityBean.setChildren(countyBeanList);
|
// cityBean.setChildren(countyBeanList);
|
||||||
|
@ -126,6 +126,7 @@ public class SysUserServiceImpl implements SysUserService {
|
|||||||
|
|
||||||
String countyCode = sysUserQo.getCountyCode();
|
String countyCode = sysUserQo.getCountyCode();
|
||||||
String countyName = sysUserQo.getCountyName();
|
String countyName = sysUserQo.getCountyName();
|
||||||
|
countyName = adapterCountyNameByCountyCode(countyCode);
|
||||||
if (TextUtils.isEmpty(countyCode)) {
|
if (TextUtils.isEmpty(countyCode)) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "省市区街道编码不能为空!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "省市区街道编码不能为空!", locale);
|
||||||
}
|
}
|
||||||
@ -141,8 +142,10 @@ public class SysUserServiceImpl implements SysUserService {
|
|||||||
if (streetNameList == null || streetNameList.isEmpty()) {
|
if (streetNameList == null || streetNameList.isEmpty()) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "您所选择的区域不存在!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "您所选择的区域不存在!", locale);
|
||||||
}
|
}
|
||||||
sysUserEntity.setActiveFlag(0);
|
|
||||||
sysUserEntity.setAccountType("街道级");
|
sysUserEntity.setAccountType("街道级");
|
||||||
|
sysUserEntity.setActiveFlag(0);
|
||||||
|
sysUserEntity.setOverTime(dateTimeToString(LocalDateTime.now().plusDays(7L)));
|
||||||
|
adapterStreetUser(sysUserEntity);
|
||||||
} else if ("0000".equals(countyCode.substring(2))) {
|
} else if ("0000".equals(countyCode.substring(2))) {
|
||||||
List<StreetEntity> proCodeList = streetDao.findByProCode(countyCode);
|
List<StreetEntity> proCodeList = streetDao.findByProCode(countyCode);
|
||||||
if (proCodeList == null || proCodeList.size() == 0) {
|
if (proCodeList == null || proCodeList.size() == 0) {
|
||||||
@ -152,8 +155,10 @@ public class SysUserServiceImpl implements SysUserService {
|
|||||||
if (proNameList == null || proNameList.size() == 0) {
|
if (proNameList == null || proNameList.size() == 0) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "您所选择的区域不存在!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "您所选择的区域不存在!", locale);
|
||||||
}
|
}
|
||||||
sysUserEntity.setActiveFlag(1);
|
|
||||||
sysUserEntity.setAccountType("省级");
|
sysUserEntity.setAccountType("省级");
|
||||||
|
sysUserEntity.setActiveFlag(1);
|
||||||
|
sysUserEntity.setOverTime(dateTimeToString(LocalDateTime.now().plusDays(5L)));
|
||||||
|
// adapterProUser(sysUserEntity);
|
||||||
} else if ("00".equals(countyCode.substring(4)) && !"0000".equals(countyCode.substring(2))) {
|
} else if ("00".equals(countyCode.substring(4)) && !"0000".equals(countyCode.substring(2))) {
|
||||||
List<StreetEntity> cityCodeList = streetDao.findByCityCode(countyCode);
|
List<StreetEntity> cityCodeList = streetDao.findByCityCode(countyCode);
|
||||||
if (cityCodeList == null || cityCodeList.size() == 0) {
|
if (cityCodeList == null || cityCodeList.size() == 0) {
|
||||||
@ -163,8 +168,10 @@ public class SysUserServiceImpl implements SysUserService {
|
|||||||
if (cityNameList == null || cityNameList.size() == 0) {
|
if (cityNameList == null || cityNameList.size() == 0) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "您所选择的区域不存在!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "您所选择的区域不存在!", locale);
|
||||||
}
|
}
|
||||||
sysUserEntity.setActiveFlag(1);
|
|
||||||
sysUserEntity.setAccountType("市级");
|
sysUserEntity.setAccountType("市级");
|
||||||
|
sysUserEntity.setActiveFlag(1);
|
||||||
|
sysUserEntity.setOverTime(dateTimeToString(LocalDateTime.now().plusDays(5L)));
|
||||||
|
adapterCityUser(sysUserEntity);
|
||||||
} else {
|
} else {
|
||||||
List<StreetEntity> countyCodeList = streetDao.findByCountyCode(countyCode);
|
List<StreetEntity> countyCodeList = streetDao.findByCountyCode(countyCode);
|
||||||
if (countyCodeList == null || countyCodeList.isEmpty()) {
|
if (countyCodeList == null || countyCodeList.isEmpty()) {
|
||||||
@ -174,13 +181,10 @@ public class SysUserServiceImpl implements SysUserService {
|
|||||||
if (countyNameList == null || countyNameList.isEmpty()) {
|
if (countyNameList == null || countyNameList.isEmpty()) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "您所选择的区域不存在!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "您所选择的区域不存在!", locale);
|
||||||
}
|
}
|
||||||
sysUserEntity.setActiveFlag(0);
|
|
||||||
sysUserEntity.setAccountType("县级");
|
sysUserEntity.setAccountType("县级");
|
||||||
}
|
sysUserEntity.setActiveFlag(0);
|
||||||
if (9 == countyCode.length()) {//街道账号7天后过期
|
|
||||||
sysUserEntity.setOverTime(dateTimeToString(LocalDateTime.now().plusDays(7L)));
|
|
||||||
} else {//省市区县账号5天后过期
|
|
||||||
sysUserEntity.setOverTime(dateTimeToString(LocalDateTime.now().plusDays(5L)));
|
sysUserEntity.setOverTime(dateTimeToString(LocalDateTime.now().plusDays(5L)));
|
||||||
|
adapterCountyUser(sysUserEntity);
|
||||||
}
|
}
|
||||||
sysUserEntity.setStatusCode(0);
|
sysUserEntity.setStatusCode(0);
|
||||||
sysUserEntity.setAddTime(dateTimeToString(LocalDateTime.now()));
|
sysUserEntity.setAddTime(dateTimeToString(LocalDateTime.now()));
|
||||||
@ -209,6 +213,81 @@ public class SysUserServiceImpl implements SysUserService {
|
|||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "注册成功!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "注册成功!", locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String adapterCountyNameByCountyCode(String countyCode) {
|
||||||
|
if (9 == countyCode.length()) {
|
||||||
|
List<StreetEntity> streetCodeList = streetDao.findByStreetCode(countyCode);
|
||||||
|
if (streetCodeList == null || streetCodeList.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return streetCodeList.get(0).getStreetName();
|
||||||
|
} else if ("0000".equals(countyCode.substring(2))) {
|
||||||
|
List<StreetEntity> proCodeList = streetDao.findByProCode(countyCode);
|
||||||
|
if (proCodeList == null || proCodeList.size() == 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return proCodeList.get(0).getProName();
|
||||||
|
} else if ("00".equals(countyCode.substring(4)) && !"0000".equals(countyCode.substring(2))) {
|
||||||
|
List<StreetEntity> cityCodeList = streetDao.findByCityCode(countyCode);
|
||||||
|
if (cityCodeList == null || cityCodeList.size() == 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return cityCodeList.get(0).getCityName();
|
||||||
|
} else {
|
||||||
|
List<StreetEntity> countyCodeList = streetDao.findByCountyCode(countyCode);
|
||||||
|
if (countyCodeList == null || countyCodeList.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return countyCodeList.get(0).getCountyName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 适配2023-11-09到2023-11-12之间注册的街道用户
|
||||||
|
*/
|
||||||
|
private void adapterStreetUser(SysUserEntity sysUserEntity) {
|
||||||
|
if (in1109To1112()) {
|
||||||
|
sysUserEntity.setActiveFlag(0);
|
||||||
|
sysUserEntity.setOverTime(dateTimeToString(LocalDateTime.now().plusDays(180L)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// private void adapterProUser(SysUserEntity sysUserEntity) {
|
||||||
|
// if (in1109To1112()) {
|
||||||
|
// sysUserEntity.setActiveFlag(1);
|
||||||
|
// sysUserEntity.setOverTime(dateTimeToString(LocalDateTime.now().plusDays(5L)));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 适配2023-11-09到2023-11-12之间注册的市级用户
|
||||||
|
*/
|
||||||
|
private void adapterCityUser(SysUserEntity sysUserEntity) {
|
||||||
|
if (in1109To1112()) {
|
||||||
|
sysUserEntity.setActiveFlag(0);
|
||||||
|
sysUserEntity.setOverTime(dateTimeToString(LocalDateTime.now().plusDays(30L)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 适配2023-11-09到2023-11-12之间注册的区县用户
|
||||||
|
*/
|
||||||
|
private void adapterCountyUser(SysUserEntity sysUserEntity) {
|
||||||
|
if (in1109To1112()) {
|
||||||
|
sysUserEntity.setActiveFlag(0);
|
||||||
|
sysUserEntity.setOverTime(dateTimeToString(LocalDateTime.now().plusDays(30L)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断当前是否处于2023-11-09到2023-11-12之间注册的
|
||||||
|
*/
|
||||||
|
private boolean in1109To1112() {
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
LocalDateTime start1109 = LocalDateTime.of(2023, 11, 9, 0, 0, 0, 0);
|
||||||
|
LocalDateTime end1112 = LocalDateTime.of(2023, 11, 13, 0, 0, 0, 0);
|
||||||
|
return start1109.isBefore(now) && end1112.isAfter(now);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增用户
|
* 新增用户
|
||||||
*
|
*
|
||||||
@ -247,8 +326,9 @@ public class SysUserServiceImpl implements SysUserService {
|
|||||||
if (streetNameList == null || streetNameList.isEmpty()) {
|
if (streetNameList == null || streetNameList.isEmpty()) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "您所选择的区域不存在!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "您所选择的区域不存在!", locale);
|
||||||
}
|
}
|
||||||
sysUserEntity.setActiveFlag(0);
|
|
||||||
sysUserEntity.setAccountType("街道级");
|
sysUserEntity.setAccountType("街道级");
|
||||||
|
sysUserEntity.setActiveFlag(0);
|
||||||
|
sysUserEntity.setOverTime(dateTimeToString(LocalDateTime.now().plusDays(7L)));
|
||||||
} else if ("0000".equals(countyCode.substring(2))) {
|
} else if ("0000".equals(countyCode.substring(2))) {
|
||||||
List<StreetEntity> proCodeList = streetDao.findByProCode(countyCode);
|
List<StreetEntity> proCodeList = streetDao.findByProCode(countyCode);
|
||||||
if (proCodeList == null || proCodeList.size() == 0) {
|
if (proCodeList == null || proCodeList.size() == 0) {
|
||||||
@ -258,8 +338,9 @@ public class SysUserServiceImpl implements SysUserService {
|
|||||||
if (proNameList == null || proNameList.size() == 0) {
|
if (proNameList == null || proNameList.size() == 0) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "您所选择的区域不存在!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "您所选择的区域不存在!", locale);
|
||||||
}
|
}
|
||||||
sysUserEntity.setActiveFlag(1);
|
|
||||||
sysUserEntity.setAccountType("省级");
|
sysUserEntity.setAccountType("省级");
|
||||||
|
sysUserEntity.setActiveFlag(1);
|
||||||
|
sysUserEntity.setOverTime(dateTimeToString(LocalDateTime.now().plusDays(5L)));
|
||||||
} else if ("00".equals(countyCode.substring(4)) && !"0000".equals(countyCode.substring(2))) {
|
} else if ("00".equals(countyCode.substring(4)) && !"0000".equals(countyCode.substring(2))) {
|
||||||
List<StreetEntity> cityCodeList = streetDao.findByCityCode(countyCode);
|
List<StreetEntity> cityCodeList = streetDao.findByCityCode(countyCode);
|
||||||
if (cityCodeList == null || cityCodeList.size() == 0) {
|
if (cityCodeList == null || cityCodeList.size() == 0) {
|
||||||
@ -269,8 +350,9 @@ public class SysUserServiceImpl implements SysUserService {
|
|||||||
if (cityNameList == null || cityNameList.size() == 0) {
|
if (cityNameList == null || cityNameList.size() == 0) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "您所选择的区域不存在!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "您所选择的区域不存在!", locale);
|
||||||
}
|
}
|
||||||
sysUserEntity.setActiveFlag(1);
|
|
||||||
sysUserEntity.setAccountType("市级");
|
sysUserEntity.setAccountType("市级");
|
||||||
|
sysUserEntity.setActiveFlag(1);
|
||||||
|
sysUserEntity.setOverTime(dateTimeToString(LocalDateTime.now().plusDays(5L)));
|
||||||
} else {
|
} else {
|
||||||
List<StreetEntity> countyCodeList = streetDao.findByCountyCode(countyCode);
|
List<StreetEntity> countyCodeList = streetDao.findByCountyCode(countyCode);
|
||||||
if (countyCodeList == null || countyCodeList.isEmpty()) {
|
if (countyCodeList == null || countyCodeList.isEmpty()) {
|
||||||
@ -280,12 +362,8 @@ public class SysUserServiceImpl implements SysUserService {
|
|||||||
if (countyNameList == null || countyNameList.isEmpty()) {
|
if (countyNameList == null || countyNameList.isEmpty()) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "您所选择的区域不存在!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "您所选择的区域不存在!", locale);
|
||||||
}
|
}
|
||||||
sysUserEntity.setActiveFlag(0);
|
|
||||||
sysUserEntity.setAccountType("县级");
|
sysUserEntity.setAccountType("县级");
|
||||||
}
|
sysUserEntity.setActiveFlag(0);
|
||||||
if (9 == countyCode.length()) {//街道账号7天后过期
|
|
||||||
sysUserEntity.setOverTime(dateTimeToString(LocalDateTime.now().plusDays(7L)));
|
|
||||||
} else {//省市区县账号5天后过期
|
|
||||||
sysUserEntity.setOverTime(dateTimeToString(LocalDateTime.now().plusDays(5L)));
|
sysUserEntity.setOverTime(dateTimeToString(LocalDateTime.now().plusDays(5L)));
|
||||||
}
|
}
|
||||||
sysUserEntity.setStatusCode(0);
|
sysUserEntity.setStatusCode(0);
|
||||||
|
@ -19,9 +19,9 @@ public class AliYunSmsUtils {
|
|||||||
//产品域名,开发者无需替换
|
//产品域名,开发者无需替换
|
||||||
String domain = "dysmsapi.aliyuncs.com";
|
String domain = "dysmsapi.aliyuncs.com";
|
||||||
//此处需要替换成开发者自己的AK(在阿里云访问控制台寻找)
|
//此处需要替换成开发者自己的AK(在阿里云访问控制台寻找)
|
||||||
String accessKeyId = "LTAI5tMSjLfu8Xu2w6WeguFF";
|
String accessKeyId = "LTAI5tMa5Va4CSwFwXxKpKfc";
|
||||||
//修改成自己的
|
//修改成自己的
|
||||||
String accessKeySecret = "hvqM5zpi72hvX4VXM71wq6AE0XYtDI";
|
String accessKeySecret = "PIUhRNVcApBF3H8TzU8pM1ZI6fjvWQ";
|
||||||
//可自助调整超时时间
|
//可自助调整超时时间
|
||||||
System.setProperty("sun.net.client.defaultConnectTimeout", "10000");
|
System.setProperty("sun.net.client.defaultConnectTimeout", "10000");
|
||||||
System.setProperty("sun.net.client.defaultReadTimeout", "10000");
|
System.setProperty("sun.net.client.defaultReadTimeout", "10000");
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
package com.xkrs.websocket.config;
|
|
||||||
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.messaging.simp.config.MessageBrokerRegistry;
|
|
||||||
import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
|
|
||||||
import org.springframework.web.socket.config.annotation.StompEndpointRegistry;
|
|
||||||
import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* websocket广播配置
|
|
||||||
* @author xkrs
|
|
||||||
*/
|
|
||||||
@Configuration
|
|
||||||
@EnableWebSocketMessageBroker
|
|
||||||
public class WebSocketBrokerConfig implements WebSocketMessageBrokerConfigurer {
|
|
||||||
@Override
|
|
||||||
public void registerStompEndpoints(StompEndpointRegistry registry) {
|
|
||||||
registry.addEndpoint("/endPointClientServer").withSockJS();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void configureMessageBroker(MessageBrokerRegistry registry) {
|
|
||||||
registry.enableSimpleBroker("/ws");
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
package com.xkrs.websocket.config;
|
|
||||||
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author xkrs
|
|
||||||
*/
|
|
||||||
@Configuration
|
|
||||||
public class WebSocketConfig {
|
|
||||||
@Bean
|
|
||||||
public ServerEndpointExporter serverEndpointExporter(){
|
|
||||||
return new ServerEndpointExporter();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
package com.xkrs.websocket.controller;
|
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author xkrs
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/test")
|
|
||||||
public class TestController {
|
|
||||||
|
|
||||||
@GetMapping("/hello")
|
|
||||||
public String sayHello(){
|
|
||||||
return "asdasd";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,24 +0,0 @@
|
|||||||
package com.xkrs.websocket.controller.websocket;
|
|
||||||
|
|
||||||
import com.xkrs.websocket.service.WebSocketServer;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author xkrs
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/api/socket")
|
|
||||||
public class WebSocketController {
|
|
||||||
|
|
||||||
@GetMapping("/sendAll")
|
|
||||||
public String sendAll(@RequestParam String msg) {
|
|
||||||
WebSocketServer.broadInfo(msg);
|
|
||||||
return "success";
|
|
||||||
}
|
|
||||||
|
|
||||||
@RequestMapping(value = "/sendOne", method = RequestMethod.GET)
|
|
||||||
public String sendOne(@RequestParam String msg, @RequestParam String session) {
|
|
||||||
WebSocketServer.sendMsg(msg, session);
|
|
||||||
return "success";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
package com.xkrs.websocket.controller.websocketbroker;
|
|
||||||
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
|
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author xkrs
|
|
||||||
*/
|
|
||||||
@Configuration
|
|
||||||
public class ViewController extends WebMvcConfigurerAdapter {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addViewControllers(ViewControllerRegistry registry) {
|
|
||||||
registry.addViewController("/ws").setViewName("/ws");
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
package com.xkrs.websocket.controller.websocketbroker;
|
|
||||||
|
|
||||||
import com.xkrs.websocket.websocket.ClientServerMessage;
|
|
||||||
import com.xkrs.websocket.websocket.ServerClientMessage;
|
|
||||||
import org.springframework.messaging.handler.annotation.MessageMapping;
|
|
||||||
import org.springframework.messaging.handler.annotation.SendTo;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author xkrs
|
|
||||||
*/
|
|
||||||
@Controller
|
|
||||||
public class WebSocketBrokerController {
|
|
||||||
|
|
||||||
@MessageMapping("/hello")
|
|
||||||
@SendTo("/ws/getResponse")
|
|
||||||
public ServerClientMessage say(ClientServerMessage message) throws InterruptedException {
|
|
||||||
Thread.sleep(3000);
|
|
||||||
return new ServerClientMessage("hello," + message.getName() + "!");
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,128 +0,0 @@
|
|||||||
package com.xkrs.websocket.service;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
|
||||||
import javax.websocket.*;
|
|
||||||
import javax.websocket.server.ServerEndpoint;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.CopyOnWriteArraySet;
|
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author xkrs
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
@ServerEndpoint(value = "/ws/asset")
|
|
||||||
public class WebSocketServer {
|
|
||||||
|
|
||||||
@PostConstruct
|
|
||||||
public void init() {
|
|
||||||
System.out.println("websocketBroker loading......");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Logger log = LoggerFactory.getLogger(WebSocketServer.class);
|
|
||||||
private static final AtomicInteger ONLINE_COUNT = new AtomicInteger(0);
|
|
||||||
private static CopyOnWriteArraySet<Session> sessionSet = new CopyOnWriteArraySet<>();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 连接建立
|
|
||||||
*/
|
|
||||||
@OnOpen
|
|
||||||
public void onOpen(Session session) {
|
|
||||||
sessionSet.add(session);
|
|
||||||
//在线加1
|
|
||||||
int cnt = ONLINE_COUNT.incrementAndGet();
|
|
||||||
//log.info("have a new connect:{}", cnt);
|
|
||||||
//sendMsg(session, "connect success");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 连接关闭
|
|
||||||
*
|
|
||||||
* @param session
|
|
||||||
*/
|
|
||||||
@OnClose
|
|
||||||
public void onClose(Session session) {
|
|
||||||
sessionSet.remove(session);
|
|
||||||
//在线减1
|
|
||||||
int cnt = ONLINE_COUNT.decrementAndGet();
|
|
||||||
log.info("have a connect close:{}", cnt);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 收到客户端消息后调用的方法
|
|
||||||
*
|
|
||||||
* @param session
|
|
||||||
* @param msg
|
|
||||||
*/
|
|
||||||
@OnMessage
|
|
||||||
public void onMessage(String msg, Session session) {
|
|
||||||
log.info("receive the msg:{}", msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void sendMsg(Session session, String msg) {
|
|
||||||
try {
|
|
||||||
session.getBasicRemote().sendText(String.format(msg));
|
|
||||||
} catch (IOException e) {
|
|
||||||
log.error("发送信息出错:{}", e.getMessage());
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void sendDate(Session session, Map map) {
|
|
||||||
try {
|
|
||||||
session.getBasicRemote().sendObject(map);
|
|
||||||
} catch (IOException | EncodeException e) {
|
|
||||||
log.error("发送信息出错:{}", e.getMessage());
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 指定session发送
|
|
||||||
*/
|
|
||||||
public static void sendMsg(String msg, String sessionId) {
|
|
||||||
Session session = null;
|
|
||||||
for (Session s : sessionSet) {
|
|
||||||
if (s.getId().equals(sessionId)) {
|
|
||||||
session = s;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (session != null) {
|
|
||||||
sendMsg(session, msg);
|
|
||||||
} else {
|
|
||||||
log.warn("not find your session");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 群发消息
|
|
||||||
*/
|
|
||||||
public static void broadInfo(String msg) {
|
|
||||||
for (Session s : sessionSet) {
|
|
||||||
synchronized (sessionSet){
|
|
||||||
if (s.isOpen()) {
|
|
||||||
sendMsg(s, msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 群发map消息
|
|
||||||
* @param map
|
|
||||||
*/
|
|
||||||
public static void broadInfoMap(Map map) {
|
|
||||||
for (Session s : sessionSet) {
|
|
||||||
if (s.isOpen()) {
|
|
||||||
sendDate(s, map);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
package com.xkrs.websocket.websocket;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author xkrs
|
|
||||||
*/
|
|
||||||
public class ClientServerMessage {
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
package com.xkrs.websocket.websocket;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author xkrs
|
|
||||||
*/
|
|
||||||
public class ServerClientMessage {
|
|
||||||
|
|
||||||
public String getResponseMsg() {
|
|
||||||
return responseMsg;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setResponseMsg(String responseMsg) {
|
|
||||||
this.responseMsg = responseMsg;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String responseMsg;
|
|
||||||
|
|
||||||
public ServerClientMessage(String responseMsg) {
|
|
||||||
this.responseMsg = responseMsg;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,7 +1,7 @@
|
|||||||
server.port = 6801
|
server.port = 6801
|
||||||
|
|
||||||
## 数据源配置
|
## 数据源配置
|
||||||
spring.datasource.url = jdbc:postgresql://118.24.27.47:5432/fire_point
|
spring.datasource.url = jdbc:postgresql://8.142.26.238:5432/fire_point_new
|
||||||
spring.datasource.userName = fire_manage
|
spring.datasource.userName = fire_manage
|
||||||
spring.datasource.password = fire456
|
spring.datasource.password = fire456
|
||||||
spring.datasource.driverClassName = org.postgresql.Driver
|
spring.datasource.driverClassName = org.postgresql.Driver
|
||||||
|
Loading…
Reference in New Issue
Block a user