Commit 22b835ec authored by wzp's avatar wzp

修改展板管理

parent 12f2edff
......@@ -97,42 +97,32 @@ public enum RESPONSE_CODE_ENUM {
// 错误编码
private String code;
private String resultCode;
// 错误信息
private String msg;
private String message;
// 相应编码有参构造函数
RESPONSE_CODE_ENUM(String code, String msg) {
this.code = code;
this.msg = msg;
RESPONSE_CODE_ENUM(String resultCode, String message) {
this.resultCode = resultCode;
this.message = message;
}
/**
* 获取编码
*/
public String getCode() {
return code;
public String getResultCode() {
return resultCode;
}
/**
* 设置编码
*/
public void setCode(String code) {
this.code = code;
public String getMessage() {
return message;
}
/**
* 获取编码信息
*/
public String getMsg() {
return msg;
public void setResultCode(String resultCode) {
this.resultCode = resultCode;
}
/**
* 设置编码信息
*/
public void setMsg(String msg) {
this.msg = msg;
public void setMessage(String message) {
this.message = message;
}
}
......@@ -90,6 +90,12 @@ class SystemOperationLogService extends ServiceImpl<SysLogMapper, SysLog> {
MethodLog methodLog = getAnnotationLog(point);
String ip = getIp(request);
TUser user = getCurAdmin(request);
// if (user==null){
// HashMap<String, Object> resultMap = new HashMap<>();
// resultMap.put("resultCode", "500");
// resultMap.put("message", "用户未登录!");
// return resultMap;
// }
String methodName = user.getUserName() + "登录本系统";
if (user.getOrgName() != null) {
methodName += ",机构" + user.getOrgName();
......@@ -170,8 +176,8 @@ class SystemOperationLogService extends ServiceImpl<SysLogMapper, SysLog> {
protected Map<String, Object> getFailResult() {
Map<String, Object> map = new HashMap<>();
map.put(RESULT_INFO_ENUM.RESULT_CODE.getKey(), RESPONSE_CODE_ENUM.SERVER_ERROR.getCode());
map.put(RESULT_INFO_ENUM.RESULT_MSG.getKey(), RESPONSE_CODE_ENUM.SERVER_ERROR.getMsg());
map.put(RESULT_INFO_ENUM.RESULT_CODE.getKey(), RESPONSE_CODE_ENUM.SERVER_ERROR.getResultCode());
map.put(RESULT_INFO_ENUM.RESULT_MSG.getKey(), RESPONSE_CODE_ENUM.SERVER_ERROR.getMessage());
return map;
}
......
......@@ -169,8 +169,8 @@ public class GlobalExceptionAdvisor {
@ExceptionHandler(InterfaceException.class)
public cn.wisenergy.chnmuseum.party.common.validator.HttpResult handleInterfaceException(InterfaceException exception) {
cn.wisenergy.chnmuseum.party.common.validator.HttpResult httpResult = new cn.wisenergy.chnmuseum.party.common.validator.HttpResult();
httpResult.setCode(Integer.parseInt(exception.getErrorCode()));
httpResult.setMsg(exception.getErrorMsg());
httpResult.setResultCode(Integer.parseInt(exception.getErrorCode()));
httpResult.setMessage(exception.getErrorMsg());
return httpResult;
}
......@@ -209,7 +209,7 @@ public class GlobalExceptionAdvisor {
* @param httpResult 响应对象
*/
private void addResCodeToMap(RESPONSE_CODE_ENUM responseCodeEnum, cn.wisenergy.chnmuseum.party.common.validator.HttpResult httpResult) {
httpResult.setCode(Integer.parseInt(responseCodeEnum.getCode()));
httpResult.setMsg(responseCodeEnum.getMsg());
httpResult.setResultCode(Integer.parseInt(responseCodeEnum.getResultCode()));
httpResult.setMessage(responseCodeEnum.getMessage());
}
}
\ No newline at end of file
......@@ -43,9 +43,9 @@ public class InterfaceException extends RuntimeException {
* @param responseCode 响应编码枚举
*/
public InterfaceException(RESPONSE_CODE_ENUM responseCode) {
super("errorCode:" + responseCode.getCode() + " errorMsg:" + responseCode.getMsg());
this.errorCode = responseCode.getCode();
this.errorMsg = responseCode.getMsg();
super("errorCode:" + responseCode.getResultCode() + " errorMsg:" + responseCode.getMessage());
this.errorCode = responseCode.getResultCode();
this.errorMsg = responseCode.getMessage();
}
/**
......
......@@ -89,7 +89,7 @@ public class RequestParamValidAspect {
}
//返回第一条校验失败信息,也可以拼接起来返回所有的
String message = validResult.iterator().next().getMessage();
throw new InterfaceException(RESPONSE_CODE_ENUM.PARAM_NOT_VALID.getCode(), message);
throw new InterfaceException(RESPONSE_CODE_ENUM.PARAM_NOT_VALID.getResultCode(), message);
}
}
......
......@@ -2,57 +2,57 @@ package cn.wisenergy.chnmuseum.party.common.validator;
public class HttpResult {
// 响应的状态码
private int code;
private int resultCode;
// 响应的响应信息
private String msg;
private String message;
// 响应的响应体
private Object body;
private Object data;
public HttpResult() {
}
public HttpResult(int code, String msg) {
this.code = code;
this.msg = msg;
public HttpResult(int resultCode, String message) {
this.resultCode = resultCode;
this.message = message;
}
public HttpResult(int code, Object body) {
this.code = code;
this.body = body;
public HttpResult(int resultCode, Object data) {
this.resultCode = resultCode;
this.data = data;
}
public int getCode() {
return code;
public int getResultCode() {
return resultCode;
}
public void setCode(int code) {
this.code = code;
public void setResultCode(int resultCode) {
this.resultCode = resultCode;
}
public String getMsg() {
return msg;
public String getMessage() {
return message;
}
public void setMsg(String msg) {
this.msg = msg;
public void setMessage(String message) {
this.message = message;
}
public Object getBody() {
return body;
public Object getData() {
return data;
}
public void setBody(Object body) {
this.body = body;
public void setData(Object data) {
this.data = data;
}
@Override
public String toString() {
return "{" +
"\"code\":" + code +
", \"msg\":" + "\"" + msg + "\"" +
", \"body\":" + body +
return "HttpResult{" +
"resultCode=" + resultCode +
", message='" + message + '\'' +
", data=" + data +
'}';
}
}
......@@ -35,7 +35,7 @@ public class Audit implements Serializable {
@ApiModelProperty("审核ID")
@TableId(value = "id", type = IdType.ASSIGN_ID)
@NotNull(message = "审核ID不能为空", groups = {Update.class})
@NotNull(message = "审核ID不能为空")
private String id;
@ApiModelProperty("审核内容")
......@@ -48,17 +48,17 @@ public class Audit implements Serializable {
@ApiModelProperty("审核项ID")
@TableField("ref_item_id")
@NotBlank(message = "审核项ID不能为空", groups = {Add.class, Update.class})
@NotBlank(message = "审核项ID不能为空", groups = {Add.class})
private String refItemId;
@ApiModelProperty("提交人员")
@TableField(value = "user_id", fill = FieldFill.INSERT)
@NotBlank(message = "提交人员不能为空", groups = {Add.class, Update.class})
@NotBlank(message = "提交人员不能为空", groups = {Add.class})
private String userId;
@ApiModelProperty(value = "审核内容", allowableValues = "视频内容 ASSET, 展板内容 EXHIBITION_BOARD, 学习内容 LEARNING_CONTENT, 账户 ACCOUNT")
@TableField("type")
@NotBlank(message = "0,看板;1 视频;2 学习内容;3 账号禁用不能为空", groups = {Add.class, Update.class})
@NotBlank(message = "0,看板;1 视频;2 学习内容;3 账号禁用不能为空", groups = {Add.class})
private String type;
@ApiModelProperty("操作类型")
......@@ -71,7 +71,7 @@ public class Audit implements Serializable {
@ApiModelProperty("创建日期")
@TableField(value = "create_time", fill = FieldFill.INSERT)
@NotNull(message = "创建日期不能为空", groups = {Add.class, Update.class})
@NotNull(message = "创建日期不能为空", groups = {Add.class})
private LocalDateTime createTime;
@ApiModelProperty("更新日期")
......
......@@ -11,6 +11,7 @@ import cn.wisenergy.chnmuseum.party.service.AuditService;
import cn.wisenergy.chnmuseum.party.service.impl.TUserServiceImpl;
import cn.wisenergy.chnmuseum.party.web.controller.base.BaseController;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
......@@ -23,6 +24,7 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -57,7 +59,7 @@ public class AuditController extends BaseController {
@ApiImplicitParam(name = "status", value = "待初审 TBC, 驳回 REFUSED,待复审 TBCA, 通过APPROVED_FINAL", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "level", value = "初审 TBC,复审 TBCA", paramType = "query", dataType = "String")
})
public Map<String, Object> getUserList(String name, String status,String level) {
public Map<String, Object> getUserList(String name, String status, String level) {
Page<Audit> auditList;
try {
TUser user1 = getcurUser();
......@@ -72,7 +74,7 @@ public class AuditController extends BaseController {
user.setAuditStatus(level);
}
user.setOrgCode(user1.getOrgCode());
auditList = auditService.getUserList(getPage(),user);
auditList = auditService.getUserList(getPage(), user);
return getResult(auditList);
} catch (Exception e) {
e.printStackTrace();
......@@ -85,10 +87,10 @@ public class AuditController extends BaseController {
@ApiOperation(value = "修改禁用审核信息", notes = "修改禁用审核信息")
public Map<String, Object> updateAudit(@Validated(value = {Update.class}) Audit audit) {
boolean flag;
if (!AuditStatusEnum.TBCA.name().equals(audit.getStatus())){
if (!AuditStatusEnum.TBCA.name().equals(audit.getStatus())) {
audit.setLevel(AuditStatusEnum.TBCA.name());
}
if (!AuditStatusEnum.REFUSED.name().equals(audit.getStatus())){
if (!AuditStatusEnum.REFUSED.name().equals(audit.getStatus())) {
audit.setRemarks("");
}
try {
......@@ -174,8 +176,21 @@ public class AuditController extends BaseController {
@GetMapping("/getById")
@RequiresPermissions("/audit/getById")
public Map<String, Object> getById(String id) {
Audit audit = auditService.getById(id);
return getResult(audit);
HashMap<String, Object> resultMap = new HashMap<>();
try {
Audit audit = new Audit();
UpdateWrapper<Audit> wrapper = new UpdateWrapper<>();
wrapper.eq("ref_item_id", id);
audit = auditService.getOne(wrapper);
resultMap.put("resultCode", "500");
resultMap.put("message", "用户未登录!");
resultMap.put("data", audit);
return resultMap;
} catch (Exception e) {
e.printStackTrace();
}
return getFailResult();
}
}
......
......@@ -105,7 +105,7 @@ public class FileUploadController {
@ApiOperation(value = "资料上传", notes = "资料上传")
public ResponseEntity<BatchUploadResVO> uploadFile(@RequestPart(value = "file", required = false) MultipartFile[] files) throws IOException {
if (files.length == 0) {
throw new InterfaceException(RESPONSE_CODE_ENUM.REQUEST_PARAMS_ERROR.getCode(), "没有文件可供上传");
throw new InterfaceException(RESPONSE_CODE_ENUM.REQUEST_PARAMS_ERROR.getResultCode(), "没有文件可供上传");
}
int successCount = 0;
int failureCount = 0;
......@@ -160,16 +160,16 @@ public class FileUploadController {
@ApiOperation(value = "单图片上传", notes = "单图片上传")
public ResponseEntity<ImageUploadResult> uploadImage(@RequestParam(value = "file") MultipartFile uploadFile) throws Exception {
if (uploadFile == null || uploadFile.getSize() == 0) {
throw new InterfaceException(RESPONSE_CODE_ENUM.REQUEST_PARAMS_ERROR.getCode(), "没有文件可供上传");
throw new InterfaceException(RESPONSE_CODE_ENUM.REQUEST_PARAMS_ERROR.getResultCode(), "没有文件可供上传");
}
String fileName = uploadFile.getOriginalFilename();
String extension = FilenameUtils.getExtension(fileName);
if (StringUtils.isBlank(extension)) {
throw new InterfaceException(RESPONSE_CODE_ENUM.REQUEST_PARAMS_ERROR.getCode(), "文件格式不支持");
throw new InterfaceException(RESPONSE_CODE_ENUM.REQUEST_PARAMS_ERROR.getResultCode(), "文件格式不支持");
}
boolean anyMatch = Arrays.stream(IMAGE_TYPE).anyMatch(s -> Objects.equals(s, extension.toUpperCase()));
if (!anyMatch) {
throw new InterfaceException(RESPONSE_CODE_ENUM.REQUEST_PARAMS_ERROR.getCode(), "文件格式不支持");
throw new InterfaceException(RESPONSE_CODE_ENUM.REQUEST_PARAMS_ERROR.getResultCode(), "文件格式不支持");
}
String url = FastDFSUtils.uploadFile(uploadFile.getInputStream(), uploadFile.getSize(), fileName);
......@@ -189,11 +189,11 @@ public class FileUploadController {
@ApiOperation(value = "多音频上传", notes = "多音频上传")
public ResponseEntity<BatchUploadResVO> uploadAudio(@RequestPart(value = "file", required = false) MultipartFile[] files) throws IOException {
if (files.length == 0) {
throw new InterfaceException(RESPONSE_CODE_ENUM.REQUEST_PARAMS_ERROR.getCode(), "没有文件可供上传");
throw new InterfaceException(RESPONSE_CODE_ENUM.REQUEST_PARAMS_ERROR.getResultCode(), "没有文件可供上传");
}
final boolean existChineseAudio = Arrays.stream(files).anyMatch(s -> Objects.requireNonNull(s.getOriginalFilename()).contains("汉语"));
if (!existChineseAudio) {
throw new InterfaceException(RESPONSE_CODE_ENUM.REQUEST_PARAMS_ERROR.getCode(), "必须包含汉语音频");
throw new InterfaceException(RESPONSE_CODE_ENUM.REQUEST_PARAMS_ERROR.getResultCode(), "必须包含汉语音频");
}
int successCount = 0;
......@@ -252,11 +252,11 @@ public class FileUploadController {
@ApiOperation(value = "多视频上传", notes = "多视频上传")
public ResponseEntity<BatchUploadResVO> uploadVideo(@RequestPart(value = "file", required = false) MultipartFile[] files) throws IOException {
if (files == null || files.length == 0) {
throw new InterfaceException(RESPONSE_CODE_ENUM.REQUEST_PARAMS_ERROR.getCode(), "没有文件可供上传");
throw new InterfaceException(RESPONSE_CODE_ENUM.REQUEST_PARAMS_ERROR.getResultCode(), "没有文件可供上传");
}
final boolean matchChinese = Arrays.stream(files).anyMatch(s -> Objects.requireNonNull(s.getOriginalFilename()).contains("汉语"));
if (!matchChinese) {
throw new InterfaceException(RESPONSE_CODE_ENUM.REQUEST_PARAMS_ERROR.getCode(), "必须包含汉语视频");
throw new InterfaceException(RESPONSE_CODE_ENUM.REQUEST_PARAMS_ERROR.getResultCode(), "必须包含汉语视频");
}
int successCount = 0;
......
......@@ -9,6 +9,7 @@ import cn.wisenergy.chnmuseum.party.model.TArea;
import cn.wisenergy.chnmuseum.party.model.TUser;
import cn.wisenergy.chnmuseum.party.service.TAreaService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -70,6 +71,20 @@ public class TOrganController extends BaseController {
@ApiOperation(value = "添加机构", notes = "添加机构")
// @MethodLog(operModule = OperModule.ORG,operType = OperType.ADD)
public Map<String, Object> add(TOrgan organ) {
QueryWrapper<TOrgan> ew = new QueryWrapper<>();
if (StringUtils.isNoneBlank(organ.getName())) {
organ.setName(organ.getName().trim());
ew.eq("is_deleted", 0);
ew.eq("name", organ.getName());
List<TOrgan> list = this.tOrganService.list(ew);
if (list != null&&list.get(0)!=null) {
HashMap<String, Object> resultMap = new HashMap<>();
resultMap.put("resultCode", "500");
resultMap.put("message", "机构名称不能重复!");
return resultMap;
}
}
organ.setCreateTime(DateUtil80.getDateTimeOfTimestamp(System.currentTimeMillis()));
organ.setUpdateTime(DateUtil80.getDateTimeOfTimestamp(System.currentTimeMillis()));
String organCode = getOrganCode(organ.getParentId());
......
......@@ -64,8 +64,8 @@ public class BaseController implements Serializable {
*/
protected Map<String, Object> getResult(Object obj) {
Map<String, Object> map = new HashMap<>();
map.put(RESULT_INFO_ENUM.RESULT_CODE.getKey(), RESPONSE_CODE_ENUM.REQUEST_SUCCESS.getCode());
map.put(RESULT_INFO_ENUM.RESULT_MSG.getKey(), RESPONSE_CODE_ENUM.REQUEST_SUCCESS.getMsg());
map.put(RESULT_INFO_ENUM.RESULT_CODE.getKey(), RESPONSE_CODE_ENUM.REQUEST_SUCCESS.getResultCode());
map.put(RESULT_INFO_ENUM.RESULT_MSG.getKey(), RESPONSE_CODE_ENUM.REQUEST_SUCCESS.getMessage());
map.put(RESULT_INFO_ENUM.RESULT_BODY.getKey(), obj);
return map;
}
......@@ -77,8 +77,8 @@ public class BaseController implements Serializable {
*/
protected Map<String, Object> getSuccessResult() {
Map<String, Object> map = new HashMap<>();
map.put(RESULT_INFO_ENUM.RESULT_CODE.getKey(), RESPONSE_CODE_ENUM.REQUEST_SUCCESS.getCode());
map.put(RESULT_INFO_ENUM.RESULT_MSG.getKey(), RESPONSE_CODE_ENUM.REQUEST_SUCCESS.getMsg());
map.put(RESULT_INFO_ENUM.RESULT_CODE.getKey(), RESPONSE_CODE_ENUM.REQUEST_SUCCESS.getResultCode());
map.put(RESULT_INFO_ENUM.RESULT_MSG.getKey(), RESPONSE_CODE_ENUM.REQUEST_SUCCESS.getMessage());
map.put(RESULT_INFO_ENUM.RESULT_BODY.getKey(),"");
return map;
}
......@@ -105,8 +105,8 @@ public class BaseController implements Serializable {
*/
protected Map<String, Object> getFailResult(RESPONSE_CODE_ENUM responseCodeEnum) {
Map<String, Object> map = new HashMap<>();
map.put(RESULT_INFO_ENUM.RESULT_CODE.getKey(), responseCodeEnum.getCode());
map.put(RESULT_INFO_ENUM.RESULT_MSG.getKey(), responseCodeEnum.getMsg());
map.put(RESULT_INFO_ENUM.RESULT_CODE.getKey(), responseCodeEnum.getResultCode());
map.put(RESULT_INFO_ENUM.RESULT_MSG.getKey(), responseCodeEnum.getMessage());
return map;
}
......@@ -117,8 +117,8 @@ public class BaseController implements Serializable {
*/
protected Map<String, Object> getFailResult() {
Map<String, Object> map = new HashMap<>();
map.put(RESULT_INFO_ENUM.RESULT_CODE.getKey(), RESPONSE_CODE_ENUM.SERVER_ERROR.getCode());
map.put(RESULT_INFO_ENUM.RESULT_MSG.getKey(), RESPONSE_CODE_ENUM.SERVER_ERROR.getMsg());
map.put(RESULT_INFO_ENUM.RESULT_CODE.getKey(), RESPONSE_CODE_ENUM.SERVER_ERROR.getResultCode());
map.put(RESULT_INFO_ENUM.RESULT_MSG.getKey(), RESPONSE_CODE_ENUM.SERVER_ERROR.getMessage());
return map;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment