|
|
|
@ -4,7 +4,9 @@ import cn.hutool.core.codec.Base64; |
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
|
import com.alibaba.excel.EasyExcel; |
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.dxhy.common.constant.DbConstant; |
|
|
|
|
import com.dxhy.common.controller.AbstractController; |
|
|
|
|
import com.dxhy.common.datasource.config.DynamicContextHolder; |
|
|
|
|
import com.dxhy.common.util.UUIDUtils; |
|
|
|
|
import com.dxhy.common.utils.Base64Encoding; |
|
|
|
|
import com.dxhy.common.utils.R; |
|
|
|
@ -91,6 +93,13 @@ public class EmailMaintainController extends AbstractController { |
|
|
|
|
} |
|
|
|
|
String loginname = getUserInfo().getLoginname(); |
|
|
|
|
emailMaintain.setCreateUser(loginname); |
|
|
|
|
DynamicContextHolder.push(DbConstant.BASICS_READ); |
|
|
|
|
EmailMaintainVo vo = new EmailMaintainVo(); |
|
|
|
|
vo.setEmailAddress(emailMaintain.getEmailAddress()); |
|
|
|
|
EmailMaintainVo maintainVo = emailMaintainService.getEmailMaintainVo(vo); |
|
|
|
|
if(maintainVo != null){ |
|
|
|
|
return ResponseEntity.ok(R.error("邮箱地址已存在!")); |
|
|
|
|
} |
|
|
|
|
boolean insert = this.emailMaintainService.insert(emailMaintain); |
|
|
|
|
if(insert){ |
|
|
|
|
return ResponseEntity.ok(R.ok()); |
|
|
|
@ -106,6 +115,19 @@ public class EmailMaintainController extends AbstractController { |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/edit") |
|
|
|
|
public ResponseEntity<R> edit(@RequestBody EmailMaintainVo emailMaintain) { |
|
|
|
|
if(StringUtils.isBlank(emailMaintain.getEmailPassword()) || StringUtils.isBlank(emailMaintain.getEmailAddress()) ){ |
|
|
|
|
return ResponseEntity.ok(R.error("邮箱地址/密码不能为空!")); |
|
|
|
|
}else { |
|
|
|
|
String encode = Base64Encoding.encode(emailMaintain.getEmailPassword()); |
|
|
|
|
emailMaintain.setEmailPassword(encode); |
|
|
|
|
} |
|
|
|
|
DynamicContextHolder.push(DbConstant.BASICS_READ); |
|
|
|
|
EmailMaintainVo vo = new EmailMaintainVo(); |
|
|
|
|
vo.setEmailAddress(emailMaintain.getEmailAddress()); |
|
|
|
|
EmailMaintainVo maintainVo = emailMaintainService.getEmailMaintainVo(vo); |
|
|
|
|
if(maintainVo != null && maintainVo.getId().equals(emailMaintain.getId())){ |
|
|
|
|
return ResponseEntity.ok(R.error("邮箱地址已存在!")); |
|
|
|
|
} |
|
|
|
|
boolean b = emailMaintainService.update(emailMaintain); |
|
|
|
|
if(b){ |
|
|
|
|
return ResponseEntity.ok(R.ok()); |
|
|
|
@ -142,6 +164,7 @@ public class EmailMaintainController extends AbstractController { |
|
|
|
|
errorMsgList.add("第" + resultIndex + "行,用户编码不能为空"); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
DynamicContextHolder.push(DbConstant.BASICS_READ); |
|
|
|
|
String userName = emailMaintainService.getUserName(userId); |
|
|
|
|
if(StringUtils.isBlank(userName)){ |
|
|
|
|
errorMsgList.add("第" + resultIndex + "行,用户编码在系统中查询不到,请核实!"); |
|
|
|
@ -206,6 +229,7 @@ public class EmailMaintainController extends AbstractController { |
|
|
|
|
if(StringUtils.isEmpty(userCode)){ |
|
|
|
|
return ResponseEntity.ok(R.error("数据不能为空!")); |
|
|
|
|
} |
|
|
|
|
DynamicContextHolder.push(DbConstant.BASICS_READ); |
|
|
|
|
String userName = emailMaintainService.getUserName(userCode); |
|
|
|
|
if(StringUtils.isNotEmpty(userName)){ |
|
|
|
|
JSONObject json = new JSONObject(); |
|
|
|
|