|
@@ -119,7 +119,7 @@ public class TOrderController {
|
|
|
//0,线上 -》 国内
|
|
|
if (type.equals("0")) {
|
|
|
LambdaQueryWrapper<TOrder> query = Wrappers.lambdaQuery();
|
|
|
- if (!username.equals("admin")) {
|
|
|
+ if (!username.equals("sysMgtAcc")) {
|
|
|
if (StringUtils.isNotEmpty(username)) {
|
|
|
ResponseModel<TAdmin> adminByUsername = szwlFeign.getAdminByUsername(username);
|
|
|
TAdmin data = adminByUsername.getData();
|
|
@@ -367,7 +367,7 @@ public class TOrderController {
|
|
|
//1,海外
|
|
|
if (type.equals("1")) {
|
|
|
LambdaQueryWrapper<TCoinOrder> query = Wrappers.lambdaQuery();
|
|
|
- if (!username.equals("admin")) {
|
|
|
+ if (!username.equals("sysMgtAcc")) {
|
|
|
// 如果为账户
|
|
|
if (admin.getType() > 2) {
|
|
|
username = null;
|
|
@@ -1432,7 +1432,7 @@ public class TOrderController {
|
|
|
//0,线上
|
|
|
if (type.equals("0")) {
|
|
|
LambdaQueryWrapper<TOrder> query = Wrappers.lambdaQuery();
|
|
|
- if (!userName.equals("admin")) {
|
|
|
+ if (!userName.equals("sysMgtAcc")) {
|
|
|
if (StringUtils.isNotEmpty(userName)) {
|
|
|
ResponseModel<TAdmin> adminByUsername = szwlFeign.getAdminByUsername(userName);
|
|
|
TAdmin data = adminByUsername.getData();
|
|
@@ -1608,7 +1608,7 @@ public class TOrderController {
|
|
|
//1,线下
|
|
|
if (type.equals("1")) {
|
|
|
LambdaQueryWrapper<TCoinOrder> query = Wrappers.lambdaQuery();
|
|
|
- if (!userName.equals("admin")) {
|
|
|
+ if (!userName.equals("sysMgtAcc")) {
|
|
|
// 如果为账户
|
|
|
if (admin.getType() > 2) {
|
|
|
userName = null;
|
|
@@ -1766,211 +1766,6 @@ public class TOrderController {
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
-// LambdaQueryWrapper<TOrder> query = Wrappers.lambdaQuery();
|
|
|
-// if (!orderDto.getUserName().equals("admin")) {
|
|
|
-// if (StringUtils.isNotEmpty(orderDto.getUserName())) {
|
|
|
-// TAdmin data = R.getDataIfSuccess(szwlFeign.getAdminByUsername(orderDto.getUserName()));
|
|
|
-// if (data == null || data.getId() == null) {
|
|
|
-// return;
|
|
|
-// }
|
|
|
-// if (data.getIsAdmined()) {
|
|
|
-// query.eq(TOrder::getAdminId, data.getId());
|
|
|
-// } else {
|
|
|
-// if (data.getParentId() != 1) {
|
|
|
-// query.eq(TOrder::getAdminId, data.getParentId());
|
|
|
-// //查找子账户所管理的机器
|
|
|
-// TAdminEquipment adminEquipment = R.getDataIfSuccess(szwlFeign.getClientIdList(orderDto.getAdminId()));
|
|
|
-// if (!adminEquipment.getType().equals("0")) {
|
|
|
-// List<String> list = R.getDataIfSuccess(szwlFeign.getClientIds(orderDto.getAdminId()));
|
|
|
-// if (list == null || list.size() == 0) {
|
|
|
-// return;
|
|
|
-// }
|
|
|
-// query.in(TOrder::getClientId, list);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// } else {
|
|
|
-// //adminType="all"时,代表查全部下级 子账户没有这个权限 公司人员默认查所有人
|
|
|
-// if (StringUtils.isNotEmpty(orderDto.getAdminType())) {
|
|
|
-// if (admin.getIsAdmined() && admin.getType() > 1) {
|
|
|
-// if (admin.getType() > 1) {
|
|
|
-// if (orderDto.getAdminType().equals("all")) {
|
|
|
-// //查找所有下级
|
|
|
-// List<Long> admidIdList = R.getDataIfSuccess(szwlFeign.getAdminIdList(orderDto.getAdminId()));
|
|
|
-// query.in(TOrder::getAdminId, admidIdList);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// } else {
|
|
|
-// if (admin.getType() > 1) {
|
|
|
-// //登录账户为子账户 不查下级 只查对应机器的订单
|
|
|
-// TAdminEquipment adminEquipment = R.getDataIfSuccess(szwlFeign.getClientIdList(String.valueOf(admin.getParentId())));
|
|
|
-// if (adminEquipment.getType().equals("0")) {
|
|
|
-// //全部机器
|
|
|
-// TAdmin upAdmin = R.getDataIfSuccess(szwlFeign.getAdmin(String.valueOf(admin.getParentId())));
|
|
|
-// query.eq(TOrder::getAdminId, upAdmin.getId());
|
|
|
-// } else {
|
|
|
-// String equipmentIds = adminEquipment.getEquipmentIds();
|
|
|
-// List<String> equipmentIdList = JSON.parseArray(equipmentIds, String.class);
|
|
|
-// query.in(TOrder::getClientId, equipmentIdList);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// } else {
|
|
|
-// //判断当前账号状态 公司还是商家
|
|
|
-// if (admin.getType() > 1) {
|
|
|
-// //商家 判断是否子账户
|
|
|
-// if (admin.getIsAdmined()) {
|
|
|
-// //商家自己
|
|
|
-// query.eq(TOrder::getAdminId, orderDto.getAdminId());
|
|
|
-// } else {
|
|
|
-// //商家 子账户
|
|
|
-// //登录账户为子账户 不查下级 只查对应机器的订单
|
|
|
-// TAdminEquipment adminEquipment = R.getDataIfSuccess(szwlFeign.getClientIdList(String.valueOf(admin.getParentId())));
|
|
|
-// if (adminEquipment.getType().equals("0")) {
|
|
|
-// //全部机器
|
|
|
-// TAdmin upAdmin = R.getDataIfSuccess(szwlFeign.getAdmin(String.valueOf(admin.getParentId())));
|
|
|
-// query.eq(TOrder::getAdminId, upAdmin.getId());
|
|
|
-// } else {
|
|
|
-// String equipmentIds = adminEquipment.getEquipmentIds();
|
|
|
-// List<String> equipmentIdList = JSON.parseArray(equipmentIds, String.class);
|
|
|
-// query.in(TOrder::getClientId, equipmentIdList);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// if (StringUtils.isNotEmpty(orderDto.getPayType())) {
|
|
|
-// query.eq(TOrder::getFrpCode, orderDto.getPayType());
|
|
|
-// }
|
|
|
-// if (StringUtils.isNotEmpty(orderDto.getClientId())) {
|
|
|
-// TEquipment equipment = R.getDataIfSuccess(szwlFeign.findEquipmentByClientId(orderDto.getClientId()));
|
|
|
-// //判断机器是否属于这个登陆账号
|
|
|
-// if (admin.getType() > 1) {
|
|
|
-// //商家
|
|
|
-// if (equipment.getAdminId().toString().equals(admin.getId().toString())) {
|
|
|
-// query.eq(TOrder::getEquipmentId, equipment.getId());
|
|
|
-// }
|
|
|
-// } else {
|
|
|
-// query.eq(TOrder::getEquipmentId, equipment.getId());
|
|
|
-// }
|
|
|
-// }
|
|
|
-// if (StringUtils.isNotEmpty(orderDto.getEquipmentId())) {
|
|
|
-// query.eq(TOrder::getEquipmentId, orderDto.getEquipmentId());
|
|
|
-// }
|
|
|
-// if (StringUtils.isNotEmpty(orderDto.getStatus())) {
|
|
|
-// query.eq(TOrder::getStatus, orderDto.getStatus());
|
|
|
-// }
|
|
|
-// if (StringUtils.isNotEmpty(orderDto.getDateType())) {
|
|
|
-// if (orderDto.getDateType().equals("0")) {
|
|
|
-// //创建时间
|
|
|
-// if (begin != null && end != null) {
|
|
|
-// query.gt(TOrder::getCreateDate, begin);
|
|
|
-// query.lt(TOrder::getCreateDate, end);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// if (orderDto.getDateType().equals("1")) {
|
|
|
-// //退款时间
|
|
|
-// if (begin != null && end != null) {
|
|
|
-// query.gt(TOrder::getRefundDate, begin);
|
|
|
-// query.lt(TOrder::getRefundDate, end);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// // 公司平台
|
|
|
-// // 申泽平台管理员
|
|
|
-// String companyType = orderDto.getCompanyType();
|
|
|
-// if (admin.getId() == 2738) {
|
|
|
-// companyType = "0";
|
|
|
-// }
|
|
|
-// // 七云平台管理员
|
|
|
-// if (admin.getId() == 2739) {
|
|
|
-// companyType = "1";
|
|
|
-// }
|
|
|
-// if (StringUtils.isNotEmpty(companyType)) {
|
|
|
-// if (companyType.equals("0")) {
|
|
|
-// String finalCompanyType = companyType;
|
|
|
-// query.nested(q -> q.isNull(TOrder::getCompanyType).or()
|
|
|
-// .eq(TOrder::getCompanyType, finalCompanyType));
|
|
|
-// } else {
|
|
|
-// query.eq(TOrder::getCompanyType, companyType);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// String machineType = orderDto.getMachineType();
|
|
|
-// if (StringUtils.isNotEmpty(machineType)) {
|
|
|
-// if (machineType.equals("0")) {
|
|
|
-// query.nested(q -> q.isNull(TOrder::getMachineType).or()
|
|
|
-// .eq(TOrder::getMachineType, machineType));
|
|
|
-// } else {
|
|
|
-// query.eq(TOrder::getMachineType, machineType);
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// // 查询总数
|
|
|
-// total = orderService.count(query);
|
|
|
-// // 总页数
|
|
|
-// int totalPages = (total + pageSize - 1) / pageSize;
|
|
|
-// // 这里注意 有同学反应使用swagger 会导致各种问题,请直接用浏览器或者用postman
|
|
|
-// response.setContentType("application/octet-stream; charset=UTF-8");
|
|
|
-// response.setCharacterEncoding("utf-8");
|
|
|
-// // 这里URLEncoder.encode可以防止中文乱码
|
|
|
-// String fileName = URLEncoder.encode("订单记录-" + System.currentTimeMillis(), "UTF-8").replaceAll("\\+", "%20");
|
|
|
-// response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
|
|
|
-// // 创建ExcelWriter对象
|
|
|
-// ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), NewOrderTarget.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).build();
|
|
|
-// // 创建 Sheet 对象
|
|
|
-// WriteSheet writeSheet = EasyExcel.writerSheet(0, "订单").build();
|
|
|
-// // 创建 CountDownLatch 对象
|
|
|
-// CountDownLatch countDownLatch = new CountDownLatch(totalPages);
|
|
|
-// // 创建线程池
|
|
|
-// ExecutorService executorService = Executors.newFixedThreadPool(10);
|
|
|
-// // 循环写入数据
|
|
|
-// for (int i = 1; i <= totalPages; i++) {
|
|
|
-// int page = i;
|
|
|
-// executorService.submit(() -> {
|
|
|
-// try {
|
|
|
-// Page<TOrder> orderPage = new Page<>(page, pageSize);
|
|
|
-// Page<TOrder> pageList = orderService.page(orderPage, query);
|
|
|
-// List<TOrder> list = pageList.getRecords();
|
|
|
-// // 写入数据
|
|
|
-// List<NewOrderTarget> orderTargetList = orderService.exportOrderData(admin, list);
|
|
|
-// synchronized (excelWriter) {
|
|
|
-// excelWriter.write(orderTargetList, writeSheet);
|
|
|
-// }
|
|
|
-// } catch (Exception e) {
|
|
|
-// // 异常处理
|
|
|
-// e.printStackTrace();
|
|
|
-// } finally {
|
|
|
-// // 计数器减一
|
|
|
-// countDownLatch.countDown();
|
|
|
-// }
|
|
|
-// });
|
|
|
-// }
|
|
|
-// // 等待所有线程执行完毕
|
|
|
-// try {
|
|
|
-// countDownLatch.await();
|
|
|
-// } catch (InterruptedException e) {
|
|
|
-// e.printStackTrace();
|
|
|
-// }
|
|
|
-// while (hasNextPage) {
|
|
|
-// Page<TOrder> orderPage = new Page<>(pageNum, pageSize);
|
|
|
-// Page<TOrder> page = orderService.page(orderPage, query);
|
|
|
-// List<TOrder> list = page.getRecords();
|
|
|
-// if (CollectionUtils.isEmpty(list)) {
|
|
|
-// hasNextPage = false;
|
|
|
-// break;
|
|
|
-// }
|
|
|
-// // 写入数据
|
|
|
-// List<NewOrderTarget> orderTargetList = orderService.exportOrderData(admin, list);
|
|
|
-// excelWriter.write(orderTargetList, EasyExcel.writerSheet("订单").build());
|
|
|
-// // 更新起始位置
|
|
|
-// pageNum++;
|
|
|
-// }
|
|
|
- // 关闭 ExcelWriter 对象
|
|
|
-// excelWriter.finish();
|
|
|
-//
|
|
|
-// // 关闭线程池
|
|
|
-// executorService.shutdown();
|
|
|
}
|
|
|
|
|
|
//1,线下
|