Merge remote-tracking branch 'remotes/origin/dev' into test
commit
7e7f7ed1ec
@ -0,0 +1,33 @@
|
|||||||
|
package cn.estsh.i3plus.core.api.iservice.busi;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
||||||
|
import cn.estsh.i3plus.pojo.base.common.Pager;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.bean.SysLogUserLogin;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description : 用户登录日志
|
||||||
|
* @Reference :
|
||||||
|
* @Author : yunhao
|
||||||
|
* @CreateDate : 2020-08-31 11:47
|
||||||
|
* @Modify:
|
||||||
|
**/
|
||||||
|
public interface ISysLogUserLoginService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户登录日志分页查询
|
||||||
|
* @param sysLogUserLogin 查询条件
|
||||||
|
* @param pager 分页信息
|
||||||
|
* @return 查询结果
|
||||||
|
*/
|
||||||
|
ListPager<SysLogUserLogin> querySysLogUserLoginByPager(SysLogUserLogin sysLogUserLogin, Pager pager);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户登录日志查询
|
||||||
|
* @param sysLogUserLogin 查询条件
|
||||||
|
* @return 查询结果
|
||||||
|
*/
|
||||||
|
List<SysLogUserLogin> findSysUserLoginList(SysLogUserLogin sysLogUserLogin);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
package cn.estsh.i3plus.core.api.iservice.busi;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.pojo.platform.bean.SysOrderNoRecord;
|
||||||
|
import cn.estsh.impp.framework.base.service.ICrudService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description :
|
||||||
|
* @Reference :
|
||||||
|
* @Author : yunhao
|
||||||
|
* @CreateDate : 2020-09-03 22:01
|
||||||
|
* @Modify:
|
||||||
|
**/
|
||||||
|
public interface ISysOrderNoRecordService extends ICrudService<SysOrderNoRecord> {
|
||||||
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
package cn.estsh.i3plus.core.api.iservice.busi;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.pojo.platform.bean.SysRefUserExternal;
|
||||||
|
import cn.estsh.impp.framework.base.service.ICrudService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description : 用户外部关联关系
|
||||||
|
* @Reference :
|
||||||
|
* @Author : yunhao
|
||||||
|
* @CreateDate : 2020-09-03 13:45
|
||||||
|
* @Modify:
|
||||||
|
**/
|
||||||
|
public interface ISysRefUserExternalService extends ICrudService<SysRefUserExternal> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据外部值和关联关系查询用户id
|
||||||
|
* @param externalRef 外部关联关系
|
||||||
|
* @param valueList 值集合
|
||||||
|
* @return 用户id
|
||||||
|
*/
|
||||||
|
List<Long> findUserByExternalRefAndValue(Integer externalRef, List<String> valueList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据外部关系和用户id查询外部关联值
|
||||||
|
* @param externalRef 关系
|
||||||
|
* @param userIdList 用户id列表
|
||||||
|
* @return 外部关联值
|
||||||
|
*/
|
||||||
|
List<String> findExternalValueByRefAndUserId(Integer externalRef, List<Long> userIdList);
|
||||||
|
|
||||||
|
SysRefUserExternal getSysRefUserExternalByRefAndValue(Integer externalRef, String value);
|
||||||
|
|
||||||
|
SysRefUserExternal getSysRefUserExternalByRefAndUserId(Integer externalRef, Long userId);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,101 @@
|
|||||||
|
package cn.estsh.i3plus.core.apiservice.controller.busi;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.core.api.iservice.busi.ISysLogUserLoginService;
|
||||||
|
import cn.estsh.i3plus.platform.common.tool.ExcelTool;
|
||||||
|
import cn.estsh.i3plus.platform.common.tool.StringTool;
|
||||||
|
import cn.estsh.i3plus.platform.common.util.CommonConstWords;
|
||||||
|
import cn.estsh.i3plus.platform.common.util.FileContentTypeTool;
|
||||||
|
import cn.estsh.i3plus.platform.common.util.PlatformConstWords;
|
||||||
|
import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
||||||
|
import cn.estsh.i3plus.pojo.base.common.Pager;
|
||||||
|
import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.bean.SysLogUserLogin;
|
||||||
|
import cn.estsh.impp.framework.base.controller.CoreBaseController;
|
||||||
|
import cn.estsh.impp.framework.boot.exception.ImppBusiException;
|
||||||
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
||||||
|
import cn.estsh.impp.framework.boot.util.ImppRedis;
|
||||||
|
import cn.estsh.impp.framework.boot.util.ResultBean;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.apache.commons.io.FileUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.persistence.EntityManager;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.*;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description :
|
||||||
|
* @Reference :
|
||||||
|
* @Author : yunhao
|
||||||
|
* @CreateDate : 2020-08-31 11:45
|
||||||
|
* @Modify:
|
||||||
|
**/
|
||||||
|
@RestController
|
||||||
|
@Api(tags = "用户登录日志")
|
||||||
|
@RequestMapping(PlatformConstWords.BASE_URL + "/sys-log-user-login")
|
||||||
|
public class SysLogUserLoginController extends CoreBaseController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysLogUserLoginService sysLogUserLoginService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EntityManager entityManager;
|
||||||
|
|
||||||
|
@Resource(name= CommonConstWords.IMPP_REDIS_RES)
|
||||||
|
private ImppRedis redisRes;
|
||||||
|
|
||||||
|
@GetMapping("/query")
|
||||||
|
@ApiOperation(value = "定时任务日志分页复杂查询",notes = "定时任务日志分页复杂查询")
|
||||||
|
public ResultBean querySysLogUserLogin(SysLogUserLogin sysLogUserLogin, Pager pager){
|
||||||
|
try {
|
||||||
|
ListPager logUserLoginListPager = sysLogUserLoginService.querySysLogUserLoginByPager(sysLogUserLogin, pager);
|
||||||
|
return ResultBean.success("查询成功").setListPager(logUserLoginListPager).setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
||||||
|
}catch(ImppBusiException busExcep){
|
||||||
|
return ResultBean.fail(busExcep);
|
||||||
|
}catch(Exception e){
|
||||||
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export")
|
||||||
|
@ApiOperation(value = "定时任务日志分页复杂查询",notes = "定时任务日志分页复杂查询")
|
||||||
|
public void exportSysLogUserLogin(SysLogUserLogin sysLogUserLogin, HttpServletResponse response) throws Exception {
|
||||||
|
File file = null;
|
||||||
|
try {
|
||||||
|
List<SysLogUserLogin> list = sysLogUserLoginService.findSysUserLoginList(sysLogUserLogin);
|
||||||
|
|
||||||
|
ExcelTool excelTool = new ExcelTool(entityManager, redisRes);
|
||||||
|
String fileName = "log-user-login-" + System.currentTimeMillis() + ".xls";
|
||||||
|
file = new File(fileName);
|
||||||
|
file.createNewFile();
|
||||||
|
File excle = excelTool.exportData(file, list, SysLogUserLogin.class, (LinkedHashMap<String, String>) ExcelTool.getColName(SysLogUserLogin.class));
|
||||||
|
|
||||||
|
response.setContentType("application/force-download"); // 设置强制下载不打开
|
||||||
|
response.addHeader("Content-Disposition", "attachment;fileName=" + fileName); // 设置文件名
|
||||||
|
response.addHeader("Content-type", FileContentTypeTool.getContentType(StringTool.getStringFileSuffix(fileName,true)));
|
||||||
|
|
||||||
|
// 设置文件名
|
||||||
|
try (BufferedInputStream bis = new BufferedInputStream(new DataInputStream(new FileInputStream(excle)))) {
|
||||||
|
OutputStream os = response.getOutputStream();
|
||||||
|
byte[] buffer = new byte[1024];
|
||||||
|
int i = bis.read(buffer);
|
||||||
|
while (i != -1) {
|
||||||
|
os.write(buffer, 0, i);
|
||||||
|
i = bis.read(buffer);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
FileUtils.deleteQuietly(file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,55 @@
|
|||||||
|
package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.core.api.iservice.busi.ISysLogUserLoginService;
|
||||||
|
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
|
||||||
|
import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
||||||
|
import cn.estsh.i3plus.pojo.base.common.Pager;
|
||||||
|
import cn.estsh.i3plus.pojo.base.common.PagerHelper;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.bean.SysLogUserLogin;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.repository.SysLogUserLoginRepository;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.sqlpack.CoreHqlPack;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description : 用户登录日志
|
||||||
|
* @Reference :
|
||||||
|
* @Author : yunhao
|
||||||
|
* @CreateDate : 2020-08-31 11:51
|
||||||
|
* @Modify:
|
||||||
|
**/
|
||||||
|
@Service
|
||||||
|
public class SysLogUserLoginService implements ISysLogUserLoginService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysLogUserLoginRepository sysLogUserLoginRDao;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户登录日志分页查询
|
||||||
|
*
|
||||||
|
* @param sysLogUserLogin 查询条件
|
||||||
|
* @param pager 分页信息
|
||||||
|
* @return 查询结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ListPager<SysLogUserLogin> querySysLogUserLoginByPager(SysLogUserLogin sysLogUserLogin, Pager pager) {
|
||||||
|
DdlPackBean ddlPackBean = CoreHqlPack.packHqlQuerySysLogUserLogin(sysLogUserLogin);
|
||||||
|
int count = sysLogUserLoginRDao.findByHqlWhereCount(ddlPackBean);
|
||||||
|
PagerHelper.getPager(pager, count);
|
||||||
|
return new ListPager<>(sysLogUserLoginRDao.findByHqlWherePage(ddlPackBean, pager), pager);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户登录日志查询
|
||||||
|
*
|
||||||
|
* @param sysLogUserLogin 查询条件
|
||||||
|
* @return 查询结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<SysLogUserLogin> findSysUserLoginList(SysLogUserLogin sysLogUserLogin) {
|
||||||
|
DdlPackBean ddlPackBean = CoreHqlPack.packHqlQuerySysLogUserLogin(sysLogUserLogin);
|
||||||
|
return sysLogUserLoginRDao.findByHqlWhere(ddlPackBean);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.core.api.iservice.busi.ISysOrderNoRecordService;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.bean.SysOrderNoRecord;
|
||||||
|
import cn.estsh.impp.framework.base.service.CrudService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description :
|
||||||
|
* @Reference :
|
||||||
|
* @Author : yunhao
|
||||||
|
* @CreateDate : 2020-09-03 22:02
|
||||||
|
* @Modify:
|
||||||
|
**/
|
||||||
|
@Service
|
||||||
|
public class SysOrderNoRecordService extends CrudService<SysOrderNoRecord> implements ISysOrderNoRecordService {
|
||||||
|
}
|
@ -0,0 +1,65 @@
|
|||||||
|
package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.core.api.iservice.busi.ISysRefUserExternalService;
|
||||||
|
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.bean.SysRefUserExternal;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.sqlpack.CoreHqlPack;
|
||||||
|
import cn.estsh.impp.framework.base.service.CrudService;
|
||||||
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description : 用户外部关系
|
||||||
|
* @Reference :
|
||||||
|
* @Author : yunhao
|
||||||
|
* @CreateDate : 2020-09-03 13:46
|
||||||
|
* @Modify:
|
||||||
|
**/
|
||||||
|
@Service
|
||||||
|
public class SysRefUserExternalService extends CrudService<SysRefUserExternal> implements ISysRefUserExternalService {
|
||||||
|
|
||||||
|
public List<Long> findUserByExternalRefAndValue(Integer externalRef, List<String> valueList) {
|
||||||
|
List<Long> userIdList = new ArrayList<>();
|
||||||
|
|
||||||
|
DdlPackBean ddlPackBean = CoreHqlPack.packHqlFindUserIdByExternalRef(externalRef, valueList);
|
||||||
|
List<SysRefUserExternal> sysRefUserExternalList = getRepository().findByHqlWhere(ddlPackBean);
|
||||||
|
if (CollectionUtils.isNotEmpty(sysRefUserExternalList)) {
|
||||||
|
sysRefUserExternalList.forEach(item -> userIdList.add(item.getUserId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return userIdList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> findExternalValueByRefAndUserId(Integer externalRef, List<Long> userIdList) {
|
||||||
|
List<String> refValList = new ArrayList<>();
|
||||||
|
|
||||||
|
DdlPackBean ddlPackBean = CoreHqlPack.packHqlFindExternalRefByUserId(externalRef, userIdList);
|
||||||
|
List<SysRefUserExternal> sysRefUserExternalList = getRepository().findByHqlWhere(ddlPackBean);
|
||||||
|
if (CollectionUtils.isNotEmpty(sysRefUserExternalList)) {
|
||||||
|
sysRefUserExternalList.forEach(item -> refValList.add(item.getRefValue()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return refValList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SysRefUserExternal getSysRefUserExternalByRefAndValue(Integer externalRef, String value) {
|
||||||
|
SysRefUserExternal sysRefUserExternal = new SysRefUserExternal();
|
||||||
|
sysRefUserExternal.setExternalRef(externalRef);
|
||||||
|
sysRefUserExternal.setRefValue(value);
|
||||||
|
return getRepository().getByProperty(CoreHqlPack.packHqlGetSysRefUserExternal(sysRefUserExternal));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SysRefUserExternal getSysRefUserExternalByRefAndUserId(Integer externalRef, Long userId) {
|
||||||
|
SysRefUserExternal sysRefUserExternal = new SysRefUserExternal();
|
||||||
|
sysRefUserExternal.setExternalRef(externalRef);
|
||||||
|
sysRefUserExternal.setUserId(userId);
|
||||||
|
return getRepository().getByProperty(CoreHqlPack.packHqlGetSysRefUserExternal(sysRefUserExternal));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue