|
|
@@ -85,7 +85,7 @@ public class contractServiceController {
|
|
|
}
|
|
|
|
|
|
|
|
|
- if (contractServiceAdj.getInstance().execServiceSaleAdj(uc, boId,false))
|
|
|
+ if (contractServiceAdj.getInstance().execServiceSaleAdj(uc, boId, false))
|
|
|
|
|
|
return ResponseObject.newOkResponse();
|
|
|
|
|
|
@@ -138,7 +138,7 @@ public class contractServiceController {
|
|
|
}
|
|
|
|
|
|
|
|
|
- if (contractServiceAdj.getInstance().execServicePurchaseAdj(uc, boId, null,false)) {
|
|
|
+ if (contractServiceAdj.getInstance().execServicePurchaseAdj(uc, boId, null, false)) {
|
|
|
return ResponseObject.newOkResponse();
|
|
|
}
|
|
|
return ResponseObject.newOkResponse();
|
|
|
@@ -169,4 +169,85 @@ public class contractServiceController {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /*
|
|
|
+ @Mapping(value = "com.awspaas.user.apps.donenow_ctt.BO_EU_DNV_RPT_MONTH_PUMA")
|
|
|
+ public ResponseObject BO_EU_DNV_RPT_MONTH_PUMA(UserContext uc, int startAccountPeriod, int endAccountPeriod) {
|
|
|
+
|
|
|
+ // DBSql.update("delete from BO_EU_DNV_RPT_MONTH_PUMA where userid='" + uc.getUID() + "'");
|
|
|
+
|
|
|
+ DBSql.update("delete from BO_EU_DNV_RPT_MONTH_PUMA ");
|
|
|
+
|
|
|
+ String sql = "INSERT INTO BO_EU_DNV_RPT_MONTH_PUMA \n" +
|
|
|
+ "\tselect t.*,onetime_dollars+tube_dollars+property_manage_dollars+construction_dollars+phone_dollars+datacard_dollars+adsl_dollars as total_dollars,concat(left(item_month,4),QUARTER(concat(item_month,'01'))) as item_quarter,'" + uc.getUID() + "' AS userid from (\n" +
|
|
|
+ "select item_month,a.CONTRACT_ID,no as contract_no,project_Location,CONTRACT_START_DATE,group_concat(distinct ITEM_MODEL) as ITEM_MODEL,\n" +
|
|
|
+ "ifnull((select sum(ifnull(DOLLARS,0)) from VIEW_EU_DNV_POSTED_ALL where item_month =a.item_month and group_Label=4684 and contract_id=a.contract_id),0)adsl_dollars,-- 宽带服务费\n" +
|
|
|
+ "ifnull((select sum(ifnull(DOLLARS,0)) from VIEW_EU_DNV_POSTED_ALL where item_month =a.item_month and group_Label=4683 and contract_id=a.contract_id),0)onetime_dollars,-- 一次性费用\n" +
|
|
|
+ "ifnull((select sum(ifnull(DOLLARS,0)) from VIEW_EU_DNV_POSTED_ALL where item_month =a.item_month and group_Label=4685 and contract_id=a.contract_id),0)tube_dollars, -- 物业管道占用费\n" +
|
|
|
+ "ifnull((select sum(ifnull(DOLLARS,0)) from VIEW_EU_DNV_POSTED_ALL where item_month =a.item_month and group_Label=4686 and contract_id=a.contract_id),0)property_manage_dollars,-- 物业管理费\n" +
|
|
|
+ "ifnull((select sum(ifnull(DOLLARS,0)) from VIEW_EU_DNV_POSTED_ALL where item_month =a.item_month and group_Label=4687 and contract_id=a.contract_id),0)construction_dollars, -- 第三方施工费\n" +
|
|
|
+ "ifnull((select sum(ifnull(DOLLARS,0)) from VIEW_EU_DNV_POSTED_ALL where item_month =a.item_month and group_Label=4688 and contract_id=a.contract_id),0)phone_dollars, -- 固话非\n" +
|
|
|
+ "ifnull((select sum(ifnull(DOLLARS,0)) from VIEW_EU_DNV_POSTED_ALL where item_month =a.item_month and group_Label=4689 and contract_id=a.contract_id),0)datacard_dollars, -- 流量卡费\n" +
|
|
|
+ "ifnull((select sum(ifnull(DOLLARS,0)) from VIEW_EU_DNV_POSTED_ALL where item_month =a.item_month and group_Label=4691 and contract_id= a.contract_id ),0)datacard_personal_dollars, -- 个人流量卡费\n" +
|
|
|
+ "ifnull((select sum(ifnull(DOLLARS,0)) from VIEW_EU_DNV_POSTED_ALL where item_month =a.item_month and group_Label=4690 and contract_id=a.contract_id ),0)vats_service_dollars, -- 代领专票服务费\n" +
|
|
|
+ "ifnull((select sum(ifnull(DOLLARS,0)) from VIEW_EU_DNV_POSTED_ALL where item_month =a.item_month and item_type=1318 and contract_id=a.contract_id),0)product_dollars -- 物料费\n" +
|
|
|
+ "from VIEW_EU_DNV_POSTED_ALL a where account_id='e9358570-f6f3-4a43-9268-ae265f3cc030' \n" +
|
|
|
+ "GROUP BY item_month,a.CONTRACT_ID,no,project_Location,CONTRACT_START_DATE \n" +
|
|
|
+ ")t where t.item_month>=" + startAccountPeriod + " and t.item_month<=" + endAccountPeriod + " order by item_month";
|
|
|
+
|
|
|
+
|
|
|
+ DBSql.update(sql);
|
|
|
+ return ResponseObject.newOkResponse();
|
|
|
+ }
|
|
|
+*/
|
|
|
+ @Mapping(value = "com.awspaas.user.apps.donenow_ctt.BO_EU_DNV_RPT_MONTH_PUMA")
|
|
|
+ public ResponseObject BO_EU_DNV_RPT_MONTH_PUMA(UserContext uc, int startAccountPeriod, int endAccountPeriod) {
|
|
|
+ // 直接执行upsert操作,无需先删除
|
|
|
+ String sql = "INSERT INTO BO_EU_DNV_RPT_MONTH_PUMA \n" +
|
|
|
+ "\tSELECT t.*, onetime_dollars+tube_dollars+property_manage_dollars+construction_dollars+phone_dollars+datacard_dollars+adsl_dollars AS total_dollars, \n" +
|
|
|
+ "\t CONCAT(LEFT(item_month,4), QUARTER(CONCAT(item_month,'01'))) AS item_quarter, \n" +
|
|
|
+ "\t '" + uc.getUID() + "' AS userid \n" +
|
|
|
+ "FROM (\n" +
|
|
|
+ " SELECT item_month, a.CONTRACT_ID, no AS contract_no, project_Location, CONTRACT_START_DATE, \n" +
|
|
|
+ " GROUP_CONCAT(DISTINCT ITEM_MODEL) AS ITEM_MODEL,\n" +
|
|
|
+ " IFNULL((SELECT SUM(IFNULL(DOLLARS,0)) FROM VIEW_EU_DNV_POSTED_ALL WHERE item_month = a.item_month AND group_Label = 4684 AND contract_id = a.contract_id), 0) AS adsl_dollars,\n" +
|
|
|
+ " IFNULL((SELECT SUM(IFNULL(DOLLARS,0)) FROM VIEW_EU_DNV_POSTED_ALL WHERE item_month = a.item_month AND group_Label = 4683 AND contract_id = a.contract_id), 0) AS onetime_dollars,\n" +
|
|
|
+ " IFNULL((SELECT SUM(IFNULL(DOLLARS,0)) FROM VIEW_EU_DNV_POSTED_ALL WHERE item_month = a.item_month AND group_Label = 4685 AND contract_id = a.contract_id), 0) AS tube_dollars,\n" +
|
|
|
+ " IFNULL((SELECT SUM(IFNULL(DOLLARS,0)) FROM VIEW_EU_DNV_POSTED_ALL WHERE item_month = a.item_month AND group_Label = 4686 AND contract_id = a.contract_id), 0) AS property_manage_dollars,\n" +
|
|
|
+ " IFNULL((SELECT SUM(IFNULL(DOLLARS,0)) FROM VIEW_EU_DNV_POSTED_ALL WHERE item_month = a.item_month AND group_Label = 4687 AND contract_id = a.contract_id), 0) AS construction_dollars,\n" +
|
|
|
+ " IFNULL((SELECT SUM(IFNULL(DOLLARS,0)) FROM VIEW_EU_DNV_POSTED_ALL WHERE item_month = a.item_month AND group_Label = 4688 AND contract_id = a.contract_id), 0) AS phone_dollars,\n" +
|
|
|
+ " IFNULL((SELECT SUM(IFNULL(DOLLARS,0)) FROM VIEW_EU_DNV_POSTED_ALL WHERE item_month = a.item_month AND group_Label = 4689 AND contract_id = a.contract_id), 0) AS datacard_dollars,\n" +
|
|
|
+ " IFNULL((SELECT SUM(IFNULL(DOLLARS,0)) FROM VIEW_EU_DNV_POSTED_ALL WHERE item_month = a.item_month AND group_Label = 4691 AND contract_id = a.contract_id), 0) AS datacard_personal_dollars,\n" +
|
|
|
+ " IFNULL((SELECT SUM(IFNULL(DOLLARS,0)) FROM VIEW_EU_DNV_POSTED_ALL WHERE item_month = a.item_month AND group_Label = 4690 AND contract_id = a.contract_id), 0) AS vats_service_dollars,\n" +
|
|
|
+ " IFNULL((SELECT SUM(IFNULL(DOLLARS,0)) FROM VIEW_EU_DNV_POSTED_ALL WHERE item_month = a.item_month AND item_type = 1318 AND contract_id = a.contract_id), 0) AS product_dollars\n" +
|
|
|
+ " FROM VIEW_EU_DNV_POSTED_ALL a\n" +
|
|
|
+ " WHERE account_id = 'e9358570-f6f3-4a43-9268-ae265f3cc030'\n" +
|
|
|
+ " GROUP BY item_month, a.CONTRACT_ID, no, project_Location, CONTRACT_START_DATE\n" +
|
|
|
+ ") t \n" +
|
|
|
+ "WHERE t.item_month >= " + startAccountPeriod + " AND t.item_month <= " + endAccountPeriod + "\n" +
|
|
|
+ "ORDER BY item_month\n" +
|
|
|
+ "ON DUPLICATE KEY UPDATE \n" +
|
|
|
+ " contract_no = VALUES(contract_no),\n" +
|
|
|
+ " project_Location = VALUES(project_Location),\n" +
|
|
|
+ " CONTRACT_START_DATE = VALUES(CONTRACT_START_DATE),\n" +
|
|
|
+ " ITEM_MODEL = VALUES(ITEM_MODEL),\n" +
|
|
|
+ " adsl_dollars = VALUES(adsl_dollars),\n" +
|
|
|
+ " onetime_dollars = VALUES(onetime_dollars),\n" +
|
|
|
+ " tube_dollars = VALUES(tube_dollars),\n" +
|
|
|
+ " property_manage_dollars = VALUES(property_manage_dollars),\n" +
|
|
|
+ " construction_dollars = VALUES(construction_dollars),\n" +
|
|
|
+ " phone_dollars = VALUES(phone_dollars),\n" +
|
|
|
+ " datacard_dollars = VALUES(datacard_dollars),\n" +
|
|
|
+ " datacard_personal_dollars = VALUES(datacard_personal_dollars),\n" +
|
|
|
+ " vats_service_dollars = VALUES(vats_service_dollars),\n" +
|
|
|
+ " product_dollars = VALUES(product_dollars),\n" +
|
|
|
+ " total_dollars = VALUES(total_dollars),\n" +
|
|
|
+ " item_quarter = VALUES(item_quarter),\n" +
|
|
|
+ " userid = VALUES(userid);";
|
|
|
+
|
|
|
+ contractLogger.info("BO_EU_DNV_RPT_MONTH_PUMA SQL: " + sql);
|
|
|
+
|
|
|
+ DBSql.update(sql);
|
|
|
+ return ResponseObject.newOkResponse();
|
|
|
+ }
|
|
|
+
|
|
|
}
|