H5账号管理相关代码
This commit is contained in:
parent
3d4066ec86
commit
b7cdf61703
|
|
@ -1,5 +1,7 @@
|
|||
package com.jinrui.reference.admin.controller;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -98,9 +100,17 @@ public class ApiController {
|
|||
if (clientType == null) {
|
||||
return ResultObject.failed("非法操作,用户不存在!");
|
||||
}
|
||||
ResultObject<List<NewsApi4VO>> result = newsService.requestNewsByApi4(num, last, clientType);
|
||||
Date updateTime = null;
|
||||
if (last != null) {
|
||||
Calendar now = Calendar.getInstance();
|
||||
now.setTimeInMillis(last);
|
||||
updateTime = now.getTime();
|
||||
}
|
||||
ResultObject<List<NewsApi4VO>> result = newsService.requestNewsByApi4(num, updateTime, clientType);
|
||||
List<NewsApi4VO> newsList = result.getData();
|
||||
newsList.forEach(e -> e.setSource("中国证券报"));
|
||||
newsList.forEach(e -> {
|
||||
e.setSource("中国证券报");
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,425 @@
|
|||
package com.jinrui.reference.admin.controller;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import com.jinrui.reference.admin.model.entity.AdminUser;
|
||||
import com.jinrui.reference.admin.service.AdminJwtService;
|
||||
import com.jinrui.reference.admin.service.H5UserService;
|
||||
import com.jinrui.reference.core.model.entity.H5Tenant;
|
||||
import com.jinrui.reference.core.model.vo.PageObject;
|
||||
import com.jinrui.reference.core.model.vo.ResultObject;
|
||||
import com.jinrui.reference.core.model.vo.tenant.H5TenantDTO;
|
||||
import com.jinrui.reference.core.model.vo.tenant.H5TenantQueryDTO;
|
||||
import com.jinrui.reference.core.model.vo.tenant.H5TenantUserDTO;
|
||||
import com.jinrui.reference.core.model.vo.tenant.H5TenantVO;
|
||||
import com.jinrui.reference.core.model.vo.tenant.H5UserQueryParam;
|
||||
import com.jinrui.reference.core.model.vo.tenant.H5UserVO;
|
||||
import com.jinrui.reference.core.service.H5TenantService;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/tenant")
|
||||
public class H5TenantController {
|
||||
private static final Logger log = LoggerFactory.getLogger(H5TenantController.class);
|
||||
|
||||
private final H5TenantService h5TenantService;
|
||||
private final H5UserService h5UserService;
|
||||
|
||||
public H5TenantController(H5TenantService h5TenantService, H5UserService h5UserService) {
|
||||
this.h5TenantService = h5TenantService;
|
||||
this.h5UserService = h5UserService;
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
public PageObject<H5TenantVO> queryTenantInfo(@RequestHeader("auth-token") String token,
|
||||
H5TenantQueryDTO h5TenantQuery) {
|
||||
if (!StringUtils.hasText(token)) {
|
||||
return PageObject.failedPage("登陆Token为空!");
|
||||
}
|
||||
|
||||
try {
|
||||
AdminUser adminUser = AdminJwtService.parseToken(token);
|
||||
if (adminUser == null) {
|
||||
log.warn("解析token {}拿不到AdminUser对象!", token);
|
||||
return PageObject.failedPage("登陆Token有误,请联系系统管理员!");
|
||||
}
|
||||
|
||||
if (!adminUser.isActive()) {
|
||||
log.warn("当前用户已被封禁! id = {}", adminUser.getId());
|
||||
return PageObject.failedPage("当前用户已被封禁!请联系系统管理员!");
|
||||
}
|
||||
|
||||
log.info("path: /tenant/list, method: GET, request user id: {}, accountType: {}, companyType: {}, status: {}, " +
|
||||
"page: {}, size: {}, last: {}, current: {}, orderBy: {}, accountName: {}",
|
||||
adminUser.getId(), h5TenantQuery.getAccountType(), h5TenantQuery.getCompanyType(), h5TenantQuery.getStatus(), h5TenantQuery.getPage(), h5TenantQuery.getSize(), h5TenantQuery.getLast(), h5TenantQuery.getCurrent(), h5TenantQuery.getOrderBy(), h5TenantQuery.getAccountName());
|
||||
|
||||
return h5TenantService.queryTenantInfo(h5TenantQuery);
|
||||
} catch (Exception e) {
|
||||
log.error("解析登陆Token出错!", e);
|
||||
return PageObject.failedPage(500, "服务端错误,请联系系统管理员!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResultObject<Void> createH5Tenant(@RequestHeader("auth-token") String token, @RequestBody H5TenantDTO h5TenantDTO) {
|
||||
if (!StringUtils.hasText(token)) {
|
||||
return ResultObject.failed("登陆Token为空!");
|
||||
}
|
||||
|
||||
try {
|
||||
AdminUser adminUser = AdminJwtService.parseToken(token);
|
||||
if (adminUser == null) {
|
||||
log.warn("解析token {}拿不到AdminUser对象!", token);
|
||||
return ResultObject.failed("登陆Token有误,请联系系统管理员!");
|
||||
}
|
||||
|
||||
if (!adminUser.isActive()) {
|
||||
log.warn("当前用户已被封禁! id = {}", adminUser.getId());
|
||||
return ResultObject.failed("当前用户已被封禁!请联系系统管理员!");
|
||||
}
|
||||
|
||||
log.info("path: /tenant/create, method: POST, request user id: {}, companyName: {}, companyType: {}, accountName: {}, " +
|
||||
" accountType: {}, accountLimit: {}",
|
||||
adminUser.getId(), h5TenantDTO.getCompanyName(), h5TenantDTO.getCompanyType(), h5TenantDTO.getAccountName(), h5TenantDTO.getAccountType(), h5TenantDTO.getAccountLimit());
|
||||
h5TenantService.createH5TenantInfo(h5TenantDTO);
|
||||
return ResultObject.success();
|
||||
} catch (Exception e) {
|
||||
log.error("解析登陆Token出错!", e);
|
||||
return ResultObject.failed(500, "服务端错误,请联系系统管理员!");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/disable")
|
||||
public ResultObject<Void> disableTenantAccount(@RequestHeader("auth-token") String token, @RequestBody H5Tenant h5Tenant) {
|
||||
if (!StringUtils.hasText(token)) {
|
||||
return ResultObject.failed("登陆Token为空!");
|
||||
}
|
||||
|
||||
try {
|
||||
AdminUser adminUser = AdminJwtService.parseToken(token);
|
||||
if (adminUser == null) {
|
||||
log.warn("解析token {}拿不到AdminUser对象!", token);
|
||||
return ResultObject.failed("登陆Token有误,请联系系统管理员!");
|
||||
}
|
||||
|
||||
if (!adminUser.isActive()) {
|
||||
log.warn("当前用户已被封禁! id = {}", adminUser.getId());
|
||||
return ResultObject.failed("当前用户已被封禁!请联系系统管理员!");
|
||||
}
|
||||
|
||||
log.info("path: /tenant/disable, method: POST, request user id: {}, id: {}",
|
||||
adminUser.getId(), h5Tenant.getId());
|
||||
h5TenantService.disableAccount(h5Tenant.getId());
|
||||
return ResultObject.success();
|
||||
} catch (Exception e) {
|
||||
log.error("解析登陆Token出错!", e);
|
||||
return ResultObject.failed(500, "服务端错误,请联系系统管理员!");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/enable")
|
||||
public ResultObject<Void> enableTenantAccount(@RequestHeader("auth-token") String token, @RequestBody H5Tenant h5Tenant) {
|
||||
if (!StringUtils.hasText(token)) {
|
||||
return ResultObject.failed("登陆Token为空!");
|
||||
}
|
||||
|
||||
try {
|
||||
AdminUser adminUser = AdminJwtService.parseToken(token);
|
||||
if (adminUser == null) {
|
||||
log.warn("解析token {}拿不到AdminUser对象!", token);
|
||||
return ResultObject.failed("登陆Token有误,请联系系统管理员!");
|
||||
}
|
||||
|
||||
if (!adminUser.isActive()) {
|
||||
log.warn("当前用户已被封禁! id = {}", adminUser.getId());
|
||||
return ResultObject.failed("当前用户已被封禁!请联系系统管理员!");
|
||||
}
|
||||
|
||||
log.info("path: /tenant/enable, method: POST, request user id: {}, id: {}",
|
||||
adminUser.getId(), h5Tenant.getId());
|
||||
h5TenantService.enableAccount(h5Tenant.getId());
|
||||
return ResultObject.success();
|
||||
} catch (Exception e) {
|
||||
log.error("解析登陆Token出错!", e);
|
||||
return ResultObject.failed(500, "服务端错误,请联系系统管理员!");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public ResultObject<Void> updateTenantAccount(@RequestHeader("auth-token") String token, @RequestBody H5Tenant h5Tenant) {
|
||||
if (!StringUtils.hasText(token)) {
|
||||
return ResultObject.failed("登陆Token为空!");
|
||||
}
|
||||
|
||||
try {
|
||||
AdminUser adminUser = AdminJwtService.parseToken(token);
|
||||
if (adminUser == null) {
|
||||
log.warn("解析token {}拿不到AdminUser对象!", token);
|
||||
return ResultObject.failed("登陆Token有误,请联系系统管理员!");
|
||||
}
|
||||
|
||||
if (!adminUser.isActive()) {
|
||||
log.warn("当前用户已被封禁! id = {}", adminUser.getId());
|
||||
return ResultObject.failed("当前用户已被封禁!请联系系统管理员!");
|
||||
}
|
||||
|
||||
log.info("path: /tenant/update, method: POST, request user id: {}, id: {}",
|
||||
adminUser.getId(), h5Tenant.getId());
|
||||
h5TenantService.update(h5Tenant);
|
||||
return ResultObject.success();
|
||||
} catch (Exception e) {
|
||||
log.error("解析登陆Token出错!", e);
|
||||
return ResultObject.failed(500, "服务端错误,请联系系统管理员!");
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/export")
|
||||
public ResponseEntity<byte[]> exportTenants(@RequestHeader("auth-token") String token, H5TenantQueryDTO h5TenantQuery) {
|
||||
if (!StringUtils.hasText(token)) {
|
||||
new RuntimeException("登陆Token为空!");
|
||||
}
|
||||
|
||||
HttpHeaders responseHeaders = new HttpHeaders();
|
||||
try {
|
||||
AdminUser adminUser = AdminJwtService.parseToken(token);
|
||||
if (adminUser == null) {
|
||||
log.warn("解析token {}拿不到AdminUser对象!", token);
|
||||
new RuntimeException("登陆Token有误,请联系系统管理员!");
|
||||
}
|
||||
|
||||
if (!adminUser.isActive()) {
|
||||
log.warn("当前用户已被封禁! id = {}", adminUser.getId());
|
||||
new RuntimeException("当前用户已被封禁!请联系系统管理员!");
|
||||
}
|
||||
|
||||
log.info("path: /tenant/export, method: POST, request user id: {}", adminUser.getId());
|
||||
byte[] output = h5TenantService.exportTenants(h5TenantQuery);
|
||||
|
||||
responseHeaders.setContentType(MediaType.valueOf(MediaType.APPLICATION_OCTET_STREAM_VALUE));
|
||||
responseHeaders.setContentLength(output.length);
|
||||
responseHeaders.set("Content-Disposition", "attachment; filename=export.xlsx");
|
||||
return new ResponseEntity<>(output, responseHeaders, HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
log.error("解析登陆Token出错!", e);
|
||||
return new ResponseEntity<>(null, responseHeaders, HttpStatus.EXPECTATION_FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/user/create")
|
||||
public ResultObject<Void> createTenantUser(@RequestHeader("auth-token") String token, @RequestBody H5TenantUserDTO h5TenantUserDTO) {
|
||||
if (!StringUtils.hasText(token)) {
|
||||
return ResultObject.failed("登陆Token为空!");
|
||||
}
|
||||
|
||||
try {
|
||||
AdminUser adminUser = AdminJwtService.parseToken(token);
|
||||
if (adminUser == null) {
|
||||
log.warn("解析token {}拿不到AdminUser对象!", token);
|
||||
return ResultObject.failed("登陆Token有误,请联系系统管理员!");
|
||||
}
|
||||
|
||||
if (!adminUser.isActive()) {
|
||||
log.warn("当前用户已被封禁! id = {}", adminUser.getId());
|
||||
return ResultObject.failed("当前用户已被封禁!请联系系统管理员!");
|
||||
}
|
||||
|
||||
log.info("path: /tenant/user/create, method: POST, request user id: {}, name: {}, mobile: {}, department: {}, " +
|
||||
" companyName: {}",
|
||||
adminUser.getId(), h5TenantUserDTO.getName(), h5TenantUserDTO.getMobile(), h5TenantUserDTO.getDepartment(), h5TenantUserDTO.getCompanyName());
|
||||
h5TenantService.createH5TenantUser(h5TenantUserDTO);
|
||||
return ResultObject.success();
|
||||
} catch (Exception e) {
|
||||
log.error("解析登陆Token出错!", e);
|
||||
return ResultObject.failed(500, "服务端错误,请联系系统管理员!");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/user/update")
|
||||
public ResultObject<Void> updateTenantUser(@RequestHeader("auth-token") String token, @RequestBody H5TenantUserDTO h5TenantUserDTO) {
|
||||
if (!StringUtils.hasText(token)) {
|
||||
return ResultObject.failed("登陆Token为空!");
|
||||
}
|
||||
|
||||
try {
|
||||
AdminUser adminUser = AdminJwtService.parseToken(token);
|
||||
if (adminUser == null) {
|
||||
log.warn("解析token {}拿不到AdminUser对象!", token);
|
||||
return ResultObject.failed("登陆Token有误,请联系系统管理员!");
|
||||
}
|
||||
|
||||
if (!adminUser.isActive()) {
|
||||
log.warn("当前用户已被封禁! id = {}", adminUser.getId());
|
||||
return ResultObject.failed("当前用户已被封禁!请联系系统管理员!");
|
||||
}
|
||||
|
||||
log.info("path: /tenant/user/update, method: POST, request user id: {},id: {}, name: {}, mobile: {}, department: {}, " +
|
||||
" companyName: {}",
|
||||
adminUser.getId(),h5TenantUserDTO.getId(), h5TenantUserDTO.getName(), h5TenantUserDTO.getMobile(), h5TenantUserDTO.getDepartment(), h5TenantUserDTO.getCompanyName());
|
||||
h5TenantService.updateH5TenantUser(h5TenantUserDTO);
|
||||
return ResultObject.success();
|
||||
} catch (Exception e) {
|
||||
log.error("解析登陆Token出错!", e);
|
||||
return ResultObject.failed(500, "服务端错误,请联系系统管理员!");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/user/import")
|
||||
public ResultObject<String> importTenantUser(@RequestHeader("auth-token") String token, @RequestParam("file") MultipartFile file) {
|
||||
if (!StringUtils.hasText(token)) {
|
||||
return ResultObject.failed("登陆Token为空!");
|
||||
}
|
||||
|
||||
try {
|
||||
AdminUser adminUser = AdminJwtService.parseToken(token);
|
||||
if (adminUser == null) {
|
||||
log.warn("解析token {}拿不到AdminUser对象!", token);
|
||||
return ResultObject.failed("登陆Token有误,请联系系统管理员!");
|
||||
}
|
||||
|
||||
if (!adminUser.isActive()) {
|
||||
log.warn("当前用户已被封禁! id = {}", adminUser.getId());
|
||||
return ResultObject.failed("当前用户已被封禁!请联系系统管理员!");
|
||||
}
|
||||
|
||||
log.info("path: /tenant/user/import, method: POST, request user id: {}", adminUser.getId());
|
||||
if (file.isEmpty()) {
|
||||
return ResultObject.failed("上传的批量导入文件为空!");
|
||||
}
|
||||
return h5UserService.importAccounts(file, null);
|
||||
} catch (Exception e) {
|
||||
log.error("解析登陆Token出错!", e);
|
||||
return ResultObject.failed(500, "服务端错误,请联系系统管理员!");
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/user/list")
|
||||
public PageObject<H5UserVO> queryTenantUser(@RequestHeader("auth-token") String token,
|
||||
H5UserQueryParam h5UserQuery) {
|
||||
if (!StringUtils.hasText(token)) {
|
||||
return PageObject.failedPage("登陆Token为空!");
|
||||
}
|
||||
|
||||
try {
|
||||
AdminUser adminUser = AdminJwtService.parseToken(token);
|
||||
if (adminUser == null) {
|
||||
log.warn("解析token {}拿不到AdminUser对象!", token);
|
||||
return PageObject.failedPage("登陆Token有误,请联系系统管理员!");
|
||||
}
|
||||
|
||||
if (!adminUser.isActive()) {
|
||||
log.warn("当前用户已被封禁! id = {}", adminUser.getId());
|
||||
return PageObject.failedPage("当前用户已被封禁!请联系系统管理员!");
|
||||
}
|
||||
|
||||
log.info("path: /tenant/user/list, method: GET, request user id: {} ",
|
||||
adminUser.getId());
|
||||
|
||||
return h5TenantService.queryTenantUser(h5UserQuery);
|
||||
} catch (Exception e) {
|
||||
log.error("解析登陆Token出错!", e);
|
||||
return PageObject.failedPage(500, "服务端错误,请联系系统管理员!");
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/user/export")
|
||||
public ResponseEntity<byte[]> exportTenantUser(@RequestHeader("auth-token") String token, H5UserQueryParam h5UserQuery) {
|
||||
if (!StringUtils.hasText(token)) {
|
||||
new RuntimeException("登陆Token为空!");
|
||||
}
|
||||
|
||||
HttpHeaders responseHeaders = new HttpHeaders();
|
||||
try {
|
||||
AdminUser adminUser = AdminJwtService.parseToken(token);
|
||||
if (adminUser == null) {
|
||||
log.warn("解析token {}拿不到AdminUser对象!", token);
|
||||
new RuntimeException("登陆Token有误,请联系系统管理员!");
|
||||
}
|
||||
|
||||
if (!adminUser.isActive()) {
|
||||
log.warn("当前用户已被封禁! id = {}", adminUser.getId());
|
||||
new RuntimeException("当前用户已被封禁!请联系系统管理员!");
|
||||
}
|
||||
|
||||
log.info("path: /tenant/user/export, method: POST, request user id: {}", adminUser.getId());
|
||||
byte[] output = h5TenantService.exportTenantUsers(h5UserQuery);
|
||||
|
||||
responseHeaders.setContentType(MediaType.valueOf(MediaType.APPLICATION_OCTET_STREAM_VALUE));
|
||||
responseHeaders.setContentLength(output.length);
|
||||
responseHeaders.set("Content-Disposition", "attachment; filename=export.xlsx");
|
||||
return new ResponseEntity<>(output, responseHeaders, HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
log.error("解析登陆Token出错!", e);
|
||||
return new ResponseEntity<>(null, responseHeaders, HttpStatus.EXPECTATION_FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/user/disable")
|
||||
public ResultObject<Void> disableTenantUserAccount(@RequestHeader("auth-token") String token, @RequestBody H5TenantUserDTO h5TenantUserDTO) {
|
||||
if (!StringUtils.hasText(token)) {
|
||||
return ResultObject.failed("登陆Token为空!");
|
||||
}
|
||||
|
||||
try {
|
||||
AdminUser adminUser = AdminJwtService.parseToken(token);
|
||||
if (adminUser == null) {
|
||||
log.warn("解析token {}拿不到AdminUser对象!", token);
|
||||
return ResultObject.failed("登陆Token有误,请联系系统管理员!");
|
||||
}
|
||||
|
||||
if (!adminUser.isActive()) {
|
||||
log.warn("当前用户已被封禁! id = {}", adminUser.getId());
|
||||
return ResultObject.failed("当前用户已被封禁!请联系系统管理员!");
|
||||
}
|
||||
|
||||
log.info("path: /tenant/user/disable, method: POST, request user id: {}, id: {}",
|
||||
adminUser.getId(), h5TenantUserDTO.getId());
|
||||
h5TenantService.disableUserAccount(h5TenantUserDTO.getId());
|
||||
return ResultObject.success();
|
||||
} catch (Exception e) {
|
||||
log.error("解析登陆Token出错!", e);
|
||||
return ResultObject.failed(500, "服务端错误,请联系系统管理员!");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/user/enable")
|
||||
public ResultObject<Void> enableTenantUserAccount(@RequestHeader("auth-token") String token, @RequestBody H5TenantUserDTO h5TenantUserDTO) {
|
||||
if (!StringUtils.hasText(token)) {
|
||||
return ResultObject.failed("登陆Token为空!");
|
||||
}
|
||||
|
||||
try {
|
||||
AdminUser adminUser = AdminJwtService.parseToken(token);
|
||||
if (adminUser == null) {
|
||||
log.warn("解析token {}拿不到AdminUser对象!", token);
|
||||
return ResultObject.failed("登陆Token有误,请联系系统管理员!");
|
||||
}
|
||||
|
||||
if (!adminUser.isActive()) {
|
||||
log.warn("当前用户已被封禁! id = {}", adminUser.getId());
|
||||
return ResultObject.failed("当前用户已被封禁!请联系系统管理员!");
|
||||
}
|
||||
|
||||
log.info("path: /tenant/user/enable, method: POST, request user id: {}, id: {}",
|
||||
adminUser.getId(), h5TenantUserDTO.getId());
|
||||
h5TenantService.enableUserAccount(h5TenantUserDTO.getId());
|
||||
return ResultObject.success();
|
||||
} catch (Exception e) {
|
||||
log.error("解析登陆Token出错!", e);
|
||||
return ResultObject.failed(500, "服务端错误,请联系系统管理员!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -13,13 +13,13 @@ import org.springframework.web.multipart.MultipartFile;
|
|||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.jinrui.reference.admin.model.entity.AdminUser;
|
||||
import com.jinrui.reference.admin.model.vo.admin.user.H5UserDTO;
|
||||
import com.jinrui.reference.admin.model.vo.admin.user.H5UserQueryParam;
|
||||
import com.jinrui.reference.admin.model.vo.admin.user.H5UserVO;
|
||||
import com.jinrui.reference.admin.service.AdminJwtService;
|
||||
import com.jinrui.reference.admin.service.H5UserService;
|
||||
import com.jinrui.reference.core.model.vo.PageObject;
|
||||
import com.jinrui.reference.core.model.vo.ResultObject;
|
||||
import com.jinrui.reference.core.model.vo.tenant.H5UserDTO;
|
||||
import com.jinrui.reference.core.model.vo.tenant.H5UserQueryParam;
|
||||
import com.jinrui.reference.core.model.vo.tenant.H5UserVO;
|
||||
|
||||
import redis.clients.jedis.JedisPool;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.jinrui.reference.admin.mapper;
|
||||
|
||||
import com.jinrui.reference.admin.model.entity.AdminUser;
|
||||
import com.jinrui.reference.admin.model.vo.admin.user.H5UserVO;
|
||||
import com.jinrui.reference.core.model.vo.tenant.H5UserVO;
|
||||
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
|
|
|
|||
|
|
@ -16,11 +16,11 @@ import org.springframework.util.StringUtils;
|
|||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.jinrui.reference.admin.mapper.AdminUserMapper;
|
||||
import com.jinrui.reference.admin.mapper.H5UserMapper;
|
||||
import com.jinrui.reference.admin.model.dto.login.LoginDTO;
|
||||
import com.jinrui.reference.admin.model.entity.AdminUser;
|
||||
import com.jinrui.reference.admin.model.vo.admin.user.AdminUserVO;
|
||||
import com.jinrui.reference.admin.model.vo.login.LoginVO;
|
||||
import com.jinrui.reference.core.mapper.H5UserMapper;
|
||||
import com.jinrui.reference.core.model.vo.PageObject;
|
||||
import com.jinrui.reference.core.model.vo.ResultObject;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,14 +1,11 @@
|
|||
package com.jinrui.reference.admin.service;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.jinrui.reference.admin.mapper.ShareUserMapper;
|
||||
import com.jinrui.reference.admin.model.entity.ShareUser;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
|
@ -18,17 +15,19 @@ import org.springframework.util.StringUtils;
|
|||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.jinrui.reference.admin.mapper.H5UserMapper;
|
||||
import com.jinrui.reference.admin.model.vo.admin.user.H5UserDTO;
|
||||
import com.jinrui.reference.admin.model.vo.admin.user.H5UserQueryParam;
|
||||
import com.jinrui.reference.admin.model.vo.admin.user.H5UserUploadData;
|
||||
import com.jinrui.reference.admin.model.vo.admin.user.H5UserUploadDataListener;
|
||||
import com.jinrui.reference.admin.model.vo.admin.user.H5UserVO;
|
||||
import com.jinrui.reference.core.mapper.H5UserMapper;
|
||||
import com.jinrui.reference.core.mapper.ShareUserMapper;
|
||||
import com.jinrui.reference.core.mapper.TenantInfoMapper;
|
||||
import com.jinrui.reference.core.model.entity.H5Tenant;
|
||||
import com.jinrui.reference.core.model.vo.PageObject;
|
||||
import com.jinrui.reference.core.model.vo.ResultObject;
|
||||
import com.jinrui.reference.core.model.vo.tenant.H5UserDTO;
|
||||
import com.jinrui.reference.core.model.vo.tenant.H5UserQueryParam;
|
||||
import com.jinrui.reference.core.model.vo.tenant.H5UserUploadData;
|
||||
import com.jinrui.reference.core.model.vo.tenant.H5UserUploadDataListener;
|
||||
import com.jinrui.reference.core.model.vo.tenant.H5UserVO;
|
||||
|
||||
import cn.idev.excel.FastExcel;
|
||||
import cn.idev.excel.read.listener.PageReadListener;
|
||||
import redis.clients.jedis.JedisPool;
|
||||
|
||||
@Service
|
||||
|
|
@ -39,14 +38,17 @@ public class H5UserService {
|
|||
private final H5UserMapper h5UserMapper;
|
||||
private final ShareUserMapper shareUserMapper;
|
||||
private final ObjectMapper objectMapper;
|
||||
private final TenantInfoMapper tenantInfoMapper;
|
||||
|
||||
public H5UserService(JedisPool jedisPool,
|
||||
H5UserMapper h5UserMapper, ShareUserMapper shareUserMapper,
|
||||
ObjectMapper objectMapper) {
|
||||
ObjectMapper objectMapper,
|
||||
TenantInfoMapper tenantInfoMapper) {
|
||||
this.jedisPool = jedisPool;
|
||||
this.h5UserMapper = h5UserMapper;
|
||||
this.shareUserMapper = shareUserMapper;
|
||||
this.objectMapper = objectMapper;
|
||||
this.tenantInfoMapper = tenantInfoMapper;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -136,7 +138,7 @@ public class H5UserService {
|
|||
Map<String, H5UserUploadData> h5UserMobileMap = new HashMap<>();
|
||||
for (int i = 0; i < h5Users.size(); i++) {
|
||||
H5UserUploadData h5User = h5Users.get(i);
|
||||
if (!(StringUtils.hasText(h5User.getName()) && StringUtils.hasText(h5User.getMobile()))) {
|
||||
if (!(StringUtils.hasText(h5User.getName()) && StringUtils.hasText(h5User.getMobile()) && StringUtils.hasText(h5User.getCompanyName()))) {
|
||||
msg += "第" + (i+2) + "行数据缺少必填内容!\n";
|
||||
continue;
|
||||
}
|
||||
|
|
@ -153,8 +155,15 @@ public class H5UserService {
|
|||
if (h5UserVO == null) {
|
||||
H5UserDTO h5UserDTO = new H5UserDTO();
|
||||
BeanUtils.copyProperties(h5UserUploadData, h5UserDTO);
|
||||
h5UserDTO.setCreateBy(createBy);
|
||||
h5UserDTO.setType(1);
|
||||
String companyName = h5UserUploadData.getCompanyName();
|
||||
H5Tenant h5Tenant = tenantInfoMapper.getByCompanyName(companyName);
|
||||
h5UserDTO.setCompanyName(h5Tenant.getId());
|
||||
if (StringUtils.hasText(createBy)) {
|
||||
h5UserDTO.setCreateBy(createBy);
|
||||
h5UserDTO.setType(1);
|
||||
} else {
|
||||
h5UserDTO.setType(0);
|
||||
}
|
||||
h5UserMapper.createH5User(h5UserDTO);
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package com.jinrui.reference.admin.mapper;
|
||||
package com.jinrui.reference.core.mapper;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
|
@ -13,9 +13,9 @@ import org.apache.ibatis.annotations.Select;
|
|||
import org.apache.ibatis.annotations.Update;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
|
||||
import com.jinrui.reference.admin.model.vo.admin.user.H5UserDTO;
|
||||
import com.jinrui.reference.admin.model.vo.admin.user.H5UserQueryParam;
|
||||
import com.jinrui.reference.admin.model.vo.admin.user.H5UserVO;
|
||||
import com.jinrui.reference.core.model.vo.tenant.H5UserDTO;
|
||||
import com.jinrui.reference.core.model.vo.tenant.H5UserQueryParam;
|
||||
import com.jinrui.reference.core.model.vo.tenant.H5UserVO;
|
||||
|
||||
public interface H5UserMapper {
|
||||
@Insert("<script>" +
|
||||
|
|
@ -26,8 +26,8 @@ public interface H5UserMapper {
|
|||
void createH5UserByPhone(@Param("phone") String phone);
|
||||
|
||||
@Insert("<script>" +
|
||||
"insert into allowlist_detail(mobile, department, name, create_by, create_time, update_time, type" +
|
||||
") values (#{mobile}, #{department},#{name}, #{createBy}, now(), now(), #{type}" +
|
||||
"insert into allowlist_detail(mobile, department, name, create_by, create_time, update_time, type, company_name" +
|
||||
") values (#{mobile}, #{department},#{name}, #{createBy}, now(), now(), #{type}, #{companyName}" +
|
||||
")" +
|
||||
"</script>")
|
||||
void createH5User(H5UserDTO h5UserDTO);
|
||||
|
|
@ -38,10 +38,13 @@ public interface H5UserMapper {
|
|||
@Result(column = "name", property = "name"),
|
||||
@Result(column = "department", property = "department"),
|
||||
@Result(column = "status", property = "status"),
|
||||
@Result(column = "company_name", property = "companyName"),
|
||||
@Result(column = "account_type", property = "accountType"),
|
||||
@Result(column = "create_time", property = "createTime", javaType = Date.class, jdbcType = JdbcType.TIMESTAMP),
|
||||
@Result(column = "update_time", property = "updateTime", javaType = Date.class, jdbcType = JdbcType.TIMESTAMP)
|
||||
})
|
||||
@Select("select * from allowlist_detail where mobile = #{mobile}")
|
||||
@Select("select allowlist_detail.id, allowlist_detail.mobile, allowlist_detail.name,"
|
||||
+ " allowlist_detail.department,allowlist_detail.status, allowlist_detail.create_time, allowlist_detail.update_time, tenant_info.company_name, tenant_info.account_type from allowlist_detail left join tenant_info on allowlist_detail.company_name = tenant_info.id where allowlist_detail.mobile = #{mobile}")
|
||||
H5UserVO selectByMobile(@Param("mobile") String mobile);
|
||||
|
||||
@Update("<script>" +
|
||||
|
|
@ -65,27 +68,24 @@ public interface H5UserMapper {
|
|||
"</script>" )
|
||||
void updateH5User(H5UserDTO h5UserDTO);
|
||||
|
||||
// "<if test=\"createBy != null and createBy.trim().length() > 0 \">" +
|
||||
// " and create_by = #{createBy} " +
|
||||
// "</if>" +
|
||||
@ResultMap("h5UserMap")
|
||||
@Select("<script>" +
|
||||
"select * from allowlist_detail " +
|
||||
"select allowlist_detail.id, allowlist_detail.mobile, allowlist_detail.name,allowlist_detail.department,allowlist_detail.status, allowlist_detail.create_time, allowlist_detail.update_time,tenant_info.company_name, tenant_info.account_type from allowlist_detail left join tenant_info on allowlist_detail.company_name = tenant_info.id " +
|
||||
"<where>" +
|
||||
"<if test=\"type != null \">" +
|
||||
" and type = #{type} " +
|
||||
" and allowlist_detail.type = #{type} " +
|
||||
"</if>" +
|
||||
"<if test=\"mobile != null and mobile.trim().length() > 0 \">" +
|
||||
" and mobile = #{mobile} " +
|
||||
" and allowlist_detail.mobile = #{mobile} " +
|
||||
"</if>" +
|
||||
"<if test=\"department != null and department.trim().length() > 0 \">" +
|
||||
" and department like concat('%', #{department}, '%') " +
|
||||
" and allowlist_detail.department like concat('%', #{department}, '%') " +
|
||||
"</if>" +
|
||||
"<if test=\"status != null \">" +
|
||||
" and status = #{status} " +
|
||||
" and allowlist_detail.status = #{status} " +
|
||||
"</if>" +
|
||||
"</where>" +
|
||||
"order by create_time desc " +
|
||||
"order by allowlist_detail.create_time desc " +
|
||||
"limit ${size} offset ${offset}" +
|
||||
"</script>")
|
||||
List<H5UserVO> queryH5User(H5UserQueryParam h5UserQueryParam);
|
||||
|
|
@ -114,4 +114,20 @@ public interface H5UserMapper {
|
|||
|
||||
@Delete("delete from allowlist_detail where id = #{id}")
|
||||
void deleteById(@Param("id") Long id);
|
||||
|
||||
@ResultMap("h5UserMap")
|
||||
@Select("<script>" +
|
||||
"select allowlist_detail.id, allowlist_detail.mobile, allowlist_detail.name,allowlist_detail.department,allowlist_detail.status, allowlist_detail.create_time, allowlist_detail.update_time,tenant_info.company_name, tenant_info.account_type " +
|
||||
" from allowlist_detail left join tenant_info on allowlist_detail.company_name = tenant_info.id " +
|
||||
" where allowlist_detail.id in " +
|
||||
"<foreach collection=\"ids\" item=\"id\" open=\"(\" close=\")\" separator=\",\">\n" +
|
||||
" #{id} " +
|
||||
"</foreach>" +
|
||||
"</script>")
|
||||
List<H5UserVO> getByIds(@Param("ids") List<Long> ids);
|
||||
|
||||
@Update("update allowlist_detail " +
|
||||
"set status = #{status} " +
|
||||
"where id = #{id} ")
|
||||
int changeAccountStatus(Long id, Integer status);
|
||||
}
|
||||
|
|
@ -515,6 +515,7 @@ public interface NewsMapper {
|
|||
@Result(column = "stock_codes", property = "stockCodes", typeHandler = JsonArrayTypeHandler.class),
|
||||
@Result(column = "stock_names", property = "stockNames", typeHandler = JsonArrayTypeHandler.class),
|
||||
@Result(column = "company_name", property = "companyName"),
|
||||
@Result(column = "update_time", property = "updateTime"),
|
||||
})
|
||||
@Select("<script>" +
|
||||
"select " +
|
||||
|
|
@ -536,7 +537,8 @@ public interface NewsMapper {
|
|||
"news_tags.public_opinion_score," +
|
||||
"news.stock_codes," +
|
||||
"news.stock_names," +
|
||||
"news.company_name" +
|
||||
"news.company_name," +
|
||||
"news.update_time" +
|
||||
" from news " +
|
||||
" left join news_tags on news.newsinfo_id = news_tags.newsinfo_id " +
|
||||
"<where>" +
|
||||
|
|
@ -548,12 +550,12 @@ public interface NewsMapper {
|
|||
"</if>" +
|
||||
" and news.is_delete = 0 " +
|
||||
"<if test=\"last != null\">" +
|
||||
" and news.id > #{last}" +
|
||||
" and news.update_time >= #{last}" +
|
||||
"</if>" +
|
||||
"</where>" +
|
||||
" order by id asc " +
|
||||
" order by news.update_time asc " +
|
||||
" limit ${limit}" +
|
||||
"</script>")
|
||||
List<NewsApi4VO> queryNewsByApi4(@Param("last") Long last, @Param("limit") int limit, @Param("clientType") int clientType);
|
||||
List<NewsApi4VO> queryNewsByApi4(@Param("last") Date last, @Param("limit") int limit, @Param("clientType") int clientType);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,17 +1,14 @@
|
|||
package com.jinrui.reference.admin.mapper;
|
||||
package com.jinrui.reference.core.mapper;
|
||||
|
||||
import com.jinrui.reference.admin.model.entity.ShareUser;
|
||||
import java.util.Date;
|
||||
|
||||
import com.jinrui.reference.core.model.entity.NewsTags;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Result;
|
||||
import org.apache.ibatis.annotations.Results;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import com.jinrui.reference.core.model.entity.ShareUser;
|
||||
|
||||
public interface ShareUserMapper {
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,174 @@
|
|||
package com.jinrui.reference.core.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.apache.ibatis.annotations.Options;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Result;
|
||||
import org.apache.ibatis.annotations.ResultMap;
|
||||
import org.apache.ibatis.annotations.Results;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
import com.jinrui.reference.core.model.entity.H5Tenant;
|
||||
import com.jinrui.reference.core.model.vo.tenant.H5TenantUserDTO;
|
||||
import com.jinrui.reference.core.typehandler.JsonArrayTypeHandler;
|
||||
|
||||
public interface TenantInfoMapper {
|
||||
@Results(id="tenantInfoMap", value = {
|
||||
@Result(column = "id", property = "id", id = true),
|
||||
@Result(column = "company_type", property = "companyType"),
|
||||
@Result(column = "company_name", property = "companyName"),
|
||||
@Result(column = "phone", property = "phone"),
|
||||
@Result(column = "account_name", property = "accountName"),
|
||||
@Result(column = "account_limit", property = "accountLimit"),
|
||||
@Result(column = "account_type", property = "accountType"),
|
||||
@Result(column = "status", property = "status"),
|
||||
@Result(column = "valid_start", property = "validStart"),
|
||||
@Result(column = "valid_end", property = "validEnd"),
|
||||
@Result(column = "permissions", property = "permissions",typeHandler = JsonArrayTypeHandler.class),
|
||||
@Result(column = "create_time", property = "createTime"),
|
||||
@Result(column = "update_time", property = "updateTime")
|
||||
})
|
||||
@Select("<script>" +
|
||||
"select * " +
|
||||
" from tenant_info " +
|
||||
"<where>" +
|
||||
"<if test=\"accountType != null \">" +
|
||||
"and account_type = #{accountType} " +
|
||||
"</if>" +
|
||||
"<if test=\"companyType != null \">" +
|
||||
"and company_type = #{companyType} " +
|
||||
"</if>" +
|
||||
"<if test=\"status != null \">" +
|
||||
"and status = #{status} " +
|
||||
"</if>" +
|
||||
"<if test=\"accountName != null and accountName.trim().length() > 0\">" +
|
||||
"and (account_name like concat('%', #{accountName}, '%') or company_name like concat('%', #{accountName}, '%')) " +
|
||||
"</if>" +
|
||||
"</where>" +
|
||||
"<if test=\"orderBy != null\">" +
|
||||
"order by ${orderBy} " +
|
||||
"</if>" +
|
||||
"limit ${limit} offset ${offset}" +
|
||||
"</script>")
|
||||
List<H5Tenant> queryTenantInfo(@Param("accountType") Integer accountType,
|
||||
@Param("companyType") Integer companyType,
|
||||
@Param("status") Integer status,
|
||||
@Param("accountName") String accountName,
|
||||
@Param("last") Integer last,
|
||||
@Param("orderBy") String orderBy,
|
||||
@Param("limit") int limit,
|
||||
@Param("offset") int offset);
|
||||
|
||||
@Select("<script>" +
|
||||
"select count(*) " +
|
||||
" from tenant_info " +
|
||||
"<where>" +
|
||||
"<if test=\"accountType != null \">" +
|
||||
"and account_type = #{accountType} " +
|
||||
"</if>" +
|
||||
"<if test=\"companyType != null \">" +
|
||||
"and company_type = #{companyType} " +
|
||||
"</if>" +
|
||||
"<if test=\"status != null \">" +
|
||||
"and status = #{status} " +
|
||||
"</if>" +
|
||||
"<if test=\"accountName != null and accountName.trim().length() > 0\">" +
|
||||
"and (account_name like concat('%', #{accountName}, '%') or company_name like concat('%', #{accountName}, '%')) " +
|
||||
"</if>" +
|
||||
"</where>" +
|
||||
"</script>")
|
||||
int queryTotal(@Param("accountType") Integer accountType,
|
||||
@Param("companyType") Integer companyType,
|
||||
@Param("status") Integer status,
|
||||
@Param("accountName") String accountName,
|
||||
@Param("last") Integer last,
|
||||
@Param("orderBy") String orderBy,
|
||||
@Param("limit") int limit,
|
||||
@Param("offset") int offset);
|
||||
|
||||
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
|
||||
@Insert("insert into tenant_info(company_type, company_name, phone, account_name, account_limit, account_type, status, valid_start, valid_end, create_time, update_time, permissions)" +
|
||||
"values (#{companyType}, #{companyName}, #{phone}, #{accountName}, #{accountLimit}, #{accountType}, #{status}, #{validStart}, #{validEnd}, now(), now(), #{permissions, typeHandler = com.jinrui.reference.core.typehandler.JsonArrayTypeHandler})")
|
||||
void createTenant(H5Tenant h5Tenant);
|
||||
|
||||
@Update("update tenant_info " +
|
||||
"set status = #{status} " +
|
||||
"where id = #{id} ")
|
||||
int changeAccountStatus(Long id, Integer status);
|
||||
|
||||
@Update("update tenant_info " +
|
||||
"set company_type = #{h5Tenant.companyType}," +
|
||||
"company_name = #{h5Tenant.companyName}, " +
|
||||
"phone = #{h5Tenant.phone}," +
|
||||
"account_name = #{h5Tenant.accountName}," +
|
||||
"account_limit = #{h5Tenant.accountLimit}," +
|
||||
"account_type = #{h5Tenant.accountType}," +
|
||||
"valid_start = #{h5Tenant.validStart}," +
|
||||
"valid_end = #{h5Tenant.validEnd}," +
|
||||
"permissions = #{h5Tenant.permissions, typeHandler = com.jinrui.reference.core.typehandler.JsonArrayTypeHandler}," +
|
||||
"update_time = now()" +
|
||||
"where id = #{h5Tenant.id}")
|
||||
int updateTenant(@Param("h5Tenant") H5Tenant h5Tenant);
|
||||
|
||||
@ResultMap("tenantInfoMap")
|
||||
@Select("<script>" +
|
||||
"select * " +
|
||||
" from tenant_info " +
|
||||
" where id in " +
|
||||
"<foreach collection=\"ids\" item=\"id\" open=\"(\" close=\")\" separator=\",\">\n" +
|
||||
" #{id} " +
|
||||
"</foreach>" +
|
||||
"</script>")
|
||||
List<H5Tenant> getByIds(@Param("ids") List<Long> ids);
|
||||
|
||||
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
|
||||
@Insert("<script>" +
|
||||
"insert into allowlist_detail(mobile, department, name, create_by, create_time, update_time, type, company_name" +
|
||||
") values (#{mobile}, #{department},#{name}, #{createBy}, now(), now(), #{type}, #{companyName}" +
|
||||
")" +
|
||||
"</script>")
|
||||
void createH5User(H5TenantUserDTO h5UserDTO);
|
||||
|
||||
@Update("<script>" +
|
||||
"update allowlist_detail " +
|
||||
" <set>" +
|
||||
"<if test=\"name != null and name.trim().length() > 0 \">" +
|
||||
" name = #{name}, " +
|
||||
"</if>" +
|
||||
"<if test=\"department != null and department.trim().length() > 0 \">" +
|
||||
" department = #{department}, " +
|
||||
"</if>" +
|
||||
"<if test=\"mobile != null and mobile.trim().length() > 0 \">" +
|
||||
" mobile = #{mobile}, " +
|
||||
"</if>" +
|
||||
"<if test=\"status != null \">" +
|
||||
" status = #{status}, " +
|
||||
"</if>" +
|
||||
"<if test=\"companyName != null \">" +
|
||||
" company_name = #{companyName}, " +
|
||||
"</if>" +
|
||||
" update_time = now() " +
|
||||
" </set>" +
|
||||
" where id = #{id} " +
|
||||
"</script>" )
|
||||
void updateH5User(H5TenantUserDTO h5UserDTO);
|
||||
|
||||
@ResultMap("tenantInfoMap")
|
||||
@Select("<script>" +
|
||||
"select * " +
|
||||
" from tenant_info " +
|
||||
" where id = #{id} " +
|
||||
"</script>")
|
||||
H5Tenant getById(@Param("id") Long id);
|
||||
|
||||
@ResultMap("tenantInfoMap")
|
||||
@Select("<script>" +
|
||||
"select * " +
|
||||
" from tenant_info " +
|
||||
" where company_name = #{companyName} " +
|
||||
"</script>")
|
||||
H5Tenant getByCompanyName(@Param("companyName") String companyName);
|
||||
}
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
package com.jinrui.reference.core.model.entity;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.jinrui.reference.core.model.vo.tenant.TenantPermission;
|
||||
|
||||
public class H5Tenant {
|
||||
private Long id;
|
||||
private Integer companyType;
|
||||
private String companyName;
|
||||
private String phone;
|
||||
private String accountName;
|
||||
private Integer accountLimit;
|
||||
private Integer accountType;
|
||||
private Integer status;
|
||||
private Date validStart;
|
||||
private Date validEnd;
|
||||
private Date createTime;
|
||||
private Date updateTime;
|
||||
private List<TenantPermission> permissions;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
public Integer getCompanyType() {
|
||||
return companyType;
|
||||
}
|
||||
public void setCompanyType(Integer companyType) {
|
||||
this.companyType = companyType;
|
||||
}
|
||||
public String getCompanyName() {
|
||||
return companyName;
|
||||
}
|
||||
public void setCompanyName(String companyName) {
|
||||
this.companyName = companyName;
|
||||
}
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
public String getAccountName() {
|
||||
return accountName;
|
||||
}
|
||||
public void setAccountName(String accountName) {
|
||||
this.accountName = accountName;
|
||||
}
|
||||
public Integer getAccountLimit() {
|
||||
return accountLimit;
|
||||
}
|
||||
public void setAccountLimit(Integer accountLimit) {
|
||||
this.accountLimit = accountLimit;
|
||||
}
|
||||
public Integer getAccountType() {
|
||||
return accountType;
|
||||
}
|
||||
public void setAccountType(Integer accountType) {
|
||||
this.accountType = accountType;
|
||||
}
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
public Date getValidStart() {
|
||||
return validStart;
|
||||
}
|
||||
public void setValidStart(Date validStart) {
|
||||
this.validStart = validStart;
|
||||
}
|
||||
public Date getValidEnd() {
|
||||
return validEnd;
|
||||
}
|
||||
public void setValidEnd(Date validEnd) {
|
||||
this.validEnd = validEnd;
|
||||
}
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
public List<TenantPermission> getPermissions() {
|
||||
return permissions;
|
||||
}
|
||||
public void setPermissions(List<TenantPermission> permissions) {
|
||||
this.permissions = permissions;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.jinrui.reference.admin.model.entity;
|
||||
package com.jinrui.reference.core.model.entity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,12 @@ public class NewsApi4VO {
|
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
|
||||
private Date publishTime;
|
||||
|
||||
/**
|
||||
* 报道时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 资讯摘要
|
||||
*/
|
||||
|
|
@ -139,6 +145,14 @@ public class NewsApi4VO {
|
|||
public void setPublishTime(Date publishTime) {
|
||||
this.publishTime = publishTime;
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public String getSummary() {
|
||||
return summary;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
package com.jinrui.reference.core.model.vo.tenant;
|
||||
|
||||
public enum AccountTypeEnum {
|
||||
TRIAL(0, "试用"),
|
||||
sdfdf(1, "正式");
|
||||
|
||||
AccountTypeEnum(int code, String name) {
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
private final int code;
|
||||
private final String name;
|
||||
|
||||
public static String getName(int code) {
|
||||
for (AccountTypeEnum accountTypeEnum :AccountTypeEnum.values()) {
|
||||
if (accountTypeEnum.getCode() == code) {
|
||||
return accountTypeEnum.getName();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package com.jinrui.reference.core.model.vo.tenant;
|
||||
|
||||
public enum CompanyTypeEnum {
|
||||
STAFF(0, "内部"),
|
||||
BANK(1, "银行"),
|
||||
BROKER(2, "券商"),
|
||||
LISTED_COMPANY(3, "上市公司"),
|
||||
OTHER(4, "其它机构");
|
||||
private CompanyTypeEnum(int type, String name) {
|
||||
this.type = type;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
private final int type;
|
||||
private final String name;
|
||||
|
||||
public static String getName(int type) {
|
||||
for (CompanyTypeEnum companyTypeEnum :CompanyTypeEnum.values()) {
|
||||
if (companyTypeEnum.getType() == type) {
|
||||
return companyTypeEnum.getName();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
package com.jinrui.reference.core.model.vo.tenant;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.idev.excel.annotation.write.style.ColumnWidth;
|
||||
import cn.idev.excel.annotation.write.style.HeadStyle;
|
||||
|
||||
@HeadStyle
|
||||
public class ExportTenant implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 7772281396604095846L;
|
||||
|
||||
@ColumnWidth(18)
|
||||
@ExcelProperty("企业类型")
|
||||
private String companyType;
|
||||
@ColumnWidth(16)
|
||||
@ExcelProperty("企业名称")
|
||||
private String companyName;
|
||||
@ColumnWidth(42)
|
||||
@ExcelProperty("账号类型")
|
||||
private String accountType;
|
||||
@ColumnWidth(42)
|
||||
@ExcelProperty("子账号限制")
|
||||
private Integer accountLimit;
|
||||
@ColumnWidth(14)
|
||||
@ExcelProperty("手机号")
|
||||
private String phone;
|
||||
@ColumnWidth(40)
|
||||
@ExcelProperty("账号名称")
|
||||
private String accountName;
|
||||
@ColumnWidth(14)
|
||||
@ExcelProperty("账号有效期")
|
||||
private String validPeriod;
|
||||
@ExcelProperty("创建时间")
|
||||
private String createTime;
|
||||
@ExcelProperty("状态")
|
||||
private String status;
|
||||
public String getCompanyType() {
|
||||
return companyType;
|
||||
}
|
||||
public void setCompanyType(String companyType) {
|
||||
this.companyType = companyType;
|
||||
}
|
||||
public String getCompanyName() {
|
||||
return companyName;
|
||||
}
|
||||
public void setCompanyName(String companyName) {
|
||||
this.companyName = companyName;
|
||||
}
|
||||
public String getAccountType() {
|
||||
return accountType;
|
||||
}
|
||||
public void setAccountType(String accountType) {
|
||||
this.accountType = accountType;
|
||||
}
|
||||
public Integer getAccountLimit() {
|
||||
return accountLimit;
|
||||
}
|
||||
public void setAccountLimit(Integer accountLimit) {
|
||||
this.accountLimit = accountLimit;
|
||||
}
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
public String getAccountName() {
|
||||
return accountName;
|
||||
}
|
||||
public void setAccountName(String accountName) {
|
||||
this.accountName = accountName;
|
||||
}
|
||||
public String getValidPeriod() {
|
||||
return validPeriod;
|
||||
}
|
||||
public void setValidPeriod(String validPeriod) {
|
||||
this.validPeriod = validPeriod;
|
||||
}
|
||||
public String getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
public void setCreateTime(String createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
package com.jinrui.reference.core.model.vo.tenant;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.idev.excel.annotation.write.style.ColumnWidth;
|
||||
import cn.idev.excel.annotation.write.style.HeadStyle;
|
||||
|
||||
@HeadStyle
|
||||
public class ExportTenantUser implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 7772281396604095846L;
|
||||
|
||||
@ColumnWidth(18)
|
||||
@ExcelProperty("姓名")
|
||||
private String name;
|
||||
@ColumnWidth(16)
|
||||
@ExcelProperty("手机号")
|
||||
private String mobile;
|
||||
@ColumnWidth(42)
|
||||
@ExcelProperty("企业名称")
|
||||
private String companyName;
|
||||
@ColumnWidth(42)
|
||||
@ExcelProperty("账号类型")
|
||||
private String accountType;
|
||||
@ExcelProperty("创建时间")
|
||||
private String createTime;
|
||||
@ExcelProperty("变更时间")
|
||||
private String updateTime;
|
||||
@ExcelProperty("状态")
|
||||
private String status;
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public String getMobile() {
|
||||
return mobile;
|
||||
}
|
||||
public void setMobile(String mobile) {
|
||||
this.mobile = mobile;
|
||||
}
|
||||
public String getCompanyName() {
|
||||
return companyName;
|
||||
}
|
||||
public void setCompanyName(String companyName) {
|
||||
this.companyName = companyName;
|
||||
}
|
||||
public String getAccountType() {
|
||||
return accountType;
|
||||
}
|
||||
public void setAccountType(String accountType) {
|
||||
this.accountType = accountType;
|
||||
}
|
||||
public String getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
public void setCreateTime(String createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
public String getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
public void setUpdateTime(String updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
package com.jinrui.reference.core.model.vo.tenant;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class H5TenantDTO {
|
||||
private Integer companyType;
|
||||
private String companyName;
|
||||
private String phone;
|
||||
private String accountName;
|
||||
private Integer accountLimit;
|
||||
private Integer accountType;
|
||||
private Integer status;
|
||||
private Date validStart;
|
||||
private Date validEnd;
|
||||
private Date createTime;
|
||||
private List<TenantPermission> permissions;
|
||||
|
||||
public Integer getCompanyType() {
|
||||
return companyType;
|
||||
}
|
||||
public void setCompanyType(Integer companyType) {
|
||||
this.companyType = companyType;
|
||||
}
|
||||
public String getCompanyName() {
|
||||
return companyName;
|
||||
}
|
||||
public void setCompanyName(String companyName) {
|
||||
this.companyName = companyName;
|
||||
}
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
public String getAccountName() {
|
||||
return accountName;
|
||||
}
|
||||
public void setAccountName(String accountName) {
|
||||
this.accountName = accountName;
|
||||
}
|
||||
public Integer getAccountLimit() {
|
||||
return accountLimit;
|
||||
}
|
||||
public void setAccountLimit(Integer accountLimit) {
|
||||
this.accountLimit = accountLimit;
|
||||
}
|
||||
public Integer getAccountType() {
|
||||
return accountType;
|
||||
}
|
||||
public void setAccountType(Integer accountType) {
|
||||
this.accountType = accountType;
|
||||
}
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
public Date getValidStart() {
|
||||
return validStart;
|
||||
}
|
||||
public void setValidStart(Date validStart) {
|
||||
this.validStart = validStart;
|
||||
}
|
||||
public Date getValidEnd() {
|
||||
return validEnd;
|
||||
}
|
||||
public void setValidEnd(Date validEnd) {
|
||||
this.validEnd = validEnd;
|
||||
}
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
public List<TenantPermission> getPermissions() {
|
||||
return permissions;
|
||||
}
|
||||
public void setPermissions(List<TenantPermission> permissions) {
|
||||
this.permissions = permissions;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
package com.jinrui.reference.core.model.vo.tenant;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class H5TenantQueryDTO {
|
||||
private int page = 1;
|
||||
private int size = 10;
|
||||
private Integer last;
|
||||
private Integer current;
|
||||
private String orderBy;
|
||||
private Integer accountType;
|
||||
private Integer companyType;
|
||||
private Integer status;
|
||||
private String accountName;
|
||||
|
||||
private List<Long> ids;
|
||||
|
||||
public int getPage() {
|
||||
return page;
|
||||
}
|
||||
public void setPage(int page) {
|
||||
this.page = page;
|
||||
}
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
public void setSize(int size) {
|
||||
this.size = size;
|
||||
}
|
||||
public Integer getLast() {
|
||||
return last;
|
||||
}
|
||||
public void setLast(Integer last) {
|
||||
this.last = last;
|
||||
}
|
||||
public Integer getCurrent() {
|
||||
return current;
|
||||
}
|
||||
public void setCurrent(Integer current) {
|
||||
this.current = current;
|
||||
}
|
||||
public String getOrderBy() {
|
||||
return orderBy;
|
||||
}
|
||||
public void setOrderBy(String orderBy) {
|
||||
this.orderBy = orderBy;
|
||||
}
|
||||
public Integer getAccountType() {
|
||||
return accountType;
|
||||
}
|
||||
public void setAccountType(Integer accountType) {
|
||||
this.accountType = accountType;
|
||||
}
|
||||
public Integer getCompanyType() {
|
||||
return companyType;
|
||||
}
|
||||
public void setCompanyType(Integer companyType) {
|
||||
this.companyType = companyType;
|
||||
}
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
public String getAccountName() {
|
||||
return accountName;
|
||||
}
|
||||
public void setAccountName(String accountName) {
|
||||
this.accountName = accountName;
|
||||
}
|
||||
public List<Long> getIds() {
|
||||
return ids;
|
||||
}
|
||||
public void setIds(List<Long> ids) {
|
||||
this.ids = ids;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
package com.jinrui.reference.core.model.vo.tenant;
|
||||
|
||||
public class H5TenantUserDTO {
|
||||
private Long id;
|
||||
private String name;
|
||||
private String mobile;
|
||||
private Long companyName;
|
||||
private String department;
|
||||
private String createBy;
|
||||
private Integer type;
|
||||
private Integer status;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public String getMobile() {
|
||||
return mobile;
|
||||
}
|
||||
public void setMobile(String mobile) {
|
||||
this.mobile = mobile;
|
||||
}
|
||||
public Long getCompanyName() {
|
||||
return companyName;
|
||||
}
|
||||
public void setCompanyName(Long companyName) {
|
||||
this.companyName = companyName;
|
||||
}
|
||||
public String getDepartment() {
|
||||
return department;
|
||||
}
|
||||
public void setDepartment(String department) {
|
||||
this.department = department;
|
||||
}
|
||||
public String getCreateBy() {
|
||||
return createBy;
|
||||
}
|
||||
public void setCreateBy(String createBy) {
|
||||
this.createBy = createBy;
|
||||
}
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
public Integer getType() {
|
||||
return type;
|
||||
}
|
||||
public void setType(Integer type) {
|
||||
this.type = type;
|
||||
}
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
package com.jinrui.reference.core.model.vo.tenant;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class H5TenantVO {
|
||||
private Long id;
|
||||
private Integer companyType;
|
||||
private String companyName;
|
||||
private String phone;
|
||||
private String accountName;
|
||||
private Integer accountLimit;
|
||||
private Integer accountType;
|
||||
private Integer status;
|
||||
private Date validStart;
|
||||
private Date validEnd;
|
||||
private Date createTime;
|
||||
private List<TenantPermission> permissions;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
public Integer getCompanyType() {
|
||||
return companyType;
|
||||
}
|
||||
public void setCompanyType(Integer companyType) {
|
||||
this.companyType = companyType;
|
||||
}
|
||||
public String getCompanyName() {
|
||||
return companyName;
|
||||
}
|
||||
public void setCompanyName(String companyName) {
|
||||
this.companyName = companyName;
|
||||
}
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
public String getAccountName() {
|
||||
return accountName;
|
||||
}
|
||||
public void setAccountName(String accountName) {
|
||||
this.accountName = accountName;
|
||||
}
|
||||
public Integer getAccountLimit() {
|
||||
return accountLimit;
|
||||
}
|
||||
public void setAccountLimit(Integer accountLimit) {
|
||||
this.accountLimit = accountLimit;
|
||||
}
|
||||
public Integer getAccountType() {
|
||||
return accountType;
|
||||
}
|
||||
public void setAccountType(Integer accountType) {
|
||||
this.accountType = accountType;
|
||||
}
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
public Date getValidStart() {
|
||||
return validStart;
|
||||
}
|
||||
public void setValidStart(Date validStart) {
|
||||
this.validStart = validStart;
|
||||
}
|
||||
public Date getValidEnd() {
|
||||
return validEnd;
|
||||
}
|
||||
public void setValidEnd(Date validEnd) {
|
||||
this.validEnd = validEnd;
|
||||
}
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
public List<TenantPermission> getPermissions() {
|
||||
return permissions;
|
||||
}
|
||||
public void setPermissions(List<TenantPermission> permissions) {
|
||||
this.permissions = permissions;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.jinrui.reference.admin.model.vo.admin.user;
|
||||
package com.jinrui.reference.core.model.vo.tenant;
|
||||
|
||||
public class H5UserDTO {
|
||||
private Long id;
|
||||
|
|
@ -8,6 +8,7 @@ public class H5UserDTO {
|
|||
private Integer status;
|
||||
private String createBy;
|
||||
private Integer type;
|
||||
private Long companyName;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
|
|
@ -52,4 +53,10 @@ public class H5UserDTO {
|
|||
public void setType(Integer type) {
|
||||
this.type = type;
|
||||
}
|
||||
public Long getCompanyName() {
|
||||
return companyName;
|
||||
}
|
||||
public void setCompanyName(Long companyName) {
|
||||
this.companyName = companyName;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,10 @@
|
|||
package com.jinrui.reference.admin.model.vo.admin.user;
|
||||
package com.jinrui.reference.core.model.vo.tenant;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class H5UserQueryParam {
|
||||
private int page;
|
||||
private int size;
|
||||
private int page = 1;
|
||||
private int size = 10;
|
||||
private int offset;
|
||||
private Integer last;
|
||||
private Integer current;
|
||||
|
|
@ -12,6 +14,10 @@ public class H5UserQueryParam {
|
|||
private Integer status;
|
||||
private String createBy;
|
||||
private Integer type;
|
||||
private String companyName;
|
||||
private Integer accountType;
|
||||
private Integer active;
|
||||
private List<Long> ids;
|
||||
|
||||
public int getPage() {
|
||||
return page;
|
||||
|
|
@ -80,4 +86,28 @@ public class H5UserQueryParam {
|
|||
public void setType(Integer type) {
|
||||
this.type = type;
|
||||
}
|
||||
public String getCompanyName() {
|
||||
return companyName;
|
||||
}
|
||||
public void setCompanyName(String companyName) {
|
||||
this.companyName = companyName;
|
||||
}
|
||||
public Integer getAccountType() {
|
||||
return accountType;
|
||||
}
|
||||
public void setAccountType(Integer accountType) {
|
||||
this.accountType = accountType;
|
||||
}
|
||||
public Integer getActive() {
|
||||
return active;
|
||||
}
|
||||
public void setActive(Integer active) {
|
||||
this.active = active;
|
||||
}
|
||||
public List<Long> getIds() {
|
||||
return ids;
|
||||
}
|
||||
public void setIds(List<Long> ids) {
|
||||
this.ids = ids;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.jinrui.reference.admin.model.vo.admin.user;
|
||||
package com.jinrui.reference.core.model.vo.tenant;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
|
||||
|
|
@ -9,6 +9,8 @@ public class H5UserUploadData {
|
|||
private String mobile;
|
||||
@ExcelProperty(index = 2)
|
||||
private String department;
|
||||
@ExcelProperty(index = 3)
|
||||
private String companyName;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
|
|
@ -28,4 +30,10 @@ public class H5UserUploadData {
|
|||
public void setDepartment(String department) {
|
||||
this.department = department;
|
||||
}
|
||||
public String getCompanyName() {
|
||||
return companyName;
|
||||
}
|
||||
public void setCompanyName(String companyName) {
|
||||
this.companyName = companyName;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.jinrui.reference.admin.model.vo.admin.user;
|
||||
package com.jinrui.reference.core.model.vo.tenant;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.jinrui.reference.admin.model.vo.admin.user;
|
||||
package com.jinrui.reference.core.model.vo.tenant;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
|
@ -10,6 +10,8 @@ public class H5UserVO {
|
|||
private String name;
|
||||
private String department;
|
||||
private Integer status;
|
||||
private String companyName;
|
||||
private Integer accountType;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
|
||||
private Date createTime;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
|
||||
|
|
@ -66,4 +68,20 @@ public class H5UserVO {
|
|||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public String getCompanyName() {
|
||||
return companyName;
|
||||
}
|
||||
|
||||
public void setCompanyName(String companyName) {
|
||||
this.companyName = companyName;
|
||||
}
|
||||
|
||||
public Integer getAccountType() {
|
||||
return accountType;
|
||||
}
|
||||
|
||||
public void setAccountType(Integer accountType) {
|
||||
this.accountType = accountType;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.jinrui.reference.core.model.vo.tenant;
|
||||
|
||||
public class TenantPermission {
|
||||
private String name;
|
||||
private Integer enabled;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public Integer getEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
public void setEnabled(Integer enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,285 @@
|
|||
package com.jinrui.reference.core.service;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import com.jinrui.reference.core.mapper.H5UserMapper;
|
||||
import com.jinrui.reference.core.mapper.TenantInfoMapper;
|
||||
import com.jinrui.reference.core.model.entity.H5Tenant;
|
||||
import com.jinrui.reference.core.model.vo.PageObject;
|
||||
import com.jinrui.reference.core.model.vo.tenant.AccountTypeEnum;
|
||||
import com.jinrui.reference.core.model.vo.tenant.CompanyTypeEnum;
|
||||
import com.jinrui.reference.core.model.vo.tenant.ExportTenant;
|
||||
import com.jinrui.reference.core.model.vo.tenant.ExportTenantUser;
|
||||
import com.jinrui.reference.core.model.vo.tenant.H5TenantDTO;
|
||||
import com.jinrui.reference.core.model.vo.tenant.H5TenantQueryDTO;
|
||||
import com.jinrui.reference.core.model.vo.tenant.H5TenantUserDTO;
|
||||
import com.jinrui.reference.core.model.vo.tenant.H5TenantVO;
|
||||
import com.jinrui.reference.core.model.vo.tenant.H5UserQueryParam;
|
||||
import com.jinrui.reference.core.model.vo.tenant.H5UserVO;
|
||||
|
||||
import cn.idev.excel.EasyExcel;
|
||||
import cn.idev.excel.ExcelWriter;
|
||||
import cn.idev.excel.support.ExcelTypeEnum;
|
||||
import cn.idev.excel.write.metadata.WriteSheet;
|
||||
|
||||
@Service
|
||||
public class H5TenantService {
|
||||
private static final Logger log = LoggerFactory.getLogger(H5TenantService.class);
|
||||
|
||||
private final TenantInfoMapper tenantInfoMapper;
|
||||
private final H5UserMapper h5UserMapper;
|
||||
|
||||
public H5TenantService(TenantInfoMapper tenantInfoMapper, H5UserMapper h5UserMapper) {
|
||||
this.tenantInfoMapper = tenantInfoMapper;
|
||||
this.h5UserMapper = h5UserMapper;
|
||||
}
|
||||
|
||||
public PageObject<H5TenantVO> queryTenantInfo(H5TenantQueryDTO h5TenantQuery) {
|
||||
int size = h5TenantQuery.getSize();
|
||||
int offset = 0;
|
||||
if (h5TenantQuery.getCurrent() != null) {
|
||||
// offset = (Math.max(0, page - current)) * size;
|
||||
offset = (Math.max(0, h5TenantQuery.getCurrent() - 1)) * size;
|
||||
}
|
||||
List<H5Tenant> h5Tenants;
|
||||
try {
|
||||
h5Tenants = tenantInfoMapper.queryTenantInfo(h5TenantQuery.getAccountType(), h5TenantQuery.getCompanyType(), h5TenantQuery.getStatus(), h5TenantQuery.getAccountName(), h5TenantQuery.getLast(), h5TenantQuery.getOrderBy(), size, offset);
|
||||
} catch (Exception e) {
|
||||
log.error("搜索H5租户信息异常!", e);
|
||||
return PageObject.failedPage(500, "服务器错误,请联系系统管理员!");
|
||||
}
|
||||
|
||||
PageObject<H5TenantVO> pageObject = new PageObject<>();
|
||||
int page = h5TenantQuery.getPage();
|
||||
if (page == 1) {
|
||||
try {
|
||||
int total = tenantInfoMapper.queryTotal(h5TenantQuery.getAccountType(), h5TenantQuery.getCompanyType(), h5TenantQuery.getStatus(), h5TenantQuery.getAccountName(), h5TenantQuery.getLast(), h5TenantQuery.getOrderBy(), size, offset);
|
||||
pageObject.setTotal(total);
|
||||
} catch (Exception e) {
|
||||
log.error("获取H5租户总数异常!", e);
|
||||
return PageObject.failedPage(500, "服务器错误,请联系系统管理员!");
|
||||
}
|
||||
}
|
||||
|
||||
pageObject.setCode(200);
|
||||
pageObject.setCurrent(page);
|
||||
size = Math.min(h5Tenants.size(), size);
|
||||
pageObject.setSize(size);
|
||||
if (CollectionUtils.isEmpty(h5Tenants)) {
|
||||
log.info("搜索结果为空!");
|
||||
pageObject.setData(new ArrayList<>());
|
||||
return pageObject;
|
||||
}
|
||||
|
||||
pageObject.setData(h5Tenants.stream().map(e -> {
|
||||
H5TenantVO h5TenantVO = new H5TenantVO();
|
||||
BeanUtils.copyProperties(e, h5TenantVO);
|
||||
h5TenantVO.setPermissions(e.getPermissions());
|
||||
return h5TenantVO;
|
||||
}).collect(Collectors.toList()));
|
||||
return pageObject;
|
||||
}
|
||||
|
||||
public Long createH5TenantInfo(H5TenantDTO h5TenantDTO) {
|
||||
H5Tenant h5Tenant = new H5Tenant();
|
||||
BeanUtils.copyProperties(h5TenantDTO, h5Tenant);
|
||||
if (!CollectionUtils.isEmpty(h5TenantDTO.getPermissions())) {
|
||||
h5Tenant.setPermissions(h5TenantDTO.getPermissions());
|
||||
}
|
||||
h5Tenant.setStatus(0);
|
||||
tenantInfoMapper.createTenant(h5Tenant);
|
||||
return h5Tenant.getId();
|
||||
}
|
||||
|
||||
public void disableAccount(Long id) {
|
||||
tenantInfoMapper.changeAccountStatus(id, 1);
|
||||
}
|
||||
|
||||
public void enableAccount(Long id) {
|
||||
tenantInfoMapper.changeAccountStatus(id, 0);
|
||||
}
|
||||
|
||||
public void update(H5Tenant h5Tenant) {
|
||||
tenantInfoMapper.updateTenant(h5Tenant);
|
||||
}
|
||||
|
||||
public void createH5TenantUser(H5TenantUserDTO h5TenantUserDTO) {
|
||||
h5TenantUserDTO.setType(0);
|
||||
tenantInfoMapper.createH5User(h5TenantUserDTO);
|
||||
}
|
||||
|
||||
public byte[] exportTenants(H5TenantQueryDTO h5TenantQuery) {
|
||||
try {
|
||||
|
||||
List<H5Tenant> h5Tenants;
|
||||
if (CollectionUtils.isEmpty(h5TenantQuery.getIds())) {
|
||||
int size = h5TenantQuery.getSize();
|
||||
int offset = 0;
|
||||
if (h5TenantQuery.getCurrent() != null) {
|
||||
offset = (Math.max(0, h5TenantQuery.getCurrent() - 1)) * size;
|
||||
}
|
||||
h5Tenants = tenantInfoMapper.queryTenantInfo(h5TenantQuery.getAccountType(), h5TenantQuery.getCompanyType(), h5TenantQuery.getStatus(), h5TenantQuery.getAccountName(), h5TenantQuery.getLast(), h5TenantQuery.getOrderBy(), size, offset);
|
||||
} else {
|
||||
h5Tenants = tenantInfoMapper.getByIds(h5TenantQuery.getIds());
|
||||
}
|
||||
|
||||
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
|
||||
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
List<ExportTenant> data = new ArrayList<>(h5Tenants.size());
|
||||
for (H5Tenant h5Tenant: h5Tenants) {
|
||||
ExportTenant exportTenant = new ExportTenant();
|
||||
exportTenant.setCompanyType(CompanyTypeEnum.getName(h5Tenant.getCompanyType()));
|
||||
exportTenant.setCompanyName(h5Tenant.getCompanyName());
|
||||
exportTenant.setAccountType(AccountTypeEnum.getName(h5Tenant.getAccountType()));
|
||||
exportTenant.setAccountLimit(h5Tenant.getAccountLimit());
|
||||
exportTenant.setPhone(h5Tenant.getPhone());
|
||||
exportTenant.setAccountName(h5Tenant.getAccountName());
|
||||
Date validStartDate = h5Tenant.getValidStart();
|
||||
Date validEndDate = h5Tenant.getValidEnd();
|
||||
String validStart = sdf1.format(validStartDate);
|
||||
String validEnd = sdf1.format(validEndDate);
|
||||
|
||||
exportTenant.setValidPeriod(validStart + "~" + validEnd);
|
||||
exportTenant.setCreateTime(sdf2.format(h5Tenant.getCreateTime()));
|
||||
exportTenant.setStatus(Objects.equals(h5Tenant.getStatus(), 0) ? "启用":"禁用");
|
||||
|
||||
data.add(exportTenant);
|
||||
}
|
||||
|
||||
String tmpPath = System.getProperty("java.io.tmpdir");
|
||||
File file = new File(String.format("%s/%d.xlsx", tmpPath, System.currentTimeMillis()));
|
||||
|
||||
ExcelWriter excelWriter = EasyExcel.write(file.getPath()).excelType(ExcelTypeEnum.XLSX).build();
|
||||
WriteSheet writeSheet = EasyExcel.writerSheet("租户信息").head(ExportTenant.class).build();
|
||||
excelWriter.write(data, writeSheet);
|
||||
excelWriter.finish();
|
||||
byte[] bytes = FileUtils.readFileToByteArray(file);
|
||||
return bytes;
|
||||
} catch (Exception e) {
|
||||
log.error("导出租户信息异常!", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void updateH5TenantUser(H5TenantUserDTO h5TenantUserDTO) {
|
||||
tenantInfoMapper.updateH5User(h5TenantUserDTO);
|
||||
}
|
||||
|
||||
public PageObject<H5UserVO> queryTenantUser(H5UserQueryParam h5UserQueryParam) {
|
||||
int offset = 0;
|
||||
Integer current = h5UserQueryParam.getCurrent();
|
||||
int size = h5UserQueryParam.getSize();
|
||||
if (current != null) {
|
||||
offset = (Math.max(0, current - 1)) * size;
|
||||
}
|
||||
int page = h5UserQueryParam.getPage();
|
||||
h5UserQueryParam.setOffset(offset);
|
||||
h5UserQueryParam.setType(0);
|
||||
List<H5UserVO> h5UserList;
|
||||
try {
|
||||
h5UserList = h5UserMapper.queryH5User(h5UserQueryParam);
|
||||
} catch (Exception e) {
|
||||
log.error("搜索新闻异常!", e);
|
||||
return PageObject.failedPage(500, "服务器错误,请联系系统管理员!");
|
||||
}
|
||||
|
||||
PageObject<H5UserVO> pageObject = new PageObject<>();
|
||||
if (page == 1) {
|
||||
try {
|
||||
int total = h5UserMapper.queryTotal(h5UserQueryParam);
|
||||
pageObject.setTotal(total);
|
||||
} catch (Exception e) {
|
||||
log.error("获取新闻总数异常!", e);
|
||||
return PageObject.failedPage(500, "服务器错误,请联系系统管理员!");
|
||||
}
|
||||
}
|
||||
|
||||
pageObject.setCode(200);
|
||||
pageObject.setCurrent(page);
|
||||
size = Math.min(h5UserList.size(), size);
|
||||
pageObject.setSize(size);
|
||||
if (CollectionUtils.isEmpty(h5UserList)) {
|
||||
log.info("搜索结果为空!");
|
||||
pageObject.setData(Collections.emptyList());
|
||||
return pageObject;
|
||||
}
|
||||
|
||||
pageObject.setData(h5UserList);
|
||||
return pageObject;
|
||||
}
|
||||
|
||||
public byte[] exportTenantUsers(H5UserQueryParam h5UserQuery) {
|
||||
try {
|
||||
|
||||
List<H5UserVO> h5Tenants;
|
||||
if (CollectionUtils.isEmpty(h5UserQuery.getIds())) {
|
||||
int offset = 0;
|
||||
Integer current = h5UserQuery.getCurrent();
|
||||
int size = h5UserQuery.getSize();
|
||||
if (current != null) {
|
||||
offset = (Math.max(0, current - 1)) * size;
|
||||
}
|
||||
h5UserQuery.setOffset(offset);
|
||||
h5UserQuery.setType(0);
|
||||
h5Tenants = h5UserMapper.queryH5User(h5UserQuery);
|
||||
} else {
|
||||
h5Tenants = h5UserMapper.getByIds(h5UserQuery.getIds());
|
||||
}
|
||||
|
||||
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
List<ExportTenantUser> data = new ArrayList<>(h5Tenants.size());
|
||||
for (H5UserVO h5TenantUser: h5Tenants) {
|
||||
ExportTenantUser exportTenantUser = new ExportTenantUser();
|
||||
exportTenantUser.setMobile(h5TenantUser.getMobile());
|
||||
exportTenantUser.setName(h5TenantUser.getName());
|
||||
exportTenantUser.setCompanyName(h5TenantUser.getName());
|
||||
if (h5TenantUser.getAccountType() != null) {
|
||||
exportTenantUser.setAccountType(AccountTypeEnum.getName(h5TenantUser.getAccountType()));
|
||||
} else {
|
||||
exportTenantUser.setAccountType("");
|
||||
}
|
||||
exportTenantUser.setCreateTime(sdf2.format(h5TenantUser.getCreateTime()));
|
||||
exportTenantUser.setUpdateTime(sdf2.format(h5TenantUser.getUpdateTime()));
|
||||
exportTenantUser.setStatus(Objects.equals(h5TenantUser.getStatus(), 0) ? "启用":"禁用");
|
||||
data.add(exportTenantUser);
|
||||
}
|
||||
|
||||
String tmpPath = System.getProperty("java.io.tmpdir");
|
||||
File file = new File(String.format("%s/%d.xlsx", tmpPath, System.currentTimeMillis()));
|
||||
|
||||
ExcelWriter excelWriter = EasyExcel.write(file.getPath()).excelType(ExcelTypeEnum.XLSX).build();
|
||||
WriteSheet writeSheet = EasyExcel.writerSheet("租户用户信息").head(ExportTenantUser.class).build();
|
||||
excelWriter.write(data, writeSheet);
|
||||
excelWriter.finish();
|
||||
byte[] bytes = FileUtils.readFileToByteArray(file);
|
||||
return bytes;
|
||||
} catch (Exception e) {
|
||||
log.error("导出租户用户信息异常!", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void disableUserAccount(Long id) {
|
||||
h5UserMapper.changeAccountStatus(id, 1);
|
||||
|
||||
}
|
||||
|
||||
public void enableUserAccount(Long id) {
|
||||
h5UserMapper.changeAccountStatus(id, 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1407,7 +1407,7 @@ public class NewsService {
|
|||
* @param last
|
||||
* @return
|
||||
*/
|
||||
public ResultObject<List<NewsApi4VO>> requestNewsByApi4(Integer num, Long last, Integer clientType) {
|
||||
public ResultObject<List<NewsApi4VO>> requestNewsByApi4(Integer num, Date last, Integer clientType) {
|
||||
List<NewsApi4VO> result = newsMapper.queryNewsByApi4(last, num, clientType);
|
||||
|
||||
Map<Long, Industry> industryMap = industryMapper.queryAll().stream().collect(Collectors.toMap(Industry::getId, Function.identity()));
|
||||
|
|
|
|||
Loading…
Reference in New Issue