Skip to content

Commit 2c11743

Browse files
committed
feat: Save fields
1 parent 6cc54ef commit 2c11743

File tree

17 files changed

+298
-57
lines changed

17 files changed

+298
-57
lines changed

backend/crm/src/main/java/cn/cordys/common/constants/BusinessModuleField.java

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,50 @@ public enum BusinessModuleField {
193193
/*------ start: PRODUCT ------*/
194194
PRODUCT_NAME("productName", "name", Set.of("rules.required", "mobile"), FormKey.PRODUCT.getKey()),
195195
PRODUCT_PRICE("productPrice", "price", Set.of(), FormKey.PRODUCT.getKey()),
196-
PRODUCT_STATUS("productStatus", "status", Set.of("rules.required", "mobile"), FormKey.PRODUCT.getKey());
196+
PRODUCT_STATUS("productStatus", "status", Set.of("rules.required", "mobile"), FormKey.PRODUCT.getKey()),
197197
/*------ end: PRODUCT ------*/
198+
199+
/**
200+
* 价格表单
201+
*/
202+
PRICE_NAME("priceName", "name", Set.of("rules.required", "mobile"), FormKey.PRICE.getKey()),
203+
PRICE_STATUS("priceStatus", "status", Set.of("rules.required", "mobile"), FormKey.PRICE.getKey()),
204+
PRICE_PRODUCT_TABLE("priceProducts", "products", Set.of("mobile"), FormKey.PRICE.getKey()),
205+
PRICE_PRODUCT("priceProduct", "product", Set.of("rules.required", "mobile", "dataSourceType"), FormKey.PRICE.getKey()),
206+
PRICE_PRODUCT_AMOUNT("priceProductAmount", "amount", Set.of("rules.required", "mobile"), FormKey.PRICE.getKey()),
207+
208+
/**
209+
* 报价单表单
210+
*/
211+
QUOTATION_NAME("quotationName", "name", Set.of("rules.required", "mobile"), FormKey.QUOTATION.getKey()),
212+
QUOTATION_OPPORTUNITY("quotationOpportunity", "opportunityId", Set.of("rules.required", "mobile"), FormKey.QUOTATION.getKey()),
213+
QUOTATION_PRODUCT_TABLE("quotationProducts", "products", Set.of("mobile"), FormKey.QUOTATION.getKey()),
214+
QUOTATION_PRODUCT("quotationProduct", "product", Set.of("rules.required", "mobile", "dataSourceType"), FormKey.QUOTATION.getKey()),
215+
QUOTATION_PRODUCT_AMOUNT("quotationAmount", "amount", Set.of("rules.required", "mobile"), FormKey.QUOTATION.getKey()),
216+
217+
/**
218+
* 合同回款计划
219+
*/
220+
/*------ start: CONTRACT_PAYMENT_PLAN ------*/
221+
/**
222+
* 负责人
223+
*/
224+
CONTRACT_PAYMENT_PLAN_OWNER("contractPaymentPlanOwner", "owner", Set.of("rules.required", "mobile"), FormKey.CONTRACT_PAYMENT_PLAN.getKey()),
225+
/**
226+
* 合同
227+
*/
228+
CONTRACT_PAYMENT_PLAN_CONTRACT("contractPaymentPlanContract", "contractId", Set.of(), FormKey.CONTRACT_PAYMENT_PLAN.getKey()),
229+
/**
230+
* 计划回款金额
231+
*/
232+
CONTRACT_PAYMENT_PLAN_PLAN_AMOUNT("contractPaymentPlanPlanAmount", "plan_amount", Set.of(), FormKey.CONTRACT_PAYMENT_PLAN.getKey()),
233+
/**
234+
* 计划回款时间
235+
*/
236+
CONTRACT_PAYMENT_PLAN_PLAN_END_TIME("contractPaymentPlanPlanEndTime", "plan_end_time", Set.of(), FormKey.CONTRACT_PAYMENT_PLAN.getKey());
237+
/*------ end: CONTRACT_PAYMENT_PLAN ------*/
238+
239+
198240
/**
199241
* 业务字段缓存
200242
*/

backend/crm/src/main/java/cn/cordys/common/constants/FormKey.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@ public enum FormKey {
5252
/**
5353
* 合同
5454
*/
55-
CONTRACT("contract");
55+
CONTRACT("contract"),
56+
/**
57+
* 合同回款计划
58+
*/
59+
CONTRACT_PAYMENT_PLAN("contractPaymentPlan");
5660

5761
private final String key;
5862

backend/crm/src/main/java/cn/cordys/common/service/DataInitService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public void initOneTime() {
5050
initOneTime(moduleFormService::processOldLinkData, "process.old.link.data");
5151
initOneTime(moduleFormService::initFormScenarioProp, "init.record.form.scenario");
5252
initOneTime(clueService::processTransferredCluePlanAndRecord, "process.transferred.clue");
53-
initOneTime(moduleFormService::initUpgradeForm, "init.upgrade.form.v1.3.4");
53+
initOneTime(moduleFormService::initUpgradeForm, "init.upgrade.form.v1.4.0");
5454
} finally {
5555
lock.unlock();
5656
}

backend/crm/src/main/java/cn/cordys/crm/product/controller/ProductPriceController.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package cn.cordys.crm.product.controller;
22

3+
import cn.cordys.common.constants.FormKey;
34
import cn.cordys.common.constants.PermissionConstants;
45
import cn.cordys.common.pager.PagerWithOption;
56
import cn.cordys.context.OrganizationContext;
@@ -10,6 +11,8 @@
1011
import cn.cordys.crm.product.dto.response.ProductPriceGetResponse;
1112
import cn.cordys.crm.product.dto.response.ProductPriceResponse;
1213
import cn.cordys.crm.product.service.ProductPriceService;
14+
import cn.cordys.crm.system.dto.response.ModuleFormConfigDTO;
15+
import cn.cordys.crm.system.service.ModuleFormCacheService;
1316
import cn.cordys.security.SessionUtils;
1417
import io.swagger.v3.oas.annotations.Operation;
1518
import io.swagger.v3.oas.annotations.tags.Tag;
@@ -30,6 +33,15 @@ public class ProductPriceController {
3033

3134
@Resource
3235
private ProductPriceService priceService;
36+
@Resource
37+
private ModuleFormCacheService moduleFormCacheService;
38+
39+
@GetMapping("/module/form")
40+
@RequiresPermissions(PermissionConstants.PRICE_READ)
41+
@Operation(summary = "获取表单配置")
42+
public ModuleFormConfigDTO getModuleFormConfig() {
43+
return moduleFormCacheService.getBusinessFormConfig(FormKey.PRICE.getKey(), OrganizationContext.getOrganizationId());
44+
}
3345

3446
@PostMapping("/page")
3547
@RequiresPermissions(PermissionConstants.PRICE_READ)

backend/crm/src/main/java/cn/cordys/crm/system/constants/FieldType.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,5 +95,14 @@ public enum FieldType {
9595
/**
9696
* 行业
9797
*/
98-
INDUSTRY
98+
INDUSTRY,
99+
/**
100+
* 公式
101+
*/
102+
FORMULA,
103+
/**
104+
* 子表-产品, 子表-价格
105+
*/
106+
SUB_PRODUCT,
107+
SUB_PRICE;
99108
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package cn.cordys.crm.system.dto.field;
2+
3+
import cn.cordys.crm.system.dto.field.base.BaseField;
4+
import com.fasterxml.jackson.annotation.JsonTypeName;
5+
import io.swagger.v3.oas.annotations.media.Schema;
6+
import lombok.Data;
7+
import lombok.EqualsAndHashCode;
8+
9+
/**
10+
* 公式字段
11+
* @author song-cc-rock
12+
*/
13+
@Data
14+
@JsonTypeName(value = "FORMULA")
15+
@EqualsAndHashCode(callSuper = true)
16+
public class FormulaField extends BaseField {
17+
18+
@Schema(description = "公式")
19+
private String formula;
20+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package cn.cordys.crm.system.dto.field;
2+
3+
import cn.cordys.crm.system.dto.field.base.SubField;
4+
import com.fasterxml.jackson.annotation.JsonTypeName;
5+
import lombok.Data;
6+
import lombok.EqualsAndHashCode;
7+
8+
@Data
9+
@JsonTypeName("SUB_PRICE")
10+
@EqualsAndHashCode(callSuper = true)
11+
public class PriceSubField extends SubField {
12+
13+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package cn.cordys.crm.system.dto.field;
2+
3+
import cn.cordys.crm.system.dto.field.base.BaseField;
4+
import cn.cordys.crm.system.dto.field.base.SubField;
5+
import com.fasterxml.jackson.annotation.JsonTypeName;
6+
import io.swagger.v3.oas.annotations.media.Schema;
7+
import lombok.Data;
8+
import lombok.EqualsAndHashCode;
9+
10+
import java.util.List;
11+
12+
/**
13+
* 产品子表字段
14+
* @author song-cc-rock
15+
*/
16+
@Data
17+
@JsonTypeName(value = "SUB_PRODUCT")
18+
@EqualsAndHashCode(callSuper = true)
19+
public class ProductSubField extends SubField {
20+
21+
}

backend/crm/src/main/java/cn/cordys/crm/system/dto/field/base/BaseField.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
import java.util.List;
1414
import java.util.Set;
1515

16+
/**
17+
* @author song-cc-rock
18+
*/
1619
@Data
1720
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true)
1821
@JsonSubTypes({
@@ -38,7 +41,10 @@
3841
@JsonSubTypes.Type(value = SerialNumberField.class, name = "SERIAL_NUMBER"),
3942
@JsonSubTypes.Type(value = AttachmentField.class, name = "ATTACHMENT"),
4043
@JsonSubTypes.Type(value = LinkField.class, name = "LINK"),
41-
@JsonSubTypes.Type(value = IndustryField.class, name = "INDUSTRY")
44+
@JsonSubTypes.Type(value = IndustryField.class, name = "INDUSTRY"),
45+
@JsonSubTypes.Type(value = ProductSubField.class, name = "SUB_PRODUCT"),
46+
@JsonSubTypes.Type(value = PriceSubField.class, name = "SUB_PRICE"),
47+
@JsonSubTypes.Type(value = FormulaField.class, name = "FORMULA"),
4248
})
4349
public abstract class BaseField {
4450

@@ -138,7 +144,7 @@ public boolean hasOptions() {
138144

139145
@JsonIgnore
140146
public boolean canImport() {
141-
return !Strings.CS.equalsAny(type, FieldType.SERIAL_NUMBER.name())
147+
return !Strings.CS.equalsAny(type, FieldType.SERIAL_NUMBER.name()) && !Strings.CS.equalsAny(type, FieldType.ATTACHMENT.name())
142148
&& !Strings.CS.equalsAny(type, FieldType.PICTURE.name()) && !Strings.CS.equalsAny(type, FieldType.DIVIDER.name()) && readable;
143149
}
144150

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package cn.cordys.crm.system.dto.field.base;
2+
3+
import io.swagger.v3.oas.annotations.media.Schema;
4+
import lombok.Data;
5+
import lombok.EqualsAndHashCode;
6+
7+
import java.util.List;
8+
9+
/**
10+
* 通用子表格字段(兼容子表格)
11+
* @author song-cc-rock
12+
*/
13+
@Data
14+
@EqualsAndHashCode(callSuper = true)
15+
public class SubField extends BaseField{
16+
17+
@Schema(description = "固定宽度")
18+
private Integer fixedColumn;
19+
20+
@Schema(description = "表格子字段")
21+
private List<? extends BaseField> subFields;
22+
23+
@Schema(description = "汇总列")
24+
private String sumColumn;
25+
}

0 commit comments

Comments
 (0)