tanzhongran пре 3 година
родитељ
комит
085507ca53

+ 9 - 30
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/controller/console/ActiveController.java

@@ -46,6 +46,15 @@ public class ActiveController {
         return BaseResponse.create();
     }
 
+    @ApiOperation("删除活动")
+    @PostMapping("deleteActive")
+    public BaseResponse deleteActive(@Validated @RequestBody DeleteActiveReq deleteActiveReq) throws Exception{
+        //删除活动
+        activeService.deleteActive(deleteActiveReq);
+        //包装出参
+        return BaseResponse.create();
+    }
+
     @ApiOperation("修改码活动(已审核通过)")
     @PostMapping("resubmitActive")
     public BaseResponse resubmitActive(@Validated @RequestBody ResubmitActiveReq req) throws Exception{
@@ -64,8 +73,6 @@ public class ActiveController {
         return BaseResponse.create(result);
     }
 
-
-
     @ApiOperation("查询活动明细(编辑审核页面)")
     @GetMapping("getActive")
     public BaseResponse<GetActiveRes> getActive(@Validated GetActiveReq getActiveReq) throws Exception{
@@ -130,34 +137,6 @@ public class ActiveController {
         return BaseResponse.create();
     }
 
-
-    //    6.03已废弃
-//    @ApiOperation("分页查询码活动未关联的码包列表(新增修改页面)")
-//    @GetMapping("listActivePackageAdd")
-//    public BaseResponse<ListActivePackageAddRes> listActivePackageAdd(@Validated ListActivePackageAddReq req) throws Exception{
-//        //分页查询
-//        ListActivePackageAddRes result = activeService.listActivePackageAdd(req);
-//        //包装出参
-//        return BaseResponse.create(result);
-//    }
-//
-//    @ApiOperation("分页查询关联码包列表(编辑审核页面)")
-//    @GetMapping("listActivePackage")
-//    public BaseResponse<ListActivePackageRes> listActivePackage(@Validated GetActiveReq getActiveReq) throws Exception{
-//        //分页查询
-//        ListActivePackageRes result = activeService.listActivePackage(getActiveReq);
-//        //包装出参
-//        return BaseResponse.create(result);
-//    }
-//
-//    @ApiOperation("分页查询关联的码包列表(重新提交申请单审核页面)")
-//    @GetMapping("listActiveModifyApplyPackage")
-//    public BaseResponse<ListActiveModifyApplyPackageRes> listActiveModifyApplyPackage(@Validated GetActiveModifyApplyReq req) throws Exception{
-//        //分页查询
-//        ListActiveModifyApplyPackageRes result = activeService.listActiveModifyApplyPackage(req);
-//        //包装出参
-//        return BaseResponse.create(result);
-//    }
 }
 
 

+ 0 - 8
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dto/req/AddActiveReq.java

@@ -49,12 +49,4 @@ public class AddActiveReq implements Serializable {
     private String activeUrl;
 
 
-//    6.03已废弃
-//    @NotNull(message = "关联码包为空")
-//    @ApiModelProperty(value = "关联码包")
-//    private List<Long> qrPackageIdList;
-//
-//    @NotEmpty(message = "所属品牌为空")
-//    @ApiModelProperty(value = "所属品牌")
-//    private List<String> brandCodeList;
 }

+ 20 - 0
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dto/req/DeleteActiveReq.java

@@ -0,0 +1,20 @@
+package com.abi.qms.platform.dto.req;
+
+import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+
+/**
+ * @author:Andy.Tan
+ * @Description: 删除活动入参
+ */
+@Data
+@Schema
+public class DeleteActiveReq implements Serializable {
+    @NotNull
+    @ApiModelProperty(value = "id")
+    private Long id;
+}

+ 19 - 0
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dto/res/DeleteActiveRes.java

@@ -0,0 +1,19 @@
+package com.abi.qms.platform.dto.res;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
+import java.io.Serializable;
+
+/**
+ * @author:Andy.Tan
+ * @Description: 删除活动出参
+ */
+@Data
+@Schema
+public class DeleteActiveRes implements Serializable {
+
+}

+ 4 - 0
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/service/ActiveService.java

@@ -27,6 +27,10 @@ public interface ActiveService{
      */
     void updateActive(UpdateActiveReq updateActiveReq);
 
+
+    void deleteActive(DeleteActiveReq deleteActiveReq) throws Exception;
+
+
     /**
      * 修改码活动(已审核通过)
      * @param req

+ 19 - 7
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/service/impl/ActiveServiceImpl.java

@@ -121,16 +121,28 @@ public class ActiveServiceImpl implements ActiveService {
         active.setApplyUserName(userUtil.getUser().getUserName());
         active.setBeginTime(req.getBeginTime());
         active.setEndTime(req.getEndTime());
-        //    6.03已废弃
-//        active.setBrandCode(CollectionUtil.isNotEmpty(req.getBrandCodeList()) ? String.join(",", req.getBrandCodeList()) : null);
         active.setUrlTab(req.getUrlTab());
         active.setActiveUrl(req.getActiveUrl());
         active.setUpdateBy(userId);
         baseActiveMapper.updateById(active);
+    }
+
+    /**
+     * 删除活动
+     **/
+    @Override
+    public void deleteActive(DeleteActiveReq req) {
+        //1-查询活动
+        BaseActive active = baseActiveMapper.selectById(req.getId());
+        AssertUtil.isNull(active,"活动不存在");
+        if(ActiveAuditStatusEnum.REVIEW_PASS.is(active.getAuditStatus())){
+            throw new BusinessException("活动已审核通过,不可删除");
+        }
+
+        //2-删除活动
+        active.setIsDelete(1);
+        baseActiveMapper.updateById(active);
 
-        //    6.03已废弃
-//        //删除添加关联的码包,重新插入
-//        updateActivePackageMappiing(req.getId(), req.getQrPackageIdAddList(), req.getQrPackageIdDeleteList());
     }
 
     @Override
@@ -343,7 +355,7 @@ public class ActiveServiceImpl implements ActiveService {
         BaseActive active = baseActiveMapper.selectById(req.getId());
         AssertUtil.isNull(active, "活动不存在");
 
-        if(ActiveAuditStatusEnum.WAIT_REVIEW.is(active.getAuditStatus())){
+        if(!ActiveAuditStatusEnum.WAIT_REVIEW.is(active.getAuditStatus())){
             throw new BusinessException("该活动不能审核");
         }
         Long userId = userUtil.getUser().getId();
@@ -360,7 +372,7 @@ public class ActiveServiceImpl implements ActiveService {
     public void refuseActive(RefuseActiveReq req) {
         BaseActive active = baseActiveMapper.selectById(req.getId());
         AssertUtil.isNull(active, "活动不存在");
-        if(ActiveAuditStatusEnum.WAIT_REVIEW.is(active.getAuditStatus())){
+        if(!ActiveAuditStatusEnum.WAIT_REVIEW.is(active.getAuditStatus())){
             throw new BusinessException("该活动不能审核");
         }
         Long userId = userUtil.getUser().getId();

+ 5 - 3
abi-cloud-qr-platform-server/src/main/resources/dao/mapper/BaseActiveMapper.xml

@@ -16,8 +16,6 @@
         <result column="audit_user_name" property="auditUserName" />
         <result column="begin_time" property="beginTime" />
         <result column="end_time" property="endTime" />
-        <result column="brand_code" property="brandCode" />
-        <result column="sub_brand_code" property="subBrandCode" />
         <result column="url_tab" property="urlTab" />
         <result column="active_url" property="activeUrl" />
         <result column="create_time" property="createTime" />
@@ -35,7 +33,11 @@
     </sql>
 
     <select id="listActivePage" resultType="com.abi.qms.platform.dao.vo.result.ListActiveVO">
-        select active.id, active.active_name, active.active_type, active.audit_status, active.apply_time, active.apply_user_name, active.begin_time, active.end_time, active.active_url, active.valid, active.is_modify_apply, apply.audit_status as apply_audit_status
+        select active.id, active.active_name, active.active_type, active.audit_status,
+            active.apply_time, active.apply_user_name, active.begin_time, active.end_time,
+            active.active_url, active.valid, active.is_modify_apply,
+            active.url_tab,
+            apply.audit_status as apply_audit_status
         from base_active active
         left join base_active_modify_apply apply on active.id = apply.active_id and apply.is_delete = 0
         <where>

+ 45 - 0
abi-cloud-qr-platform-server/src/test/java/com/abi/qms/platform/ReactBeanTest.java

@@ -0,0 +1,45 @@
+package com.abi.qms.platform;
+
+import com.abi.qms.platform.dao.vo.result.QrRepertorySelectDetailVO;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.extern.slf4j.Slf4j;
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+
+import java.lang.reflect.Field;
+import java.time.LocalDateTime;
+import java.util.HashMap;
+import java.util.Map;
+
+@SpringBootTest
+@Slf4j
+public class ReactBeanTest {
+
+
+    @Test
+    public void testGenerateBean() {
+        Class clz = QrRepertorySelectDetailVO.class;
+
+        Map<Class,String> classMap = new HashMap<>();
+        classMap.put(String.class,"string");
+        classMap.put(LocalDateTime.class,"string");
+        classMap.put(Long.class,"string");
+        classMap.put(Integer.class,"number");
+
+        StringBuffer sb = new StringBuffer();
+
+        Field[] declaredFields = clz.getDeclaredFields();
+        for(Field field:declaredFields){
+            ApiModelProperty annotation = field.getAnnotation(ApiModelProperty.class);
+            String desc = annotation==null?"":annotation.value();
+//            System.out.println(field.getName());
+//            System.out.println(classMap.get(field.getType()));
+//            System.out.println(desc);
+
+            sb.append(String.format("// %s\n",desc));
+            sb.append(String.format("%s: %s;\n",field.getName(),classMap.get(field.getType())));
+        }
+        System.out.println(sb.toString());
+    }
+
+}