Commit 8e76f9cd9a7157fc0d14c3792876937aa62f889e
Merge branch 'znh'
Showing
11 changed files
with
172 additions
and
6 deletions
pom.xml
@@ -45,9 +45,17 @@ | @@ -45,9 +45,17 @@ | ||
45 | <aliyun-sdk-oss.version>3.15.0</aliyun-sdk-oss.version> | 45 | <aliyun-sdk-oss.version>3.15.0</aliyun-sdk-oss.version> |
46 | <thumbnailator.version>0.4.8</thumbnailator.version> | 46 | <thumbnailator.version>0.4.8</thumbnailator.version> |
47 | <jjwt.version>0.10.6</jjwt.version> | 47 | <jjwt.version>0.10.6</jjwt.version> |
48 | + <easyexcel.version>2.2.3</easyexcel.version> | ||
48 | </properties> | 49 | </properties> |
49 | 50 | ||
50 | <dependencies> | 51 | <dependencies> |
52 | + | ||
53 | + <dependency> | ||
54 | + <groupId>com.alibaba</groupId> | ||
55 | + <artifactId>easyexcel</artifactId> | ||
56 | + <version>${easyexcel.version}</version> | ||
57 | + </dependency> | ||
58 | + | ||
51 | <dependency> | 59 | <dependency> |
52 | <groupId>org.springframework.boot</groupId> | 60 | <groupId>org.springframework.boot</groupId> |
53 | <artifactId>spring-boot-starter-web</artifactId> | 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,6 +12,7 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; | ||
12 | import org.springframework.context.annotation.Bean; | 12 | import org.springframework.context.annotation.Bean; |
13 | import org.springframework.scheduling.annotation.EnableAsync; | 13 | import org.springframework.scheduling.annotation.EnableAsync; |
14 | import org.springframework.scheduling.annotation.EnableScheduling; | 14 | import org.springframework.scheduling.annotation.EnableScheduling; |
15 | +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; | ||
15 | import org.springframework.transaction.annotation.EnableTransactionManagement; | 16 | import org.springframework.transaction.annotation.EnableTransactionManagement; |
16 | import springfox.documentation.swagger2.annotations.EnableSwagger2; | 17 | import springfox.documentation.swagger2.annotations.EnableSwagger2; |
17 | 18 |
src/main/java/com/order/erp/controller/DictionaryController.java
1 | package com.order.erp.controller; | 1 | package com.order.erp.controller; |
2 | 2 | ||
3 | +import com.alibaba.excel.EasyExcel; | ||
3 | import com.order.erp.common.annotation.AnonymousAccess; | 4 | import com.order.erp.common.annotation.AnonymousAccess; |
4 | import com.order.erp.common.constant.ServerResult; | 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 | import com.order.erp.domain.vo.admin.DictionaryQueryVO; | 8 | import com.order.erp.domain.vo.admin.DictionaryQueryVO; |
6 | import com.order.erp.domain.vo.admin.DictionaryVO; | 9 | import com.order.erp.domain.vo.admin.DictionaryVO; |
7 | import com.order.erp.log.Log; | 10 | import com.order.erp.log.Log; |
8 | import com.order.erp.service.admin.DictionaryService; | 11 | import com.order.erp.service.admin.DictionaryService; |
9 | import io.swagger.annotations.Api; | 12 | import io.swagger.annotations.Api; |
10 | import io.swagger.annotations.ApiOperation; | 13 | import io.swagger.annotations.ApiOperation; |
14 | +import org.apache.commons.codec.EncoderException; | ||
15 | +import org.apache.commons.codec.net.URLCodec; | ||
11 | import org.springframework.security.access.prepost.PreAuthorize; | 16 | import org.springframework.security.access.prepost.PreAuthorize; |
12 | import org.springframework.validation.annotation.Validated; | 17 | import org.springframework.validation.annotation.Validated; |
13 | import org.springframework.web.bind.annotation.PostMapping; | 18 | import org.springframework.web.bind.annotation.PostMapping; |
@@ -16,6 +21,9 @@ import org.springframework.web.bind.annotation.RequestMapping; | @@ -16,6 +21,9 @@ import org.springframework.web.bind.annotation.RequestMapping; | ||
16 | import org.springframework.web.bind.annotation.RestController; | 21 | import org.springframework.web.bind.annotation.RestController; |
17 | 22 | ||
18 | import javax.annotation.Resource; | 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 | * @author xms | 29 | * @author xms |
@@ -68,4 +76,34 @@ public class DictionaryController { | @@ -68,4 +76,34 @@ public class DictionaryController { | ||
68 | public ServerResult delete(@RequestBody @Validated DictionaryQueryVO queryVO) { | 76 | public ServerResult delete(@RequestBody @Validated DictionaryQueryVO queryVO) { |
69 | return dictionaryService.deleteById(queryVO); | 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 | \ No newline at end of file | 110 | \ No newline at end of file |
src/main/java/com/order/erp/controller/OrderController.java
@@ -3,13 +3,13 @@ package com.order.erp.controller; | @@ -3,13 +3,13 @@ package com.order.erp.controller; | ||
3 | import com.order.erp.common.annotation.AnonymousAccess; | 3 | import com.order.erp.common.annotation.AnonymousAccess; |
4 | import com.order.erp.common.constant.ServerResult; | 4 | import com.order.erp.common.constant.ServerResult; |
5 | import com.order.erp.common.excel4j.exceptions.Excel4JException; | 5 | import com.order.erp.common.excel4j.exceptions.Excel4JException; |
6 | -import com.order.erp.domain.vo.order.OrderAddVO; | ||
7 | -import com.order.erp.domain.vo.order.OrderBaseInfoQueryVO; | ||
8 | -import com.order.erp.domain.vo.order.OrderUnlockFieldApplyVO; | ||
9 | -import com.order.erp.domain.vo.order.OrderUpdateVO; | 6 | +import com.order.erp.common.exception.BusinessException; |
7 | +import com.order.erp.domain.vo.order.*; | ||
8 | +import com.order.erp.mapper.order.OrderBaseInfoMapper; | ||
10 | import com.order.erp.service.order.OrderBaseInfoService; | 9 | import com.order.erp.service.order.OrderBaseInfoService; |
11 | import io.swagger.annotations.Api; | 10 | import io.swagger.annotations.Api; |
12 | import io.swagger.annotations.ApiOperation; | 11 | import io.swagger.annotations.ApiOperation; |
12 | +import org.springframework.beans.factory.annotation.Autowired; | ||
13 | import org.springframework.validation.annotation.Validated; | 13 | import org.springframework.validation.annotation.Validated; |
14 | import org.springframework.web.bind.annotation.PostMapping; | 14 | import org.springframework.web.bind.annotation.PostMapping; |
15 | import org.springframework.web.bind.annotation.RequestBody; | 15 | import org.springframework.web.bind.annotation.RequestBody; |
@@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.RestController; | @@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.RestController; | ||
19 | import javax.annotation.Resource; | 19 | import javax.annotation.Resource; |
20 | import javax.servlet.http.HttpServletResponse; | 20 | import javax.servlet.http.HttpServletResponse; |
21 | import java.io.IOException; | 21 | import java.io.IOException; |
22 | +import java.util.Objects; | ||
22 | 23 | ||
23 | /** | 24 | /** |
24 | * 订单基础信息表(OrderBaseInfo)表控制层 | 25 | * 订单基础信息表(OrderBaseInfo)表控制层 |
@@ -36,6 +37,9 @@ public class OrderController { | @@ -36,6 +37,9 @@ public class OrderController { | ||
36 | @Resource | 37 | @Resource |
37 | private OrderBaseInfoService orderBaseInfoService; | 38 | private OrderBaseInfoService orderBaseInfoService; |
38 | 39 | ||
40 | + @Resource | ||
41 | + private OrderBaseInfoMapper orderBaseInfoMapper; | ||
42 | + | ||
39 | /** | 43 | /** |
40 | * 分页查询 | 44 | * 分页查询 |
41 | * | 45 | * |
@@ -124,5 +128,20 @@ public class OrderController { | @@ -124,5 +128,20 @@ public class OrderController { | ||
124 | return orderBaseInfoService.deleteById(orderBaseInfoQueryVO); | 128 | return orderBaseInfoService.deleteById(orderBaseInfoQueryVO); |
125 | } | 129 | } |
126 | 130 | ||
131 | + /** | ||
132 | + * @param dto | ||
133 | + * @return ServerResult | ||
134 | + * @Description: 查询项目号或者内部编号 | ||
135 | + * @Author wmr | ||
136 | + * @CreateTime 2023/12/21 14:50 | ||
137 | + */ | ||
138 | + @ApiOperation("查询项目号或者内部编号") | ||
139 | + @PostMapping("/queryProjectNoAndInnerNo") | ||
140 | + public ServerResult queryProjectNoAndInnerNo(@RequestBody QueryProjectNoAndInnerNoDto dto) { | ||
141 | + if (Objects.isNull(dto.getProjectNo()) && Objects.isNull(dto.getInnerNo())) { | ||
142 | + throw new BusinessException("请传入项目号或内部编号"); | ||
143 | + } | ||
144 | + return ServerResult.success(orderBaseInfoMapper.queryProjectNoAndInnerNoDto(dto.getInnerNo() == null ? Boolean.TRUE : Boolean.FALSE, dto)); | ||
145 | + } | ||
127 | } | 146 | } |
128 | 147 |
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,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/domain/vo/order/QueryProjectNoAndInnerNoDto.java
0 → 100644
1 | +package com.order.erp.domain.vo.order; | ||
2 | + | ||
3 | +import io.swagger.annotations.ApiModelProperty; | ||
4 | +import io.swagger.annotations.ApiOperation; | ||
5 | +import lombok.AllArgsConstructor; | ||
6 | +import lombok.Data; | ||
7 | +import lombok.NoArgsConstructor; | ||
8 | + | ||
9 | +import java.io.Serializable; | ||
10 | + | ||
11 | +/** | ||
12 | + * Date:2023/12/21 | ||
13 | + * Author:wmr | ||
14 | + * Description:查询项目号和内部编号Dto类 | ||
15 | + */ | ||
16 | +@ApiOperation("查询项目号和内部编号Dto类") | ||
17 | +@Data | ||
18 | +@AllArgsConstructor | ||
19 | +@NoArgsConstructor | ||
20 | +public class QueryProjectNoAndInnerNoDto implements Serializable { | ||
21 | + | ||
22 | + @ApiModelProperty(value = "项目号") | ||
23 | + private String projectNo; | ||
24 | + | ||
25 | + @ApiModelProperty(value = "内部编号") | ||
26 | + private String innerNo; | ||
27 | +} |
src/main/java/com/order/erp/mapper/order/OrderBaseInfoMapper.java
@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; | @@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
4 | import com.order.erp.domain.OrderStatusEnum; | 4 | import com.order.erp.domain.OrderStatusEnum; |
5 | import com.order.erp.domain.dto.order.OrderBaseInfoDO; | 5 | import com.order.erp.domain.dto.order.OrderBaseInfoDO; |
6 | import com.order.erp.domain.vo.OrderCountVO; | 6 | import com.order.erp.domain.vo.OrderCountVO; |
7 | +import com.order.erp.domain.vo.order.QueryProjectNoAndInnerNoDto; | ||
8 | +import org.apache.ibatis.annotations.Param; | ||
7 | import org.apache.ibatis.annotations.Select; | 9 | import org.apache.ibatis.annotations.Select; |
8 | 10 | ||
9 | import java.util.List; | 11 | import java.util.List; |
@@ -26,5 +28,8 @@ public interface OrderBaseInfoMapper extends BaseMapper<OrderBaseInfoDO> { | @@ -26,5 +28,8 @@ public interface OrderBaseInfoMapper extends BaseMapper<OrderBaseInfoDO> { | ||
26 | 28 | ||
27 | @Select("SELECT COUNT(*) as total_orders FROM order_base_info WHERE enable_flag=10 and YEAR(create_time) = YEAR(CURDATE())") | 29 | @Select("SELECT COUNT(*) as total_orders FROM order_base_info WHERE enable_flag=10 and YEAR(create_time) = YEAR(CURDATE())") |
28 | long countRecentYear(); | 30 | long countRecentYear(); |
31 | + | ||
32 | + List<QueryProjectNoAndInnerNoDto> queryProjectNoAndInnerNoDto(@Param("flag") Boolean flag, | ||
33 | + @Param("dto") QueryProjectNoAndInnerNoDto dto); | ||
29 | } | 34 | } |
30 | 35 |
src/main/java/com/order/erp/service/order/impl/OrderBaseInfoServiceImpl.java
@@ -1241,7 +1241,8 @@ public class OrderBaseInfoServiceImpl extends ServiceImpl<OrderBaseInfoMapper, O | @@ -1241,7 +1241,8 @@ public class OrderBaseInfoServiceImpl extends ServiceImpl<OrderBaseInfoMapper, O | ||
1241 | .le(StringUtils.isNotBlank(queryVO.getCreateEndTime()), OrderBaseInfoDO::getCreateTime, queryVO.getCreateEndTime()) | 1241 | .le(StringUtils.isNotBlank(queryVO.getCreateEndTime()), OrderBaseInfoDO::getCreateTime, queryVO.getCreateEndTime()) |
1242 | .eq(StringUtils.isNotBlank(queryVO.getOrderStatus()), OrderBaseInfoDO::getOrderStatus, queryVO.getOrderStatus()) | 1242 | .eq(StringUtils.isNotBlank(queryVO.getOrderStatus()), OrderBaseInfoDO::getOrderStatus, queryVO.getOrderStatus()) |
1243 | .eq(StringUtils.isNotBlank(queryVO.getCustomerCode()), OrderBaseInfoDO::getCustomerCode, queryVO.getCustomerCode()) | 1243 | .eq(StringUtils.isNotBlank(queryVO.getCustomerCode()), OrderBaseInfoDO::getCustomerCode, queryVO.getCustomerCode()) |
1244 | - .eq(StringUtils.isNotBlank(queryVO.getProjectNo()), OrderBaseInfoDO::getProjectNo, queryVO.getProjectNo()) | 1244 | + .in(CollectionUtils.isNotEmpty(queryVO.getProjectNo()), OrderBaseInfoDO::getProjectNo, queryVO.getProjectNo()) |
1245 | + .in(CollectionUtils.isNotEmpty(queryVO.getInnerNo()),OrderBaseInfoDO::getInnerNo,queryVO.getInnerNo()) | ||
1245 | .eq(StringUtils.isNotBlank(queryVO.getProductionDepartment()), OrderBaseInfoDO::getProductionDepartment, queryVO.getProductionDepartment()) | 1246 | .eq(StringUtils.isNotBlank(queryVO.getProductionDepartment()), OrderBaseInfoDO::getProductionDepartment, queryVO.getProductionDepartment()) |
1246 | .eq(StringUtils.isNotBlank(queryVO.getCreateBy()), OrderBaseInfoDO::getCreateBy, queryVO.getCreateBy()) | 1247 | .eq(StringUtils.isNotBlank(queryVO.getCreateBy()), OrderBaseInfoDO::getCreateBy, queryVO.getCreateBy()) |
1247 | .eq(StringUtils.isNotBlank(queryVO.getBusinessPerson()), OrderBaseInfoDO::getBusinessPerson, queryVO.getBusinessPerson()) | 1248 | .eq(StringUtils.isNotBlank(queryVO.getBusinessPerson()), OrderBaseInfoDO::getBusinessPerson, queryVO.getBusinessPerson()) |
src/main/resources/mapper/OrderBaseInfoMapper.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
3 | +<mapper namespace="com.order.erp.mapper.order.OrderBaseInfoMapper"> | ||
4 | + <select id="queryProjectNoAndInnerNoDto" resultType="com.order.erp.domain.vo.order.QueryProjectNoAndInnerNoDto"> | ||
5 | + <if test="flag == true"> | ||
6 | + SELECT DISTINCT project_no | ||
7 | + FROM order_base_info | ||
8 | + WHERE enable_flag = 10 | ||
9 | + AND project_no like concat(#{dto.projectNo},'%') | ||
10 | + </if> | ||
11 | + <if test="flag == false"> | ||
12 | + SELECT DISTINCT inner_no | ||
13 | + FROM order_base_info | ||
14 | + WHERE enable_flag = 10 | ||
15 | + AND inner_no like concat(#{dto.innerNo},'%') | ||
16 | + </if> | ||
17 | + </select> | ||
18 | +</mapper> |