From 24a1aa1d7470998522aa28b4abc728fff5bcbaf7 Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期五, 11 八月 2023 16:00:20 +0800
Subject: [PATCH] WMS--回单管理
---
framework/src/main/java/com/yuanchu/mom/exception/MyFileException.java | 18 +
inventory-server/src/main/java/com/yuanchu/mom/service/ReceiptService.java | 58 +++
inventory-server/src/main/java/com/yuanchu/mom/pojo/ImportRepertory.java | 4
inspect-server/src/main/resources/mapper/InspectUnacceptedMapper.xml | 7
inventory-server/src/main/java/com/yuanchu/mom/service/impl/ReceiptServiceImpl.java | 100 ++++++
standard-server/src/main/resources/mapper/OrdersMapper.xml | 5
inspect-server/src/main/resources/mapper/RawInspectMapper.xml | 7
inventory-server/src/main/java/com/yuanchu/mom/pojo/Receipt.java | 105 +++++++
system-run/src/main/resources/application.yml | 4
system-run/src/main/java/com/yuanchu/mom/SystemRunApplication.java | 1
inventory-server/src/main/java/com/yuanchu/mom/mapper/ConsignmentMapper.java | 6
inventory-server/src/main/resources/mapper/ImportRepertoryMapper.xml | 1
inventory-server/src/main/java/com/yuanchu/mom/service/ConsignmentService.java | 27 +
inventory-server/src/main/java/com/yuanchu/mom/controller/ReceiptController.java | 98 ++++++
inventory-server/src/main/java/com/yuanchu/mom/mapper/ReceiptMapper.java | 22 +
inventory-server/src/main/java/com/yuanchu/mom/service/impl/ConsignmentServiceImpl.java | 161 ++++++++--
system-run/src/main/resources/application-dev.yml | 4
framework/src/main/java/com/yuanchu/mom/utils/FileSaveUtil.java | 74 ++++
inventory-server/src/main/java/com/yuanchu/mom/controller/ConsignmentController.java | 45 ++
inventory-server/src/main/resources/mapper/RepertoryMapper.xml | 1
inventory-server/src/main/resources/mapper/ReceiptMapper.xml | 32 ++
inventory-server/src/main/resources/mapper/ConsignmentMapper.xml | 28 +
framework/src/main/java/com/yuanchu/mom/handler/GlobalExceptionHandler.java | 34 ++
sale-server/src/main/resources/mapper/SaleMapper.xml | 30 -
24 files changed, 792 insertions(+), 80 deletions(-)
diff --git a/framework/src/main/java/com/yuanchu/mom/exception/MyFileException.java b/framework/src/main/java/com/yuanchu/mom/exception/MyFileException.java
new file mode 100644
index 0000000..97fa4b4
--- /dev/null
+++ b/framework/src/main/java/com/yuanchu/mom/exception/MyFileException.java
@@ -0,0 +1,18 @@
+package com.yuanchu.mom.exception;
+
+public class MyFileException extends RuntimeException{
+ public MyFileException() {
+ }
+
+ public MyFileException(String message) {
+ super(message);
+ }
+
+ public MyFileException(Throwable cause) {
+ super(cause);
+ }
+
+ public MyFileException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/framework/src/main/java/com/yuanchu/mom/handler/GlobalExceptionHandler.java b/framework/src/main/java/com/yuanchu/mom/handler/GlobalExceptionHandler.java
index e34b0d1..cc99c2d 100644
--- a/framework/src/main/java/com/yuanchu/mom/handler/GlobalExceptionHandler.java
+++ b/framework/src/main/java/com/yuanchu/mom/handler/GlobalExceptionHandler.java
@@ -1,11 +1,15 @@
package com.yuanchu.mom.handler;
+import com.yuanchu.mom.exception.MyFileException;
import com.yuanchu.mom.vo.Result;
import lombok.extern.slf4j.Slf4j;
+import org.apache.tomcat.util.http.fileupload.impl.FileSizeLimitExceededException;
+import org.apache.tomcat.util.http.fileupload.impl.SizeLimitExceededException;
import org.springframework.beans.ConversionNotSupportedException;
import org.springframework.beans.TypeMismatchException;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.http.converter.HttpMessageNotWritableException;
@@ -14,6 +18,7 @@
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
+import org.springframework.web.multipart.MultipartException;
import javax.servlet.http.HttpServletResponse;
import java.io.FileNotFoundException;
@@ -230,6 +235,35 @@
return Result.fail(message);
}
+ @Value("${spring.servlet.multipart.max-file-size}")
+ private String maxFileSize;
+
+ @Value("${spring.servlet.multipart.max-request-size}")
+ private String maxRequestSize;
+
+ /**
+ *鏂囦欢杩囧ぇ鎶ラ敊鎻愮ず
+ */
+ @ExceptionHandler({MultipartException.class})
+ public Result<?> fileUploadExceptionHandler(MultipartException e) {
+ String msg;
+ Throwable rootCause = e.getRootCause();
+ if (rootCause instanceof FileSizeLimitExceededException) {
+ msg="涓婁紶鏂囦欢杩囧ぇ銆愬崟涓枃浠跺ぇ灏忎笉寰楄秴杩�" + maxFileSize + "銆�";
+ }else if(rootCause instanceof SizeLimitExceededException){
+ msg="涓婁紶鏂囦欢杩囧ぇ銆愭�讳笂浼犲ぇ灏忎笉寰楄秴杩�" + maxRequestSize + "銆�";
+ }else {
+ msg="鏂囦欢涓婁紶澶辫触銆愭湇鍔″櫒寮傚父銆�";
+ }
+ return Result.fail(msg);
+ }
+
+ /** 鏂囦欢鍚庣紑鍚嶄笉閫氳繃杩斿洖鎻愮ず */
+ @ExceptionHandler({MyFileException.class})
+ public Result<?> myFileException(Exception e) {
+ return Result.fail("鎶辨瓑涓嶆敮鎸併��" + e.getMessage() +"銆戝悗缂�鐨勬枃浠讹紒");
+ }
+
/** 鍏朵粬閿欒 */
/**
* 鍏朵粬閿欒
diff --git a/framework/src/main/java/com/yuanchu/mom/utils/FileSaveUtil.java b/framework/src/main/java/com/yuanchu/mom/utils/FileSaveUtil.java
index 11332ea..00e2ca6 100644
--- a/framework/src/main/java/com/yuanchu/mom/utils/FileSaveUtil.java
+++ b/framework/src/main/java/com/yuanchu/mom/utils/FileSaveUtil.java
@@ -1,10 +1,15 @@
package com.yuanchu.mom.utils;
+import com.yuanchu.mom.exception.MyFileException;
import lombok.extern.slf4j.Slf4j;
import org.apache.tomcat.util.http.fileupload.IOUtils;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
-
+import org.springframework.util.FileSystemUtils;
+import org.springframework.web.multipart.MultipartFile;
+import javax.annotation.PostConstruct;
import java.io.ByteArrayInputStream;
+import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
@@ -16,36 +21,66 @@
public class FileSaveUtil {
// 鍙杫ml涓殑璺緞 + /
-// @Value("${file.path}")
- private String FILE_PATH;
+ private static String FILE_PATH;
+ private static String[] ALLOWED;
+
+ @Value("${file.path}")
+ private String file;
+
+ @Value("${file.allowed}")
+ private String[] allowed;
+
+ @PostConstruct
+ public void getFile() {
+ FILE_PATH = this.file;
+ }
+
+ @PostConstruct
+ public void getAllowed(){
+ ALLOWED = this.allowed;
+ }
/**
* 瀛樺偍鏂囦欢涓诲嚱鏁�
- * @param content 鏂囦欢浜岃繘鍒舵祦
- * @param originalFilename 鏂囦欢鍚嶇О
+ * @param file 鏂囦欢浜岃繘鍒舵祦
* @return 杩斿洖鏂囦欢鍚嶇О鐢ㄤ簬瀛樺偍鏁版嵁搴�
*/
- public String StoreFile(byte[] content, String originalFilename) {
+ public static String StoreFile(MultipartFile file) {
+ String originalFilename = file.getOriginalFilename();
// 鐢熸垚闅忔満鍚嶇О锛氭椂闂確闅忔満6浣嶆暟瀛�
String FileName = System.currentTimeMillis() + "_" + MyUtil.getNumber(6);
- String suffix = originalFilename.substring(originalFilename.lastIndexOf("."));
+ String suffix = null;
+ if (originalFilename != null) {
+ suffix = originalFilename.substring(originalFilename.lastIndexOf("."));
+ // 濡傛灉鍚庣紑鍚嶄笉閫氳繃鎶涘嚭寮傚父
+ if (!isFileAllowed(suffix)){
+ throw new MyFileException(suffix);
+ }
+ }
// 鍚嶇О鎷兼帴
String fileName = FileName + suffix;
// 杩涜瀛樺偍
- storeFileWithFileName(content, fileName);
+ try {
+ storeFileWithFileName(file.getBytes(), fileName);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
return fileName;
}
+ public static Boolean DeleteFile(String fileName) {
+ return FileSystemUtils.deleteRecursively(new File(FILE_PATH + "/" + fileName));
+ }
/**
* 瀛樺偍鏂囦欢鍑芥暟
* @param content 鏂囦欢浜岃繘鍒舵祦
* @param fileName 鏂囦欢鍚嶇О
*/
- private void storeFileWithFileName(byte[] content, String fileName) {
+ private static void storeFileWithFileName(byte[] content, String fileName) {
// 瀛樺偍璺緞
- String path = FILE_PATH + java.io.File.separatorChar;
+ String path = FILE_PATH + File.separatorChar;
// 鐩綍涓嶅瓨鍦ㄥ垯鍒涘缓
- java.io.File file = new java.io.File(path);
+ File file = new File(path);
if (!file.exists()) {
file.mkdirs();
}
@@ -57,4 +92,21 @@
MyUtil.PrintLog("瀛樺偍鏂囦欢寮傚父锛�" + e);
}
}
+
+ /**
+ * 鍒ゆ柇鏂囦欢鏄惁琚厑璁镐笂浼�
+ *
+ * @param fileName 鏂囦欢鍚�
+ * @return 鍏佽true, 鍚﹀垯false
+ */
+ private static boolean isFileAllowed(String fileName) {
+ // 鑾峰彇鍚庣紑鍚�
+ String suffixName = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase();
+ for (String allow : ALLOWED) {
+ if (allow.equals(suffixName)) {
+ return true;
+ }
+ }
+ return false;
+ }
}
diff --git a/inspect-server/src/main/resources/mapper/InspectUnacceptedMapper.xml b/inspect-server/src/main/resources/mapper/InspectUnacceptedMapper.xml
index ab3d5c2..74e77d6 100644
--- a/inspect-server/src/main/resources/mapper/InspectUnacceptedMapper.xml
+++ b/inspect-server/src/main/resources/mapper/InspectUnacceptedMapper.xml
@@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yuanchu.mom.mapper.InspectUnacceptedMapper">
<select id="selectUnRawInspectsList" resultType="java.util.Map">
- select
+ select ru.id
DATE_FORMAT(form_time, '%Y-%m-%d') '鏉ユ枡鏃ユ湡',
reason,
code,
@@ -29,9 +29,11 @@
</if>
and ru.state=1
</where>
+ order by ru.id desc
</select>
<select id="selectInsList" resultType="java.util.Map">
- select DATE_FORMAT(fi.create_time, '%Y-%m-%d') '鏉ユ枡鏃ユ湡',
+ select ru.id
+ DATE_FORMAT(fi.create_time, '%Y-%m-%d') '鏉ユ枡鏃ユ湡',
reason,
material_code,
name,
@@ -59,5 +61,6 @@
and ru.type=#{type}
</if>
and ru.state=1
+ order by ru.id desc
</select>
</mapper>
\ No newline at end of file
diff --git a/inspect-server/src/main/resources/mapper/RawInspectMapper.xml b/inspect-server/src/main/resources/mapper/RawInspectMapper.xml
index f8bfd64..e2d212b 100644
--- a/inspect-server/src/main/resources/mapper/RawInspectMapper.xml
+++ b/inspect-server/src/main/resources/mapper/RawInspectMapper.xml
@@ -3,7 +3,6 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yuanchu.mom.mapper.RawInspectMapper">
-
<resultMap id="BaseResultMap" type="com.yuanchu.mom.pojo.RawInspect">
<id property="id" column="id" jdbcType="INTEGER"/>
<result property="code" column="code" jdbcType="VARCHAR"/>
@@ -21,8 +20,9 @@
<result property="formTime" column="form_time" jdbcType="DATE"/>
</resultMap>
<select id="selectRawInspectsByLimit" resultType="com.yuanchu.mom.pojo.RawInspect">
- select id, code, name, specifications, unit, number, ins_state, judge_state, ins_time, user_name, create_time, form_time
- from raw_inspect
+ select id, code, name, specifications, unit, number, ins_state, judge_state, ins_time, user_name, create_time,
+ form_time
+ from mom_ocean.raw_inspect
where state = 1
<if test="formTime!=null and formTime!=''">
and form_time = #{formTime}
@@ -36,6 +36,7 @@
<if test="judgeState!=2">
and judge_state = #{judgeState}
</if>
+ order by id desc
limit #{pageSize},#{countSize}
</select>
</mapper>
diff --git a/inventory-server/src/main/java/com/yuanchu/mom/controller/ConsignmentController.java b/inventory-server/src/main/java/com/yuanchu/mom/controller/ConsignmentController.java
index ef0cd6b..3e80933 100644
--- a/inventory-server/src/main/java/com/yuanchu/mom/controller/ConsignmentController.java
+++ b/inventory-server/src/main/java/com/yuanchu/mom/controller/ConsignmentController.java
@@ -1,8 +1,8 @@
package com.yuanchu.mom.controller;
-
-
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yuanchu.mom.pojo.dto.ConsignmentDto;
import com.yuanchu.mom.service.SaleService;
import com.yuanchu.mom.utils.JackSonUtil;
@@ -17,6 +17,8 @@
import com.yuanchu.mom.service.ConsignmentService;
import javax.annotation.Resource;
+import java.util.HashMap;
+import java.util.List;
import java.util.Map;
/**
@@ -44,7 +46,7 @@
@ApiImplicitParam(name = "orderNumber", value = "璁㈠崟缂栧彿", dataTypeClass = String.class, required = true)
})
@GetMapping("/selSale")
- public Result selSale(String orderNumber ) {
+ public Result selSale(String orderNumber) {
return Result.success(saleService.selSale(orderNumber));
}
@@ -55,5 +57,42 @@
return Result.success(consignmentService.addCon(data.get("name").replaceAll("\"", ""), consignmentDto));
}
+
+ @ApiOperation(value = "鏌ヨ鍙戣揣璁板綍鍒楄〃")
+ @ApiImplicitParams(value = {
+ @ApiImplicitParam(name = "pageSize", value = "椤垫暟", dataTypeClass = Integer.class, required = true),
+ @ApiImplicitParam(name = "countSize", value = "鏉℃暟/椤�", dataTypeClass = Integer.class, required = true),
+ @ApiImplicitParam(name = "name", value = "浜у搧鍚嶇О", dataTypeClass = String.class),
+ @ApiImplicitParam(name = "specifications", value = "浜у搧鍨嬪彿", dataTypeClass = String.class),
+ @ApiImplicitParam(name = "time", value = "鍙戣揣鏃ユ湡", dataTypeClass = String.class)
+ })
+ @GetMapping("/selectAllCon")
+ public Result selectAllCon(int pageSize, int countSize, String name, String specifications, String time) {
+ IPage<Map<String, Object>> consignmentPage = consignmentService.selectAllCon(new Page<Object>(pageSize, countSize), name, specifications, time);
+ Map<String, Object> map = new HashMap<>();
+ map.put("total", consignmentPage.getTotal());
+ map.put("row", consignmentPage.getRecords());
+ return Result.success(map);
+ }
+ @ApiOperation(value = "鏍规嵁鍙戣揣id鍒犻櫎")
+ @ApiImplicitParams(value = {
+ @ApiImplicitParam(name = "id", value = "鍙戣揣id", dataTypeClass = Integer.class, required = true)
+ })
+ @PostMapping("/delCon")
+ public Result delCon(Integer id) {
+ consignmentService.delCon(id);
+ return Result.success();
+ }
+
+ @ApiOperation(value = "鎵归噺鍒犻櫎")
+ @ApiImplicitParams(value = {
+ @ApiImplicitParam(name = "ids", value = "ids", dataTypeClass = Integer.class, dataType = "List", required = true)
+ })
+ @PostMapping("/delAllCon")
+ public Result delAllCon(@RequestParam("ids") List<Integer> ids) {
+ consignmentService.delAllCon(ids);
+ return Result.success();
+ }
+
}
diff --git a/inventory-server/src/main/java/com/yuanchu/mom/controller/ReceiptController.java b/inventory-server/src/main/java/com/yuanchu/mom/controller/ReceiptController.java
new file mode 100644
index 0000000..e442845
--- /dev/null
+++ b/inventory-server/src/main/java/com/yuanchu/mom/controller/ReceiptController.java
@@ -0,0 +1,98 @@
+package com.yuanchu.mom.controller;
+
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.yuanchu.mom.vo.Result;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+import com.yuanchu.mom.service.ReceiptService;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * 鍥炲崟琛�(Receipt)琛ㄦ帶鍒跺眰
+ *
+ * @author zss
+ * @since 2023-08-11 10:08:54
+ */
+@Api(tags = "WMS绠$悊-->鍥炲崟绠$悊")
+@RestController
+@RequestMapping("/receipt")
+public class ReceiptController {
+
+ @Autowired
+ private ReceiptService receiptService;
+
+ @ApiOperation(value = "鏌ヨ鍥炲崟鍒楄〃")
+ @ApiImplicitParams(value = {
+ @ApiImplicitParam(name = "pageSize", value = "椤垫暟", dataTypeClass = Integer.class, required = true),
+ @ApiImplicitParam(name = "countSize", value = "鏉℃暟/椤�", dataTypeClass = Integer.class, required = true),
+ @ApiImplicitParam(name = "name", value = "浜у搧鍚嶇О", dataTypeClass = String.class),
+ @ApiImplicitParam(name = "orderCode", value = "璁㈠崟缂栧彿", dataTypeClass = String.class),
+ @ApiImplicitParam(name = "type", value = "绫诲瀷(涓虹┖=鍏ㄩ儴)", dataTypeClass = String.class),
+ @ApiImplicitParam(name = "deliverTime", value = "鍙戣揣鏃ユ湡", dataTypeClass = String.class)
+ })
+ @GetMapping("/selectAllRece")
+ public Result selectAllRece(int pageSize, int countSize, String name, String orderCode, String type, String deliverTime) {
+ IPage<Map<String, Object>> receiptPage = receiptService.selectAllRece(new Page<Object>(pageSize, countSize), name, orderCode, type, deliverTime);
+ Map<String, Object> map = new HashMap<>();
+ map.put("total", receiptPage.getTotal());
+ map.put("row", receiptPage.getRecords());
+ return Result.success(map);
+ }
+
+
+ @ApiOperation(value = "鏍搁攢")
+ @ApiImplicitParams(value = {
+ @ApiImplicitParam(name = "id", value = "鍥炲崟id", dataTypeClass = Integer.class, required = true)
+ })
+ @PostMapping("/delRece")
+ public Result delRece(Integer id) {
+ receiptService.delRece(id);
+ return Result.success();
+ }
+
+ @ApiOperation(value = "鎵归噺鏍搁攢")
+ @ApiImplicitParams(value = {
+ @ApiImplicitParam(name = "ids", value = "ids", dataTypeClass = Integer.class, dataType = "List", required = true)
+ })
+ @PostMapping("/delAllRece")
+ public Result delAllRece(@RequestParam("ids") List<Integer> ids) {
+ receiptService.delAllRece(ids);
+ return Result.success();
+ }
+
+ @ApiOperation(value = "涓婁紶闄勪欢")
+ @ApiImplicitParams(value = {
+ @ApiImplicitParam(name = "id", value = "鍥炲崟id", dataTypeClass = Integer.class, required = true),
+ @ApiImplicitParam(name = "file", value = "鍥炲崟鏂囦欢", dataTypeClass = MultipartFile.class, required = true)
+ })
+ @PostMapping("/updRece")
+ public Result updRece(Integer id,@RequestPart MultipartFile file) {
+ receiptService.updRece(id, file);
+ return Result.success();
+ }
+
+ @ApiOperation(value = "鏌ョ湅鍥炲崟")
+ @ApiImplicitParams(value = {
+ @ApiImplicitParam(name = "id", value = "鍥炲崟id", dataTypeClass = Integer.class, required = true)
+ })
+ @PostMapping("/selReceDatil")
+ public ResponseEntity<byte[]> selReceDatil(Integer id) throws IOException {
+ return receiptService.selReceDatil(id);
+ }
+
+}
+
diff --git a/inventory-server/src/main/java/com/yuanchu/mom/mapper/ConsignmentMapper.java b/inventory-server/src/main/java/com/yuanchu/mom/mapper/ConsignmentMapper.java
index aadad50..a9b1956 100644
--- a/inventory-server/src/main/java/com/yuanchu/mom/mapper/ConsignmentMapper.java
+++ b/inventory-server/src/main/java/com/yuanchu/mom/mapper/ConsignmentMapper.java
@@ -1,9 +1,12 @@
package com.yuanchu.mom.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yuanchu.mom.pojo.Consignment;
import java.util.List;
+import java.util.Map;
/**
* 鎴愬搧鍙戣揣琛�(Consignment)琛ㄦ暟鎹簱璁块棶灞�
@@ -15,5 +18,8 @@
//鏌ヨ鎵�鏈夊彂璐ц褰�
List<Consignment> selectAll();
+
+ //鏌ヨ鍙戣揣璁板綍鍒楄〃
+ IPage<Map<String, Object>> selectAllCon(Page<Object> page, String name, String specifications, String time);
}
diff --git a/inventory-server/src/main/java/com/yuanchu/mom/mapper/ReceiptMapper.java b/inventory-server/src/main/java/com/yuanchu/mom/mapper/ReceiptMapper.java
new file mode 100644
index 0000000..77301e1
--- /dev/null
+++ b/inventory-server/src/main/java/com/yuanchu/mom/mapper/ReceiptMapper.java
@@ -0,0 +1,22 @@
+package com.yuanchu.mom.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.yuanchu.mom.pojo.Receipt;
+
+import java.util.Map;
+
+/**
+ * 鍥炲崟琛�(Receipt)琛ㄦ暟鎹簱璁块棶灞�
+ *
+ * @author zss
+ * @since 2023-08-11 10:08:54
+ */
+public interface ReceiptMapper extends BaseMapper<Receipt> {
+
+ //鏌ヨ鍥炲崟鍒楄〃
+ IPage<Map<String, Object>> selectAllRece(Page<Object> page, String name, String orderCode, String type, String deliverTime);
+
+}
+
diff --git a/inventory-server/src/main/java/com/yuanchu/mom/pojo/ImportRepertory.java b/inventory-server/src/main/java/com/yuanchu/mom/pojo/ImportRepertory.java
index a64c71e..75fa247 100644
--- a/inventory-server/src/main/java/com/yuanchu/mom/pojo/ImportRepertory.java
+++ b/inventory-server/src/main/java/com/yuanchu/mom/pojo/ImportRepertory.java
@@ -78,9 +78,7 @@
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date createTime;
- /**
- * ${column.comment}
- **/
+
@TableField(fill = FieldFill.INSERT_UPDATE)
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
diff --git a/inventory-server/src/main/java/com/yuanchu/mom/pojo/Receipt.java b/inventory-server/src/main/java/com/yuanchu/mom/pojo/Receipt.java
new file mode 100644
index 0000000..f01d4a2
--- /dev/null
+++ b/inventory-server/src/main/java/com/yuanchu/mom/pojo/Receipt.java
@@ -0,0 +1,105 @@
+package com.yuanchu.mom.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.*;
+import lombok.experimental.Accessors;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+import java.io.Serializable;
+
+/**
+ * 鍥炲崟琛�(Receipt)琛ㄥ疄浣撶被
+ *
+ * @author zss
+ * @since 2023-08-11 10:08:55
+ */
+@Data
+@Accessors(chain = true)
+@AllArgsConstructor
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = false)
+@Builder
+@TableName("receipt")
+public class Receipt implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * id
+ **/
+ @TableId(type = IdType.AUTO)
+ private Integer id;
+
+ /**
+ * 璁㈠崟缂栧彿
+ **/
+ private String orderCode;
+
+ /**
+ * 鍚堝悓缂栧彿(瀹㈡埛璁㈠崟鍙�)
+ **/
+ private String customerCode;
+
+ /**
+ * 瀹㈡埛鍚嶇О
+ **/
+ private String proname;
+
+ /**
+ * 鍒拌揣鍦板潃
+ **/
+ private String adress;
+
+ /**
+ * 鍒拌揣鑱旂郴浜�
+ **/
+ private String name;
+
+ /**
+ * 鎵嬫満鍙�
+ **/
+ private String phone;
+
+ /**
+ * 鎶艰繍鍗曠紪鍙�
+ **/
+ private String escortCode;
+
+ /**
+ * 鍙戣揣鏃ユ湡
+ **/
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+ private Date deliverTime;
+
+ /**
+ * 鍙戣揣浜�
+ **/
+ private String userName;
+
+ /**
+ * 鐘舵��0:寰呭洖鍗�;1:宸插洖鍗�
+ **/
+ private Integer type;
+
+ @ApiModelProperty(value = "閫昏緫鍒犻櫎 姝e父>=1,鍒犻櫎<=0", hidden = true)
+ private Integer state;
+
+ @TableField(fill = FieldFill.INSERT)
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+ private Date createTime;
+
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+ private Date updateTime;
+
+ /**
+ * 鍥炲崟鐓х墖url
+ **/
+ private String url;
+}
+
diff --git a/inventory-server/src/main/java/com/yuanchu/mom/service/ConsignmentService.java b/inventory-server/src/main/java/com/yuanchu/mom/service/ConsignmentService.java
index a28acaf..d47a783 100644
--- a/inventory-server/src/main/java/com/yuanchu/mom/service/ConsignmentService.java
+++ b/inventory-server/src/main/java/com/yuanchu/mom/service/ConsignmentService.java
@@ -1,8 +1,13 @@
package com.yuanchu.mom.service;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yuanchu.mom.pojo.Consignment;
import com.yuanchu.mom.pojo.dto.ConsignmentDto;
+
+import java.util.List;
+import java.util.Map;
/**
* 鎴愬搧鍙戣揣琛�(Consignment)琛ㄦ湇鍔℃帴鍙�
@@ -18,5 +23,27 @@
* @param consignmentDto
*/
String addCon(String name, ConsignmentDto consignmentDto);
+
+ /**
+ * 鏌ヨ鍙戣揣璁板綍鍒楄〃
+ * @param page
+ * @param name
+ * @param specifications
+ * @param time
+ * @return
+ */
+ IPage<Map<String, Object>> selectAllCon(Page<Object> page, String name, String specifications, String time);
+
+ /**
+ * 鏍规嵁id鍒犻櫎
+ * @param id
+ */
+ void delCon(Integer id);
+
+ /**
+ * 鎵归噺鍒犻櫎
+ * @param ids
+ */
+ void delAllCon(List<Integer> ids);
}
diff --git a/inventory-server/src/main/java/com/yuanchu/mom/service/ReceiptService.java b/inventory-server/src/main/java/com/yuanchu/mom/service/ReceiptService.java
new file mode 100644
index 0000000..1085ae8
--- /dev/null
+++ b/inventory-server/src/main/java/com/yuanchu/mom/service/ReceiptService.java
@@ -0,0 +1,58 @@
+package com.yuanchu.mom.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.yuanchu.mom.pojo.Receipt;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 鍥炲崟琛�(Receipt)琛ㄦ湇鍔℃帴鍙�
+ *
+ * @author zss
+ * @since 2023-08-11 10:08:54
+ */
+public interface ReceiptService extends IService<Receipt> {
+
+ /**
+ * 鏌ヨ鍥炲崟鍒楄〃
+ * @param page
+ * @param name
+ * @param orderCode
+ * @param type
+ * @param deliverTime
+ * @return
+ */
+ IPage<Map<String, Object>> selectAllRece(Page<Object> page, String name, String orderCode, String type, String deliverTime);
+
+ /**
+ * 鏍规嵁鍥炲崟id鍒犻櫎
+ * @param id
+ */
+ void delRece(Integer id);
+
+ /**
+ * 鎵归噺鍒犻櫎
+ * @param ids
+ */
+ void delAllRece(List<Integer> ids);
+
+ /**
+ * 鏍规嵁id淇敼鐘舵��
+ * @param id
+ */
+ void updRece(Integer id, MultipartFile file);
+
+ /**
+ * 鏍规嵁id鏌ョ湅鍥炲崟
+ * @param id
+ */
+ ResponseEntity<byte[]> selReceDatil(Integer id) throws IOException;
+
+}
+
diff --git a/inventory-server/src/main/java/com/yuanchu/mom/service/impl/ConsignmentServiceImpl.java b/inventory-server/src/main/java/com/yuanchu/mom/service/impl/ConsignmentServiceImpl.java
index 0191276..adbb905 100644
--- a/inventory-server/src/main/java/com/yuanchu/mom/service/impl/ConsignmentServiceImpl.java
+++ b/inventory-server/src/main/java/com/yuanchu/mom/service/impl/ConsignmentServiceImpl.java
@@ -1,19 +1,26 @@
package com.yuanchu.mom.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yuanchu.mom.mapper.ConsignmentMapper;
+import com.yuanchu.mom.mapper.ReceiptMapper;
import com.yuanchu.mom.mapper.RepertoryMapper;
import com.yuanchu.mom.pojo.Consignment;
+import com.yuanchu.mom.pojo.Receipt;
import com.yuanchu.mom.pojo.Repertory;
import com.yuanchu.mom.pojo.dto.ConsignmentDto;
import com.yuanchu.mom.pojo.dto.ConsignmentDto2;
import com.yuanchu.mom.service.ConsignmentService;
import com.yuanchu.mom.utils.MyUtil;
+import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
+import java.util.Date;
import java.util.List;
+import java.util.Map;
/**
* 鎴愬搧鍙戣揣琛�(Consignment)琛ㄦ湇鍔″疄鐜扮被
@@ -30,53 +37,131 @@
@Resource
RepertoryMapper repertoryMapper;
+ @Resource
+ ReceiptMapper receiptMapper;
+
//鏂板鎴愬搧鍙戣揣
@Override
public String addCon(String name, ConsignmentDto consignmentDto) {
+ //鐢熸垚涓�涓娂杩愬崟缂栧彿
+ String escortCode = MyUtil.getTimeSixNumberCode("YY");
//濡傛灉璇ヨ鍗曞凡缁忓彂杩囪揣浜嗕笉鑳藉啀鍙戣揣
List<Consignment> consignments = consignmentMapper.selectAll();
- for (Consignment consignment : consignments) {
- if (consignment.getCustomerCode().equals(consignmentDto.getCustomerCode())) {
- return "璇ュ悎鍚岃鍗曞凡鍙戣繃璐�,鏃犳硶鍐嶆鍙戣揣!";
- } else {
- /*鏂板鎴愬搧鍙戣揣*/
- List<ConsignmentDto2> messages = consignmentDto.getMessages();
- for (ConsignmentDto2 message : messages) {
- //鏌ヨ浜у搧缂栫爜(閫氳繃鍦ㄦ垚鍝佸簱瀛樿〃涓殑浜у搧鍚嶇О,瑙勬牸鍨嬪彿浠ュ強鍗曚綅杩涜鏌ユ壘)
- LambdaQueryWrapper<Repertory> queryWrapper = new LambdaQueryWrapper<>();
- queryWrapper.eq(Repertory::getName, message.getName())
- .eq(Repertory::getSpecifications, message.getSpecifications())
- .eq(Repertory::getUnit, message.getUnit())
- .eq(Repertory::getType, 0);
- Repertory repertory = repertoryMapper.selectOne(queryWrapper);
- //璇ユ垚鍝佺殑妫�楠岀姸鎬佹槸宸叉楠�1鎵嶈兘杩涜鍙戣揣
- if (repertory.getCheckState() == 1) {
- //璇ユ垚鍝佸簱瀛樼殑鏁伴噺澶т簬绛変簬鍙戣揣鐨勬暟閲忔墠鑳借繘琛屽彂璐�
- if (repertory.getNumber() >= message.getNumber()) {
- //鏋勯�犳垚鍝佸彂璐у疄浣撶被
- Consignment consig = Consignment.builder()
- .customerCode(consignmentDto.getCustomerCode())
- .escortCode(MyUtil.getTimeSixNumberCode("YY"))
- .orderCode(consignmentDto.getOrderCode())
- .userName(name)
- .checkName(consignmentDto.getCheckName())
- .fitName(consignmentDto.getFitName())
- .name(message.getName())
- .specifications(message.getSpecifications())
- .unit(message.getUnit())
- .number(message.getNumber())
- .code(repertory.getCode())
- .build();
- consignmentMapper.insert(consig);
- /*鍑忓皯瀵瑰簲鐨勫簱瀛�*/
- repertory.setNumber(repertory.getNumber() - consig.getNumber());
- repertoryMapper.updateById(repertory);
- } else return "搴撳瓨涓嶈冻,鏃犳硶鍙戣揣!";
- } else return "璇ヤ骇鍝佽繕鏈楠�,涓嶈兘鍙戣揣!";
+ //濡傛灉娌℃湁鍙戣揣琛ㄤ腑娌℃湁鏁版嵁涔熷彲浠ュ彂璐�
+ if (consignments.size()==0) {
+ /*鏂板鎴愬搧鍙戣揣*/
+ String mes1 = addConsign(name, consignmentDto, escortCode);
+ return mes1;
+ } else {
+ for (Consignment consignment : consignments) {
+ if (consignment.getCustomerCode().equals(consignmentDto.getCustomerCode())) {
+ return "璇ュ悎鍚岃鍗曞凡鍙戣繃璐�,鏃犳硶鍐嶆鍙戣揣!";
+ } else {
+ /*鏂板鎴愬搧鍙戣揣*/
+ String mes2 = addConsign(name, consignmentDto, escortCode);
+ return mes2;
}
}
}
+ return null;
+ }
+
+ //鏌ヨ鍙戣揣璁板綍鍒楄〃
+ @Override
+ public IPage<Map<String, Object>> selectAllCon(Page<Object> page, String name, String specifications, String time) {
+ return consignmentMapper.selectAllCon(page, name, specifications, time);
+ }
+
+ //鏍规嵁id鍒犻櫎
+ @Override
+ public void delCon(Integer id) {
+ //鍒犻櫎鍙戣揣璁板綍
+ Consignment consignment = consignmentMapper.selectById(id);
+ consignment.setState(0);
+ consignmentMapper.updateById(consignment);
+ //搴撳瓨涔熻鏂板
+ LambdaQueryWrapper<Repertory> queryWrapper = new LambdaQueryWrapper<>();
+ queryWrapper.eq(Repertory::getCode, consignment.getCode())
+ .eq(Repertory::getName, consignment.getName())
+ .eq(Repertory::getSpecifications, consignment.getSpecifications())
+ .eq(Repertory::getUnit, consignment.getUnit())
+ .eq(Repertory::getType, 0) //鎴愬搧鍙戣揣
+ .eq(Repertory::getCheckState, 1); //鍙湁宸叉楠屾墠鑳藉彂璐�
+ Repertory repertory = repertoryMapper.selectOne(queryWrapper);
+ repertory.setNumber(repertory.getNumber() + consignment.getNumber());
+ repertoryMapper.updateById(repertory);
+ }
+
+ //鎵归噺鍒犻櫎
+ @Override
+ public void delAllCon(List<Integer> ids) {
+ List<Consignment> consignments = consignmentMapper.selectBatchIds(ids);
+ for (Consignment consignment : consignments) {
+ consignment.setState(0);
+ //鍒犻櫎鍙戣揣璁板綍
+ consignmentMapper.updateById(consignment);
+ //搴撳瓨鏂板
+ LambdaQueryWrapper<Repertory> queryWrapper = new LambdaQueryWrapper<>();
+ queryWrapper.eq(Repertory::getCode, consignment.getCode())
+ .eq(Repertory::getName, consignment.getName())
+ .eq(Repertory::getSpecifications, consignment.getSpecifications())
+ .eq(Repertory::getUnit, consignment.getUnit())
+ .eq(Repertory::getType, 0) //鎴愬搧鍙戣揣
+ .eq(Repertory::getCheckState, 1); //鍙湁宸叉楠屾墠鑳藉彂璐�
+ Repertory repertory = repertoryMapper.selectOne(queryWrapper);
+ repertory.setNumber(repertory.getNumber() + consignment.getNumber());
+ repertoryMapper.updateById(repertory);
+ }
+ }
+
+
+ //鏂板鍙戣揣涓�绯诲垪鎿嶄綔
+ private String addConsign(String name, ConsignmentDto consignmentDto, String escortCode) {
+ /*鏂板鎴愬搧鍙戣揣*/
+ List<ConsignmentDto2> messages = consignmentDto.getMessages();
+ for (ConsignmentDto2 message : messages) {
+ //鏌ヨ浜у搧缂栫爜(閫氳繃鍦ㄦ垚鍝佸簱瀛樿〃涓殑浜у搧鍚嶇О,瑙勬牸鍨嬪彿浠ュ強鍗曚綅杩涜鏌ユ壘)
+ LambdaQueryWrapper<Repertory> queryWrapper = new LambdaQueryWrapper<>();
+ queryWrapper.eq(Repertory::getName, message.getName())
+ .eq(Repertory::getSpecifications, message.getSpecifications())
+ .eq(Repertory::getUnit, message.getUnit())
+ .eq(Repertory::getType, 0);
+ Repertory repertory = repertoryMapper.selectOne(queryWrapper);
+ //璇ユ垚鍝佺殑妫�楠岀姸鎬佹槸宸叉楠�1鎵嶈兘杩涜鍙戣揣
+ if (repertory.getCheckState() == 1) {
+ //璇ユ垚鍝佸簱瀛樼殑鏁伴噺澶т簬绛変簬鍙戣揣鐨勬暟閲忔墠鑳借繘琛屽彂璐�
+ if (repertory.getNumber() >= message.getNumber()) {
+ //鏋勯�犳垚鍝佸彂璐у疄浣撶被
+ Consignment consig = Consignment.builder()
+ .customerCode(consignmentDto.getCustomerCode())
+ .escortCode(escortCode)
+ .orderCode(consignmentDto.getOrderCode())
+ .userName(name)
+ .checkName(consignmentDto.getCheckName())
+ .fitName(consignmentDto.getFitName())
+ .name(message.getName())
+ .specifications(message.getSpecifications())
+ .unit(message.getUnit())
+ .number(message.getNumber())
+ .code(repertory.getCode())
+ .build();
+ consignmentMapper.insert(consig);
+ /*鍑忓皯瀵瑰簲鐨勫簱瀛�*/
+ repertory.setNumber(repertory.getNumber() - consig.getNumber());
+ repertoryMapper.updateById(repertory);
+ } else return "搴撳瓨涓嶈冻,鏃犳硶鍙戣揣!";
+ } else return "璇ヤ骇鍝佽繕鏈楠�,涓嶈兘鍙戣揣!";
+ }
+ /*鍙戣揣鎴愬姛涔嬪悗闇�瑕佹柊澧炰竴寮犲洖鍗�*/
+ Receipt receipt = new Receipt();
+ BeanUtils.copyProperties(consignmentDto, receipt);
+ receipt.setName(consignmentDto.getUsername());//鏀惰揣鑱旂郴浜�
+ receipt.setUserName(name);//鍙戣揣浜�
+ receipt.setEscortCode(escortCode);//鎶艰繍鍗曠紪鍙�
+ receipt.setDeliverTime(new Date());//鍙戣揣鏃ユ湡
+ receiptMapper.insert(receipt);
return "鍙戣揣鎴愬姛!";
}
}
+
diff --git a/inventory-server/src/main/java/com/yuanchu/mom/service/impl/ReceiptServiceImpl.java b/inventory-server/src/main/java/com/yuanchu/mom/service/impl/ReceiptServiceImpl.java
new file mode 100644
index 0000000..6b94a81
--- /dev/null
+++ b/inventory-server/src/main/java/com/yuanchu/mom/service/impl/ReceiptServiceImpl.java
@@ -0,0 +1,100 @@
+package com.yuanchu.mom.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.yuanchu.mom.mapper.ReceiptMapper;
+import com.yuanchu.mom.pojo.Receipt;
+import com.yuanchu.mom.service.ReceiptService;
+import com.yuanchu.mom.utils.FileSaveUtil;
+import io.swagger.models.Response;
+import org.apache.logging.log4j.util.Strings;
+import org.springframework.core.io.FileSystemResource;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.annotation.Resource;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 鍥炲崟琛�(Receipt)琛ㄦ湇鍔″疄鐜扮被
+ *
+ * @author zss
+ * @since 2023-08-11 10:08:55
+ */
+@Service
+public class ReceiptServiceImpl extends ServiceImpl<ReceiptMapper, Receipt> implements ReceiptService {
+
+ @Resource
+ ReceiptMapper receiptMapper;
+
+ //鏌ヨ鍥炲崟鍒楄〃
+ @Override
+ public IPage<Map<String, Object>> selectAllRece(Page<Object> page, String name, String orderCode, String type, String deliverTime) {
+ return receiptMapper.selectAllRece(page, name, orderCode, type, deliverTime);
+ }
+
+ //鏍规嵁id鍒犻櫎
+ @Override
+ public void delRece(Integer id) {
+ Receipt receipt = receiptMapper.selectById(id);
+ receipt.setState(0);
+ receiptMapper.updateById(receipt);
+ }
+
+ //鎵归噺鍒犻櫎
+ @Override
+ public void delAllRece(List<Integer> ids) {
+ List<Receipt> receipts = receiptMapper.selectBatchIds(ids);
+ for (Receipt receipt : receipts) {
+ receipt.setState(0);
+ receiptMapper.updateById(receipt);
+ }
+ }
+
+ //涓婁紶闄勪欢淇敼鐘舵��
+ @Override
+ public void updRece(Integer id, MultipartFile file) {
+ if (ObjectUtils.isNotEmpty(file)) {
+ Receipt receipt = receiptMapper.selectById(id);
+ receipt.setUrl(FileSaveUtil.StoreFile(file));
+ receipt.setType(1);
+ receiptMapper.updateById(receipt);
+ }
+ }
+
+ //鏍规嵁id鏌ョ湅鍥炲崟鐓х墖
+ @Override
+ public ResponseEntity<byte[]> selReceDatil(Integer id) throws IOException {
+ String url = receiptMapper.selectById(id).getUrl();
+ String path = "D:\\webapp\\images\\" + url;
+ //鑾峰彇鍥剧墖鏍煎紡鍚庣紑鍚�
+ String extension = getImageExtension(url);
+ // 璇诲彇鏈湴鍥剧墖鏂囦欢锛屽苟灏嗗叾杞崲涓哄瓧鑺傛暟缁�
+ FileSystemResource imageResource = new FileSystemResource(path);
+ byte[] bytes = Files.readAllBytes(imageResource.getFile().toPath());
+ // 璁剧疆HTTP澶翠俊鎭紝鍛婅瘔娴忚鍣ㄨ繑鍥炵殑鏄浘鐗囨暟鎹�
+ HttpHeaders headers = new HttpHeaders();
+ headers.setContentType(new MediaType("image", extension));
+ return new ResponseEntity<>(bytes, headers, HttpStatus.OK);
+ }
+
+ private String getImageExtension(String imageName) {
+ // 鏍规嵁鍥剧墖鏂囦欢鍚嶈幏鍙栨墿灞曞悕
+ int dotIndex = imageName.lastIndexOf('.');
+ if (dotIndex > 0 && dotIndex < imageName.length() - 1) {
+ return imageName.substring(dotIndex + 1);
+ }
+ return null;
+ }
+}
+
diff --git a/inventory-server/src/main/resources/mapper/ConsignmentMapper.xml b/inventory-server/src/main/resources/mapper/ConsignmentMapper.xml
index ccc21e2..ef52f7a 100644
--- a/inventory-server/src/main/resources/mapper/ConsignmentMapper.xml
+++ b/inventory-server/src/main/resources/mapper/ConsignmentMapper.xml
@@ -2,6 +2,32 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yuanchu.mom.mapper.ConsignmentMapper">
<select id="selectAll" resultType="com.yuanchu.mom.pojo.Consignment">
- select * from mom_ocean.consignment where state=1
+ select *
+ from mom_ocean.consignment
+ where state = 1
+ </select>
+ <select id="selectAllCon" resultType="java.util.Map">
+ select id,
+ name,
+ specifications,
+ code,
+ customer_code,
+ unit,
+ number,
+ check_name,
+ fit_name,
+ user_name
+ from mom_ocean.consignment
+ where state=1
+ <if test="name!=null and name!=''">
+ and name like concat('%',#{name},'%')
+ </if>
+ <if test="specifications!=null and specifications!=''">
+ and specifications like concat('%',#{specifications},'%')
+ </if>
+ <if test="time!=null and time!=''">
+ and DATE_FORMAT(create_time, '%Y-%m-%d')=#{time}
+ </if>
+ order by id desc
</select>
</mapper>
\ No newline at end of file
diff --git a/inventory-server/src/main/resources/mapper/ImportRepertoryMapper.xml b/inventory-server/src/main/resources/mapper/ImportRepertoryMapper.xml
index 2c7fd0e..56f10b8 100644
--- a/inventory-server/src/main/resources/mapper/ImportRepertoryMapper.xml
+++ b/inventory-server/src/main/resources/mapper/ImportRepertoryMapper.xml
@@ -22,5 +22,6 @@
<if test="time!=null and time!=''">
and create_time=#{time}
</if>
+ order by id desc
</select>
</mapper>
\ No newline at end of file
diff --git a/inventory-server/src/main/resources/mapper/ReceiptMapper.xml b/inventory-server/src/main/resources/mapper/ReceiptMapper.xml
new file mode 100644
index 0000000..32b4bfd
--- /dev/null
+++ b/inventory-server/src/main/resources/mapper/ReceiptMapper.xml
@@ -0,0 +1,32 @@
+<?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.yuanchu.mom.mapper.ReceiptMapper">
+ <select id="selectAllRece" resultType="java.util.Map">
+ select id,
+ order_code,
+ customer_code,
+ proname,
+ adress,
+ name,
+ phone,
+ escort_code,
+ DATE_FORMAT(deliver_time,'%Y-%m-%d'),
+ user_name,
+ type
+ from mom_ocean.receipt
+ where state=1
+ <if test="name!=null and name!=''">
+ and name like concat('%',#{name},'%')
+ </if>
+ <if test="orderCode!=null and orderCode!=''">
+ and order_code like concat('%',#{orderCode},'%')
+ </if>
+ <if test="type!=null and type!=''">
+ and type=#{type}
+ </if>
+ <if test="deliverTime!=null and deliverTime!=''">
+ and deliver_time=#{deliverTime}
+ </if>
+ order by id desc
+ </select>
+</mapper>
\ No newline at end of file
diff --git a/inventory-server/src/main/resources/mapper/RepertoryMapper.xml b/inventory-server/src/main/resources/mapper/RepertoryMapper.xml
index b556cba..3172d85 100644
--- a/inventory-server/src/main/resources/mapper/RepertoryMapper.xml
+++ b/inventory-server/src/main/resources/mapper/RepertoryMapper.xml
@@ -28,6 +28,7 @@
<if test="checkState!=null and checkState!=''">
and check_state=#{checkState}
</if>
+ order by id desc
</where>
</select>
</mapper>
\ No newline at end of file
diff --git a/sale-server/src/main/resources/mapper/SaleMapper.xml b/sale-server/src/main/resources/mapper/SaleMapper.xml
index 91951ff..f530a91 100644
--- a/sale-server/src/main/resources/mapper/SaleMapper.xml
+++ b/sale-server/src/main/resources/mapper/SaleMapper.xml
@@ -10,21 +10,19 @@
type,
DATE_FORMAT(delTime, '%Y-%m-%d') '浜よ揣鏃ユ湡'
from mom_ocean.sale
- <where>
- state=1
- <if test="orderNumber!=null and orderNumber!=''">
- and order_number LIKE CONCAT('%',#{orderNumber},'%')
- </if>
- <if test="name!=null and name!=''">
- and name LIKE CONCAT('%',#{name},'%')
- </if>
- <if test="type!=null and type!=''">
- and type=#{type}
- </if>
- <if test="delTime!=null and delTime!=''">
- and DATE_FORMAT(delTime, '%Y-%m-%d')=#{delTime}
- </if>
- </where>
+ where state=1
+ <if test="orderNumber!=null and orderNumber!=''">
+ and order_number like concat('%',#{orderNumber},'%')
+ </if>
+ <if test="name!=null and name!=''">
+ and name LIKE CONCAT('%',#{name},'%')
+ </if>
+ <if test="type!=null and type!=''">
+ and type=#{type}
+ </if>
+ <if test="delTime!=null and delTime!=''">
+ and DATE_FORMAT(delTime, '%Y-%m-%d')=#{delTime}
+ </if>
+ order by id desc
</select>
-
</mapper>
diff --git a/standard-server/src/main/resources/mapper/OrdersMapper.xml b/standard-server/src/main/resources/mapper/OrdersMapper.xml
index ea3942f..f9aaada 100644
--- a/standard-server/src/main/resources/mapper/OrdersMapper.xml
+++ b/standard-server/src/main/resources/mapper/OrdersMapper.xml
@@ -2,7 +2,8 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yuanchu.mom.mapper.OrdersMapper">
<select id="selectAllOrder" resultType="java.util.Map">
- select order_code,
+ select o.id,
+ order_code,
department,
province,
salesman,
@@ -31,6 +32,6 @@
</if>
and o.code=m.code
</where>
- order by o.create_time desc
+ order by o.id desc
</select>
</mapper>
\ No newline at end of file
diff --git a/system-run/src/main/java/com/yuanchu/mom/SystemRunApplication.java b/system-run/src/main/java/com/yuanchu/mom/SystemRunApplication.java
index 4747d6e..e38aeea 100644
--- a/system-run/src/main/java/com/yuanchu/mom/SystemRunApplication.java
+++ b/system-run/src/main/java/com/yuanchu/mom/SystemRunApplication.java
@@ -2,6 +2,7 @@
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
diff --git a/system-run/src/main/resources/application-dev.yml b/system-run/src/main/resources/application-dev.yml
index c36cec2..ac77d34 100644
--- a/system-run/src/main/resources/application-dev.yml
+++ b/system-run/src/main/resources/application-dev.yml
@@ -18,7 +18,9 @@
# 鐓х墖瀛樺偍璺緞+++++++++++++++++++++++++++杩愮淮闇�瑕侀厤缃�+++++++++++++++++++++++++++
file:
- path: E:/webapp/images
+ path: D:/webapp/images
+ # 涓婁紶鏂囦欢鍏佽鐨勬墿灞曞悕
+ allowed: png,jpg,jpeg,gif
mybatis-plus:
type-aliases-package: com.yuanchu.mom.pojo
diff --git a/system-run/src/main/resources/application.yml b/system-run/src/main/resources/application.yml
index 696df2f..fe0e329 100644
--- a/system-run/src/main/resources/application.yml
+++ b/system-run/src/main/resources/application.yml
@@ -3,6 +3,10 @@
spring:
profiles:
active: dev
+ servlet:
+ multipart:
+ max-file-size: 20MB # 鍗曚釜鏂囦欢澶у皬
+ max-request-size: 1024MB # 涓�娆¤姹傛枃浠舵�诲ぇ灏�
mybatis-plus:
type-aliases-package: com.yuanchu.mom.pojo
--
Gitblit v1.9.3