Commit 29ca27c26124fa16e06e7c2865fda2c2aaeef08e

Authored by Ran
1 parent bf6639aa

微调代码

... ... @@ -45,9 +45,17 @@
45 45 <aliyun-sdk-oss.version>3.15.0</aliyun-sdk-oss.version>
46 46 <thumbnailator.version>0.4.8</thumbnailator.version>
47 47 <jjwt.version>0.10.6</jjwt.version>
  48 + <easyexcel.version>2.2.3</easyexcel.version>
48 49 </properties>
49 50  
50 51 <dependencies>
  52 +
  53 + <dependency>
  54 + <groupId>com.alibaba</groupId>
  55 + <artifactId>easyexcel</artifactId>
  56 + <version>${easyexcel.version}</version>
  57 + </dependency>
  58 +
51 59 <dependency>
52 60 <groupId>org.springframework.boot</groupId>
53 61 <artifactId>spring-boot-starter-web</artifactId>
... ...
src/main/java/com/order/erp/AdminApplication.java
... ... @@ -12,6 +12,7 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
12 12 import org.springframework.context.annotation.Bean;
13 13 import org.springframework.scheduling.annotation.EnableAsync;
14 14 import org.springframework.scheduling.annotation.EnableScheduling;
  15 +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
15 16 import org.springframework.transaction.annotation.EnableTransactionManagement;
16 17 import springfox.documentation.swagger2.annotations.EnableSwagger2;
17 18  
... ...
src/main/java/com/order/erp/controller/DictionaryController.java
1 1 package com.order.erp.controller;
2 2  
  3 +import com.alibaba.excel.EasyExcel;
3 4 import com.order.erp.common.annotation.AnonymousAccess;
4 5 import com.order.erp.common.constant.ServerResult;
  6 +import com.order.erp.domain.dto.model.InnerNoModel;
  7 +import com.order.erp.domain.dto.model.ProjectNoModel;
5 8 import com.order.erp.domain.vo.admin.DictionaryQueryVO;
6 9 import com.order.erp.domain.vo.admin.DictionaryVO;
7 10 import com.order.erp.log.Log;
8 11 import com.order.erp.service.admin.DictionaryService;
9 12 import io.swagger.annotations.Api;
10 13 import io.swagger.annotations.ApiOperation;
  14 +import org.apache.commons.codec.EncoderException;
  15 +import org.apache.commons.codec.net.URLCodec;
11 16 import org.springframework.security.access.prepost.PreAuthorize;
12 17 import org.springframework.validation.annotation.Validated;
13 18 import org.springframework.web.bind.annotation.PostMapping;
... ... @@ -16,6 +21,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
16 21 import org.springframework.web.bind.annotation.RestController;
17 22  
18 23 import javax.annotation.Resource;
  24 +import javax.servlet.http.HttpServletResponse;
  25 +import java.io.IOException;
  26 +import java.util.ArrayList;
19 27  
20 28 /**
21 29 * @author xms
... ... @@ -68,4 +76,34 @@ public class DictionaryController {
68 76 public ServerResult delete(@RequestBody @Validated DictionaryQueryVO queryVO) {
69 77 return dictionaryService.deleteById(queryVO);
70 78 }
  79 +
  80 + /**
  81 + * @param response
  82 + * @return ServerResult
  83 + * @Description: 导出项目编号模板
  84 + * @Author wmr
  85 + * @CreateTime 2023/12/20 11:53
  86 + */
  87 + @ApiOperation("导出项目编号模板")
  88 + @PostMapping("/exportProjectNoModel")
  89 + public ServerResult exportProjectNoModel(HttpServletResponse response) throws IOException, EncoderException {
  90 + response.setHeader("Content-Disposition", "attachment;fileName=" + new URLCodec("UTF-8").encode("项目号导入模板.xlsx"));
  91 + EasyExcel.write(response.getOutputStream(), ProjectNoModel.class).sheet("项目号导入表").doWrite(new ArrayList<>());
  92 + return ServerResult.success();
  93 + }
  94 +
  95 + /**
  96 + * @Description: 导出内部编号模板
  97 + * @param response
  98 + * @return ServerResult
  99 + * @Author wmr
  100 + * @CreateTime 2023/12/20 11:59
  101 + */
  102 + @ApiOperation("导出内部编号模板")
  103 + @PostMapping("/exportInnerNoModel")
  104 + public ServerResult exportInnerNoModel(HttpServletResponse response) throws IOException, EncoderException {
  105 + response.setHeader("Content-Disposition", "attachment;fileName=" + new URLCodec("UTF-8").encode("内部编号导入模板.xlsx"));
  106 + EasyExcel.write(response.getOutputStream(), InnerNoModel.class).sheet("内部编号导入表").doWrite(new ArrayList<>());
  107 + return ServerResult.success();
  108 + }
71 109 }
72 110 \ No newline at end of file
... ...
src/main/java/com/order/erp/controller/OrderController.java
... ... @@ -123,6 +123,5 @@ public class OrderController {
123 123 public ServerResult deleteById(@RequestBody OrderBaseInfoQueryVO orderBaseInfoQueryVO) {
124 124 return orderBaseInfoService.deleteById(orderBaseInfoQueryVO);
125 125 }
126   -
127 126 }
128 127  
... ...
src/main/java/com/order/erp/domain/dto/model/InnerNoModel.java 0 → 100644
  1 +package com.order.erp.domain.dto.model;
  2 +
  3 +import com.alibaba.excel.annotation.ExcelProperty;
  4 +import com.alibaba.excel.annotation.write.style.ColumnWidth;
  5 +import lombok.AllArgsConstructor;
  6 +import lombok.Data;
  7 +import lombok.NoArgsConstructor;
  8 +
  9 +/**
  10 + * Date:2023/12/20
  11 + * Author:wmr
  12 + * Description:内部编号模板类
  13 + */
  14 +@Data
  15 +@AllArgsConstructor
  16 +@NoArgsConstructor
  17 +public class InnerNoModel {
  18 + @ColumnWidth(20)
  19 + @ExcelProperty(value = "内部编号",index = 0)
  20 + private String innerNo;
  21 +}
... ...
src/main/java/com/order/erp/domain/dto/model/ProjectNoModel.java 0 → 100644
  1 +package com.order.erp.domain.dto.model;
  2 +
  3 +import com.alibaba.excel.annotation.ExcelProperty;
  4 +import com.alibaba.excel.annotation.write.style.ColumnWidth;
  5 +import lombok.AllArgsConstructor;
  6 +import lombok.Data;
  7 +import lombok.NoArgsConstructor;
  8 +
  9 +import java.io.Serializable;
  10 +
  11 +/**
  12 + * Date:2023/12/20
  13 + * Author:wmr
  14 + * Description:项目号模板
  15 + */
  16 +@Data
  17 +@NoArgsConstructor
  18 +@AllArgsConstructor
  19 +public class ProjectNoModel implements Serializable {
  20 + @ColumnWidth(20)
  21 + @ExcelProperty(value = "项目号",index = 0)
  22 + private String projectNo;
  23 +}
... ...
src/main/java/com/order/erp/domain/vo/order/OrderBaseInfoQueryVO.java
... ... @@ -63,7 +63,12 @@ public class OrderBaseInfoQueryVO extends BasePageVO implements Serializable {
63 63 /**
64 64 * 项目号
65 65 */
66   - private String projectNo;
  66 + private List<String> projectNo;
  67 +
  68 + /**
  69 + * 内部编号
  70 + */
  71 + private List<String> innerNo;
67 72  
68 73 /**
69 74 * 生产科
... ...
src/main/java/com/order/erp/service/order/impl/OrderBaseInfoServiceImpl.java
... ... @@ -1201,7 +1201,8 @@ public class OrderBaseInfoServiceImpl extends ServiceImpl&lt;OrderBaseInfoMapper, O
1201 1201 .le(StringUtils.isNotBlank(queryVO.getCreateEndTime()), OrderBaseInfoDO::getCreateTime, queryVO.getCreateEndTime())
1202 1202 .eq(StringUtils.isNotBlank(queryVO.getOrderStatus()), OrderBaseInfoDO::getOrderStatus, queryVO.getOrderStatus())
1203 1203 .eq(StringUtils.isNotBlank(queryVO.getCustomerCode()), OrderBaseInfoDO::getCustomerCode, queryVO.getCustomerCode())
1204   - .eq(StringUtils.isNotBlank(queryVO.getProjectNo()), OrderBaseInfoDO::getProjectNo, queryVO.getProjectNo())
  1204 + .in(CollectionUtils.isNotEmpty(queryVO.getProjectNo()), OrderBaseInfoDO::getProjectNo, queryVO.getProjectNo())
  1205 + .in(CollectionUtils.isNotEmpty(queryVO.getInnerNo()),OrderBaseInfoDO::getInnerNo,queryVO.getInnerNo())
1205 1206 .eq(StringUtils.isNotBlank(queryVO.getProductionDepartment()), OrderBaseInfoDO::getProductionDepartment, queryVO.getProductionDepartment())
1206 1207 .eq(StringUtils.isNotBlank(queryVO.getCreateBy()), OrderBaseInfoDO::getCreateBy, queryVO.getCreateBy())
1207 1208 .eq(StringUtils.isNotBlank(queryVO.getBusinessPerson()), OrderBaseInfoDO::getBusinessPerson, queryVO.getBusinessPerson())
... ...