新增市县通讯录导入导出接口
parent
ffc58cb901
commit
56eb868d6d
|
|
@ -1,45 +0,0 @@
|
||||||
package com.whdc.config;
|
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.springframework.data.redis.cache.RedisCache;
|
|
||||||
import org.springframework.data.redis.cache.RedisCacheConfiguration;
|
|
||||||
import org.springframework.data.redis.cache.RedisCacheManager;
|
|
||||||
import org.springframework.data.redis.cache.RedisCacheWriter;
|
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
import java.time.Duration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Description:
|
|
||||||
* Created by XuSan on 2024/6/3.
|
|
||||||
*
|
|
||||||
* @author XuSan
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
public class CustomRedisCacheManager extends RedisCacheManager {
|
|
||||||
|
|
||||||
|
|
||||||
public CustomRedisCacheManager(RedisCacheWriter cacheWriter, RedisCacheConfiguration defaultCacheConfiguration) {
|
|
||||||
super(cacheWriter, defaultCacheConfiguration);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 针对@Cacheable设置缓存过期时间
|
|
||||||
*
|
|
||||||
* @param name
|
|
||||||
* @param cacheConfig
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
protected RedisCache createRedisCache(String name, RedisCacheConfiguration cacheConfig) {
|
|
||||||
String[] array = StringUtils.delimitedListToStringArray(name, "#");
|
|
||||||
name = array[0];
|
|
||||||
// 解析TTL
|
|
||||||
if (array.length > 1) {
|
|
||||||
long ttl = Long.parseLong(array[1]);
|
|
||||||
cacheConfig = cacheConfig.entryTtl(Duration.ofSeconds(ttl)); // 注意单位我此处用的是秒,而非毫秒
|
|
||||||
}
|
|
||||||
return super.createRedisCache(name, cacheConfig);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -616,6 +616,13 @@ public class AddressBookController {
|
||||||
response);
|
response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "解析文件数据")
|
||||||
|
@PostMapping(value = "getExcelData")
|
||||||
|
public ResultJson<List<ExcelABVo>> getExcelData(MultipartFile file) {
|
||||||
|
|
||||||
|
List<ExcelABVo> appends = ExcelCommon.importExcel(file, 0, 1, ExcelABVo.class);
|
||||||
|
return ResultJson.ok(appends);
|
||||||
|
}
|
||||||
@ApiOperation(value = "行政区划联系人导入")
|
@ApiOperation(value = "行政区划联系人导入")
|
||||||
@PostMapping(value = "uploadExcel")
|
@PostMapping(value = "uploadExcel")
|
||||||
public ResultJson uploadExcel(MultipartFile file) {
|
public ResultJson uploadExcel(MultipartFile file) {
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ public class UserController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation(value = "wx登录", notes = "登录后,从 tokenInfo 中获取 token 相关信息。headers[tokenName] = tokenValue ")
|
@ApiOperation(value = "wxOpenid登录", notes = "登录后,从 tokenInfo 中获取 token 相关信息。headers[tokenName] = tokenValue ")
|
||||||
@GetMapping("wxLogin/{openid}")
|
@GetMapping("wxLogin/{openid}")
|
||||||
public ResultJson<LoginVo> getWxLogin(@PathVariable("openid") String openid) throws InvocationTargetException, IllegalAccessException {
|
public ResultJson<LoginVo> getWxLogin(@PathVariable("openid") String openid) throws InvocationTargetException, IllegalAccessException {
|
||||||
LoginVo loginVo = service.wxLogin(openid);
|
LoginVo loginVo = service.wxLogin(openid);
|
||||||
|
|
@ -185,16 +185,16 @@ public class UserController {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// @ApiOperation(value = "修改密码")
|
@ApiOperation(value = "修改密码")
|
||||||
// @PostMapping(value = "updatePw")
|
@PostMapping(value = "updatePw")
|
||||||
public ResultJson updatePwd(@RequestBody UserDto dto) {
|
public ResultJson updatePwd(@RequestBody UserDto dto) {
|
||||||
|
|
||||||
return service.updatePwd(dto);
|
return service.updatePwd(dto);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// @ApiOperation(value = "忘记密码")
|
@ApiOperation(value = "忘记密码")
|
||||||
// @GetMapping(value = "forgotPassword/{username}")
|
@GetMapping(value = "forgotPassword/{username}")
|
||||||
public ResultJson updatePwd(@PathVariable("username") String username) {
|
public ResultJson updatePwd(@PathVariable("username") String username) {
|
||||||
User one = service.lambdaQuery().eq(User::getUsername, username)
|
User one = service.lambdaQuery().eq(User::getUsername, username)
|
||||||
.one();
|
.one();
|
||||||
|
|
@ -212,16 +212,16 @@ public class UserController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// @ApiOperation(value = "发送验证码")
|
@ApiOperation(value = "发送验证码")
|
||||||
// @GetMapping(value = "pushCode/{phone}")
|
@GetMapping(value = "pushCode/{phone}")
|
||||||
public ResultJson pushCode(@PathVariable("phone") String phone) {
|
public ResultJson pushCode(@PathVariable("phone") String phone) {
|
||||||
|
|
||||||
return ResultJson.ok(service.pushCode(phone));
|
return ResultJson.ok(service.pushCode(phone));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// @ApiOperation(value = "手机验证码登录")
|
@ApiOperation(value = "手机验证码登录")
|
||||||
// @GetMapping(value = "loginByCode/{phone}/{code}")
|
@GetMapping(value = "loginByCode/{phone}/{code}")
|
||||||
public ResultJson loginByCode(@PathVariable("phone") String phone,@PathVariable("code") String code) throws InvocationTargetException, IllegalAccessException {
|
public ResultJson loginByCode(@PathVariable("phone") String phone,@PathVariable("code") String code) throws InvocationTargetException, IllegalAccessException {
|
||||||
|
|
||||||
LoginVo loginVo = service.loginByCode(phone, code.toUpperCase());
|
LoginVo loginVo = service.loginByCode(phone, code.toUpperCase());
|
||||||
|
|
|
||||||
|
|
@ -242,6 +242,13 @@ public class WarningController {
|
||||||
vo.setAdnm(publishUnit.replace("气象台", ""));
|
vo.setAdnm(publishUnit.replace("气象台", ""));
|
||||||
String adnm = publishUnit.replace("气象台", "");
|
String adnm = publishUnit.replace("气象台", "");
|
||||||
|
|
||||||
|
if ("恩施州".equals(adnm)){
|
||||||
|
adnm = "恩施土家族苗族自治州";
|
||||||
|
}
|
||||||
|
if ("武汉经济技术开发区".equals(adnm)){
|
||||||
|
adnm = "经济技术开发区(汉南区)";
|
||||||
|
}
|
||||||
|
|
||||||
String adcd = adinfoService.getAdcdByAdnm(adnm);
|
String adcd = adinfoService.getAdcdByAdnm(adnm);
|
||||||
if (StringUtils.isNotBlank(adcd)){
|
if (StringUtils.isNotBlank(adcd)){
|
||||||
vo.setAddressBooks(addressBookService.getListByAdnm(adcd));
|
vo.setAddressBooks(addressBookService.getListByAdnm(adcd));
|
||||||
|
|
|
||||||
|
|
@ -188,7 +188,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!book.getIsPass()){
|
if (!book.getIsPass()){
|
||||||
// throw new MyException("当前账号无法登录,请联系上级管理员!");
|
throw new MyException("当前账号无法登录,请联系上级管理员!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -229,7 +229,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
||||||
BeanUtils.copyProperties(sysUser, out);
|
BeanUtils.copyProperties(sysUser, out);
|
||||||
|
|
||||||
if (!book.getIsPass()){
|
if (!book.getIsPass()){
|
||||||
// throw new MyException("当前账号无法登录,请联系上级管理员!");
|
throw new MyException("当前账号无法登录,请联系上级管理员!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -344,6 +344,11 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
||||||
throw new MyException("当前账号暂未注册");
|
throw new MyException("当前账号暂未注册");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!addressBook.getIsPass()){
|
||||||
|
throw new MyException("当前账号无法登录,请联系上级管理员!");
|
||||||
|
}
|
||||||
|
|
||||||
LoginVo out = new LoginVo();
|
LoginVo out = new LoginVo();
|
||||||
BeanUtils.copyProperties(sysUser, out);
|
BeanUtils.copyProperties(sysUser, out);
|
||||||
String adcd = addressBook.getAdcd();
|
String adcd = addressBook.getAdcd();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue