From b2f8320707dc72b2429bfb4fe0b317c11b1e5b7f Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期四, 29 十月 2026 16:34:45 +0800
Subject: [PATCH] change
---
src/main/java/com/ruoyi/customerPortal/dto/ReviewSubmissionDto.java | 13
src/main/resources/mapper/sales/SalesLedgerMapper.xml | 14
src/main/java/com/ruoyi/basic/pojo/Customer.java | 6
src/main/java/com/ruoyi/purchase/pojo/PurchaseLedgerSimple.java | 122 +++++
src/main/java/com/ruoyi/sales/pojo/SalesLedger.java | 10
src/main/java/com/ruoyi/purchase/mapper/PurchaseLedgerSimpleMapper.java | 12
src/main/java/com/ruoyi/basic/pojo/CustomerFinancialReport.java | 98 ++++
src/main/java/com/ruoyi/basic/service/impl/CustomerServiceImpl.java | 61 +
src/main/java/com/ruoyi/customerPortal/service/CustomerSubmissionService.java | 165 +++++++
src/main/java/com/ruoyi/customerPortal/controller/CustomerSubmissionController.java | 49 ++
src/main/java/com/ruoyi/basic/controller/CustomerFinancialReportController.java | 86 +++
src/main/java/com/ruoyi/basic/service/CustomerFinancialReportService.java | 264 ++++++++++++
src/main/java/com/ruoyi/customerPortal/pojo/CustomerSubmission.java | 45 ++
src/main/java/com/ruoyi/sales/service/BusinessApprovalService.java | 124 +++++
src/main/resources/mapper/projectManagement/InfoMapper.xml | 1
src/main/resources/application-dev.yml | 4
src/main/java/com/ruoyi/sales/dto/BusinessReviewDto.java | 11
src/main/java/com/ruoyi/customerPortal/mapper/CustomerSubmissionMapper.java | 7
src/main/java/com/ruoyi/basic/mapper/CustomerFinancialReportMapper.java | 7
src/main/java/com/ruoyi/basic/controller/CustomerController.java | 8
src/main/java/com/ruoyi/projectManagement/dto/SaveInfoDto.java | 3
src/main/java/com/ruoyi/sales/controller/BusinessApprovalController.java | 33 +
src/main/java/com/ruoyi/purchase/controller/PurchaseLedgerSimpleController.java | 134 ++++++
src/main/java/com/ruoyi/projectManagement/pojo/Info.java | 6
src/main/java/com/ruoyi/basic/enums/RecordTypeEnum.java | 1
25 files changed, 1,263 insertions(+), 21 deletions(-)
diff --git a/src/main/java/com/ruoyi/basic/controller/CustomerController.java b/src/main/java/com/ruoyi/basic/controller/CustomerController.java
index 2130007..9d4ff0c 100644
--- a/src/main/java/com/ruoyi/basic/controller/CustomerController.java
+++ b/src/main/java/com/ruoyi/basic/controller/CustomerController.java
@@ -13,6 +13,7 @@
import com.ruoyi.framework.web.domain.R;
import jakarta.servlet.http.HttpServletResponse;
import lombok.AllArgsConstructor;
+import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@@ -43,6 +44,7 @@
* 瀵煎嚭瀹㈡埛妗f鍒楄〃
*/
@Log(title = "瀹㈡埛妗f", businessType = BusinessType.EXPORT)
+ @PreAuthorize("@ss.hasPermi('basic:customer:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, CustomerDto customer) {
ExcelUtil<CustomerVo> util = new ExcelUtil<CustomerVo>(CustomerVo.class);
@@ -50,6 +52,7 @@
}
@PostMapping("/downloadTemplate")
+ @PreAuthorize("@ss.hasPermi('basic:customer:import')")
@Log(title = "瀹㈡埛妗f-涓嬭浇妯℃澘", businessType = BusinessType.EXPORT)
public void downloadTemplate(HttpServletResponse response) {
ExcelUtil<Customer> util = new ExcelUtil<Customer>(Customer.class);
@@ -61,6 +64,7 @@
* 瀵煎叆瀹㈡埛妗f
*/
@Log(title = "瀹㈡埛妗f", businessType = BusinessType.IMPORT)
+ @PreAuthorize("@ss.hasPermi('basic:customer:import')")
@PostMapping("/importData")
public R importData(MultipartFile file, Integer type) throws Exception {
@@ -71,6 +75,7 @@
* 鑾峰彇瀹㈡埛妗f璇︾粏淇℃伅
*/
@GetMapping(value = "/{id}")
+ @PreAuthorize("@ss.hasPermi('basic:customer:query')")
public R getInfo(@PathVariable("id") Long id) {
return R.ok(customerService.selectCustomerDetailById(id));
}
@@ -79,6 +84,7 @@
* 鏂板瀹㈡埛妗f
*/
@Log(title = "瀹㈡埛妗f", businessType = BusinessType.INSERT)
+ @PreAuthorize("@ss.hasPermi('basic:customer:add')")
@PostMapping("/addCustomer")
public R add(@RequestBody Customer customer) {
return R.ok(customerService.insertCustomer(customer));
@@ -88,6 +94,7 @@
* 淇敼瀹㈡埛妗f
*/
@Log(title = "瀹㈡埛妗f", businessType = BusinessType.UPDATE)
+ @PreAuthorize("@ss.hasPermi('basic:customer:edit')")
@PostMapping("/updateCustomer")
public R edit(@RequestBody Customer customer) {
return R.ok(customerService.updateCustomer(customer));
@@ -97,6 +104,7 @@
* 鍒犻櫎瀹㈡埛妗f
*/
@Log(title = "瀹㈡埛妗f", businessType = BusinessType.DELETE)
+ @PreAuthorize("@ss.hasPermi('basic:customer:remove')")
@DeleteMapping("/delCustomer")
public R remove(@RequestBody Long[] ids) {
if (ids == null || ids.length == 0) {
diff --git a/src/main/java/com/ruoyi/basic/controller/CustomerFinancialReportController.java b/src/main/java/com/ruoyi/basic/controller/CustomerFinancialReportController.java
new file mode 100644
index 0000000..46acfc5
--- /dev/null
+++ b/src/main/java/com/ruoyi/basic/controller/CustomerFinancialReportController.java
@@ -0,0 +1,86 @@
+package com.ruoyi.basic.controller;
+
+import com.ruoyi.basic.pojo.CustomerFinancialReport;
+import com.ruoyi.basic.service.CustomerFinancialReportService;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.web.domain.AjaxResult;
+import io.swagger.v3.oas.annotations.Operation;
+import lombok.AllArgsConstructor;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * 瀹㈡埛杩�3骞磋储鍔℃姤琛�
+ */
+@RestController
+@RequestMapping("/basic/customerFinancialReport")
+@AllArgsConstructor
+public class CustomerFinancialReportController {
+ private final CustomerFinancialReportService customerFinancialReportService;
+
+ /**
+ * 鍚庡彴鎸夊鎴锋煡璇㈣繎3骞磋储鍔℃姤琛�
+ */
+ @Operation(summary = "鏌ヨ瀹㈡埛杩�3骞磋储鍔℃姤琛�")
+ @PreAuthorize("@ss.hasPermi('basic:customer:report')")
+ @GetMapping("/list")
+ public AjaxResult list(Long customerId) {
+ return AjaxResult.success(customerFinancialReportService.listByCustomer(customerId));
+ }
+
+ /**
+ * 瀹㈡埛璐﹀彿鏌ヨ鑷繁鐨勮繎3骞磋储鍔℃姤琛�
+ */
+ @Operation(summary = "鏌ヨ鎴戠殑璐㈠姟鎶ヨ〃")
+ @PreAuthorize("@ss.hasPermi('customer:report:mine')")
+ @GetMapping("/mine")
+ public AjaxResult mine() {
+ return AjaxResult.success(customerFinancialReportService.listMine());
+ }
+
+ /**
+ * 涓婁紶/淇敼璐㈠姟鎶ヨ〃
+ */
+ @Operation(summary = "涓婁紶璐㈠姟鎶ヨ〃")
+ @Log(title = "瀹㈡埛璐㈠姟鎶ヨ〃", businessType = BusinessType.UPDATE)
+ @PreAuthorize("@ss.hasPermi('basic:customer:report') or @ss.hasPermi('customer:report:mine')")
+ @PostMapping("/save")
+ public AjaxResult save(@RequestBody CustomerFinancialReport report) {
+ return AjaxResult.success(customerFinancialReportService.saveReport(report));
+ }
+
+ /**
+ * 鐢虫姤瀹℃壒鍒楄〃锛堝唴閮ㄤ汉鍛樻煡鐪嬫墍鏈夊鎴风殑鎻愪氦鎯呭喌锛�
+ */
+ @Operation(summary = "鐢虫姤瀹℃壒鍒楄〃")
+ @PreAuthorize("@ss.hasPermi('sales:report:audit')")
+ @GetMapping("/auditList")
+ public AjaxResult auditList(String customerName, Integer reportYear, Integer auditStatus) {
+ return AjaxResult.success(customerFinancialReportService.auditList(customerName, reportYear, auditStatus));
+ }
+
+ /**
+ * 瀹℃壒璐㈠姟鎶ヨ〃锛�1閫氳繃 2閫�鍥烇級
+ */
+ @Operation(summary = "瀹℃壒璐㈠姟鎶ヨ〃")
+ @Log(title = "瀹㈡埛璐㈠姟鎶ヨ〃", businessType = BusinessType.UPDATE)
+ @PreAuthorize("@ss.hasPermi('sales:report:audit')")
+ @PostMapping("/audit")
+ public AjaxResult audit(@RequestBody CustomerFinancialReport report) {
+ return AjaxResult.success(customerFinancialReportService.auditReport(
+ report.getId(), report.getAuditStatus(), report.getAuditRemark()));
+ }
+
+ /**
+ * 鍒犻櫎璐㈠姟鎶ヨ〃锛堝鎴疯处鍙蜂笉鍙垹闄わ級
+ */
+ @Operation(summary = "鍒犻櫎璐㈠姟鎶ヨ〃")
+ @Log(title = "瀹㈡埛璐㈠姟鎶ヨ〃", businessType = BusinessType.DELETE)
+ @PreAuthorize("@ss.hasPermi('basic:customer:report')")
+ @DeleteMapping("/{id}")
+ public AjaxResult remove(@PathVariable Long id) {
+ customerFinancialReportService.deleteReport(id);
+ return AjaxResult.success();
+ }
+}
diff --git a/src/main/java/com/ruoyi/basic/enums/RecordTypeEnum.java b/src/main/java/com/ruoyi/basic/enums/RecordTypeEnum.java
index b0c01bb..abf2371 100644
--- a/src/main/java/com/ruoyi/basic/enums/RecordTypeEnum.java
+++ b/src/main/java/com/ruoyi/basic/enums/RecordTypeEnum.java
@@ -87,6 +87,7 @@
PURCHASE_RETURN_ORDERS("purchase_return_orders"),
SALES_LEDGER_PRODUCT_TEMPLATE("sales_ledger_product_template"),
PURCHASE_LEDGER("purchase_ledger"),
+ PURCHASE_LEDGER_SIMPLE("purchase_ledger_simple"),
PURCHASE_LEDGER_TEMPLATE("purchase_ledger_template"),
// Project Management
SHIPPING_ADDRESS("shipping_address"),
diff --git a/src/main/java/com/ruoyi/basic/mapper/CustomerFinancialReportMapper.java b/src/main/java/com/ruoyi/basic/mapper/CustomerFinancialReportMapper.java
new file mode 100644
index 0000000..b8df6b0
--- /dev/null
+++ b/src/main/java/com/ruoyi/basic/mapper/CustomerFinancialReportMapper.java
@@ -0,0 +1,7 @@
+package com.ruoyi.basic.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.basic.pojo.CustomerFinancialReport;
+
+public interface CustomerFinancialReportMapper extends BaseMapper<CustomerFinancialReport> {
+}
diff --git a/src/main/java/com/ruoyi/basic/pojo/Customer.java b/src/main/java/com/ruoyi/basic/pojo/Customer.java
index 6a8e302..707d873 100644
--- a/src/main/java/com/ruoyi/basic/pojo/Customer.java
+++ b/src/main/java/com/ruoyi/basic/pojo/Customer.java
@@ -134,4 +134,10 @@
@Schema(description = "鏄惁琚垎閰嶏細0-鏈垎閰嶏紝1-宸插垎閰�")
private Integer isAssigned;
+
+ /**
+ * 缁戝畾鐨勭櫥褰曡处鍙穒d锛坈ustomer_user 涓�瀵逛竴缁戝畾锛岄潪瀹㈡埛琛ㄥ瓧娈碉級
+ */
+ @TableField(exist = false)
+ private Long bindUserId;
}
diff --git a/src/main/java/com/ruoyi/basic/pojo/CustomerFinancialReport.java b/src/main/java/com/ruoyi/basic/pojo/CustomerFinancialReport.java
new file mode 100644
index 0000000..6f68cb1
--- /dev/null
+++ b/src/main/java/com/ruoyi/basic/pojo/CustomerFinancialReport.java
@@ -0,0 +1,98 @@
+package com.ruoyi.basic.pojo;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * 瀹㈡埛杩�3骞磋储鍔℃姤琛�
+ *
+ * @author ruoyi
+ * @date 2026-10-29
+ */
+@TableName("customer_financial_report")
+@Data
+public class CustomerFinancialReport implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ @TableId(type = IdType.AUTO)
+ private Long id;
+
+ /**
+ * 瀹㈡埛id
+ */
+ private Long customerId;
+
+ /**
+ * 鎶ヨ〃骞村害
+ */
+ private Integer reportYear;
+
+ /**
+ * 鎶ヨ〃鍚嶇О
+ */
+ private String reportName;
+
+ /**
+ * 鎶ヨ〃闄勪欢锛圝SON鏁扮粍瀛楃涓诧級
+ */
+ private String reportFiles;
+
+ /**
+ * 瀹℃壒鐘舵�侊細0寰呭鎵� 1宸查�氳繃 2宸查��鍥�
+ */
+ private Integer auditStatus;
+
+ /**
+ * 瀹℃壒浜篿d
+ */
+ private Long auditUserId;
+
+ /**
+ * 瀹℃壒浜�
+ */
+ private String auditUserName;
+
+ /**
+ * 瀹℃壒鏃堕棿
+ */
+ private LocalDateTime auditTime;
+
+ /**
+ * 瀹℃壒鎰忚/閫�鍥炲師鍥�
+ */
+ private String auditRemark;
+
+ /**
+ * 涓婁紶浜篿d
+ */
+ private Long uploadUserId;
+
+ /**
+ * 涓婁紶浜�
+ */
+ private String uploadUserName;
+
+ @TableField(fill = FieldFill.INSERT)
+ private Long tenantId;
+
+ @TableField(fill = FieldFill.INSERT)
+ private Long deptId;
+
+ @TableField(fill = FieldFill.INSERT)
+ private LocalDateTime createTime;
+
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private LocalDateTime updateTime;
+
+ @Schema(description = "瀹㈡埛鍚嶇О")
+ @TableField(exist = false)
+ private String customerName;
+}
diff --git a/src/main/java/com/ruoyi/basic/service/CustomerFinancialReportService.java b/src/main/java/com/ruoyi/basic/service/CustomerFinancialReportService.java
new file mode 100644
index 0000000..7b67106
--- /dev/null
+++ b/src/main/java/com/ruoyi/basic/service/CustomerFinancialReportService.java
@@ -0,0 +1,264 @@
+package com.ruoyi.basic.service;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.ruoyi.basic.dto.StorageBlobVO;
+import com.ruoyi.basic.mapper.CustomerFinancialReportMapper;
+import com.ruoyi.basic.mapper.CustomerMapper;
+import com.ruoyi.basic.mapper.CustomerUserMapper;
+import com.ruoyi.basic.mapper.StorageBlobMapper;
+import com.ruoyi.basic.pojo.Customer;
+import com.ruoyi.basic.pojo.CustomerFinancialReport;
+import com.ruoyi.basic.pojo.CustomerUser;
+import com.ruoyi.basic.pojo.StorageBlob;
+import com.ruoyi.basic.utils.FileUtil;
+import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.framework.security.LoginUser;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.time.LocalDateTime;
+import java.time.Year;
+import java.util.List;
+import java.util.Objects;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+/**
+ * 瀹㈡埛杩�3骞磋储鍔℃姤琛⊿ervice
+ */
+@Service
+@RequiredArgsConstructor
+public class CustomerFinancialReportService extends ServiceImpl<CustomerFinancialReportMapper, CustomerFinancialReport> {
+ private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
+
+ private final CustomerMapper customerMapper;
+ private final CustomerUserMapper customerUserMapper;
+ private final StorageBlobMapper storageBlobMapper;
+ private final FileUtil fileUtil;
+
+ /**
+ * 鍚庡彴鎸夊鎴锋煡璇㈣繎3骞磋储鍔℃姤琛�
+ */
+ public List<CustomerFinancialReport> listByCustomer(Long customerId) {
+ if (customerId == null) {
+ throw new ServiceException("璇烽�夋嫨瀹㈡埛");
+ }
+ List<CustomerFinancialReport> reports = list(new LambdaQueryWrapper<CustomerFinancialReport>()
+ .eq(CustomerFinancialReport::getCustomerId, customerId)
+ .orderByDesc(CustomerFinancialReport::getReportYear));
+ refreshFileUrls(reports);
+ fillCustomerName(reports);
+ return reports;
+ }
+
+ /**
+ * 瀹㈡埛璐﹀彿鏌ヨ鑷繁鐨勮繎3骞磋储鍔℃姤琛�
+ */
+ public List<CustomerFinancialReport> listMine() {
+ Long customerId = currentCustomerId();
+ List<CustomerFinancialReport> reports = list(new LambdaQueryWrapper<CustomerFinancialReport>()
+ .eq(CustomerFinancialReport::getCustomerId, customerId)
+ .orderByDesc(CustomerFinancialReport::getReportYear));
+ refreshFileUrls(reports);
+ fillCustomerName(reports);
+ return reports;
+ }
+
+ /**
+ * 淇濆瓨璐㈠姟鎶ヨ〃锛氬悓涓�瀹㈡埛鍚屼竴骞村害浠呬繚鐣欎竴鏉★紝鍙弽澶嶈鐩栦慨鏀�
+ */
+ @Transactional(rollbackFor = Exception.class)
+ public CustomerFinancialReport saveReport(CustomerFinancialReport input) {
+ if (input.getReportYear() == null) {
+ throw new ServiceException("璇烽�夋嫨鎶ヨ〃骞村害");
+ }
+ int currentYear = Year.now().getValue();
+ if (input.getReportYear() < currentYear - 2 || input.getReportYear() > currentYear) {
+ throw new ServiceException("鍙兘涓婁紶鏈�杩戜笁涓勾搴︾殑璐㈠姟鎶ヨ〃");
+ }
+ if (StringUtils.isBlank(input.getReportFiles())) {
+ throw new ServiceException("璇蜂笂浼犺储鍔℃姤琛ㄩ檮浠�");
+ }
+
+ Long customerId;
+ if (isCustomerAccount()) {
+ customerId = currentCustomerId();
+ } else {
+ customerId = input.getCustomerId();
+ if (customerId == null || customerMapper.selectById(customerId) == null) {
+ throw new ServiceException("瀹㈡埛涓嶅瓨鍦�");
+ }
+ }
+
+ CustomerFinancialReport entity = getOne(new LambdaQueryWrapper<CustomerFinancialReport>()
+ .eq(CustomerFinancialReport::getCustomerId, customerId)
+ .eq(CustomerFinancialReport::getReportYear, input.getReportYear()), false);
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ if (entity == null) {
+ entity = new CustomerFinancialReport();
+ entity.setCustomerId(customerId);
+ entity.setReportYear(input.getReportYear());
+ }
+ entity.setReportName(input.getReportName());
+ entity.setReportFiles(input.getReportFiles());
+ // 閲嶆柊鎻愪氦鍚庡洖鍒板緟瀹℃壒鐘舵�侊紝绛夊緟鍐呴儴浜哄憳閲嶆柊瀹℃壒
+ entity.setAuditStatus(0);
+ entity.setAuditUserId(null);
+ entity.setAuditUserName(null);
+ entity.setAuditTime(null);
+ entity.setAuditRemark(null);
+ entity.setUploadUserId(loginUser.getUserId());
+ entity.setUploadUserName(loginUser.getNickName());
+ saveOrUpdate(entity);
+ return entity;
+ }
+
+ /**
+ * 鐢虫姤瀹℃壒鍒楄〃锛氬唴閮ㄤ汉鍛樻煡鐪嬫墍鏈夊鎴风殑鎻愪氦鎯呭喌
+ */
+ public List<CustomerFinancialReport> auditList(String customerName, Integer reportYear, Integer auditStatus) {
+ LambdaQueryWrapper<CustomerFinancialReport> wrapper = new LambdaQueryWrapper<CustomerFinancialReport>()
+ .eq(reportYear != null, CustomerFinancialReport::getReportYear, reportYear)
+ .eq(auditStatus != null, CustomerFinancialReport::getAuditStatus, auditStatus)
+ .orderByDesc(CustomerFinancialReport::getUpdateTime);
+ if (StringUtils.isNotBlank(customerName)) {
+ List<Long> customerIds = customerMapper.selectList(new LambdaQueryWrapper<Customer>()
+ .like(Customer::getCustomerName, customerName))
+ .stream().map(Customer::getId).filter(Objects::nonNull).collect(Collectors.toList());
+ if (customerIds.isEmpty()) {
+ return new java.util.ArrayList<>();
+ }
+ wrapper.in(CustomerFinancialReport::getCustomerId, customerIds);
+ }
+ List<CustomerFinancialReport> reports = list(wrapper);
+ refreshFileUrls(reports);
+ fillCustomerName(reports);
+ return reports;
+ }
+
+ /**
+ * 瀹℃壒璐㈠姟鎶ヨ〃锛�1閫氳繃 2閫�鍥�
+ */
+ @Transactional(rollbackFor = Exception.class)
+ public CustomerFinancialReport auditReport(Long id, Integer auditStatus, String auditRemark) {
+ if (isCustomerAccount()) {
+ throw new ServiceException("瀹㈡埛璐﹀彿鏃犳潈瀹℃壒璐㈠姟鎶ヨ〃");
+ }
+ if (id == null) {
+ throw new ServiceException("璇烽�夋嫨鐢虫姤璁板綍");
+ }
+ if (auditStatus == null || auditStatus != 1 && auditStatus != 2) {
+ throw new ServiceException("瀹℃壒缁撴灉涓嶆纭�");
+ }
+ CustomerFinancialReport entity = getById(id);
+ if (entity == null) {
+ throw new ServiceException("鐢虫姤璁板綍涓嶅瓨鍦�");
+ }
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ entity.setAuditStatus(auditStatus);
+ entity.setAuditUserId(loginUser.getUserId());
+ entity.setAuditUserName(loginUser.getNickName());
+ entity.setAuditTime(LocalDateTime.now());
+ entity.setAuditRemark(auditRemark);
+ updateById(entity);
+ return entity;
+ }
+
+ /**
+ * 鍒犻櫎璐㈠姟鎶ヨ〃锛氫粎鍚庡彴浜哄憳鍙垹闄わ紝瀹㈡埛璐﹀彿涓嶅厑璁稿垹闄�
+ */
+ @Transactional(rollbackFor = Exception.class)
+ public void deleteReport(Long id) {
+ if (isCustomerAccount()) {
+ throw new ServiceException("瀹㈡埛璐﹀彿鏃犳潈鍒犻櫎璐㈠姟鎶ヨ〃");
+ }
+ CustomerFinancialReport entity = getById(id);
+ if (entity == null) {
+ throw new ServiceException("璐㈠姟鎶ヨ〃涓嶅瓨鍦�");
+ }
+ removeById(id);
+ }
+
+ /**
+ * 閲嶆柊鐢熸垚闄勪欢棰勮/涓嬭浇鍦板潃锛氭暟鎹簱涓繚瀛樼殑鏄笂浼犳椂鐨勫甫绛惧悕鍦板潃锛屼細杩囨湡锛岃鍙栨椂鎸夋枃浠秈d鍒锋柊
+ */
+ private void refreshFileUrls(List<CustomerFinancialReport> reports) {
+ if (reports == null || reports.isEmpty()) {
+ return;
+ }
+ for (CustomerFinancialReport report : reports) {
+ String files = report.getReportFiles();
+ if (StringUtils.isBlank(files)) {
+ continue;
+ }
+ try {
+ JsonNode root = OBJECT_MAPPER.readTree(files);
+ if (root == null || !root.isArray()) {
+ continue;
+ }
+ for (JsonNode node : root) {
+ Long blobId = node.hasNonNull("id") ? node.get("id").asLong() : null;
+ if (blobId == null) {
+ continue;
+ }
+ StorageBlob blob = storageBlobMapper.selectById(blobId);
+ if (blob == null) {
+ continue;
+ }
+ StorageBlobVO vo = new StorageBlobVO();
+ vo.setUidFilename(blob.getUidFilename());
+ vo.setPath(blob.getPath());
+ vo.setResourceKey(blob.getResourceKey());
+ ObjectNode objectNode = (ObjectNode) node;
+ objectNode.put("url", fileUtil.buildSignedPreviewUrl(vo));
+ objectNode.put("downloadURL", fileUtil.buildSignedDownloadUrl(vo));
+ if (!node.hasNonNull("name")) {
+ objectNode.put("name", blob.getOriginalFilename());
+ }
+ }
+ report.setReportFiles(OBJECT_MAPPER.writeValueAsString(root));
+ } catch (Exception e) {
+ // 鏃ф暟鎹垨闈� JSON 鏍煎紡锛屼繚鎸佸師鍊�
+ }
+ }
+ }
+
+ private boolean isCustomerAccount() {
+ Long userId = SecurityUtils.getUserId();
+ return !SecurityUtils.isAdmin(userId) && SecurityUtils.hasRole("customer");
+ }
+
+ /**
+ * 鑾峰彇褰撳墠鐧诲綍璐﹀彿缁戝畾鐨勫鎴穒d
+ */
+ private Long currentCustomerId() {
+ CustomerUser binding = customerUserMapper.selectOne(new LambdaQueryWrapper<CustomerUser>()
+ .eq(CustomerUser::getUserId, SecurityUtils.getUserId()).last("limit 1"));
+ if (binding == null || binding.getCustomerId() == null) {
+ throw new ServiceException("褰撳墠璐﹀彿灏氭湭缁戝畾瀹㈡埛锛岃鑱旂郴绠$悊鍛�");
+ }
+ return binding.getCustomerId();
+ }
+
+ private void fillCustomerName(List<CustomerFinancialReport> reports) {
+ if (reports == null || reports.isEmpty()) {
+ return;
+ }
+ Set<Long> ids = reports.stream().map(CustomerFinancialReport::getCustomerId)
+ .filter(Objects::nonNull).collect(Collectors.toSet());
+ if (ids.isEmpty()) {
+ return;
+ }
+ List<Customer> customers = customerMapper.selectBatchIds(ids);
+ java.util.Map<Long, String> nameMap = customers.stream()
+ .collect(Collectors.toMap(Customer::getId, Customer::getCustomerName, (a, b) -> a));
+ reports.forEach(item -> item.setCustomerName(nameMap.getOrDefault(item.getCustomerId(), "")));
+ }
+}
diff --git a/src/main/java/com/ruoyi/basic/service/impl/CustomerServiceImpl.java b/src/main/java/com/ruoyi/basic/service/impl/CustomerServiceImpl.java
index b2f407d..ce90a16 100644
--- a/src/main/java/com/ruoyi/basic/service/impl/CustomerServiceImpl.java
+++ b/src/main/java/com/ruoyi/basic/service/impl/CustomerServiceImpl.java
@@ -33,6 +33,7 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
@@ -70,6 +71,8 @@
private CustomerReturnVisitService customerReturnVisitService;
@Autowired
private CustomerUserService customerUserService;
+ @Autowired
+ private JdbcTemplate jdbcTemplate;
/**
* 鏌ヨ瀹㈡埛妗f
@@ -92,6 +95,13 @@
public CustomerVo selectCustomerDetailById(Long id) {
CustomerVo customerVo = new CustomerVo();
BeanUtils.copyProperties(this.getById(id), customerVo);
+
+ // 鍥炴樉缁戝畾鐨勭櫥褰曡处鍙�
+ CustomerUser binding = customerUserService.getOne(new LambdaQueryWrapper<CustomerUser>()
+ .eq(CustomerUser::getCustomerId, id).last("limit 1"), false);
+ if (binding != null) {
+ customerVo.setBindUserId(binding.getUserId());
+ }
// 鏌ヨ璺熻繘璁板綍
List<CustomerFollowUp> followUpList = customerFollowUpService.list(
@@ -196,11 +206,14 @@
* @return 缁撴灉
*/
@Override
+ @Transactional(rollbackFor = Exception.class)
public int insertCustomer(Customer customer) {
LoginUser loginUser = SecurityUtils.getLoginUser();
Long tenantId = loginUser.getTenantId();
customer.setTenantId(tenantId);
- return customerMapper.insert(customer);
+ int rows = customerMapper.insert(customer);
+ saveCustomerBinding(customer.getId(), customer.getBindUserId());
+ return rows;
}
/**
@@ -210,12 +223,38 @@
* @return 缁撴灉
*/
@Override
+ @Transactional(rollbackFor = Exception.class)
public int updateCustomer(Customer customer) {
LoginUser loginUser = SecurityUtils.getLoginUser();
Long tenantId = loginUser.getTenantId();
- validateCustomerEditPermission(customer.getId());
customer.setTenantId(tenantId);
- return customerMapper.updateById(customer);
+ int rows = customerMapper.updateById(customer);
+ saveCustomerBinding(customer.getId(), customer.getBindUserId());
+ return rows;
+ }
+
+ /**
+ * 淇濆瓨瀹㈡埛涓庣櫥褰曡处鍙风殑涓�瀵逛竴缁戝畾鍏崇郴
+ */
+ private void saveCustomerBinding(Long customerId, Long bindUserId) {
+ if (customerId == null) {
+ return;
+ }
+ customerUserService.remove(new LambdaQueryWrapper<CustomerUser>()
+ .eq(CustomerUser::getCustomerId, customerId));
+ if (bindUserId == null) {
+ return;
+ }
+ // 涓�涓櫥褰曡处鍙峰彧鑳界粦瀹氫竴涓鎴�
+ customerUserService.remove(new LambdaQueryWrapper<CustomerUser>()
+ .eq(CustomerUser::getUserId, bindUserId));
+ CustomerUser binding = new CustomerUser();
+ binding.setCustomerId(customerId);
+ binding.setUserId(bindUserId);
+ customerUserService.save(binding);
+ // 缁戝畾璐﹀彿鑷姩鎺堜簣鈥滃鎴封�濊鑹诧紝浣垮叾鐧诲綍鍚庡彧鑳借闂鎴烽棬鎴�
+ jdbcTemplate.update("INSERT IGNORE INTO sys_user_role (user_id, role_id) "
+ + "SELECT ?, role_id FROM sys_role WHERE role_key = 'customer' AND del_flag = '0'", bindUserId);
}
/**
@@ -418,22 +457,6 @@
customer.setType(1);
customer.setIsAssigned(0);
return this.updateById(customer);
- }
-
- private void validateCustomerEditPermission(Long customerId) {
- Customer customer = customerMapper.selectById(customerId);
- if (customer == null) {
- throw new RuntimeException("瀹㈡埛妗f涓嶅瓨鍦�");
- }
- if (!hasSalesModuleReference(customerId)) {
- return;
- }
- if (Objects.equals(customer.getType(), 0)) {
- throw new RuntimeException("宸茶閿�鍞ā鍧楀紩鐢ㄧ殑绉佹捣瀹㈡埛涓嶈兘缂栬緫");
- }
- if (Objects.equals(customer.getType(), 1) && Objects.equals(customer.getIsAssigned(), 1)) {
- throw new RuntimeException("宸查鐢ㄥ苟涓旇閿�鍞ā鍧楀紩鐢ㄧ殑鍏捣瀹㈡埛涓嶈兘缂栬緫");
- }
}
private void validatePublicSeaRecyclePermission(Long customerId) {
diff --git a/src/main/java/com/ruoyi/customerPortal/controller/CustomerSubmissionController.java b/src/main/java/com/ruoyi/customerPortal/controller/CustomerSubmissionController.java
new file mode 100644
index 0000000..74d43b8
--- /dev/null
+++ b/src/main/java/com/ruoyi/customerPortal/controller/CustomerSubmissionController.java
@@ -0,0 +1,49 @@
+package com.ruoyi.customerPortal.controller;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.customerPortal.dto.ReviewSubmissionDto;
+import com.ruoyi.customerPortal.pojo.CustomerSubmission;
+import com.ruoyi.customerPortal.service.CustomerSubmissionService;
+import com.ruoyi.framework.web.domain.AjaxResult;
+import lombok.RequiredArgsConstructor;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/customer/submission")
+@RequiredArgsConstructor
+public class CustomerSubmissionController {
+ private final CustomerSubmissionService customerSubmissionService;
+
+ @GetMapping("/mine")
+ @PreAuthorize("@ss.hasPermi('customer:submission:mine')")
+ public AjaxResult mine(Page<CustomerSubmission> page, Integer reportYear, Integer status) {
+ return AjaxResult.success(customerSubmissionService.listMine(page, reportYear, status));
+ }
+
+ @PostMapping
+ @PreAuthorize("@ss.hasPermi('customer:submission:mine')")
+ public AjaxResult submit(@RequestBody CustomerSubmission submission) {
+ return AjaxResult.success(customerSubmissionService.submit(submission));
+ }
+
+ @GetMapping("/manage/list")
+ @PreAuthorize("@ss.hasPermi('customer:submission:manage')")
+ public AjaxResult manageList(Page<CustomerSubmission> page, Long customerId,
+ Integer reportYear, Integer status) {
+ return AjaxResult.success(customerSubmissionService.listManage(page, customerId, reportYear, status));
+ }
+
+ @PutMapping("/review")
+ @PreAuthorize("@ss.hasPermi('customer:submission:manage')")
+ public AjaxResult review(@RequestBody ReviewSubmissionDto dto) {
+ customerSubmissionService.review(dto);
+ return AjaxResult.success();
+ }
+}
diff --git a/src/main/java/com/ruoyi/customerPortal/dto/ReviewSubmissionDto.java b/src/main/java/com/ruoyi/customerPortal/dto/ReviewSubmissionDto.java
new file mode 100644
index 0000000..035c984
--- /dev/null
+++ b/src/main/java/com/ruoyi/customerPortal/dto/ReviewSubmissionDto.java
@@ -0,0 +1,13 @@
+package com.ruoyi.customerPortal.dto;
+
+import lombok.Data;
+
+@Data
+public class ReviewSubmissionDto {
+ private Long id;
+ /** 1澶勭悊涓� 2宸插彂甯� 3宸查��鍥� */
+ private Integer status;
+ private String resultText;
+ private String resultFiles;
+ private String reviewRemark;
+}
diff --git a/src/main/java/com/ruoyi/customerPortal/mapper/CustomerSubmissionMapper.java b/src/main/java/com/ruoyi/customerPortal/mapper/CustomerSubmissionMapper.java
new file mode 100644
index 0000000..2cd1aa2
--- /dev/null
+++ b/src/main/java/com/ruoyi/customerPortal/mapper/CustomerSubmissionMapper.java
@@ -0,0 +1,7 @@
+package com.ruoyi.customerPortal.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.customerPortal.pojo.CustomerSubmission;
+
+public interface CustomerSubmissionMapper extends BaseMapper<CustomerSubmission> {
+}
diff --git a/src/main/java/com/ruoyi/customerPortal/pojo/CustomerSubmission.java b/src/main/java/com/ruoyi/customerPortal/pojo/CustomerSubmission.java
new file mode 100644
index 0000000..d11636c
--- /dev/null
+++ b/src/main/java/com/ruoyi/customerPortal/pojo/CustomerSubmission.java
@@ -0,0 +1,45 @@
+package com.ruoyi.customerPortal.pojo;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+/** 瀹㈡埛骞村害鐢虫姤鏉愭枡鍙婂彂甯冪粨鏋溿�� */
+@Data
+@TableName("customer_submission")
+public class CustomerSubmission {
+ @TableId(type = IdType.AUTO)
+ private Long id;
+ private Long customerId;
+ private Integer reportYear;
+ private String reportName;
+ private String materialFiles;
+ /** 0寰呭鏍� 1澶勭悊涓� 2宸插彂甯� 3宸查��鍥� */
+ private Integer status;
+ private String resultText;
+ private String resultFiles;
+ private String reviewRemark;
+ private Long submitUserId;
+ private String submitUserName;
+ private Long publishUserId;
+ private String publishUserName;
+ private LocalDateTime publishTime;
+ private Integer isDeleted;
+
+ @TableField(fill = FieldFill.INSERT)
+ private Long tenantId;
+ @TableField(fill = FieldFill.INSERT)
+ private Long deptId;
+ @TableField(fill = FieldFill.INSERT)
+ private LocalDateTime createTime;
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private LocalDateTime updateTime;
+
+ @TableField(exist = false)
+ private String customerName;
+}
diff --git a/src/main/java/com/ruoyi/customerPortal/service/CustomerSubmissionService.java b/src/main/java/com/ruoyi/customerPortal/service/CustomerSubmissionService.java
new file mode 100644
index 0000000..dc118be
--- /dev/null
+++ b/src/main/java/com/ruoyi/customerPortal/service/CustomerSubmissionService.java
@@ -0,0 +1,165 @@
+package com.ruoyi.customerPortal.service;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.basic.mapper.CustomerMapper;
+import com.ruoyi.basic.mapper.CustomerUserMapper;
+import com.ruoyi.basic.pojo.Customer;
+import com.ruoyi.basic.pojo.CustomerUser;
+import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.customerPortal.dto.ReviewSubmissionDto;
+import com.ruoyi.customerPortal.mapper.CustomerSubmissionMapper;
+import com.ruoyi.customerPortal.pojo.CustomerSubmission;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.time.LocalDateTime;
+import java.time.Year;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+@Service
+@RequiredArgsConstructor
+public class CustomerSubmissionService extends ServiceImpl<CustomerSubmissionMapper, CustomerSubmission> {
+ private final CustomerUserMapper customerUserMapper;
+ private final CustomerMapper customerMapper;
+
+ public Page<CustomerSubmission> listMine(Page<CustomerSubmission> page, Integer reportYear, Integer status) {
+ CustomerUser binding = currentBinding();
+ LambdaQueryWrapper<CustomerSubmission> query = new LambdaQueryWrapper<CustomerSubmission>()
+ .eq(CustomerSubmission::getCustomerId, binding.getCustomerId())
+ .eq(CustomerSubmission::getIsDeleted, 0)
+ .eq(reportYear != null, CustomerSubmission::getReportYear, reportYear)
+ .eq(status != null, CustomerSubmission::getStatus, status)
+ .orderByDesc(CustomerSubmission::getReportYear)
+ .orderByDesc(CustomerSubmission::getCreateTime);
+ return fillCustomerName(page(page, query));
+ }
+
+ public Page<CustomerSubmission> listManage(Page<CustomerSubmission> page, Long customerId,
+ Integer reportYear, Integer status) {
+ ensureStaff();
+ LambdaQueryWrapper<CustomerSubmission> query = new LambdaQueryWrapper<CustomerSubmission>()
+ .eq(CustomerSubmission::getIsDeleted, 0)
+ .eq(customerId != null, CustomerSubmission::getCustomerId, customerId)
+ .eq(reportYear != null, CustomerSubmission::getReportYear, reportYear)
+ .eq(status != null, CustomerSubmission::getStatus, status)
+ .orderByAsc(CustomerSubmission::getStatus)
+ .orderByDesc(CustomerSubmission::getUpdateTime);
+ return fillCustomerName(page(page, query));
+ }
+
+ @Transactional(rollbackFor = Exception.class)
+ public CustomerSubmission submit(CustomerSubmission input) {
+ CustomerUser binding = currentBinding();
+ int currentYear = Year.now().getValue();
+ if (input.getReportYear() == null || input.getReportYear() < currentYear - 2
+ || input.getReportYear() > currentYear) {
+ throw new ServiceException("鍙兘鎻愪氦鏈�杩戜笁涓勾搴︾殑璐㈠姟鏉愭枡");
+ }
+ if (input.getMaterialFiles() == null || input.getMaterialFiles().isBlank()) {
+ throw new ServiceException("璇疯嚦灏戜笂浼犱竴浠芥潗鏂�");
+ }
+ CustomerSubmission entity = getOne(new LambdaQueryWrapper<CustomerSubmission>()
+ .eq(CustomerSubmission::getCustomerId, binding.getCustomerId())
+ .eq(CustomerSubmission::getReportYear, input.getReportYear())
+ .eq(CustomerSubmission::getIsDeleted, 0), false);
+ if (entity != null && entity.getStatus() != null
+ && entity.getStatus() != 0 && entity.getStatus() != 3) {
+ throw new ServiceException("鏉愭枡宸插彈鐞嗘垨缁撴灉宸插彂甯冿紝涓嶈兘鍐嶆淇敼");
+ }
+ if (entity == null) {
+ entity = new CustomerSubmission();
+ entity.setCustomerId(binding.getCustomerId());
+ entity.setReportYear(input.getReportYear());
+ entity.setSubmitUserId(SecurityUtils.getUserId());
+ entity.setSubmitUserName(SecurityUtils.getLoginUser().getNickName());
+ entity.setIsDeleted(0);
+ }
+ entity.setReportName(input.getReportName());
+ entity.setMaterialFiles(input.getMaterialFiles());
+ entity.setStatus(0);
+ entity.setReviewRemark(null);
+ entity.setResultText(null);
+ entity.setResultFiles(null);
+ entity.setPublishUserId(null);
+ entity.setPublishUserName(null);
+ entity.setPublishTime(null);
+ saveOrUpdate(entity);
+ return entity;
+ }
+
+ @Transactional(rollbackFor = Exception.class)
+ public void review(ReviewSubmissionDto dto) {
+ ensureStaff();
+ if (dto.getId() == null || dto.getStatus() == null
+ || (dto.getStatus() != 1 && dto.getStatus() != 2 && dto.getStatus() != 3)) {
+ throw new ServiceException("瀹℃牳鍙傛暟涓嶆纭�");
+ }
+ CustomerSubmission entity = getById(dto.getId());
+ if (entity == null || Objects.equals(entity.getIsDeleted(), 1)) {
+ throw new ServiceException("鐢虫姤璁板綍涓嶅瓨鍦�");
+ }
+ Integer oldStatus = entity.getStatus();
+ if (dto.getStatus() == 1 && !Objects.equals(oldStatus, 0)) {
+ throw new ServiceException("鍙湁寰呭鏍告潗鏂欏彲浠ュ彈鐞�");
+ }
+ if (dto.getStatus() == 2 && !Objects.equals(oldStatus, 1)) {
+ throw new ServiceException("鍙湁澶勭悊涓潗鏂欏彲浠ュ彂甯冪粨鏋�");
+ }
+ if (dto.getStatus() == 3 && !Objects.equals(oldStatus, 0) && !Objects.equals(oldStatus, 1)) {
+ throw new ServiceException("褰撳墠鐘舵�佷笉鑳介��鍥�");
+ }
+ if (dto.getStatus() == 3 && (dto.getReviewRemark() == null || dto.getReviewRemark().isBlank())) {
+ throw new ServiceException("閫�鍥炴椂蹇呴』濉啓鍘熷洜");
+ }
+ if (dto.getStatus() == 2 && (dto.getResultText() == null || dto.getResultText().isBlank())
+ && (dto.getResultFiles() == null || dto.getResultFiles().isBlank())) {
+ throw new ServiceException("鍙戝竷鏃惰濉啓缁撴灉璇存槑鎴栦笂浼犵粨鏋滄枃浠�");
+ }
+ entity.setStatus(dto.getStatus());
+ entity.setResultText(dto.getResultText());
+ entity.setResultFiles(dto.getResultFiles());
+ entity.setReviewRemark(dto.getReviewRemark());
+ if (dto.getStatus() == 2) {
+ entity.setPublishUserId(SecurityUtils.getUserId());
+ entity.setPublishUserName(SecurityUtils.getLoginUser().getNickName());
+ entity.setPublishTime(LocalDateTime.now());
+ }
+ updateById(entity);
+ }
+
+ private CustomerUser currentBinding() {
+ CustomerUser binding = customerUserMapper.selectOne(new LambdaQueryWrapper<CustomerUser>()
+ .eq(CustomerUser::getUserId, SecurityUtils.getUserId()).last("limit 1"));
+ if (binding == null) {
+ throw new ServiceException("褰撳墠璐﹀彿灏氭湭缁戝畾瀹㈡埛锛岃鑱旂郴绠$悊鍛�");
+ }
+ return binding;
+ }
+
+ private void ensureStaff() {
+ if (!SecurityUtils.isAdmin(SecurityUtils.getUserId()) && SecurityUtils.hasRole("customer")) {
+ throw new ServiceException("瀹㈡埛璐﹀彿鏃犳潈鎵ц姝ゆ搷浣�");
+ }
+ }
+
+ private Page<CustomerSubmission> fillCustomerName(Page<CustomerSubmission> result) {
+ Set<Long> ids = result.getRecords().stream().map(CustomerSubmission::getCustomerId)
+ .filter(Objects::nonNull).collect(Collectors.toSet());
+ Map<Long, Customer> customerMap = ids.isEmpty() ? Collections.emptyMap() : customerMapper.selectBatchIds(ids)
+ .stream().collect(Collectors.toMap(Customer::getId, Function.identity(), (a, b) -> a));
+ result.getRecords().forEach(item -> {
+ Customer customer = customerMap.get(item.getCustomerId());
+ item.setCustomerName(customer == null ? "" : customer.getCustomerName());
+ });
+ return result;
+ }
+}
diff --git a/src/main/java/com/ruoyi/projectManagement/dto/SaveInfoDto.java b/src/main/java/com/ruoyi/projectManagement/dto/SaveInfoDto.java
index 9fbef30..c423055 100644
--- a/src/main/java/com/ruoyi/projectManagement/dto/SaveInfoDto.java
+++ b/src/main/java/com/ruoyi/projectManagement/dto/SaveInfoDto.java
@@ -42,6 +42,9 @@
private String source;
+ // 椤圭洰鍒嗙被
+ private String projectClassification;
+
private Long managerId;
private String managerName;
private Long salesmanId;
diff --git a/src/main/java/com/ruoyi/projectManagement/pojo/Info.java b/src/main/java/com/ruoyi/projectManagement/pojo/Info.java
index 5f5a0ab..2e7f95f 100644
--- a/src/main/java/com/ruoyi/projectManagement/pojo/Info.java
+++ b/src/main/java/com/ruoyi/projectManagement/pojo/Info.java
@@ -74,6 +74,12 @@
private String source;
/**
+ * 椤圭洰鍒嗙被
+ */
+ @TableField(value = "project_classification")
+ private String projectClassification;
+
+ /**
* 椤圭洰缁忕悊id
*/
@TableField(value = "manager_id")
diff --git a/src/main/java/com/ruoyi/purchase/controller/PurchaseLedgerSimpleController.java b/src/main/java/com/ruoyi/purchase/controller/PurchaseLedgerSimpleController.java
new file mode 100644
index 0000000..067c7d5
--- /dev/null
+++ b/src/main/java/com/ruoyi/purchase/controller/PurchaseLedgerSimpleController.java
@@ -0,0 +1,134 @@
+package com.ruoyi.purchase.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.framework.web.domain.R;
+import com.ruoyi.purchase.mapper.PurchaseLedgerSimpleMapper;
+import com.ruoyi.purchase.pojo.PurchaseLedgerSimple;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.AllArgsConstructor;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.springframework.web.bind.annotation.*;
+
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.ZoneId;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 閲囪喘鍙拌处锛堢畝锛塁ontroller
+ * 鍙仛鍩虹鍙拌处鐨勫鍒犳敼鏌ヤ笌瀵煎嚭锛屼笉涓庡悎鍚屻�佷緵搴斿晢銆佷骇鍝併�佸叆搴撶瓑妯″潡鍏宠仈銆�
+ */
+@RestController
+@RequestMapping("/purchase/simpleLedger")
+@Tag(name = "閲囪喘鍙拌处锛堢畝锛�")
+@AllArgsConstructor
+public class PurchaseLedgerSimpleController {
+
+ private final PurchaseLedgerSimpleMapper purchaseLedgerSimpleMapper;
+
+ /**
+ * 鍒嗛〉鍒楄〃
+ */
+ @GetMapping("/list")
+ @Operation(summary = "閲囪喘鍙拌处锛堢畝锛夊垎椤靛垪琛�")
+ public R list(@RequestParam(defaultValue = "1") long current,
+ @RequestParam(defaultValue = "10") long size,
+ @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate paymentDateStart,
+ @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate paymentDateEnd,
+ @RequestParam(required = false) String paymentMethod) {
+ LambdaQueryWrapper<PurchaseLedgerSimple> wrapper = new LambdaQueryWrapper<>();
+ if (paymentDateStart != null) {
+ wrapper.ge(PurchaseLedgerSimple::getPaymentDate, toDate(paymentDateStart));
+ }
+ if (paymentDateEnd != null) {
+ wrapper.le(PurchaseLedgerSimple::getPaymentDate, toDate(paymentDateEnd));
+ }
+ if (paymentMethod != null && !paymentMethod.isBlank()) {
+ wrapper.eq(PurchaseLedgerSimple::getPaymentMethod, paymentMethod);
+ }
+ wrapper.orderByDesc(PurchaseLedgerSimple::getPurchaseDate)
+ .orderByDesc(PurchaseLedgerSimple::getId);
+ return R.ok(purchaseLedgerSimpleMapper.selectPage(new Page<>(current, size), wrapper));
+ }
+
+ /**
+ * 璇︽儏
+ */
+ @GetMapping("/{id}")
+ @Operation(summary = "閲囪喘鍙拌处锛堢畝锛夎鎯�")
+ public R getById(@PathVariable Long id) {
+ return R.ok(purchaseLedgerSimpleMapper.selectById(id));
+ }
+
+ /**
+ * 鏂板銆佺紪杈�
+ */
+ @PostMapping("/save")
+ @Log(title = "閲囪喘鍙拌处锛堢畝锛�", businessType = BusinessType.INSERT)
+ @Operation(summary = "閲囪喘鍙拌处锛堢畝锛夋柊澧炪�佺紪杈�")
+ public AjaxResult save(@RequestBody PurchaseLedgerSimple entity) {
+ Date now = new Date();
+ if (entity.getId() == null) {
+ entity.setCreateTime(now);
+ entity.setUpdateTime(now);
+ purchaseLedgerSimpleMapper.insert(entity);
+ } else {
+ entity.setUpdateTime(now);
+ purchaseLedgerSimpleMapper.updateById(entity);
+ }
+ return AjaxResult.success(entity.getId());
+ }
+
+ /**
+ * 鍒犻櫎
+ */
+ @DeleteMapping("/delete")
+ @Log(title = "閲囪喘鍙拌处锛堢畝锛�", businessType = BusinessType.DELETE)
+ @Operation(summary = "閲囪喘鍙拌处锛堢畝锛夊垹闄�")
+ public AjaxResult delete(@RequestBody List<Long> ids) {
+ if (ids == null || ids.isEmpty()) {
+ return AjaxResult.error("璇烽�夋嫨瑕佸垹闄ょ殑鏁版嵁");
+ }
+ purchaseLedgerSimpleMapper.deleteBatchIds(ids);
+ return AjaxResult.success();
+ }
+
+ /**
+ * 瀵煎嚭
+ */
+ @PostMapping("/export")
+ @Log(title = "閲囪喘鍙拌处锛堢畝锛�", businessType = BusinessType.EXPORT)
+ @Operation(summary = "閲囪喘鍙拌处锛堢畝锛夊鍑�")
+ public void export(HttpServletResponse response,
+ @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate paymentDateStart,
+ @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate paymentDateEnd,
+ @RequestParam(required = false) String paymentMethod) {
+ LambdaQueryWrapper<PurchaseLedgerSimple> wrapper = new LambdaQueryWrapper<>();
+ if (paymentDateStart != null) {
+ wrapper.ge(PurchaseLedgerSimple::getPaymentDate, toDate(paymentDateStart));
+ }
+ if (paymentDateEnd != null) {
+ wrapper.le(PurchaseLedgerSimple::getPaymentDate, toDate(paymentDateEnd));
+ }
+ if (paymentMethod != null && !paymentMethod.isBlank()) {
+ wrapper.eq(PurchaseLedgerSimple::getPaymentMethod, paymentMethod);
+ }
+ wrapper.orderByDesc(PurchaseLedgerSimple::getPurchaseDate)
+ .orderByDesc(PurchaseLedgerSimple::getId);
+ List<PurchaseLedgerSimple> list = purchaseLedgerSimpleMapper.selectList(wrapper);
+ ExcelUtil<PurchaseLedgerSimple> util = new ExcelUtil<>(PurchaseLedgerSimple.class);
+ util.exportExcel(response, list, "閲囪喘鍙拌处");
+ }
+
+ private Date toDate(LocalDate date) {
+ return Date.from(date.atStartOfDay(ZoneId.systemDefault()).toInstant());
+ }
+}
diff --git a/src/main/java/com/ruoyi/purchase/mapper/PurchaseLedgerSimpleMapper.java b/src/main/java/com/ruoyi/purchase/mapper/PurchaseLedgerSimpleMapper.java
new file mode 100644
index 0000000..463d68c
--- /dev/null
+++ b/src/main/java/com/ruoyi/purchase/mapper/PurchaseLedgerSimpleMapper.java
@@ -0,0 +1,12 @@
+package com.ruoyi.purchase.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.purchase.pojo.PurchaseLedgerSimple;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 閲囪喘鍙拌处锛堢畝锛塎apper
+ */
+@Mapper
+public interface PurchaseLedgerSimpleMapper extends BaseMapper<PurchaseLedgerSimple> {
+}
diff --git a/src/main/java/com/ruoyi/purchase/pojo/PurchaseLedgerSimple.java b/src/main/java/com/ruoyi/purchase/pojo/PurchaseLedgerSimple.java
new file mode 100644
index 0000000..6fee6f7
--- /dev/null
+++ b/src/main/java/com/ruoyi/purchase/pojo/PurchaseLedgerSimple.java
@@ -0,0 +1,122 @@
+package com.ruoyi.purchase.pojo;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.framework.aspectj.lang.annotation.Excel;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 閲囪喘鍙拌处锛堢畝锛夊璞� purchase_ledger_simple
+ *
+ * 浠呬繚鐣欓噰璐棩鏈熴�佹敮鍑烘棩鏈熴�侀噾棰濄�侀噰璐墿鍝併�佸彂绁ㄥ彿鐮併�佷粯娆炬柟寮忋�佸娉ㄧ瓑鍩虹淇℃伅锛�
+ * 涓嶄笌鍚堝悓銆佷緵搴斿晢銆佷骇鍝併�佸叆搴撶瓑妯″潡鍏宠仈銆�
+ */
+@Getter
+@Setter
+@TableName("purchase_ledger_simple")
+@Schema(name = "PurchaseLedgerSimple瀵硅薄", description = "閲囪喘鍙拌处锛堢畝锛�")
+public class PurchaseLedgerSimple implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @Schema(description = "涓婚敭ID")
+ @TableId(value = "id", type = IdType.AUTO)
+ private Long id;
+
+ /**
+ * 鏀嚭鏃ユ湡
+ */
+ @Schema(description = "鏀嚭鏃ユ湡")
+ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+ @Excel(name = "鏀嚭鏃ユ湡", width = 20, dateFormat = "yyyy-MM-dd")
+ private Date paymentDate;
+
+ /**
+ * 閲囪喘鏃ユ湡
+ */
+ @Schema(description = "閲囪喘鏃ユ湡")
+ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+ @Excel(name = "閲囪喘鏃ユ湡", width = 20, dateFormat = "yyyy-MM-dd")
+ private Date purchaseDate;
+
+ /**
+ * 閲戦
+ */
+ @Schema(description = "閲戦")
+ @Excel(name = "閲戦")
+ private BigDecimal amount;
+
+ /**
+ * 閲囪喘鐗╁搧
+ */
+ @Schema(description = "閲囪喘鐗╁搧")
+ @Excel(name = "閲囪喘鐗╁搧")
+ private String purchaseGoods;
+
+ /**
+ * 鍙戠エ鍙风爜
+ */
+ @Schema(description = "鍙戠エ鍙风爜")
+ @Excel(name = "鍙戠エ鍙风爜")
+ private String invoiceNumber;
+
+ /**
+ * 浠樻鏂瑰紡
+ */
+ @Schema(description = "浠樻鏂瑰紡")
+ @Excel(name = "浠樻鏂瑰紡")
+ private String paymentMethod;
+
+ /**
+ * 澶囨敞
+ */
+ @Schema(description = "澶囨敞")
+ @Excel(name = "澶囨敞")
+ private String remark;
+
+ /**
+ * 褰曞叆浜篿d
+ */
+ @Schema(description = "褰曞叆浜篿d")
+ private Long recorderId;
+
+ /**
+ * 褰曞叆浜�
+ */
+ @Schema(description = "褰曞叆浜�")
+ @Excel(name = "褰曞叆浜�")
+ private String recorderName;
+
+ /**
+ * 褰曞叆鏃ユ湡
+ */
+ @Schema(description = "褰曞叆鏃ユ湡")
+ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+ @Excel(name = "褰曞叆鏃ユ湡", width = 20, dateFormat = "yyyy-MM-dd")
+ private Date entryDate;
+
+ @Schema(description = "鍒涘缓鐢ㄦ埛")
+ @TableField(fill = FieldFill.INSERT)
+ private Long createUser;
+
+ @TableField(fill = FieldFill.INSERT)
+ private Long deptId;
+
+ @Schema(description = "鍒涘缓鏃堕棿")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ private Date createTime;
+
+ @Schema(description = "鏇存柊鏃堕棿")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ private Date updateTime;
+}
diff --git a/src/main/java/com/ruoyi/sales/controller/BusinessApprovalController.java b/src/main/java/com/ruoyi/sales/controller/BusinessApprovalController.java
new file mode 100644
index 0000000..a4dab46
--- /dev/null
+++ b/src/main/java/com/ruoyi/sales/controller/BusinessApprovalController.java
@@ -0,0 +1,33 @@
+package com.ruoyi.sales.controller;
+
+import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.sales.dto.BusinessReviewDto;
+import com.ruoyi.sales.service.BusinessApprovalService;
+import lombok.RequiredArgsConstructor;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/business/approval")
+@RequiredArgsConstructor
+public class BusinessApprovalController {
+ private final BusinessApprovalService businessApprovalService;
+
+ @PostMapping("/submit/{id}")
+ @PreAuthorize("@ss.hasPermi('business:approval:submit')")
+ public AjaxResult submit(@PathVariable Long id) {
+ businessApprovalService.submit(id);
+ return AjaxResult.success();
+ }
+
+ @PutMapping("/review")
+ @PreAuthorize("@ss.hasPermi('business:approval:review')")
+ public AjaxResult review(@RequestBody BusinessReviewDto dto) {
+ return AjaxResult.success(businessApprovalService.review(dto));
+ }
+}
diff --git a/src/main/java/com/ruoyi/sales/dto/BusinessReviewDto.java b/src/main/java/com/ruoyi/sales/dto/BusinessReviewDto.java
new file mode 100644
index 0000000..a1cf55b
--- /dev/null
+++ b/src/main/java/com/ruoyi/sales/dto/BusinessReviewDto.java
@@ -0,0 +1,11 @@
+package com.ruoyi.sales.dto;
+
+import lombok.Data;
+
+@Data
+public class BusinessReviewDto {
+ private Long salesLedgerId;
+ private Boolean approved;
+ private String remark;
+ private Long planId;
+}
diff --git a/src/main/java/com/ruoyi/sales/pojo/SalesLedger.java b/src/main/java/com/ruoyi/sales/pojo/SalesLedger.java
index c8a0443..3d69022 100644
--- a/src/main/java/com/ruoyi/sales/pojo/SalesLedger.java
+++ b/src/main/java/com/ruoyi/sales/pojo/SalesLedger.java
@@ -9,6 +9,7 @@
import java.math.BigDecimal;
import java.time.LocalDate;
+import java.time.LocalDateTime;
import java.util.Date;
/**
@@ -139,6 +140,15 @@
@TableField(fill = FieldFill.INSERT)
private Long deptId;
+ /** 涓氬姟瀹℃壒锛�0鑽夌 1寰呭鎵� 2宸查�氳繃 3宸查��鍥� */
+ private Integer businessApprovalStatus;
+ private String businessApprovalRemark;
+ private Long businessApprovedBy;
+ private String businessApprovedName;
+ private LocalDateTime businessApprovedTime;
+ private LocalDateTime businessSubmittedTime;
+ private Long projectManagementInfoId;
+
@Schema(description = "鏄惁鏈夌敓浜ц褰�")
@TableField(exist = false)
private Boolean hasProductionRecord;
diff --git a/src/main/java/com/ruoyi/sales/service/BusinessApprovalService.java b/src/main/java/com/ruoyi/sales/service/BusinessApprovalService.java
new file mode 100644
index 0000000..939cd2f
--- /dev/null
+++ b/src/main/java/com/ruoyi/sales/service/BusinessApprovalService.java
@@ -0,0 +1,124 @@
+package com.ruoyi.sales.service;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.ruoyi.common.enums.PlanStageEnum;
+import com.ruoyi.common.enums.ReviewStatusEnum;
+import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.projectManagement.dto.PlanStageDto;
+import com.ruoyi.projectManagement.mapper.InfoMapper;
+import com.ruoyi.projectManagement.mapper.PlanMapper;
+import com.ruoyi.projectManagement.mapper.PlanNodeMapper;
+import com.ruoyi.projectManagement.pojo.Info;
+import com.ruoyi.projectManagement.pojo.Plan;
+import com.ruoyi.projectManagement.pojo.PlanNode;
+import com.ruoyi.sales.dto.BusinessReviewDto;
+import com.ruoyi.sales.mapper.SalesLedgerMapper;
+import com.ruoyi.sales.pojo.SalesLedger;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.List;
+
+@Service
+@RequiredArgsConstructor
+public class BusinessApprovalService {
+ private final SalesLedgerMapper salesLedgerMapper;
+ private final InfoMapper infoMapper;
+ private final PlanMapper planMapper;
+ private final PlanNodeMapper planNodeMapper;
+
+ @Transactional(rollbackFor = Exception.class)
+ public void submit(Long id) {
+ SalesLedger ledger = requireLedger(id);
+ Integer status = ledger.getBusinessApprovalStatus();
+ if (status != null && status == 2) {
+ throw new ServiceException("璇ヤ笟鍔″凡缁忓鎵归�氳繃");
+ }
+ ledger.setBusinessApprovalStatus(1);
+ ledger.setBusinessApprovalRemark(null);
+ ledger.setBusinessSubmittedTime(LocalDateTime.now());
+ salesLedgerMapper.updateById(ledger);
+ }
+
+ @Transactional(rollbackFor = Exception.class)
+ public Long review(BusinessReviewDto dto) {
+ if (dto.getSalesLedgerId() == null || dto.getApproved() == null) {
+ throw new ServiceException("瀹℃壒鍙傛暟涓嶅畬鏁�");
+ }
+ SalesLedger ledger = requireLedger(dto.getSalesLedgerId());
+ if (ledger.getBusinessApprovalStatus() == null || ledger.getBusinessApprovalStatus() != 1) {
+ throw new ServiceException("鍙湁寰呭鎵逛笟鍔″彲浠ュ鏍�");
+ }
+ ledger.setBusinessApprovedBy(SecurityUtils.getUserId());
+ ledger.setBusinessApprovedName(SecurityUtils.getLoginUser().getNickName());
+ ledger.setBusinessApprovedTime(LocalDateTime.now());
+ ledger.setBusinessApprovalRemark(dto.getRemark());
+ if (!dto.getApproved()) {
+ ledger.setBusinessApprovalStatus(3);
+ salesLedgerMapper.updateById(ledger);
+ return null;
+ }
+ Long projectId = ledger.getProjectManagementInfoId();
+ if (projectId == null) {
+ projectId = createProject(ledger, dto.getPlanId());
+ ledger.setProjectManagementInfoId(projectId);
+ }
+ ledger.setBusinessApprovalStatus(2);
+ salesLedgerMapper.updateById(ledger);
+ return projectId;
+ }
+
+ private Long createProject(SalesLedger ledger, Long selectedPlanId) {
+ Plan plan = selectedPlanId == null ? planMapper.selectOne(new LambdaQueryWrapper<Plan>()
+ .eq(Plan::getName, "椤圭洰鐢虫姤鍏樁娈�")
+ .eq(Plan::getIsDelete, 0).last("limit 1")) : planMapper.selectById(selectedPlanId);
+ if (plan == null) {
+ throw new ServiceException("鏈壘鍒扳�滈」鐩敵鎶ュ叚闃舵鈥濊鍒掞紝璇峰厛鎵ц鍗囩骇SQL");
+ }
+ List<PlanNode> nodes = planNodeMapper.selectList(new LambdaQueryWrapper<PlanNode>()
+ .eq(PlanNode::getProjectManagementPlanId, plan.getId())
+ .eq(PlanNode::getIsDelete, 0).orderByAsc(PlanNode::getSort));
+ if (nodes.isEmpty()) {
+ throw new ServiceException("椤圭洰鍏樁娈靛皻鏈厤缃�");
+ }
+ Info info = new Info();
+ info.setNo("XM" + LocalDate.now().format(DateTimeFormatter.BASIC_ISO_DATE)
+ + String.format("%06d", ledger.getId()));
+ info.setTitle(ledger.getProjectName() == null || ledger.getProjectName().isBlank()
+ ? ledger.getCustomerName() + "鐢虫姤椤圭洰" : ledger.getProjectName());
+ info.setClientId(ledger.getCustomerId());
+ info.setClientName(ledger.getCustomerName());
+ info.setEstablishTime(LocalDate.now());
+ info.setProjectManagementPlanId(plan.getId());
+ info.setSource("涓氬姟瀹℃壒");
+ info.setManagerId(SecurityUtils.getUserId());
+ info.setManagerName(SecurityUtils.getLoginUser().getNickName());
+ info.setSalesmanName(ledger.getSalesman());
+ info.setIsDelete(0);
+ info.setPlanStartTime(LocalDate.now());
+ info.setReviewStatus(ReviewStatusEnum.APPROVED.getCode());
+ info.setStatus(PlanStageEnum.TO_BEGIN.getCode());
+ info.setOrderDate(ledger.getExecutionDate());
+ info.setOrderAmount(ledger.getContractAmount() == null ? null : ledger.getContractAmount().toPlainString());
+ info.setRemark(ledger.getRemarks());
+ info.setAttachment(ledger.getAttachmentMaterials());
+ info.setDeptId(ledger.getDeptId());
+ info.setPlanStage(nodes.stream().map(node -> new PlanStageDto(node.getId(), node.getName(),
+ PlanStageEnum.TO_BEGIN, node.getSort(), node.getEstimatedDuration())).toList());
+ infoMapper.insert(info);
+ return info.getId();
+ }
+
+ private SalesLedger requireLedger(Long id) {
+ SalesLedger ledger = salesLedgerMapper.selectById(id);
+ if (ledger == null) {
+ throw new ServiceException("涓氬姟璁板綍涓嶅瓨鍦�");
+ }
+ return ledger;
+ }
+}
diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml
index 3277d70..6923844 100644
--- a/src/main/resources/application-dev.yml
+++ b/src/main/resources/application-dev.yml
@@ -74,7 +74,7 @@
druid:
# 涓诲簱鏁版嵁婧�
master:
- url: jdbc:mysql://36.213.90.123:11101/product-inventory-management-thzs?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+ url: jdbc:mysql://36.213.150.237:10000/product-inventory-management-xmgl?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=GMT%2B8
username: root
password: xd@123456..
# 浠庡簱鏁版嵁婧�
@@ -260,7 +260,7 @@
upload-dir: D:/ruoyi/prod/uploads # 姝e紡鐩綍 鍚庢湡鍒犻櫎
path: D:/ruoyi/prod/uploads # 涓婁紶鐩綍
urlPrefix: /common # 閾炬帴鍓嶇紑
- domain: http://127.0.0.1:7006 # 鍩熷悕鍓嶇紑
+ domain: http://127.0.0.1:7005 # 鍩熷悕鍓嶇紑
expired: 120 # 杩囨湡鏃堕棿(鍗曚綅:鍒嗛挓)
useLimit: 10 # 浣跨敤娆℃暟
compress: true # 鏄惁鍘嬬缉
diff --git a/src/main/resources/mapper/projectManagement/InfoMapper.xml b/src/main/resources/mapper/projectManagement/InfoMapper.xml
index e101797..4ef6518 100644
--- a/src/main/resources/mapper/projectManagement/InfoMapper.xml
+++ b/src/main/resources/mapper/projectManagement/InfoMapper.xml
@@ -14,6 +14,7 @@
<result property="establishTime" column="establish_time" jdbcType="TIMESTAMP"/>
<result property="projectManagementPlanId" column="project_management_plan_id" jdbcType="BIGINT"/>
<result property="source" column="source" jdbcType="VARCHAR"/>
+ <result property="projectClassification" column="project_classification" jdbcType="VARCHAR"/>
<result property="managerId" column="manager_id" jdbcType="BIGINT"/>
<result property="managerName" column="manager_name" jdbcType="VARCHAR"/>
<result property="salesmanId" column="salesman_id" jdbcType="BIGINT"/>
diff --git a/src/main/resources/mapper/sales/SalesLedgerMapper.xml b/src/main/resources/mapper/sales/SalesLedgerMapper.xml
index 2d6b7f8..a05c00c 100644
--- a/src/main/resources/mapper/sales/SalesLedgerMapper.xml
+++ b/src/main/resources/mapper/sales/SalesLedgerMapper.xml
@@ -26,6 +26,13 @@
T1.entry_person,
T1.remarks,
T1.attachment_materials,
+ T1.business_approval_status,
+ T1.business_approval_remark,
+ T1.business_approved_by,
+ T1.business_approved_name,
+ T1.business_approved_time,
+ T1.business_submitted_time,
+ T1.project_management_info_id,
T1.tenant_id,
T1.contract_amount,
T1.execution_date,
@@ -54,6 +61,13 @@
T1.entry_person,
T1.remarks,
T1.attachment_materials,
+ T1.business_approval_status,
+ T1.business_approval_remark,
+ T1.business_approved_by,
+ T1.business_approved_name,
+ T1.business_approved_time,
+ T1.business_submitted_time,
+ T1.project_management_info_id,
T1.tenant_id,
T1.contract_amount,
T1.net_contract_amount,
--
Gitblit v1.9.3