|
@@ -85,7 +85,8 @@ public class TOrderController {
|
|
|
public ResponseModel<IPage<?>> pageOrder(String equipmentId, String adminId, String adminType,
|
|
|
String type, String sn, String status, String userName,
|
|
|
String payType, String productNo, String clientId,
|
|
|
- String trxNo, String dateType, String startDate, String companyType, String machineType, String endDate, long current, long size) {
|
|
|
+ String trxNo, String dateType, String startDate,
|
|
|
+ String companyType, String machineType, String endDate, long current, long size) {
|
|
|
//判断当前账号状态
|
|
|
TAdmin admin = R.getDataIfSuccess(szwlFeign.getAdmin(adminId));
|
|
|
if (StringUtils.isEmpty(type)) {
|
|
@@ -199,39 +200,23 @@ public class TOrderController {
|
|
|
if (StringUtils.isNotEmpty(status)) {
|
|
|
query.eq(TOrder::getStatus, status);
|
|
|
}
|
|
|
- // 公司平台
|
|
|
- // 申泽平台管理员
|
|
|
-// 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);
|
|
|
-// }
|
|
|
-// }
|
|
|
|
|
|
+ // 公司平台
|
|
|
// 申泽平台管理员
|
|
|
if (admin.getId() == 2738) {
|
|
|
- String finalCompanyType = "0";
|
|
|
- if (StringUtils.isNotEmpty(finalCompanyType)) {
|
|
|
- query.nested(q -> q.isNull(TOrder::getCompanyType).or()
|
|
|
- .eq(TOrder::getCompanyType, finalCompanyType));
|
|
|
- }
|
|
|
+ companyType = "0";
|
|
|
}
|
|
|
-
|
|
|
// 七云平台管理员
|
|
|
if (admin.getId() == 2739) {
|
|
|
- String finalCompanyType = "1";
|
|
|
- if (StringUtils.isNotEmpty(finalCompanyType)) {
|
|
|
- query.eq(TOrder::getCompanyType, finalCompanyType);
|
|
|
+ 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);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -316,77 +301,9 @@ public class TOrderController {
|
|
|
IPage<TOrder> iPage = orderService.page(page, query);
|
|
|
IPage<OrderDetailsVo> pageList = new Page<>();
|
|
|
//显示订单所属机器的设备名称
|
|
|
-// if(admin.getType()!=null&&admin.getType()<2){
|
|
|
-// //公司人员
|
|
|
-// List<TOrder> orderList = iPage.getRecords();
|
|
|
-// if(orderList.size()>0){
|
|
|
-// List<String> clientIds = new ArrayList<>();
|
|
|
-// for (TOrder order : orderList) {
|
|
|
-// clientIds.add(order.getClientId());
|
|
|
-// }
|
|
|
-// Map<String, String> equipmentMap = new HashMap<>();
|
|
|
-// List<TEquipment> equipmentList = R.getDataIfSuccess(szwlFeign.findEquipmentByClientIds(clientIds));
|
|
|
-// for (TEquipment equipment : equipmentList) {
|
|
|
-// equipmentMap.put(equipment.getClientId(), equipment.getName());
|
|
|
-// }
|
|
|
-// // 设置设备信息到订单中
|
|
|
-// for (TOrder order : orderList) {
|
|
|
-// String name = equipmentMap.get(order.getClientId());
|
|
|
-// if (StringUtils.isNotEmpty(name)) {
|
|
|
-// order.setEs(name);
|
|
|
-// }
|
|
|
-// }
|
|
|
-//// for(TOrder order:orderList){
|
|
|
-//// TEquipment equipment = R.getDataIfSuccess(szwlFeign.findEquipmentByClientId(order.getClientId()));
|
|
|
-//// order.setEs(equipment.getName());
|
|
|
-//// }
|
|
|
-// iPage.setRecords(orderList);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// if(admin.getType()!=null&&admin.getType()>1){
|
|
|
-// //商家
|
|
|
-// List<TOrder> orderList = iPage.getRecords();
|
|
|
-// if(orderList.size()>0){
|
|
|
-//// for(TOrder order:orderList){
|
|
|
-//// TEquipment equipment = R.getDataIfSuccess(szwlFeign.findEquipmentByClientId(order.getClientId()));
|
|
|
-//// order.setEs(equipment.getName());
|
|
|
-//// }
|
|
|
-// // 设备编号集合
|
|
|
-// List<String> clientIds = new ArrayList<>();
|
|
|
-// for (TOrder order : orderList) {
|
|
|
-// clientIds.add(order.getClientId());
|
|
|
-// }
|
|
|
-// // 设备编号名称集合
|
|
|
-// Map<String, String> equipmentMap = new HashMap<>();
|
|
|
-// // 设备编号名称集合
|
|
|
-// List<TEquipment> equipmentList = R.getDataIfSuccess(szwlFeign.findEquipmentByClientIds(clientIds));
|
|
|
-// for (TEquipment equipment : equipmentList) {
|
|
|
-// equipmentMap.put(equipment.getClientId(), equipment.getName());
|
|
|
-// }
|
|
|
-// LambdaQueryWrapper<TOrderDetails> wrapper = new LambdaQueryWrapper<>();
|
|
|
-//
|
|
|
-// // 设置设备信息到订单中
|
|
|
-// for (TOrder order : orderList) {
|
|
|
-// String name = equipmentMap.get(order.getClientId());
|
|
|
-// if (StringUtils.isNotEmpty(name)) {
|
|
|
-// order.setEs(name);
|
|
|
-// }
|
|
|
-// wrapper.in(TOrderDetails::getOrderSn,order.getSn());
|
|
|
-// List<TOrderDetails> orderDetailsList = orderDetailsService.list(wrapper);
|
|
|
-// if(orderDetailsList != null) {
|
|
|
-// order.setOrderDetails(orderDetailsList);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// iPage.setRecords(orderList);
|
|
|
-// }
|
|
|
List<TOrder> orderList = iPage.getRecords();
|
|
|
List<OrderDetailsVo> orderDetailsVos = new ArrayList<>();
|
|
|
if(orderList.size()>0){
|
|
|
-// for(TOrder order:orderList){
|
|
|
-// TEquipment equipment = R.getDataIfSuccess(szwlFeign.findEquipmentByClientId(order.getClientId()));
|
|
|
-// order.setEs(equipment.getName());
|
|
|
-// }
|
|
|
// 设备编号集合
|
|
|
List<String> clientIds = new ArrayList<>();
|
|
|
for (TOrder order : orderList) {
|
|
@@ -504,33 +421,25 @@ public class TOrderController {
|
|
|
query.eq(TCoinOrder::getProductNo, productNo);
|
|
|
}
|
|
|
|
|
|
+ // 公司平台
|
|
|
// 申泽平台管理员
|
|
|
if (admin.getId() == 2738) {
|
|
|
-// companyType = "0";
|
|
|
- String finalCompanyType = "0";
|
|
|
- if (StringUtils.isNotEmpty(finalCompanyType)) {
|
|
|
- query.nested(q -> q.isNull(TCoinOrder::getCompanyType).or()
|
|
|
- .eq(TCoinOrder::getCompanyType, finalCompanyType));
|
|
|
- }
|
|
|
+ companyType = "0";
|
|
|
}
|
|
|
// 七云平台管理员
|
|
|
if (admin.getId() == 2739) {
|
|
|
- String finalCompanyType = "1";
|
|
|
- if (StringUtils.isNotEmpty(finalCompanyType)) {
|
|
|
- query.eq(TCoinOrder::getCompanyType, finalCompanyType);
|
|
|
+ companyType = "1";
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(companyType)) {
|
|
|
+ if (companyType.equals("0")) {
|
|
|
+ String finalCompanyType = companyType;
|
|
|
+ query.nested(q -> q.isNull(TCoinOrder::getCompanyType).or()
|
|
|
+ .eq(TCoinOrder::getCompanyType, finalCompanyType));
|
|
|
+ } else {
|
|
|
+ query.eq(TCoinOrder::getCompanyType, companyType);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// if (StringUtils.isNotEmpty(companyType)) {
|
|
|
-// if (companyType.equals("0")) {
|
|
|
-// String finalCompanyType = companyType;
|
|
|
-// query.nested(q -> q.isNull(TCoinOrder::getCompanyType).or()
|
|
|
-// .eq(TCoinOrder::getCompanyType, finalCompanyType));
|
|
|
-// } else {
|
|
|
-// query.eq(TCoinOrder::getCompanyType, companyType);
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
// 棉花糖机型 + 爆米花机型
|
|
|
if (StringUtils.isNotEmpty(machineType)) {
|
|
|
if (machineType.equals("0")) {
|
|
@@ -663,7 +572,6 @@ public class TOrderController {
|
|
|
@PostMapping("/getStatistics")
|
|
|
public ResponseEntity<?> getStatistics(@RequestBody StatisticsParam param) {
|
|
|
// 判断是否为外国
|
|
|
- param.setIfForeign(isForeignUser(param.getAdminId()));
|
|
|
log.info("param:{}", param);
|
|
|
String adminId = param.getAdminId();
|
|
|
TAdmin admin = R.getDataIfSuccess(szwlFeign.getAdmin(param.getAdminId()));
|
|
@@ -690,6 +598,7 @@ public class TOrderController {
|
|
|
param.setCompanyType("1");
|
|
|
}
|
|
|
} else {
|
|
|
+ param.setIfForeign(isForeignUser(param.getAdminId()));
|
|
|
if (admin.getType() == 2) {
|
|
|
//商家
|
|
|
if (param.getEquipmentId() != null && param.getEquipmentId() != "") {
|
|
@@ -1400,78 +1309,6 @@ public class TOrderController {
|
|
|
//0,线上
|
|
|
if (type.equals("0")) {
|
|
|
LambdaQueryWrapper<TOrder> query = Wrappers.lambdaQuery();
|
|
|
-// if(StringUtils.isNotEmpty(userName)&&!userName.equals("admin")){
|
|
|
-// ResponseModel<TAdmin> adminByUsername = szwlFeign.getAdminByUsername(userName);
|
|
|
-// TAdmin data = adminByUsername.getData();
|
|
|
-// if(data==null||data.getId()==null){
|
|
|
-// return R.fail(ResponseCodesEnum.A0001,"找不到商家");
|
|
|
-// }
|
|
|
-// query.eq(TOrder::getAdminId,data.getId());
|
|
|
-// }else if(StringUtils.isEmpty(userName)){
|
|
|
-// //adminType="all"时,代表查全部下级 子账户没有这个权限 公司人员默认查所有人
|
|
|
-// if(StringUtils.isNotEmpty(adminType)){
|
|
|
-// if(admin.getIsAdmined()&&admin.getType()>1){
|
|
|
-// if(admin.getType()>1){
|
|
|
-// if(adminType.equals("all")){
|
|
|
-// //查找所有下级
|
|
|
-// List<Long> admidIdList = R.getDataIfSuccess(szwlFeign.getAdminIdList(adminId));
|
|
|
-// 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);
|
|
|
-// if(!adminEquipment.getType().equals("0")){
|
|
|
-// List<String> list = R.getDataIfSuccess(szwlFeign.getClientIds(adminId));
|
|
|
-// if(list==null||list.size()==0){
|
|
|
-// return R.fail(ResponseCodesEnum.A0001,"没有机器/no machine");
|
|
|
-// }
|
|
|
-// query.in(TOrder::getClientId,list);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// }else {
|
|
|
-// //判断当前账号状态 公司还是商家
|
|
|
-// if(admin.getType()>1){
|
|
|
-// //商家 判断是否子账户
|
|
|
-// if(admin.getIsAdmined()){
|
|
|
-// //商家自己
|
|
|
-// query.eq(TOrder::getAdminId,adminId);
|
|
|
-// }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(!adminEquipment.getType().equals("0")){
|
|
|
-// List<String> list = R.getDataIfSuccess(szwlFeign.getClientIds(adminId));
|
|
|
-// if(list==null||list.size()==0){
|
|
|
-// return R.fail(ResponseCodesEnum.A0001,"没有机器/no machine");
|
|
|
-// }
|
|
|
-// query.in(TOrder::getClientId,list);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
if (!userName.equals("admin")) {
|
|
|
if (StringUtils.isNotEmpty(userName)) {
|
|
|
ResponseModel<TAdmin> adminByUsername = szwlFeign.getAdminByUsername(userName);
|