wangys 6 anni fa
parent
commit
a7a83cf9f5

+ 2 - 0
efunbox-base/efunbox-base-api/src/main/java/cn/efunbox/manage/base/repository/CostTypeRepository.java

@@ -9,4 +9,6 @@ import java.util.List;
 public interface CostTypeRepository extends BasicRepository<CostType> {
 public interface CostTypeRepository extends BasicRepository<CostType> {
 
 
     List<CostType> findByStatusOrderBySortDesc(BaseStatusEnum status);
     List<CostType> findByStatusOrderBySortDesc(BaseStatusEnum status);
+
+    CostType findByName(String name);
 }
 }

+ 2 - 0
efunbox-base/efunbox-base-api/src/main/java/cn/efunbox/manage/base/repository/ProjectRepository.java

@@ -12,5 +12,7 @@ public interface ProjectRepository extends BasicRepository<Project> {
 
 
     List<Project> findByStatusOrderBySortDesc(BaseStatusEnum status);
     List<Project> findByStatusOrderBySortDesc(BaseStatusEnum status);
 
 
+    Project findByName(String name);
+
     Project findById(String id);
     Project findById(String id);
 }
 }

+ 6 - 0
efunbox-base/efunbox-base-api/src/main/java/cn/efunbox/manage/base/service/impl/CostTypeServiceImpl.java

@@ -37,6 +37,9 @@ public class CostTypeServiceImpl implements CostTypeService {
         if(costType == null){
         if(costType == null){
             return ApiResult.error(ApiCode.PARAMETER_ERROR);
             return ApiResult.error(ApiCode.PARAMETER_ERROR);
         }
         }
+        if(Objects.nonNull(costTypeRepository.findByName(costType.getName()))){
+            return ApiResult.error(ApiCode.REPETITION_ERROR);
+        }
         costType = costTypeRepository.save(costType);
         costType = costTypeRepository.save(costType);
         if(Objects.nonNull(costType)){
         if(Objects.nonNull(costType)){
             return ApiResult.ok(costType);
             return ApiResult.ok(costType);
@@ -49,6 +52,9 @@ public class CostTypeServiceImpl implements CostTypeService {
         if(costType == null){
         if(costType == null){
             return ApiResult.error(ApiCode.PARAMETER_ERROR);
             return ApiResult.error(ApiCode.PARAMETER_ERROR);
         }
         }
+        if(Objects.nonNull(costTypeRepository.findByName(costType.getName()))){
+            return ApiResult.error(ApiCode.REPETITION_ERROR);
+        }
         costType = costTypeRepository.update(costType);
         costType = costTypeRepository.update(costType);
         if(Objects.nonNull(costType)){
         if(Objects.nonNull(costType)){
             return ApiResult.ok(costType);
             return ApiResult.ok(costType);

+ 6 - 0
efunbox-base/efunbox-base-api/src/main/java/cn/efunbox/manage/base/service/impl/ProjectServiceImpl.java

@@ -40,6 +40,9 @@ public class ProjectServiceImpl implements ProjectService {
         if(project ==null){
         if(project ==null){
             return ApiResult.error(ApiCode.PARAMETER_ERROR);
             return ApiResult.error(ApiCode.PARAMETER_ERROR);
         }
         }
+        if(Objects.nonNull(projectRepository.findByName(project.getName()))){
+            return ApiResult.error(ApiCode.REPETITION_ERROR);
+        }
         project = projectRepository.save(project);
         project = projectRepository.save(project);
         if(Objects.nonNull(project)){
         if(Objects.nonNull(project)){
             return ApiResult.ok(project);
             return ApiResult.ok(project);
@@ -52,6 +55,9 @@ public class ProjectServiceImpl implements ProjectService {
         if(project ==null){
         if(project ==null){
             return ApiResult.error(ApiCode.PARAMETER_ERROR);
             return ApiResult.error(ApiCode.PARAMETER_ERROR);
         }
         }
+        if(Objects.nonNull(projectRepository.findByName(project.getName()))){
+            return ApiResult.error(ApiCode.REPETITION_ERROR);
+        }
         project = projectRepository.update(project);
         project = projectRepository.update(project);
         if(Objects.nonNull(project)){
         if(Objects.nonNull(project)){
             return ApiResult.ok(project);
             return ApiResult.ok(project);

+ 2 - 30
manage-common/src/main/java/cn/efunbox/manage/common/result/ApiCode.java

@@ -59,36 +59,8 @@ public class ApiCode extends AbstractApiCode {
     public final static ApiCode DEVICE_ERROR = new ApiCode("没有相关deviceCode信息", _C_DEVICE_ERROR);
     public final static ApiCode DEVICE_ERROR = new ApiCode("没有相关deviceCode信息", _C_DEVICE_ERROR);
     public final static int _C_DATA_ERROR = 701;
     public final static int _C_DATA_ERROR = 701;
     public final static ApiCode DATA_ERROR = new ApiCode("数据异常", _C_DATA_ERROR);
     public final static ApiCode DATA_ERROR = new ApiCode("数据异常", _C_DATA_ERROR);
-
-    public final static int _C_UNIONID_ERROR = 703;
-    public final static ApiCode UNIONID_ERROR = new ApiCode(" unionId为空", _C_UNIONID_ERROR);
-
-    public final static int _C_AWARD_ERROR = 706;
-    public final static ApiCode AWARD_ERROR = new ApiCode("自己不能打赏自己", _C_AWARD_ERROR);
-
-    public final static int _C_VIDEO_ERROR = 707;
-    public final static ApiCode VIDEO_ERROR = new ApiCode("视频地址错误", _C_VIDEO_ERROR);
-
-    public final static int _C_BUY_TIME_ERROR = 708;
-    public final static ApiCode BUY_TIME_ERROR = new ApiCode("购买时长不能超过12个月", _C_BUY_TIME_ERROR);
-
-    public final static int _C_JOINED_GROUP_ERROR = 801;
-    public final static ApiCode JOINED_GROUP_ERROR = new ApiCode("你已参加过当前团购", _C_JOINED_GROUP_ERROR);
-
-    public final static int _C_GROUP_STATUS_ERROR = 802;
-    public final static ApiCode GROUP_STATUS_ERROR = new ApiCode("当前团购已关闭", _C_GROUP_STATUS_ERROR);
-
-    public final static int _C_GROUP_EXIST_ERROR = 803;
-    public final static ApiCode GROUP_EXIST_ERROR = new ApiCode("您有未完成的团正在进行中", _C_GROUP_EXIST_ERROR);
-
-    public final static int _C_GROUP_HEADCOUNT_ERROR = 804;
-    public final static ApiCode GROUP_HEADCOUNT_ERROR = new ApiCode("此团参加人数已达上限", _C_GROUP_HEADCOUNT_ERROR);
-
-    public final static int _C_GROUP_CREATE_ERROR = 805;
-    public final static ApiCode GROUP_CREATE_ERROR = new ApiCode("您已购买过当前课文", _C_GROUP_CREATE_ERROR);
-
-    public final static int _C_JOIN_SHARE_ERROR = 806;
-    public final static ApiCode JOIN_SHARE_ERROR = new ApiCode("您当前没有助力资格", _C_JOIN_SHARE_ERROR);
+    public final static int _C_REPETITION_ERROR = 703;
+    public final static ApiCode REPETITION_ERROR = new ApiCode("名称重复", _C_REPETITION_ERROR);
 
 
     protected ApiCode(String message, int code) {
     protected ApiCode(String message, int code) {
         super(code, message);
         super(code, message);