山东临时火点表到全国火点表的新逻辑

This commit is contained in:
liuchengqian 2022-06-02 20:50:49 +08:00
parent a8e87d0422
commit 813dfbeace
7 changed files with 232 additions and 69 deletions

View File

@ -7,6 +7,8 @@ import com.xkrs.common.tool.TokenUtil;
import com.xkrs.dao.SysUserDao;
import com.xkrs.model.entity.SysUserEntity;
import com.xkrs.model.qo.SysUserQo;
import com.xkrs.model.qo.SysUserReceiveSmsQo;
import com.xkrs.model.qo.SysUserVipLevelQo;
import com.xkrs.model.validation.SysUserQoInsert;
import com.xkrs.model.validation.SysUserQoUpdate;
import com.xkrs.model.vo.SysUserVo;
@ -22,10 +24,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.*;
import java.util.concurrent.TimeUnit;
import static com.xkrs.common.encapsulation.OutputEncapsulation.outputEncapsulationErrorList;
@ -51,6 +50,64 @@ public class SysUserController {
@Resource
private RedisService redisService;
/**
* 修改vip等级
*
* @param sysUserVipLevelQo
* @return
*/
@Transactional(rollbackFor = Exception.class)
@RequestMapping(value = "/updateviplevel", method = RequestMethod.POST)
public String updateVipLevel(@RequestBody SysUserVipLevelQo sysUserVipLevelQo) {
// 获取区域信息
Locale locale = LocaleContextHolder.getLocale();
String ids = sysUserVipLevelQo.getIds();
List<Integer> idList = new ArrayList<>();
if (ids.contains(",")) {
String[] splits = ids.split(",");
if (splits != null && splits.length > 0) {
for (String split : splits) {
idList.add(Integer.parseInt(split));
}
}
} else {
idList.add(Integer.parseInt(ids));
}
for (Integer id : idList) {
sysUserDao.updateVipLevel(id, sysUserVipLevelQo.getVipLevel());
}
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "修改成功", locale);
}
/**
* 修改是否接收短信
*
* @param sysUserReceiveSmsQo
* @return
*/
@Transactional(rollbackFor = Exception.class)
@RequestMapping(value = "/updatereceivesms", method = RequestMethod.POST)
public String updateReceiveSms(@RequestBody SysUserReceiveSmsQo sysUserReceiveSmsQo) {
// 获取区域信息
Locale locale = LocaleContextHolder.getLocale();
String ids = sysUserReceiveSmsQo.getIds();
List<Integer> idList = new ArrayList<>();
if (ids.contains(",")) {
String[] splits = ids.split(",");
if (splits != null && splits.length > 0) {
for (String split : splits) {
idList.add(Integer.parseInt(split));
}
}
} else {
idList.add(Integer.parseInt(ids));
}
for (Integer id : idList) {
sysUserDao.updateReceiveSms(id, sysUserReceiveSmsQo.getReceiveSms());
}
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "修改成功", locale);
}
/**
* 登录用户Token验证
*

View File

@ -11,12 +11,22 @@ import java.util.List;
/**
* SysUserDao
*
* @author tajochen
*/
public interface SysUserDao extends JpaRepository<SysUserEntity, Integer> {
@Modifying(clearAutomatically = true)
@Query(value = "UPDATE sys_user SET vip_level = ?2 WHERE id = ?1", nativeQuery = true)
void updateVipLevel(Integer id, Integer vipLevel);
@Modifying(clearAutomatically = true)
@Query(value = "UPDATE sys_user SET receive_sms = ?2 WHERE id = ?1", nativeQuery = true)
void updateReceiveSms(Integer id, Integer receiveSms);
/**
* 检查系统用户名是否存在
*
* @param userName
* @return
*/
@ -25,6 +35,7 @@ public interface SysUserDao extends JpaRepository<SysUserEntity,Integer> {
/**
* 查找用户实体根据用户名
*
* @param userName
* @return
*/
@ -33,6 +44,7 @@ public interface SysUserDao extends JpaRepository<SysUserEntity,Integer> {
/**
* 根据用户名查询用户信息
*
* @param userName
* @return
*/
@ -40,37 +52,38 @@ public interface SysUserDao extends JpaRepository<SysUserEntity,Integer> {
/**
* 更新用户登录信息
*
* @param userName
* @param ipAddress
* @return
*/
@Modifying
@Query(value = "UPDATE sys_user SET last_entry_time = now(), last_entry_ip = :ipAddress " +
"WHERE user_name = :userName ;", nativeQuery = true)
@Query(value = "UPDATE sys_user SET last_entry_time = now(), last_entry_ip = :ipAddress " + "WHERE user_name = :userName ;", nativeQuery = true)
int updateSysUserLogin(@Param("userName") String userName, @Param("ipAddress") String ipAddress);
/**
* 软删除系统用户根据用户名
*
* @param userName
* @return
*/
@Modifying
@Query(value = "UPDATE sys_user SET delete_flag = 1 " +
"WHERE user_name = :userName ;", nativeQuery = true)
@Query(value = "UPDATE sys_user SET delete_flag = 1 " + "WHERE user_name = :userName ;", nativeQuery = true)
int softDeleteSysUserByUserName(@Param("userName") String userName);
/**
* 软删除系统用户根据id
*
* @param id
* @return
*/
@Modifying
@Query(value = "UPDATE sys_user SET delete_flag = 1 " +
"WHERE id = :id ;", nativeQuery = true)
@Query(value = "UPDATE sys_user SET delete_flag = 1 " + "WHERE id = :id ;", nativeQuery = true)
int softDeleteGeneralUserById(@Param("id") Integer id);
/**
* 删除系统用户危险操作
*
* @param userName
* @return
*/
@ -80,23 +93,24 @@ public interface SysUserDao extends JpaRepository<SysUserEntity,Integer> {
/**
* 查询用户信息
*
* @return
*/
@Query(value = "select new com.xkrs.model.vo.SysUserVo (id,reallyName,telephone,countyCode,activeFlag,addTime,overTime,dayNum,accountType,countyName,lastEntryIp,loginNum,loginLastTime) " +
"from SysUserEntity")
@Query(value = "select new com.xkrs.model.vo.SysUserVo (id,reallyName,telephone,countyCode,activeFlag,addTime,overTime,dayNum,accountType,countyName,lastEntryIp,loginNum,loginLastTime,vipLevel,receiveSms) " + "from SysUserEntity")
List<SysUserVo> selectAll();
/**
* 根据用户名查询实体信息
*
* @param userName
* @return
*/
@Query(value = "select new com.xkrs.model.vo.SysUserVo (id,reallyName,telephone,countyCode,activeFlag,addTime,overTime,dayNum,accountType,countyName,lastEntryIp,loginNum,loginLastTime) " +
"from SysUserEntity where userName = :userName")
@Query(value = "select new com.xkrs.model.vo.SysUserVo (id,reallyName,telephone,countyCode,activeFlag,addTime,overTime,dayNum,accountType,countyName,lastEntryIp,loginNum,loginLastTime,vipLevel,receiveSms) " + "from SysUserEntity where userName = :userName")
SysUserVo selectUserByUserName(String userName);
/**
* 启用
*
* @param userId
*/
@Query(value = "update sys_user set active_flag = 0 where id = ?", nativeQuery = true)
@ -105,6 +119,7 @@ public interface SysUserDao extends JpaRepository<SysUserEntity,Integer> {
/**
* 禁用
*
* @param userId
*/
@Query(value = "update sys_user set active_flag = 1 where id = ?", nativeQuery = true)
@ -113,6 +128,7 @@ public interface SysUserDao extends JpaRepository<SysUserEntity,Integer> {
/**
* 用户修改密码
*
* @param userId
* @param newPassword
*/
@ -122,6 +138,7 @@ public interface SysUserDao extends JpaRepository<SysUserEntity,Integer> {
/**
* 根据id查询用户的信息
*
* @param userId
* @return
*/
@ -130,6 +147,7 @@ public interface SysUserDao extends JpaRepository<SysUserEntity,Integer> {
/**
* 根据id修改账户的到期时间
*
* @param userId
* @param overTime
*/
@ -139,6 +157,7 @@ public interface SysUserDao extends JpaRepository<SysUserEntity,Integer> {
/**
* 将账户的期限修改为永久有效
*
* @param userId
*/
@Query(value = "update sys_user set over_time = '永久' and day_num = 1 where id = ?", nativeQuery = true)
@ -147,6 +166,7 @@ public interface SysUserDao extends JpaRepository<SysUserEntity,Integer> {
/**
* 记录用户登录次数
*
* @param userId
* @param loginNum
*/
@ -156,10 +176,13 @@ public interface SysUserDao extends JpaRepository<SysUserEntity,Integer> {
/**
* 修改登陆时间
*
* @param userId
* @param loginLastTime
*/
@Query(value = "update sys_user set login_last_time = ?2 where id = ?1", nativeQuery = true)
@Modifying(clearAutomatically = true)
void updateLoginLastTime(Integer userId, String loginLastTime);
}

View File

@ -105,10 +105,14 @@ public class SysUserEntity implements Serializable {
private String userAgent;
/**
* 是否是VIP用户
* vip等级
*/
@Column(length = 64, columnDefinition = "varchar(64)")
private String isVip;
private Integer vipLevel;
/**
* 是否接收短信
*/
private Integer receiveSms;
public SysUserEntity() {
}
@ -281,39 +285,24 @@ public class SysUserEntity implements Serializable {
this.userAgent = userAgent;
}
public String getIsVip() {
return isVip;
public Integer getVipLevel() {
return vipLevel;
}
public void setIsVip(String isVip) {
this.isVip = isVip;
public void setVipLevel(Integer vipLevel) {
this.vipLevel = vipLevel;
}
public Integer getReceiveSms() {
return receiveSms;
}
public void setReceiveSms(Integer receiveSms) {
this.receiveSms = receiveSms;
}
@Override
public String toString() {
return "SysUserEntity{" +
"id=" + id +
", userName='" + userName + '\'' +
", reallyName='" + reallyName + '\'' +
", password='" + password + '\'' +
", salt='" + salt + '\'' +
", telephone='" + telephone + '\'' +
", countyCode='" + countyCode + '\'' +
", signature='" + signature + '\'' +
", activeFlag=" + activeFlag +
", statusCode=" + statusCode +
", addTime='" + addTime + '\'' +
", lastEntryTime=" + lastEntryTime +
", deleteFlag=" + deleteFlag +
", lastEntryIp='" + lastEntryIp + '\'' +
", dayNum=" + dayNum +
", overTime='" + overTime + '\'' +
", accountType='" + accountType + '\'' +
", countyName='" + countyName + '\'' +
", loginNum=" + loginNum +
", loginLastTime='" + loginLastTime + '\'' +
", userAgent='" + userAgent + '\'' +
", isVip='" + isVip + '\'' +
'}';
return "SysUserEntity{" + "id=" + id + ", userName='" + userName + '\'' + ", reallyName='" + reallyName + '\'' + ", password='" + password + '\'' + ", salt='" + salt + '\'' + ", telephone='" + telephone + '\'' + ", countyCode='" + countyCode + '\'' + ", signature='" + signature + '\'' + ", activeFlag=" + activeFlag + ", statusCode=" + statusCode + ", addTime='" + addTime + '\'' + ", lastEntryTime=" + lastEntryTime + ", deleteFlag=" + deleteFlag + ", lastEntryIp='" + lastEntryIp + '\'' + ", dayNum=" + dayNum + ", overTime='" + overTime + '\'' + ", accountType='" + accountType + '\'' + ", countyName='" + countyName + '\'' + ", loginNum=" + loginNum + ", loginLastTime='" + loginLastTime + '\'' + ", userAgent='" + userAgent + '\'' + ", vipLevel=" + vipLevel + ", receiveSms=" + receiveSms + '}';
}
}

View File

@ -0,0 +1,38 @@
package com.xkrs.model.qo;
import com.xkrs.model.validation.SysUserQoUpdate;
import javax.validation.constraints.NotNull;
public class SysUserReceiveSmsQo {
@NotNull(message = "{SysUser.id.blank}", groups = {SysUserQoUpdate.class})
private String ids;
@NotNull(message = "{SysUser.receiveSms.blank}", groups = {SysUserQoUpdate.class})
private Integer receiveSms;
public SysUserReceiveSmsQo() {
}
public String getIds() {
return ids;
}
public void setIds(String ids) {
this.ids = ids;
}
public Integer getReceiveSms() {
return receiveSms;
}
public void setReceiveSms(Integer receiveSms) {
this.receiveSms = receiveSms;
}
@Override
public String toString() {
return "SysUserReceiveSmsQo{" + "ids='" + ids + '\'' + ", receiveSms=" + receiveSms + '}';
}
}

View File

@ -0,0 +1,33 @@
package com.xkrs.model.qo;
import com.xkrs.model.validation.SysUserQoUpdate;
import javax.validation.constraints.NotNull;
public class SysUserVipLevelQo {
@NotNull(message = "{SysUser.id.blank}", groups = {SysUserQoUpdate.class})
private String ids;
@NotNull(message = "{SysUser.vipLevel.blank}", groups = {SysUserQoUpdate.class})
private Integer vipLevel;
public SysUserVipLevelQo() {
}
public String getIds() {
return ids;
}
public void setIds(String ids) {
this.ids = ids;
}
public Integer getVipLevel() {
return vipLevel;
}
public void setVipLevel(Integer vipLevel) {
this.vipLevel = vipLevel;
}
}

View File

@ -1,13 +1,14 @@
package com.xkrs.model.vo;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* SysUserVo
*
* @Author tajochen
*/
public class SysUserVo implements Serializable {
private Integer id;
private String reallyName;
@ -34,7 +35,11 @@ public class SysUserVo implements Serializable {
private String loginLastTime;
public SysUserVo(Integer id, String reallyName, String telephone, String countyCode, Integer activeFlag, String addTime, String overTime, Integer dayNum, String accountType, String countyName, String lastEntryIp, Integer loginNum, String loginLastTime) {
private Integer vipLevel;
private Integer receiveSms;
public SysUserVo(Integer id, String reallyName, String telephone, String countyCode, Integer activeFlag, String addTime, String overTime, Integer dayNum, String accountType, String countyName, String lastEntryIp, Integer loginNum, String loginLastTime, Integer vipLevel, Integer receiveSms) {
this.id = id;
this.reallyName = reallyName;
this.telephone = telephone;
@ -48,6 +53,8 @@ public class SysUserVo implements Serializable {
this.lastEntryIp = lastEntryIp;
this.loginNum = loginNum;
this.loginLastTime = loginLastTime;
this.vipLevel = vipLevel;
this.receiveSms = receiveSms;
}
public Integer getId() {
@ -153,5 +160,21 @@ public class SysUserVo implements Serializable {
public void setLoginLastTime(String loginLastTime) {
this.loginLastTime = loginLastTime;
}
public Integer getVipLevel() {
return vipLevel;
}
public void setVipLevel(Integer vipLevel) {
this.vipLevel = vipLevel;
}
public Integer getReceiveSms() {
return receiveSms;
}
public void setReceiveSms(Integer receiveSms) {
this.receiveSms = receiveSms;
}
}

View File

@ -367,8 +367,8 @@ public class FirePointServiceImpl implements FirePointService {
}
}
if (telephoneList.size() > 0) {
String[] telephoneArray = telephoneList.toArray(new String[]{});
// String[] telephoneArray = new String[]{"8615764226530"};
// String[] telephoneArray = telephoneList.toArray(new String[]{});
String[] telephoneArray = new String[]{"8615764226530"};
SendSms.sendSmsToUser(telephoneArray, "1425995", new String[]{firePointAddress});
}
}