初始化
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package com.adc.da.dto;
|
||||
|
||||
import com.adc.da.excel.annotation.Excel;
|
||||
|
||||
/**
|
||||
* @Author sima
|
||||
* @Date 2020/12/21 19:30
|
||||
*/
|
||||
public class SelectCommercialSaleDTO {
|
||||
@Excel(name = "品牌", orderNum = "1")
|
||||
private String brand;
|
||||
@Excel(name = "车辆类别", orderNum = "2")
|
||||
private String vehicleCategory;
|
||||
|
||||
public String getBrand() {
|
||||
return brand;
|
||||
}
|
||||
|
||||
public void setBrand(String brand) {
|
||||
this.brand = brand;
|
||||
}
|
||||
|
||||
public String getVehicleCategory() {
|
||||
return vehicleCategory;
|
||||
}
|
||||
|
||||
public void setVehicleCategory(String vehicleCategory) {
|
||||
this.vehicleCategory = vehicleCategory;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.adc.da.dto;
|
||||
|
||||
import com.adc.da.excel.annotation.Excel;
|
||||
|
||||
/**
|
||||
* @Author sima
|
||||
* @Date 2020/12/21 19:26
|
||||
*/
|
||||
public class SelectCommercialYieldDTO {
|
||||
@Excel(name = "企业名称", orderNum = "1")
|
||||
private String enterpriseName;
|
||||
@Excel(name = "车辆类别", orderNum = "2")
|
||||
private String vehicleCategory;
|
||||
|
||||
|
||||
public String getEnterpriseName() {
|
||||
return enterpriseName;
|
||||
}
|
||||
|
||||
public void setEnterpriseName(String enterpriseName) {
|
||||
this.enterpriseName = enterpriseName;
|
||||
}
|
||||
|
||||
public String getVehicleCategory() {
|
||||
return vehicleCategory;
|
||||
}
|
||||
|
||||
public void setVehicleCategory(String vehicleCategory) {
|
||||
this.vehicleCategory = vehicleCategory;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.adc.da.dto;
|
||||
|
||||
import com.adc.da.excel.annotation.Excel;
|
||||
|
||||
/**
|
||||
* @Author sima
|
||||
* @Date 2020/12/21 19:33
|
||||
*/
|
||||
public class SelectNewEnergySaleDTO {
|
||||
@Excel(name = "车型大类", orderNum = "1")
|
||||
private String vehicleType;
|
||||
@Excel(name = "品牌", orderNum = "2")
|
||||
private String brand;
|
||||
@Excel(name = "车型", orderNum = "3")
|
||||
private String vehicleModel;
|
||||
@Excel(name = "新能源类型", orderNum = "4")
|
||||
private String newEnergyType;
|
||||
|
||||
public String getVehicleType() {
|
||||
return vehicleType;
|
||||
}
|
||||
|
||||
public void setVehicleType(String vehicleType) {
|
||||
this.vehicleType = vehicleType;
|
||||
}
|
||||
|
||||
public String getBrand() {
|
||||
return brand;
|
||||
}
|
||||
|
||||
public void setBrand(String brand) {
|
||||
this.brand = brand;
|
||||
}
|
||||
|
||||
public String getVehicleModel() {
|
||||
return vehicleModel;
|
||||
}
|
||||
|
||||
public void setVehicleModel(String vehicleModel) {
|
||||
this.vehicleModel = vehicleModel;
|
||||
}
|
||||
|
||||
public String getNewEnergyType() {
|
||||
return newEnergyType;
|
||||
}
|
||||
|
||||
public void setNewEnergyType(String newEnergyType) {
|
||||
this.newEnergyType = newEnergyType;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.adc.da.dto;
|
||||
|
||||
import com.adc.da.excel.annotation.Excel;
|
||||
|
||||
/**
|
||||
* @Author sima
|
||||
* @Date 2020/12/21 19:30
|
||||
*/
|
||||
public class SelectPassengerSaleDTO {
|
||||
@Excel(name = "品牌", orderNum = "1")
|
||||
private String brand;
|
||||
@Excel(name = "车型", orderNum = "2")
|
||||
private String vehicleModel;
|
||||
|
||||
public String getBrand() {
|
||||
return brand;
|
||||
}
|
||||
|
||||
public void setBrand(String brand) {
|
||||
this.brand = brand;
|
||||
}
|
||||
|
||||
public String getVehicleModel() {
|
||||
return vehicleModel;
|
||||
}
|
||||
|
||||
public void setVehicleModel(String vehicleModel) {
|
||||
this.vehicleModel = vehicleModel;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.adc.da.dto;
|
||||
|
||||
import com.adc.da.excel.annotation.Excel;
|
||||
|
||||
/**
|
||||
* @Author sima
|
||||
* @Date 2020/12/21 19:38
|
||||
*/
|
||||
public class SelectPolityDTO {
|
||||
|
||||
@Excel(name = "政策级别", orderNum = "1")
|
||||
private String polityLevel;
|
||||
@Excel(name = "政策分类", orderNum = "2")
|
||||
private String polityType;
|
||||
|
||||
public String getPolityLevel() {
|
||||
return polityLevel;
|
||||
}
|
||||
|
||||
public void setPolityLevel(String polityLevel) {
|
||||
this.polityLevel = polityLevel;
|
||||
}
|
||||
|
||||
public String getPolityType() {
|
||||
return polityType;
|
||||
}
|
||||
|
||||
public void setPolityType(String polityType) {
|
||||
this.polityType = polityType;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.adc.da.dto;
|
||||
|
||||
import com.adc.da.excel.annotation.Excel;
|
||||
|
||||
/**
|
||||
* @Author sima
|
||||
* @Date 2020/12/21 18:40
|
||||
*/
|
||||
public class SelectStockDTO {
|
||||
|
||||
@Excel(name = "车型大类", orderNum = "1")
|
||||
private String vehicleType;
|
||||
@Excel(name = "品牌", orderNum = "2")
|
||||
private String brand;
|
||||
@Excel(name = "车辆类别", orderNum = "3")
|
||||
private String vehicleCategory;
|
||||
|
||||
private String id;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getVehicleType() {
|
||||
return vehicleType;
|
||||
}
|
||||
|
||||
public void setVehicleType(String vehicleType) {
|
||||
this.vehicleType = vehicleType;
|
||||
}
|
||||
|
||||
public String getBrand() {
|
||||
return brand;
|
||||
}
|
||||
|
||||
public void setBrand(String brand) {
|
||||
this.brand = brand;
|
||||
}
|
||||
|
||||
public String getVehicleCategory() {
|
||||
return vehicleCategory;
|
||||
}
|
||||
|
||||
public void setVehicleCategory(String vehicleCategory) {
|
||||
this.vehicleCategory = vehicleCategory;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.adc.da.dto;
|
||||
|
||||
import com.adc.da.excel.annotation.Excel;
|
||||
|
||||
/**
|
||||
* @Author sima
|
||||
* @Date 2020/12/21 19:26
|
||||
*/
|
||||
public class SelectYieldDTO {
|
||||
@Excel(name = "企业名称", orderNum = "1")
|
||||
private String enterpriseName;
|
||||
@Excel(name = "车辆类别", orderNum = "2")
|
||||
private String vehicleCategory;
|
||||
|
||||
public String getEnterpriseName() {
|
||||
return enterpriseName;
|
||||
}
|
||||
|
||||
public void setEnterpriseName(String enterpriseName) {
|
||||
this.enterpriseName = enterpriseName;
|
||||
}
|
||||
|
||||
public String getVehicleCategory() {
|
||||
return vehicleCategory;
|
||||
}
|
||||
|
||||
public void setVehicleCategory(String vehicleCategory) {
|
||||
this.vehicleCategory = vehicleCategory;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.adc.da.dto;
|
||||
|
||||
import com.adc.da.excel.annotation.Excel;
|
||||
|
||||
/**
|
||||
* @Author sima
|
||||
* @Date 2021/1/5 14:25
|
||||
*/
|
||||
public class selectMacroscopicDTO {
|
||||
@Excel(name = "区域", orderNum = "1")
|
||||
private String area;
|
||||
@Excel(name = "分类", orderNum = "2")
|
||||
private String sort;
|
||||
@Excel(name = "指标", orderNum = "3")
|
||||
private String indes;
|
||||
|
||||
public String getArea() {
|
||||
return area;
|
||||
}
|
||||
|
||||
public void setArea(String area) {
|
||||
this.area = area;
|
||||
}
|
||||
|
||||
public String getSort() {
|
||||
return sort;
|
||||
}
|
||||
|
||||
public void setSort(String sort) {
|
||||
this.sort = sort;
|
||||
}
|
||||
|
||||
public String getIndes() {
|
||||
return indes;
|
||||
}
|
||||
|
||||
public void setIndes(String indes) {
|
||||
this.indes = indes;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.adc.da.log.annotation;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Target({ java.lang.annotation.ElementType.METHOD })
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface BusinessLog {
|
||||
public String description();
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.adc.da.log.constant;
|
||||
|
||||
public class LogConstants {
|
||||
private LogConstants() {
|
||||
throw new IllegalStateException("LogConstants class");
|
||||
}
|
||||
|
||||
/**
|
||||
* 开发模式不拦截方法记日志
|
||||
*/
|
||||
public static final String LOG_TYPE_DEV = "DEV";
|
||||
|
||||
/**
|
||||
* 客户自定义需要拦截记日志的方法
|
||||
*/
|
||||
public static final String LOG_TYPE_CUSTOM = "CUSTOM";
|
||||
|
||||
/**
|
||||
* 系统原设需要拦截记日志的方法
|
||||
*/
|
||||
public static final String LOG_TYPE_SYS = "SYS";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
package com.adc.da.log.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.adc.da.base.page.Pager;
|
||||
import com.adc.da.util.utils.BeanMapper;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.adc.da.base.web.BaseController;
|
||||
import com.adc.da.log.entity.LogEO;
|
||||
import com.adc.da.log.vo.LogVO;
|
||||
import com.adc.da.log.page.LogEOPage;
|
||||
import com.adc.da.log.service.LogEOService;
|
||||
import com.adc.da.util.http.PageInfo;
|
||||
import com.adc.da.util.http.ResponseMessage;
|
||||
import com.adc.da.util.http.Result;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
|
||||
/**
|
||||
* 日志管理模块
|
||||
* 1.日志分页查询 @author 李坤澔
|
||||
* 2.日志详情
|
||||
* date 2018-08-16
|
||||
*
|
||||
* @author comments created by Lee Kwanho
|
||||
* @see LogEOService
|
||||
* @see LogEO
|
||||
* @see LogVO
|
||||
* @see LogEOPage
|
||||
* @see mybatis.mapper.log
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/${restPath}/log/log")
|
||||
@Api(tags = "Sys-日志管理")
|
||||
public class LogEOController extends BaseController<LogEO> {
|
||||
|
||||
/**
|
||||
* 日志
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(LogEOController.class);
|
||||
|
||||
/**
|
||||
* 统一标识日志异常
|
||||
*/
|
||||
private static final String ERROR_INFO = "日志管理异常";
|
||||
|
||||
/**
|
||||
* @see LogEOService
|
||||
*/
|
||||
@Resource
|
||||
private LogEOService logEOService;
|
||||
|
||||
/**
|
||||
* dozer相关,EO间VO转换
|
||||
*
|
||||
* @see dozer
|
||||
*/
|
||||
@Resource
|
||||
private BeanMapper beanMapper;
|
||||
|
||||
/**
|
||||
* new paging query, using GetMapping.
|
||||
* total 5 variable: pageNo,pageSize,account,startTime,endTime
|
||||
* date 2018/03/26
|
||||
* 按照时间节点
|
||||
* 权限字段:sys:log:list
|
||||
*
|
||||
* @param pageNo 页码
|
||||
* @param pageSize 分页大小
|
||||
* @param account 账户
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @return 查询结果
|
||||
* @author Lee Kwanho 李坤澔
|
||||
*/
|
||||
@ApiOperation(value = "|LogEO|分页查询")
|
||||
@GetMapping("")
|
||||
// @RequiresPermissions("sys:log:list")
|
||||
public ResponseMessage<PageInfo<LogVO>> page(Integer page, Integer limit, String account,
|
||||
String startTime, String endTime) {
|
||||
|
||||
LogEOPage eoPage = new LogEOPage();
|
||||
//设置排序字段,对应是数据库中的字段非EO中的字段 倒叙排序
|
||||
eoPage.setOrderBy("start_time DESC");
|
||||
if (page != null) {
|
||||
eoPage.setPage(page);
|
||||
}
|
||||
if (limit != null) {
|
||||
eoPage.setPageSize(limit);
|
||||
}
|
||||
|
||||
/* 日志相关账户查询 */
|
||||
if (StringUtils.isNotEmpty(account)) {
|
||||
eoPage.setAccount(account);
|
||||
eoPage.setAccountOperator("LIKE");
|
||||
}
|
||||
|
||||
/* 设置查询起始时间 */
|
||||
if (StringUtils.isNotEmpty(startTime)) {
|
||||
eoPage.setStartTime1(startTime);
|
||||
}
|
||||
|
||||
/* 设置查询终止时间 */
|
||||
if (StringUtils.isNotEmpty(endTime)) {
|
||||
eoPage.setStartTime2(endTime);
|
||||
}
|
||||
eoPage.setPager(new Pager());
|
||||
|
||||
try {
|
||||
List<LogEO> rows = logEOService.queryByPage(eoPage);
|
||||
return Result.success(beanMapper.mapPage(getPageInfo(eoPage.getPager(), rows), LogVO.class));
|
||||
} catch (Exception e) {
|
||||
logger.error(ERROR_INFO, e);
|
||||
return Result.error(ERROR_INFO + e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 日志详情
|
||||
* 权限字段:sys:log:get
|
||||
*
|
||||
* @param id 日志id
|
||||
* @return 日志详情
|
||||
*/
|
||||
@ApiOperation(value = "|LogEO|详情")
|
||||
@GetMapping("/{id}")
|
||||
// @RequiresPermissions("sys:log:get")
|
||||
public ResponseMessage<LogVO> find(@PathVariable String id) {
|
||||
try {
|
||||
LogVO logVO = beanMapper.map(logEOService.selectByPrimaryKey(id), LogVO.class);
|
||||
return Result.success(logVO);
|
||||
} catch (Exception e) {
|
||||
logger.error(ERROR_INFO, e);
|
||||
return Result.error(ERROR_INFO + e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.adc.da.log.dao.mysql;
|
||||
|
||||
import com.adc.da.base.dao.BaseDao;
|
||||
import com.adc.da.log.entity.LogEO;
|
||||
import com.adc.da.log.entity.MiLogEO;
|
||||
import com.adc.da.sys.entity.UserEO;
|
||||
|
||||
/**
|
||||
* <br>
|
||||
* <b>功能:</b>TS_LOG LogEODao<br>
|
||||
* <b>作者:</b>code generator<br>
|
||||
* <b>日期:</b> 2017-12-24 <br>
|
||||
* <b>版权所有:<b>版权归天津卡达克数据技术中心所有。<br>
|
||||
* sql实现在xml中路径如下
|
||||
*
|
||||
* @see mybatis.mapper.log
|
||||
*/
|
||||
public interface LogEODao extends BaseDao<LogEO> {
|
||||
|
||||
void save(MiLogEO user);
|
||||
}
|
||||
@@ -0,0 +1,204 @@
|
||||
package com.adc.da.log.entity;
|
||||
|
||||
import com.adc.da.base.entity.BaseEntity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <b>功能:</b>TS_LOG LogEOEntity<br>
|
||||
* <b>版权所有:<b>版权归天津卡达克数据技术中心所有。<br>
|
||||
* <p>
|
||||
* <p>字段列表:</p>
|
||||
* <li>ipAddress -> ip_address</li>
|
||||
* <li>browser -> browser</li>
|
||||
* <li>startTime -> start_time</li>
|
||||
* <li>endTime -> end_time</li>
|
||||
* <li>usid -> usid</li>
|
||||
* <li>operateTime -> operate_time</li>
|
||||
* <li>method -> method</li>
|
||||
* <li>description -> description</li>
|
||||
* <li>className -> class_name</li>
|
||||
* <li>account -> account</li>
|
||||
* <li>id -> id</li>
|
||||
* date 2018-08-15
|
||||
*
|
||||
* @author comments created by Lee Kwanho
|
||||
* @see com.adc.da.log.controller.LogEOController
|
||||
*/
|
||||
public class LogEO extends BaseEntity {
|
||||
|
||||
/**
|
||||
* ip地址
|
||||
*/
|
||||
private String ipAddress;
|
||||
|
||||
/**
|
||||
* 浏览器信息
|
||||
*/
|
||||
private String browser;
|
||||
|
||||
/**
|
||||
* 生成时间
|
||||
* 格式转换为 年-月-日 时:分:秒
|
||||
* 类型为Date 与 VO不同
|
||||
*/
|
||||
@org.springframework.format.annotation.DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date startTime;
|
||||
|
||||
/**
|
||||
* 日志结束时间(意义不明,数值与日志生成时间相同)
|
||||
* 格式转换为 年-月-日 时:分:秒
|
||||
* 类型为Date 与 VO不同
|
||||
*/
|
||||
@org.springframework.format.annotation.DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date endTime;
|
||||
|
||||
/**
|
||||
* 操作用户的ID
|
||||
*/
|
||||
private String usid;
|
||||
|
||||
/**
|
||||
* 默认为空,意义不明,操作时间
|
||||
* 格式转换为 年-月-日 时:分:秒
|
||||
* 类型为Date 与 VO不同
|
||||
*/
|
||||
@org.springframework.format.annotation.DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date operateTime;
|
||||
|
||||
/**
|
||||
* 日志涉及的操作方法
|
||||
*/
|
||||
private String method;
|
||||
|
||||
/**
|
||||
* 默认为空,描述字段
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 日志涉及的类名
|
||||
*/
|
||||
private String className;
|
||||
|
||||
/**
|
||||
* 操作用户的账号
|
||||
*/
|
||||
private String account;
|
||||
|
||||
/**
|
||||
* 日志ID
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/** **/
|
||||
public String getIpAddress() {
|
||||
return this.ipAddress;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setIpAddress(String ipAddress) {
|
||||
this.ipAddress = ipAddress;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getBrowser() {
|
||||
return this.browser;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setBrowser(String browser) {
|
||||
this.browser = browser;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public Date getStartTime() {
|
||||
return this.startTime;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setStartTime(Date startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public Date getEndTime() {
|
||||
return this.endTime;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setEndTime(Date endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getUsid() {
|
||||
return this.usid;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setUsid(String usid) {
|
||||
this.usid = usid;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public Date getOperateTime() {
|
||||
return this.operateTime;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setOperateTime(Date operateTime) {
|
||||
this.operateTime = operateTime;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getMethod() {
|
||||
return this.method;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setMethod(String method) {
|
||||
this.method = method;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getClassName() {
|
||||
return this.className;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setClassName(String className) {
|
||||
this.className = className;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getAccount() {
|
||||
return this.account;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setAccount(String account) {
|
||||
this.account = account;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.adc.da.log.entity;
|
||||
|
||||
import com.adc.da.base.entity.BaseEntity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class MiLogEO extends BaseEntity {
|
||||
private String id;
|
||||
private String account;
|
||||
private String userName;
|
||||
private String accessPage;
|
||||
private String department;
|
||||
private Date operateDate;
|
||||
|
||||
public MiLogEO() {
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getAccount() {
|
||||
return account;
|
||||
}
|
||||
|
||||
public void setAccount(String account) {
|
||||
this.account = account;
|
||||
}
|
||||
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getAccessPage() {
|
||||
return accessPage;
|
||||
}
|
||||
|
||||
public void setAccessPage(String accessPage) {
|
||||
this.accessPage = accessPage;
|
||||
}
|
||||
|
||||
public String getDepartment() {
|
||||
return department;
|
||||
}
|
||||
|
||||
public void setDepartment(String department) {
|
||||
this.department = department;
|
||||
}
|
||||
|
||||
public Date getOperateDate() {
|
||||
return operateDate;
|
||||
}
|
||||
|
||||
public void setOperateDate(Date operateDate) {
|
||||
this.operateDate = operateDate;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,297 @@
|
||||
package com.adc.da.log.page;
|
||||
|
||||
import com.adc.da.base.page.BasePage;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* <b>功能:</b>TS_LOG LogEOPage<br>
|
||||
* <b>作者:</b>code generator<br>
|
||||
* <b>日期:</b> 2017-12-24 <br>
|
||||
* <b>版权所有:<b>版权归天津卡达克数据技术中心所有。<br>
|
||||
*
|
||||
* @author comments created by Lee Kwanho
|
||||
*/
|
||||
public class LogEOPage extends BasePage {
|
||||
|
||||
private String ipAddress;
|
||||
|
||||
private String ipAddressOperator = "=";
|
||||
|
||||
private String browser;
|
||||
|
||||
private String browserOperator = "=";
|
||||
|
||||
private String startTime;
|
||||
|
||||
private String startTime1;
|
||||
|
||||
private String startTime2;
|
||||
|
||||
private String startTimeOperator = "=";
|
||||
|
||||
private String endTime;
|
||||
|
||||
private String endTime1;
|
||||
|
||||
private String endTime2;
|
||||
|
||||
private String endTimeOperator = "=";
|
||||
|
||||
private String usid;
|
||||
|
||||
private String usidOperator = "=";
|
||||
|
||||
private String operateTime;
|
||||
|
||||
private String operateTime1;
|
||||
|
||||
private String operateTime2;
|
||||
|
||||
private String operateTimeOperator = "=";
|
||||
|
||||
private String method;
|
||||
|
||||
private String methodOperator = "=";
|
||||
|
||||
private String description;
|
||||
|
||||
private String descriptionOperator = "=";
|
||||
|
||||
private String className;
|
||||
|
||||
private String classNameOperator = "=";
|
||||
|
||||
private String account;
|
||||
|
||||
private String accountOperator = "=";
|
||||
|
||||
private String id;
|
||||
|
||||
private String idOperator = "=";
|
||||
|
||||
public String getIpAddress() {
|
||||
return this.ipAddress;
|
||||
}
|
||||
|
||||
public void setIpAddress(String ipAddress) {
|
||||
this.ipAddress = ipAddress;
|
||||
}
|
||||
|
||||
public String getIpAddressOperator() {
|
||||
return this.ipAddressOperator;
|
||||
}
|
||||
|
||||
public void setIpAddressOperator(String ipAddressOperator) {
|
||||
this.ipAddressOperator = ipAddressOperator;
|
||||
}
|
||||
|
||||
public String getBrowser() {
|
||||
return this.browser;
|
||||
}
|
||||
|
||||
public void setBrowser(String browser) {
|
||||
this.browser = browser;
|
||||
}
|
||||
|
||||
public String getBrowserOperator() {
|
||||
return this.browserOperator;
|
||||
}
|
||||
|
||||
public void setBrowserOperator(String browserOperator) {
|
||||
this.browserOperator = browserOperator;
|
||||
}
|
||||
|
||||
public String getStartTime() {
|
||||
return this.startTime;
|
||||
}
|
||||
|
||||
public void setStartTime(String startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
public String getStartTime1() {
|
||||
return this.startTime1;
|
||||
}
|
||||
|
||||
public void setStartTime1(String startTime1) {
|
||||
this.startTime1 = startTime1;
|
||||
}
|
||||
|
||||
public String getStartTime2() {
|
||||
return this.startTime2;
|
||||
}
|
||||
|
||||
public void setStartTime2(String startTime2) {
|
||||
this.startTime2 = startTime2;
|
||||
}
|
||||
|
||||
public String getStartTimeOperator() {
|
||||
return this.startTimeOperator;
|
||||
}
|
||||
|
||||
public void setStartTimeOperator(String startTimeOperator) {
|
||||
this.startTimeOperator = startTimeOperator;
|
||||
}
|
||||
|
||||
public String getEndTime() {
|
||||
return this.endTime;
|
||||
}
|
||||
|
||||
public void setEndTime(String endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public String getEndTime1() {
|
||||
return this.endTime1;
|
||||
}
|
||||
|
||||
public void setEndTime1(String endTime1) {
|
||||
this.endTime1 = endTime1;
|
||||
}
|
||||
|
||||
public String getEndTime2() {
|
||||
return this.endTime2;
|
||||
}
|
||||
|
||||
public void setEndTime2(String endTime2) {
|
||||
this.endTime2 = endTime2;
|
||||
}
|
||||
|
||||
public String getEndTimeOperator() {
|
||||
return this.endTimeOperator;
|
||||
}
|
||||
|
||||
public void setEndTimeOperator(String endTimeOperator) {
|
||||
this.endTimeOperator = endTimeOperator;
|
||||
}
|
||||
|
||||
public String getUsid() {
|
||||
return this.usid;
|
||||
}
|
||||
|
||||
public void setUsid(String usid) {
|
||||
this.usid = usid;
|
||||
}
|
||||
|
||||
public String getUsidOperator() {
|
||||
return this.usidOperator;
|
||||
}
|
||||
|
||||
public void setUsidOperator(String usidOperator) {
|
||||
this.usidOperator = usidOperator;
|
||||
}
|
||||
|
||||
public String getOperateTime() {
|
||||
return this.operateTime;
|
||||
}
|
||||
|
||||
public void setOperateTime(String operateTime) {
|
||||
this.operateTime = operateTime;
|
||||
}
|
||||
|
||||
public String getOperateTime1() {
|
||||
return this.operateTime1;
|
||||
}
|
||||
|
||||
public void setOperateTime1(String operateTime1) {
|
||||
this.operateTime1 = operateTime1;
|
||||
}
|
||||
|
||||
public String getOperateTime2() {
|
||||
return this.operateTime2;
|
||||
}
|
||||
|
||||
public void setOperateTime2(String operateTime2) {
|
||||
this.operateTime2 = operateTime2;
|
||||
}
|
||||
|
||||
public String getOperateTimeOperator() {
|
||||
return this.operateTimeOperator;
|
||||
}
|
||||
|
||||
public void setOperateTimeOperator(String operateTimeOperator) {
|
||||
this.operateTimeOperator = operateTimeOperator;
|
||||
}
|
||||
|
||||
public String getMethod() {
|
||||
return this.method;
|
||||
}
|
||||
|
||||
public void setMethod(String method) {
|
||||
this.method = method;
|
||||
}
|
||||
|
||||
public String getMethodOperator() {
|
||||
return this.methodOperator;
|
||||
}
|
||||
|
||||
public void setMethodOperator(String methodOperator) {
|
||||
this.methodOperator = methodOperator;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getDescriptionOperator() {
|
||||
return this.descriptionOperator;
|
||||
}
|
||||
|
||||
public void setDescriptionOperator(String descriptionOperator) {
|
||||
this.descriptionOperator = descriptionOperator;
|
||||
}
|
||||
|
||||
public String getClassName() {
|
||||
return this.className;
|
||||
}
|
||||
|
||||
public void setClassName(String className) {
|
||||
this.className = className;
|
||||
}
|
||||
|
||||
public String getClassNameOperator() {
|
||||
return this.classNameOperator;
|
||||
}
|
||||
|
||||
public void setClassNameOperator(String classNameOperator) {
|
||||
this.classNameOperator = classNameOperator;
|
||||
}
|
||||
|
||||
public String getAccount() {
|
||||
return this.account;
|
||||
}
|
||||
|
||||
public void setAccount(String account) {
|
||||
this.account = account;
|
||||
}
|
||||
|
||||
public String getAccountOperator() {
|
||||
return this.accountOperator;
|
||||
}
|
||||
|
||||
public void setAccountOperator(String accountOperator) {
|
||||
this.accountOperator = accountOperator;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getIdOperator() {
|
||||
return this.idOperator;
|
||||
}
|
||||
|
||||
public void setIdOperator(String idOperator) {
|
||||
this.idOperator = idOperator;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.adc.da.log.service;
|
||||
|
||||
import com.adc.da.log.entity.MiLogEO;
|
||||
import com.adc.da.sys.entity.UserEO;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.adc.da.base.service.BaseService;
|
||||
import com.adc.da.log.dao.mysql.LogEODao;
|
||||
import com.adc.da.log.entity.LogEO;
|
||||
|
||||
/**
|
||||
* <br>
|
||||
* <b>功能:</b>TS_LOG LogEOService<br>
|
||||
* <b>作者:</b>code generator<br>
|
||||
* <b>日期:</b> 2017-12-24 <br>
|
||||
* <b>版权所有:<b>版权归天津卡达克数据技术中心所有。<br>
|
||||
*
|
||||
* @see LogEODao
|
||||
*/
|
||||
@Service("logEOService")
|
||||
@Transactional
|
||||
public class LogEOService extends BaseService<LogEO, String> {
|
||||
|
||||
/**
|
||||
* @see LogEODao
|
||||
* @see mybatis.mapper.log
|
||||
*/
|
||||
@Resource
|
||||
private LogEODao dao;
|
||||
|
||||
@Override
|
||||
public LogEODao getDao() {
|
||||
return dao;
|
||||
}
|
||||
|
||||
public void save(MiLogEO user) {
|
||||
dao.save(user);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,198 @@
|
||||
package com.adc.da.log.vo;
|
||||
|
||||
import com.adc.da.base.entity.BaseEntity;
|
||||
|
||||
/**
|
||||
* <b>功能:</b>TS_LOG LogEOEntity<br>
|
||||
* <b>作者:</b>code generator<br>
|
||||
* <b>日期:</b> 2017-12-24 <br>
|
||||
* <b>版权所有:<b>版权归天津卡达克数据技术中心所有。<br>
|
||||
* <p>字段列表:</p>
|
||||
* <li>ipAddress -> ip_address</li>
|
||||
* <li>browser -> browser</li>
|
||||
* <li>startTime -> start_time</li>
|
||||
* <li>endTime -> end_time</li>
|
||||
* <li>usid -> usid</li>
|
||||
* <li>operateTime -> operate_time</li>
|
||||
* <li>method -> method</li>
|
||||
* <li>description -> description</li>
|
||||
* <li>className -> class_name</li>
|
||||
* <li>account -> account</li>
|
||||
* <li>id -> id</li>
|
||||
* <p>
|
||||
* date 2018-08-17
|
||||
*
|
||||
* @author comments created by Lee Kwanho
|
||||
* @see com.adc.da.log.controller.LogEOController
|
||||
*/
|
||||
public class LogVO extends BaseEntity {
|
||||
|
||||
/**
|
||||
* ip地址
|
||||
*/
|
||||
private String ipAddress;
|
||||
|
||||
/**
|
||||
* 浏览器
|
||||
*/
|
||||
private String browser;
|
||||
|
||||
/**
|
||||
* 日志生成时间
|
||||
* 类型为String 与 EO不同
|
||||
*/
|
||||
private String startTime;
|
||||
|
||||
/**
|
||||
* 日志结束时间(意义不明,数值与日志生成时间相同)
|
||||
* 类型为String 与 EO不同
|
||||
*/
|
||||
private String endTime;
|
||||
|
||||
/**
|
||||
* 操作用户的ID
|
||||
*/
|
||||
private String usid;
|
||||
|
||||
/**
|
||||
* 默认为空,意义不明
|
||||
* 类型为String 与 EO不同
|
||||
*/
|
||||
private String operateTime;
|
||||
|
||||
/**
|
||||
* 日志涉及的操作方法
|
||||
*/
|
||||
private String method;
|
||||
|
||||
/**
|
||||
* 默认为空
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 日志涉及的类名
|
||||
*/
|
||||
private String className;
|
||||
|
||||
/**
|
||||
* 操作用户的账号
|
||||
*/
|
||||
private String account;
|
||||
|
||||
/**
|
||||
* 日志ID
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/** **/
|
||||
public String getIpAddress() {
|
||||
return this.ipAddress;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setIpAddress(String ipAddress) {
|
||||
this.ipAddress = ipAddress;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getBrowser() {
|
||||
return this.browser;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setBrowser(String browser) {
|
||||
this.browser = browser;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getStartTime() {
|
||||
return this.startTime;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setStartTime(String startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getEndTime() {
|
||||
return this.endTime;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setEndTime(String endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getUsid() {
|
||||
return this.usid;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setUsid(String usid) {
|
||||
this.usid = usid;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getOperateTime() {
|
||||
return this.operateTime;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setOperateTime(String operateTime) {
|
||||
this.operateTime = operateTime;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getMethod() {
|
||||
return this.method;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setMethod(String method) {
|
||||
this.method = method;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getClassName() {
|
||||
return this.className;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setClassName(String className) {
|
||||
this.className = className;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getAccount() {
|
||||
return this.account;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setAccount(String account) {
|
||||
this.account = account;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
//package com.adc.da.sync.service;
|
||||
//
|
||||
//import com.adc.da.sys.dao.mysql.UserEODao;
|
||||
//import javax.annotation.Resource;
|
||||
//import org.springframework.stereotype.Service;
|
||||
//import org.springframework.transaction.annotation.Propagation;
|
||||
//import org.springframework.transaction.annotation.Transactional;
|
||||
//
|
||||
//@Service("syncService")
|
||||
//@Transactional
|
||||
//public class SyncService {
|
||||
//
|
||||
// @Resource
|
||||
// private UserEODao userEODao;
|
||||
//
|
||||
//// public void syncUserOrg(String usid, String oldOrgId, String newOrgId) {
|
||||
//// userEODao.deleteUserOrgByUsidAndOrgId(usid ,oldOrgId);
|
||||
//// userEODao.saveUserOrg(usid ,newOrgId);
|
||||
//// }
|
||||
//}
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.adc.da.sync.vo;
|
||||
|
||||
public class SyncVO {
|
||||
|
||||
private String account;
|
||||
|
||||
private String userCode; //工号
|
||||
|
||||
private String oldOrgName;
|
||||
|
||||
private String newOrgName;
|
||||
|
||||
private String newContactAddress;
|
||||
|
||||
/**
|
||||
* 办公电话
|
||||
*/
|
||||
private String officePhone;
|
||||
|
||||
/**
|
||||
* 手机号码
|
||||
*/
|
||||
private String cellPhoneNumber;
|
||||
/**
|
||||
* 电子邮件
|
||||
*/
|
||||
private String email;
|
||||
|
||||
public String getAccount() {
|
||||
return account;
|
||||
}
|
||||
|
||||
public void setAccount(String account) {
|
||||
this.account = account;
|
||||
}
|
||||
|
||||
public String getUserCode() {
|
||||
return userCode;
|
||||
}
|
||||
|
||||
public void setUserCode(String userCode) {
|
||||
this.userCode = userCode;
|
||||
}
|
||||
|
||||
public String getOldOrgName() {
|
||||
return oldOrgName;
|
||||
}
|
||||
|
||||
public void setOldOrgName(String oldOrgName) {
|
||||
this.oldOrgName = oldOrgName;
|
||||
}
|
||||
|
||||
public String getNewOrgName() {
|
||||
return newOrgName;
|
||||
}
|
||||
|
||||
public void setNewOrgName(String newOrgName) {
|
||||
this.newOrgName = newOrgName;
|
||||
}
|
||||
|
||||
public String getNewContactAddress() {
|
||||
return newContactAddress;
|
||||
}
|
||||
|
||||
public void setNewContactAddress(String newContactAddress) {
|
||||
this.newContactAddress = newContactAddress;
|
||||
}
|
||||
|
||||
public String getOfficePhone() {
|
||||
return officePhone;
|
||||
}
|
||||
|
||||
public void setOfficePhone(String officePhone) {
|
||||
this.officePhone = officePhone;
|
||||
}
|
||||
|
||||
public String getCellPhoneNumber() {
|
||||
return cellPhoneNumber;
|
||||
}
|
||||
|
||||
public void setCellPhoneNumber(String cellPhoneNumber) {
|
||||
this.cellPhoneNumber = cellPhoneNumber;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.adc.da.sys.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 数据过滤
|
||||
*/
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface DataFilter {
|
||||
|
||||
/** 表的别名 */
|
||||
String tableAlias() default "";
|
||||
|
||||
/** true:没有本部门数据权限,也能查询本人数据 */
|
||||
boolean user() default true;
|
||||
|
||||
/** true:拥有子部门数据权限 */
|
||||
boolean subOrg() default false;
|
||||
|
||||
/** 部门ID */
|
||||
String orgId() default "id";
|
||||
|
||||
/** 用户ID */
|
||||
String userId() default "usid";
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.adc.da.sys.constant;
|
||||
|
||||
/**
|
||||
* 用於菜單和角色判斷
|
||||
*
|
||||
* @author comments created by Lee Kwanho
|
||||
* date 2018-08-15
|
||||
* @see com.adc.da.sys.controller.MenuEOController
|
||||
* @see com.adc.da.sys.controller.RoleEOController
|
||||
*/
|
||||
public enum IsBelongEnum {
|
||||
BELONG(1, "属于");
|
||||
|
||||
/**
|
||||
* 对应数值
|
||||
*/
|
||||
private int value;
|
||||
|
||||
/**
|
||||
* 代表意义
|
||||
*/
|
||||
private String label;
|
||||
|
||||
IsBelongEnum(int value, String label) {
|
||||
this.value = value;
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,193 @@
|
||||
package com.adc.da.sys.controller;
|
||||
|
||||
|
||||
import com.adc.da.sys.dao.mysql.MailEODao;
|
||||
import com.adc.da.sys.entity.MailEO;
|
||||
import com.adc.da.sys.entity.UserEO;
|
||||
import com.adc.da.sys.service.iservice.IUserEoService;
|
||||
import com.adc.da.sys.util.DefaultConfigurer;
|
||||
import com.adc.da.sys.util.EncryptUtil;
|
||||
import com.adc.da.sys.util.MailTestUtils;
|
||||
import com.adc.da.sys.util.SendEmailMessage;
|
||||
import com.adc.da.util.http.ResponseMessage;
|
||||
import com.adc.da.util.http.Result;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
/**
|
||||
* @Author sima
|
||||
* @Date 2022/6/24 13:06
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/${restPath}/sys/mail")
|
||||
@Api(tags = {"Sys-发送邮件"})
|
||||
@Slf4j
|
||||
public class MailController {
|
||||
|
||||
@Resource
|
||||
private MailEODao mailEODao;
|
||||
@Resource
|
||||
private IUserEoService userEOService;
|
||||
|
||||
|
||||
@Value("${MAIL_SMTP}")
|
||||
private String mail_smtp;
|
||||
|
||||
@Value("${MAIL_SMTP_PORT}")
|
||||
private String mail_smtp_port;
|
||||
|
||||
@Value("${MAIL_USERNAME}")
|
||||
private String mail_username;
|
||||
|
||||
@Value("${MAIL_PASSWORD}")
|
||||
private String mail_password;
|
||||
@Value("${MAIL_POP_PORT}")
|
||||
private String mail_pop_port;
|
||||
|
||||
|
||||
@Value("${IPANDPORT}")
|
||||
private String piAndPort;
|
||||
|
||||
|
||||
/**
|
||||
* 废弃
|
||||
* @param mailEO
|
||||
* @return
|
||||
*/
|
||||
/* @ApiOperation("发送邮件")
|
||||
@PostMapping("/send")
|
||||
public ResponseMessage send(@RequestBody MailEO mailEO) {
|
||||
MailUtils sendmail = new MailUtils();
|
||||
sendmail.setHost(mail_smtp);
|
||||
sendmail.setPort(mail_smtp_port);
|
||||
sendmail.setUserName(mail_username); // 发送邮箱
|
||||
sendmail.setPassWord(mail_password); // 发送邮箱密码
|
||||
sendmail.setFrom(mail_username);// 发送邮箱
|
||||
sendmail.setSubject(mailEO.getSubject());
|
||||
sendmail.setContent(mailEO.getContent());
|
||||
|
||||
String mails = mailEO.getToMail();
|
||||
Set<String> set = strToList(mails);
|
||||
|
||||
int i = 0;
|
||||
for (String mail : set) {
|
||||
sendmail.setTo(mail); // 目的邮箱
|
||||
|
||||
if (sendmail.sendMail()) {
|
||||
mailEO.setSendDate(new Date());
|
||||
mailEO.setId(UUID.randomUUID().toString());
|
||||
mailEO.setToMail(mail);
|
||||
mailEODao.insert(mailEO);
|
||||
i++;
|
||||
//保存记录
|
||||
// return Result.success("成功");
|
||||
}
|
||||
}
|
||||
if(i>0){
|
||||
return Result.success("成功");
|
||||
}
|
||||
return Result.error("发送失败");
|
||||
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
@ApiOperation("发送邮件")
|
||||
@PostMapping("/send")
|
||||
public ResponseMessage send(@RequestBody MailEO mailEO) throws Exception {
|
||||
|
||||
MailTestUtils eu = new MailTestUtils(mail_username, mail_password);
|
||||
SendEmailMessage sem = new SendEmailMessage();
|
||||
sem.setFrom(mail_username);
|
||||
sem.setRecipient(mailEO.getToMail());
|
||||
sem.setCopyRecipient(mailEO.getCcMail());
|
||||
sem.setSubject(mailEO.getSubject());
|
||||
sem.setContent(mailEO.getContent());
|
||||
|
||||
DefaultConfigurer defaultConfigurer = new DefaultConfigurer();
|
||||
defaultConfigurer.setMail_smtp(mail_smtp);
|
||||
defaultConfigurer.setMail_smtp_port(mail_smtp_port);
|
||||
defaultConfigurer.setMail_pop_port(mail_pop_port);
|
||||
try{
|
||||
eu.sendMail(defaultConfigurer.getSMTP(), sem);
|
||||
mailEO.setSendDate(new Date());
|
||||
mailEO.setId(UUID.randomUUID().toString().replaceAll("-",""));
|
||||
mailEO.setToMail(getUserByMail(mailEO.getToMail()));
|
||||
mailEO.setCcMail(getUserByMail(mailEO.getCcMail()));
|
||||
mailEODao.insert(mailEO);
|
||||
System.out.println("发送成功");
|
||||
return Result.success("发送成功");
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("邮件发送失败:",e);
|
||||
return Result.error("发送失败");
|
||||
}
|
||||
|
||||
|
||||
// 收邮件
|
||||
// eu.receiveMail(defaultConfigurer.getPOP3(), "pop3"); // pop3收信
|
||||
// System.out.println("收取完毕");
|
||||
|
||||
// 使用IMAP收信会抛出 Failed to load IMAP envelope 异常
|
||||
//eu.receiveMail(DefaultConfigurer.getIMAP(), "imap"); // imap收信
|
||||
|
||||
}
|
||||
|
||||
private String getUserByMail(String mails) {
|
||||
if(null == mails || "".equals(mails)){
|
||||
return "";
|
||||
}
|
||||
List<String> mailList = Arrays.asList(mails.split(","));
|
||||
List<String> accountList = new ArrayList<>();
|
||||
for (int i = 0; i < mailList.size(); i++) {
|
||||
String mail = mailList.get(i);
|
||||
String account = mail.substring(0, mail.indexOf("@"));
|
||||
accountList.add(account);
|
||||
}
|
||||
// List<UserEO> userEOList = userEOService.getUserByMail(mailList);
|
||||
List<UserEO> userEOList = userEOService.getUserByAccount(accountList);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (UserEO user:userEOList) {
|
||||
sb.append(",");
|
||||
sb.append(user.getUsname());
|
||||
sb.append("-");
|
||||
sb.append(user.getDepartment());
|
||||
sb.append("<");
|
||||
sb.append(user.getAccount());
|
||||
sb.append("@Any3.com");
|
||||
sb.append(">");
|
||||
}
|
||||
return sb.toString().substring(1);
|
||||
}
|
||||
|
||||
@ApiOperation("发送记录")
|
||||
@PostMapping("/list")
|
||||
public ResponseMessage list(Integer pageNo, Integer pageSize) {
|
||||
pageNo = null == pageNo ? 1 : pageNo;
|
||||
pageSize = null == pageSize ? 10 : pageSize;
|
||||
IPage page = new Page();
|
||||
page.setCurrent(pageNo);
|
||||
page.setSize(pageSize);
|
||||
IPage<MailEO> list = mailEODao.list(page);
|
||||
List<MailEO> records = list.getRecords();
|
||||
DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
||||
for (MailEO eo:records) {
|
||||
eo.setStrSendDate(sdf.format(eo.getSendDate()));
|
||||
}
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.adc.da.sys.controller;
|
||||
|
||||
import com.adc.da.sys.dao.mysql.MailEODao;
|
||||
import com.adc.da.sys.entity.MailEO;
|
||||
import com.adc.da.sys.util.DefaultConfigurer;
|
||||
import com.adc.da.sys.util.MailTestUtils;
|
||||
import com.adc.da.sys.util.MailUtils;
|
||||
import com.adc.da.sys.util.SendEmailMessage;
|
||||
import com.adc.da.util.http.ResponseMessage;
|
||||
import com.adc.da.util.http.Result;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
/**
|
||||
* @Author sima
|
||||
* @Date 2022/6/24 13:06
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/${restPath}/sys/mailtest")
|
||||
@Api(tags = {"Sys-发送邮件test"})
|
||||
@Slf4j
|
||||
public class MailTestController {
|
||||
|
||||
@Value("${MAIL_USERNAME}")
|
||||
private String mail_username;
|
||||
|
||||
@Value("${MAIL_PASSWORD}")
|
||||
private String mail_password;
|
||||
|
||||
@Value("${MAIL_SMTP}")
|
||||
private String mail_smtp;
|
||||
|
||||
@Value("${MAIL_SMTP_PORT}")
|
||||
private String mail_smtp_port;
|
||||
|
||||
@Value("${MAIL_POP_PORT}")
|
||||
private String mail_pop_port;
|
||||
|
||||
/**
|
||||
* 程序入口点
|
||||
* @param
|
||||
* @throws Exception
|
||||
*/
|
||||
@ApiOperation("发送邮件")
|
||||
@PostMapping("/send")
|
||||
public ResponseMessage send(@RequestBody MailEO mailEO) throws Exception {
|
||||
|
||||
MailTestUtils eu = new MailTestUtils(mail_username, mail_password);
|
||||
SendEmailMessage sem = new SendEmailMessage();
|
||||
sem.setFrom(mail_username);
|
||||
sem.setRecipient(mailEO.getToMail());
|
||||
sem.setSubject("镇长");
|
||||
sem.setText("hello world");
|
||||
DefaultConfigurer defaultConfigurer = new DefaultConfigurer();
|
||||
defaultConfigurer.setMail_smtp(mail_smtp);
|
||||
defaultConfigurer.setMail_smtp_port(mail_smtp_port);
|
||||
defaultConfigurer.setMail_pop_port(mail_pop_port);
|
||||
eu.sendMail(defaultConfigurer.getSMTP(), sem);
|
||||
System.out.println("发送成功");
|
||||
// 收邮件
|
||||
// eu.receiveMail(defaultConfigurer.getPOP3(), "pop3"); // pop3收信
|
||||
// System.out.println("收取完毕");
|
||||
|
||||
// 使用IMAP收信会抛出 Failed to load IMAP envelope 异常
|
||||
//eu.receiveMail(DefaultConfigurer.getIMAP(), "imap"); // imap收信
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,291 @@
|
||||
package com.adc.da.sys.controller;
|
||||
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_UTF8_VALUE;
|
||||
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import com.adc.da.sys.constant.IsBelongEnum;
|
||||
import com.adc.da.sys.entity.RoleEO;
|
||||
import com.adc.da.sys.entity.RoleMenuEO;
|
||||
import com.adc.da.sys.page.RoleMenuEOPage;
|
||||
import com.adc.da.sys.service.RoleEOService;
|
||||
import com.adc.da.sys.service.RoleMenuEOService;
|
||||
import com.adc.da.sys.vo.MenuVO;
|
||||
|
||||
import com.adc.da.util.utils.BeanMapper;
|
||||
|
||||
import com.adc.da.util.utils.StringUtils;
|
||||
import com.adc.da.util.utils.UUID;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import com.adc.da.base.web.BaseController;
|
||||
import com.adc.da.sys.entity.MenuEO;
|
||||
import com.adc.da.sys.service.MenuEOService;
|
||||
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
|
||||
import com.adc.da.util.http.ResponseMessage;
|
||||
import com.adc.da.util.http.Result;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/${restPath}/sys/menu")
|
||||
@Api(tags = {"Sys-菜单管理"})
|
||||
public class MenuEOController extends BaseController<MenuEO> {
|
||||
|
||||
/**
|
||||
* 用于记录日志.
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(MenuEOController.class);
|
||||
|
||||
/**
|
||||
* 1.MenuEOService 用于菜单相关service方法.
|
||||
*
|
||||
* @see MenuEOService
|
||||
*/
|
||||
@Resource
|
||||
private MenuEOService menuEOService;
|
||||
|
||||
@Resource
|
||||
private RoleMenuEOService roleMenuEOService ;
|
||||
|
||||
@Resource
|
||||
private RoleEOService roleEOService ;
|
||||
|
||||
|
||||
/**
|
||||
* dozer相关,EO间VO转换
|
||||
*
|
||||
* @see dozer
|
||||
*/
|
||||
@Resource
|
||||
private BeanMapper beanMapper;
|
||||
|
||||
/**
|
||||
* 显示菜单详情,需要输入菜单id.
|
||||
* 权限字段:sys:menu:get
|
||||
*
|
||||
* @param id 菜单ID
|
||||
* @return 成功返回菜单详情,失败返回异常信息
|
||||
*/
|
||||
@ApiOperation(value = "|MenuEO|详情")
|
||||
@GetMapping("/{id}")
|
||||
//@RequiresPermissions("sys:menu:get")
|
||||
public ResponseMessage<MenuVO> find(@NotNull @PathVariable("id") final String id) {
|
||||
|
||||
try {
|
||||
return Result.success(beanMapper.map(menuEOService.selectByPrimaryKey(id), MenuVO.class));
|
||||
} catch (Exception e) {
|
||||
logger.error("菜单详情获取失败", e);
|
||||
return Result.error("表单详情获取失败:");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增菜单.若菜单名为空之间返回error.
|
||||
* 权限字段:sys:menu:save
|
||||
*
|
||||
* @param menuVO 菜单单信息
|
||||
* @return 成功返回菜单信息,失败返回异常信息
|
||||
*/
|
||||
@ApiOperation(value = "|MenuEO|新增")
|
||||
@PostMapping(consumes = APPLICATION_JSON_UTF8_VALUE)
|
||||
//@RequiresPermissions("sys:menu:save")
|
||||
public ResponseMessage<MenuVO> create(@RequestBody final MenuVO menuVO) {
|
||||
|
||||
if (StringUtils.isEmpty(menuVO.getName())) {
|
||||
return Result.error("菜单名不能为空");
|
||||
}
|
||||
if(StringUtils.isEmpty(menuVO.getParentId())){
|
||||
return Result.error("父菜单id不能为空");
|
||||
}
|
||||
try {
|
||||
menuVO.setId(UUID.randomUUID10());
|
||||
int conflict = menuEOService.queryConflict(menuVO.getName(),menuVO.getId(),menuVO.getParentId());
|
||||
if (conflict == 0) {
|
||||
MenuEO menuEO = beanMapper.map(menuVO, MenuEO.class) ;
|
||||
MenuEO parentMenu = menuEOService.selectByPrimaryKey(menuVO.getParentId());
|
||||
menuEO.setParent(parentMenu);
|
||||
menuEOService.insertMenu(menuEO);
|
||||
return Result.success(beanMapper.map(menuEO, MenuVO.class));
|
||||
}else {
|
||||
return Result.error("-1","新增菜单失败: 所选父节点下有相同的“菜单名称”,请修改!");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("新增菜单失败", e);
|
||||
return Result.error("-1","新增菜单失败!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示角色对应菜单.
|
||||
* 权限字段:sys:menu:list
|
||||
* 路径"/"
|
||||
*
|
||||
* @param roleId 角色id
|
||||
* @return 菜单列表
|
||||
*/
|
||||
@ApiOperation(value = "|MenuEO|列表 --> 角色对应的菜单")
|
||||
@GetMapping()
|
||||
//@RequiresPermissions("sys:menu:list")
|
||||
public ResponseMessage<List<MenuVO>> listType( String roleId) throws Exception {
|
||||
List<MenuVO> menuVOs = beanMapper.mapList(menuEOService.findAll(),MenuVO.class);
|
||||
RoleMenuEOPage roleMenuEOPage = new RoleMenuEOPage() ;
|
||||
roleMenuEOPage.setPageSize(1000);
|
||||
|
||||
if (roleId != null && !"".equals(roleId)) {
|
||||
roleMenuEOPage.setRoleId(roleId);
|
||||
RoleEO roleEO = roleEOService.selectByPrimaryKey(roleId);
|
||||
if ("管理员".equals(roleEO.getName())) {
|
||||
menuVOs.forEach(menuVO -> {
|
||||
menuVO.setBelong(IsBelongEnum.BELONG.getValue());
|
||||
});
|
||||
}else{
|
||||
List<RoleMenuEO> roleMenuEOList =roleMenuEOService.queryByList(roleMenuEOPage);
|
||||
for (MenuVO menuVO : menuVOs) {
|
||||
for (RoleMenuEO roleMenuEO : roleMenuEOList){
|
||||
if (StringUtils.equals(menuVO.getId(),roleMenuEO.getMenuId())){
|
||||
menuVO.setBelong(IsBelongEnum.BELONG.getValue());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//List<MenuVO> levelMenus = menuEOService.changeMenu(menuVOs);
|
||||
|
||||
return Result.success(menuVOs);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 修改菜单信息.
|
||||
* 权限字段:sys:menu:update
|
||||
*
|
||||
* @param menuVO 菜单参数
|
||||
* @return 修改结果,和改动后的参数
|
||||
*/
|
||||
@ApiOperation(value = "|MenuEO|修改")
|
||||
@PutMapping(consumes = APPLICATION_JSON_UTF8_VALUE)
|
||||
//@RequiresPermissions("sys:menu:update")
|
||||
public ResponseMessage<MenuVO> update(@RequestBody final MenuVO menuVO) {
|
||||
if (StringUtils.isEmpty(menuVO.getName())) {
|
||||
return Result.error("菜单名不能为空");
|
||||
}
|
||||
try {
|
||||
int conflict = menuEOService.queryConflict(menuVO.getName(),menuVO.getId(),menuVO.getParentId());
|
||||
if (conflict == 0) {
|
||||
MenuEO menuEO = beanMapper.map(menuVO, MenuEO.class) ;
|
||||
MenuEO parentMenu = menuEOService.selectByPrimaryKey(menuVO.getParentId());
|
||||
menuEO.setParent(parentMenu);
|
||||
MenuVO parentMenuVO = beanMapper.map(parentMenu, MenuVO.class) ;
|
||||
menuVO.setParent(parentMenuVO);
|
||||
menuEOService.updateMenu(menuVO);
|
||||
}else {
|
||||
return Result.error("-1", "修改菜单失败: 所选父节点下有相同的“菜单排序”,请修改! ", menuVO);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("修改菜单失败: ", e);
|
||||
return Result.error("-1", "修改菜单失败 ", menuVO);
|
||||
}
|
||||
return Result.success(menuVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除菜单,可删除多个菜单.
|
||||
* 权限字段:sys:menu:delete
|
||||
*
|
||||
* @param ids 菜单组
|
||||
* @return 处理结果
|
||||
*/
|
||||
@ApiOperation(value = "|MenuEO|删除")
|
||||
@DeleteMapping("/{ids}")
|
||||
//@RequiresPermissions("sys:menu:delete")
|
||||
public ResponseMessage delete(@NotNull @PathVariable("ids") final String[] ids) {
|
||||
|
||||
menuEOService.delete(ids);
|
||||
logger.info("log===>delete from TS_MENU where ids = {}", ids);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户菜单列表.
|
||||
* 权限字段:sys:menu:listMenuByUserId
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @return 菜单列表
|
||||
*/
|
||||
@ApiOperation(value = "用户菜单列表|MenuEO|")
|
||||
@GetMapping(value = "/listMenuByUserId")
|
||||
//@RequiresPermissions("sys:menu:listMenuByUserId")
|
||||
public ResponseMessage<List<MenuVO>> listMenuByUserId(String userId) {
|
||||
if(StringUtils.isEmpty(userId)){
|
||||
return Result.error("用户id不能为空");
|
||||
}
|
||||
List<MenuEO> list= menuEOService.listMenuEOByUserId(userId);
|
||||
List<MenuVO> entities = beanMapper.mapList(list, MenuVO.class);
|
||||
|
||||
//List<MenuVO> levelMenus = menuEOService.changeMenu(entities);
|
||||
return Result.success(entities);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询菜单|MenuEO|")
|
||||
@GetMapping("/findAllMenus")
|
||||
// @RequiresPermissions("sys:menu:listByName")
|
||||
public ResponseMessage<List<MenuVO>> findAllMenus() {
|
||||
|
||||
List<MenuVO> entities = beanMapper.mapList(menuEOService.findAll(),MenuVO.class);
|
||||
//List<MenuVO> levelMenus = menuEOService.changeMenu(entities);
|
||||
return Result.success(entities);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// @ApiOperation(value = "查询提示信息")
|
||||
// @GetMapping("/information")
|
||||
// public ResponseMessage information() {
|
||||
//
|
||||
// String information = menuEOService.queryInformation();
|
||||
// return Result.success(information);
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @ApiOperation(value = "编辑提示信息")
|
||||
// @GetMapping("/updateInformation")
|
||||
// public ResponseMessage updateInformation(String information) {
|
||||
//
|
||||
// int i = menuEOService.updateInformation(information);
|
||||
// if(i==0){
|
||||
// menuEOService.insertInformation(information);
|
||||
// }
|
||||
// return Result.success();
|
||||
//
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,267 @@
|
||||
package com.adc.da.sys.controller;
|
||||
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_UTF8_VALUE;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import com.adc.da.sys.dao.mysql.RoleEODao;
|
||||
import com.adc.da.sys.entity.MenuEO;
|
||||
import com.adc.da.sys.vo.MenuVO;
|
||||
import com.adc.da.util.utils.CollectionUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.adc.da.base.page.Pager;
|
||||
import com.adc.da.base.web.BaseController;
|
||||
import com.adc.da.sys.constant.IsBelongEnum;
|
||||
import com.adc.da.sys.entity.RoleEO;
|
||||
import com.adc.da.sys.entity.UserRoleEO;
|
||||
import com.adc.da.sys.page.RoleEOPage;
|
||||
import com.adc.da.sys.service.RoleEOService;
|
||||
import com.adc.da.sys.vo.RoleVO;
|
||||
import com.adc.da.util.http.PageInfo;
|
||||
import com.adc.da.util.http.ResponseMessage;
|
||||
import com.adc.da.util.http.Result;
|
||||
import com.adc.da.util.utils.BeanMapper;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
/**
|
||||
* 角色管理模块相关接口.
|
||||
* 1.分页查询
|
||||
* 2.角色详情
|
||||
* 3.角色列表
|
||||
* 4.新增角色
|
||||
* 5.修改角色
|
||||
* 6.删除角色
|
||||
* 7.配置角色菜单
|
||||
* date 2018/08/15
|
||||
*
|
||||
* @author comments created by Lee Kwanho
|
||||
* @see RoleEOService
|
||||
* @see RoleEO
|
||||
* @see RoleVO
|
||||
* @see RoleEOPage
|
||||
* @see RoleEODao
|
||||
* @see mybatis.mapper.sys
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/${restPath}/sys/role")
|
||||
@Api(tags = {"Sys-角色管理"})
|
||||
public class RoleEOController extends BaseController<RoleEO> {
|
||||
|
||||
/**
|
||||
* 日志
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(RoleEOController.class);
|
||||
|
||||
/**
|
||||
* 角色相关Service
|
||||
*/
|
||||
@Resource
|
||||
private RoleEOService roleEOService;
|
||||
|
||||
|
||||
/**
|
||||
* dozer相关,EO间VO转换
|
||||
*/
|
||||
@Resource
|
||||
private BeanMapper beanMapper;
|
||||
|
||||
/**
|
||||
* 分页查询角色列表,可以根据角色名称进行查询
|
||||
* 权限字段:sys:role:pageList
|
||||
*
|
||||
* @param pageNo 页码
|
||||
* @param pageSize 分页大小
|
||||
* @param roleName 角色名称,非id
|
||||
* @return 查询结果分页,异常会返回异常信息
|
||||
*/
|
||||
@ApiOperation(value = "|RoleEO|分页查询")
|
||||
@GetMapping("/page")
|
||||
// @RequiresPermissions("sys:role:pageList")
|
||||
public ResponseMessage<PageInfo<RoleVO>> page(Integer pageNo, Integer pageSize, String roleName) {
|
||||
RoleEOPage page = new RoleEOPage();
|
||||
if (pageNo != null) {
|
||||
page.setPage(pageNo);
|
||||
}
|
||||
if (pageSize != null) {
|
||||
page.setPageSize(pageSize);
|
||||
}
|
||||
if (StringUtils.isNotEmpty(roleName)) {
|
||||
page.setName('%' + roleName + '%');
|
||||
page.setNameOperator("LIKE");
|
||||
}
|
||||
page.setDelFlag("0");//没有删除
|
||||
page.setPager(new Pager());
|
||||
|
||||
try {
|
||||
List<RoleEO> rows = roleEOService.queryByPage(page);
|
||||
return Result.success(beanMapper.mapPage(getPageInfo(page.getPager(), rows), RoleVO.class));
|
||||
} catch (Exception e) {
|
||||
logger.error("Role Page Error:", e);
|
||||
return Result.error("参数异常" + e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据角色id查询角色信息
|
||||
* 权限字段:sys:role:get
|
||||
*
|
||||
* @param id 角色id
|
||||
* @return 角色详情
|
||||
*/
|
||||
@ApiOperation(value = "|RoleEO|详情")
|
||||
@GetMapping("/{id}")
|
||||
// @RequiresPermissions("sys:role:get")
|
||||
public ResponseMessage<RoleVO> getById(@NotNull @PathVariable("id") String id) {
|
||||
RoleEO roleEO = roleEOService.getRoleWithMenus(id);
|
||||
return Result.success(beanMapper.map(roleEO, RoleVO.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据角色编码查询角色信息
|
||||
* 权限字段:sys:role:get
|
||||
*
|
||||
* @param roleCode 角色编码
|
||||
* @return 角色详情
|
||||
*/
|
||||
@ApiOperation(value = "|RoleEO|详情")
|
||||
@GetMapping("getRoleByCode/{roleCode}")
|
||||
// @RequiresPermissions("sys:role:get")
|
||||
public ResponseMessage<List<RoleVO>> getRoleByCode(@NotNull @PathVariable("roleCode") String roleCode) {
|
||||
List<RoleEO> roleEO = roleEOService.getRoleByCode(roleCode);
|
||||
return Result.success(beanMapper.mapList(roleEO, RoleVO.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示角色列表,同时对该用户已有角色进行belong字段标注
|
||||
* 权限字段:sys:role:list
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @return 角色列表,该用户角色身份会的belong字段会标注
|
||||
*/
|
||||
@ApiOperation(value = "|RoleEO|列表")
|
||||
@GetMapping("")
|
||||
// @RequiresPermissions("sys:role:list")
|
||||
public ResponseMessage<List<RoleVO>> list(String userId) {
|
||||
List<RoleVO> roleVOs = beanMapper.mapList(roleEOService.findAll(), RoleVO.class);
|
||||
if (userId != null) {
|
||||
for (RoleVO roleVO : roleVOs) {
|
||||
if (roleEOService.isBelong(userId, roleVO.getRid())) {
|
||||
roleVO.setBelong(IsBelongEnum.BELONG.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
return Result.success(roleVOs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增角色
|
||||
* 权限字段:sys:role:save
|
||||
*
|
||||
* @param roleVO 角色信息
|
||||
* @return 角色信息
|
||||
*/
|
||||
@ApiOperation(value = "|RoleEO|新增")
|
||||
@PostMapping(consumes = APPLICATION_JSON_UTF8_VALUE)
|
||||
// @RequiresPermissions("sys:role:save")
|
||||
public ResponseMessage<RoleVO> create(@RequestBody RoleVO roleVO) {
|
||||
RoleEO roleEO = roleEOService.save(beanMapper.map(roleVO, RoleEO.class));
|
||||
roleVO.setRid(roleEO.getId());
|
||||
return Result.success(roleVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改角色信息
|
||||
* 权限字段:sys:role:update
|
||||
*
|
||||
* @param roleVO 角色信息
|
||||
* @return 若成功,返回角色信息;否则记录日志,返回异常信息
|
||||
*/
|
||||
@ApiOperation(value = "|RoleEO|修改")
|
||||
@PutMapping(consumes = APPLICATION_JSON_UTF8_VALUE)
|
||||
// @RequiresPermissions("sys:role:update")
|
||||
public ResponseMessage<RoleVO> update(@RequestBody RoleVO roleVO) {
|
||||
|
||||
try {
|
||||
roleEOService.updateByPrimaryKeySelective(beanMapper.map(roleVO, RoleEO.class));
|
||||
return Result.success(roleVO);
|
||||
} catch (Exception e) {
|
||||
logger.error("角色修改异常", e);
|
||||
return Result.error("角色修改异常:" + e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除角色,逻辑删除,若角色有对应用户则不能删除
|
||||
* 权限字段:sys:role:delete
|
||||
*
|
||||
* @param id 角色id
|
||||
* @return 处理结果
|
||||
*/
|
||||
@ApiOperation(value = "|RoleEO|删除")
|
||||
@DeleteMapping("/{id}")
|
||||
// @RequiresPermissions("sys:role:delete")
|
||||
public ResponseMessage delete(@NotNull @PathVariable("id") String id) throws Exception {
|
||||
RoleEO roleEO = roleEOService.selectByPrimaryKey(id);
|
||||
if ("管理员".equals(roleEO.getName())) {
|
||||
return Result.error( "管理员角色不能删除");
|
||||
}
|
||||
List<UserRoleEO> list = roleEOService.getUserRoleListByRoleId(id);
|
||||
// 如果角色有对应用户,则不允许删除
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
return Result.error("该角色有对应用户,不能删除");
|
||||
}
|
||||
|
||||
roleEOService.delete(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置角色菜单
|
||||
* 权限字段:sys:role:saveRoleMenu
|
||||
*
|
||||
* @param roleVO 角色信息
|
||||
* @return 处理结果,返回角色VO
|
||||
*/
|
||||
@ApiOperation(value = "配置角色菜单|RoleEO|")
|
||||
@PostMapping("/saveRoleMenu")
|
||||
// @RequiresPermissions("sys:role:saveRoleMenu")
|
||||
public ResponseMessage<RoleVO> saveRoleMenu(@RequestBody RoleVO roleVO) {
|
||||
roleEOService.saveRoleMenu(beanMapper.map(roleVO, RoleEO.class));
|
||||
return Result.success(roleVO);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "配置角色首页|RoleEO|")
|
||||
@PostMapping("/saveRoleHome")
|
||||
public ResponseMessage saveRoleHome(@RequestBody RoleVO roleVO) {
|
||||
roleEOService.saveRoleHome(beanMapper.map(roleVO, RoleEO.class));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "得到角色首页|RoleEO|")
|
||||
@GetMapping("/getRoleHome")
|
||||
public ResponseMessage getRoleHome(String roleId) throws Exception {
|
||||
List<MenuVO> homeList = roleEOService.getHomeMenu(roleId);
|
||||
return Result.success(homeList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.adc.da.sys.controller;
|
||||
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_UTF8_VALUE;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.adc.da.base.web.BaseController;
|
||||
import com.adc.da.sys.entity.RoleMenuEO;
|
||||
import com.adc.da.sys.page.RoleMenuEOPage;
|
||||
import com.adc.da.sys.service.RoleMenuEOService;
|
||||
|
||||
import com.adc.da.util.http.ResponseMessage;
|
||||
import com.adc.da.util.http.Result;
|
||||
import com.adc.da.util.http.PageInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/${restPath}/sys/roleMenu")
|
||||
@Api(description = "|RoleMenuEO|")
|
||||
public class RoleMenuEOController extends BaseController<RoleMenuEO>{
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(RoleMenuEOController.class);
|
||||
|
||||
@Resource
|
||||
private RoleMenuEOService roleMenuEOService;
|
||||
|
||||
@ApiOperation(value = "|RoleMenuEO|分页查询")
|
||||
@GetMapping("/page")
|
||||
//@RequiresPermissions("sys:roleMenu:page")
|
||||
public ResponseMessage<PageInfo<RoleMenuEO>> page(RoleMenuEOPage page) throws Exception {
|
||||
List<RoleMenuEO> rows = roleMenuEOService.queryByPage(page);
|
||||
return Result.success(getPageInfo(page.getPager(), rows));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "|RoleMenuEO|查询")
|
||||
@GetMapping("")
|
||||
//@RequiresPermissions("sys:roleMenu:list")
|
||||
public ResponseMessage<List<RoleMenuEO>> list(RoleMenuEOPage page) throws Exception {
|
||||
return Result.success(roleMenuEOService.queryByList(page));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "|RoleMenuEO|新增")
|
||||
@PostMapping(consumes = APPLICATION_JSON_UTF8_VALUE)
|
||||
//@RequiresPermissions("sys:roleMenu:save")
|
||||
public ResponseMessage<RoleMenuEO> create(@RequestBody RoleMenuEO roleMenuEO) throws Exception {
|
||||
roleMenuEOService.insertSelective(roleMenuEO);
|
||||
return Result.success(roleMenuEO);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,274 @@
|
||||
package com.adc.da.sys.controller;
|
||||
|
||||
import com.adc.da.base.web.BaseController;
|
||||
import com.adc.da.excel.poi.excel.ExcelImportUtil;
|
||||
import com.adc.da.excel.poi.excel.entity.ImportParams;
|
||||
import com.adc.da.excel.poi.excel.entity.result.ExcelImportResult;
|
||||
import com.adc.da.excel.poi.excel.entity.result.ExcelVerifyHanlderErrorResult;
|
||||
import com.adc.da.sys.entity.UserEO;
|
||||
import com.adc.da.sys.service.iservice.IUserEoService;
|
||||
import com.adc.da.sys.util.EncryptUtil;
|
||||
import com.adc.da.sys.util.RSAUtil;
|
||||
import com.adc.da.sys.vo.UserImportVO;
|
||||
import com.adc.da.sys.vo.UserVO;
|
||||
import com.adc.da.util.exception.AdcDaBaseException;
|
||||
import com.adc.da.util.http.ResponseMessage;
|
||||
import com.adc.da.util.http.Result;
|
||||
import com.adc.da.util.utils.FileUtil;
|
||||
import com.adc.da.util.utils.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonParser;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.aspectj.weaver.tools.cache.SimpleCacheFactory.path;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/${restPath}/sys/user")
|
||||
@Api(tags = {"Sys-用户管理"})
|
||||
@Slf4j
|
||||
public class UserEOController extends BaseController<UserEO> {
|
||||
//
|
||||
@Resource
|
||||
private IUserEoService userEOService;
|
||||
//
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * dozer相关,EO间VO转换
|
||||
// *
|
||||
// *
|
||||
// * @see dozer
|
||||
// */
|
||||
|
||||
@Value("${MAIL_SMTP}")
|
||||
private String mail_smtp;
|
||||
|
||||
@Value("${MAIL_SMTP_PORT}")
|
||||
private String mail_smtp_port;
|
||||
|
||||
@Value("${MAIL_USERNAME}")
|
||||
private String mail_username;
|
||||
|
||||
@Value("${MAIL_PASSWORD}")
|
||||
private String mail_password;
|
||||
|
||||
@Value("${isPassEncrypted}")
|
||||
private boolean isPassEncrypted;
|
||||
|
||||
|
||||
@ApiOperation(value = "|UserEO|新增|编辑")
|
||||
@PostMapping("addUser")
|
||||
// @RequiresPermissions("sys:user:save")
|
||||
// @BusinessLog(description = "用户新增")
|
||||
@Transactional
|
||||
public ResponseMessage<UserVO> addUser(@RequestBody String requestString) throws Exception {
|
||||
|
||||
JsonParser parser = new JsonParser();
|
||||
Gson gson = new Gson();
|
||||
|
||||
String data = new String(Base64.decodeBase64(requestString), StandardCharsets.UTF_8);
|
||||
JsonElement element = parser.parse(data);
|
||||
UserEO eo = gson.fromJson(element, UserEO.class);
|
||||
// UserEO eo=new UserEO();
|
||||
// BeanUtils.copyProperties(vo,eo);
|
||||
eo.setPassword("EI$XIL@vdc9ptev7");
|
||||
if (StringUtils.isBlank(eo.getAccount())) {
|
||||
return Result.error("用户名不能为空!");
|
||||
}
|
||||
|
||||
if (StringUtils.isBlank(eo.getUsname())) {
|
||||
return Result.error("姓名不能为空!");
|
||||
}
|
||||
if (eo.getUsname().length() > 20) {
|
||||
return Result.error("姓名不超过20字符!");
|
||||
}
|
||||
if (eo.getRoleIdList() == null || eo.getRoleIdList().size() == 0) {
|
||||
return Result.error("角色不能为空!");
|
||||
}
|
||||
|
||||
/*
|
||||
* 用户与密码都需要加解密
|
||||
*/
|
||||
if (isPassEncrypted) {
|
||||
|
||||
eo.setAccount(new String(RSAUtil.decryptByPrivateKey(Base64.decodeBase64(eo.getAccount()), RSAUtil.PrivateKey)));
|
||||
// eo.setPassword(new String(RSAUtil.decryptByPrivateKey(Base64.decodeBase64(eo.getPassword()), RSAUtil.PrivateKey)));
|
||||
}
|
||||
|
||||
// if (!eo.getAccount().matches("^[A-Za-z0-9]{1,20}$")){
|
||||
// return Result.error("用户名必须为≤20位的纯数字、纯字母或字母数字组合!");
|
||||
// }
|
||||
if ("admin".equals(eo.getAccount()) ||
|
||||
"root".equals(eo.getAccount()) ||
|
||||
"administrator".equals(eo.getAccount()) ||
|
||||
"test".equals(eo.getAccount()) ||
|
||||
"tester".equals(eo.getAccount())) {
|
||||
return Result.error("用户名不符合规则!");
|
||||
}
|
||||
// if (!eo.getPassword().matches("^(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])[a-zA-Z0-9]{8,16}$")){
|
||||
// return Result.error("密码必须为8-16位的大、小写字母和数字组合!");
|
||||
// }
|
||||
if (StringUtils.isNotBlank(eo.getCellPhoneNumber())) {
|
||||
if (!eo.getCellPhoneNumber().matches("^[1][3,4,5,7,8,9][0-9]{9}$")) {
|
||||
return Result.error("手机号不符合规则!");
|
||||
}
|
||||
}
|
||||
//部门 非必填 <=20字符
|
||||
if (StringUtils.isNotBlank(eo.getDepartment())) {
|
||||
if (eo.getDepartment().length() > 50) {
|
||||
return Result.error("部门不超过50字符!");
|
||||
}
|
||||
}
|
||||
|
||||
if (eo.getEmail() != null) {
|
||||
eo.setEmail(eo.getEmail().replace("amp;", ""));
|
||||
}
|
||||
|
||||
|
||||
//是新增
|
||||
if (userEOService.getUserByLoginName(eo.getAccount(), eo.getUsid()) != null) {
|
||||
return Result.error("用户名已存在!");
|
||||
}
|
||||
|
||||
|
||||
userEOService.save(eo);
|
||||
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@ApiOperation("用户启用或禁用")
|
||||
@PostMapping("/isUse/{usid}/{type}")
|
||||
public ResponseMessage isUse(@PathVariable("usid") String usid, @PathVariable("type") String type) {
|
||||
userEOService.setIsUse(usid, type);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@ApiOperation("获取所有用户")
|
||||
@GetMapping("/list")
|
||||
public ResponseMessage list(int pageNo, int pageSize, String account, String roleName) {
|
||||
IPage<Map<String, Object>> list = userEOService.list(pageNo, pageSize, account, roleName);
|
||||
list.getRecords().forEach(c -> {
|
||||
try {
|
||||
c.put("CELLPHONE_NUMBER", StringUtils.isNotEmpty(c.get("CELLPHONE_NUMBER")) ? EncryptUtil.decrypt(c.get("CELLPHONE_NUMBER").toString())
|
||||
: "");
|
||||
c.put("EMAIL", StringUtils.isNotEmpty(c.get("EMAIL")) ? EncryptUtil.decrypt(c.get("EMAIL").toString()) : "");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@ApiOperation("获取所有用户All")
|
||||
@GetMapping("/allList")
|
||||
public ResponseMessage allList( String account, String roleName) {
|
||||
List<Map<String, Object>> list = userEOService.allList(account, roleName);
|
||||
list.forEach(c -> {
|
||||
try {
|
||||
c.put("CELLPHONE_NUMBER", StringUtils.isNotEmpty(c.get("CELLPHONE_NUMBER")) ? EncryptUtil.decrypt(c.get("CELLPHONE_NUMBER").toString())
|
||||
: "");
|
||||
c.put("EMAIL", StringUtils.isNotEmpty(c.get("EMAIL")) ? EncryptUtil.decrypt(c.get("EMAIL").toString()) : "");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("删除用户")
|
||||
@PostMapping("/delete")
|
||||
public ResponseMessage delete(String ids) {
|
||||
userEOService.delete(ids);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("批量导入")
|
||||
@PostMapping("/import")
|
||||
public ResponseMessage importExcel(@RequestPart MultipartFile file) {
|
||||
InputStream is = null;
|
||||
try {
|
||||
String fileExtension = FileUtil.getFileExtension(file.getOriginalFilename());
|
||||
is = file.getInputStream();
|
||||
if (!fileExtension.endsWith("xls") && !fileExtension.endsWith("xlsx")) {
|
||||
return Result.error("请上传Excel格式文件");
|
||||
}
|
||||
ImportParams params = new ImportParams();
|
||||
|
||||
List<UserImportVO> userImportVOList = ExcelImportUtil.importExcel(file.getInputStream(), UserImportVO.class, params);
|
||||
userEOService.importExcelUser(userImportVOList);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error(e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
is.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@ApiOperation("下载模板")
|
||||
@GetMapping("/template")
|
||||
public ResponseMessage download(HttpServletResponse response) {
|
||||
|
||||
try {
|
||||
InputStream fis = Thread.currentThread().getContextClassLoader().getResourceAsStream("template/用户导入模板.xlsx");
|
||||
byte[] buffer = new byte[fis.available()];
|
||||
fis.read(buffer);
|
||||
fis.close();
|
||||
response.reset();
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode("用户导入模板.xlsx","UTF-8"));
|
||||
OutputStream toClient = new BufferedOutputStream(response.getOutputStream());
|
||||
|
||||
toClient.write(buffer);
|
||||
|
||||
toClient.flush();
|
||||
|
||||
toClient.close();
|
||||
|
||||
} catch (IOException ex) {
|
||||
|
||||
ex.printStackTrace();
|
||||
|
||||
}
|
||||
return Result.success();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.adc.da.sys.controller.ddm;
|
||||
|
||||
import com.adc.da.base.page.BasePage;
|
||||
import com.adc.da.base.web.BaseController;
|
||||
import com.adc.da.sys.entity.MenuEO;
|
||||
import com.adc.da.sys.entity.UserEO;
|
||||
import com.adc.da.sys.service.MenuEOService;
|
||||
import com.adc.da.sys.service.iservice.IUserEoService;
|
||||
import com.adc.da.sys.util.EncryptUtil;
|
||||
import com.adc.da.sys.vo.ddm.DdmMenuListVO;
|
||||
import com.adc.da.sys.vo.ddm.DdmMenuVO;
|
||||
import com.adc.da.util.http.ResponseMessage;
|
||||
import com.adc.da.util.http.Result;
|
||||
import com.adc.da.util.utils.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/${portalPath}")
|
||||
@Api(tags = {"ddm-菜单类接口"})
|
||||
public class DdmMenuEOController extends BaseController<UserEO> {
|
||||
//
|
||||
@Resource
|
||||
private MenuEOService menuEOService;
|
||||
|
||||
/**
|
||||
* 日志
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(DdmMenuEOController.class);
|
||||
|
||||
@ApiOperation("查询菜单")
|
||||
@PostMapping("/model/list.do")
|
||||
public DdmResponseMessage list( ){
|
||||
try {
|
||||
|
||||
List<MenuEO> menuEOS = menuEOService.findAll();
|
||||
List<DdmMenuListVO> ddmMenuListVOList = new ArrayList<>();
|
||||
menuEOS.forEach(menuEO -> {
|
||||
DdmMenuListVO ddmMenuListVO = new DdmMenuListVO();
|
||||
ddmMenuListVO.setModelId(menuEO.getId());
|
||||
ddmMenuListVO.setModelName(menuEO.getName());
|
||||
ddmMenuListVO.setParentModelCode(menuEO.getParentId());
|
||||
ddmMenuListVOList.add(ddmMenuListVO);
|
||||
});
|
||||
HashMap<String,Object> dataMap =new HashMap<>();
|
||||
dataMap.put("modelList",ddmMenuListVOList);
|
||||
return DdmResult.success(dataMap) ;
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("查询菜单", e);
|
||||
return DdmResult.error("查询菜单:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.adc.da.sys.controller.ddm;
|
||||
|
||||
|
||||
public class DdmResponseMessage<T> {
|
||||
private String resCode;
|
||||
private String resMsg;
|
||||
private T data;
|
||||
|
||||
public DdmResponseMessage() {
|
||||
}
|
||||
|
||||
public DdmResponseMessage(String respCode, String message,T data) {
|
||||
this.resCode = respCode;
|
||||
this.resMsg = message;
|
||||
this.data=data;
|
||||
}
|
||||
|
||||
public DdmResponseMessage(String respCode, String message) {
|
||||
this.resCode = respCode;
|
||||
this.resMsg = message;
|
||||
}
|
||||
|
||||
public String getResCode() {
|
||||
return resCode;
|
||||
}
|
||||
|
||||
public void setResCode(String resCode) {
|
||||
this.resCode = resCode;
|
||||
}
|
||||
|
||||
public String getResMsg() {
|
||||
return resMsg;
|
||||
}
|
||||
|
||||
public void setResMsg(String resMsg) {
|
||||
this.resMsg = resMsg;
|
||||
}
|
||||
|
||||
public T getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(T data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.adc.da.sys.controller.ddm;
|
||||
|
||||
public class DdmResult {
|
||||
public DdmResult() {
|
||||
}
|
||||
|
||||
|
||||
public static <T> DdmResponseMessage<T> success(String code, T t) {
|
||||
return new DdmResponseMessage(code, "success", t);
|
||||
}
|
||||
|
||||
public static <T> DdmResponseMessage<T> success( T t) {
|
||||
return success("0","success", t);
|
||||
}
|
||||
|
||||
public static <T> DdmResponseMessage<T> success() {
|
||||
return success("0","success");
|
||||
}
|
||||
|
||||
public static <T> DdmResponseMessage<T> success(String code, String message) {
|
||||
return new DdmResponseMessage(code, message);
|
||||
}
|
||||
|
||||
public static <T> DdmResponseMessage<T> success(String code, String message, T t) {
|
||||
return new DdmResponseMessage(code, message, t);
|
||||
}
|
||||
|
||||
|
||||
public static DdmResponseMessage error(String message) {
|
||||
return new DdmResponseMessage("1", message);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,327 @@
|
||||
package com.adc.da.sys.controller.ddm;
|
||||
|
||||
import com.adc.da.base.page.Pager;
|
||||
import com.adc.da.base.web.BaseController;
|
||||
import com.adc.da.sys.constant.IsBelongEnum;
|
||||
import com.adc.da.sys.dao.mysql.RoleEODao;
|
||||
import com.adc.da.sys.dao.mysql.UserEODao;
|
||||
import com.adc.da.sys.entity.RoleEO;
|
||||
import com.adc.da.sys.entity.RoleMenuEO;
|
||||
import com.adc.da.sys.entity.UserEO;
|
||||
import com.adc.da.sys.entity.UserRoleEO;
|
||||
import com.adc.da.sys.page.RoleEOPage;
|
||||
import com.adc.da.sys.page.RoleMenuEOPage;
|
||||
import com.adc.da.sys.service.MenuEOService;
|
||||
import com.adc.da.sys.service.RoleEOService;
|
||||
import com.adc.da.sys.util.EncryptUtil;
|
||||
import com.adc.da.sys.vo.MenuVO;
|
||||
import com.adc.da.sys.vo.RoleVO;
|
||||
import com.adc.da.sys.vo.UserRoleVO;
|
||||
import com.adc.da.sys.vo.ddm.*;
|
||||
import com.adc.da.util.exception.AdcDaBaseException;
|
||||
import com.adc.da.util.http.PageInfo;
|
||||
import com.adc.da.util.http.ResponseMessage;
|
||||
import com.adc.da.util.http.Result;
|
||||
import com.adc.da.util.utils.BeanMapper;
|
||||
import com.adc.da.util.utils.CollectionUtils;
|
||||
import com.adc.da.util.utils.StringUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.shiro.crypto.hash.Hash;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_UTF8_VALUE;
|
||||
|
||||
/**
|
||||
* 角色管理模块相关接口.
|
||||
* 1.分页查询
|
||||
* 2.角色详情
|
||||
* 3.角色列表
|
||||
* 4.新增角色
|
||||
* 5.修改角色
|
||||
* 6.删除角色
|
||||
* 7.配置角色菜单
|
||||
* date 2018/08/15
|
||||
*
|
||||
* @author comments created by Lee Kwanho
|
||||
* @see RoleEOService
|
||||
* @see RoleEO
|
||||
* @see RoleVO
|
||||
* @see RoleEOPage
|
||||
* @see RoleEODao
|
||||
* @see mybatis.mapper.sys
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/${portalPath}")
|
||||
@Api(tags = {"ddm-角色类接口"})
|
||||
public class DdmRoleEOController extends BaseController<RoleEO> {
|
||||
|
||||
/**
|
||||
* 日志
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(DdmRoleEOController.class);
|
||||
|
||||
/**
|
||||
* 角色相关Service
|
||||
*/
|
||||
@Resource
|
||||
private RoleEOService roleEOService;
|
||||
|
||||
@Resource
|
||||
private RoleEODao roleEODao;
|
||||
|
||||
@Resource
|
||||
private UserEODao userEODao;
|
||||
|
||||
|
||||
/**
|
||||
* dozer相关,EO间VO转换
|
||||
*/
|
||||
@Resource
|
||||
private BeanMapper beanMapper;
|
||||
|
||||
|
||||
@ApiOperation(value = "|查询角色")
|
||||
@GetMapping("/role/list.do")
|
||||
// @RequiresPermissions("sys:role:list")
|
||||
public DdmResponseMessage<HashMap<String,List<DdmRoleVO>>> list() {
|
||||
List<RoleEO> roleEOList = roleEOService.findAll();
|
||||
List<DdmRoleVO> ddmRoleVOList = new ArrayList<>();
|
||||
for (RoleEO roleEO : roleEOList) {
|
||||
DdmRoleVO ddmRoleVO = new DdmRoleVO(roleEO);
|
||||
ddmRoleVOList.add(ddmRoleVO);
|
||||
}
|
||||
HashMap<String,List<DdmRoleVO>> dataMap = new HashMap<>();
|
||||
dataMap.put("roles",ddmRoleVOList);
|
||||
return DdmResult.success(dataMap);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "|角色创建")
|
||||
@PostMapping(consumes = APPLICATION_JSON_UTF8_VALUE, value = "/role/save.do")
|
||||
// @RequiresPermissions("sys:role:save")
|
||||
public DdmResponseMessage create(@RequestBody DdmRoleCreateVO ddmRoleCreateVO) {
|
||||
if (null == ddmRoleCreateVO || StringUtils.isEmpty(ddmRoleCreateVO.getRoleName())) {
|
||||
return DdmResult.error("角色名称不能为空");
|
||||
}
|
||||
try {
|
||||
RoleEO roleEO = new RoleEO();
|
||||
roleEO.setName(ddmRoleCreateVO.getRoleName());
|
||||
roleEO.setRemarks(ddmRoleCreateVO.getRoleDesc());
|
||||
roleEO = roleEOService.save(roleEO);
|
||||
} catch (Exception e) {
|
||||
logger.error("角色创建失败:", e);
|
||||
return DdmResult.error("角色创建失败:"+e.getMessage());
|
||||
}
|
||||
return DdmResult.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "角色修改")
|
||||
@PostMapping(consumes = APPLICATION_JSON_UTF8_VALUE, value = "/role/update.do")
|
||||
// @RequiresPermissions("sys:role:update")
|
||||
public DdmResponseMessage update(@RequestBody DdmRoleVO ddmRoleVO) {
|
||||
if (null == ddmRoleVO || StringUtils.isEmpty(ddmRoleVO.getRoleName()) || StringUtils.isEmpty(ddmRoleVO.getRoleId())) {
|
||||
return DdmResult.error("角色ID和角色名称不能为空");
|
||||
}
|
||||
try {
|
||||
RoleEO roleEO = new RoleEO();
|
||||
roleEO.setId(ddmRoleVO.getRoleId());
|
||||
roleEO.setRemarks(ddmRoleVO.getRoleDesc());
|
||||
roleEO.setName(ddmRoleVO.getRoleName());
|
||||
roleEOService.updateByPrimaryKeySelective(roleEO);
|
||||
return DdmResult.success();
|
||||
} catch (Exception e) {
|
||||
logger.error("角色修改失败:", e);
|
||||
return DdmResult.error("角色修改失败:"+e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除角色,逻辑删除,若角色有对应用户则不能删除
|
||||
*/
|
||||
//todo
|
||||
@ApiOperation(value = "|角色删除")
|
||||
@PostMapping("/role/delete.do")
|
||||
// @RequiresPermissions("sys:role:delete")
|
||||
public DdmResponseMessage delete(@RequestBody HashMap<String, String> query) {
|
||||
|
||||
if (CollectionUtils.isEmpty(query) || StringUtils.isEmpty(query.get("roleCode"))) {
|
||||
return DdmResult.error("角色ID不能为空");
|
||||
}
|
||||
String roleId = query.get("roleCode");
|
||||
try {
|
||||
RoleEO roleEO = roleEOService.selectByPrimaryKey(roleId);
|
||||
if ("管理员".equals(roleEO.getName())) {
|
||||
return DdmResult.error("管理员角色不能删除");
|
||||
}
|
||||
List<UserRoleEO> list = roleEOService.getUserRoleListByRoleId(roleId);
|
||||
// 如果角色有对应用户,则不允许删除
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
return DdmResult.error("该角色有对应用户,不能删除");
|
||||
}
|
||||
roleEOService.delete(roleId);
|
||||
} catch (Exception e) {
|
||||
logger.error("删除角色失败:", e);
|
||||
return DdmResult.error("删除角色失败:"+e.getMessage());
|
||||
}
|
||||
return DdmResult.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询角色用户")
|
||||
@PostMapping("/role/queryRoleUser.do")
|
||||
public DdmResponseMessage getRoleUsers(@RequestBody DdmRoleUserQuery query) {
|
||||
List<UserRoleVO> list;
|
||||
if (null == query.getPageSize()) {
|
||||
query.setPageSize(10000);
|
||||
}
|
||||
try {
|
||||
PageInfo<UserRoleVO> userInfoPage = roleEOService.getUserInfoPageByRoleId(query);
|
||||
List<DdmUserVO> ddmUserVOList = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(userInfoPage.getList())) {
|
||||
userInfoPage.getList().forEach(userRoleVO -> {
|
||||
DdmUserVO ddmUserVO = new DdmUserVO();
|
||||
ddmUserVO.setUserId(userRoleVO.getUserId());
|
||||
ddmUserVO.setUserAccount(userRoleVO.getAccount());
|
||||
ddmUserVO.setUserName(userRoleVO.getUsname());
|
||||
ddmUserVOList.add(ddmUserVO);
|
||||
});
|
||||
}
|
||||
HashMap<String, Object> resultMap = new HashMap<>();
|
||||
resultMap.put("recordCount", userInfoPage.getCount());
|
||||
resultMap.put("recordPages", userInfoPage.getPageCount());
|
||||
resultMap.put("userList", ddmUserVOList);
|
||||
return DdmResult.success(resultMap);
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("查询角色用户失败", e);
|
||||
return DdmResult.error("查询角色用户失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation(value = "角色添加用户")
|
||||
@PostMapping("/role/roleAddUser.do")
|
||||
public DdmResponseMessage saveRoleUsers(@RequestBody DdmUserRoleAdd ddmUserRoleAdd) {
|
||||
if (null==ddmUserRoleAdd){
|
||||
return DdmResult.error("角色添加用户失败:" + "参数不能为空");
|
||||
}
|
||||
List<DdmUserRoleVO> userRoles = ddmUserRoleAdd.getUserRoles();
|
||||
try {
|
||||
userRoles.forEach(ddmUserRoleVO -> {
|
||||
//传参由用户id变成了用户账号,根绝用户id 找出account
|
||||
UserEO ddmUser = userEODao.getDdmUserEOByAccountNotDeleted(ddmUserRoleVO.getUserId());
|
||||
if (null==ddmUser){
|
||||
throw new AdcDaBaseException("角色添加用户失败:" + "用户"+ddmUserRoleVO.getUserId()+"不存在");
|
||||
}
|
||||
UserRoleEO userRoleEO = new UserRoleEO();
|
||||
userRoleEO.setRoleId(ddmUserRoleVO.getRoleId());
|
||||
userRoleEO.setUserId(ddmUser.getUsid());
|
||||
roleEOService.saveRoleUser(userRoleEO);
|
||||
});
|
||||
} catch (Exception e) {
|
||||
logger.error("角色添加用户失败", e);
|
||||
return DdmResult.error("角色添加用户失败:" + e.getMessage());
|
||||
}
|
||||
return DdmResult.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "角色删除用户")
|
||||
@PostMapping("/role/roleDelUser.do")
|
||||
public DdmResponseMessage deleteRoleUsers(@RequestBody DdmUserRolesDeleteVO ddmUserRolesDeleteVO) {
|
||||
try {
|
||||
if (null == ddmUserRolesDeleteVO || null == ddmUserRolesDeleteVO.getUserRoles()) {
|
||||
return DdmResult.error("参数不能为空");
|
||||
}
|
||||
List<DdmUserRoleVO> userRoles = ddmUserRolesDeleteVO.getUserRoles();
|
||||
|
||||
List<UserRoleEO> userRoleEOList = new ArrayList<>();
|
||||
userRoles.forEach(ddmUserRoleVO -> {
|
||||
//传参由用户id变成了用户账号,根绝用户id 找出account
|
||||
UserEO ddmUser = userEODao.getDdmUserEOByAccountNotDeleted(ddmUserRoleVO.getUserId());
|
||||
if (null==ddmUser){
|
||||
throw new AdcDaBaseException("角色删除用户失败:" + "用户"+ddmUserRoleVO.getUserId()+"不存在");
|
||||
}
|
||||
UserRoleEO userRoleEO = new UserRoleEO();
|
||||
userRoleEO.setUserId(ddmUser.getUsid());
|
||||
userRoleEO.setRoleId(ddmUserRoleVO.getRoleId());
|
||||
userRoleEOList.add(userRoleEO);
|
||||
});
|
||||
roleEOService.deleteRoleUsers(userRoleEOList);
|
||||
} catch (Exception e) {
|
||||
logger.error("角色删除用户失败", e);
|
||||
return DdmResult.error("角色删除用户失败:" + e.getMessage());
|
||||
}
|
||||
return DdmResult.success();
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "查询角色菜单")
|
||||
@PostMapping("/role/queryRoleModel.do")
|
||||
public DdmResponseMessage getRoleMenus(@RequestBody HashMap<String, String> queryMap) {
|
||||
try {
|
||||
if (CollectionUtils.isEmpty(queryMap) || StringUtils.isEmpty(queryMap.get("roleId"))) {
|
||||
return DdmResult.error("参数不能为空");
|
||||
}
|
||||
String roleId = queryMap.get("roleId");
|
||||
List<DdmMenuVO> roleMenuEOList = roleEOService.getRoleMenuInfoList(roleId);
|
||||
HashMap<String, Object> dataMap = new HashMap<>();
|
||||
dataMap.put("modelList", roleMenuEOList);
|
||||
return DdmResult.success(dataMap);
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("查询角色菜单失败", e);
|
||||
return DdmResult.error("查询角色菜单失败:" + e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ApiOperation(value = "角色添加菜单")
|
||||
@PostMapping("/role/roleAddModel.do")
|
||||
public DdmResponseMessage addRoleMenus(@RequestBody DdmRoleMenuCreate ddmRoleMenuCreate) {
|
||||
if (null==ddmRoleMenuCreate ||CollectionUtils.isEmpty( ddmRoleMenuCreate.getRoleModels())) {
|
||||
return DdmResult.error("参数不能为空");
|
||||
}
|
||||
try {
|
||||
List<DdmRoleMenuCreateVO> roleModels = ddmRoleMenuCreate.getRoleModels();
|
||||
roleEOService.saveRoleMenuByDdm(roleModels);
|
||||
return DdmResult.success();
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("角色添加菜单失败", e);
|
||||
return DdmResult.error("角色添加菜单失败:" + e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ApiOperation(value = "角色删除菜单")
|
||||
@PostMapping("/role/roleDelModel.do")
|
||||
public DdmResponseMessage deleteRoleMenus(@RequestBody DdmRoleMenuDelete ddmRoleMenuDelete) {
|
||||
try {
|
||||
if (null==ddmRoleMenuDelete ||CollectionUtils.isEmpty( ddmRoleMenuDelete.getRoleModels())) {
|
||||
return DdmResult.error("参数不能为空");
|
||||
}
|
||||
List<DdmRoleMenuCreateVO> roleModels = ddmRoleMenuDelete.getRoleModels();
|
||||
for (DdmRoleMenuCreateVO ddmRoleMenuCreateVO : roleModels) {
|
||||
/*新增角色关联*/
|
||||
roleEODao.deleteRoleMenu(ddmRoleMenuCreateVO.getRoleId(), ddmRoleMenuCreateVO.getModelId());
|
||||
}
|
||||
return DdmResult.success();
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("角色删除菜单失败", e);
|
||||
return DdmResult.error("角色删除菜单失败:" + e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.adc.da.sys.controller.ddm;
|
||||
|
||||
import com.adc.da.base.web.BaseController;
|
||||
import com.adc.da.sys.entity.UserEO;
|
||||
import com.adc.da.sys.service.iservice.IUserEoService;
|
||||
import com.adc.da.sys.util.EncryptUtil;
|
||||
import com.adc.da.sys.util.RSAUtil;
|
||||
import com.adc.da.sys.vo.UserRoleVO;
|
||||
import com.adc.da.sys.vo.UserVO;
|
||||
import com.adc.da.sys.vo.ddm.DdmUserQueryVO;
|
||||
import com.adc.da.sys.vo.ddm.DdmUserVO;
|
||||
import com.adc.da.util.http.PageInfo;
|
||||
import com.adc.da.util.http.ResponseMessage;
|
||||
import com.adc.da.util.http.Result;
|
||||
import com.adc.da.util.utils.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonParser;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/${portalPath}")
|
||||
@Api(tags = {"ddm-用户类接口"})
|
||||
@Slf4j
|
||||
public class DdmUserEOController extends BaseController<UserEO> {
|
||||
//
|
||||
@Resource
|
||||
private IUserEoService userEOService;
|
||||
|
||||
/**
|
||||
* 日志
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(DdmUserEOController.class);
|
||||
|
||||
@ApiOperation("查询用户")
|
||||
@PostMapping("/user/list.do")
|
||||
public DdmResponseMessage list(@RequestBody DdmUserQueryVO userQueryVO){
|
||||
try {
|
||||
if (null==userQueryVO.getPageSize()){
|
||||
userQueryVO.setPageSize(100000);
|
||||
}
|
||||
PageInfo<DdmUserVO> userPage = userEOService.getUserPage(userQueryVO);
|
||||
HashMap<String, Object> resultMap = new HashMap<>();
|
||||
resultMap.put("recordCount", userPage.getCount());
|
||||
resultMap.put("recordPages", userPage.getPageCount());
|
||||
resultMap.put("userList", userPage.getList());
|
||||
return DdmResult.success(resultMap);
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("查询角色用户失败", e);
|
||||
return DdmResult.error("查询角色用户失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.adc.da.sys.dao.mysql;
|
||||
|
||||
import com.adc.da.base.dao.BaseDao;
|
||||
import com.adc.da.sys.entity.MailEO;
|
||||
import com.adc.da.sys.entity.MenuEO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
|
||||
/**
|
||||
* @Author sima
|
||||
* @Date 2022/6/24 14:16
|
||||
*/
|
||||
public interface MailEODao extends BaseDao<MailEO> {
|
||||
|
||||
IPage<MailEO> list(IPage page);
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package com.adc.da.sys.dao.mysql;
|
||||
|
||||
import com.adc.da.base.dao.BaseDao;
|
||||
import com.adc.da.sys.entity.MenuEO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <br>
|
||||
* <b>功能:</b>TS_MENU MenuEODao<br>
|
||||
* <b>作者:</b>code generator<br>
|
||||
* <b>日期:</b> 2017-11-06 <br>
|
||||
* <b>版权所有:<b>版权归天津卡达克数据技术中心所有。<br>
|
||||
*
|
||||
* @author comments created by Lee Kwanho
|
||||
* @see mybatis.mapper.sys
|
||||
*/
|
||||
public interface MenuEODao extends BaseDao<MenuEO> {
|
||||
|
||||
/**
|
||||
* 获取所有的菜单
|
||||
*
|
||||
* @return 所有菜单
|
||||
*/
|
||||
List<MenuEO> findAll();
|
||||
|
||||
/**
|
||||
* 获取角色对应的所有菜单
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 角色对应的所有菜单
|
||||
*/
|
||||
List<MenuEO> listMenuEOByRoleID(String roleId);
|
||||
|
||||
/**
|
||||
* 获取用户的所有菜单
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 用户的所有菜单
|
||||
*/
|
||||
List<MenuEO> listMenuEOByUserId(String userId);
|
||||
|
||||
|
||||
/**
|
||||
* 获取当前节点的所有子节点
|
||||
*
|
||||
* @param parentId 当前节点
|
||||
* @return 返回所有子节点
|
||||
*/
|
||||
List<MenuEO> getChildMenus(String parentId);
|
||||
|
||||
/**
|
||||
* 逻辑删除所有菜单
|
||||
*
|
||||
* @param ids 菜单ID
|
||||
*/
|
||||
void deleteMenuLogic(String[] ids);
|
||||
|
||||
void deleteMenuByParentId(@Param("pId")String pId);
|
||||
|
||||
/**
|
||||
* 删除角色与当前菜单以及子菜单关系
|
||||
*
|
||||
* @param ids 菜单id组
|
||||
*/
|
||||
void deleteRoleMenus(String[] ids);
|
||||
|
||||
/**
|
||||
* 判定菜单是否属于角色
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @param menuId 菜单ID
|
||||
* @return 如果>0说明存在记录,菜单属于角色
|
||||
*/
|
||||
int isBelong(@Param("roleId") String roleId, @Param("menuId") String menuId);
|
||||
|
||||
/**
|
||||
* Dao 根据菜单名进行菜单查询,返回关联菜单以及父级菜单信息
|
||||
*
|
||||
* @param menuName 菜单名
|
||||
* @return 查询结果
|
||||
* @author Lee Kwanho 李坤澔
|
||||
* date 2018-08-22
|
||||
**/
|
||||
List<MenuEO> listMenuEOByMenuName(@Param("menuName") String menuName);
|
||||
|
||||
|
||||
int queryConflict(@Param("name") String name ,@Param("id") String id , @Param("parentId") String parentId);
|
||||
|
||||
List<String> findIndustryAll();
|
||||
|
||||
List<String> listIndustryByUserId(String userId);
|
||||
|
||||
List<MenuEO> listMenuEOByMenuIds(@Param("ids") List<String> ids);
|
||||
|
||||
List<MenuEO> listMenuEOByRoleId(@Param("roleId")String roleId);
|
||||
|
||||
// String queryInformation();
|
||||
//
|
||||
// int updateInformation(@Param("information") String information);
|
||||
//
|
||||
// int insertInformation(@Param("information") String information );
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
package com.adc.da.sys.dao.mysql;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.adc.da.sys.vo.UserRoleVO;
|
||||
import com.adc.da.sys.vo.ddm.DdmRoleUserQuery;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.adc.da.base.dao.BaseDao;
|
||||
import com.adc.da.sys.entity.RoleEO;
|
||||
import com.adc.da.sys.entity.UserRoleEO;
|
||||
|
||||
/**
|
||||
* <br>
|
||||
* <b>功能:</b>TS_ROLE RoleEODao<br>
|
||||
* <b>作者:</b>code generator<br>
|
||||
* <b>日期:</b> 2017-11-06 <br>
|
||||
* <b>版权所有:<b>版权归天津卡达克数据技术中心所有。<br>
|
||||
*
|
||||
* @author comments created by Lee Kwanho
|
||||
* @see mybatis.mapper.sys
|
||||
*/
|
||||
public interface RoleEODao extends BaseDao<RoleEO> {
|
||||
|
||||
/**
|
||||
* 保存角色信息
|
||||
*
|
||||
* @param sysRoleEO 角色信息
|
||||
*/
|
||||
void save(RoleEO sysRoleEO);
|
||||
|
||||
/**
|
||||
* 获取角色菜单
|
||||
*
|
||||
* @param id 角色id
|
||||
* @return 角色菜单
|
||||
*/
|
||||
RoleEO getRoleWithMenus(String id);
|
||||
|
||||
/**
|
||||
* 获取角色信息,可能有多角色
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @return 角色列表
|
||||
*/
|
||||
List<RoleEO> getRoleListByUserId(String userId);
|
||||
|
||||
/**
|
||||
* 删除角色
|
||||
*
|
||||
* @param roleId 角色id
|
||||
*/
|
||||
void deleteLogic(String roleId);
|
||||
|
||||
/**
|
||||
* 删除角色菜单关联
|
||||
*
|
||||
* @param roleId 角色id
|
||||
*/
|
||||
void deleteRoleMenuByRoleId(String roleId);
|
||||
|
||||
/**
|
||||
* 获取所有角色
|
||||
*
|
||||
* @return 全角色信息
|
||||
*/
|
||||
List<RoleEO> findAll();
|
||||
|
||||
/**
|
||||
* 查询角色所对应的用户
|
||||
*
|
||||
* @param roleId 角色id
|
||||
* @return 用户列表
|
||||
*/
|
||||
List<UserRoleEO> getUserRoleListByRoleId(String roleId);
|
||||
|
||||
/**
|
||||
* 获取菜单id组 , 用角色id
|
||||
*
|
||||
* @param roleId 角色id
|
||||
* @return 菜单id组
|
||||
*/
|
||||
List<String> getMenuIdListByRoleId(String roleId);
|
||||
|
||||
/**
|
||||
* 新增角色菜单关联
|
||||
*
|
||||
* @param roleId 角色id
|
||||
* @param menuId 菜单id
|
||||
*/
|
||||
void saveRoleMenu(@Param("roleId") String roleId, @Param("menuId") String menuId);
|
||||
|
||||
/**
|
||||
* 删除角色菜单关联
|
||||
*
|
||||
* @param roleId 角色id
|
||||
* @param menuId 菜单id
|
||||
*/
|
||||
void deleteRoleMenu(@Param("roleId") String roleId, @Param("menuId") String menuId);
|
||||
|
||||
/**
|
||||
* 判断角色是否属于相应用户
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @param roleId 角色id
|
||||
* @return 若属于返回1 ,否则返回0
|
||||
*/
|
||||
int isBelong(@Param("userId") String userId, @Param("roleId") String roleId);
|
||||
|
||||
List<RoleEO> getRoleByCode(String roleCode);
|
||||
|
||||
String getpidByMenuId(@Param("id") String id);
|
||||
|
||||
List<UserRoleVO> getUserInfoListByRoleId(@Param("roleId") String roleId);
|
||||
|
||||
IPage<UserRoleVO> getUserInfoPageByRoleId(IPage page,String roleId);
|
||||
|
||||
Long getUserCountByRoleId(@Param("roleId") String roleId);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.adc.da.sys.dao.mysql;
|
||||
|
||||
import com.adc.da.base.dao.BaseDao;
|
||||
import com.adc.da.sys.entity.MenuEO;
|
||||
import com.adc.da.sys.entity.RoleHomeEO;
|
||||
import com.adc.da.sys.entity.RoleMenuEO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* <br>
|
||||
* <b>功能:</b>TR_ROLE_MENU RoleMenuEODao<br>
|
||||
* <b>作者:</b>code generator<br>
|
||||
* <b>日期:</b> 2019-09-02 <br>
|
||||
* <b>版权所有:<b>版权归北京卡达克数据技术中心所有。<br>
|
||||
*/
|
||||
public interface RoleHomeEODao extends BaseMapper<RoleHomeEO> {
|
||||
|
||||
void insertRoleHomeBatch(@Param("rhList")List<RoleMenuEO> list);
|
||||
|
||||
List<MenuEO> getHomeListByRoleId(@Param("roleId")String roleId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.adc.da.sys.dao.mysql;
|
||||
|
||||
import com.adc.da.base.dao.BaseDao;
|
||||
import com.adc.da.sys.entity.RoleEO;
|
||||
import com.adc.da.sys.entity.RoleMenuEO;
|
||||
import com.adc.da.sys.vo.ddm.DdmMenuVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <br>
|
||||
* <b>功能:</b>TR_ROLE_MENU RoleMenuEODao<br>
|
||||
* <b>作者:</b>code generator<br>
|
||||
* <b>日期:</b> 2019-09-02 <br>
|
||||
* <b>版权所有:<b>版权归北京卡达克数据技术中心所有。<br>
|
||||
*/
|
||||
public interface RoleMenuEODao extends BaseDao<RoleMenuEO> {
|
||||
|
||||
List<RoleMenuEO> getRoleMenuList(@Param("roleId") String roleId);
|
||||
|
||||
List<DdmMenuVO> getRoleMenuInfoList(@Param("roleId") String roleId);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.adc.da.sys.dao.mysql;
|
||||
|
||||
import com.adc.da.base.dao.BaseDao;
|
||||
import com.adc.da.sys.entity.RoleOrgEO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* <br>
|
||||
* <b>功能:</b>TR_ROLE_ORG RoleOrgEODao<br>
|
||||
* <b>作者:</b>Wei Jinjin<br>
|
||||
* <b>日期:</b> 2019-10-28 <br>
|
||||
* <b>版权所有:<b>版权归北京卡达克数据技术中心所有。<br>
|
||||
*/
|
||||
public interface RoleOrgEODao extends BaseDao<RoleOrgEO> {
|
||||
|
||||
/**
|
||||
* 删除角色组织机构关联
|
||||
*/
|
||||
void deleteRoleOrgByRoleId(String roleId);
|
||||
|
||||
/**
|
||||
* 根据角色ID,获取部门ID列表
|
||||
*/
|
||||
List<String> queryOrgIdList(String[] roleIds);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.adc.da.sys.dao.mysql;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.adc.da.sys.vo.ddm.DdmUserQueryVO;
|
||||
import com.adc.da.sys.vo.ddm.DdmUserVO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.adc.da.sys.entity.UserEO;
|
||||
|
||||
/**
|
||||
* <br>
|
||||
* <b>功能:</b>TS_USER UserEODao<br>
|
||||
* <b>作者:</b>code generator<br>
|
||||
* <b>日期:</b> 2017-12-18 <br>
|
||||
* <b>版权所有:<b>版权归天津卡达克数据技术中心所有。<br>
|
||||
*
|
||||
* @author comments created by Lee Kwanho
|
||||
* @see mybatis.mapper.sys
|
||||
*/
|
||||
public interface UserEODao extends BaseMapper<UserEO> {
|
||||
|
||||
IPage<Map<String, Object>> list(IPage page, @Param("account") String account, @Param("roleName") String roleName);
|
||||
|
||||
/**
|
||||
* 查询用户及用户所对应的角色
|
||||
*
|
||||
* @param id 用户id
|
||||
* @return 用户信息
|
||||
*/
|
||||
UserEO getUserWithRoles(String id);
|
||||
|
||||
// 根据account获取未逻辑删除的UserEO
|
||||
UserEO getUserEOByAccountNotDeleted(String account);
|
||||
|
||||
IPage<DdmUserVO> getUserPage(IPage page, @Param("userAccount") String account, @Param("userName") String userName);
|
||||
|
||||
Long getUserCount(DdmUserQueryVO ddmUserQueryVO);
|
||||
|
||||
int insertUserBatch(@Param("userEOList") List<UserEO> userEOList);
|
||||
|
||||
UserEO getDdmUserEOByAccountNotDeleted(String account);
|
||||
|
||||
List<Map<String, Object>> allList( @Param("account") String account, @Param("roleName") String roleName);
|
||||
|
||||
List<UserEO> getUserByMail(@Param("mailList") List<String> mailList);
|
||||
|
||||
List<UserEO> getUserByAccount(@Param("accountList") List<String> accountList);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.adc.da.sys.dao.mysql;
|
||||
|
||||
import com.adc.da.base.dao.BaseDao;
|
||||
import com.adc.da.sys.entity.UserRoleEO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <br>
|
||||
* <b>功能:</b>TR_USER_ROLE UserRoleEODao<br>
|
||||
* <b>作者:</b>code generator<br>
|
||||
* <b>日期:</b> 2017-11-07 <br>
|
||||
* <b>版权所有:<b>版权归天津卡达克数据技术中心所有。<br>
|
||||
*
|
||||
* @see mybatis.mapper.sys
|
||||
*/
|
||||
public interface UserRoleEODao extends BaseMapper<UserRoleEO> {
|
||||
|
||||
public int insertBatch(@Param("userRoleEOList") List<UserRoleEO> userRoleEOList);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.adc.da.sys.entity;
|
||||
|
||||
import com.adc.da.base.entity.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author sima
|
||||
* @Date 2022/6/24 14:10
|
||||
*/
|
||||
@Data
|
||||
public class MailEO extends BaseEntity {
|
||||
|
||||
String id;
|
||||
String toMail;//收件人邮箱
|
||||
String ccMail;//抄送人
|
||||
String subject ;// 邮件主题
|
||||
String content ;// 邮件正文
|
||||
Date sendDate;
|
||||
String strSendDate;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
package com.adc.da.sys.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.adc.da.base.entity.TreeEntity;
|
||||
|
||||
/**
|
||||
* <b>功能:</b>TS_MENU MenuEOEntity<br>
|
||||
* <p>
|
||||
* <b>日期:</b> 2017-12-21 <br>
|
||||
* <b>版权所有:<b>版权归天津卡达克数据技术中心所有。<br>
|
||||
* <p>字段列表:</p>
|
||||
* <li>extInfo -> ext_info</li>
|
||||
* <li>sort -> sort</li>
|
||||
* <li>remarks -> remarks</li>
|
||||
* <li>permission -> permission</li>
|
||||
* <li>isShow -> is_show</li>
|
||||
* <li>icon -> icon</li>
|
||||
* <li>href -> href</li>
|
||||
* <li>parentIds -> parent_ids</li>
|
||||
* <li>parentId -> parent_id</li>
|
||||
* <li>name -> name</li>
|
||||
* <li>delFlag -> del_flag</li>
|
||||
* <li>id -> id</li>
|
||||
*
|
||||
* @author comments created by Lee Kwanho
|
||||
* date 2018-08-17
|
||||
* @see com.adc.da.sys.controller.MenuEOController
|
||||
*/
|
||||
public class MenuEO extends TreeEntity implements Serializable {
|
||||
private static final long serialVersionUID = 2497292638985614077L;
|
||||
|
||||
/**
|
||||
* 路径,网页路径
|
||||
*/
|
||||
private String href;
|
||||
|
||||
/**
|
||||
* 图标
|
||||
*/
|
||||
private String icon;
|
||||
|
||||
|
||||
private String iconHref;
|
||||
|
||||
|
||||
private String iconClick;
|
||||
|
||||
|
||||
|
||||
private String iconClickHref;
|
||||
|
||||
/**
|
||||
* 排序字段
|
||||
*/
|
||||
private String sort;
|
||||
|
||||
/**
|
||||
* 是否显示
|
||||
*/
|
||||
private Integer isShow;
|
||||
|
||||
/**
|
||||
* 权限
|
||||
*/
|
||||
private String permission;
|
||||
|
||||
/**
|
||||
* 说明
|
||||
*/
|
||||
private String remarks;
|
||||
|
||||
/**
|
||||
* 以下为扩展字段-保留字段
|
||||
*/
|
||||
private String extInfo;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private String isUrl;
|
||||
|
||||
public String getIsUrl() {
|
||||
return isUrl;
|
||||
}
|
||||
|
||||
public void setIsUrl(String isUrl) {
|
||||
this.isUrl = isUrl;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getExtInfo() {
|
||||
return this.extInfo;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setExtInfo(String extInfo) {
|
||||
this.extInfo = extInfo;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getSort() {
|
||||
return this.sort;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setSort(String sort) {
|
||||
this.sort = sort;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getRemarks() {
|
||||
return this.remarks;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setRemarks(String remarks) {
|
||||
this.remarks = remarks;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getPermission() {
|
||||
return this.permission;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setPermission(String permission) {
|
||||
this.permission = permission;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public Integer getIsShow() {
|
||||
return this.isShow;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setIsShow(Integer isShow) {
|
||||
this.isShow = isShow;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getIcon() {
|
||||
return this.icon;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setIcon(String icon) {
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getHref() {
|
||||
return this.href;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setHref(String href) {
|
||||
this.href = href;
|
||||
}
|
||||
|
||||
public String getIconHref() {
|
||||
return iconHref;
|
||||
}
|
||||
|
||||
public void setIconHref(String iconHref) {
|
||||
this.iconHref = iconHref;
|
||||
}
|
||||
|
||||
public String getIconClick() {
|
||||
return iconClick;
|
||||
}
|
||||
|
||||
public void setIconClick(String iconClick) {
|
||||
this.iconClick = iconClick;
|
||||
}
|
||||
|
||||
public String getIconClickHref() {
|
||||
return iconClickHref;
|
||||
}
|
||||
|
||||
public void setIconClickHref(String iconClickHref) {
|
||||
this.iconClickHref = iconClickHref;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.adc.da.sys.entity;
|
||||
|
||||
import com.adc.da.base.entity.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <b>功能:</b>TS_USER UserEOEntity<br>
|
||||
* <b>日期:</b> 2017-12-18 <br>
|
||||
* <b>版权所有:<b>版权归天津卡达克数据技术中心所有。<br>
|
||||
* <p>字段列表:</p>
|
||||
* <li>extInfo -> ext_info</li>
|
||||
* <li>usname -> usname</li>
|
||||
* <li>password -> password</li>
|
||||
* <li>delFlag -> del_flag</li>
|
||||
* <li>account -> account</li>
|
||||
* <li>usid -> usid</li>
|
||||
*
|
||||
* @author comments created by Lee Kwanho
|
||||
* date 2018-08-16
|
||||
* @see com.adc.da.sys.controller.UserEOController
|
||||
*/
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@TableName("TS_OPEN_USER")
|
||||
public class OpenUserEO extends BaseEntity implements Serializable {
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@TableId(value = "ID",type =IdType.INPUT)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@TableId(value = "APP_ID")
|
||||
private String appId;
|
||||
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
|
||||
@TableField("APP_SECRET")
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 删除标记
|
||||
*/
|
||||
@TableField("DEL_FLAG")
|
||||
private Integer delFlag;
|
||||
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField("CREATE_TIME")
|
||||
private String createTime;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField("UPDATE_TIME")
|
||||
private String updateTime;
|
||||
|
||||
|
||||
@TableField("USNAME")
|
||||
private String usname;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,204 @@
|
||||
package com.adc.da.sys.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.adc.da.base.entity.BaseEntity;
|
||||
|
||||
/**
|
||||
* <b>功能:</b>TS_ROLE RoleEOEntity<br>
|
||||
* <p>
|
||||
* <b>日期:</b> 2017-12-21 <br>
|
||||
* <b>版权所有:<b>版权归天津卡达克数据技术中心所有。<br>
|
||||
* java字段名转换为原始数据库列名。<b>如果不存在则返回null</b><br>
|
||||
* <p>字段列表:</p>
|
||||
* <li>isDefault -> is_default</li>
|
||||
* <li>delFlag -> del_flag</li>
|
||||
* <li>dataScope -> data_scope</li>
|
||||
* <li>id -> id</li>
|
||||
* <li>extInfo -> ext_info</li>
|
||||
* <li>remarks -> remarks</li>
|
||||
* <li>name -> name</li>
|
||||
*
|
||||
* @author comments created by Lee Kwanho
|
||||
* date 2018-08-17
|
||||
* @see com.adc.da.sys.controller.RoleEOController
|
||||
*/
|
||||
public class RoleEO extends BaseEntity implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -1386892031737294731L;
|
||||
|
||||
/**
|
||||
*默认字段
|
||||
*/
|
||||
private Integer isDefault;
|
||||
|
||||
/**
|
||||
* 删除标识
|
||||
*/
|
||||
private Integer delFlag;
|
||||
|
||||
/**
|
||||
* 角色用户数
|
||||
*/
|
||||
private Integer dataScope;
|
||||
|
||||
/**
|
||||
* 角色id
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 标识
|
||||
*/
|
||||
private String remarks;
|
||||
|
||||
/**
|
||||
* 角色名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/* 以下为扩展字段 */
|
||||
|
||||
/**
|
||||
* 拓展字段
|
||||
*/
|
||||
private String extInfo;
|
||||
|
||||
private String extInfo2;
|
||||
|
||||
private String extInfo3;
|
||||
|
||||
private String extInfo4;
|
||||
|
||||
private String extInfo5;
|
||||
|
||||
/**
|
||||
* 菜单列表
|
||||
*/
|
||||
private List<MenuEO> menuEOList = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 菜单id列表
|
||||
*/
|
||||
private List<String> menuEOIdList = new ArrayList<>();
|
||||
|
||||
/** **/
|
||||
public Integer getIsDefault() {
|
||||
return this.isDefault;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setIsDefault(Integer isDefault) {
|
||||
this.isDefault = isDefault;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public Integer getDelFlag() {
|
||||
return this.delFlag;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setDelFlag(Integer delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public Integer getDataScope() {
|
||||
return this.dataScope;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setDataScope(Integer dataScope) {
|
||||
this.dataScope = dataScope;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getExtInfo() {
|
||||
return this.extInfo;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setExtInfo(String extInfo) {
|
||||
this.extInfo = extInfo;
|
||||
}
|
||||
|
||||
public String getExtInfo2() {
|
||||
return extInfo2;
|
||||
}
|
||||
|
||||
public void setExtInfo2(String extInfo2) {
|
||||
this.extInfo2 = extInfo2;
|
||||
}
|
||||
|
||||
public String getExtInfo3() {
|
||||
return extInfo3;
|
||||
}
|
||||
|
||||
public void setExtInfo3(String extInfo3) {
|
||||
this.extInfo3 = extInfo3;
|
||||
}
|
||||
|
||||
public String getExtInfo4() {
|
||||
return extInfo4;
|
||||
}
|
||||
|
||||
public void setExtInfo4(String extInfo4) {
|
||||
this.extInfo4 = extInfo4;
|
||||
}
|
||||
|
||||
public String getExtInfo5() {
|
||||
return extInfo5;
|
||||
}
|
||||
|
||||
public void setExtInfo5(String extInfo5) {
|
||||
this.extInfo5 = extInfo5;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getRemarks() {
|
||||
return this.remarks;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setRemarks(String remarks) {
|
||||
this.remarks = remarks;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public List<MenuEO> getMenuEOList() {
|
||||
return menuEOList;
|
||||
}
|
||||
|
||||
public void setMenuEOList(List<MenuEO> menuEOList) {
|
||||
this.menuEOList = menuEOList;
|
||||
}
|
||||
|
||||
public List<String> getMenuEOIdList() {
|
||||
return menuEOIdList;
|
||||
}
|
||||
|
||||
public void setMenuEOIdList(List<String> menuEOIdList) {
|
||||
this.menuEOIdList = menuEOIdList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.adc.da.sys.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author doudxw
|
||||
* @Date 2022/3/11 09:33
|
||||
*/
|
||||
@Data
|
||||
@TableName("TR_ROLE_HOME")
|
||||
public class RoleHomeEO {
|
||||
|
||||
@TableField("ROLEID")
|
||||
private String roleId;
|
||||
|
||||
@TableField("MENUID")
|
||||
private String menuId;
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.adc.da.sys.entity;
|
||||
|
||||
import com.adc.da.base.entity.BaseEntity;
|
||||
|
||||
|
||||
/**
|
||||
* <b>功能:</b>TR_ROLE_MENU RoleMenuEOEntity<br>
|
||||
* <b>作者:</b>code generator<br>
|
||||
* <b>日期:</b> 2019-09-02 <br>
|
||||
* <b>版权所有:<b>版权归北京卡达克数据技术中心所有。<br>
|
||||
*/
|
||||
public class RoleMenuEO extends BaseEntity {
|
||||
|
||||
private String roleId;
|
||||
private String menuId;
|
||||
|
||||
/**
|
||||
* java字段名转换为原始数据库列名。<b>如果不存在则返回null</b><br>
|
||||
* <p>字段列表:</p>
|
||||
* <li>roleId -> role_id</li>
|
||||
* <li>menuId -> menu_id</li>
|
||||
*/
|
||||
public static String fieldToColumn(String fieldName) {
|
||||
if (fieldName == null) { return null; }
|
||||
switch (fieldName) {
|
||||
case "roleId": return "role_id";
|
||||
case "menuId": return "menu_id";
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 原始数据库列名转换为java字段名。<b>如果不存在则返回null</b><br>
|
||||
* <p>字段列表:</p>
|
||||
* <li>role_id -> roleId</li>
|
||||
* <li>menu_id -> menuId</li>
|
||||
*/
|
||||
public static String columnToField(String columnName) {
|
||||
if (columnName == null) { return null; }
|
||||
switch (columnName) {
|
||||
case "role_id": return "roleId";
|
||||
case "menu_id": return "menuId";
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getRoleId() {
|
||||
return this.roleId;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setRoleId(String roleId) {
|
||||
this.roleId = roleId;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getMenuId() {
|
||||
return this.menuId;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setMenuId(String menuId) {
|
||||
this.menuId = menuId;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.adc.da.sys.entity;
|
||||
|
||||
import com.adc.da.base.entity.BaseEntity;
|
||||
|
||||
|
||||
/**
|
||||
* <b>功能:</b>TR_ROLE_ORG RoleOrgEOEntity<br>
|
||||
* <b>作者:</b>code generator<br>
|
||||
* <b>日期:</b> 2019-10-28 <br>
|
||||
* <b>版权所有:<b>版权归北京卡达克数据技术中心所有。<br>
|
||||
*/
|
||||
public class RoleOrgEO extends BaseEntity {
|
||||
|
||||
private String roleId;
|
||||
private String orgId;
|
||||
|
||||
/**
|
||||
* java字段名转换为原始数据库列名。<b>如果不存在则返回null</b><br>
|
||||
* <p>字段列表:</p>
|
||||
* <li>roleId -> role_id</li>
|
||||
* <li>orgId -> org_id</li>
|
||||
*/
|
||||
public static String fieldToColumn(String fieldName) {
|
||||
if (fieldName == null) { return null; }
|
||||
switch (fieldName) {
|
||||
case "roleId": return "role_id";
|
||||
case "orgId": return "org_id";
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 原始数据库列名转换为java字段名。<b>如果不存在则返回null</b><br>
|
||||
* <p>字段列表:</p>
|
||||
* <li>role_id -> roleId</li>
|
||||
* <li>org_id -> orgId</li>
|
||||
*/
|
||||
public static String columnToField(String columnName) {
|
||||
if (columnName == null) { return null; }
|
||||
switch (columnName) {
|
||||
case "role_id": return "roleId";
|
||||
case "org_id": return "orgId";
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getRoleId() {
|
||||
return this.roleId;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setRoleId(String roleId) {
|
||||
this.roleId = roleId;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getOrgId() {
|
||||
return this.orgId;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setOrgId(String orgId) {
|
||||
this.orgId = orgId;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
package com.adc.da.sys.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.adc.da.base.entity.BaseEntity;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* <b>功能:</b>TS_USER UserEOEntity<br>
|
||||
* <b>日期:</b> 2017-12-18 <br>
|
||||
* <b>版权所有:<b>版权归天津卡达克数据技术中心所有。<br>
|
||||
* <p>字段列表:</p>
|
||||
* <li>extInfo -> ext_info</li>
|
||||
* <li>usname -> usname</li>
|
||||
* <li>password -> password</li>
|
||||
* <li>delFlag -> del_flag</li>
|
||||
* <li>account -> account</li>
|
||||
* <li>usid -> usid</li>
|
||||
*
|
||||
* @author comments created by Lee Kwanho
|
||||
* date 2018-08-16
|
||||
* @see com.adc.da.sys.controller.UserEOController
|
||||
*/
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@TableName("TS_USER")
|
||||
public class UserEO extends BaseEntity implements Serializable {
|
||||
private static final long serialVersionUID = 3658632939727891047L;
|
||||
|
||||
|
||||
/**
|
||||
* 区分本系统自建用户和同步过来的用户
|
||||
* 1代表本系统自建用户
|
||||
* 0代表同步过来的用户
|
||||
*/
|
||||
@TableField("ISSELF")
|
||||
private String isSelf;
|
||||
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@TableId(value = "USID",type =IdType.INPUT)
|
||||
private String usid;
|
||||
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
|
||||
@TableField("PASSWORD")
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 删除标记
|
||||
*/
|
||||
@TableField("DEL_FLAG")
|
||||
private Integer delFlag;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
@TableField("ACCOUNT")
|
||||
private String account;
|
||||
|
||||
|
||||
/**
|
||||
* 手机号码
|
||||
*/
|
||||
@TableField("CELLPHONE_NUMBER")
|
||||
private String cellPhoneNumber;
|
||||
|
||||
/**
|
||||
* 电子邮件
|
||||
*/
|
||||
@TableField("EMAIL")
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField("CREATE_TIME")
|
||||
private String createTime;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField("UPDATE_TIME")
|
||||
private String updateTime;
|
||||
|
||||
|
||||
@TableField("ISUSE")
|
||||
private String isUse;
|
||||
|
||||
|
||||
@TableField("DEPARTMENT")
|
||||
private String department;
|
||||
|
||||
|
||||
@TableField("USNAME")
|
||||
private String usname;
|
||||
|
||||
|
||||
/**
|
||||
* 角色ID列表
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private List<String> roleIdList = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 角色EO列表
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private List<RoleEO> roleEOList = new ArrayList<>();
|
||||
|
||||
@TableField(exist = false)
|
||||
private String roleId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.adc.da.sys.entity;
|
||||
|
||||
import com.adc.da.base.entity.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* <b>功能:</b>TR_USER_ROLE UserRoleEOEntity<br>
|
||||
* <b>作者:</b>code generator<br>
|
||||
* <b>日期:</b> 2017-11-07 <br>
|
||||
* <b>版权所有:<b>版权归天津卡达克数据技术中心所有。<br>
|
||||
* <p>字段列表:</p>
|
||||
* <li>userId -> user_id</li>
|
||||
* <li>roleId -> role_id</li>
|
||||
* @author comments created by Lee Kwanho
|
||||
* date 2018-08-16
|
||||
*/
|
||||
@Data
|
||||
@TableName("TR_USER_ROLE")
|
||||
public class UserRoleEO extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@TableField("USER_ID")
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 角色id
|
||||
*/
|
||||
@TableField("ROLE_ID")
|
||||
private String roleId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
package com.adc.da.sys.page;
|
||||
|
||||
import com.adc.da.base.page.BasePage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class DicTypeEOPage extends BasePage {
|
||||
private String id;
|
||||
|
||||
private String idOperator = "=";
|
||||
|
||||
private String dicTypeCode;
|
||||
|
||||
private String dicTypeCodeOperator = "=";
|
||||
|
||||
private String dicTypeName;
|
||||
|
||||
private String dicTypeNameOperator = "=";
|
||||
|
||||
private String dicId;
|
||||
|
||||
private String dicIdOperator = "=";
|
||||
|
||||
private Integer delFlag;
|
||||
|
||||
private String delFlagOperator = "=";
|
||||
|
||||
private List<String> dicIdList ;
|
||||
|
||||
public List<String> getDicIdList() {
|
||||
return dicIdList;
|
||||
}
|
||||
|
||||
public void setDicIdList(List<String> dicIdList) {
|
||||
this.dicIdList = dicIdList;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getIdOperator() {
|
||||
return idOperator;
|
||||
}
|
||||
|
||||
public void setIdOperator(String idOperator) {
|
||||
this.idOperator = idOperator;
|
||||
}
|
||||
|
||||
public String getDicTypeCode() {
|
||||
return dicTypeCode;
|
||||
}
|
||||
|
||||
public void setDicTypeCode(String dicTypeCode) {
|
||||
this.dicTypeCode = dicTypeCode;
|
||||
}
|
||||
|
||||
public String getDicTypeCodeOperator() {
|
||||
return dicTypeCodeOperator;
|
||||
}
|
||||
|
||||
public void setDicTypeCodeOperator(String dicTypeCodeOperator) {
|
||||
this.dicTypeCodeOperator = dicTypeCodeOperator;
|
||||
}
|
||||
|
||||
public String getDicTypeName() {
|
||||
return dicTypeName;
|
||||
}
|
||||
|
||||
public void setDicTypeName(String dicTypeName) {
|
||||
this.dicTypeName = dicTypeName;
|
||||
}
|
||||
|
||||
public String getDicTypeNameOperator() {
|
||||
return dicTypeNameOperator;
|
||||
}
|
||||
|
||||
public void setDicTypeNameOperator(String dicTypeNameOperator) {
|
||||
this.dicTypeNameOperator = dicTypeNameOperator;
|
||||
}
|
||||
|
||||
public String getDicId() {
|
||||
return dicId;
|
||||
}
|
||||
|
||||
public void setDicId(String dicId) {
|
||||
this.dicId = dicId;
|
||||
}
|
||||
|
||||
public String getDicIdOperator() {
|
||||
return dicIdOperator;
|
||||
}
|
||||
|
||||
public void setDicIdOperator(String dicIdOperator) {
|
||||
this.dicIdOperator = dicIdOperator;
|
||||
}
|
||||
|
||||
public Integer getDelFlag() {
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public void setDelFlag(Integer delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getDelFlagOperator() {
|
||||
return delFlagOperator;
|
||||
}
|
||||
|
||||
public void setDelFlagOperator(String delFlagOperator) {
|
||||
this.delFlagOperator = delFlagOperator;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package com.adc.da.sys.page;
|
||||
|
||||
import com.adc.da.base.page.BasePage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author comments by Lee Kwanho
|
||||
* date 2018-08-16
|
||||
*/
|
||||
public class DictionaryEOPage extends BasePage {
|
||||
private String id;
|
||||
|
||||
private String idOperator = "=";
|
||||
|
||||
private String dictionaryCode;
|
||||
|
||||
private String dictionaryCodeOperator = "=";
|
||||
|
||||
private String dictionaryName;
|
||||
|
||||
private String dictionaryNameOperator = "=";
|
||||
|
||||
private Integer delFlag;
|
||||
|
||||
private String delFlagOperator = "=";
|
||||
|
||||
private List<String> dicIdList ;
|
||||
|
||||
public List<String> getDicIdList() {
|
||||
return dicIdList;
|
||||
}
|
||||
|
||||
public void setDicIdList(List<String> dicIdList) {
|
||||
this.dicIdList = dicIdList;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getIdOperator() {
|
||||
return idOperator;
|
||||
}
|
||||
|
||||
public void setIdOperator(String idOperator) {
|
||||
this.idOperator = idOperator;
|
||||
}
|
||||
|
||||
public String getDictionaryCode() {
|
||||
return dictionaryCode;
|
||||
}
|
||||
|
||||
public void setDictionaryCode(String dictionaryCode) {
|
||||
this.dictionaryCode = dictionaryCode;
|
||||
}
|
||||
|
||||
public String getDictionaryCodeOperator() {
|
||||
return dictionaryCodeOperator;
|
||||
}
|
||||
|
||||
public void setDictionaryCodeOperator(String dictionaryCodeOperator) {
|
||||
this.dictionaryCodeOperator = dictionaryCodeOperator;
|
||||
}
|
||||
|
||||
public String getDictionaryName() {
|
||||
return dictionaryName;
|
||||
}
|
||||
|
||||
public void setDictionaryName(String dictionaryName) {
|
||||
this.dictionaryName = dictionaryName;
|
||||
}
|
||||
|
||||
public String getDictionaryNameOperator() {
|
||||
return dictionaryNameOperator;
|
||||
}
|
||||
|
||||
public void setDictionaryNameOperator(String dictionaryNameOperator) {
|
||||
this.dictionaryNameOperator = dictionaryNameOperator;
|
||||
}
|
||||
|
||||
public Integer getDelFlag() {
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public void setDelFlag(Integer delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getDelFlagOperator() {
|
||||
return delFlagOperator;
|
||||
}
|
||||
|
||||
public void setDelFlagOperator(String delFlagOperator) {
|
||||
this.delFlagOperator = delFlagOperator;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,213 @@
|
||||
package com.adc.da.sys.page;
|
||||
|
||||
import com.adc.da.base.page.BasePage;
|
||||
|
||||
|
||||
/**
|
||||
* <b>功能:</b>TS_MENU MenuEOPage<br>
|
||||
* <b>作者:</b>code generator<br>
|
||||
* <b>日期:</b> 2017-11-06 <br>
|
||||
* <b>版权所有:<b>版权归天津卡达克数据技术中心所有。<br>
|
||||
*/
|
||||
public class MenuEOPage extends BasePage {
|
||||
|
||||
private String id;
|
||||
private String idOperator = "=";
|
||||
private String delFlag;
|
||||
private String delFlagOperator = "=";
|
||||
private String name;
|
||||
private String nameOperator = "=";
|
||||
private String parentId;
|
||||
private String parentIdOperator = "=";
|
||||
private String parentIds;
|
||||
private String parentIdsOperator = "=";
|
||||
private String href;
|
||||
private String hrefOperator = "=";
|
||||
private String icon;
|
||||
private String iconOperator = "=";
|
||||
private String isShow;
|
||||
private String isShowOperator = "=";
|
||||
private String permission;
|
||||
private String permissionOperator = "=";
|
||||
private String remarks;
|
||||
private String remarksOperator = "=";
|
||||
private String sort;
|
||||
private String sortOperator = "=";
|
||||
|
||||
public String getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getIdOperator() {
|
||||
return this.idOperator;
|
||||
}
|
||||
|
||||
public void setIdOperator(String idOperator) {
|
||||
this.idOperator = idOperator;
|
||||
}
|
||||
|
||||
public String getDelFlag() {
|
||||
return this.delFlag;
|
||||
}
|
||||
|
||||
public void setDelFlag(String delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getDelFlagOperator() {
|
||||
return this.delFlagOperator;
|
||||
}
|
||||
|
||||
public void setDelFlagOperator(String delFlagOperator) {
|
||||
this.delFlagOperator = delFlagOperator;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getNameOperator() {
|
||||
return this.nameOperator;
|
||||
}
|
||||
|
||||
public void setNameOperator(String nameOperator) {
|
||||
this.nameOperator = nameOperator;
|
||||
}
|
||||
|
||||
public String getParentId() {
|
||||
return this.parentId;
|
||||
}
|
||||
|
||||
public void setParentId(String parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public String getParentIdOperator() {
|
||||
return this.parentIdOperator;
|
||||
}
|
||||
|
||||
public void setParentIdOperator(String parentIdOperator) {
|
||||
this.parentIdOperator = parentIdOperator;
|
||||
}
|
||||
|
||||
public String getParentIds() {
|
||||
return this.parentIds;
|
||||
}
|
||||
|
||||
public void setParentIds(String parentIds) {
|
||||
this.parentIds = parentIds;
|
||||
}
|
||||
|
||||
public String getParentIdsOperator() {
|
||||
return this.parentIdsOperator;
|
||||
}
|
||||
|
||||
public void setParentIdsOperator(String parentIdsOperator) {
|
||||
this.parentIdsOperator = parentIdsOperator;
|
||||
}
|
||||
|
||||
public String getHref() {
|
||||
return this.href;
|
||||
}
|
||||
|
||||
public void setHref(String href) {
|
||||
this.href = href;
|
||||
}
|
||||
|
||||
public String getHrefOperator() {
|
||||
return this.hrefOperator;
|
||||
}
|
||||
|
||||
public void setHrefOperator(String hrefOperator) {
|
||||
this.hrefOperator = hrefOperator;
|
||||
}
|
||||
|
||||
public String getIcon() {
|
||||
return this.icon;
|
||||
}
|
||||
|
||||
public void setIcon(String icon) {
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
public String getIconOperator() {
|
||||
return this.iconOperator;
|
||||
}
|
||||
|
||||
public void setIconOperator(String iconOperator) {
|
||||
this.iconOperator = iconOperator;
|
||||
}
|
||||
|
||||
public String getIsShow() {
|
||||
return this.isShow;
|
||||
}
|
||||
|
||||
public void setIsShow(String isShow) {
|
||||
this.isShow = isShow;
|
||||
}
|
||||
|
||||
public String getIsShowOperator() {
|
||||
return this.isShowOperator;
|
||||
}
|
||||
|
||||
public void setIsShowOperator(String isShowOperator) {
|
||||
this.isShowOperator = isShowOperator;
|
||||
}
|
||||
|
||||
public String getPermission() {
|
||||
return this.permission;
|
||||
}
|
||||
|
||||
public void setPermission(String permission) {
|
||||
this.permission = permission;
|
||||
}
|
||||
|
||||
public String getPermissionOperator() {
|
||||
return this.permissionOperator;
|
||||
}
|
||||
|
||||
public void setPermissionOperator(String permissionOperator) {
|
||||
this.permissionOperator = permissionOperator;
|
||||
}
|
||||
|
||||
public String getRemarks() {
|
||||
return this.remarks;
|
||||
}
|
||||
|
||||
public void setRemarks(String remarks) {
|
||||
this.remarks = remarks;
|
||||
}
|
||||
|
||||
public String getRemarksOperator() {
|
||||
return this.remarksOperator;
|
||||
}
|
||||
|
||||
public void setRemarksOperator(String remarksOperator) {
|
||||
this.remarksOperator = remarksOperator;
|
||||
}
|
||||
|
||||
public String getSort() {
|
||||
return this.sort;
|
||||
}
|
||||
|
||||
public void setSort(String sort) {
|
||||
this.sort = sort;
|
||||
}
|
||||
|
||||
public String getSortOperator() {
|
||||
return this.sortOperator;
|
||||
}
|
||||
|
||||
public void setSortOperator(String sortOperator) {
|
||||
this.sortOperator = sortOperator;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,207 @@
|
||||
package com.adc.da.sys.page;
|
||||
|
||||
import com.adc.da.base.page.BasePage;
|
||||
|
||||
public class OrgEOPage extends BasePage {
|
||||
|
||||
private String id;
|
||||
|
||||
private String idOperator = "=";
|
||||
|
||||
private String delFlag;
|
||||
|
||||
private String delFlagOperator = "=";
|
||||
|
||||
private String name;
|
||||
|
||||
private String nameOperator = "=";
|
||||
|
||||
private String orgDesc;
|
||||
|
||||
private String orgDescOperator = "=";
|
||||
|
||||
private String orgCode;
|
||||
|
||||
private String orgCodeOperator = "=";
|
||||
|
||||
private String orgType;
|
||||
|
||||
private String orgTypeOperator = "=";
|
||||
|
||||
private String isShow;
|
||||
|
||||
private String isShowOperator = "=";
|
||||
|
||||
private String parentId;
|
||||
|
||||
private String parentIdOperator = "=";
|
||||
|
||||
private String parentIds;
|
||||
|
||||
private String parentIdsOperator = "=";
|
||||
|
||||
private String remarks;
|
||||
|
||||
private String remarksOperator = "=";
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getIdOperator() {
|
||||
return idOperator;
|
||||
}
|
||||
|
||||
public void setIdOperator(String idOperator) {
|
||||
this.idOperator = idOperator;
|
||||
}
|
||||
|
||||
public String getDelFlag() {
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public void setDelFlag(String delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getDelFlagOperator() {
|
||||
return delFlagOperator;
|
||||
}
|
||||
|
||||
public void setDelFlagOperator(String delFlagOperator) {
|
||||
this.delFlagOperator = delFlagOperator;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getNameOperator() {
|
||||
return nameOperator;
|
||||
}
|
||||
|
||||
public void setNameOperator(String nameOperator) {
|
||||
this.nameOperator = nameOperator;
|
||||
}
|
||||
|
||||
public String getOrgDesc() {
|
||||
return orgDesc;
|
||||
}
|
||||
|
||||
public void setOrgDesc(String orgDesc) {
|
||||
this.orgDesc = orgDesc;
|
||||
}
|
||||
|
||||
public String getOrgDescOperator() {
|
||||
return orgDescOperator;
|
||||
}
|
||||
|
||||
public void setOrgDescOperator(String orgDescOperator) {
|
||||
this.orgDescOperator = orgDescOperator;
|
||||
}
|
||||
|
||||
public String getOrgCode() {
|
||||
return orgCode;
|
||||
}
|
||||
|
||||
public void setOrgCode(String orgCode) {
|
||||
this.orgCode = orgCode;
|
||||
}
|
||||
|
||||
public String getOrgCodeOperator() {
|
||||
return orgCodeOperator;
|
||||
}
|
||||
|
||||
public void setOrgCodeOperator(String orgCodeOperator) {
|
||||
this.orgCodeOperator = orgCodeOperator;
|
||||
}
|
||||
|
||||
public String getOrgType() {
|
||||
return orgType;
|
||||
}
|
||||
|
||||
public void setOrgType(String orgType) {
|
||||
this.orgType = orgType;
|
||||
}
|
||||
|
||||
public String getOrgTypeOperator() {
|
||||
return orgTypeOperator;
|
||||
}
|
||||
|
||||
public void setOrgTypeOperator(String orgTypeOperator) {
|
||||
this.orgTypeOperator = orgTypeOperator;
|
||||
}
|
||||
|
||||
public String getIsShow() {
|
||||
return isShow;
|
||||
}
|
||||
|
||||
public void setIsShow(String isShow) {
|
||||
this.isShow = isShow;
|
||||
}
|
||||
|
||||
public String getIsShowOperator() {
|
||||
return isShowOperator;
|
||||
}
|
||||
|
||||
public void setIsShowOperator(String isShowOperator) {
|
||||
this.isShowOperator = isShowOperator;
|
||||
}
|
||||
|
||||
public String getParentId() {
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setParentId(String parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public String getParentIdOperator() {
|
||||
return parentIdOperator;
|
||||
}
|
||||
|
||||
public void setParentIdOperator(String parentIdOperator) {
|
||||
this.parentIdOperator = parentIdOperator;
|
||||
}
|
||||
|
||||
public String getParentIds() {
|
||||
return parentIds;
|
||||
}
|
||||
|
||||
public void setParentIds(String parentIds) {
|
||||
this.parentIds = parentIds;
|
||||
}
|
||||
|
||||
public String getParentIdsOperator() {
|
||||
return parentIdsOperator;
|
||||
}
|
||||
|
||||
public void setParentIdsOperator(String parentIdsOperator) {
|
||||
this.parentIdsOperator = parentIdsOperator;
|
||||
}
|
||||
|
||||
public String getRemarks() {
|
||||
return remarks;
|
||||
}
|
||||
|
||||
public void setRemarks(String remarks) {
|
||||
this.remarks = remarks;
|
||||
}
|
||||
|
||||
public String getRemarksOperator() {
|
||||
return remarksOperator;
|
||||
}
|
||||
|
||||
public void setRemarksOperator(String remarksOperator) {
|
||||
this.remarksOperator = remarksOperator;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
package com.adc.da.sys.page;
|
||||
|
||||
import com.adc.da.base.page.BasePage;
|
||||
|
||||
/**
|
||||
* <b>功能:</b>TS_ROLE RoleEOPage<br>
|
||||
* <b>作者:</b>code generator<br>
|
||||
* <b>日期:</b> 2017-11-06 <br>
|
||||
* <b>版权所有:<b>版权归天津卡达克数据技术中心所有。<br>
|
||||
*/
|
||||
public class RoleEOPage extends BasePage {
|
||||
|
||||
private String id;
|
||||
|
||||
private String idOperator = "=";
|
||||
|
||||
private String dataScope;
|
||||
|
||||
private String dataScopeOperator = "=";
|
||||
|
||||
private String delFlag;
|
||||
|
||||
private String delFlagOperator = "=";
|
||||
|
||||
private String isDefault;
|
||||
|
||||
private String isDefaultOperator = "=";
|
||||
|
||||
private String name;
|
||||
|
||||
private String nameOperator = "=";
|
||||
|
||||
private String remarks;
|
||||
|
||||
private String remarksOperator = "=";
|
||||
|
||||
public String getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getIdOperator() {
|
||||
return this.idOperator;
|
||||
}
|
||||
|
||||
public void setIdOperator(String idOperator) {
|
||||
this.idOperator = idOperator;
|
||||
}
|
||||
|
||||
public String getDataScope() {
|
||||
return this.dataScope;
|
||||
}
|
||||
|
||||
public void setDataScope(String dataScope) {
|
||||
this.dataScope = dataScope;
|
||||
}
|
||||
|
||||
public String getDataScopeOperator() {
|
||||
return this.dataScopeOperator;
|
||||
}
|
||||
|
||||
public void setDataScopeOperator(String dataScopeOperator) {
|
||||
this.dataScopeOperator = dataScopeOperator;
|
||||
}
|
||||
|
||||
public String getDelFlag() {
|
||||
return this.delFlag;
|
||||
}
|
||||
|
||||
public void setDelFlag(String delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getDelFlagOperator() {
|
||||
return this.delFlagOperator;
|
||||
}
|
||||
|
||||
public void setDelFlagOperator(String delFlagOperator) {
|
||||
this.delFlagOperator = delFlagOperator;
|
||||
}
|
||||
|
||||
public String getIsDefault() {
|
||||
return this.isDefault;
|
||||
}
|
||||
|
||||
public void setIsDefault(String isDefault) {
|
||||
this.isDefault = isDefault;
|
||||
}
|
||||
|
||||
public String getIsDefaultOperator() {
|
||||
return this.isDefaultOperator;
|
||||
}
|
||||
|
||||
public void setIsDefaultOperator(String isDefaultOperator) {
|
||||
this.isDefaultOperator = isDefaultOperator;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getNameOperator() {
|
||||
return this.nameOperator;
|
||||
}
|
||||
|
||||
public void setNameOperator(String nameOperator) {
|
||||
this.nameOperator = nameOperator;
|
||||
}
|
||||
|
||||
public String getRemarks() {
|
||||
return this.remarks;
|
||||
}
|
||||
|
||||
public void setRemarks(String remarks) {
|
||||
this.remarks = remarks;
|
||||
}
|
||||
|
||||
public String getRemarksOperator() {
|
||||
return this.remarksOperator;
|
||||
}
|
||||
|
||||
public void setRemarksOperator(String remarksOperator) {
|
||||
this.remarksOperator = remarksOperator;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.adc.da.sys.page;
|
||||
|
||||
import com.adc.da.base.page.BasePage;
|
||||
|
||||
|
||||
/**
|
||||
* <b>功能:</b>TR_ROLE_MENU RoleMenuEOPage<br>
|
||||
* <b>作者:</b>code generator<br>
|
||||
* <b>日期:</b> 2019-09-02 <br>
|
||||
* <b>版权所有:<b>版权归北京卡达克数据技术中心所有。<br>
|
||||
*/
|
||||
public class RoleMenuEOPage extends BasePage {
|
||||
|
||||
private String roleId;
|
||||
private String roleIdOperator = "=";
|
||||
private String menuId;
|
||||
private String menuIdOperator = "=";
|
||||
|
||||
public String getRoleId() {
|
||||
return this.roleId;
|
||||
}
|
||||
|
||||
public void setRoleId(String roleId) {
|
||||
this.roleId = roleId;
|
||||
}
|
||||
|
||||
public String getRoleIdOperator() {
|
||||
return this.roleIdOperator;
|
||||
}
|
||||
|
||||
public void setRoleIdOperator(String roleIdOperator) {
|
||||
this.roleIdOperator = roleIdOperator;
|
||||
}
|
||||
|
||||
public String getMenuId() {
|
||||
return this.menuId;
|
||||
}
|
||||
|
||||
public void setMenuId(String menuId) {
|
||||
this.menuId = menuId;
|
||||
}
|
||||
|
||||
public String getMenuIdOperator() {
|
||||
return this.menuIdOperator;
|
||||
}
|
||||
|
||||
public void setMenuIdOperator(String menuIdOperator) {
|
||||
this.menuIdOperator = menuIdOperator;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.adc.da.sys.page;
|
||||
|
||||
import com.adc.da.base.page.BasePage;
|
||||
|
||||
|
||||
/**
|
||||
* <b>功能:</b>TR_ROLE_ORG RoleOrgEOPage<br>
|
||||
* <b>作者:</b>code generator<br>
|
||||
* <b>日期:</b> 2019-10-28 <br>
|
||||
* <b>版权所有:<b>版权归北京卡达克数据技术中心所有。<br>
|
||||
*/
|
||||
public class RoleOrgEOPage extends BasePage {
|
||||
|
||||
private String roleId;
|
||||
private String roleIdOperator = "=";
|
||||
private String orgId;
|
||||
private String orgIdOperator = "=";
|
||||
|
||||
public String getRoleId() {
|
||||
return this.roleId;
|
||||
}
|
||||
|
||||
public void setRoleId(String roleId) {
|
||||
this.roleId = roleId;
|
||||
}
|
||||
|
||||
public String getRoleIdOperator() {
|
||||
return this.roleIdOperator;
|
||||
}
|
||||
|
||||
public void setRoleIdOperator(String roleIdOperator) {
|
||||
this.roleIdOperator = roleIdOperator;
|
||||
}
|
||||
|
||||
public String getOrgId() {
|
||||
return this.orgId;
|
||||
}
|
||||
|
||||
public void setOrgId(String orgId) {
|
||||
this.orgId = orgId;
|
||||
}
|
||||
|
||||
public String getOrgIdOperator() {
|
||||
return this.orgIdOperator;
|
||||
}
|
||||
|
||||
public void setOrgIdOperator(String orgIdOperator) {
|
||||
this.orgIdOperator = orgIdOperator;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,225 @@
|
||||
package com.adc.da.sys.page;
|
||||
|
||||
import com.adc.da.base.page.BasePage;
|
||||
|
||||
/**
|
||||
* <b>功能:</b>TS_USER UserEOPage<br>
|
||||
* <b>作者:</b>code generator<br>
|
||||
* <b>日期:</b> 2017-11-06 <br>
|
||||
* <b>版权所有:<b>版权归天津卡达克数据技术中心所有。<br>
|
||||
*/
|
||||
public class UserEOPage extends BasePage {
|
||||
|
||||
private String usid;
|
||||
|
||||
private String usidOperator = "=";
|
||||
|
||||
private String account;
|
||||
|
||||
private String accountOperator = "=";
|
||||
|
||||
private String delFlag;
|
||||
|
||||
private String delFlagOperator = "=";
|
||||
|
||||
private String usname;
|
||||
|
||||
private String usnameOperator = "=";
|
||||
|
||||
private String password;
|
||||
|
||||
private String rolename;
|
||||
|
||||
private String rolenameOperator = "=";
|
||||
|
||||
private String roleId;
|
||||
|
||||
private String roleIdOperator = "=";
|
||||
|
||||
private String orgId;
|
||||
|
||||
private String orgIdOperator = "=";
|
||||
|
||||
private String weight;
|
||||
|
||||
private String weightOperator = ">=";
|
||||
|
||||
|
||||
private String isuse;
|
||||
|
||||
private String companyName;
|
||||
|
||||
private String companyId;
|
||||
|
||||
private String isAdmin;
|
||||
|
||||
|
||||
public String getUsid() {
|
||||
return this.usid;
|
||||
}
|
||||
|
||||
public void setUsid(String usid) {
|
||||
this.usid = usid;
|
||||
}
|
||||
|
||||
public String getUsidOperator() {
|
||||
return this.usidOperator;
|
||||
}
|
||||
|
||||
public void setUsidOperator(String usidOperator) {
|
||||
this.usidOperator = usidOperator;
|
||||
}
|
||||
|
||||
public String getAccount() {
|
||||
return this.account;
|
||||
}
|
||||
|
||||
public void setAccount(String account) {
|
||||
this.account = account;
|
||||
}
|
||||
|
||||
public String getAccountOperator() {
|
||||
return this.accountOperator;
|
||||
}
|
||||
|
||||
public void setAccountOperator(String accountOperator) {
|
||||
this.accountOperator = accountOperator;
|
||||
}
|
||||
|
||||
public String getDelFlag() {
|
||||
return this.delFlag;
|
||||
}
|
||||
|
||||
public void setDelFlag(String delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getDelFlagOperator() {
|
||||
return this.delFlagOperator;
|
||||
}
|
||||
|
||||
public void setDelFlagOperator(String delFlagOperator) {
|
||||
this.delFlagOperator = delFlagOperator;
|
||||
}
|
||||
|
||||
public String getUsname() {
|
||||
return this.usname;
|
||||
}
|
||||
|
||||
public void setUsname(String usname) {
|
||||
this.usname = usname;
|
||||
}
|
||||
|
||||
public String getUsnameOperator() {
|
||||
return this.usnameOperator;
|
||||
}
|
||||
|
||||
public void setUsnameOperator(String usnameOperator) {
|
||||
this.usnameOperator = usnameOperator;
|
||||
}
|
||||
|
||||
public String getRolename() {
|
||||
return rolename;
|
||||
}
|
||||
|
||||
public void setRolename(String rolename) {
|
||||
this.rolename = rolename;
|
||||
}
|
||||
|
||||
public String getRolenameOperator() {
|
||||
return rolenameOperator;
|
||||
}
|
||||
|
||||
public void setRolenameOperator(String rolenameOperator) {
|
||||
this.rolenameOperator = rolenameOperator;
|
||||
}
|
||||
|
||||
public String getRoleId() {
|
||||
return roleId;
|
||||
}
|
||||
|
||||
public void setRoleId(String roleId) {
|
||||
this.roleId = roleId;
|
||||
}
|
||||
|
||||
public String getRoleIdOperator() {
|
||||
return roleIdOperator;
|
||||
}
|
||||
|
||||
public void setRoleIdOperator(String roleIdOperator) {
|
||||
this.roleIdOperator = roleIdOperator;
|
||||
}
|
||||
|
||||
public String getOrgId() {
|
||||
return orgId;
|
||||
}
|
||||
|
||||
public void setOrgId(String orgId) {
|
||||
this.orgId = orgId;
|
||||
}
|
||||
|
||||
public String getOrgIdOperator() {
|
||||
return orgIdOperator;
|
||||
}
|
||||
|
||||
public void setOrgIdOperator(String orgIdOperator) {
|
||||
this.orgIdOperator = orgIdOperator;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return this.password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getWeight() {
|
||||
return weight;
|
||||
}
|
||||
|
||||
public void setWeight(String weight) {
|
||||
this.weight = weight;
|
||||
}
|
||||
|
||||
public String getWeightOperator() {
|
||||
return weightOperator;
|
||||
}
|
||||
|
||||
public void setWeightOperator(String weightOperator) {
|
||||
this.weightOperator = weightOperator;
|
||||
}
|
||||
|
||||
|
||||
public String getIsuse() {
|
||||
return isuse;
|
||||
}
|
||||
|
||||
public void setIsuse(String isuse) {
|
||||
this.isuse = isuse;
|
||||
}
|
||||
|
||||
public String getCompanyName() {
|
||||
return companyName;
|
||||
}
|
||||
|
||||
public void setCompanyName(String companyName) {
|
||||
this.companyName = companyName;
|
||||
}
|
||||
|
||||
public String getCompanyId() {
|
||||
return companyId;
|
||||
}
|
||||
|
||||
public void setCompanyId(String companyId) {
|
||||
this.companyId = companyId;
|
||||
}
|
||||
|
||||
public String getIsAdmin() {
|
||||
return isAdmin;
|
||||
}
|
||||
|
||||
public void setIsAdmin(String isAdmin) {
|
||||
this.isAdmin = isAdmin;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.adc.da.sys.page;
|
||||
|
||||
import com.adc.da.base.page.BasePage;
|
||||
|
||||
public class UserOrgEOPage extends BasePage {
|
||||
|
||||
private String userId;
|
||||
|
||||
private String userIdOperator = "=";
|
||||
|
||||
private String orgId;
|
||||
|
||||
private String orgIdOperator = "=";
|
||||
|
||||
public String getUserId() {
|
||||
return this.userId;
|
||||
}
|
||||
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getUserIdOperator() {
|
||||
return this.userIdOperator;
|
||||
}
|
||||
|
||||
public void setUserIdOperator(String userIdOperator) {
|
||||
this.userIdOperator = userIdOperator;
|
||||
}
|
||||
|
||||
public String getOrgId() {
|
||||
return orgId;
|
||||
}
|
||||
|
||||
public void setOrgId(String orgId) {
|
||||
this.orgId = orgId;
|
||||
}
|
||||
|
||||
public String getOrgIdOperator() {
|
||||
return orgIdOperator;
|
||||
}
|
||||
|
||||
public void setOrgIdOperator(String orgIdOperator) {
|
||||
this.orgIdOperator = orgIdOperator;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.adc.da.sys.page;
|
||||
|
||||
import com.adc.da.base.page.BasePage;
|
||||
|
||||
/**
|
||||
* <b>功能:</b>TR_USER_ROLE UserRoleEOPage<br>
|
||||
* <b>作者:</b>code generator<br>
|
||||
* <b>日期:</b> 2017-11-07 <br>
|
||||
* <b>版权所有:<b>版权归天津卡达克数据技术中心所有。<br>
|
||||
*/
|
||||
public class UserRoleEOPage extends BasePage {
|
||||
|
||||
private String userId;
|
||||
|
||||
private String userIdOperator = "=";
|
||||
|
||||
private String roleId;
|
||||
|
||||
private String roleIdOperator = "=";
|
||||
|
||||
public String getUserId() {
|
||||
return this.userId;
|
||||
}
|
||||
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getUserIdOperator() {
|
||||
return this.userIdOperator;
|
||||
}
|
||||
|
||||
public void setUserIdOperator(String userIdOperator) {
|
||||
this.userIdOperator = userIdOperator;
|
||||
}
|
||||
|
||||
public String getRoleId() {
|
||||
return this.roleId;
|
||||
}
|
||||
|
||||
public void setRoleId(String roleId) {
|
||||
this.roleId = roleId;
|
||||
}
|
||||
|
||||
public String getRoleIdOperator() {
|
||||
return this.roleIdOperator;
|
||||
}
|
||||
|
||||
public void setRoleIdOperator(String roleIdOperator) {
|
||||
this.roleIdOperator = roleIdOperator;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,272 @@
|
||||
package com.adc.da.sys.service;
|
||||
|
||||
import com.adc.da.sys.vo.MenuVO;
|
||||
import com.adc.da.util.constant.DeleteFlagEnum;
|
||||
import com.adc.da.util.utils.BeanMapper;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.adc.da.base.entity.TreeEntity;
|
||||
import com.adc.da.base.service.BaseService;
|
||||
import com.adc.da.sys.dao.mysql.MenuEODao;
|
||||
import com.adc.da.sys.entity.MenuEO;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <br>
|
||||
* <b>功能:</b>TS_MENU MenuEOService<br>
|
||||
* <b>作者:</b>code generator<br>
|
||||
* <b>日期:</b> 2017-11-06 <br>
|
||||
* <b>版权所有:<b>版权归天津卡达克数据技术中心所有。<br>
|
||||
* <p>
|
||||
*
|
||||
* @author comments created by Lee Kwanho
|
||||
* date 2018-08-16
|
||||
* @see MenuEODao
|
||||
* @see
|
||||
*/
|
||||
@Service("menuEOService")
|
||||
@Transactional
|
||||
public class MenuEOService extends BaseService<MenuEO, String> {
|
||||
|
||||
/**
|
||||
* Dao层自动装配
|
||||
*
|
||||
* @see MenuEODao
|
||||
*/
|
||||
@Resource
|
||||
private MenuEODao dao;
|
||||
|
||||
/**
|
||||
* @see dozer
|
||||
*/
|
||||
@Resource
|
||||
private BeanMapper beanMapper;
|
||||
|
||||
@Override
|
||||
public MenuEODao getDao() {
|
||||
return dao;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加菜单 构建菜单树 , 生成uuid,初始化删除标识符
|
||||
*
|
||||
* @param menuEO 菜单信息
|
||||
* @return 返回生成的菜单信息
|
||||
* @throws Exception 添加菜单异常,由上级进行处理
|
||||
*/
|
||||
public MenuEO insertMenu(MenuEO menuEO) throws Exception {
|
||||
/**
|
||||
* 生成10位随机id
|
||||
*/
|
||||
// menuEO.setId(UUID.randomUUID(10));
|
||||
menuEO.setDelFlag(DeleteFlagEnum.NORMAL.getValue());
|
||||
TreeEntity parent = menuEO.getParent();
|
||||
if (parent != null) {
|
||||
menuEO.setParentId(parent.getId());
|
||||
menuEO.setParentIds(parent.getParentIds() + parent.getId() + ",");
|
||||
}
|
||||
menuEO.setIsShow(1);
|
||||
super.insertSelective(menuEO);
|
||||
return menuEO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新菜单
|
||||
*
|
||||
* @param menuVO 菜单VO对象
|
||||
*/
|
||||
public void updateMenu(MenuVO menuVO) {
|
||||
/* 处理当前节点
|
||||
构建菜单 */
|
||||
String oldParentId = menuVO.getParentId();
|
||||
String oldParentIds = menuVO.getParentIds();
|
||||
MenuVO parentMenu = menuVO.getParent();
|
||||
if (parentMenu != null) {
|
||||
menuVO.setParentId(parentMenu.getId());
|
||||
menuVO.setParentIds(parentMenu.getParentIds() + parentMenu.getId() + ",");
|
||||
}
|
||||
/*处理所有的子节点
|
||||
判断父节点是否移动到其他节点*/
|
||||
if (oldParentId != null && !oldParentId.equals(menuVO.getParentId())) {
|
||||
// 获取要修改的当前节点的所有子节点
|
||||
List<MenuEO> childMenus = dao.getChildMenus(menuVO.getId());
|
||||
// 修改所有子节点的ParentIds为当前节点的parentIds + parentId
|
||||
for (MenuEO childMenu : childMenus) {
|
||||
childMenu.setParentIds(childMenu.getParentIds().replace(oldParentIds, menuVO.getParentIds()));
|
||||
// 更新到数据库
|
||||
dao.updateByPrimaryKey(childMenu);
|
||||
}
|
||||
}
|
||||
// 修改当前节点
|
||||
dao.updateByPrimaryKeySelective(beanMapper.map(menuVO, MenuEO.class));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 逻辑删除菜单及其子菜单,物理删除菜单及其子菜单与角色的关联
|
||||
*
|
||||
* @param ids 待删除的所有菜单ID
|
||||
*/
|
||||
public void delete(String[] ids) {
|
||||
dao.deleteMenuLogic(ids);
|
||||
|
||||
//删除子菜单
|
||||
for(String id:ids){
|
||||
dao.deleteMenuByParentId(id);
|
||||
}
|
||||
dao.deleteRoleMenus(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户的所有菜单
|
||||
*
|
||||
* @param userId 用户ID
|
||||
*/
|
||||
@Transactional(readOnly = true, rollbackFor = Throwable.class)
|
||||
public List<MenuEO> listMenuEOByUserId(String userId) {
|
||||
List<MenuEO> menuEOS = dao.listMenuEOByUserId(userId);
|
||||
Set<String> menuIds = new HashSet<>();
|
||||
menuEOS.forEach(c -> {
|
||||
Arrays.asList(c.getParentIds().split(",")).forEach(
|
||||
d -> {
|
||||
menuIds.add(d);
|
||||
}
|
||||
);
|
||||
menuIds.add(c.getId());
|
||||
});
|
||||
|
||||
if(menuIds.size()==0){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return dao.listMenuEOByMenuIds(new ArrayList<String>(menuIds));
|
||||
|
||||
// return dao.listMenuEOByUserId(userId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取所有的菜单
|
||||
*
|
||||
* @return 所有菜单
|
||||
*/
|
||||
@Transactional(readOnly = true, rollbackFor = Throwable.class)
|
||||
public List<MenuEO> findAll() {
|
||||
return dao.findAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* 判定菜单是否属于角色
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @param menuId 菜单ID
|
||||
* @return true -> 菜单属于角色
|
||||
*/
|
||||
@Transactional(readOnly = true, rollbackFor = Exception.class)
|
||||
public boolean isBelong(String roleId, String menuId) {
|
||||
int count = dao.isBelong(roleId, menuId);
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取角色对应的所有菜单
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 角色对应的所有菜单
|
||||
*/
|
||||
@Transactional(readOnly = true, rollbackFor = Exception.class)
|
||||
public List<MenuEO> listMenuEOByRoleId(String roleId) {
|
||||
return dao.listMenuEOByRoleID(roleId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归生成列表,
|
||||
* Sonar 建议 listMenuByParent 类型设置成Map而不是HashMap
|
||||
* 同时sons为空时建议返回Collections.emptyList(),而不是null
|
||||
*
|
||||
* @param sons 子菜单
|
||||
* @param listMenuByParent 菜单列表
|
||||
* @return 父菜单的子菜单信息
|
||||
*/
|
||||
public List<HashMap<String, Object>> recursionList(List<MenuVO> sons, Map<String, List<MenuVO>> listMenuByParent) {
|
||||
/**
|
||||
* 判断空值,返回空list
|
||||
*/
|
||||
if (sons == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
List<HashMap<String, Object>> list = new ArrayList<>();
|
||||
for (MenuVO son : sons) {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("text", son.getName());
|
||||
map.put("icon", son.getIcon());
|
||||
map.put("link", son.getHref());
|
||||
List<HashMap<String, Object>> sonList = recursionList(listMenuByParent.get(son.getId()), listMenuByParent);
|
||||
if (sonList != null) {
|
||||
map.put("children", sonList);
|
||||
map.put("group", true);
|
||||
}
|
||||
list.add(map);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
public int queryConflict(String name ,String id , String parentId){
|
||||
return dao.queryConflict(name , id , parentId) ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<MenuVO> changeMenu(List<MenuVO> entities){
|
||||
//2.1)、找到所有一级分类
|
||||
List<MenuVO> levelMenus = entities.stream()
|
||||
.filter(e -> e.getParentId().equals("0"))
|
||||
.map((menu) -> {
|
||||
menu.setChildList(getChildrens(menu, entities));
|
||||
return menu;
|
||||
})
|
||||
.sorted((menu, menu2) -> {
|
||||
return Integer.parseInt(menu.getSort() == null ? "0" :menu.getSort()) - Integer.parseInt(menu2.getSort() == null ? "0" : menu2.getSort());
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
return levelMenus;
|
||||
}
|
||||
|
||||
//递归查找所有菜单的子菜单
|
||||
private List<MenuVO> getChildrens(MenuVO root, List<MenuVO> all) {
|
||||
|
||||
List<MenuVO> children = all.stream().filter(categoryEntity -> {
|
||||
return categoryEntity.getParentId().equals(root.getId());
|
||||
}).map(categoryEntity -> {
|
||||
//1、找到子菜单(递归)
|
||||
categoryEntity.setChildList(getChildrens(categoryEntity, all));
|
||||
return categoryEntity;
|
||||
}).sorted((menu, menu2) -> {
|
||||
//2、菜单的排序
|
||||
return Integer.parseInt(menu.getSort() == null ? "0" :menu.getSort()) - Integer.parseInt(menu2.getSort() == null ? "0" : menu2.getSort());
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
return children;
|
||||
|
||||
}
|
||||
|
||||
// public String queryInformation() {
|
||||
// return dao.queryInformation();
|
||||
// }
|
||||
//
|
||||
// public int updateInformation(String information) {
|
||||
// return dao.updateInformation(information);
|
||||
// }
|
||||
//
|
||||
// public int insertInformation(String information) {
|
||||
// return dao.insertInformation(information);
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,341 @@
|
||||
package com.adc.da.sys.service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.adc.da.sys.dao.mysql.*;
|
||||
import com.adc.da.sys.entity.*;
|
||||
import com.adc.da.sys.vo.MenuVO;
|
||||
import com.adc.da.sys.vo.UserRoleVO;
|
||||
import com.adc.da.sys.vo.ddm.DdmMenuVO;
|
||||
import com.adc.da.sys.vo.ddm.DdmRoleMenuCreateVO;
|
||||
import com.adc.da.sys.vo.ddm.DdmRoleUserQuery;
|
||||
import com.adc.da.sys.vo.ddm.DdmUserVO;
|
||||
import com.adc.da.util.exception.AdcDaBaseException;
|
||||
import com.adc.da.util.http.PageInfo;
|
||||
import com.adc.da.util.utils.BeanMapper;
|
||||
import com.adc.da.util.utils.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.adc.da.base.service.BaseService;
|
||||
import com.adc.da.util.constant.DeleteFlagEnum;
|
||||
import com.adc.da.util.utils.CollectionUtils;
|
||||
import com.adc.da.util.utils.UUID;
|
||||
|
||||
/**
|
||||
* <br>
|
||||
* <b>功能:</b>TS_ROLE RoleEOService<br>
|
||||
* <b>作者:</b>code generator<br>
|
||||
* <b>日期:</b> 2017-11-06 <br>
|
||||
* <b>版权所有:<b>版权归天津卡达克数据技术中心所有。<br>
|
||||
* date 2018-08-17
|
||||
*
|
||||
* @author comments created by Lee Kwanho
|
||||
* @see RoleEODao
|
||||
* @see com.adc.da.sys.controller.RoleEOController
|
||||
*/
|
||||
@Service("roleEOService")
|
||||
@Transactional
|
||||
public class RoleEOService extends BaseService<RoleEO, String> {
|
||||
|
||||
/**
|
||||
* Dao层自动装配
|
||||
*
|
||||
* @see RoleEODao
|
||||
*/
|
||||
@Resource
|
||||
private RoleEODao dao;
|
||||
|
||||
public RoleEODao getDao() {
|
||||
return dao;
|
||||
}
|
||||
|
||||
@Resource
|
||||
private RoleHomeEODao roleHomeEODao;
|
||||
|
||||
@Resource
|
||||
private RoleMenuEODao roleMenuEODao;
|
||||
|
||||
@Resource
|
||||
private MenuEODao menuEODao;
|
||||
|
||||
@Resource
|
||||
private UserRoleEODao userRoleEODao;
|
||||
|
||||
@Resource
|
||||
private BeanMapper beanMapper;
|
||||
|
||||
/**
|
||||
* 保存角色信息,生成uuid,删除标识位
|
||||
*
|
||||
* @param sysRoleEO 角色信息
|
||||
* @return 完整的角色信息
|
||||
*/
|
||||
public RoleEO save(RoleEO sysRoleEO) {
|
||||
sysRoleEO.setId(UUID.randomUUID10());
|
||||
sysRoleEO.setDelFlag(DeleteFlagEnum.NORMAL.getValue());
|
||||
dao.insertSelective(sysRoleEO);
|
||||
return sysRoleEO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取角色id
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public RoleEO getRoleWithMenus(String id) {
|
||||
return dao.getRoleWithMenus(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户所关联的所有角色id
|
||||
*
|
||||
* @author Wei Jinjin
|
||||
* date 2019-10-29
|
||||
*/
|
||||
public List<String> getRoleIdListByUserId(String userId) {
|
||||
List<String> roleIdList = new ArrayList<>();
|
||||
List<RoleEO> roleList = dao.getRoleListByUserId(userId);
|
||||
for (RoleEO roleEO : roleList) {
|
||||
roleIdList.add(roleEO.getId());
|
||||
}
|
||||
return roleIdList;
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public List<RoleEO> getSysRoleListByUserId(String userId) {
|
||||
return dao.getRoleListByUserId(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除角色及角色菜单关联(角色有对应用户则不能被删除)
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delete(String roleId) {
|
||||
dao.deleteLogic(roleId);
|
||||
dao.deleteRoleMenuByRoleId(roleId);
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public List<RoleEO> findAll() {
|
||||
return dao.findAll();
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public List<RoleEO> findAll(String roleName) {
|
||||
return dao.findAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询角色所对应的用户
|
||||
*
|
||||
* @param roleId 角色id
|
||||
* @return 角色信息
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public List<UserRoleEO> getUserRoleListByRoleId(String roleId) {
|
||||
return dao.getUserRoleListByRoleId(roleId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询角色所对应的用户
|
||||
*
|
||||
* @param roleId 角色id
|
||||
* @return 角色信息
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public List<UserRoleVO> getUserInfoListByRoleId(String roleId) {
|
||||
return dao.getUserInfoListByRoleId(roleId);
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public PageInfo<UserRoleVO> getUserInfoPageByRoleId(DdmRoleUserQuery query) {
|
||||
IPage page = new Page();
|
||||
page.setCurrent(query.getPageNum());
|
||||
page.setSize(query.getPageSize());
|
||||
IPage<UserRoleVO> userInfoList = dao.getUserInfoPageByRoleId(page, query.getRoleId());
|
||||
Long count = dao.getUserCountByRoleId(query.getRoleId());
|
||||
PageInfo<UserRoleVO> pageInfo = new PageInfo();
|
||||
pageInfo.setPageSize(query.getPageSize());
|
||||
pageInfo.setCount(count);
|
||||
pageInfo.setList(userInfoList.getRecords());
|
||||
return pageInfo;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 设置角色菜单关联
|
||||
*
|
||||
* @param roleEO 角色信息
|
||||
* @return 角色信息
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public RoleEO saveRoleMenu(RoleEO roleEO) {
|
||||
if (CollectionUtils.isNotEmpty(roleEO.getMenuEOIdList())) {
|
||||
/*删除旧角色关联*/
|
||||
dao.deleteRoleMenuByRoleId(roleEO.getId());
|
||||
|
||||
/* List<String> newMenuList=new ArrayList<>();
|
||||
roleEO.getMenuEOIdList().forEach(c->{
|
||||
String pId = dao.getpidByMenuId(c);
|
||||
if(!"0".equals(pId)&&!roleEO.getMenuEOIdList().contains(pId)){
|
||||
newMenuList.add(pId);
|
||||
}
|
||||
});
|
||||
roleEO.getMenuEOIdList().addAll(newMenuList.stream().distinct().collect(Collectors.toList()));*/
|
||||
for (String menuId : roleEO.getMenuEOIdList()) {
|
||||
/*新增角色关联*/
|
||||
dao.saveRoleMenu(roleEO.getId(), menuId);
|
||||
}
|
||||
} else {
|
||||
dao.deleteRoleMenuByRoleId(roleEO.getId());
|
||||
}
|
||||
return roleEO;
|
||||
}
|
||||
|
||||
/**
|
||||
* ddm设置角色菜单关联,同时设置首页权限
|
||||
*
|
||||
* @return 角色信息
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveRoleMenuByDdm(List<DdmRoleMenuCreateVO> roleModels) {
|
||||
if (CollectionUtils.isNotEmpty(roleModels)) {
|
||||
Map<String, List<DdmRoleMenuCreateVO>> roldMenuMap = roleModels.stream().collect(Collectors.groupingBy(DdmRoleMenuCreateVO::getRoleId));
|
||||
for (String key : roldMenuMap.keySet()) {
|
||||
String roleId=key;
|
||||
List<DdmRoleMenuCreateVO> menuList = roldMenuMap.get(key);
|
||||
List<RoleMenuEO> rmList = new ArrayList<>();
|
||||
/*删除旧角色关联*/
|
||||
dao.deleteRoleMenuByRoleId(roleId);
|
||||
// /*删除旧角色首页权限关联*/ 修改 ddm不管理首页权限
|
||||
// roleHomeEODao.delete(new QueryWrapper<RoleHomeEO>().eq("ROLEID", roleId));
|
||||
for (DdmRoleMenuCreateVO roleModel : menuList) {
|
||||
if (StringUtils.isNotEmpty(roleModel.getModelId())){
|
||||
/*新增角色关联*/
|
||||
dao.saveRoleMenu(roleModel.getRoleId(), roleModel.getModelId());
|
||||
// /*新增角色首页权限*/
|
||||
// RoleMenuEO roleMenuEO = new RoleMenuEO();
|
||||
// roleMenuEO.setRoleId(roleModel.getRoleId());
|
||||
// roleMenuEO.setMenuId(roleModel.getModelId());
|
||||
// rmList.add(roleMenuEO);
|
||||
}
|
||||
}
|
||||
// if (CollectionUtils.isNotEmpty(rmList)) {
|
||||
// roleHomeEODao.insertRoleHomeBatch(rmList);
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 判断角色是否属于相应用户
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @param roleId 角色id
|
||||
* @return 返回布尔值,确认是否有该角色信息
|
||||
*/
|
||||
public boolean isBelong(String userId, String roleId) {
|
||||
int count = dao.isBelong(userId, roleId);
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
public List<RoleEO> getRoleByCode(String roleCode) {
|
||||
return dao.getRoleByCode(roleCode);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveRoleHome(RoleEO roleEO) {
|
||||
if (roleEO.getMenuEOIdList() == null || roleEO.getMenuEOIdList().size() == 0) {
|
||||
//将首页展示默认调整成角色菜单
|
||||
roleHomeEODao.delete(new QueryWrapper<RoleHomeEO>().eq("ROLEID", roleEO.getId()));
|
||||
List<RoleMenuEO> roleMenuList = roleMenuEODao.getRoleMenuList(roleEO.getId());
|
||||
roleHomeEODao.insertRoleHomeBatch(roleMenuList);
|
||||
} else {
|
||||
roleHomeEODao.delete(new QueryWrapper<RoleHomeEO>().eq("ROLEID", roleEO.getId()));
|
||||
List<RoleMenuEO> rmList = new ArrayList<>();
|
||||
roleEO.getMenuEOIdList().forEach(c -> {
|
||||
RoleMenuEO roleMenuEO = new RoleMenuEO();
|
||||
roleMenuEO.setRoleId(roleEO.getId());
|
||||
roleMenuEO.setMenuId(c);
|
||||
rmList.add(roleMenuEO);
|
||||
});
|
||||
|
||||
roleHomeEODao.insertRoleHomeBatch(rmList);
|
||||
}
|
||||
}
|
||||
|
||||
public List<MenuVO> getHomeMenu(String roleId) throws Exception {
|
||||
if (StringUtils.isEmpty(roleId)) {
|
||||
return new ArrayList<MenuVO>();
|
||||
}
|
||||
List<MenuEO> homeMenuList = roleHomeEODao.getHomeListByRoleId(roleId);
|
||||
List<MenuEO> roleMenuList=menuEODao.listMenuEOByRoleId(roleId);
|
||||
|
||||
List<String> idList = roleMenuList.stream().map(MenuEO::getId).collect(Collectors.toList());
|
||||
//已分配好的菜单权限为基础,`找出其中的配置首页
|
||||
|
||||
RoleEO roleEO = selectByPrimaryKey(roleId);
|
||||
List<MenuVO> allList;
|
||||
if ("管理员".equals(roleEO.getName())) {
|
||||
//管理员返回所有菜单权限
|
||||
allList = beanMapper.mapList(menuEODao.findAll(), MenuVO.class);
|
||||
allList.forEach(c -> {
|
||||
c.setBelong(1);
|
||||
});
|
||||
} else {
|
||||
allList = beanMapper.mapList(homeMenuList, MenuVO.class);
|
||||
allList.forEach(c -> {
|
||||
if (idList.contains(c.getId())) {
|
||||
c.setBelong(1);
|
||||
} else {
|
||||
c.setBelong(0);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
return allList;
|
||||
}
|
||||
|
||||
//角色添加用户
|
||||
public int saveRoleUser(UserRoleEO userRoleEO) {
|
||||
QueryWrapper<UserRoleEO> queryWrapper1 = new QueryWrapper<UserRoleEO>().eq("USER_ID", userRoleEO.getUserId()).eq("ROLE_ID", userRoleEO.getRoleId());
|
||||
List<UserRoleEO> userRoleEOS1 = userRoleEODao.selectList(queryWrapper1);
|
||||
if (userRoleEOS1.size() > 0) {
|
||||
throw new AdcDaBaseException("此角色下该用户已存在,请不要重复添加");
|
||||
}
|
||||
//因为系统用户角色1对一 ,所以删除原先角色
|
||||
QueryWrapper<UserRoleEO> queryWrapper2 = new QueryWrapper<UserRoleEO>().eq("USER_ID", userRoleEO.getUserId());
|
||||
userRoleEODao.delete(queryWrapper2);
|
||||
|
||||
return userRoleEODao.insert(userRoleEO);
|
||||
}
|
||||
|
||||
//角色删除用户
|
||||
public int deleteRoleUsers(List<UserRoleEO> userRoleEOList) {
|
||||
int i = 0;
|
||||
for (UserRoleEO userRoleEO : userRoleEOList) {
|
||||
userRoleEODao.delete(new QueryWrapper<UserRoleEO>().eq("USER_ID", userRoleEO.getUserId()).eq("ROLE_ID", userRoleEO.getRoleId()));
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
public List<DdmMenuVO> getRoleMenuInfoList(@Param("roleId") String roleId) {
|
||||
return roleMenuEODao.getRoleMenuInfoList(roleId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.adc.da.sys.service;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.adc.da.base.service.BaseService;
|
||||
import com.adc.da.sys.dao.mysql.RoleMenuEODao;
|
||||
import com.adc.da.sys.entity.RoleMenuEO;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* <br>
|
||||
* <b>功能:</b>TR_ROLE_MENU RoleMenuEOService<br>
|
||||
* <b>作者:</b>code generator<br>
|
||||
* <b>日期:</b> 2019-09-02 <br>
|
||||
* <b>版权所有:<b>版权归北京卡达克数据技术中心所有。<br>
|
||||
*/
|
||||
@Service("roleMenuEOService")
|
||||
@Transactional
|
||||
public class RoleMenuEOService extends BaseService<RoleMenuEO, Void> {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(RoleMenuEOService.class);
|
||||
|
||||
@Resource
|
||||
private RoleMenuEODao dao;
|
||||
|
||||
@Override
|
||||
public RoleMenuEODao getDao() {
|
||||
return dao;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,382 @@
|
||||
package com.adc.da.sys.service;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
import com.adc.da.sys.dao.mysql.UserRoleEODao;
|
||||
import com.adc.da.sys.entity.RoleEO;
|
||||
import com.adc.da.sys.entity.UserRoleEO;
|
||||
import com.adc.da.sys.service.iservice.IUserEoService;
|
||||
import com.adc.da.sys.util.EncryptUtil;
|
||||
import com.adc.da.sys.vo.UserImportVO;
|
||||
import com.adc.da.sys.vo.ddm.DdmUserQueryVO;
|
||||
import com.adc.da.sys.vo.ddm.DdmUserVO;
|
||||
import com.adc.da.util.exception.AdcDaBaseException;
|
||||
import com.adc.da.util.http.PageInfo;
|
||||
import com.adc.da.util.utils.*;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.adc.da.sys.dao.mysql.UserEODao;
|
||||
import com.adc.da.sys.entity.UserEO;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 用户管理模块Service层
|
||||
* <b>版权所有:<b>版权归天津卡达克数据技术中心所有。<br>
|
||||
*
|
||||
* @author comments created by Lee Kwanho
|
||||
* @see UserEODao
|
||||
* @see com.adc.da.sys.controller.UserEOController
|
||||
*/
|
||||
@Service("userEOService")
|
||||
@Transactional
|
||||
public class UserEOServiceImpl implements IUserEoService {
|
||||
|
||||
|
||||
@Value("${isPassEncrypted}")
|
||||
private boolean isPassEncrypted;
|
||||
|
||||
@Resource
|
||||
private UserEODao dao;
|
||||
|
||||
@Resource
|
||||
private UserRoleEODao userRoleEODao;
|
||||
|
||||
@Resource
|
||||
private RoleEOService roleEOService;
|
||||
|
||||
|
||||
/**
|
||||
* 获取角色信息,用户名,用于新增用户校验
|
||||
* 根据account获取UserEO
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @return 用户信息
|
||||
*/
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public UserEO getUserByLoginName(String userName, String usid) {
|
||||
QueryWrapper<UserEO> wrapper = new QueryWrapper();
|
||||
wrapper.eq("ACCOUNT", userName).eq("DEL_FLAG", "0");
|
||||
if (StringUtils.isNotEmpty(usid)) {
|
||||
wrapper.ne("USID", usid);
|
||||
}
|
||||
return dao.selectOne(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getUserCountByEmail(String email, String usid) {
|
||||
QueryWrapper<UserEO> wrapper = new QueryWrapper();
|
||||
wrapper.eq("EMAIL", email).eq("DEL_FLAG", "0");
|
||||
if (StringUtils.isNotEmpty(usid)) {
|
||||
wrapper.ne("USID", usid);
|
||||
}
|
||||
return dao.selectCount(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void save(UserEO eo) {
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
if (StringUtils.isEmpty(eo.getUsid())) {
|
||||
eo.setDelFlag(0);
|
||||
eo.setEmail(EncryptUtil.encrypt(eo.getEmail()));
|
||||
eo.setCreateTime(format.format(new Date()));
|
||||
eo.setUpdateTime(format.format(new Date()));
|
||||
eo.setPassword(EncryptUtil.encrypt(eo.getPassword()));
|
||||
eo.setCellPhoneNumber(EncryptUtil.encrypt(eo.getCellPhoneNumber()));
|
||||
eo.setIsUse("1");
|
||||
/**
|
||||
* 区分本系统自建用户和同步过来的用户
|
||||
* 1代表本系统自建用户
|
||||
* 0代表同步过来的用户
|
||||
*/
|
||||
eo.setIsSelf("1");
|
||||
eo.setUsid(com.adc.da.util.utils.UUID.randomUUID10());
|
||||
dao.insert(eo);
|
||||
} else {
|
||||
UserEO userEO = dao.selectById(eo.getUsid());
|
||||
userEO.setUsname(eo.getUsname());
|
||||
userEO.setCellPhoneNumber(EncryptUtil.encrypt(eo.getCellPhoneNumber()));
|
||||
userEO.setEmail(EncryptUtil.encrypt(eo.getEmail()));
|
||||
userEO.setDepartment(eo.getDepartment());
|
||||
userEO.setPassword(StringUtils.isEmpty(eo.getPassword()) ? userEO.getPassword() : EncryptUtil.encrypt(eo.getPassword()));
|
||||
userEO.setUpdateTime(format.format(new Date()));
|
||||
userEO.setAccount(eo.getAccount());
|
||||
dao.updateById(userEO);
|
||||
//删除旧的角色
|
||||
QueryWrapper<UserRoleEO> deleteWapper =new QueryWrapper<>();
|
||||
deleteWapper.eq("user_id",userEO.getUsid());
|
||||
userRoleEODao.delete(deleteWapper);
|
||||
}
|
||||
eo.getRoleIdList().forEach(c -> {
|
||||
UserRoleEO userRoleEO = new UserRoleEO();
|
||||
userRoleEO.setUserId(eo.getUsid());
|
||||
userRoleEO.setRoleId(c);
|
||||
userRoleEODao.insert(userRoleEO);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveBatch(List<UserEO> userEOList) {
|
||||
dao.insertUserBatch(userEOList);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setIsUse(String usid, String type) {
|
||||
UserEO userEO = dao.selectById(usid);
|
||||
userEO.setIsUse(type);
|
||||
dao.updateById(userEO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserEO getUserById(String usid) {
|
||||
UserEO userEO = dao.selectById(usid);
|
||||
return userEO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<Map<String, Object>> list(int pageNo, int pageSize, String account, String roleName) {
|
||||
IPage page = new Page();
|
||||
page.setCurrent(pageNo);
|
||||
page.setSize(pageSize);
|
||||
IPage<Map<String, Object>> list = dao.list(page, account, roleName);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delete(String ids) {
|
||||
String[] idArray = ids.split(",");
|
||||
for (String id : idArray) {
|
||||
|
||||
UserEO userEO = dao.selectById(id);
|
||||
userEO.setDelFlag(1);
|
||||
dao.updateById(userEO);
|
||||
//删除用户的角色
|
||||
QueryWrapper<UserRoleEO> deleteWapper =new QueryWrapper<>();
|
||||
deleteWapper.eq("user_id",userEO.getUsid());
|
||||
userRoleEODao.delete(deleteWapper);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户及用户所对应的角色
|
||||
*
|
||||
* @param id 用户id
|
||||
* @return 用户角色信息
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public UserEO getUserWithRoles(String id) {
|
||||
return dao.getUserWithRoles(id);
|
||||
}
|
||||
|
||||
|
||||
// 根据account获取未逻辑删除的UserEO
|
||||
@Transactional(readOnly = true)
|
||||
public UserEO getUserByLoginNameNotDeleted(String userName) {
|
||||
|
||||
UserEO userEO = dao.getUserEOByAccountNotDeleted(userName);
|
||||
if (userEO == null) {
|
||||
return null;
|
||||
}
|
||||
return userEO;
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public PageInfo<DdmUserVO> getUserPage(DdmUserQueryVO query) {
|
||||
IPage page = new Page();
|
||||
page.setCurrent(query.getPageNum());
|
||||
page.setSize(query.getPageSize());
|
||||
IPage<DdmUserVO> userPage = dao.getUserPage(page,query.getUserAccount(),query.getUserName());
|
||||
Long count = dao.getUserCount(query);
|
||||
PageInfo<DdmUserVO> pageInfo = new PageInfo();
|
||||
pageInfo.setPageSize(query.getPageSize());
|
||||
pageInfo.setCount(count);
|
||||
pageInfo.setList(userPage.getRecords());
|
||||
return pageInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void importExcelUser(List<UserImportVO> list) {
|
||||
checkExcel(list);
|
||||
Map<String, List<UserImportVO>> dataMap = list.stream().collect(Collectors.groupingBy(UserImportVO::getOperation));
|
||||
Set<String> keySet = dataMap.keySet();
|
||||
Date date = new Date();
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
keySet.forEach(key -> {
|
||||
//新增
|
||||
if ("add".equals(key)) {
|
||||
List<UserImportVO> userEOArrayList = dataMap.get(key);
|
||||
ArrayList<UserEO> addList = new ArrayList<>();
|
||||
ArrayList<UserRoleEO> addRoleList = new ArrayList<>();
|
||||
userEOArrayList.forEach(userImportVO -> {
|
||||
UserEO userEO = new UserEO();
|
||||
BeanUtils.copyProperties(userImportVO, userEO);
|
||||
userEO.setDelFlag(0);
|
||||
userEO.setIsSelf("1");
|
||||
userEO.setUsid(com.adc.da.util.utils.UUID.randomUUID10());
|
||||
userEO.setCellPhoneNumber(userImportVO.getCellPhoneNumber() == null ? EncryptUtil.encrypt("") : EncryptUtil.encrypt(userImportVO.getCellPhoneNumber()));
|
||||
userEO.setPassword(EncryptUtil.encrypt("EI$XIL@vdc9ptev7"));
|
||||
userEO.setEmail(userImportVO.getEmail() == null ? EncryptUtil.encrypt("") : EncryptUtil.encrypt(userImportVO.getEmail()));
|
||||
userEO.setCreateTime(simpleDateFormat.format(date));
|
||||
userEO.setUpdateTime(simpleDateFormat.format(date));
|
||||
userEO.setRoleId(userImportVO.getRoleId());
|
||||
addList.add(userEO);
|
||||
|
||||
});
|
||||
saveBatch(addList);
|
||||
//添加角色
|
||||
addList.forEach(userEO -> {
|
||||
//角色
|
||||
UserRoleEO userRoleEO = new UserRoleEO();
|
||||
userRoleEO.setRoleId(userEO.getRoleId());
|
||||
userRoleEO.setUserId(userEO.getUsid());
|
||||
addRoleList.add(userRoleEO);
|
||||
});
|
||||
userRoleEODao.insertBatch(addRoleList);
|
||||
|
||||
}
|
||||
//更新
|
||||
if ("full".equals(key)) {
|
||||
List<UserImportVO> userEOArrayList = dataMap.get(key);
|
||||
ArrayList<String> userIDList = new ArrayList<>();
|
||||
ArrayList<UserRoleEO> userRoleList = new ArrayList<>();
|
||||
userEOArrayList.forEach(userImportVO -> {
|
||||
QueryWrapper<UserEO> queryWrapper = new QueryWrapper();
|
||||
queryWrapper.eq("ACCOUNT", userImportVO.getAccount());
|
||||
queryWrapper.eq("DEL_FLAG", 0);
|
||||
UserEO userEO = dao.selectOne(queryWrapper);
|
||||
if(null!=userEO){
|
||||
userEO.setUsname(userImportVO.getUsname());
|
||||
userEO.setCellPhoneNumber(userImportVO.getCellPhoneNumber() == null ? EncryptUtil.encrypt("") : EncryptUtil.encrypt(userImportVO.getCellPhoneNumber()));
|
||||
userEO.setEmail(userImportVO.getEmail() == null ? EncryptUtil.encrypt("") : EncryptUtil.encrypt(userImportVO.getEmail()));
|
||||
userEO.setDepartment(userImportVO.getDepartment());
|
||||
userEO.setIsUse(userImportVO.getIsUse());
|
||||
userEO.setUpdateTime(simpleDateFormat.format(date));
|
||||
dao.updateById(userEO);
|
||||
userIDList.add(userEO.getUsid());
|
||||
UserRoleEO userRoleEO = new UserRoleEO();
|
||||
userRoleEO.setUserId(userEO.getUsid());
|
||||
userRoleEO.setRoleId(userImportVO.getRoleId());
|
||||
userRoleList.add(userRoleEO);
|
||||
}
|
||||
});
|
||||
QueryWrapper<UserRoleEO> deleteWapper = new QueryWrapper<>();
|
||||
deleteWapper.in("user_id", userIDList);
|
||||
userRoleEODao.delete(deleteWapper);
|
||||
userRoleEODao.insertBatch(userRoleList);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> allList(String account, String roleName) {
|
||||
return dao.allList(account,roleName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserEO> getUserByMail(List<String> mailList) {
|
||||
return dao.getUserByMail(mailList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserEO> getUserByAccount(List<String> accountList) {
|
||||
return dao.getUserByAccount(accountList);
|
||||
}
|
||||
|
||||
void checkExcel(List<UserImportVO> list) {
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
throw new AdcDaBaseException("数据不能为空");
|
||||
}
|
||||
//所有角色
|
||||
List<RoleEO> allRoles = roleEOService.findAll();
|
||||
HashMap<String, RoleEO> roleEOMap = new HashMap<>();
|
||||
for (RoleEO roleEO : allRoles) {
|
||||
roleEOMap.put(roleEO.getName(), roleEO);
|
||||
}
|
||||
//所有用户
|
||||
List<String> existUserAccounts = new ArrayList<>();
|
||||
List<String> existUserAccountsUpdate = new ArrayList<>();
|
||||
QueryWrapper<UserEO> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("del_flag", 0);
|
||||
List<UserEO> allUsers = dao.selectList(queryWrapper);
|
||||
for (UserEO userEO : allUsers) {
|
||||
existUserAccounts.add(userEO.getAccount());
|
||||
existUserAccountsUpdate.add(userEO.getAccount());
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
UserImportVO userImportVO = list.get(i);
|
||||
if (StringUtils.isEmpty(userImportVO.getAccount())) {
|
||||
throw new AdcDaBaseException("第"+(i+1)+"行"+"用户名不能为空");
|
||||
}
|
||||
if (StringUtils.isEmpty(userImportVO.getUsname())) {
|
||||
throw new AdcDaBaseException("第"+(i+1)+"行"+"姓名不能为空");
|
||||
}
|
||||
if (userImportVO.getUsname().length() > 20) {
|
||||
throw new AdcDaBaseException("第"+(i+1)+"行"+"姓名不超过20字符");
|
||||
}
|
||||
if ("admin".equals(userImportVO.getAccount()) ||
|
||||
"root".equals(userImportVO.getAccount()) ||
|
||||
"administrator".equals(userImportVO.getAccount()) ||
|
||||
"test".equals(userImportVO.getAccount()) ||
|
||||
"tester".equals(userImportVO.getAccount())) {
|
||||
throw new AdcDaBaseException("第"+(i+1)+"行"+"用户名不符合规则");
|
||||
}
|
||||
if (StringUtils.isNotBlank(userImportVO.getDepartment())) {
|
||||
if (userImportVO.getDepartment().length() > 50) {
|
||||
throw new AdcDaBaseException("第"+(i+1)+"行"+"部门不超过50字符");
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotBlank(userImportVO.getEmail())) {
|
||||
userImportVO.setEmail(userImportVO.getEmail().replace("amp;", ""));
|
||||
}
|
||||
if (StringUtils.isNotBlank(userImportVO.getCellPhoneNumber())) {
|
||||
if (!userImportVO.getCellPhoneNumber().matches("^[1][3,4,5,7,8,9][0-9]{9}$")) {
|
||||
throw new AdcDaBaseException("第"+(i+1)+"行"+"手机号不符合规则");
|
||||
}
|
||||
}
|
||||
if (StringUtils.isEmpty(userImportVO.getOperation())) {
|
||||
throw new AdcDaBaseException("第"+(i+1)+"行"+"操作(add添加、full覆盖角色)不能为空");
|
||||
}
|
||||
if (StringUtils.isEmpty(userImportVO.getIsUse())) {
|
||||
throw new AdcDaBaseException("第"+(i+1)+"行"+"是否启用不能为空");
|
||||
}
|
||||
if (!roleEOMap.keySet().contains(userImportVO.getRoleName())) {
|
||||
throw new AdcDaBaseException("第"+(i+1)+"行"+"角色:" + userImportVO.getRoleName() + "不存在,请检查");
|
||||
}
|
||||
if ("add".equals(userImportVO.getOperation())) {
|
||||
if (existUserAccounts.contains(userImportVO.getAccount())) {
|
||||
throw new AdcDaBaseException("第"+(i+1)+"行"+"用户名:" + userImportVO.getAccount() + "已存在,请检查");
|
||||
}else{
|
||||
existUserAccounts.add(userImportVO.getAccount());
|
||||
}
|
||||
}
|
||||
if ("full".equals(userImportVO.getOperation())) {
|
||||
if (!existUserAccountsUpdate.contains(userImportVO.getAccount())) {
|
||||
throw new AdcDaBaseException("第"+(i+1)+"行"+"用户名:" + userImportVO.getAccount() + "不存在,无法更新,请检查");
|
||||
}
|
||||
}
|
||||
userImportVO.setRoleId(roleEOMap.get(userImportVO.getRoleName()).getId());
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.adc.da.sys.service.iservice;
|
||||
|
||||
import com.adc.da.sys.entity.UserEO;
|
||||
import com.adc.da.sys.vo.UserImportVO;
|
||||
import com.adc.da.sys.vo.ddm.DdmUserQueryVO;
|
||||
import com.adc.da.sys.vo.ddm.DdmUserVO;
|
||||
import com.adc.da.util.http.PageInfo;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author doudxw
|
||||
* @Date 2021/11/4 09:17
|
||||
*/
|
||||
public interface IUserEoService {
|
||||
|
||||
/** 根据登录名和id查询用户
|
||||
* @param userName
|
||||
* @param usid
|
||||
* @return
|
||||
*/
|
||||
UserEO getUserByLoginName(String userName,String usid);
|
||||
|
||||
/**
|
||||
* 根据邮箱和id查询用户数量
|
||||
* @param email
|
||||
* @param usid
|
||||
* @return
|
||||
*/
|
||||
int getUserCountByEmail(String email,String usid);
|
||||
|
||||
/**
|
||||
* 新增或者编辑用户
|
||||
* @param eo
|
||||
*/
|
||||
void save(UserEO eo);
|
||||
|
||||
void setIsUse(String usid,String type);
|
||||
|
||||
UserEO getUserById(String usid);
|
||||
|
||||
IPage<Map<String, Object>> list(int pageNo, int pageSize, String account, String roleName);
|
||||
|
||||
void delete(String ids);
|
||||
|
||||
UserEO getUserWithRoles(String id);
|
||||
|
||||
UserEO getUserByLoginNameNotDeleted(String userName);
|
||||
|
||||
public PageInfo<DdmUserVO> getUserPage(DdmUserQueryVO query);
|
||||
|
||||
public void importExcelUser(List<UserImportVO> list);
|
||||
|
||||
List<Map<String, Object>> allList(String account, String roleName);
|
||||
|
||||
List<UserEO> getUserByMail(List<String> mailList);
|
||||
|
||||
List<UserEO> getUserByAccount(List<String> mailList);
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
package com.adc.da.sys.util;
|
||||
|
||||
import com.adc.da.util.utils.SpringContextHolder;
|
||||
import net.sf.ehcache.Cache;
|
||||
import net.sf.ehcache.CacheManager;
|
||||
import net.sf.ehcache.Element;
|
||||
|
||||
/**
|
||||
* Cache工具类
|
||||
*/
|
||||
public class CacheUtils {
|
||||
|
||||
private CacheUtils() {
|
||||
throw new IllegalStateException("CacheUtils.java");
|
||||
}
|
||||
|
||||
private static CacheManager cacheManager = SpringContextHolder.getBean("ehCacheManagerFactoryBean");
|
||||
|
||||
private static final String SYS_CACHE = "sysCache";
|
||||
|
||||
private static final String ERROR_CACHE = "errorCache";
|
||||
|
||||
private static final String SUBJECT_CACHE = "subjectCache" ;
|
||||
private static final String SHIRO_ACTIVE_SESSION_CACHE = "shiro-activeSessionCache";
|
||||
|
||||
|
||||
public static Object get(String key) {
|
||||
return get(SYS_CACHE, key);
|
||||
}
|
||||
|
||||
public static void put(String key, Object value) {
|
||||
put(SYS_CACHE, key, value);
|
||||
}
|
||||
|
||||
public static void remove(String key) {
|
||||
remove(SYS_CACHE, key);
|
||||
}
|
||||
|
||||
//以下三个方法由丁强添加,配合main模块下resource/cache/ehcache-local.xml
|
||||
//<cache name="errorCache" maxElementsInMemory="100" timeToIdleSeconds="180" timeToLiveSeconds="300" eternal="false" overflowToDisk="true"/>
|
||||
public static Object getErrorCache(String key) {
|
||||
return get(ERROR_CACHE, key);
|
||||
}
|
||||
|
||||
public static void putErrorCache(String key, Object value) {
|
||||
put(ERROR_CACHE, key, value);
|
||||
}
|
||||
|
||||
public static void removeErrorCache(String key) {
|
||||
remove(ERROR_CACHE, key);
|
||||
}
|
||||
|
||||
|
||||
//以下三个方法由丁强添加,配合main模块下resource/cache/ehcache-local.xml
|
||||
//<cache name="subjectCache" maxElementsInMemory="100" timeToIdleSeconds="180" timeToLiveSeconds="300" eternal="false" overflowToDisk="true"/>
|
||||
public static Object getSubjectCache(String key) {
|
||||
return get(SUBJECT_CACHE, key);
|
||||
}
|
||||
|
||||
public static void putSubjectCache(String key, Object value) {
|
||||
put(SUBJECT_CACHE, key, value);
|
||||
}
|
||||
|
||||
public static void removeSubjectCache(String key) {
|
||||
remove(SUBJECT_CACHE, key);
|
||||
}
|
||||
|
||||
public static Cache getSubjectCacheObject() {
|
||||
Cache cache = cacheManager.getCache(SUBJECT_CACHE);
|
||||
if (cache == null) {
|
||||
cacheManager.addCache(SUBJECT_CACHE);
|
||||
cache = cacheManager.getCache(SUBJECT_CACHE);
|
||||
cache.getCacheConfiguration().setEternal(true);
|
||||
}
|
||||
return cache;
|
||||
}
|
||||
|
||||
//cacheManager.getCache("shiroActiveSessionCache").remove(sessionid)
|
||||
|
||||
public static Cache getShiroSessionCacheObject() {
|
||||
Cache cache = cacheManager.getCache(SHIRO_ACTIVE_SESSION_CACHE);
|
||||
if (cache == null) {
|
||||
cacheManager.addCache(SHIRO_ACTIVE_SESSION_CACHE);
|
||||
cache = cacheManager.getCache(SHIRO_ACTIVE_SESSION_CACHE);
|
||||
cache.getCacheConfiguration().setEternal(true);
|
||||
}
|
||||
return cache;
|
||||
}
|
||||
|
||||
public static void putShiroSessionCache(String key, Object value) {
|
||||
put(SHIRO_ACTIVE_SESSION_CACHE, key, value);
|
||||
}
|
||||
|
||||
public static Object getShiroSessionCache(String key) {
|
||||
return get(SUBJECT_CACHE, key);
|
||||
}
|
||||
|
||||
public static void removeShiroSessionCache(String key) {
|
||||
remove(SHIRO_ACTIVE_SESSION_CACHE, key);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static Object get(String cacheName, String key) {
|
||||
Element element = getCache(cacheName).get(key);
|
||||
return element == null ? null : element.getObjectValue();
|
||||
}
|
||||
|
||||
public static void put(String cacheName, String key, Object value) {
|
||||
Element element = new Element(key, value);
|
||||
getCache(cacheName).put(element);
|
||||
}
|
||||
|
||||
public static void remove(String cacheName, String key) {
|
||||
getCache(cacheName).remove(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得一个Cache,没有则创建一个。
|
||||
*
|
||||
* @param cacheName
|
||||
* @return
|
||||
*/
|
||||
private static Cache getCache(String cacheName) {
|
||||
Cache cache = cacheManager.getCache(cacheName);
|
||||
if (cache == null) {
|
||||
cacheManager.addCache(cacheName);
|
||||
cache = cacheManager.getCache(cacheName);
|
||||
cache.getCacheConfiguration().setEternal(true);
|
||||
}
|
||||
return cache;
|
||||
}
|
||||
|
||||
public static CacheManager getCacheManager() {
|
||||
return cacheManager;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
package com.adc.da.sys.util;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
|
||||
public class CompressUtil {
|
||||
|
||||
/**
|
||||
* @param path 要压缩的文件路径
|
||||
* @param format 生成的格式(zip、rar)d
|
||||
*/
|
||||
public static void generateFile(String path, String format) throws Exception {
|
||||
|
||||
File file = new File(path);
|
||||
// 压缩文件的路径不存在
|
||||
if (!file.exists()) {
|
||||
throw new Exception("路径 " + path + " 不存在文件,无法进行压缩...");
|
||||
}
|
||||
// 用于存放压缩文件的文件夹
|
||||
// String generateFile = file.getParent() + File.separator + "CompressFile";
|
||||
// File compress = new File(generateFile);
|
||||
// // 如果文件夹不存在,进行创建
|
||||
// if (!compress.exists()) {
|
||||
// compress.mkdirs();
|
||||
// }
|
||||
//
|
||||
// // 目的压缩文件
|
||||
// String generateFileName = compress.getAbsolutePath() + File.separator + "AAA" + file.getName() + "." + format;
|
||||
|
||||
String generateFileName="/Users/sxh/test.rar";
|
||||
|
||||
// 输入流 表示从一个源读取数据
|
||||
// 输出流 表示向一个目标写入数据
|
||||
|
||||
// 输出流
|
||||
FileOutputStream outputStream = new FileOutputStream(generateFileName);
|
||||
|
||||
// 压缩输出流
|
||||
ZipOutputStream zipOutputStream = new ZipOutputStream(new BufferedOutputStream(outputStream));
|
||||
|
||||
generateFile(zipOutputStream, file, "");
|
||||
|
||||
System.out.println("源文件位置:" + file.getAbsolutePath() + ",目的压缩文件生成位置:" + generateFileName);
|
||||
// 关闭 输出流
|
||||
zipOutputStream.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param out 输出流
|
||||
* @param file 目标文件
|
||||
* @param dir 文件夹
|
||||
* @throws Exception
|
||||
*/
|
||||
private static void generateFile(ZipOutputStream out, File file, String dir) throws Exception {
|
||||
|
||||
// 当前的是文件夹,则进行一步处理
|
||||
if (file.isDirectory()) {
|
||||
//得到文件列表信息
|
||||
File[] files = file.listFiles();
|
||||
|
||||
//将文件夹添加到下一级打包目录
|
||||
out.putNextEntry(new ZipEntry(dir + "/"));
|
||||
|
||||
dir = dir.length() == 0 ? "" : dir + "/";
|
||||
|
||||
//循环将文件夹中的文件打包
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
generateFile(out, files[i], dir + files[i].getName());
|
||||
}
|
||||
|
||||
} else { // 当前是文件
|
||||
|
||||
// 输入流
|
||||
FileInputStream inputStream = new FileInputStream(file);
|
||||
// 标记要打包的条目
|
||||
out.putNextEntry(new ZipEntry(file.getName()));
|
||||
// 进行写操作
|
||||
int len = 0;
|
||||
byte[] bytes = new byte[1024];
|
||||
while ((len = inputStream.read(bytes)) > 0) {
|
||||
out.write(bytes, 0, len);
|
||||
}
|
||||
// 关闭输入流
|
||||
inputStream.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 递归压缩文件
|
||||
* @param output ZipOutputStream 对象流
|
||||
* @param file 压缩的目标文件流
|
||||
* @param childPath 条目目录
|
||||
*/
|
||||
private static void zip(ZipOutputStream output,File file,String childPath){
|
||||
FileInputStream input = null;
|
||||
try {
|
||||
// 文件为目录
|
||||
if (file.isDirectory()) {
|
||||
// 得到当前目录里面的文件列表
|
||||
File list[] = file.listFiles();
|
||||
childPath = childPath + (childPath.length() == 0 ? "" : "/")
|
||||
+ file.getName();
|
||||
// 循环递归压缩每个文件
|
||||
for (File f : list) {
|
||||
zip(output, f, childPath);
|
||||
}
|
||||
} else {
|
||||
// 压缩文件
|
||||
childPath = (childPath.length() == 0 ? "" : childPath + "/")
|
||||
+ file.getName();
|
||||
output.putNextEntry(new ZipEntry(childPath));
|
||||
input = new FileInputStream(file);
|
||||
int readLen = 0;
|
||||
byte[] buffer = new byte[1024 * 8];
|
||||
while ((readLen = input.read(buffer, 0, 1024 * 8)) != -1) {
|
||||
output.write(buffer, 0, readLen);
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
} finally {
|
||||
// 关闭流
|
||||
if (input != null) {
|
||||
try {
|
||||
input.close();
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static String zipFile(File path,String format) throws Exception {
|
||||
String generatePath = "";
|
||||
if( path.isDirectory() ){
|
||||
generatePath = path.getParent().endsWith("/") == false ? path.getParent() + File.separator + path.getName() + "." + format: path.getParent() + path.getName() + "." + format;
|
||||
}else {
|
||||
generatePath = path.getParent().endsWith("/") == false ? path.getParent() + File.separator : path.getParent();
|
||||
generatePath += path.getName().substring(0,path.getName().lastIndexOf(".")) + "." + format;
|
||||
}
|
||||
// 输出流
|
||||
FileOutputStream outputStream = new FileOutputStream( generatePath );
|
||||
// 压缩输出流
|
||||
ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(outputStream));
|
||||
zip(out, path,"");
|
||||
out.flush();
|
||||
out.close();
|
||||
|
||||
return generatePath;
|
||||
}
|
||||
|
||||
// 测试
|
||||
public static void main(String[] args) {
|
||||
// String path = "/Users/sxh/reportTest/2020-02";
|
||||
// String format = "rar";
|
||||
//
|
||||
// try {
|
||||
// generateFile(path, format);
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// System.out.println(e.getMessage());
|
||||
// }
|
||||
|
||||
|
||||
String path = "/Users/sxh/reportTest/2020-02";
|
||||
String format = "rar";
|
||||
try {
|
||||
System.out.println(zipFile(new File(path),format));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package com.adc.da.sys.util;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* @Author sima
|
||||
* @Date 2022/7/11 10:30
|
||||
*/
|
||||
public class DefaultConfigurer {
|
||||
|
||||
private String mail_smtp;
|
||||
|
||||
private String mail_smtp_port;
|
||||
|
||||
private String mail_pop_port;
|
||||
|
||||
public String getMail_smtp() {
|
||||
return mail_smtp;
|
||||
}
|
||||
|
||||
public void setMail_smtp(String mail_smtp) {
|
||||
this.mail_smtp = mail_smtp;
|
||||
}
|
||||
|
||||
public String getMail_smtp_port() {
|
||||
return mail_smtp_port;
|
||||
}
|
||||
|
||||
public void setMail_smtp_port(String mail_smtp_port) {
|
||||
this.mail_smtp_port = mail_smtp_port;
|
||||
}
|
||||
|
||||
public String getMail_pop_port() {
|
||||
return mail_pop_port;
|
||||
}
|
||||
|
||||
public void setMail_pop_port(String mail_pop_port) {
|
||||
this.mail_pop_port = mail_pop_port;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取SMTP默认配置
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Properties getSMTP() {
|
||||
Properties p = new Properties();
|
||||
// p.setProperty("mail.smtp.host", "smtp.qq.com"); // 按需要更改
|
||||
p.setProperty("mail.smtp.host", mail_smtp); // 按需要更改
|
||||
p.setProperty("mail.smtp.protocol", "smtp");
|
||||
// p.setProperty("mail.smtp.port", "465");
|
||||
p.setProperty("mail.smtp.port", mail_smtp_port);
|
||||
|
||||
p.setProperty("mail.smtp.auth", "true");
|
||||
|
||||
// SSL安全连接参数 长安发件服务器不配,qq网易邮箱需要配
|
||||
if ("cmp.changan.com".equals(mail_smtp)) {
|
||||
p.setProperty("mail.smtp.starttls.enable", "true");
|
||||
} else {
|
||||
p.setProperty("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
|
||||
p.setProperty("mail.smtp.socketFactory.fallback", "false");
|
||||
// p.setProperty("mail.smtp.socketFactory.port", "465");
|
||||
p.setProperty("mail.smtp.socketFactory.port", mail_smtp_port);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取POP3收信配置
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Properties getPOP3() {
|
||||
Properties p = new Properties();
|
||||
// p.setProperty("mail.pop3.host", "pop.qq.com"); // 按需要更改
|
||||
p.setProperty("mail.pop3.host", mail_smtp); // 按需要更改
|
||||
// p.setProperty("mail.pop3.port", "995");
|
||||
p.setProperty("mail.pop3.port", mail_pop_port);
|
||||
// SSL安全连接参数
|
||||
// p.setProperty("mail.pop3.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
|
||||
// p.setProperty("mail.pop3.socketFactory.fallback", "false");
|
||||
//// p.setProperty("mail.pop3.socketFactory.port", "995");
|
||||
// p.setProperty("mail.pop3.socketFactory.port", mail_pop_port);
|
||||
p.setProperty("mail.smtp.starttls.enable", "true");
|
||||
return p;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取IMAP收信配置
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Properties getIMAP() {
|
||||
Properties p = new Properties();
|
||||
p.setProperty("mail.imap.host", "imap.qq.com"); // 按需要更改
|
||||
p.setProperty("mail.imap.port", "993");
|
||||
// SSL安全连接参数
|
||||
p.setProperty("mail.imap.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
|
||||
p.setProperty("mail.imap.socketFactory.fallback", "false");
|
||||
p.setProperty("mail.imap.socketFactory.port", "993");
|
||||
return p;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,482 @@
|
||||
package com.adc.da.sys.util;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import sun.misc.BASE64Decoder;
|
||||
import sun.misc.BASE64Encoder;
|
||||
|
||||
import javax.crypto.*;
|
||||
import javax.crypto.spec.IvParameterSpec;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.SecureRandom;
|
||||
|
||||
/**
|
||||
* 功能描述 加密常用类
|
||||
*/
|
||||
@Slf4j
|
||||
public class EncryptUtil {
|
||||
// 密钥是16位长度的byte[]进行Base64转换后得到的字符串
|
||||
public static String key = "LmMGStGtOpF4xNyvYt54EQ==";
|
||||
|
||||
/**
|
||||
* <li>
|
||||
* 方法名称:encrypt</li> <li>
|
||||
* 加密方法
|
||||
*
|
||||
* @param xmlStr
|
||||
* 需要加密的消息字符串
|
||||
* @return 加密后的字符串
|
||||
*/
|
||||
public static String encrypt(String xmlStr) {
|
||||
byte[] encrypt = null;
|
||||
|
||||
try {
|
||||
// 取需要加密内容的utf-8编码。
|
||||
encrypt = xmlStr.getBytes("utf-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// 取MD5Hash码,并组合加密数组
|
||||
byte[] md5Hasn = null;
|
||||
try {
|
||||
md5Hasn = EncryptUtil.MD5Hash(encrypt, 0, encrypt.length);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// 组合消息体
|
||||
byte[] totalByte = EncryptUtil.addMD5(md5Hasn, encrypt);
|
||||
|
||||
// 取密钥和偏转向量
|
||||
byte[] key = new byte[8];
|
||||
byte[] iv = new byte[8];
|
||||
getKeyIV(EncryptUtil.key, key, iv);
|
||||
SecretKeySpec deskey = new SecretKeySpec(key, "DES");
|
||||
IvParameterSpec ivParam = new IvParameterSpec(iv);
|
||||
|
||||
// 使用DES算法使用加密消息体
|
||||
byte[] temp = null;
|
||||
try {
|
||||
temp = EncryptUtil.DES_CBC_Encrypt(totalByte, deskey, ivParam);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// 使用Base64加密后返回
|
||||
return new BASE64Encoder().encode(temp);
|
||||
}
|
||||
|
||||
/**
|
||||
* <li>
|
||||
* 方法名称:encrypt</li> <li>
|
||||
* 功能描述:
|
||||
*
|
||||
* <pre>
|
||||
* 解密方法
|
||||
* </pre>
|
||||
*
|
||||
* </li>
|
||||
*
|
||||
* @param xmlStr
|
||||
* 需要解密的消息字符串
|
||||
* @return 解密后的字符串
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String decrypt(String xmlStr) throws Exception {
|
||||
// base64解码
|
||||
BASE64Decoder decoder = new BASE64Decoder();
|
||||
byte[] encBuf = null;
|
||||
try {
|
||||
encBuf = decoder.decodeBuffer(xmlStr);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// 取密钥和偏转向量
|
||||
byte[] key = new byte[8];
|
||||
byte[] iv = new byte[8];
|
||||
getKeyIV(EncryptUtil.key, key, iv);
|
||||
|
||||
SecretKeySpec deskey = new SecretKeySpec(key, "DES");
|
||||
IvParameterSpec ivParam = new IvParameterSpec(iv);
|
||||
|
||||
// 使用DES算法解密
|
||||
byte[] temp = null;
|
||||
try {
|
||||
temp = EncryptUtil.DES_CBC_Decrypt(encBuf, deskey, ivParam);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// 进行解密后的md5Hash校验
|
||||
byte[] md5Hash = null;
|
||||
try {
|
||||
md5Hash = EncryptUtil.MD5Hash(temp, 16, temp.length - 16);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// 进行解密校检
|
||||
for (int i = 0; i < md5Hash.length; i++) {
|
||||
if (md5Hash[i] != temp[i]) {
|
||||
// System.out.println(md5Hash[i] + "MD5校验错误。" + temp[i]);
|
||||
throw new Exception("MD5校验错误。");
|
||||
}
|
||||
}
|
||||
|
||||
// 返回解密后的数组,其中前16位MD5Hash码要除去。
|
||||
return new String(temp, 16, temp.length - 16, "utf-8");
|
||||
}
|
||||
|
||||
/**
|
||||
* <li>
|
||||
* 方法名称:TripleDES_CBC_Encrypt</li> <li>
|
||||
* 功能描述:
|
||||
*
|
||||
* <pre>
|
||||
* 经过封装的三重DES/CBC加密算法,如果包含中文,请注意编码。
|
||||
* </pre>
|
||||
*
|
||||
* </li>
|
||||
*
|
||||
* @param sourceBuf
|
||||
* 需要加密内容的字节数组。
|
||||
* @param deskey
|
||||
* KEY 由24位字节数组通过SecretKeySpec类转换而成。
|
||||
* @param ivParam
|
||||
* IV偏转向量,由8位字节数组通过IvParameterSpec类转换而成。
|
||||
* @return 加密后的字节数组
|
||||
* @throws Exception
|
||||
*/
|
||||
public static byte[] TripleDES_CBC_Encrypt(byte[] sourceBuf,
|
||||
SecretKeySpec deskey, IvParameterSpec ivParam) throws Exception {
|
||||
byte[] cipherByte;
|
||||
// 使用DES对称加密算法的CBC模式加密
|
||||
Cipher encrypt = Cipher.getInstance("TripleDES/CBC/PKCS5Padding");
|
||||
|
||||
encrypt.init(Cipher.ENCRYPT_MODE, deskey, ivParam);
|
||||
|
||||
cipherByte = encrypt.doFinal(sourceBuf, 0, sourceBuf.length);
|
||||
// 返回加密后的字节数组
|
||||
return cipherByte;
|
||||
}
|
||||
|
||||
/**
|
||||
* <li>
|
||||
* 方法名称:TripleDES_CBC_Decrypt</li> <li>
|
||||
* 功能描述:
|
||||
*
|
||||
* <pre>
|
||||
* 经过封装的三重DES / CBC解密算法
|
||||
* </pre>
|
||||
*
|
||||
* </li>
|
||||
*
|
||||
* @param sourceBuf
|
||||
* 需要解密内容的字节数组
|
||||
* @param deskey
|
||||
* KEY 由24位字节数组通过SecretKeySpec类转换而成。
|
||||
* @param ivParam
|
||||
* IV偏转向量,由6位字节数组通过IvParameterSpec类转换而成。
|
||||
* @return 解密后的字节数组
|
||||
* @throws Exception
|
||||
*/
|
||||
public static byte[] TripleDES_CBC_Decrypt(byte[] sourceBuf,
|
||||
SecretKeySpec deskey, IvParameterSpec ivParam) throws Exception {
|
||||
|
||||
byte[] cipherByte;
|
||||
// 获得Cipher实例,使用CBC模式。
|
||||
Cipher decrypt = Cipher.getInstance("TripleDES/CBC/PKCS5Padding");
|
||||
// 初始化加密实例,定义为解密功能,并传入密钥,偏转向量
|
||||
decrypt.init(Cipher.DECRYPT_MODE, deskey, ivParam);
|
||||
|
||||
cipherByte = decrypt.doFinal(sourceBuf, 0, sourceBuf.length);
|
||||
// 返回解密后的字节数组
|
||||
return cipherByte;
|
||||
}
|
||||
|
||||
/**
|
||||
* <li>
|
||||
* 方法名称:DES_CBC_Encrypt</li> <li>
|
||||
* 功能描述:
|
||||
*
|
||||
* <pre>
|
||||
* 经过封装的DES/CBC加密算法,如果包含中文,请注意编码。
|
||||
* </pre>
|
||||
*
|
||||
* </li>
|
||||
*
|
||||
* @param sourceBuf
|
||||
* 需要加密内容的字节数组。
|
||||
* @param deskey
|
||||
* KEY 由8位字节数组通过SecretKeySpec类转换而成。
|
||||
* @param ivParam
|
||||
* IV偏转向量,由8位字节数组通过IvParameterSpec类转换而成。
|
||||
* @return 加密后的字节数组
|
||||
* @throws Exception
|
||||
*/
|
||||
public static byte[] DES_CBC_Encrypt(byte[] sourceBuf,
|
||||
SecretKeySpec deskey, IvParameterSpec ivParam) throws Exception {
|
||||
byte[] cipherByte;
|
||||
// 使用DES对称加密算法的CBC模式加密
|
||||
Cipher encrypt = Cipher.getInstance("DES/CBC/PKCS5Padding");
|
||||
|
||||
encrypt.init(Cipher.ENCRYPT_MODE, deskey, ivParam);
|
||||
|
||||
cipherByte = encrypt.doFinal(sourceBuf, 0, sourceBuf.length);
|
||||
// 返回加密后的字节数组
|
||||
return cipherByte;
|
||||
}
|
||||
|
||||
/**
|
||||
* <li>
|
||||
* 方法名称:DES_CBC_Decrypt</li> <li>
|
||||
* 功能描述:
|
||||
*
|
||||
* <pre>
|
||||
* 经过封装的DES/CBC解密算法。
|
||||
* </pre>
|
||||
*
|
||||
* </li>
|
||||
*
|
||||
* @param sourceBuf
|
||||
* 需要解密内容的字节数组
|
||||
* @param deskey
|
||||
* KEY 由8位字节数组通过SecretKeySpec类转换而成。
|
||||
* @param ivParam
|
||||
* IV偏转向量,由6位字节数组通过IvParameterSpec类转换而成。
|
||||
* @return 解密后的字节数组
|
||||
* @throws Exception
|
||||
*/
|
||||
public static byte[] DES_CBC_Decrypt(byte[] sourceBuf,
|
||||
SecretKeySpec deskey, IvParameterSpec ivParam) throws Exception {
|
||||
|
||||
byte[] cipherByte;
|
||||
// 获得Cipher实例,使用CBC模式。
|
||||
Cipher decrypt = Cipher.getInstance("DES/CBC/PKCS5Padding");
|
||||
// 初始化加密实例,定义为解密功能,并传入密钥,偏转向量
|
||||
decrypt.init(Cipher.DECRYPT_MODE, deskey, ivParam);
|
||||
|
||||
cipherByte = decrypt.doFinal(sourceBuf, 0, sourceBuf.length);
|
||||
// 返回解密后的字节数组
|
||||
return cipherByte;
|
||||
}
|
||||
|
||||
/**
|
||||
* <li>
|
||||
* 方法名称:MD5Hash</li> <li>
|
||||
* 功能描述:
|
||||
*
|
||||
* <pre>
|
||||
* MD5,进行了简单的封装,以适用于加,解密字符串的校验。
|
||||
* </pre>
|
||||
*
|
||||
* </li>
|
||||
*
|
||||
* @param buf
|
||||
* 需要MD5加密字节数组。
|
||||
* @param offset
|
||||
* 加密数据起始位置。
|
||||
* @param length
|
||||
* 需要加密的数组长度。
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static byte[] MD5Hash(byte[] buf, int offset, int length)
|
||||
throws Exception {
|
||||
MessageDigest md = MessageDigest.getInstance("MD5");
|
||||
md.update(buf, offset, length);
|
||||
return md.digest();
|
||||
}
|
||||
|
||||
/**
|
||||
* <li>
|
||||
* 方法名称:byte2hex</li> <li>
|
||||
* 功能描述:
|
||||
*
|
||||
* <pre>
|
||||
* 字节数组转换为二行制表示
|
||||
* </pre>
|
||||
*
|
||||
* </li>
|
||||
*
|
||||
* @param inStr
|
||||
* 需要转换字节数组。
|
||||
* @return 字节数组的二进制表示。
|
||||
*/
|
||||
public static String byte2hex(byte[] inStr) {
|
||||
String stmp;
|
||||
StringBuffer out = new StringBuffer(inStr.length * 2);
|
||||
|
||||
for (int n = 0; n < inStr.length; n++) {
|
||||
// 字节做"与"运算,去除高位置字节 11111111
|
||||
stmp = Integer.toHexString(inStr[n] & 0xFF);
|
||||
if (stmp.length() == 1) {
|
||||
// 如果是0至F的单位字符串,则添加0
|
||||
out.append("0" + stmp);
|
||||
} else {
|
||||
out.append(stmp);
|
||||
}
|
||||
}
|
||||
return out.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* <li>
|
||||
* 方法名称:addMD5</li> <li>
|
||||
* 功能描述:
|
||||
*
|
||||
* <pre>
|
||||
* MD校验码 组合方法,前16位放MD5Hash码。 把MD5验证码byte[],加密内容byte[]组合的方法。
|
||||
* </pre>
|
||||
*
|
||||
* </li>
|
||||
*
|
||||
* @param md5Byte
|
||||
* 加密内容的MD5Hash字节数组。
|
||||
* @param bodyByte
|
||||
* 加密内容字节数组
|
||||
* @return 组合后的字节数组,比加密内容长16个字节。
|
||||
*/
|
||||
public static byte[] addMD5(byte[] md5Byte, byte[] bodyByte) {
|
||||
int length = bodyByte.length + md5Byte.length;
|
||||
byte[] resutlByte = new byte[length];
|
||||
|
||||
// 前16位放MD5Hash码
|
||||
for (int i = 0; i < length; i++) {
|
||||
if (i < md5Byte.length) {
|
||||
resutlByte[i] = md5Byte[i];
|
||||
} else {
|
||||
resutlByte[i] = bodyByte[i - md5Byte.length];
|
||||
}
|
||||
}
|
||||
|
||||
return resutlByte;
|
||||
}
|
||||
|
||||
/**
|
||||
* <li>
|
||||
* 方法名称:getKeyIV</li> <li>
|
||||
* 功能描述:
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* </pre>
|
||||
* </li>
|
||||
*
|
||||
* @param encryptKey
|
||||
* @param key
|
||||
* @param iv
|
||||
*/
|
||||
public static void getKeyIV(String encryptKey, byte[] key, byte[] iv) {
|
||||
// 密钥Base64解密
|
||||
BASE64Decoder decoder = new BASE64Decoder();
|
||||
byte[] buf = null;
|
||||
try {
|
||||
buf = decoder.decodeBuffer(encryptKey);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// 前8位为key
|
||||
int i;
|
||||
for (i = 0; i < key.length; i++) {
|
||||
key[i] = buf[i];
|
||||
}
|
||||
// 后8位为iv向量
|
||||
for (i = 0; i < iv.length; i++) {
|
||||
iv[i] = buf[i + 8];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* AES加密算法
|
||||
*
|
||||
* @param content
|
||||
* 加密内容
|
||||
* @param password
|
||||
* 密匙
|
||||
* @return
|
||||
*/
|
||||
public static String encryptAES(String content, String password) {
|
||||
try {
|
||||
if (content == null || content.equalsIgnoreCase("")) {
|
||||
return "";
|
||||
}
|
||||
|
||||
KeyGenerator kgen = KeyGenerator.getInstance("AES");
|
||||
SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG");
|
||||
secureRandom.setSeed(password.getBytes());
|
||||
kgen.init(128, secureRandom);
|
||||
SecretKey secretKey = kgen.generateKey();
|
||||
byte[] enCodeFormat = secretKey.getEncoded();
|
||||
SecretKeySpec key = new SecretKeySpec(enCodeFormat, "AES");
|
||||
BASE64Encoder coder = new BASE64Encoder();
|
||||
coder.encode(enCodeFormat);
|
||||
Cipher cipher = Cipher.getInstance("AES");
|
||||
byte[] byteContent = content.getBytes("utf-8");
|
||||
cipher.init(1, key);
|
||||
byte[] result = cipher.doFinal(byteContent);
|
||||
String str = Base64.encodeBase64String(result);
|
||||
return str;
|
||||
} catch (NoSuchAlgorithmException var13) {
|
||||
var13.printStackTrace();
|
||||
} catch (NoSuchPaddingException var14) {
|
||||
var14.printStackTrace();
|
||||
} catch (InvalidKeyException var15) {
|
||||
var15.printStackTrace();
|
||||
} catch (UnsupportedEncodingException var16) {
|
||||
var16.printStackTrace();
|
||||
} catch (IllegalBlockSizeException var17) {
|
||||
var17.printStackTrace();
|
||||
} catch (BadPaddingException var18) {
|
||||
var18.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* AES解密
|
||||
*
|
||||
* @param str
|
||||
* @param password
|
||||
* @return
|
||||
*/
|
||||
public static String decryptAES(String str, String password) {
|
||||
try {
|
||||
if (str == null || str.equalsIgnoreCase("")) {
|
||||
return "";
|
||||
}
|
||||
byte[] content = Base64.decodeBase64(str);
|
||||
KeyGenerator kgen = KeyGenerator.getInstance("AES");
|
||||
SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG");
|
||||
secureRandom.setSeed(password.getBytes());
|
||||
kgen.init(128, secureRandom);
|
||||
SecretKey secretKey = kgen.generateKey();
|
||||
byte[] enCodeFormat = secretKey.getEncoded();
|
||||
SecretKeySpec key = new SecretKeySpec(enCodeFormat, "AES");
|
||||
Cipher cipher = Cipher.getInstance("AES");// 创建密码器
|
||||
cipher.init(Cipher.DECRYPT_MODE, key);// 初始化
|
||||
byte[] result = cipher.doFinal(content);
|
||||
return new String(result, "utf-8"); // 加密
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
e.printStackTrace();
|
||||
} catch (NoSuchPaddingException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InvalidKeyException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalBlockSizeException e) {
|
||||
e.printStackTrace();
|
||||
} catch (BadPaddingException e) {
|
||||
e.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
package com.adc.da.sys.util;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* @Author sima
|
||||
* @Date 2022/6/30 16:51
|
||||
*/
|
||||
public class MailSenderInfo {
|
||||
// 发送邮件的服务器的IP和端口
|
||||
private String mailServerHost;
|
||||
private String mailServerPort;
|
||||
// 邮件发送者的地址
|
||||
private String fromAddress;
|
||||
// 邮件接收者的地址
|
||||
private String toAddress;
|
||||
// 登陆邮件发送服务器的用户名和密码
|
||||
private String userName;
|
||||
private String password;
|
||||
// 是否需要身份验证
|
||||
private boolean validate = false;
|
||||
// 邮件主题
|
||||
private String subject;
|
||||
// 邮件的文本内容
|
||||
private String content;
|
||||
// 邮件附件的文件名
|
||||
private String[] attachFileNames;
|
||||
|
||||
/**
|
||||
* 获得邮件会话属性
|
||||
*/
|
||||
public Properties getProperties() {
|
||||
Properties p = new Properties();
|
||||
p.put("mail.smtp.host", this.mailServerHost);
|
||||
p.put("mail.smtp.port", this.mailServerPort);
|
||||
p.put("mail.smtp.auth", validate ? "true" : "false");
|
||||
return p;
|
||||
}
|
||||
|
||||
public String getMailServerHost() {
|
||||
return mailServerHost;
|
||||
}
|
||||
|
||||
public void setMailServerHost(String mailServerHost) {
|
||||
this.mailServerHost = mailServerHost;
|
||||
}
|
||||
|
||||
public String getMailServerPort() {
|
||||
return mailServerPort;
|
||||
}
|
||||
|
||||
public void setMailServerPort(String mailServerPort) {
|
||||
this.mailServerPort = mailServerPort;
|
||||
}
|
||||
|
||||
public boolean isValidate() {
|
||||
return validate;
|
||||
}
|
||||
|
||||
public void setValidate(boolean validate) {
|
||||
this.validate = validate;
|
||||
}
|
||||
|
||||
public String[] getAttachFileNames() {
|
||||
return attachFileNames;
|
||||
}
|
||||
|
||||
public void setAttachFileNames(String[] fileNames) {
|
||||
this.attachFileNames = fileNames;
|
||||
}
|
||||
|
||||
public String getFromAddress() {
|
||||
return fromAddress;
|
||||
}
|
||||
|
||||
public void setFromAddress(String fromAddress) {
|
||||
this.fromAddress = fromAddress;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getToAddress() {
|
||||
return toAddress;
|
||||
}
|
||||
|
||||
public void setToAddress(String toAddress) {
|
||||
this.toAddress = toAddress;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getSubject() {
|
||||
return subject;
|
||||
}
|
||||
|
||||
public void setSubject(String subject) {
|
||||
this.subject = subject;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String textContent) {
|
||||
this.content = textContent;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,259 @@
|
||||
package com.adc.da.sys.util;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
import javax.mail.Authenticator;
|
||||
|
||||
import javax.mail.FetchProfile;
|
||||
|
||||
import javax.mail.Folder;
|
||||
|
||||
import javax.mail.Message;
|
||||
|
||||
import javax.mail.Message.RecipientType;
|
||||
|
||||
import javax.mail.PasswordAuthentication;
|
||||
|
||||
import javax.mail.Session;
|
||||
|
||||
import javax.mail.Store;
|
||||
|
||||
import javax.mail.Transport;
|
||||
|
||||
import javax.mail.internet.AddressException;
|
||||
import javax.mail.internet.InternetAddress;
|
||||
|
||||
import javax.mail.internet.MimeMessage;
|
||||
|
||||
import javax.mail.internet.MimeUtility;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Title: 使用javamail
|
||||
* </p>
|
||||
*/
|
||||
public class MailTestUtils {
|
||||
|
||||
|
||||
|
||||
|
||||
private String username = null; // 邮箱用户名
|
||||
|
||||
private String password = null; // 邮箱密码
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* 传入自己的邮箱用户名和密码
|
||||
|
||||
* @param username
|
||||
|
||||
* @param password
|
||||
|
||||
*/
|
||||
|
||||
public MailTestUtils(String username, String password) {
|
||||
|
||||
this.username = username;
|
||||
|
||||
this.password = password;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* 创建连接会话
|
||||
|
||||
* @param props
|
||||
|
||||
* @return
|
||||
|
||||
*/
|
||||
|
||||
public Session createSession(Properties props) {
|
||||
|
||||
|
||||
Session session = Session.getInstance(props, new Authenticator() {
|
||||
|
||||
// 返回用户名密码认证
|
||||
|
||||
@Override
|
||||
|
||||
public PasswordAuthentication getPasswordAuthentication() {
|
||||
|
||||
PasswordAuthentication pa = new PasswordAuthentication(username, password);
|
||||
|
||||
return pa;
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
return session;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* 发送邮件(需设置SMTP)
|
||||
|
||||
* @throws Exception
|
||||
|
||||
*/
|
||||
|
||||
public void sendMail(Properties props, SendEmailMessage sem) throws Exception {
|
||||
|
||||
|
||||
Session session = createSession(props);
|
||||
|
||||
// 消息
|
||||
Message msg = new MimeMessage(session);
|
||||
|
||||
msg.setFrom(InternetAddress.parse(MimeUtility.decodeText(sem.getFrom()))[0]);
|
||||
|
||||
// TO为初级收件人,CC为邮件副本抄送,BCC应该是密秘抄送吧
|
||||
|
||||
// msg.setRecipients(RecipientType.TO, InternetAddress.parse(sem.getRecipient()));
|
||||
|
||||
// 添加收件人
|
||||
if (sem.getRecipient() != null && !"".equals(sem.getRecipient())) {
|
||||
msg.setRecipients(Message.RecipientType.TO, getInternetAddress(sem.getRecipient()));
|
||||
}
|
||||
// 添加抄送人
|
||||
if (sem.getCopyRecipient() != null && !"".equals(sem.getCopyRecipient())) {
|
||||
msg.setRecipients(Message.RecipientType.CC, getInternetAddress(sem.getCopyRecipient()));
|
||||
}
|
||||
|
||||
msg.setSubject(sem.getSubject());
|
||||
|
||||
// msg.setText(sem.getText());
|
||||
msg.setContent(sem.getContent(),"text/html;charset=utf-8");
|
||||
|
||||
msg.setSentDate(new Date());
|
||||
|
||||
|
||||
// 发送消息
|
||||
|
||||
Transport.send(msg);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public InternetAddress[] getInternetAddress(String mails) throws AddressException {
|
||||
List<String> mailList = Arrays.asList(mails.split(","));
|
||||
int length=mailList.size();
|
||||
if (length == 0) {
|
||||
return null;
|
||||
}
|
||||
InternetAddress[] internetAddresses = new InternetAddress[length];
|
||||
for (int i = 0; i < length; i++) {
|
||||
internetAddresses[i]=new InternetAddress(mailList.get(i));
|
||||
}
|
||||
return internetAddresses;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
* 接收邮件(需设置POP3或SAMP)
|
||||
|
||||
* @throws Exception
|
||||
|
||||
*/
|
||||
|
||||
public void receiveMail(Properties props, String protocol) throws Exception {
|
||||
|
||||
|
||||
Session session = createSession(props);
|
||||
|
||||
Store store = session.getStore(protocol);
|
||||
|
||||
store.connect(); // 连接
|
||||
|
||||
Folder inbox = store.getFolder("INBOX"); // 进入根目录
|
||||
|
||||
inbox.open(Folder.READ_WRITE); // 只读方式
|
||||
|
||||
FetchProfile profile = new FetchProfile();
|
||||
|
||||
profile.add(FetchProfile.Item.ENVELOPE); // 获取信封
|
||||
|
||||
Message[] msgs = inbox.getMessages(); // 得到所有邮件
|
||||
|
||||
inbox.fetch(msgs, profile); // 预获取信息
|
||||
|
||||
// 打印
|
||||
|
||||
for (int i = 0; i < msgs.length; i++) {
|
||||
|
||||
System.out.println("发送时间:" + msgs[i].getSentDate());
|
||||
|
||||
System.out.println("发送人:" + decodeText(msgs[i].getFrom()[0].toString()));
|
||||
|
||||
System.out.println("大小:" + msgs[i].getSize());
|
||||
|
||||
System.out.println("标题:" + msgs[i].getSubject());
|
||||
|
||||
System.out.println("内容" + msgs[i].getContent());
|
||||
|
||||
System.out.println("-------------------");
|
||||
|
||||
}
|
||||
|
||||
|
||||
store.close();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* 处理中文编码问题
|
||||
|
||||
* @param text
|
||||
|
||||
* @return
|
||||
|
||||
* @throws UnsupportedEncodingException
|
||||
|
||||
*/
|
||||
|
||||
private String decodeText(String text) throws UnsupportedEncodingException {
|
||||
|
||||
|
||||
if (text == null) {
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (text.startsWith("=?GB") || text.startsWith("=?gb"))
|
||||
|
||||
text = MimeUtility.decodeText(text);
|
||||
|
||||
else
|
||||
|
||||
text = new String(text.getBytes("ISO8859_1"));
|
||||
|
||||
return text;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,354 @@
|
||||
package com.adc.da.sys.util;
|
||||
|
||||
import com.adc.da.sys.entity.UserEO;
|
||||
import com.adc.da.util.utils.StringUtils;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
|
||||
import javax.activation.DataHandler;
|
||||
import javax.activation.FileDataSource;
|
||||
import javax.mail.*;
|
||||
import javax.mail.internet.*;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Properties;
|
||||
import java.util.Vector;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Title: 使用javamail
|
||||
* </p>
|
||||
*/
|
||||
public class MailUtils {
|
||||
|
||||
String to = "";// 收件人
|
||||
String from = "";// 发件人
|
||||
String host = "";// smtp主机
|
||||
String port = "";
|
||||
String username = "";
|
||||
String password = "";
|
||||
String filename = "";// 附件文件名
|
||||
String subject = "";// 邮件主题
|
||||
String content = "";// 邮件正文
|
||||
Vector file = new Vector();// 附件文件集合
|
||||
|
||||
/**
|
||||
* <br>
|
||||
* 方法说明:默认构造器 <br>
|
||||
* 输入参数: <br>
|
||||
* 返回类型:
|
||||
*/
|
||||
public MailUtils() {
|
||||
}
|
||||
|
||||
/**
|
||||
* <br>
|
||||
* 方法说明:构造器,提供直接的参数传入 <br>
|
||||
* 输入参数: <br>
|
||||
* 返回类型:
|
||||
*/
|
||||
public MailUtils(String to, String from, String smtpServer,
|
||||
String username, String password, String subject, String content) {
|
||||
this.to = to;
|
||||
this.from = from;
|
||||
this.host = smtpServer;
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
this.subject = subject;
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getPort() {
|
||||
return port;
|
||||
}
|
||||
|
||||
public void setPort(String port) {
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
/**
|
||||
* <br>
|
||||
* 方法说明:设置邮件服务器地址 <br>
|
||||
* 输入参数:String host 邮件服务器地址名称 <br>
|
||||
* 返回类型:
|
||||
*/
|
||||
|
||||
public void setHost(String host) {
|
||||
this.host = host;
|
||||
}
|
||||
|
||||
/**
|
||||
* <br>
|
||||
* 方法说明:设置登录服务器校验密码 <br>
|
||||
* 输入参数: <br>
|
||||
* 返回类型:
|
||||
*/
|
||||
public void setPassWord(String pwd) {
|
||||
this.password = pwd;
|
||||
}
|
||||
|
||||
/**
|
||||
* <br>
|
||||
* 方法说明:设置登录服务器校验用户 <br>
|
||||
* 输入参数: <br>
|
||||
* 返回类型:
|
||||
*/
|
||||
public void setUserName(String usn) {
|
||||
this.username = usn;
|
||||
}
|
||||
|
||||
/**
|
||||
* <br>
|
||||
* 方法说明:设置邮件发送目的邮箱 <br>
|
||||
* 输入参数: <br>
|
||||
* 返回类型:
|
||||
*/
|
||||
public void setTo(String to) {
|
||||
this.to = to;
|
||||
}
|
||||
|
||||
/**
|
||||
* <br>
|
||||
* 方法说明:设置邮件发送源邮箱 <br>
|
||||
* 输入参数: <br>
|
||||
* 返回类型:
|
||||
*/
|
||||
public void setFrom(String from) {
|
||||
this.from = from;
|
||||
}
|
||||
|
||||
/**
|
||||
* <br>
|
||||
* 方法说明:设置邮件主题 <br>
|
||||
* 输入参数: <br>
|
||||
* 返回类型:
|
||||
*/
|
||||
public void setSubject(String subject) {
|
||||
this.subject = subject;
|
||||
}
|
||||
|
||||
/**
|
||||
* <br>
|
||||
* 方法说明:设置邮件内容 <br>
|
||||
* 输入参数: <br>
|
||||
* 返回类型:
|
||||
*/
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
/**
|
||||
* <br>
|
||||
* 方法说明:把主题转换为中文 <br>
|
||||
* 输入参数:String strText <br>
|
||||
* 返回类型:
|
||||
*/
|
||||
public String transferChinese(String strText) {
|
||||
try {
|
||||
// strText = MimeUtility.encodeText(new String(strText.getBytes(),
|
||||
// "UTF-8"), "UTF-8", "B");
|
||||
strText = MimeUtility.encodeText(strText);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return strText;
|
||||
}
|
||||
|
||||
/**
|
||||
* <br>
|
||||
* 方法说明:往附件组合中添加附件 <br>
|
||||
* 输入参数: <br>
|
||||
* 返回类型:
|
||||
*/
|
||||
public void attachfile(String fname) {
|
||||
file.addElement(fname);
|
||||
}
|
||||
|
||||
/**
|
||||
* <br>
|
||||
* 方法说明:发送邮件 <br>
|
||||
* 输入参数: <br>
|
||||
* 返回类型:boolean 成功为true,反之为false
|
||||
*/
|
||||
public boolean sendMail() {
|
||||
|
||||
// 构造mail session
|
||||
Properties props = new Properties();
|
||||
// props.put("mail.smtp.host", host);
|
||||
// props.put("mail.smtp.auth", "true");
|
||||
final String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory";
|
||||
// props.setProperty("mail.smtp.host", "smtp.163.com");
|
||||
props.setProperty("mail.smtp.host", host);
|
||||
props.setProperty("mail.smtp.socketFactory.class", SSL_FACTORY);
|
||||
props.setProperty("mail.smtp.socketFactory.fallback", "false");
|
||||
props.setProperty("mail.smtp.port", port);
|
||||
props.setProperty("mail.smtp.socketFactory.port", port);
|
||||
props.setProperty("mail.smtp.auth", "true");
|
||||
Session session = Session.getDefaultInstance(props,
|
||||
new Authenticator() {
|
||||
@Override
|
||||
public PasswordAuthentication getPasswordAuthentication() {
|
||||
return new PasswordAuthentication(username, password);
|
||||
}
|
||||
});
|
||||
// Session session = Session.getDefaultInstance(props);
|
||||
// Session session = Session.getDefaultInstance(props, null);
|
||||
|
||||
try {
|
||||
// 构造MimeMessage 并设定基本的值
|
||||
MimeMessage msg = new MimeMessage(session);
|
||||
// MimeMessage msg = new MimeMessage();
|
||||
msg.setFrom(new InternetAddress(from));
|
||||
|
||||
// msg.addRecipients(Message.RecipientType.TO, address);
|
||||
// //这个只能是给一个人发送email
|
||||
msg.setRecipients(Message.RecipientType.BCC,
|
||||
InternetAddress.parse(to));
|
||||
subject = transferChinese(subject);
|
||||
msg.setSubject(subject);
|
||||
|
||||
// 构造Multipart
|
||||
Multipart mp = new MimeMultipart();
|
||||
|
||||
// 向Multipart添加正文
|
||||
MimeBodyPart mbpContent = new MimeBodyPart();
|
||||
mbpContent.setContent(content, "text/html;charset=utf-8");
|
||||
|
||||
// 向MimeMessage添加(Multipart代表正文)
|
||||
mp.addBodyPart(mbpContent);
|
||||
|
||||
// 向Multipart添加附件
|
||||
Enumeration efile = file.elements();
|
||||
while (efile.hasMoreElements()) {
|
||||
|
||||
MimeBodyPart mbpFile = new MimeBodyPart();
|
||||
filename = efile.nextElement().toString();
|
||||
FileDataSource fds = new FileDataSource(filename);
|
||||
mbpFile.setDataHandler(new DataHandler(fds));
|
||||
// <span style="color: #ff0000;">//这个方法可以解决附件乱码问题。</span>
|
||||
String filename = new String(fds.getName().getBytes(), "UTF-8");
|
||||
|
||||
mbpFile.setFileName(filename);
|
||||
// 向MimeMessage添加(Multipart代表附件)
|
||||
mp.addBodyPart(mbpFile);
|
||||
|
||||
}
|
||||
|
||||
file.removeAllElements();
|
||||
// 向Multipart添加MimeMessage
|
||||
msg.setContent(mp);
|
||||
msg.setSentDate(new Date());
|
||||
msg.saveChanges();
|
||||
// 发送邮件
|
||||
|
||||
Transport transport = session.getTransport("smtp");
|
||||
transport.connect(host, username, password);
|
||||
transport.sendMessage(msg, msg.getAllRecipients());
|
||||
transport.close();
|
||||
} catch (Exception mex) {
|
||||
mex.printStackTrace();
|
||||
// Exception ex = null;
|
||||
// if ((ex = mex.getNextException()) != null) {
|
||||
// ex.printStackTrace();
|
||||
// }
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* <br>
|
||||
* 方法说明:主方法,用于测试 <br>
|
||||
* 输入参数: <br>
|
||||
* 返回类型:
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
MailUtils sendmail = new MailUtils();
|
||||
|
||||
sendmail.setHost("smtp.163.com");
|
||||
sendmail.setPort("465");
|
||||
// sendmail.setUserName("simashihao@163.com");
|
||||
// sendmail.setPassWord("VQBNNQBLDIALAYCV");
|
||||
sendmail.setUserName("cagds@catarc.ac.cn");
|
||||
sendmail.setPassWord("Cagds9760");
|
||||
sendmail.setTo("1845769955@qq.com");
|
||||
sendmail.setFrom("cagds@catarc.ac.cn");
|
||||
sendmail.setSubject("你好,这是测试!");
|
||||
sendmail.setContent("你好这是一个带多附件的测试!");
|
||||
// Mail sendmail = new
|
||||
// Mail("dujiang@sricnet.com","du_jiang@sohu.com","smtp.sohu.com","du_jiang","31415926","你好","胃,你好吗?");
|
||||
// sendmail.attachfile("D:\\123\\测试Excel.xls");
|
||||
|
||||
System.out.println(sendmail.sendMail());
|
||||
|
||||
}
|
||||
public static void main1(String[] args) {
|
||||
|
||||
String toEmailAddress = "simashihao@163.com";
|
||||
|
||||
|
||||
MailSenderInfo mailInfo = new MailSenderInfo();
|
||||
mailInfo.setMailServerHost("smtp.qiye.163.com");
|
||||
mailInfo.setMailServerPort("25");
|
||||
mailInfo.setValidate(true);
|
||||
mailInfo.setUserName("service@tbrat.org");
|
||||
mailInfo.setPassword("Wang2018"); // 您的邮箱密码
|
||||
mailInfo.setFromAddress("service@tbrat.org");
|
||||
mailInfo.setToAddress(toEmailAddress);
|
||||
mailInfo.setSubject("subject");
|
||||
mailInfo.setContent("mailContent");
|
||||
|
||||
MailUtils sms = new MailUtils();
|
||||
sms.sendHtmlMail(mailInfo);// 发送html格式
|
||||
}
|
||||
|
||||
public static boolean sendHtmlMail(MailSenderInfo mailInfo) {
|
||||
// 判断是否需要身份认证
|
||||
MyAuthenticator authenticator = null;
|
||||
Properties pro = mailInfo.getProperties();
|
||||
// 如果需要身份认证,则创建一个密码验证器
|
||||
if (mailInfo.isValidate()) {
|
||||
authenticator = new MyAuthenticator(mailInfo.getUserName(),
|
||||
mailInfo.getPassword());
|
||||
}
|
||||
// 根据邮件会话属性和密码验证器构造一个发送邮件的session
|
||||
Session sendMailSession = Session
|
||||
.getDefaultInstance(pro, authenticator);
|
||||
try {
|
||||
// 根据session创建一个邮件消息
|
||||
Message mailMessage = new MimeMessage(sendMailSession);
|
||||
// 创建邮件发送者地址
|
||||
Address from = new InternetAddress(mailInfo.getFromAddress());
|
||||
// 设置邮件消息的发送者
|
||||
mailMessage.setFrom(from);
|
||||
// 创建邮件的接收者地址,并设置到邮件消息中
|
||||
Address to = new InternetAddress(mailInfo.getToAddress());
|
||||
// Message.RecipientType.TO属性表示接收者的类型为TO
|
||||
mailMessage.setRecipient(Message.RecipientType.TO, to);
|
||||
// 设置邮件消息的主题
|
||||
mailMessage.setSubject(mailInfo.getSubject());
|
||||
// 设置邮件消息发送的时间
|
||||
mailMessage.setSentDate(new Date());
|
||||
// MiniMultipart类是一个容器类,包含MimeBodyPart类型的对象
|
||||
Multipart mainPart = new MimeMultipart();
|
||||
// 创建一个包含HTML内容的MimeBodyPart
|
||||
BodyPart html = new MimeBodyPart();
|
||||
// 设置HTML内容
|
||||
html.setContent(mailInfo.getContent(), "text/html; charset=utf-8");
|
||||
mainPart.addBodyPart(html);
|
||||
// 将MiniMultipart对象设置为邮件内容
|
||||
mailMessage.setContent(mainPart);
|
||||
// 发送邮件
|
||||
Transport.send(mailMessage);
|
||||
return true;
|
||||
} catch (MessagingException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.adc.da.sys.util;
|
||||
|
||||
import javax.mail.Authenticator;
|
||||
import javax.mail.PasswordAuthentication;
|
||||
|
||||
/**
|
||||
* @Author sima
|
||||
* @Date 2022/6/30 16:55
|
||||
*/
|
||||
public class MyAuthenticator extends Authenticator {
|
||||
String userName = null;
|
||||
String password = null;
|
||||
|
||||
public MyAuthenticator() {
|
||||
}
|
||||
|
||||
public MyAuthenticator(String username, String password) {
|
||||
this.userName = username;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
protected PasswordAuthentication getPasswordAuthentication() {
|
||||
return new PasswordAuthentication(userName, password);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,208 @@
|
||||
package com.adc.da.sys.util;
|
||||
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.security.Key;
|
||||
import java.security.KeyFactory;
|
||||
import java.security.spec.PKCS8EncodedKeySpec;
|
||||
import java.security.spec.X509EncodedKeySpec;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* RSA公钥/私钥/签名工具包
|
||||
* </p>
|
||||
*/
|
||||
public class RSAUtil {
|
||||
|
||||
public static final String PrivateKey="MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAMrC+KYc0YSLJX" +
|
||||
"kvveWUB5O/w7/dz0otkuM0OnM1U6/OjCTUwnJJ1KHoGJk8VcYsnj1Gun/RTUvrxkK8LZm/TthhOuv" +
|
||||
"sF3yjyUoH0eVSpwmj+x4gessIuXZ4+4uf41i0gzjHFtu8A53LkSn9BsrhpbPwbu+zHyly2KMuSxgo0" +
|
||||
"FDJAgMBAAECgYAySZTdrfwQwWnz2nFghQw0CrWD2oFUxmTN0OBGPo2Y5sM/Rz1KlyETXrrrFlm3os1E" +
|
||||
"KUyL8t8W20z6tC0jGp10/2FVXUaBgXX/nBC+KNu6UjYT1PeQDg4bqS6xs4HSGCxOfyyWhnJ9szgLF4GX" +
|
||||
"9fR3UFIFeECbnmsVoZQg97QBAQJBAPwTLaxiJLbfiXRDNbTqNV1O3tp+1iXW4pFES/vnleY9uE4a/zejJa" +
|
||||
"51HleOdvMoGimLT4i7RUm7eZqN4bPUe5ECQQDN6zhVQaHDBqb/WDgUhpFW87hHmakiizufOpbkaIlZluMb" +
|
||||
"aXRUm18rmoNKTGTSm0DvSFWRxZMYWEl54aZIzjW5AkA/5BCIh9usal4plLtxHofmHY6IrOtUbfHBRiFIO" +
|
||||
"PuafvxO97LGhFiRrmfBY3+sw/ZVn1TKYEUAmj8JOHsDnJCxAkBP6tl7JTS9tyg686cYOD3SDFbZ2wYsdPM" +
|
||||
"X0ipbzUJ5NblAm0XdzEs8ZgRMYqfCoSSreVxUbeSvzxv9JJlfqkBpAkEA8kGuzB4sNjv88obNXcYgjOQr" +
|
||||
"zrM6mTkzyq3flipzFTQFkPLaT1JGg2qegRqezatRH8dwt84UDNXF+w3uQjl16w==";
|
||||
|
||||
|
||||
/**
|
||||
* 加密算法RSA
|
||||
*/
|
||||
public static final String KEY_ALGORITHM = "RSA";
|
||||
|
||||
/**
|
||||
* RSA最大加密明文大小
|
||||
*/
|
||||
private static final int MAX_ENCRYPT_BLOCK = 117;
|
||||
|
||||
/**
|
||||
* RSA最大解密密文大小
|
||||
*/
|
||||
private static final int MAX_DECRYPT_BLOCK = 128;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* <P>
|
||||
* 私钥解密
|
||||
* </p>
|
||||
*
|
||||
* @param encryptedData 已加密数据
|
||||
* @param privateKey 私钥(BASE64编码)
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static byte[] decryptByPrivateKey(byte[] encryptedData, String privateKey)
|
||||
throws Exception {
|
||||
byte[] keyBytes = Base64.decodeBase64(privateKey);
|
||||
PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(keyBytes);
|
||||
KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM);
|
||||
Key privateK = keyFactory.generatePrivate(pkcs8KeySpec);
|
||||
Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm());
|
||||
cipher.init(Cipher.DECRYPT_MODE, privateK);
|
||||
int inputLen = encryptedData.length;
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
int offSet = 0;
|
||||
byte[] cache;
|
||||
int i = 0;
|
||||
// 对数据分段解密
|
||||
while (inputLen - offSet > 0) {
|
||||
if (inputLen - offSet > MAX_DECRYPT_BLOCK) {
|
||||
cache = cipher.doFinal(encryptedData, offSet, MAX_DECRYPT_BLOCK);
|
||||
} else {
|
||||
cache = cipher.doFinal(encryptedData, offSet, inputLen - offSet);
|
||||
}
|
||||
out.write(cache, 0, cache.length);
|
||||
i++;
|
||||
offSet = i * MAX_DECRYPT_BLOCK;
|
||||
}
|
||||
byte[] decryptedData = out.toByteArray();
|
||||
out.close();
|
||||
return decryptedData;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 公钥解密
|
||||
* </p>
|
||||
*
|
||||
* @param encryptedData 已加密数据
|
||||
* @param publicKey 公钥(BASE64编码)
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static byte[] decryptByPublicKey(byte[] encryptedData, String publicKey)
|
||||
throws Exception {
|
||||
byte[] keyBytes = Base64.decodeBase64(publicKey);
|
||||
X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(keyBytes);
|
||||
KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM);
|
||||
Key publicK = keyFactory.generatePublic(x509KeySpec);
|
||||
Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm());
|
||||
cipher.init(Cipher.DECRYPT_MODE, publicK);
|
||||
int inputLen = encryptedData.length;
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
int offSet = 0;
|
||||
byte[] cache;
|
||||
int i = 0;
|
||||
// 对数据分段解密
|
||||
while (inputLen - offSet > 0) {
|
||||
if (inputLen - offSet > MAX_DECRYPT_BLOCK) {
|
||||
cache = cipher.doFinal(encryptedData, offSet, MAX_DECRYPT_BLOCK);
|
||||
} else {
|
||||
cache = cipher.doFinal(encryptedData, offSet, inputLen - offSet);
|
||||
}
|
||||
out.write(cache, 0, cache.length);
|
||||
i++;
|
||||
offSet = i * MAX_DECRYPT_BLOCK;
|
||||
}
|
||||
byte[] decryptedData = out.toByteArray();
|
||||
out.close();
|
||||
return decryptedData;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 公钥加密
|
||||
* </p>
|
||||
*
|
||||
* @param data 源数据
|
||||
* @param publicKey 公钥(BASE64编码)
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static byte[] encryptByPublicKey(byte[] data, String publicKey)
|
||||
throws Exception {
|
||||
byte[] keyBytes = Base64.decodeBase64(publicKey);
|
||||
X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(keyBytes);
|
||||
KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM);
|
||||
Key publicK = keyFactory.generatePublic(x509KeySpec);
|
||||
// 对数据加密
|
||||
Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm());
|
||||
cipher.init(Cipher.ENCRYPT_MODE, publicK);
|
||||
int inputLen = data.length;
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
int offSet = 0;
|
||||
byte[] cache;
|
||||
int i = 0;
|
||||
// 对数据分段加密
|
||||
while (inputLen - offSet > 0) {
|
||||
if (inputLen - offSet > MAX_ENCRYPT_BLOCK) {
|
||||
cache = cipher.doFinal(data, offSet, MAX_ENCRYPT_BLOCK);
|
||||
} else {
|
||||
cache = cipher.doFinal(data, offSet, inputLen - offSet);
|
||||
}
|
||||
out.write(cache, 0, cache.length);
|
||||
i++;
|
||||
offSet = i * MAX_ENCRYPT_BLOCK;
|
||||
}
|
||||
byte[] encryptedData = out.toByteArray();
|
||||
out.close();
|
||||
return encryptedData;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 私钥加密
|
||||
* </p>
|
||||
*
|
||||
* @param data 源数据
|
||||
* @param privateKey 私钥(BASE64编码)
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static byte[] encryptByPrivateKey(byte[] data, String privateKey)
|
||||
throws Exception {
|
||||
byte[] keyBytes = Base64.decodeBase64(privateKey);
|
||||
PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(keyBytes);
|
||||
KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM);
|
||||
Key privateK = keyFactory.generatePrivate(pkcs8KeySpec);
|
||||
Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm());
|
||||
cipher.init(Cipher.ENCRYPT_MODE, privateK);
|
||||
int inputLen = data.length;
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
int offSet = 0;
|
||||
byte[] cache;
|
||||
int i = 0;
|
||||
// 对数据分段加密
|
||||
while (inputLen - offSet > 0) {
|
||||
if (inputLen - offSet > MAX_ENCRYPT_BLOCK) {
|
||||
cache = cipher.doFinal(data, offSet, MAX_ENCRYPT_BLOCK);
|
||||
} else {
|
||||
cache = cipher.doFinal(data, offSet, inputLen - offSet);
|
||||
}
|
||||
out.write(cache, 0, cache.length);
|
||||
i++;
|
||||
offSet = i * MAX_ENCRYPT_BLOCK;
|
||||
}
|
||||
byte[] encryptedData = out.toByteArray();
|
||||
out.close();
|
||||
return encryptedData;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.adc.da.sys.util;
|
||||
|
||||
import cn.hutool.core.util.ReUtil;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
/**
|
||||
* @Author doudxw
|
||||
* @Date 2021/10/12 14:10
|
||||
*/
|
||||
public class ReValidUtil {
|
||||
|
||||
//验证是否是手机号或固定电话
|
||||
public static boolean validPhone(String content){
|
||||
if(ReUtil.isMatch("\\d{3}-\\d{8}|\\d{4}-\\d{7}",content)){
|
||||
return true;
|
||||
}
|
||||
|
||||
if(ReUtil.isMatch("^(13[0-9]|14[5|7]|15[0|1|2|3|4|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\\d{8}$",content)){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//验证身份证号
|
||||
public static boolean validIdCard(String content){
|
||||
return ReUtil.isMatch("^[1-9]\\d{5}(18|19|([23]\\d))\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$",content);
|
||||
}
|
||||
|
||||
//验证营业执照
|
||||
public static boolean validBussinessCard(String content){
|
||||
return ReUtil.isMatch("^[A-Z]\\d{17}$",content);
|
||||
}
|
||||
|
||||
//验证发动机(字母+数字的组合)
|
||||
public static boolean validMotor(String content){
|
||||
if(ReUtil.isMatch("^[0-9]*$",content)){
|
||||
return false;
|
||||
}
|
||||
if(ReUtil.isMatch("^[A-Za-z]+$",content)){
|
||||
return false;
|
||||
}
|
||||
|
||||
if(ReUtil.isMatch("^[A-Za-z0-9]+$",content)){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//验证日期
|
||||
public static boolean validDate(String content){
|
||||
SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd");
|
||||
try {
|
||||
format.parse(content);
|
||||
return true;
|
||||
} catch (ParseException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//验证质量
|
||||
public static boolean validQuality(String content){
|
||||
return ReUtil.isMatch("^(\\+)?\\d+(\\.\\d+)?$",content);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
package com.adc.da.sys.util;
|
||||
|
||||
/**
|
||||
* @Author sima
|
||||
* @Date 2022/7/11 10:27
|
||||
*/
|
||||
public class SendEmailMessage {
|
||||
|
||||
|
||||
private String type; // 格式类型,如 text/html;charset=gbk
|
||||
private String from; // 发送人
|
||||
private String subject; // 标题
|
||||
private String text; // 文本内容
|
||||
private String content; // html内容
|
||||
private String recipient; // 接收人,多个接收人用逗号分隔
|
||||
private String copyRecipient; //抄送人
|
||||
private String datetime; // 发送时间
|
||||
|
||||
|
||||
public String getFrom() {
|
||||
return from;
|
||||
}
|
||||
|
||||
|
||||
public void setFrom(String from) {
|
||||
this.from = from;
|
||||
}
|
||||
|
||||
|
||||
public String getSubject() {
|
||||
return subject;
|
||||
}
|
||||
|
||||
|
||||
public void setSubject(String subject) {
|
||||
this.subject = subject;
|
||||
}
|
||||
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
|
||||
public String getRecipient() {
|
||||
return recipient;
|
||||
}
|
||||
|
||||
|
||||
public void setRecipient(String recipient) {
|
||||
this.recipient = recipient;
|
||||
}
|
||||
|
||||
|
||||
public String getDatetime() {
|
||||
return datetime;
|
||||
}
|
||||
|
||||
|
||||
public void setDatetime(String datetime) {
|
||||
this.datetime = datetime;
|
||||
}
|
||||
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getCopyRecipient() {
|
||||
return copyRecipient;
|
||||
}
|
||||
|
||||
public void setCopyRecipient(String copyRecipient) {
|
||||
this.copyRecipient = copyRecipient;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.adc.da.sys.vo;
|
||||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author doudxw
|
||||
* @Date 2021/11/9 14:55
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class LabelReturnVo {
|
||||
|
||||
private String name;
|
||||
|
||||
private String value;
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
package com.adc.da.sys.vo;
|
||||
|
||||
/**
|
||||
* 菜单对应VO
|
||||
*
|
||||
* @author comments created by Lee Kwanho
|
||||
* date 2018-08-17
|
||||
* @see com.adc.da.sys.controller.MenuEOController
|
||||
*/
|
||||
public class MenuVO extends TreeVO<MenuVO> {
|
||||
|
||||
/**
|
||||
* 菜单对应网页
|
||||
*/
|
||||
private String href;
|
||||
|
||||
/**
|
||||
* 图标
|
||||
*/
|
||||
private String icon;
|
||||
|
||||
|
||||
private String iconHref;
|
||||
|
||||
|
||||
private String iconClick;
|
||||
|
||||
|
||||
|
||||
private String iconClickHref;
|
||||
/**
|
||||
* 序列
|
||||
*/
|
||||
private String sort;
|
||||
|
||||
/**
|
||||
* 权限
|
||||
*/
|
||||
private String permission;
|
||||
|
||||
/**
|
||||
* 描述,标记
|
||||
*/
|
||||
private String remarks;
|
||||
|
||||
/**
|
||||
* 属于
|
||||
*/
|
||||
private Integer belong;
|
||||
|
||||
/**
|
||||
* 展示
|
||||
*/
|
||||
private Integer isShow;
|
||||
|
||||
/**
|
||||
* 扩展字段
|
||||
*/
|
||||
|
||||
private String extInfo;
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private String isUrl;
|
||||
|
||||
public String getIsUrl() {
|
||||
return isUrl;
|
||||
}
|
||||
|
||||
public void setIsUrl(String isUrl) {
|
||||
this.isUrl = isUrl;
|
||||
}
|
||||
|
||||
public String getHref() {
|
||||
return href;
|
||||
}
|
||||
|
||||
public void setHref(String href) {
|
||||
this.href = href;
|
||||
}
|
||||
|
||||
public String getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
public void setIcon(String icon) {
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
public String getSort() {
|
||||
return sort;
|
||||
}
|
||||
|
||||
public void setSort(String sort) {
|
||||
this.sort = sort;
|
||||
}
|
||||
|
||||
public String getPermission() {
|
||||
return permission;
|
||||
}
|
||||
|
||||
public void setPermission(String permission) {
|
||||
this.permission = permission;
|
||||
}
|
||||
|
||||
public String getRemarks() {
|
||||
return remarks;
|
||||
}
|
||||
|
||||
public void setRemarks(String remarks) {
|
||||
this.remarks = remarks;
|
||||
}
|
||||
|
||||
public Integer getBelong() {
|
||||
return belong;
|
||||
}
|
||||
|
||||
public void setBelong(Integer belong) {
|
||||
this.belong = belong;
|
||||
}
|
||||
|
||||
public Integer getIsShow() {
|
||||
return isShow;
|
||||
}
|
||||
|
||||
public void setIsShow(Integer isShow) {
|
||||
this.isShow = isShow;
|
||||
}
|
||||
|
||||
public String getExtInfo() {
|
||||
return extInfo;
|
||||
}
|
||||
|
||||
public void setExtInfo(String extInfo) {
|
||||
this.extInfo = extInfo;
|
||||
}
|
||||
|
||||
|
||||
public String getIconHref() {
|
||||
return iconHref;
|
||||
}
|
||||
|
||||
public void setIconHref(String iconHref) {
|
||||
this.iconHref = iconHref;
|
||||
}
|
||||
|
||||
public String getIconClick() {
|
||||
return iconClick;
|
||||
}
|
||||
|
||||
public void setIconClick(String iconClick) {
|
||||
this.iconClick = iconClick;
|
||||
}
|
||||
|
||||
public String getIconClickHref() {
|
||||
return iconClickHref;
|
||||
}
|
||||
|
||||
public void setIconClickHref(String iconClickHref) {
|
||||
this.iconClickHref = iconClickHref;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.adc.da.sys.vo;
|
||||
|
||||
public class ModuleVo{
|
||||
private String id;
|
||||
|
||||
private String moduleName;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getModuleName() {
|
||||
return moduleName;
|
||||
}
|
||||
|
||||
public void setModuleName(String moduleName) {
|
||||
this.moduleName = moduleName;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.adc.da.sys.vo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.adc.da.sys.entity.MenuEO;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 角色对应VO
|
||||
*
|
||||
* @author comments created by Lee Kwanho
|
||||
* date 2018-08-17
|
||||
* @see com.adc.da.sys.controller.RoleEOController
|
||||
*/
|
||||
@Data
|
||||
public class RoleVO {
|
||||
/**
|
||||
* 角色id
|
||||
*/
|
||||
private String rid;
|
||||
|
||||
/**
|
||||
* 角色名称
|
||||
*/
|
||||
private String rname;
|
||||
|
||||
/**
|
||||
* 角色描述
|
||||
*/
|
||||
private String rdesc;
|
||||
|
||||
/**
|
||||
* 删除标记
|
||||
*/
|
||||
private int enabled;
|
||||
|
||||
/**
|
||||
* 用户数
|
||||
*/
|
||||
private int usercount;
|
||||
|
||||
/**
|
||||
* 属于与否
|
||||
*/
|
||||
private int belong;
|
||||
|
||||
// 扩展字段
|
||||
private String extInfo;
|
||||
|
||||
private String extInfo2;
|
||||
|
||||
private String extInfo3;
|
||||
|
||||
private String extInfo4;
|
||||
|
||||
private String extInfo5;
|
||||
|
||||
private List<MenuEO> menus = new ArrayList<>();
|
||||
|
||||
private List<String> menusstr = new ArrayList<>();
|
||||
|
||||
private List<String> orgsstr = new ArrayList<>();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.adc.da.sys.vo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 抽象类VO
|
||||
* 用于菜单和组织
|
||||
*
|
||||
* @param <T>
|
||||
* @author comments created by Lee Kwanho
|
||||
* date 2018-08-16
|
||||
* @see OrgVO
|
||||
* @see MenuVO
|
||||
*/
|
||||
public abstract class TreeVO<T extends TreeVO> {
|
||||
|
||||
/**
|
||||
* id字段
|
||||
*/
|
||||
protected String id;
|
||||
|
||||
/**
|
||||
* 名称字段
|
||||
*/
|
||||
protected String name;
|
||||
|
||||
/**
|
||||
* 所有父级编号
|
||||
*/
|
||||
protected String parentId;
|
||||
|
||||
/**
|
||||
* 所有父级编号
|
||||
*/
|
||||
protected String parentIds;
|
||||
|
||||
/**
|
||||
* 父级编号
|
||||
*/
|
||||
protected T parent;
|
||||
|
||||
protected List<T> childList;
|
||||
|
||||
/**
|
||||
* 删除标识
|
||||
*/
|
||||
protected Integer delFlag;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getParentId() {
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setParentId(String parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public String getParentIds() {
|
||||
return parentIds;
|
||||
}
|
||||
|
||||
public void setParentIds(String parentIds) {
|
||||
this.parentIds = parentIds;
|
||||
}
|
||||
|
||||
public T getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
public void setParent(T parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public List<T> getChildList() {
|
||||
return childList;
|
||||
}
|
||||
|
||||
public void setChildList(List<T> childList) {
|
||||
this.childList = childList;
|
||||
}
|
||||
|
||||
public Integer getDelFlag() {
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public void setDelFlag(Integer delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.adc.da.sys.vo;
|
||||
|
||||
import com.adc.da.excel.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class UserImportVO {
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
|
||||
private String usid;
|
||||
|
||||
|
||||
/**
|
||||
* 删除标记
|
||||
*/
|
||||
private Integer delFlag;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
@Excel(name = "用户名", width = 20)
|
||||
private String account;
|
||||
|
||||
|
||||
/**
|
||||
* 手机号码
|
||||
*/
|
||||
@Excel(name = "手机号", width = 20)
|
||||
private String cellPhoneNumber;
|
||||
|
||||
/**
|
||||
* 电子邮件
|
||||
*/
|
||||
@Excel(name = "邮箱", width = 20)
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
|
||||
private String createTime;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
|
||||
private String updateTime;
|
||||
|
||||
|
||||
@Excel(name = "是否启用(0禁用、1启用)", width = 20)
|
||||
private String isUse;
|
||||
|
||||
|
||||
@Excel(name = "部门", width = 20)
|
||||
private String department;
|
||||
|
||||
|
||||
@Excel(name = "姓名", width = 20)
|
||||
private String usname;
|
||||
|
||||
@Excel(name = "角色", width = 20)
|
||||
private String roleName;
|
||||
|
||||
private String roleId;
|
||||
|
||||
@Excel(name = "操作(add添加、full覆盖角色)", width = 20)
|
||||
private String operation;
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.adc.da.sys.vo;
|
||||
|
||||
import com.adc.da.base.entity.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* <b>功能:</b>TR_USER_ROLE UserRoleEOEntity<br>
|
||||
* <b>作者:</b>code generator<br>
|
||||
* <b>日期:</b> 2017-11-07 <br>
|
||||
* <b>版权所有:<b>版权归天津卡达克数据技术中心所有。<br>
|
||||
* <p>字段列表:</p>
|
||||
* <li>userId -> user_id</li>
|
||||
* <li>roleId -> role_id</li>
|
||||
* @author comments created by Lee Kwanho
|
||||
* date 2018-08-16
|
||||
*/
|
||||
@Data
|
||||
public class UserRoleVO extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 角色id
|
||||
*/
|
||||
private String roleId;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String account;
|
||||
|
||||
|
||||
/**
|
||||
* 手机号码
|
||||
*/
|
||||
private String cellPhoneNumber;
|
||||
|
||||
/**
|
||||
* 电子邮件
|
||||
*/
|
||||
private String email;
|
||||
|
||||
|
||||
|
||||
private String department;
|
||||
|
||||
|
||||
private String usname;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.adc.da.sys.vo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.adc.da.sys.entity.RoleEO;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@Data
|
||||
public class UserVO {
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private String usid;
|
||||
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
|
||||
private String password;
|
||||
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String account;
|
||||
|
||||
|
||||
/**
|
||||
* 手机号码
|
||||
*/
|
||||
private String cellPhoneNumber;
|
||||
|
||||
/**
|
||||
* 电子邮件
|
||||
*/
|
||||
private String email;
|
||||
|
||||
|
||||
|
||||
|
||||
private String department;
|
||||
|
||||
|
||||
private String usname;
|
||||
|
||||
|
||||
/**
|
||||
* 角色ID列表
|
||||
*/
|
||||
private List<String> roleIdList = new ArrayList<>();
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.adc.da.sys.vo.ddm;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DdmMenuListVO {
|
||||
//菜单id
|
||||
private String modelId;
|
||||
//菜单名称
|
||||
private String modelName;
|
||||
//菜单父Id
|
||||
private String parentModelCode;
|
||||
//菜单父名称
|
||||
private String parentModelName;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.adc.da.sys.vo.ddm;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DdmMenuVO {
|
||||
//菜单id
|
||||
private String modelId;
|
||||
//菜单父Id
|
||||
private String parentModelId;
|
||||
//菜单名称
|
||||
private String modelName;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.adc.da.sys.vo.ddm;
|
||||
|
||||
import com.adc.da.sys.entity.RoleEO;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
roles jsonArray 查询结果集
|
||||
roles. roleId String 必填 角色Id
|
||||
roles. roleCode String 必填 角色编码
|
||||
roles.roleName String 必填 角色名称
|
||||
roles.parentRoleId String 可选 父角色Id
|
||||
roles.parentRoleCode String 可选 父角色编码
|
||||
roles.parentRoleName String 可选 父角色名称
|
||||
roles. roleDesc String 可选 角色描述
|
||||
*/
|
||||
@Data
|
||||
public class DdmRoleCreateVO {
|
||||
|
||||
@NotBlank(message = "角色编码不能为空")
|
||||
private String roleCode;
|
||||
@NotBlank(message = "角色名称不能为空")
|
||||
private String roleName;
|
||||
|
||||
private String parentRoleId;
|
||||
|
||||
private String parentRoleCode;
|
||||
|
||||
private String parentRoleName;
|
||||
|
||||
/**
|
||||
* 角色描述
|
||||
*/
|
||||
private String roleDesc;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.adc.da.sys.vo.ddm;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class DdmRoleMenuCreate {
|
||||
@JsonFormat(with =JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
|
||||
List<DdmRoleMenuCreateVO> roleModels;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.adc.da.sys.vo.ddm;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
public class DdmRoleMenuCreateVO {
|
||||
//菜单id
|
||||
@NotBlank(message = "菜单id不能为空")
|
||||
private String modelId;
|
||||
//菜单父Id
|
||||
@NotBlank(message = "菜单父id不能为空")
|
||||
private String parentModelId;
|
||||
//角色id
|
||||
@NotBlank(message = "角色id不能为空")
|
||||
private String roleId;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.adc.da.sys.vo.ddm;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class DdmRoleMenuDelete {
|
||||
@JsonFormat(with =JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
|
||||
List<DdmRoleMenuCreateVO> roleModels;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.adc.da.sys.vo.ddm;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DdmRoleUserQuery {
|
||||
private String roleId;
|
||||
private Integer pageNum;
|
||||
private Integer pageSize;
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.adc.da.sys.vo.ddm;
|
||||
|
||||
import com.adc.da.sys.entity.MenuEO;
|
||||
import com.adc.da.sys.entity.RoleEO;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
roles jsonArray 查询结果集
|
||||
roles. roleId String 必填 角色Id
|
||||
roles. roleCode String 必填 角色编码
|
||||
roles.roleName String 必填 角色名称
|
||||
roles.parentRoleId String 可选 父角色Id
|
||||
roles.parentRoleCode String 可选 父角色编码
|
||||
roles.parentRoleName String 可选 父角色名称
|
||||
roles. roleDesc String 可选 角色描述
|
||||
*/
|
||||
@Data
|
||||
public class DdmRoleVO {
|
||||
|
||||
private String roleId;
|
||||
|
||||
private String roleCode;
|
||||
|
||||
private String roleName;
|
||||
|
||||
private String parentRoleId;
|
||||
|
||||
private String parentRoleCode;
|
||||
|
||||
private String parentRoleName;
|
||||
|
||||
/**
|
||||
* 角色描述
|
||||
*/
|
||||
private String roleDesc;
|
||||
|
||||
public DdmRoleVO(){
|
||||
|
||||
}
|
||||
|
||||
public DdmRoleVO(RoleEO roleEO) {
|
||||
this.roleId = roleEO.getId();
|
||||
this.roleCode = roleEO.getId();
|
||||
this.roleName = roleEO.getName();
|
||||
this.parentRoleId = "";
|
||||
this.parentRoleCode = "";
|
||||
this.parentRoleName = "";
|
||||
this.roleDesc = roleEO.getRemarks();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.adc.da.sys.vo.ddm;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DdmUserQueryVO {
|
||||
|
||||
private String userAccount;
|
||||
private String userName;
|
||||
private Integer pageNum;
|
||||
private Integer pageSize;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.adc.da.sys.vo.ddm;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class DdmUserRoleAdd {
|
||||
@JsonFormat(with =JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
|
||||
List<DdmUserRoleVO> userRoles;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.adc.da.sys.vo.ddm;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DdmUserRoleVO {
|
||||
|
||||
private String userId;
|
||||
|
||||
private String roleId;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.adc.da.sys.vo.ddm;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class DdmUserRolesDeleteVO {
|
||||
@JsonFormat(with =JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
|
||||
List<DdmUserRoleVO> userRoles;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.adc.da.sys.vo.ddm;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Data
|
||||
public class DdmUserVO {
|
||||
|
||||
private String userId;
|
||||
|
||||
private String userName;
|
||||
|
||||
private String userAccount;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user