From c0830e12a5b6fb7378784198e5941b0b2f1635d8 Mon Sep 17 00:00:00 2001 From: Burce Date: Wed, 9 Oct 2019 20:20:17 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=8B=9B=E5=95=86]adjust?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../invest/InvestDemandController.java | 3 +-- .../java/com/iformall/common/ErrorCode.java | 1 + .../common/GlobalDefultExceptionHandler.java | 9 ++++++++- .../domain/po/InvestCustomerEntity.java | 2 ++ .../domain/po/InvestDemandEntity.java | 2 ++ .../domain/po/InvestFollowRecordEntity.java | 2 ++ .../domain/po/InvestOperateRecordEntity.java | 2 ++ .../domain/po/InvestRemindEntity.java | 2 ++ .../iformall/domain/po/InvestTaskEntity.java | 2 ++ .../domain/vo/invest/InvestTaskVo.java | 2 ++ .../service/invest/InvestBizService.java | 2 +- .../invest/impl/InvestBizServiceImpl.java | 20 +++++++++---------- 12 files changed, 35 insertions(+), 14 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestDemandController.java b/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestDemandController.java index 3f73d675a..6665cfc60 100755 --- a/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestDemandController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestDemandController.java @@ -41,7 +41,6 @@ public class InvestDemandController extends InvestBaseController { /** * 分页列表 */ - @RequiresPermissions("investTaskEdit") @SystemServiceLog @ApiOperation(value = "分页列表接口") @GetMapping("/list") @@ -73,7 +72,7 @@ public class InvestDemandController extends InvestBaseController { */ @SystemServiceLog @PostMapping("/update") - public InvestResultData update(@RequestBody InvestDemandVo investDemand) { + public InvestResultData update(@RequestBody InvestDemandDto investDemand) { return execute(investDemand, p -> investBizService.updateCustomerAndDemand(p)); } diff --git a/mallinkService/src/main/java/com/iformall/common/ErrorCode.java b/mallinkService/src/main/java/com/iformall/common/ErrorCode.java index 7d82f0cc2..619eef548 100644 --- a/mallinkService/src/main/java/com/iformall/common/ErrorCode.java +++ b/mallinkService/src/main/java/com/iformall/common/ErrorCode.java @@ -29,6 +29,7 @@ public enum ErrorCode{ SYS_REPEAT_SUBMIT_EXCEPTION(1013, "请勿重复操作"), REPORT_TYPE_UNKNOWN(1014, "不支持的报表类型"), SYS_MCH_NOT_FOUND(1015, "微信商户号未找到"), + SYS_AUTH_ERROR(1016, "该用户没有权限访问"), /** * 菜单 diff --git a/mallinkService/src/main/java/com/iformall/common/GlobalDefultExceptionHandler.java b/mallinkService/src/main/java/com/iformall/common/GlobalDefultExceptionHandler.java index a06412457..c79922bc1 100644 --- a/mallinkService/src/main/java/com/iformall/common/GlobalDefultExceptionHandler.java +++ b/mallinkService/src/main/java/com/iformall/common/GlobalDefultExceptionHandler.java @@ -3,6 +3,7 @@ package com.iformall.common; import com.iformall.exception.MallinkException; import com.iformall.service.MailService; +import org.apache.shiro.authz.AuthorizationException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -63,7 +64,9 @@ public class GlobalDefultExceptionHandler { if(checkExceptionType(e)) { MallinkException me = (MallinkException)e; return new ResultData(me.getErrorCode(),me.getMessage()); - }else { + } else if(checkAuthException(e)) { + return new ResultData(ErrorCode.SYS_AUTH_ERROR); + } else { return new ResultData(Result.ERROR, e.getMessage()); } } @@ -106,4 +109,8 @@ public class GlobalDefultExceptionHandler { } return false; } + + private boolean checkAuthException(Exception e) { + return e instanceof AuthorizationException; + } } diff --git a/mallinkService/src/main/java/com/iformall/domain/po/InvestCustomerEntity.java b/mallinkService/src/main/java/com/iformall/domain/po/InvestCustomerEntity.java index 0209807ba..9a7d257b5 100755 --- a/mallinkService/src/main/java/com/iformall/domain/po/InvestCustomerEntity.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/InvestCustomerEntity.java @@ -10,6 +10,7 @@ import com.iformall.enums.EnumCustomerRatingType; import com.iformall.enums.EnumCustomerType; import com.iformall.enums.EnumInvestChannel; import lombok.Data; +import lombok.EqualsAndHashCode; import java.util.Date; @@ -22,6 +23,7 @@ import java.util.Date; */ @Data @TableName("invest_customer") +@EqualsAndHashCode(callSuper = true) public class InvestCustomerEntity extends InvestBaseEntity { /** diff --git a/mallinkService/src/main/java/com/iformall/domain/po/InvestDemandEntity.java b/mallinkService/src/main/java/com/iformall/domain/po/InvestDemandEntity.java index 19cd5687d..5f937e183 100755 --- a/mallinkService/src/main/java/com/iformall/domain/po/InvestDemandEntity.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/InvestDemandEntity.java @@ -8,6 +8,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.iformall.common.LogColumn; import com.iformall.enums.EnumInvestType; import lombok.Data; +import lombok.EqualsAndHashCode; import java.util.Date; @@ -20,6 +21,7 @@ import java.util.Date; */ @Data @TableName("invest_demand") +@EqualsAndHashCode(callSuper = true) public class InvestDemandEntity extends InvestBaseEntity { /** diff --git a/mallinkService/src/main/java/com/iformall/domain/po/InvestFollowRecordEntity.java b/mallinkService/src/main/java/com/iformall/domain/po/InvestFollowRecordEntity.java index 6eea09391..573067989 100755 --- a/mallinkService/src/main/java/com/iformall/domain/po/InvestFollowRecordEntity.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/InvestFollowRecordEntity.java @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableName; import com.iformall.enums.EnumFollowType; import lombok.Data; +import lombok.EqualsAndHashCode; /** * 跟踪记录 @@ -15,6 +16,7 @@ import lombok.Data; */ @Data @TableName("invest_follow_record") +@EqualsAndHashCode(callSuper = true) public class InvestFollowRecordEntity extends InvestBaseEntity { /** diff --git a/mallinkService/src/main/java/com/iformall/domain/po/InvestOperateRecordEntity.java b/mallinkService/src/main/java/com/iformall/domain/po/InvestOperateRecordEntity.java index 5ee137927..fba4c6455 100755 --- a/mallinkService/src/main/java/com/iformall/domain/po/InvestOperateRecordEntity.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/InvestOperateRecordEntity.java @@ -9,6 +9,7 @@ import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonIgnore; import com.iformall.enums.EnumTableOperateType; import lombok.Data; +import lombok.EqualsAndHashCode; /** * 操作记录 @@ -19,6 +20,7 @@ import lombok.Data; */ @Data @TableName("invest_operate_record") +@EqualsAndHashCode(callSuper = true) public class InvestOperateRecordEntity extends InvestBaseEntity { /** diff --git a/mallinkService/src/main/java/com/iformall/domain/po/InvestRemindEntity.java b/mallinkService/src/main/java/com/iformall/domain/po/InvestRemindEntity.java index 8dae970d6..3fbf66d6f 100755 --- a/mallinkService/src/main/java/com/iformall/domain/po/InvestRemindEntity.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/InvestRemindEntity.java @@ -6,6 +6,7 @@ import java.util.Date; import lombok.Data; import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.EqualsAndHashCode; /** * 招商提醒 @@ -16,6 +17,7 @@ import com.fasterxml.jackson.annotation.JsonFormat; */ @Data @TableName("invest_remind") +@EqualsAndHashCode(callSuper = true) public class InvestRemindEntity extends InvestBaseEntity { /** diff --git a/mallinkService/src/main/java/com/iformall/domain/po/InvestTaskEntity.java b/mallinkService/src/main/java/com/iformall/domain/po/InvestTaskEntity.java index 44b666850..463433372 100755 --- a/mallinkService/src/main/java/com/iformall/domain/po/InvestTaskEntity.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/InvestTaskEntity.java @@ -8,6 +8,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.iformall.enums.EnumInvestType; import com.iformall.enums.EnumTaskStatus; import lombok.Data; +import lombok.EqualsAndHashCode; import java.util.Date; @@ -20,6 +21,7 @@ import java.util.Date; */ @Data @TableName("invest_task") +@EqualsAndHashCode(callSuper = true) public class InvestTaskEntity extends InvestBaseEntity { /** diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestTaskVo.java b/mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestTaskVo.java index d5e4cc866..8cdb6d1d3 100644 --- a/mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestTaskVo.java +++ b/mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestTaskVo.java @@ -4,11 +4,13 @@ import com.iformall.domain.po.InvestTaskEntity; import com.iformall.domain.po.MallUserInfo; import lombok.Builder; import lombok.Data; +import lombok.EqualsAndHashCode; import java.util.List; @Data @Builder +@EqualsAndHashCode(callSuper = true) public class InvestTaskVo extends InvestTaskEntity { /** diff --git a/mallinkService/src/main/java/com/iformall/service/invest/InvestBizService.java b/mallinkService/src/main/java/com/iformall/service/invest/InvestBizService.java index 2a02f51f4..157c5d112 100644 --- a/mallinkService/src/main/java/com/iformall/service/invest/InvestBizService.java +++ b/mallinkService/src/main/java/com/iformall/service/invest/InvestBizService.java @@ -21,7 +21,7 @@ public interface InvestBizService { boolean saveCustomerAndDemand(InvestDemandDto customerDemandDto) ; - boolean updateCustomerAndDemand(InvestDemandVo customerDemandVo) ; + boolean updateCustomerAndDemand(InvestDemandDto demandDto) ; InvestDemandVo findDemandById(Long id) ; diff --git a/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java index 3206329e0..79d619397 100644 --- a/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java @@ -129,10 +129,10 @@ public class InvestBizServiceImpl implements InvestBizService { @Transactional(rollbackFor = Exception.class) @Override - public boolean saveCustomerAndDemand(InvestDemandDto customerDemandDto) { - InvestHelper.allNotNull(customerDemandDto, customerDemandDto.getCustomerId()); - InvestCustomerEntity customerEntity = customerDemandDto.getCustomer(); - InvestCustomerEntity customerEntityDB = customerService.getById(customerDemandDto.getCustomerId()); + public boolean saveCustomerAndDemand(InvestDemandDto demandDto) { + InvestHelper.allNotNull(demandDto, demandDto.getCustomerId()); + InvestCustomerEntity customerEntity = demandDto.getCustomer(); + InvestCustomerEntity customerEntityDB = customerService.getById(demandDto.getCustomerId()); if (Objects.nonNull(customerEntity)) { if (Objects.isNull(customerEntityDB)) { customerService.save(customerEntity); @@ -141,19 +141,19 @@ public class InvestBizServiceImpl implements InvestBizService { } } InvestDemandEntity demandEntity = new InvestDemandEntity(); - BeanUtils.copyProperties(customerDemandDto, demandEntity); + BeanUtils.copyProperties(demandDto, demandEntity); return demandService.save(demandEntity); } @Transactional(rollbackFor = Exception.class) @Override - public boolean updateCustomerAndDemand(InvestDemandVo customerDemandVo) { - InvestHelper.allNotNull(customerDemandVo); - InvestHelper.allNotNull(customerDemandVo.getBrand(), customerDemandVo.getCustomer()); - InvestCustomerEntity customerEntity = customerDemandVo.getCustomer(); + public boolean updateCustomerAndDemand(InvestDemandDto demandDto) { + InvestHelper.allNotNull(demandDto, demandDto.getCustomerId()); + InvestCustomerEntity customerEntity = demandDto.getCustomer(); + InvestHelper.allNotNull(customerEntity); customerService.updateById(customerEntity); InvestDemandEntity demandEntity = new InvestDemandEntity(); - BeanUtils.copyProperties(customerDemandVo, demandEntity); + BeanUtils.copyProperties(demandDto, demandEntity); return demandService.updateById(demandEntity); }