|
|
@@ -2072,6 +2072,121 @@ public class contractApproveController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Mapping(value = "com.awspaas.user.apps.donenow_ctt.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_ctt.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());
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|