diff --git a/anrui-reportcenter/anrui-reportcenter-biz/src/main/java/com/yxt/anrui/reportcenter/biz/reportset/ReportSetService.java b/anrui-reportcenter/anrui-reportcenter-biz/src/main/java/com/yxt/anrui/reportcenter/biz/reportset/ReportSetService.java index f9b29d987d..d492a071b4 100644 --- a/anrui-reportcenter/anrui-reportcenter-biz/src/main/java/com/yxt/anrui/reportcenter/biz/reportset/ReportSetService.java +++ b/anrui-reportcenter/anrui-reportcenter-biz/src/main/java/com/yxt/anrui/reportcenter/biz/reportset/ReportSetService.java @@ -119,7 +119,7 @@ public class ReportSetService extends MybatisBaseService '0002' - AND vehicleState <> '0004' - AND vehicleState <> '0007' - AND isDelete <> 1 - AND lockedState <> '02' - GROUP BY `useOrgSid`, `modelSid`, `modelConfigSid`) AS s ON - r.useOrgSid = s.useOrgSid AND r.vehModelSid = s.modelSid AND r.vehMConfigSid = s.modelConfigSid - SET r.`stock_unreserve`=s.scount - WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - -- 更新库存-已定(库存状态不是出库0002且不是内销0007且不是退库0004的,非删除,锁定状态为销售订单锁定02) - UPDATE daily_report r INNER JOIN (SELECT COUNT(id) AS scount, `useOrgSid`, `modelSid`, `modelConfigSid` - FROM anrui_base.`base_vehicle` - WHERE vehicleState <> '0002' - AND vehicleState <> '0004' - AND vehicleState <> '0007' - AND isDelete <> 1 - AND lockedState = '02' - GROUP BY `useOrgSid`, `modelSid`, `modelConfigSid`) AS s ON - r.useOrgSid = s.useOrgSid AND r.vehModelSid = s.modelSid AND r.vehMConfigSid = s.modelConfigSid - SET r.`stock_reserve`=s.scount - WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - -- 更新库存-小计 - UPDATE daily_report - SET stock_subtotal=stock_unreserve + stock_reserve - WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - -- 更新库存-买断-未定(库存状态不是出库0002且不是内销0007且不是退库0004的,非删除,非销售订单锁定、已买断) - UPDATE daily_report r INNER JOIN (SELECT COUNT(id) AS scount, `useOrgSid`, `modelSid`, `modelConfigSid` - FROM anrui_base.`base_vehicle` - WHERE vehicleState <> '0002' - AND vehicleState <> '0004' - AND vehicleState <> '0007' - AND isDelete <> 1 - AND lockedState <> '02' - AND settlementStatus = '2' - GROUP BY `useOrgSid`, `modelSid`, `modelConfigSid`) AS s ON - r.useOrgSid = s.useOrgSid AND r.vehModelSid = s.modelSid AND r.vehMConfigSid = s.modelConfigSid - SET r.`stock_buyout_unreserve`=s.scount - WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - -- 更新库存-买断-已定(库存状态不是出库0002且不是内销0007且不是退库0004的,非删除,销售订单锁定,已买断) - UPDATE daily_report r INNER JOIN (SELECT COUNT(id) AS scount, `useOrgSid`, `modelSid`, `modelConfigSid` - FROM anrui_base.`base_vehicle` - WHERE vehicleState <> '0002' - AND vehicleState <> '0004' - AND vehicleState <> '0007' - AND isDelete <> 1 - AND lockedState = '02' - AND settlementStatus = '2' - GROUP BY `useOrgSid`, `modelSid`, `modelConfigSid`) AS s ON - r.useOrgSid = s.useOrgSid AND r.vehModelSid = s.modelSid AND r.vehMConfigSid = s.modelConfigSid - SET r.`stock_buyout_reserve`=s.scount - WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - -- 更新库存-买断-小计 - UPDATE daily_report - SET `stock_buyout_subtotal`=`stock_buyout_unreserve` + `stock_buyout_reserve` - WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - -- 更新库存-排产-未定(排产订单中未入库,且未被销售订单锁定) - UPDATE daily_report r - INNER JOIN ( - select sum(v.scount) as scount, v.useOrgSid, v.modelSid, v.modelConfigSid, v.carBrand, v.orderNo - from ( - select ifnull(si.num, 0) as scount, - si.useOrgSid, - si.modelSid, - si.configSid modelConfigSid, - bbm.carBrand, - bbo.orderNo - from anrui_base.bus_vehicle_apply bo - left join anrui_scm.scm_apply_inbound si on bo.sid = si.vehicleOrderSid - left join anrui_base.bus_vehicle_order bbo on bbo.purchaseRequisitionSid = bo.sid - left join anrui_base.base_vehicle_model bbm on bbm.sid = si.modelSid - where (si.nodeState != '已办结' and si.nodeState != '终止') - and bo.isDelete <> 1 - and bo.applyTypeKey = '001' - and bo.sid not in (select bbbbo.linkSid - from anrui_buscenter.bus_sales_vehicle_order bbbbo - LEFT JOIN anrui_buscenter.bus_sales_order bb ON bb.sid = bbbbo.salesOrderSid - WHERE LENGTH(bb.nodeState) > 0 - AND bb.nodeState != '终止' - and bb.nodeState != '销售订单申请' - group by bbbbo.linkSid) - group by si.applicationCode, bo.createOrgSid, si.modelSid, si.configSid - union all - select ifnull(sum(bo.platformNo), 0) - ifnull(sum(ab.counts), 0) as scount, - bo.useOrgSid, - bd.vehicleSid, - bd.configSid modelConfigSid, - bbm.carBrand, - bo.orderNo - - from anrui_base.bus_vehicle_order bo - left join anrui_base.bus_vehicle_apply_detail bd - on bd.sid = bo.purchaseApplyMediumModelSid - left join anrui_base.base_vehicle_model bbm on bbm.sid = bd.vehicleSid - LEFT JOIN ( - SELECT bbbbo.linkSid, - ifnull(sum(bbbbo.usingNum), 0) as counts - FROM anrui_buscenter.bus_sales_vehicle_order bbbbo - LEFT JOIN anrui_buscenter.bus_sales_order bb ON bb.sid = bbbbo.salesOrderSid - WHERE LENGTH(bb.nodeState) > 0 - AND bb.nodeState != '终止' - and bb.nodeState != '销售订单申请' - group by bbbbo.linkSid - ) ab ON ab.linkSid = bo.sid - where bo.isDelete <> 1 - and (offlineDate is null or offlineDate = '') - and bo.orderStatus != '已作废' - and LENGTH(bo.orderNo) > 0 - group by bo.sid, bo.createOrgSid, bd.vehicleSid, bd.configSid - union all - select ifnull(si.num, 0) as scount, - si.useOrgSid, - si.modelSid, - si.configSid modelConfigSid, - bbm.carBrand, - 0 - from anrui_base.bus_vehicle_apply bo - left join anrui_scm.scm_apply_inbound si on bo.sid = si.vehicleOrderSid - left join anrui_base.base_vehicle_model bbm on bbm.sid = si.modelSid - where (si.nodeState != '已办结' and si.nodeState != '终止') - and bo.isDelete <> 1 - and bo.applyTypeKey = '004' - group by si.applicationCode, bo.createOrgSid, si.modelSid, si.configSid - ) as v - GROUP BY v.`useOrgSid`, - v.`modelSid`, - v.`modelConfigSid` - ) AS s ON r.useOrgSid = s.useOrgSid - AND r.vehModelSid = s.modelSid - AND r.vehMConfigSid = s.modelConfigSid - SET r.`pcOrder_unreserve` = s.scount - WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - --- 更新库存-排产已定(未入库且被销售订单锁定的台数) - UPDATE daily_report r - INNER JOIN ( - select sum(v.scount) as scount, v.useOrgSid, v.modelSid, v.modelConfigSid - from ( - SELECT si.useOrgSid, - si.modelSid, - si.configSid modelConfigSid, - bo.sid, - ifnull(ab.counts, 0) as scount - FROM anrui_base.bus_vehicle_apply bo - LEFT JOIN anrui_scm.scm_apply_inbound si ON bo.sid = si.vehicleOrderSid - LEFT JOIN ( - SELECT bbbbo.linkSid, - ifnull(sum(bbbbo.usingNum), 0) as counts - FROM anrui_buscenter.bus_sales_vehicle_order bbbbo - LEFT JOIN anrui_buscenter.bus_sales_order bb ON bb.sid = bbbbo.salesOrderSid - WHERE LENGTH(bb.nodeState) > 0 - AND bb.nodeState != '终止' - and bb.nodeState != '销售订单申请' - group by bbbbo.linkSid - ) ab ON ab.linkSid = bo.sid - WHERE (si.nodeState != '已办结' AND si.nodeState != '终止') - AND bo.isDelete <> 1 - group by si.applicationCode, bo.createOrgSid, si.modelSid, si.configSid - UNION ALL - SELECT bo.useOrgSid, - bd.vehicleSid modelSid, - bd.configSid, - bo.sid, - ifnull(ab.counts, 0) as scount - FROM anrui_base.bus_vehicle_order bo - LEFT JOIN anrui_base.bus_vehicle_apply_detail bd - ON bd.sid = bo.purchaseApplyMediumModelSid - LEFT JOIN anrui_base.base_vehicle_model bbm ON bbm.sid = bd.vehicleSid - LEFT JOIN ( - SELECT bbbbo.linkSid, - ifnull(sum(bbbbo.usingNum), 0) as counts - FROM anrui_buscenter.bus_sales_vehicle_order bbbbo - LEFT JOIN anrui_buscenter.bus_sales_order bb ON bb.sid = bbbbo.salesOrderSid - WHERE LENGTH(bb.nodeState) > 0 - AND bb.nodeState != '终止' - and bb.nodeState != '销售订单申请' - group by bbbbo.linkSid - ) ab ON ab.linkSid = bo.sid - WHERE bo.isDelete <> 1 - AND LENGTH(offlineDate) = 0 - AND bo.orderStatus != '已作废' - group by bo.createOrgSid, bd.vehicleSid, bd.configSid - ) as v - GROUP BY v.`useOrgSid`, - v.`modelSid`, - v.`modelConfigSid` - ) AS s ON r.useOrgSid = s.useOrgSid - AND r.vehModelSid = s.modelSid - AND r.vehMConfigSid = s.modelConfigSid - SET r.`pcOrder_reserve` = s.scount - WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - - -- 更新库存- 排产小计 - - UPDATE daily_report - SET pcOrder_subtotal=pcOrder_reserve + pcOrder_unreserve - WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - - --- 简易订单-每日(简易订单今日已办结的) - - UPDATE daily_report r - INNER JOIN (select count(bbv.id) as scount, bbv.modelSid, bbv.modelConfigSid, bbm.orgSid useOrgSid - from anrui_buscenter.bus_main_deposit bbm - left join anrui_buscenter.bus_deposit_vehicle bbv on bbv.billSid = bbm.sid - where bbm.createTime like concat('%', CURDATE(), '%') - and bbm.nodeState = '已办结' - GROUP BY `useOrgSid`, - `modelSid`, - `modelConfigSid` - ) AS s ON r.useOrgSid = s.useOrgSid - AND r.vehModelSid = s.modelSid - AND r.vehMConfigSid = s.modelConfigSid - SET r.`simpleOrder_day` = s.scount - WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - - --- 简易订单-每月(简易订单本月已办结的) - - UPDATE daily_report r - INNER JOIN (select count(bbv.id) as scount, bbv.modelSid, bbv.modelConfigSid, bbm.orgSid useOrgSid - from anrui_buscenter.bus_main_deposit bbm - left join anrui_buscenter.bus_deposit_vehicle bbv on bbv.billSid = bbm.sid - where bbm.createTime like concat('%', DATE_FORMAT(CURDATE(), '%Y-%m'), '%') - and bbm.nodeState = '已办结' - GROUP BY `useOrgSid`, - `modelSid`, - `modelConfigSid` - ) AS s ON r.useOrgSid = s.useOrgSid - AND r.vehModelSid = s.modelSid - AND r.vehMConfigSid = s.modelConfigSid - SET r.`simpleOrder_month` = s.scount - WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - - --- 销售订单-本日-全款 - UPDATE daily_report r - INNER JOIN (select count(bv.id) as scount, bm.modelSid, bm.modelConfigSid, bo.useOrgSid - from anrui_buscenter.bus_sales_order bo - left join anrui_buscenter.bus_sales_order_model bm on bm.salesOrderSid = bo.sid - left join anrui_buscenter.bus_sales_order_vehicle bv on bv.salesOrderSid = bo.sid - where bo.closingDate like concat('%', CURDATE(), '%') - and bo.payTypeKey = 1 - and bo.nodeState = '已办结' - group by useOrgSid, modelSid, modelConfigSid - ) AS s ON r.useOrgSid = s.useOrgSid - AND r.vehModelSid = s.modelSid - AND r.vehMConfigSid = s.modelConfigSid - SET r.`saleOrder_full_day` = s.scount - WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); --- 销售订单-本日-贷款 - UPDATE daily_report r - INNER JOIN (select count(bv.id) as scount, bm.modelSid, bm.modelConfigSid, bo.useOrgSid - from anrui_buscenter.bus_sales_order bo - left join anrui_buscenter.bus_sales_order_model bm on bm.salesOrderSid = bo.sid - left join anrui_buscenter.bus_sales_order_vehicle bv on bv.salesOrderSid = bo.sid - where bo.closingDate like concat('%', CURDATE(), '%') - and bo.payTypeKey = 2 - and bo.nodeState = '已办结' - group by useOrgSid, modelSid, modelConfigSid - ) AS s ON r.useOrgSid = s.useOrgSid - AND r.vehModelSid = s.modelSid - AND r.vehMConfigSid = s.modelConfigSid - SET r.`saleOrder_loan_day` = s.scount - WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - /*-- 销售订单-本日-小计 - UPDATE daily_report r - INNER JOIN (select count(bv.id) as scount, bm.modelSid, bm.modelConfigSid, bo.useOrgSid - from anrui_buscenter.bus_sales_order bo - left join anrui_buscenter.bus_sales_order_model bm on bm.salesOrderSid = bo.sid - left join anrui_buscenter.bus_sales_order_vehicle bv on bv.salesOrderSid = bo.sid - where bo.closingDate like concat('%', CURDATE(), '%') - group by useOrgSid, modelSid, modelConfigSid - ) AS s ON r.useOrgSid = s.useOrgSid - AND r.vehModelSid = s.modelSid - AND r.vehMConfigSid = s.modelConfigSid - SET r.`saleOrder_subtotal_day` = s.scount - WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE();*/ - --- 销售订单本日-小计 - UPDATE daily_report - SET saleOrder_subtotal_day=saleOrder_loan_day + saleOrder_full_day - WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - - --- 销售订单-本月-全款 - UPDATE daily_report r - INNER JOIN (select count(bv.id) as scount, bm.modelSid, bm.modelConfigSid, bo.useOrgSid - from anrui_buscenter.bus_sales_order bo - left join anrui_buscenter.bus_sales_order_model bm on bm.salesOrderSid = bo.sid - left join anrui_buscenter.bus_sales_order_vehicle bv on bv.salesOrderSid = bo.sid - where bo.closingDate like concat('%', DATE_FORMAT(CURDATE(), '%Y-%m'), '%') - and bo.payTypeKey = 1 - and bo.nodeState = '已办结' - group by useOrgSid, modelSid, modelConfigSid - ) AS s ON r.useOrgSid = s.useOrgSid - AND r.vehModelSid = s.modelSid - AND r.vehMConfigSid = s.modelConfigSid - SET r.`saleOrder_full_month` = s.scount - WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); --- 销售订单-本月-贷款 - UPDATE daily_report r - INNER JOIN (select count(bv.id) as scount, bm.modelSid, bm.modelConfigSid, bo.useOrgSid - from anrui_buscenter.bus_sales_order bo - left join anrui_buscenter.bus_sales_order_model bm on bm.salesOrderSid = bo.sid - left join anrui_buscenter.bus_sales_order_vehicle bv on bv.salesOrderSid = bo.sid - where bo.closingDate like concat('%', DATE_FORMAT(CURDATE(), '%Y-%m'), '%') - and bo.payTypeKey = 2 - and bo.nodeState = '已办结' - group by useOrgSid, modelSid, modelConfigSid - ) AS s ON r.useOrgSid = s.useOrgSid - AND r.vehModelSid = s.modelSid - AND r.vehMConfigSid = s.modelConfigSid - SET r.`saleOrder_loan_month` = s.scount - WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - - -- 销售订单-本月-小计 -/*UPDATE daily_report r - INNER JOIN (select count(bv.id) as scount, bm.modelSid, bm.modelConfigSid, bo.useOrgSid - from anrui_buscenter.bus_sales_order bo - left join anrui_buscenter.bus_sales_order_model bm on bm.salesOrderSid = bo.sid - left join anrui_buscenter.bus_sales_order_vehicle bv on bv.salesOrderSid = bo.sid - where bo.closingDate like concat('%', DATE_FORMAT(CURDATE(), '%Y-%m'), '%') - group by useOrgSid, modelSid, modelConfigSid - ) AS s ON r.useOrgSid = s.useOrgSid - AND r.vehModelSid = s.modelSid - AND r.vehMConfigSid = s.modelConfigSid -SET r.`saleOrder_subtotal_month` = s.scount -WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE();*/ - UPDATE daily_report - SET saleOrder_subtotal_month=saleOrder_loan_month + saleOrder_full_month - WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - - -- 销售订单-待交车累计 -/*UPDATE daily_report r - INNER JOIN (select count(bs.id) as scount, bo.useOrgSid, bm.modelSid, bm.modelConfigSid - from anrui_base.base_vehicle_state bs - left join anrui_buscenter.bus_sales_order bo on bo.sid = bs.saleOrderSid - left join anrui_buscenter.bus_sales_order_model bm on bm.salesOrderSid = bo.sid - where bs.busState = '401' - and (bs.finState = 1 or bs.carryVehicleState = 1) - group by bo.useOrgSid, bm.modelSid, bm.modelConfigSid - ) AS s ON r.useOrgSid = s.useOrgSid - AND r.vehModelSid = s.modelSid - AND r.vehMConfigSid = s.modelConfigSid -SET r.`saleOrder_waitVeh_total` = s.scount -WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE();*/ - --- UPDATE daily_report r --- INNER JOIN (select count(bv.id) as scount,bv.useOrgSid,bv.modelSid,bv.modelConfigSid,bo.contractNo from anrui_base.base_vehicle bv --- left join anrui_buscenter.bus_sales_order_vehicle bov on bov.linkSid = bv.sid --- left join anrui_buscenter.bus_sales_order bo on bo.sid = bov.salesOrderSid --- where bo.nodeState = '已办结' and (bv.vehicleState = '0001' or bv.vehicleState = '0005') --- group by bo.useOrgSid, bv.modelSid, bv.modelConfigSid --- ) AS s ON r.useOrgSid = s.useOrgSid --- AND r.vehModelSid = s.modelSid --- AND r.vehMConfigSid = s.modelConfigSid --- SET r.`saleOrder_waitVeh_total` = s.scount --- WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - --- -- 销售订单-待交车累计(销售订单已办结且库存状态为库存和在途的)已办结的销售订单的台数-已出库的台数 - UPDATE daily_report r - INNER JOIN (select sum(c.scount) as scount, c.useOrgSid, c.modelSid, c.modelConfigSid - from (select (b.scount - b.ssscount1 - b.ssscount) as scount, - b.ssscount1 s1, - b.ssscount s2, - b.useOrgSid, - b.modelConfigSid, - b.modelSid, - b.contractNo - from (SELECT a.scount, - a.useOrgSid, - a.modelConfigSid, - a.modelSid, - a.contractNo, - (SELECT count(bov.id) AS scount - from anrui_buscenter.bus_sales_order_vehicle bov - LEFT JOIN anrui_buscenter.bus_sales_order bo ON bo.sid = bov.salesOrderSid - LEFT JOIN anrui_buscenter.bus_sales_order_model bm ON bm.salesOrderSid = bo.sid - left join anrui_base.base_vehicle_state bs on bs.busSid = bov.sid - WHERE bo.nodeState = '已办结' - AND (bs.busState = '602' or bs.busState = '501' or bs.busState = '502' or - bs.busState = '503' or bs.busState = '601' or bs.busState = '602') - and bo.useOrgSid = a.useOrgSid - and bm.modelSid = a.modelSid - and bm.modelConfigSid = a.modelConfigSid - and bo.contractNo = a.contractNo) as ssscount1, - (SELECT count(bov.id) AS scount - FROM anrui_base.base_vehicle bv - LEFT JOIN anrui_buscenter.bus_sales_order_vehicle bov ON bov.linkSid = bv.sid - LEFT JOIN anrui_buscenter.bus_sales_order bo ON bo.sid = bov.salesOrderSid - LEFT JOIN anrui_buscenter.bus_sales_order_model bm ON bm.salesOrderSid = bo.sid - left join anrui_base.base_vehicle_state bs on bs.busSid = bov.sid - WHERE bo.nodeState = '已办结' - AND bv.vehicleState = '0002' - and bo.useOrgSid = a.useOrgSid - and bm.modelSid = a.modelSid - and bm.modelConfigSid = a.modelConfigSid - and bs.busSid is null - and bo.contractNo = a.contractNo) as ssscount - FROM ( - SELECT count(bov.id) AS scount, - bo.useOrgSid, - bm.modelSid, - bm.modelConfigSid, - bo.contractNo - FROM anrui_buscenter.bus_sales_order_vehicle bov - LEFT JOIN anrui_buscenter.bus_sales_order bo ON bo.sid = bov.salesOrderSid - LEFT JOIN anrui_buscenter.bus_sales_order_model bm ON bm.salesOrderSid = bo.sid - WHERE bo.nodeState = '已办结' - GROUP BY bo.useOrgSid, - bm.modelSid, - bm.modelConfigSid, - bo.contractNo - ) a) b) c - group by c.useOrgSid, c.modelSid, c.modelConfigSid - ) AS s ON r.useOrgSid = s.useOrgSid - AND r.vehModelSid = s.modelSid - AND r.vehMConfigSid = s.modelConfigSid - SET r.`saleOrder_waitVeh_total` = s.scount - WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - - --- 本日销售全款(销售日期为本日、全款、主车(包含value为空的)) - UPDATE daily_report r - INNER JOIN (select sum(ss.scount) as scount, ss.modelSid, ss.modelConfigSid, ss.useOrgSid - from (select count(bv.id) as scount, bv.modelSid, bv.modelConfigSid, bv.useOrgSid - from anrui_base.base_vehicle bv - left join anrui_base.base_vehicle_out bvo on bv.sid = bvo.vinSid - left join anrui_base.base_vehicle_out_apply bvoa on bvoa.sid = bvo.mainSid - where bv.salesDate like concat('%', CURDATE(), '%') - and bvoa.saleTypeKey = '001' - and (bvo.materialTypeKey = '001' or bvo.materialTypeValue is null or - length(bvo.materialTypeValue) = 0) - group by bv.useOrgSid, bv.modelSid, bv.modelConfigSid) ss - group by ss.useOrgSid, ss.modelSid, ss.modelConfigSid - ) AS s ON r.useOrgSid = s.useOrgSid - AND r.vehModelSid = s.modelSid - AND r.vehMConfigSid = s.modelConfigSid - SET r.`sale_full_day` = s.scount - WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); --- 本日销售贷款(贷款、销售日期为本日、主车(包含value为空的)) - UPDATE daily_report r - INNER JOIN (select sum(ss.scount) as scount, ss.modelSid, ss.modelConfigSid, ss.useOrgSid - from (select count(bv.id) as scount, bv.modelSid, bv.modelConfigSid, bv.useOrgSid - from anrui_base.base_vehicle bv - left join anrui_base.base_vehicle_out bvo on bv.sid = bvo.vinSid - left join anrui_base.base_vehicle_out_apply bvoa on bvoa.sid = bvo.mainSid - where bv.salesDate like concat('%', CURDATE(), '%') - and bvoa.saleTypeKey = '002' - and (bvo.materialTypeKey = '001' or bvo.materialTypeValue is null or - length(bvo.materialTypeValue) = 0) - group by bv.useOrgSid, bv.modelSid, bv.modelConfigSid) ss - group by ss.useOrgSid, ss.modelSid, ss.modelConfigSid - ) AS s ON r.useOrgSid = s.useOrgSid - AND r.vehModelSid = s.modelSid - AND r.vehMConfigSid = s.modelConfigSid - SET r.`sale_loan_day` = s.scount - WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - - -- 本日销售小计 -/*UPDATE daily_report r - INNER JOIN (select count(bv.id) as scount, bv.modelSid, bv.modelConfigSid, bv.useOrgSid - from anrui_base.base_vehicle bv - where bv.salesDate like concat('%', CURDATE(), '%') - group by useOrgSid, modelSid, modelConfigSid - ) AS s ON r.useOrgSid = s.useOrgSid - AND r.vehModelSid = s.modelSid - AND r.vehMConfigSid = s.modelConfigSid -SET r.`sale_subtotal_day` = s.scount -WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE();*/ - UPDATE daily_report - SET sale_subtotal_day=sale_loan_day + sale_full_day - WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - - --- 本月销售全款(全款、销售日期本月、主车(包含value为空的)) - UPDATE daily_report r - INNER JOIN (select sum(ss.scount) as scount, ss.modelSid, ss.modelConfigSid, ss.useOrgSid - from (select count(bv.id) as scount, bv.modelSid, bv.modelConfigSid, bv.useOrgSid - from anrui_base.base_vehicle bv - left join anrui_base.base_vehicle_out bvo on bv.sid = bvo.vinSid - left join anrui_base.base_vehicle_out_apply bvoa on bvoa.sid = bvo.mainSid - where bv.salesDate like concat('%', DATE_FORMAT(CURDATE(), '%Y-%m'), '%') - and bvoa.saleTypeKey = '001' - and (bvo.materialTypeKey = '001' or bvo.materialTypeValue is null or - length(bvo.materialTypeValue) = 0) - group by bv.useOrgSid, bv.modelSid, bv.modelConfigSid) ss - group by ss.useOrgSid, ss.modelSid, ss.modelConfigSid - ) AS s ON r.useOrgSid = s.useOrgSid - AND r.vehModelSid = s.modelSid - AND r.vehMConfigSid = s.modelConfigSid - SET r.`sale_full_month` = s.scount - WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); --- 本月销售贷款(贷款、销售日期为本月、主车(包含value为空的)) - UPDATE daily_report r - INNER JOIN (select sum(ss.scount) as scount, ss.modelSid, ss.modelConfigSid, ss.useOrgSid - from (select count(bv.id) as scount, bv.modelSid, bv.modelConfigSid, bv.useOrgSid - from anrui_base.base_vehicle bv - left join anrui_base.base_vehicle_out bvo on bv.sid = bvo.vinSid - left join anrui_base.base_vehicle_out_apply bvoa on bvoa.sid = bvo.mainSid - where bv.salesDate like concat('%', DATE_FORMAT(CURDATE(), '%Y-%m'), '%') - and bvoa.saleTypeKey = '002' - and (bvo.materialTypeKey = '001' or bvo.materialTypeValue is null or - length(bvo.materialTypeValue) = 0) - group by bv.useOrgSid, bv.modelSid, bv.modelConfigSid) ss - group by ss.useOrgSid, ss.modelSid, ss.modelConfigSid - ) AS s ON r.useOrgSid = s.useOrgSid - AND r.vehModelSid = s.modelSid - AND r.vehMConfigSid = s.modelConfigSid - SET r.`sale_loan_month` = s.scount - WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - - -- 本月销售小计 -/*UPDATE daily_report r - INNER JOIN (select count(bv.id) as scount, bv.modelSid, bv.modelConfigSid, bv.useOrgSid - from anrui_base.base_vehicle bv - where bv.salesDate like concat('%', DATE_FORMAT(CURDATE(), '%Y-%m'), '%') - group by useOrgSid, modelSid, modelConfigSid - ) AS s ON r.useOrgSid = s.useOrgSid - AND r.vehModelSid = s.modelSid - AND r.vehMConfigSid = s.modelConfigSid -SET r.`sale_subtotal_month` = s.scount -WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE();*/ - UPDATE daily_report - SET sale_subtotal_month=sale_loan_month + sale_full_month - WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - - --- 本年销售全款(全款、销售日期为本年、主车(包含value为空的)) - UPDATE daily_report r - INNER JOIN (select sum(ss.scount) as scount, ss.modelSid, ss.modelConfigSid, ss.useOrgSid - from (select count(bv.id) as scount, bv.modelSid, bv.modelConfigSid, bv.useOrgSid - from anrui_base.base_vehicle bv - left join anrui_base.base_vehicle_out bvo on bv.sid = bvo.vinSid - left join anrui_base.base_vehicle_out_apply bvoa on bvoa.sid = bvo.mainSid - where bv.salesDate like concat('%', DATE_FORMAT(CURDATE(), '%Y'), '%') - and bvoa.saleTypeKey = '001' - and (bvo.materialTypeKey = '001' or bvo.materialTypeValue is null or - length(bvo.materialTypeValue) = 0) - group by bv.useOrgSid, bv.modelSid, bv.modelConfigSid) ss - group by ss.useOrgSid, ss.modelSid, ss.modelConfigSid - ) AS s ON r.useOrgSid = s.useOrgSid - AND r.vehModelSid = s.modelSid - AND r.vehMConfigSid = s.modelConfigSid - SET r.`sale_full_year` = s.scount - WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); --- 本年销售贷款(贷款、销售日期本年、主车(value为空的))) - UPDATE daily_report r - INNER JOIN (select sum(ss.scount) as scount, ss.modelSid, ss.modelConfigSid, ss.useOrgSid - from (select count(bv.id) as scount, bv.modelSid, bv.modelConfigSid, bv.useOrgSid - from anrui_base.base_vehicle bv - left join anrui_base.base_vehicle_out bvo on bv.sid = bvo.vinSid - left join anrui_base.base_vehicle_out_apply bvoa on bvoa.sid = bvo.mainSid - where bv.salesDate like concat('%', DATE_FORMAT(CURDATE(), '%Y'), '%') - and bvoa.saleTypeKey = '002' - and (bvo.materialTypeKey = '001' or bvo.materialTypeValue is null or - length(bvo.materialTypeValue) = 0) - group by bv.useOrgSid, bv.modelSid, bv.modelConfigSid) ss - group by ss.useOrgSid, ss.modelSid, ss.modelConfigSid - ) AS s ON r.useOrgSid = s.useOrgSid - AND r.vehModelSid = s.modelSid - AND r.vehMConfigSid = s.modelConfigSid - SET r.`sale_loan_year` = s.scount - WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - - -- 本年销售小计 -/*UPDATE daily_report r - INNER JOIN (select count(bv.id) as scount, bv.modelSid, bv.modelConfigSid, bv.useOrgSid - from anrui_base.base_vehicle bv - where bv.salesDate like concat('%', DATE_FORMAT(CURDATE(), '%Y'), '%') - group by useOrgSid, modelSid, modelConfigSid - ) AS s ON r.useOrgSid = s.useOrgSid - AND r.vehModelSid = s.modelSid - AND r.vehMConfigSid = s.modelConfigSid -SET r.`sale_subtotal_year` = s.scount -WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE();*/ - UPDATE daily_report - SET sale_subtotal_year=sale_loan_year + sale_full_year - WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - --- 本日买断的台数 - - UPDATE daily_report r - INNER JOIN (select count(bv.id) as scount, bv.modelSid, bv.modelConfigSid, bv.useOrgSid - from anrui_base.base_vehicle bv - where bv.solidDate like concat('%', CURDATE(), '%') - group by useOrgSid, modelSid, modelConfigSid - ) AS s ON r.useOrgSid = s.useOrgSid - AND r.vehModelSid = s.modelSid - AND r.vehMConfigSid = s.modelConfigSid - SET r.`buyout_day` = s.scount - WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - --- 本月买断的台数 - - UPDATE daily_report r - INNER JOIN (select count(bv.id) as scount, bv.modelSid, bv.modelConfigSid, bv.useOrgSid - from anrui_base.base_vehicle bv - where bv.solidDate like concat('%', DATE_FORMAT(CURDATE(), '%Y-%m'), '%') - group by useOrgSid, modelSid, modelConfigSid - ) AS s ON r.useOrgSid = s.useOrgSid - AND r.vehModelSid = s.modelSid - AND r.vehMConfigSid = s.modelConfigSid - SET r.`buyout_month` = s.scount - WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - --- 本年买断的台数 - UPDATE daily_report r - INNER JOIN (select count(bv.id) as scount, bv.modelSid, bv.modelConfigSid, bv.useOrgSid - from anrui_base.base_vehicle bv - where bv.solidDate like concat('%', DATE_FORMAT(CURDATE(), '%Y'), '%') - group by useOrgSid, modelSid, modelConfigSid - ) AS s ON r.useOrgSid = s.useOrgSid - AND r.vehModelSid = s.modelSid - AND r.vehMConfigSid = s.modelConfigSid - SET r.`buyout_year` = s.scount - WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - - --- 交付-贷款-本日 - update daily_report r inner join ( - select count(bhi.id) as scount, bm.modelSid, bm.modelConfigSid, bh.useOrgSid - from anrui_buscenter.bus_handover_items bhi - left join anrui_buscenter.bus_handover bh on bh.sid = bhi.handoverSid - left join anrui_buscenter.bus_sales_order_model bm on bm.salesOrderSid = bh.orderSid - left join anrui_buscenter.bus_sales_order_vehicle bv on bhi.vinSid = bv.linkSid - left join anrui_buscenter.bus_sales_order bo on bo.sid = bh.orderSid - where bh.closingDate like concat('%', CURDATE(), '%') - and bo.payTypeKey = '2' - group by bh.useOrgSid, bm.modelSid, modelConfigSid) s - on r.useOrgSid = s.useOrgSid - and r.vehModelSid = s.modelSid - and r.vehMConfigSid = s.modelConfigSid - set deliver_loan_day = s.scount - where DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - --- 交付-全款-本日 - update daily_report r inner join ( - select count(bhi.id) as scount, bm.modelSid, bm.modelConfigSid, bh.useOrgSid - from anrui_buscenter.bus_handover_items bhi - left join anrui_buscenter.bus_handover bh on bh.sid = bhi.handoverSid - left join anrui_buscenter.bus_sales_order_model bm on bm.salesOrderSid = bh.orderSid - left join anrui_buscenter.bus_sales_order_vehicle bv on bhi.vinSid = bv.linkSid - left join anrui_buscenter.bus_sales_order bo on bo.sid = bh.orderSid - where bh.closingDate like concat('%', CURDATE(), '%') - and bo.payTypeKey = '1' - group by bh.useOrgSid, bm.modelSid, modelConfigSid) s - on r.useOrgSid = s.useOrgSid - and r.vehModelSid = s.modelSid - and r.vehMConfigSid = s.modelConfigSid - set deliver_full_day = s.scount - where DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - - -- 交付-小计-本日 -/*update daily_report r inner join ( - select count(bhi.id) as scount, bm.modelSid, bm.modelConfigSid, bh.useOrgSid - from anrui_buscenter.bus_handover_items bhi - left join anrui_buscenter.bus_handover bh on bh.sid = bhi.handoverSid - left join anrui_buscenter.bus_sales_order_model bm on bm.salesOrderSid = bh.orderSid - left join anrui_buscenter.bus_sales_order_vehicle bv on bhi.vinSid = bv.linkSid - left join anrui_buscenter.bus_sales_order bo on bo.sid = bh.orderSid - where bh.closingDate like concat('%', CURDATE(), '%') - group by bh.useOrgSid, bm.modelSid, modelConfigSid) s - on r.useOrgSid = s.useOrgSid - and r.vehModelSid = s.modelSid - and r.vehMConfigSid = s.modelConfigSid -set deliver_subtotal_day = s.scount -where DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE();*/ - - UPDATE daily_report - SET deliver_subtotal_day=deliver_full_day + deliver_loan_day - WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - --- 交付-贷款-本月 - update daily_report r inner join ( - select count(bhi.id) as scount, bm.modelSid, bm.modelConfigSid, bh.useOrgSid - from anrui_buscenter.bus_handover_items bhi - left join anrui_buscenter.bus_handover bh on bh.sid = bhi.handoverSid - left join anrui_buscenter.bus_sales_order_model bm on bm.salesOrderSid = bh.orderSid - left join anrui_buscenter.bus_sales_order_vehicle bv on bhi.vinSid = bv.linkSid - left join anrui_buscenter.bus_sales_order bo on bo.sid = bh.orderSid - where bh.closingDate like concat('%', DATE_FORMAT(CURDATE(), '%Y-%m'), '%') - and bo.payTypeKey = '2' - group by bh.useOrgSid, bm.modelSid, modelConfigSid) s - on r.useOrgSid = s.useOrgSid - and r.vehModelSid = s.modelSid - and r.vehMConfigSid = s.modelConfigSid - set deliver_loan_month = s.scount - where DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - --- 交付-全款-本月 - update daily_report r inner join ( - select count(bhi.id) as scount, bm.modelSid, bm.modelConfigSid, bh.useOrgSid - from anrui_buscenter.bus_handover_items bhi - left join anrui_buscenter.bus_handover bh on bh.sid = bhi.handoverSid - left join anrui_buscenter.bus_sales_order_model bm on bm.salesOrderSid = bh.orderSid - left join anrui_buscenter.bus_sales_order_vehicle bv on bhi.vinSid = bv.linkSid - left join anrui_buscenter.bus_sales_order bo on bo.sid = bh.orderSid - where bh.closingDate like concat('%', DATE_FORMAT(CURDATE(), '%Y-%m'), '%') - and bo.payTypeKey = '1' - group by bh.useOrgSid, bm.modelSid, modelConfigSid) s - on r.useOrgSid = s.useOrgSid - and r.vehModelSid = s.modelSid - and r.vehMConfigSid = s.modelConfigSid - set deliver_full_month = s.scount - where DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - - -- 交付-小计-本月 -/*update daily_report r inner join ( - select count(bhi.id) as scount, bm.modelSid, bm.modelConfigSid, bh.useOrgSid - from anrui_buscenter.bus_handover_items bhi - left join anrui_buscenter.bus_handover bh on bh.sid = bhi.handoverSid - left join anrui_buscenter.bus_sales_order_model bm on bm.salesOrderSid = bh.orderSid - left join anrui_buscenter.bus_sales_order_vehicle bv on bhi.vinSid = bv.linkSid - left join anrui_buscenter.bus_sales_order bo on bo.sid = bh.orderSid - where bh.closingDate like concat('%', DATE_FORMAT(CURDATE(), '%Y-%m'), '%') - group by bh.useOrgSid, bm.modelSid, modelConfigSid) s - on r.useOrgSid = s.useOrgSid - and r.vehModelSid = s.modelSid - and r.vehMConfigSid = s.modelConfigSid -set deliver_subtotal_month = s.scount -where DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE();*/ - UPDATE daily_report - SET deliver_subtotal_month=deliver_full_month + deliver_loan_month - WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - --- 交付-贷款-本年 - update daily_report r inner join ( - select count(bhi.id) as scount, bm.modelSid, bm.modelConfigSid, bh.useOrgSid - from anrui_buscenter.bus_handover_items bhi - left join anrui_buscenter.bus_handover bh on bh.sid = bhi.handoverSid - left join anrui_buscenter.bus_sales_order_model bm on bm.salesOrderSid = bh.orderSid - left join anrui_buscenter.bus_sales_order_vehicle bv on bhi.vinSid = bv.linkSid - left join anrui_buscenter.bus_sales_order bo on bo.sid = bh.orderSid - where bh.closingDate like concat('%', DATE_FORMAT(CURDATE(), '%Y'), '%') - and bo.payTypeKey = '2' - group by bh.useOrgSid, bm.modelSid, modelConfigSid) s - on r.useOrgSid = s.useOrgSid - and r.vehModelSid = s.modelSid - and r.vehMConfigSid = s.modelConfigSid - set deliver_loan_year = s.scount - where DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - --- 交付-全款-本年 - update daily_report r inner join ( - select count(bhi.id) as scount, bm.modelSid, bm.modelConfigSid, bh.useOrgSid - from anrui_buscenter.bus_handover_items bhi - left join anrui_buscenter.bus_handover bh on bh.sid = bhi.handoverSid - left join anrui_buscenter.bus_sales_order_model bm on bm.salesOrderSid = bh.orderSid - left join anrui_buscenter.bus_sales_order_vehicle bv on bhi.vinSid = bv.linkSid - left join anrui_buscenter.bus_sales_order bo on bo.sid = bh.orderSid - where bh.closingDate like concat('%', DATE_FORMAT(CURDATE(), '%Y'), '%') - and bo.payTypeKey = '1' - group by bh.useOrgSid, bm.modelSid, modelConfigSid) s - on r.useOrgSid = s.useOrgSid - and r.vehModelSid = s.modelSid - and r.vehMConfigSid = s.modelConfigSid - set deliver_full_year = s.scount - where DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - - -- 交付-小计-本年 -/*update daily_report r inner join ( - select count(bhi.id) as scount, bm.modelSid, bm.modelConfigSid, bh.useOrgSid - from anrui_buscenter.bus_handover_items bhi - left join anrui_buscenter.bus_handover bh on bh.sid = bhi.handoverSid - left join anrui_buscenter.bus_sales_order_model bm on bm.salesOrderSid = bh.orderSid - left join anrui_buscenter.bus_sales_order_vehicle bv on bhi.vinSid = bv.linkSid - left join anrui_buscenter.bus_sales_order bo on bo.sid = bh.orderSid - where bh.closingDate like concat('%', DATE_FORMAT(CURDATE(), '%Y'), '%') - group by bh.useOrgSid, bm.modelSid, modelConfigSid) s - on r.useOrgSid = s.useOrgSid - and r.vehModelSid = s.modelSid - and r.vehMConfigSid = s.modelConfigSid -set deliver_subtotal_year = s.scount -where DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE();*/ - UPDATE daily_report - SET deliver_subtotal_year=deliver_full_year + deliver_loan_year - WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - - --- 存销比 - update daily_report r inner join ( - select ddr.useOrgSid, - ddr.vehModelSid, - ddr.vehMConfigSid, - (select ifnull(sum(ss.scount), 0) as scount - from (select count(bv.id) as scount, bv.modelSid, bv.modelConfigSid, bv.useOrgSid - from anrui_base.base_vehicle bv - left join anrui_base.base_vehicle_out bvo on bv.sid = bvo.vinSid - left join anrui_base.base_vehicle_out_apply bvoa on bvoa.sid = bvo.mainSid - where (DATE_FORMAT(bv.salesDate, '%Y-%m') LIKE - DATE_FORMAT(DATE_SUB(CURDATE(), INTERVAL 1 MONTH), '%Y-%m') - OR DATE_FORMAT(bv.salesDate, '%Y-%m') LIKE - DATE_FORMAT(DATE_SUB(CURDATE(), INTERVAL 2 MONTH), '%Y-%m') - OR DATE_FORMAT(bv.salesDate, '%Y-%m') LIKE - DATE_FORMAT(DATE_SUB(CURDATE(), INTERVAL 3 MONTH), '%Y-%m') - ) - and (bvoa.saleTypeKey = '001' or bvoa.saleTypeKey = '002') - group by bv.useOrgSid, bv.modelSid, bv.modelConfigSid) ss - where ss.useOrgSid = ddr.useOrgSid - and ss.modelSid = ddr.vehModelSid - and ss.modelConfigSid = ddr.vehMConfigSid) as subtotal - from daily_report ddr - where DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE() - group by ddr.useOrgSid, ddr.vehModelSid, ddr.vehMConfigSid - ) s - on r.useOrgSid = s.useOrgSid - and r.vehModelSid = s.vehModelSid - and r.vehMConfigSid = s.vehMConfigSid - set saleOfStockRatio =if(ROUND(s.subtotal / 3, 2) = 0, - stock_subtotal + pcOrder_subtotal, - ROUND((stock_subtotal + pcOrder_subtotal) / ROUND(s.subtotal / 3, 2), 2)) - where DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - --- 前三个月的销售台数之和 - update daily_report r inner join ( - select ddr.useOrgSid, - ddr.vehModelSid, - ddr.vehMConfigSid, - (select ifnull(sum(ss.scount), 0) as scount - from (select count(bv.id) as scount, bv.modelSid, bv.modelConfigSid, bv.useOrgSid - from anrui_base.base_vehicle bv - left join anrui_base.base_vehicle_out bvo on bv.sid = bvo.vinSid - left join anrui_base.base_vehicle_out_apply bvoa on bvoa.sid = bvo.mainSid - where (DATE_FORMAT(bv.salesDate, '%Y-%m') LIKE - DATE_FORMAT(DATE_SUB(CURDATE(), INTERVAL 1 MONTH), '%Y-%m') - OR DATE_FORMAT(bv.salesDate, '%Y-%m') LIKE - DATE_FORMAT(DATE_SUB(CURDATE(), INTERVAL 2 MONTH), '%Y-%m') - OR DATE_FORMAT(bv.salesDate, '%Y-%m') LIKE - DATE_FORMAT(DATE_SUB(CURDATE(), INTERVAL 3 MONTH), '%Y-%m') - ) - and (bvoa.saleTypeKey = '001' or bvoa.saleTypeKey = '002') - and (bvo.materialTypeKey = '001' or bvo.materialTypeValue is null or - length(bvo.materialTypeValue) = 0) - group by bv.useOrgSid, bv.modelSid, bv.modelConfigSid) ss - where ss.useOrgSid = ddr.useOrgSid - and ss.modelSid = ddr.vehModelSid - and ss.modelConfigSid = ddr.vehMConfigSid) as subtotal - from daily_report ddr - where DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE() - group by ddr.useOrgSid, ddr.vehModelSid, ddr.vehMConfigSid - ) s - on r.useOrgSid = s.useOrgSid - and r.vehModelSid = s.vehModelSid - and r.vehMConfigSid = s.vehMConfigSid - set saleAllToThree =s.subtotal - where DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - - --- 库存小计 - update daily_report - set stock_total = (stock_subtotal + pcOrder_subtotal) - where DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - - -- 欠款出库数量--截止当日欠款出库申请通过且未回清款的台数 --- 欠款出库数量--截止当日欠款出库申请通过且未回清款的台数(欠款出库申请通过,且未认完款的台数总和加上欠款提车申请通过,且全款已出库未认完款的台数总和) - update daily_report r inner join (SELECT SUM(cc.scount) AS scount, - cc.useOrgSid, - cc.vehMConfigSid, - cc.vehModelSid - FROM ( - SELECT COUNT(a.id) AS scount, - a.useOrgSid, - a.NAME, - a.contractNo, - a.vehMConfigSid, - a.vehModelSid - FROM ( - SELECT bdad.id, - ba.useOrgSid, - bm.modelConfigSid AS vehMConfigSid, - bm.modelSid AS vehModelSid, - so.NAME, - SUM(s.reveivableMoney), - SUM(s.subscriptionMoney), - bo.contractNo - FROM anrui_buscenter.bus_delivered_apply_details bdad - LEFT JOIN anrui_buscenter.bus_delivered_apply ba ON ba.sid = bdad.applySid - LEFT JOIN anrui_buscenter.bus_sales_order_vehicle bv ON bv.sid = bdad.busVinSid - LEFT JOIN anrui_buscenter.bus_sales_order bo ON bo.sid = bv.salesOrderSid - LEFT JOIN anrui_buscenter.bus_sales_order_model bm ON bm.salesOrderSid = bo.sid - LEFT JOIN ( - SELECT fd.reveivableMoney, - fd.busVinSid, - IFNULL(SUM(fs.subscriptionMoney), 0) AS subscriptionMoney - FROM anrui_fin.fin_uncollected_receivables_detailed fd - LEFT JOIN anrui_fin.fin_selected_receivables_detailed fs - ON fs.receivablesSid = fd.sid - WHERE fd.kxState = '01' - AND fs.auditState = 3 - GROUP BY fd.sid - UNION ALL - SELECT fd.reveivableMoney, - fd.busVinSid, - 0 AS subscriptionMoney - FROM anrui_fin.fin_uncollected_receivables_detailed fd - left join (select fs.* - from anrui_fin.fin_selected_receivables_detailed fs - where fs.auditState = 3) s - on s.receivablesSid = fd.sid - WHERE fd.kxState = '01' - and s.id is null - GROUP BY fd.sid - ) s ON s.busVinSid = bv.sid - LEFT JOIN anrui_portal.sys_organization so ON so.sid = ba.useOrgSid - WHERE ba.nodeState = '已办结' - AND ba.typeState = 1 - GROUP BY bv.sid, - ba.useOrgSid, - bm.modelSid, - bm.modelConfigSid - HAVING SUM(s.reveivableMoney) > SUM(s.subscriptionMoney)) a - GROUP BY a.useOrgSid, - a.vehMConfigSid, - a.vehModelSid - UNION ALL - SELECT COUNT(a.id) AS scount, - a.useOrgSid, - a.name, - a.contractNo, - a.vehMConfigSid, - a.vehModelSid - FROM (SELECT bdad.id, - ba.useOrgSid, - bm.modelConfigSid AS vehMConfigSid, - bm.modelSid AS vehModelSid, - so.name, - SUM(s.reveivableMoney), - SUM(s.subscriptionMoney), - bo.contractNo - FROM anrui_buscenter.bus_arrears_carry_vehicle_details bdad - LEFT JOIN anrui_buscenter.bus_arrears_carry_vehicle_apply ba - ON ba.sid = bdad.applySid - LEFT JOIN anrui_buscenter.bus_sales_order_vehicle bv ON bv.linkSid = bdad.vinSid - LEFT JOIN anrui_buscenter.bus_sales_order bo ON bo.sid = bv.salesOrderSid - LEFT JOIN anrui_buscenter.bus_sales_order_model bm ON bm.salesOrderSid = bo.sid - LEFT JOIN anrui_base.base_vehicle bbv ON bbv.sid = bv.linkSid - LEFT JOIN (SELECT fd.reveivableMoney, - fd.busVinSid, - IFNULL(SUM(fs.subscriptionMoney), 0) AS subscriptionMoney - FROM anrui_fin.fin_uncollected_receivables_detailed fd - LEFT JOIN anrui_fin.fin_selected_receivables_detailed fs - ON fs.receivablesSid = fd.sid - WHERE fd.kxState = '01' - AND fs.auditState = 3 - GROUP BY fd.sid - UNION ALL - SELECT fd.reveivableMoney, - fd.busVinSid, - 0 AS subscriptionMoney - FROM anrui_fin.fin_uncollected_receivables_detailed fd - left join (select fs.* - from anrui_fin.fin_selected_receivables_detailed fs - where fs.auditState = 3) s - on s.receivablesSid = fd.sid - WHERE fd.kxState = '01' - and s.id is null - GROUP BY fd.sid - ) s ON s.busVinSid = bv.sid - LEFT JOIN anrui_portal.sys_organization so ON so.sid = ba.useOrgSid - WHERE ba.nodeState = '已办结' - AND ba.paymentMethodKey = 1 - AND bbv.vehicleState = '0002' - GROUP BY bv.sid, - ba.useOrgSid, - bm.modelSid, - bm.modelConfigSid - HAVING SUM(s.reveivableMoney) > SUM(s.subscriptionMoney)) a - GROUP BY a.useOrgSid, - a.vehMConfigSid, a.vehModelSid) cc - GROUP BY cc.useOrgSid, - cc.vehMConfigSid, - cc.vehModelSid - ) s - on r.useOrgSid = s.useOrgSid - and r.vehModelSid = s.vehModelSid - and r.vehMConfigSid = s.vehMConfigSid - set arrears_carry_veh_count = s.scount - where DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - - - -- 欠款出库金融--截止当日欠款出库申请通过且未回清款的台数欠款总额 --- 欠款出库金融--截止当日欠款出库申请通过且未回清款的台数欠款总额(欠款出库申请通过,且未认完款的剩余认款总和加上欠款提车申请通过,且全款已出库未认完款的剩余认款总和) - update daily_report r inner join (SELECT sum(cc.scount) AS scount, - cc.useOrgSid, - cc.vehMConfigSid, - cc.vehModelSid - FROM ( - SELECT SUM(a.scount) AS scount, - a.useOrgSid, - a.NAME, - a.contractNo, - a.vehMConfigSid, - a.vehModelSid - FROM ( - SELECT bdad.id, - ba.useOrgSid, - bm.modelConfigSid AS vehMConfigSid, - bm.modelSid AS vehModelSid, - so.NAME, - SUM(s.reveivableMoney), - SUM(s.subscriptionMoney), - bo.contractNo, - ( - SUM(s.reveivableMoney) - SUM(s.subscriptionMoney)) AS scount - FROM anrui_buscenter.bus_delivered_apply_details bdad - LEFT JOIN anrui_buscenter.bus_delivered_apply ba ON ba.sid = bdad.applySid - LEFT JOIN anrui_buscenter.bus_sales_order_vehicle bv ON bv.sid = bdad.busVinSid - LEFT JOIN anrui_buscenter.bus_sales_order bo ON bo.sid = bv.salesOrderSid - LEFT JOIN anrui_buscenter.bus_sales_order_model bm ON bm.salesOrderSid = bo.sid - LEFT JOIN ( - SELECT fd.reveivableMoney, - fd.busVinSid, - IFNULL(SUM(fs.subscriptionMoney), 0) AS subscriptionMoney - FROM anrui_fin.fin_uncollected_receivables_detailed fd - LEFT JOIN anrui_fin.fin_selected_receivables_detailed fs - ON fs.receivablesSid = fd.sid - WHERE fd.kxState = '01' - AND fs.auditState = 3 - GROUP BY fd.sid - UNION ALL - SELECT fd.reveivableMoney, - fd.busVinSid, - 0 AS subscriptionMoney - FROM anrui_fin.fin_uncollected_receivables_detailed fd - left join (select fs.* - from anrui_fin.fin_selected_receivables_detailed fs - where fs.auditState = 3) s - on s.receivablesSid = fd.sid - WHERE fd.kxState = '01' - and s.id is null - GROUP BY fd.sid - ) s ON s.busVinSid = bv.sid - LEFT JOIN anrui_portal.sys_organization so ON so.sid = ba.useOrgSid - WHERE ba.nodeState = '已办结' - AND ba.typeState = 1 - GROUP BY bv.sid, - ba.useOrgSid, - bm.modelSid, - bm.modelConfigSid - HAVING SUM(s.reveivableMoney) > SUM(s.subscriptionMoney)) a - GROUP BY a.useOrgSid, - a.vehMConfigSid, - a.vehModelSid - UNION ALL - SELECT SUM(a.scount) AS scount, - a.useOrgSid, - a.NAME, - a.contractNo, - a.vehMConfigSid, - a.vehModelSid - FROM ( - SELECT bdad.id, - ba.useOrgSid, - bm.modelConfigSid AS vehMConfigSid, - bm.modelSid AS vehModelSid, - so.NAME, - SUM(s.reveivableMoney), - SUM(s.subscriptionMoney), - bo.contractNo, - ( - SUM(s.reveivableMoney) - SUM(s.subscriptionMoney)) AS scount - FROM anrui_buscenter.bus_arrears_carry_vehicle_details bdad - LEFT JOIN anrui_buscenter.bus_arrears_carry_vehicle_apply ba - ON ba.sid = bdad.applySid - LEFT JOIN anrui_buscenter.bus_sales_order_vehicle bv ON bv.linkSid = bdad.vinSid - LEFT JOIN anrui_buscenter.bus_sales_order bo ON bo.sid = bv.salesOrderSid - LEFT JOIN anrui_buscenter.bus_sales_order_model bm ON bm.salesOrderSid = bo.sid - LEFT JOIN anrui_base.base_vehicle bbv ON bbv.sid = bv.linkSid - LEFT JOIN ( - SELECT fd.reveivableMoney, - fd.busVinSid, - IFNULL(SUM(fs.subscriptionMoney), 0) AS subscriptionMoney - FROM anrui_fin.fin_uncollected_receivables_detailed fd - LEFT JOIN anrui_fin.fin_selected_receivables_detailed fs - ON fs.receivablesSid = fd.sid - WHERE fd.kxState = '01' - AND fs.auditState = 3 - GROUP BY fd.sid - UNION ALL - SELECT fd.reveivableMoney, - fd.busVinSid, - 0 AS subscriptionMoney - FROM anrui_fin.fin_uncollected_receivables_detailed fd - left join (select fs.* - from anrui_fin.fin_selected_receivables_detailed fs - where fs.auditState = 3) s - on s.receivablesSid = fd.sid - WHERE fd.kxState = '01' - and s.id is null - GROUP BY fd.sid - ) s ON s.busVinSid = bv.sid - LEFT JOIN anrui_portal.sys_organization so ON so.sid = ba.useOrgSid - WHERE ba.nodeState = '已办结' - AND ba.paymentMethodKey = 1 - AND bbv.vehicleState = '0002' - GROUP BY bv.sid, - ba.useOrgSid, - bm.modelSid, - bm.modelConfigSid - HAVING SUM(s.reveivableMoney) > SUM(s.subscriptionMoney)) a - GROUP BY a.useOrgSid, - a.vehMConfigSid, - a.vehModelSid - ) cc - GROUP BY cc.useOrgSid, - cc.vehMConfigSid, - cc.vehModelSid - ) s - on r.useOrgSid = s.useOrgSid - and r.vehModelSid = s.vehModelSid - and r.vehMConfigSid = s.vehMConfigSid - set arrears_carry_veh_amount = ROUND(s.scount / 10000, 2) - where DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - - --- 金融未放款数量--- 截止当日贷款业务已出库且融资放款未认款的台数。 - update daily_report r inner join ( - SELECT sum(b.scount) AS scount, - b.useOrgSid, - b.NAME, - b.contractNo, - b.vehMConfigSid, - b.vehModelSid - from (SELECT count(a.id) AS scount, - a.useOrgSid, - a.NAME, - a.contractNo, - a.vehMConfigSid, - a.vehModelSid - FROM ( - SELECT bv.id, - bo.useOrgSid, - bm.modelConfigSid AS vehMConfigSid, - bm.modelSid AS vehModelSid, - so.NAME, - SUM(s.reveivableMoney), - SUM(s.subscriptionMoney), - bo.contractNo - FROM anrui_buscenter.bus_sales_order_vehicle bv - LEFT JOIN anrui_buscenter.bus_sales_order bo ON bo.sid = bv.salesOrderSid - LEFT JOIN anrui_base.base_vehicle bbv ON bbv.sid = bv.linkSid - LEFT JOIN anrui_buscenter.bus_sales_order_model bm - ON bm.salesOrderSid = bv.salesOrderSid - LEFT JOIN ( - SELECT fd.reveivableMoney, - fd.busVinSid, - IFNULL(SUM(fs.subscriptionMoney), 0) AS subscriptionMoney - FROM anrui_fin.fin_uncollected_receivables_detailed fd - LEFT JOIN anrui_fin.fin_selected_receivables_detailed fs - ON fs.receivablesSid = fd.sid - WHERE fd.kxState = '01' - AND fs.auditState = 3 - AND fd.receivablesName = '融资放款' - GROUP BY fd.sid - UNION ALL - SELECT fd.reveivableMoney, - fd.busVinSid, - 0 AS subscriptionMoney - FROM anrui_fin.fin_uncollected_receivables_detailed fd - WHERE fd.kxState = '01' - AND fd.receivablesName = '融资放款' - AND fd.sid NOT IN (SELECT fs.`receivablesSid` - FROM anrui_fin.fin_selected_receivables_detailed fs - WHERE fs.`auditState` = 3 - AND fs.`receivablesName` = '融资放款') - GROUP BY fd.sid - ) s ON s.busVinSid = bv.sid - LEFT JOIN anrui_portal.sys_organization so ON so.sid = bo.useOrgSid - WHERE bo.payTypeKey = 2 - AND bbv.vehicleState = '0002' - GROUP BY bv.sid, - bo.useOrgSid, - bm.modelSid, - bm.modelConfigSid - HAVING SUM(s.reveivableMoney) > SUM(s.subscriptionMoney)) a - GROUP BY a.contractNo, - a.useOrgSid, - a.vehMConfigSid, - a.vehModelSid - union all - SELECT count(a.id) AS scount, - a.useOrgSid, - a.NAME, - a.contractNo, - a.vehMConfigSid, - a.vehModelSid - FROM ( - SELECT bv.id, - bo.useOrgSid, - bm.modelConfigSid AS vehMConfigSid, - bm.modelSid AS vehModelSid, - so.NAME, - bo.contractNo, - IFNULL(sss.money, '0') as money - FROM anrui_buscenter.bus_sales_order_vehicle bv - LEFT JOIN anrui_buscenter.bus_sales_order bo ON bo.sid = bv.salesOrderSid - LEFT JOIN anrui_base.base_vehicle bbv ON bbv.sid = bv.linkSid - LEFT JOIN anrui_buscenter.bus_sales_order_model bm - ON bm.salesOrderSid = bv.salesOrderSid - LEFT JOIN anrui_portal.sys_organization so ON so.sid = bo.useOrgSid - LEFT JOIN (SELECT furd.busVinSid - FROM anrui_fin.fin_uncollected_receivables_detailed furd - WHERE furd.receivablesName = '融资放款' - group by furd.busVinSid) ss ON ss.busVinSid = bv.sid - LEFT JOIN ( - SELECT (ls.loanTotal - lo.loanDownPay) AS money, - ls.salesOrderSid - FROM anrui_riskcenter.loan_solutions ls - LEFT JOIN anrui_riskcenter.loan_solutions_otherpolicy lo ON lo.solutionsSid = ls.sid - ) sss ON sss.salesOrderSid = bv.salesOrderSid - WHERE bo.payTypeKey = 2 - and ss.busVinSid is null - AND bbv.vehicleState = '0002' - and bo.nodeState = '已办结' - GROUP BY bv.sid, - bo.useOrgSid, - bm.modelSid, - bm.modelConfigSid - having money > 0 - ) a - GROUP BY a.contractNo, - a.useOrgSid, - a.vehMConfigSid, - a.vehModelSid) b - group by b.useOrgSid, b.vehModelSid, b.vehMConfigSid) as s on - r.useOrgSid = s.useOrgSid AND r.vehModelSid = s.vehModelSid AND r.vehMConfigSid = s.vehMConfigSid - SET r.`loan_not_count`=s.scount - WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - --- 金融未放款金额-- 截止当日贷款业务已出库且融资放款未认款的台数融资放款金额之和++未生成融资放款的总贷款金额。 - - update daily_report r inner join ( - select SUM(b.scount) AS scount, - b.useOrgSid, - b.NAME, - b.contractNo, - b.vehMConfigSid, - b.vehModelSid - from (SELECT SUM(a.scount) AS scount, - a.useOrgSid, - a.NAME, - a.contractNo, - a.vehMConfigSid, - a.vehModelSid - FROM (SELECT bv.id, - bo.useOrgSid, - bm.modelConfigSid AS vehMConfigSid, - bm.modelSid AS vehModelSid, - so.NAME, - SUM(s.reveivableMoney), - SUM(s.subscriptionMoney), - bo.contractNo, - ( - SUM(s.reveivableMoney) - SUM(s.subscriptionMoney)) AS scount - FROM anrui_buscenter.bus_sales_order_vehicle bv - LEFT JOIN anrui_buscenter.bus_sales_order bo ON bo.sid = bv.salesOrderSid - LEFT JOIN anrui_base.base_vehicle bbv ON bbv.sid = bv.linkSid - LEFT JOIN anrui_buscenter.bus_sales_order_model bm ON bm.salesOrderSid = bv.salesOrderSid - LEFT JOIN ( - SELECT fd.reveivableMoney, - fd.busVinSid, - IFNULL(SUM(fs.subscriptionMoney), 0) AS subscriptionMoney - FROM anrui_fin.fin_uncollected_receivables_detailed fd - LEFT JOIN anrui_fin.fin_selected_receivables_detailed fs ON fs.receivablesSid = fd.sid - WHERE fd.kxState = '01' - AND fs.auditState = 3 - AND fd.receivablesName = '融资放款' - GROUP BY fd.sid - UNION ALL - SELECT fd.reveivableMoney, - fd.busVinSid, - 0 AS subscriptionMoney - FROM anrui_fin.fin_uncollected_receivables_detailed fd - WHERE fd.kxState = '01' - AND fd.receivablesName = '融资放款' - AND fd.sid NOT IN (SELECT fs.`receivablesSid` - FROM anrui_fin.fin_selected_receivables_detailed fs - WHERE fs.`auditState` = 3 - AND fs.`receivablesName` = '融资放款') - GROUP BY fd.sid - ) s ON s.busVinSid = bv.sid - LEFT JOIN anrui_portal.sys_organization so ON so.sid = bo.useOrgSid - WHERE bo.payTypeKey = 2 - - AND bbv.vehicleState = '0002' - GROUP BY bv.sid, bo.useOrgSid, bm.modelSid, bm.modelConfigSid - HAVING SUM(s.reveivableMoney) > SUM(s.subscriptionMoney)) a - GROUP BY a.contractNo, a.useOrgSid, - a.vehMConfigSid, - a.vehModelSid - union all - - SELECT sum(a.money) AS scount, - a.useOrgSid, - a.NAME, - a.contractNo, - a.vehMConfigSid, - a.vehModelSid - FROM ( - SELECT bo.useOrgSid, - bm.modelConfigSid AS vehMConfigSid, - bm.modelSid AS vehModelSid, - so.NAME, - bo.contractNo, - IFNULL(sss.money, '0') as money - FROM anrui_buscenter.bus_sales_order_vehicle bv - LEFT JOIN anrui_buscenter.bus_sales_order bo ON bo.sid = bv.salesOrderSid - LEFT JOIN anrui_base.base_vehicle bbv ON bbv.sid = bv.linkSid - LEFT JOIN anrui_buscenter.bus_sales_order_model bm - ON bm.salesOrderSid = bv.salesOrderSid - LEFT JOIN anrui_portal.sys_organization so ON so.sid = bo.useOrgSid - LEFT JOIN (SELECT furd.busVinSid - FROM anrui_fin.fin_uncollected_receivables_detailed furd - WHERE furd.receivablesName = '融资放款' - group by furd.busVinSid) ss ON ss.busVinSid = bv.sid - LEFT JOIN ( - SELECT (ls.loanTotal - lo.loanDownPay) AS money, - ls.salesOrderSid - FROM anrui_riskcenter.loan_solutions ls - LEFT JOIN anrui_riskcenter.loan_solutions_otherpolicy lo ON lo.solutionsSid = ls.sid - ) sss ON sss.salesOrderSid = bv.salesOrderSid - WHERE bo.payTypeKey = 2 - and ss.busVinSid is null - AND bbv.vehicleState = '0002' - and bo.nodeState = '已办结' - GROUP BY bv.sid, - bo.useOrgSid, - bm.modelSid, - bm.modelConfigSid - having money > 0 - ) a - GROUP BY a.contractNo, - a.useOrgSid, - a.vehMConfigSid, - a.vehModelSid) b - group by b.useOrgSid, b.vehModelSid, b.vehMConfigSid) as s on - r.useOrgSid = s.useOrgSid AND r.vehModelSid = s.vehModelSid AND r.vehMConfigSid = s.vehMConfigSid - SET r.`loan_not_amount`=ROUND(s.scount / 10000, 2) - WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - --- 金融未放款数量已信审终审--- 截止当日贷款业务已信审终审且融资放款未认款的台数。 - update daily_report r inner join ( - select sum(b.scount) AS scount, - b.useOrgSid, - b.NAME, - b.contractNo, - b.vehMConfigSid, - b.vehModelSid - from (SELECT count(a.id) AS scount, - a.useOrgSid, - a.NAME, - a.contractNo, - a.vehMConfigSid, - a.vehModelSid - FROM ( - SELECT bv.id, - bo.useOrgSid, - bm.modelConfigSid AS vehMConfigSid, - bm.modelSid AS vehModelSid, - so.NAME, - SUM(s.reveivableMoney), - SUM(s.subscriptionMoney), - bo.contractNo - FROM anrui_buscenter.bus_sales_order_vehicle bv - LEFT JOIN anrui_buscenter.bus_sales_order bo ON bo.sid = bv.salesOrderSid - LEFT JOIN anrui_base.base_vehicle bbv ON bbv.sid = bv.linkSid - LEFT JOIN anrui_buscenter.bus_sales_order_model bm - ON bm.salesOrderSid = bv.salesOrderSid - LEFT JOIN ( - SELECT fd.reveivableMoney, - fd.busVinSid, - IFNULL(SUM(fs.subscriptionMoney), 0) AS subscriptionMoney - FROM anrui_fin.fin_uncollected_receivables_detailed fd - LEFT JOIN anrui_fin.fin_selected_receivables_detailed fs - ON fs.receivablesSid = fd.sid - WHERE fd.kxState = '01' - AND fs.auditState = 3 - AND fd.receivablesName = '融资放款' - GROUP BY fd.sid - UNION ALL - SELECT fd.reveivableMoney, - fd.busVinSid, - 0 AS subscriptionMoney - FROM anrui_fin.fin_uncollected_receivables_detailed fd - WHERE fd.kxState = '01' - AND fd.receivablesName = '融资放款' - AND fd.sid NOT IN (SELECT fs.`receivablesSid` - FROM anrui_fin.fin_selected_receivables_detailed fs - WHERE fs.`auditState` = 3 - AND fs.`receivablesName` = '融资放款') - GROUP BY fd.sid - ) s ON s.busVinSid = bv.sid - LEFT JOIN anrui_portal.sys_organization so ON so.sid = bo.useOrgSid - LEFT JOIN anrui_riskcenter.loan_capital_credit_result lr - ON lr.loanContractSid = bv.loanContractSid - WHERE bo.payTypeKey = 2 - AND lr.capCarefulResult = '通过' - GROUP BY bv.sid, - bo.useOrgSid, - bm.modelSid, - bm.modelConfigSid - HAVING SUM(s.reveivableMoney) > SUM(s.subscriptionMoney)) a - GROUP BY a.contractNo, a.useOrgSid, - a.vehMConfigSid, - a.vehModelSid - union all - SELECT count(a.id) AS scount, - a.useOrgSid, - a.NAME, - a.contractNo, - a.vehMConfigSid, - a.vehModelSid - FROM ( - SELECT bv.id, - bo.useOrgSid, - bm.modelConfigSid AS vehMConfigSid, - bm.modelSid AS vehModelSid, - so.NAME, - SUM(s.reveivableMoney), - SUM(s.subscriptionMoney), - bo.contractNo - FROM anrui_buscenter.bus_sales_order_vehicle bv - LEFT JOIN anrui_buscenter.bus_sales_order bo ON bo.sid = bv.salesOrderSid - LEFT JOIN anrui_base.base_vehicle bbv ON bbv.sid = bv.linkSid - LEFT JOIN anrui_buscenter.bus_sales_order_model bm - ON bm.salesOrderSid = bv.salesOrderSid - LEFT JOIN ( - SELECT fd.reveivableMoney, - fd.busVinSid, - IFNULL(SUM(fs.subscriptionMoney), 0) AS subscriptionMoney - FROM anrui_fin.fin_uncollected_receivables_detailed fd - LEFT JOIN anrui_fin.fin_selected_receivables_detailed fs - ON fs.receivablesSid = fd.sid - WHERE fd.kxState = '01' - AND fs.auditState = 3 - AND fd.receivablesName = '融资放款' - GROUP BY fd.sid - UNION ALL - SELECT fd.reveivableMoney, - fd.busVinSid, - 0 AS subscriptionMoney - FROM anrui_fin.fin_uncollected_receivables_detailed fd - WHERE fd.kxState = '01' - AND fd.receivablesName = '融资放款' - AND fd.sid NOT IN (SELECT fs.`receivablesSid` - FROM anrui_fin.fin_selected_receivables_detailed fs - WHERE fs.`auditState` = 3 - AND fs.`receivablesName` = '融资放款') - GROUP BY fd.sid - ) s ON s.busVinSid = bv.sid - LEFT JOIN anrui_portal.sys_organization so ON so.sid = bo.useOrgSid - LEFT JOIN anrui_riskcenter.loan_noguarantee_credit_review lr - ON lr.borrowerSid = bv.borrowerSid - WHERE bo.payTypeKey = 2 - AND lr.creditReview = '通过' - GROUP BY bv.sid, - bo.useOrgSid, - bm.modelSid, - bm.modelConfigSid - HAVING SUM(s.reveivableMoney) > SUM(s.subscriptionMoney)) a - GROUP BY a.contractNo, a.useOrgSid, - a.vehMConfigSid, - a.vehModelSid) b - group by b.useOrgSid, b.vehModelSid, b.vehMConfigSid) as s on - r.useOrgSid = s.useOrgSid AND r.vehModelSid = s.vehModelSid AND r.vehMConfigSid = s.vehMConfigSid - SET r.`loan_not_counts`=s.scount - WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - --- 金融未放款金额已信审终审-- 截止当日贷款业务已信审终审且融资放款未认款的台数融资放款金额之和 - - update daily_report r inner join ( - SELECT SUM(b.scount) AS scount, - b.useOrgSid, - b.NAME, - b.contractNo, - b.vehMConfigSid, - b.vehModelSid - from ( - SELECT SUM(a.scount) AS scount, - a.useOrgSid, - a.NAME, - a.contractNo, - a.vehMConfigSid, - a.vehModelSid - FROM ( - SELECT bv.id, - bo.useOrgSid, - bm.modelConfigSid AS vehMConfigSid, - bm.modelSid AS vehModelSid, - so.NAME, - SUM(s.reveivableMoney), - SUM(s.subscriptionMoney), - bo.contractNo, - ( - SUM(s.reveivableMoney) - SUM(s.subscriptionMoney)) AS scount - FROM anrui_buscenter.bus_sales_order_vehicle bv - LEFT JOIN anrui_buscenter.bus_sales_order bo ON bo.sid = bv.salesOrderSid - LEFT JOIN anrui_base.base_vehicle bbv ON bbv.sid = bv.linkSid - LEFT JOIN anrui_buscenter.bus_sales_order_model bm - ON bm.salesOrderSid = bv.salesOrderSid - LEFT JOIN ( - SELECT fd.reveivableMoney, - fd.busVinSid, - IFNULL(SUM(fs.subscriptionMoney), 0) AS subscriptionMoney - FROM anrui_fin.fin_uncollected_receivables_detailed fd - LEFT JOIN anrui_fin.fin_selected_receivables_detailed fs - ON fs.receivablesSid = fd.sid - WHERE fd.kxState = '01' - AND fs.auditState = 3 - AND fd.receivablesName = '融资放款' - GROUP BY fd.sid - UNION ALL - SELECT fd.reveivableMoney, - fd.busVinSid, - 0 AS subscriptionMoney - FROM anrui_fin.fin_uncollected_receivables_detailed fd - WHERE fd.kxState = '01' - AND fd.receivablesName = '融资放款' - AND fd.sid NOT IN (SELECT fs.`receivablesSid` - FROM anrui_fin.fin_selected_receivables_detailed fs - WHERE fs.`auditState` = 3 - AND fs.`receivablesName` = '融资放款') - GROUP BY fd.sid - ) s ON s.busVinSid = bv.sid - LEFT JOIN anrui_portal.sys_organization so ON so.sid = bo.useOrgSid - LEFT JOIN anrui_riskcenter.loan_capital_credit_result lr - ON lr.loanContractSid = bv.loanContractSid - WHERE bo.payTypeKey = 2 - AND lr.capCarefulResult = '通过' - GROUP BY bv.sid, - bo.useOrgSid, - bm.modelSid, - bm.modelConfigSid - HAVING SUM(s.reveivableMoney) > SUM(s.subscriptionMoney)) a - GROUP BY a.contractNo, a.useOrgSid, - a.vehMConfigSid, - a.vehModelSid - UNION ALL - SELECT SUM(a.scount) AS scount, - a.useOrgSid, - a.NAME, - a.contractNo, - a.vehMConfigSid, - a.vehModelSid - FROM ( - SELECT bv.id, - bo.useOrgSid, - bm.modelConfigSid AS vehMConfigSid, - bm.modelSid AS vehModelSid, - so.NAME, - SUM(s.reveivableMoney), - SUM(s.subscriptionMoney), - bo.contractNo, - ( - SUM(s.reveivableMoney) - SUM(s.subscriptionMoney)) AS scount - FROM anrui_buscenter.bus_sales_order_vehicle bv - LEFT JOIN anrui_buscenter.bus_sales_order bo ON bo.sid = bv.salesOrderSid - LEFT JOIN anrui_base.base_vehicle bbv ON bbv.sid = bv.linkSid - LEFT JOIN anrui_buscenter.bus_sales_order_model bm - ON bm.salesOrderSid = bv.salesOrderSid - LEFT JOIN ( - SELECT fd.reveivableMoney, - fd.busVinSid, - IFNULL(SUM(fs.subscriptionMoney), 0) AS subscriptionMoney - FROM anrui_fin.fin_uncollected_receivables_detailed fd - LEFT JOIN anrui_fin.fin_selected_receivables_detailed fs - ON fs.receivablesSid = fd.sid - WHERE fd.kxState = '01' - AND fs.auditState = 3 - AND fd.receivablesName = '融资放款' - GROUP BY fd.sid - UNION ALL - SELECT fd.reveivableMoney, - fd.busVinSid, - 0 AS subscriptionMoney - FROM anrui_fin.fin_uncollected_receivables_detailed fd - WHERE fd.kxState = '01' - AND fd.receivablesName = '融资放款' - AND fd.sid NOT IN (SELECT fs.`receivablesSid` - FROM anrui_fin.fin_selected_receivables_detailed fs - WHERE fs.`auditState` = 3 - AND fs.`receivablesName` = '融资放款') - GROUP BY fd.sid - ) s ON s.busVinSid = bv.sid - LEFT JOIN anrui_portal.sys_organization so ON so.sid = bo.useOrgSid - LEFT JOIN anrui_riskcenter.loan_noguarantee_credit_review lr - ON lr.borrowerSid = bv.borrowerSid - WHERE bo.payTypeKey = 2 - AND lr.creditReview = '通过' - GROUP BY bv.sid, - bo.useOrgSid, - bm.modelSid, - bm.modelConfigSid - HAVING SUM(s.reveivableMoney) > SUM(s.subscriptionMoney)) a - GROUP BY a.contractNo, a.useOrgSid, - a.vehMConfigSid, - a.vehModelSid) b - group by b.useOrgSid, b.vehModelSid - , b.vehMConfigSid) as s on - r.useOrgSid = s.useOrgSid AND r.vehModelSid = s.vehModelSid AND r.vehMConfigSid = s.vehMConfigSid - SET r.`loan_not_amounts`=ROUND(s.scount / 10000, 2) - WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - - --- 全年厂家开票数 - UPDATE daily_report r INNER JOIN (SELECT COUNT(id) AS scount, `useOrgSid`, `modelSid`, `modelConfigSid` - FROM anrui_base.`base_vehicle` - WHERE manDate like concat('%', DATE_FORMAT(CURDATE(), '%Y'), '%') - GROUP BY `useOrgSid`, `modelSid`, `modelConfigSid`) AS s ON - r.useOrgSid = s.useOrgSid AND r.vehModelSid = s.modelSid AND r.vehMConfigSid = s.modelConfigSid - SET r.`manufacturer_invoicing_year`=s.scount - WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - - -END \ No newline at end of file diff --git a/doc/databases/统计报表更新.sql b/doc/databases/统计报表更新.sql index 62334033f7..92be4cc8a0 100644 --- a/doc/databases/统计报表更新.sql +++ b/doc/databases/统计报表更新.sql @@ -413,7 +413,8 @@ BEGIN left join anrui_buscenter.bus_sales_order_price bp on bp.salesOrderSid = bo.sid left join anrui_scm.scm_purchase_channel scc on scc.saleOrderSid = bo.sid WHERE bo.nodeState = '已办结' - and bo.type = 3 and scc.state = 2 + and bo.type = 3 + and scc.state = 2 GROUP BY bo.useOrgSid, bm.modelSid, bm.modelConfigSid, @@ -428,14 +429,17 @@ BEGIN LEFT JOIN anrui_buscenter.bus_sales_order_model bm ON bm.salesOrderSid = bo.sid left join anrui_buscenter.bus_sales_order_price bp on bp.salesOrderSid = bo.sid left join anrui_scm.scm_purchase_channel scc on scc.saleOrderSid = bo.sid - left join anrui_buscenter.bus_sales_order_vehicle bvvv on bvvv.salesOrderSid = bo.sid + left join anrui_buscenter.bus_sales_order_vehicle bvvv + on bvvv.salesOrderSid = bo.sid WHERE bo.nodeState = '已办结' - and bo.type = 3 and scc.state is null and length(bvvv.linkSid)>0 + and bo.type = 3 + and scc.state is null + and length(bvvv.linkSid) > 0 GROUP BY bo.useOrgSid, bm.modelSid, bm.modelConfigSid, bo.contractNo - ) d + ) d group by d.useOrgSid, d.modelSid, d.modelConfigSid, @@ -456,7 +460,8 @@ BEGIN left join anrui_base.base_vehicle_out bvo on bv.sid = bvo.vinSid left join anrui_base.base_vehicle_out_apply bvoa on bvoa.sid = bvo.mainSid where bv.salesDate like concat('%', CURDATE(), '%') - and bvoa.saleTypeKey = '001' and bvo.isDelete = 0 + and bvoa.saleTypeKey = '001' + and bvo.isDelete = 0 and (bvo.materialTypeKey = '001' or bvo.materialTypeValue is null or length(bvo.materialTypeValue) = 0) group by bv.useOrgSid, bv.modelSid, bv.modelConfigSid) ss @@ -474,7 +479,8 @@ BEGIN left join anrui_base.base_vehicle_out bvo on bv.sid = bvo.vinSid left join anrui_base.base_vehicle_out_apply bvoa on bvoa.sid = bvo.mainSid where bv.salesDate like concat('%', CURDATE(), '%') - and bvoa.saleTypeKey = '002' and bvo.isDelete = 0 + and bvoa.saleTypeKey = '002' + and bvo.isDelete = 0 and (bvo.materialTypeKey = '001' or bvo.materialTypeValue is null or length(bvo.materialTypeValue) = 0) group by bv.useOrgSid, bv.modelSid, bv.modelConfigSid) ss @@ -499,7 +505,8 @@ BEGIN left join anrui_base.base_vehicle_out bvo on bv.sid = bvo.vinSid left join anrui_base.base_vehicle_out_apply bvoa on bvoa.sid = bvo.mainSid where bv.salesDate like concat('%', DATE_FORMAT(CURDATE(), '%Y-%m'), '%') - and bvoa.saleTypeKey = '001' and bvo.isDelete = 0 + and bvoa.saleTypeKey = '001' + and bvo.isDelete = 0 and (bvo.materialTypeKey = '001' or bvo.materialTypeValue is null or length(bvo.materialTypeValue) = 0) group by bv.useOrgSid, bv.modelSid, bv.modelConfigSid) ss @@ -517,7 +524,8 @@ BEGIN left join anrui_base.base_vehicle_out bvo on bv.sid = bvo.vinSid left join anrui_base.base_vehicle_out_apply bvoa on bvoa.sid = bvo.mainSid where bv.salesDate like concat('%', DATE_FORMAT(CURDATE(), '%Y-%m'), '%') - and bvoa.saleTypeKey = '002' and bvo.isDelete = 0 + and bvoa.saleTypeKey = '002' + and bvo.isDelete = 0 and (bvo.materialTypeKey = '001' or bvo.materialTypeValue is null or length(bvo.materialTypeValue) = 0) group by bv.useOrgSid, bv.modelSid, bv.modelConfigSid) ss @@ -542,7 +550,8 @@ BEGIN left join anrui_base.base_vehicle_out bvo on bv.sid = bvo.vinSid left join anrui_base.base_vehicle_out_apply bvoa on bvoa.sid = bvo.mainSid where bv.salesDate like concat('%', DATE_FORMAT(CURDATE(), '%Y'), '%') - and bvoa.saleTypeKey = '001' and bvo.isDelete = 0 + and bvoa.saleTypeKey = '001' + and bvo.isDelete = 0 and (bvo.materialTypeKey = '001' or bvo.materialTypeValue is null or length(bvo.materialTypeValue) = 0) group by bv.useOrgSid, bv.modelSid, bv.modelConfigSid) ss @@ -560,7 +569,8 @@ BEGIN left join anrui_base.base_vehicle_out bvo on bv.sid = bvo.vinSid left join anrui_base.base_vehicle_out_apply bvoa on bvoa.sid = bvo.mainSid where bv.salesDate like concat('%', DATE_FORMAT(CURDATE(), '%Y'), '%') - and bvoa.saleTypeKey = '002' and bvo.isDelete = 0 + and bvoa.saleTypeKey = '002' + and bvo.isDelete = 0 and (bvo.materialTypeKey = '001' or bvo.materialTypeValue is null or length(bvo.materialTypeValue) = 0) group by bv.useOrgSid, bv.modelSid, bv.modelConfigSid) ss @@ -1060,236 +1070,7 @@ BEGIN set arrears_carry_veh_amount = ROUND(s.scount / 10000, 2) where DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - --- 金融未放款数量--- 截止当日贷款业务已出库且融资放款未认款的台数。 - update daily_report r inner join ( - SELECT sum(b.scount) AS scount, - b.useOrgSid, - b.NAME, - b.contractNo, - b.vehMConfigSid, - b.vehModelSid - from (SELECT count(a.id) AS scount, - a.useOrgSid, - a.NAME, - a.contractNo, - a.vehMConfigSid, - a.vehModelSid - FROM ( - SELECT bv.id, - bo.useOrgSid, - bm.modelConfigSid AS vehMConfigSid, - bm.modelSid AS vehModelSid, - so.NAME, - SUM(s.reveivableMoney), - SUM(s.subscriptionMoney), - bo.contractNo - FROM anrui_buscenter.bus_sales_order_vehicle bv - LEFT JOIN anrui_buscenter.bus_sales_order bo ON bo.sid = bv.salesOrderSid - LEFT JOIN anrui_base.base_vehicle bbv ON bbv.sid = bv.linkSid - LEFT JOIN anrui_buscenter.bus_sales_order_model bm - ON bm.salesOrderSid = bv.salesOrderSid - LEFT JOIN ( - SELECT fd.reveivableMoney, - fd.busVinSid, - IFNULL(SUM(fs.subscriptionMoney), 0) AS subscriptionMoney - FROM anrui_fin.fin_uncollected_receivables_detailed fd - LEFT JOIN anrui_fin.fin_selected_receivables_detailed fs - ON fs.receivablesSid = fd.sid - WHERE fd.kxState = '01' - AND fs.auditState = 3 - AND fd.receivablesName = '融资放款' - GROUP BY fd.sid - UNION ALL - SELECT fd.reveivableMoney, - fd.busVinSid, - 0 AS subscriptionMoney - FROM anrui_fin.fin_uncollected_receivables_detailed fd - WHERE fd.kxState = '01' - AND fd.receivablesName = '融资放款' - AND fd.sid NOT IN (SELECT fs.`receivablesSid` - FROM anrui_fin.fin_selected_receivables_detailed fs - WHERE fs.`auditState` = 3 - AND fs.`receivablesName` = '融资放款') - GROUP BY fd.sid - ) s ON s.busVinSid = bv.sid - LEFT JOIN anrui_portal.sys_organization so ON so.sid = bo.useOrgSid - WHERE bo.payTypeKey = 2 - AND bbv.vehicleState = '0002' - GROUP BY bv.sid, - bo.useOrgSid, - bm.modelSid, - bm.modelConfigSid - HAVING SUM(s.reveivableMoney) > SUM(s.subscriptionMoney)) a - GROUP BY a.contractNo, - a.useOrgSid, - a.vehMConfigSid, - a.vehModelSid - union all - SELECT count(a.id) AS scount, - a.useOrgSid, - a.NAME, - a.contractNo, - a.vehMConfigSid, - a.vehModelSid - FROM ( - SELECT bv.id, - bo.useOrgSid, - bm.modelConfigSid AS vehMConfigSid, - bm.modelSid AS vehModelSid, - so.NAME, - bo.contractNo, - IFNULL(sss.money, '0') as money - FROM anrui_buscenter.bus_sales_order_vehicle bv - LEFT JOIN anrui_buscenter.bus_sales_order bo ON bo.sid = bv.salesOrderSid - LEFT JOIN anrui_base.base_vehicle bbv ON bbv.sid = bv.linkSid - LEFT JOIN anrui_buscenter.bus_sales_order_model bm - ON bm.salesOrderSid = bv.salesOrderSid - LEFT JOIN anrui_portal.sys_organization so ON so.sid = bo.useOrgSid - LEFT JOIN (SELECT furd.busVinSid - FROM anrui_fin.fin_uncollected_receivables_detailed furd - WHERE furd.receivablesName = '融资放款' - group by furd.busVinSid) ss ON ss.busVinSid = bv.sid - LEFT JOIN ( - SELECT (ls.loanTotal - lo.loanDownPay) AS money, - ls.salesOrderSid - FROM anrui_riskcenter.loan_solutions ls - LEFT JOIN anrui_riskcenter.loan_solutions_otherpolicy lo ON lo.solutionsSid = ls.sid - ) sss ON sss.salesOrderSid = bv.salesOrderSid - WHERE bo.payTypeKey = 2 - and ss.busVinSid is null - AND bbv.vehicleState = '0002' - and bo.nodeState = '已办结' - and bo.contractNo NOT LIKE '%2023%' - GROUP BY bv.sid, - bo.useOrgSid, - bm.modelSid, - bm.modelConfigSid - having money > 0 - ) a - GROUP BY a.contractNo, - a.useOrgSid, - a.vehMConfigSid, - a.vehModelSid) b - group by b.useOrgSid, b.vehModelSid, b.vehMConfigSid) as s on - r.useOrgSid = s.useOrgSid AND r.vehModelSid = s.vehModelSid AND r.vehMConfigSid = s.vehMConfigSid - SET r.`loan_not_count`=s.scount - WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - --- 金融未放款金额-- 截止当日贷款业务已出库且融资放款未认款的台数融资放款金额之和 - - update daily_report r inner join ( - select SUM(b.scount) AS scount, - b.useOrgSid, - b.NAME, - b.contractNo, - b.vehMConfigSid, - b.vehModelSid - from (SELECT SUM(a.scount) AS scount, - a.useOrgSid, - a.NAME, - a.contractNo, - a.vehMConfigSid, - a.vehModelSid - FROM (SELECT bv.id, - bo.useOrgSid, - bm.modelConfigSid AS vehMConfigSid, - bm.modelSid AS vehModelSid, - so.NAME, - SUM(s.reveivableMoney), - SUM(s.subscriptionMoney), - bo.contractNo, - ( - SUM(s.reveivableMoney) - SUM(s.subscriptionMoney)) AS scount - FROM anrui_buscenter.bus_sales_order_vehicle bv - LEFT JOIN anrui_buscenter.bus_sales_order bo ON bo.sid = bv.salesOrderSid - LEFT JOIN anrui_base.base_vehicle bbv ON bbv.sid = bv.linkSid - LEFT JOIN anrui_buscenter.bus_sales_order_model bm ON bm.salesOrderSid = bv.salesOrderSid - LEFT JOIN ( - SELECT fd.reveivableMoney, - fd.busVinSid, - IFNULL(SUM(fs.subscriptionMoney), 0) AS subscriptionMoney - FROM anrui_fin.fin_uncollected_receivables_detailed fd - LEFT JOIN anrui_fin.fin_selected_receivables_detailed fs ON fs.receivablesSid = fd.sid - WHERE fd.kxState = '01' - AND fs.auditState = 3 - AND fd.receivablesName = '融资放款' - GROUP BY fd.sid - UNION ALL - SELECT fd.reveivableMoney, - fd.busVinSid, - 0 AS subscriptionMoney - FROM anrui_fin.fin_uncollected_receivables_detailed fd - WHERE fd.kxState = '01' - AND fd.receivablesName = '融资放款' - AND fd.sid NOT IN (SELECT fs.`receivablesSid` - FROM anrui_fin.fin_selected_receivables_detailed fs - WHERE fs.`auditState` = 3 - AND fs.`receivablesName` = '融资放款') - GROUP BY fd.sid - ) s ON s.busVinSid = bv.sid - LEFT JOIN anrui_portal.sys_organization so ON so.sid = bo.useOrgSid - WHERE bo.payTypeKey = 2 - - AND bbv.vehicleState = '0002' - GROUP BY bv.sid, bo.useOrgSid, bm.modelSid, bm.modelConfigSid - HAVING SUM(s.reveivableMoney) > SUM(s.subscriptionMoney)) a - GROUP BY a.contractNo, a.useOrgSid, - a.vehMConfigSid, - a.vehModelSid - union all - - SELECT sum(a.money) AS scount, - a.useOrgSid, - a.NAME, - a.contractNo, - a.vehMConfigSid, - a.vehModelSid - FROM ( - SELECT bo.useOrgSid, - bm.modelConfigSid AS vehMConfigSid, - bm.modelSid AS vehModelSid, - so.NAME, - bo.contractNo, - IFNULL(sss.money, '0') as money - FROM anrui_buscenter.bus_sales_order_vehicle bv - LEFT JOIN anrui_buscenter.bus_sales_order bo ON bo.sid = bv.salesOrderSid - LEFT JOIN anrui_base.base_vehicle bbv ON bbv.sid = bv.linkSid - LEFT JOIN anrui_buscenter.bus_sales_order_model bm - ON bm.salesOrderSid = bv.salesOrderSid - LEFT JOIN anrui_portal.sys_organization so ON so.sid = bo.useOrgSid - LEFT JOIN (SELECT furd.busVinSid - FROM anrui_fin.fin_uncollected_receivables_detailed furd - WHERE furd.receivablesName = '融资放款' - group by furd.busVinSid) ss ON ss.busVinSid = bv.sid - LEFT JOIN ( - SELECT (ls.loanTotal - lo.loanDownPay) AS money, - ls.salesOrderSid - FROM anrui_riskcenter.loan_solutions ls - LEFT JOIN anrui_riskcenter.loan_solutions_otherpolicy lo ON lo.solutionsSid = ls.sid - ) sss ON sss.salesOrderSid = bv.salesOrderSid - WHERE bo.payTypeKey = 2 - and ss.busVinSid is null - AND bbv.vehicleState = '0002' - and bo.nodeState = '已办结' - and bo.contractNo NOT LIKE '%2023%' - GROUP BY bv.sid, - bo.useOrgSid, - bm.modelSid, - bm.modelConfigSid - having money > 0 - ) a - GROUP BY a.contractNo, - a.useOrgSid, - a.vehMConfigSid, - a.vehModelSid) b - group by b.useOrgSid, b.vehModelSid, b.vehMConfigSid) as s on - r.useOrgSid = s.useOrgSid AND r.vehModelSid = s.vehModelSid AND r.vehMConfigSid = s.vehMConfigSid - SET r.`loan_not_amount`=ROUND(s.scount / 10000, 2) - WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); - - --- 全年厂家开票数 + -- 全年厂家开票数 UPDATE daily_report r INNER JOIN (SELECT COUNT(id) AS scount, `useOrgSid`, `modelSid`, `modelConfigSid` FROM anrui_base.`base_vehicle` WHERE manDate like concat('%', DATE_FORMAT(CURDATE(), '%Y'), '%') @@ -1298,8 +1079,238 @@ BEGIN SET r.`manufacturer_invoicing_year`=s.scount WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); + + -- 金融未放款数量--- 截止当日贷款业务已出库且融资放款未认款的台数。 + /* update daily_report r inner join ( + SELECT sum(b.scount) AS scount, + b.useOrgSid, + b.NAME, + b.contractNo, + b.vehMConfigSid, + b.vehModelSid + from (SELECT count(a.id) AS scount, + a.useOrgSid, + a.NAME, + a.contractNo, + a.vehMConfigSid, + a.vehModelSid + FROM ( + SELECT bv.id, + bo.useOrgSid, + bm.modelConfigSid AS vehMConfigSid, + bm.modelSid AS vehModelSid, + so.NAME, + SUM(s.reveivableMoney), + SUM(s.subscriptionMoney), + bo.contractNo + FROM anrui_buscenter.bus_sales_order_vehicle bv + LEFT JOIN anrui_buscenter.bus_sales_order bo ON bo.sid = bv.salesOrderSid + LEFT JOIN anrui_base.base_vehicle bbv ON bbv.sid = bv.linkSid + LEFT JOIN anrui_buscenter.bus_sales_order_model bm + ON bm.salesOrderSid = bv.salesOrderSid + LEFT JOIN ( + SELECT fd.reveivableMoney, + fd.busVinSid, + IFNULL(SUM(fs.subscriptionMoney), 0) AS subscriptionMoney + FROM anrui_fin.fin_uncollected_receivables_detailed fd + LEFT JOIN anrui_fin.fin_selected_receivables_detailed fs + ON fs.receivablesSid = fd.sid + WHERE fd.kxState = '01' + AND fs.auditState = 3 + AND fd.receivablesName = '融资放款' + GROUP BY fd.sid + UNION ALL + SELECT fd.reveivableMoney, + fd.busVinSid, + 0 AS subscriptionMoney + FROM anrui_fin.fin_uncollected_receivables_detailed fd + WHERE fd.kxState = '01' + AND fd.receivablesName = '融资放款' + AND fd.sid NOT IN (SELECT fs.`receivablesSid` + FROM anrui_fin.fin_selected_receivables_detailed fs + WHERE fs.`auditState` = 3 + AND fs.`receivablesName` = '融资放款') + GROUP BY fd.sid + ) s ON s.busVinSid = bv.sid + LEFT JOIN anrui_portal.sys_organization so ON so.sid = bo.useOrgSid + WHERE bo.payTypeKey = 2 + AND bbv.vehicleState = '0002' + GROUP BY bv.sid, + bo.useOrgSid, + bm.modelSid, + bm.modelConfigSid + HAVING SUM(s.reveivableMoney) > SUM(s.subscriptionMoney)) a + GROUP BY a.contractNo, + a.useOrgSid, + a.vehMConfigSid, + a.vehModelSid + union all + SELECT count(a.id) AS scount, + a.useOrgSid, + a.NAME, + a.contractNo, + a.vehMConfigSid, + a.vehModelSid + FROM ( + SELECT bv.id, + bo.useOrgSid, + bm.modelConfigSid AS vehMConfigSid, + bm.modelSid AS vehModelSid, + so.NAME, + bo.contractNo, + IFNULL(sss.money, '0') as money + FROM anrui_buscenter.bus_sales_order_vehicle bv + LEFT JOIN anrui_buscenter.bus_sales_order bo ON bo.sid = bv.salesOrderSid + LEFT JOIN anrui_base.base_vehicle bbv ON bbv.sid = bv.linkSid + LEFT JOIN anrui_buscenter.bus_sales_order_model bm + ON bm.salesOrderSid = bv.salesOrderSid + LEFT JOIN anrui_portal.sys_organization so ON so.sid = bo.useOrgSid + LEFT JOIN (SELECT furd.busVinSid + FROM anrui_fin.fin_uncollected_receivables_detailed furd + WHERE furd.receivablesName = '融资放款' + group by furd.busVinSid) ss ON ss.busVinSid = bv.sid + LEFT JOIN ( + SELECT (ls.loanTotal - lo.loanDownPay) AS money, + ls.salesOrderSid + FROM anrui_riskcenter.loan_solutions ls + LEFT JOIN anrui_riskcenter.loan_solutions_otherpolicy lo ON lo.solutionsSid = ls.sid + ) sss ON sss.salesOrderSid = bv.salesOrderSid + WHERE bo.payTypeKey = 2 + and ss.busVinSid is null + AND bbv.vehicleState = '0002' + and bo.nodeState = '已办结' + and bo.contractNo NOT LIKE '%2023%' + GROUP BY bv.sid, + bo.useOrgSid, + bm.modelSid, + bm.modelConfigSid + having money > 0 + ) a + GROUP BY a.contractNo, + a.useOrgSid, + a.vehMConfigSid, + a.vehModelSid) b + group by b.useOrgSid, b.vehModelSid, b.vehMConfigSid) as s on + r.useOrgSid = s.useOrgSid AND r.vehModelSid = s.vehModelSid AND r.vehMConfigSid = s.vehMConfigSid + SET r.`loan_not_count`=s.scount + WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE();*/ + + +-- 金融未放款金额-- 截止当日贷款业务已出库且融资放款未认款的台数融资放款金额之和 + + /* update daily_report r inner join ( + select SUM(b.scount) AS scount, + b.useOrgSid, + b.NAME, + b.contractNo, + b.vehMConfigSid, + b.vehModelSid + from (SELECT SUM(a.scount) AS scount, + a.useOrgSid, + a.NAME, + a.contractNo, + a.vehMConfigSid, + a.vehModelSid + FROM (SELECT bv.id, + bo.useOrgSid, + bm.modelConfigSid AS vehMConfigSid, + bm.modelSid AS vehModelSid, + so.NAME, + SUM(s.reveivableMoney), + SUM(s.subscriptionMoney), + bo.contractNo, + ( + SUM(s.reveivableMoney) - SUM(s.subscriptionMoney)) AS scount + FROM anrui_buscenter.bus_sales_order_vehicle bv + LEFT JOIN anrui_buscenter.bus_sales_order bo ON bo.sid = bv.salesOrderSid + LEFT JOIN anrui_base.base_vehicle bbv ON bbv.sid = bv.linkSid + LEFT JOIN anrui_buscenter.bus_sales_order_model bm ON bm.salesOrderSid = bv.salesOrderSid + LEFT JOIN ( + SELECT fd.reveivableMoney, + fd.busVinSid, + IFNULL(SUM(fs.subscriptionMoney), 0) AS subscriptionMoney + FROM anrui_fin.fin_uncollected_receivables_detailed fd + LEFT JOIN anrui_fin.fin_selected_receivables_detailed fs ON fs.receivablesSid = fd.sid + WHERE fd.kxState = '01' + AND fs.auditState = 3 + AND fd.receivablesName = '融资放款' + GROUP BY fd.sid + UNION ALL + SELECT fd.reveivableMoney, + fd.busVinSid, + 0 AS subscriptionMoney + FROM anrui_fin.fin_uncollected_receivables_detailed fd + WHERE fd.kxState = '01' + AND fd.receivablesName = '融资放款' + AND fd.sid NOT IN (SELECT fs.`receivablesSid` + FROM anrui_fin.fin_selected_receivables_detailed fs + WHERE fs.`auditState` = 3 + AND fs.`receivablesName` = '融资放款') + GROUP BY fd.sid + ) s ON s.busVinSid = bv.sid + LEFT JOIN anrui_portal.sys_organization so ON so.sid = bo.useOrgSid + WHERE bo.payTypeKey = 2 + + AND bbv.vehicleState = '0002' + GROUP BY bv.sid, bo.useOrgSid, bm.modelSid, bm.modelConfigSid + HAVING SUM(s.reveivableMoney) > SUM(s.subscriptionMoney)) a + GROUP BY a.contractNo, a.useOrgSid, + a.vehMConfigSid, + a.vehModelSid + union all + + SELECT sum(a.money) AS scount, + a.useOrgSid, + a.NAME, + a.contractNo, + a.vehMConfigSid, + a.vehModelSid + FROM ( + SELECT bo.useOrgSid, + bm.modelConfigSid AS vehMConfigSid, + bm.modelSid AS vehModelSid, + so.NAME, + bo.contractNo, + IFNULL(sss.money, '0') as money + FROM anrui_buscenter.bus_sales_order_vehicle bv + LEFT JOIN anrui_buscenter.bus_sales_order bo ON bo.sid = bv.salesOrderSid + LEFT JOIN anrui_base.base_vehicle bbv ON bbv.sid = bv.linkSid + LEFT JOIN anrui_buscenter.bus_sales_order_model bm + ON bm.salesOrderSid = bv.salesOrderSid + LEFT JOIN anrui_portal.sys_organization so ON so.sid = bo.useOrgSid + LEFT JOIN (SELECT furd.busVinSid + FROM anrui_fin.fin_uncollected_receivables_detailed furd + WHERE furd.receivablesName = '融资放款' + group by furd.busVinSid) ss ON ss.busVinSid = bv.sid + LEFT JOIN ( + SELECT (ls.loanTotal - lo.loanDownPay) AS money, + ls.salesOrderSid + FROM anrui_riskcenter.loan_solutions ls + LEFT JOIN anrui_riskcenter.loan_solutions_otherpolicy lo ON lo.solutionsSid = ls.sid + ) sss ON sss.salesOrderSid = bv.salesOrderSid + WHERE bo.payTypeKey = 2 + and ss.busVinSid is null + AND bbv.vehicleState = '0002' + and bo.nodeState = '已办结' + and bo.contractNo NOT LIKE '%2023%' + GROUP BY bv.sid, + bo.useOrgSid, + bm.modelSid, + bm.modelConfigSid + having money > 0 + ) a + GROUP BY a.contractNo, + a.useOrgSid, + a.vehMConfigSid, + a.vehModelSid) b + group by b.useOrgSid, b.vehModelSid, b.vehMConfigSid) as s on + r.useOrgSid = s.useOrgSid AND r.vehModelSid = s.vehModelSid AND r.vehMConfigSid = s.vehMConfigSid + SET r.`loan_not_amount`=ROUND(s.scount / 10000, 2) + WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); + */ + -- 金融未放款数量已信审终审--- 截止当日贷款业务已信审终审且融资放款未认款的台数。 - update daily_report r inner join ( + /*update daily_report r inner join ( select sum(b.scount) AS scount, b.useOrgSid, b.NAME, @@ -1424,10 +1435,538 @@ BEGIN group by b.useOrgSid, b.vehModelSid, b.vehMConfigSid) as s on r.useOrgSid = s.useOrgSid AND r.vehModelSid = s.vehModelSid AND r.vehMConfigSid = s.vehMConfigSid SET r.`loan_not_counts`=s.scount - WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); + WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE();*/ -- 金融未放款金额已信审终审-- 截止当日贷款业务已信审终审且融资放款未认款的台数融资放款金额之和 + /* update daily_report r inner join ( + SELECT SUM(b.scount) AS scount, + b.useOrgSid, + b.NAME, + b.contractNo, + b.vehMConfigSid, + b.vehModelSid + from ( + SELECT SUM(a.scount) AS scount, + a.useOrgSid, + a.NAME, + a.contractNo, + a.vehMConfigSid, + a.vehModelSid + FROM ( + SELECT bv.id, + bo.useOrgSid, + bm.modelConfigSid AS vehMConfigSid, + bm.modelSid AS vehModelSid, + so.NAME, + SUM(s.reveivableMoney), + SUM(s.subscriptionMoney), + bo.contractNo, + ( + SUM(s.reveivableMoney) - SUM(s.subscriptionMoney)) AS scount + FROM anrui_buscenter.bus_sales_order_vehicle bv + LEFT JOIN anrui_buscenter.bus_sales_order bo ON bo.sid = bv.salesOrderSid + LEFT JOIN anrui_base.base_vehicle bbv ON bbv.sid = bv.linkSid + LEFT JOIN anrui_buscenter.bus_sales_order_model bm + ON bm.salesOrderSid = bv.salesOrderSid + LEFT JOIN ( + SELECT fd.reveivableMoney, + fd.busVinSid, + IFNULL(SUM(fs.subscriptionMoney), 0) AS subscriptionMoney + FROM anrui_fin.fin_uncollected_receivables_detailed fd + LEFT JOIN anrui_fin.fin_selected_receivables_detailed fs + ON fs.receivablesSid = fd.sid + WHERE fd.kxState = '01' + AND fs.auditState = 3 + AND fd.receivablesName = '融资放款' + GROUP BY fd.sid + UNION ALL + SELECT fd.reveivableMoney, + fd.busVinSid, + 0 AS subscriptionMoney + FROM anrui_fin.fin_uncollected_receivables_detailed fd + WHERE fd.kxState = '01' + AND fd.receivablesName = '融资放款' + AND fd.sid NOT IN (SELECT fs.`receivablesSid` + FROM anrui_fin.fin_selected_receivables_detailed fs + WHERE fs.`auditState` = 3 + AND fs.`receivablesName` = '融资放款') + GROUP BY fd.sid + ) s ON s.busVinSid = bv.sid + LEFT JOIN anrui_portal.sys_organization so ON so.sid = bo.useOrgSid + LEFT JOIN anrui_riskcenter.loan_capital_credit_result lr + ON lr.loanContractSid = bv.loanContractSid + WHERE bo.payTypeKey = 2 + AND lr.capCarefulResult = '通过' + GROUP BY bv.sid, + bo.useOrgSid, + bm.modelSid, + bm.modelConfigSid + HAVING SUM(s.reveivableMoney) > SUM(s.subscriptionMoney)) a + GROUP BY a.contractNo, a.useOrgSid, + a.vehMConfigSid, + a.vehModelSid + UNION ALL + SELECT SUM(a.scount) AS scount, + a.useOrgSid, + a.NAME, + a.contractNo, + a.vehMConfigSid, + a.vehModelSid + FROM ( + SELECT bv.id, + bo.useOrgSid, + bm.modelConfigSid AS vehMConfigSid, + bm.modelSid AS vehModelSid, + so.NAME, + SUM(s.reveivableMoney), + SUM(s.subscriptionMoney), + bo.contractNo, + ( + SUM(s.reveivableMoney) - SUM(s.subscriptionMoney)) AS scount + FROM anrui_buscenter.bus_sales_order_vehicle bv + LEFT JOIN anrui_buscenter.bus_sales_order bo ON bo.sid = bv.salesOrderSid + LEFT JOIN anrui_base.base_vehicle bbv ON bbv.sid = bv.linkSid + LEFT JOIN anrui_buscenter.bus_sales_order_model bm + ON bm.salesOrderSid = bv.salesOrderSid + LEFT JOIN ( + SELECT fd.reveivableMoney, + fd.busVinSid, + IFNULL(SUM(fs.subscriptionMoney), 0) AS subscriptionMoney + FROM anrui_fin.fin_uncollected_receivables_detailed fd + LEFT JOIN anrui_fin.fin_selected_receivables_detailed fs + ON fs.receivablesSid = fd.sid + WHERE fd.kxState = '01' + AND fs.auditState = 3 + AND fd.receivablesName = '融资放款' + GROUP BY fd.sid + UNION ALL + SELECT fd.reveivableMoney, + fd.busVinSid, + 0 AS subscriptionMoney + FROM anrui_fin.fin_uncollected_receivables_detailed fd + WHERE fd.kxState = '01' + AND fd.receivablesName = '融资放款' + AND fd.sid NOT IN (SELECT fs.`receivablesSid` + FROM anrui_fin.fin_selected_receivables_detailed fs + WHERE fs.`auditState` = 3 + AND fs.`receivablesName` = '融资放款') + GROUP BY fd.sid + ) s ON s.busVinSid = bv.sid + LEFT JOIN anrui_portal.sys_organization so ON so.sid = bo.useOrgSid + LEFT JOIN anrui_riskcenter.loan_noguarantee_credit_review lr + ON lr.borrowerSid = bv.borrowerSid + WHERE bo.payTypeKey = 2 + AND lr.creditReview = '通过' + GROUP BY bv.sid, + bo.useOrgSid, + bm.modelSid, + bm.modelConfigSid + HAVING SUM(s.reveivableMoney) > SUM(s.subscriptionMoney)) a + GROUP BY a.contractNo, a.useOrgSid, + a.vehMConfigSid, + a.vehModelSid) b + group by b.useOrgSid, b.vehModelSid + , b.vehMConfigSid) as s on + r.useOrgSid = s.useOrgSid AND r.vehModelSid = s.vehModelSid AND r.vehMConfigSid = s.vehMConfigSid + SET r.`loan_not_amounts`=ROUND(s.scount / 10000, 2) + WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE();*/ + + +-- 金融未放款 统计规则调整:包含担保和非担保。 金融未放款(已开票):截止当日贷款业务已开票的,融资放款应收未认款金额+未生成融资放款的总贷款金额。 +-- 台数: + + update daily_report r inner join ( + SELECT sum(b.scount) AS scount, + b.useOrgSid, + b.NAME, + b.contractNo, + b.vehMConfigSid, + b.vehModelSid + FROM ( + SELECT count(a.id) AS scount, + a.useOrgSid, + a.NAME, + a.contractNo, + a.vehMConfigSid, + a.vehModelSid + FROM ( + SELECT bv.id, + bo.useOrgSid, + bm.modelConfigSid AS vehMConfigSid, + bm.modelSid AS vehModelSid, + so.NAME, + SUM(s.reveivableMoney), + SUM(s.subscriptionMoney), + bo.contractNo + FROM anrui_buscenter.bus_sales_order_vehicle bv + LEFT JOIN anrui_buscenter.bus_sales_order bo ON bo.sid = bv.salesOrderSid + LEFT JOIN anrui_base.base_vehicle bbv ON bbv.sid = bv.linkSid + LEFT JOIN anrui_buscenter.bus_sales_order_model bm + ON bm.salesOrderSid = bv.salesOrderSid + left join anrui_fin.fin_vehicle_invoice ffi + on ffi.vehicleSid = bbv.sid and ffi.contractNo = bo.contractNo + LEFT JOIN ( + SELECT fd.reveivableMoney, + fd.busVinSid, + IFNULL(SUM(fs.subscriptionMoney), 0) AS subscriptionMoney + FROM anrui_fin.fin_uncollected_receivables_detailed fd + LEFT JOIN anrui_fin.fin_selected_receivables_detailed fs + ON fs.receivablesSid = fd.sid + WHERE fd.kxState = '01' + AND fs.auditState = 3 + AND fd.receivablesName = '融资放款' + GROUP BY fd.sid + UNION ALL + SELECT fd.reveivableMoney, + fd.busVinSid, + 0 AS subscriptionMoney + FROM anrui_fin.fin_uncollected_receivables_detailed fd + WHERE fd.kxState = '01' + AND fd.receivablesName = '融资放款' + AND fd.sid NOT IN (SELECT fs.`receivablesSid` + FROM anrui_fin.fin_selected_receivables_detailed fs + WHERE fs.`auditState` = 3 + AND fs.`receivablesName` = '融资放款') + GROUP BY fd.sid + ) s ON s.busVinSid = bv.sid + LEFT JOIN anrui_portal.sys_organization so ON so.sid = bo.useOrgSid + WHERE bo.payTypeKey = 2 + AND ffi.billingStateKey = '002' + GROUP BY bv.sid, + bo.useOrgSid, + bm.modelSid, + bm.modelConfigSid + HAVING SUM(s.reveivableMoney) > SUM(s.subscriptionMoney)) a + GROUP BY a.contractNo, + a.useOrgSid, + a.vehMConfigSid, + a.vehModelSid + UNION ALL + SELECT count(a.id) AS scount, + a.useOrgSid, + a.NAME, + a.contractNo, + a.vehMConfigSid, + a.vehModelSid + FROM ( + SELECT bv.id, + bo.useOrgSid, + bm.modelConfigSid AS vehMConfigSid, + bm.modelSid AS vehModelSid, + so.NAME, + bo.contractNo, + IFNULL(sss.money, '0') AS money + FROM anrui_buscenter.bus_sales_order_vehicle bv + LEFT JOIN anrui_buscenter.bus_sales_order bo ON bo.sid = bv.salesOrderSid + LEFT JOIN anrui_base.base_vehicle bbv ON bbv.sid = bv.linkSid + LEFT JOIN anrui_buscenter.bus_sales_order_model bm + ON bm.salesOrderSid = bv.salesOrderSid + LEFT JOIN anrui_portal.sys_organization so ON so.sid = bo.useOrgSid + LEFT JOIN (SELECT furd.busVinSid + FROM anrui_fin.fin_uncollected_receivables_detailed furd + WHERE furd.receivablesName = '融资放款' + GROUP BY furd.busVinSid) ss ON ss.busVinSid = bv.sid + LEFT JOIN ( + SELECT (ls.loanTotal - lo.loanDownPay) AS money, + ls.salesOrderSid + FROM anrui_riskcenter.loan_solutions ls + LEFT JOIN anrui_riskcenter.loan_solutions_otherpolicy lo + ON lo.solutionsSid = ls.sid + ) sss ON sss.salesOrderSid = bv.salesOrderSid + left join anrui_fin.fin_vehicle_invoice ffi + on ffi.vehicleSid = bbv.sid and ffi.contractNo = bo.contractNo + WHERE bo.payTypeKey = 2 + AND ss.busVinSid IS NULL + AND ffi.billingStateKey = '002' + AND bo.nodeState = '已办结' + AND bo.contractNo NOT LIKE '%2023%' + GROUP BY bv.sid, + bo.useOrgSid, + bm.modelSid, + bm.modelConfigSid + HAVING money > 0 + ) a + GROUP BY a.contractNo, + a.useOrgSid, + a.vehMConfigSid, + a.vehModelSid + ) b + GROUP BY b.useOrgSid, + b.vehModelSid, + b.vehMConfigSid) as s on + r.useOrgSid = s.useOrgSid AND r.vehModelSid = s.vehModelSid AND r.vehMConfigSid = s.vehMConfigSid + SET r.`loan_not_count`=s.scount + WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); + +-- 金融未放款已开票金额 + update daily_report r inner join ( + SELECT SUM(b.scount) AS scount, + b.useOrgSid, + b.NAME, + b.contractNo, + b.vehMConfigSid, + b.vehModelSid + FROM ( + SELECT SUM(a.scount) AS scount, + a.useOrgSid, + a.NAME, + a.contractNo, + a.vehMConfigSid, + a.vehModelSid + FROM ( + SELECT bv.id, + bo.useOrgSid, + bm.modelConfigSid AS vehMConfigSid, + bm.modelSid AS vehModelSid, + so.NAME, + SUM(s.reveivableMoney), + SUM(s.subscriptionMoney), + bo.contractNo, + ( + SUM(s.reveivableMoney) - SUM(s.subscriptionMoney)) AS scount + FROM anrui_buscenter.bus_sales_order_vehicle bv + LEFT JOIN anrui_buscenter.bus_sales_order bo ON bo.sid = bv.salesOrderSid + LEFT JOIN anrui_base.base_vehicle bbv ON bbv.sid = bv.linkSid + LEFT JOIN anrui_buscenter.bus_sales_order_model bm + ON bm.salesOrderSid = bv.salesOrderSid + LEFT JOIN ( + SELECT fd.reveivableMoney, + fd.busVinSid, + IFNULL(SUM(fs.subscriptionMoney), 0) AS subscriptionMoney + FROM anrui_fin.fin_uncollected_receivables_detailed fd + LEFT JOIN anrui_fin.fin_selected_receivables_detailed fs + ON fs.receivablesSid = fd.sid + WHERE fd.kxState = '01' + AND fs.auditState = 3 + AND fd.receivablesName = '融资放款' + GROUP BY fd.sid + UNION ALL + SELECT fd.reveivableMoney, + fd.busVinSid, + 0 AS subscriptionMoney + FROM anrui_fin.fin_uncollected_receivables_detailed fd + WHERE fd.kxState = '01' + AND fd.receivablesName = '融资放款' + AND fd.sid NOT IN (SELECT fs.`receivablesSid` + FROM anrui_fin.fin_selected_receivables_detailed fs + WHERE fs.`auditState` = 3 + AND fs.`receivablesName` = '融资放款') + GROUP BY fd.sid + ) s ON s.busVinSid = bv.sid + LEFT JOIN anrui_portal.sys_organization so ON so.sid = bo.useOrgSid + left join anrui_fin.fin_vehicle_invoice ffi + on ffi.vehicleSid = bbv.sid and ffi.contractNo = bo.contractNo + WHERE bo.payTypeKey = 2 + AND ffi.billingStateKey = '002' + GROUP BY bv.sid, + bo.useOrgSid, + bm.modelSid, + bm.modelConfigSid + HAVING SUM(s.reveivableMoney) > SUM(s.subscriptionMoney)) a + GROUP BY a.contractNo, + a.useOrgSid, + a.vehMConfigSid, + a.vehModelSid + UNION ALL + SELECT sum(a.money) AS scount, + a.useOrgSid, + a.NAME, + a.contractNo, + a.vehMConfigSid, + a.vehModelSid + FROM ( + SELECT bo.useOrgSid, + bm.modelConfigSid AS vehMConfigSid, + bm.modelSid AS vehModelSid, + so.NAME, + bo.contractNo, + IFNULL(sss.money, '0') AS money + FROM anrui_buscenter.bus_sales_order_vehicle bv + LEFT JOIN anrui_buscenter.bus_sales_order bo ON bo.sid = bv.salesOrderSid + LEFT JOIN anrui_base.base_vehicle bbv ON bbv.sid = bv.linkSid + LEFT JOIN anrui_buscenter.bus_sales_order_model bm + ON bm.salesOrderSid = bv.salesOrderSid + LEFT JOIN anrui_portal.sys_organization so ON so.sid = bo.useOrgSid + LEFT JOIN (SELECT furd.busVinSid + FROM anrui_fin.fin_uncollected_receivables_detailed furd + WHERE furd.receivablesName = '融资放款' + GROUP BY furd.busVinSid) ss ON ss.busVinSid = bv.sid + LEFT JOIN ( + SELECT (ls.loanTotal - lo.loanDownPay) AS money, + ls.salesOrderSid + FROM anrui_riskcenter.loan_solutions ls + LEFT JOIN anrui_riskcenter.loan_solutions_otherpolicy lo + ON lo.solutionsSid = ls.sid + ) sss ON sss.salesOrderSid = bv.salesOrderSid + left join anrui_fin.fin_vehicle_invoice ffi + on ffi.vehicleSid = bbv.sid and ffi.contractNo = bo.contractNo + WHERE bo.payTypeKey = 2 + AND ss.busVinSid IS NULL + AND ffi.billingStateKey = '002' + AND bo.nodeState = '已办结' + AND bo.contractNo NOT LIKE '%2023%' + GROUP BY bv.sid, + bo.useOrgSid, + bm.modelSid, + bm.modelConfigSid + HAVING money > 0 + ) a + GROUP BY a.contractNo, + a.useOrgSid, + a.vehMConfigSid, + a.vehModelSid + ) b + GROUP BY b.useOrgSid, + b.vehModelSid, + b.vehMConfigSid) as s on + r.useOrgSid = s.useOrgSid AND r.vehModelSid = s.vehModelSid AND r.vehMConfigSid = s.vehMConfigSid + SET r.`loan_not_amount`=ROUND(s.scount / 10000, 2) + WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); + + + -- 金融未放款(已终审):截止当日贷款业务的已开票且信审终审已通过,统计融资放款未认款金额。 +-- 已终审台数 + update daily_report r inner join ( + SELECT sum(b.scount) AS scount, + b.useOrgSid, + b.NAME, + b.contractNo, + b.vehMConfigSid, + b.vehModelSid + FROM ( + SELECT count(a.id) AS scount, + a.useOrgSid, + a.NAME, + a.contractNo, + a.vehMConfigSid, + a.vehModelSid + FROM ( + SELECT bv.id, + bo.useOrgSid, + bm.modelConfigSid AS vehMConfigSid, + bm.modelSid AS vehModelSid, + so.NAME, + SUM(s.reveivableMoney), + SUM(s.subscriptionMoney), + bo.contractNo + FROM anrui_buscenter.bus_sales_order_vehicle bv + LEFT JOIN anrui_buscenter.bus_sales_order bo ON bo.sid = bv.salesOrderSid + LEFT JOIN anrui_base.base_vehicle bbv ON bbv.sid = bv.linkSid + LEFT JOIN anrui_buscenter.bus_sales_order_model bm + ON bm.salesOrderSid = bv.salesOrderSid + LEFT JOIN ( + SELECT fd.reveivableMoney, + fd.busVinSid, + IFNULL(SUM(fs.subscriptionMoney), 0) AS subscriptionMoney + FROM anrui_fin.fin_uncollected_receivables_detailed fd + LEFT JOIN anrui_fin.fin_selected_receivables_detailed fs + ON fs.receivablesSid = fd.sid + WHERE fd.kxState = '01' + AND fs.auditState = 3 + AND fd.receivablesName = '融资放款' + GROUP BY fd.sid + UNION ALL + SELECT fd.reveivableMoney, + fd.busVinSid, + 0 AS subscriptionMoney + FROM anrui_fin.fin_uncollected_receivables_detailed fd + WHERE fd.kxState = '01' + AND fd.receivablesName = '融资放款' + AND fd.sid NOT IN (SELECT fs.`receivablesSid` + FROM anrui_fin.fin_selected_receivables_detailed fs + WHERE fs.`auditState` = 3 + AND fs.`receivablesName` = '融资放款') + GROUP BY fd.sid + ) s ON s.busVinSid = bv.sid + LEFT JOIN anrui_portal.sys_organization so ON so.sid = bo.useOrgSid + LEFT JOIN anrui_riskcenter.loan_capital_credit_result lr + ON lr.loanContractSid = bv.loanContractSid + LEFT JOIN anrui_fin.fin_vehicle_invoice ffi ON ffi.vehicleSid = bbv.sid + AND ffi.contractNo = bo.contractNo + WHERE bo.payTypeKey = 2 + AND lr.capCarefulResult = '通过' + AND ffi.billingStateKey = '002' + GROUP BY bv.sid, + bo.useOrgSid, + bm.modelSid, + bm.modelConfigSid + HAVING SUM(s.reveivableMoney) > SUM(s.subscriptionMoney)) a + GROUP BY a.contractNo, + a.useOrgSid, + a.vehMConfigSid, + a.vehModelSid + UNION ALL + SELECT count(a.id) AS scount, + a.useOrgSid, + a.NAME, + a.contractNo, + a.vehMConfigSid, + a.vehModelSid + FROM ( + SELECT bv.id, + bo.useOrgSid, + bm.modelConfigSid AS vehMConfigSid, + bm.modelSid AS vehModelSid, + so.NAME, + SUM(s.reveivableMoney), + SUM(s.subscriptionMoney), + bo.contractNo + FROM anrui_buscenter.bus_sales_order_vehicle bv + LEFT JOIN anrui_buscenter.bus_sales_order bo ON bo.sid = bv.salesOrderSid + LEFT JOIN anrui_base.base_vehicle bbv ON bbv.sid = bv.linkSid + LEFT JOIN anrui_buscenter.bus_sales_order_model bm + ON bm.salesOrderSid = bv.salesOrderSid + LEFT JOIN ( + SELECT fd.reveivableMoney, + fd.busVinSid, + IFNULL(SUM(fs.subscriptionMoney), 0) AS subscriptionMoney + FROM anrui_fin.fin_uncollected_receivables_detailed fd + LEFT JOIN anrui_fin.fin_selected_receivables_detailed fs + ON fs.receivablesSid = fd.sid + WHERE fd.kxState = '01' + AND fs.auditState = 3 + AND fd.receivablesName = '融资放款' + GROUP BY fd.sid + UNION ALL + SELECT fd.reveivableMoney, + fd.busVinSid, + 0 AS subscriptionMoney + FROM anrui_fin.fin_uncollected_receivables_detailed fd + WHERE fd.kxState = '01' + AND fd.receivablesName = '融资放款' + AND fd.sid NOT IN (SELECT fs.`receivablesSid` + FROM anrui_fin.fin_selected_receivables_detailed fs + WHERE fs.`auditState` = 3 + AND fs.`receivablesName` = '融资放款') + GROUP BY fd.sid + ) s ON s.busVinSid = bv.sid + LEFT JOIN anrui_portal.sys_organization so ON so.sid = bo.useOrgSid + LEFT JOIN anrui_riskcenter.loan_noguarantee_credit_review lr + ON lr.borrowerSid = bv.borrowerSid + LEFT JOIN anrui_fin.fin_vehicle_invoice ffi ON ffi.vehicleSid = bbv.sid + AND ffi.contractNo = bo.contractNo + WHERE bo.payTypeKey = 2 + AND lr.creditReview = '通过' + AND ffi.billingStateKey = '002' + GROUP BY bv.sid, + bo.useOrgSid, + bm.modelSid, + bm.modelConfigSid + HAVING SUM(s.reveivableMoney) > SUM(s.subscriptionMoney)) a + GROUP BY a.contractNo, + a.useOrgSid, + a.vehMConfigSid, + a.vehModelSid + ) b + GROUP BY b.useOrgSid, + b.vehModelSid, + b.vehMConfigSid) as s on + r.useOrgSid = s.useOrgSid AND r.vehModelSid = s.vehModelSid AND r.vehMConfigSid = s.vehMConfigSid + SET r.`loan_not_counts`=s.scount + WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); + +-- 已终审已开票金额 update daily_report r inner join ( SELECT SUM(b.scount) AS scount, b.useOrgSid, @@ -1435,7 +1974,7 @@ BEGIN b.contractNo, b.vehMConfigSid, b.vehModelSid - from ( + FROM ( SELECT SUM(a.scount) AS scount, a.useOrgSid, a.NAME, @@ -1485,14 +2024,18 @@ BEGIN LEFT JOIN anrui_portal.sys_organization so ON so.sid = bo.useOrgSid LEFT JOIN anrui_riskcenter.loan_capital_credit_result lr ON lr.loanContractSid = bv.loanContractSid + LEFT JOIN anrui_fin.fin_vehicle_invoice ffi ON ffi.vehicleSid = bbv.sid + AND ffi.contractNo = bo.contractNo WHERE bo.payTypeKey = 2 AND lr.capCarefulResult = '通过' + AND ffi.billingStateKey = '002' GROUP BY bv.sid, bo.useOrgSid, bm.modelSid, bm.modelConfigSid HAVING SUM(s.reveivableMoney) > SUM(s.subscriptionMoney)) a - GROUP BY a.contractNo, a.useOrgSid, + GROUP BY a.contractNo, + a.useOrgSid, a.vehMConfigSid, a.vehModelSid UNION ALL @@ -1545,18 +2088,24 @@ BEGIN LEFT JOIN anrui_portal.sys_organization so ON so.sid = bo.useOrgSid LEFT JOIN anrui_riskcenter.loan_noguarantee_credit_review lr ON lr.borrowerSid = bv.borrowerSid + LEFT JOIN anrui_fin.fin_vehicle_invoice ffi ON ffi.vehicleSid = bbv.sid + AND ffi.contractNo = bo.contractNo WHERE bo.payTypeKey = 2 AND lr.creditReview = '通过' + AND ffi.billingStateKey = '002' GROUP BY bv.sid, bo.useOrgSid, bm.modelSid, bm.modelConfigSid HAVING SUM(s.reveivableMoney) > SUM(s.subscriptionMoney)) a - GROUP BY a.contractNo, a.useOrgSid, + GROUP BY a.contractNo, + a.useOrgSid, a.vehMConfigSid, - a.vehModelSid) b - group by b.useOrgSid, b.vehModelSid - , b.vehMConfigSid) as s on + a.vehModelSid + ) b + GROUP BY b.useOrgSid, + b.vehModelSid, + b.vehMConfigSid) as s on r.useOrgSid = s.useOrgSid AND r.vehModelSid = s.vehModelSid AND r.vehMConfigSid = s.vehMConfigSid SET r.`loan_not_amounts`=ROUND(s.scount / 10000, 2) WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); diff --git a/yxt-as-ui/src/api/operation/repairbill.js b/yxt-as-ui/src/api/operation/repairbill.js index 865d8dd16a..05398b1422 100644 --- a/yxt-as-ui/src/api/operation/repairbill.js +++ b/yxt-as-ui/src/api/operation/repairbill.js @@ -48,5 +48,14 @@ export default { data: data, headers: { 'Content-Type': 'application/json' } }) + }, + // 确认材料费 + settle: function(data) { + return request({ + url: '/as/v1/AsBusrepairBill/settle', + method: 'post', + data: data, + headers: { 'Content-Type': 'application/json' } + }) } } diff --git a/yxt-as-ui/src/api/operation/workslrsettlement.js b/yxt-as-ui/src/api/operation/workslrsettlement.js new file mode 100644 index 0000000000..faf29470b0 --- /dev/null +++ b/yxt-as-ui/src/api/operation/workslrsettlement.js @@ -0,0 +1,112 @@ +import request from '@/utils/request' + +export default { + // 查询分页列表 + listPage: function(params) { + return request({ + url: '/as/v1/asbusrepairbillreversesettle/listPage', + method: 'post', + data: params, + headers: { 'Content-Type': 'application/json' } + }) + }, + saveOrUpdate: function(data) { + return request({ + url: '/as/v1/asbusrepairbillreversesettle/saveReverseSettle', + method: 'post', + data: data, + headers: { 'Content-Type': 'application/json' } + }) + }, + reverseSettleInit: function(data) { + return request({ + url: '/as/v1/asbusrepairbillreversesettle/reverseSettleInit', + method: 'post', + data: data, + headers: { 'Content-Type': 'application/json' } + }) + }, + fetchBySid: function(data) { + return request({ + url: '/as/v1/asbusrepairbillreversesettle/fetchDetailsBySid/' + data, + method: 'get' + }) + }, + deleteBySids: function(data) { + return request({ + url: '/as/v1/asbusrepairbillreversesettle/delBySids', + method: 'DELETE', + data: data, + headers: { 'Content-Type': 'application/json' } + }) + }, + submit: function(data) { + return request({ + url: '/as/v1/asbusrepairbillreversesettle/submit', + method: 'post', + data: data, + headers: { 'Content-Type': 'application/json' } + }) + }, + // 流程审批(同意) + complete: function(params) { + return request({ + url: '/pms/v1/asbusrepairbillreversesettle/complete', + method: 'post', + data: params, + headers: { 'Content-Type': 'application/json' } + }) + }, + // 流程审批(加签) + delegate: function(params) { + return request({ + url: '/pms/v1/asbusrepairbillreversesettle/delegate', + method: 'post', + data: params, + headers: { 'Content-Type': 'application/json' } + }) + }, + // 流程审批(驳回) + reject: function(params) { + return request({ + url: '/pms/v1/asbusrepairbillreversesettle/reject', + method: 'post', + data: params, + headers: { 'Content-Type': 'application/json' } + }) + }, + // 流程审批(终止) + breakProcess: function(params) { + return request({ + url: '/pms/v1/asbusrepairbillreversesettle/breakProcess', + method: 'post', + data: params, + headers: { 'Content-Type': 'application/json' } + }) + }, + // 流程审批(撤回) + revokeProcess: function(params) { + return request({ + url: '/pms/v1/asbusrepairbillreversesettle/revokeProcess', + method: 'post', + data: params, + headers: { 'Content-Type': 'application/json' } + }) + }, + // 审批流程(同意)获取下一环节 + getNextNodesForSubmit: function(data) { + return request({ + url: '/pms/v1/asbusrepairbillreversesettle/getNextNodesForSubmit', + method: 'get', + params: data + }) + }, + // 审批流程(驳回)获取上一环节 + getPreviousNodesForReject: function(data) { + return request({ + url: '/pms/v1/asbusrepairbillreversesettle/getPreviousNodesForReject', + method: 'get', + params: data + }) + } +} diff --git a/yxt-as-ui/src/router/index.js b/yxt-as-ui/src/router/index.js index 8925a2ed36..838b13a27d 100644 --- a/yxt-as-ui/src/router/index.js +++ b/yxt-as-ui/src/router/index.js @@ -91,13 +91,13 @@ export const constantRoutes = [{ component: () => import('@/views/operation/repairbill/repairbillBYLeaveFactory.vue'), name: 'RepairBillBYLeaveFactory', meta: { title: '维修单管理(出厂)', noCache: true } - } - // { - // path: '/workslrsettlement/workslrsettlement', - // component: () => import('@/views/operation/workslrsettlement/workslrsettlement.vue'), - // name: 'WorkSLRSettlement', - // meta: { title: '工单反结算管理', noCache: true } - // }, + }, + { + path: '/workslrsettlement/workslrsettlement', + component: () => import('@/views/operation/workslrsettlement/workslrsettlement.vue'), + name: 'WorkSLRSettlement', + meta: { title: '工单反结算管理', noCache: true } + }, ] }, { @@ -463,6 +463,27 @@ export const constantRoutes = [{ import('@/views/workFlow/caigoutuihuoFlow/purchasereturnYiBan.vue'), name: 'PurchaseReturnYiBan' }, + // 工单反结算管理--编辑 + { + path: '/fanjiesuanFlow/workslrsettlementEdit', + component: () => + import('@/views/workFlow/fanjiesuanFlow/workslrsettlementEdit.vue'), + name: 'WorkSLRSettlementEdit' + }, + // 工单反结算管理--待办 + { + path: '/fanjiesuanFlow/workslrsettlementDaiBan', + component: () => + import('@/views/workFlow/fanjiesuanFlow/workslrsettlementDaiBan.vue'), + name: 'WorkSLRSettlementDaiBan' + }, + // 工单反结算管理--已办 + { + path: '/fanjiesuanFlow/workslrsettlementYiBan', + component: () => + import('@/views/workFlow/fanjiesuanFlow/workslrsettlementYiBan.vue'), + name: 'WorkSLRSettlementYiBan' + }, // 404 page must be placed at the end !!! // { path: '*', redirect: '/404', hidden: true } ] diff --git a/yxt-as-ui/src/views/operation/repairbill/repairbillAdd.vue b/yxt-as-ui/src/views/operation/repairbill/repairbillAdd.vue index 63f3551b87..e4ab7f1c08 100644 --- a/yxt-as-ui/src/views/operation/repairbill/repairbillAdd.vue +++ b/yxt-as-ui/src/views/operation/repairbill/repairbillAdd.vue @@ -6,9 +6,9 @@
选择客户 保存 - 提交 + 提交 结算 - 确认材料费 + 确认材料费 关闭
@@ -442,7 +442,7 @@
付款人编号
- +
应收金额
@@ -470,7 +470,7 @@
其他结算方式
- + @@ -1072,7 +1072,6 @@ export default { }, settleAccounts() { this.settleVisible = true - // this.formobj.payableAmount = this.yfjeTotal }, settleChange(value) { const choose = this.settle_list.filter((item) => item.dictValue === value) @@ -1094,7 +1093,7 @@ export default { this.$refs['form_obj'].validate((valid) => { if (valid) { this.submitdisabled = true - req.settlement(this.formobj).then((res) => { + req.settle(this.formobj).then((res) => { if (res.success) { this.$message({ showClose: true, type: 'success', message: '结算成功' }) this.handleReturn('true') @@ -1221,6 +1220,7 @@ export default { }, showReSettleBtn: true } + this.settleVisible = false this.submitdisabled = false this.$emit('doback') } diff --git a/yxt-as-ui/src/views/operation/repairbill/repairbillBYLeaveFactory.vue b/yxt-as-ui/src/views/operation/repairbill/repairbillBYLeaveFactory.vue index a8985f38b3..d6a35ca46c 100644 --- a/yxt-as-ui/src/views/operation/repairbill/repairbillBYLeaveFactory.vue +++ b/yxt-as-ui/src/views/operation/repairbill/repairbillBYLeaveFactory.vue @@ -146,6 +146,7 @@ import ButtonBar from '@/components/ButtonBar' import req from '@/api/operation/repairbill' import repairbillAdd from './repairbillAdd' import repairbillInfo from './repairbillInfo' +import { typeValues } from '@/api/Common/dictcommons' export default { name: 'RepairBYLeaveFactory', @@ -160,13 +161,6 @@ export default { return { btndisabled: false, btnList: [ - { - type: 'primary', - size: 'small', - icon: 'plus', - btnKey: 'toAdd', - btnLabel: '新增' - }, { type: 'primary', size: 'small', @@ -195,20 +189,7 @@ export default { tableKey: 0, list: [], sids: [], // 用于导出的时候保存已选择的SIDs - billType_list: [ - { - dictKey: '0', - dictValue: '正常工单' - }, - { - dictKey: '1', - dictValue: '保险理赔' - }, - { - dictKey: '2', - dictValue: '协议单位' - } - ], + billType_list: [], state_list: [ { dictKey: '1', @@ -216,7 +197,7 @@ export default { }, { dictKey: '0', - dictValue: '是' + dictValue: '否' } ], FormLoading: false, @@ -224,7 +205,7 @@ export default { // 翻页 listQuery: { current: 1, - size: 10, + size: 5, total: 0, params: { startTime: '', @@ -258,12 +239,20 @@ export default { }, created() { // 初始化变量 + this.init() this.getList() }, mounted() { this.$refs['btnbar'].setButtonList(this.btnList) }, methods: { + init() { + typeValues({ type: 'billType' }).then((res) => { + if (res.success) { + this.billType_list = res.data + } + }) + }, // 搜索条件效果 clicksearchShow() { this.isSearchShow = !this.isSearchShow @@ -276,9 +265,6 @@ export default { btnHandle(btnKey) { console.log('XXXXXXXXXXXXXXX ' + btnKey) switch (btnKey) { - case 'toAdd': - this.toAdd() - break case 'toEdit': this.toEdit() break @@ -333,7 +319,7 @@ export default { handleReset() { this.listQuery = { current: 1, - size: 10, + size: 5, total: 0, params: { startTime: '', @@ -365,13 +351,13 @@ export default { } this.getList() }, - toAdd() { - this.viewState = 2 - this.$refs['divAdd'].showAdd() - }, toEdit() { - this.viewState = 3 - this.$refs['divAdd'].showEdit() + if (this.sids.length === 1) { + this.viewState = 3 + this.$refs['divAdd'].showEdit(this.sids[0]) + } else { + this.$message({ showClose: true, type: 'error', message: '请选择一条记录进行操作' }) + } }, toInfo(row) { this.viewState = 4 diff --git a/yxt-as-ui/src/views/operation/repairbill/repairbillByBeCompleted.vue b/yxt-as-ui/src/views/operation/repairbill/repairbillByBeCompleted.vue index f8f0570c55..f8e9399dc8 100644 --- a/yxt-as-ui/src/views/operation/repairbill/repairbillByBeCompleted.vue +++ b/yxt-as-ui/src/views/operation/repairbill/repairbillByBeCompleted.vue @@ -146,6 +146,7 @@ import ButtonBar from '@/components/ButtonBar' import req from '@/api/operation/repairbill' import repairbillAdd from './repairbillAdd' import repairbillInfo from './repairbillInfo' +import { typeValues } from '@/api/Common/dictcommons' export default { name: 'RepairBillByCompleted', @@ -160,13 +161,6 @@ export default { return { btndisabled: false, btnList: [ - { - type: 'primary', - size: 'small', - icon: 'plus', - btnKey: 'toAdd', - btnLabel: '新增' - }, { type: 'primary', size: 'small', @@ -195,20 +189,7 @@ export default { tableKey: 0, list: [], sids: [], // 用于导出的时候保存已选择的SIDs - billType_list: [ - { - dictKey: '0', - dictValue: '正常工单' - }, - { - dictKey: '1', - dictValue: '保险理赔' - }, - { - dictKey: '2', - dictValue: '协议单位' - } - ], + billType_list: [], state_list: [ { dictKey: '1', @@ -216,7 +197,7 @@ export default { }, { dictKey: '0', - dictValue: '是' + dictValue: '否' } ], FormLoading: false, @@ -224,7 +205,7 @@ export default { // 翻页 listQuery: { current: 1, - size: 10, + size: 5, total: 0, params: { startTime: '', @@ -258,12 +239,20 @@ export default { }, created() { // 初始化变量 + this.init() this.getList() }, mounted() { this.$refs['btnbar'].setButtonList(this.btnList) }, methods: { + init() { + typeValues({ type: 'billType' }).then((res) => { + if (res.success) { + this.billType_list = res.data + } + }) + }, // 搜索条件效果 clicksearchShow() { this.isSearchShow = !this.isSearchShow @@ -276,9 +265,6 @@ export default { btnHandle(btnKey) { console.log('XXXXXXXXXXXXXXX ' + btnKey) switch (btnKey) { - case 'toAdd': - this.toAdd() - break case 'toEdit': this.toEdit() break @@ -333,7 +319,7 @@ export default { handleReset() { this.listQuery = { current: 1, - size: 10, + size: 5, total: 0, params: { startTime: '', @@ -365,13 +351,13 @@ export default { } this.getList() }, - toAdd() { - this.viewState = 2 - this.$refs['divAdd'].showAdd() - }, toEdit() { - this.viewState = 3 - this.$refs['divAdd'].showEdit() + if (this.sids.length === 1) { + this.viewState = 3 + this.$refs['divAdd'].showEdit(this.sids[0]) + } else { + this.$message({ showClose: true, type: 'error', message: '请选择一条记录进行操作' }) + } }, toInfo(row) { this.viewState = 4 diff --git a/yxt-as-ui/src/views/operation/repairbill/repairbillByMaintain.vue b/yxt-as-ui/src/views/operation/repairbill/repairbillByMaintain.vue index 75809fbae7..658d316334 100644 --- a/yxt-as-ui/src/views/operation/repairbill/repairbillByMaintain.vue +++ b/yxt-as-ui/src/views/operation/repairbill/repairbillByMaintain.vue @@ -146,6 +146,7 @@ import ButtonBar from '@/components/ButtonBar' import req from '@/api/operation/repairbill' import repairbillAdd from './repairbillAdd' import repairbillInfo from './repairbillInfo' +import {typeValues} from "@/api/Common/dictcommons"; export default { name: 'RepairBillByMaintain', @@ -160,13 +161,6 @@ export default { return { btndisabled: false, btnList: [ - { - type: 'primary', - size: 'small', - icon: 'plus', - btnKey: 'toAdd', - btnLabel: '新增' - }, { type: 'primary', size: 'small', @@ -195,20 +189,7 @@ export default { tableKey: 0, list: [], sids: [], // 用于导出的时候保存已选择的SIDs - billType_list: [ - { - dictKey: '0', - dictValue: '正常工单' - }, - { - dictKey: '1', - dictValue: '保险理赔' - }, - { - dictKey: '2', - dictValue: '协议单位' - } - ], + billType_list: [], state_list: [ { dictKey: '1', @@ -216,7 +197,7 @@ export default { }, { dictKey: '0', - dictValue: '是' + dictValue: '否' } ], FormLoading: false, @@ -224,7 +205,7 @@ export default { // 翻页 listQuery: { current: 1, - size: 10, + size: 5, total: 0, params: { startTime: '', @@ -258,12 +239,20 @@ export default { }, created() { // 初始化变量 + this.init() this.getList() }, mounted() { this.$refs['btnbar'].setButtonList(this.btnList) }, methods: { + init() { + typeValues({ type: 'billType' }).then((res) => { + if (res.success) { + this.billType_list = res.data + } + }) + }, // 搜索条件效果 clicksearchShow() { this.isSearchShow = !this.isSearchShow @@ -276,9 +265,6 @@ export default { btnHandle(btnKey) { console.log('XXXXXXXXXXXXXXX ' + btnKey) switch (btnKey) { - case 'toAdd': - this.toAdd() - break case 'toEdit': this.toEdit() break @@ -333,7 +319,7 @@ export default { handleReset() { this.listQuery = { current: 1, - size: 10, + size: 5, total: 0, params: { startTime: '', @@ -365,13 +351,13 @@ export default { } this.getList() }, - toAdd() { - this.viewState = 2 - this.$refs['divAdd'].showAdd() - }, toEdit() { - this.viewState = 3 - this.$refs['divAdd'].showEdit() + if (this.sids.length === 1) { + this.viewState = 3 + this.$refs['divAdd'].showEdit(this.sids[0]) + } else { + this.$message({ showClose: true, type: 'error', message: '请选择一条记录进行操作' }) + } }, toInfo(row) { this.viewState = 4 diff --git a/yxt-as-ui/src/views/operation/repairbill/repairbillBySendWork.vue b/yxt-as-ui/src/views/operation/repairbill/repairbillBySendWork.vue index aebb36169c..7496012378 100644 --- a/yxt-as-ui/src/views/operation/repairbill/repairbillBySendWork.vue +++ b/yxt-as-ui/src/views/operation/repairbill/repairbillBySendWork.vue @@ -146,6 +146,7 @@ import ButtonBar from '@/components/ButtonBar' import req from '@/api/operation/repairbill' import repairbillAdd from './repairbillAdd' import repairbillInfo from './repairbillInfo' +import { typeValues } from '@/api/Common/dictcommons' export default { name: 'RepairBillBySendWork', @@ -160,13 +161,6 @@ export default { return { btndisabled: false, btnList: [ - { - type: 'primary', - size: 'small', - icon: 'plus', - btnKey: 'toAdd', - btnLabel: '新增' - }, { type: 'primary', size: 'small', @@ -195,20 +189,7 @@ export default { tableKey: 0, list: [], sids: [], // 用于导出的时候保存已选择的SIDs - billType_list: [ - { - dictKey: '0', - dictValue: '正常工单' - }, - { - dictKey: '1', - dictValue: '保险理赔' - }, - { - dictKey: '2', - dictValue: '协议单位' - } - ], + billType_list: [], state_list: [ { dictKey: '1', @@ -216,7 +197,7 @@ export default { }, { dictKey: '0', - dictValue: '是' + dictValue: '否' } ], FormLoading: false, @@ -224,7 +205,7 @@ export default { // 翻页 listQuery: { current: 1, - size: 10, + size: 5, total: 0, params: { startTime: '', @@ -258,12 +239,20 @@ export default { }, created() { // 初始化变量 + this.init() this.getList() }, mounted() { this.$refs['btnbar'].setButtonList(this.btnList) }, methods: { + init() { + typeValues({ type: 'billType' }).then((res) => { + if (res.success) { + this.billType_list = res.data + } + }) + }, // 搜索条件效果 clicksearchShow() { this.isSearchShow = !this.isSearchShow @@ -276,9 +265,6 @@ export default { btnHandle(btnKey) { console.log('XXXXXXXXXXXXXXX ' + btnKey) switch (btnKey) { - case 'toAdd': - this.toAdd() - break case 'toEdit': this.toEdit() break @@ -333,7 +319,7 @@ export default { handleReset() { this.listQuery = { current: 1, - size: 10, + size: 5, total: 0, params: { startTime: '', @@ -365,13 +351,13 @@ export default { } this.getList() }, - toAdd() { - this.viewState = 2 - this.$refs['divAdd'].showAdd() - }, toEdit() { - this.viewState = 3 - this.$refs['divAdd'].showEdit() + if (this.sids.length === 1) { + this.viewState = 3 + this.$refs['divAdd'].showEdit(this.sids[0]) + } else { + this.$message({ showClose: true, type: 'error', message: '请选择一条记录进行操作' }) + } }, toInfo(row) { this.viewState = 4 diff --git a/yxt-as-ui/src/views/operation/repairbill/repairbillBySettleAccounts.vue b/yxt-as-ui/src/views/operation/repairbill/repairbillBySettleAccounts.vue index ef629b3ab7..34d0cbe26a 100644 --- a/yxt-as-ui/src/views/operation/repairbill/repairbillBySettleAccounts.vue +++ b/yxt-as-ui/src/views/operation/repairbill/repairbillBySettleAccounts.vue @@ -146,6 +146,7 @@ import ButtonBar from '@/components/ButtonBar' import req from '@/api/operation/repairbill' import repairbillAdd from './repairbillAdd' import repairbillInfo from './repairbillInfo' +import { typeValues } from '@/api/Common/dictcommons' export default { name: 'RepairBillBySettleAccounts', @@ -160,13 +161,6 @@ export default { return { btndisabled: false, btnList: [ - { - type: 'primary', - size: 'small', - icon: 'plus', - btnKey: 'toAdd', - btnLabel: '新增' - }, { type: 'primary', size: 'small', @@ -195,20 +189,7 @@ export default { tableKey: 0, list: [], sids: [], // 用于导出的时候保存已选择的SIDs - billType_list: [ - { - dictKey: '0', - dictValue: '正常工单' - }, - { - dictKey: '1', - dictValue: '保险理赔' - }, - { - dictKey: '2', - dictValue: '协议单位' - } - ], + billType_list: [], state_list: [ { dictKey: '1', @@ -216,7 +197,7 @@ export default { }, { dictKey: '0', - dictValue: '是' + dictValue: '否' } ], FormLoading: false, @@ -224,7 +205,7 @@ export default { // 翻页 listQuery: { current: 1, - size: 10, + size: 5, total: 0, params: { startTime: '', @@ -258,12 +239,20 @@ export default { }, created() { // 初始化变量 + this.init() this.getList() }, mounted() { this.$refs['btnbar'].setButtonList(this.btnList) }, methods: { + init() { + typeValues({ type: 'billType' }).then((res) => { + if (res.success) { + this.billType_list = res.data + } + }) + }, // 搜索条件效果 clicksearchShow() { this.isSearchShow = !this.isSearchShow @@ -276,9 +265,6 @@ export default { btnHandle(btnKey) { console.log('XXXXXXXXXXXXXXX ' + btnKey) switch (btnKey) { - case 'toAdd': - this.toAdd() - break case 'toEdit': this.toEdit() break @@ -333,7 +319,7 @@ export default { handleReset() { this.listQuery = { current: 1, - size: 10, + size: 5, total: 0, params: { startTime: '', @@ -365,13 +351,13 @@ export default { } this.getList() }, - toAdd() { - this.viewState = 2 - this.$refs['divAdd'].showAdd() - }, toEdit() { - this.viewState = 3 - this.$refs['divAdd'].showEdit() + if (this.sids.length === 1) { + this.viewState = 3 + this.$refs['divAdd'].showEdit(this.sids[0]) + } else { + this.$message({ showClose: true, type: 'error', message: '请选择一条记录进行操作' }) + } }, toInfo(row) { this.viewState = 4 diff --git a/yxt-as-ui/src/views/operation/repairbill/repairbillInfo.vue b/yxt-as-ui/src/views/operation/repairbill/repairbillInfo.vue index 3fa465871d..1071c960d0 100644 --- a/yxt-as-ui/src/views/operation/repairbill/repairbillInfo.vue +++ b/yxt-as-ui/src/views/operation/repairbill/repairbillInfo.vue @@ -4,6 +4,7 @@
{{ viewTitle }}
+ 反结算 关闭
@@ -271,14 +272,19 @@ + + diff --git a/yxt-as-ui/src/views/operation/workslrsettlement/workslrsettlementAdd.vue b/yxt-as-ui/src/views/operation/workslrsettlement/workslrsettlementAdd.vue new file mode 100644 index 0000000000..4fdc527302 --- /dev/null +++ b/yxt-as-ui/src/views/operation/workslrsettlement/workslrsettlementAdd.vue @@ -0,0 +1,359 @@ + + + + + diff --git a/yxt-as-ui/src/views/operation/workslrsettlement/workslrsettlementInfo.vue b/yxt-as-ui/src/views/operation/workslrsettlement/workslrsettlementInfo.vue new file mode 100644 index 0000000000..61948d2d4d --- /dev/null +++ b/yxt-as-ui/src/views/operation/workslrsettlement/workslrsettlementInfo.vue @@ -0,0 +1,312 @@ + + + + + diff --git a/yxt-as-ui/src/views/workFlow/fanjiesuanFlow/workslrsettlementDaiBan.vue b/yxt-as-ui/src/views/workFlow/fanjiesuanFlow/workslrsettlementDaiBan.vue new file mode 100644 index 0000000000..69f8c8ada7 --- /dev/null +++ b/yxt-as-ui/src/views/workFlow/fanjiesuanFlow/workslrsettlementDaiBan.vue @@ -0,0 +1,556 @@ + + + + + diff --git a/yxt-as-ui/src/views/workFlow/fanjiesuanFlow/workslrsettlementEdit.vue b/yxt-as-ui/src/views/workFlow/fanjiesuanFlow/workslrsettlementEdit.vue new file mode 100644 index 0000000000..bfe14204cf --- /dev/null +++ b/yxt-as-ui/src/views/workFlow/fanjiesuanFlow/workslrsettlementEdit.vue @@ -0,0 +1,335 @@ + + + + + diff --git a/yxt-as-ui/src/views/workFlow/fanjiesuanFlow/workslrsettlementYiBan.vue b/yxt-as-ui/src/views/workFlow/fanjiesuanFlow/workslrsettlementYiBan.vue new file mode 100644 index 0000000000..b941998ae9 --- /dev/null +++ b/yxt-as-ui/src/views/workFlow/fanjiesuanFlow/workslrsettlementYiBan.vue @@ -0,0 +1,348 @@ + + + + + diff --git a/yxt-as/src/main/java/com/yxt/anrui/as/biz/asbusrepairbill/AsBusrepairBillService.java b/yxt-as/src/main/java/com/yxt/anrui/as/biz/asbusrepairbill/AsBusrepairBillService.java index 209b434dc8..c833982fda 100644 --- a/yxt-as/src/main/java/com/yxt/anrui/as/biz/asbusrepairbill/AsBusrepairBillService.java +++ b/yxt-as/src/main/java/com/yxt/anrui/as/biz/asbusrepairbill/AsBusrepairBillService.java @@ -29,6 +29,8 @@ import com.yxt.anrui.as.biz.asbusrepairbillsitem.AsBusrepairBillSitemService; import com.yxt.anrui.as.biz.asbusrepairbillsitemrepairer.AsBusrepairBillSitemRepairerService; import com.yxt.anrui.as.biz.asbusrepairbillvech.AsBusrepairBillVechService; import com.yxt.anrui.as.biz.asbusrepairinventorybilldetail.AsBusrepairInventorybillDetailService; +import com.yxt.anrui.as.feign.fin.finuncollectedreceivablesdetailed.FinUncollectedReceivablesDetailedDto; +import com.yxt.anrui.as.feign.fin.finuncollectedreceivablesdetailed.FinUncollectedReceivablesDetailedFeign; import com.yxt.anrui.as.feign.fms.FmsReceivesettle; import com.yxt.anrui.as.feign.fms.FmsReceivesettleDto; import com.yxt.anrui.as.feign.fms.FmsReceivesettleFeign; @@ -37,6 +39,7 @@ import com.yxt.anrui.as.feign.portal.sysorganization.SysOrganizationFeign; import com.yxt.anrui.as.feign.portal.sysorganization.SysOrganizationVo; import com.yxt.anrui.as.feign.portal.sysstafforg.SysStaffOrgFeign; import com.yxt.anrui.as.feign.portal.sysuser.SysUserFeign; +import com.yxt.anrui.as.feign.portal.sysuser.SysUserVo; import com.yxt.common.base.service.MybatisBaseService; import com.yxt.common.base.utils.PagerUtil; import com.yxt.common.core.query.PagerQuery; @@ -89,7 +92,8 @@ public class AsBusrepairBillService extends MybatisBaseService_/___.' >' "". * + * | | : `- \`.;`\ _ /`;.`/ - ` : | | * + * \ \ `_. \_ __\ /__ _/ .-` / / * + * =====`-.____`.___ \_____/___.-`___.-'===== * + * `=---=' * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * + *********__佛祖保佑__永无BUG__验收通过__钞票多多__********* + *********************************************************/ +package com.yxt.anrui.as.feign.fin.finuncollectedreceivablesdetailed; + + +import com.yxt.common.core.dto.Dto; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * Project: anrui-fin(销售相关)
+ * File: FinUncollectedReceivablesDetailedDto.java
+ * Class: com.yxt.anrui.fin.api.finuncollectedreceivablesdetailed.FinUncollectedReceivablesDetailedDto
+ * Description: 应收未收款项明细表 数据传输对象.
+ * Copyright: Copyright (c) 2011
+ * Company: https://gitee.com/liuzp315
+ * Makedate: 2022-04-12 17:57:01
+ * + * @author liupopo + * @version 1.0 + * @since 1.0 + */ +@ApiModel(value = "应收未收款项明细表 数据传输对象", description = "应收未收款项明细表 数据传输对象") +@Data +public class FinUncollectedReceivablesDetailedDto implements Dto { + + @ApiModelProperty("应收未收款项sid") + private String sid; // 应收未收款项sid + @ApiModelProperty("创建人接口") + private String createByName; // 创建人接口 + @ApiModelProperty("创建人sid") + private String createBySid; // 创建人sid + @ApiModelProperty("合同sid") + private String contractSid; // 合同sid + @ApiModelProperty("合同编号") + private String contractNo; // 合同编号 + @ApiModelProperty("客户sid") + private String customerSid; // 客户sid + @ApiModelProperty("客户名称") + private String customerName; // 客户名称 + @ApiModelProperty("车架号") + private String VIN; // 车架号 + @ApiModelProperty("分公司sid") + private String useOrgSid; // 分公司sid + @ApiModelProperty("联系电话") + private String customerPhone; // 联系电话 + @ApiModelProperty("应收项目名称") + private String receivablesName; // 应收项目名称 + @ApiModelProperty("当前应收金额") + private String currentReceivableMoney; // 当前应收金额 + @ApiModelProperty("应收金额(不变)") + private String reveivableMoney; + private String busVinSid; + @ApiModelProperty("付款方式") + private String payTypeKey; + private String payType; + @ApiModelProperty("应收款项状态") + private String kxState; + @ApiModelProperty("分公司") + private String useOrgName; + @ApiModelProperty("申请人组织路径") + private String orgSidPath; + + @ApiModelProperty("采购系统sid") + private String purchaseSystemSid; + @ApiModelProperty("采购系统名称") + private String purchaseSystemName; + + @ApiModelProperty("销售专员") + private String staffName; + @ApiModelProperty("销售专员用户sid") + private String staffUserSid; + @ApiModelProperty("销售专员部门") + private String staffDeptName; + @ApiModelProperty("销售专员部门sid") + private String staffDeptSid; +} diff --git a/yxt-as/src/main/java/com/yxt/anrui/as/feign/fin/finuncollectedreceivablesdetailed/FinUncollectedReceivablesDetailedFeign.java b/yxt-as/src/main/java/com/yxt/anrui/as/feign/fin/finuncollectedreceivablesdetailed/FinUncollectedReceivablesDetailedFeign.java new file mode 100644 index 0000000000..9779f52c18 --- /dev/null +++ b/yxt-as/src/main/java/com/yxt/anrui/as/feign/fin/finuncollectedreceivablesdetailed/FinUncollectedReceivablesDetailedFeign.java @@ -0,0 +1,64 @@ +/********************************************************* + ********************************************************* + ******************** ******************* + ************* ************ + ******* _oo0oo_ ******* + *** o8888888o *** + * 88" . "88 * + * (| -_- |) * + * 0\ = /0 * + * ___/`---'\___ * + * .' \\| |// '. * + * / \\||| : |||// \ * + * / _||||| -:- |||||- \ * + * | | \\\ - /// | | * + * | \_| ''\---/'' |_/ | * + * \ .-\__ '-' ___/-. / * + * ___'. .' /--.--\ `. .'___ * + * ."" '< `.___\_<|>_/___.' >' "". * + * | | : `- \`.;`\ _ /`;.`/ - ` : | | * + * \ \ `_. \_ __\ /__ _/ .-` / / * + * =====`-.____`.___ \_____/___.-`___.-'===== * + * `=---=' * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * + *********__佛祖保佑__永无BUG__验收通过__钞票多多__********* + *********************************************************/ +package com.yxt.anrui.as.feign.fin.finuncollectedreceivablesdetailed; + +import com.yxt.common.core.query.PagerQuery; +import com.yxt.common.core.result.ResultBean; +import com.yxt.common.core.vo.PagerVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * Project: anrui-fin(应收未收款项明细表)
+ * File: FinUncollectedReceivablesDetailedFeign.java
+ * Class: com.yxt.anrui.fin.api.finuncollectedreceivablesdetailed.FinUncollectedReceivablesDetailedFeign
+ * Description: 应收未收款项明细表.
+ * Copyright: Copyright (c) 2011
+ * Company: https://gitee.com/liuzp315
+ * Makedate: 2022-04-12 17:57:01
+ * + * @author liupopo + * @version 1.0 + * @since 1.0 + */ +@Api(tags = "应收未收款项明细表") +@FeignClient( + contextId = "anrui-fin-FinUncollectedReceivablesDetailed", + name = "anrui-fin", + path = "finuncollectedreceivablesdetailed", + fallback = FinUncollectedReceivablesDetailedFeignFallback.class) +public interface FinUncollectedReceivablesDetailedFeign { + + + @ApiOperation("新增或修改保存") + @PostMapping("/saveOrUpdate") + public ResultBean saveOrUpdate(@RequestBody FinUncollectedReceivablesDetailedDto dto); + +} diff --git a/yxt-as/src/main/java/com/yxt/anrui/as/feign/fin/finuncollectedreceivablesdetailed/FinUncollectedReceivablesDetailedFeignFallback.java b/yxt-as/src/main/java/com/yxt/anrui/as/feign/fin/finuncollectedreceivablesdetailed/FinUncollectedReceivablesDetailedFeignFallback.java new file mode 100644 index 0000000000..5752ebbfeb --- /dev/null +++ b/yxt-as/src/main/java/com/yxt/anrui/as/feign/fin/finuncollectedreceivablesdetailed/FinUncollectedReceivablesDetailedFeignFallback.java @@ -0,0 +1,60 @@ +/********************************************************* + ********************************************************* + ******************** ******************* + ************* ************ + ******* _oo0oo_ ******* + *** o8888888o *** + * 88" . "88 * + * (| -_- |) * + * 0\ = /0 * + * ___/`---'\___ * + * .' \\| |// '. * + * / \\||| : |||// \ * + * / _||||| -:- |||||- \ * + * | | \\\ - /// | | * + * | \_| ''\---/'' |_/ | * + * \ .-\__ '-' ___/-. / * + * ___'. .' /--.--\ `. .'___ * + * ."" '< `.___\_<|>_/___.' >' "". * + * | | : `- \`.;`\ _ /`;.`/ - ` : | | * + * \ \ `_. \_ __\ /__ _/ .-` / / * + * =====`-.____`.___ \_____/___.-`___.-'===== * + * `=---=' * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * + *********__佛祖保佑__永无BUG__验收通过__钞票多多__********* + *********************************************************/ +package com.yxt.anrui.as.feign.fin.finuncollectedreceivablesdetailed; + +import com.yxt.common.core.query.PagerQuery; +import com.yxt.common.core.result.ResultBean; +import com.yxt.common.core.vo.PagerVo; +import org.springframework.stereotype.Component; + +import java.util.List; + +/** + * Project: anrui-fin(销售相关)
+ * File: FinUncollectedReceivablesDetailedFeignFallback.java
+ * Class: com.yxt.anrui.fin.api.finuncollectedreceivablesdetailed.FinUncollectedReceivablesDetailedFeignFallback
+ * Description: 应收未收款项明细表.
+ * Copyright: Copyright (c) 2011
+ * Company: https://gitee.com/liuzp315
+ * Makedate: 2022-04-12 17:57:01
+ * + * @author liupopo + * @version 1.0 + * @since 1.0 + */ +@Component +public class FinUncollectedReceivablesDetailedFeignFallback implements FinUncollectedReceivablesDetailedFeign { + + + + @Override + public ResultBean saveOrUpdate(FinUncollectedReceivablesDetailedDto dto){ + return ResultBean.fireFail().setMsg("接口anrui-fin/finuncollectedreceivablesdetailed/saveOrUpdate无法访问"); + } + + + +} diff --git a/yxt-base-biz/src/main/java/com/yxt/base/apiadmin/base/BaseGoodsSpuRest.java b/yxt-base-biz/src/main/java/com/yxt/base/apiadmin/base/BaseGoodsSpuRest.java index 9cda6da133..f4977b98ee 100644 --- a/yxt-base-biz/src/main/java/com/yxt/base/apiadmin/base/BaseGoodsSpuRest.java +++ b/yxt-base-biz/src/main/java/com/yxt/base/apiadmin/base/BaseGoodsSpuRest.java @@ -1,9 +1,6 @@ package com.yxt.base.apiadmin.base; -import com.yxt.base.biz.base.basegoodsspu.BaseGoodsSpuDto; -import com.yxt.base.biz.base.basegoodsspu.BaseGoodsSpuQuery; -import com.yxt.base.biz.base.basegoodsspu.BaseGoodsSpuService; -import com.yxt.base.biz.base.basegoodsspu.BaseGoodsSpuVo; +import com.yxt.base.biz.base.basegoodsspu.*; import com.yxt.common.core.query.PagerQuery; import com.yxt.common.core.result.ResultBean; import com.yxt.common.core.vo.PagerVo; @@ -23,6 +20,31 @@ public class BaseGoodsSpuRest { @Autowired BaseGoodsSpuService baseGoodsSpuService; + + @ApiOperation("商品管理分页列表") + @PostMapping("/goodsListPage") + public ResultBean> goodsListPage(@RequestBody PagerQuery pq) { + return baseGoodsSpuService.goodsListPage(pq); + } + + @ApiOperation("保存修改商品信息") + @PostMapping("/saveOrUpdateGoods") + public ResultBean saveOrUpdateGoods(@RequestBody BaseGoodsDetailsDto dto) { + return baseGoodsSpuService.saveOrUpdateGoods(dto); + } + + @ApiOperation("商品信息详情回显") + @GetMapping("/goodsDetails/{sid}") + public ResultBean goodsDetails(@PathVariable("sid") String sid) { + return baseGoodsSpuService.goodsDetails(sid); + } + + @ApiOperation("根据sid批量删除") + @DeleteMapping("/delGoodsBySids") + public ResultBean delBySids(@RequestBody String[] sids) { + return baseGoodsSpuService.deleteBySids(sids); + } + @ApiOperation("分页列表") @PostMapping("/listPage") public ResultBean> listPage(@RequestBody PagerQuery pq) { diff --git a/yxt-base-biz/src/main/java/com/yxt/base/biz/base/basegoodssku/BaseGoodsSkuService.java b/yxt-base-biz/src/main/java/com/yxt/base/biz/base/basegoodssku/BaseGoodsSkuService.java index a924442336..73378c2221 100644 --- a/yxt-base-biz/src/main/java/com/yxt/base/biz/base/basegoodssku/BaseGoodsSkuService.java +++ b/yxt-base-biz/src/main/java/com/yxt/base/biz/base/basegoodssku/BaseGoodsSkuService.java @@ -48,6 +48,10 @@ public class BaseGoodsSkuService extends MybatisBaseService().eq("goodsSpuSid", spuSid)); + } + public ResultBean> listPage(PagerQuery pq) { ResultBean rb = ResultBean.fireFail(); BaseGoodsSkuQuery query = pq.getParams(); diff --git a/yxt-base-biz/src/main/java/com/yxt/base/biz/base/basegoodsskuextend/BaseGoodsSkuExtendService.java b/yxt-base-biz/src/main/java/com/yxt/base/biz/base/basegoodsskuextend/BaseGoodsSkuExtendService.java index 0db5492581..8a0fa2e3ce 100644 --- a/yxt-base-biz/src/main/java/com/yxt/base/biz/base/basegoodsskuextend/BaseGoodsSkuExtendService.java +++ b/yxt-base-biz/src/main/java/com/yxt/base/biz/base/basegoodsskuextend/BaseGoodsSkuExtendService.java @@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.date.DateTime; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.yxt.base.biz.base.basegoodssku.BaseGoodsSku; import com.yxt.common.base.config.component.FileUploadComponent; import com.yxt.common.base.service.MybatisBaseService; import com.yxt.common.base.utils.PagerUtil; @@ -41,6 +42,10 @@ public class BaseGoodsSkuExtendService extends MybatisBaseService().eq("goodsSkuSid", skuSid)); + } + public ResultBean> listPage(PagerQuery pq) { ResultBean rb = ResultBean.fireFail(); BaseGoodsSkuExtendQuery query = pq.getParams(); diff --git a/yxt-base-biz/src/main/java/com/yxt/base/biz/base/basegoodsspu/BaseGoodsDetailsDto.java b/yxt-base-biz/src/main/java/com/yxt/base/biz/base/basegoodsspu/BaseGoodsDetailsDto.java new file mode 100644 index 0000000000..564fad62d7 --- /dev/null +++ b/yxt-base-biz/src/main/java/com/yxt/base/biz/base/basegoodsspu/BaseGoodsDetailsDto.java @@ -0,0 +1,47 @@ +package com.yxt.base.biz.base.basegoodsspu; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.yxt.common.core.dto.Dto; +import lombok.Data; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author Fan + * @description + * @date 2024/5/15 14:59 + */ +@Data +public class BaseGoodsDetailsDto implements Dto { + + private String sid; + private String userSid; + private String orgPath; + + private String goodsName;//商品名称 + private String goodsCode;//图号 + private String goodsPY;//拼音缩写 + private String barCode;//条形码 + private String goodsUnitSid;//计量单位sid + private String goodsUnitName;//计量单位名称 + private String goodsTypeSid;//商品分类sid + private String goodsTypeName;//商品分类sid + private String indexes;//规格 + private String shelfLife;//保质期 + private String brandSid;//品牌sid + private String brandName;//品牌 + private String manufacturerSid;//厂家sid + private String manufacturerName;//厂家名称 + private String isOriginalFactory;//是否原厂 1 是 2否 + private String sortNo;//排序 + private String skuRemarks;//备注 + private String inventoryAlertUpperLimit;//库存上限 + private String inventoryAlertLowerLimit;//库存下限 + private String isLockingSalesPrice;//是否锁定销售价 1 是 2否 + private String minimumSalesPrice;//销售底价 + private String standardPurchasePrice;//三包价格 + private String agencyPrice;//首保价格 + private List picPath = new ArrayList<>();//商品图片 + +} diff --git a/yxt-base-biz/src/main/java/com/yxt/base/biz/base/basegoodsspu/BaseGoodsDetailsVo.java b/yxt-base-biz/src/main/java/com/yxt/base/biz/base/basegoodsspu/BaseGoodsDetailsVo.java new file mode 100644 index 0000000000..6195b0fa02 --- /dev/null +++ b/yxt-base-biz/src/main/java/com/yxt/base/biz/base/basegoodsspu/BaseGoodsDetailsVo.java @@ -0,0 +1,46 @@ +package com.yxt.base.biz.base.basegoodsspu; + +import com.yxt.common.core.vo.Vo; +import lombok.Data; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author Fan + * @description + * @date 2024/5/15 14:58 + */ +@Data +public class BaseGoodsDetailsVo implements Vo { + + private String sid; + private String userSid; + private String orgPath; + + private String goodsName;//商品名称 + private String goodsCode;//图号 + private String goodsPY;//拼音缩写 + private String barCode;//条形码 + private String goodsUnitSid;//计量单位sid + private String goodsUnitName;//计量单位名称 + private String goodsTypeSid;//商品分类sid + private String goodsTypeName;//商品分类sid + private String indexes;//规格 + private String shelfLife;//保质期 + private String brandSid;//品牌sid + private String brandName;//品牌 + private String manufacturerSid;//厂家sid + private String manufacturerName;//厂家名称 + private String isOriginalFactory;//是否原厂 1 是 2否 + private String sortNo;//排序 + private String skuRemarks;//备注 + private String inventoryAlertUpperLimit;//库存上限 + private String inventoryAlertLowerLimit;//库存下限 + private String isLockingSalesPrice;//是否锁定销售价 1 是 2否 + private String minimumSalesPrice;//销售底价 + private String standardPurchasePrice;//三包价格 + private String agencyPrice;//首保价格 + private List picPath = new ArrayList<>();//商品图片 + +} diff --git a/yxt-base-biz/src/main/java/com/yxt/base/biz/base/basegoodsspu/BaseGoodsSpu.java b/yxt-base-biz/src/main/java/com/yxt/base/biz/base/basegoodsspu/BaseGoodsSpu.java index ccac2973ec..177ad79d2c 100644 --- a/yxt-base-biz/src/main/java/com/yxt/base/biz/base/basegoodsspu/BaseGoodsSpu.java +++ b/yxt-base-biz/src/main/java/com/yxt/base/biz/base/basegoodsspu/BaseGoodsSpu.java @@ -12,7 +12,7 @@ public class BaseGoodsSpu extends BaseEntity { private String goodsCode;//商品代码 private String barCode;//条形码 private String goodsName;//商品名称 - private String subTitle;//商品名称 + private String subTitle;//副标题 private String goodsPY;//拼音缩写 private String goodsShortName;//商品简称 private String goodsTypeSid;//商品分类sid @@ -30,4 +30,6 @@ public class BaseGoodsSpu extends BaseEntity { private String isListed;//是否上架 private String useOrgSid;//使用组织sid private String createOrgSid;//创建组织sid + private String useOrgName;//使用组织 + private String createOrgName;//创建组织 } diff --git a/yxt-base-biz/src/main/java/com/yxt/base/biz/base/basegoodsspu/BaseGoodsSpuListQuery.java b/yxt-base-biz/src/main/java/com/yxt/base/biz/base/basegoodsspu/BaseGoodsSpuListQuery.java new file mode 100644 index 0000000000..3c943b0826 --- /dev/null +++ b/yxt-base-biz/src/main/java/com/yxt/base/biz/base/basegoodsspu/BaseGoodsSpuListQuery.java @@ -0,0 +1,24 @@ +package com.yxt.base.biz.base.basegoodsspu; + +import com.yxt.common.core.query.Query; +import lombok.Data; + +/** + * @author Fan + * @description + * @date 2024/5/15 13:51 + */ +@Data +public class BaseGoodsSpuListQuery implements Query { + + private String orgPath; //组织全路径 + private String useOrgName;//部门 + private String createOrgName;//分公司 + private String goodsName;//商品名称 + private String goodsCode;//图号 + private String goodsPY;//拼音缩写 + private String goodsTypeName;//商品类别 + private String brandName;//品牌 + private String manufacturerName;//厂家 + +} diff --git a/yxt-base-biz/src/main/java/com/yxt/base/biz/base/basegoodsspu/BaseGoodsSpuListVo.java b/yxt-base-biz/src/main/java/com/yxt/base/biz/base/basegoodsspu/BaseGoodsSpuListVo.java new file mode 100644 index 0000000000..936904e7b0 --- /dev/null +++ b/yxt-base-biz/src/main/java/com/yxt/base/biz/base/basegoodsspu/BaseGoodsSpuListVo.java @@ -0,0 +1,39 @@ +package com.yxt.base.biz.base.basegoodsspu; + +import com.yxt.common.core.vo.Vo; +import lombok.Data; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author Fan + * @description + * @date 2024/5/15 13:32 + */ +@Data +public class BaseGoodsSpuListVo implements Vo { + + private String sid; //spuSid + private String goodsName;//商品名称 + private String goodsCode;//图号 + private String goodsPY;//拼音缩写 + private String barCode;//条形码 + private String goodsUnitName;//计量单位 + private String goodsTypeName;//商品类别 + private String indexes;//规格 + private String shelfLife;//保质期 + private String brandName;//品牌 + private String manufacturerName;//厂家 + private String isOriginalFactory;//原厂标志( 1 是 2否) + private String InventoryAlertUpperLimit;//库存上限 + private String InventoryAlertLowerLimit;//库存下限 + private String isLockingSalesPrice;//锁定销售价( 1 是 2否) + private String minimumSalesPrice;//销售底价 + private String standardPurchasePrice;//三包价格 + private String agencyPrice;//首保价格 + private String picUrl; + private List picPath = new ArrayList<>();//商品图片 + + +} diff --git a/yxt-base-biz/src/main/java/com/yxt/base/biz/base/basegoodsspu/BaseGoodsSpuMapper.java b/yxt-base-biz/src/main/java/com/yxt/base/biz/base/basegoodsspu/BaseGoodsSpuMapper.java index f082933b3e..4c40a0e89c 100644 --- a/yxt-base-biz/src/main/java/com/yxt/base/biz/base/basegoodsspu/BaseGoodsSpuMapper.java +++ b/yxt-base-biz/src/main/java/com/yxt/base/biz/base/basegoodsspu/BaseGoodsSpuMapper.java @@ -16,4 +16,8 @@ public interface BaseGoodsSpuMapper extends BaseMapper { IPage listPage(IPage page, @Param(Constants.WRAPPER) QueryWrapper qw); BaseGoodsSpuVo initialization(@Param("sid")String sid); + + IPage goodsListPage(IPage page,@Param(Constants.WRAPPER) QueryWrapper qw); + + void delBySpuSid(@Param("sid") String sid); } diff --git a/yxt-base-biz/src/main/java/com/yxt/base/biz/base/basegoodsspu/BaseGoodsSpuMapper.xml b/yxt-base-biz/src/main/java/com/yxt/base/biz/base/basegoodsspu/BaseGoodsSpuMapper.xml index 2acb6e459c..32235f8135 100644 --- a/yxt-base-biz/src/main/java/com/yxt/base/biz/base/basegoodsspu/BaseGoodsSpuMapper.xml +++ b/yxt-base-biz/src/main/java/com/yxt/base/biz/base/basegoodsspu/BaseGoodsSpuMapper.xml @@ -1,12 +1,23 @@ + + DELETE + p,pd,k,e +FROM + base_goods_spu AS p + LEFT JOIN base_goods_spu_detail AS pd ON p.sid = pd.goodSpuSid + LEFT JOIN base_goods_sku AS k ON p.sid = k.goodsSpuSid + LEFT JOIN base_goods_sku_extend AS e ON k.sid = e.goodsSkuSid +WHERE + p.sid = #{sid} + + - \ No newline at end of file + diff --git a/yxt-base-biz/src/main/java/com/yxt/base/biz/base/basegoodsspu/BaseGoodsSpuService.java b/yxt-base-biz/src/main/java/com/yxt/base/biz/base/basegoodsspu/BaseGoodsSpuService.java index 60e324557c..df8ef16a5f 100644 --- a/yxt-base-biz/src/main/java/com/yxt/base/biz/base/basegoodsspu/BaseGoodsSpuService.java +++ b/yxt-base-biz/src/main/java/com/yxt/base/biz/base/basegoodsspu/BaseGoodsSpuService.java @@ -4,13 +4,18 @@ import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.date.DateTime; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.yxt.base.biz.base.basegoodssku.BaseGoodsSku; import com.yxt.base.biz.base.basegoodssku.BaseGoodsSkuVo; +import com.yxt.base.biz.base.basegoodsskuextend.BaseGoodsSkuExtend; import com.yxt.base.biz.base.basegoodsskuextend.BaseGoodsSkuExtendService; import com.yxt.base.biz.base.basegoodsskuextend.BaseGoodsSkuExtendVo; import com.yxt.base.biz.base.basegoodsskuextend.UrlsVo; import com.yxt.base.biz.base.basegoodsspudetail.BaseGoodsSpuDetailVo; import com.yxt.base.biz.base.basegoodsunit.BaseGoodsUnit; import com.yxt.base.biz.base.basegoodsunit.BaseGoodsUnitService; +import com.yxt.base.feign.portal.sysorganization.SysOrganizationFeign; +import com.yxt.base.feign.portal.sysorganization.SysOrganizationVo; +import com.yxt.base.feign.portal.sysstafforg.SysStaffOrgFeign; import com.yxt.base.utils.PinYinUtils; import com.yxt.common.base.config.component.FileUploadComponent; import com.yxt.common.base.service.MybatisBaseService; @@ -32,10 +37,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Date; -import java.util.List; +import java.util.*; /** * @author wangpengfei @@ -53,14 +55,23 @@ public class BaseGoodsSpuService extends MybatisBaseService> listPage(PagerQuery pq) { ResultBean rb = ResultBean.fireFail(); BaseGoodsSpuQuery query = pq.getParams(); QueryWrapper qw = new QueryWrapper<>(); - if(StringUtils.isNotBlank(query.getName())){ - qw.like("goodsName",query.getName()); + if (StringUtils.isNotBlank(query.getName())) { + qw.like("goodsName", query.getName()); } IPage page = PagerUtil.queryToPage(pq); IPage pagging = baseMapper.listPage(page, qw); @@ -76,18 +87,19 @@ public class BaseGoodsSpuService extends MybatisBaseService saveOrUpdate(BaseGoodsSpuDto dto) { ResultBean rb = ResultBean.fireFail(); String sid = ""; - BaseGoodsSpu spun= baseMapper.selectOne(new QueryWrapper().eq("sid",dto.getSid())); - BaseGoodsUnit baseGoodsUnit=baseGoodsUnitService.getOne(new QueryWrapper().eq("sid",dto.getGoodsUnitSid())); - if(null!=baseGoodsUnit){ + BaseGoodsSpu spun = baseMapper.selectOne(new QueryWrapper().eq("sid", dto.getSid())); + BaseGoodsUnit baseGoodsUnit = baseGoodsUnitService.getOne(new QueryWrapper().eq("sid", dto.getGoodsUnitSid())); + if (null != baseGoodsUnit) { dto.setGoodsUnitName(baseGoodsUnit.getUnitName()); } - if (spun!=null) { - if(!spun.getSid().equals(dto.getSid())){ + if (spun != null) { + if (!spun.getSid().equals(dto.getSid())) { return rb.setMsg("商品编码重复"); } sid = dto.getSid(); @@ -95,19 +107,20 @@ public class BaseGoodsSpuService extends MybatisBaseService{ + dto.getBaseGoodsSkus().forEach(s -> { s.setGoodsSpuSid(wmsGoods.getSid()); }); baseGoodsSkuService.saveOrUpdate(dto.getBaseGoodsSkus()); } else { - BaseGoodsSpu spu=baseMapper.selectOne(new QueryWrapper().eq("goodsCode",dto.getGoodsCode())); - if(spu!=null){ + BaseGoodsSpu spu = baseMapper.selectOne(new QueryWrapper().eq("goodsCode", dto.getGoodsCode())); + if (spu != null) { return rb.setMsg("商品编码重复"); } BaseGoodsSpu wmsGoods = new BaseGoodsSpu(); @@ -120,7 +133,7 @@ public class BaseGoodsSpuService extends MybatisBaseService{ + dto.getBaseGoodsSkus().forEach(s -> { s.setGoodsSpuSid(wmsGoods.getSid()); }); baseGoodsSkuService.saveOrUpdate(dto.getBaseGoodsSkus()); @@ -132,16 +145,17 @@ public class BaseGoodsSpuService extends MybatisBaseService initialization(String sid) { ResultBean rb = ResultBean.fireFail(); BaseGoodsSpuVo vo = baseMapper.initialization(sid); - BaseGoodsSpuDetailVo vo1=baseGoodsSpuDetailService.getSpuDetailsBySpuSid(vo.getSid()).getData(); + BaseGoodsSpuDetailVo vo1 = baseGoodsSpuDetailService.getSpuDetailsBySpuSid(vo.getSid()).getData(); vo.setBaseGoodsSpuDetail(vo1); - List vos=baseGoodsSkuService.getSkusBySpuSid(vo.getSid()).getData(); + List vos = baseGoodsSkuService.getSkusBySpuSid(vo.getSid()).getData(); for (BaseGoodsSkuVo baseGoodsSkuVo : vos) { - List ur=new ArrayList<>(); - BaseGoodsSkuExtendVo vo2=baseGoodsSkuExtendService.getExtendBySkuSid(baseGoodsSkuVo.getSid()).getData(); - if(StringUtils.isNotBlank(vo2.getPicUrl())){ + List ur = new ArrayList<>(); + BaseGoodsSkuExtendVo vo2 = baseGoodsSkuExtendService.getExtendBySkuSid(baseGoodsSkuVo.getSid()).getData(); + if (StringUtils.isNotBlank(vo2.getPicUrl())) { for (String url : vo2.getPicUrl().split(",")) { - url=fileUploadComponent.getUrlPrefix()+url; - UrlsVo vo3=new UrlsVo();vo3.setUrl(url); + url = fileUploadComponent.getUrlPrefix() + url; + UrlsVo vo3 = new UrlsVo(); + vo3.setUrl(url); ur.add(vo3); } } @@ -153,7 +167,6 @@ public class BaseGoodsSpuService extends MybatisBaseService> goodsListPage(PagerQuery pq) { + ResultBean rb = ResultBean.fireFail(); + BaseGoodsSpuListQuery query = pq.getParams(); + QueryWrapper qw = new QueryWrapper<>(); + if (StringUtils.isNotBlank(query.getOrgPath())) { + String createOrgSid = sysStaffOrgFeign.getOrgSidByPath(query.getOrgPath()).getData(); + qw.eq("p.createOrgSid", createOrgSid); + } + if (StringUtils.isNotBlank(query.getGoodsPY())) { + qw.like("p.goodsPY", query.getGoodsPY()); + } + if (StringUtils.isNotBlank(query.getCreateOrgName())) { + qw.like("p.createOrgName", query.getCreateOrgName()); + } + if (StringUtils.isNotBlank(query.getUseOrgName())) { + qw.like("p.useOrgName", query.getUseOrgName()); + } + if (StringUtils.isNotBlank(query.getGoodsName())) { + qw.like("p.goodsName", query.getGoodsName()); + } + if (StringUtils.isNotBlank(query.getGoodsCode())) { + qw.like("p.goodsCode", query.getGoodsCode()); + } + if (StringUtils.isNotBlank(query.getGoodsTypeName())) { + qw.like("t.goodsTypeName", query.getGoodsTypeName()); + } + if (StringUtils.isNotBlank(query.getBrandName())) { + qw.like("b.brandName", query.getBrandName()); + } + if (StringUtils.isNotBlank(query.getManufacturerName())) { + qw.like("m.manufacturerName", query.getManufacturerName()); + } + IPage page = PagerUtil.queryToPage(pq); + IPage pagging = baseMapper.goodsListPage(page, qw); + PagerVo p = PagerUtil.pageToVo(pagging, null); + List records = pagging.getRecords(); + records.removeAll(Collections.singleton(null)); + if (!records.isEmpty()) { + String urlPrefix = fileUploadComponent.getUrlPrefix(); + for (BaseGoodsSpuListVo record : records) { + if (StringUtils.isNotBlank(record.getPicUrl())) { + List files = new ArrayList<>(); + String picUrl = record.getPicUrl(); + String[] split = picUrl.split(","); + for (String s : split) { + files.add(urlPrefix + s); + } + record.setPicPath(files); + } + } + } + return rb.success().setData(p); + } + + @Transactional + public ResultBean saveOrUpdateGoods(BaseGoodsDetailsDto dto) { + ResultBean rb = ResultBean.fireFail(); + String sid = ""; + String orgPath = ""; + if (StringUtils.isNotBlank(dto.getOrgPath())) { + orgPath = dto.getOrgPath(); + } + BaseGoodsSpu spun = baseMapper.selectOne(new QueryWrapper().eq("sid", dto.getSid())); + if (spun != null) { + if (!spun.getSid().equals(dto.getSid())) { + return rb.setMsg("商品编码重复"); + } + sid = dto.getSid(); + BaseGoodsSpu wmsGoods = fetchBySid(dto.getSid()); + BeanUtil.copyProperties(dto, wmsGoods, "id", "sid"); + wmsGoods.setModifyTime(new Date()); + wmsGoods.setGoodsPY(PinYinUtils.sx(wmsGoods.getGoodsName())); + baseMapper.updateById(wmsGoods); + //商品sku + BaseGoodsSku skuUpdate = baseGoodsSkuService.getOneBySpuSid(sid); + if (null != skuUpdate) { + if (StringUtils.isNotBlank(dto.getGoodsName())) { + skuUpdate.setTitle(dto.getGoodsName()); + } + if (StringUtils.isNotBlank(dto.getGoodsCode())) { + skuUpdate.setGoodsSkuCode(dto.getGoodsCode()); + } + if (StringUtils.isNotBlank(dto.getIndexes())) { + skuUpdate.setIndexes(dto.getIndexes()); + } + skuUpdate.setModifyTime(new Date()); + baseGoodsSkuService.updateById(skuUpdate); + BaseGoodsSkuExtend skuExtendUpdate = baseGoodsSkuExtendService.getOneBySKuSid(skuUpdate.getSid()); + if (null != skuExtendUpdate) { + BeanUtil.copyProperties(dto, skuExtendUpdate, "id", "sid"); + if (StringUtils.isNotBlank(dto.getSkuRemarks())) { + skuExtendUpdate.setRemarks(dto.getSkuRemarks()); + } + List picPath = dto.getPicPath(); + if (!picPath.isEmpty()) { + StringBuilder sb = new StringBuilder(); + String urlPrefix = fileUploadComponent.getUrlPrefix(); + for (String filePath : picPath) { + String path = filePath.substring(urlPrefix.length()); + sb.append(path).append(","); + } + sb.delete(sb.length() - 1, sb.length()); + skuExtendUpdate.setPicUrl(sb.toString()); + } + baseGoodsSkuExtendService.updateById(skuExtendUpdate); + } else { + BaseGoodsSkuExtend skuExtend = new BaseGoodsSkuExtend(); + BeanUtil.copyProperties(dto, skuExtend, "id", "sid"); + skuExtend.setGoodsSkuSid(skuUpdate.getSid()); + if (StringUtils.isNotBlank(dto.getSkuRemarks())) { + skuExtend.setRemarks(dto.getSkuRemarks()); + } + List picPath = dto.getPicPath(); + if (!picPath.isEmpty()) { + StringBuilder sb = new StringBuilder(); + String urlPrefix = fileUploadComponent.getUrlPrefix(); + for (String filePath : picPath) { + String path = filePath.substring(urlPrefix.length()); + sb.append(path).append(","); + } + sb.delete(sb.length() - 1, sb.length()); + skuExtend.setPicUrl(sb.toString()); + } + baseGoodsSkuExtendService.insert(skuExtend); + } + } else { + //商品sku + BaseGoodsSku sku = new BaseGoodsSku(); + sku.setGoodsSpuSid(sid); + if (StringUtils.isNotBlank(dto.getGoodsName())) { + sku.setTitle(dto.getGoodsName()); + } + if (StringUtils.isNotBlank(dto.getGoodsCode())) { + sku.setGoodsSkuCode(dto.getGoodsCode()); + } + if (StringUtils.isNotBlank(dto.getIndexes())) { + sku.setIndexes(dto.getIndexes()); + } + baseGoodsSkuService.insert(sku); + //商品sku_extend + BaseGoodsSkuExtend skuExtend = new BaseGoodsSkuExtend(); + BeanUtil.copyProperties(dto, skuExtend, "id", "sid"); + skuExtend.setGoodsSkuSid(sku.getSid()); + if (StringUtils.isNotBlank(dto.getSkuRemarks())) { + skuExtend.setRemarks(dto.getSkuRemarks()); + } + List picPath = dto.getPicPath(); + if (!picPath.isEmpty()) { + StringBuilder sb = new StringBuilder(); + String urlPrefix = fileUploadComponent.getUrlPrefix(); + for (String filePath : picPath) { + String path = filePath.substring(urlPrefix.length()); + sb.append(path).append(","); + } + sb.delete(sb.length() - 1, sb.length()); + skuExtend.setPicUrl(sb.toString()); + } + baseGoodsSkuExtendService.insert(skuExtend); + } + } else { + BaseGoodsSpu spu = baseMapper.selectOne(new QueryWrapper().eq("goodsCode", dto.getGoodsCode())); + if (spu != null) { + return rb.setMsg("商品编码重复"); + } + BaseGoodsSpu wmsGoods = new BaseGoodsSpu(); + sid = wmsGoods.getSid(); + BeanUtil.copyProperties(dto, wmsGoods, "id", "sid"); + wmsGoods.setCreateBySid(dto.getUserSid()); + String deptName = ""; + String deptSid = ""; + String createOrgSid = ""; + if (StringUtils.isNotBlank(orgPath)) { + List split = Arrays.asList(orgPath.split("/")); + if (split.size() > 1) { + //获取本级sid获取本级部门信息 + SysOrganizationVo sysOrganization = sysOrganizationFeign.fetchBySid(split.get(split.size() - 2)).getData(); + SysOrganizationVo sysOrganization1 = sysOrganizationFeign.fetchBySid(split.get(split.size() - 1)).getData(); + deptName = sysOrganization.getName() + "/" + sysOrganization1.getName(); + deptName = sysOrganization1.getName(); + deptSid = sysOrganization1.getSid(); + } else { + SysOrganizationVo sysOrganization = sysOrganizationFeign.fetchBySid(split.get(0)).getData(); + deptName = sysOrganization.getName(); + deptName = sysOrganization.getName(); + deptSid = sysOrganization.getSid(); + } + wmsGoods.setUseOrgName(deptName); + wmsGoods.setUseOrgSid(deptSid); + createOrgSid = sysStaffOrgFeign.getOrgSidByPath(orgPath).getData(); + //创建组织使用组织 + ResultBean organizationResultBean = sysOrganizationFeign.fetchBySid(createOrgSid); + if (organizationResultBean.getData() != null) { + wmsGoods.setCreateOrgName(organizationResultBean.getData().getName()); + wmsGoods.setCreateOrgSid(createOrgSid); + } + } + wmsGoods.setGoodsPY(PinYinUtils.sx(wmsGoods.getGoodsName())); + baseMapper.insert(wmsGoods); + //商品sku + BaseGoodsSku sku = new BaseGoodsSku(); + sku.setGoodsSpuSid(sid); + if (StringUtils.isNotBlank(dto.getGoodsName())) { + sku.setTitle(dto.getGoodsName()); + } + if (StringUtils.isNotBlank(dto.getGoodsCode())) { + sku.setGoodsSkuCode(dto.getGoodsCode()); + } + if (StringUtils.isNotBlank(dto.getIndexes())) { + sku.setIndexes(dto.getIndexes()); + } + baseGoodsSkuService.insert(sku); + //商品sku_extend + BaseGoodsSkuExtend skuExtend = new BaseGoodsSkuExtend(); + BeanUtil.copyProperties(dto, skuExtend, "id", "sid"); + skuExtend.setGoodsSkuSid(sku.getSid()); + if (StringUtils.isNotBlank(dto.getSkuRemarks())) { + skuExtend.setRemarks(dto.getSkuRemarks()); + } + List picPath = dto.getPicPath(); + if (!picPath.isEmpty()) { + StringBuilder sb = new StringBuilder(); + String urlPrefix = fileUploadComponent.getUrlPrefix(); + for (String filePath : picPath) { + String path = filePath.substring(urlPrefix.length()); + sb.append(path).append(","); + } + sb.delete(sb.length() - 1, sb.length()); + skuExtend.setPicUrl(sb.toString()); + } + baseGoodsSkuExtendService.insert(skuExtend); + } + return rb.success().setData(sid); + } + + public ResultBean goodsDetails(String sid) { + ResultBean rb = ResultBean.fireFail(); + BaseGoodsDetailsVo vo = new BaseGoodsDetailsVo(); + BaseGoodsSpu baseGoodsSpu = fetchBySid(sid); + if (null != baseGoodsSpu) { + BeanUtil.copyProperties(baseGoodsSpu, vo); + if (StringUtils.isNotBlank(baseGoodsSpu.getGoodsTypeSid())) { + BaseGoodsType baseGoodsType = baseGoodsTypeService.fetchBySid(baseGoodsSpu.getGoodsTypeSid()); + if (null != baseGoodsType) { + if (StringUtils.isNotBlank(baseGoodsType.getGoodsTypeName())) { + vo.setGoodsTypeName(baseGoodsType.getGoodsTypeName()); + } + } + } + if (StringUtils.isNotBlank(baseGoodsSpu.getBrandSid())) { + BaseBrandInfo baseBrandInfo = baseBrandInfoService.fetchBySid(baseGoodsSpu.getBrandSid()); + if (null != baseBrandInfo) { + if (StringUtils.isNotBlank(baseBrandInfo.getBrandName())) { + vo.setBrandName(baseBrandInfo.getBrandName()); + } + } + } + if (StringUtils.isNotBlank(baseGoodsSpu.getManufacturerSid())) { + BaseManufacturer manufacturer = baseManufacturerService.fetchBySid(baseGoodsSpu.getManufacturerSid()); + if (null != manufacturer) { + if (StringUtils.isNotBlank(manufacturer.getManufacturerName())) { + vo.setManufacturerName(manufacturer.getManufacturerName()); + } + } + } + } + BaseGoodsSku sku = baseGoodsSkuService.getOneBySpuSid(sid); + if (null != sku) { + if (StringUtils.isNotBlank(sku.getIndexes())) { + vo.setIndexes(sku.getIndexes()); + } + BaseGoodsSkuExtend skuExtend = baseGoodsSkuExtendService.getOneBySKuSid(sku.getSid()); + if (null != skuExtend) { + BeanUtil.copyProperties(skuExtend, vo, "sid"); + if (StringUtils.isNotBlank(skuExtend.getRemarks())) { + vo.setSkuRemarks(skuExtend.getRemarks()); + } + String urlPrefix = fileUploadComponent.getUrlPrefix(); + if (StringUtils.isNotBlank(skuExtend.getPicUrl())) { + List files = new ArrayList<>(); + String picUrl = skuExtend.getPicUrl(); + String[] split = picUrl.split(","); + for (String s : split) { + files.add(urlPrefix + s); + } + vo.setPicPath(files); + } + } + } + return rb.success().setData(vo); + } + + public ResultBean deleteBySids(String[] sids) { + ResultBean rb = ResultBean.fireFail(); + for (String sid : sids) { + baseMapper.delBySpuSid(sid); + } + return rb.success(); + } } diff --git a/yxt-wms-biz/src/main/java/com/yxt/wms/biz/inventory/wmsreceiptbill/WmsReceiptBillDto2.java b/yxt-wms-biz/src/main/java/com/yxt/wms/biz/inventory/wmsreceiptbill/WmsReceiptBillDto2.java index 68d80baf2c..aa98223962 100644 --- a/yxt-wms-biz/src/main/java/com/yxt/wms/biz/inventory/wmsreceiptbill/WmsReceiptBillDto2.java +++ b/yxt-wms-biz/src/main/java/com/yxt/wms/biz/inventory/wmsreceiptbill/WmsReceiptBillDto2.java @@ -43,6 +43,7 @@ public class WmsReceiptBillDto2 { //单据状态:新建/已完成 @ApiModelProperty("单据状态:待收货/部分收货/已收货(默认)") private String billState; + private String billStateKey; @ApiModelProperty("备注") private String remarks; @ApiModelProperty("使用组织sid") diff --git a/yxt-wms-biz/src/main/java/com/yxt/wms/biz/inventory/wmsreceiptbill/WmsReceiptBillService.java b/yxt-wms-biz/src/main/java/com/yxt/wms/biz/inventory/wmsreceiptbill/WmsReceiptBillService.java index 4b15008feb..e50ae83d99 100644 --- a/yxt-wms-biz/src/main/java/com/yxt/wms/biz/inventory/wmsreceiptbill/WmsReceiptBillService.java +++ b/yxt-wms-biz/src/main/java/com/yxt/wms/biz/inventory/wmsreceiptbill/WmsReceiptBillService.java @@ -120,6 +120,11 @@ public class WmsReceiptBillService extends MybatisBaseService