|
@@ -82,7 +82,11 @@ public class TOrderController {
|
|
|
@Autowired
|
|
|
SzwlFeign szwlFeign;
|
|
|
@GetMapping("/pageOrder")
|
|
|
- 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 endDate, long current, long size ) {
|
|
|
+ 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 endDate, long current, long size ) {
|
|
|
//判断当前账号状态
|
|
|
TAdmin admin = R.getDataIfSuccess(szwlFeign.getAdmin(adminId));
|
|
|
if(StringUtils.isEmpty(type)){
|
|
@@ -195,6 +199,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")) {
|
|
|
+ query.isNull(TOrder::getCompanyType).or()
|
|
|
+ .eq(TOrder::getCompanyType,companyType);
|
|
|
+ }else {
|
|
|
+ query.eq(TOrder::getCompanyType, companyType);
|
|
|
+ }
|
|
|
+ }
|
|
|
if(StringUtils.isNotEmpty(clientId)){
|
|
|
TEquipment equipment = R.getDataIfSuccess(szwlFeign.findEquipmentByClientId(clientId));
|
|
|
//判断机器是否属于这个登陆账号
|
|
@@ -498,7 +519,15 @@ public class TOrderController {
|
|
|
//补全clientId
|
|
|
TEquipment tEquipment = R.getDataIfSuccess(szwlFeign.findEquipmentByClientId(param.getClientId()));
|
|
|
param.setClientId(tEquipment.getClientId());
|
|
|
-// param.setClientId(tEquipment.getClientId());
|
|
|
+ }
|
|
|
+ // 公司平台
|
|
|
+ // 申泽平台管理员
|
|
|
+ if (admin.getId() == 2738) {
|
|
|
+ param.setCompanyType("0");
|
|
|
+ }
|
|
|
+ // 七云平台管理员
|
|
|
+ if (admin.getId() == 2739) {
|
|
|
+ param.setCompanyType("1");
|
|
|
}
|
|
|
}else {
|
|
|
if(admin.getType()==2){
|
|
@@ -530,8 +559,6 @@ public class TOrderController {
|
|
|
}else{
|
|
|
TAdminEquipment adminEquipment = R.getDataIfSuccess(szwlFeign.getClientIdList(String.valueOf(admin.getId())));
|
|
|
if(adminEquipment.getType().equals("0")){
|
|
|
-// TAdmin admin1 = R.getDataIfSuccess(szwlFeign.getAdmin(String.valueOf(admin.getParentId())));
|
|
|
-// param.setAdminId(admin1.getId().toString());
|
|
|
param.setAdminId(admin.getParentId().toString());
|
|
|
}else {
|
|
|
List<String> list = R.getDataIfSuccess(szwlFeign.getClientIds(adminId));
|
|
@@ -676,6 +703,14 @@ public class TOrderController {
|
|
|
ChartColumn chartColumn = new ChartColumn();
|
|
|
if(StringUtils.isNotEmpty(param.getAdminId())){
|
|
|
TAdmin admin = R.getDataIfSuccess(szwlFeign.getAdmin(String.valueOf(param.getAdminId())));
|
|
|
+ // 申泽平台管理员
|
|
|
+ if (admin.getId() == 2738) {
|
|
|
+ param.setCompanyType("0");
|
|
|
+ }
|
|
|
+ // 七云平台管理员
|
|
|
+ if (admin.getId() == 2739) {
|
|
|
+ param.setCompanyType("1");
|
|
|
+ }
|
|
|
if(admin.getType()<2){
|
|
|
param.setAdminId(null);
|
|
|
}else {
|
|
@@ -763,6 +798,8 @@ public class TOrderController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
if(StringUtils.isNotEmpty(param.getIfForeign())&¶m.getIfForeign().equals("1")){
|
|
|
//国外
|
|
|
// chartColumn = orderService.getEquipmentStatistics(param);
|
|
@@ -885,7 +922,6 @@ public class TOrderController {
|
|
|
IPage<TOrder> iPage = orderService.page(page, query);
|
|
|
long total = page.getTotal();
|
|
|
List<TOrder> content = iPage.getRecords();
|
|
|
-// List<Order> content = page.getContent();
|
|
|
ArrayList<OrderVo> orderVos = new ArrayList<>();
|
|
|
for (TOrder order : content) {
|
|
|
OrderVo orderVo = new OrderVo();
|
|
@@ -921,19 +957,26 @@ public class TOrderController {
|
|
|
*/
|
|
|
@ApiOperation(value = "订单数据导出-查询")
|
|
|
@RequestMapping(value = "/orderSelect", method = RequestMethod.GET)
|
|
|
- public ResponseModel<?> orderSelect(String type, String clientId, String username,String ifForeign, String startDate, String endDate, long current, long size) {
|
|
|
+ public ResponseModel<?> orderSelect(String type, String clientId, String username, String ifForeign,
|
|
|
+ String companyType, String startDate, String endDate,
|
|
|
+ Long adminId, long current, long size) {
|
|
|
if(size>100){
|
|
|
return R.fail(ResponseCodesEnum.A0001,"请求数量过大");
|
|
|
}
|
|
|
-// JSONObject jsonObject = new JSONObject();
|
|
|
Page<OrderDaoChuDTO> page0 = new Page<>(current, size, true);
|
|
|
page0.setSize(size);
|
|
|
page0.setCurrent(current);
|
|
|
+ if(adminId == 2738) {
|
|
|
+ companyType = "0";
|
|
|
+ }
|
|
|
+ if(adminId == 2739) {
|
|
|
+ companyType = "1";
|
|
|
+ }
|
|
|
if (startDate!=null&&endDate!=null) {
|
|
|
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
Date begin = null;
|
|
|
Date end = null;
|
|
|
- Long adminId = null;
|
|
|
+ Long n_adminId = null;
|
|
|
try {
|
|
|
begin = simpleDateFormat.parse(startDate);
|
|
|
end = simpleDateFormat.parse(endDate);
|
|
@@ -942,7 +985,7 @@ public class TOrderController {
|
|
|
}
|
|
|
|
|
|
long time = end.getTime() - begin.getTime();
|
|
|
- if(time>31*24*60*60*1000l){
|
|
|
+ if(time>31*24*60*60*1000L){
|
|
|
return R.fail(ResponseCodesEnum.A0001,"时间跨度过长");
|
|
|
}
|
|
|
if(!StringUtils.isEmpty(username)){
|
|
@@ -952,21 +995,20 @@ public class TOrderController {
|
|
|
if(data==null||data.getId()==null){
|
|
|
return R.fail(ResponseCodesEnum.A0001,"找不到商家");
|
|
|
}
|
|
|
- adminId = data.getId();
|
|
|
+ n_adminId = data.getId();
|
|
|
}
|
|
|
List<OrderDaoChuDTO> OrderDaoChuDTOList = new ArrayList<>();
|
|
|
if(ifForeign.equals("0")) {
|
|
|
//大陆
|
|
|
- OrderDaoChuDTOList = orderService.orderDaoChu(simpleDateFormat.format(begin), simpleDateFormat.format(end), adminId, clientId, type, current, size);
|
|
|
+ OrderDaoChuDTOList = orderService.orderDaoChu(simpleDateFormat.format(begin), simpleDateFormat.format(end), n_adminId, clientId, type, companyType, current, size);
|
|
|
}else {
|
|
|
//查海外
|
|
|
- OrderDaoChuDTOList =coinOrderService.orderDaoChu(simpleDateFormat.format(begin),simpleDateFormat.format(end),adminId,clientId,type,current,size);
|
|
|
+ OrderDaoChuDTOList =coinOrderService.orderDaoChu(simpleDateFormat.format(begin),simpleDateFormat.format(end),n_adminId,clientId,type,current,size);
|
|
|
}
|
|
|
for(OrderDaoChuDTO orderDaoChuDTO: OrderDaoChuDTOList){
|
|
|
String adminId1 = orderDaoChuDTO.getAdminId().toString();
|
|
|
ResponseModel<TAdmin> admin1 = szwlFeign.getAdmin(adminId1);
|
|
|
TAdmin admin = admin1.getData();
|
|
|
-// TAdmin admin = R.getDataIfSuccess(szwlFeign.getAdmin(adminId1));
|
|
|
if(admin==null){
|
|
|
continue;
|
|
|
}
|
|
@@ -974,28 +1016,25 @@ public class TOrderController {
|
|
|
orderDaoChuDTO.setUsername(admin.getUsername());
|
|
|
orderDaoChuDTO.setName(admin.getName());
|
|
|
if(!StringUtils.isEmpty(type)&&type.equals("2")){
|
|
|
+ TArea area = areaService.getById(admin.getAreaId());
|
|
|
+ if(area!=null){
|
|
|
+ orderDaoChuDTO.setAddress(area.getFullName());
|
|
|
+ }
|
|
|
+ ResponseModel<List<String>> clientIds = szwlFeign.getClientIds(String.valueOf(admin.getId()));
|
|
|
+ List<String> stringList = clientIds.getData();
|
|
|
+ if(stringList!=null&&stringList.size()>0){
|
|
|
+ orderDaoChuDTO.setEquipmentTotal(String.valueOf(stringList.size()));
|
|
|
+ }
|
|
|
//商户为单位
|
|
|
ResponseModel<TAdmin> feignAdmin = szwlFeign.getAdmin(String.valueOf(admin.getParentId()));
|
|
|
TAdmin parent = feignAdmin.getData();
|
|
|
if(parent!=null&&parent.getId()!=null){
|
|
|
orderDaoChuDTO.setLastUsername(parent.getUsername());
|
|
|
- TArea area = areaService.getById(admin.getAreaId());
|
|
|
- if(area!=null){
|
|
|
- orderDaoChuDTO.setAddress(area.getFullName());
|
|
|
- }
|
|
|
- ResponseModel<List<String>> clientIds = szwlFeign.getClientIds(String.valueOf(admin.getId()));
|
|
|
- List<String> stringList = clientIds.getData();
|
|
|
-// List<String> stringList = R.getDataIfSuccess(szwlFeign.getClientIds(String.valueOf(admin.getId())));
|
|
|
- if(stringList!=null&&stringList.size()>0){
|
|
|
- orderDaoChuDTO.setEquipmentTotal(String.valueOf(stringList.size()));
|
|
|
- }
|
|
|
}
|
|
|
-// TAdmin parent = R.getDataIfSuccess(szwlFeign.getAdmin(String.valueOf(admin.getParentId())));
|
|
|
}else {
|
|
|
//设备为单位
|
|
|
ResponseModel<TEquipment> equipmentByClientId = szwlFeign.findEquipmentByClientId(String.valueOf(orderDaoChuDTO.getClientId()));
|
|
|
TEquipment equipment = equipmentByClientId.getData();
|
|
|
-// TEquipment equipment = R.getDataIfSuccess(szwlFeign.findEquipmentByClientId(String.valueOf(orderDaoChuDTO.getClientId())));
|
|
|
if(equipment!=null&&equipment.getId()!=null){
|
|
|
if(StringUtils.isNotEmpty(equipment.getFullName())){
|
|
|
orderDaoChuDTO.setAddress(equipment.getFullName());
|
|
@@ -1005,62 +1044,9 @@ public class TOrderController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-// jsonObject.put("OrderDaoChuDTOList", OrderDaoChuDTOList);
|
|
|
page0.setRecords(OrderDaoChuDTOList);
|
|
|
page0.setTotal(1000);
|
|
|
-// if(ifForeign.equals("0")){
|
|
|
-// //大陆
|
|
|
-// if(type.equals("1")){
|
|
|
-// //机器做单位
|
|
|
-// LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
|
|
|
-// if(StringUtils.isNotEmpty(clientId)){
|
|
|
-// query.eq(TEquipment::getClientId,clientId);
|
|
|
-// }
|
|
|
-// Page<TEquipment> page = new Page<>(current, size, true);
|
|
|
-// IPage<TEquipment> iPage = equipmentService.page(page, query);
|
|
|
-// page0.setTotal(iPage.getTotal());
|
|
|
-// }else {
|
|
|
-// //商户做单位
|
|
|
-// LambdaQueryWrapper<TAdmin> query = Wrappers.lambdaQuery();
|
|
|
-// if(adminId!=null){
|
|
|
-// query.eq(TAdmin::getId,adminId);
|
|
|
-// }
|
|
|
-// Page<TAdmin> page = new Page<>(current, size, true);
|
|
|
-// IPage<TAdmin> iPage = .page(page, query);
|
|
|
-// page0.setTotal(iPage.getTotal());
|
|
|
-// }
|
|
|
-// }else {
|
|
|
-// //海外
|
|
|
-// if(type.equals("1")){
|
|
|
-// //机器做单位
|
|
|
-// LambdaQueryWrapper<TCoinOrder> query = Wrappers.lambdaQuery();
|
|
|
-// if(adminId!=null){
|
|
|
-// query.eq(TCoinOrder::getAdminId,adminId);
|
|
|
-// }
|
|
|
-// if(StringUtils.isNotEmpty(clientId)){
|
|
|
-// query.eq(TCoinOrder::getClientId,clientId);
|
|
|
-// }
|
|
|
-// query.groupBy(TCoinOrder::getClientId);
|
|
|
-// Page<TCoinOrder> page = new Page<>(current, size, true);
|
|
|
-// IPage<TCoinOrder> iPage = coinOrderService.page(page, query);
|
|
|
-// page0.setTotal(iPage.getTotal());
|
|
|
-// }else {
|
|
|
-// //商户做单位
|
|
|
-// LambdaQueryWrapper<TCoinOrder> query = Wrappers.lambdaQuery();
|
|
|
-// if(adminId!=null){
|
|
|
-// query.eq(TCoinOrder::getAdminId,adminId);
|
|
|
-// }
|
|
|
-// if(StringUtils.isNotEmpty(clientId)){
|
|
|
-// query.eq(TCoinOrder::getClientId,clientId);
|
|
|
-// }
|
|
|
-// query.groupBy(TCoinOrder::getAdminId);
|
|
|
-// Page<TCoinOrder> page = new Page<>(current, size, true);
|
|
|
-// IPage<TCoinOrder> iPage = coinOrderService.page(page, query);
|
|
|
-// page0.setTotal(iPage.getTotal());
|
|
|
-// }
|
|
|
-// }
|
|
|
}
|
|
|
-
|
|
|
return R.ok(page0);
|
|
|
}
|
|
|
|
|
@@ -1070,17 +1056,23 @@ public class TOrderController {
|
|
|
@ApiOperation(value = "订单数据导出-导出")
|
|
|
@RequestMapping(value = "/onlineExport", method = RequestMethod.GET)
|
|
|
@LogAnnotation(module = "模块名称:订单", operator="操作参数:导出订单数据")
|
|
|
- public Object onlineExport(HttpServletResponse response, String type, String clientId, String ifForeign, String userName, String startDate, String endDate, long current, long size) {
|
|
|
-// if(size>100){
|
|
|
-// return JsonMessage.success("页数过大");
|
|
|
-// }
|
|
|
- current = 1l;
|
|
|
- size = 1000l;
|
|
|
+ public Object onlineExport(HttpServletResponse response, String type, String clientId,
|
|
|
+ String ifForeign, String userName, String startDate,
|
|
|
+ String companyType, Long adminId,
|
|
|
+ String endDate, long current, long size) {
|
|
|
+ current = 1L;
|
|
|
+ size = 1000L;
|
|
|
+ if(adminId == 2738) {
|
|
|
+ companyType = "0";
|
|
|
+ }
|
|
|
+ if(adminId == 2739) {
|
|
|
+ companyType = "1";
|
|
|
+ }
|
|
|
if (startDate!=null&&endDate!=null) {
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
Date begin = null;
|
|
|
Date end = null;
|
|
|
- Long adminId = null;
|
|
|
+ Long n_adminId = null;
|
|
|
try {
|
|
|
begin = simpleDateFormat.parse(startDate);
|
|
|
end = simpleDateFormat.parse(endDate);
|
|
@@ -1088,7 +1080,7 @@ public class TOrderController {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
long time = end.getTime() - begin.getTime();
|
|
|
- if(time>31*24*60*60*1000l){
|
|
|
+ if(time>31*24*60*60*1000L){
|
|
|
return JsonMessage.success("时间跨度过长");
|
|
|
}
|
|
|
if(!StringUtils.isEmpty(userName)){
|
|
@@ -1106,15 +1098,15 @@ public class TOrderController {
|
|
|
List<OrderDaoChuDTO> OrderDaoChuDTOList = new ArrayList<>();
|
|
|
if(ifForeign.equals("0")) {
|
|
|
//大陆
|
|
|
- OrderDaoChuDTOList = orderService.orderDaoChu(simpleDateFormat.format(begin), simpleDateFormat.format(end), adminId, clientId, type, current, size);
|
|
|
+ OrderDaoChuDTOList = orderService.orderDaoChu(simpleDateFormat.format(begin), simpleDateFormat.format(end), n_adminId, clientId, type, companyType, current, size);
|
|
|
}else {
|
|
|
//查海外
|
|
|
- OrderDaoChuDTOList =coinOrderService.orderDaoChu(simpleDateFormat.format(begin),simpleDateFormat.format(end),adminId,clientId,type,current,size);
|
|
|
+ OrderDaoChuDTOList =coinOrderService.orderDaoChu(simpleDateFormat.format(begin),simpleDateFormat.format(end),n_adminId,clientId,type,current,size);
|
|
|
}
|
|
|
-// List<OrderDaoChuDTO> OrderDaoChuDTOList =orderService.orderDaoChu(simpleDateFormat.format(begin),simpleDateFormat.format(end),adminId,clientId,type,current,size);
|
|
|
for(OrderDaoChuDTO orderDaoChuDTO: OrderDaoChuDTOList){
|
|
|
- Long adminId1 = Long.valueOf(orderDaoChuDTO.getAdminId().toString());
|
|
|
- TAdmin admin = R.getDataIfSuccess(szwlFeign.getAdmin(adminId1.toString()));
|
|
|
+ String adminId1 = orderDaoChuDTO.getAdminId().toString();
|
|
|
+ ResponseModel<TAdmin> admin1 = szwlFeign.getAdmin(adminId1);
|
|
|
+ TAdmin admin = admin1.getData();
|
|
|
if(admin==null){
|
|
|
continue;
|
|
|
}
|
|
@@ -1122,27 +1114,26 @@ public class TOrderController {
|
|
|
orderDaoChuDTO.setUsername(admin.getUsername());
|
|
|
orderDaoChuDTO.setName(admin.getName());
|
|
|
if(!StringUtils.isEmpty(type)&&type.equals("2")){
|
|
|
- //商户为单位
|
|
|
-// TAdmin parent = R.getDataIfSuccess(szwlFeign.getAdmin(String.valueOf(admin.getParentId())));
|
|
|
- ResponseModel<TAdmin> feignAdmin = szwlFeign.getAdmin(String.valueOf(admin.getParentId()));
|
|
|
- TAdmin parent = feignAdmin.getData();
|
|
|
- orderDaoChuDTO.setLastUsername(parent.getUsername());
|
|
|
TArea area = areaService.getById(admin.getAreaId());
|
|
|
if(area!=null){
|
|
|
orderDaoChuDTO.setAddress(area.getFullName());
|
|
|
}
|
|
|
ResponseModel<List<String>> clientIds = szwlFeign.getClientIds(String.valueOf(admin.getId()));
|
|
|
List<String> stringList = clientIds.getData();
|
|
|
-// List<String> stringList = R.getDataIfSuccess(szwlFeign.getClientIds(String.valueOf(admin.getId())));
|
|
|
if(stringList!=null&&stringList.size()>0){
|
|
|
orderDaoChuDTO.setEquipmentTotal(String.valueOf(stringList.size()));
|
|
|
}
|
|
|
+ //商户为单位
|
|
|
+ ResponseModel<TAdmin> feignAdmin = szwlFeign.getAdmin(String.valueOf(admin.getParentId()));
|
|
|
+ TAdmin parent = feignAdmin.getData();
|
|
|
+ if(parent!=null&&parent.getId()!=null){
|
|
|
+ orderDaoChuDTO.setLastUsername(parent.getUsername());
|
|
|
+ }
|
|
|
}else {
|
|
|
//设备为单位
|
|
|
ResponseModel<TEquipment> equipmentByClientId = szwlFeign.findEquipmentByClientId(String.valueOf(orderDaoChuDTO.getClientId()));
|
|
|
TEquipment equipment = equipmentByClientId.getData();
|
|
|
-// TEquipment equipment = R.getDataIfSuccess(szwlFeign.findEquipmentByClientId(String.valueOf(orderDaoChuDTO.getClientId())));
|
|
|
- if(equipment!=null){
|
|
|
+ if(equipment!=null&&equipment.getId()!=null){
|
|
|
if(StringUtils.isNotEmpty(equipment.getFullName())){
|
|
|
orderDaoChuDTO.setAddress(equipment.getFullName());
|
|
|
}
|