You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

233 lines
28 KiB

diff --git a/crm-dict/src/main/java/com/crm/dict/config/DictDataInitializer.java b/crm-dict/src/main/java/com/crm/dict/config/DictDataInitializer.java
index 1d622f1..44490c0 100644
--- a/crm-dict/src/main/java/com/crm/dict/config/DictDataInitializer.java
+++ b/crm-dict/src/main/java/com/crm/dict/config/DictDataInitializer.java
@@ -42,6 +42,7 @@ public class DictDataInitializer implements CommandLineRunner {
/*-------- 棣栨壒鍐呯疆瀛楀吀绉嶅瓙锛圗xcel 鏇挎崲鍙o紝瑙佺被娉ㄩ噴锛? * 娓犻亾/鍝佺墝/闇€姹備骇鍝?闇€姹傚満鏅€夐」鍙栬嚜钃濇箹鍘熷瀷 A2-1-2-2 鏂板绾跨储琛ㄥ崟锛坒rontend-integration 绁ㄦ嵁 02锛夛紱
+ * 鍟嗘満闃舵鍙栬嚜鍘熷瀷 A7-3-2-1 闃舵妯℃澘杞ㄩ亾鍥炬牱渚嬶紙鍟嗘満妯″潡绁?06锛孫PP_STAGE_05 涓哄浐瀹氳妭鐐瑰绾︾爜锛夛紱
* 鍘熷瀷娓犻亾娓呭崟涓殑鍗犱綅鏂囨湰銆屽垪琛ㄩ」1銆嶄笉鍏ュ簱銆?-------*/
private static final List<GroupSeed> SEED_GROUPS = List.of(
@@ -148,7 +149,14 @@ public class DictDataInitializer implements CommandLineRunner {
new ItemSeed("energy", "鑳芥簮", "energy", 15, null, false),
new ItemSeed("park", "鍥尯", "park", 16, null, false),
new ItemSeed("cultural_tourism", "鏂囨梾", "cultural_tourism", 17, null, false),
- new ItemSeed("exhibition_hall", "灞曞巺", "exhibition_hall", 18, null, false))));
+ new ItemSeed("exhibition_hall", "灞曞巺", "exhibition_hall", 18, null, false))),
+ new GroupSeed("opp_stage", "鍟嗘満闃舵", 7, "鍟嗘満闃舵妯℃澘鑺傜偣寮曠敤锛堝師鍨?A7-3-2-1 杞ㄩ亾鍥炬牱渚嬶紱OPP_STAGE_05=宸茶浆椤圭洰鍥哄畾鑺傜偣锛屽晢鏈烘ā鍧楃エ 06锛?,
+ List.of(
+ new ItemSeed("OPP_STAGE_01", "瀹㈡埛鍦堝畾", "OPP_STAGE_01", 1, null, false),
+ new ItemSeed("OPP_STAGE_02", "鍏崇郴鎽告帓", "OPP_STAGE_02", 2, null, false),
+ new ItemSeed("OPP_STAGE_03", "璧勬枡閲囬泦", "OPP_STAGE_03", 3, null, false),
+ new ItemSeed("OPP_STAGE_04", "鏂规鍗?, "OPP_STAGE_04", 4, null, false),
+ new ItemSeed("OPP_STAGE_05", "宸茶浆椤圭洰", "OPP_STAGE_05", 5, null, false))));
@Override
public void run(String... args) {
diff --git a/crm-dict/src/test/java/com/crm/dict/config/DictDataInitializerTest.java b/crm-dict/src/test/java/com/crm/dict/config/DictDataInitializerTest.java
index 7a34dab..16b8e10 100644
--- a/crm-dict/src/test/java/com/crm/dict/config/DictDataInitializerTest.java
+++ b/crm-dict/src/test/java/com/crm/dict/config/DictDataInitializerTest.java
@@ -31,24 +31,24 @@ class DictDataInitializerTest extends AbstractDictH2Test {
}
@Test
- @DisplayName("棣栬锛? 涓唴缃垎缁?+ 92 涓唴缃」鍏ㄩ儴寤哄簱锛宺ef_count 棰勫缓锛岀瀛愰粯璁ら」鐢熸晥")
+ @DisplayName("棣栬锛? 涓唴缃垎缁?+ 97 涓唴缃」鍏ㄩ儴寤哄簱锛宺ef_count 棰勫缓锛岀瀛愰粯璁ら」鐢熸晥")
void firstRun_createsBuiltinDictsWithDefaults() {
initializer.run();
List<DictGroup> groups = dictGroupMapper.selectList(null);
- assertThat(groups).hasSize(6);
+ assertThat(groups).hasSize(7);
assertThat(groups).extracting(DictGroup::getCode)
.containsExactlyInAnyOrder("lead_source", "customer_status", "industry",
- "brand", "product", "scene");
+ "brand", "product", "scene", "opp_stage");
assertThat(groups).allMatch(g -> Boolean.TRUE.equals(g.getBuiltin()));
assertThat(groups).allMatch(g -> g.getStatus() == DictConstants.STATUS_ENABLED);
List<DictItem> items = dictItemMapper.selectList(null);
- assertThat(items).hasSize(92); // 38 娓犻亾 + 3 瀹㈡埛鐘舵€?+ 8 琛屼笟 + 9 鍝佺墝 + 16 闇€姹備骇鍝?+ 18 闇€姹傚満鏅?+ assertThat(items).hasSize(97); // 38 娓犻亾 + 3 瀹㈡埛鐘舵€?+ 8 琛屼笟 + 9 鍝佺墝 + 16 闇€姹備骇鍝?+ 18 闇€姹傚満鏅?+ 5 鍟嗘満闃舵
assertThat(items).allMatch(i -> Boolean.TRUE.equals(i.getBuiltin()));
// 寮曠敤璁℃暟琛岄寤猴紙涓庢柊寤烘帴鍙e悓鍙e緞锛?- assertThat(dictRefCountMapper.selectCount(null)).isEqualTo(92);
+ assertThat(dictRefCountMapper.selectCount(null)).isEqualTo(97);
DictGroup statusGroup = groups.stream()
.filter(g -> g.getCode().equals("customer_status")).findFirst().orElseThrow();
DictItem potential = dictItemMapper.selectList(null).stream()
@@ -69,9 +69,9 @@ class DictDataInitializerTest extends AbstractDictH2Test {
initializer.run();
initializer.run();
- assertThat(dictGroupMapper.selectCount(null)).isEqualTo(6);
- assertThat(dictItemMapper.selectCount(null)).isEqualTo(92);
- assertThat(dictRefCountMapper.selectCount(null)).isEqualTo(92);
+ assertThat(dictGroupMapper.selectCount(null)).isEqualTo(7);
+ assertThat(dictItemMapper.selectCount(null)).isEqualTo(97);
+ assertThat(dictRefCountMapper.selectCount(null)).isEqualTo(97);
assertThat(dictGroupDefaultMapper.selectCount(null)).isEqualTo(1);
}
@@ -194,12 +194,12 @@ class DictDataInitializerTest extends AbstractDictH2Test {
assertThat(dictGroupMapper.selectById(userGroup.getId()).getBuiltin()).isFalse();
assertThat(dictItemMapper.selectList(null).stream()
.filter(i -> i.getGroupId().equals(userGroup.getId()))).isEmpty();
- // 绉嶅瓙鍏朵粬鍒嗙粍涓嶅彈褰卞搷锛堢户缁甯稿鍏ワ級锛歝ustomer_status + industry + brand + product + scene
- assertThat(dictGroupMapper.selectCount(null)).isEqualTo(6); // lead_source(鐢ㄦ埛) + 鍏朵綑 5 涓唴缃垎缁?+ // 绉嶅瓙鍏朵粬鍒嗙粍涓嶅彈褰卞搷锛堢户缁甯稿鍏ワ級锛歝ustomer_status + industry + brand + product + scene + opp_stage
+ assertThat(dictGroupMapper.selectCount(null)).isEqualTo(7); // lead_source(鐢ㄦ埛) + 鍏朵綑 6 涓唴缃垎缁? assertThat(dictGroupMapper.selectList(null).stream()
.filter(g -> g.getCode().equals("industry"))).hasSize(1);
- assertThat(dictItemMapper.selectCount(null)).isEqualTo(54); // 92 - 娓犻亾 38锛堢敤鎴峰垎缁勬暣缁勮烦杩囷級
- assertThat(dictRefCountMapper.selectCount(null)).isEqualTo(54);
+ assertThat(dictItemMapper.selectCount(null)).isEqualTo(59); // 97 - 娓犻亾 38锛堢敤鎴峰垎缁勬暣缁勮烦杩囷級
+ assertThat(dictRefCountMapper.selectCount(null)).isEqualTo(59);
assertThat(dictGroupDefaultMapper.selectCount(null)).isEqualTo(1); // customer_status 榛樿椤? }
diff --git a/crm-opportunity/src/main/java/com/crm/opportunity/constant/OpportunityConstants.java b/crm-opportunity/src/main/java/com/crm/opportunity/constant/OpportunityConstants.java
index cbbbba8..27fe7f7 100644
--- a/crm-opportunity/src/main/java/com/crm/opportunity/constant/OpportunityConstants.java
+++ b/crm-opportunity/src/main/java/com/crm/opportunity/constant/OpportunityConstants.java
@@ -13,6 +13,8 @@ public interface OpportunityConstants {
int CODE_OPP_NOT_EXIST = 66002; // 鍟嗘満涓嶅瓨鍦ㄦ垨宸茶鍒犻櫎
int CODE_STATUS_NOT_ALLOWED = 66003; // 褰撳墠鐘舵€佷笉鍏佽姝ゆ搷浣滐紙瀹堝崼鍓嶇疆锛? int CODE_CAS_FAIL = 66004; // 涔愯閿?鐘舵€?CAS 鍐茬獊锛圓DR-0021锛?+ int CODE_STAGE_NOT_ALLOWED = 66005; // 褰撳墠鐘舵€佷笉鍏佽闃舵鍒囨崲锛堢エ 06锛氫粎鎺ㄨ繘涓彲鍒囷級
+ int CODE_STAGE_NODE_INVALID = 66006; // 鐩爣闃舵鑺傜偣闈炴硶锛堜笉灞炵粦瀹氭ā鏉跨増鏈?鍥哄畾鑺傜偣/涓嶅瓨鍦紝绁?06锛?
/*-------- 杩涘叆鍏捣鍘熷洜 pool_reason锛圥RD 搂3.5 鏋氫妇锛屽洓鍊煎皝闂紱varchar(32) 瀛樿涔夌爜锛?-------
* E3 涓変釜鏉ユ簮鍊肩敱璋冪敤鏂癸紙Service锛夋寜鎿嶄綔鍦烘櫙浼犲叆锛汦10 瓒呮湡鍥炴敹鐢?executeRecycle 鍐欐銆?diff --git a/crm-opportunity/src/main/java/com/crm/opportunity/port/inbound/impl/OpportunityConvertPortImpl.java b/crm-opportunity/src/main/java/com/crm/opportunity/port/inbound/impl/OpportunityConvertPortImpl.java
index 5c1d908..f8485d0 100644
--- a/crm-opportunity/src/main/java/com/crm/opportunity/port/inbound/impl/OpportunityConvertPortImpl.java
+++ b/crm-opportunity/src/main/java/com/crm/opportunity/port/inbound/impl/OpportunityConvertPortImpl.java
@@ -8,6 +8,7 @@ import com.crm.opportunity.mapper.OpportunityMapper;
import com.crm.opportunity.port.inbound.ConvertToProjectCmd;
import com.crm.opportunity.port.inbound.OpportunityConvertException;
import com.crm.opportunity.port.inbound.OpportunityConvertPort;
+import com.crm.opportunity.stage.OpportunityStageService;
import com.crm.opportunity.state.OpportunityTransition;
import com.crm.opportunity.state.OpportunityTransitionCmd;
import lombok.RequiredArgsConstructor;
@@ -21,6 +22,9 @@ import org.springframework.transaction.annotation.Transactional;
* 骞傜瓑锛氬凡缁堟€?5) 瀹夐潤璺宠繃杩斿洖锛涢潪鎺ㄨ繘涓?涓嶅瓨鍦ㄦ姏 {@link OpportunityConvertException}锛? * 骞跺彂绐楀彛锛堢姸鎬佹満 CAS 澶辫触锛夊厛澶嶆煡缁堟€佲€斺€斿苟鍙戦噸澶嶅洖璋冨綋骞傜瓑鍛戒腑瀹夐潤璺宠繃锛? * 鍏朵綑 CAS 鍐茬獊杞瘧涓哄悓涓€绔彛寮傚父锛屼繚鎸佸澶栧崟涓€寮傚父濂戠害锛坈ode review 20260824 琛ヤ竵锛夈€?/p>
+ *
+ * <p>杞?2 鑱斿姩锛堢エ 06銆屽洓銆嶏級锛欵8 鎴愬姛鍚庡悓姝ラ┍鍔?current_stage_id 鈫?缁戝畾妯℃澘鐗堟湰鍥哄畾鑺傜偣
+ * 銆屽凡杞」鐩€嶅苟鍐欓樁娈垫帹杩涘巻鍙诧紱骞傜瓑鍛戒腑璺緞涓嶉噸澶嶉┍鍔紙棣栨杞崲鏃跺凡钀斤級銆?/p>
*/
@Service
@RequiredArgsConstructor
@@ -31,6 +35,7 @@ public class OpportunityConvertPortImpl implements OpportunityConvertPort {
private final OpportunityMapper oppMapper;
private final OpportunityTransition transition;
+ private final OpportunityStageService stageService;
@Override
@Transactional(rollbackFor = Exception.class)
@@ -50,6 +55,8 @@ public class OpportunityConvertPortImpl implements OpportunityConvertPort {
transition.execute(cmd.opportunityId(),
new OpportunityTransitionCmd.ConvertToProjectCmd(
SYSTEM_OPERATOR, cmd.projectId(), cmd.schemeCardId()));
+ // 杞?2 鑱斿姩锛堢エ 06銆屽洓銆嶏級锛欵8 鎴愬姛 鈫?闃舵椹卞姩鑷冲浐瀹氳妭鐐广€屽凡杞」鐩€?+ stageService.onConvertedToProject(opp);
} catch (BusinessErrorException e) {
// 骞跺彂骞傜瓑琛ヤ竵锛欳AS 澶辫触鍙兘鏄苟鍙戦噸澶嶅洖璋冿紙瀵规柟浜嬪姟宸插厛瀹屾垚 E8锛夛紝澶嶆煡缁堟€佸垯褰撳箓绛夊懡涓? Opportunity latest = oppMapper.selectById(cmd.opportunityId());
diff --git a/crm-opportunity/src/test/java/com/crm/opportunity/port/inbound/OpportunityConvertPortImplTest.java b/crm-opportunity/src/test/java/com/crm/opportunity/port/inbound/OpportunityConvertPortImplTest.java
index 317e163..01d9532 100644
--- a/crm-opportunity/src/test/java/com/crm/opportunity/port/inbound/OpportunityConvertPortImplTest.java
+++ b/crm-opportunity/src/test/java/com/crm/opportunity/port/inbound/OpportunityConvertPortImplTest.java
@@ -6,6 +6,7 @@ import com.crm.opportunity.domain.entity.Opportunity;
import com.crm.opportunity.domain.enums.OpportunityStatus;
import com.crm.opportunity.mapper.OpportunityMapper;
import com.crm.opportunity.port.inbound.impl.OpportunityConvertPortImpl;
+import com.crm.opportunity.stage.OpportunityStageService;
import com.crm.opportunity.state.OpportunityTransition;
import com.crm.opportunity.state.OpportunityTransitionCmd;
import org.junit.jupiter.api.DisplayName;
@@ -40,6 +41,7 @@ class OpportunityConvertPortImplTest {
@Mock private OpportunityMapper oppMapper;
@Mock private OpportunityTransition transition;
+ @Mock private OpportunityStageService stageService;
@InjectMocks
private OpportunityConvertPortImpl port;
@@ -73,6 +75,8 @@ class OpportunityConvertPortImplTest {
.doesNotThrowAnyException();
verify(transition, never()).execute(anyLong(), any());
+ // 骞傜瓑鍛戒腑璺緞涓嶉噸澶嶉┍鍔ㄩ樁娈佃仈鍔紙棣栨杞崲鏃跺凡钀斤紝绁?06銆屽洓銆嶏級
+ verify(stageService, never()).onConvertedToProject(any());
}
@Test
@@ -89,14 +93,17 @@ class OpportunityConvertPortImplTest {
}
@Test
- @DisplayName("鎺ㄨ繘涓?2) 鈫?璋冪姸鎬佹満 E8锛堢郴缁熻韩浠?0L + projectId/schemeCardId 钀藉揩鐓э級")
+ @DisplayName("鎺ㄨ繘涓?2) 鈫?璋冪姸鎬佹満 E8锛堢郴缁熻韩浠?0L + projectId/schemeCardId 钀藉揩鐓э級+ 闃舵鑱斿姩椹卞姩鍥哄畾鑺傜偣")
void convert_advancing_invokesTransitionWithSystemOperator() {
- when(oppMapper.selectById(OPP_ID)).thenReturn(oppAt(OpportunityStatus.STATUS_ADVANCING));
+ Opportunity opp = oppAt(OpportunityStatus.STATUS_ADVANCING);
+ when(oppMapper.selectById(OPP_ID)).thenReturn(opp);
port.convert(new ConvertToProjectCmd(OPP_ID, SCHEME_CARD_ID, PROJECT_ID));
verify(transition).execute(eq(OPP_ID), eq(
new OpportunityTransitionCmd.ConvertToProjectCmd(0L, PROJECT_ID, SCHEME_CARD_ID)));
+ // 杞?2 鑱斿姩锛堢エ 06銆屽洓銆嶏級锛欵8 鎴愬姛鍚庨┍鍔ㄩ樁娈佃嚦鍥哄畾鑺傜偣銆屽凡杞」鐩€?+ verify(stageService).onConvertedToProject(opp);
}
@Test
diff --git a/crm-rule/src/main/java/com/crm/rule/constant/OpportunityRuleConstants.java b/crm-rule/src/main/java/com/crm/rule/constant/OpportunityRuleConstants.java
index 50a902a..88e9c52 100644
--- a/crm-rule/src/main/java/com/crm/rule/constant/OpportunityRuleConstants.java
+++ b/crm-rule/src/main/java/com/crm/rule/constant/OpportunityRuleConstants.java
@@ -1,10 +1,11 @@
package com.crm.rule.constant;
/**
- * 鍟嗘満瑙勫垯妯″潡甯搁噺锛堝叕娴疯鍒欓厤缃紝绁?05 / PRD 搂5锛?+ * 鍟嗘満瑙勫垯妯″潡甯搁噺锛堝叕娴疯鍒欓厤缃?绁?05 + 闃舵妯℃澘 绁?06 / PRD 搂5-搂6锛? *
* <p>涓?{@link RuleConstants}锛堢嚎绱㈣鍒欏瓙鍩燂級鍒嗗煙缁存姢锛涘晢鏈鸿鍒欎笟鍔¢敊璇爜鍚屾 64xxx 椤哄欢
- * 锛?4008 璧凤紝鍒囩墖 B 鐗堟湰鐘舵€佹満鏍¢獙鏃跺惎鐢級銆?/p>
+ * 锛?4008-64012 鍏捣瑙勫垯锛?4013 璧烽樁娈垫ā鏉匡級銆傜増鏈姸鎬?閫傜敤鑼冨洿/鏄惁鏍囪涓虹エ 05/06/07 鍏变韩鐨?+ * 銆岀増鏈寲閰嶇疆銆嶅叕鍏辩害瀹?V-CONFIG 鍊煎煙锛堢エ 06銆岄浂銆嶏級銆?/p>
*/
public interface OpportunityRuleConstants {
@@ -36,6 +37,17 @@ public interface OpportunityRuleConstants {
String RULE_CODE_PREFIX = "POOL_RULE_";
+ /*-------- 闃舵妯℃澘锛堢エ 06锛夛細缂栫爜鍓嶇紑 + 鍥哄畾鑺傜偣 ---------*/
+
+ /** 闃舵妯℃澘缂栫爜鍓嶇紑锛堢郴缁熺敓鎴愶紝搴忓彿椤哄欢锛孷-CONFIG 1锛?*/
+ String TEMPLATE_CODE_PREFIX = "OPP_STAGE_TPL_";
+
+ /** 銆屽凡杞」鐩€嶅浐瀹氳妭鐐瑰瓧鍏?code锛堢エ 06銆屽洓銆嶏細姣忔ā鏉胯嚜甯︺€佷笉鍙垹銆佷粎鏂规鍗¤浆椤圭洰椹卞姩鍒拌揪锛?*/
+ String FIXED_STAGE_DICT_CODE = "OPP_STAGE_05";
+
+ /** 銆屽凡杞」鐩€嶅浐瀹氳妭鐐瑰睍绀哄悕锛坈ustom_node_name 涓虹┖鏃剁殑瀛楀吀鍚嶅厹搴曪級 */
+ String FIXED_STAGE_NAME = "宸茶浆椤圭洰";
+
/*-------- 涓氬姟閿欒鐮侊紙64xxx锛屾帴 RuleConstants 64007 椤哄欢锛?--------*/
/** 瑙勫垯鍙傛暟/鐘舵€佹牎楠屽け璐?*/
@@ -52,4 +64,21 @@ public interface OpportunityRuleConstants {
/** 鍙戝竷鏃堕€傜敤閮ㄩ棬涓庡叾瀹冨彂甯冧腑瑙勫垯閲嶅彔锛堥儴闂ㄨ鐩栧敮涓€锛?*/
int CODE_OPP_RULE_DEPT_CONFLICT = 64012;
+
+ /*-------- 闃舵妯℃澘涓氬姟閿欒鐮侊紙绁?06锛?4013 璧烽『寤讹級 --------*/
+
+ /** 妯℃澘鍙傛暟/鐘舵€佹牎楠屽け璐?*/
+ int CODE_STAGE_TPL_INVALID = 64013;
+
+ /** 妯℃澘鐗堟湰涓嶅瓨鍦?*/
+ int CODE_STAGE_TPL_NOT_EXIST = 64014;
+
+ /** 浠呰崏绋垮彲鍒狅紙鍙戝竷涓€佸凡鍋滅敤涓嶅彲鐩存帴鍒狅級 */
+ int CODE_STAGE_TPL_NOT_DRAFT = 64015;
+
+ /** 鍚屾ā鏉跨紪鐮佸凡瀛樺湪鑽夌锛堢紪杈戝彂甯冧腑/鍋滅敤鐗堟湰鏃朵笉鍐嶇敓鎴愭柊鑽夌锛?*/
+ int CODE_STAGE_TPL_DRAFT_EXISTS = 64016;
+
+ /** 鍙戝竷鏍¢獙澶辫触锛氶樁娈佃妭鐐归厤缃笉瀹屾暣锛堟棤鏅€氳妭鐐?瀛楀吀 code 缂哄け锛?*/
+ int CODE_STAGE_TPL_NODE_INVALID = 64017;
}