From 031399b2893306a010cb4a6b0261441deb0d6625 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期四, 07 五月 2026 16:03:29 +0800
Subject: [PATCH] Merge branch 'dev_New_pro' into dev_山西_黎城县胜德建材
---
src/main/java/com/ruoyi/basic/pojo/Customer.java | 5
src/main/resources/mapper/basic/CustomerMapper.xml | 93 +++
src/main/java/com/ruoyi/production/controller/ProductionOperationTaskController.java | 12
src/main/java/com/ruoyi/sales/mapper/ShippingProductDetailMapper.java | 4
src/main/java/com/ruoyi/basic/service/impl/CustomerFollowUpServiceImpl.java | 2
src/main/java/com/ruoyi/purchase/service/impl/PurchaseLedgerServiceImpl.java | 5
src/main/java/com/ruoyi/sales/service/ShippingInfoService.java | 3
src/main/java/com/ruoyi/procurementrecord/utils/StockUtils.java | 4
src/main/java/com/ruoyi/production/service/impl/ProductionOperationTaskServiceImpl.java | 5
src/main/java/com/ruoyi/basic/service/impl/CustomerServiceImpl.java | 211 ++++++-
src/main/java/com/ruoyi/sales/service/impl/ShippingInfoServiceImpl.java | 6
src/main/resources/application-demo.yml | 115 +++-
src/main/java/com/ruoyi/production/service/impl/ProductionOrderServiceImpl.java | 90 ++-
src/main/java/com/ruoyi/production/service/ProductionOrderService.java | 2
src/main/java/com/ruoyi/ai/tools/ApproveTodoTools.java | 1
src/main/java/com/ruoyi/production/controller/ProductionOrderController.java | 8
src/main/java/com/ruoyi/basic/pojo/CustomerUser.java | 43 +
src/main/java/com/ruoyi/staff/controller/PersonalAttendanceLocationConfigController.java | 9
src/main/java/com/ruoyi/basic/vo/CustomerVo.java | 28 +
src/main/java/com/ruoyi/approve/service/impl/ApproveNodeServiceImpl.java | 8
src/main/resources/mapper/production/ProductionOperationTaskMapper.xml | 67 ++
src/main/java/com/ruoyi/basic/controller/CustomerFollowUpController.java | 2
src/main/java/com/ruoyi/basic/mapper/CustomerUserMapper.java | 15
src/main/java/com/ruoyi/production/bean/vo/ProductionOrderWorkOrderDetailVo.java | 62 +-
src/main/java/com/ruoyi/basic/pojo/CustomerFollowUp.java | 2
src/main/java/com/ruoyi/production/bean/dto/ProductionOperationTaskDto.java | 13
src/main/java/com/ruoyi/sales/mapper/ShippingInfoMapper.java | 4
src/main/java/com/ruoyi/basic/pojo/CustomerReturnVisit.java | 2
src/main/java/com/ruoyi/production/service/ProductionOperationTaskService.java | 2
src/main/java/com/ruoyi/project/system/service/impl/UnipushService.java | 2
src/main/java/com/ruoyi/production/service/impl/ProductionOrderPickServiceImpl.java | 8
doc/create_table_customer_user.sql | 10
src/main/java/com/ruoyi/production/bean/vo/ProductionOperationTaskVo.java | 9
src/main/java/com/ruoyi/basic/service/CustomerUserService.java | 13
src/main/java/com/ruoyi/sales/pojo/SalesQuotation.java | 35
src/main/java/com/ruoyi/basic/service/impl/CustomerUserServiceImpl.java | 19
src/main/java/com/ruoyi/production/bean/vo/ProductionOrderVo.java | 3
src/main/resources/application-new-pro.yml | 10
src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java | 194 +++++-
src/main/resources/mapper/sales/ShippingProductDetailMapper.xml | 8
src/main/java/com/ruoyi/sales/service/impl/SalesQuotationServiceImpl.java | 15
src/main/java/com/ruoyi/basic/service/impl/CustomerReturnVisitServiceImpl.java | 6
src/main/java/com/ruoyi/sales/controller/ShippingInfoController.java | 10
src/main/java/com/ruoyi/approve/service/impl/ApproveProcessServiceImpl.java | 8
doc/20260507_采购多文件分析确认接口传参类型约束.md | 166 ++++++
src/main/java/com/ruoyi/basic/mapper/CustomerMapper.java | 7
src/main/java/com/ruoyi/purchase/dto/PurchaseLedgerDto.java | 10
src/main/java/com/ruoyi/basic/task/ReturnVisitReminderTask.java | 2
src/main/resources/mapper/production/ProductionOrderMapper.xml | 10
src/main/java/com/ruoyi/basic/service/ICustomerService.java | 25
/dev/null | 101 ---
src/main/java/com/ruoyi/basic/dto/CustomerDto.java | 6
src/main/java/com/ruoyi/basic/controller/CustomerController.java | 79 ++
src/main/java/com/ruoyi/sales/dto/ShippingProductDetailDto.java | 16
src/main/java/com/ruoyi/production/mapper/ProductionOperationTaskMapper.java | 2
55 files changed, 1,200 insertions(+), 397 deletions(-)
diff --git "a/doc/20260507_\351\207\207\350\264\255\345\244\232\346\226\207\344\273\266\345\210\206\346\236\220\347\241\256\350\256\244\346\216\245\345\217\243\344\274\240\345\217\202\347\261\273\345\236\213\347\272\246\346\235\237.md" "b/doc/20260507_\351\207\207\350\264\255\345\244\232\346\226\207\344\273\266\345\210\206\346\236\220\347\241\256\350\256\244\346\216\245\345\217\243\344\274\240\345\217\202\347\261\273\345\236\213\347\272\246\346\235\237.md"
new file mode 100644
index 0000000..69535e7
--- /dev/null
+++ "b/doc/20260507_\351\207\207\350\264\255\345\244\232\346\226\207\344\273\266\345\210\206\346\236\220\347\241\256\350\256\244\346\216\245\345\217\243\344\274\240\345\217\202\347\261\273\345\236\213\347\272\246\346\235\237.md"
@@ -0,0 +1,166 @@
+# 閲囪喘澶氭枃浠跺垎鏋愮‘璁ゆ帴鍙d紶鍙傜被鍨嬬害鏉燂紙`purchase_ledger`锛�
+
+## 1. 閫傜敤鎺ュ彛
+
+- `POST /purchase-ai/analyze-files/confirm`
+- `businessType = purchase_ledger`
+
+> 鏈枃鐢ㄤ簬绾︽潫鍓嶇鎻愪氦鍒扮‘璁ゆ帴鍙g殑 `payload` 绫诲瀷锛岄伩鍏� `Cannot deserialize ...` 杩欑被鍙嶅簭鍒楀寲寮傚父銆�
+
+## 2. 椤跺眰璇锋眰浣�
+
+```json
+{
+ "businessType": "purchase_ledger",
+ "payload": {
+ "purchaseLedgers": []
+ }
+}
+```
+
+## 3. payload 缁撴瀯
+
+鎺ㄨ崘缁熶竴浣跨敤鎵归噺缁撴瀯锛堝嵆浣垮彧鏈� 1 鏉★級锛�
+
+```json
+{
+ "purchaseLedgers": [
+ {
+ "purchaseContractNumber": "CG-2026-001",
+ "supplierId": 10001,
+ "entryDate": "2026-05-07",
+ "type": 2,
+ "approvalStatus": 1,
+ "productData": [
+ {
+ "productCategory": "閽㈡潗",
+ "specificationModel": "Q235-A",
+ "unit": "鍚�",
+ "quantity": 10,
+ "taxInclusiveUnitPrice": 1200,
+ "taxInclusiveTotalPrice": 12000,
+ "taxRate": 13,
+ "type": 2
+ }
+ ]
+ }
+ ]
+}
+```
+
+鍚庣涔熷吋瀹光�滃崟鏉$洿浼犫�濓紙`payload` 鐩存帴鏄竴鏉� `PurchaseLedgerDto`锛夛紝浣嗕笉寤鸿鏂板墠绔户缁娇鐢ㄣ��
+
+## 4. Java 绫诲瀷鍒� JSON 绫诲瀷鏄犲皠瑙勫垯
+
+- `Long` / `Integer`锛氫紶 **number**锛堟暣鏁帮級锛屼笉瑕佷紶 `"pending"`銆乣"1绾�"` 杩欑被瀛楃涓层��
+- `BigDecimal`锛氫紶 **number**锛堝彲灏忔暟锛夛紝涓嶈浼犲甫閫楀彿銆佸崟浣嶇殑瀛楃涓诧紙濡� `"12,000鍏�"`锛夈��
+- `Date`锛氫紶 **string**锛屾牸寮忓浐瀹� `yyyy-MM-dd`銆�
+- `Boolean`锛氫紶 `true/false`锛屼笉瑕佷紶 `"true"`銆乣"鏄�"`銆�
+- `List<T>`锛氫紶鏁扮粍 `[]`銆�
+
+## 5. `PurchaseLedgerDto` 瀛楁绫诲瀷绾︽潫锛堢‘璁ゆ帴鍙e彲璇嗗埆瀛楁锛�
+
+| 瀛楁 | Java 绫诲瀷 | JSON 绫诲瀷 | 璇存槑 |
+| --- | --- | --- | --- |
+| entryDateStart | String | string | 鏌ヨ鍖洪棿寮�濮嬫棩鏈燂紙`yyyy-MM-dd`锛� |
+| entryDateEnd | String | string | 鏌ヨ鍖洪棿缁撴潫鏃ユ湡锛坄yyyy-MM-dd`锛� |
+| id | Long | number(integer) | 鍙拌处ID |
+| purchaseContractNumber | String | string | **蹇呭~**锛堜富涓氬姟鍗曞彿锛� |
+| supplierId | Long | number(integer) | `supplierId` 涓� `supplierName` 浜岄�変竴蹇呭~ |
+| supplierName | String | string | `supplierId` 涓� `supplierName` 浜岄�変竴蹇呭~ |
+| recorderId | Long | number(integer) | 褰曞叆浜篒D |
+| recorderName | String | string | 褰曞叆浜哄悕绉� |
+| salesContractNo | String | string | 閿�鍞悎鍚屽彿 |
+| salesContractNoId | Long | number(integer) | 閿�鍞悎鍚孖D |
+| projectName | String | string | 椤圭洰鍚嶇О |
+| entryDate | Date | string(`yyyy-MM-dd`) | 褰曞叆鏃ユ湡锛涚己鐪佹椂鍚庣浼氳ˉ褰撳ぉ |
+| executionDate | Date | string(`yyyy-MM-dd`) | 绛捐鏃ユ湡 |
+| remarks | String | string | 澶囨敞 |
+| attachmentMaterials | String | string | 闄勪欢璇存槑/璺緞 |
+| createdAt | Date | string(`yyyy-MM-dd`) | 鍒涘缓鏃ユ湡 |
+| updatedAt | Date | string(`yyyy-MM-dd`) | 鏇存柊鏃ユ湡 |
+| salesLedgerId | Long | number(integer) | 閿�鍞彴璐D |
+| hasChildren | Boolean | boolean | 鏄惁鏈夊瓙椤� |
+| Type | Integer | number(integer) | 鍘嗗彶瀛楁锛堜笉鎺ㄨ崘鏂板墠绔娇鐢級 |
+| productData | List<SalesLedgerProduct> | array | 浜у搧鏄庣粏锛岃涓嬭妭 |
+| tempFileIds | List<String> | array[string] | 涓存椂鏂囦欢ID鍒楄〃 |
+| SalesLedgerFiles | List<CommonFile> | array[object] | 鍘嗗彶鍏煎瀛楁 |
+| phoneNumber | String | string | 涓氬姟鍛樻墜鏈哄彿 |
+| businessPersonId | Long | number(integer) | 涓氬姟鍛業D |
+| productId | Long | number(integer) | 浜у搧ID |
+| productModelId | Long | number(integer) | 浜у搧瑙勬牸ID |
+| invoiceNumber | String | string | 鍙戠エ鍙� |
+| invoiceAmount | BigDecimal | number | 鍙戠エ閲戦 |
+| ticketRegistrationId | Long | number(integer) | 鏉ョエ鐧昏ID |
+| contractAmount | BigDecimal | number | 鍚堝悓閲戦 |
+| receiptPaymentAmount | BigDecimal | number | 鏉ョエ閲戦 |
+| unReceiptPaymentAmount | BigDecimal | number | 鏈潵绁ㄩ噾棰� |
+| type | Integer | number(integer) | 鍙拌处绫诲瀷锛岄噰璐浐瀹� `2`锛堢己鐪佹椂鍚庣琛� `2`锛� |
+| paymentMethod | String | string | 浠樻鏂瑰紡 |
+| approvalStatus | Integer | number(integer) | 瀹℃壒鐘舵�侊紝**涓ョ浼犲瓧绗︿覆**锛堝 `"pending"`锛� |
+| templateName | String | string | 妯℃澘鍚嶇О |
+
+### 瀹℃壒鐘舵�佸缓璁�硷紙`approvalStatus`锛�
+
+寤鸿鎸夋暟瀛椾紶鍊硷細
+
+- `1`锛氬緟瀹℃牳
+- `2`锛氬鏍镐腑
+- `3`锛氬鏍搁�氳繃
+- `4`锛氬鏍告嫆缁�/澶辫触
+- `5`锛氭ā鏉挎暟鎹紙鍘嗗彶瀹氫箟锛�
+
+## 6. `productData`锛坄SalesLedgerProduct`锛夊缓璁瓧娈靛強绫诲瀷
+
+| 瀛楁 | Java 绫诲瀷 | JSON 绫诲瀷 | 璇存槑 |
+| --- | --- | --- | --- |
+| productCategory | String | string | **蹇呭~**锛屼骇鍝佸ぇ绫�/鍚嶇О |
+| specificationModel | String | string | **蹇呭~**锛岃鏍煎瀷鍙� |
+| unit | String | string | **蹇呭~**锛屽崟浣� |
+| quantity | BigDecimal | number | **蹇呭~**锛屾暟閲� |
+| taxRate | BigDecimal | number | 绋庣巼锛堝 `13`锛� |
+| taxInclusiveUnitPrice | BigDecimal | number | **蹇呭~**锛屽惈绋庡崟浠� |
+| taxInclusiveTotalPrice | BigDecimal | number | **蹇呭~**锛屽惈绋庢�讳环 |
+| taxExclusiveTotalPrice | BigDecimal | number | 涓嶅惈绋庢�讳环锛堝彲涓嶄紶锛屽悗绔彲鎺ㄥ锛� |
+| invoiceType | String | string | 鍙戠エ绫诲瀷 |
+| productId | Long | number(integer) | 浜у搧ID |
+| productModelId | Long | number(integer) | 浜у搧鍨嬪彿ID |
+| isChecked | Boolean | boolean | 鏄惁璐ㄦ |
+| type | Integer | number(integer) | 閲囪喘浜у搧鍥哄畾 `2`锛堝缓璁紶 `2`锛� |
+
+## 7. 蹇呭~涓庡悗绔粯璁よ涓�
+
+- 鍙拌处涓昏〃蹇呭~锛歚purchaseContractNumber`锛屼互鍙� `supplierId` / `supplierName` 浜岄�変竴銆�
+- 浜у搧鏄庣粏鑻ヤ紶浜� `productData`锛屽垯姣忔潯浜у搧蹇呭~锛歚productCategory`銆乣specificationModel`銆乣unit`銆乣quantity`銆乣taxInclusiveUnitPrice`銆乣taxInclusiveTotalPrice`銆�
+- `entryDate` 涓虹┖鏃讹紝鍚庣琛ュ綋澶╂棩鏈熴��
+- `type` 涓虹┖鏃讹紝鍚庣琛� `2`銆�
+
+## 8. 鍓嶇楂橀閿欒绀轰緥
+
+閿欒锛堜細瑙﹀彂鍙嶅簭鍒楀寲寮傚父锛夛細
+
+```json
+{
+ "approvalStatus": "pending",
+ "type": "閲囪喘",
+ "supplierId": "渚涘簲鍟咥"
+}
+```
+
+姝g‘锛�
+
+```json
+{
+ "approvalStatus": 1,
+ "type": 2,
+ "supplierId": 10001
+}
+```
+
+## 9. 鎻愪氦鍓嶈嚜妫�娓呭崟
+
+1. 鎵�鏈� `Long/Integer/BigDecimal` 瀛楁閮戒负鏁板瓧锛屼笉鏄笟鍔¤瘝瀛楃涓层��
+2. 鎵�鏈夋棩鏈熷瓧娈甸兘鏄� `yyyy-MM-dd`銆�
+3. `approvalStatus` 浠呬紶鏁板瓧鐘舵�佺爜銆�
+4. `supplierId` 涓� `supplierName` 鑷冲皯鏈変竴涓湁鏁堝�笺��
+5. `productData` 涓繀濉垪榻愬叏涓斾负姝g‘绫诲瀷銆�
diff --git a/doc/create_table_customer_user.sql b/doc/create_table_customer_user.sql
new file mode 100644
index 0000000..dacbfb4
--- /dev/null
+++ b/doc/create_table_customer_user.sql
@@ -0,0 +1,10 @@
+drop table if exists customer_user;
+create table customer_user
+(
+ id bigint auto_increment
+ primary key,
+ customer_id bigint not null default 0 comment '瀹㈡埛id',
+ user_id bigint not null default 0 comment '鐢ㄦ埛id',
+ create_time datetime null comment '褰曞叆鏃堕棿',
+ tenant_id bigint not null default 0 comment '绉熸埛id'
+);
diff --git a/src/main/java/com/ruoyi/ai/tools/ApproveTodoTools.java b/src/main/java/com/ruoyi/ai/tools/ApproveTodoTools.java
index 233c459..cd3e933 100644
--- a/src/main/java/com/ruoyi/ai/tools/ApproveTodoTools.java
+++ b/src/main/java/com/ruoyi/ai/tools/ApproveTodoTools.java
@@ -707,6 +707,7 @@
case 6 -> "鎶ヤ环瀹℃壒";
case 7 -> "鍙戣揣瀹℃壒";
case 8 -> "鍗遍櫓浣滀笟瀹℃壒";
+ case 9 -> "鍔炲叕鐢ㄥ搧瀹℃壒";
default -> "绫诲瀷" + type;
};
}
diff --git a/src/main/java/com/ruoyi/approve/service/impl/ApproveNodeServiceImpl.java b/src/main/java/com/ruoyi/approve/service/impl/ApproveNodeServiceImpl.java
index 517f0c8..3caf7cf 100644
--- a/src/main/java/com/ruoyi/approve/service/impl/ApproveNodeServiceImpl.java
+++ b/src/main/java/com/ruoyi/approve/service/impl/ApproveNodeServiceImpl.java
@@ -301,6 +301,8 @@
return "鍙戣揣瀹℃壒";
case 8:
return "鍗遍櫓浣滀笟瀹℃壒";
+ case 9:
+ return "鍔炲叕鐢ㄥ搧瀹℃壒";
}
return null;
}
@@ -317,12 +319,12 @@
qualityInspect.setUnit(saleProduct.getUnit());
qualityInspect.setQuantity(saleProduct.getQuantity());
qualityInspectMapper.insert(qualityInspect);
- List<QualityTestStandard> qualityTestStandard = qualityTestStandardMapper.getQualityTestStandardByProductId(saleProduct.getProductId(), 0,null);
- if (qualityTestStandard.size()>0){
+ List<QualityTestStandard> qualityTestStandard = qualityTestStandardMapper.getQualityTestStandardByProductId(saleProduct.getProductId(), 0, null);
+ if (qualityTestStandard.size() > 0) {
qualityInspect.setTestStandardId(qualityTestStandard.get(0).getId());
qualityInspectMapper.updateById(qualityInspect);
qualityTestStandardParamMapper.selectList(Wrappers.<QualityTestStandardParam>lambdaQuery()
- .eq(QualityTestStandardParam::getTestStandardId,qualityTestStandard.get(0).getId()))
+ .eq(QualityTestStandardParam::getTestStandardId, qualityTestStandard.get(0).getId()))
.forEach(qualityTestStandardParam -> {
QualityInspectParam param = new QualityInspectParam();
com.ruoyi.common.utils.bean.BeanUtils.copyProperties(qualityTestStandardParam, param);
diff --git a/src/main/java/com/ruoyi/approve/service/impl/ApproveProcessServiceImpl.java b/src/main/java/com/ruoyi/approve/service/impl/ApproveProcessServiceImpl.java
index 2140949..c8c6af0 100644
--- a/src/main/java/com/ruoyi/approve/service/impl/ApproveProcessServiceImpl.java
+++ b/src/main/java/com/ruoyi/approve/service/impl/ApproveProcessServiceImpl.java
@@ -80,11 +80,9 @@
.map(ApproveProcessConfigNodeVo::getApproverId)
.filter(Objects::nonNull)
.collect(Collectors.toList());
- if (list.isEmpty()) {
- throw new RuntimeException("娴佺▼涓嶅瓨鍦�");
- }
+ // 鏃犲鏍镐汉閫昏緫娣诲姞
if (CollectionUtils.isEmpty(nodeIds)) {
- autoPassPurchaseApproveIfNoApprover(approveProcessVO);
+ autoPassPurchaseApproveIfNoApprover(approveProcessVO); // 閲囪喘鍗曟棤瀹℃牳浜洪�昏緫
return;
}
List<SysUser> sysUsers = sysUserMapper.selectUserByIds(nodeIds);
@@ -451,6 +449,8 @@
return "鍙戣揣瀹℃壒";
case 8:
return "鍗遍櫓浣滀笟瀹℃壒";
+ case 9:
+ return "鍔炲叕鐢ㄥ搧瀹℃壒";
}
return null;
}
diff --git a/src/main/java/com/ruoyi/basic/controller/CustomerController.java b/src/main/java/com/ruoyi/basic/controller/CustomerController.java
index 9aa6570..9090d34 100644
--- a/src/main/java/com/ruoyi/basic/controller/CustomerController.java
+++ b/src/main/java/com/ruoyi/basic/controller/CustomerController.java
@@ -5,17 +5,17 @@
import com.ruoyi.basic.dto.CustomerDto;
import com.ruoyi.basic.pojo.Customer;
import com.ruoyi.basic.service.ICustomerService;
+import com.ruoyi.basic.vo.CustomerVo;
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.controller.BaseController;
-import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.domain.R;
+import jakarta.servlet.http.HttpServletResponse;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
-import jakarta.servlet.http.HttpServletResponse;
import java.util.List;
/**
@@ -35,7 +35,7 @@
*/
@GetMapping("/list")
public R list(Page<CustomerDto> page, CustomerDto customer) {
- IPage<CustomerDto> customerDtoIPage = customerService.selectCustomerList(page, customer);
+ IPage<CustomerVo> customerDtoIPage = customerService.selectCustomerList(page, customer);
return R.ok(customerDtoIPage);
}
@@ -44,16 +44,9 @@
*/
@Log(title = "瀹㈡埛妗f", businessType = BusinessType.EXPORT)
@PostMapping("/export")
- public void export(HttpServletResponse response, Customer customer) {
- Long[] ids = customer.getIds();
- List<Customer> list;
- if (ids != null && ids.length > 0) {
- list = customerService.selectCustomerListByIds(ids);
- } else {
- list = customerService.selectCustomerLists(customer);
- }
- ExcelUtil<Customer> util = new ExcelUtil<Customer>(Customer.class);
- util.exportExcel(response, list, "瀹㈡埛妗f鏁版嵁");
+ public void export(HttpServletResponse response, CustomerDto customer) {
+ ExcelUtil<CustomerVo> util = new ExcelUtil<CustomerVo>(CustomerVo.class);
+ util.exportExcel(response, customerService.selectCustomerLists(customer), "瀹㈡埛妗f鏁版嵁");
}
@PostMapping("/downloadTemplate")
@@ -69,17 +62,17 @@
*/
@Log(title = "瀹㈡埛妗f", businessType = BusinessType.IMPORT)
@PostMapping("/importData")
- public AjaxResult importData(MultipartFile file) throws Exception {
+ public R importData(MultipartFile file, Integer type) throws Exception {
- return customerService.importData(file);
+ return customerService.importData(file, type);
}
/**
* 鑾峰彇瀹㈡埛妗f璇︾粏淇℃伅
*/
@GetMapping(value = "/{id}")
- public AjaxResult getInfo(@PathVariable("id") Long id) {
- return success(customerService.selectCustomerDetailById(id));
+ public R getInfo(@PathVariable("id") Long id) {
+ return R.ok(customerService.selectCustomerDetailById(id));
}
/**
@@ -87,8 +80,8 @@
*/
@Log(title = "瀹㈡埛妗f", businessType = BusinessType.INSERT)
@PostMapping("/addCustomer")
- public AjaxResult add(@RequestBody Customer customer) {
- return toAjax(customerService.insertCustomer(customer));
+ public R add(@RequestBody Customer customer) {
+ return R.ok(customerService.insertCustomer(customer));
}
/**
@@ -96,8 +89,8 @@
*/
@Log(title = "瀹㈡埛妗f", businessType = BusinessType.UPDATE)
@PostMapping("/updateCustomer")
- public AjaxResult edit(@RequestBody Customer customer) {
- return toAjax(customerService.updateCustomer(customer));
+ public R edit(@RequestBody Customer customer) {
+ return R.ok(customerService.updateCustomer(customer));
}
/**
@@ -105,11 +98,11 @@
*/
@Log(title = "瀹㈡埛妗f", businessType = BusinessType.DELETE)
@DeleteMapping("/delCustomer")
- public AjaxResult remove(@RequestBody Long[] ids) {
+ public R remove(@RequestBody Long[] ids) {
if (ids == null || ids.length == 0) {
- return AjaxResult.error("璇蜂紶鍏ヨ鍒犻櫎鐨処D");
+ return R.fail("璇蜂紶鍏ヨ鍒犻櫎鐨処D");
}
- return toAjax(customerService.deleteCustomerByIds(ids));
+ return R.ok(customerService.deleteCustomerByIds(ids));
}
/**
@@ -121,4 +114,42 @@
}
+ /**
+ * 鍒嗛厤瀹㈡埛
+ */
+ @Log(title = "瀹㈡埛妗f", businessType = BusinessType.OTHER)
+ @PostMapping("/assignCustomer")
+ public R assignCustomer(@RequestBody CustomerDto customer) {
+ customerService.assignCustomer(customer);
+ return R.ok();
+ }
+
+ /**
+ * 鍥炴敹瀹㈡埛
+ */
+ @Log(title = "瀹㈡埛妗f", businessType = BusinessType.OTHER)
+ @PostMapping("/recycleCustomer")
+ public R recycleCustomer(@RequestBody CustomerDto customer) {
+ customerService.recycleCustomer(customer);
+ return R.ok();
+ }
+
+ /**
+ * 鍏变韩瀹㈡埛
+ */
+ @Log(title = "瀹㈡埛妗f", businessType = BusinessType.OTHER)
+ @PostMapping("/together")
+ public R together(@RequestBody CustomerDto customer) {
+ customerService.together(customer);
+ return R.ok();
+ }
+
+ /**
+ * 绉佹捣瀹㈡埛娴佸洖鍏捣
+ */
+ @Log(title = "瀹㈡埛妗f", businessType = BusinessType.OTHER)
+ @PostMapping("/back")
+ public R back(Long id) {
+ return R.ok(customerService.back(id));
+ }
}
diff --git a/src/main/java/com/ruoyi/basic/controller/CustomerFollowUpController.java b/src/main/java/com/ruoyi/basic/controller/CustomerFollowUpController.java
index 70b109e..a5dcc83 100644
--- a/src/main/java/com/ruoyi/basic/controller/CustomerFollowUpController.java
+++ b/src/main/java/com/ruoyi/basic/controller/CustomerFollowUpController.java
@@ -44,7 +44,7 @@
@Operation(summary = "鏌ヨ瀹㈡埛璺熻繘鍒楄〃")
public IPage<CustomerFollowUp> list(Page<CustomerFollowUp> page, CustomerFollowUp customerFollowUp) {
LambdaQueryWrapper<CustomerFollowUp> queryWrapper = new LambdaQueryWrapper<>();
- queryWrapper.eq(customerFollowUp.getCustomerPrivatePoolId() != null, CustomerFollowUp::getCustomerPrivatePoolId, customerFollowUp.getCustomerPrivatePoolId())
+ queryWrapper.eq(customerFollowUp.getCustomerId() != null, CustomerFollowUp::getCustomerId, customerFollowUp.getCustomerId())
.like(customerFollowUp.getFollowerUserName() != null, CustomerFollowUp::getFollowerUserName, customerFollowUp.getFollowerUserName())
.orderByDesc(CustomerFollowUp::getFollowUpTime);
return customerFollowUpService.page(page, queryWrapper);
diff --git a/src/main/java/com/ruoyi/basic/controller/CustomerPrivateController.java b/src/main/java/com/ruoyi/basic/controller/CustomerPrivateController.java
deleted file mode 100644
index 67b1755..0000000
--- a/src/main/java/com/ruoyi/basic/controller/CustomerPrivateController.java
+++ /dev/null
@@ -1,80 +0,0 @@
-package com.ruoyi.basic.controller;
-
-import com.ruoyi.basic.dto.CustomerPrivateDto;
-import com.ruoyi.basic.dto.CustomerPrivatePoolDto;
-import com.ruoyi.basic.service.CustomerPrivatePoolService;
-import com.ruoyi.basic.service.CustomerPrivateService;
-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.R;
-import jakarta.servlet.http.HttpServletResponse;
-import lombok.AllArgsConstructor;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-
-import java.util.List;
-
-/**
- * <p>
- * 瀹㈡埛妗f 鍓嶇鎺у埗鍣�
- * </p>
- *
- * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
- * @since 2026-04-17 10:39:09
- */
-@RestController
-@RequestMapping("/customerPrivate")
-@AllArgsConstructor
-public class CustomerPrivateController {
- private final CustomerPrivateService customerPrivateService;
-
- private final CustomerPrivatePoolService customerPrivatePoolService;
-
-
- @PostMapping("/add")
- public R add(@RequestBody CustomerPrivateDto customerPrivateDto) {
- return R.ok(customerPrivateService.add(customerPrivateDto));
- }
-
-
- @DeleteMapping("/delete")
- public R delete(@RequestBody List<Long> ids) {
- return R.ok(customerPrivateService.delete(ids));
- }
-
-
- /**
- * 瀵煎叆瀹㈡埛妗f
- */
- @Log(title = "瀹㈡埛妗f", businessType = BusinessType.IMPORT)
- @PostMapping("/importData")
- public R importData(MultipartFile file) throws Exception {
-
- return customerPrivateService.importData(file);
- }
-
- /**
- * 瀵煎嚭瀹㈡埛妗f鍒楄〃
- */
- @Log(title = "瀹㈡埛妗f", businessType = BusinessType.EXPORT)
- @PostMapping("/export")
- public void export(HttpServletResponse response, CustomerPrivatePoolDto customerPrivatePoolDto) {
- List<Long> ids = customerPrivatePoolDto.getIds();
- List<CustomerPrivatePoolDto> list;
- if (ids != null && ids.size() > 0) {
- list = customerPrivatePoolService.selectCustomerPrivatePoolDtoListByIds(ids);
- } else {
- list = customerPrivatePoolService.selectCustomerPrivatePoolDtoLists(customerPrivatePoolDto);
- }
- ExcelUtil<CustomerPrivatePoolDto> util = new ExcelUtil<CustomerPrivatePoolDto>(CustomerPrivatePoolDto.class);
- util.exportExcel(response, list, "瀹㈡埛妗f鏁版嵁");
- }
-
- @PostMapping("/downloadTemplate")
- @Log(title = "瀹㈡埛妗f-涓嬭浇妯℃澘", businessType = BusinessType.EXPORT)
- public void downloadTemplate(HttpServletResponse response) {
- ExcelUtil<CustomerPrivatePoolDto> util = new ExcelUtil<CustomerPrivatePoolDto>(CustomerPrivatePoolDto.class);
- util.importTemplateExcel(response, "瀹㈡埛妗f妯℃澘");
- }
-}
diff --git a/src/main/java/com/ruoyi/basic/controller/CustomerPrivatePoolController.java b/src/main/java/com/ruoyi/basic/controller/CustomerPrivatePoolController.java
deleted file mode 100644
index 83597cf..0000000
--- a/src/main/java/com/ruoyi/basic/controller/CustomerPrivatePoolController.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package com.ruoyi.basic.controller;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.basic.dto.CustomerPrivatePoolDto;
-import com.ruoyi.basic.service.CustomerPrivatePoolService;
-import com.ruoyi.common.utils.SecurityUtils;
-import com.ruoyi.framework.web.domain.R;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import io.swagger.v3.oas.annotations.Operation;
-import lombok.AllArgsConstructor;
-import org.springframework.web.bind.annotation.*;
-
-/**
- * <p>
- * 鍓嶇鎺у埗鍣� 瀹㈡埛锛堢娴凤級
- * </p>
- *
- * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
- * @since 2026-04-16 04:43:00
- */
-@RestController
-@Tag(name = "瀹㈡埛锛堢娴凤級")
-@RequestMapping("/customerPrivatePool")
-@AllArgsConstructor
-public class CustomerPrivatePoolController {
-
- private final CustomerPrivatePoolService customerPrivatePoolService;
-
-
- @GetMapping("/listPage")
- @Operation(summary = "瀹㈡埛锛堢娴凤級鍒楄〃")
- public R listPage(CustomerPrivatePoolDto customerPrivatePoolDto, Page<CustomerPrivatePoolDto> page){
- //鏌ヨ褰撳墠鐢ㄦ埛鐨勫鎴蜂俊鎭�
- customerPrivatePoolDto.setBoundId(SecurityUtils.getUserId());
- IPage<CustomerPrivatePoolDto> listPage = customerPrivatePoolService.listPage(page, customerPrivatePoolDto);
- return R.ok(listPage);
- }
-
- @PostMapping("/add")
- @Operation(summary = "鍒嗛厤瀹㈡埛锛堢娴凤級")
- public R add(@RequestBody CustomerPrivatePoolDto customerPrivatePool){
- boolean result = customerPrivatePoolService.add(customerPrivatePool);
- return R.ok(result);
- }
-
- @PutMapping("/update")
- public R update(@RequestBody CustomerPrivatePoolDto customerPrivatePoolDto) {
- return R.ok(customerPrivatePoolService.updateCustomerPrivatePoolDto(customerPrivatePoolDto));
- }
-
-
- @DeleteMapping("/delete/{id}")
- @Operation(summary = "鍒犻櫎瀹㈡埛锛堢娴凤級")
- public R delete(@PathVariable Long id){
- boolean result = customerPrivatePoolService.deleteCustomerPrivatePool(id);
- return R.ok(result);
- }
-
- @PostMapping("/together")
- @Operation(summary = "鍏变韩")
- public R together( @RequestBody CustomerPrivatePoolDto customerPrivatePool){
- boolean result = customerPrivatePoolService.together(customerPrivatePool);
- return R.ok(result);
- }
-
- @GetMapping("/info/{id}")
- @Operation(summary = "璇︽儏")
- public R getInfo(@PathVariable Long id){
- CustomerPrivatePoolDto customerPrivatePool = customerPrivatePoolService.getInfo(id);
- return R.ok(customerPrivatePool);
- }
-
- @GetMapping("/getbyId/{id}")
- @Operation(summary = "璇︽儏")
- public R getbyId(@PathVariable Long id){
- CustomerPrivatePoolDto customerPrivatePool = customerPrivatePoolService.getbyId(id);
- return R.ok(customerPrivatePool);
- }
-
-
-
-
-
-}
diff --git a/src/main/java/com/ruoyi/basic/dto/CustomerDto.java b/src/main/java/com/ruoyi/basic/dto/CustomerDto.java
index 630119f..d75de55 100644
--- a/src/main/java/com/ruoyi/basic/dto/CustomerDto.java
+++ b/src/main/java/com/ruoyi/basic/dto/CustomerDto.java
@@ -25,4 +25,8 @@
private String togetherUserNames;
-}
+ /**
+ * 鍏变韩鐢ㄦ埛ID鍒楄〃
+ */
+ private List<Long> userIds;
+}
\ No newline at end of file
diff --git a/src/main/java/com/ruoyi/basic/dto/CustomerPrivateDto.java b/src/main/java/com/ruoyi/basic/dto/CustomerPrivateDto.java
deleted file mode 100644
index c06ad62..0000000
--- a/src/main/java/com/ruoyi/basic/dto/CustomerPrivateDto.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.ruoyi.basic.dto;
-
-import com.ruoyi.basic.pojo.CustomerPrivate;
-import lombok.Data;
-
-import java.util.List;
-
-@Data
-public class CustomerPrivateDto extends CustomerPrivate {
-
- private List<CustomerFollowUpDto> followUpList;
-}
diff --git a/src/main/java/com/ruoyi/basic/dto/CustomerPrivatePoolDto.java b/src/main/java/com/ruoyi/basic/dto/CustomerPrivatePoolDto.java
deleted file mode 100644
index e452a24..0000000
--- a/src/main/java/com/ruoyi/basic/dto/CustomerPrivatePoolDto.java
+++ /dev/null
@@ -1,124 +0,0 @@
-package com.ruoyi.basic.dto;
-
-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.fasterxml.jackson.annotation.JsonFormat;
-import com.ruoyi.basic.pojo.CustomerFollowUp;
-import com.ruoyi.basic.pojo.CustomerPrivatePool;
-import com.ruoyi.framework.aspectj.lang.annotation.Excel;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import java.util.Date;
-import java.util.List;
-
-@Data
-public class CustomerPrivatePoolDto extends CustomerPrivatePool {
-
- /**
- * 瀹㈡埛鍚嶇О
- */
- @Excel(name = "瀹㈡埛鍚嶇О")
- private String customerName;
- /** 瀹㈡埛鍒嗙被锛氶浂鍞鎴凤紝杩涢攢鍟嗗鎴� */
-
- @Schema(description = "瀹㈡埛瑕乮d")
- private Long customerId;
-
- /**
- * 璺熻繘绋嬪害
- */
-// @Excel(name = "璺熻繘绋嬪害")
- @TableField(exist = false)
- private String followUpLevel;
-
- /**
- * 璺熻繘鏃堕棿
- */
-// @Excel(name = "璺熻繘鏃堕棿" , width = 30, dateFormat = "yyyy-MM-dd")
- @TableField(exist = false)
- @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
- @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
- private Date followUpTime;
-
- @Excel(name = "瀹㈡埛鍒嗙被")
- private String customerType;
-
-
- private String addressPhone;
- /**
- * 绾崇◣浜鸿瘑鍒彿
- */
- @Excel(name = "绾崇◣浜鸿瘑鍒彿")
- private String taxpayerIdentificationNumber;
-
- /**
- * 鍏徃鍦板潃
- */
- @Excel(name = "鍏徃鍦板潃")
- private String companyAddress;
-
- /**
- * 鍏徃鐢佃瘽
- */
- @Excel(name = "鍏徃鐢佃瘽")
- private String companyPhone;
-
- /**
- * 鑱旂郴浜�
- */
- @Excel(name = "鑱旂郴浜�")
- private String contactPerson;
-
- /**
- * 鑱旂郴鐢佃瘽
- */
- @Excel(name = "鑱旂郴鐢佃瘽",cellType = Excel.ColumnType.STRING)
- private String contactPhone;
-
- /**
- * 缁存姢浜�
- */
- @Excel(name = "缁存姢浜�")
- private String maintainer;
-
- /**
- * 缁存姢鏃堕棿
- */
- @JsonFormat(pattern = "yyyy-MM-dd")
- @Excel(name = "缁存姢鏃堕棿" , width = 30, dateFormat = "yyyy-MM-dd")
- private Date maintenanceTime;
-
- @TableField(fill = FieldFill.INSERT)
- private Long tenantId;
-
- @Schema(description = "閾惰鍩烘湰鎴�")
- @Excel(name = "閾惰鍩烘湰鎴�")
- private String basicBankAccount;
-
- @Schema(description = "閾惰璐﹀彿")
- @Excel(name = "閾惰璐﹀彿")
- private String bankAccount;
-
- @Schema(description = "寮�鎴疯鍙�")
- @Excel(name = "寮�鎴疯鍙�")
- private String bankCode;
- @Schema(description = "鍒涘缓鐢ㄦ埛")
- @TableField(fill = FieldFill.INSERT)
- private Integer createUser;
-
-
- @Schema(description = "璺熻繘璁板綍")
- private List<CustomerFollowUpDto> followUpList;
-
- @Schema(description = "缁戝畾浜篿ds")
- private List< Long> boundIds;
-
- @Excel(isExport = false)
- private List<Long> ids;
-
-
-}
diff --git a/src/main/java/com/ruoyi/basic/mapper/CustomerMapper.java b/src/main/java/com/ruoyi/basic/mapper/CustomerMapper.java
index ac86398..2605737 100644
--- a/src/main/java/com/ruoyi/basic/mapper/CustomerMapper.java
+++ b/src/main/java/com/ruoyi/basic/mapper/CustomerMapper.java
@@ -5,6 +5,7 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.basic.dto.CustomerDto;
import com.ruoyi.basic.pojo.Customer;
+import com.ruoyi.basic.vo.CustomerVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@@ -67,5 +68,7 @@
*/
int deleteCustomerByIds(Long[] ids);
- IPage<CustomerDto> listPage(Page<CustomerDto> page, @Param("c") CustomerDto customer);
-}
+ IPage<CustomerVo> listPage(Page<CustomerDto> page, @Param("c") CustomerDto customer, @Param("loginUserId") Long loginUserId);
+
+ List<CustomerVo> list(@Param("c") CustomerDto customer, @Param("loginUserId") Long loginUserId);
+}
\ No newline at end of file
diff --git a/src/main/java/com/ruoyi/basic/mapper/CustomerPrivateMapper.java b/src/main/java/com/ruoyi/basic/mapper/CustomerPrivateMapper.java
deleted file mode 100644
index 4f1bf6d..0000000
--- a/src/main/java/com/ruoyi/basic/mapper/CustomerPrivateMapper.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.ruoyi.basic.mapper;
-
-import com.ruoyi.basic.pojo.CustomerPrivate;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import org.apache.ibatis.annotations.Mapper;
-
-/**
- * <p>
- * 瀹㈡埛妗f Mapper 鎺ュ彛
- * </p>
- *
- * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
- * @since 2026-04-17 10:39:09
- */
-@Mapper
-public interface CustomerPrivateMapper extends BaseMapper<CustomerPrivate> {
-
-}
diff --git a/src/main/java/com/ruoyi/basic/mapper/CustomerPrivatePoolMapper.java b/src/main/java/com/ruoyi/basic/mapper/CustomerPrivatePoolMapper.java
deleted file mode 100644
index 4c6f325..0000000
--- a/src/main/java/com/ruoyi/basic/mapper/CustomerPrivatePoolMapper.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.ruoyi.basic.mapper;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.ruoyi.basic.dto.CustomerPrivatePoolDto;
-import com.ruoyi.basic.pojo.CustomerPrivatePool;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-/**
- * <p>
- * Mapper 鎺ュ彛
- * </p>
- *
- * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
- * @since 2026-04-16 04:43:00
- */
-@Mapper
-public interface CustomerPrivatePoolMapper extends BaseMapper<CustomerPrivatePool> {
-
- IPage<CustomerPrivatePoolDto> listPage(IPage<CustomerPrivatePoolDto> page, @Param("c") CustomerPrivatePoolDto customerPrivatePoolDto);
-
- CustomerPrivatePoolDto selectInfo(Long id);
-
- List<CustomerPrivatePoolDto> selectInfos();
-
-}
diff --git a/src/main/java/com/ruoyi/basic/mapper/CustomerUserMapper.java b/src/main/java/com/ruoyi/basic/mapper/CustomerUserMapper.java
new file mode 100644
index 0000000..84aebac
--- /dev/null
+++ b/src/main/java/com/ruoyi/basic/mapper/CustomerUserMapper.java
@@ -0,0 +1,15 @@
+package com.ruoyi.basic.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.basic.pojo.CustomerUser;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 瀹㈡埛鍏变韩Mapper鎺ュ彛
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @date 2026-04-29
+ */
+@Mapper
+public interface CustomerUserMapper extends BaseMapper<CustomerUser> {
+}
diff --git a/src/main/java/com/ruoyi/basic/pojo/Customer.java b/src/main/java/com/ruoyi/basic/pojo/Customer.java
index 1b47163..6a8e302 100644
--- a/src/main/java/com/ruoyi/basic/pojo/Customer.java
+++ b/src/main/java/com/ruoyi/basic/pojo/Customer.java
@@ -129,4 +129,9 @@
@Schema(description = "浣跨敤鐘舵��")
private Long usageStatus;
+ @Schema(description = "绫诲瀷 0 绉佹捣瀹㈡埛 1 鍏捣瀹㈡埛")
+ private Integer type;
+
+ @Schema(description = "鏄惁琚垎閰嶏細0-鏈垎閰嶏紝1-宸插垎閰�")
+ private Integer isAssigned;
}
diff --git a/src/main/java/com/ruoyi/basic/pojo/CustomerFollowUp.java b/src/main/java/com/ruoyi/basic/pojo/CustomerFollowUp.java
index 9f34f61..5d9dfe3 100644
--- a/src/main/java/com/ruoyi/basic/pojo/CustomerFollowUp.java
+++ b/src/main/java/com/ruoyi/basic/pojo/CustomerFollowUp.java
@@ -37,7 +37,7 @@
/**
* 鍏宠仈鐨勭娴穒d
*/
- private Long customerPrivatePoolId;
+ private Long customerId;
/**
* 璺熻繘鏂瑰紡
diff --git a/src/main/java/com/ruoyi/basic/pojo/CustomerPrivate.java b/src/main/java/com/ruoyi/basic/pojo/CustomerPrivate.java
deleted file mode 100644
index 87f2cc6..0000000
--- a/src/main/java/com/ruoyi/basic/pojo/CustomerPrivate.java
+++ /dev/null
@@ -1,114 +0,0 @@
-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 java.io.Serializable;
-import java.time.LocalDate;
-import java.util.Date;
-
-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;
-
-/**
- * <p>
- * 瀹㈡埛妗f
- * </p>
- *
- * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
- * @since 2026-04-17 10:39:09
- */
-@Getter
-@Setter
-@TableName("customer_private")
-@Schema(name = "CustomerPrivate瀵硅薄", description = "瀹㈡埛妗f")
-public class CustomerPrivate implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @TableId(value = "id", type = IdType.AUTO)
- private Long id;
-
- @Schema(description = "瀹㈡埛鍚嶇О")
- @Excel(name = "瀹㈡埛鍚嶇О")
- private String customerName;
-
- @Schema(description = "绾崇◣浜鸿瘑鍒彿")
- @Excel(name = "绾崇◣浜鸿瘑鍒彿")
- private String taxpayerIdentificationNumber;
-
- @Schema(description = "鍏徃鍦板潃")
- @Excel(name = "鍏徃鍦板潃")
- private String companyAddress;
-
- @Schema(description = "鍏徃鐢佃瘽")
- @Excel(name = "鍏徃鐢佃瘽")
- private String companyPhone;
-
- @Schema(description = "鑱旂郴浜�")
- @Excel(name = "鑱旂郴浜�")
- private String contactPerson;
-
- @Schema(description = "鑱旂郴鐢佃瘽")
- @Excel(name = "鑱旂郴鐢佃瘽", cellType = Excel.ColumnType.STRING)
- private String contactPhone;
-
- @Schema(description = "缁存姢浜�")
- @Excel(name = "缁存姢浜�")
- private String maintainer;
-
- @Schema(description = "缁存姢鏃堕棿")
- @JsonFormat(pattern = "yyyy-MM-dd")
- @Excel(name = "缁存姢鏃堕棿", width = 30, dateFormat = "yyyy-MM-dd")
- private Date maintenanceTime;
-
- @Schema(description = "绉熸埛ID")
- @TableField(fill = FieldFill.INSERT)
- private Long tenantId;
-
- @Schema(description = "閾惰鍩烘湰鎴�")
- @Excel(name = "閾惰鍩烘湰鎴�")
- private String basicBankAccount;
-
- @Schema(description = "閾惰璐﹀彿")
- @Excel(name = "閾惰璐﹀彿")
- private String bankAccount;
-
- @Schema(description = "寮�鎴疯鍙�")
- @Excel(name = "寮�鎴疯鍙�")
- private String bankCode;
-
- @Schema(description = "瀹㈡埛鍒嗙被锛氶浂鍞鎴凤紝杩涢攢鍟嗗鎴�")
- @Excel(name = "瀹㈡埛鍒嗙被")
- private String customerType;
-
- @Schema(description = "鍒涘缓浜篒D")
- @TableField(fill = FieldFill.INSERT)
- private Long createUser;
-
- @Schema(description = "閮ㄩ棬ID")
- @TableField(fill = FieldFill.INSERT)
- private Long deptId;
-
-
- @Schema(description = "璺熻繘绋嬪害")
- @TableField(exist = false)
- private String followUpLevel;
-
- @Schema(description = "璺熻繘鏃堕棿")
- @TableField(exist = false)
- private Date followUpTime;
-
-
- @TableField(exist = false)
- private Long[] ids;
-
- @TableField(exist = false)
- private String addressPhone;
-
-}
diff --git a/src/main/java/com/ruoyi/basic/pojo/CustomerPrivatePool.java b/src/main/java/com/ruoyi/basic/pojo/CustomerPrivatePool.java
deleted file mode 100644
index 86dfc5a..0000000
--- a/src/main/java/com/ruoyi/basic/pojo/CustomerPrivatePool.java
+++ /dev/null
@@ -1,67 +0,0 @@
-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 java.io.Serializable;
-import java.time.LocalDateTime;
-
-import com.ruoyi.framework.aspectj.lang.annotation.Excel;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-import lombok.Getter;
-import lombok.Setter;
-
-/**
- * <p>
- *
- * </p>
- *
- * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
- * @since 2026-04-16 04:43:00
- */
-@Data
-@TableName("customer_private_pool")
-@Schema(name = "CustomerPrivatePool瀵硅薄", description = "")
-public class CustomerPrivatePool implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @Schema(description = "涓婚敭id")
- @TableId(value = "id", type = IdType.AUTO)
- private Long id;
-
- @Schema(description = "瀹㈡埛id")
- private Long customerId;
-
- @Schema(description = "缁戝畾浜篿d")
- private Long boundId;
-
- @Schema(description = "鍒涘缓浜�")
- @TableField(fill = FieldFill.INSERT)
- private Integer createUser;
-
- @Schema(description = "鏇存柊浜�")
- @TableField(fill = FieldFill.INSERT_UPDATE)
- private Integer updateUser;
-
- @Schema(description = "鍒涘缓鏃堕棿")
- @TableField(fill = FieldFill.INSERT)
- private LocalDateTime createTime;
-
- @Schema(description = "鏇存柊鏃堕棿")
- @TableField(fill = FieldFill.INSERT_UPDATE)
- private LocalDateTime updateTime;
-
- @Schema(description = "绫诲瀷鍖哄垎鍏捣瀹㈡埛鍜岀娴峰鎴� 榛樿鏄娴峰鎴�0 鍏捣1")
- private Long type;
-
- @Schema(description = "閮ㄩ棬id")
- @TableField(fill = FieldFill.INSERT)
- private Long deptId;
-
- @Schema(description = "鍒犻櫎鏍囪瘑 榛樿0 1宸茬粡鍒犻櫎")
- private Integer DeleteFlag;
-}
diff --git a/src/main/java/com/ruoyi/basic/pojo/CustomerReturnVisit.java b/src/main/java/com/ruoyi/basic/pojo/CustomerReturnVisit.java
index f2edcc5..ddd3d4b 100644
--- a/src/main/java/com/ruoyi/basic/pojo/CustomerReturnVisit.java
+++ b/src/main/java/com/ruoyi/basic/pojo/CustomerReturnVisit.java
@@ -36,7 +36,7 @@
/**
* 鍏宠仈瀹㈡埛ID
*/
- private Integer customerPrivatePoolId;
+ private Long customerId;
/**
* 鎻愰啋寮�鍏� (0:鍏抽棴, 1:寮�鍚�)
diff --git a/src/main/java/com/ruoyi/basic/pojo/CustomerUser.java b/src/main/java/com/ruoyi/basic/pojo/CustomerUser.java
new file mode 100644
index 0000000..901b0ce
--- /dev/null
+++ b/src/main/java/com/ruoyi/basic/pojo/CustomerUser.java
@@ -0,0 +1,43 @@
+package com.ruoyi.basic.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+@TableName(value = "customer_user")
+@Data
+public class CustomerUser implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 搴忓彿
+ */
+ @TableId(type = IdType.AUTO)
+ private Long id;
+
+ /**
+ * 瀹㈡埛id
+ */
+ private Long customerId;
+
+ /**
+ * 鐢ㄦ埛id
+ */
+ private Long userId;
+
+ /**
+ * 绉熸埛id
+ */
+ @TableField(fill = FieldFill.INSERT)
+ private Long tenantId;
+
+ /**
+ * 褰曞叆鏃堕棿
+ */
+ @ApiModelProperty(value = "鍒涘缓鏃堕棿")
+ @TableField(fill = FieldFill.INSERT)
+ private LocalDateTime createTime;
+}
diff --git a/src/main/java/com/ruoyi/basic/service/CustomerPrivatePoolService.java b/src/main/java/com/ruoyi/basic/service/CustomerPrivatePoolService.java
deleted file mode 100644
index 18ca371..0000000
--- a/src/main/java/com/ruoyi/basic/service/CustomerPrivatePoolService.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package com.ruoyi.basic.service;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.basic.dto.CustomerPrivatePoolDto;
-import com.ruoyi.basic.pojo.Customer;
-import com.ruoyi.basic.pojo.CustomerPrivatePool;
-import com.baomidou.mybatisplus.extension.service.IService;
-
-import java.util.List;
-
-/**
- * <p>
- * 鏈嶅姟绫�
- * </p>
- *
- * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
- * @since 2026-04-16 04:43:00
- */
-public interface CustomerPrivatePoolService extends IService<CustomerPrivatePool> {
-
- IPage<CustomerPrivatePoolDto> listPage(Page<CustomerPrivatePoolDto> page, CustomerPrivatePoolDto customerPrivatePoolDto);
-
- boolean deleteCustomerPrivatePool(Long id);
-
- boolean together(CustomerPrivatePoolDto customerPrivatePool);
-
- boolean add(CustomerPrivatePoolDto customerPrivatePool);
-
- CustomerPrivatePoolDto getInfo(Long id);
-
- Boolean updateCustomerPrivatePoolDto(CustomerPrivatePoolDto customerPrivatePoolDto);
-
- CustomerPrivatePoolDto getbyId(Long id);
-
- List<CustomerPrivatePoolDto> selectCustomerPrivatePoolDtoListByIds(List<Long> ids);
-
- List<CustomerPrivatePoolDto> selectCustomerPrivatePoolDtoLists(CustomerPrivatePoolDto customerPrivatePoolDto);
-}
diff --git a/src/main/java/com/ruoyi/basic/service/CustomerPrivateService.java b/src/main/java/com/ruoyi/basic/service/CustomerPrivateService.java
deleted file mode 100644
index e758157..0000000
--- a/src/main/java/com/ruoyi/basic/service/CustomerPrivateService.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.ruoyi.basic.service;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.basic.dto.CustomerPrivateDto;
-import com.ruoyi.basic.dto.CustomerPrivatePoolDto;
-import com.ruoyi.basic.pojo.Customer;
-import com.ruoyi.basic.pojo.CustomerPrivate;
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.framework.web.domain.R;
-import org.springframework.web.multipart.MultipartFile;
-
-import java.util.List;
-
-/**
- * <p>
- * 瀹㈡埛妗f 鏈嶅姟绫�
- * </p>
- *
- * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
- * @since 2026-04-17 10:39:09
- */
-public interface CustomerPrivateService extends IService<CustomerPrivate> {
-
-
- Boolean add(CustomerPrivateDto customerPrivateDto);
-
-
- Integer delete(List<Long> id);
-
- R importData(MultipartFile file);
-}
diff --git a/src/main/java/com/ruoyi/basic/service/CustomerUserService.java b/src/main/java/com/ruoyi/basic/service/CustomerUserService.java
new file mode 100644
index 0000000..eda5f8e
--- /dev/null
+++ b/src/main/java/com/ruoyi/basic/service/CustomerUserService.java
@@ -0,0 +1,13 @@
+package com.ruoyi.basic.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.basic.pojo.CustomerUser;
+
+/**
+ * 瀹㈡埛鍏变韩Service鎺ュ彛
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @date 2026-04-29
+ */
+public interface CustomerUserService extends IService<CustomerUser> {
+}
\ No newline at end of file
diff --git a/src/main/java/com/ruoyi/basic/service/ICustomerService.java b/src/main/java/com/ruoyi/basic/service/ICustomerService.java
index c27dd92..b725216 100644
--- a/src/main/java/com/ruoyi/basic/service/ICustomerService.java
+++ b/src/main/java/com/ruoyi/basic/service/ICustomerService.java
@@ -4,9 +4,9 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.basic.dto.CustomerDto;
-import com.ruoyi.basic.dto.CustomerPrivatePoolDto;
import com.ruoyi.basic.pojo.Customer;
-import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.basic.vo.CustomerVo;
+import com.ruoyi.framework.web.domain.R;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
@@ -33,7 +33,7 @@
* @param id 瀹㈡埛妗f涓婚敭
* @return 瀹㈡埛璇︽儏DTO
*/
- Customer selectCustomerDetailById(Long id);
+ CustomerVo selectCustomerDetailById(Long id);
/**
* 鏌ヨ瀹㈡埛妗f鍒楄〃
@@ -75,9 +75,22 @@
*/
List<Map<String, Object>> customerList(Customer customer);
- List<Customer> selectCustomerLists(Customer customer);
+ List<CustomerVo> selectCustomerLists(CustomerDto customer);
- AjaxResult importData(MultipartFile file);
+ R importData(MultipartFile file, Integer type);
- IPage<CustomerDto> selectCustomerList(Page<CustomerDto> page, CustomerDto customer);
+ IPage<CustomerVo> selectCustomerList(Page<CustomerDto> page, CustomerDto customer);
+
+ void assignCustomer(CustomerDto customer);
+
+ void recycleCustomer(CustomerDto customer);
+
+ /**
+ * 鍏变韩瀹㈡埛缁欏叾浠栫敤鎴�
+ *
+ * @param customerDto 瀹㈡埛DTO锛堝寘鍚鎴稩D鍜屽叡浜敤鎴稩D鍒楄〃锛�
+ */
+ void together(CustomerDto customerDto);
+
+ Boolean back(Long id);
}
diff --git a/src/main/java/com/ruoyi/basic/service/impl/CustomerFollowUpServiceImpl.java b/src/main/java/com/ruoyi/basic/service/impl/CustomerFollowUpServiceImpl.java
index 29013d3..7946753 100644
--- a/src/main/java/com/ruoyi/basic/service/impl/CustomerFollowUpServiceImpl.java
+++ b/src/main/java/com/ruoyi/basic/service/impl/CustomerFollowUpServiceImpl.java
@@ -130,7 +130,7 @@
}
List<CustomerFollowUp> followUps = list(new LambdaQueryWrapper<CustomerFollowUp>()
- .eq(CustomerFollowUp::getCustomerPrivatePoolId, customerId));
+ .eq(CustomerFollowUp::getCustomerId, customerId));
if (followUps != null && !followUps.isEmpty()) {
for (CustomerFollowUp followUp : followUps) {
diff --git a/src/main/java/com/ruoyi/basic/service/impl/CustomerPrivatePoolServiceImpl.java b/src/main/java/com/ruoyi/basic/service/impl/CustomerPrivatePoolServiceImpl.java
deleted file mode 100644
index 0b14ee9..0000000
--- a/src/main/java/com/ruoyi/basic/service/impl/CustomerPrivatePoolServiceImpl.java
+++ /dev/null
@@ -1,225 +0,0 @@
-package com.ruoyi.basic.service.impl;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.basic.dto.CustomerFollowUpDto;
-import com.ruoyi.basic.dto.CustomerPrivatePoolDto;
-import com.ruoyi.basic.mapper.CustomerPrivateMapper;
-import com.ruoyi.basic.mapper.CustomerPrivatePoolMapper;
-import com.ruoyi.basic.pojo.*;
-import com.ruoyi.basic.service.*;
-import com.ruoyi.common.utils.StringUtils;
-import lombok.RequiredArgsConstructor;
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.time.ZoneId;
-import java.util.*;
-import java.util.stream.Collectors;
-
-/**
- * <p>
- * 鏈嶅姟瀹炵幇绫�
- * </p>
- *
- * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
- * @since 2026-04-16 04:43:00
- */
-@Service
-@Transactional(rollbackFor = Exception.class)
-@RequiredArgsConstructor
-public class CustomerPrivatePoolServiceImpl extends ServiceImpl<CustomerPrivatePoolMapper, CustomerPrivatePool> implements CustomerPrivatePoolService {
-
- private final CustomerPrivatePoolMapper customerPrivatePoolMapper;
-
- private final CustomerFollowUpService customerFollowUpService;
-
- private final CustomerReturnVisitService customerReturnVisitService;
-
- private final ICustomerService customerService;
-
- private final CustomerFollowUpFileService customerFollowUpFileService;
- private final CustomerPrivateMapper customerPrivateMapper;
-
-
- @Override
- public IPage<CustomerPrivatePoolDto> listPage(Page<CustomerPrivatePoolDto> page, CustomerPrivatePoolDto customerPrivatePoolDto) {
- IPage<CustomerPrivatePoolDto> customerPrivatePoolDtoIPage = customerPrivatePoolMapper.listPage(page, customerPrivatePoolDto);
- List<Long> customerIds = customerPrivatePoolDtoIPage.getRecords().stream()
- .map(CustomerPrivatePoolDto::getId )
- .filter(Objects::nonNull)
- .collect(Collectors.toList());
-
- if (!org.springframework.util.CollectionUtils.isEmpty(customerIds)) {
- Map<Long, CustomerFollowUp> latestFollowUpMap = getLatestFollowUpMap(customerIds);
-
- customerPrivatePoolDtoIPage.getRecords().forEach(c -> {
- String address = StringUtils.defaultString(c.getCompanyAddress(), "");
- String phone = StringUtils.defaultString(c.getCompanyPhone(), "");
- c.setAddressPhone(address + "(" + phone + ")");
-
- CustomerFollowUp followUp = latestFollowUpMap.get(c.getId());
- if (followUp != null) {
- c.setFollowUpLevel(followUp.getFollowUpLevel());
- c.setFollowUpTime(Date.from(
- followUp.getFollowUpTime().atZone(ZoneId.systemDefault()).toInstant()
- ));
- }
- });
-
- }
- return customerPrivatePoolDtoIPage;
- }
-
-
- private Map<Long, CustomerFollowUp> getLatestFollowUpMap(List<Long> customerIds) {
- List<CustomerFollowUp> followUps = customerFollowUpService.list(
- new LambdaQueryWrapper<CustomerFollowUp>()
- .in(CustomerFollowUp::getCustomerPrivatePoolId, customerIds)
- .orderByDesc(CustomerFollowUp::getFollowUpTime)
- );
-
- return followUps.stream()
- .collect(Collectors.toMap(
- CustomerFollowUp::getCustomerPrivatePoolId,
- followUp -> followUp,
- (existing, replacement) -> existing
- ));
- }
-
- @Override
- public boolean deleteCustomerPrivatePool(Long id) {
- List<CustomerPrivatePool> list = this.list(new QueryWrapper<CustomerPrivatePool>().lambda().eq(CustomerPrivatePool::getCustomerId, id));
-
- for (CustomerPrivatePool customerPrivatePool : list) {
- customerFollowUpService.remove(new QueryWrapper<CustomerFollowUp>().lambda().eq(CustomerFollowUp::getCustomerPrivatePoolId, customerPrivatePool.getId()));
- customerReturnVisitService.remove(new QueryWrapper<CustomerReturnVisit>().lambda().eq(CustomerReturnVisit::getCustomerPrivatePoolId, customerPrivatePool.getId()));
- }
- Customer byId = customerService.getById(id);
- byId.setUsageStatus(0L);
- byId.setUsageUser(0L);
- customerService.updateById(byId);
- list.stream().forEach(customerPrivatePool -> {
- customerPrivatePool.setDeleteFlag(1);
- customerPrivatePoolMapper.updateById(customerPrivatePool);
- });
- return true;
- }
-
- @Override
- public boolean together(CustomerPrivatePoolDto customerPrivatePoolDto) {
- List<CustomerPrivatePool> existingPools = this.list(new QueryWrapper<CustomerPrivatePool>().lambda().eq(CustomerPrivatePool::getCustomerId, customerPrivatePoolDto.getCustomerId()));
-
- List<Long> existingBoundIds = existingPools.stream()
- .map(CustomerPrivatePool::getBoundId)
- .collect(Collectors.toList());
-
- List<Long> newBoundIds = customerPrivatePoolDto.getBoundIds().stream()
- .filter(boundId -> !existingBoundIds.contains(boundId))
- .collect(Collectors.toList());
-
- if (CollectionUtils.isEmpty(newBoundIds)) {
- return true;
- }
- for (Long id : customerPrivatePoolDto.getBoundIds()) {
- CustomerPrivatePool customerPrivatePool = new CustomerPrivatePool();
- customerPrivatePool.setCustomerId(customerPrivatePoolDto.getCustomerId());
- customerPrivatePool.setBoundId(id);
- customerPrivatePool.setType(1L);
- this.save(customerPrivatePool);
- }
- return true;
- }
-
- @Override
- public boolean add(CustomerPrivatePoolDto customerPrivatePool) {
- customerPrivatePool.setType(1L);
- this.save(customerPrivatePool);
- Customer byId = customerService.getById(customerPrivatePool.getCustomerId());
- if (byId != null) {
- byId.setUsageStatus(1L);
- byId.setUsageUser(customerPrivatePool.getBoundId());
- return customerService.updateById(byId);
- }
- throw new RuntimeException("瀹㈡埛涓嶅瓨鍦�");
-
- }
-
- @Override
- public CustomerPrivatePoolDto getInfo(Long id) {
- CustomerPrivatePoolDto customerPrivatePool = customerPrivatePoolMapper.selectInfo(id);
- if (customerPrivatePool == null) {
- return null;
- }
-
- // 鏌ヨ璺熻繘璁板綍
- List<CustomerFollowUp> followUpList = customerFollowUpService.list(
- new LambdaQueryWrapper<CustomerFollowUp>()
- .eq(CustomerFollowUp::getCustomerPrivatePoolId, id)
- .orderByDesc(CustomerFollowUp::getFollowUpTime)
- );
- if (!CollectionUtils.isEmpty(followUpList)) {
- List<CustomerFollowUpDto> followUpDtoList = followUpList.stream().map(followUp -> {
- CustomerFollowUpDto followUpDto = new CustomerFollowUpDto();
- BeanUtils.copyProperties(followUp, followUpDto);
-
- // 鏌ヨ闄勪欢
- List<CustomerFollowUpFile> fileList = customerFollowUpFileService.list(
- new LambdaQueryWrapper<CustomerFollowUpFile>()
- .eq(CustomerFollowUpFile::getFollowUpId, followUp.getId())
- );
- followUpDto.setFileList(fileList);
-
- return followUpDto;
- }).collect(Collectors.toList());
-
- customerPrivatePool.setFollowUpList(followUpDtoList);
- }
-
- return customerPrivatePool;
- }
-
- @Override
- public Boolean updateCustomerPrivatePoolDto(CustomerPrivatePoolDto customerPrivatePoolDto) {
- if (customerPrivatePoolDto.getType() == 0L) {
- CustomerPrivate byId = customerPrivateMapper.selectById(customerPrivatePoolDto.getCustomerId());
- BeanUtils.copyProperties(customerPrivatePoolDto, byId);
- byId.setId(customerPrivatePoolDto.getCustomerId());
- customerPrivateMapper.updateById(byId);
- } else if (customerPrivatePoolDto.getType() == 1L) {
- Customer customer = customerService.getById(customerPrivatePoolDto.getCustomerId());
- BeanUtils.copyProperties(customerPrivatePoolDto, customer);
- customer.setId(customerPrivatePoolDto.getCustomerId());
- customerService.updateById(customer);
- }
- return true;
- }
-
- @Override
- public CustomerPrivatePoolDto getbyId(Long id) {
- CustomerPrivatePoolDto customerPrivatePool = customerPrivatePoolMapper.selectInfo(id);
- return customerPrivatePool;
- }
-
- @Override
- public List<CustomerPrivatePoolDto> selectCustomerPrivatePoolDtoListByIds(List<Long> ids) {
- ArrayList<CustomerPrivatePoolDto> customerPrivatePoolDtos = new ArrayList<>();
- for (Long id : ids) {
- CustomerPrivatePoolDto customerPrivatePoolDto = customerPrivatePoolMapper.selectInfo(id);
- customerPrivatePoolDtos.add(customerPrivatePoolDto);
- }
- return customerPrivatePoolDtos;
- }
-
- @Override
- public List<CustomerPrivatePoolDto> selectCustomerPrivatePoolDtoLists(CustomerPrivatePoolDto customerPrivatePoolDto) {
-
- return customerPrivatePoolMapper.selectInfos();
- }
-}
diff --git a/src/main/java/com/ruoyi/basic/service/impl/CustomerPrivateServiceImpl.java b/src/main/java/com/ruoyi/basic/service/impl/CustomerPrivateServiceImpl.java
deleted file mode 100644
index 4521155..0000000
--- a/src/main/java/com/ruoyi/basic/service/impl/CustomerPrivateServiceImpl.java
+++ /dev/null
@@ -1,121 +0,0 @@
-package com.ruoyi.basic.service.impl;
-
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.basic.dto.CustomerPrivateDto;
-import com.ruoyi.basic.mapper.CustomerPrivateMapper;
-import com.ruoyi.basic.mapper.CustomerPrivatePoolMapper;
-import com.ruoyi.basic.pojo.CustomerFollowUp;
-import com.ruoyi.basic.pojo.CustomerPrivate;
-import com.ruoyi.basic.pojo.CustomerPrivatePool;
-import com.ruoyi.basic.pojo.CustomerReturnVisit;
-import com.ruoyi.basic.service.CustomerFollowUpService;
-import com.ruoyi.basic.service.CustomerPrivateService;
-import com.ruoyi.basic.service.CustomerReturnVisitService;
-import com.ruoyi.common.utils.SecurityUtils;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.framework.web.domain.R;
-import com.ruoyi.sales.mapper.SalesLedgerMapper;
-import com.ruoyi.sales.pojo.SalesLedger;
-import lombok.RequiredArgsConstructor;
-import org.springframework.beans.BeanUtils;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.CollectionUtils;
-import org.springframework.web.multipart.MultipartFile;
-
-import java.util.List;
-import java.util.stream.Collectors;
-
-/**
- * <p>
- * 瀹㈡埛妗f 鏈嶅姟瀹炵幇绫�
- * </p>
- *
- * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
- * @since 2026-04-17 10:39:09
- */
-@Service
-@Transactional(rollbackFor = Exception.class)
-@RequiredArgsConstructor
-public class CustomerPrivateServiceImpl extends ServiceImpl<CustomerPrivateMapper, CustomerPrivate> implements CustomerPrivateService {
-
-
- private final CustomerPrivatePoolMapper customerPrivatePoolMapper;
-
- private final CustomerFollowUpService customerFollowUpService;
-
- private final CustomerReturnVisitService customerReturnVisitService;
- private final SalesLedgerMapper salesLedgerMapper;
-
- private final CustomerPrivateMapper customerPrivateMapper;
-
-
- @Override
- public Boolean add(CustomerPrivateDto customerPrivateDto) {
- //鏂板绉佹捣 瀹㈡埛
- this.save(customerPrivateDto);
- //鏂板绉佹捣璁板綍
- CustomerPrivatePool customerPrivatePool = new CustomerPrivatePool();
- customerPrivatePool.setCustomerId(customerPrivateDto.getId());
- customerPrivatePool.setType(0L);
- customerPrivatePool.setBoundId(SecurityUtils.getLoginUser().getUserId());
- customerPrivatePoolMapper.insert(customerPrivatePool);
- return true;
- }
-
-
- @Override
- public Integer delete(List<Long> ids) {
- List<CustomerPrivatePool> customerPrivatePools = customerPrivatePoolMapper.selectList(new QueryWrapper<CustomerPrivatePool>().lambda().in(CustomerPrivatePool::getId, ids));
- List<SalesLedger> salesLedgers = salesLedgerMapper.selectList(new QueryWrapper<SalesLedger>().lambda().in(SalesLedger::getCustomerId, customerPrivatePools.stream().map(CustomerPrivatePool::getCustomerId).collect(Collectors.toList())));
- if (!CollectionUtils.isEmpty(salesLedgers)) {
- throw new RuntimeException("瀹㈡埛鏈夐攢鍞悎鍚岋紝璇峰厛鍒犻櫎閿�鍞悎鍚�");
- }
- if (CollectionUtils.isEmpty(customerPrivatePools)) {
- throw new RuntimeException("瀹㈡埛涓嶅瓨鍦�");
- }
- customerFollowUpService.remove(new QueryWrapper<CustomerFollowUp>().lambda().in(CustomerFollowUp::getCustomerPrivatePoolId, customerPrivatePools.stream().map(CustomerPrivatePool::getCustomerId).collect(Collectors.toList())));
- customerReturnVisitService.remove(new QueryWrapper<CustomerReturnVisit>().lambda().in(CustomerReturnVisit::getCustomerPrivatePoolId, customerPrivatePools.stream().map(CustomerPrivatePool::getCustomerId).collect(Collectors.toList())));
- customerPrivatePools.stream().forEach(customerPrivatePool -> {
- customerPrivatePool.setDeleteFlag(1);
- customerPrivatePoolMapper.updateById(customerPrivatePool);
- });
- return 1;
-
- }
-
- @Override
- public R importData(MultipartFile file) {
- try {
- List<CustomerPrivate> existingList = customerPrivateMapper.selectList(null);
- java.util.Set<String> existingCustomerNames = existingList.stream()
- .map(CustomerPrivate::getCustomerName)
- .collect(Collectors.toSet());
-
- ExcelUtil<CustomerPrivate> util = new ExcelUtil<CustomerPrivate>(CustomerPrivate.class);
- List<CustomerPrivate> userList = util.importExcel(file.getInputStream());
- if (CollectionUtils.isEmpty(userList)) {
- return R.fail("妯℃澘閿欒鎴栧鍏ユ暟鎹负绌�");
- }
-
- int successCount = 0;
- int skipCount = 0;
- for (CustomerPrivate user : userList) {
- if (existingCustomerNames.contains(user.getCustomerName())) {
- skipCount++;
- continue;
- }
- CustomerPrivateDto customerPrivateDto = new CustomerPrivateDto();
- BeanUtils.copyProperties(user, customerPrivateDto);
- this.add(customerPrivateDto);
- existingCustomerNames.add(user.getCustomerName());
- successCount++;
- }
- return R.ok("瀵煎叆瀹屾垚锛屾垚鍔�" + successCount + "鏉★紝璺宠繃閲嶅" + skipCount + "鏉�");
- } catch (Exception e) {
- e.printStackTrace();
- return R.fail("瀵煎叆澶辫触锛�" + e.getMessage());
- }
- }
-}
diff --git a/src/main/java/com/ruoyi/basic/service/impl/CustomerReturnVisitServiceImpl.java b/src/main/java/com/ruoyi/basic/service/impl/CustomerReturnVisitServiceImpl.java
index 9192d50..f2a1556 100644
--- a/src/main/java/com/ruoyi/basic/service/impl/CustomerReturnVisitServiceImpl.java
+++ b/src/main/java/com/ruoyi/basic/service/impl/CustomerReturnVisitServiceImpl.java
@@ -75,7 +75,7 @@
throw new ServiceException("瀹㈡埛ID涓嶈兘涓虹┖");
}
LambdaQueryWrapper<CustomerReturnVisit> queryWrapper = new LambdaQueryWrapper<>();
- queryWrapper.eq(CustomerReturnVisit::getCustomerPrivatePoolId, customerId);
+ queryWrapper.eq(CustomerReturnVisit::getCustomerId, customerId);
CustomerReturnVisit returnVisit = baseMapper.selectOne(queryWrapper);
if (returnVisit == null) {
@@ -94,7 +94,7 @@
throw new ServiceException("瀹㈡埛ID涓嶈兘涓虹┖");
}
LambdaQueryWrapper<CustomerReturnVisit> queryWrapper = new LambdaQueryWrapper<>();
- queryWrapper.eq(CustomerReturnVisit::getCustomerPrivatePoolId, customerId);
+ queryWrapper.eq(CustomerReturnVisit::getCustomerId, customerId);
List<CustomerReturnVisit> returnVisits = baseMapper.selectList(queryWrapper);
for (CustomerReturnVisit returnVisit : returnVisits) {
@@ -124,7 +124,7 @@
if (returnVisit == null) {
throw new ServiceException("鍥炶鎻愰啋鏁版嵁涓嶈兘涓虹┖");
}
- if (returnVisit.getCustomerPrivatePoolId() == null) {
+ if (returnVisit.getCustomerId() == null) {
throw new ServiceException("瀹㈡埛ID涓嶈兘涓虹┖");
}
if (returnVisit.getReminderTime() == null) {
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 b4b0232..52d01ec 100644
--- a/src/main/java/com/ruoyi/basic/service/impl/CustomerServiceImpl.java
+++ b/src/main/java/com/ruoyi/basic/service/impl/CustomerServiceImpl.java
@@ -8,23 +8,25 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.basic.dto.CustomerDto;
+import com.ruoyi.basic.dto.CustomerFollowUpDto;
import com.ruoyi.basic.mapper.CustomerMapper;
-import com.ruoyi.basic.mapper.CustomerPrivatePoolMapper;
import com.ruoyi.basic.pojo.Customer;
import com.ruoyi.basic.pojo.CustomerFollowUp;
-import com.ruoyi.basic.pojo.CustomerPrivatePool;
-import com.ruoyi.basic.service.CustomerFollowUpService;
-import com.ruoyi.basic.service.CustomerReturnVisitService;
-import com.ruoyi.basic.service.ICustomerService;
+import com.ruoyi.basic.pojo.CustomerFollowUpFile;
+import com.ruoyi.basic.pojo.CustomerUser;
+import com.ruoyi.basic.service.*;
+import com.ruoyi.basic.vo.CustomerVo;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.security.LoginUser;
-import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.framework.web.domain.R;
import com.ruoyi.sales.mapper.SalesLedgerMapper;
import com.ruoyi.sales.pojo.SalesLedger;
-import lombok.RequiredArgsConstructor;
+import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
@@ -42,15 +44,22 @@
* @date 2025-05-07
*/
@Service
-@RequiredArgsConstructor
+@AllArgsConstructor
@Slf4j
public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> implements ICustomerService {
- private final SalesLedgerMapper salesLedgerMapper;
- private final CustomerPrivatePoolMapper customerPrivatePoolMapper;
- private final CustomerMapper customerMapper;
+ @Autowired
+ private SalesLedgerMapper salesLedgerMapper;
+ @Autowired
+ private CustomerMapper customerMapper;
- private final CustomerFollowUpService customerFollowUpService;
- private final CustomerReturnVisitService customerReturnVisitService;
+ @Autowired
+ private CustomerFollowUpService customerFollowUpService;
+ @Autowired
+ private CustomerFollowUpFileService customerFollowUpFileService;
+ @Autowired
+ private CustomerReturnVisitService customerReturnVisitService;
+ @Autowired
+ private CustomerUserService customerUserService;
/**
* 鏌ヨ瀹㈡埛妗f
@@ -70,8 +79,35 @@
* @return 瀹㈡埛璇︽儏DTO
*/
@Override
- public Customer selectCustomerDetailById(Long id) {
- return this.getById( id);
+ public CustomerVo selectCustomerDetailById(Long id) {
+ CustomerVo customerVo = new CustomerVo();
+ BeanUtils.copyProperties(this.getById(id), customerVo);
+
+ // 鏌ヨ璺熻繘璁板綍
+ List<CustomerFollowUp> followUpList = customerFollowUpService.list(
+ new LambdaQueryWrapper<CustomerFollowUp>()
+ .eq(CustomerFollowUp::getCustomerId, id)
+ .orderByDesc(CustomerFollowUp::getFollowUpTime)
+ );
+ if (!com.baomidou.mybatisplus.core.toolkit.CollectionUtils.isEmpty(followUpList)) {
+ List<CustomerFollowUpDto> followUpDtoList = followUpList.stream().map(followUp -> {
+ CustomerFollowUpDto followUpDto = new CustomerFollowUpDto();
+ BeanUtils.copyProperties(followUp, followUpDto);
+
+ // 鏌ヨ闄勪欢
+ List<CustomerFollowUpFile> fileList = customerFollowUpFileService.list(
+ new LambdaQueryWrapper<CustomerFollowUpFile>()
+ .eq(CustomerFollowUpFile::getFollowUpId, followUp.getId())
+ );
+ followUpDto.setFileList(fileList);
+
+ return followUpDto;
+ }).collect(Collectors.toList());
+
+ customerVo.setFollowUpList(followUpDtoList);
+ }
+
+ return customerVo;
}
/**
@@ -81,16 +117,18 @@
* @return 瀹㈡埛妗f
*/
@Override
- public IPage<CustomerDto> selectCustomerList(Page<CustomerDto> page, CustomerDto customer) {
- IPage<CustomerDto> customerPage = customerMapper.listPage(page, customer);
+ public IPage<CustomerVo> selectCustomerList(Page<CustomerDto> page, CustomerDto customer) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ Long loginUserId = loginUser.getUserId();
+ IPage<CustomerVo> customerPage = customerMapper.listPage(page, customer, loginUserId);
- List<CustomerDto> records = customerPage.getRecords();
+ List<CustomerVo> records = customerPage.getRecords();
if (CollectionUtils.isEmpty(records)) {
return customerPage;
}
List<Long> customerIds = records.stream()
- .map(CustomerDto::getId)
+ .map(CustomerVo::getId)
.filter(Objects::nonNull)
.collect(Collectors.toList());
@@ -109,6 +147,16 @@
followUp.getFollowUpTime().atZone(ZoneId.systemDefault()).toInstant()
));
}
+
+ // 杞崲鍏变韩鐢ㄦ埛ID瀛楃涓蹭负List<Long>
+ String userIdsStr = c.getUserIdsStr();
+ if (StringUtils.isNotEmpty(userIdsStr)) {
+ List<Long> userIds = Arrays.stream(userIdsStr.split(","))
+ .map(String::trim)
+ .map(Long::parseLong)
+ .collect(Collectors.toList());
+ c.setUserIds(userIds);
+ }
});
}
@@ -118,13 +166,13 @@
private Map<Long, CustomerFollowUp> getLatestFollowUpMap(List<Long> customerIds) {
List<CustomerFollowUp> followUps = customerFollowUpService.list(
new LambdaQueryWrapper<CustomerFollowUp>()
- .in(CustomerFollowUp::getCustomerPrivatePoolId, customerIds)
+ .in(CustomerFollowUp::getCustomerId, customerIds)
.orderByDesc(CustomerFollowUp::getFollowUpTime)
);
return followUps.stream()
.collect(Collectors.toMap(
- CustomerFollowUp::getCustomerPrivatePoolId,
+ CustomerFollowUp::getCustomerId,
followUp -> followUp,
(existing, replacement) -> existing
));
@@ -172,16 +220,28 @@
if (!salesLedgers.isEmpty()) {
throw new RuntimeException("瀹㈡埛妗f涓嬫湁閿�鍞悎鍚岋紝璇峰厛鍒犻櫎閿�鍞悎鍚�");
}
- List<CustomerPrivatePool> customerPrivatePools = customerPrivatePoolMapper.selectList(new QueryWrapper<CustomerPrivatePool>().lambda().in(CustomerPrivatePool::getCustomerId, idList));
- if (!customerPrivatePools.isEmpty()) {
- throw new RuntimeException("瀹㈡埛妗f涓嬫湁瀹㈡埛绉佹捣锛岃鍏堟敹鍥炵娴锋暟鎹�");
+ // 鏌ヨ鏄惁鏈夊凡鍒嗛厤鐨勫叕娴峰鎴�
+ List<Customer> assignedPools = customerMapper.selectList(
+ new QueryWrapper<Customer>().lambda()
+ .in(Customer::getId, idList)
+ .eq(Customer::getType, 1).
+ eq(Customer::getIsAssigned, 1) // 鍏捣瀹㈡埛
+ );
+ if (!assignedPools.isEmpty()) {
+ throw new RuntimeException("瀹㈡埛妗f涓嬫湁宸插垎閰嶇殑鍏捣瀹㈡埛锛岃鍏堟敹鍥�");
}
- // 鍒犻櫎瀹㈡埛鐨勫悓鏃朵篃闇�瑕佸垹闄ゅ搴旂殑瀹㈡埛璺熼殢銆侀檮浠跺拰鍥炶鎻愰啋
+ // 鍒犻櫎瀹㈡埛鐨勫悓鏃朵篃闇�瑕佸垹闄ゅ搴旂殑瀹㈡埛璺熼殢銆侀檮浠跺拰鍥炶鎻愰啋
for (Long id : ids) {
customerFollowUpService.deleteByCustomerId(id);
customerReturnVisitService.deleteByCustomerId(id);
+ // 鍒犻櫎瀹㈡埛鐨勫叡浜叧绯�
+ customerUserService.remove(
+ new QueryWrapper<CustomerUser>().lambda()
+ .eq(CustomerUser::getCustomerId, id)
+ );
}
+ // 鍒犻櫎瀹㈡埛涓昏〃鏁版嵁
return customerMapper.deleteBatchIds(idList);
}
@@ -193,23 +253,32 @@
}
@Override
- public List<Customer> selectCustomerLists(Customer customer) {
- return customerMapper.selectList(null);
+ public List<CustomerVo> selectCustomerLists(CustomerDto customer) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ Long loginUserId = loginUser.getUserId();
+ return customerMapper.list(customer, loginUserId);
}
@Override
- public AjaxResult importData(MultipartFile file) {
+ public R importData(MultipartFile file, Integer type) {
try {
ExcelUtil<Customer> util = new ExcelUtil<Customer>(Customer.class);
List<Customer> userList = util.importExcel(file.getInputStream());
if (CollectionUtils.isEmpty(userList)) {
- return AjaxResult.warn("妯℃澘閿欒鎴栧鍏ユ暟鎹负绌�");
+ return R.fail("妯℃澘閿欒鎴栧鍏ユ暟鎹负绌�");
+ }
+
+ // 鏍规嵁 type 鍙傛暟璁剧疆瀹㈡埛绫诲瀷锛堢娴�/鍏捣锛�
+ if (type != null) {
+ userList.forEach(customer -> {
+ customer.setType(type);
+ });
}
this.saveOrUpdateBatch(userList);
- return AjaxResult.success(true);
+ return R.ok(true);
} catch (Exception e) {
e.printStackTrace();
- return AjaxResult.error("瀵煎叆澶辫触");
+ return R.fail("瀵煎叆澶辫触");
}
}
@@ -230,6 +299,86 @@
).collect(Collectors.toList());
}
+ // 鍒嗛厤鍏捣瀹㈡埛缁欑娴�
+ @Override
+ public void assignCustomer(CustomerDto customerDto) {
+ Customer customer = customerMapper.selectById(customerDto.getId());
+ if (customer.getType() == 1 && customer.getIsAssigned() == 0) { // 鍏捣涓斿彲鍒嗛厤
+ customer.setIsAssigned(1);
+ customer.setUsageStatus(1L);
+ customer.setUsageUser(customerDto.getUsageUser());
+ customerMapper.updateById(customer);
+ }
+ }
+
+ // 鍥炴敹绉佹捣瀹㈡埛鍒板叕娴�
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void recycleCustomer(CustomerDto customerDto) {
+ Customer customer = customerMapper.selectById(customerDto.getId());
+ if (customer.getType() == 1 && customer.getIsAssigned() == 1) { // 鍏捣涓斿凡鍒嗛厤
+ customer.setIsAssigned(0);
+ customer.setUsageStatus(0L);
+ customer.setUsageUser(0L);
+ customerMapper.updateById(customer);
+
+ // 鍒犻櫎璇ュ鎴风殑鎵�鏈夊叡浜叧绯�
+ customerUserService.remove(
+ new QueryWrapper<CustomerUser>().lambda()
+ .eq(CustomerUser::getCustomerId, customerDto.getId())
+ );
+ }
+ }
+
+ // 瀹㈡埛鍏变韩
+ @Override
+ public void together(CustomerDto customerDto) {
+ // 鏌ヨ鐜版湁鐨勫叡浜褰�
+ List<CustomerUser> existingUsers = customerUserService.list(
+ new QueryWrapper<CustomerUser>().lambda().eq(CustomerUser::getCustomerId, customerDto.getId())
+ );
+
+ // 鑾峰彇宸插瓨鍦ㄧ殑鐢ㄦ埛ID鍒楄〃
+ List<Long> existingUserIds = existingUsers.stream()
+ .map(CustomerUser::getUserId)
+ .collect(Collectors.toList());
+
+ // 杩囨护鎺夊凡瀛樺湪鐨勭敤鎴凤紝鍙繚鐣欐柊鐢ㄦ埛
+ List<Long> newUserIds = customerDto.getUserIds().stream()
+ .filter(userId -> !existingUserIds.contains(userId))
+ .collect(Collectors.toList());
+
+ if (CollectionUtils.isEmpty(newUserIds)) {
+ return;
+ }
+
+ // 鑾峰彇褰撳墠绉熸埛ID
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ Long tenantId = loginUser.getTenantId();
+
+ // 鎵归噺淇濆瓨鏂扮殑鍏变韩璁板綍
+ List<CustomerUser> customerUsers = newUserIds.stream()
+ .map(userId -> {
+ CustomerUser customerUser = new CustomerUser();
+ customerUser.setCustomerId(customerDto.getId());
+ customerUser.setUserId(userId);
+ customerUser.setTenantId(tenantId);
+ return customerUser;
+ })
+ .collect(Collectors.toList());
+
+ customerUserService.saveBatch(customerUsers);
+ }
+
+ @Override
+ public Boolean back(Long id) {
+ //灏嗗鎴风殑type鏀逛负1 涓旂洿鎺ュ垎閰嶇粰褰撳墠鐢ㄦ埛
+ Customer customer = customerMapper.selectById(id);
+ customer.setType(1);
+ customer.setIsAssigned(1);
+ return this.updateById(customer);
+ }
+
/**
* 涓嬪垝绾垮懡鍚嶈浆椹煎嘲鍛藉悕
*/
diff --git a/src/main/java/com/ruoyi/basic/service/impl/CustomerUserServiceImpl.java b/src/main/java/com/ruoyi/basic/service/impl/CustomerUserServiceImpl.java
new file mode 100644
index 0000000..5829e8a
--- /dev/null
+++ b/src/main/java/com/ruoyi/basic/service/impl/CustomerUserServiceImpl.java
@@ -0,0 +1,19 @@
+package com.ruoyi.basic.service.impl;
+
+import com.ruoyi.basic.mapper.CustomerUserMapper;
+import com.ruoyi.basic.pojo.CustomerUser;
+import com.ruoyi.basic.service.CustomerUserService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * 瀹㈡埛鍏变韩Service瀹炵幇绫�
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @date 2026-04-29
+ */
+@Service
+@Transactional(rollbackFor = Exception.class)
+public class CustomerUserServiceImpl extends ServiceImpl<CustomerUserMapper, CustomerUser> implements CustomerUserService {
+}
\ No newline at end of file
diff --git a/src/main/java/com/ruoyi/basic/task/ReturnVisitReminderTask.java b/src/main/java/com/ruoyi/basic/task/ReturnVisitReminderTask.java
index edc3b54..fbfb5b6 100644
--- a/src/main/java/com/ruoyi/basic/task/ReturnVisitReminderTask.java
+++ b/src/main/java/com/ruoyi/basic/task/ReturnVisitReminderTask.java
@@ -72,7 +72,7 @@
}
try {
- unipushService.sendReturnVisitReminder(returnVisitId, client.getCid(), returnVisit.getContent(), returnVisit.getCustomerPrivatePoolId());
+ unipushService.sendReturnVisitReminder(returnVisitId, client.getCid(), returnVisit.getContent(), returnVisit.getCustomerId());
CustomerReturnVisit updateObj = new CustomerReturnVisit();
updateObj.setId(returnVisitId);
updateObj.setIsCompleted(1);
diff --git a/src/main/java/com/ruoyi/basic/vo/CustomerVo.java b/src/main/java/com/ruoyi/basic/vo/CustomerVo.java
new file mode 100644
index 0000000..3d4c8cb
--- /dev/null
+++ b/src/main/java/com/ruoyi/basic/vo/CustomerVo.java
@@ -0,0 +1,28 @@
+package com.ruoyi.basic.vo;
+
+import com.ruoyi.basic.dto.CustomerFollowUpDto;
+import com.ruoyi.basic.pojo.Customer;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class CustomerVo extends Customer {
+ @ApiModelProperty(value = "璺熻繘璁板綍")
+ private List<CustomerFollowUpDto> followUpList;
+
+ private String usageUserName;
+
+ private String togetherUserNames;
+
+ /**
+ * 鍏变韩鐢ㄦ埛ID鍒楄〃
+ */
+ private List<Long> userIds;
+
+ /**
+ * 鍏变韩鐢ㄦ埛ID瀛楃涓诧紙SQL鏌ヨ杩斿洖锛岀敤浜庤浆鎹负List锛�
+ */
+ private String userIdsStr;
+}
diff --git a/src/main/java/com/ruoyi/procurementrecord/utils/StockUtils.java b/src/main/java/com/ruoyi/procurementrecord/utils/StockUtils.java
index 394fd3a..f561b49 100644
--- a/src/main/java/com/ruoyi/procurementrecord/utils/StockUtils.java
+++ b/src/main/java/com/ruoyi/procurementrecord/utils/StockUtils.java
@@ -44,7 +44,7 @@
stockUninventoryDto.setRecordType(String.valueOf(recordType));
stockUninventoryDto.setQualitity(quantity);
stockUninventoryDto.setProductModelId(productModelId);
- stockUninventoryService.addStockUninventory(stockUninventoryDto);
+ stockUninventoryService.addStockInRecordOnly(stockUninventoryDto);
}
/**
@@ -77,7 +77,7 @@
stockInventoryDto.setRecordType(String.valueOf(recordType));
stockInventoryDto.setQualitity(quantity);
stockInventoryDto.setProductModelId(productModelId);
- stockInventoryService.addstockInventory(stockInventoryDto);
+ stockInventoryService.addStockInRecordOnly(stockInventoryDto);
}
/**
diff --git a/src/main/java/com/ruoyi/production/bean/dto/ProductionOperationTaskDto.java b/src/main/java/com/ruoyi/production/bean/dto/ProductionOperationTaskDto.java
index 4326c95..965cbf3 100644
--- a/src/main/java/com/ruoyi/production/bean/dto/ProductionOperationTaskDto.java
+++ b/src/main/java/com/ruoyi/production/bean/dto/ProductionOperationTaskDto.java
@@ -4,8 +4,10 @@
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
+import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
+import java.time.LocalDate;
@EqualsAndHashCode(callSuper = true)
@Data
@@ -31,4 +33,15 @@
@Schema(description = "瀹屾垚杩涘害")
private BigDecimal completionStatus;
+
+ @Schema(description = "璁㈠崟鍙�")
+ private String npsNo;
+
+ @Schema(description = "寮�濮嬫棩鏈�")
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ private LocalDate startDate;
+
+ @Schema(description = "缁撴潫鏃ユ湡")
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ private LocalDate endDate;
}
diff --git a/src/main/java/com/ruoyi/production/bean/vo/ProductionOperationTaskVo.java b/src/main/java/com/ruoyi/production/bean/vo/ProductionOperationTaskVo.java
index decdc39..6c7c5a7 100644
--- a/src/main/java/com/ruoyi/production/bean/vo/ProductionOperationTaskVo.java
+++ b/src/main/java/com/ruoyi/production/bean/vo/ProductionOperationTaskVo.java
@@ -29,6 +29,15 @@
@Schema(description = "宸ュ崟绫诲瀷 姝e父/杩斿伐杩斾慨")
private String workOrderType;
+ @Schema(description = "鐢熶骇浠诲姟鏁�")
+ private Long productionTaskCount;
+
+ @Schema(description = "鑹搧鏁�")
+ private BigDecimal goodQuantity;
+
+ @Schema(description = "鎶ュ簾鏁伴噺")
+ private BigDecimal scrapQty;
+
@Schema(description = "瀹屾垚杩涘害")
private BigDecimal completionStatus;
diff --git a/src/main/java/com/ruoyi/production/bean/vo/ProductionOrderVo.java b/src/main/java/com/ruoyi/production/bean/vo/ProductionOrderVo.java
index f3b48a6..1bb26a4 100644
--- a/src/main/java/com/ruoyi/production/bean/vo/ProductionOrderVo.java
+++ b/src/main/java/com/ruoyi/production/bean/vo/ProductionOrderVo.java
@@ -36,4 +36,7 @@
@Schema(description = "瀹屾垚杩涘害")
private BigDecimal completionStatus;
+
+ @Schema(description = "鏄惁宸查��鏂�")
+ private Boolean returned;
}
diff --git a/src/main/java/com/ruoyi/production/bean/vo/ProductionOrderWorkOrderDetailVo.java b/src/main/java/com/ruoyi/production/bean/vo/ProductionOrderWorkOrderDetailVo.java
index ecbb0f2..2a0571d 100644
--- a/src/main/java/com/ruoyi/production/bean/vo/ProductionOrderWorkOrderDetailVo.java
+++ b/src/main/java/com/ruoyi/production/bean/vo/ProductionOrderWorkOrderDetailVo.java
@@ -1,6 +1,5 @@
package com.ruoyi.production.bean.vo;
-import com.ruoyi.production.pojo.ProductionOperationTask;
import com.ruoyi.production.pojo.ProductionOrderRoutingOperationParam;
import com.ruoyi.production.pojo.ProductionProductMain;
import com.ruoyi.production.pojo.ProductionProductOutput;
@@ -13,54 +12,63 @@
import java.util.List;
@Data
-@Schema(name = "ProductionOrderWorkOrderDetailVo", description = "Production order work order/report/inspect detail")
+@Schema(name = "ProductionOrderWorkOrderDetailVo", description = "鐢熶骇杩芥函杩斿洖瀵硅薄")
public class ProductionOrderWorkOrderDetailVo {
- @Schema(description = "Production order info")
+ @Schema(description = "璁㈠崟")
private ProductionOrderVo productionOrder;
- @Schema(description = "Work order list")
+ @Schema(description = "宸ュ崟鏄庣粏鍒楄〃")
private List<WorkOrderDetail> workOrderList;
@Data
- @Schema(name = "WorkOrderDetail", description = "Work order detail")
+ @Schema(name = "WorkOrderDetail", description = "宸ュ崟鏄庣粏")
public static class WorkOrderDetail {
- @Schema(description = "Work order info")
- private ProductionOperationTask workOrder;
+ @Schema(description = "宸ュ崟淇℃伅")
+ private ProductionOperationTaskVo workOrder;
- @Schema(description = "Report list under current work order")
+ @Schema(description = "鎶ュ伐璇︽儏鍒楄〃")
private List<ReportDetail> reportList;
- }
- @Data
- @Schema(name = "ReportDetail", description = "Production report detail")
- public static class ReportDetail {
-
- @Schema(description = "Report main info")
- private ProductionProductMain reportMain;
-
- @Schema(description = "Report output list")
- private List<ProductionProductOutput> reportOutputList;
-
- @Schema(description = "Report process param list")
- private List<ProductionOrderRoutingOperationParam> reportParamList;
-
- @Schema(description = "Inspect list under current report")
+ @Schema(description = "璐ㄦ璇︽儏鍒楄〃")
private List<InspectDetail> inspectList;
}
@Data
- @Schema(name = "InspectDetail", description = "Quality inspect detail")
+ @Schema(name = "ReportDetail", description = "鎶ュ伐璇︽儏")
+ public static class ReportDetail {
+
+ @Schema(description = "鎶ュ伐涓讳俊鎭�")
+ private ProductionProductMain reportMain;
+
+ @Schema(description = "鎶ュ伐浜у嚭鏄庣粏")
+ private List<ProductionProductOutput> reportOutputList;
+
+ @Schema(description = "鎶ュ伐宸ュ簭鍙傛暟")
+ private List<ProductionOrderRoutingOperationParam> reportParamList;
+ }
+
+ @Data
+ @Schema(name = "InspectDetail", description = "璐ㄦ璇︽儏")
public static class InspectDetail {
- @Schema(description = "Inspect main info")
+ @Schema(description = "鎶ュ伐ID")
+ private Long reportId;
+
+ @Schema(description = "鎶ュ伐鍗曞彿")
+ private String reportNo;
+
+ @Schema(description = "鎶ュ伐涓讳俊鎭�")
+ private ProductionProductMain reportMain;
+
+ @Schema(description = "璐ㄦ涓讳俊鎭�")
private QualityInspect inspect;
- @Schema(description = "Inspect param list")
+ @Schema(description = "璐ㄦ鎸囨爣鏄庣粏")
private List<QualityInspectParam> inspectParamList;
- @Schema(description = "Inspect attachment list")
+ @Schema(description = "璐ㄦ闄勪欢鍒楄〃")
private List<QualityInspectFile> inspectFileList;
}
}
diff --git a/src/main/java/com/ruoyi/production/controller/ProductionOperationTaskController.java b/src/main/java/com/ruoyi/production/controller/ProductionOperationTaskController.java
index af6184a..56ed8c2 100644
--- a/src/main/java/com/ruoyi/production/controller/ProductionOperationTaskController.java
+++ b/src/main/java/com/ruoyi/production/controller/ProductionOperationTaskController.java
@@ -70,14 +70,16 @@
return R.ok(productionOperationTaskService.assign(dto));
}
- /**
- * 宸ュ崟娴佽浆鍗′笅杞�
- * @param response
- * @param dto
- */
@PostMapping("/down")
+ @Operation(summary = "宸ュ崟娴佽浆鍗′笅杞�")
public void down(HttpServletResponse response, @RequestBody ProductionOperationTaskDto dto) {
productionOperationTaskService.down(response, dto);
}
+ @GetMapping("/getOperation")
+ @Operation(summary = "宸ュ簭璇︽儏鏌ヨ")
+ public R<List<ProductionOperationTaskVo>> getOperation(ProductionOperationTaskDto dto) {
+ return R.ok(productionOperationTaskService.getOperation(dto));
+ }
+
}
diff --git a/src/main/java/com/ruoyi/production/controller/ProductionOrderController.java b/src/main/java/com/ruoyi/production/controller/ProductionOrderController.java
index 53a22a7..b5f7b97 100644
--- a/src/main/java/com/ruoyi/production/controller/ProductionOrderController.java
+++ b/src/main/java/com/ruoyi/production/controller/ProductionOrderController.java
@@ -84,10 +84,10 @@
return R.ok(productionOrderService.pick(productionOrderId));
}
- @GetMapping("/workOrder/detail/{productionOrderId}")
- @Operation(summary = "Query work orders/reports/inspects by production order id")
- public R<ProductionOrderWorkOrderDetailVo> getWorkOrderReportInspectDetail(@PathVariable Long productionOrderId) {
- return R.ok(productionOrderService.getWorkOrderReportInspectDetail(productionOrderId));
+ @GetMapping("/ordeDetail")
+ @Operation(summary = "鐢熶骇杩芥函")
+ public R<ProductionOrderWorkOrderDetailVo> getWorkOrderReportInspectDetail(ProductionOrderDto productionOrderDto) {
+ return R.ok(productionOrderService.getWorkOrderReportInspectDetail(productionOrderDto));
}
@Operation(summary = "鏇存柊璁㈠崟鐘舵��")
diff --git a/src/main/java/com/ruoyi/production/mapper/ProductionOperationTaskMapper.java b/src/main/java/com/ruoyi/production/mapper/ProductionOperationTaskMapper.java
index 4349537..a09dd6f 100644
--- a/src/main/java/com/ruoyi/production/mapper/ProductionOperationTaskMapper.java
+++ b/src/main/java/com/ruoyi/production/mapper/ProductionOperationTaskMapper.java
@@ -41,4 +41,6 @@
@Param("processIds") List<Long> processIds);
ProductionOperationTaskDto getProductWorkOrderFlowCard(@Param("id") Long id);
+
+ List<ProductionOperationTaskVo> getOperation(@Param("c") ProductionOperationTaskDto dto);
}
diff --git a/src/main/java/com/ruoyi/production/service/ProductionOperationTaskService.java b/src/main/java/com/ruoyi/production/service/ProductionOperationTaskService.java
index 2735cc3..0945c6a 100644
--- a/src/main/java/com/ruoyi/production/service/ProductionOperationTaskService.java
+++ b/src/main/java/com/ruoyi/production/service/ProductionOperationTaskService.java
@@ -28,4 +28,6 @@
boolean assign(ProductionOperationTaskDto dto);
void down(HttpServletResponse response, ProductionOperationTaskDto dto);
+
+ List<ProductionOperationTaskVo> getOperation(ProductionOperationTaskDto dto);
}
diff --git a/src/main/java/com/ruoyi/production/service/ProductionOrderService.java b/src/main/java/com/ruoyi/production/service/ProductionOrderService.java
index 7e588dc..deeb0dd 100644
--- a/src/main/java/com/ruoyi/production/service/ProductionOrderService.java
+++ b/src/main/java/com/ruoyi/production/service/ProductionOrderService.java
@@ -32,7 +32,7 @@
List<ProductionOrderPickVo> pick(Long productionOrderId);
- ProductionOrderWorkOrderDetailVo getWorkOrderReportInspectDetail(Long productionOrderId);
+ ProductionOrderWorkOrderDetailVo getWorkOrderReportInspectDetail(ProductionOrderDto productionOrderDto);
int updateOrder(ProductionOrderDto productionOrderDto);
}
diff --git a/src/main/java/com/ruoyi/production/service/impl/ProductionOperationTaskServiceImpl.java b/src/main/java/com/ruoyi/production/service/impl/ProductionOperationTaskServiceImpl.java
index aad1350..383193b 100644
--- a/src/main/java/com/ruoyi/production/service/impl/ProductionOperationTaskServiceImpl.java
+++ b/src/main/java/com/ruoyi/production/service/impl/ProductionOperationTaskServiceImpl.java
@@ -347,4 +347,9 @@
return null;
}
}
+
+ @Override
+ public List<ProductionOperationTaskVo> getOperation(ProductionOperationTaskDto dto) {
+ return baseMapper.getOperation(dto);
+ }
}
diff --git a/src/main/java/com/ruoyi/production/service/impl/ProductionOrderPickServiceImpl.java b/src/main/java/com/ruoyi/production/service/impl/ProductionOrderPickServiceImpl.java
index 72a237e..f45c117 100644
--- a/src/main/java/com/ruoyi/production/service/impl/ProductionOrderPickServiceImpl.java
+++ b/src/main/java/com/ruoyi/production/service/impl/ProductionOrderPickServiceImpl.java
@@ -673,8 +673,8 @@
if (dto.getProductModelId() == null) {
throw new ServiceException("绗�" + rowNo + "鏉′骇鍝佽鏍糏D涓嶈兘涓虹┖");
}
- if (dto.getPickQuantity() == null || dto.getPickQuantity().compareTo(BigDecimal.ZERO) <= 0) {
- throw new ServiceException("绗�" + rowNo + "鏉¢鏂欐暟閲忓繀椤诲ぇ浜�0");
+ if (dto.getPickQuantity() == null || dto.getPickQuantity().compareTo(BigDecimal.ZERO) < 0) {
+ throw new ServiceException("绗�" + rowNo + "鏉¢鏂欐暟閲忎笉鑳藉皬浜�0");
}
if (dto.getPickType() != null && dto.getPickType() != PICK_TYPE_NORMAL && dto.getPickType() != PICK_TYPE_FEEDING) {
throw new ServiceException("绗�" + rowNo + "鏉¢鏂欑被鍨嬪彧鑳芥槸1鎴�2");
@@ -688,8 +688,8 @@
if (dto.getId() == null) {
throw new ServiceException("绗�" + rowNo + "鏉¢鏂橧D涓嶈兘涓虹┖");
}
- if (dto.getFeedingQuantity() == null || dto.getFeedingQuantity().compareTo(BigDecimal.ZERO) <= 0) {
- throw new ServiceException("绗�" + rowNo + "鏉℃湰娆¤ˉ鏂欐暟閲忓繀椤诲ぇ浜�0");
+ if (dto.getFeedingQuantity() == null || dto.getFeedingQuantity().compareTo(BigDecimal.ZERO) < 0) {
+ throw new ServiceException("绗�" + rowNo + "鏉℃湰娆¤ˉ鏂欐暟閲忎笉鑳藉皬浜�0");
}
if (!isFeedingPick(dto)) {
throw new ServiceException("绗�" + rowNo + "鏉¤ˉ鏂欑被鍨嬪繀椤讳负2");
diff --git a/src/main/java/com/ruoyi/production/service/impl/ProductionOrderServiceImpl.java b/src/main/java/com/ruoyi/production/service/impl/ProductionOrderServiceImpl.java
index 90c5e5c..9973d98 100644
--- a/src/main/java/com/ruoyi/production/service/impl/ProductionOrderServiceImpl.java
+++ b/src/main/java/com/ruoyi/production/service/impl/ProductionOrderServiceImpl.java
@@ -14,8 +14,10 @@
import com.ruoyi.basic.utils.FileUtil;
import com.ruoyi.common.constant.StorageAttachmentConstants;
import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.production.bean.dto.ProductionOperationTaskDto;
import com.ruoyi.production.bean.dto.ProductionOrderDto;
import com.ruoyi.production.bean.vo.ProductionBomStructureVo;
+import com.ruoyi.production.bean.vo.ProductionOperationTaskVo;
import com.ruoyi.production.bean.vo.ProductionOrderPickVo;
import com.ruoyi.production.bean.vo.ProductionOrderVo;
import com.ruoyi.production.bean.vo.ProductionPlanVo;
@@ -681,29 +683,33 @@
}
@Override
- public ProductionOrderWorkOrderDetailVo getWorkOrderReportInspectDetail(Long productionOrderId) {
- if (productionOrderId == null) {
- throw new ServiceException("productionOrderId can not be null");
- }
+ public ProductionOrderWorkOrderDetailVo getWorkOrderReportInspectDetail(ProductionOrderDto dto) {
+ Long productionOrderId = resolveProductionOrderId(dto);
ProductionOrderVo orderInfo = getProductionOrderInfo(productionOrderId);
if (orderInfo == null) {
- throw new ServiceException("production order not found");
+ throw new ServiceException("鐢熶骇璁㈠崟涓嶅瓨鍦�");
}
ProductionOrderWorkOrderDetailVo detailVo = new ProductionOrderWorkOrderDetailVo();
detailVo.setProductionOrder(orderInfo);
- List<ProductionOperationTask> workOrderList = productionOperationTaskMapper.selectList(
- Wrappers.<ProductionOperationTask>lambdaQuery()
- .eq(ProductionOperationTask::getProductionOrderId, productionOrderId)
- .orderByAsc(ProductionOperationTask::getId));
+ ProductionOperationTaskDto taskQuery = new ProductionOperationTaskDto();
+ taskQuery.setProductionOrderId(productionOrderId);
+ IPage<ProductionOperationTaskVo> workOrderPage = productionOperationTaskMapper.pageProductionOperationTask(
+ new Page<ProductionOperationTaskVo>(1, -1), taskQuery);
+ List<ProductionOperationTaskVo> workOrderList = workOrderPage == null || workOrderPage.getRecords() == null
+ ? Collections.emptyList()
+ : workOrderPage.getRecords().stream()
+ .filter(Objects::nonNull)
+ .sorted(Comparator.comparing(ProductionOperationTaskVo::getId, Comparator.nullsLast(Comparator.naturalOrder())))
+ .collect(Collectors.toList());
if (workOrderList == null || workOrderList.isEmpty()) {
detailVo.setWorkOrderList(Collections.emptyList());
return detailVo;
}
List<Long> workOrderIdList = workOrderList.stream()
- .map(ProductionOperationTask::getId)
+ .map(ProductionOperationTaskVo::getId)
.filter(Objects::nonNull)
.collect(Collectors.toList());
List<ProductionProductMain> reportMainList = workOrderIdList.isEmpty()
@@ -712,12 +718,12 @@
Wrappers.<ProductionProductMain>lambdaQuery()
.in(ProductionProductMain::getProductionOperationTaskId, workOrderIdList)
.orderByAsc(ProductionProductMain::getId));
- Map<Long, List<ProductionProductMain>> reportMainMap = new LinkedHashMap<>();
+ Map<Long, List<ProductionProductMain>> reportMainByWorkOrderMap = new LinkedHashMap<>();
for (ProductionProductMain reportMain : reportMainList) {
if (reportMain == null || reportMain.getProductionOperationTaskId() == null) {
continue;
}
- reportMainMap.computeIfAbsent(reportMain.getProductionOperationTaskId(), k -> new ArrayList<>()).add(reportMain);
+ reportMainByWorkOrderMap.computeIfAbsent(reportMain.getProductionOperationTaskId(), key -> new ArrayList<>()).add(reportMain);
}
List<Long> reportMainIdList = reportMainList.stream()
@@ -766,7 +772,7 @@
if (inspect == null || inspect.getProductMainId() == null) {
continue;
}
- inspectMap.computeIfAbsent(inspect.getProductMainId(), k -> new ArrayList<>()).add(inspect);
+ inspectMap.computeIfAbsent(inspect.getProductMainId(), key -> new ArrayList<>()).add(inspect);
}
List<Long> inspectIdList = inspectList.stream()
@@ -799,42 +805,44 @@
}
List<ProductionOrderWorkOrderDetailVo.WorkOrderDetail> workOrderDetailList = new ArrayList<>();
- for (ProductionOperationTask workOrder : workOrderList) {
+ for (ProductionOperationTaskVo workOrder : workOrderList) {
ProductionOrderWorkOrderDetailVo.WorkOrderDetail workOrderDetail = new ProductionOrderWorkOrderDetailVo.WorkOrderDetail();
workOrderDetail.setWorkOrder(workOrder);
- List<ProductionProductMain> workOrderReportMainList = reportMainMap.get(workOrder.getId());
- if (workOrderReportMainList == null || workOrderReportMainList.isEmpty()) {
+ List<ProductionProductMain> workOrderReportMainList = reportMainByWorkOrderMap.getOrDefault(workOrder.getId(), Collections.emptyList());
+ if (workOrderReportMainList.isEmpty()) {
workOrderDetail.setReportList(Collections.emptyList());
+ workOrderDetail.setInspectList(Collections.emptyList());
workOrderDetailList.add(workOrderDetail);
continue;
}
List<ProductionOrderWorkOrderDetailVo.ReportDetail> reportDetailList = new ArrayList<>();
+ List<ProductionOrderWorkOrderDetailVo.InspectDetail> inspectDetailList = new ArrayList<>();
for (ProductionProductMain reportMain : workOrderReportMainList) {
Long reportMainId = reportMain.getId();
+
ProductionOrderWorkOrderDetailVo.ReportDetail reportDetail = new ProductionOrderWorkOrderDetailVo.ReportDetail();
reportDetail.setReportMain(reportMain);
reportDetail.setReportOutputList(reportOutputMap.getOrDefault(reportMainId, Collections.emptyList()));
reportDetail.setReportParamList(reportParamMap.getOrDefault(reportMainId, Collections.emptyList()));
-
- List<QualityInspect> reportInspectList = inspectMap.get(reportMainId);
- if (reportInspectList == null || reportInspectList.isEmpty()) {
- reportDetail.setInspectList(Collections.emptyList());
- } else {
- List<ProductionOrderWorkOrderDetailVo.InspectDetail> inspectDetailList = new ArrayList<>();
- for (QualityInspect inspect : reportInspectList) {
- ProductionOrderWorkOrderDetailVo.InspectDetail inspectDetail = new ProductionOrderWorkOrderDetailVo.InspectDetail();
- inspectDetail.setInspect(inspect);
- inspectDetail.setInspectParamList(inspectParamMap.getOrDefault(inspect.getId(), Collections.emptyList()));
- inspectDetail.setInspectFileList(inspectFileMap.getOrDefault(inspect.getId(), Collections.emptyList()));
- inspectDetailList.add(inspectDetail);
- }
- reportDetail.setInspectList(inspectDetailList);
- }
reportDetailList.add(reportDetail);
+
+ List<QualityInspect> reportInspectList = inspectMap.getOrDefault(reportMainId, Collections.emptyList());
+ for (QualityInspect inspect : reportInspectList) {
+ ProductionOrderWorkOrderDetailVo.InspectDetail inspectDetail = new ProductionOrderWorkOrderDetailVo.InspectDetail();
+ inspectDetail.setReportId(reportMainId);
+ inspectDetail.setReportNo(reportMain.getProductNo());
+ inspectDetail.setReportMain(reportMain);
+ inspectDetail.setInspect(inspect);
+ inspectDetail.setInspectParamList(inspectParamMap.getOrDefault(inspect.getId(), Collections.emptyList()));
+ inspectDetail.setInspectFileList(inspectFileMap.getOrDefault(inspect.getId(), Collections.emptyList()));
+ inspectDetailList.add(inspectDetail);
+ }
}
+
workOrderDetail.setReportList(reportDetailList);
+ workOrderDetail.setInspectList(inspectDetailList);
workOrderDetailList.add(workOrderDetail);
}
@@ -842,6 +850,26 @@
return detailVo;
}
+ private Long resolveProductionOrderId(ProductionOrderDto dto) {
+ if (dto == null) {
+ throw new ServiceException("璇蜂紶鍏ョ敓浜ц鍗旾D鎴栫敓浜ц鍗曞彿");
+ }
+ if (dto.getId() != null) {
+ return dto.getId();
+ }
+ if (dto.getNpsNo() == null || dto.getNpsNo().trim().isEmpty()) {
+ throw new ServiceException("璇蜂紶鍏ョ敓浜ц鍗旾D鎴栫敓浜ц鍗曞彿");
+ }
+ ProductionOrder productionOrder = baseMapper.selectOne(
+ Wrappers.<ProductionOrder>lambdaQuery()
+ .eq(ProductionOrder::getNpsNo, dto.getNpsNo().trim())
+ .last("limit 1"));
+ if (productionOrder == null || productionOrder.getId() == null) {
+ throw new ServiceException("鐢熶骇璁㈠崟涓嶅瓨鍦�");
+ }
+ return productionOrder.getId();
+ }
+
@Override
public List<ProductionOrderPickVo> pick(Long productionOrderId) {
if (productionOrderId == null) {
diff --git a/src/main/java/com/ruoyi/project/system/service/impl/UnipushService.java b/src/main/java/com/ruoyi/project/system/service/impl/UnipushService.java
index af06bbc..c331756 100644
--- a/src/main/java/com/ruoyi/project/system/service/impl/UnipushService.java
+++ b/src/main/java/com/ruoyi/project/system/service/impl/UnipushService.java
@@ -136,7 +136,7 @@
/**
* 鍙戦�佸洖璁挎彁閱�
*/
- public void sendReturnVisitReminder(Long returnVisitId, String cid, String content, Integer customerId) {
+ public void sendReturnVisitReminder(Long returnVisitId, String cid, String content, Long customerId) {
String targetPath = "pages/cooperativeOffice/customerManage/detail?customerId=" + customerId;
sendRoutingPush(returnVisitId, cid, "瀹㈡埛鍥炶鎻愰啋", content, targetPath, false);
}
diff --git a/src/main/java/com/ruoyi/purchase/dto/PurchaseLedgerDto.java b/src/main/java/com/ruoyi/purchase/dto/PurchaseLedgerDto.java
index c6b1406..455dc9b 100644
--- a/src/main/java/com/ruoyi/purchase/dto/PurchaseLedgerDto.java
+++ b/src/main/java/com/ruoyi/purchase/dto/PurchaseLedgerDto.java
@@ -48,11 +48,11 @@
*/
@Excel(name = "渚涘簲鍟嗗悕绉�")
private String supplierName;
- /**
- * 鏄惁鐧藉悕鍗�
- */
- @Excel(name = "鏄惁鐧藉悕鍗�")
- private Integer isWhite;
+// /**
+// * 鏄惁鐧藉悕鍗�
+// */
+// @Excel(name = "鏄惁鐧藉悕鍗�")
+// private Integer isWhite;
/**
* 褰曞叆浜哄鍚峣d
diff --git a/src/main/java/com/ruoyi/purchase/service/impl/PurchaseLedgerServiceImpl.java b/src/main/java/com/ruoyi/purchase/service/impl/PurchaseLedgerServiceImpl.java
index c4a48cd..91fb7b9 100644
--- a/src/main/java/com/ruoyi/purchase/service/impl/PurchaseLedgerServiceImpl.java
+++ b/src/main/java/com/ruoyi/purchase/service/impl/PurchaseLedgerServiceImpl.java
@@ -132,6 +132,8 @@
@Transactional(rollbackFor = Exception.class)
public int addOrEditPurchase(PurchaseLedgerDto purchaseLedgerDto) throws Exception {
PurchaseLedger purchaseLedger = new PurchaseLedger();
+ // DTO杞珽ntity
+ BeanUtils.copyProperties(purchaseLedgerDto, purchaseLedger);
SalesLedger salesLedger = salesLedgerMapper.selectById(purchaseLedgerDto.getSalesLedgerId());
//褰曞叆浜�
SysUser sysUser = userMapper.selectUserById(purchaseLedgerDto.getRecorderId());
@@ -146,9 +148,6 @@
SupplierManage supplierManage = supplierManageMapper.selectById(purchaseLedgerDto.getSupplierId());
- // DTO杞珽ntity
-
- BeanUtils.copyProperties(purchaseLedgerDto, purchaseLedger);
LoginUser loginUser = SecurityUtils.getLoginUser();
if (ObjectUtils.isNotEmpty(loginUser) && null != loginUser.getTenantId()) {
purchaseLedger.setTenantId(loginUser.getTenantId());
diff --git a/src/main/java/com/ruoyi/sales/controller/ShippingInfoController.java b/src/main/java/com/ruoyi/sales/controller/ShippingInfoController.java
index 46597fb..458be2d 100644
--- a/src/main/java/com/ruoyi/sales/controller/ShippingInfoController.java
+++ b/src/main/java/com/ruoyi/sales/controller/ShippingInfoController.java
@@ -2,8 +2,8 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.approve.service.impl.ApproveProcessServiceImpl;
import com.ruoyi.approve.bean.vo.ApproveProcessVO;
+import com.ruoyi.approve.service.impl.ApproveProcessServiceImpl;
import com.ruoyi.common.utils.OrderUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
@@ -12,12 +12,13 @@
import com.ruoyi.framework.security.LoginUser;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.framework.web.domain.R;
import com.ruoyi.sales.dto.ShippingInfoDto;
import com.ruoyi.sales.mapper.ShippingInfoMapper;
import com.ruoyi.sales.pojo.ShippingInfo;
import com.ruoyi.sales.service.ShippingInfoService;
-import io.swagger.v3.oas.annotations.tags.Tag;
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.transaction.annotation.Transactional;
@@ -119,4 +120,9 @@
public AjaxResult getByCustomerName(String customerName) {
return AjaxResult.success(shippingInfoService.getShippingInfoByCustomerName(customerName));
}
+
+ @GetMapping("/getDateil/{id}")
+ public R getDateil(@PathVariable("id") Long id) {
+ return R.ok(shippingInfoService.getDetail(id));
+ }
}
diff --git a/src/main/java/com/ruoyi/sales/dto/ShippingProductDetailDto.java b/src/main/java/com/ruoyi/sales/dto/ShippingProductDetailDto.java
new file mode 100644
index 0000000..0ef46f3
--- /dev/null
+++ b/src/main/java/com/ruoyi/sales/dto/ShippingProductDetailDto.java
@@ -0,0 +1,16 @@
+package com.ruoyi.sales.dto;
+
+import com.ruoyi.sales.pojo.ShippingProductDetail;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class ShippingProductDetailDto extends ShippingProductDetail {
+
+ private String specificationModel;
+
+ private String productName;
+
+ private BigDecimal deliveryQuantity;
+}
diff --git a/src/main/java/com/ruoyi/sales/mapper/ShippingInfoMapper.java b/src/main/java/com/ruoyi/sales/mapper/ShippingInfoMapper.java
index 25b5128..5c7a5bf 100644
--- a/src/main/java/com/ruoyi/sales/mapper/ShippingInfoMapper.java
+++ b/src/main/java/com/ruoyi/sales/mapper/ShippingInfoMapper.java
@@ -3,11 +3,10 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.procurementrecord.dto.ReturnSaleProductDto;
import com.ruoyi.sales.dto.SalesLedgerProductDto;
import com.ruoyi.sales.dto.ShippingInfoDto;
-import com.ruoyi.sales.pojo.SalesLedgerProduct;
import com.ruoyi.sales.pojo.ShippingInfo;
+import com.ruoyi.sales.pojo.ShippingProductDetail;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -25,4 +24,5 @@
List<ShippingInfo> getShippingInfoByCustomerName(String customerName);
+ List<ShippingProductDetail> getDateil(Long id);
}
diff --git a/src/main/java/com/ruoyi/sales/mapper/ShippingProductDetailMapper.java b/src/main/java/com/ruoyi/sales/mapper/ShippingProductDetailMapper.java
index c277f4d..f564ba1 100644
--- a/src/main/java/com/ruoyi/sales/mapper/ShippingProductDetailMapper.java
+++ b/src/main/java/com/ruoyi/sales/mapper/ShippingProductDetailMapper.java
@@ -1,8 +1,11 @@
package com.ruoyi.sales.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.sales.dto.ShippingProductDetailDto;
import com.ruoyi.sales.pojo.ShippingProductDetail;
import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
/**
* <p>
@@ -15,4 +18,5 @@
@Mapper
public interface ShippingProductDetailMapper extends BaseMapper<ShippingProductDetail> {
+ List<ShippingProductDetailDto> getDetail(Long id);
}
diff --git a/src/main/java/com/ruoyi/sales/pojo/SalesQuotation.java b/src/main/java/com/ruoyi/sales/pojo/SalesQuotation.java
index 9a795c4..b72b3af 100644
--- a/src/main/java/com/ruoyi/sales/pojo/SalesQuotation.java
+++ b/src/main/java/com/ruoyi/sales/pojo/SalesQuotation.java
@@ -3,7 +3,7 @@
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
-import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
@@ -16,55 +16,58 @@
public class SalesQuotation {
@TableId(value = "id", type = IdType.AUTO)
private Long id;
- @Schema(description = "鎶ヤ环鍗曠紪鍙�")
+ @ApiModelProperty(value = "鎶ヤ环鍗曠紪鍙�")
@Excel(name = "鎶ヤ环鍗曠紪鍙�")
private String quotationNo;
- @Schema(description = "瀹㈡埛鍚嶇О")
+ @ApiModelProperty(value = "瀹㈡埛鍚嶇О")
@Excel(name = "瀹㈡埛鍚嶇О")
private String customer;
- @Schema(description = "涓氬姟鍛�")
+ @ApiModelProperty(value = "瀹㈡埛id")
+ private Long customerId;
+
+ @ApiModelProperty(value = "涓氬姟鍛�")
@Excel(name = "涓氬姟鍛�")
private String salesperson;
- @Schema(description = "鎶ヤ环鏃ユ湡")
+ @ApiModelProperty(value = "鎶ヤ环鏃ユ湡")
@JsonFormat(pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@Excel(name = "鎶ヤ环鏃ユ湡", width = 30, dateFormat = "yyyy-MM-dd")
private LocalDate quotationDate;
- @Schema(description = "鏈夋晥鏈熻嚦")
+ @ApiModelProperty(value = "鏈夋晥鏈熻嚦")
@JsonFormat(pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@Excel(name = "鏈夋晥鏈熻嚦", width = 30, dateFormat = "yyyy-MM-dd")
private LocalDate validDate;
- @Schema(description = "浠樻鏂瑰紡")
+ @ApiModelProperty(value = "浠樻鏂瑰紡")
private String paymentMethod;
- @Schema(description = "浜よ揣鍛ㄦ湡澶╂暟")
+ @ApiModelProperty(value = "浜よ揣鍛ㄦ湡澶╂暟")
private String deliveryPeriod;
- @Schema(description = "鐘舵��")
+ @ApiModelProperty(value = "鐘舵��")
private String status;
- @Schema(description = "鎶ヤ环鎬婚噾棰�")
+ @ApiModelProperty(value = "鎶ヤ环鎬婚噾棰�")
@Excel(name = "鎶ヤ环閲戦")
private BigDecimal totalAmount;
- @Schema(description = "澶囨敞")
+ @ApiModelProperty(value = "澶囨敞")
private String remark;
- @Schema(description = "鍒涘缓鏃堕棿")
+ @ApiModelProperty(value = "鍒涘缓鏃堕棿")
@TableField(fill = FieldFill.INSERT)
private LocalDateTime createTime;
- @Schema(description = "淇敼鏃堕棿")
+ @ApiModelProperty(value = "淇敼鏃堕棿")
@TableField(fill = FieldFill.INSERT_UPDATE)
private LocalDateTime updateTime;
- @Schema(description = "鍒涘缓鐢ㄦ埛")
+ @ApiModelProperty(value = "鍒涘缓鐢ㄦ埛")
@TableField(fill = FieldFill.INSERT)
private Integer createUser;
- @Schema(description = "淇敼鐢ㄦ埛")
+ @ApiModelProperty(value = "淇敼鐢ㄦ埛")
@TableField(fill = FieldFill.INSERT_UPDATE)
private Integer updateUser;
- @Schema(description = "绉熸埛ID")
+ @ApiModelProperty(value = "绉熸埛ID")
@TableField(fill = FieldFill.INSERT)
private Long tenantId;
diff --git a/src/main/java/com/ruoyi/sales/service/ShippingInfoService.java b/src/main/java/com/ruoyi/sales/service/ShippingInfoService.java
index fcd6280..c3e8a0c 100644
--- a/src/main/java/com/ruoyi/sales/service/ShippingInfoService.java
+++ b/src/main/java/com/ruoyi/sales/service/ShippingInfoService.java
@@ -5,6 +5,7 @@
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.sales.dto.SalesLedgerProductDto;
import com.ruoyi.sales.dto.ShippingInfoDto;
+import com.ruoyi.sales.dto.ShippingProductDetailDto;
import com.ruoyi.sales.pojo.ShippingInfo;
import java.util.List;
@@ -25,4 +26,6 @@
List<ShippingInfo> getShippingInfoByCustomerName(String customerName);
boolean add(ShippingInfoDto req);
+
+ List<ShippingProductDetailDto> getDetail(Long id);
}
diff --git a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
index ccbe035..9803611 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
@@ -9,15 +9,10 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.account.service.AccountIncomeService;
-import com.ruoyi.basic.dto.CustomerPrivatePoolDto;
-import com.ruoyi.basic.dto.StorageBlobVO;
-import com.ruoyi.basic.enums.ApplicationTypeEnum;
-import com.ruoyi.basic.enums.RecordTypeEnum;
import com.ruoyi.basic.mapper.CustomerMapper;
-import com.ruoyi.basic.mapper.CustomerPrivatePoolMapper;
+import com.ruoyi.basic.mapper.ProductMapper;
import com.ruoyi.basic.mapper.ProductModelMapper;
import com.ruoyi.basic.pojo.Customer;
-import com.ruoyi.basic.utils.FileUtil;
import com.ruoyi.common.enums.FileNameType;
import com.ruoyi.common.enums.SaleEnum;
import com.ruoyi.common.exception.base.BaseException;
@@ -29,9 +24,8 @@
import com.ruoyi.framework.security.LoginUser;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.other.mapper.TempFileMapper;
-import com.ruoyi.production.mapper.ProductionProductInputMapper;
-import com.ruoyi.production.mapper.ProductionProductMainMapper;
-import com.ruoyi.production.mapper.ProductionProductOutputMapper;
+import com.ruoyi.other.pojo.TempFile;
+import com.ruoyi.production.mapper.*;
import com.ruoyi.production.service.ProductionProductMainService;
import com.ruoyi.project.system.domain.SysDept;
import com.ruoyi.project.system.domain.SysUser;
@@ -47,8 +41,10 @@
import com.ruoyi.sales.vo.SalesLedgerVo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.io.FilenameUtils;
import org.jetbrains.annotations.Nullable;
import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.script.DefaultRedisScript;
@@ -56,10 +52,15 @@
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
+import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.math.RoundingMode;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.YearMonth;
@@ -82,11 +83,13 @@
private static final String LOCK_PREFIX = "contract_no_lock:";
private static final long LOCK_WAIT_TIMEOUT = 10; // 閿佺瓑寰呰秴鏃舵椂闂达紙绉掞級
private static final long LOCK_EXPIRE_TIME = 30; // 閿佽嚜鍔ㄨ繃鏈熸椂闂达紙绉掞級
+ private final AccountIncomeService accountIncomeService;
private final SalesLedgerMapper salesLedgerMapper;
private final CustomerMapper customerMapper;
private final SalesLedgerProductMapper salesLedgerProductMapper;
private final SalesLedgerProductServiceImpl salesLedgerProductServiceImpl;
private final CommonFileMapper commonFileMapper;
+ private final TempFileMapper tempFileMapper;
private final ReceiptPaymentMapper receiptPaymentMapper;
private final ShippingInfoServiceImpl shippingInfoServiceImpl;
private final CommonFileServiceImpl commonFileService;
@@ -94,14 +97,27 @@
private final InvoiceLedgerMapper invoiceLedgerMapper;
private final InvoiceRegistrationProductMapper invoiceRegistrationProductMapper;
private final InvoiceRegistrationMapper invoiceRegistrationMapper;
- private final ProductModelMapper productModelMapper;
+ private final ProductionProductMainMapper productionProductMainMapper;
+ private final ProductionProductOutputMapper productionProductOutputMapper;
+ private final ProductionProductInputMapper productionProductInputMapper;
+ private final QualityInspectMapper qualityInspectMapper;
private final RedisTemplate<String, String> redisTemplate;
- private final SysDeptMapper sysDeptMapper;
- private final ProductionProductMainService productionProductMainService;
- private final PurchaseReturnOrderProductsMapper purchaseReturnOrderProductsMapper;
- private final SysUserMapper sysUserMapper;
- private final CustomerPrivatePoolMapper customerPrivatePoolMapper;
- private final FileUtil fileUtil;
+ @Autowired
+ private SysDeptMapper sysDeptMapper;
+ @Value("${file.upload-dir}")
+ private String uploadDir;
+ @Autowired
+ private ProductModelMapper productModelMapper;
+
+ @Autowired
+ private ProductMapper productMapper;
+ @Autowired
+ private ProductionProductMainService productionProductMainService;
+ @Autowired
+ private PurchaseReturnOrderProductsMapper purchaseReturnOrderProductsMapper;
+ ;
+ @Autowired
+ private SysUserMapper sysUserMapper;
@Override
public List<SalesLedger> selectSalesLedgerList(SalesLedgerDto salesLedgerDto) {
@@ -185,9 +201,6 @@
resultDto.setProductData(products);
resultDto.setSalesLedgerFiles(salesLedgerFiles);
}
- // 5. 鏌ヨ闄勪欢
- List<StorageBlobVO> StorageBlobVOs = fileUtil.getStorageBlobVOsByRecordTypeAndRecordId(RecordTypeEnum.SALES_LEDGER, salesLedger.getId());
- resultDto.setStorageBlobVOs(StorageBlobVOs);
return resultDto;
}
@@ -514,7 +527,7 @@
List<Long> productIds = products.stream()
.map(SalesLedgerProduct::getId)
.collect(Collectors.toList());
- //鍒犻櫎鐢熶骇璁″垝
+ //鍒犻櫎鐢熶骇鏁版嵁
salesLedgerProductServiceImpl.deleteProductionData(productIds);
// 鎵归噺鍒犻櫎浜у搧瀛愯〃
@@ -569,43 +582,122 @@
@Override
@Transactional(rollbackFor = Exception.class)
public int addOrUpdateSalesLedger(SalesLedgerDto salesLedgerDto) {
- // 1. 鏍¢獙瀹㈡埛淇℃伅
- CustomerPrivatePoolDto customer = customerPrivatePoolMapper.selectInfo(salesLedgerDto.getCustomerId());
- if (customer == null) {
- throw new BaseException("瀹㈡埛涓嶅瓨鍦�");
+ try {
+ // 1. 鏍¢獙瀹㈡埛淇℃伅
+ Customer customer = customerMapper.selectById(salesLedgerDto.getCustomerId());
+ if (customer == null) {
+ throw new BaseException("瀹㈡埛涓嶅瓨鍦�");
+ }
+
+ // 2. DTO杞珽ntity
+ SalesLedger salesLedger = convertToEntity(salesLedgerDto);
+ salesLedger.setCustomerName(customer.getCustomerName());
+ salesLedger.setTenantId(customer.getTenantId());
+ // 3. 鏂板鎴栨洿鏂颁富琛�
+ if (salesLedger.getId() == null) {
+ String contractNo = generateSalesContractNo();
+ salesLedger.setSalesContractNo(contractNo);
+ salesLedgerMapper.insert(salesLedger);
+ } else {
+ salesLedgerMapper.updateById(salesLedger);
+ }
+
+ // 4. 澶勭悊瀛愯〃鏁版嵁
+ List<SalesLedgerProduct> productList = salesLedgerDto.getProductData();
+ if (productList != null && !productList.isEmpty()) {
+ handleSalesLedgerProducts(salesLedger.getId(), productList, EnumUtil.fromCode(SaleEnum.class, salesLedgerDto.getType()));
+ updateMainContractAmount(
+ salesLedger.getId(),
+ productList,
+ SalesLedgerProduct::getTaxInclusiveTotalPrice,
+ salesLedgerMapper,
+ SalesLedger.class
+ );
+ }
+
+ // 5. 杩佺Щ涓存椂鏂囦欢鍒版寮忕洰褰�
+ if (salesLedgerDto.getTempFileIds() != null && !salesLedgerDto.getTempFileIds().isEmpty()) {
+ migrateTempFilesToFormal(salesLedger.getId(), salesLedgerDto.getTempFileIds());
+ }
+ return 1;
+ } catch (IOException e) {
+ throw new BaseException("鏂囦欢杩佺Щ澶辫触: " + e.getMessage());
+ }
+ }
+
+ /**
+ * 灏嗕复鏃舵枃浠惰縼绉诲埌姝e紡鐩綍
+ *
+ * @param businessId 涓氬姟ID锛堥攢鍞彴璐D锛�
+ * @param tempFileIds 涓存椂鏂囦欢ID鍒楄〃
+ * @throws IOException 鏂囦欢鎿嶄綔寮傚父
+ */
+ private void migrateTempFilesToFormal(Long businessId, List<String> tempFileIds) throws IOException {
+ if (CollectionUtils.isEmpty(tempFileIds)) {
+ return;
}
- // 2. DTO杞珽ntity
- SalesLedger salesLedger = convertToEntity(salesLedgerDto);
- salesLedger.setCustomerName(customer.getCustomerName());
- salesLedger.setTenantId(customer.getTenantId());
- // 3. 鏂板鎴栨洿鏂颁富琛�
- if (salesLedger.getId() == null) {
- String contractNo = generateSalesContractNo();
- salesLedger.setSalesContractNo(contractNo);
- salesLedgerMapper.insert(salesLedger);
- } else {
- salesLedgerMapper.updateById(salesLedger);
+ // 鏋勫缓姝e紡鐩綍璺緞锛堟寜涓氬姟绫诲瀷鍜屾棩鏈熷垎缁勶級
+ String formalDir = uploadDir + LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE);
+
+ Path formalDirPath = Paths.get(formalDir);
+
+ // 纭繚姝e紡鐩綍瀛樺湪锛堥�掑綊鍒涘缓锛�
+ if (!Files.exists(formalDirPath)) {
+ Files.createDirectories(formalDirPath);
}
- // 4. 澶勭悊瀛愯〃鏁版嵁
- List<SalesLedgerProduct> productList = salesLedgerDto.getProductData();
- if (productList != null && !productList.isEmpty()) {
- handleSalesLedgerProducts(salesLedger.getId(), productList, EnumUtil.fromCode(SaleEnum.class, salesLedgerDto.getType()));
- updateMainContractAmount(
- salesLedger.getId(),
- productList,
- SalesLedgerProduct::getTaxInclusiveTotalPrice,
- salesLedgerMapper,
- SalesLedger.class
- );
- }
+ for (String tempFileId : tempFileIds) {
+ // 鏌ヨ涓存椂鏂囦欢璁板綍
+ TempFile tempFile = tempFileMapper.selectById(tempFileId);
+ if (tempFile == null) {
+ log.warn("涓存椂鏂囦欢涓嶅瓨鍦紝璺宠繃澶勭悊: {}", tempFileId);
+ continue;
+ }
- // 5. 淇濆瓨鏂囦欢
- if (salesLedgerDto.getStorageBlobDTOs() != null && !salesLedgerDto.getStorageBlobDTOs().isEmpty()) {
- fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, RecordTypeEnum.SALES_LEDGER, salesLedger.getId(), salesLedgerDto.getStorageBlobDTOs());
+ // 鏋勫缓姝e紡鏂囦欢鍚嶏紙鍖呭惈涓氬姟ID鍜屾椂闂存埑锛岄伩鍏嶅啿绐侊級
+ String originalFilename = tempFile.getOriginalName();
+ String fileExtension = FilenameUtils.getExtension(originalFilename);
+ String formalFilename = businessId + "_" +
+ System.currentTimeMillis() + "_" +
+ UUID.randomUUID().toString().substring(0, 8) +
+ (StringUtils.hasText(fileExtension) ? "." + fileExtension : "");
+
+ Path formalFilePath = formalDirPath.resolve(formalFilename);
+
+ try {
+ // 鎵ц鏂囦欢杩佺Щ锛堜娇鐢ㄥ師瀛愭搷浣滅‘淇濆畨鍏ㄦ�э級
+// Files.move(
+// Paths.get(tempFile.getTempPath()),
+// formalFilePath,
+// StandardCopyOption.REPLACE_EXISTING,
+// StandardCopyOption.ATOMIC_MOVE
+// );
+ // 鍘熷瓙绉诲姩澶辫触锛屼娇鐢ㄥ鍒�+鍒犻櫎
+ Files.copy(Paths.get(tempFile.getTempPath()), formalFilePath, StandardCopyOption.REPLACE_EXISTING);
+ Files.deleteIfExists(Paths.get(tempFile.getTempPath()));
+ log.info("鏂囦欢杩佺Щ鎴愬姛: {} -> {}", tempFile.getTempPath(), formalFilePath);
+
+ // 鏇存柊鏂囦欢璁板綍锛堝叧鑱斿埌涓氬姟ID锛�
+ CommonFile fileRecord = new CommonFile();
+ fileRecord.setCommonId(businessId);
+ fileRecord.setName(originalFilename);
+ fileRecord.setUrl(formalFilePath.toString());
+ fileRecord.setCreateTime(LocalDateTime.now());
+ //閿�鍞�
+ fileRecord.setType(FileNameType.SALE.getValue());
+ commonFileMapper.insert(fileRecord);
+
+ // 鍒犻櫎涓存椂鏂囦欢璁板綍
+ tempFileMapper.deleteById(tempFile);
+
+ log.info("鏂囦欢杩佺Щ鎴愬姛: {} -> {}", tempFile.getTempPath(), formalFilePath);
+ } catch (IOException e) {
+ log.error("鏂囦欢杩佺Щ澶辫触: {}", tempFile.getTempPath(), e);
+ // 鍙�夋嫨鍥炴粴浜嬪姟鎴栬褰曞け璐ユ枃浠�
+ throw new IOException("鏂囦欢杩佺Щ寮傚父", e);
+ }
}
- return 1;
}
// 鏂囦欢杩佺Щ鏂规硶
diff --git a/src/main/java/com/ruoyi/sales/service/impl/SalesQuotationServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/SalesQuotationServiceImpl.java
index a58bcfc..1ec6a8d 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/SalesQuotationServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/SalesQuotationServiceImpl.java
@@ -11,8 +11,8 @@
import com.ruoyi.approve.service.impl.ApproveProcessServiceImpl;
import com.ruoyi.approve.bean.vo.ApproveGetAndUpdateVo;
import com.ruoyi.approve.bean.vo.ApproveProcessVO;
-import com.ruoyi.basic.dto.CustomerPrivatePoolDto;
-import com.ruoyi.basic.mapper.CustomerPrivatePoolMapper;
+import com.ruoyi.basic.mapper.CustomerMapper;
+import com.ruoyi.basic.pojo.Customer;
import com.ruoyi.common.utils.OrderUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.bean.BeanUtils;
@@ -42,7 +42,7 @@
private final SalesQuotationProductService salesQuotationProductService;
private final ApproveProcessServiceImpl approveProcessService;
- private final CustomerPrivatePoolMapper customerPrivatePoolMapper;
+ private final CustomerMapper customerMapper;
@Override
public IPage<SalesQuotationDto> listPage(Page page, SalesQuotationDto salesQuotationDto) {
@@ -61,10 +61,9 @@
public boolean add(SalesQuotationDto salesQuotationDto) {
LoginUser loginUser = SecurityUtils.getLoginUser();
SalesQuotation salesQuotation = new SalesQuotation();
- CustomerPrivatePoolDto customerPrivatePoolDto = customerPrivatePoolMapper.selectInfo(Long.valueOf(salesQuotationDto.getCustomer()));
- if (ObjectUtils.isNotEmpty(customerPrivatePoolDto)) {
- BeanUtils.copyProperties(salesQuotationDto, salesQuotation);
- salesQuotation.setCustomer(customerPrivatePoolDto.getCustomerName());
+ Customer customer = customerMapper.selectById(Long.valueOf(salesQuotationDto.getCustomerId()));
+ if (ObjectUtils.isNotEmpty(customer)) {
+ salesQuotation.setCustomer(customer.getCustomerName());
}
String quotationNo = OrderUtils.countTodayByCreateTime(salesQuotationMapper, "QT","quotation_no");
salesQuotation.setQuotationNo(quotationNo);
@@ -93,7 +92,7 @@
approveProcessService.addApprove(approveProcessVO);
}catch (Exception e){
log.error("SalesQuotationServiceImpl error:{}", e);
- throw new RuntimeException("瀹℃壒澶辫触");
+ throw new RuntimeException("瀹℃壒澶辫触");
}
return true;
}
diff --git a/src/main/java/com/ruoyi/sales/service/impl/ShippingInfoServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/ShippingInfoServiceImpl.java
index 20b563a..545ac7d 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/ShippingInfoServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/ShippingInfoServiceImpl.java
@@ -14,6 +14,7 @@
import com.ruoyi.procurementrecord.utils.StockUtils;
import com.ruoyi.sales.dto.SalesLedgerProductDto;
import com.ruoyi.sales.dto.ShippingInfoDto;
+import com.ruoyi.sales.dto.ShippingProductDetailDto;
import com.ruoyi.sales.mapper.SalesLedgerProductMapper;
import com.ruoyi.sales.mapper.ShippingInfoMapper;
import com.ruoyi.sales.mapper.ShippingProductDetailMapper;
@@ -135,4 +136,9 @@
shippingProductDetailMapper.insert(req.getBatchNoDetailList());
return true;
}
+
+ @Override
+ public List<ShippingProductDetailDto> getDetail(Long id) {
+ return shippingProductDetailMapper.getDetail(id);
+ }
}
diff --git a/src/main/java/com/ruoyi/staff/controller/PersonalAttendanceLocationConfigController.java b/src/main/java/com/ruoyi/staff/controller/PersonalAttendanceLocationConfigController.java
index aa40835..7b4ba61 100644
--- a/src/main/java/com/ruoyi/staff/controller/PersonalAttendanceLocationConfigController.java
+++ b/src/main/java/com/ruoyi/staff/controller/PersonalAttendanceLocationConfigController.java
@@ -1,17 +1,12 @@
package com.ruoyi.staff.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.domain.R;
-import com.ruoyi.staff.dto.PersonalAttendanceRecordsDto;
import com.ruoyi.staff.pojo.PersonalAttendanceLocationConfig;
-import com.ruoyi.staff.pojo.PersonalAttendanceRecords;
import com.ruoyi.staff.service.PersonalAttendanceLocationConfigService;
-import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@@ -30,7 +25,7 @@
@RequiredArgsConstructor
public class PersonalAttendanceLocationConfigController {
- private PersonalAttendanceLocationConfigService personalAttendanceLocationConfigService;
+ private final PersonalAttendanceLocationConfigService personalAttendanceLocationConfigService;
@Operation(summary = "鏂板/淇敼浜哄憳鎵撳崱瑙勫垯閰嶇疆")
@PostMapping("/add")
diff --git a/src/main/resources/application-demo.yml b/src/main/resources/application-demo.yml
index ee53b79..096da4e 100644
--- a/src/main/resources/application-demo.yml
+++ b/src/main/resources/application-demo.yml
@@ -13,11 +13,22 @@
addressEnabled: false
# 楠岃瘉鐮佺被鍨� math 鏁板瓧璁$畻 char 瀛楃楠岃瘉
captchaType: math
+ # 鍗忓悓瀹℃壒缂栧彿鍓嶇紑(閰嶇疆鏂囦欢鍚庣紑鍛藉悕)
+ approvalNumberPrefix: NEW
+
+ # 涓帹 Unipush 閰嶇疆
+ getui:
+ appId: PfjyAAE0FK64FaO1w2CMb1
+ appKey: zTMb831OEL6J4GK1uE3Ob4
+ masterSecret: K1GFtsv42v61tXGnF7SGE5
+ domain: https://restapi.getui.cn/v2/
+ # 绂荤嚎鎺ㄩ�佷娇鐢ㄧ殑鍖呭悕/缁勪欢鍚�
+ intentComponent: uni.app.UNI099A590/io.dcloud.PandoraEntry
# 寮�鍙戠幆澧冮厤缃�
server:
# 鏈嶅姟鍣ㄧ殑HTTP绔彛锛岄粯璁や负8080
- port: 9036
+ port: 9003
servlet:
# 搴旂敤鐨勮闂矾寰�
context-path: /
@@ -45,7 +56,7 @@
accessKey: admin
secretKey: 12345678
preview-expiry: 24 # 棰勮鍦板潃榛樿24灏忔椂
- default-bucket: demo-product
+ default-bucket: jxc
# 鐢ㄦ埛閰嶇疆
user:
password:
@@ -62,9 +73,9 @@
druid:
# 涓诲簱鏁版嵁婧�
master:
- url: jdbc:mysql://172.17.0.1:3306/product-inventory-management-demo?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+ url: jdbc:mysql://172.17.0.1:9002/product-inventory-management-sdjc?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
- password: xd@123456..
+ password: sdjc@123456..
# 浠庡簱鏁版嵁婧�
slave:
# 浠庢暟鎹簮寮�鍏�/榛樿鍏抽棴
@@ -132,40 +143,69 @@
# 鐑儴缃插紑鍏�
enabled: false
# redis 閰嶇疆
- redis:
- # 鍦板潃
-# host: 127.0.0.1
- host: 172.17.0.1
- # 绔彛锛岄粯璁や负6379
- port: 6379
- # 鏁版嵁搴撶储寮�
- database: 0
- # 瀵嗙爜
-# password: root2022!
- password:
+ data:
+ mongodb:
+ uri: mongodb://114.132.189.42:9028/chat_memory_db
+ # redis 閰嶇疆
+ redis:
+ # 鍦板潃
+ # host: 127.0.0.1
+ host: 172.17.0.1
+ # 绔彛锛岄粯璁や负6379
+ port: 6379
+ # 鏁版嵁搴撶储寮�
+ database: 0
+ # 瀵嗙爜
+ # password: root2022!
+ password:
- # 杩炴帴瓒呮椂鏃堕棿
- timeout: 10s
- lettuce:
- pool:
- # 杩炴帴姹犱腑鐨勬渶灏忕┖闂茶繛鎺�
- min-idle: 0
- # 杩炴帴姹犱腑鐨勬渶澶х┖闂茶繛鎺�
- max-idle: 8
- # 杩炴帴姹犵殑鏈�澶ф暟鎹簱杩炴帴鏁�
- max-active: 8
- # #杩炴帴姹犳渶澶ч樆濉炵瓑寰呮椂闂达紙浣跨敤璐熷�艰〃绀烘病鏈夐檺鍒讹級
- max-wait: -1ms
+ # 杩炴帴瓒呮椂鏃堕棿
+ timeout: 10s
+ lettuce:
+ pool:
+ # 杩炴帴姹犱腑鐨勬渶灏忕┖闂茶繛鎺�
+ min-idle: 0
+ # 杩炴帴姹犱腑鐨勬渶澶х┖闂茶繛鎺�
+ max-idle: 8
+ # 杩炴帴姹犵殑鏈�澶ф暟鎹簱杩炴帴鏁�
+ max-active: 8
+ # #杩炴帴姹犳渶澶ч樆濉炵瓑寰呮椂闂达紙浣跨敤璐熷�艰〃绀烘病鏈夐檺鍒讹級
+ max-wait: -1ms
+ # Quartz瀹氭椂浠诲姟閰嶇疆锛堟柊澧為儴鍒嗭級
+ quartz:
+ job-store-type: jdbc # 浣跨敤鏁版嵁搴撳瓨鍌�
+ jdbc:
+ initialize-schema: never # 棣栨杩愯鏃惰嚜鍔ㄥ垱寤鸿〃缁撴瀯锛屾垚鍔熷悗鏀逛负never
+ schema: classpath:org/quartz/impl/jdbcjobstore/tables_mysql_innodb.sql # MySQL琛ㄧ粨鏋勮剼鏈�
+ properties:
+ org:
+ quartz:
+ scheduler:
+ instanceName: RuoYiScheduler
+ instanceId: AUTO
+ jobStore:
+ class: org.quartz.impl.jdbcjobstore.JobStoreTX
+ driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate # MySQL閫傞厤
+ tablePrefix: qrtz_ # 琛ㄥ悕鍓嶇紑锛屼笌鑴氭湰涓�鑷�
+ isClustered: false # 鍗曡妭鐐规ā寮忥紙闆嗙兢闇�鏀逛负true锛�
+ clusterCheckinInterval: 10000
+ txIsolationLevelSerializable: true
+ threadPool:
+ class: org.quartz.simpl.SimpleThreadPool
+ threadCount: 10 # 绾跨▼姹犲ぇ灏�
+ threadPriority: 5
+ makeThreadsDaemons: true
+ updateCheck: false # 鍏抽棴鐗堟湰妫�鏌�
# token閰嶇疆
token:
# 浠ょ墝鑷畾涔夋爣璇�
header: Authorization
# 浠ょ墝瀵嗛挜
- secret: abcdefghijklmnopqrstuvwxyz
+ secret: xpAVjhCjQDaDB7mjPAzMDSbQWXNu2zYkTdDNUsPMS5Xx8QMmQVYN7n74eZrYJxDJ
# 浠ょ墝鏈夋晥鏈燂紙榛樿30鍒嗛挓锛�
expireTime: 450
-
+
# MyBatis Plus閰嶇疆
mybatis-plus:
# 鎼滅储鎸囧畾鍖呭埆鍚� 鏍规嵁鑷繁鐨勯」鐩潵
@@ -178,7 +218,7 @@
enable-sql-runner: true
db-config:
id-type: auto
-
+
# PageHelper鍒嗛〉鎻掍欢
pagehelper:
helperDialect: mysql
@@ -200,7 +240,7 @@
excludes: /system/notice
# 鍖归厤閾炬帴
urlPatterns: /system/*,/monitor/*,/tool/*
-
+
# 浠g爜鐢熸垚
gen:
# 浣滆��
@@ -214,6 +254,15 @@
# 鏄惁鍏佽鐢熸垚鏂囦欢瑕嗙洊鍒版湰鍦帮紙鑷畾涔夎矾寰勶級锛岄粯璁や笉鍏佽
allowOverwrite: false
+# 鏂囦欢涓婁紶閰嶇疆
file:
- temp-dir: /javaWork/product-inventory-management/file/temp/uploads
- upload-dir: /javaWork/product-inventory-management/file/prod/uploads
\ No newline at end of file
+ temp-dir: /javaWork/product-inventory-management/file/temp/uploads # 涓存椂鐩綍
+ upload-dir: /javaWork/product-inventory-management/file/prod/uploads # 姝e紡鐩綍
+ path: /javaWork/product-inventory-management/file # 涓婁紶鐩綍
+ urlPrefix: /common # 閾炬帴鍓嶇紑
+ domain: http://36.138.236.153:9001 # 鍩熷悕鍓嶇紑
+ expired: 120 # 杩囨湡鏃堕棿(鍗曚綅:鍒嗛挓)
+ useLimit: 10 # 浣跨敤娆℃暟
+ compress: true # 鏄惁鍘嬬缉
+ needCompressSize: 10MB # 鍘嬬缉闃堝��
+ compressQuality: 0.5 # 鍘嬬缉璐ㄩ噺(0.0-1.0)
diff --git a/src/main/resources/application-new-pro.yml b/src/main/resources/application-new-pro.yml
index f71bddf..7ff138a 100644
--- a/src/main/resources/application-new-pro.yml
+++ b/src/main/resources/application-new-pro.yml
@@ -256,11 +256,11 @@
# 鏂囦欢涓婁紶閰嶇疆
file:
- temp-dir: D:/ruoyi/temp/uploads # 涓存椂鐩綍
- upload-dir: D:/ruoyi/prod/uploads # 姝e紡鐩綍
- path: C:/Users/12631/Desktop/download/uploads # 涓婁紶鐩綍
- urlPrefix: /common # 閾炬帴鍓嶇紑
- domain: http://127.0.0.1:7003 # 鍩熷悕鍓嶇紑
+ temp-dir: /javaWork/product-inventory-management/file/temp/uploads # 涓存椂鐩綍
+ upload-dir: /javaWork/product-inventory-management/file/prod/uploads # 姝e紡鐩綍
+ path: /javaWork/product-inventory-management/file # 涓婁紶鐩綍
+ urlPrefix: /prod-api/common # 閾炬帴鍓嶇紑
+ domain: http://1.15.17.182:9049 # 鍩熷悕鍓嶇紑
expired: 120 # 杩囨湡鏃堕棿(鍗曚綅:鍒嗛挓)
useLimit: 10 # 浣跨敤娆℃暟
compress: true # 鏄惁鍘嬬缉
diff --git a/src/main/resources/mapper/basic/CustomerMapper.xml b/src/main/resources/mapper/basic/CustomerMapper.xml
index 3b42238..57dea6c 100644
--- a/src/main/resources/mapper/basic/CustomerMapper.xml
+++ b/src/main/resources/mapper/basic/CustomerMapper.xml
@@ -6,17 +6,23 @@
<resultMap id="BaseResultMap" type="com.ruoyi.basic.pojo.Customer">
<id column="id" property="id" />
</resultMap>
- <select id="listPage" resultType="com.ruoyi.basic.dto.CustomerDto">
+ <select id="listPage" resultType="com.ruoyi.basic.vo.CustomerVo">
select
c.*,
u.user_name usage_user_name,
(
select group_concat(u2.user_name separator ', ')
- from customer_private_pool cpp2
- left join sys_user u2 on cpp2.bound_id = u2.user_id
- where cpp2.customer_id = c.id and cpp2.delete_flag = 0
- and cpp2.bound_id != c.usage_user
- ) as together_user_names
+ from customer_user cu
+ left join sys_user u2 on cu.user_id = u2.user_id
+ where cu.customer_id = c.id
+ and cu.user_id != c.usage_user
+ ) as together_user_names,
+ (
+ select group_concat(cu.user_id separator ',')
+ from customer_user cu
+ where cu.customer_id = c.id
+ and cu.user_id != c.usage_user
+ ) as user_ids_str
from customer c
left join sys_user u on c.usage_user = u.user_id
<where>
@@ -26,8 +32,79 @@
<if test="c.customerType != null and c.customerType != ''">
and customer_type = #{c.customerType}
</if>
+ <!-- 鍏捣鏌ヨ锛歵ype = 1锛堝叕娴峰鎴凤級-->
+ <if test="c.type != null and c.type == 1">
+ and type = #{c.type}
+ </if>
+ <!-- 绉佹捣鏌ヨ锛歵ype = 0锛堢娴峰鎴凤級鎴栬�� type = 1锛堝叕娴峰鎴凤級涓斿凡琚垎閰嶏紝骞朵笖鏄嚜宸遍鐢ㄣ�佽嚜宸卞垱寤烘垨鑰呭叡浜粰鑷繁鐨勫鎴� -->
+ <if test="c.type != null and c.type == 0">
+ and (
+ (type = #{c.type} or (type = 1 and is_assigned = 1))
+ and (
+ c.usage_user = #{loginUserId}
+ or c.create_user = #{loginUserId}
+ or exists (
+ select 1 from customer_user cu
+ where cu.customer_id = c.id
+ and cu.user_id = #{loginUserId}
+ )
+ )
+ )
+ </if>
</where>
</select>
-
-</mapper>
+ <select id="list" resultType="com.ruoyi.basic.vo.CustomerVo">
+ select
+ c.*,
+ u.user_name usage_user_name,
+ (
+ select group_concat(u2.user_name separator ', ')
+ from customer_user cu
+ left join sys_user u2 on cu.user_id = u2.user_id
+ where cu.customer_id = c.id
+ and cu.user_id != c.usage_user
+ ) as together_user_names,
+ (
+ select group_concat(cu.user_id separator ',')
+ from customer_user cu
+ where cu.customer_id = c.id
+ and cu.user_id != c.usage_user
+ ) as user_ids_str
+ from customer c
+ left join sys_user u on c.usage_user = u.user_id
+ <where>
+ <if test="c.ids != null and c.ids.length > 0">
+ and c.id in
+ <foreach collection="c.ids" item="id" open="(" separator="," close=")">
+ #{id}
+ </foreach>
+ </if>
+ <if test="c.customerName != null and c.customerName != ''">
+ and customer_name like concat('%', #{c.customerName}, '%')
+ </if>
+ <if test="c.customerType != null and c.customerType != ''">
+ and customer_type = #{c.customerType}
+ </if>
+ <!-- 鍏捣鏌ヨ锛歵ype = 1锛堝叕娴峰鎴凤級-->
+ <if test="c.type != null and c.type == 1">
+ and type = #{c.type}
+ </if>
+ <!-- 绉佹捣鏌ヨ锛歵ype = 0锛堢娴峰鎴凤級鎴栬�� type = 1锛堝叕娴峰鎴凤級涓斿凡琚垎閰嶏紝骞朵笖鏄嚜宸遍鐢ㄣ�佽嚜宸卞垱寤烘垨鑰呭叡浜粰鑷繁鐨勫鎴� -->
+ <if test="c.type != null and c.type == 0">
+ and (
+ (type = #{c.type} or (type = 1 and is_assigned = 1))
+ and (
+ c.usage_user = #{loginUserId}
+ or c.create_user = #{loginUserId}
+ or exists (
+ select 1 from customer_user cu
+ where cu.customer_id = c.id
+ and cu.user_id = #{loginUserId}
+ )
+ )
+ )
+ </if>
+ </where>
+ </select>
+</mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/basic/CustomerPrivateMapper.xml b/src/main/resources/mapper/basic/CustomerPrivateMapper.xml
deleted file mode 100644
index 9a8d68c..0000000
--- a/src/main/resources/mapper/basic/CustomerPrivateMapper.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?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.ruoyi.basic.mapper.CustomerPrivateMapper">
-
- <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
- <resultMap id="BaseResultMap" type="com.ruoyi.basic.pojo.CustomerPrivate">
- <id column="id" property="id" />
- <result column="customer_name" property="customerName" />
- <result column="taxpayer_identification_number" property="taxpayerIdentificationNumber" />
- <result column="company_address" property="companyAddress" />
- <result column="company_phone" property="companyPhone" />
- <result column="contact_person" property="contactPerson" />
- <result column="contact_phone" property="contactPhone" />
- <result column="maintainer" property="maintainer" />
- <result column="maintenance_time" property="maintenanceTime" />
- <result column="tenant_id" property="tenantId" />
- <result column="basic_bank_account" property="basicBankAccount" />
- <result column="bank_account" property="bankAccount" />
- <result column="bank_code" property="bankCode" />
- <result column="customer_type" property="customerType" />
- <result column="create_user" property="createUser" />
- <result column="dept_id" property="deptId" />
- </resultMap>
-
-</mapper>
diff --git a/src/main/resources/mapper/basic/CustomerPrivatePoolMapper.xml b/src/main/resources/mapper/basic/CustomerPrivatePoolMapper.xml
deleted file mode 100644
index c7f33c8..0000000
--- a/src/main/resources/mapper/basic/CustomerPrivatePoolMapper.xml
+++ /dev/null
@@ -1,101 +0,0 @@
-<?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.ruoyi.basic.mapper.CustomerPrivatePoolMapper">
-
- <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
- <resultMap id="BaseResultMap" type="com.ruoyi.basic.pojo.CustomerPrivatePool">
- <id column="id" property="id" />
- <result column="customer_id" property="customerId" />
- <result column="bound_id" property="boundId" />
- <result column="create_user" property="createUser" />
- <result column="update_user" property="updateUser" />
- <result column="create_time" property="createTime" />
- <result column="update_time" property="updateTime" />
- </resultMap>
- <select id="listPage" resultType="com.ruoyi.basic.dto.CustomerPrivatePoolDto">
- select cpp.id,
- cpp.bound_id,
- cpp.type,
- coalesce(c.id, cp.id) as customer_id,
- coalesce(c.customer_name, cp.customer_name) as customer_name,
- coalesce(c.customer_type, cp.customer_type) as customer_type,
- coalesce(c.taxpayer_identification_number, cp.taxpayer_identification_number) as taxpayer_identification_number,
- coalesce(c.company_address, cp.company_address) as company_address,
- coalesce(c.company_phone, cp.company_phone) as company_phone,
- coalesce(c.contact_person, cp.contact_person) as contact_person,
- coalesce(c.contact_phone, cp.contact_phone) as contact_phone,
- coalesce(c.maintainer, cp.maintainer) as maintainer,
- coalesce(c.maintenance_time, cp.maintenance_time) as maintenance_time,
- coalesce(c.tenant_id, cp.tenant_id) as tenant_id,
- coalesce(c.basic_bank_account, cp.basic_bank_account) as basic_bank_account,
- coalesce(c.bank_account, cp.bank_account) as bank_account,
- coalesce(c.bank_code, cp.bank_code) as bank_code
- from customer_private_pool cpp
- left join customer c on c.id = cpp.customer_id and cpp.type = 1
- left join customer_private cp on cp.id = cpp.customer_id and cpp.type = 0
- <where>
- cpp.delete_flag = 0
- <if test="c.customerName != null and c.customerName != ''">
- and (c.customer_name like concat('%', #{c.customerName}, '%') or cp.customer_name like concat('%', #{c.customerName}, '%'))
- </if>
- <if test="c.customerType != null">
- and c.customer_type = #{c.customerType}
- </if>
- <if test="c.boundId != null">
- and cpp.bound_id = #{c.boundId}
- </if>
-
- </where>
- order by cpp.id desc
- </select>
- <select id="selectInfo" resultType="com.ruoyi.basic.dto.CustomerPrivatePoolDto">
- select cpp.id,
- cpp.bound_id,
- cpp.type,
- coalesce(c.id, cp.id) as customer_id,
- coalesce(c.customer_name, cp.customer_name) as customer_name,
- coalesce(c.customer_type, cp.customer_type) as customer_type,
- coalesce(c.taxpayer_identification_number, cp.taxpayer_identification_number) as taxpayer_identification_number,
- coalesce(c.company_address, cp.company_address) as company_address,
- coalesce(c.company_phone, cp.company_phone) as company_phone,
- coalesce(c.contact_person, cp.contact_person) as contact_person,
- coalesce(c.contact_phone, cp.contact_phone) as contact_phone,
- coalesce(c.maintainer, cp.maintainer) as maintainer,
- coalesce(c.maintenance_time, cp.maintenance_time) as maintenance_time,
- coalesce(c.tenant_id, cp.tenant_id) as tenant_id,
- coalesce(c.basic_bank_account, cp.basic_bank_account) as basic_bank_account,
- coalesce(c.bank_account, cp.bank_account) as bank_account,
- coalesce(c.bank_code, cp.bank_code) as bank_code
- from customer_private_pool cpp
- left join customer c on c.id = cpp.customer_id and cpp.type = 1
- left join customer_private cp on cp.id = cpp.customer_id and cpp.type = 0
- <where>
- <if test="id != null">
- and cpp.id = #{id}
- </if>
- </where>
- </select>
- <select id="selectInfos" resultType="com.ruoyi.basic.dto.CustomerPrivatePoolDto">
- select cpp.id,
- cpp.bound_id,
- cpp.type,
- coalesce(c.id, cp.id) as customer_id,
- coalesce(c.customer_name, cp.customer_name) as customer_name,
- coalesce(c.customer_type, cp.customer_type) as customer_type,
- coalesce(c.taxpayer_identification_number, cp.taxpayer_identification_number) as taxpayer_identification_number,
- coalesce(c.company_address, cp.company_address) as company_address,
- coalesce(c.company_phone, cp.company_phone) as company_phone,
- coalesce(c.contact_person, cp.contact_person) as contact_person,
- coalesce(c.contact_phone, cp.contact_phone) as contact_phone,
- coalesce(c.maintainer, cp.maintainer) as maintainer,
- coalesce(c.maintenance_time, cp.maintenance_time) as maintenance_time,
- coalesce(c.tenant_id, cp.tenant_id) as tenant_id,
- coalesce(c.basic_bank_account, cp.basic_bank_account) as basic_bank_account,
- coalesce(c.bank_account, cp.bank_account) as bank_account,
- coalesce(c.bank_code, cp.bank_code) as bank_code
- from customer_private_pool cpp
- left join customer c on c.id = cpp.customer_id and cpp.type = 1
- left join customer_private cp on cp.id = cpp.customer_id and cpp.type = 0
- </select>
-
-</mapper>
diff --git a/src/main/resources/mapper/production/ProductionOperationTaskMapper.xml b/src/main/resources/mapper/production/ProductionOperationTaskMapper.xml
index 0ccb06f..577bcfd 100644
--- a/src/main/resources/mapper/production/ProductionOperationTaskMapper.xml
+++ b/src/main/resources/mapper/production/ProductionOperationTaskMapper.xml
@@ -29,7 +29,8 @@
pm.model as model,
pm.unit as unit,
poro.operation_name as operationName,
- ROUND(pot.complete_quantity / pot.plan_quantity * 100, 2) AS completionStatus,
+ IFNULL(scrapStat.scrapQty, 0) AS scrapQty,
+ ROUND(IFNULL(pot.complete_quantity, 0) / NULLIF(pot.plan_quantity, 0) * 100, 2) AS completionStatus,
CASE
WHEN pot.work_order_no LIKE 'FG%' THEN '杩斿伐杩斾慨'
ELSE '姝e父'
@@ -39,9 +40,19 @@
left join production_order_routing_operation poro on pot.production_order_routing_operation_id = poro.id
left join product_model pm on pm.id = ifnull(poro.product_model_id, po.product_model_id)
left join product p on pm.product_id = p.id
+ left join (
+ select ppm.production_operation_task_id as taskId,
+ sum(ifnull(ppo.scrap_qty, 0)) as scrapQty
+ from production_product_main ppm
+ left join production_product_output ppo on ppo.production_product_main_id = ppm.id
+ group by ppm.production_operation_task_id
+ ) scrapStat on scrapStat.taskId = pot.id
<where>
<if test="c != null and c.id != null">
and pot.id = #{c.id}
+ </if>
+ <if test="c != null and c.npsNo != null">
+ and po.nps_no like concat('%', #{c.npsNo}, '%')
</if>
<if test="c != null and c.productionOrderId != null">
and pot.production_order_id = #{c.productionOrderId}
@@ -145,4 +156,58 @@
WHERE pot.id = #{id}
</select>
+ <select id="getOperation" resultType="com.ruoyi.production.bean.vo.ProductionOperationTaskVo">
+ select poro.operation_name as operationName,
+ count(pot.id) as productionTaskCount,
+ sum(ifnull(pot.plan_quantity, 0)) as planQuantity,
+ sum(ifnull(pot.complete_quantity, 0)) as completeQuantity,
+ sum(ifnull(pot.complete_quantity, 0)) as goodQuantity,
+ sum(ifnull(outputStat.scrapQty, 0)) as scrapQty,
+ round(
+ case
+ when sum(ifnull(pot.plan_quantity, 0)) = 0 then 0
+ else (sum(ifnull(pot.complete_quantity, 0)) + sum(ifnull(outputStat.scrapQty, 0)))
+ / sum(ifnull(pot.plan_quantity, 0)) * 100
+ end,
+ 2
+ ) as completionStatus
+ from production_operation_task pot
+ left join production_order_routing_operation poro on pot.production_order_routing_operation_id = poro.id
+ left join (
+ select ppm.production_operation_task_id as taskId,
+ sum(ifnull(ppo.scrap_qty, 0)) as scrapQty
+ from production_product_main ppm
+ left join production_product_output ppo on ppo.production_product_main_id = ppm.id
+ group by ppm.production_operation_task_id
+ ) outputStat on outputStat.taskId = pot.id
+ <where>
+ <if test="c != null and c.startDate != null">
+ and date(pot.create_time) >= #{c.startDate}
+ </if>
+ <if test="c != null and c.endDate != null">
+ and date(pot.create_time) <= #{c.endDate}
+ </if>
+ <if test="c != null and c.planStartTime != null">
+ and pot.plan_start_time >= #{c.planStartTime}
+ </if>
+ <if test="c != null and c.planEndTime != null">
+ and pot.plan_end_time <= #{c.planEndTime}
+ </if>
+ <if test="c != null and c.productionOrderId != null">
+ and pot.production_order_id = #{c.productionOrderId}
+ </if>
+ <if test="c != null and c.productionOrderRoutingOperationId != null">
+ and pot.production_order_routing_operation_id = #{c.productionOrderRoutingOperationId}
+ </if>
+ <if test="c != null and c.status != null">
+ and pot.status = #{c.status}
+ </if>
+ <if test="c != null and c.processName != null and c.processName != ''">
+ and poro.operation_name like concat('%', #{c.processName}, '%')
+ </if>
+ </where>
+ group by poro.operation_name
+ order by min(poro.drag_sort), poro.operation_name
+ </select>
+
</mapper>
diff --git a/src/main/resources/mapper/production/ProductionOrderMapper.xml b/src/main/resources/mapper/production/ProductionOrderMapper.xml
index 2ea7d33..1a304ef 100644
--- a/src/main/resources/mapper/production/ProductionOrderMapper.xml
+++ b/src/main/resources/mapper/production/ProductionOrderMapper.xml
@@ -27,6 +27,7 @@
<result column="productName" property="productName" />
<result column="model" property="model" />
<result column="processRouteCode" property="processRouteCode" />
+ <result column="returned" property="returned" />
</resultMap>
<sql id="ProductionOrderVoColumns">
@@ -52,7 +53,8 @@
po.is_end_order as endOrder,
tr.process_route_code as processRouteCode,
ROUND(po.complete_quantity / po.quantity * 100, 2) AS completionStatus,
- tb.bom_no as bomNo
+ tb.bom_no as bomNo,
+ pop_return.returned as returned
</sql>
<sql id="ProductionOrderVoFrom">
@@ -73,6 +75,12 @@
left join product p on pm.product_id = p.id
left join technology_routing tr on po.technology_routing_id = tr.id
left join technology_bom tb on tb.id = tr.bom_id
+ left join (
+ select production_order_id as productionOrderId,
+ if(max(case when ifnull(is_returned, 0) = 1 then 1 else 0 end) = 1, true, false) as returned
+ from production_order_pick
+ group by production_order_id
+ ) pop_return on pop_return.productionOrderId = po.id
</sql>
<sql id="ProductionOrderWhere">
diff --git a/src/main/resources/mapper/sales/ShippingProductDetailMapper.xml b/src/main/resources/mapper/sales/ShippingProductDetailMapper.xml
index eabe491..464af10 100644
--- a/src/main/resources/mapper/sales/ShippingProductDetailMapper.xml
+++ b/src/main/resources/mapper/sales/ShippingProductDetailMapper.xml
@@ -10,5 +10,13 @@
<result column="quantity" property="quantity" />
<result column="shipping_info_id" property="shippingInfoId" />
</resultMap>
+ <select id="getDetail" resultType="com.ruoyi.sales.dto.ShippingProductDetailDto">
+ select si.batch_no, pm.model as specification_model, p.product_name, spd.quantity as delivery_quantity
+ from shipping_product_detail spd
+ left join stock_inventory si on si.id = spd.stock_inventory_id
+ left join product_model pm on pm.id = si.product_model_id
+ left join product p on p.id = pm.product_id
+ where spd.shipping_info_id = #{id}
+ </select>
</mapper>
--
Gitblit v1.9.3