|
|
@@ -9,6 +9,7 @@ import com.malk.server.common.McException;
|
|
|
import com.malk.server.common.McR;
|
|
|
import com.malk.utils.UtilMap;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
@@ -166,4 +167,56 @@ public class AitableController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 销售项目状态变更
|
|
|
+ * @param data
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping("/changeOpportunity")
|
|
|
+ McR changeSaleProjectStatus(@RequestBody JSONObject data) {
|
|
|
+ log.info("销售项目状态变更, {}", data);
|
|
|
+ McException.assertParamException_Null(data, "aitableId");
|
|
|
+ String aitableId = UtilMap.getString(data, "aitableId");
|
|
|
+ String yidaSaleProjectStatus = UtilMap.getString(data, "yidaSaleProjectStatus"); //销售项目状态
|
|
|
+ String yidaOrderAmount = UtilMap.getString(data, "yidaOrderAmount"); //预计项目金额
|
|
|
+ String yidaActualOrderDate = UtilMap.getString(data, "yidaActualOrderDate"); //实际成单日期
|
|
|
+ Map<String,Object> fields = new HashMap<>();
|
|
|
+ try {
|
|
|
+ String aiTableOrderStatus = ""; //订单状态 - S1~3【商机进度】
|
|
|
+ String aiTableOpportunityStage = ""; //商机阶段 - S1~3【商机进度】
|
|
|
+ if(yidaSaleProjectStatus != null && !yidaSaleProjectStatus.isEmpty()){
|
|
|
+ if("报价中".equals(yidaSaleProjectStatus)){
|
|
|
+ aiTableOrderStatus = "2、报价中";
|
|
|
+ aiTableOpportunityStage = "RFQ";
|
|
|
+ }else if("提前打样 / 修图".equals(yidaSaleProjectStatus)){
|
|
|
+ aiTableOrderStatus = "3、提前打样 / 修图";
|
|
|
+ }else if("订单确认".equals(yidaSaleProjectStatus)){
|
|
|
+ aiTableOrderStatus = "4、订单确认";
|
|
|
+ aiTableOpportunityStage = "已成单";
|
|
|
+
|
|
|
+ }else if("已立项".equals(yidaSaleProjectStatus)){
|
|
|
+ aiTableOrderStatus = "5、已立项";
|
|
|
+ }else if("暂停".equals(yidaSaleProjectStatus)){
|
|
|
+ aiTableOrderStatus = "6、暂停";
|
|
|
+ }else if("已完成".equals(yidaSaleProjectStatus)){
|
|
|
+ aiTableOrderStatus = "7、已完成";
|
|
|
+ }else if("已终止".equals(yidaSaleProjectStatus)){
|
|
|
+ aiTableOrderStatus = "8、已终止";
|
|
|
+ aiTableOpportunityStage = "已丢单";
|
|
|
+ }
|
|
|
+ fields.put("31G4UB7",aiTableOrderStatus); //订单状态 - S1~3【商机进度】
|
|
|
+ if(StringUtils.isNotEmpty(aiTableOpportunityStage)){
|
|
|
+ fields.put("LQF6OWD",aiTableOpportunityStage); //商机阶段 - S1~3【商机进度】
|
|
|
+ }
|
|
|
+ fields.put("VBsHxPE",Long.parseLong(yidaActualOrderDate)); //实际成单日期 - S3【销售数据】
|
|
|
+ fields.put("MYBeHPG",Double.parseDouble(yidaOrderAmount)); //订单金额 - S2~3【销售数据】
|
|
|
+ aitableService.updateSys1SaleData(aitableId,fields);
|
|
|
+ }
|
|
|
+ return McR.success();
|
|
|
+ } catch (Exception e) {
|
|
|
+ return McR.error("400",e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|