用户管理更新

yun-zuoyi
wei.peng 6 years ago
parent 13118c8ef5
commit f7998ab767

@ -0,0 +1,105 @@
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.model.platform.UserDetailModel;
import cn.estsh.i3plus.pojo.platform.bean.*;
import io.swagger.annotations.ApiOperation;
import java.util.List;
/**
* @Description :
* @Reference :
* @Author : Adair Peng
* @CreateDate : 2018-12-22 16:15
* @Modify:
**/
public interface IPersonnelService {
@ApiOperation(value = "保存账号")
SysUser saveSysUser(SysUser user);
@ApiOperation(value = "保存用户")
SysUserInfo saveSysUserInfo(SysUserInfo info);
@ApiOperation(value = "更新用户状态")
void updateSysUserInfoStatus(Long userInfoId,Integer status);
@ApiOperation(value = "删除账号信息")
void deleteSysUser(Long[] userIdList,String userName);
@ApiOperation(value = "删除用户信息")
void deleteSysUserInfo(Long[] infoIdList,String userName);
@ApiOperation(value = "获取账号信息")
SysUser getSysUserById(Long id);
@ApiOperation(value = "获取用户信息")
SysUserInfo getSysUserInfoById(Long id);
@ApiOperation(value = "获取部门")
SysDepartment getSysDepartmentById(Long id);
@ApiOperation(value = "获取岗位")
SysPosition getSysPositionById(Long id);
@ApiOperation(value = "获取组织")
SysOrganize getSysOrganizeById(Long id);
@ApiOperation(value = "用户登录")
SessionUser queryUserLogin(String userName, String password, String languageCode);
@ApiOperation(value = "查询用户信息")
ListPager<SysUserInfo> querySysUserInfo(UserDetailModel model, Pager pager);
@ApiOperation(value = "查询用户信息")
List<SysUserInfo> findSysUserInfoByIds(Long[] ids);
@ApiOperation(value = "查询账号角色关系")
List<SysRefUserRole> findSysRefUserRoleById(Long userId);
@ApiOperation(value = "查询账号部门关系")
List<SysRefUserDepartment> findSysRefUserDepartmentById(Long userId);
@ApiOperation(value = "查询用户部门关系")
List<SysRefUserInfoDepartment> findSysRefUserInfoDepartmentById(Long infoId);
@ApiOperation(value = "查询用户部门关系")
List<SysOrganize> findSysUserInfoOrganize(Long infoId);
@ApiOperation(value = "查询账户组织关系")
List<SysOrganize> findSysUserOrganize(Long infoId);
@ApiOperation(value = "查询用户岗位关系")
List<SysRefUserPosition> findSysRefUserPositionById(Long infoId);
@ApiOperation(value = "封装用户信息",notes = "封装登录完成后的用户信息(角色、权限、部门、操作部门、组织、岗位)")
SessionUser packSessionUser(SessionUser sessionUser, SysUser user, Integer userType, String languageCode);
@ApiOperation(value = "账号唯一检查")
void checkSysUserOnly(SysUser user);
@ApiOperation(value = "刷新组织冗余")
void refreshRefSysUserOrganizeRdd(Long organizeIds);
@ApiOperation(value = "刷新账号部门")
void refreshRefSysUserDepartment(Long userId, Long[] departmentIds);
@ApiOperation(value = "刷新账号角色")
void refreshRefSysUserRole(Long userId, Long[] roleIds);
@ApiOperation(value = "刷新账号部门")
void refreshRefSysUserDepartmentRdd(Long departmentId);
@ApiOperation(value = "刷新用户部门")
void refreshRefSysUserInfoDepartment(Long userInfoId, Long[] departmentIds);
@ApiOperation(value = "刷新用户部门")
void refreshRefSysUserInfoDepartmentRdd(Long departmentId);
@ApiOperation(value = "刷新用户岗位")
void refreshRefSysUserInfoPosition(Long userInfoId, Long[] positionIds);
@ApiOperation(value = "刷新用户岗位")
void refreshRefSysUserInfoPositionRdd(Long positionId);
}

@ -1,10 +1,7 @@
package cn.estsh.i3plus.core.apiservice.controller.base;
import cn.estsh.i3plus.core.api.iservice.base.ISystemLoginService;
import cn.estsh.i3plus.core.api.iservice.busi.ICoreTreeService;
import cn.estsh.i3plus.core.api.iservice.busi.ISysLocaleLanguageService;
import cn.estsh.i3plus.core.api.iservice.busi.ISysMenuService;
import cn.estsh.i3plus.core.api.iservice.busi.ISysUserService;
import cn.estsh.i3plus.core.api.iservice.busi.*;
import cn.estsh.i3plus.core.apiservice.controller.DemoAuthController;
import cn.estsh.i3plus.core.apiservice.serviceimpl.busi.SysLocaleLanguageService;
import cn.estsh.i3plus.platform.common.tool.ServletRequestTool;
@ -58,6 +55,9 @@ public class WhiteController extends CoreBaseController {
@Autowired
private ISysUserService userService;
@Autowired
private IPersonnelService personnelService;
@GetMapping(value = "/sys-locale-language/list")
@ApiOperation(value = "查询全部系统语言",notes = "查询全部系统语言")
public ResultBean listSysLocaleLanguage(){
@ -81,18 +81,20 @@ public class WhiteController extends CoreBaseController {
ValidatorBean.checkNotNull(loginPwd,"密码不能为空");
ValidatorBean.checkNotNull(languageCode,"语言不能为空");
SessionUser user = userService.queryUserLogin(loginName,loginPwd,languageCode);
String redisKey = CommonConstWords.USER_LOGIN_ERROR + "_" + user.getUser().getId();
redisCore.deleteKey(redisKey);
LOGGER.info("会员登陆:{}",user);
AuthUtil.setSessionObject("languageCode",languageCode);
result = new ResultBean(true, AuthUtil.getSession().getId().toString(), AuthUtil.getSessionUser());
result.setUrl("/");
// 记录登录记录
recordSysUserLog(user.getUser().getUserInfoId(), loginName,CommonEnumUtil.USER_LOGIN_STATUS.LOGIN_SUCCESS.getValue(), request);
return new ResultBean(true, "1233","");
// SessionUser user = userService.queryUserLogin(loginName,loginPwd,languageCode);
//
// String redisKey = CommonConstWords.USER_LOGIN_ERROR + "_" + user.getUser().getId();
// redisCore.deleteKey(redisKey);
//
// LOGGER.info("会员登陆:{}",user);
// AuthUtil.setSessionObject("languageCode",languageCode);
// result = new ResultBean(true, AuthUtil.getSession().getId().toString(), AuthUtil.getSessionUser());
// result.setUrl("/");
//
// // 记录登录记录
// recordSysUserLog(user.getUser().getUserInfoId(), loginName,CommonEnumUtil.USER_LOGIN_STATUS.LOGIN_SUCCESS.getValue(), request);
} catch (IncorrectCredentialsException e) {
// 密码错误
Integer num = systemLoginService.doLoginPasswordError(loginName,request.getSession().getId());

@ -0,0 +1,332 @@
package cn.estsh.i3plus.core.apiservice.controller.busi;
import cn.estsh.i3plus.core.api.iservice.busi.IPersonnelService;
import cn.estsh.i3plus.core.api.iservice.busi.ISysFileService;
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
import cn.estsh.i3plus.platform.common.tool.EncryptTool;
import cn.estsh.i3plus.platform.common.tool.StringTool;
import cn.estsh.i3plus.platform.common.tool.TimeTool;
import cn.estsh.i3plus.platform.common.util.PlatformConstWords;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil;
import cn.estsh.i3plus.pojo.model.platform.UserDetailModel;
import cn.estsh.i3plus.pojo.platform.bean.*;
import cn.estsh.impp.framework.base.controller.CoreBaseController;
import cn.estsh.impp.framework.boot.auth.AuthUtil;
import cn.estsh.impp.framework.boot.exception.ImppBusiException;
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
import cn.estsh.impp.framework.boot.exception.ImppExceptionEnum;
import cn.estsh.impp.framework.boot.util.ResultBean;
import cn.estsh.impp.framework.boot.util.ValidatorBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Description :
* @Reference :
* @Author : Adair Peng
* @CreateDate : 2018-12-24 14:02
* @Modify:
**/
@RestController
@Api(description = "系统用户管理服务")
@RequestMapping(PlatformConstWords.BASE_URL +"/personnel")
public class PersonnelController extends CoreBaseController {
public static final Logger LOGGER = LoggerFactory.getLogger(PersonnelController.class);
@Autowired
private IPersonnelService personnelService;
@Autowired
private ISysFileService fileService;
@PostMapping(value="/user-detail/insert")
@ApiOperation(value="添加用户信息",notes="返回内容添加用户信息")
public ResultBean insertUserDetailModel(UserDetailModel model) {
try {
SysUser user = model.getSysUser();
SysUserInfo info = model.getSysUserInfo();
checkUserDetailModel(model, false);
personnelService.checkSysUserOnly(user);
SysDepartment infoDepartment = personnelService.getSysDepartmentById(Long.parseLong(model.getInfoDepartmentId()));
if(infoDepartment == null){
ValidatorBean.checkNotNull(infoDepartment,"用户主部门不存在");
}
SysOrganize infoOrganize = personnelService.getSysOrganizeById(infoDepartment.getOrganizeId());
SysPosition position = personnelService.getSysPositionById(Long.parseLong(model.getInfoPositionId()));
if(infoDepartment == null){
ValidatorBean.checkNotNull(position,"用户主岗位存在");
}
SysDepartment userDepartment = personnelService.getSysDepartmentById(Long.parseLong(model.getUserDepartmentId()));
if(userDepartment == null){
ValidatorBean.checkNotNull(userDepartment,"账号主部门不存在");
}
SysOrganize userOrganize = personnelService.getSysOrganizeById(userDepartment.getOrganizeId());
info.setDepartmentId(infoDepartment.getId());
info.setDepartmentNameRdd(infoDepartment.getName());
info.setOrganizeId(infoOrganize.getId());
info.setOrganizeNameRdd(infoOrganize.getName());
info.setOrganizeCode(infoOrganize.getOrganizeCode());
info.setPositionId(position.getId());
info.setPositionNameRdd(position.getName());
personnelService.saveSysUserInfo(info);
user.setDepartmentId(userDepartment.getId());
user.setDepartmentNameRdd(userDepartment.getName());
user.setOrganizeId(userOrganize.getId());
user.setOrganizeNameRdd(userOrganize.getName());
user.setOrganizeCode(userOrganize.getOrganizeCode());
user.setUserInfoId(info.getId());
user.setUserLoginPassword(EncryptTool.hexMD5(user.getUserLoginPassword()));
personnelService.saveSysUser(user);
info.setUserId(user.getId());
personnelService.saveSysUserInfo(info);
// 关系 刷新
refreshRef(user, info, model);
return ResultBean.success("添加成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
} catch (ImppBusiException busExcep) {
LOGGER.error(busExcep.getErrorMsg() + "{}", busExcep.getErrorDetail(), busExcep);
return ResultBean.fail(busExcep);
} catch (Exception e) {
LOGGER.error(ImppExceptionEnum.BUSINESS_EXCEPTION_DATA_ERROR.getDescription() + "{}", e.getMessage(), e);
return ResultBean.fail().setCode(ImppExceptionEnum.BUSINESS_EXCEPTION_DATA_ERROR.getCode());
}
}
@PutMapping(value="/user-detail/update")
@ApiOperation(value="添加用户信息",notes="返回内容添加用户信息")
public ResultBean updateUserDetailModel(UserDetailModel model) {
try {
SysUser user = model.getSysUser();
SysUserInfo info = model.getSysUserInfo();
checkUserDetailModel(model, true);
personnelService.checkSysUserOnly(user);
initUserDetail(info,user);
SysDepartment infoDepartment = personnelService.getSysDepartmentById(Long.parseLong(model.getInfoDepartmentId()));
if(infoDepartment == null){
ValidatorBean.checkNotNull(infoDepartment,"用户主部门不存在");
}
SysOrganize infoOrganize = personnelService.getSysOrganizeById(infoDepartment.getOrganizeId());
SysPosition position = personnelService.getSysPositionById(Long.parseLong(model.getInfoPositionId()));
if(infoDepartment == null){
ValidatorBean.checkNotNull(position,"用户主岗位存在");
}
SysDepartment userDepartment = personnelService.getSysDepartmentById(Long.parseLong(model.getUserDepartmentId()));
if(userDepartment == null){
ValidatorBean.checkNotNull(userDepartment,"账号主部门不存在");
}
SysOrganize userOrganize = personnelService.getSysOrganizeById(userDepartment.getOrganizeId());
info.setDepartmentId(infoDepartment.getId());
info.setDepartmentNameRdd(infoDepartment.getName());
info.setOrganizeId(infoOrganize.getId());
info.setOrganizeNameRdd(infoOrganize.getName());
user.setDepartmentId(userDepartment.getId());
user.setDepartmentNameRdd(userDepartment.getName());
user.setOrganizeId(userOrganize.getId());
user.setOrganizeNameRdd(userOrganize.getName());
// 关系 刷新
refreshRef(user, info, model);
personnelService.saveSysUser(user);
personnelService.saveSysUserInfo(info);
return ResultBean.success("添加成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
} catch (ImppBusiException busExcep) {
LOGGER.error(busExcep.getErrorMsg() + "{}", busExcep.getErrorDetail(), busExcep);
return ResultBean.fail(busExcep);
} catch (Exception e) {
LOGGER.error(ImppExceptionEnum.BUSINESS_EXCEPTION_DATA_ERROR.getDescription() + "{}", e.getMessage(), e);
return ResultBean.fail().setCode(ImppExceptionEnum.BUSINESS_EXCEPTION_DATA_ERROR.getCode());
}
}
@GetMapping(value = "/user-info/get-detail/{id}")
@ApiOperation(value = "获取用户信息", notes = "查询根据ID查询用户相关所有信息")
public ResultBean getUserInfoById(@PathVariable("id") String id){
try {
// 数据校验
ValidatorBean.checkNotNull(id, "角色id 不能为空");
Map<String,Object> resultMap = new HashMap<>();
SysUserInfo info = personnelService.getSysUserInfoById(Long.parseLong(id));
SysUser user = personnelService.getSysUserById(info.getUserId());
List<SysRefUserInfoDepartment> refUserInfoDepartmentList = personnelService.findSysRefUserInfoDepartmentById(info.getId());
List<SysRefUserPosition> refUserPositionList = personnelService.findSysRefUserPositionById(info.getId());
List<SysRefUserDepartment> refUserDepartmentList = personnelService.findSysRefUserDepartmentById(user.getId());
List<SysRefUserRole> refUserRoleList = personnelService.findSysRefUserRoleById(user.getId());
SysFile image = info.getUserImageId() != null ? fileService.getSysFileById(info.getUserImageId()) : null;
resultMap.put("user",user);
resultMap.put("refUserInfoDepartmentList",refUserInfoDepartmentList);
resultMap.put("refUserPositionList",refUserPositionList);
resultMap.put("refUserDepartmentList",refUserDepartmentList);
resultMap.put("refUserRoleList",refUserRoleList);
resultMap.put("image",image);
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()).setResultMap(resultMap);
} catch (ImppBusiException busExcep) {
LOGGER.error(busExcep.getErrorMsg() + "{}", busExcep.getErrorDetail(), busExcep);
return ResultBean.fail(busExcep);
} catch (Exception e) {
LOGGER.error(ImppExceptionEnum.SYSTEM_EXCEPTION.getDescription() + "{}", e.getMessage(), e);
return ResultBean.fail().setCode(ImppExceptionEnum.SYSTEM_EXCEPTION.getCode());
}
}
@DeleteMapping(value="/user-info/delete/{id}")
@ApiOperation(value="删除用户信息",notes="根据用户信息id删除信息")
public ResultBean deleteSysUserInfo(@PathVariable("id") String id){
try {
//条件验证
ValidatorBean.checkNotNull(id,"id为空");
SysUserInfo info = personnelService.getSysUserInfoById(Long.parseLong(id));
if(info != null){
personnelService.deleteSysUserInfo(new Long[]{info.getId()},getSessionUser().getUserName());
personnelService.deleteSysUser(new Long[]{info.getUserId()},getSessionUser().getUserName());
return ResultBean.success("删除成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
}else{
return ResultBean.fail("数据不存在").setCode(ResourceEnumUtil.MESSAGE.EMPTY.getCode());
}
} catch (ImppBusiException busExcep) {
LOGGER.error(busExcep.getErrorMsg() + "{}", busExcep.getErrorDetail(), busExcep);
return ResultBean.fail(busExcep);
} catch (Exception e) {
LOGGER.error(ImppExceptionEnum.BUSINESS_EXCEPTION_DATA_ERROR.getDescription() + "{}", e.getMessage(), e);
return ResultBean.fail().setCode(ImppExceptionEnum.BUSINESS_EXCEPTION_DATA_ERROR.getCode());
}
}
@DeleteMapping(value = "/user-info/batch-delete")
@ApiOperation(value = "根据id批量删除", notes = "根据id批量删除")
public ResultBean deleteSysUserInfoByIds(String[] ids){
try{
ids = ConvertBean.modelSafeArrayNumber(ids,true);
if(ids.length == 0){
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
.setErrorDetail("请选择需要删除的用户信息。")
.build();
}
List<SysUserInfo> list = personnelService.findSysUserInfoByIds(StringTool.getArrayLong(ids));
if(list != null && list.size() > 0){
Long[] infoIds = new Long[list.size()];
Long[] userIds = new Long[list.size()];
for (int i = 0; i < list.size(); i++) {
infoIds[i] = list.get(i).getId();
userIds[i] = list.get(i).getUserId();
}
personnelService.deleteSysUserInfo(infoIds,getSessionUser().getUserName());
personnelService.deleteSysUser(userIds,getSessionUser().getUserName());
return ResultBean.success("删除成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
}else{
return ResultBean.fail("数据不存在").setCode(ResourceEnumUtil.MESSAGE.EMPTY.getCode());
}
}catch(ImppBusiException busExcep){
LOGGER.error(busExcep.getErrorMsg() + "{}",busExcep.getErrorDetail(),busExcep);
return ResultBean.fail(busExcep);
}catch(Exception e){
LOGGER.error(ImppExceptionEnum.SYSTEM_EXCEPTION.getDescription() + "{}",e.getMessage(),e);
return ResultBean.fail().setCode(ImppExceptionEnum.SYSTEM_EXCEPTION.getCode());
}
}
/**
*
* @param model
* @param isCheckId
* @throws Exception
*/
private void checkUserDetailModel(UserDetailModel model,boolean isCheckId)throws Exception{
if(isCheckId){
ValidatorBean.beginValid(model)
.notNull("userInfoId", model.getUserInfoId())
.notNull("userId", model.getUserId());
}else {
ValidatorBean.beginValid(model).notNull("userLoginPassword", model.getUserLoginPassword());
}
ValidatorBean.beginValid(model)
.notNull("infoName", model.getInfoName())
.notNull("infoEmpNo", model.getInfoEmpNo())
.notNull("infoPositionId", model.getInfoPositionId())
.notNull("infoDepartmentId", model.getInfoDepartmentId())
.notNull("userLoginName", model.getUserLoginName())
.notNull("userEmail", model.getUserEmail())
.notNull("userPhone", model.getUserPhone());
}
/**
*
* @param info
* @param user
* @throws Exception
*/
private void initUserDetail(SysUserInfo info ,SysUser user)throws Exception{
if(StringUtils.isBlank(info.getUserJoinDate())){
info.setUserJoinDate(TimeTool.getToday());
}
info.setUserInfoStatus(CommonEnumUtil.USER_INFO_STATUS.INCUMBENT.getValue());
info.setUserLoginNum(0);
ConvertBean.modelInitialize(info, AuthUtil.getSessionUser());
user.setUserType(CommonEnumUtil.USER_TYPE.USER.getValue());
user.setUserStatus(CommonEnumUtil.USER_STATUS.ENABLE.getValue());
user.setIsValid(CommonEnumUtil.IS_VAILD.VAILD.getValue());
user.setUserLoginNum(0);
ConvertBean.modelInitialize(user, AuthUtil.getSessionUser());
}
/**
*
* @param user
* @param info
* @param model
*/
private void refreshRef(SysUser user,SysUserInfo info,UserDetailModel model){
// 刷新账号 部门关系
personnelService.refreshRefSysUserDepartment(user.getId(), StringTool.getArrayLong(model.getUserDepartmentIdList()));
// 刷新账号 角色关系
personnelService.refreshRefSysUserRole(user.getId(),StringTool.getArrayLong(model.getUserRoleIdList()));
// 刷新用户 部门关系
personnelService.refreshRefSysUserInfoDepartment(info.getId(),StringTool.getArrayLong(model.getInfoDepartmentIdList()));
// 刷新用户 岗位关系
personnelService.refreshRefSysUserInfoPosition(info.getId(),StringTool.getArrayLong(model.getInfoPositionIdList()));
}
}

@ -3,6 +3,7 @@ package cn.estsh.i3plus.core.apiservice.controller.busi;
import cn.estsh.i3plus.core.api.iservice.busi.ISysDictionaryService;
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
import cn.estsh.i3plus.platform.common.tool.StringTool;
import cn.estsh.i3plus.platform.common.util.CommonConstWords;
import cn.estsh.i3plus.platform.common.util.PlatformConstWords;
import cn.estsh.i3plus.pojo.base.bean.ListPager;
import cn.estsh.i3plus.pojo.base.common.Pager;
@ -24,7 +25,9 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Description :
@ -178,6 +181,31 @@ public class SysDictionaryController extends CoreBaseController{
}
}
@GetMapping(value = "/find/user-info")
@ApiOperation(value = "查询跟用户相关所有字典")
public ResultBean findSysDictionaryUserInfo() {
try {
Map<String,Object> resultMap = new HashMap<>();
resultMap.put("1",sysDictionaryService.findSysDictionaryByParentCode(CommonConstWords.DICTIONARY_SEX));
resultMap.put("2",sysDictionaryService.findSysDictionaryByParentCode(CommonConstWords.DICTIONARY_FILE_TYPE));
resultMap.put("3",sysDictionaryService.findSysDictionaryByParentCode(CommonConstWords.DICTIONARY_MARRIAGE));
resultMap.put("4",sysDictionaryService.findSysDictionaryByParentCode(CommonConstWords.DICTIONARY_EDUCATION));
resultMap.put("5",sysDictionaryService.findSysDictionaryByParentCode(CommonConstWords.DICTIONARY_NATIONALITY));
resultMap.put("6",sysDictionaryService.findSysDictionaryByParentCode(CommonConstWords.DICTIONARY_CERTIFICATE_TYPE));
resultMap.put("7",sysDictionaryService.findSysDictionaryByParentCode(CommonConstWords.DICTIONARY_GRADE));
resultMap.put("8",sysDictionaryService.findSysDictionaryByParentCode(CommonConstWords.DICTIONARY_POLITICAL_STATUS));
resultMap.put("9",sysDictionaryService.findSysDictionaryByParentCode(CommonConstWords.DICTIONARY_EMPLOYEE_TYPE));
return ResultBean.success("查询成功").setResultMap(resultMap).setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
} catch (ImppBusiException busExcep) {
LOGGER.error(busExcep.getErrorMsg() + "{}", busExcep.getErrorDetail(), busExcep);
return ResultBean.fail(busExcep);
} catch (Exception e) {
LOGGER.error(ImppExceptionEnum.SYSTEM_EXCEPTION.getDescription() + "{}", e.getMessage(), e);
return ResultBean.fail().setCode(ImppExceptionEnum.SYSTEM_EXCEPTION.getCode());
}
}
@GetMapping("/query")
@ApiOperation(value = "字典复杂查询,分页,排序",notes = "字典复杂查询,分页,排序")
public ResultBean querySysDictionaryByPager(SysDictionary sysDictionary, Pager pager) {

@ -92,8 +92,8 @@ public class SysUserController extends CoreBaseController{
//新增初始化
sysUser.setUserName(userInfo.getName());
sysUser.setUserStatus(CommonEnumUtil.USER_STATUS.ENABLE.getValue());
sysUser.setDepartmentId(userInfo.getDepartmentId());
sysUser.setDepartmentNameRdd(userInfo.getDepartmentNameRdd());
// sysUser.setDepartmentId(userInfo.getDepartmentId());
// sysUser.setDepartmentNameRdd(userInfo.getDepartmentNameRdd());
sysUser.setIsValid(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue());
sysUser.setUserType(CommonEnumUtil.USER_TYPE.USER.getValue());
sysUser.setUserLoginNum(0);
@ -157,8 +157,8 @@ public class SysUserController extends CoreBaseController{
user.setUserInfoId(userInfo.getId());
user.setUserName(userInfo.getName());
user.setDepartmentId(userInfo.getDepartmentId());
user.setDepartmentNameRdd(userInfo.getDepartmentNameRdd());
// user.setDepartmentId(userInfo.getDepartmentId());
// user.setDepartmentNameRdd(userInfo.getDepartmentNameRdd());
user.setUserLoginName(sysUser.getUserLoginName());
user.setUserEmail(sysUser.getUserEmail());
user.setUserPhone(sysUser.getUserPhone());

@ -69,13 +69,13 @@ public class SysUserInfoController extends CoreBaseController{
SysUserInfo info = sysUserInfoService.insertSysUserInfo(userInfo);
sysUserInfoService.refreshRefUserDepartment(info.getId(),
StringTool.getArrayLong(userInfo.getDepartmentIdList()),
user.getUserName());
sysUserInfoService.refreshRefUserPosition(info.getId(),
StringTool.getArrayLong(userInfo.getPositionIdList()),
user.getUserName());
// sysUserInfoService.refreshRefUserDepartment(info.getId(),
// StringTool.getArrayLong(userInfo.getDepartmentIdList()),
// user.getUserName());
//
// sysUserInfoService.refreshRefUserPosition(info.getId(),
// StringTool.getArrayLong(userInfo.getPositionIdList()),
// user.getUserName());
sysUserInfoService.refreshRefUserOrganize(info.getId(), userInfo.getDepartment().getOrganizeId(),user.getUserName());
@ -104,13 +104,13 @@ public class SysUserInfoController extends CoreBaseController{
sysUserInfoService.updateSysUserInfo(userInfo);
sysUserInfoService.refreshRefUserDepartment(userInfo.getId(),
StringTool.getArrayLong(userInfo.getDepartmentIdList()),
user.getUserName());
sysUserInfoService.refreshRefUserPosition(userInfo.getId(),
StringTool.getArrayLong(userInfo.getPositionIdList()),
user.getUserName());
// sysUserInfoService.refreshRefUserDepartment(userInfo.getId(),
// StringTool.getArrayLong(userInfo.getDepartmentIdList()),
// user.getUserName());
//
// sysUserInfoService.refreshRefUserPosition(userInfo.getId(),
// StringTool.getArrayLong(userInfo.getPositionIdList()),
// user.getUserName());
sysUserInfoService.refreshRefUserOrganize(userInfo.getId(), userInfo.getDepartment().getOrganizeId(),user.getUserName());
@ -296,7 +296,7 @@ public class SysUserInfoController extends CoreBaseController{
.notNull("name",userInfo.getName())
.notNull("userEmpNo",userInfo.getUserEmpNo())
.checkNotZero("departmentId",userInfo.getDepartmentId())
.checkNotZero("departmentIdList",userInfo.getDepartmentIdList())
// .checkNotZero("departmentIdList",userInfo.getDepartmentIdList())
.checkNotZero("positionId",userInfo.getPositionId());
if(isId){
ValidatorBean.beginValid(userInfo)

@ -35,7 +35,7 @@ public class ScheduleQueueReceiver {
* @param channel
* @param message
*/
@RabbitListener(queues = PlatformConstWords.IMPP_SCHEDULE_QUEUE)
// @RabbitListener(queues = PlatformConstWords.IMPP_SCHEDULE_QUEUE)
public void processSchedule(SysLogTaskTime logTaskTime, Channel channel, Message message) {
try {
LOGGER.info("【MQ-IMPP_SCHEDULE_QUEUE】数据接收成功{}",logTaskTime);

@ -0,0 +1,530 @@
package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
import cn.estsh.i3plus.core.api.iservice.busi.IPersonnelService;
import cn.estsh.i3plus.platform.common.tool.TimeTool;
import cn.estsh.i3plus.pojo.base.bean.ListPager;
import cn.estsh.i3plus.pojo.base.common.Pager;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.base.shirotoken.UserToken;
import cn.estsh.i3plus.pojo.base.tool.HqlPack;
import cn.estsh.i3plus.pojo.model.platform.UserDetailModel;
import cn.estsh.i3plus.pojo.platform.bean.*;
import cn.estsh.i3plus.pojo.platform.repository.*;
import cn.estsh.i3plus.pojo.platform.sqlpack.CoreHqlPack;
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 io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
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 : Adair Peng
* @CreateDate : 2018-12-24 13:10
* @Modify:
**/
@Service
public class PersonnelServiceService implements IPersonnelService {
public static final Logger LOGGER = LoggerFactory.getLogger(SysConfigService.class);
@Autowired
private SysUserRepository userRDao;
@Autowired
private SysUserInfoRepository userInfoRDao;
@Autowired
private SysRoleRepository roleRDao;
@Autowired
private SysRefUserDepartmentRepository refUserDepartmentRDao;
@Autowired
private SysRefUserInfoDepartmentRepository refUserInfoDepartmentRDao;
@Autowired
private SysRefUserPositionRepository refUserPositionRDao;
@Autowired
private SysRefUserRoleRepository refUserRoleRDao;
@Autowired
private SysOrganizeRepository organizeRDao;
@Autowired
private SysDepartmentRepository departmentRDao;
@Autowired
private SysPositionRepository positionRDao;
@Override
public SysUser saveSysUser(SysUser user) {
LOGGER.debug("平台账号 SysUser user:{}", user);
return userRDao.save(user);
}
@Override
public SysUserInfo saveSysUserInfo(SysUserInfo info) {
LOGGER.debug("平台用户 SysUserInfo info:{}", info);
return userInfoRDao.save(info);
}
@Override
public void updateSysUserInfoStatus(Long userInfoId, Integer status) {
}
@Override
@ApiOperation(value = "删除账号信息")
public void deleteSysUser(Long[] userIdList,String userName) {
LOGGER.debug("平台账号 SysUser userIdList:{}", userIdList);
// 删除账号信息
userRDao.updateValidStatusByPropertyIn("id", userIdList,CommonEnumUtil.IS_VAILD.INVAILD.getValue(), userName);
// 删除账号关系
refUserDepartmentRDao.deleteByPropertyIn("userId",userIdList);
refUserRoleRDao.deleteByPropertyIn("userId", userIdList);
}
@Override
@ApiOperation(value = "删除用户信息")
public void deleteSysUserInfo(Long[] infoIdList,String userName) {
LOGGER.debug("平台用户 SysUserInfo infoIdList:{}", infoIdList);
// 删除用户信息
userInfoRDao.updateValidStatusByPropertyIn("id", infoIdList,CommonEnumUtil.IS_VAILD.INVAILD.getValue(), userName);
// 删除用户关系
refUserInfoDepartmentRDao.deleteByPropertyIn("userId",infoIdList);
refUserPositionRDao.deleteByPropertyIn("userId",infoIdList);
}
@Override
public SysUser getSysUserById(Long id) {
return userRDao.getById(id);
}
@Override
public SysUserInfo getSysUserInfoById(Long id) {
return userInfoRDao.getById(id);
}
@Override
public SysDepartment getSysDepartmentById(Long id) {
return departmentRDao.getById(id);
}
@Override
public SysPosition getSysPositionById(Long id) {
return positionRDao.getById(id);
}
@Override
public SysOrganize getSysOrganizeById(Long id) {
return organizeRDao.getById(id);
}
@Override
public SessionUser queryUserLogin(String userName, String password, String languageCode) {
LOGGER.debug("平台用户 SYS_USER loginName:{} \t password:{} \t languageCode:{}", userName, password, languageCode);
UserToken token = new UserToken(userName,password,languageCode);
SessionUser sessionUser = AuthUtil.login(token);
AuthUtil.setSessionUser(sessionUser);
return sessionUser;
}
@Override
public ListPager<SysUserInfo> querySysUserInfo(UserDetailModel model, Pager pager) {
return null;
}
@Override
public List<SysUserInfo> findSysUserInfoByIds(Long[] ids) {
LOGGER.debug("平台用户 SysUserInfo ids:{}", ids);
String infoWhere = CoreHqlPack.packHqlIds("id", ids);
return userInfoRDao.findByHqlWhere(infoWhere);
}
@Override
public List<SysRefUserRole> findSysRefUserRoleById(Long userId) {
LOGGER.debug("平台账号角色 SysRefUserRole userId:{}", userId);
return refUserRoleRDao.findByProperty("userId",userId);
}
@Override
public List<SysRefUserDepartment> findSysRefUserDepartmentById(Long userId) {
LOGGER.debug("平台账号部门 SysRefUserDepartment userId:{}", userId);
return refUserDepartmentRDao.findByProperty("userId",userId);
}
@Override
public List<SysRefUserInfoDepartment> findSysRefUserInfoDepartmentById(Long infoId) {
LOGGER.debug("平台用户部门 SysRefUserInfoDepartment infoId:{}", infoId);
return refUserInfoDepartmentRDao.findByProperty("userId",infoId);
}
@Override
public List<SysOrganize> findSysUserInfoOrganize(Long infoId) {
return null;
}
@Override
public List<SysOrganize> findSysUserOrganize(Long infoId) {
return null;
}
@Override
public List<SysRefUserPosition> findSysRefUserPositionById(Long infoId) {
LOGGER.debug("平台用户岗位 SysRefUserPosition infoId:{}", infoId);
return refUserPositionRDao.findByProperty("userId",infoId);
}
@Override
public SessionUser packSessionUser(SessionUser sessionUser, SysUser user, Integer userType, String languageCode) {
return null;
}
@Override
public void checkSysUserOnly(SysUser user) {
if(user != null){
// 登录名唯一教研
if(!checkSysUserLoginName(user.getUserLoginName(), user.getId() == null ? 0 : user.getId())){
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_DATA_EXIT.getCode())
.setErrorDetail("用户名已存在")
.setErrorSolution("请重新输入用户名")
.build();
}
// 邮箱唯一教研
if(!checkSysUserEmail(user.getUserEmail(),user.getUserInfoId() == null ? 0 : user.getUserInfoId())){
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_DATA_EXIT.getCode())
.setErrorDetail("邮箱已存在")
.setErrorSolution("请重新输入邮箱")
.build();
}
// 手机号唯一教研
if(!checkSysUserPhone(user.getUserPhone(),user.getUserInfoId() == null ? 0 : user.getUserInfoId())){
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_DATA_EXIT.getCode())
.setErrorDetail("手机号已存在")
.setErrorSolution("请重新输入手机号")
.build();
}
// 工号唯一教研
if(!checkSysUserEmpNo(user.getUserEmpNo(),user.getUserInfoId() == null ? 0 : user.getUserInfoId())){
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_DATA_EXIT.getCode())
.setErrorDetail("工号号已存在")
.setErrorSolution("请重新输入工号")
.build();
}
}
}
/************************************ 用户唯一检查 ****************************************/
/**
*
* @param userLoginName
* @param userId
* @return
*/
private boolean checkSysUserLoginName(String userLoginName, long userId) {
int count = 0;
if(userId > 0){
StringBuffer sw = new StringBuffer();
HqlPack.getStringEqualPack(userLoginName,"userLoginName",sw);
HqlPack.getNumNOEqualPack(userId,"id",sw);
count = userRDao.findByHqlWhereCount(sw.toString());
}else{
count = userRDao.findByPropertyCount("userLoginName",userLoginName);
}
return count <= 0 ;
}
/**
*
* @param email
* @param infoId
* @return
*/
private boolean checkSysUserEmail(String email, long infoId) {
int count;
if(infoId > 0){
StringBuffer sw = new StringBuffer();
HqlPack.getStringEqualPack(email,"userEmail",sw);
HqlPack.getNumNOEqualPack(infoId,"userInfoId",sw);
count = userRDao.findByHqlWhereCount(sw.toString());
}else{
count = userRDao.findByPropertyCount("userEmail",email);
}
return count <= 0 ;
}
/**
*
* @param phone
* @param infoId
* @return
*/
private boolean checkSysUserPhone(String phone, long infoId) {
int count;
if(infoId > 0){
StringBuffer sw = new StringBuffer();
HqlPack.getStringEqualPack(phone,"userPhone",sw);
HqlPack.getNumNOEqualPack(infoId,"userInfoId",sw);
count = userRDao.findByHqlWhereCount(sw.toString());
}else{
count = userRDao.findByPropertyCount("userPhone",phone);
}
return count <= 0 ;
}
/**
*
* @param phone
* @param infoId
* @return
*/
private boolean checkSysUserEmpNo(String phone, long infoId) {
int count;
if(infoId > 0){
StringBuffer sw = new StringBuffer();
HqlPack.getStringEqualPack(phone,"userEmpNo",sw);
HqlPack.getNumNOEqualPack(infoId,"userInfoId",sw);
count = userRDao.findByHqlWhereCount(sw.toString());
}else{
count = userRDao.findByPropertyCount("userEmpNo",phone);
}
return count <= 0 ;
}
@Override
public void refreshRefSysUserOrganizeRdd(Long organizeIds) {
}
@Override
public void refreshRefSysUserDepartment(Long userId, Long[] departmentIds) {
LOGGER.info("账号部门信息 SysUser userInfoId:{} departmentIds:{}",userId,departmentIds);
SysUser user = userRDao.getById(userId);
if(user != null ){
// 删除用户部门关系
refUserDepartmentRDao.deleteByProperty("userId",user.getId());
if(departmentIds.length > 0){
// 查询部门信息
StringBuffer where = new StringBuffer();
HqlPack.getInPack(StringUtils.join(departmentIds,","),"id",where);
List<SysDepartment> departmentList = departmentRDao.findByHqlWhere(where.toString());
if(departmentList != null && departmentList.size() >0){
List<SysRefUserDepartment> list = new ArrayList<>();
List<String> nameList = new ArrayList<>();
SysRefUserDepartment ref = null;
for (SysDepartment department : departmentList) {
ref = new SysRefUserDepartment();
ref.setOrganizeId(department.getOrganizeId());
ref.setOrganizeNameRdd(department.getOrganizeNameRdd());
ref.setDepartmentId(department.getId());
ref.setDepartmentNameRdd(department.getName());
ref.setUserId(user.getId());
ref.setUserNameRdd(user.getUserName());
list.add(ref);
nameList.add(department.getName());
}
user.setDepartmentNamesRdd(String.join(",",nameList));
refUserDepartmentRDao.saveAll(list);
userRDao.save(user);
LOGGER.info("账号部门信息 SysUserInfo RefUserDepartmentRDao Insert Size :{}",list.size());
}
}
}else {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_DATA_NOT_EXIT.getCode())
.setErrorDetail("用户信息不存在")
.setErrorSolution("请重新操作")
.build();
}
}
@Override
public void refreshRefSysUserRole(Long userId, Long[] roleIds) {
LOGGER.debug("账号角色关系信息 RefSysUserRole userId:{} roleIds:{} ", userId,roleIds);
SysUser user = userRDao.getById(userId);
if(user != null){
// 根据IDS 查询所有的角色信息
String where = CoreHqlPack.packHqlIds("id", roleIds);
List<SysRole> list = roleRDao.findByHqlWhere(where);
// 删除角色关系信息
refUserRoleRDao.deleteByProperty("userId", user.getId()); // 删除用户角色关系
if(null != list && list.size() > 0){
// 新增用户角色关系
List<SysRefUserRole> refUserRoles = new ArrayList<>();
List<String> roleNameList = new ArrayList<>();
List<String> roleIdList = new ArrayList<>();
SysRefUserRole refUserRole = null;
for (SysRole role : list) {
roleNameList.add(role.getName());
roleIdList.add(role.getId().toString());
// 用户角色关系创建
refUserRole = new SysRefUserRole();
refUserRole.setRoleId(role.getId());
refUserRole.setRoleNameRdd(role.getName());
refUserRole.setUserId(user.getId());
refUserRole.setUserNameRdd(user.getUserName());
refUserRoles.add(refUserRole);
}
refUserRoleRDao.saveAll(refUserRoles);
// 角色名称冗余
user.setRoleNamesRdd(String.join(",", roleNameList));
user.setRoleIds(String.join(",", roleIdList));
userRDao.save(user);
}
}
}
@Override
public void refreshRefSysUserDepartmentRdd(Long departmentId) {
}
@Override
public void refreshRefSysUserInfoDepartment(Long userInfoId, Long[] departmentIds) {
LOGGER.info("用户部门关系信息 SysUser userInfoId:{} departmentIds:{}",userInfoId,departmentIds);
SysUserInfo info = userInfoRDao.getById(userInfoId);
if(info != null ){
// 删除用户部门关系
refUserInfoDepartmentRDao.deleteByProperty("userId",info.getId());
if(departmentIds.length > 0){
// 查询部门信息
StringBuffer where = new StringBuffer();
HqlPack.getInPack(StringUtils.join(departmentIds,","),"id",where);
List<SysDepartment> departmentList = departmentRDao.findByHqlWhere(where.toString());
if(departmentList != null && departmentList.size() >0){
List<SysRefUserInfoDepartment> list = new ArrayList<>();
List<String> nameList = new ArrayList<>();
SysRefUserInfoDepartment ref = null;
for (SysDepartment department : departmentList) {
ref = new SysRefUserInfoDepartment();
ref.setOrganizeId(department.getOrganizeId());
ref.setOrganizeNameRdd(department.getOrganizeNameRdd());
ref.setDepartmentId(department.getId());
ref.setDepartmentNameRdd(department.getName());
ref.setUserId(info.getId());
ref.setUserNameRdd(info.getName());
list.add(ref);
nameList.add(department.getName());
}
info.setDepartmentNamesRdd(String.join(",",nameList));
refUserInfoDepartmentRDao.saveAll(list);
userInfoRDao.save(info);
LOGGER.info("用户部门关系信息 SysUserInfo RefUserDepartmentRDao Insert Size :{}",list.size());
}
}
}else {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_DATA_NOT_EXIT.getCode())
.setErrorDetail("用户信息不存在")
.setErrorSolution("请重新操作")
.build();
}
}
@Override
public void refreshRefSysUserInfoDepartmentRdd(Long departmentId) {
}
@Override
public void refreshRefSysUserInfoPosition(Long userInfoId, Long[] positionIds) {
LOGGER.info("用户岗位关系信息 RefSysUserInfoPosition userInfoId:{} positionIds:{} userName:{}",userInfoId,positionIds);
SysUserInfo userInfo = userInfoRDao.getById(userInfoId);
if(userInfo != null ){
// 删除用户岗位关系
refUserPositionRDao.deleteByProperty("userId",userInfo.getId());
if(positionIds.length > 0){
StringBuffer where = new StringBuffer();
HqlPack.getInPack(StringUtils.join(positionIds,","),"id",where); // 查询部门信息
List<SysPosition> positionList = positionRDao.findByHqlWhere(where.toString());
if(positionList != null && positionList.size() >0){
List<SysRefUserPosition> list = new ArrayList<>();
List<String> nameList = new ArrayList<>();
SysRefUserPosition ref = null;
for (SysPosition position : positionList) {
ref = new SysRefUserPosition();
ref.setUserId(userInfo.getId());
ref.setUserNameRdd(userInfo.getName());
ref.setPositionId(position.getId());
ref.setPositionNameRdd(position.getName());
list.add(ref);
nameList.add(position.getName());
}
userInfo.setPositionNamesRdd(String.join(",",nameList));
refUserPositionRDao.saveAll(list);
userInfoRDao.save(userInfo);
LOGGER.info("用户岗位关系信息 SysUserInfo RefUserPositionRDao Insert Size :{}",list.size());
}
}
}else {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_DATA_NOT_EXIT.getCode())
.setErrorDetail("用户信息不存在")
.setErrorSolution("请重新操作")
.build();
}
}
@Override
public void refreshRefSysUserInfoPositionRdd(Long positionId) {
}
}

@ -216,7 +216,7 @@ public class SysUserInfoService implements ISysUserInfoService {
int count = sysUserRepository.findByPropertyCount(
new String[]{"userInfoId","isValid"},
new Object[]{userInfo.getId(),CommonEnumUtil.IS_VAILD.VAILD.getValue()});
userInfo.setUserNum(count);
// userInfo.setUserNum(count);
sysUserInfoRDao.save(userInfo);
}
@ -274,12 +274,12 @@ public class SysUserInfoService implements ISysUserInfoService {
if(userInfo != null){
StringBuffer userIdWhere = new StringBuffer();
if(userInfo.getDepartmentIdList() != null){
HqlPack.getInPack(StringUtils.join(userInfo.getDepartmentIdList(),","),"departmentId", userIdWhere);
}
if(userInfo.getOrganizeIdList() != null){
HqlPack.getInPack( StringUtils.join(userInfo.getOrganizeIdList(),","),"organizeId",userIdWhere);
}
// if(userInfo.getDepartmentIdList() != null){
// HqlPack.getInPack(StringUtils.join(userInfo.getDepartmentIdList(),","),"departmentId", userIdWhere);
// }
// if(userInfo.getOrganizeIdList() != null){
// HqlPack.getInPack( StringUtils.join(userInfo.getOrganizeIdList(),","),"organizeId",userIdWhere);
// }
return refUserDepartmentRDao.findByHqlWhere(userIdWhere.toString());
}else {

@ -251,8 +251,8 @@ public class SysUserService implements ISysUserService {
refUserRoleRDao.saveAll(refUserRoles);
// 角色名称冗余
sysUser.setRoleNameRdd(String.join(",", roleNameList));
sysUser.setRoleId(list.get(0).getId());
// sysUser.setRoleNameRdd(String.join(",", roleNameList));
// sysUser.setRoleId(list.get(0).getId());
sysUserRDao.save(sysUser);
}
@ -467,7 +467,7 @@ public class SysUserService implements ISysUserService {
packSysUserPosition(sessionUser,userInfo); //封装用户岗位信息
packSysUserOrganize(userInfo); //封装用户组织信息
userInfo.setUser(user);
// userInfo.setUser(user);
sessionUser.setUserName(userInfo.getName());
sessionUser.setUserCode(userInfo.getUserEmpNo());
sessionUser.setUserId(userInfo.getId());

@ -1,50 +0,0 @@
package cn.estsh.i3plus.core.apiservice.mq;
import cn.estsh.i3plus.core.apiservice.serviceimpl.busi.TestBase;
import cn.estsh.i3plus.core.apiservice.util.MailUtil;
import cn.estsh.i3plus.pojo.base.enumutil.ImppEnumUtil;
import cn.estsh.i3plus.pojo.platform.bean.SysMessage;
import org.junit.Test;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
/**
* @Description :
* @Reference :
* @Author : yunhao
* @CreateDate : 2018-11-15 13:22
* @Modify:
**/
public class TestMQ extends TestBase {
/**
* rabbitMQ
*/
@Autowired
private RabbitTemplate rabbitTemplate;
@Autowired
private MailUtil mailUtil;
@Test
public void sendMail() throws InterruptedException {
SysMessage sysMessage = new SysMessage();
sysMessage.setMessageTitle("test-系统通知");
sysMessage.setMessageSenderNameRdd("system");
sysMessage.setMessageSenderId(-1L);
sysMessage.setMessageType(ImppEnumUtil.MESSAGE_TYPE.MAIL.getValue());
sysMessage.setMessageSendTime("2018-11-01 16:58:00");
for (int i = 0; i < 50; i++) {
sysMessage = new SysMessage();
sysMessage.setId(null);
sysMessage.setMessageTitle( i + "mail测试");
sysMessage.setMessageSenderNameRdd(i+"");
rabbitTemplate.convertAndSend("WYH_MESSAGE_QUEUE", new SysMessage());
System.out.println("第" + i + "次");
}
}
}

@ -1,34 +0,0 @@
package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
/**
* @Description :
* @Reference :
* @Author : alwaysfrin
* @CreateDate : 2018-11-09 10:00
* @Modify:
**/
public class ArraySort implements Runnable {
private String num;
public ArraySort(int num){
this.num = num + "";
}
public static void main(String[] args){
int[] num = {11,3,9,5,1,4,15};
for(int i=0;i<num.length;i++){
new Thread(new ArraySort(num[i])).start();
}
}
@Override
public void run() {
try {
Thread.sleep(Integer.parseInt(num));
System.out.println(num);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}

@ -1,118 +0,0 @@
//package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
//
//import cn.estsh.i3plus.core.api.iservice.busi.IDepartmentService;
//import cn.estsh.i3plus.pojo.base.bean.ListPager;
//import cn.estsh.i3plus.pojo.base.common.Pager;
//import cn.estsh.i3plus.pojo.platform.bean.Department;
//import cn.estsh.i3plus.pojo.platform.bean.Organize;
//import com.alibaba.fastjson.JSON;
//import org.junit.Test;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.test.annotation.Rollback;
//
//import javax.transaction.Transactional;
//import java.util.List;
//
///**
// * @Description : 岗位信息测试
// * @Reference :
// * @Author : wei.peng
// * @Date : 2018-10-29 19:02
// * @Modify :
// **/
//public class TestDepartmentService extends TestBase {
//
// @Autowired
// private IDepartmentService departmentService;
//
// /**
// * 新增数据
// */
// @Test
// @Transactional
// public void testInsertDepartment(){
// for(int i = 0 ; i < 50 ; i++ ){
// Department obj = new Department();
// obj.setName("Junit Test " + i);
// obj.setDepartmentCode("DEV_JUNIT " + i);
// obj.setParentId(1057165194242953216L);
// obj.setOrganizeId(1057163974900060160L);
// obj = departmentService.insertDepartment(obj);
// System.out.println(JSON.toJSONString(obj));
// }
// }
//
// /**
// * 根据Key 数据
// * @return
// */
// @Test
// @Transactional
// public void testGetDepartmentById(){
// Department obj = departmentService.getDepartmentById("1057163974900060160");
// System.out.println(JSON.toJSONString(obj));
// }
//
// /**
// * 查询所有数据
// *
// * @return
// */
// @Test
// @Transactional
// public void testListDepartment(){
// List list = departmentService.listDepartment();
// System.out.println(JSON.toJSONString(list));
// }
//
// /**
// * 根据岗位信息进行查找
// * @return
// */
// @Test
// @Transactional
// public void testFindDepartmentByPager(){
// Organize obj = new Organize();
//
// Pager pager = new Pager();
// pager.setPageSize(10);
// pager.setCurrentPage(1);
//
// ListPager list = departmentService.queryDepartment(null, pager);
//
// System.out.println(JSON.toJSONString(list));
// }
//
// /**
// * 修改数据
// */
// @Test
// @Transactional
// public void testUpdateDepartment(){
// Department obj = departmentService.getDepartmentById("1057108586410414080");
// obj.setName("Junit update Name ");
// departmentService.updateDepartment(obj);
// System.out.println(JSON.toJSONString(obj));
// }
//
// /**
// * 根据Key 删除数据
// */
// @Test
// @Transactional
// public void testDeleteDepartmentById(){
//// departmentService.deleteOrganizeById("");
// }
//
// /**
// * 根据id批量删除岗位
// * @return
// */
// @Test
// @Transactional
// public void deleteDepartmentByIds(){
//// departmentService.deleteOrganizeByIds(new String[]{"1057108585445724160","1057108585760296960"});
// }
//
//
//}

@ -1,96 +0,0 @@
package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;//package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
import cn.estsh.i3plus.pojo.platform.bean.*;
import cn.estsh.i3plus.pojo.platform.repository.*;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
/**
* @Description :
* @Reference :
* @Author : yunhao
* @CreateDate : 2018-11-22 11:01
* @Modify:
**/
public class TestExcelOrderNoRule extends TestBase {
public static final Logger LOGGER = LoggerFactory.getLogger(TestExcelOrderNoRule.class);
// 文件路径
public static final String PATH_NAME = "init/oder-no-rule.xlsx";
// 权限Sheet 名称
public static final String SHEET_ORDER_NO_RULE = "order-no-rule";
@Autowired
private SysOrderNoRuleRepository sysOrderNoRuleRDao;
@Test
public void testInit() throws Exception {
XSSFWorkbook workbook = getWorkbook(PATH_NAME);
if(workbook != null){
XSSFSheet sheetOrderNoRule = workbook.getSheet(SHEET_ORDER_NO_RULE);
List<SysOrderNoRule> ysOrderNoRuleList = getSysOrderNoRule(sheetOrderNoRule);
LOGGER.info("System Init SysOrderNoRule Size:{}",ysOrderNoRuleList.size());
sysOrderNoRuleRDao.saveAll(ysOrderNoRuleList);
}
}
public List<SysOrderNoRule> getSysOrderNoRule(XSSFSheet sheet){
List<SysOrderNoRule> result = new ArrayList<>();
if(sheet != null){
if(sheet.getLastRowNum() >= 1){
SysOrderNoRule obj = null;
for (int i = 1; i <= sheet.getLastRowNum(); i++) {
try {
Row row = sheet.getRow(i);//获取索引为i的行以0开始
if(row.getCell(0).toString().trim().length() > 0){
obj = new SysOrderNoRule();
obj.setId(Long.parseLong(row.getCell(0).getStringCellValue()));
obj.setName(row.getCell(1).getStringCellValue());
obj.setOrderNoRuleCode(row.getCell(2).getStringCellValue());
obj.setOrderNoRule(row.getCell(3).getStringCellValue());
obj.setSerialNoSeed(Long.parseLong(row.getCell(4).getStringCellValue()));
obj.setSerialNoIncrement(Long.parseLong(row.getCell(5).getStringCellValue()));
obj.setSerialNoLength(Long.parseLong(row.getCell(6).getStringCellValue()));
obj.setIsCycle(Integer.parseInt(row.getCell(7).getStringCellValue()));
obj.setOrderNoRuleDescription(row.getCell(8).getStringCellValue());
obj.setOrderNoRuleStatus(1);
obj.setSerialNo(-1L);
obj.setIsValid(1);
result.add(obj);
}
}catch (Exception e){
LOGGER.error("Excel Sheet Name :{} Index:{} DataType Error", sheet.getSheetName(), i);
}
}
}
}
return result;
}
public XSSFWorkbook getWorkbook(String pathName){
try {
InputStream in = TestExcelPermission.class.getClassLoader().getResourceAsStream(pathName);
XSSFWorkbook workbook = new XSSFWorkbook(in);
return workbook;
}catch (Exception e){
LOGGER.error(" System Init Sys Data Excel Error file path {} error message :{}",pathName,e.getMessage());
e.getMessage();
return null;
}
}
}

@ -1,260 +0,0 @@
package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
import cn.estsh.i3plus.platform.common.tool.EncryptTool;
import cn.estsh.i3plus.pojo.platform.bean.*;
import cn.estsh.i3plus.pojo.platform.repository.*;
import com.alibaba.fastjson.JSON;
import io.swagger.models.auth.In;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.jdom2.Document;
import org.jdom2.JDOMException;
import org.jdom2.input.SAXBuilder;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
/**
*
*/
public class TestExcelPermission extends TestBase {
//public class TestExcelPermission {
public static final Logger LOGGER = LoggerFactory.getLogger(TestExcelPermission.class);
// 文件路径
public static final String PATH_NAME = "init/permission.xlsx";
// 权限Sheet 名称
public static final String SHEET_NAME_MENU = "menu";
public static final String SHEET_NAME_ROLE = "role";
public static final String SHEET_NAME_USER_INFO = "user-info";
public static final String SHEET_NAME_USER = "user";
@Autowired
private SysUserRepository sysUserRdao;
@Autowired
private SysUserInfoRepository userInfoRDao;
@Autowired
private SysMenuRepository menuRdao;
@Autowired
private SysRoleRepository roleRDao;
@Autowired
private SysRefRoleMenuRepository refRoleMenuRDao;
@Test
public void testInit() throws Exception {
XSSFWorkbook workbook = getWorkbook(PATH_NAME);
if(workbook != null){
XSSFSheet sheetMenu = workbook.getSheet(SHEET_NAME_MENU);
XSSFSheet sheetRole = workbook.getSheet(SHEET_NAME_ROLE);
XSSFSheet sheetUserInfo = workbook.getSheet(SHEET_NAME_USER_INFO);
XSSFSheet sheetUser = workbook.getSheet(SHEET_NAME_USER);
List<SysMenu> menus = getSysMenu(sheetMenu);
List<SysRole> roles = getSysRole(sheetRole);
List<SysUserInfo> userInfos = getSysUserInfo(sheetUserInfo);
List<SysUser> users = getSysUser(sheetUser);
List<SysRefRoleMenu> refRoleMenu = getRefRoleMenu(menus, roles);
LOGGER.info("System Init SysMenu Size:{}",menus.size());
LOGGER.info("System Init SysRole Size:{}",roles.size());
LOGGER.info("System Init SysUserInfo Size:{}",userInfos.size());
LOGGER.info("System Init SysUser Size:{}",users.size());
LOGGER.info("System Init SysRefRoleMenu Size:{}",refRoleMenu.size());
sysUserRdao.saveAll(users);
userInfoRDao.saveAll(userInfos);
menuRdao.saveAll(menus);
roleRDao.saveAll(roles);
refRoleMenuRDao.saveAll(refRoleMenu);
}
}
public List<SysRefUserRole> getRefUserRole(List<SysUser> users,List<SysRole> roles){
List<SysRefUserRole> result = new ArrayList<>();
if(users != null && roles != null){
SysRefUserRole ref = null;
for (SysUser user : users) {
for (SysRole role : roles) {
ref = new SysRefUserRole();
ref.setRoleId(role.getId());
ref.setRoleNameRdd(role.getName());
ref.setUserId(user.getId());
ref.setUserNameRdd(user.getUserName());
result.add(ref);
}
}
}
return result;
}
public List<SysRefRoleMenu> getRefRoleMenu(List<SysMenu> menus,List<SysRole> roles){
List<SysRefRoleMenu> result = new ArrayList<>();
if(menus != null && roles != null){
SysRefRoleMenu ref = null;
for (SysMenu menu : menus) {
for (SysRole role : roles) {
ref = new SysRefRoleMenu();
ref.setRoleId(role.getId());
ref.setRoleNameRdd(role.getName());
ref.setMenuId(menu.getId());
ref.setMenuNameRdd(menu.getName());
ref.setMenuTypeRdd(menu.getMenuType());
result.add(ref);
}
}
}
return result;
}
public List<SysUser> getSysUser(XSSFSheet sheet){
List<SysUser> result = new ArrayList<>();
if(sheet != null){
if(sheet.getLastRowNum() >= 1){
SysUser obj = null;
for (int i = 1; i <= sheet.getLastRowNum(); i++) {
try {
Row row = sheet.getRow(i);//获取索引为i的行以0开始
if(row.getCell(0).toString().trim().length() > 0){
obj = new SysUser();
String md5 = EncryptTool.hexMD5(row.getCell(2).toString());
obj.setId(Long.parseLong(row.getCell(0).getStringCellValue()));
obj.setUserLoginName(row.getCell(1).getStringCellValue());
obj.setUserLoginPassword(md5);
obj.setUserEmail(row.getCell(3).getStringCellValue());
obj.setUserPhone(row.getCell(4).getStringCellValue());
obj.setUserInfoId(Long.parseLong(row.getCell(5).getStringCellValue()));
obj.setUserName(row.getCell(6).getStringCellValue());
obj.setIsValid(1);
obj.setUserStatus(1);
obj.setUserType(1);
obj.setUserLoginNum(0);
result.add(obj);
}
}catch (Exception e){
LOGGER.error("Excel Sheet Name :{} Index:{} DataType Error", sheet.getSheetName(), i);
}
}
}
}
return result;
}
public List<SysUserInfo> getSysUserInfo(XSSFSheet sheet){
List<SysUserInfo> result = new ArrayList<>();
if(sheet != null){
if(sheet.getLastRowNum() >= 1){
SysUserInfo obj = null;
for (int i = 1; i <= sheet.getLastRowNum(); i++) {
try {
Row row = sheet.getRow(i);//获取索引为i的行以0开始
if(row.getCell(0).toString().trim().length() > 0){
obj = new SysUserInfo();
obj.setId(Long.parseLong(row.getCell(0).getStringCellValue()));
obj.setName(row.getCell(1).getStringCellValue());
obj.setUserEmpNo(row.getCell(2).getStringCellValue());
obj.setUserLoginNum(0);
obj.setIsValid(1);
obj.setUserInfoStatus(1);
result.add(obj);
}
}catch (Exception e){
LOGGER.error("Excel Sheet Name :{} Index:{} DataType Error", sheet.getSheetName(), i);
}
}
}
}
return result;
}
public List<SysRole> getSysRole(XSSFSheet sheet){
List<SysRole> result = new ArrayList<>();
if(sheet != null){
if(sheet.getLastRowNum() >= 1){
SysRole role = null;
for (int i = 1; i <= sheet.getLastRowNum(); i++) {
try {
Row row = sheet.getRow(i);//获取索引为i的行以0开始
if(row.getCell(0).toString().trim().length() > 0){
role = new SysRole();
role.setId(Long.parseLong(row.getCell(0).getStringCellValue()));
role.setName(row.getCell(1).getStringCellValue());
role.setRoleDescription(row.getCell(2).getStringCellValue());
role.setRoleStatus(1);
role.setIsValid(1);
result.add(role);
}
}catch (Exception e){
LOGGER.error("Excel Sheet Name :{} Index:{} DataType Error", sheet.getSheetName(), i);
}
}
}
}
return result;
}
public List<SysMenu> getSysMenu(XSSFSheet sheet){
List<SysMenu> result = new ArrayList<>();
if(sheet != null){
if(sheet.getLastRowNum() >= 1){
SysMenu menu = null;
for (int i = 1; i <= sheet.getLastRowNum(); i++) {
try {
Row row = sheet.getRow(i);//获取索引为i的行以0开始
if(row.getCell(0).toString().trim().length() > 0){
menu = new SysMenu();
menu.setId(Long.parseLong(row.getCell(0).getStringCellValue()));
menu.setMenuType(Integer.parseInt(row.getCell(1).getStringCellValue()));
menu.setMenuCode(row.getCell(2).getStringCellValue());
menu.setName(row.getCell(3).getStringCellValue());
menu.setParentId(Long.parseLong(row.getCell(4).getStringCellValue()));
menu.setParentNameRdd(row.getCell(5).getStringCellValue());
menu.setMenuDescription(row.getCell(6).getStringCellValue());
menu.setMenuStatus(Integer.parseInt(row.getCell(7).getStringCellValue()));
menu.setCreateUser("System Init");
menu.setMenuUrl(row.getCell(9).getStringCellValue());
menu.setMenuCss(row.getCell(10).getStringCellValue());
menu.setMenuIcon(row.getCell(11).getStringCellValue());
result.add(menu);
}
}catch (Exception e){
LOGGER.error("Excel Sheet Name :{} Index:{} DataType Error", sheet.getSheetName(), i);
}
}
}
}
return result;
}
public XSSFWorkbook getWorkbook(String pathName){
try {
InputStream in = TestExcelPermission.class.getClassLoader().getResourceAsStream(pathName);
XSSFWorkbook workbook = new XSSFWorkbook(in);
return workbook;
}catch (Exception e){
LOGGER.error(" System Init Sys Data Excel Error file path {} error message :{}",pathName,e.getMessage());
e.getMessage();
return null;
}
}
}

@ -1,207 +0,0 @@
package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
import cn.estsh.i3plus.pojo.platform.bean.*;
import cn.estsh.i3plus.pojo.platform.repository.SysConfigRepository;
import cn.estsh.i3plus.pojo.platform.repository.SysDictionaryRepository;
import cn.estsh.i3plus.pojo.platform.repository.SysLocaleLanguageRepository;
import cn.estsh.i3plus.pojo.platform.repository.SysLocaleResourceRepository;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
/**
* @Description :
* @Reference :
* @Author : yunhao
* @CreateDate : 2018-11-22 11:01
* @Modify:
**/
public class TestExcelSysConfig extends TestBase {
public static final Logger LOGGER = LoggerFactory.getLogger(TestExcelPermission.class);
// 文件路径
public static final String PATH_NAME = "init/sys-config.xlsx";
// 权限Sheet 名称
public static final String SHEET_SYS_CONFIG = "sys-config";
public static final String SHEET_DICTIONARY = "dictionary";
public static final String SHEET_LANGUAGE = "language";
public static final String SHEET_RESOURCE = "resource";
@Autowired
private SysConfigRepository sysConfigRDao;
@Autowired
private SysDictionaryRepository sysDictionaryRDao;
@Autowired
private SysLocaleLanguageRepository sysLocaleLanguageRDao;
@Autowired
private SysLocaleResourceRepository sysLocaleResourceRDao;
@Test
public void testInit() throws Exception {
XSSFWorkbook workbook = getWorkbook(PATH_NAME);
if(workbook != null){
XSSFSheet sheetSysConfig = workbook.getSheet(SHEET_SYS_CONFIG);
XSSFSheet sheetDictionary = workbook.getSheet(SHEET_DICTIONARY);
XSSFSheet sheetLanguage = workbook.getSheet(SHEET_LANGUAGE);
XSSFSheet sheetResource = workbook.getSheet(SHEET_RESOURCE);
List<SysConfig> sysConfigList = getSysConfig(sheetSysConfig);
List<SysDictionary> sysDictionaryList = getSysDictionary(sheetDictionary);
List<SysLocaleLanguage> sysLocaleLanguageList = getSysLocaleLanguage(sheetLanguage);
List<SysLocaleResource> sysLocaleResourceList= getSysLocaleResource(sheetResource);
LOGGER.info("System Init SysConfig Size:{}",sysConfigList.size());
LOGGER.info("System Init SysDictionary Size:{}",sysDictionaryList.size());
LOGGER.info("System Init SysLocaleLanguage Size:{}",sysLocaleLanguageList.size());
LOGGER.info("System Init SysLocaleResource Size:{}",sysLocaleResourceList.size());
sysConfigRDao.saveAll(sysConfigList);
sysDictionaryRDao.saveAll(sysDictionaryList);
sysLocaleLanguageRDao.saveAll(sysLocaleLanguageList);
sysLocaleResourceRDao.saveAll(sysLocaleResourceList);
}
}
public List<SysConfig> getSysConfig(XSSFSheet sheet){
List<SysConfig> result = new ArrayList<>();
if(sheet != null){
if(sheet.getLastRowNum() >= 1){
SysConfig obj = null;
for (int i = 1; i <= sheet.getLastRowNum(); i++) {
try {
Row row = sheet.getRow(i);//获取索引为i的行以0开始
if(row.getCell(0).toString().trim().length() > 0){
obj = new SysConfig();
obj.setId(Long.parseLong(row.getCell(0).getStringCellValue()));
obj.setName(row.getCell(1).getStringCellValue());
obj.setConfigType(Integer.valueOf(row.getCell(2).getStringCellValue()));
obj.setConfigCode(row.getCell(3).getStringCellValue());
obj.setConfigValue(row.getCell(4).getStringCellValue());
obj.setConfigDescription(row.getCell(5).getStringCellValue());
obj.setIsValid(1);
result.add(obj);
}
}catch (Exception e){
LOGGER.error("Excel Sheet Name :{} Index:{} DataType Error", sheet.getSheetName(), i);
}
}
}
}
return result;
}
public List<SysDictionary> getSysDictionary(XSSFSheet sheet){
List<SysDictionary> result = new ArrayList<>();
if(sheet != null){
if(sheet.getLastRowNum() >= 1){
SysDictionary obj = null;
for (int i = 1; i <= sheet.getLastRowNum(); i++) {
try {
Row row = sheet.getRow(i);//获取索引为i的行以0开始
if(row.getCell(0).toString().trim().length() > 0){
obj = new SysDictionary();
obj.setId(Long.parseLong(row.getCell(0).getStringCellValue()));
obj.setName(row.getCell(1).getStringCellValue());
obj.setDictionaryCode(row.getCell(2).getStringCellValue());
obj.setParentId(Long.valueOf(row.getCell(3).getStringCellValue()));
obj.setParentNameRdd(row.getCell(4).getStringCellValue());
obj.setParentCodeRdd(row.getCell(5).getStringCellValue());
obj.setDictionaryValue(row.getCell(6).getStringCellValue());
obj.setDictionarySort(Integer.valueOf(row.getCell(7).getStringCellValue()));
obj.setDictionaryDescription(row.getCell(8).getStringCellValue());
obj.setIsValid(1);
result.add(obj);
}
}catch (Exception e){
LOGGER.error("Excel Sheet Name :{} Index:{} DataType Error", sheet.getSheetName(), i);
}
}
}
}
return result;
}
public List<SysLocaleLanguage> getSysLocaleLanguage(XSSFSheet sheet){
List<SysLocaleLanguage> result = new ArrayList<>();
if(sheet != null){
if(sheet.getLastRowNum() >= 1){
SysLocaleLanguage obj = null;
for (int i = 1; i <= sheet.getLastRowNum(); i++) {
try {
Row row = sheet.getRow(i);//获取索引为i的行以0开始
if(row.getCell(0).toString().trim().length() > 0){
obj = new SysLocaleLanguage();
obj.setId(Long.parseLong(row.getCell(0).getStringCellValue()));
obj.setLanguageName(row.getCell(1).getStringCellValue());
obj.setLanguageCode(row.getCell(2).getStringCellValue());
obj.setLanguageSort(Integer.valueOf(row.getCell(3).getStringCellValue()));
obj.setIsDefault(Integer.valueOf(row.getCell(4).getStringCellValue()));
obj.setLanguageStatus(Integer.valueOf(row.getCell(5).getStringCellValue()));
obj.setIsValid(1);
result.add(obj);
}
}catch (Exception e){
LOGGER.error("Excel Sheet Name :{} Index:{} DataType Error", sheet.getSheetName(), i);
}
}
}
}
return result;
}
public List<SysLocaleResource> getSysLocaleResource(XSSFSheet sheet){
List<SysLocaleResource> result = new ArrayList<>();
if(sheet != null){
if(sheet.getLastRowNum() >= 1){
SysLocaleResource obj = null;
for (int i = 1; i <= sheet.getLastRowNum(); i++) {
try {
Row row = sheet.getRow(i);//获取索引为i的行以0开始
if(row.getCell(0).toString().trim().length() > 0){
obj = new SysLocaleResource();
obj.setId(Long.parseLong(row.getCell(0).getStringCellValue()));
obj.setResourceType(Integer.valueOf(row.getCell(1).getStringCellValue()));
obj.setLanguageCode(row.getCell(2).getStringCellValue());
obj.setLanguageNameRdd(row.getCell(3).getStringCellValue());
obj.setResourceKey(row.getCell(4).getStringCellValue());
obj.setResourceValue(row.getCell(5).getStringCellValue());
obj.setIsSystem(Integer.valueOf(row.getCell(6).getStringCellValue()));
obj.setIsValid(1);
result.add(obj);
}
}catch (Exception e){
LOGGER.error("Excel Sheet Name :{} Index:{} DataType Error", sheet.getSheetName(), i);
}
}
}
}
return result;
}
public XSSFWorkbook getWorkbook(String pathName){
try {
InputStream in = TestExcelPermission.class.getClassLoader().getResourceAsStream(pathName);
XSSFWorkbook workbook = new XSSFWorkbook(in);
return workbook;
}catch (Exception e){
LOGGER.error(" System Init Sys Data Excel Error file path {} error message :{}",pathName,e.getMessage());
e.getMessage();
return null;
}
}
}

@ -1,59 +0,0 @@
package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
import cn.estsh.i3plus.pojo.platform.bean.SysConfig;
import cn.estsh.i3plus.pojo.platform.repository.SysConfigRepository;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
/**
* @Description :
* @Reference :
* @Author : yunhao
* @CreateDate : 2018-12-20 17:02
* @Modify:
**/
public class TestMathOper extends TestBase {
@Test
public void test(){
System.out.println("Hello World !~");
}
@Autowired
private SysConfigRepository sysConfigRDao;
String propertyName = "configType";
String groupByName = "configType";
String[] param = new String[]{"configType"};
Object[] paramValue = new Object[]{1};
@Test
public void testMax(){
SysConfig sysConfig = new SysConfig();
// max
System.out.println(sysConfigRDao.findMaxByProperties(propertyName,groupByName,param,paramValue));
System.out.println(sysConfigRDao.findMaxByProperty(propertyName,groupByName,param[0],paramValue[0]));
}
@Test
public void testMin(){
// min
System.out.println(sysConfigRDao.findMinByProperties(propertyName,groupByName,param,paramValue));
System.out.println(sysConfigRDao.findMinByProperty(propertyName,groupByName,param[0],paramValue[0]));
}
@Test
public void testSum(){
//sum
System.out.println(sysConfigRDao.findSumByProperties(propertyName,groupByName,param,paramValue));
System.out.println(sysConfigRDao.findSumByProperty(propertyName,groupByName,param[0],paramValue[0]));
}
@Test
public void testAvg(){
//avg
System.out.println(sysConfigRDao.findAvgByProperties(propertyName,groupByName,param,paramValue));
System.out.println(sysConfigRDao.findAvgByProperty(propertyName,groupByName,param[0],paramValue[0]));
}
}

@ -1,110 +0,0 @@
//package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
//
//import cn.estsh.i3plus.core.api.iservice.busi.ISysMessageService;
//import cn.estsh.i3plus.pojo.base.bean.ListPager;
//import cn.estsh.i3plus.pojo.base.common.Pager;
//import cn.estsh.i3plus.pojo.base.enumutil.ImppEnumUtil;
//import cn.estsh.i3plus.pojo.platform.bean.SysMessage;
//import com.alibaba.fastjson.JSON;
//import org.junit.Test;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.test.annotation.Rollback;
//
//import javax.transaction.Transactional;
//import java.util.List;
//
///**
// * @Description : 测试 消息服务接口
// * @Reference :
// * @Author : yunhao
// * @Date : 2018-10-31 15:30
// * @Modify :
// **/
//public class TestMessageService extends TestBase {
//
// public static final Logger LOGGER = LoggerFactory.getLogger(TestMessageService.class);
// @Autowired
// private ISysMessageService sysMessageService;
//
// /**
// * 测试 查询所有消息
// */
// @Test
// @Transactional
// public void testListSysMessage() {
// List list = sysMessageService.listSysMessage();
// System.out.println(JSON.toJSONString(list));
// }
//
// /**
// * 测试 根据id查询消息
// */
// @Test
// @Transactional
// public void testGetSysMessageById() {
// SysMessage sysMessage = sysMessageService.getSysMessageById(1L);
// System.out.println(JSON.toJSONString(sysMessage));
// }
//
// /**
// * 测试 添加消息
// */
// @Test
// @Transactional
// @Rollback(false)
// public void testInsertSysMessage() {
// SysMessage sysMessage = new SysMessage();
// sysMessage.setMessageTitle("test-系统通知");
// sysMessage.setMessageSenderNameRdd("system");
// sysMessage.setMessageSenderId(-1L);
// sysMessage.setMessageType(ImppEnumUtil.MESSAGE_TYPE.MAIL.getValue());
// sysMessage.setMessageSendTime("2018-11-01 16:58:00");
//
// for (int i = 0; i < 50; i++) {
// sysMessage.setId(null);
// sysMessage.setMessageTitle("test-系统通知" + i);
// sysMessageService.insertSysMessage(sysMessage);
// }
// System.out.println(JSON.toJSONString(sysMessage));
// }
//
// /**
// * 测试 修改消息
// */
// @Test
// @Transactional
// public void testUpdateSysMessage(){
// SysMessage sysMessage = sysMessageService.getSysMessageById(1L);
// sysMessage.setMessageTitle("测试修改");
//
// sysMessageService.updateSysMessage(sysMessage);
// }
//
// /**
// * 测试 根据id删除消息
// */
// @Test
// @Transactional
// public void testDeleteSysMessageById(){
// sysMessageService.deleteSysMessageById(1L);
// }
//
// /**
// * 测试 复杂查询
// */
// @Test
// @Transactional
// public void testQuerySysMessageByPager(){
// SysMessage sysMessage = new SysMessage();
//
// Pager pager = new Pager();
// pager.setPageSize(10);
// pager.setCurrentPage(5);
//
// ListPager list = sysMessageService.querySysMessageByPager(sysMessage,pager);
// System.out.println(list);
// }
//
//}

@ -1,118 +0,0 @@
//package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
//
//import cn.estsh.i3plus.core.api.iservice.busi.IOrganizeService;
//import cn.estsh.i3plus.pojo.base.bean.ListPager;
//import cn.estsh.i3plus.pojo.base.common.Pager;
//import cn.estsh.i3plus.pojo.platform.bean.Organize;
//import cn.estsh.i3plus.pojo.platform.bean.Organize;
//import com.alibaba.fastjson.JSON;
//import org.junit.Test;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.test.annotation.Rollback;
//
//import javax.transaction.Transactional;
//import java.util.List;
//
///**
// * @Description : 岗位信息测试
// * @Reference :
// * @Author : wei.peng
// * @Date : 2018-10-29 19:02
// * @Modify :
// **/
//public class TestOrganizeService extends TestBase {
//
// @Autowired
// private IOrganizeService organizeService;
//
// /**
// * 新增数据
// */
// @Test
// @Transactional
// @Rollback(false)
// public void testInsertOrganize(){
// for(int i = 0 ; i < 50 ; i++ ){
// Organize obj = new Organize();
// obj.setName("Junit Test " + i);
// obj.setOrganizeCode("DEV_JUNIT " + i);
// obj.setParentId(-1L);
// obj = organizeService.insertOrganize(obj);
// System.out.println(JSON.toJSONString(obj));
// }
// }
//
// /**
// * 根据Key 数据
// * @return
// */
// @Test
// @Transactional
// public void testGetOrganizeById(){
// Organize obj = organizeService.getOrganizeById("1057163974900060160");
// System.out.println(JSON.toJSONString(obj));
// }
//
// /**
// * 查询所有数据
// *
// * @return
// */
// @Test
// @Transactional
// public void testListOrganize(){
// List list = organizeService.listOrganize();
// System.out.println(JSON.toJSONString(list));
// }
//
// /**
// * 根据岗位信息进行查找
// * @return
// */
// @Test
// @Transactional
// public void testFindOrganizeByPager(){
// Organize obj = new Organize();
//
// Pager pager = new Pager();
// pager.setPageSize(10);
// pager.setCurrentPage(1);
//
// ListPager list = organizeService.queryOrganize(null, pager);
//
// System.out.println(JSON.toJSONString(list));
// }
//
// /**
// * 修改数据
// */
// @Test
// @Transactional
// public void testUpdateOrganize(){
// Organize obj = organizeService.getOrganizeById("1057108586410414080");
// obj.setName("Junit update Name ");
// organizeService.updateOrganize(obj);
// System.out.println(JSON.toJSONString(obj));
// }
//
// /**
// * 根据Key 删除数据
// */
// @Test
// @Transactional
// public void testDeleteOrganizeById(){
//// organizeService.deleteOrganizeById("");
// }
//
// /**
// * 根据id批量删除岗位
// * @return
// */
// @Test
// @Transactional
// public void deleteOrganizeByIds(){
//// organizeService.deleteOrganizeByIds(new String[]{"1057108585445724160","1057108585760296960"});
// }
//
//
//}

@ -1,117 +0,0 @@
//package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
//
//import cn.estsh.i3plus.core.api.iservice.busi.IPositionService;
//import cn.estsh.i3plus.pojo.base.bean.ListPager;
//import cn.estsh.i3plus.pojo.base.common.Pager;
//import cn.estsh.i3plus.pojo.platform.bean.Position;
//import com.alibaba.fastjson.JSON;
//import org.junit.Test;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.core.annotation.Order;
//import org.springframework.test.annotation.Rollback;
//
//import javax.transaction.Transactional;
//import java.util.List;
//
///**
// * @Description : 岗位信息测试
// * @Reference :
// * @Author : wei.peng
// * @Date : 2018-10-29 19:02
// * @Modify :
// **/
//public class TestPositionService extends TestBase {
//
// @Autowired
// private IPositionService positionService;
//
// /**
// * 新增数据
// */
// @Test
// @Transactional
// @Rollback(false)
// public void testInsertPosition(){
// for(int i = 0 ; i < 50 ; i++ ){
// Position position = new Position();
// position.setName("Junit Test " + i);
// position.setPositionCode("DEV_JUNIT " + i);
// position = positionService.insertPosition(position);
// System.out.println(JSON.toJSONString(position));
// }
// }
//
// /**
// * 根据Key 数据
// * @return
// */
// @Test
// @Transactional
// public void testGetPositionById(){
// Position pos = positionService.getPositionById("1057108589715525632");
// System.out.println(JSON.toJSONString(pos));
// }
//
// /**
// * 查询所有数据
// *
// * @return
// */
// @Test
// @Transactional
// public void testListPosition(){
// List list = positionService.listPosition();
// System.out.println(JSON.toJSONString(list));
// }
//
// /**
// * 根据岗位信息进行查找
// * @return
// */
// @Test
// @Transactional
// public void testFindPositionByPager(){
// Position position = new Position();
//
// Pager pager = new Pager();
// pager.setPageSize(10);
// pager.setCurrentPage(1);
//
// ListPager list = positionService.findPositionByPager(null, pager);
//
// System.out.println(JSON.toJSONString(list));
// }
//
// /**
// * 修改数据
// */
// @Test
// @Transactional
// public void testUpdatePosition(){
// Position position = positionService.getPositionById("1057108586410414080");
// position.setName("Junit update Name ");
// positionService.updatePosition(position);
// System.out.println(JSON.toJSONString(position));
// }
//
// /**
// * 根据Key 删除数据
// */
// @Test
// @Transactional
// public void testDeletePositionById(){
// positionService.deletePositionById("1057108585240203264");
// }
//
// /**
// * 根据id批量删除岗位
// * @return
// */
// @Test
// @Transactional
// public void deletePositionByIds(){
// positionService.deletePositionByIds(new String[]{"1057108585445724160","1057108585760296960"});
// }
//
//
//}

@ -1,102 +0,0 @@
package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
import cn.estsh.i3plus.core.api.iservice.busi.ISysConfigService;
import cn.estsh.i3plus.pojo.base.bean.ListPager;
import cn.estsh.i3plus.pojo.base.common.Pager;
import cn.estsh.i3plus.pojo.platform.bean.SysConfig;
import com.alibaba.fastjson.JSON;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.annotation.Rollback;
import javax.transaction.Transactional;
import java.util.List;
/**
* @Description :
* @Reference :
* @Author : yunhao
* @Date : 2018-10-30 10:49
* @Modify :
**/
public class TestSysConfigService extends TestBase {
@Autowired
private ISysConfigService sysConfigService;
/**
*
*/
@Test
@Transactional
public void testListSysConfig() {
List list = sysConfigService.ListSysConfig();
System.out.println(JSON.toJSONString(list));
}
/**
* id
*/
@Test
@Transactional
public void testGetSysConfigById() {
SysConfig sysConfig = sysConfigService.getSysConfigById(1057110061127700480L);
System.out.println(JSON.toJSONString(sysConfig));
}
/**
*
*/
@Test
@Transactional
@Rollback(false)
public void testInsertSysConfig() {
SysConfig sysConfig = new SysConfig();
sysConfig.setName("系统名称");
sysConfig.setConfigCode("sys_name");
sysConfig.setConfigType(1);
sysConfig.setConfigValue("IMPP");
sysConfig.setConfigDescription("系统名称");
sysConfigService.insertSysConfig(sysConfig);
System.out.println(JSON.toJSONString(sysConfig));
}
/**
*
*/
@Test
@Transactional
public void testUpdateSysConfig(){
SysConfig sysConfig = sysConfigService.getSysConfigById(1057110613261684736L);
sysConfig.setConfigDescription("测试修改");
sysConfigService.updateSysConfig(sysConfig);
}
/**
* id
*/
@Test
@Transactional
public void testDeleteSysConfigById(){
sysConfigService.deleteSysConfigById(1057111616417566720L);
}
/**
*
*/
@Test
@Transactional
public void testQuerySysConfigByPager(){
SysConfig sysConfig = new SysConfig();
Pager pager = new Pager();
pager.setPageSize(10);
pager.setCurrentPage(1);
ListPager list = sysConfigService.querySysConfigByPager(sysConfig,pager);
System.out.println(list);
}
}

@ -1,99 +0,0 @@
//package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
//
//import cn.estsh.i3plus.core.api.iservice.busi.ISysDictionaryService;
//import cn.estsh.i3plus.pojo.base.bean.ListPager;
//import cn.estsh.i3plus.pojo.base.common.Pager;
//import cn.estsh.i3plus.pojo.platform.bean.SysDictionary;
//import com.alibaba.fastjson.JSON;
//import org.junit.Test;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.test.annotation.Rollback;
//
//import javax.transaction.Transactional;
//import java.util.List;
//
///**
// * @Description : 测试字典服务接口
// * @Reference :
// * @Author : yunhao
// * @Date : 2018-10-30 18:52
// * @Modify :
// **/
//public class TestSysDictionaryService extends TestBase {
// @Autowired
// private ISysDictionaryService sysDictionaryService;
//
// /**
// * 测试 查询所有字典
// */
// @Test
// @Transactional
// public void testListSysDictionary() {
// List list = sysDictionaryService.listSysDictionary();
// System.out.println(JSON.toJSONString(list));
// }
//
// /**
// * 测试 根据id查询字典
// */
// @Test
// @Transactional
// public void testGetSysDictionaryById() {
// SysDictionary sysDictionary = sysDictionaryService.getSysDictionaryById("1057110061127700480");
// System.out.println(JSON.toJSONString(sysDictionary));
// }
//
// /**
// * 测试 添加字典
// */
// @Test
// @Transactional
// @Rollback(false)
// public void testInsertSysDictionary() {
// SysDictionary sysDictionary = new SysDictionary();
// sysDictionary.setName("字典测试");
// sysDictionary.setDictionaryCode("dic_test");
// sysDictionary.setDictionaryValue("DEV");
// sysDictionary.setDictionaryDescription("字典测试");
//
// sysDictionaryService.insertSysDictionary(sysDictionary);
// System.out.println(JSON.toJSONString(sysDictionary));
// }
//
// /**
// * 测试 修改字典
// */
// @Test
// @Transactional
// public void testUpdateSysDictionary(){
// SysDictionary sysDictionary = sysDictionaryService.getSysDictionaryById("1057110613261684736");
// sysDictionary.setName("测试修改");
//
// sysDictionaryService.updateSysDictionary(sysDictionary);
// }
//
// /**
// * 测试 根据id删除字典
// */
// @Test
// @Transactional
// public void testDeleteSysDictionaryById(){
// sysDictionaryService.deleteSysDictionaryById("1057111616417566720");
// }
//
// /**
// * 测试 复杂查询
// */
// @Test
// @Transactional
// public void testQuerySysDictionaryByPager(){
// SysDictionary sysDictionary = new SysDictionary();
//
// Pager pager = new Pager();
// pager.setPageSize(10);
// pager.setCurrentPage(5);
//
// ListPager list = sysDictionaryService.querySysDictionaryByPager(sysDictionary,pager);
// System.out.println(list);
// }
//}

@ -1,107 +0,0 @@
//package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
//
//import cn.estsh.i3plus.core.api.iservice.busi.ISysFileService;
//import cn.estsh.i3plus.pojo.base.bean.ListPager;
//import cn.estsh.i3plus.pojo.base.common.Pager;
//import cn.estsh.i3plus.pojo.platform.bean.SysFile;
//import com.alibaba.fastjson.JSON;
//import org.junit.Test;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.test.annotation.Rollback;
//
//import javax.transaction.Transactional;
//import java.util.List;
//
///**
// * @Description : 测试 文件资源服务接口
// * @Reference :
// * @Author : yunhao
// * @Date : 2018-10-31 15:30
// * @Modify :
// **/
//public class TestSysFileService extends TestBase {
//
// @Autowired
// public ISysFileService sysFileService;
//
// /**
// * 测试 查询所有文件资源
// */
// @Test
// @Transactional
// public void testListSysFile() {
// List list = sysFileService.listSysFile();
// System.out.println(JSON.toJSONString(list));
// }
//
// /**
// * 测试 根据id查询文件资源
// */
// @Test
// @Transactional
// public void testGetSysFileById() {
// SysFile sysFile = sysFileService.getSysFileById(1057110061127700480L);
// System.out.println(JSON.toJSONString(sysFile));
// }
//
// /**
// * 测试 添加文件资源
// */
// @Test
// @Transactional
// @Rollback(false)
// public void testInsertSysFile() {
// SysFile sysFile = new SysFile();
// sysFile.setName("文件doc");
// sysFile.setFileTypeId(1058251784058966016L);
// sysFile.setFileTypeName("doc");
// sysFile.setDownloads(999);
// sysFile.setFileSize(1024);
// sysFile.setCreateUser("中国移动");
// sysFile.setCreateDatetime("2018-01-01 00:00:00");
// for (int i = 0; i < 50; i++) {
// sysFile.setId(null);
// sysFile.setName("文件"+ i +".doc");
// sysFile.setCreateDatetime("2018-01-01 " + (i % 10) + "0:00:00");
// sysFileService.insertSysFile(sysFile);
// }
// System.out.println(JSON.toJSONString(sysFile));
// }
//
// /**
// * 测试 修改文件资源
// */
// @Test
// @Transactional
// public void testUpdateSysFile(){
// SysFile sysFile = sysFileService.getSysFileById(1057110613261684736L);
// sysFile.setName("测试修改");
//
// sysFileService.updateSysFile(sysFile);
// }
//
// /**
// * 测试 根据id删除文件资源
// */
// @Test
// @Transactional
// public void testDeleteSysFileById(){
// sysFileService.deleteSysFileById("1057111616417566720");
// }
//
// /**
// * 测试 复杂查询
// */
// @Test
// @Transactional
// public void testQuerySysFileByPager(){
// SysFile sysFile = new SysFile();
//
// Pager pager = new Pager();
// pager.setPageSize(10);
// pager.setCurrentPage(5);
//
// ListPager list = sysFileService.querySysFileByPager(sysFile,pager);
// System.out.println(list);
// }
//}

@ -1,104 +0,0 @@
//package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
//
//import cn.estsh.i3plus.core.api.iservice.busi.ISysMenuService;
//import cn.estsh.i3plus.pojo.platform.bean.Organize;
//import cn.estsh.i3plus.pojo.platform.bean.SysMenu;
//import com.alibaba.fastjson.JSON;
//import org.junit.Test;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.test.annotation.Rollback;
//
//import javax.transaction.Transactional;
//import java.util.List;
//
///**
// * @Description :
// * @Reference :
// * @Author : wei.peng
// * @Date : 2018-11-01 11:58
// * @Modify :
// **/
//public class TestSysMenuService extends TestBase {
//
// @Autowired
// private ISysMenuService sysMenuService;
//
//
//
//
// /**
// * 修改数据
// */
// @Test
// public void testUpdateSysMenu() {
//
// }
//
// /**
// * 修改权限状态
// */
// @Test
// public void testUpdateSysMenuStatus() {
//
// }
//
// /**
// * 批量修改状态
// */
// @Test
// public void testUpdateSysMenuStatusByIds() {
//
// }
//
// /**
// * 根据Key 删除数据
// */
// @Test
// public void testDeleteSysMenuById() {
//
// }
//
// /**
// * 新增数据
// */
// @Test
// @Transactional
// @Rollback(false)
// public void testInsertSysMenu() {
// for(int i = 0 ; i < 50 ; i++ ){
// SysMenu obj = new SysMenu();
// obj.setName("Junit Test " + i);
// obj.setMenuCode("DEV_JUNIT " + i);
// obj.setParentId(-1L);
// obj = sysMenuService.insertSysMenu(obj);
// System.out.println(JSON.toJSONString(obj));
// }
// }
//
// /**
// * 查询所有数据
// */
// @Test
// public void testFindSysMenuAll() {
// List<SysMenu> list = sysMenuService.findSysMenuAll();
// System.out.println(JSON.toJSONString(list));
// }
//
// /**
// * 根据id 数据
// */
// @Test
// public void testGetSysMenuById() {
// SysMenu menu = sysMenuService.getSysMenuById("1057844135052054528");
// System.out.println(JSON.toJSONString(menu));
// }
//
// /**
// * 复杂查询
// */
// @Test
// public void testQuerySysMenu() {
//
// }
//
//}

@ -1,104 +0,0 @@
//package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
//
//import cn.estsh.i3plus.core.api.iservice.busi.ITaskTimeExpressionService;
//import cn.estsh.i3plus.pojo.base.bean.ListPager;
//import cn.estsh.i3plus.pojo.base.common.Pager;
//import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
//import cn.estsh.i3plus.pojo.platform.bean.TaskTimeExpression;
//import com.alibaba.fastjson.JSON;
//import org.junit.Test;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.test.annotation.Rollback;
//
//import javax.transaction.Transactional;
//import java.util.List;
//
///**
// * @Description : 测试 时间表达式
// * @Reference :
// * @Author : yunhao
// * @Date : 2018-10-31 15:30
// * @Modify :
// **/
//public class TestTaskTimeExpressionService extends TestBase {
//
// @Autowired
// ITaskTimeExpressionService taskTimeExpressionService;
//
// /**
// * 测试 查询所有时间表达式
// */
// @Test
// @Transactional
// public void testListTaskTimeExpression() {
// List list = taskTimeExpressionService.listTaskTimeExpression();
// System.out.println(JSON.toJSONString(list));
// }
//
// /**
// * 测试 根据id查询时间表达式
// */
// @Test
// @Transactional
// public void testGetTaskTimeExpressionById() {
// TaskTimeExpression taskTimeExpression = taskTimeExpressionService.getTaskTimeExpressionById("1057110061127700480");
// System.out.println(JSON.toJSONString(taskTimeExpression));
// }
//
// /**
// * 测试 添加时间表达式
// */
// @Test
// @Transactional
// @Rollback(false)
// public void testInsertTaskTimeExpression() {
// TaskTimeExpression taskTimeExpression = new TaskTimeExpression();
// taskTimeExpression.setName("表达式");
// taskTimeExpression.setExpressionContent("0000000");
// taskTimeExpression.setExpressionDescription("描述");
//
// for (int i = 0; i < 50; i++) {
// taskTimeExpression.setId(null);
// taskTimeExpression.setName("表达式"+i);
// taskTimeExpressionService.insertTaskTimeExpression(taskTimeExpression);
// }
// System.out.println(JSON.toJSONString(taskTimeExpression));
// }
//
// /**
// * 测试 修改时间表达式
// */
// @Test
// @Transactional
// public void testUpdateTaskTimeExpression(){
// TaskTimeExpression taskTimeExpression = taskTimeExpressionService.getTaskTimeExpressionById("1057110613261684736");
// taskTimeExpression.setName("测试修改");
//
// taskTimeExpressionService.updateTaskTimeExpression(taskTimeExpression);
// }
//
// /**
// * 测试 根据id删除时间表达式
// */
// @Test
// @Transactional
// public void testDeleteTaskTimeExpressionById(){
// taskTimeExpressionService.deleteTaskTimeExpressionById("1057111616417566720");
// }
//
// /**
// * 测试 复杂查询
// */
// @Test
// @Transactional
// public void testQueryTaskTimeExpressionByPager(){
// TaskTimeExpression taskTimeExpression = new TaskTimeExpression();
//
// Pager pager = new Pager();
// pager.setPageSize(10);
// pager.setCurrentPage(5);
//
// ListPager list = taskTimeExpressionService.queryTaskTimeExpressionByPager(taskTimeExpression,pager);
// System.out.println(list);
// }
//}

@ -1,109 +0,0 @@
//package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
//
//import cn.estsh.i3plus.core.api.iservice.busi.ITaskTimeService;
//import cn.estsh.i3plus.core.api.iservice.busi.ITaskTimeService;
//import cn.estsh.i3plus.pojo.base.bean.ListPager;
//import cn.estsh.i3plus.pojo.base.common.Pager;
//import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
//import cn.estsh.i3plus.pojo.base.enumutil.ImppEnumUtil;
//import cn.estsh.i3plus.pojo.platform.bean.TaskTime;
//import com.alibaba.fastjson.JSON;
//import org.junit.Test;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.test.annotation.Rollback;
//
//import javax.transaction.Transactional;
//import java.util.List;
//
///**
// * @Description :
// * @Reference :
// * @Author : yunhao
// * @Date : 2018-11-03 00:09
// * @Modify :
// **/
//public class TestTaskTimeService extends TestBase {
//
// @Autowired
// ITaskTimeService taskTimeService;
//
// /**
// * 测试 查询所有硬件
// */
// @Test
// @Transactional
// public void testListTaskTime() {
// List list = taskTimeService.listTaskTime();
// System.out.println(JSON.toJSONString(list));
// }
//
// /**
// * 测试 根据id查询硬件
// */
// @Test
// @Transactional
// public void testGetTaskTimeById() {
// TaskTime taskTime = taskTimeService.getTaskTimeById("1057110061127700480");
// System.out.println(JSON.toJSONString(taskTime));
// }
//
// /**
// * 测试 添加硬件
// */
// @Test
// @Transactional
// @Rollback(false)
// public void testInsertTaskTime() {
// TaskTime taskTime = new TaskTime();
// taskTime.setName("时间表达式");
// taskTime.setTimeExpressionId(1L);
// taskTime.setTaskStartDateTimeRdd("2018-01-01 00:00:00");
// taskTime.setTaskEndDateTimeRdd("2018-12-31 00:00:00");
// taskTime.setTaskTypeId(ImppEnumUtil.TASK_METHOD_TYPE.TYPE_GROUP.getValue());
// taskTime.setTaskStatus(CommonEnumUtil.DATA_STATUS.ENABLE.getValue());
//
// for (int i = 0; i < 50; i++) {
// taskTime.setId(null);
// taskTime.setName("时间表达式"+i);
// taskTimeService.insertTaskTime(taskTime,null);
// }
// System.out.println(JSON.toJSONString(taskTime));
// }
//
// /**
// * 测试 修改硬件
// */
// @Test
// @Transactional
// public void testUpdateTaskTime(){
// TaskTime taskTime = taskTimeService.getTaskTimeById("1057110613261684736");
// taskTime.setName("测试修改");
//
// taskTimeService.updateTaskTime(taskTime,null);
// }
//
// /**
// * 测试 根据id删除硬件
// */
// @Test
// @Transactional
// public void testDeleteTaskTimeById(){
// taskTimeService.deleteTaskTimeById("1058406771644829696");
// }
//
// /**
// * 测试 复杂查询
// */
// @Test
// @Transactional
// public void testQueryTaskTimeByPager(){
// TaskTime taskTime = new TaskTime();
//
// Pager pager = new Pager();
// pager.setPageSize(10);
// pager.setCurrentPage(5);
//
// ListPager list = taskTimeService.queryTaskTimeByPager(taskTime,pager);
// System.out.println(list);
// }
//}

@ -1,109 +0,0 @@
//package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
//
//import cn.estsh.i3plus.core.api.iservice.busi.IToolService;
//import cn.estsh.i3plus.pojo.base.bean.ListPager;
//import cn.estsh.i3plus.pojo.base.common.Pager;
//import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
//import cn.estsh.i3plus.pojo.base.enumutil.ImppEnumUtil;
//import cn.estsh.i3plus.pojo.platform.bean.Tool;
//import com.alibaba.fastjson.JSON;
//import org.apache.commons.lang3.EnumUtils;
//import org.junit.Test;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.test.annotation.Rollback;
//
//import javax.transaction.Transactional;
//import java.util.List;
//
///**
// * @Description : 测试 硬件服务接口
// * @Reference :
// * @Author : yunhao
// * @Date : 2018-10-31 15:30
// * @Modify :
// **/
//public class TestToolService extends TestBase {
//
// @Autowired
// IToolService toolService;
//
// /**
// * 测试 查询所有硬件
// */
// @Test
// @Transactional
// public void testListTool() {
// List list = toolService.listTool();
// System.out.println(JSON.toJSONString(list));
// }
//
// /**
// * 测试 根据id查询硬件
// */
// @Test
// @Transactional
// public void testGetToolById() {
// Tool tool = toolService.getToolById("1057110061127700480");
// System.out.println(JSON.toJSONString(tool));
// }
//
// /**
// * 测试 添加硬件
// */
// @Test
// @Transactional
// @Rollback(false)
// public void testInsertTool() {
// Tool tool = new Tool();
// tool.setName("扫描枪");
// tool.setToolTypeId(1057261374348070912L);
// tool.setRedToolTypeName("扫描枪22");
// tool.setToolConnTypeId(1);
// tool.setToolDataTypeId(1);
// tool.setToolStatusId(CommonEnumUtil.DATA_STATUS.ENABLE.getValue());
//
// for (int i = 0; i < 50; i++) {
// tool.setId(null);
// tool.setName("扫描枪"+i);
// toolService.insertTool(tool);
// }
// System.out.println(JSON.toJSONString(tool));
// }
//
// /**
// * 测试 修改硬件
// */
// @Test
// @Transactional
// public void testUpdateTool(){
// Tool tool = toolService.getToolById("1057110613261684736");
// tool.setName("测试修改");
//
// toolService.updateTool(tool);
// }
//
// /**
// * 测试 根据id删除硬件
// */
// @Test
// @Transactional
// public void testDeleteToolById(){
// toolService.deleteToolById("1057111616417566720");
// }
//
// /**
// * 测试 复杂查询
// */
// @Test
// @Transactional
// public void testQueryToolByPager(){
// Tool tool = new Tool();
//
// Pager pager = new Pager();
// pager.setPageSize(10);
// pager.setCurrentPage(5);
//
// ListPager list = toolService.queryToolByPager(tool,pager);
// System.out.println(list);
// }
//}

@ -1,101 +0,0 @@
//package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
//
//import cn.estsh.i3plus.core.api.iservice.busi.IToolTypeService;
//import cn.estsh.i3plus.core.api.iservice.busi.IToolTypeService;
//import cn.estsh.i3plus.pojo.base.bean.ListPager;
//import cn.estsh.i3plus.pojo.base.common.Pager;
//import cn.estsh.i3plus.pojo.platform.bean.ToolType;
//import com.alibaba.fastjson.JSON;
//import org.junit.Test;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.test.annotation.Rollback;
//
//import javax.transaction.Transactional;
//import java.util.List;
//
///**
// * @Description : 测试 硬件类型服务接口
// * @Reference :
// * @Author : yunhao
// * @Date : 2018-10-30 20:36
// * @Modify :
// **/
//public class TestToolTypeService extends TestBase {
// @Autowired
// private IToolTypeService toolTypeService;
//
// /**
// * 测试 查询所有硬件类型
// */
// @Test
// @Transactional
// public void testListToolType() {
// List list = toolTypeService.listToolType();
// System.out.println(JSON.toJSONString(list));
// }
//
// /**
// * 测试 根据id查询硬件类型
// */
// @Test
// @Transactional
// public void testGetToolTypeById() {
// ToolType toolType = toolTypeService.getToolTypeById("1057110061127700480");
// System.out.println(JSON.toJSONString(toolType));
// }
//
// /**
// * 测试 添加硬件类型
// */
// @Test
// @Transactional
// @Rollback(false)
// public void testInsertToolType() {
// ToolType toolType = new ToolType();
// toolType.setName("扫描枪");
//
// for (int i = 0; i < 50; i++) {
// toolType.setId(null);
// toolType.setName("扫描枪"+i);
// toolTypeService.insertToolType(toolType);
// }
// System.out.println(JSON.toJSONString(toolType));
// }
//
// /**
// * 测试 修改硬件类型
// */
// @Test
// @Transactional
// public void testUpdateToolType(){
// ToolType toolType = toolTypeService.getToolTypeById("1057110613261684736");
// toolType.setName("测试修改");
//
// toolTypeService.updateToolType(toolType);
// }
//
// /**
// * 测试 根据id删除硬件类型
// */
// @Test
// @Transactional
// public void testDeleteToolTypeById(){
// toolTypeService.deleteToolTypeById("1057111616417566720");
// }
//
// /**
// * 测试 复杂查询
// */
// @Test
// @Transactional
// public void testQueryToolTypeByPager(){
// ToolType toolType = new ToolType();
//
// Pager pager = new Pager();
// pager.setPageSize(10);
// pager.setCurrentPage(5);
//
// ListPager list = toolTypeService.queryToolTypeByPager(toolType,pager);
// System.out.println(list);
// }
//}

@ -1,41 +0,0 @@
package cn.estsh.i3plus.core.apiservice.util;
import cn.estsh.i3plus.core.apiservice.serviceimpl.busi.TestBase;
import cn.estsh.i3plus.pojo.base.enumutil.ImppEnumUtil;
import cn.estsh.i3plus.pojo.platform.bean.SysTool;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.List;
/**
* @Description : excel
* @Reference :
* @Author : yunhao
* @CreateDate : 2018-11-21 19:44
* @Modify:
**/
public class TestExcelUtil extends TestBase {
@Test
public void TestExportData(){
}
@Test
public void importData(){
try {
List sy = ExcelUtil.importData("testOut.xls", new FileInputStream("E://testOut.xls"), SysTool.class);
System.out.println(sy);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
}

@ -1,29 +0,0 @@
package cn.estsh.i3plus.core.apiservice.util;
import cn.estsh.i3plus.core.apiservice.serviceimpl.busi.TestBase;
import cn.estsh.i3plus.pojo.base.enumutil.ImppEnumUtil;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
/**
* @Description :
* @Reference :
* @Author : yunhao
* @CreateDate : 2018-11-21 19:44
* @Modify:
**/
public class TestMailUtil extends TestBase {
@Autowired
MailUtil mailUtil;
@Test
public void TestSendMail(){
mailUtil.setTo("yunhao.wang@estsh.com");
mailUtil.setSubject("中文");
mailUtil.setContentType(ImppEnumUtil.MESSAGE_TYPE_CONTENT.HTML.getDescription());
mailUtil.setBody("内容");
mailUtil.send();
}
}

@ -1,33 +0,0 @@
package cn.estsh.i3plus.core.apiservice.util;
import cn.estsh.i3plus.core.apiservice.serviceimpl.busi.TestBase;
import cn.estsh.i3plus.pojo.platform.bean.SysOrderNoRule;
import org.junit.Test;
/**
* @Description :
* @Reference :
* @Author : yunhao
* @CreateDate : 2018-11-21 19:45
* @Modify:
**/
public class TestOrderNoMakeUtil extends TestBase {
@Test
public void TestMakeOrderNo() {
SysOrderNoRule sysOrderNoRule = new SysOrderNoRule();
sysOrderNoRule.setName("一号单据");
sysOrderNoRule.setOrderNoRule("GG-{yyyy}{MM}{dd}{serialNo}");
sysOrderNoRule.setSerialNoSeed(1L);
sysOrderNoRule.setSerialNoIncrement(1L);
sysOrderNoRule.setSerialNoLength(4L);
sysOrderNoRule.setSerialNo(9999L);
sysOrderNoRule.setIsCycle(1);
System.out.println(OrderNoMakeUtil.next(sysOrderNoRule));
// String d= MessageFormat.format("%0{0}d", 3);
// System.out.println(d);
}
}
Loading…
Cancel
Save