删掉不要的代码
This commit is contained in:
@@ -1,193 +0,0 @@
|
||||
//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);
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//}
|
||||
@@ -1,82 +0,0 @@
|
||||
//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();
|
||||
// }
|
||||
//}
|
||||
@@ -249,19 +249,6 @@ public class RoleEOController extends BaseController<RoleEO> {
|
||||
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("/getRoleMenu")
|
||||
// public ResponseMessage getRoleMenu(String roleId) throws Exception {
|
||||
// List<MenuVO> homeList = roleEOService.getRoleMenu(roleId);
|
||||
// return Result.success(homeList);
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -57,27 +57,6 @@ 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;
|
||||
@@ -85,8 +64,6 @@ public class UserEOController extends BaseController<UserEO> {
|
||||
|
||||
@ApiOperation(value = "|UserEO|新增|编辑")
|
||||
@PostMapping("addUser")
|
||||
// @RequiresPermissions("sys:user:save")
|
||||
// @BusinessLog(description = "用户新增")
|
||||
@Transactional
|
||||
public ResponseMessage<UserVO> addUser(@RequestBody String requestString) throws Exception {
|
||||
|
||||
@@ -96,8 +73,7 @@ public class UserEOController extends BaseController<UserEO> {
|
||||
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("HZWLsoft.com123");
|
||||
if (StringUtils.isBlank(eo.getAccount())) {
|
||||
return Result.error("用户名不能为空!");
|
||||
@@ -119,12 +95,8 @@ public class UserEOController extends BaseController<UserEO> {
|
||||
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()) ||
|
||||
@@ -132,9 +104,7 @@ public class UserEOController extends BaseController<UserEO> {
|
||||
"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("手机号不符合规则!");
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
//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());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
//}
|
||||
@@ -1,47 +0,0 @@
|
||||
//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;
|
||||
// }
|
||||
//}
|
||||
//
|
||||
@@ -1,36 +0,0 @@
|
||||
//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);
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//}
|
||||
@@ -1,327 +0,0 @@
|
||||
//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());
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//}
|
||||
//
|
||||
@@ -1,71 +0,0 @@
|
||||
//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());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//}
|
||||
@@ -1,15 +0,0 @@
|
||||
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);
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
//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);
|
||||
//
|
||||
//}
|
||||
@@ -258,15 +258,4 @@ public class MenuEOService extends BaseService<MenuEO, String> {
|
||||
|
||||
}
|
||||
|
||||
// public String queryInformation() {
|
||||
// return dao.queryInformation();
|
||||
// }
|
||||
//
|
||||
// public int updateInformation(String information) {
|
||||
// return dao.updateInformation(information);
|
||||
// }
|
||||
//
|
||||
// public int insertInformation(String information) {
|
||||
// return dao.insertInformation(information);
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -60,8 +60,6 @@ public class RoleEOService extends BaseService<RoleEO, String> {
|
||||
return dao;
|
||||
}
|
||||
|
||||
// @Resource
|
||||
// private RoleHomeEODao roleHomeEODao;
|
||||
|
||||
@Resource
|
||||
private RoleMenuEODao roleMenuEODao;
|
||||
@@ -186,15 +184,6 @@ public class RoleEOService extends BaseService<RoleEO, String> {
|
||||
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);
|
||||
@@ -205,43 +194,6 @@ public class RoleEOService extends BaseService<RoleEO, String> {
|
||||
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);
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 判断角色是否属于相应用户
|
||||
@@ -259,88 +211,4 @@ public class RoleEOService extends BaseService<RoleEO, String> {
|
||||
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> getRoleMenu(String roleId) throws Exception {
|
||||
// if (StringUtils.isEmpty(roleId)) {
|
||||
// return new ArrayList<MenuVO>();
|
||||
// }
|
||||
//// List<MenuEO> homeMenuList = roleHomeEODao.getHomeListByRoleId(roleId);
|
||||
//
|
||||
//
|
||||
////
|
||||
// //已分配好的菜单权限为基础,`找出其中的配置首页
|
||||
//
|
||||
// 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 {
|
||||
// List<MenuEO> roleMenuList=menuEODao.listMenuEOByRoleId(roleId);
|
||||
// List<String> idList = roleMenuList.stream().map(MenuEO::getId).collect(Collectors.toList());
|
||||
//
|
||||
// allList = beanMapper.mapList(roleMenuList, 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);
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -1,108 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -1,119 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -1,259 +0,0 @@
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,354 +0,0 @@
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
//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;
|
||||
// }
|
||||
//}
|
||||
@@ -1,15 +0,0 @@
|
||||
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;
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
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;
|
||||
|
||||
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
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;
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
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;
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
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;
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package com.adc.da.sys.vo.ddm;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DdmUserRoleVO {
|
||||
|
||||
private String userId;
|
||||
|
||||
private String roleId;
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
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;
|
||||
}
|
||||
@@ -6,43 +6,6 @@
|
||||
<!--调用时依靠Controller 中
|
||||
@Resource private BeanMapper beanMapper 进行自动装配,然后调用相应方法进行匹配-->
|
||||
|
||||
|
||||
<mapping>
|
||||
<!--角色对应实体类-->
|
||||
<class-a>com.adc.da.sys.entity.RoleEO</class-a>
|
||||
<class-b>com.adc.da.sys.vo.ddm.DdmRoleVO</class-b>
|
||||
|
||||
<!--区别字段-->
|
||||
<field>
|
||||
<a>id</a>
|
||||
<b>rid</b>
|
||||
</field>
|
||||
<field>
|
||||
<a>name</a>
|
||||
<b>roleName</b>
|
||||
</field>
|
||||
<field>
|
||||
<a>name</a>
|
||||
<b>roleCode</b>
|
||||
</field>
|
||||
<field>
|
||||
<a>remarks</a>
|
||||
<b>rdesc</b>
|
||||
</field>
|
||||
<field>
|
||||
<a>delFlag</a>
|
||||
<b>enabled</b>
|
||||
</field>
|
||||
<field>
|
||||
<a>menuEOIdList</a>
|
||||
<b>menusstr</b>
|
||||
</field>
|
||||
<field>
|
||||
<a>menuEOList</a>
|
||||
<b>menus</b>
|
||||
</field>
|
||||
</mapping>
|
||||
|
||||
<mapping>
|
||||
<!--菜单对应实体类-->
|
||||
<class-a>com.adc.da.sys.entity.MenuEO</class-a>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user