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

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.dao.SysUserDao;
import com.xkrs.model.entity.SysUserEntity; import com.xkrs.model.entity.SysUserEntity;
import com.xkrs.model.qo.SysUserQo; 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.SysUserQoInsert;
import com.xkrs.model.validation.SysUserQoUpdate; import com.xkrs.model.validation.SysUserQoUpdate;
import com.xkrs.model.vo.SysUserVo; import com.xkrs.model.vo.SysUserVo;
@ -22,10 +24,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.HashMap; import java.util.*;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import static com.xkrs.common.encapsulation.OutputEncapsulation.outputEncapsulationErrorList; import static com.xkrs.common.encapsulation.OutputEncapsulation.outputEncapsulationErrorList;
@ -51,6 +50,64 @@ public class SysUserController {
@Resource @Resource
private RedisService redisService; 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验证 * 登录用户Token验证
* *

View File

@ -11,12 +11,22 @@ import java.util.List;
/** /**
* SysUserDao * SysUserDao
*
* @author tajochen * @author tajochen
*/ */
public interface SysUserDao extends JpaRepository<SysUserEntity,Integer> { 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 * @param userName
* @return * @return
*/ */
@ -25,6 +35,7 @@ public interface SysUserDao extends JpaRepository<SysUserEntity,Integer> {
/** /**
* 查找用户实体根据用户名 * 查找用户实体根据用户名
*
* @param userName * @param userName
* @return * @return
*/ */
@ -33,6 +44,7 @@ public interface SysUserDao extends JpaRepository<SysUserEntity,Integer> {
/** /**
* 根据用户名查询用户信息 * 根据用户名查询用户信息
*
* @param userName * @param userName
* @return * @return
*/ */
@ -40,37 +52,38 @@ public interface SysUserDao extends JpaRepository<SysUserEntity,Integer> {
/** /**
* 更新用户登录信息 * 更新用户登录信息
*
* @param userName * @param userName
* @param ipAddress * @param ipAddress
* @return * @return
*/ */
@Modifying @Modifying
@Query(value = "UPDATE sys_user SET last_entry_time = now(), last_entry_ip = :ipAddress " + @Query(value = "UPDATE sys_user SET last_entry_time = now(), last_entry_ip = :ipAddress " + "WHERE user_name = :userName ;", nativeQuery = true)
"WHERE user_name = :userName ;", nativeQuery = true)
int updateSysUserLogin(@Param("userName") String userName, @Param("ipAddress") String ipAddress); int updateSysUserLogin(@Param("userName") String userName, @Param("ipAddress") String ipAddress);
/** /**
* 软删除系统用户根据用户名 * 软删除系统用户根据用户名
*
* @param userName * @param userName
* @return * @return
*/ */
@Modifying @Modifying
@Query(value = "UPDATE sys_user SET delete_flag = 1 " + @Query(value = "UPDATE sys_user SET delete_flag = 1 " + "WHERE user_name = :userName ;", nativeQuery = true)
"WHERE user_name = :userName ;", nativeQuery = true)
int softDeleteSysUserByUserName(@Param("userName") String userName); int softDeleteSysUserByUserName(@Param("userName") String userName);
/** /**
* 软删除系统用户根据id * 软删除系统用户根据id
*
* @param id * @param id
* @return * @return
*/ */
@Modifying @Modifying
@Query(value = "UPDATE sys_user SET delete_flag = 1 " + @Query(value = "UPDATE sys_user SET delete_flag = 1 " + "WHERE id = :id ;", nativeQuery = true)
"WHERE id = :id ;", nativeQuery = true)
int softDeleteGeneralUserById(@Param("id") Integer id); int softDeleteGeneralUserById(@Param("id") Integer id);
/** /**
* 删除系统用户危险操作 * 删除系统用户危险操作
*
* @param userName * @param userName
* @return * @return
*/ */
@ -80,86 +93,96 @@ public interface SysUserDao extends JpaRepository<SysUserEntity,Integer> {
/** /**
* 查询用户信息 * 查询用户信息
*
* @return * @return
*/ */
@Query(value = "select new com.xkrs.model.vo.SysUserVo (id,reallyName,telephone,countyCode,activeFlag,addTime,overTime,dayNum,accountType,countyName,lastEntryIp,loginNum,loginLastTime) " + @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")
"from SysUserEntity")
List<SysUserVo> selectAll(); List<SysUserVo> selectAll();
/** /**
* 根据用户名查询实体信息 * 根据用户名查询实体信息
*
* @param userName * @param userName
* @return * @return
*/ */
@Query(value = "select new com.xkrs.model.vo.SysUserVo (id,reallyName,telephone,countyCode,activeFlag,addTime,overTime,dayNum,accountType,countyName,lastEntryIp,loginNum,loginLastTime) " + @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")
"from SysUserEntity where userName = :userName")
SysUserVo selectUserByUserName(String userName); SysUserVo selectUserByUserName(String userName);
/** /**
* 启用 * 启用
*
* @param userId * @param userId
*/ */
@Query(value = "update sys_user set active_flag = 0 where id = ?",nativeQuery = true) @Query(value = "update sys_user set active_flag = 0 where id = ?", nativeQuery = true)
@Modifying(clearAutomatically=true) @Modifying(clearAutomatically = true)
void updateEnable(Integer userId); void updateEnable(Integer userId);
/** /**
* 禁用 * 禁用
*
* @param userId * @param userId
*/ */
@Query(value = "update sys_user set active_flag = 1 where id = ?",nativeQuery = true) @Query(value = "update sys_user set active_flag = 1 where id = ?", nativeQuery = true)
@Modifying(clearAutomatically=true) @Modifying(clearAutomatically = true)
void updateDisable(Integer userId); void updateDisable(Integer userId);
/** /**
* 用户修改密码 * 用户修改密码
*
* @param userId * @param userId
* @param newPassword * @param newPassword
*/ */
@Query(value = "update sys_user set password = ?2 where id = ?1",nativeQuery = true) @Query(value = "update sys_user set password = ?2 where id = ?1", nativeQuery = true)
@Modifying(clearAutomatically=true) @Modifying(clearAutomatically = true)
void updatePassword(Integer userId,String newPassword); void updatePassword(Integer userId, String newPassword);
/** /**
* 根据id查询用户的信息 * 根据id查询用户的信息
*
* @param userId * @param userId
* @return * @return
*/ */
@Query(value = "select * from sys_user where id = ?",nativeQuery = true) @Query(value = "select * from sys_user where id = ?", nativeQuery = true)
SysUserEntity selectByUserId(Integer userId); SysUserEntity selectByUserId(Integer userId);
/** /**
* 根据id修改账户的到期时间 * 根据id修改账户的到期时间
*
* @param userId * @param userId
* @param overTime * @param overTime
*/ */
@Query(value = "update sys_user set over_time = ?2 where id = ?1",nativeQuery = true) @Query(value = "update sys_user set over_time = ?2 where id = ?1", nativeQuery = true)
@Modifying(clearAutomatically=true) @Modifying(clearAutomatically = true)
void updateOverTime(Integer userId,String overTime); void updateOverTime(Integer userId, String overTime);
/** /**
* 将账户的期限修改为永久有效 * 将账户的期限修改为永久有效
*
* @param userId * @param userId
*/ */
@Query(value = "update sys_user set over_time = '永久' and day_num = 1 where id = ?",nativeQuery = true) @Query(value = "update sys_user set over_time = '永久' and day_num = 1 where id = ?", nativeQuery = true)
@Modifying(clearAutomatically=true) @Modifying(clearAutomatically = true)
void updateDayNum(Integer userId); void updateDayNum(Integer userId);
/** /**
* 记录用户登录次数 * 记录用户登录次数
*
* @param userId * @param userId
* @param loginNum * @param loginNum
*/ */
@Query(value = "update sys_user set login_num = ?2 where id = ?1",nativeQuery = true) @Query(value = "update sys_user set login_num = ?2 where id = ?1", nativeQuery = true)
@Modifying(clearAutomatically=true) @Modifying(clearAutomatically = true)
void updateLoginNum(Integer userId,Integer loginNum); void updateLoginNum(Integer userId, Integer loginNum);
/** /**
* 修改登陆时间 * 修改登陆时间
*
* @param userId * @param userId
* @param loginLastTime * @param loginLastTime
*/ */
@Query(value = "update sys_user set login_last_time = ?2 where id = ?1",nativeQuery = true) @Query(value = "update sys_user set login_last_time = ?2 where id = ?1", nativeQuery = true)
@Modifying(clearAutomatically=true) @Modifying(clearAutomatically = true)
void updateLoginLastTime(Integer userId,String loginLastTime); void updateLoginLastTime(Integer userId, String loginLastTime);
} }

View File

@ -105,10 +105,14 @@ public class SysUserEntity implements Serializable {
private String userAgent; private String userAgent;
/** /**
* 是否是VIP用户 * vip等级
*/ */
@Column(length = 64, columnDefinition = "varchar(64)") private Integer vipLevel;
private String isVip;
/**
* 是否接收短信
*/
private Integer receiveSms;
public SysUserEntity() { public SysUserEntity() {
} }
@ -281,39 +285,24 @@ public class SysUserEntity implements Serializable {
this.userAgent = userAgent; this.userAgent = userAgent;
} }
public String getIsVip() { public Integer getVipLevel() {
return isVip; return vipLevel;
} }
public void setIsVip(String isVip) { public void setVipLevel(Integer vipLevel) {
this.isVip = isVip; this.vipLevel = vipLevel;
}
public Integer getReceiveSms() {
return receiveSms;
}
public void setReceiveSms(Integer receiveSms) {
this.receiveSms = receiveSms;
} }
@Override @Override
public String toString() { public String toString() {
return "SysUserEntity{" + 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 + '}';
"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 + '\'' +
'}';
} }
} }

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; package com.xkrs.model.vo;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDateTime;
/** /**
* SysUserVo * SysUserVo
*
* @Author tajochen * @Author tajochen
*/ */
public class SysUserVo implements Serializable { public class SysUserVo implements Serializable {
private Integer id; private Integer id;
private String reallyName; private String reallyName;
@ -34,7 +35,11 @@ public class SysUserVo implements Serializable {
private String loginLastTime; 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.id = id;
this.reallyName = reallyName; this.reallyName = reallyName;
this.telephone = telephone; this.telephone = telephone;
@ -48,6 +53,8 @@ public class SysUserVo implements Serializable {
this.lastEntryIp = lastEntryIp; this.lastEntryIp = lastEntryIp;
this.loginNum = loginNum; this.loginNum = loginNum;
this.loginLastTime = loginLastTime; this.loginLastTime = loginLastTime;
this.vipLevel = vipLevel;
this.receiveSms = receiveSms;
} }
public Integer getId() { public Integer getId() {
@ -153,5 +160,21 @@ public class SysUserVo implements Serializable {
public void setLoginLastTime(String loginLastTime) { public void setLoginLastTime(String loginLastTime) {
this.loginLastTime = 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) { if (telephoneList.size() > 0) {
String[] telephoneArray = telephoneList.toArray(new String[]{}); // String[] telephoneArray = telephoneList.toArray(new String[]{});
// String[] telephoneArray = new String[]{"8615764226530"}; String[] telephoneArray = new String[]{"8615764226530"};
SendSms.sendSmsToUser(telephoneArray, "1425995", new String[]{firePointAddress}); SendSms.sendSmsToUser(telephoneArray, "1425995", new String[]{firePointAddress});
} }
} }