|
@@ -434,5 +434,161 @@ public class accountController extends BaseController {
|
|
|
return ResponseObject.newOkResponse("����ɹ�");
|
|
return ResponseObject.newOkResponse("����ɹ�");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Mapping(value = "com.awspaas.user.apps.donenow_crm.getProductInfoByContractServiceId")
|
|
|
|
|
+ public ResponseObject getProductInfoByContractServiceId(UserContext uc, String id) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ // 1. 根据传入的id查询BO_EU_DNCTT_CONTRACT_SERVICE表获取OBJECT_ID
|
|
|
|
|
+ String contractServiceSql = "SELECT OBJECT_ID " +
|
|
|
|
|
+ "FROM BO_EU_DNCTT_CONTRACT_SERVICE " +
|
|
|
|
|
+ "WHERE id = ?";
|
|
|
|
|
+ Map<String, Object> contractServiceInfo = DBSql.getMap(contractServiceSql, new Object[]{id});
|
|
|
|
|
+
|
|
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
|
|
+
|
|
|
|
|
+ if (contractServiceInfo == null || contractServiceInfo.get("OBJECT_ID") == null) {
|
|
|
|
|
+ // 未查询到合同服务记录
|
|
|
|
|
+ result.put("contractServiceExists", false);
|
|
|
|
|
+ result.put("serviceExists", false);
|
|
|
|
|
+ result.put("productExists", false);
|
|
|
|
|
+ result.put("productId", null);
|
|
|
|
|
+ result.put("productName", null);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ result.put("contractServiceExists", true);
|
|
|
|
|
+ String objectId = contractServiceInfo.get("OBJECT_ID").toString();
|
|
|
|
|
+
|
|
|
|
|
+ // 2. 根据OBJECT_ID查询BO_EU_DNIVT_SERVICE表获取PRODUCT_ID
|
|
|
|
|
+ String serviceSql = "SELECT PRODUCT_ID " +
|
|
|
|
|
+ "FROM BO_EU_DNIVT_SERVICE " +
|
|
|
|
|
+ "WHERE id = ?";
|
|
|
|
|
+ Map<String, Object> serviceInfo = DBSql.getMap(serviceSql, new Object[]{objectId});
|
|
|
|
|
+
|
|
|
|
|
+ if (serviceInfo == null || serviceInfo.get("PRODUCT_ID") == null) {
|
|
|
|
|
+ // 未查询到服务记录
|
|
|
|
|
+ result.put("serviceExists", false);
|
|
|
|
|
+ result.put("productExists", false);
|
|
|
|
|
+ result.put("productId", null);
|
|
|
|
|
+ result.put("productName", null);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ result.put("serviceExists", true);
|
|
|
|
|
+ String productId = serviceInfo.get("PRODUCT_ID").toString();
|
|
|
|
|
+
|
|
|
|
|
+ // 3. 根据PRODUCT_ID查询bo_eu_dnivt_product表获取id和NAME
|
|
|
|
|
+ String productSql = "SELECT id, NAME " +
|
|
|
|
|
+ "FROM bo_eu_dnivt_product " +
|
|
|
|
|
+ "WHERE id = ?";
|
|
|
|
|
+ Map<String, Object> productInfo = DBSql.getMap(productSql, new Object[]{productId});
|
|
|
|
|
+
|
|
|
|
|
+ if (productInfo == null) {
|
|
|
|
|
+ // 未查询到产品记录
|
|
|
|
|
+ result.put("productExists", false);
|
|
|
|
|
+ result.put("productId", null);
|
|
|
|
|
+ result.put("productName", null);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 成功查询到产品信息
|
|
|
|
|
+ result.put("productExists", true);
|
|
|
|
|
+ result.put("productId", productInfo.get("id"));
|
|
|
|
|
+ result.put("productName", productInfo.get("NAME"));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ ResponseObject responseObject = ResponseObject.newOkResponse();
|
|
|
|
|
+ responseObject.setData(result);
|
|
|
|
|
+ return responseObject;
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ return ResponseObject.newErrResponse("查询产品信息失败:" + e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Mapping(value = "com.awspaas.user.apps.donenow_crm.getProductByContractCostId")
|
|
|
|
|
+ public ResponseObject getProductByContractCostId(UserContext uc, String id) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ // 1. 第一步:根据传入的id查询bo_eu_dnctt_contract_cost表的PRODUCT_ID
|
|
|
|
|
+ String contractCostSql = "SELECT PRODUCT_ID " +
|
|
|
|
|
+ "FROM bo_eu_dnctt_contract_cost " +
|
|
|
|
|
+ "WHERE id = ?";
|
|
|
|
|
+ Map<String, Object> contractCostInfo = DBSql.getMap(contractCostSql, new Object[]{id});
|
|
|
|
|
+
|
|
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
|
|
+
|
|
|
|
|
+ if (contractCostInfo == null || contractCostInfo.get("PRODUCT_ID") == null) {
|
|
|
|
|
+ // 未查询到合同成本记录或PRODUCT_ID为空
|
|
|
|
|
+ result.put("contractCostExists", false); // 合同成本记录是否存在
|
|
|
|
|
+ result.put("productExists", false); // 产品记录是否存在
|
|
|
|
|
+ result.put("productId", null);
|
|
|
|
|
+ result.put("productName", null);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ result.put("contractCostExists", true);
|
|
|
|
|
+ String productId = contractCostInfo.get("PRODUCT_ID").toString();
|
|
|
|
|
+
|
|
|
|
|
+ // 2. 第二步:用PRODUCT_ID查询bo_eu_dnivt_product表的id和name
|
|
|
|
|
+ String productSql = "SELECT id, NAME " +
|
|
|
|
|
+ "FROM bo_eu_dnivt_product " +
|
|
|
|
|
+ "WHERE id = ?";
|
|
|
|
|
+ Map<String, Object> productInfo = DBSql.getMap(productSql, new Object[]{productId});
|
|
|
|
|
+
|
|
|
|
|
+ if (productInfo == null) {
|
|
|
|
|
+ // 未查询到产品记录
|
|
|
|
|
+ result.put("productExists", false);
|
|
|
|
|
+ result.put("productId", null);
|
|
|
|
|
+ result.put("productName", null);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 成功查询到产品信息
|
|
|
|
|
+ result.put("productExists", true);
|
|
|
|
|
+ result.put("productId", productInfo.get("id")); // 产品表id
|
|
|
|
|
+ result.put("productName", productInfo.get("NAME")); // 产品名称
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ ResponseObject responseObject = ResponseObject.newOkResponse();
|
|
|
|
|
+ responseObject.setData(result);
|
|
|
|
|
+ return responseObject;
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ return ResponseObject.newErrResponse("查询产品信息失败:" + e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Mapping(value = "com.awspaas.user.apps.donenow_crm.getUdfGroupByProductId")
|
|
|
|
|
+ public ResponseObject getUdfGroupByProductId(UserContext uc, String productId) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ // 1. 第一步:查询产品表的INSTALLED_PRODUCT_CATE_ID
|
|
|
|
|
+ String productSql = "SELECT INSTALLED_PRODUCT_CATE_ID " +
|
|
|
|
|
+ "FROM BO_EU_DNIVT_PRODUCT " +
|
|
|
|
|
+ "WHERE id = ?";
|
|
|
|
|
+ Map<String, Object> productInfo = DBSql.getMap(productSql, new Object[]{productId});
|
|
|
|
|
+
|
|
|
|
|
+ Map<String, Object> result = new HashMap<>(2); // 仅存2个字段
|
|
|
|
|
+ String udfGroupId = null;
|
|
|
|
|
+ String udfGroupName = null;
|
|
|
|
|
+
|
|
|
|
|
+ if (productInfo != null && productInfo.get("INSTALLED_PRODUCT_CATE_ID") != null) {
|
|
|
|
|
+ String installedProductCateId = productInfo.get("INSTALLED_PRODUCT_CATE_ID").toString();
|
|
|
|
|
+
|
|
|
|
|
+ // 2. 第二步:查询自定义组表的id和name
|
|
|
|
|
+ String udfGroupSql = "SELECT id, NAME " +
|
|
|
|
|
+ "FROM BO_EU_DNSYS_UDF_GROUP " +
|
|
|
|
|
+ "WHERE is_active = 1 AND id = ?";
|
|
|
|
|
+ Map<String, Object> udfGroupInfo = DBSql.getMap(udfGroupSql, new Object[]{installedProductCateId});
|
|
|
|
|
+
|
|
|
|
|
+ if (udfGroupInfo != null) {
|
|
|
|
|
+ udfGroupId = udfGroupInfo.get("id").toString();
|
|
|
|
|
+ udfGroupName = udfGroupInfo.get("NAME").toString();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 仅返回两个字段:自定义组id和name(不存在则为null)
|
|
|
|
|
+ result.put("udfGroupId", udfGroupId);
|
|
|
|
|
+ result.put("udfGroupName", udfGroupName);
|
|
|
|
|
+
|
|
|
|
|
+ ResponseObject responseObject = ResponseObject.newOkResponse();
|
|
|
|
|
+ responseObject.setData(result);
|
|
|
|
|
+ return responseObject;
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ return ResponseObject.newErrResponse("查询失败:" + e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
}
|
|
}
|