Sfoglia il codice sorgente

4/1 实体类修改

lwhhszx 1 anno fa
parent
commit
d30f478c44

+ 14 - 11
src/main/java/com/example/xiaoshiweixinback/controller/TicketController.java

@@ -5,6 +5,8 @@ import com.example.xiaoshiweixinback.business.common.Constants;
 import com.example.xiaoshiweixinback.business.common.Response;
 import com.example.xiaoshiweixinback.business.common.base.Records;
 import com.example.xiaoshiweixinback.entity.dto.ProductDTO;
+import com.example.xiaoshiweixinback.entity.dto.ticket.TicketAddDTO;
+import com.example.xiaoshiweixinback.service.TicketService;
 import io.swagger.v3.oas.annotations.Operation;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
@@ -18,16 +20,17 @@ import org.springframework.web.bind.annotation.RestController;
 @RestController
 @RequiredArgsConstructor
 public class TicketController {
-//    @Operation(summary = "添加工单")
-//    @PostMapping("/addTicket")
-//    public Response queryHotProduct(@RequestBody ProductDTO productDTO){
-//        Records records =productService.queryHotProduct(productDTO);
-//        return Response.success(records);
-//    }
-//
-//
-//    public Response queryHotProduct(@RequestBody ProductDTO productDTO){
+    private final TicketService ticketService;
+    @Operation(summary = "添加工单")
+    @PostMapping("/addTicket")
+    public Response addTicket(@RequestBody TicketAddDTO ticketAddDTO){
+//        Records records =ticketService.add(productDTO);
+        return Response.success("records");
+    }
+
+
+    public Response queryHotProduct(@RequestBody ProductDTO productDTO){
 //        Records records =productService.queryHotProduct(productDTO);
-//        return Response.success(records);
-//    }
+        return Response.success("records");
+    }
 }

+ 4 - 3
src/main/java/com/example/xiaoshiweixinback/controller/VIPController.java

@@ -2,6 +2,7 @@ package com.example.xiaoshiweixinback.controller;
 
 import com.example.xiaoshiweixinback.business.common.Constants;
 import com.example.xiaoshiweixinback.business.common.Response;
+import com.example.xiaoshiweixinback.business.common.base.Records;
 import com.example.xiaoshiweixinback.entity.dto.ProductCategoryDTO;
 import com.example.xiaoshiweixinback.service.VipService;
 import io.swagger.v3.oas.annotations.Operation;
@@ -20,9 +21,9 @@ public class VIPController {
     private  final VipService vipService;
     @Operation(summary = "查询会员")
     @PostMapping("/vip")
-    private Response queryProductCategory(@RequestBody ProductCategoryDTO productCategoryDTO) {
-//        Records records = productCategoryService.queryProductCategory(productCategoryDTO);
-        return Response.success("");
+    private Response queryProductCategory() {
+        Records records =vipService.getAllVip();
+        return Response.success(records);
     }
 
 }

+ 1 - 0
src/main/java/com/example/xiaoshiweixinback/entity/dto/ProductCategoryDTO.java

@@ -7,4 +7,5 @@ public class ProductCategoryDTO {
     private String name;
     private Long current;
     private Long size;
+    private Integer parentId;
 }

+ 3 - 1
src/main/java/com/example/xiaoshiweixinback/entity/dto/ticket/TicketAddDTO.java

@@ -30,7 +30,9 @@ public class TicketAddDTO {
     /**
      *
      */
-    private Integer ticketProgress;
+    private Double ticketProgress;
+
+    private String num;
 
     /**
      *

+ 0 - 20
src/main/java/com/example/xiaoshiweixinback/mapper/FunctionMapper.java

@@ -1,20 +0,0 @@
-package com.example.xiaoshiweixinback.mapper;
-
-import com.example.xiaoshiweixinback.domain.Function;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import org.springframework.stereotype.Repository;
-
-/**
-* @author admin
-* @description 针对表【function(功能)】的数据库操作Mapper
-* @createDate 2024-03-29 15:37:27
-* @Entity xiaoshiweixinback.domain.Function
-*/
-@Repository
-public interface FunctionMapper extends BaseMapper<Function> {
-
-}
-
-
-
-

+ 0 - 1
src/main/java/com/example/xiaoshiweixinback/okhttp/RequestManager.java

@@ -5,7 +5,6 @@ import com.example.xiaoshiweixinback.business.exception.BusinessException;
 import com.example.xiaoshiweixinback.business.exception.ExceptionEnum;
 import com.example.xiaoshiweixinback.business.utils.JSONUtil;
 import okhttp3.*;
-import sun.net.httpserver.AuthFilter;
 
 import java.util.HashMap;
 import java.util.Map;

+ 0 - 20
src/main/java/com/example/xiaoshiweixinback/service/FunctionService.java

@@ -1,20 +0,0 @@
-package com.example.xiaoshiweixinback.service;
-
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.example.xiaoshiweixinback.domain.Function;
-import com.example.xiaoshiweixinback.mapper.FunctionMapper;
-import org.springframework.stereotype.Service;
-
-/**
-* @author admin
-* @description 针对表【function(功能)】的数据库操作Service实现
-* @createDate 2024-03-29 15:37:27
-*/
-@Service
-public class FunctionService extends ServiceImpl<FunctionMapper, Function> {
-
-}
-
-
-
-

+ 22 - 13
src/main/java/com/example/xiaoshiweixinback/service/ProductCategoryService.java

@@ -9,10 +9,7 @@ import com.example.xiaoshiweixinback.business.common.base.Records;
 import com.example.xiaoshiweixinback.business.common.base.SystemFile;
 import com.example.xiaoshiweixinback.business.utils.CacheUtil;
 import com.example.xiaoshiweixinback.business.utils.LoginUtils;
-import com.example.xiaoshiweixinback.domain.AssoCategoryFile;
-import com.example.xiaoshiweixinback.domain.AssoProductFile;
-import com.example.xiaoshiweixinback.domain.Person;
-import com.example.xiaoshiweixinback.domain.ProductCategory;
+import com.example.xiaoshiweixinback.domain.*;
 import com.example.xiaoshiweixinback.entity.dto.ProductCategoryDTO;
 import com.example.xiaoshiweixinback.entity.vo.PersonnelVO;
 import com.example.xiaoshiweixinback.entity.vo.ProductCategoryVO;
@@ -21,6 +18,7 @@ import com.example.xiaoshiweixinback.mapper.ProductCategoryMapper;
 import com.example.xiaoshiweixinback.service.common.FileManagerService;
 import io.swagger.v3.oas.models.security.SecurityScheme;
 import lombok.RequiredArgsConstructor;
+import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 
 import java.util.ArrayList;
@@ -50,15 +48,21 @@ public class ProductCategoryService extends ServiceImpl<ProductCategoryMapper, P
         Records records = new Records();
         Long size = productCategoryDTO.getSize();
         Long current = productCategoryDTO.getCurrent();
+        String name = productCategoryDTO.getName();
+        Integer parentId = productCategoryDTO.getParentId();
         records.setCurrent(current);
         records.setSize(size);
-        String name = productCategoryDTO.getName();
+
 
         LambdaQueryWrapper<ProductCategory> queryWrapper = new LambdaQueryWrapper<>();
         if (name != null && !name.trim().equals("")) {
             queryWrapper.like(ProductCategory::getName, name);
         }
-
+        if (parentId == null) {
+            queryWrapper.isNull(ProductCategory::getParentId);
+        } else {
+            queryWrapper.eq(ProductCategory::getParentId, parentId);
+        }
         List<ProductCategory> productCategoryList = new ArrayList<>();
         if (size != null && current != null) {
             IPage<ProductCategory> productCategoryIPage = this.page(new Page<>(current, size), queryWrapper);
@@ -68,19 +72,20 @@ public class ProductCategoryService extends ServiceImpl<ProductCategoryMapper, P
             productCategoryList = this.list(queryWrapper);
 
         }
-
-        records.setData(productCategoryList);
+        List<ProductCategoryVO> productCategoryVOS = this.loadProductCategory(productCategoryList);
+        records.setData(productCategoryVOS);
         return records;
     }
 
-    private void loadProductCategory(List<ProductCategoryVO> productCategoryVOS) {
+    private List<ProductCategoryVO> loadProductCategory(List<ProductCategory> productCategorys) {
+        List<ProductCategoryVO> productCategoryVOS = new ArrayList<>();
         List<AssoCategoryFile> assoCategoryFiles = new ArrayList<>();
         List<String> createIds = new ArrayList<>();
         List<String> guids = new ArrayList<>();
-        if (productCategoryVOS == null || productCategoryVOS.size() == 0) {
-            return;
+        if (productCategorys == null || productCategorys.size() == 0) {
+            return productCategoryVOS;
         }
-        List<Integer> ids = productCategoryVOS.stream().map(ProductCategoryVO::getId).collect(Collectors.toList());
+        List<Integer> ids = productCategorys.stream().map(ProductCategory::getId).collect(Collectors.toList());
         List<SystemFile> systemFiles = new ArrayList<>();
         List<Person> personList = new ArrayList<>();
         if (ids.size() != 0) {
@@ -112,7 +117,9 @@ public class ProductCategoryService extends ServiceImpl<ProductCategoryMapper, P
         }
 
         //装载登录人信息,装载
-        for (ProductCategoryVO productCategoryVO : productCategoryVOS) {
+        for (ProductCategory productCategory : productCategorys) {
+            ProductCategoryVO productCategoryVO = new ProductCategoryVO();
+            BeanUtils.copyProperties(productCategory, productCategoryVO);
             Person personnel = personList.stream().filter(item -> item.getUuid().toString().equals(productCategoryVO.getCreateId())).findFirst().orElse(null);
             if (personnel != null) {
                 productCategoryVO.setCreateName(personnel.getName());
@@ -128,7 +135,9 @@ public class ProductCategoryService extends ServiceImpl<ProductCategoryMapper, P
                     }
                 }
             }
+            productCategoryVOS.add(productCategoryVO);
         }
+        return productCategoryVOS;
     }
 
 }

+ 26 - 4
src/main/java/com/example/xiaoshiweixinback/service/TicketService.java

@@ -1,18 +1,40 @@
 package com.example.xiaoshiweixinback.service;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.example.xiaoshiweixinback.business.utils.CacheUtil;
+import com.example.xiaoshiweixinback.business.utils.LoginUtils;
+import com.example.xiaoshiweixinback.domain.Person;
 import com.example.xiaoshiweixinback.domain.Ticket;
+import com.example.xiaoshiweixinback.entity.dto.ticket.TicketAddDTO;
+import com.example.xiaoshiweixinback.entity.vo.PersonnelVO;
 import com.example.xiaoshiweixinback.mapper.TicketMapper;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 /**
-* @author admin
-* @description 针对表【ticket(工单)】的数据库操作Service实现
-* @createDate 2024-03-29 16:27:51
-*/
+ * @author admin
+ * @description 针对表【ticket(工单)】的数据库操作Service实现
+ * @createDate 2024-03-29 16:27:51
+ */
 @Service
+@RequiredArgsConstructor
 public class TicketService extends ServiceImpl<TicketMapper, Ticket> {
+    private final CacheUtil cacheUtil;
+    private final LoginUtils loginUtils;
 
+    @Transactional(rollbackFor = Exception.class)
+    public Integer addorUpdateTicket(TicketAddDTO ticketAddDTO) {
+        Ticket ticket = new Ticket();
+        BeanUtils.copyProperties(ticketAddDTO, ticket);
+        if (ticket.getId() == null) {
+            PersonnelVO personnelVO =cacheUtil.getLoginUser(loginUtils.getId());
+            ticket.setCreateId(personnelVO.getUuid());
+
+        }
+        return 1;
+    }
 }
 
 

+ 16 - 5
src/main/java/com/example/xiaoshiweixinback/service/VipService.java

@@ -1,18 +1,29 @@
 package com.example.xiaoshiweixinback.service;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.example.xiaoshiweixinback.business.common.base.Records;
 import com.example.xiaoshiweixinback.domain.Vip;
 import com.example.xiaoshiweixinback.mapper.VipMapper;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
-* @author admin
-* @description 针对表【vip(会员表)】的数据库操作Service实现
-* @createDate 2024-03-29 16:29:03
-*/
+ * @author admin
+ * @description 针对表【vip(会员表)】的数据库操作Service实现
+ * @createDate 2024-03-29 16:29:03
+ */
 @Service
 public class VipService extends ServiceImpl<VipMapper, Vip> {
-
+    public Records  getAllVip() {
+        Records records = new Records();
+        LambdaQueryWrapper<Vip> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.ne(Vip::getVipType, 0);
+        List<Vip> vipList = this.list(queryWrapper);
+        records.setData(vipList);
+       return records;
+    }
 }
 
 

+ 3 - 3
src/main/resources/application.yml

@@ -28,12 +28,12 @@ spring:
     date-format: yyyy-MM-dd HH:mm:ss
     time-zone: Asia/Shanghai
 logging:
-  config: classpath:config/logback-spring.xml
+#  config: classpath:config/logback-spring.xml
   level:
-    cn.cslg.pas.mapper: debug
+    cn.example.xiaoshiweixinback.mapper: debug
 #mybatis
 mybatis-plus:
-  typeAliasesPackage: cn.cslg.pas.domain
+  typeAliasesPackage: cn.example.xiaoshiweixinback.domain
   global-config:
     db-config:
       id-type: AUTO