From 48269d19a8cdec7eb614c446205d650987f11bc3 Mon Sep 17 00:00:00 2001
From: "liang.chao" <1360241448@qq.com>
Date: Fri, 13 Dec 2024 14:12:30 +0800
Subject: [PATCH 1/6] =?UTF-8?q?=E7=A7=9F=E8=B5=81=E5=8D=8F=E8=AE=AE?=
=?UTF-8?q?=E6=9F=A5=E7=9C=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
bonus-modules/bonus-material-mall/pom.xml | 8 +++
.../material/contract/domain/BmContract.java | 4 +-
.../order/controller/OrderController.java | 67 ++++++++++++++++++-
.../material/order/mapper/OrderMapper.java | 2 +
.../material/order/service/OrderService.java | 2 +
.../order/service/impl/OrderServiceImpl.java | 7 +-
.../mapper/material/order/OrderInfoMapper.xml | 23 +++++++
7 files changed, 106 insertions(+), 7 deletions(-)
diff --git a/bonus-modules/bonus-material-mall/pom.xml b/bonus-modules/bonus-material-mall/pom.xml
index 15c15e8..72546d3 100644
--- a/bonus-modules/bonus-material-mall/pom.xml
+++ b/bonus-modules/bonus-material-mall/pom.xml
@@ -106,6 +106,14 @@
test
+
+
+
+ org.apache.poi
+ poi-ooxml
+ 5.2.3
+
+
diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/contract/domain/BmContract.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/contract/domain/BmContract.java
index b84d748..d1bbd92 100644
--- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/contract/domain/BmContract.java
+++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/contract/domain/BmContract.java
@@ -27,11 +27,11 @@ public class BmContract {
private Integer status;
@ApiModelProperty(value = "创建时间")
- @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
@ApiModelProperty(value = "修改时间")
- @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime;
@ApiModelProperty(value = "用户id")
diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/controller/OrderController.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/controller/OrderController.java
index f5de88a..5caa1bb 100644
--- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/controller/OrderController.java
+++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/controller/OrderController.java
@@ -16,10 +16,21 @@ import com.bonus.material.order.service.OrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.xwpf.usermodel.IBodyElement;
+import org.apache.poi.xwpf.usermodel.XWPFDocument;
+import org.apache.poi.xwpf.usermodel.XWPFParagraph;
+import org.apache.poi.xwpf.usermodel.XWPFRun;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
import java.util.List;
+import java.util.Map;
/**
* @Author:liang.chao
@@ -110,9 +121,9 @@ public class OrderController extends BaseController {
if (dtos.size() > 0 && CollectionUtil.isNotEmpty(dtos)) {
for (OrderDetailDto dto : dtos) {
// if ("0".equals(dto.getManageType())) {
- // 编码设备已取消的继续上架
- dto.setMaStatus(MaStatusEnum.LISTING.getCode().toString());
- orderMapper.updateDeviceStatus(dto);
+ // 编码设备已取消的继续上架
+ dto.setMaStatus(MaStatusEnum.LISTING.getCode().toString());
+ orderMapper.updateDeviceStatus(dto);
/* } else {
// 数量设备已退租的增加库存
orderMapper.updateAddDevCount(dto);
@@ -141,4 +152,54 @@ public class OrderController extends BaseController {
return error("发起减免失败");
}
}
+
+ @ApiOperation(value = "租赁协议(查看)")
+ @PostMapping("/leaseAgreement")
+ public ResponseEntity getleaseAgreement(@RequestParam("file") MultipartFile file,
+ @RequestParam("orderId") String orderId,
+ @RequestParam Map replacements) {
+ // 根据orderId获取订单信息
+ OrderInfoDto orderInfoDto = orderService.getAgreementByOrderId(orderId);
+ try (XWPFDocument document = new XWPFDocument(file.getInputStream())) {
+ // 准备替换的占位符及其对应值
+ //订单日期
+ replacements.put("${orderTime}", orderInfoDto.getOrderTime().toString());
+ //装备所属公司
+ replacements.put("${czcompanyName}", orderInfoDto.getCzcompanyName());
+ //承租方所属公司
+ replacements.put("${companyName}", orderInfoDto.getCompanyName());
+ //订单金额
+ replacements.put("${cost}", orderInfoDto.getCost().toString());
+ // 可根据需求添加更多占位符及替换值
+
+ // 遍历文档中的段落,进行占位符替换
+ for (IBodyElement element : document.getBodyElements()) {
+ if (element instanceof XWPFParagraph) {
+ XWPFParagraph paragraph = (XWPFParagraph) element;
+ for (XWPFRun run : paragraph.getRuns()) {
+ String text = run.getText(0);
+ if (text != null) {
+ for (Map.Entry entry : replacements.entrySet()) {
+ text = text.replace(entry.getKey(), entry.getValue());
+ }
+ run.setText(text, 0);
+ }
+ }
+ }
+ }
+
+ // 将修改后的文档写入字节数组输出流
+ ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+ document.write(byteArrayOutputStream);
+
+ // 将字节数组转换为字符串(仅用于演示,实际应提供文件下载)
+ String content = byteArrayOutputStream.toString("UTF-8");
+ // 注意:对于大文件,不建议将内容作为字符串返回。应提供下载链接或二进制文件响应。
+
+ return ResponseEntity.ok(content);
+ } catch (IOException e) {
+ e.printStackTrace();
+ return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error processing file");
+ }
+ }
}
diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/mapper/OrderMapper.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/mapper/OrderMapper.java
index 3615ebf..e9dd9cd 100644
--- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/mapper/OrderMapper.java
+++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/mapper/OrderMapper.java
@@ -43,4 +43,6 @@ public interface OrderMapper {
int deleteCostReliefs(@Param("orderId") Integer orderId);
int insertCostReliefs(@Param("list") List reliefList);
+
+ OrderInfoDto getAgreementByOrderId(String orderId);
}
diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/service/OrderService.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/service/OrderService.java
index ba13eba..6778895 100644
--- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/service/OrderService.java
+++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/service/OrderService.java
@@ -19,4 +19,6 @@ public interface OrderService {
OrderInfoDto getOrderDetailsById(OrderDetailDto dto) throws Exception;
Integer submitCostRelief(OrderInfoDto orderInfoDto);
+
+ OrderInfoDto getAgreementByOrderId(String orderId);
}
diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/service/impl/OrderServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/service/impl/OrderServiceImpl.java
index 2fd6ca4..3c459ca 100644
--- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/service/impl/OrderServiceImpl.java
+++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/service/impl/OrderServiceImpl.java
@@ -106,8 +106,6 @@ public class OrderServiceImpl implements OrderService {
if (minOrderStatus.isPresent()) {
dto.setOrderStatus(minOrderStatus.get().getOrderStatus());
}
- dto.setStartTime(list.get(0).getRentBeginTime());
- dto.setEndTime(list.get(0).getRentEndTime());
//根据订单id去lease_repair_record表中查询是否已填写退租检修信息
int count = mapper.selectLeaseContent(String.valueOf(dto.getOrderId()));
if (count > 0) {
@@ -144,4 +142,9 @@ public class OrderServiceImpl implements OrderService {
}
return 0;
}
+
+ @Override
+ public OrderInfoDto getAgreementByOrderId(String orderId) {
+ return orderMapper.getAgreementByOrderId(orderId);
+ }
}
diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/order/OrderInfoMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/order/OrderInfoMapper.xml
index 02a8cbf..039ceef 100644
--- a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/order/OrderInfoMapper.xml
+++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/order/OrderInfoMapper.xml
@@ -271,6 +271,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE
mt.del_flag = 0 and hh.order_id = #{orderId}
+
delete from ma_order_details_relief
From 512b95fddd2563ff0ad4d569be4b9719b9a292b8 Mon Sep 17 00:00:00 2001
From: "liang.chao" <1360241448@qq.com>
Date: Fri, 13 Dec 2024 14:34:22 +0800
Subject: [PATCH 2/6] =?UTF-8?q?=E5=90=88=E5=90=8C=E7=AE=A1=E7=90=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../java/com/bonus/material/contract/domain/BmContract.java | 3 +++
.../bonus/material/order/controller/OrderController.java | 1 -
.../resources/mapper/material/contract/BmContractMapper.xml | 6 +++++-
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/contract/domain/BmContract.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/contract/domain/BmContract.java
index d1bbd92..a498d84 100644
--- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/contract/domain/BmContract.java
+++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/contract/domain/BmContract.java
@@ -40,6 +40,9 @@ public class BmContract {
@ApiModelProperty(value = "用户所属公司")
private Long ownerCom;
+ private String startTime;
+ private String endTime;
+
@ApiModelProperty(value = "文件附件")
private List bmFileInfoList;
}
diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/controller/OrderController.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/controller/OrderController.java
index 5caa1bb..018a388 100644
--- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/controller/OrderController.java
+++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/controller/OrderController.java
@@ -170,7 +170,6 @@ public class OrderController extends BaseController {
replacements.put("${companyName}", orderInfoDto.getCompanyName());
//订单金额
replacements.put("${cost}", orderInfoDto.getCost().toString());
- // 可根据需求添加更多占位符及替换值
// 遍历文档中的段落,进行占位符替换
for (IBodyElement element : document.getBodyElements()) {
diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/contract/BmContractMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/contract/BmContractMapper.xml
index e81efc4..13887f5 100644
--- a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/contract/BmContractMapper.xml
+++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/contract/BmContractMapper.xml
@@ -9,7 +9,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update bm_contract set
- contract_name = #{contractName},
+ contract_name = #{contractName},
+ status = #{status},
owner_id = #{ownerId},
owner_com = #{ownerCom},
update_time = now()
@@ -29,6 +30,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and contract_name like concat('%', #{contractName}, '%')
+
+ AND update_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
+
and status = #{status}
From 44191194b3e3f389cb247a53f9090e2c2cc1fccb Mon Sep 17 00:00:00 2001
From: "liang.chao" <1360241448@qq.com>
Date: Fri, 13 Dec 2024 15:50:13 +0800
Subject: [PATCH 3/6] =?UTF-8?q?=E5=90=88=E5=90=8C=E7=AE=A1=E7=90=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../order/controller/OrderController.java | 106 +++++++++++-------
1 file changed, 63 insertions(+), 43 deletions(-)
diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/controller/OrderController.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/controller/OrderController.java
index 018a388..a1b2d6d 100644
--- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/controller/OrderController.java
+++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/controller/OrderController.java
@@ -8,6 +8,8 @@ import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.core.web.page.TableDataInfo;
import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.material.book.domain.BookCarInfoDto;
+import com.bonus.material.contract.domain.BmContract;
+import com.bonus.material.contract.service.BmContractService;
import com.bonus.material.order.domain.OrderDetailCostReliefDto;
import com.bonus.material.order.domain.OrderDetailDto;
import com.bonus.material.order.domain.OrderInfoDto;
@@ -16,19 +18,24 @@ import com.bonus.material.order.service.OrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
-import org.apache.poi.xwpf.usermodel.IBodyElement;
-import org.apache.poi.xwpf.usermodel.XWPFDocument;
-import org.apache.poi.xwpf.usermodel.XWPFParagraph;
-import org.apache.poi.xwpf.usermodel.XWPFRun;
+import org.apache.poi.xwpf.usermodel.*;
+import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
+import org.springframework.web.client.RestTemplate;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
+import javax.imageio.ImageIO;
+import java.awt.*;
+import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
import java.util.List;
import java.util.Map;
@@ -48,6 +55,9 @@ public class OrderController extends BaseController {
@Resource
private OrderMapper orderMapper;
+ @Resource
+ private BmContractService bmContractService;
+
/**
* 提交预约车到订单
*/
@@ -154,51 +164,61 @@ public class OrderController extends BaseController {
}
@ApiOperation(value = "租赁协议(查看)")
- @PostMapping("/leaseAgreement")
- public ResponseEntity getleaseAgreement(@RequestParam("file") MultipartFile file,
- @RequestParam("orderId") String orderId,
- @RequestParam Map replacements) {
- // 根据orderId获取订单信息
+ @GetMapping("/leaseAgreement")
+ public ResponseEntity getleaseAgreement(String orderId,
+ Map replacements) throws IOException {
OrderInfoDto orderInfoDto = orderService.getAgreementByOrderId(orderId);
- try (XWPFDocument document = new XWPFDocument(file.getInputStream())) {
- // 准备替换的占位符及其对应值
- //订单日期
- replacements.put("${orderTime}", orderInfoDto.getOrderTime().toString());
- //装备所属公司
- replacements.put("${czcompanyName}", orderInfoDto.getCzcompanyName());
- //承租方所属公司
- replacements.put("${companyName}", orderInfoDto.getCompanyName());
- //订单金额
- replacements.put("${cost}", orderInfoDto.getCost().toString());
+ BmContract bmContract = new BmContract();
+ bmContract.setStatus(1);
+ List list = bmContractService.list(bmContract);
+ String wordUrl = list.get(0).getBmFileInfoList().get(0).getFileUrl();
+ RestTemplate restTemplate = new RestTemplate();
+ InputStream inputStream = restTemplate.getForObject(wordUrl, InputStream.class);
- // 遍历文档中的段落,进行占位符替换
- for (IBodyElement element : document.getBodyElements()) {
- if (element instanceof XWPFParagraph) {
- XWPFParagraph paragraph = (XWPFParagraph) element;
- for (XWPFRun run : paragraph.getRuns()) {
- String text = run.getText(0);
- if (text != null) {
- for (Map.Entry entry : replacements.entrySet()) {
- text = text.replace(entry.getKey(), entry.getValue());
- }
- run.setText(text, 0);
+ XWPFDocument document = new XWPFDocument(inputStream);
+ //订单日期
+ replacements.put("${orderTime}", orderInfoDto.getOrderTime().toString());
+ //装备所属公司
+ replacements.put("${czcompanyName}", orderInfoDto.getCzcompanyName());
+ //承租方所属公司
+ replacements.put("${companyName}", orderInfoDto.getCompanyName());
+ //订单金额
+ replacements.put("${cost}", orderInfoDto.getCost().toString());
+
+ for (IBodyElement element : document.getBodyElements()) {
+ if (element instanceof XWPFParagraph) {
+ XWPFParagraph paragraph = (XWPFParagraph) element;
+ for (XWPFRun run : paragraph.getRuns()) {
+ String text = run.getText(0);
+ if (text != null) {
+ for (Map.Entry entry : replacements.entrySet()) {
+ text = text.replace(entry.getKey(), entry.getValue());
}
+ run.setText(text, 0);
}
}
}
-
- // 将修改后的文档写入字节数组输出流
- ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
- document.write(byteArrayOutputStream);
-
- // 将字节数组转换为字符串(仅用于演示,实际应提供文件下载)
- String content = byteArrayOutputStream.toString("UTF-8");
- // 注意:对于大文件,不建议将内容作为字符串返回。应提供下载链接或二进制文件响应。
-
- return ResponseEntity.ok(content);
- } catch (IOException e) {
- e.printStackTrace();
- return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error processing file");
}
+
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+ document.write(outputStream);
+ byte[] wordBytes = outputStream.toByteArray();
+
+ // Convert Word to Image (simple example using BufferedImage)
+ BufferedImage image = new BufferedImage(800, 600, BufferedImage.TYPE_INT_RGB);
+ Graphics2D graphics = image.createGraphics();
+ graphics.setPaint(Color.white);
+ graphics.fillRect(0, 0, image.getWidth(), image.getHeight());
+ graphics.setPaint(Color.black);
+ graphics.drawString(new String(wordBytes), 10, 20);
+ graphics.dispose();
+
+ ByteArrayOutputStream imageOutputStream = new ByteArrayOutputStream();
+ ImageIO.write(image, "png", imageOutputStream);
+ byte[] imageBytes = imageOutputStream.toByteArray();
+
+ HttpHeaders headers = new HttpHeaders();
+ headers.setContentType(MediaType.IMAGE_PNG);
+ return ResponseEntity.ok().headers(headers).body(imageBytes);
}
}
From 3ef1f515842fbbb8f6c22dbd2e7825494d518798 Mon Sep 17 00:00:00 2001
From: "liang.chao" <1360241448@qq.com>
Date: Fri, 13 Dec 2024 17:09:37 +0800
Subject: [PATCH 4/6] =?UTF-8?q?=E7=A7=9F=E8=B5=81=E5=8D=8F=E8=AE=AE?=
=?UTF-8?q?=E4=BB=A5=E5=8F=8A=E6=95=B0=E6=8D=AE=E9=9A=94=E7=A6=BB?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../com/bonus/material/device/domain/MaDevQc.java | 3 +++
.../material/device/domain/SafeBookInfo.java | 3 +++
.../device/service/impl/MaDevQcServiceImpl.java | 2 ++
.../device/service/impl/SafeBookServiceImpl.java | 2 ++
.../order/controller/OrderController.java | 15 ++++++++-------
.../mapper/material/device/MaDevQcMapper.xml | 5 +++++
.../mapper/material/device/SafeBookMapper.xml | 5 +++--
7 files changed, 26 insertions(+), 9 deletions(-)
diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/domain/MaDevQc.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/domain/MaDevQc.java
index dacf63f..3a2b237 100644
--- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/domain/MaDevQc.java
+++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/domain/MaDevQc.java
@@ -66,6 +66,9 @@ public class MaDevQc extends BaseEntity implements Serializable {
@ApiModelProperty(value = "上传人")
private String nickName;
+ @ApiModelProperty(value = "创建人所属公司")
+ private String qcCom;
+
@ApiModelProperty(value = "质检次数")
private Integer minNum;
private Integer maxNum;
diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/domain/SafeBookInfo.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/domain/SafeBookInfo.java
index 9bdf66e..27f1297 100644
--- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/domain/SafeBookInfo.java
+++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/domain/SafeBookInfo.java
@@ -52,4 +52,7 @@ public class SafeBookInfo {
@ApiModelProperty(value = "上传人")
private String nickName;
+
+ @ApiModelProperty(value = "上传人所属公司")
+ private Integer uploadCom;
}
diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/impl/MaDevQcServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/impl/MaDevQcServiceImpl.java
index b62fcf0..e6f1d2c 100644
--- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/impl/MaDevQcServiceImpl.java
+++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/impl/MaDevQcServiceImpl.java
@@ -44,6 +44,7 @@ public class MaDevQcServiceImpl implements MaDevQcService {
*/
@Override
public List selectDevQcList(MaDevQc maDevQc) {
+ maDevQc.setQcCom(SecurityUtils.getLoginUser().getSysUser().getCompanyId().toString());
return maDevQcMapper.selectDevQcList(maDevQc);
}
@@ -62,6 +63,7 @@ public class MaDevQcServiceImpl implements MaDevQcService {
maDevQc.setQcCode(code);
maDevQc.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
maDevQc.setCreateTime(DateUtils.getNowDate());
+ maDevQc.setQcCom(SecurityUtils.getLoginUser().getSysUser().getCompanyId().toString());
int result = maDevQcMapper.insertDevQc(maDevQc);
devInfoMapper.updateDevInfoIsQc(maDevQc);
if (result > 0 && maDevQc.getId() != null) {
diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/impl/SafeBookServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/impl/SafeBookServiceImpl.java
index 153cd0c..60d203f 100644
--- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/impl/SafeBookServiceImpl.java
+++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/impl/SafeBookServiceImpl.java
@@ -37,6 +37,7 @@ public class SafeBookServiceImpl implements SafeBookService {
@Override
public List getSafeBookByMaId(SafeBookInfo safeBookInfo) {
+ safeBookInfo.setUploadCom(SecurityUtils.getLoginUser().getSysUser().getCompanyId().intValue());
return safeBookMapper.getSafeBookByMaId(safeBookInfo);
}
@@ -44,6 +45,7 @@ public class SafeBookServiceImpl implements SafeBookService {
public Integer addSafeBook(SafeBookInfo safeBookInfo) {
safeBookInfo.setCode(getString());
safeBookInfo.setUploadPerson(SecurityUtils.getLoginUser().getUserid());
+ safeBookInfo.setUploadCom(SecurityUtils.getLoginUser().getSysUser().getCompanyId().intValue());
Integer i = safeBookMapper.addSafeBook(safeBookInfo);
devInfoMapper.updateDevInfoIsSafeBook(safeBookInfo);
if (i > 0) {
diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/controller/OrderController.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/controller/OrderController.java
index a1b2d6d..87a3c85 100644
--- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/controller/OrderController.java
+++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/controller/OrderController.java
@@ -164,18 +164,19 @@ public class OrderController extends BaseController {
}
@ApiOperation(value = "租赁协议(查看)")
- @GetMapping("/leaseAgreement")
- public ResponseEntity getleaseAgreement(String orderId,
- Map replacements) throws IOException {
+ @PostMapping("/leaseAgreement")
+ public ResponseEntity getleaseAgreement(@RequestParam String orderId,
+ @RequestParam("file") MultipartFile file,
+ @RequestParam Map replacements) throws IOException {
OrderInfoDto orderInfoDto = orderService.getAgreementByOrderId(orderId);
- BmContract bmContract = new BmContract();
+ /* BmContract bmContract = new BmContract();
bmContract.setStatus(1);
List list = bmContractService.list(bmContract);
String wordUrl = list.get(0).getBmFileInfoList().get(0).getFileUrl();
- RestTemplate restTemplate = new RestTemplate();
- InputStream inputStream = restTemplate.getForObject(wordUrl, InputStream.class);
+ InputStream inputStream = new URL(wordUrl).openStream();
- XWPFDocument document = new XWPFDocument(inputStream);
+ XWPFDocument document = new XWPFDocument(inputStream);*/
+ XWPFDocument document = new XWPFDocument(file.getInputStream());
//订单日期
replacements.put("${orderTime}", orderInfoDto.getOrderTime().toString());
//装备所属公司
diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/MaDevQcMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/MaDevQcMapper.xml
index 07ef741..ede06ec 100644
--- a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/MaDevQcMapper.xml
+++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/MaDevQcMapper.xml
@@ -16,6 +16,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
qc_name,
qc_code,
qc_user,
+ qc_com,
qc_time,
create_by,
create_time,
@@ -25,6 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{qcName},
#{qcCode},
#{qcUser},
+ #{qcCom},
#{qcTime},
#{createBy},
#{createTime},
@@ -78,6 +80,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and DATE_FORMAT(m1.create_time,'%Y-%m-%d') between #{createStartTime} and #{createEndTime}
+
+ and m1.qc_com = #{qcCom}
+
diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/MaDevRmMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/MaDevRmMapper.xml
index d7267ec..dcbeb0a 100644
--- a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/MaDevRmMapper.xml
+++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/MaDevRmMapper.xml
@@ -18,6 +18,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
rm_time,
create_by,
create_time,
+ rm_com,
#{maId},
@@ -26,6 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{rmTime},
#{createBy},
#{createTime},
+ #{rmCom},
@@ -73,6 +75,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and DATE_FORMAT(m1.create_time,'%Y-%m-%d') between #{createStartTime} and #{createEndTime}
+
+ and m1.rm_com = #{rmCom}
+
+
+ update bm_contract set status = #{status} where id = #{id}
+
+
+ update bm_contract set status = 0 where owner_com = #{ownerCom} and id != #{id}
+
delete from bm_contract where id = #{id}