parent
8ebe456cab
commit
7405bf575f
@ -0,0 +1,85 @@
|
|||||||
|
package cn.estsh.i3plus.core.api.iservice.base;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.pojo.base.shirotoken.UserToken;
|
||||||
|
import cn.estsh.i3plus.pojo.model.flatform.UserModel;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.bean.SessionUser;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.bean.SysUser;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description : 用户服务
|
||||||
|
* @Reference :
|
||||||
|
* @Author : wei.peng
|
||||||
|
* @Date : 2018-10-25 16:21
|
||||||
|
* @Modify :
|
||||||
|
**/
|
||||||
|
public interface ISysUserService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户登录
|
||||||
|
* @param loginName 登录名
|
||||||
|
* @param password 登录密码
|
||||||
|
* @param languageCode 界面语言
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
SessionUser queryUserLogin(String loginName, String password, String languageCode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改权限状态
|
||||||
|
* @param id 修改权限状态
|
||||||
|
* @param status 状态
|
||||||
|
* @param user 当前会话用户
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
void updateSysUserStatus(String id, int status, SessionUser user);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户信息
|
||||||
|
* @param model 封装的用户对象
|
||||||
|
* @param user 当前会话用户
|
||||||
|
*/
|
||||||
|
SysUser updateSysUserModel(UserModel model, SessionUser user);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新建用户信息
|
||||||
|
* @param model 用户封装对象
|
||||||
|
* @param user 当前会话用户
|
||||||
|
*/
|
||||||
|
SysUser insertSysUserModel(UserModel model,SessionUser user);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据Key 删除数据
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
void deleteSysUserById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<SysUser> findSysUserAll();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id 数据
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
SysUser getSysUserById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据登录名称 获取用户信息
|
||||||
|
* @param loginName
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
SysUser getSysUserByLoginName(String loginName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 封装用户详细信息
|
||||||
|
* @param user
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
SysUser getSysUserInfo(SysUser user);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,50 @@
|
|||||||
|
package cn.estsh.i3plus.core.api.iservice.busi;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.pojo.platform.bean.SessionUser;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.bean.SysRole;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.bean.TaskTimeExpression;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description : 定时任务表达式业务接口
|
||||||
|
* @Reference :
|
||||||
|
* @Author : wei.peng
|
||||||
|
* @Date : 2018-10-22 16:58:43.771
|
||||||
|
* @Modify :
|
||||||
|
**/
|
||||||
|
public interface ITaskTimeExpressionService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改数据
|
||||||
|
* @param taskTimeExpression
|
||||||
|
*/
|
||||||
|
void updateTaskTimeExpression(TaskTimeExpression taskTimeExpression);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据Key 删除数据
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
void deleteTaskTimeExpressionById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增数据
|
||||||
|
* @param taskTimeExpression
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
TaskTimeExpression insertTaskTimeExpression(TaskTimeExpression taskTimeExpression);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<TaskTimeExpression> findTaskTimeExpressionAll();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID 查询任务表达式
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
TaskTimeExpression getTaskTimeExpressionById(String id);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,48 @@
|
|||||||
|
package cn.estsh.i3plus.core.api.iservice.busi;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.pojo.platform.bean.SessionUser;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.bean.TaskTimeRecording;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description : 定时任务执行记录业务接口
|
||||||
|
* @Reference :
|
||||||
|
* @Author : wei.peng
|
||||||
|
* @Date : 2018-10-22 16:58:44.005
|
||||||
|
* @Modify :
|
||||||
|
**/
|
||||||
|
public interface ITaskTimeRecordingService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改数据
|
||||||
|
* @param taskTimeRecording
|
||||||
|
*/
|
||||||
|
void updateTaskTimedRecording(TaskTimeRecording taskTimeRecording);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据Key 删除数据
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
void deleteTaskTimedRecordingById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增数据
|
||||||
|
* @param taskTimeRecording
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
TaskTimeRecording insertTaskTimedRecording(TaskTimeRecording taskTimeRecording);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<TaskTimeRecording> findTaskTimedRecordingAll();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id 数据
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
TaskTimeRecording getTaskTimedRecordingById(String id);
|
||||||
|
}
|
@ -0,0 +1,56 @@
|
|||||||
|
package cn.estsh.i3plus.core.api.iservice.busi;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.pojo.platform.bean.SessionUser;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.bean.TaskTime;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description : 定时任务业务接口
|
||||||
|
* @Reference :
|
||||||
|
* @Author : wei.peng
|
||||||
|
* @Date : 2018-10-22 16:58:43.968
|
||||||
|
* @Modify :
|
||||||
|
**/
|
||||||
|
public interface ITaskTimeService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改数据
|
||||||
|
* @param taskTime
|
||||||
|
*/
|
||||||
|
void updateTaskTimed(TaskTime taskTime);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改任务状态
|
||||||
|
* @param id 任务ID
|
||||||
|
* @param status 任务状态
|
||||||
|
* @param user 当前会话用户
|
||||||
|
*/
|
||||||
|
void updateTaskTimedStatus(String id, int status, SessionUser user);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据Key 删除数据
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
void deleteTaskTimedById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增数据
|
||||||
|
* @param taskTime
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
TaskTime insertTaskTimed(TaskTime taskTime);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<TaskTime> findTaskTimedAll();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id 数据
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
TaskTime getTaskTimedById(String id);
|
||||||
|
}
|
@ -0,0 +1,91 @@
|
|||||||
|
package cn.estsh.i3plus.core.apiservice.controller.base;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.core.api.iservice.base.ISysUserService;
|
||||||
|
import cn.estsh.i3plus.core.api.iservice.base.ISystemLoginService;
|
||||||
|
import cn.estsh.i3plus.core.apiservice.controller.DemoAuthController;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.bean.SessionUser;
|
||||||
|
import cn.estsh.impp.framework.boot.auth.AuthUtil;
|
||||||
|
import cn.estsh.impp.framework.boot.exception.ImppBusiException;
|
||||||
|
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.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description : 用户权限服务
|
||||||
|
* @Reference :
|
||||||
|
* @Author : wei.peng
|
||||||
|
* @Date : 2018-10-25 21:01
|
||||||
|
* @Modify :
|
||||||
|
**/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/auth")
|
||||||
|
@Api(description="用户所有权限操作服务")
|
||||||
|
public class AuthController {
|
||||||
|
|
||||||
|
public static final Logger LOGGER = LoggerFactory.getLogger(DemoAuthController.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISystemLoginService systemLoginService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysUserService userService;
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping(value="/login")
|
||||||
|
@ApiOperation(value="登陆",notes="登陆")
|
||||||
|
public ResultBean login(String loginName, String loginPwd, String languageCode){
|
||||||
|
LOGGER.info("用户登陆 loginName:{} loginPwd:{} languageCode:{}",loginName,loginPwd,languageCode);
|
||||||
|
try {
|
||||||
|
SessionUser sUser = userService.queryUserLogin(loginName,loginPwd,languageCode);
|
||||||
|
LOGGER.info("会员登陆:{}",sUser);
|
||||||
|
AuthUtil.setSessionObject("languageCode",languageCode);
|
||||||
|
return new ResultBean(true,"");
|
||||||
|
} catch (ImppBusiException e) {
|
||||||
|
return new ResultBean(false,e.getErrorDetail() + ",so:" + e.getErrorSolution());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping(value="/logout")
|
||||||
|
@ApiOperation(value="登出",notes="登出")
|
||||||
|
public ResultBean logout(){
|
||||||
|
LOGGER.info("用户退出...");
|
||||||
|
try {
|
||||||
|
AuthUtil.logout();
|
||||||
|
return new ResultBean(true,"");
|
||||||
|
} catch (ImppBusiException e) {
|
||||||
|
return new ResultBean(false,e.getErrorDetail() + ",so:" + e.getErrorSolution());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping(value="/getUserInfo")
|
||||||
|
@ApiOperation(value="获取登录用户信息",notes="获取当前登录用户详细信息")
|
||||||
|
public ResultBean getUserInfo(){
|
||||||
|
LOGGER.info("获取用户信息...lang:{}",AuthUtil.getSessionAttribute("languageCode"));
|
||||||
|
try {
|
||||||
|
SessionUser sUser = AuthUtil.getSessionUser();
|
||||||
|
LOGGER.info("用户:{}",sUser);
|
||||||
|
return new ResultBean(true,"",sUser);
|
||||||
|
} catch (ImppBusiException e) {
|
||||||
|
return new ResultBean(false,e.getErrorDetail() + ",so:" + e.getErrorSolution());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -1,19 +0,0 @@
|
|||||||
package cn.estsh.i3plus.core.apiservice.dao;
|
|
||||||
|
|
||||||
import cn.estsh.i3plus.pojo.platform.bean.SysMenu;
|
|
||||||
import org.springframework.data.jpa.repository.Query;
|
|
||||||
import org.springframework.data.repository.CrudRepository;
|
|
||||||
import org.springframework.data.repository.query.Param;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description :
|
|
||||||
* @Reference :
|
|
||||||
* @Author : wei.peng
|
|
||||||
* @Date : 2018-10-22 23:54
|
|
||||||
* @Modify :
|
|
||||||
**/
|
|
||||||
public interface ISysMenuDao {
|
|
||||||
|
|
||||||
@Query("select count(id ) SysMenu sm where sm.parentId = :parentId")
|
|
||||||
long queryCountByParentId(@Param("id") long parentId);
|
|
||||||
}
|
|
@ -0,0 +1,44 @@
|
|||||||
|
package cn.estsh.i3plus.core.apiservice.dao;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.pojo.platform.bean.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description : 用户权限
|
||||||
|
* @Reference :
|
||||||
|
* @Author : wei.peng
|
||||||
|
* @Date : 2018-10-25 20:24
|
||||||
|
* @Modify :
|
||||||
|
**/
|
||||||
|
public interface IUserPermissionDao {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户所有部门
|
||||||
|
* @param user
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<Department> findDepartmentByUser(SysUser user);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户所有角色
|
||||||
|
* @param user
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<SysRole> findSysRoleByUser(SysUser user);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户所有功能权限
|
||||||
|
* @param user
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<SysMenu> findSysMenuByUser(SysUser user);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户所有岗位
|
||||||
|
* @param user
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<Position> findPositionByUser(SysUser user);
|
||||||
|
|
||||||
|
}
|
@ -1,38 +0,0 @@
|
|||||||
package cn.estsh.i3plus.core.apiservice.daoimpl;
|
|
||||||
|
|
||||||
import cn.estsh.i3plus.core.apiservice.dao.ISysMenuDao;
|
|
||||||
import cn.estsh.i3plus.pojo.platform.bean.SysMenu;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import javax.persistence.EntityManager;
|
|
||||||
import javax.persistence.criteria.CriteriaBuilder;
|
|
||||||
import javax.persistence.criteria.CriteriaQuery;
|
|
||||||
import javax.persistence.criteria.ParameterExpression;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description :
|
|
||||||
* @Reference :
|
|
||||||
* @Author : wei.peng
|
|
||||||
* @Date : 2018-10-22 23:55
|
|
||||||
* @Modify :
|
|
||||||
**/
|
|
||||||
@Service
|
|
||||||
public class ISysMenuDaoImpl implements ISysMenuDao {
|
|
||||||
|
|
||||||
public static final Logger LOGGER = LoggerFactory.getLogger(ISysMenuDaoImpl.class);
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private EntityManager entityManager;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long queryCountByParentId(long parentId) {
|
|
||||||
LOGGER.info(" Parent Id :{}",parentId);
|
|
||||||
String hql = "select count(id) from SysMenu as sm where parentId =:parentId";
|
|
||||||
|
|
||||||
return (long)entityManager.createQuery(hql)
|
|
||||||
.setParameter("parentId",parentId).getSingleResult();
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,70 @@
|
|||||||
|
package cn.estsh.i3plus.core.apiservice.daoimpl;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.core.apiservice.dao.IUserPermissionDao;
|
||||||
|
import cn.estsh.i3plus.core.apiservice.serviceimpl.busi.CoreTreeServiceImpl;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.bean.*;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.persistence.EntityManager;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description :
|
||||||
|
* @Reference :
|
||||||
|
* @Author : wei.peng
|
||||||
|
* @Date : 2018-10-25 20:32
|
||||||
|
* @Modify :
|
||||||
|
**/
|
||||||
|
@Service
|
||||||
|
public class UserPermissionDaoImpl implements IUserPermissionDao {
|
||||||
|
|
||||||
|
public static final Logger LOGGER = LoggerFactory.getLogger(UserPermissionDaoImpl.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EntityManager entityManager;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Department> findDepartmentByUser(SysUser user) {
|
||||||
|
LOGGER.info(" 查询用户所有部门 user id:{}", user.getId());
|
||||||
|
String hql = "select d from RefUserDepartment as rud " +
|
||||||
|
" left join Department as d on d.id = rud.departmentId " +
|
||||||
|
" where rud.userId =:userId";
|
||||||
|
return entityManager.createQuery(hql).setParameter("userId",user.getId()).getResultList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SysRole> findSysRoleByUser(SysUser user) {
|
||||||
|
LOGGER.info(" 查询用户所有角色 user id:{}", user.getId());
|
||||||
|
|
||||||
|
String hql = "select sr from RefUserRole as rur " +
|
||||||
|
" left join SysRole as sr on sr.id = rur.roleId " +
|
||||||
|
" where rur.userId =:userId";
|
||||||
|
//hql = "select rur from RefUserRole as rur,SysRole as where rur.userId =:userId and sr.id = rur.roleId";
|
||||||
|
return entityManager.createQuery(hql).setParameter("userId",user.getId()).getResultList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SysMenu> findSysMenuByUser(SysUser user) {
|
||||||
|
LOGGER.info(" 查询用户所有菜单 user id:{}", user.getId());
|
||||||
|
String hql = "select sm from RefUserRole as rur " +
|
||||||
|
" left join RefRoleMenu as rrm on rrm.roleId = rur.roleId" +
|
||||||
|
" left join SysMenu as sm on sm.id = rrm.menuId" +
|
||||||
|
" where rur.userId =:userId";
|
||||||
|
return entityManager.createQuery(hql).setParameter("userId",user.getId()).getResultList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Position> findPositionByUser(SysUser user) {
|
||||||
|
LOGGER.info(" 查询用户所有岗位 user id:{}", user.getId());
|
||||||
|
String hql = "select p from RefUserPosition as rup " +
|
||||||
|
" left join Position as p on p.id = rup.positionId" +
|
||||||
|
" where rup.userId =:userId";
|
||||||
|
return entityManager.createQuery(hql).setParameter("userId",user.getId()).getResultList();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,441 @@
|
|||||||
|
package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.core.api.iservice.base.ISysUserService;
|
||||||
|
import cn.estsh.i3plus.core.apiservice.dao.IUserPermissionDao;
|
||||||
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
||||||
|
import cn.estsh.i3plus.pojo.base.shirotoken.AdminToken;
|
||||||
|
import cn.estsh.i3plus.pojo.base.shirotoken.SaAdminToken;
|
||||||
|
import cn.estsh.i3plus.pojo.base.shirotoken.UserToken;
|
||||||
|
import cn.estsh.i3plus.pojo.model.flatform.UserModel;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.bean.*;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.repository.*;
|
||||||
|
import cn.estsh.impp.framework.boot.auth.AuthUtil;
|
||||||
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
||||||
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionEnum;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.shiro.authc.AuthenticationToken;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description : 平台用户业务
|
||||||
|
* @Reference :
|
||||||
|
* @Author : wei.peng
|
||||||
|
* @Date : 2018-10-25 17:45
|
||||||
|
* @Modify :
|
||||||
|
**/
|
||||||
|
@Service
|
||||||
|
public class SysUserServiceImpl implements ISysUserService {
|
||||||
|
|
||||||
|
public static final Logger LOGGER = LoggerFactory.getLogger(SysUserServiceImpl.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysUserRepository sysUserRDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysUserInfoRepository sysUserInfoRDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IUserPermissionDao userPermissionDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private OrganizeRepository organizeRDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysRoleRepository sysRoleRDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DepartmentRepository departmentRDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PositionRepository positionRDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RefUserRoleRepository refUserRoleRDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RefUserDepartmentRepository refUserDepartmentRDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RefUserPositionRepository refUserPositionRDao;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SessionUser queryUserLogin(String loginName, String password, String languageCode) {
|
||||||
|
LOGGER.info("平台用户 SYS_USER loginName:{} \t password:{} \t languageCode:{}", loginName, password, languageCode);
|
||||||
|
SysUser user = getSysUserByLoginName(loginName);
|
||||||
|
AuthenticationToken token = null;
|
||||||
|
|
||||||
|
if (user == null) {
|
||||||
|
//用户不存在
|
||||||
|
throw ImppExceptionBuilder.newInstance()
|
||||||
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.IMPP.getCode())
|
||||||
|
.setErrorCode(ImppExceptionEnum.LOGIN_EXCEPTION.getCode())
|
||||||
|
.setErrorDetail("用户不存在")
|
||||||
|
.setErrorSolution("重新登陆")
|
||||||
|
.build();
|
||||||
|
} else if (!StringUtils.equals(user.getUserLoginPassword(), password)) {
|
||||||
|
//密码不符
|
||||||
|
throw ImppExceptionBuilder.newInstance()
|
||||||
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.IMPP.getCode())
|
||||||
|
.setErrorCode(ImppExceptionEnum.LOGIN_EXCEPTION.getCode())
|
||||||
|
.setErrorDetail("登陆密码错误")
|
||||||
|
.setErrorSolution("重新输入")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (user.getUserTypeId()) {
|
||||||
|
case 2:
|
||||||
|
token = new AdminToken(loginName, password, languageCode);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
token = new SaAdminToken(loginName, password, languageCode);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
token = new UserToken(loginName, password, languageCode);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
SessionUser sessionUser = AuthUtil.login(token);
|
||||||
|
|
||||||
|
user = getSysUserInfo(user); //设置用户详细信息
|
||||||
|
packSessionUser(sessionUser, user, user.getUserTypeId(), languageCode);
|
||||||
|
AuthUtil.setSessionUser(sessionUser);
|
||||||
|
return sessionUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateSysUserStatus(String id, int status, SessionUser user) {
|
||||||
|
LOGGER.info("平台用户 SYS_USER id:{} \t status:{} \t modifyUser:{}", id, status, user.getUserName());
|
||||||
|
SysUser sysUser = sysUserRDao.getById(Long.parseLong(id));
|
||||||
|
sysUser.setUserStatus(status);
|
||||||
|
sysUser.setModifyUser(user.getUserName());
|
||||||
|
sysUserRDao.update(sysUser);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SysUser updateSysUserModel(UserModel model, SessionUser user) {
|
||||||
|
LOGGER.info("平台用户 SYS_USER model:{}", model);
|
||||||
|
LOGGER.info("平台用户 SYS_USER user:{}", user);
|
||||||
|
|
||||||
|
// 数据真实性校验
|
||||||
|
SysRole sysRole = sysRoleRDao.getById(model.getRole().id);
|
||||||
|
checkSysRole(sysRole);
|
||||||
|
Department dep = departmentRDao.getById(model.getDepartment().getId());
|
||||||
|
checkDepartment(dep);
|
||||||
|
Position pos = positionRDao.getById(model.getPosition().getId());
|
||||||
|
checkPosition(pos);
|
||||||
|
Organize organize = organizeRDao.getById(model.getDepartment().getOrganizeId());
|
||||||
|
checkOrganize(organize);
|
||||||
|
|
||||||
|
SysUser sysUser = model.getUser();
|
||||||
|
|
||||||
|
SysUser loginUser = getSysUserByLoginName(sysUser.getUserLoginName());
|
||||||
|
// 判断是否修改登录名称
|
||||||
|
if (null == loginUser || loginUser.getId().equals(sysUser.getId())) {
|
||||||
|
// 冗余部分信息
|
||||||
|
sysUser.setRedDepartmentName(dep.getDepartmentName());
|
||||||
|
sysUser.setRedRoleName(sysRole.getName());
|
||||||
|
sysUser.setRedPositionName(pos.getPositionName());
|
||||||
|
sysUser.setOrganizeId(organize.getId());
|
||||||
|
sysUser.setRedOrganizeName(organize.getRedParentName());
|
||||||
|
|
||||||
|
if (!sysUser.getUserLoginPassword().isEmpty()) {
|
||||||
|
//TODO 密码加密
|
||||||
|
}
|
||||||
|
|
||||||
|
// 刷新用户角色关系信息
|
||||||
|
refreshRefUserRole( model, sysUser);
|
||||||
|
|
||||||
|
// 刷新用户部门关系信息
|
||||||
|
refreshRefUserDepartment( model, sysUser);
|
||||||
|
|
||||||
|
// 刷新用户岗位关系信息
|
||||||
|
refreshRefUserPosition( model, sysUser);
|
||||||
|
|
||||||
|
// 保存用户信息
|
||||||
|
sysUserInfoRDao.save(model.getUserInfo());
|
||||||
|
return sysUserRDao.save(sysUser);
|
||||||
|
} else {
|
||||||
|
throw ImppExceptionBuilder.newInstance()
|
||||||
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.IMPP.getCode())
|
||||||
|
.setErrorCode(ImppExceptionEnum.IO_EXCEPTION.getCode())
|
||||||
|
.setErrorDetail("用户名已存在")
|
||||||
|
.setErrorSolution("请重新输入用户名")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SysUser insertSysUserModel(UserModel model, SessionUser user) {
|
||||||
|
LOGGER.info("平台用户 SYS_USER model:{}", model);
|
||||||
|
LOGGER.info("平台用户 SYS_USER user:{}", user);
|
||||||
|
|
||||||
|
SysUser sysUser = model.getUser();
|
||||||
|
SysUser loginUser = getSysUserByLoginName(sysUser.getUserLoginName());
|
||||||
|
if (null == loginUser) {
|
||||||
|
sysUser = sysUserRDao.insert(sysUser);
|
||||||
|
model.getUserInfo().setUserId(sysUser.getId());
|
||||||
|
model.setUser(sysUser);
|
||||||
|
return updateSysUserModel(model, user);
|
||||||
|
} else {
|
||||||
|
throw ImppExceptionBuilder.newInstance()
|
||||||
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.IMPP.getCode())
|
||||||
|
.setErrorCode(ImppExceptionEnum.IO_EXCEPTION.getCode())
|
||||||
|
.setErrorDetail("用户名已存在")
|
||||||
|
.setErrorSolution("请重新输入用户名")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteSysUserById(String id) {
|
||||||
|
LOGGER.info("平台用户 SYS_USER DELETE By id :{}", id);
|
||||||
|
sysUserRDao.updateByProperties("id", id, "isValid", CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue());
|
||||||
|
// //TODO 确认是否物理删除
|
||||||
|
refUserRoleRDao.deleteByProperties("userId", Long.parseLong(id)); // 删除用户角色关系
|
||||||
|
refUserDepartmentRDao.deleteByProperties("userId", Long.parseLong(id)); //删除用户部门关系
|
||||||
|
refUserPositionRDao.deleteByProperties("userId", Long.parseLong(id)); //删除用户部门关系
|
||||||
|
|
||||||
|
// refUserRoleRDao.updateByProperties("userId",id,"isValid", CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue());
|
||||||
|
// refUserDepartmentRDao.updateByProperties("userId",id,"isValid", CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue());
|
||||||
|
// refUserPositionRDao.updateByProperties("userId",id,"isValid", CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SysUser> findSysUserAll() {
|
||||||
|
LOGGER.info("平台用户 SYS_USER find All");
|
||||||
|
return sysUserRDao.findByProperty("isValid", CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SysUser getSysUserById(String id) {
|
||||||
|
LOGGER.info("平台用户 SYS_USER get By id :{}", id);
|
||||||
|
return sysUserRDao.getById(Long.parseLong(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SysUser getSysUserByLoginName(String loginName) {
|
||||||
|
LOGGER.info("平台用户 SYS_USER find By Login Name :{}", loginName);
|
||||||
|
return sysUserRDao.getByProperty(new String[]{"userLoginName", "isValid"},
|
||||||
|
new Object[]{loginName, CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置用户详细信息
|
||||||
|
*
|
||||||
|
* @param user
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public SysUser getSysUserInfo(SysUser user) {
|
||||||
|
LOGGER.info("平台用户 SYS_USER user id :{}", user.getId());
|
||||||
|
SysUserInfo userInfo = sysUserInfoRDao.getByProperty("userId", user.getId());
|
||||||
|
Organize organize = organizeRDao.getById(user.getOrganizeId());
|
||||||
|
|
||||||
|
List<Department> departmentList = userPermissionDao.findDepartmentByUser(user);
|
||||||
|
List<Position> positionList = userPermissionDao.findPositionByUser(user);
|
||||||
|
List<SysMenu> menuList = userPermissionDao.findSysMenuByUser(user);
|
||||||
|
List<SysRole> roleList = userPermissionDao.findSysRoleByUser(user);
|
||||||
|
|
||||||
|
LOGGER.info("平台用户 SYS_USER userInfo :{}", userInfo);
|
||||||
|
LOGGER.info("平台用户 SYS_USER organize :{}", organize);
|
||||||
|
LOGGER.info("平台用户 SYS_USER departmentList size :{}", departmentList.size());
|
||||||
|
LOGGER.info("平台用户 SYS_USER positionList size :{}", positionList.size());
|
||||||
|
LOGGER.info("平台用户 SYS_USER menuList size :{}", menuList.size());
|
||||||
|
LOGGER.info("平台用户 SYS_USER roleList size :{}", roleList.size());
|
||||||
|
|
||||||
|
user.setUserInfo(userInfo);
|
||||||
|
user.setOrganize(organize);
|
||||||
|
user.setDepartmentList(departmentList);
|
||||||
|
user.setMenuList(menuList);
|
||||||
|
user.setPositionList(positionList);
|
||||||
|
user.setRoleList(roleList);
|
||||||
|
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**************************************** 公共方法封装 ****************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 封装用户登陆信息
|
||||||
|
*
|
||||||
|
* @param sessionUser 当前会话信息
|
||||||
|
* @param user 当前登录用户
|
||||||
|
* @param userType 用户类型
|
||||||
|
* @param languageCode 用户选择的语言
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static SessionUser packSessionUser(SessionUser sessionUser, SysUser user, Integer userType, String languageCode) {
|
||||||
|
sessionUser.setLanguageCode(languageCode);
|
||||||
|
sessionUser.setUserName(user.getName());
|
||||||
|
sessionUser.setUserType(CommonEnumUtil.USER_TYPE.valueOf(userType));
|
||||||
|
sessionUser.setUserCode(user.getUserInfo().getLanguageCode());
|
||||||
|
sessionUser.setRoleList(user.getRoleList());
|
||||||
|
sessionUser.setDepartmentList(user.getDepartmentList());
|
||||||
|
sessionUser.setPositionList(user.getPositionList());
|
||||||
|
sessionUser.setOrganize(user.getOrganize());
|
||||||
|
return sessionUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新用户 角色关系
|
||||||
|
* @param model
|
||||||
|
* @param sysUser
|
||||||
|
*/
|
||||||
|
private void refreshRefUserRole( UserModel model, SysUser sysUser) {
|
||||||
|
// 用户角色操作
|
||||||
|
refUserRoleRDao.deleteByProperties("userId", sysUser.getId()); // 删除用户角色关系
|
||||||
|
if (null != model.getRoles() && model.getRoles().size() > 0) { //角色非空是操作
|
||||||
|
|
||||||
|
List<RefUserRole> refUserRoles = new ArrayList<>();
|
||||||
|
StringBuffer roleNames = new StringBuffer();
|
||||||
|
RefUserRole refUserRole = null;
|
||||||
|
|
||||||
|
for (SysRole role : model.getRoles()) {
|
||||||
|
roleNames.append("," + role.getName());
|
||||||
|
// 用户角色关系创建
|
||||||
|
refUserRole = new RefUserRole(sysUser.getId(), role.getId(), role.getName());
|
||||||
|
refUserRoles.add(refUserRole);
|
||||||
|
}
|
||||||
|
|
||||||
|
refUserRoleRDao.saveAll(refUserRoles);
|
||||||
|
// 角色名称冗余
|
||||||
|
model.getUserInfo().setRedRoleNames(roleNames.substring(1, roleNames.length()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新用户部门关系
|
||||||
|
* @param model
|
||||||
|
* @param sysUser
|
||||||
|
*/
|
||||||
|
private void refreshRefUserDepartment(UserModel model, SysUser sysUser) {
|
||||||
|
// 用户部门操作
|
||||||
|
refUserDepartmentRDao.deleteByProperties("userId", sysUser.getId()); //删除用户部门关系
|
||||||
|
if (null != model.getDepartments() && model.getDepartments().size() > 0) {
|
||||||
|
|
||||||
|
List<RefUserDepartment> refUserDepartments = new ArrayList<>();
|
||||||
|
StringBuffer departmentNames = new StringBuffer();
|
||||||
|
RefUserDepartment refUserDepartment = null;
|
||||||
|
|
||||||
|
for (Department department : model.getDepartments()) {
|
||||||
|
departmentNames.append("," + department.getDepartmentName());
|
||||||
|
|
||||||
|
// 用户部门关系创建
|
||||||
|
refUserDepartment = new RefUserDepartment(sysUser.getId(), department.getId(), department.getDepartmentName());
|
||||||
|
refUserDepartments.add(refUserDepartment);
|
||||||
|
}
|
||||||
|
|
||||||
|
refUserDepartmentRDao.save(refUserDepartment);
|
||||||
|
// 部门名称冗余
|
||||||
|
model.getUserInfo().setRedDepartmentNames(departmentNames.substring(1, departmentNames.length()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新用户岗位关系
|
||||||
|
* @param model
|
||||||
|
* @param sysUser
|
||||||
|
*/
|
||||||
|
private void refreshRefUserPosition(UserModel model, SysUser sysUser) {
|
||||||
|
refUserPositionRDao.deleteByProperties("userId", sysUser.getId()); //删除用户部门关系
|
||||||
|
if (null != model.getPositions() && model.getPositions().size() > 0) {
|
||||||
|
|
||||||
|
List<RefUserPosition> refUserPositions = new ArrayList<>();
|
||||||
|
StringBuffer positionNames = new StringBuffer();
|
||||||
|
RefUserPosition refUserPosition = null;
|
||||||
|
for (Position position : model.getPositions()) {
|
||||||
|
positionNames.append("," + position.getPositionName());
|
||||||
|
|
||||||
|
// 用户岗位关系创建
|
||||||
|
refUserPosition = new RefUserPosition(sysUser.getId(), position.getId(), position.getPositionName());
|
||||||
|
refUserPositions.add(refUserPosition);
|
||||||
|
}
|
||||||
|
|
||||||
|
refUserPositionRDao.saveAll(refUserPositions);
|
||||||
|
// 岗位名称冗余
|
||||||
|
model.getUserInfo().setRedPositionNames(positionNames.substring(1, positionNames.length()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门真实性校验
|
||||||
|
* @param department
|
||||||
|
*/
|
||||||
|
private void checkDepartment(Department department) {
|
||||||
|
if (null == department) {
|
||||||
|
throw ImppExceptionBuilder.newInstance()
|
||||||
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.IMPP.getCode())
|
||||||
|
.setErrorCode(ImppExceptionEnum.IO_EXCEPTION.getCode())
|
||||||
|
.setErrorDetail("部门不存在")
|
||||||
|
.setErrorSolution("请重新输入部门信息")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 岗位真实性 校验
|
||||||
|
* @param position
|
||||||
|
*/
|
||||||
|
private void checkPosition(Position position) {
|
||||||
|
if (null == position) {
|
||||||
|
throw ImppExceptionBuilder.newInstance()
|
||||||
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.IMPP.getCode())
|
||||||
|
.setErrorCode(ImppExceptionEnum.IO_EXCEPTION.getCode())
|
||||||
|
.setErrorDetail("岗位不存在")
|
||||||
|
.setErrorSolution("请重新输入岗位信息")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色真实信息校验
|
||||||
|
* @param sysRole
|
||||||
|
*/
|
||||||
|
private void checkSysRole(SysRole sysRole) {
|
||||||
|
if (null == sysRole) {
|
||||||
|
throw ImppExceptionBuilder.newInstance()
|
||||||
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.IMPP.getCode())
|
||||||
|
.setErrorCode(ImppExceptionEnum.IO_EXCEPTION.getCode())
|
||||||
|
.setErrorDetail("角色不存在")
|
||||||
|
.setErrorSolution("请重新输入角色信息")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组织真实性校验
|
||||||
|
* @param organize
|
||||||
|
*/
|
||||||
|
private void checkOrganize(Organize organize) {
|
||||||
|
if (null == organize) {
|
||||||
|
throw ImppExceptionBuilder.newInstance()
|
||||||
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.IMPP.getCode())
|
||||||
|
.setErrorCode(ImppExceptionEnum.IO_EXCEPTION.getCode())
|
||||||
|
.setErrorDetail("部门的组织不存在")
|
||||||
|
.setErrorSolution("请先完善组织信息")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,62 @@
|
|||||||
|
package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.core.api.iservice.busi.ITaskTimeExpressionService;
|
||||||
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.bean.SysRole;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.bean.TaskTimeExpression;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.repository.TaskTimeExpressionRepository;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.repository.TaskTimeRecordingRepository;
|
||||||
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
||||||
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionEnum;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description : 定时任务时间表达式 业务逻辑实现
|
||||||
|
* @Reference :
|
||||||
|
* @Author : wei.peng
|
||||||
|
* @Date : 2018-10-24 20:40
|
||||||
|
* @Modify :
|
||||||
|
**/
|
||||||
|
@Service
|
||||||
|
public class TaskTimeExpressionServiceImpl implements ITaskTimeExpressionService {
|
||||||
|
|
||||||
|
public static final Logger LOGGER = LoggerFactory.getLogger(TaskTimeExpressionServiceImpl.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TaskTimeExpressionRepository taskTimeRecordingRDao;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateTaskTimeExpression(TaskTimeExpression taskTimeExpression) {
|
||||||
|
LOGGER.info("定时任务时间表达式 Task_TIME_EXPRESSION :{}", taskTimeExpression);
|
||||||
|
taskTimeRecordingRDao.update(taskTimeExpression);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteTaskTimeExpressionById(String id) {
|
||||||
|
LOGGER.info("定时任务时间表达式 Task_TIME_EXPRESSION :{}", id);
|
||||||
|
taskTimeRecordingRDao.deleteById(Long.parseLong(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TaskTimeExpression insertTaskTimeExpression(TaskTimeExpression taskTimeExpression) {
|
||||||
|
LOGGER.info("定时任务时间表达式 Task_TIME_EXPRESSION :{}", taskTimeExpression);
|
||||||
|
return taskTimeRecordingRDao.insert(taskTimeExpression);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<TaskTimeExpression> findTaskTimeExpressionAll() {
|
||||||
|
LOGGER.info("定时任务时间表达式 Task_TIME_EXPRESSION find All");
|
||||||
|
return taskTimeRecordingRDao.findAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TaskTimeExpression getTaskTimeExpressionById(String id) {
|
||||||
|
LOGGER.info("定时任务时间表达式 Task_TIME_EXPRESSION :{}" ,id);
|
||||||
|
return taskTimeRecordingRDao.getById(Long.parseLong(id));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.core.api.iservice.busi.ITaskTimeRecordingService;
|
||||||
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.bean.SessionUser;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.bean.TaskTimeRecording;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.repository.TaskTimeRecordingRepository;
|
||||||
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
||||||
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionEnum;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description : 定时任务执行记录业务接口实现
|
||||||
|
* @Reference :
|
||||||
|
* @Author : wei.peng
|
||||||
|
* @Date : 2018-10-22 16:58:44.011
|
||||||
|
* @Modify :
|
||||||
|
**/
|
||||||
|
@Service
|
||||||
|
public class TaskTimeRecordingServiceImpl implements ITaskTimeRecordingService {
|
||||||
|
|
||||||
|
public static final Logger LOGGER = LoggerFactory.getLogger(TaskTimeRecordingServiceImpl.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TaskTimeRecordingRepository taskTimeRecordingRDao;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateTaskTimedRecording(TaskTimeRecording taskTimeRecording) {
|
||||||
|
LOGGER.info("定时任务执行记录 TASK_TIMED_RECORDING :{}", taskTimeRecording);
|
||||||
|
taskTimeRecordingRDao.update(taskTimeRecording);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteTaskTimedRecordingById(String id) {
|
||||||
|
LOGGER.info("定时任务执行记录 TASK_TIMED_RECORDING Key:{}", id);
|
||||||
|
taskTimeRecordingRDao.deleteById(Long.parseLong(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TaskTimeRecording insertTaskTimedRecording(TaskTimeRecording taskTimeRecording) {
|
||||||
|
LOGGER.info("定时任务执行记录 TASK_TIMED_RECORDING :{}", taskTimeRecording);
|
||||||
|
return taskTimeRecordingRDao.insert(taskTimeRecording);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<TaskTimeRecording> findTaskTimedRecordingAll() {
|
||||||
|
LOGGER.info("定时任务执行记录 TASK_TIMED_RECORDING find All");
|
||||||
|
return taskTimeRecordingRDao.findAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TaskTimeRecording getTaskTimedRecordingById(String id) {
|
||||||
|
LOGGER.info("定时任务执行记录 TASK_TIMED_RECORDING find id:{}", id);
|
||||||
|
return taskTimeRecordingRDao.getOne(Long.parseLong(id));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,71 @@
|
|||||||
|
package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.core.api.iservice.busi.ITaskTimeService;
|
||||||
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.bean.SessionUser;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.bean.SysMenu;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.bean.TaskTime;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.repository.TaskTimeRepository;
|
||||||
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
||||||
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionEnum;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description : 定时任务业务接口实现
|
||||||
|
* @Reference :
|
||||||
|
* @Author : wei.peng
|
||||||
|
* @Date : 2018-10-22 16:58:43.974
|
||||||
|
* @Modify :
|
||||||
|
**/
|
||||||
|
@Service
|
||||||
|
public class TaskTimeServiceImpl implements ITaskTimeService {
|
||||||
|
|
||||||
|
public static final Logger LOGGER = LoggerFactory.getLogger(TaskTimeServiceImpl.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TaskTimeRepository taskTimeRDao;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateTaskTimed(TaskTime taskTime) {
|
||||||
|
LOGGER.info("定时任务 TASK_TIMED :{}", taskTime);
|
||||||
|
taskTimeRDao.update(taskTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateTaskTimedStatus(String id, int status, SessionUser user) {
|
||||||
|
LOGGER.info("定时任务 SYS_MENU id:{} status:{} user:{}", id,status,user);
|
||||||
|
TaskTime taskTime = taskTimeRDao.getById(Long.parseLong(id));
|
||||||
|
taskTime.setTaskStatus(status);
|
||||||
|
taskTime.setModifyUser(user.getUserName());
|
||||||
|
taskTimeRDao.update(taskTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteTaskTimedById(String id) {
|
||||||
|
LOGGER.info("定时任务 TASK_TIMED Key:{}", id);
|
||||||
|
taskTimeRDao.deleteById(Long.parseLong(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TaskTime insertTaskTimed(TaskTime taskTime) {
|
||||||
|
LOGGER.info("定时任务 TASK_TIMED :{}", taskTime);
|
||||||
|
return taskTimeRDao.insert(taskTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<TaskTime> findTaskTimedAll() {
|
||||||
|
LOGGER.info("定时任务 TASK_TIMED find All");
|
||||||
|
return taskTimeRDao.findAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TaskTime getTaskTimedById(String id) {
|
||||||
|
LOGGER.info("定时任务 TASK_TIMED find id:{}", id);
|
||||||
|
return taskTimeRDao.getOne(Long.parseLong(id));
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue