Przeglądaj źródła

Merge remote-tracking branch 'origin/feature/1.0.0' into feature/1.0.0

luyanwen 3 lat temu
rodzic
commit
9f5091c8db
18 zmienionych plików z 902 dodań i 8 usunięć
  1. 97 0
      abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/controller/console/ActiveController.java
  2. 71 0
      abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dao/entity/BaseActive.java
  3. 50 0
      abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dao/entity/BaseActiveQrPackageMapping.java
  4. 13 8
      abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dao/enums/MaterialTypeEnum.java
  5. 15 0
      abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dao/mapper/BaseActiveMapper.java
  6. 15 0
      abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dao/mapper/BaseActiveQrPackageMappingMapper.java
  7. 57 0
      abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dto/req/AddActiveReq.java
  8. 21 0
      abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dto/req/DisableActiveReq.java
  9. 21 0
      abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dto/req/EnableActiveReq.java
  10. 21 0
      abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dto/req/GetActiveReq.java
  11. 16 0
      abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dto/req/ListActiveReq.java
  12. 58 0
      abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dto/req/UpdateActiveReq.java
  13. 72 0
      abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dto/res/GetActiveRes.java
  14. 86 0
      abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dto/res/ListActiveRes.java
  15. 57 0
      abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/service/ActiveService.java
  16. 181 0
      abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/service/impl/ActiveServiceImpl.java
  17. 29 0
      abi-cloud-qr-platform-server/src/main/resources/dao/mapper/BaseActiveMapper.xml
  18. 22 0
      abi-cloud-qr-platform-server/src/main/resources/dao/mapper/BaseActiveQrPackageMappingMapper.xml

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

@@ -0,0 +1,97 @@
+package com.abi.qms.platform.controller.console;
+
+import com.abi.qms.platform.dto.req.*;
+import com.abi.qms.platform.dto.res.GetActiveRes;
+import com.abi.qms.platform.dto.res.ListActiveRes;
+import com.abi.qms.platform.service.ActiveService;
+import com.abi.task.common.api.base.BaseResponse;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * <p>
+ * 活动管理
+ * </p>
+ *
+ * @author Andy.Tan
+ */
+@Slf4j
+@RestController
+@RequestMapping("active")
+@Api(tags = "活动管理")
+public class ActiveController {
+
+    @Autowired
+    private ActiveService activeService;
+
+
+    @ApiOperation("新增活动")
+    @PostMapping("addActive")
+    public BaseResponse addActive(@Validated @RequestBody AddActiveReq addActiveReq) throws Exception{
+        //新增活动
+        activeService.addActive(addActiveReq);
+        //包装出参
+        return BaseResponse.create();
+    }
+
+    @ApiOperation("编辑活动")
+    @PostMapping("updateActive")
+    public BaseResponse updateActive(@Validated @RequestBody UpdateActiveReq updateActiveReq) throws Exception{
+        //编辑活动
+        activeService.updateActive(updateActiveReq);
+        //包装出参
+        return BaseResponse.create();
+    }
+
+    @ApiOperation("分页查询活动")
+    @GetMapping("listActive")
+    public BaseResponse<ListActiveRes> listActive(@Validated ListActiveReq listActiveReq) throws Exception{
+        //分页查询活动
+        ListActiveRes result = activeService.listActive(listActiveReq);
+        //包装出参
+        return BaseResponse.create(result);
+    }
+
+    @ApiOperation("查询活动明细")
+    @GetMapping("getActive")
+    public BaseResponse<GetActiveRes> getActive(@Validated GetActiveReq getActiveReq) throws Exception{
+        //查询活动明细
+        GetActiveRes  result = activeService.getActive(getActiveReq);
+        //包装出参
+        return BaseResponse.create(result);
+    }
+
+    @ApiOperation("活动启用")
+    @PostMapping("enableActive")
+    public BaseResponse enableActive(@Validated @RequestBody EnableActiveReq enableActiveReq) throws Exception{
+        //活动启用
+        activeService.enableActive(enableActiveReq);
+        //包装出参
+        return BaseResponse.create();
+    }
+
+    @ApiOperation("活动禁用")
+    @PostMapping("disableActive")
+    public BaseResponse disableActive(@Validated @RequestBody DisableActiveReq disableActiveReq) throws Exception{
+        //活动禁用
+        activeService.disableActive(disableActiveReq);
+        //包装出参
+        return BaseResponse.create();
+    }
+
+}
+
+
+
+
+
+
+
+

+ 71 - 0
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dao/entity/BaseActive.java

@@ -0,0 +1,71 @@
+package com.abi.qms.platform.dao.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.time.LocalDateTime;
+
+/**
+ * <p>
+ * 活动表
+ * </p>
+ *
+ * @author Andy.Tan
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Schema(name="活动表对象", description="活动表")
+public class BaseActive {
+
+	@Schema(name = "id")
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+	@Schema(name = "活动code(即页面上的手输的活动id)")
+    private String activeCode;
+
+	@Schema(name = "活动名称")
+    private String activeName;
+
+	@Schema(name = "活动类型 1-utc 2-bof 3-品质信息")
+    private Integer activeType;
+
+    @Schema(name = "活动审核状态 1-待审核 2-通过 9-驳回")
+    private Integer auditStatus;
+
+	@Schema(name = "活动开始日期")
+    private LocalDateTime beginTime;
+
+	@Schema(name = "活动结束日期")
+    private LocalDateTime endTime;
+
+	@Schema(name = "品牌code")
+    private String brandCode;
+
+	@Schema(name = "子品牌code")
+    private String subBrandCode;
+
+	@Schema(name = "活动域名")
+    private String activeUrl;
+
+	@Schema(name = "创建时间")
+    private LocalDateTime createTime;
+
+	@Schema(name = "创建人id")
+    private Long createBy;
+
+	@Schema(name = "修改时间")
+    private LocalDateTime updateTime;
+
+	@Schema(name = "修改人id")
+    private Long updateBy;
+
+	@Schema(name = "是否删除")
+    private Integer isDelete;
+
+
+
+}

+ 50 - 0
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dao/entity/BaseActiveQrPackageMapping.java

@@ -0,0 +1,50 @@
+package com.abi.qms.platform.dao.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.time.LocalDateTime;
+
+/**
+ * <p>
+ * 活动码包关联表
+ * </p>
+ *
+ * @author Andy.Tan
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Schema(name="活动码包关联表对象", description="活动码包关联表")
+public class BaseActiveQrPackageMapping {
+
+	@Schema(name = "id")
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+	@Schema(name = "活动id(base_active表的主键id)")
+    private Long activeId;
+
+	@Schema(name = "码包id")
+    private Long qrPackageId;
+
+	@Schema(name = "创建时间")
+    private LocalDateTime createTime;
+
+	@Schema(name = "创建人id")
+    private Long createBy;
+
+	@Schema(name = "修改时间")
+    private LocalDateTime updateTime;
+
+	@Schema(name = "修改人id")
+    private Long updateBy;
+
+	@Schema(name = "是否删除")
+    private Integer isDelete;
+
+
+
+}

+ 13 - 8
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dao/enums/MaterialTypeEnum.java

@@ -17,15 +17,20 @@ import java.util.Set;
 @JsonFormat(shape = JsonFormat.Shape.OBJECT)
 public enum MaterialTypeEnum {
 
-	//物料类型: 1-瓶子 2-PET 3-罐子 4-瓶盖 5-纸板箱 6-塑箱 7-小桶&叉子 8-托盘
-	BOTTLE(1,"瓶子"),
-	PET(2,"PET"),
-	JAR(3,"罐子"),
+	//全量的类型现在用不到,目前就瓶盖和纸板箱
+//	//物料类型: 1-瓶子 2-PET 3-罐子 4-瓶盖 5-纸板箱 6-塑箱 7-小桶&叉子 8-托盘
+//	BOTTLE(1,"瓶子"),
+//	PET(2,"PET"),
+//	JAR(3,"罐子"),
+//	BOTTLE_CAP(4,"瓶盖"),
+//	CARTON(5,"纸板箱"),
+//	PLASTIC_BOX(6,"塑箱"),
+//	BUCKET_FORK(7,"小桶&叉子"),
+//	TRAY(8,"托盘");
+
+	//物料类型: 4-瓶盖 5-纸板箱
 	BOTTLE_CAP(4,"瓶盖"),
-	CARTON(5,"纸板箱"),
-	PLASTIC_BOX(6,"塑箱"),
-	BUCKET_FORK(7,"小桶&叉子"),
-	TRAY(8,"托盘");
+	CARTON(5,"纸板箱");
 
 	@EnumValue
 	private Integer code;

+ 15 - 0
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dao/mapper/BaseActiveMapper.java

@@ -0,0 +1,15 @@
+package com.abi.qms.platform.dao.mapper;
+
+import com.abi.qms.platform.dao.entity.BaseActive;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 活动表 Mapper 接口
+ * </p>
+ *
+ * @author Andy.Tan
+ */
+public interface BaseActiveMapper extends BaseMapper<BaseActive> {
+
+}

+ 15 - 0
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dao/mapper/BaseActiveQrPackageMappingMapper.java

@@ -0,0 +1,15 @@
+package com.abi.qms.platform.dao.mapper;
+
+import com.abi.qms.platform.dao.entity.BaseActiveQrPackageMapping;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 活动码包关联表 Mapper 接口
+ * </p>
+ *
+ * @author Andy.Tan
+ */
+public interface BaseActiveQrPackageMappingMapper extends BaseMapper<BaseActiveQrPackageMapping> {
+
+}

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

@@ -0,0 +1,57 @@
+package com.abi.qms.platform.dto.req;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * @author:Andy.Tan
+ * @Description: 新增活动入参
+ */
+@Data
+@Schema
+public class AddActiveReq implements Serializable {
+
+    @Schema(name = "活动code(即页面上的手输的活动id)")
+    private String activeCode;
+
+    @Schema(name = "活动名称")
+    private String activeName;
+
+    @Schema(name = "活动类型 1-utc 2-bof 3-品质信息")
+    private Integer activeType;
+
+    @Schema(name = "活动审核状态 1-待审核 2-通过 9-驳回")
+    private Integer auditStatus;
+
+    @Schema(name = "申请人id")
+    private Integer applyUserId;
+
+    @Schema(name = "申请人姓名")
+    private String applyUserName;
+
+    @Schema(name = "审核人id")
+    private Integer auditUserId;
+
+    @Schema(name = "审核人姓名")
+    private String auditUserName;
+
+    @Schema(name = "活动开始日期")
+    private LocalDateTime beginTime;
+
+    @Schema(name = "活动结束日期")
+    private LocalDateTime endTime;
+
+    @Schema(name = "品牌code")
+    private String brandCode;
+
+    @Schema(name = "子品牌code")
+    private String subBrandCode;
+
+    @Schema(name = "活动域名")
+    private String activeUrl;
+
+
+}

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

@@ -0,0 +1,21 @@
+package com.abi.qms.platform.dto.req;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import javax.validation.constraints.NotNull;
+import lombok.Data;
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @author:Andy.Tan
+ * @Description: 活动入参
+ */
+@Data
+@Schema
+public class DisableActiveReq implements Serializable {
+
+    @NotNull(message = "ID为空")
+    @Schema(name = "ids")
+    private List<Long> ids;
+
+}

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

@@ -0,0 +1,21 @@
+package com.abi.qms.platform.dto.req;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import javax.validation.constraints.NotNull;
+import lombok.Data;
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @author:Andy.Tan
+ * @Description: 活动入参
+ */
+@Data
+@Schema
+public class EnableActiveReq implements Serializable {
+
+    @NotNull(message = "ID为空")
+    @Schema(name = "ids")
+    private List<Long> ids;
+
+}

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

@@ -0,0 +1,21 @@
+package com.abi.qms.platform.dto.req;
+
+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 GetActiveReq implements Serializable {
+
+    @NotNull(message = "ID为空")
+    @Schema(name = "id")
+    private Long id;
+
+}

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

@@ -0,0 +1,16 @@
+package com.abi.qms.platform.dto.req;
+
+import com.abi.task.common.api.base.PageReq;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import java.io.Serializable;
+
+/**
+ * @author:Andy.Tan
+ * @Description: 分页查询活动入参
+ */
+@Data
+@Schema
+public class ListActiveReq extends PageReq implements Serializable {
+
+}

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

@@ -0,0 +1,58 @@
+package com.abi.qms.platform.dto.req;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import java.io.Serializable;
+
+/**
+ * @author:Andy.Tan
+ * @Description: 编辑活动入参
+ */
+@Data
+@Schema
+public class UpdateActiveReq implements Serializable {
+
+    @Schema(name = "id")
+    private Long id;
+
+    @Schema(name = "活动code(即页面上的手输的活动id)")
+    private String activeCode;
+
+    @Schema(name = "活动名称")
+    private String activeName;
+
+    @Schema(name = "活动类型 1-utc 2-bof 3-品质信息")
+    private Integer activeType;
+
+    @Schema(name = "活动审核状态 1-待审核 2-通过 9-驳回")
+    private Integer auditStatus;
+
+    @Schema(name = "申请人id")
+    private Integer applyUserId;
+
+    @Schema(name = "申请人姓名")
+    private String applyUserName;
+
+    @Schema(name = "审核人id")
+    private Integer auditUserId;
+
+    @Schema(name = "审核人姓名")
+    private String auditUserName;
+
+    @Schema(name = "活动开始日期")
+    private LocalDateTime beginTime;
+
+    @Schema(name = "活动结束日期")
+    private LocalDateTime endTime;
+
+    @Schema(name = "品牌code")
+    private String brandCode;
+
+    @Schema(name = "子品牌code")
+    private String subBrandCode;
+
+    @Schema(name = "活动域名")
+    private String activeUrl;
+
+
+}

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

@@ -0,0 +1,72 @@
+package com.abi.qms.platform.dto.res;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * @author:Andy.Tan
+ * @Description: 查询活动明细出参
+ */
+@Data
+@Schema
+public class GetActiveRes implements Serializable {
+
+    @Schema(name = "id")
+    private Long id;
+
+    @Schema(name = "活动code(即页面上的手输的活动id)")
+    private String activeCode;
+
+    @Schema(name = "活动名称")
+    private String activeName;
+
+    @Schema(name = "活动类型 1-utc 2-bof 3-品质信息")
+    private Integer activeType;
+
+    @Schema(name = "活动审核状态 1-待审核 2-通过 9-驳回")
+    private Integer auditStatus;
+
+    @Schema(name = "申请人id")
+    private Integer applyUserId;
+
+    @Schema(name = "申请人姓名")
+    private String applyUserName;
+
+    @Schema(name = "审核人id")
+    private Integer auditUserId;
+
+    @Schema(name = "审核人姓名")
+    private String auditUserName;
+
+    @Schema(name = "活动开始日期")
+    private LocalDateTime beginTime;
+
+    @Schema(name = "活动结束日期")
+    private LocalDateTime endTime;
+
+    @Schema(name = "品牌code")
+    private String brandCode;
+
+    @Schema(name = "子品牌code")
+    private String subBrandCode;
+
+    @Schema(name = "活动域名")
+    private String activeUrl;
+
+    @ApiModelProperty(value = "创建时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private LocalDateTime createTime;
+
+    @ApiModelProperty(value = "修改时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private LocalDateTime updateTime;
+
+}

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

@@ -0,0 +1,86 @@
+package com.abi.qms.platform.dto.res;
+
+import com.abi.task.common.api.base.PageResp;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * @author:Andy.Tan
+ * @Description: 分页查询活动出参
+ */
+@Data
+@Schema
+public class ListActiveRes extends PageResp implements Serializable {
+
+    @Schema(name = "活动列表")
+    private List<ActiveBean> activeBeanList;
+
+    /**
+     * 活动bean
+     */
+    @Data
+    @NoArgsConstructor
+    @AllArgsConstructor
+    @ToString
+    @ApiModel(value = "ListActiveRes_Active")
+    public static class ActiveBean implements Serializable {
+
+        @Schema(name = "id")
+        private Long id;
+
+        @Schema(name = "活动code(即页面上的手输的活动id)")
+        private String activeCode;
+
+        @Schema(name = "活动名称")
+        private String activeName;
+
+        @Schema(name = "活动类型 1-utc 2-bof 3-品质信息")
+        private Integer activeType;
+
+        @Schema(name = "活动审核状态 1-待审核 2-通过 9-驳回")
+        private Integer auditStatus;
+
+        @Schema(name = "申请人id")
+        private Integer applyUserId;
+
+        @Schema(name = "申请人姓名")
+        private String applyUserName;
+
+        @Schema(name = "审核人id")
+        private Integer auditUserId;
+
+        @Schema(name = "审核人姓名")
+        private String auditUserName;
+
+        @Schema(name = "活动开始日期")
+        private LocalDateTime beginTime;
+
+        @Schema(name = "活动结束日期")
+        private LocalDateTime endTime;
+
+        @Schema(name = "品牌code")
+        private String brandCode;
+
+        @Schema(name = "子品牌code")
+        private String subBrandCode;
+
+        @Schema(name = "活动域名")
+        private String activeUrl;
+
+        @ApiModelProperty(value = "创建时间")
+        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+        private LocalDateTime createTime;
+
+        @ApiModelProperty(value = "修改时间")
+        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+        private LocalDateTime updateTime;
+
+    }
+}

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

@@ -0,0 +1,57 @@
+package com.abi.qms.platform.service;
+
+
+import com.abi.qms.platform.dto.req.*;
+import com.abi.qms.platform.dto.res.GetActiveRes;
+import com.abi.qms.platform.dto.res.ListActiveRes;
+
+/**
+ * <p>
+ * 活动管理
+ * </p>
+ *
+ * @author Andy.Tan
+ */
+public interface ActiveService{
+
+
+    /**
+     * 新增活动
+     * @param addActiveReq
+     * @throws Exception
+     */
+    void addActive(AddActiveReq addActiveReq);
+
+    /**
+     * 编辑活动
+     * @param updateActiveReq
+     */
+    void updateActive(UpdateActiveReq updateActiveReq);
+
+    /**
+     * 分页查询活动
+     * @param listActiveReq
+     * @return
+     */
+    ListActiveRes listActive(ListActiveReq listActiveReq);
+
+    /**
+     * 查询活动明细
+     * @param getActiveReq
+     * @return
+     */
+    GetActiveRes getActive(GetActiveReq getActiveReq);
+
+    /**
+     * 活动启用
+     * @param enableActiveReq
+     */
+    void enableActive(EnableActiveReq enableActiveReq);
+
+    /**
+     * 活动禁用
+     * @param disableActiveReq
+     */
+    void disableActive(DisableActiveReq disableActiveReq);
+
+}

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

@@ -0,0 +1,181 @@
+package com.abi.qms.platform.service.impl;
+
+import com.abi.qms.platform.dao.entity.BaseActive;
+import com.abi.qms.platform.dao.enums.ValidEnum;
+import com.abi.qms.platform.dao.mapper.BaseActiveMapper;
+import com.abi.qms.platform.dto.req.*;
+import com.abi.qms.platform.dto.res.GetActiveRes;
+import com.abi.qms.platform.dto.res.ListActiveRes;
+import com.abi.qms.platform.infrastructure.util.AssertUtil;
+import com.abi.qms.platform.infrastructure.util.PageUtil;
+import com.abi.qms.platform.service.ActiveService;
+import com.abi.task.common.utils.PojoConverterUtils;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.apache.commons.lang.StringUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * <p>
+ * 活动
+ * </p>
+ *
+ * @author Andy.Tan
+ */
+@Service
+public class ActiveServiceImpl implements ActiveService {
+
+    @Autowired
+    private BaseActiveMapper baseActiveMapper;
+
+
+    /**
+     * 新增活动
+     */
+    @Override
+    public void addActive(AddActiveReq req){
+        //校验入参
+        //TODO
+
+        //1-新增
+        BaseActive active = new BaseActive();
+        active.setActiveCode(req.getActiveCode());
+        active.setActiveName(req.getActiveName());
+        active.setActiveType(req.getActiveType());
+        active.setAuditStatus(req.getAuditStatus());
+        active.setApplyUserId(req.getApplyUserId());
+        active.setApplyUserName(req.getApplyUserName());
+        active.setAuditUserId(req.getAuditUserId());
+        active.setAuditUserName(req.getAuditUserName());
+        active.setBeginTime(req.getBeginTime());
+        active.setEndTime(req.getEndTime());
+        active.setBrandCode(req.getBrandCode());
+        active.setSubBrandCode(req.getSubBrandCode());
+        active.setActiveUrl(req.getActiveUrl());
+        baseActiveMapper.insert(active);
+
+    }
+
+    /**
+     * 编辑活动
+     */
+    @Override
+    public void updateActive(UpdateActiveReq req){
+
+        //1-查询活动
+        BaseActive active = baseActiveMapper.selectById(req.getId());
+        AssertUtil.isNull(active,"活动不存在");
+
+        //2-修改活动
+        active.setActiveCode(req.getActiveCode());
+        active.setActiveName(req.getActiveName());
+        active.setActiveType(req.getActiveType());
+        active.setAuditStatus(req.getAuditStatus());
+        active.setApplyUserId(req.getApplyUserId());
+        active.setApplyUserName(req.getApplyUserName());
+        active.setAuditUserId(req.getAuditUserId());
+        active.setAuditUserName(req.getAuditUserName());
+        active.setBeginTime(req.getBeginTime());
+        active.setEndTime(req.getEndTime());
+        active.setBrandCode(req.getBrandCode());
+        active.setSubBrandCode(req.getSubBrandCode());
+        active.setActiveUrl(req.getActiveUrl());
+        baseActiveMapper.updateById(active);
+
+    }
+
+    /**
+     * 分页查询活动
+     */
+    @Override
+    public ListActiveRes listActive(ListActiveReq req){
+
+        //1-拼接条件
+        QueryWrapper<BaseActive> activeQw = new QueryWrapper<>();
+        //activeQw.like(StringUtils.isNotBlank(req.getXxx()), "xxx_xxx", "%" + req.getXxx() + "%");
+        //activeQw.eq(req.getXxx2() != null, "xxx_xxx2", req.getXxx2());
+
+        //2-分页查询
+        IPage<BaseActive> iPage = baseActiveMapper.selectPage(PageUtil.createPage(req), activeQw);
+        List<BaseActive> activeList = iPage.getRecords();
+
+        //封装出参
+        ListActiveRes res = new ListActiveRes();
+        //放入分页信息
+        PageUtil.copyPageInfo(res, iPage);
+        //放入出参列表
+        List<ListActiveRes.ActiveBean> activeBeanList = PojoConverterUtils.copyList(activeList, ListActiveRes.ActiveBean.class);
+        res.setActiveBeanList(activeBeanList);
+
+        return res;
+
+    }
+
+    /**
+     * 查询活动明细
+     */
+    @Override
+    public GetActiveRes getActive(GetActiveReq req){
+
+        //1-查询活动对象
+        BaseActive active = baseActiveMapper.selectById(req.getId());
+        AssertUtil.isNull(active, "活动不存在");
+
+        //转化出参
+        GetActiveRes res = PojoConverterUtils.copy(active, GetActiveRes.class);
+
+        return res;
+
+    }
+
+    /**
+     * 活动启用
+     */
+    @Override
+    public void enableActive(EnableActiveReq req){
+        List<Long> ids = req.getIds();
+
+        //循环启用
+        for (Long id : ids) {
+            //1-查询活动对象
+            BaseActive active = baseActiveMapper.selectById(id);
+            AssertUtil.isNull(active, "活动不存在");
+
+            if (!ValidEnum.NOT_VALID.is(active.getValid())) {
+                continue;
+            }
+
+            //2-修改状态
+            active.setValid(ValidEnum.VALID.getCode());
+            baseActiveMapper.updateById(active);
+        }
+    }
+
+    /**
+     * 活动禁用
+     */
+    @Override
+    public void disableActive(DisableActiveReq req){
+        List<Long> ids = req.getIds();
+
+        //循环禁用
+        for (Long id : ids) {
+            //1-查询活动对象
+            BaseActive active = baseActiveMapper.selectById(id);
+            AssertUtil.isNull(active, "活动不存在");
+
+            if (!ValidEnum.VALID.is(active.getValid())) {
+                return;
+            }
+
+            //2-修改状态
+            active.setValid(ValidEnum.NOT_VALID.getCode());
+            baseActiveMapper.updateById(active);
+        }
+    }
+
+}

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

@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.abi.qms.platform.dao.mapper.BaseActiveMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.abi.qms.platform.dao.entity.BaseActive">
+        <id column="id" property="id" />
+        <result column="active_code" property="activeCode" />
+        <result column="active_name" property="activeName" />
+        <result column="active_type" property="activeType" />
+        <result column="audit_status" property="auditStatus" />
+        <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="active_url" property="activeUrl" />
+        <result column="create_time" property="createTime" />
+        <result column="create_by" property="createBy" />
+        <result column="update_time" property="updateTime" />
+        <result column="update_by" property="updateBy" />
+        <result column="is_delete" property="isDelete" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id, active_code, active_name, active_type, audit_status, begin_time, end_time, brand_code, sub_brand_code, active_url, create_time, create_by, update_time, update_by, is_delete
+    </sql>
+
+</mapper>

+ 22 - 0
abi-cloud-qr-platform-server/src/main/resources/dao/mapper/BaseActiveQrPackageMappingMapper.xml

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.abi.qms.platform.dao.mapper.BaseActiveQrPackageMappingMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.abi.qms.platform.dao.entity.BaseActiveQrPackageMapping">
+        <id column="ID" property="id" />
+        <result column="ACTIVE_ID" property="activeId" />
+        <result column="QR_PACKAGE_ID" property="qrPackageId" />
+        <result column="CREATE_TIME" property="createTime" />
+        <result column="CREATE_BY" property="createBy" />
+        <result column="UPDATE_TIME" property="updateTime" />
+        <result column="UPDATE_BY" property="updateBy" />
+        <result column="IS_DELETE" property="isDelete" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id, active_id, qr_package_id, create_time, create_by, update_time, update_by, is_delete
+    </sql>
+
+</mapper>