Commit 48019a0446fc92d38f8331b6e4cf12365d05a14f
1 parent
bc5848e9
Exists in
master
and in
1 other branch
test code
Showing
3 changed files
with
384 additions
and
14 deletions
Show diff stats
build.gradle
@@ -58,7 +58,7 @@ uploadArchives { | @@ -58,7 +58,7 @@ uploadArchives { | ||
58 | authentication(userName: NEXUS_USERNAME, password: NEXUS_PASSWORD) | 58 | authentication(userName: NEXUS_USERNAME, password: NEXUS_PASSWORD) |
59 | } | 59 | } |
60 | pom.project { | 60 | pom.project { |
61 | - version '2.1.52' | 61 | + version '2.2.1' |
62 | artifactId ARTIFACT_Id | 62 | artifactId ARTIFACT_Id |
63 | groupId GROUP_ID | 63 | groupId GROUP_ID |
64 | packaging TYPE | 64 | packaging TYPE |
src/test/java/com/taover/repository/test/TestAutoconfigure.java
@@ -24,13 +24,383 @@ public class TestAutoconfigure { | @@ -24,13 +24,383 @@ public class TestAutoconfigure { | ||
24 | jdbcTemplateWrapperTenant = context.getBean(JdbcTemplateWrapperTenant.class); | 24 | jdbcTemplateWrapperTenant = context.getBean(JdbcTemplateWrapperTenant.class); |
25 | 25 | ||
26 | // testBroadCast(); | 26 | // testBroadCast(); |
27 | -// testSelectSubQuery(); | 27 | + //testSelectSubQuery(); |
28 | //select子查询包含分片表 | 28 | //select子查询包含分片表 |
29 | - testSelectShardingSubQuery(); | 29 | + //testSelectShardingSubQuery(); |
30 | //where中包含子查询 | 30 | //where中包含子查询 |
31 | - testWhereSubquery(); | 31 | + //testWhereSubquery(); |
32 | + | ||
33 | + //testWarePaymentSelectSql(); | ||
34 | + //testExportPaymentDetailData(); | ||
35 | + //testTenantWithRootUser(); | ||
36 | + //testDayOrderInfoExcelData(); | ||
37 | + //testDayOrderInfoAPI(); | ||
38 | + //testWeekOrderInfoExcelData(); | ||
39 | + //testOrderPrintExcelData(); | ||
40 | + //testRefundCoreSqlForOrderList(); | ||
41 | + //testSelectSqlForDeliveryExcel(); | ||
42 | + //testDeliveryExpressNumber(); | ||
43 | + //testDeliveryGoodsExcel(); | ||
44 | + //testExcelSelectForSale(); | ||
45 | + //testChannelPrintSelect(); | ||
46 | + testWarePaymentExport(); | ||
32 | } | 47 | } |
33 | 48 | ||
49 | + private static void testWarePaymentExport() { | ||
50 | + String sql = "SELECT wc.manager_nickname,cp.id as paymentId, wo.order_sn,wo.`upload_sn`,wo.consignee,wo.mobile," | ||
51 | + + " wgbs.sku_unit_num as skuUnitNum, wgbs.unit, " | ||
52 | + + " ifnull((SELECT wc.`refund_to_channel` FROM `wxorder_compensate` AS wc WHERE wc.`order_id` = cp.`order_id` LIMIT 1),0) AS refundToChannel, " | ||
53 | + + " ifnull((SELECT wc.`refund_instructions` FROM `wxorder_compensate` AS wc WHERE wc.`order_id` = cp.`order_id` LIMIT 1),'') AS refundRemark, " | ||
54 | + + " (SELECT wpb.`pay_result` from wxorder_ware_payment_batch wpb WHERE wpb.`batch_no`= cp.`pay_batch_no` ORDER BY wpb.`pay_result` asc LIMIT 1) as pay_result," | ||
55 | + + "CONCAT(wo.province_name,wo.city_name,wo.district_name,wo.address) fullAddress,wo.`progress_delivery`,wo.`real_delivery_time`," | ||
56 | + + "wo.`express_number`,wc.`name`,wc.wx_group_nickname,wog.`goods_name`,wog.`sku_name`,wog.`sku_code`," | ||
57 | + + "wog.`goods_base_sku_price`,wog.`goods_number`, wog.`goods_base_sku_price`*wog.`goods_number` as goodsMoney," | ||
58 | + + "wog.ware_shipping_price as shipping_price,wo.`customer_remark`,wo.`channel_remark`,wo.`control_status`,wog.`ware_refund_money` as refund_money, wog.ware_money_loss as moneyLoss, " | ||
59 | + + "wog.`ware_money_paid` as money_paid,wo.`pay_time`,wo.`create_time`, wo.`latest_distribute_time`, " | ||
60 | + + "cp.`deal_progress`, cp.`check_date`,cp.deal_check_date " | ||
61 | + + " FROM `wxorder_ware_payment` cp " | ||
62 | + + " INNER JOIN `wxorder_order` AS wo ON wo.`id`=cp.order_id " | ||
63 | + + " INNER JOIN `wxorder_order_goods` wog ON wog.`order_id`=wo.id " | ||
64 | + + " INNER JOIN `wxorder_goods_base_sku` wgbs ON wgbs.`id`=wog.goods_sku_id " | ||
65 | + + " INNER JOIN `wxorder_ware` wc ON wc.`id`=wo.`ware_id` " | ||
66 | + + "WHERE cp.id in (30617) " | ||
67 | + + " and cp.tenant_id=16" | ||
68 | + + " and wo.tenant_id=16" | ||
69 | + + " and wog.tenant_id=16"; | ||
70 | + System.out.println(jdbcTemplateWrapperTenant.queryForList(sql, 16L)); | ||
71 | + } | ||
72 | + | ||
73 | + private static void testChannelPrintSelect() { | ||
74 | + String sql = "select wxorder_order.id woId,if(locate('(规格:', wxorder_order_goods.channel_goods_name)>0,left(substring_index( wxorder_order_goods.channel_goods_name, '(规格:', -1), char_length(substring_index( wxorder_order_goods.channel_goods_name, '(规格:', -1)) -1),substring_index( wxorder_order_goods.channel_goods_name, '(规格:', -1)),(SELECT GROUP_CONCAT(wn.`name`) FROM wxorder_tag wt INNER JOIN `wxorder_name_tag` wn ON wn.`id`=wt.`tag_name_id` WHERE wn.`table_name`='wxorder_channel' AND wt.`tenant_id`=wxorder_order.tenant_id AND wt.`table_id`=wxorder_order.`channel_id`) as channelTag " | ||
75 | + + " from wxorder_order inner join wxorder_order_goods on wxorder_order.id=wxorder_order_goods.order_id limit 10 "; | ||
76 | + System.out.println(jdbcTemplateWrapperTenant.queryForList(sql, 16L)); | ||
77 | + } | ||
78 | + | ||
79 | + private static void testExcelSelectForSale() { | ||
80 | + String sql = " SELECT wxorder_order.tenant_id ," | ||
81 | + + " IFNULL((select GROUP_CONCAT(wxorder_order_express.express_number) from wxorder_order_express AS wxorder_order_express where wxorder_order_express.order_id=wxorder_order.id and wxorder_order_express.tenant_id=16),'') AS express_number, " | ||
82 | + + " wxorder_order.`refund_instructions`, wxorder_order.`refund_money`,wxorder_order.ware_refund_money, wxorder_order.`refund_type`, wxorder_order.`customer_network_name`, " | ||
83 | + + "(SELECT sum(wc.`refund_money`) from `wxorder_compensate` as wc WHERE wc.order_id = wxorder_order.id)as compesateChannelRefundMoney, " | ||
84 | + + "(SELECT sum(wc.`ware_refund_money`) from `wxorder_compensate` as wc WHERE wc.order_id = wxorder_order.id)as compesateWareRefundMoney, " | ||
85 | + + " wxorder_order_wxtext.sender_payload, wxorder_excel_data.payload, " | ||
86 | + + " wxorder_order.order_sn, wxorder_order.upload_sn, wxorder_order.control_status, wxorder_order.progress_delivery, wxorder_order.consignee, " | ||
87 | + + " wxorder_order.mobile,wxorder_order.create_time, wxorder_order.province_name, wxorder_order.city_name, wxorder_order.district_name, wxorder_order.address, " | ||
88 | + + " wxorder_order.money_paid, wxorder_order.shipping_price, " | ||
89 | + + " wxorder_order.sender_name, wxorder_order.sender_mobile, " | ||
90 | + + " wxorder_order.real_delivery_time, wxorder_order.pay_time, wxorder_order.expect_delivery_time, " | ||
91 | + + " IF(wxorder_order_goods.goods_name=wxorder_order_goods.sku_name,group_concat(concat(wxorder_order_goods.goods_name,'*',wxorder_order_goods.goods_number) SEPARATOR '; '),group_concat(concat(wxorder_order_goods.goods_name,'(',wxorder_order_goods.sku_name,')','*',wxorder_order_goods.goods_number) SEPARATOR '; ')) groupGoodsDetail, sum(wxorder_order_goods.goods_number) sumGoodsNumber, " | ||
92 | + + " wxorder_order.express_name, " | ||
93 | + + " group_concat(wxorder_order_goods.goods_code separator '; ') goodsCode,group_concat(wxorder_order_goods.sku_code separator '; ') skuCode, " | ||
94 | + | ||
95 | + + " group_concat(wxorder_goods_base_sku.sku_unit_num separator '; ') skuUnitNum," | ||
96 | + + " group_concat(wxorder_goods_base_sku.unit separator '; ') unit," | ||
97 | + | ||
98 | + + " wxorder_order.channel_remark, wxorder_order.customer_remark,wxorder_order.buyer_remark, wxorder_order.action_from, " | ||
99 | + + " CONCAT(wxorder_order.province_name,wxorder_order.city_name, wxorder_order.district_name,wxorder_order.address) detailAddress, " | ||
100 | + + " wxorder_channel.name 'channelName', wxorder_channel.contact_user,wxorder_channel.manager_nickname as managerNickname, wxorder_channel.wx_group_nickname 'wxGroupNickname' , " | ||
101 | + + " wxorder_order.operate_refund_time refundTime,wxorder_order_goods.channel_goods_name , " | ||
102 | + + " wxorder_channel.id 'channelId', wxorder_ware.name 'wareName' ,group_concat(wxorder_order_goods.channel_goods_price separator '; ') as channelGoodsPrice "; | ||
103 | + sql += " FROM wxorder_order wxorder_order " | ||
104 | + + " INNER JOIN wxorder_order_goods_origin wxorder_order_goods ON wxorder_order_goods.order_id=wxorder_order.id and wxorder_order.tenant_id=16 and wxorder_order_goods.tenant_id=16" | ||
105 | + + " INNER JOIN wxorder_channel wxorder_channel ON wxorder_channel.id=wxorder_order.channel_id " | ||
106 | + + " INNER JOIN wxorder_ware wxorder_ware ON wxorder_ware.id=wxorder_order.ware_id " | ||
107 | + + " INNER JOIN wxorder_goods_base_sku as wxorder_goods_base_sku ON wxorder_goods_base_sku.id=wxorder_order_goods.goods_sku_id " | ||
108 | + //修改处4:导出销售单 | ||
109 | + + " LEFT JOIN wxorder_order_wxtext wxorder_order_wxtext ON wxorder_order_wxtext.id=wxorder_order.wxtext_order_id" | ||
110 | + + " LEFT JOIN wxorder_excel_data ON wxorder_excel_data.id=wxorder_order.excel_data_id "; | ||
111 | + sql += " WHERE wxorder_order.id in (208925) "; | ||
112 | + System.out.println(jdbcTemplateWrapperTenant.queryForList(sql, 16L)); | ||
113 | + } | ||
114 | + | ||
115 | + private static void testDeliveryGoodsExcel() { | ||
116 | + String sql = "SELECT wxorder_order.order_sn,wxorder_order.upload_sn,wxorder_order.control_status," | ||
117 | + + "wxorder_order.progress_delivery,wxorder_order.consignee,wxorder_order.mobile," | ||
118 | + + "wxorder_order.province_name,wxorder_order.city_name,wxorder_order.district_name,wxorder_order.address," | ||
119 | + + "wxorder_order.sender_name,wxorder_order.sender_mobile,wxorder_channel.sender_man," | ||
120 | + + "wxorder_channel.sender_phone,wxorder_ware.sender_man,wxorder_ware.sender_phone," | ||
121 | + + "wxorder_order.real_delivery_time,wxorder_order.expect_delivery_time,wxorder_order.create_time," | ||
122 | + + "wxorder_order.pay_time,wxorder_order.channel_remark,wxorder_order.customer_remark,wxorder_order.buyer_remark," | ||
123 | + + "wxorder_order.express_name, wxorder_order.latest_distribute_time, " | ||
124 | + + "(select group_concat(wxorder_order_express.express_number) from wxorder_order_express where wxorder_order_express.order_goods_id = wxorder_order_goods.id and wxorder_order_express.tenant_id=16)as express_number,wxorder_order.action_from," | ||
125 | + + "wxorder_order_goods.goods_name,wxorder_order_goods.sku_name,wxorder_order_goods.goods_number," | ||
126 | + + "wxorder_order_goods.goods_code goodsCode,wxorder_order_goods.sku_code skuCode," | ||
127 | + + "wxorder_order_goods.`goods_base_sku_price` AS goodsBasePrice," | ||
128 | + + "`wxorder_order_goods`.`goods_base_sku_price`*`wxorder_order_goods`.`goods_number` AS basicPrice," | ||
129 | + + "`wxorder_order_goods`.`refund_money`,`wxorder_order_goods`.`shipping_price`," | ||
130 | + + "CONCAT(wxorder_order.province_name,wxorder_order.city_name,wxorder_order.district_name," | ||
131 | + + "wxorder_order.address) detailAddress,wxorder_ware.NAME 'wareName',wxorder_channel.NAME 'channelName'," | ||
132 | + + "wxorder_channel.manager_nickname 'managerNickname',wxorder_channel.wx_group_nickname 'wxGroupNickname'," | ||
133 | + + "wxorder_order.operate_refund_time refundTime,wxorder_channel.id 'channelId',wxorder_order_goods.channel_goods_price as channelGoodsPrice,wxorder_order.customer_network_name as customerNetworkName, " | ||
134 | + + "(SELECT group_concat(distinct(delivery_sn)) from wxorder_order_distribute_log odl where wxorder_order.id=odl.order_id and wxorder_order_goods.id=odl.order_goods_id and odl.tenant_id=16) delivery_sn_list "; | ||
135 | + sql += " FROM wxorder_order wxorder_order " | ||
136 | + + " INNER JOIN wxorder_channel wxorder_channel ON wxorder_order.channel_id = wxorder_channel.id and wxorder_order.tenant_id=16" | ||
137 | + + " INNER JOIN wxorder_ware wxorder_ware ON wxorder_order.ware_id= wxorder_ware.id " | ||
138 | + + " INNER JOIN wxorder_order_goods wxorder_order_goods ON wxorder_order.id = wxorder_order_goods.order_id and wxorder_order_goods.tenant_id=16" | ||
139 | + + " INNER JOIN wxorder_goods_base_sku wxorder_goods_base_sku ON wxorder_goods_base_sku.id = wxorder_order_goods.goods_sku_id "; | ||
140 | + sql += " WHERE wxorder_order.id in (208925) "; | ||
141 | + System.out.println(jdbcTemplateWrapperTenant.queryForList(sql, 16L)); | ||
142 | + } | ||
143 | + | ||
144 | + private static void testDeliveryExpressNumber() { | ||
145 | + String sql = " SELECT " | ||
146 | + + " wxorder_goods_base_sku.sku_unit_num as skuUnitNum , " | ||
147 | + + " wxorder_goods_base_sku.unit, " | ||
148 | + + " wxorder_order.order_sn, " | ||
149 | + + " wxorder_order.customer_network_name, " | ||
150 | + + " wxorder_order.upload_sn, " | ||
151 | + + " wxorder_order.control_status, " | ||
152 | + + " wxorder_order.progress_delivery, " | ||
153 | + + " wxorder_order.consignee, " | ||
154 | + + " wxorder_order.mobile, " | ||
155 | + + " wxorder_order.province_name, " | ||
156 | + + " wxorder_order.city_name," | ||
157 | + + " wxorder_order.district_name, " | ||
158 | + + " wxorder_order.address, " | ||
159 | + + " wxorder_order.sender_name, " | ||
160 | + + " wxorder_order.sender_mobile, " | ||
161 | + + " wxorder_channel.sender_man," | ||
162 | + + " wxorder_channel.sender_phone, " | ||
163 | + + " wxorder_ware.sender_man, " | ||
164 | + + " wxorder_ware.sender_phone, " | ||
165 | + + " wxorder_order.real_delivery_time, " | ||
166 | + + " wxorder_order.expect_delivery_time, " | ||
167 | + + " wxorder_order.create_time, " | ||
168 | + + " wxorder_order.pay_time, " | ||
169 | + + " wxorder_order.channel_remark, " | ||
170 | + + " wxorder_order.customer_remark, " | ||
171 | + + " wxorder_order.buyer_remark, " | ||
172 | + + " wxorder_order.express_name, " | ||
173 | + + " wxorder_order.action_from, " | ||
174 | + + " wxorder_order.latest_distribute_time, " | ||
175 | + //+ " IF(wxorder_order_goods.goods_name= wxorder_order_goods.sku_name,(concat(wxorder_order_goods.goods_name, '*', wxorder_order_goods.goods_number)),(concat(wxorder_order_goods.goods_name, '(', wxorder_order_goods.sku_name, ')', '*', wxorder_order_goods.goods_number))) groupGoodsDetail, " | ||
176 | + + " IF(wxorder_order_goods.goods_name= wxorder_order_goods.sku_name,wxorder_order_goods.goods_name,(concat(wxorder_order_goods.goods_name, '(', wxorder_order_goods.sku_name, ')'))) groupGoodsDetail, " | ||
177 | + + " wxorder_order_goods.goods_code goodsCode, " | ||
178 | + + " wxorder_order_goods.sku_code skuCode, " | ||
179 | + + " wxorder_order_goods.goods_number orderGoodsNumber, " | ||
180 | + + " wxorder_order_goods.channel_goods_name," | ||
181 | + + " CONCAT(wxorder_order.province_name, wxorder_order.city_name, wxorder_order.district_name, wxorder_order.address) detailAddress, " | ||
182 | + + " wxorder_ware.name 'wareName', " | ||
183 | + + " wxorder_channel.name 'channelName', " | ||
184 | + + " wxorder_channel.manager_nickname 'managerNickname', " | ||
185 | + + " wxorder_channel.wx_group_nickname 'wxGroupNickname', " | ||
186 | + + " wxorder_order.operate_refund_time refundTime, " | ||
187 | + + " wxorder_channel.id 'channelId' ," | ||
188 | + + " wxorder_order_goods.id order_goods_id, " | ||
189 | + + " (SELECT group_concat(distinct(delivery_sn)) from wxorder_order_distribute_log odl where wxorder_order.id=odl.order_id and wxorder_order_goods.id=odl.order_goods_id and odl.tenant_id=16) delivery_sn_list "; | ||
190 | + sql += " FROM wxorder_order wxorder_order " | ||
191 | + + " INNER JOIN wxorder_channel wxorder_channel ON wxorder_order.channel_id = wxorder_channel.id and wxorder_order.tenant_id=16" | ||
192 | + + " INNER JOIN wxorder_ware wxorder_ware ON wxorder_order.ware_id= wxorder_ware.id " | ||
193 | + + " INNER JOIN wxorder_order_goods wxorder_order_goods ON wxorder_order.id = wxorder_order_goods.order_id and wxorder_order_goods.tenant_id=16" | ||
194 | + + " INNER JOIN wxorder_goods_base_sku wxorder_goods_base_sku ON wxorder_goods_base_sku.id = wxorder_order_goods.goods_sku_id "; | ||
195 | + sql += " WHERE wxorder_order.id in (208925) "; | ||
196 | + System.out.println(jdbcTemplateWrapperTenant.queryForList(sql, 16L)); | ||
197 | + } | ||
198 | + | ||
199 | + private static void testSelectSqlForDeliveryExcel() { | ||
200 | + String sql = " SELECT IFNULL((select GROUP_CONCAT(wxorder_order_express.express_number) from wxorder_order_express AS wxorder_order_express where wxorder_order_express.order_id=wxorder_order.id and wxorder_order_express.tenant_id=16), '') AS express_number," | ||
201 | + + " wxorder_order.order_sn, wxorder_order.upload_sn, wxorder_order.customer_network_name, " | ||
202 | + + " wxorder_order.control_status, wxorder_order.progress_delivery, " | ||
203 | + + " wxorder_order.consignee, wxorder_order.mobile, wxorder_order.province_name, wxorder_order.city_name, wxorder_order.district_name, wxorder_order.address, " | ||
204 | + + " wxorder_order.sender_name, wxorder_order.sender_mobile, wxorder_channel.sender_man, wxorder_channel.sender_phone, wxorder_ware.sender_man, wxorder_ware.sender_phone, " | ||
205 | + + " wxorder_order.real_delivery_time, wxorder_order.expect_delivery_time, wxorder_order.create_time, wxorder_order.pay_time, " | ||
206 | + + " wxorder_order.channel_remark, wxorder_order.customer_remark,wxorder_order.buyer_remark, " | ||
207 | + + " wxorder_order.express_name, wxorder_order.action_from, wxorder_order.latest_distribute_time,wxorder_order_goods.channel_goods_name , " | ||
208 | + + " IF(wxorder_order_goods.goods_name=wxorder_order_goods.sku_name,group_concat(concat(wxorder_order_goods.goods_name,'*',wxorder_order_goods.goods_number) SEPARATOR '; '),group_concat(concat(wxorder_order_goods.goods_name,'(',wxorder_order_goods.sku_name,')','*',wxorder_order_goods.goods_number) SEPARATOR '; ')) groupGoodsDetail,GROUP_CONCAT(wxorder_order_goods.goods_code SEPARATOR '; ') goodsCode, " | ||
209 | + | ||
210 | + + " GROUP_CONCAT(wxorder_goods_base_sku.sku_unit_num SEPARATOR '; ') skuUnitNum, " | ||
211 | + + " GROUP_CONCAT(wxorder_goods_base_sku.unit SEPARATOR '; ') unit, " | ||
212 | + | ||
213 | + + " GROUP_CONCAT(wxorder_order_goods.sku_code SEPARATOR '; ') skuCode, " | ||
214 | + + " (SELECT group_concat(distinct(delivery_sn)) from wxorder_order_distribute_log odl where wxorder_order.id=odl.order_id and odl.tenant_id=16) delivery_sn_list, " | ||
215 | + + " sum(wxorder_order_goods.goods_number) sumGoodsNumber, " | ||
216 | + + " CONCAT(wxorder_order.province_name,wxorder_order.city_name, wxorder_order.district_name,wxorder_order.address) detailAddress, " | ||
217 | + + " wxorder_ware.name 'wareName', wxorder_channel.name 'channelName' ,wxorder_channel.manager_nickname 'managerNickname',wxorder_channel.wx_group_nickname 'wxGroupNickname' ," | ||
218 | + + " wxorder_order.operate_refund_time refundTime, " | ||
219 | + + " wxorder_channel.id 'channelId' "; | ||
220 | + sql += " FROM wxorder_order wxorder_order " | ||
221 | + + " INNER JOIN wxorder_channel wxorder_channel ON wxorder_order.channel_id=wxorder_channel.id and wxorder_order.tenant_id=16" | ||
222 | + + " INNER JOIN wxorder_ware wxorder_ware ON wxorder_order.ware_id=wxorder_ware.id and wxorder_ware.tenant_id=16" | ||
223 | + + " INNER JOIN wxorder_order_goods wxorder_order_goods ON wxorder_order.id=wxorder_order_goods.order_id and wxorder_order_goods.tenant_id=16" | ||
224 | + + " INNER JOIN wxorder_goods_base_sku wxorder_goods_base_sku ON wxorder_goods_base_sku.id=wxorder_order_goods.goods_sku_id "; | ||
225 | + sql += " WHERE wxorder_order.id in (208925) and wxorder_order.tenant_id=16"; | ||
226 | + System.out.println(jdbcTemplateWrapperTenant.queryForList(sql, 16L)); | ||
227 | + } | ||
228 | + | ||
229 | + private static void testRefundCoreSqlForOrderList() { | ||
230 | + String selectSql = " SELECT wxorder_order.refund_way refundWay,wxorder_order.refund_delivery_sn refundDeliverySn, " | ||
231 | + + "(SELECT sum(wxorder_compensate.`ware_refund_money`) from `wxorder_compensate` where wxorder_compensate.`order_id` = wxorder_order.id) as wareRefundMoney," | ||
232 | + + "(SELECT sum(wxorder_compensate.`refund_money`) from `wxorder_compensate` where wxorder_compensate.`order_id` = wxorder_order.id) as refundMoney, " | ||
233 | + + " wxorder_order.operate_refund_time applyCompensateTime,wxorder_order.refund_instructions refundInstructions, wxorder_order.channel_id channelId, wxorder_channel.name channelName, wxorder_channel.platform_code platformCode, " | ||
234 | + + " wxorder_order.pre_control_status as refundPreStatus, wxorder_order.ware_id wareId, wxorder_ware.name wareName, " | ||
235 | + + " wxorder_order.id, wxorder_order.order_sn orderSn, wxorder_order.upload_sn uploadSn, wxorder_order.money_paid moneyPaid, " | ||
236 | + + " wxorder_order.consignee, wxorder_order.mobile, wxorder_order.province_name provinceName, wxorder_order.city_name cityName, wxorder_order.district_name districtName, wxorder_order.address, " | ||
237 | + + " wxorder_order.channel_remark channelRemark, wxorder_order.customer_remark customerRemark, wxorder_order.platform_customer_remark platformCustomerRemark, " | ||
238 | + + " wxorder_order.sender_name senderName, wxorder_order.sender_mobile senderMobile, " | ||
239 | + + " date_format(wxorder_order.create_time, '%Y-%m-%d %H:%i:%s') createTime, date_format(wxorder_order.real_delivery_time, '%Y-%m-%d %H:%i:%s') realDeliveryTime, " | ||
240 | + + " wxorder_order.progress_distribute progressDistribute, wxorder_order.progress_delivery progressDelivery, wxorder_order.control_status controlStatus, " | ||
241 | + + " wxorder_order.express_name expressName, wxorder_order.express_number expressNumber,wxorder_order.shipping_price shippingPrice," | ||
242 | + + " wxorder_order.customer_network_name ," | ||
243 | + + "(select count(*) from wxorder_compensate WHERE wxorder_compensate.order_id = wxorder_order.id) as compensateCountAll," | ||
244 | + + "(select count(*) from wxorder_compensate WHERE wxorder_compensate.order_id = wxorder_order.id and wxorder_compensate.progress_status =2) as compensateCountDealed ," | ||
245 | + + "(select count(*) from wxorder_channel_refund_payment where wxorder_channel_refund_payment.order_id = wxorder_order.id) as channelRefundPaymentStatus," | ||
246 | + + "(select count(*) from wxorder_ware_refund_payment where wxorder_ware_refund_payment.order_id = wxorder_order.id) as wareRefundPaymentStatus "; | ||
247 | + String whereSql = " WHERE wxorder_order.id=208925 "; | ||
248 | + String fromSql = " FROM wxorder_order wxorder_order " | ||
249 | + + " INNER JOIN wxorder_channel wxorder_channel ON wxorder_order.channel_id=wxorder_channel.id and wxorder_channel.tenant_id=16 and wxorder_order.tenant_id=16" | ||
250 | + + " INNER JOIN wxorder_ware wxorder_ware ON wxorder_order.ware_id=wxorder_ware.id and wxorder_ware.tenant_id=16" | ||
251 | + + " INNER JOIN wxorder_order_goods wxorder_order_goods ON wxorder_order.id=wxorder_order_goods.order_id and wxorder_order_goods.tenant_id=16"; | ||
252 | + String otherSql = " GROUP BY wxorder_order.id "; | ||
253 | + System.out.println(jdbcTemplateWrapperTenant.queryForList(selectSql+fromSql+whereSql+otherSql, 16L)); | ||
254 | + } | ||
255 | + | ||
256 | + private static void testOrderPrintExcelData() { | ||
257 | + String subQueryOrderSn = "select group_concat(wo.order_sn) " | ||
258 | + + " from wxorder_order wo inner join wxorder_order_print_list_map woplm on wo.id=woplm.order_id " | ||
259 | + + " where woplm.order_print_list_id=order_print_list.id and wo.tenant_id=16"; | ||
260 | + String selectSql = " select ("+subQueryOrderSn+") orderSnList, " | ||
261 | + + " order_print_list.consignee, order_print_list.mobile mobile, " | ||
262 | + + " order_print_list.province_name provinceName, order_print_list.city_name cityName, order_print_list.district_name districtName," | ||
263 | + + " order_print_list.address, order_print_list.channel_remark channelRemark, " | ||
264 | + + " group_concat(wxorder_order_print_list_goods.goods_name, '(', wxorder_order_print_list_goods.sku_name, '*', wxorder_order_print_list_goods.goods_number, ')') groupConcatGoods, " | ||
265 | + + " sum(wxorder_order_print_list_goods.goods_number) sumGoodsNumber, " | ||
266 | + + " order_print_list.print_num printNum, order_print_list.print_task_id printTaskId, order_print_list.print_count printCount, " | ||
267 | + + " order_print_list.status, order_print_list.waybill_code waybillCode, " | ||
268 | + + " order_print_list.express_name expressName, order_print_list.create_time createTime, order_print_list.update_time updateTime, order_print_list.print_latest_time printLatestTime, " | ||
269 | + + " order_print_list.template_url templateUrl, order_print_list.print_area_url printAreaUrl, " | ||
270 | + + " ware.name wareName, channel.name channelName, channel.wx_group_nickname wxGroupNickname, channel.manager_nickname managerNickname "; | ||
271 | + String fromSql = " from wxorder_order_print_list order_print_list" | ||
272 | + + " inner join wxorder_ware ware on order_print_list.ware_id=ware.id " | ||
273 | + + " inner join wxorder_channel channel on order_print_list.channel_id=channel.id" | ||
274 | + + " left join wxorder_order_print_list_goods on wxorder_order_print_list_goods.order_print_list_id = order_print_list.id"; | ||
275 | + String whereSql = " WHERE order_print_list.id in(467) "; | ||
276 | + String otherSql = " GROUP BY order_print_list.id "; | ||
277 | + | ||
278 | + System.out.println(jdbcTemplateWrapperTenant.queryForList(selectSql+fromSql+whereSql+otherSql, 16L)); | ||
279 | + } | ||
280 | + | ||
281 | + private static void testWeekOrderInfoExcelData() { | ||
282 | + String sql = " SELECT wo.customer_network_name as customerNetworkName,wo.order_sn AS orderSn,wo.consignee AS consignee,wo.mobile AS mobile, wog.`goods_name` AS goodsName, wog.`sku_name` AS skuName, wog.`goods_number` AS saleNumber, " | ||
283 | + + " concat(wo.province_name,wo.city_name,wo.district_name,wo.address) AS receiveAddress," | ||
284 | + + " ww.name as wareName, ww.manager_nickname as wareManager, " | ||
285 | + + " ifnull((select GROUP_CONCAT(wxorder_order_express.express_number separator ';') from wxorder_order_express AS wxorder_order_express where wxorder_order_express.order_id=wo.id and wxorder_order_express.tenant_id=16),0) AS expressNumber, " | ||
286 | + + " wc.name as channelName, " | ||
287 | + + " wog.goods_base_sku_price as costSinglePrice, " | ||
288 | + + " wc.manager_nickname as channelManager, " | ||
289 | + + " (wog.money_paid-wog.refund_money ) AS shouldReceiveMoney, " | ||
290 | + + " (wog.refund_money ) AS channelRefund, " | ||
291 | + + " (wog.ware_refund_money ) AS wareRefund, " | ||
292 | + + " ( wog.goods_base_sku_price*wog.goods_number+wog.ware_shipping_price ) AS cost, " | ||
293 | + + " wog.channel_goods_price as channelGoodsPrice, " | ||
294 | + + " wog.money_paid as moneyPaid, " | ||
295 | + + " wo.create_time as orderTime " | ||
296 | + + " FROM `wxorder_order` wo " | ||
297 | + + " INNER JOIN `wxorder_order_goods_origin` wog ON wo.id = wog.`order_id` and wo.tenant_id=16 and wog.tenant_id=16" | ||
298 | + + " INNER JOIN wxorder_channel as wc on wc.id = wo.channel_id " | ||
299 | + + " INNER JOIN wxorder_ware as ww on ww.id=wo.ware_id " | ||
300 | + + " INNER JOIN wxorder_channel_goods as wcg on wcg.id = wog.channel_goods_id " | ||
301 | + + " where wo.id=208925 ORDER BY saleNumber DESC "; | ||
302 | + System.out.println(jdbcTemplateWrapperTenant.queryForList(sql, 16L)); | ||
303 | + } | ||
304 | + | ||
305 | + private static void testDayOrderInfoAPI() { | ||
306 | + String sql = "SELECT wo.customer_network_name as customerNetworkName,wo.order_sn AS orderSn, wog.`goods_name` AS goodsName, wog.`sku_name` AS skuName, wog.`goods_number` AS saleNumber," | ||
307 | + // woe.order_goods_id woe.order_goods_origin_id | ||
308 | + + " ifnull((SELECT sum(woe.`goods_number`) from `wxorder_order_express` as woe WHERE woe.order_goods_id = wog.id and woe.tenant_id=16),0) as deliveryGoodsNumber, " | ||
309 | + + " ww.name as wareName, ww.manager_nickname as wareManager, " | ||
310 | + + " wc.name as channelName, " | ||
311 | + + " wog.goods_base_sku_price as costSinglePrice, " | ||
312 | + + " wc.manager_nickname as channelManager," | ||
313 | + + " (wog.money_paid-wog.refund_money) AS shouldReceiveMoney, " | ||
314 | + + " wog.refund_money AS channelRefund, " | ||
315 | + + " wog.ware_refund_money AS wareRefund, " | ||
316 | + + " (wog.goods_base_sku_price*wog.goods_number+wog.ware_shipping_price) AS cost, " | ||
317 | + + " wog.channel_goods_price as channelGoodsPrice, " | ||
318 | + + " wog.money_paid as moneyPaid, " | ||
319 | + + " wo.create_time as orderTime " | ||
320 | + + " FROM `wxorder_order` wo " | ||
321 | + + " INNER JOIN `wxorder_order_goods_origin` wog ON wo.id = wog.`order_id` and wo.tenant_id=16 and wog.tenant_id=16" | ||
322 | + + " INNER JOIN wxorder_channel as wc on wc.id = wo.channel_id " | ||
323 | + + " INNER JOIN wxorder_ware as ww on ww.id=wo.ware_id " | ||
324 | + + " INNER JOIN wxorder_channel_goods as wcg on wcg.id = wog.channel_goods_id " | ||
325 | + + " where wo.id=208925 "; | ||
326 | + System.out.println(jdbcTemplateWrapperTenant.queryForList(sql, 16L)); | ||
327 | + } | ||
328 | + | ||
329 | + private static void testDayOrderInfoExcelData() { | ||
330 | + String sql = "SELECT wo.customer_network_name as customerNetworkName,wo.order_sn AS orderSn, wog.`goods_name` AS goodsName, wog.`sku_name` AS skuName, wog.`goods_number` AS saleNumber," | ||
331 | + + " (SELECT sum(woe.`goods_number`) from `wxorder_order_express` as woe WHERE woe.order_goods_id = wog.id and woe.tenant_id=16)as deliveryGoodsNumber, " | ||
332 | + + " ww.name as wareName, ww.manager_nickname as wareManager, " | ||
333 | + + " wc.name as channelName, " | ||
334 | + + " wog.goods_base_sku_price as costSinglePrice, " | ||
335 | + + " wc.manager_nickname as channelManager," | ||
336 | + + " (wog.money_paid-wog.refund_money) AS shouldReceiveMoney, " | ||
337 | + + " wog.refund_money AS channelRefund, " | ||
338 | + + " wog.ware_refund_money AS wareRefund, " | ||
339 | + + " (wog.goods_base_sku_price*wog.goods_number+wog.ware_shipping_price) AS cost, " | ||
340 | + + " wog.channel_goods_price as channelGoodsPrice, " | ||
341 | + + " wog.money_paid as moneyPaid, " | ||
342 | + + " wo.create_time as orderTime " | ||
343 | + + " FROM `wxorder_order` wo " | ||
344 | + + " INNER JOIN `wxorder_order_goods` wog ON wo.id = wog.`order_id` and wo.tenant_id=16 and wog.tenant_id=16 " | ||
345 | + + " INNER JOIN wxorder_ware as ww on ww.id = wo.ware_id " | ||
346 | + + " INNER JOIN wxorder_channel as wc on wc.id = wo.channel_id " | ||
347 | + + " INNER JOIN wxorder_channel_goods as wcg on wcg.id = wog.channel_goods_id " | ||
348 | + + " where wo.id=208925 "; | ||
349 | + System.out.println(jdbcTemplateWrapperTenant.queryForList(sql, 16L)); | ||
350 | + } | ||
351 | + | ||
352 | + private static void testTenantWithRootUser() { | ||
353 | + String sql = "select tenant.id, tenant.name 'tenantName', users.id 'userId', users.mobile 'userMobile', users.type 'userType', date(tenant.create_time) 'createTime', " | ||
354 | + + " (select group_concat(agent_nickname) from wxorder_agent_ssy agent_ssy where agent_ssy.tenant_id=tenant.id) 'agentSsyAgentNickname'" | ||
355 | + + ", wv.name as versionName " | ||
356 | + + " from wxorder_tenant tenant " | ||
357 | + + " inner join wxorder_version wv on tenant.version_id=wv.id " | ||
358 | + + " inner join wxorder_user users on tenant.id=users.tenant_id " | ||
359 | + + " where 1=1 "; | ||
360 | + System.out.println(jdbcTemplateWrapperTenant.queryForList(sql, 16L)); | ||
361 | + } | ||
362 | + | ||
363 | + private static void testExportPaymentDetailData() { | ||
364 | + String sql = "SELECT wc.manager_nickname,cp.id as paymentId, wo.order_sn,wo.`upload_sn`,wo.consignee,wo.mobile," | ||
365 | + + " ifnull((SELECT wc.`refund_to_channel` FROM `wxorder_compensate` AS wc WHERE wc.`order_id` = cp.`order_id` LIMIT 1),0) AS refundToChannel, " | ||
366 | + + " ifnull((SELECT wc.`refund_instructions` FROM `wxorder_compensate` AS wc WHERE wc.`order_id` = cp.`order_id` LIMIT 1),'') AS refundRemark, " | ||
367 | + + " (SELECT wpb.`pay_result` from wxorder_ware_payment_batch wpb WHERE wpb.`batch_no`= cp.`pay_batch_no` ORDER BY wpb.`pay_result` asc LIMIT 1) as pay_result," | ||
368 | + + "CONCAT(wo.province_name,wo.city_name,wo.district_name,wo.address) fullAddress,wo.`progress_delivery`,wo.`real_delivery_time`," | ||
369 | + + "wo.`express_number`,wc.`name`,wc.wx_group_nickname,wog.`goods_name`,wog.`sku_name`,wog.`sku_code`," | ||
370 | + + "wog.`goods_base_sku_price`,wog.`goods_number`, wog.`goods_base_sku_price`*wog.`goods_number` as goodsMoney," | ||
371 | + + "wog.ware_shipping_price as shipping_price,wo.`customer_remark`,wo.`channel_remark`,wo.`control_status`,wog.`ware_refund_money` as refund_money, wog.ware_money_loss as moneyLoss, " | ||
372 | + + "wog.`ware_money_paid` as money_paid,wo.`pay_time`,wo.`create_time`, wo.`latest_distribute_time`, " | ||
373 | + + "cp.`deal_progress`, cp.`check_date`,cp.deal_check_date " | ||
374 | + + " FROM `wxorder_ware_payment` cp " | ||
375 | + + " INNER JOIN `wxorder_order` AS wo ON wo.`id`=cp.order_id " | ||
376 | + + " INNER JOIN `wxorder_order_goods` wog ON wog.`order_id`=wo.id " | ||
377 | + + " INNER JOIN `wxorder_ware` wc ON wc.`id`=wo.`ware_id` " | ||
378 | + + "WHERE cp.id in (30617) " | ||
379 | + + " and cp.tenant_id=16" | ||
380 | + + " and wo.tenant_id=16" | ||
381 | + + " and wog.tenant_id=16"; | ||
382 | + System.out.println(jdbcTemplateWrapperTenant.queryForList(sql, 16L)); | ||
383 | + } | ||
384 | + | ||
385 | + private static void testWarePaymentSelectSql() { | ||
386 | + String sql = " select wxorder_ware_payment.id as id,wxorder_ware_payment.order_id as orderId,wxorder_ware_payment.deal_progress as dealProgress, " | ||
387 | + + "wxorder_ware_payment.check_date as checkDate,wxorder_ware_payment.deal_check_date as dealCheckDate, " | ||
388 | + + "wxorder_ware_payment.status_sysnotice_check as statusSysnoticeCheck,wxorder_ware_payment.tenant_id as tenantId, " | ||
389 | + + "wxorder_ware_payment.pay_batch_no as payBatchNo,wxorder_order.consignee,wxorder_order.mobile,wxorder_order.province_name as provinceName," | ||
390 | + + "wxorder_order.city_name as cityName,wxorder_order.district_name as districtName,wxorder_order.address,wxorder_order.create_time as createTime, " | ||
391 | + + "wxorder_ware_payment.update_time as updateTime,wxorder_order.order_sn as orderSn,wxorder_order.ware_money_paid as moneyPaid, " | ||
392 | + + "wxorder_order.ware_refund_money as refundMoney,wxorder_order.ware_shipping_price as shippingPrice, wxorder_order.ware_money_loss as moneyLoss, " | ||
393 | + + "wxorder_order.real_delivery_time as realDeliveryTime,wxorder_order.latest_distribute_time as latestDistributeTime,wxorder_order.progress_delivery as progressDelivery, " | ||
394 | + + "wxorder_order.pay_time as payTime,wxorder_order.control_status as controlStatus,wxorder_order.upload_sn as uploadSn, " | ||
395 | + + "(select name from wxorder_ware where id = wxorder_order.ware_id ) as wareName, " | ||
396 | + + "(SELECT settlement_type from wxorder_ware_payment_cycle WHERE `ware_id`= `wxorder_order`.`ware_id`) as settlementType, " | ||
397 | + + "IF(`wxorder_ware_payment`.`deal_progress`!= 2, 0, (select FLOOR(sum(pay_result)/count(*)) from `wxorder_ware_payment_batch` WHERE wxorder_ware_payment_batch.batch_no= wxorder_ware_payment.`pay_batch_no`)) as payResult "; | ||
398 | + sql += " FROM wxorder_ware_payment" | ||
399 | + + " inner join wxorder_order on wxorder_ware_payment.order_id = wxorder_order.id and wxorder_ware_payment.tenant_id=16 and wxorder_order.tenant_id=16 " | ||
400 | + + " limit 5; "; | ||
401 | + System.out.println(jdbcTemplateWrapperTenant.queryForList(sql, 16L)); | ||
402 | + } | ||
403 | + | ||
34 | private static void testSelectShardingSubQuery() { | 404 | private static void testSelectShardingSubQuery() { |
35 | String sql = " select wc.name,(select count(*) from wxorder_order where) as 'sumOrderNum' from wxorder_channel wc limit 3; "; | 405 | String sql = " select wc.name,(select count(*) from wxorder_order where) as 'sumOrderNum' from wxorder_channel wc limit 3; "; |
36 | } | 406 | } |
src/test/resources/application.properties
@@ -13,7 +13,7 @@ spring.gson.serialize-nulls=true | @@ -13,7 +13,7 @@ spring.gson.serialize-nulls=true | ||
13 | spring.mvc.dispatch-options-request=true | 13 | spring.mvc.dispatch-options-request=true |
14 | 14 | ||
15 | # shardingspere | 15 | # shardingspere |
16 | -spring.shardingsphere.datasource.names=ds1 | 16 | +spring.shardingsphere.datasource.names=ds0 |
17 | spring.shardingsphere.datasource.common.type=com.alibaba.druid.pool.DruidDataSource | 17 | spring.shardingsphere.datasource.common.type=com.alibaba.druid.pool.DruidDataSource |
18 | spring.shardingsphere.datasource.common.driver-class-name=com.mysql.cj.jdbc.Driver | 18 | spring.shardingsphere.datasource.common.driver-class-name=com.mysql.cj.jdbc.Driver |
19 | spring.shardingsphere.datasource.ds0.url=jdbc:mysql://rdsifmezqifmezqo.mysql.rds.aliyuncs.com:3306/bzyun_wxorder?characterEncoding=UTF-8 | 19 | spring.shardingsphere.datasource.ds0.url=jdbc:mysql://rdsifmezqifmezqo.mysql.rds.aliyuncs.com:3306/bzyun_wxorder?characterEncoding=UTF-8 |
@@ -32,16 +32,16 @@ spring.shardingsphere.datasource.ds1.max-active=20 | @@ -32,16 +32,16 @@ spring.shardingsphere.datasource.ds1.max-active=20 | ||
32 | spring.shardingsphere.datasource.ds1.min-idle=5 | 32 | spring.shardingsphere.datasource.ds1.min-idle=5 |
33 | spring.shardingsphere.datasource.ds1.max-wait=60000 | 33 | spring.shardingsphere.datasource.ds1.max-wait=60000 |
34 | 34 | ||
35 | -spring.shardingsphere.rules.sharding.tables.wxorder_order.actual-data-nodes=ds0.wxorder_order | ||
36 | -spring.shardingsphere.rules.sharding.tables.wxorder_order.database-strategy.hint.database_hint.sharding-algorithm-name=database_hint | ||
37 | -spring.shardingsphere.rules.sharding.tables.wxorder_order.table-strategy.hint.table_hint.sharding-algorithm-name=table_hint | ||
38 | -spring.shardingsphere.rules.sharding.tables.wxorder_order.key-generate-strategy.column=id | ||
39 | -spring.shardingsphere.rules.sharding.tables.wxorder_order.key-generate-strategy.key-generator-name=SNOWFLAKE-SELF | 35 | +#spring.shardingsphere.rules.sharding.tables.wxorder_order.actual-data-nodes=ds0.wxorder_order |
36 | +#spring.shardingsphere.rules.sharding.tables.wxorder_order.database-strategy.hint.database_hint.sharding-algorithm-name=database_hint | ||
37 | +#spring.shardingsphere.rules.sharding.tables.wxorder_order.table-strategy.hint.table_hint.sharding-algorithm-name=table_hint | ||
38 | +#spring.shardingsphere.rules.sharding.tables.wxorder_order.key-generate-strategy.column=id | ||
39 | +#spring.shardingsphere.rules.sharding.tables.wxorder_order.key-generate-strategy.key-generator-name=SNOWFLAKE-SELF | ||
40 | 40 | ||
41 | -spring.shardingsphere.rules.sharding.sharding-algorithms.database_hint.type=HINT | ||
42 | -spring.shardingsphere.rules.sharding.sharding-algorithms.database_hint.algorithm-class-name=com.taover.repository.shardingsphere.ShardingDatabaseAlgorithmHint | ||
43 | -spring.shardingsphere.rules.sharding.sharding-algorithms.table_hint.type=HINT | ||
44 | -spring.shardingsphere.rules.sharding.sharding-algorithms.table_hint.algorithm-class-name=com.taover.repository.shardingsphere.ShardingTableAlgorithmHint | 41 | +#spring.shardingsphere.rules.sharding.sharding-algorithms.database_hint.type=HINT |
42 | +#spring.shardingsphere.rules.sharding.sharding-algorithms.database_hint.algorithm-class-name=com.taover.repository.shardingsphere.ShardingDatabaseAlgorithmHint | ||
43 | +#spring.shardingsphere.rules.sharding.sharding-algorithms.table_hint.type=HINT | ||
44 | +#spring.shardingsphere.rules.sharding.sharding-algorithms.table_hint.algorithm-class-name=com.taover.repository.shardingsphere.ShardingTableAlgorithmHint | ||
45 | 45 | ||
46 | taover.sharding.workerId=1 | 46 | taover.sharding.workerId=1 |
47 | taover.sharding.maxVibrationOffset=3 | 47 | taover.sharding.maxVibrationOffset=3 |