新增市县通讯录导入导出接口

master
徐杰盟 2024-06-05 16:33:32 +08:00
parent ffc58cb901
commit 56eb868d6d
5 changed files with 30 additions and 56 deletions

View File

@ -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);
}
}

View File

@ -616,6 +616,13 @@ public class AddressBookController {
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 = "行政区划联系人导入")
@PostMapping(value = "uploadExcel")
public ResultJson uploadExcel(MultipartFile file) {

View 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}")
public ResultJson<LoginVo> getWxLogin(@PathVariable("openid") String openid) throws InvocationTargetException, IllegalAccessException {
LoginVo loginVo = service.wxLogin(openid);
@ -185,16 +185,16 @@ public class UserController {
}
// @ApiOperation(value = "修改密码")
// @PostMapping(value = "updatePw")
@ApiOperation(value = "修改密码")
@PostMapping(value = "updatePw")
public ResultJson updatePwd(@RequestBody UserDto dto) {
return service.updatePwd(dto);
}
// @ApiOperation(value = "忘记密码")
// @GetMapping(value = "forgotPassword/{username}")
@ApiOperation(value = "忘记密码")
@GetMapping(value = "forgotPassword/{username}")
public ResultJson updatePwd(@PathVariable("username") String username) {
User one = service.lambdaQuery().eq(User::getUsername, username)
.one();
@ -212,16 +212,16 @@ public class UserController {
}
// @ApiOperation(value = "发送验证码")
// @GetMapping(value = "pushCode/{phone}")
@ApiOperation(value = "发送验证码")
@GetMapping(value = "pushCode/{phone}")
public ResultJson pushCode(@PathVariable("phone") String phone) {
return ResultJson.ok(service.pushCode(phone));
}
// @ApiOperation(value = "手机验证码登录")
// @GetMapping(value = "loginByCode/{phone}/{code}")
@ApiOperation(value = "手机验证码登录")
@GetMapping(value = "loginByCode/{phone}/{code}")
public ResultJson loginByCode(@PathVariable("phone") String phone,@PathVariable("code") String code) throws InvocationTargetException, IllegalAccessException {
LoginVo loginVo = service.loginByCode(phone, code.toUpperCase());

View File

@ -242,6 +242,13 @@ public class WarningController {
vo.setAdnm(publishUnit.replace("气象台", ""));
String adnm = publishUnit.replace("气象台", "");
if ("恩施州".equals(adnm)){
adnm = "恩施土家族苗族自治州";
}
if ("武汉经济技术开发区".equals(adnm)){
adnm = "经济技术开发区(汉南区)";
}
String adcd = adinfoService.getAdcdByAdnm(adnm);
if (StringUtils.isNotBlank(adcd)){
vo.setAddressBooks(addressBookService.getListByAdnm(adcd));

View File

@ -188,7 +188,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
}
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);
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("当前账号暂未注册");
}
if (!addressBook.getIsPass()){
throw new MyException("当前账号无法登录,请联系上级管理员!");
}
LoginVo out = new LoginVo();
BeanUtils.copyProperties(sysUser, out);
String adcd = addressBook.getAdcd();