feat[订单支付回调模块,排队模块]:订单查询素材列表,设备执行自动触发等
This commit is contained in:
+1
-1
@@ -32,7 +32,7 @@ public class SysGeneratorServiceImpl extends ServiceImpl<SysGeneratorMapper, Tab
|
|||||||
Page<Map<String, Object>> page = new Page<>(MapUtils.getInteger(map, "page"), MapUtils.getInteger(map, "limit"));
|
Page<Map<String, Object>> page = new Page<>(MapUtils.getInteger(map, "page"), MapUtils.getInteger(map, "limit"));
|
||||||
|
|
||||||
List<Map<String, Object>> list = sysGeneratorMapper.queryList(page, map);
|
List<Map<String, Object>> list = sysGeneratorMapper.queryList(page, map);
|
||||||
return PageResult.<Map<String, Object>>builder().data(list).code(0).count(page.getTotal()).build();
|
return PageResult.<Map<String, Object>>builder().data(list).resp_code(0).count(page.getTotal()).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+6
@@ -65,9 +65,15 @@ public class ApiDeviceController {
|
|||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
JsonObject jsonObject;
|
JsonObject jsonObject;
|
||||||
String property = MapUtil.getStrValue(param, "control");
|
String property = MapUtil.getStrValue(param, "control");
|
||||||
|
String value = MapUtil.getStrValue(param, "order_no");
|
||||||
try {
|
try {
|
||||||
if (ControlEnum.contains(ControlEnum.valueOf(property.toUpperCase()))) {
|
if (ControlEnum.contains(ControlEnum.valueOf(property.toUpperCase()))) {
|
||||||
jsonObject = gson.fromJson(controlMessageConstant.CONTROL_MESSAGE_MAP.get(property), JsonObject.class);
|
jsonObject = gson.fromJson(controlMessageConstant.CONTROL_MESSAGE_MAP.get(property), JsonObject.class);
|
||||||
|
|
||||||
|
if (value != null || value != "") {
|
||||||
|
JsonObject data = jsonObject.getAsJsonObject("data");
|
||||||
|
data.addProperty("order_no", value);
|
||||||
|
}
|
||||||
}else {
|
}else {
|
||||||
return Result.succeed("暂未开放控制权限");
|
return Result.succeed("暂未开放控制权限");
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-9
@@ -1,18 +1,17 @@
|
|||||||
package com.central.device.service.impl;
|
package com.central.device.service.impl;
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import com.central.common.model.PageResult;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.central.common.model.PageResult;
|
||||||
import com.central.common.service.impl.SuperServiceImpl;
|
import com.central.common.service.impl.SuperServiceImpl;
|
||||||
|
import com.central.device.mapper.AgeDeviceFirmwareMapper;
|
||||||
|
import com.central.device.model.AgeDeviceFirmware;
|
||||||
|
import com.central.device.service.IAgeDeviceFirmwareService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections4.MapUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.apache.commons.collections4.MapUtils;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import com.central.device.model.AgeDeviceFirmware;
|
|
||||||
import com.central.device.mapper.AgeDeviceFirmwareMapper;
|
|
||||||
import com.central.device.service.IAgeDeviceFirmwareService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Firmware file information
|
* Firmware file information
|
||||||
@@ -32,6 +31,6 @@ public class AgeDeviceFirmwareServiceImpl extends SuperServiceImpl<AgeDeviceFirm
|
|||||||
public PageResult<AgeDeviceFirmware> findList(Map<String, Object> params){
|
public PageResult<AgeDeviceFirmware> findList(Map<String, Object> params){
|
||||||
Page<AgeDeviceFirmware> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
|
Page<AgeDeviceFirmware> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
|
||||||
List<AgeDeviceFirmware> list = baseMapper.findList(page, params);
|
List<AgeDeviceFirmware> list = baseMapper.findList(page, params);
|
||||||
return PageResult.<AgeDeviceFirmware>builder().data(list).code(0).count(page.getTotal()).build();
|
return PageResult.<AgeDeviceFirmware>builder().data(list).resp_code(0).count(page.getTotal()).build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-9
@@ -1,18 +1,17 @@
|
|||||||
package com.central.device.service.impl;
|
package com.central.device.service.impl;
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import com.central.common.model.PageResult;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.central.common.model.PageResult;
|
||||||
import com.central.common.service.impl.SuperServiceImpl;
|
import com.central.common.service.impl.SuperServiceImpl;
|
||||||
|
import com.central.device.mapper.AgeDeviceHmsMapper;
|
||||||
|
import com.central.device.model.AgeDeviceHms;
|
||||||
|
import com.central.device.service.IAgeDeviceHmsService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections4.MapUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.apache.commons.collections4.MapUtils;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import com.central.device.model.AgeDeviceHms;
|
|
||||||
import com.central.device.mapper.AgeDeviceHmsMapper;
|
|
||||||
import com.central.device.service.IAgeDeviceHmsService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Device's hms information
|
* Device's hms information
|
||||||
@@ -32,6 +31,6 @@ public class AgeDeviceHmsServiceImpl extends SuperServiceImpl<AgeDeviceHmsMapper
|
|||||||
public PageResult<AgeDeviceHms> findList(Map<String, Object> params){
|
public PageResult<AgeDeviceHms> findList(Map<String, Object> params){
|
||||||
Page<AgeDeviceHms> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
|
Page<AgeDeviceHms> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
|
||||||
List<AgeDeviceHms> list = baseMapper.findList(page, params);
|
List<AgeDeviceHms> list = baseMapper.findList(page, params);
|
||||||
return PageResult.<AgeDeviceHms>builder().data(list).code(0).count(page.getTotal()).build();
|
return PageResult.<AgeDeviceHms>builder().data(list).resp_code(0).count(page.getTotal()).build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-9
@@ -1,18 +1,17 @@
|
|||||||
package com.central.device.service.impl;
|
package com.central.device.service.impl;
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import com.central.common.model.PageResult;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.central.common.model.PageResult;
|
||||||
import com.central.common.service.impl.SuperServiceImpl;
|
import com.central.common.service.impl.SuperServiceImpl;
|
||||||
|
import com.central.device.mapper.AgeDeviceLogsMapper;
|
||||||
|
import com.central.device.model.AgeDeviceLogs;
|
||||||
|
import com.central.device.service.IAgeDeviceLogsService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections4.MapUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.apache.commons.collections4.MapUtils;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import com.central.device.model.AgeDeviceLogs;
|
|
||||||
import com.central.device.mapper.AgeDeviceLogsMapper;
|
|
||||||
import com.central.device.service.IAgeDeviceLogsService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Log for uploading logs
|
* Log for uploading logs
|
||||||
@@ -32,6 +31,6 @@ public class AgeDeviceLogsServiceImpl extends SuperServiceImpl<AgeDeviceLogsMapp
|
|||||||
public PageResult<AgeDeviceLogs> findList(Map<String, Object> params){
|
public PageResult<AgeDeviceLogs> findList(Map<String, Object> params){
|
||||||
Page<AgeDeviceLogs> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
|
Page<AgeDeviceLogs> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
|
||||||
List<AgeDeviceLogs> list = baseMapper.findList(page, params);
|
List<AgeDeviceLogs> list = baseMapper.findList(page, params);
|
||||||
return PageResult.<AgeDeviceLogs>builder().data(list).code(0).count(page.getTotal()).build();
|
return PageResult.<AgeDeviceLogs>builder().data(list).resp_code(0).count(page.getTotal()).build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-9
@@ -1,18 +1,17 @@
|
|||||||
package com.central.device.service.impl;
|
package com.central.device.service.impl;
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import com.central.common.model.PageResult;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.central.common.model.PageResult;
|
||||||
import com.central.common.service.impl.SuperServiceImpl;
|
import com.central.common.service.impl.SuperServiceImpl;
|
||||||
|
import com.central.device.mapper.AgeDevicePayloadMapper;
|
||||||
|
import com.central.device.model.AgeDevicePayload;
|
||||||
|
import com.central.device.service.IAgeDevicePayloadService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections4.MapUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.apache.commons.collections4.MapUtils;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import com.central.device.model.AgeDevicePayload;
|
|
||||||
import com.central.device.mapper.AgeDevicePayloadMapper;
|
|
||||||
import com.central.device.service.IAgeDevicePayloadService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The payload information of the device.
|
* The payload information of the device.
|
||||||
@@ -32,6 +31,6 @@ public class AgeDevicePayloadServiceImpl extends SuperServiceImpl<AgeDevicePaylo
|
|||||||
public PageResult<AgeDevicePayload> findList(Map<String, Object> params){
|
public PageResult<AgeDevicePayload> findList(Map<String, Object> params){
|
||||||
Page<AgeDevicePayload> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
|
Page<AgeDevicePayload> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
|
||||||
List<AgeDevicePayload> list = baseMapper.findList(page, params);
|
List<AgeDevicePayload> list = baseMapper.findList(page, params);
|
||||||
return PageResult.<AgeDevicePayload>builder().data(list).code(0).count(page.getTotal()).build();
|
return PageResult.<AgeDevicePayload>builder().data(list).resp_code(0).count(page.getTotal()).build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-9
@@ -1,18 +1,17 @@
|
|||||||
package com.central.device.service.impl;
|
package com.central.device.service.impl;
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import com.central.common.model.PageResult;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.central.common.model.PageResult;
|
||||||
import com.central.common.service.impl.SuperServiceImpl;
|
import com.central.common.service.impl.SuperServiceImpl;
|
||||||
|
import com.central.device.mapper.AgeDeviceMapper;
|
||||||
|
import com.central.device.model.AgeDevice;
|
||||||
|
import com.central.device.service.IAgeDeviceService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections4.MapUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.apache.commons.collections4.MapUtils;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import com.central.device.model.AgeDevice;
|
|
||||||
import com.central.device.mapper.AgeDeviceMapper;
|
|
||||||
import com.central.device.service.IAgeDeviceService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Device information
|
* Device information
|
||||||
@@ -32,6 +31,6 @@ public class AgeDeviceServiceImpl extends SuperServiceImpl<AgeDeviceMapper, AgeD
|
|||||||
public PageResult<AgeDevice> findList(Map<String, Object> params){
|
public PageResult<AgeDevice> findList(Map<String, Object> params){
|
||||||
Page<AgeDevice> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
|
Page<AgeDevice> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
|
||||||
List<AgeDevice> list = baseMapper.findList(page, params);
|
List<AgeDevice> list = baseMapper.findList(page, params);
|
||||||
return PageResult.<AgeDevice>builder().data(list).code(0).count(page.getTotal()).build();
|
return PageResult.<AgeDevice>builder().data(list).resp_code(0).count(page.getTotal()).build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-9
@@ -1,18 +1,17 @@
|
|||||||
package com.central.device.service.impl;
|
package com.central.device.service.impl;
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import com.central.common.model.PageResult;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.central.common.model.PageResult;
|
||||||
import com.central.common.service.impl.SuperServiceImpl;
|
import com.central.common.service.impl.SuperServiceImpl;
|
||||||
|
import com.central.device.mapper.AgeFirmwareModelMapper;
|
||||||
|
import com.central.device.model.AgeFirmwareModel;
|
||||||
|
import com.central.device.service.IAgeFirmwareModelService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections4.MapUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.apache.commons.collections4.MapUtils;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import com.central.device.model.AgeFirmwareModel;
|
|
||||||
import com.central.device.mapper.AgeFirmwareModelMapper;
|
|
||||||
import com.central.device.service.IAgeFirmwareModelService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -32,6 +31,6 @@ public class AgeFirmwareModelServiceImpl extends SuperServiceImpl<AgeFirmwareMod
|
|||||||
public PageResult<AgeFirmwareModel> findList(Map<String, Object> params){
|
public PageResult<AgeFirmwareModel> findList(Map<String, Object> params){
|
||||||
Page<AgeFirmwareModel> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
|
Page<AgeFirmwareModel> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
|
||||||
List<AgeFirmwareModel> list = baseMapper.findList(page, params);
|
List<AgeFirmwareModel> list = baseMapper.findList(page, params);
|
||||||
return PageResult.<AgeFirmwareModel>builder().data(list).code(0).count(page.getTotal()).build();
|
return PageResult.<AgeFirmwareModel>builder().data(list).resp_code(0).count(page.getTotal()).build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-9
@@ -1,18 +1,17 @@
|
|||||||
package com.central.device.service.impl;
|
package com.central.device.service.impl;
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import com.central.common.model.PageResult;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.central.common.model.PageResult;
|
||||||
import com.central.common.service.impl.SuperServiceImpl;
|
import com.central.common.service.impl.SuperServiceImpl;
|
||||||
|
import com.central.device.mapper.AgeWorkspaceMapper;
|
||||||
|
import com.central.device.model.AgeWorkspace;
|
||||||
|
import com.central.device.service.IAgeWorkspaceService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections4.MapUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.apache.commons.collections4.MapUtils;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import com.central.device.model.AgeWorkspace;
|
|
||||||
import com.central.device.mapper.AgeWorkspaceMapper;
|
|
||||||
import com.central.device.service.IAgeWorkspaceService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -32,6 +31,6 @@ public class AgeWorkspaceServiceImpl extends SuperServiceImpl<AgeWorkspaceMapper
|
|||||||
public PageResult<AgeWorkspace> findList(Map<String, Object> params){
|
public PageResult<AgeWorkspace> findList(Map<String, Object> params){
|
||||||
Page<AgeWorkspace> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
|
Page<AgeWorkspace> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
|
||||||
List<AgeWorkspace> list = baseMapper.findList(page, params);
|
List<AgeWorkspace> list = baseMapper.findList(page, params);
|
||||||
return PageResult.<AgeWorkspace>builder().data(list).code(0).count(page.getTotal()).build();
|
return PageResult.<AgeWorkspace>builder().data(list).resp_code(0).count(page.getTotal()).build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-9
@@ -1,18 +1,17 @@
|
|||||||
package com.central.device.service.impl;
|
package com.central.device.service.impl;
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import com.central.common.model.PageResult;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.central.common.model.PageResult;
|
||||||
import com.central.common.service.impl.SuperServiceImpl;
|
import com.central.common.service.impl.SuperServiceImpl;
|
||||||
|
import com.central.device.mapper.IaFileMapper;
|
||||||
|
import com.central.device.model.IaFile;
|
||||||
|
import com.central.device.service.IIaFileService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections4.MapUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.apache.commons.collections4.MapUtils;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import com.central.device.model.IaFile;
|
|
||||||
import com.central.device.mapper.IaFileMapper;
|
|
||||||
import com.central.device.service.IIaFileService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Media file information
|
* Media file information
|
||||||
@@ -32,6 +31,6 @@ public class IaFileServiceImpl extends SuperServiceImpl<IaFileMapper, IaFile> im
|
|||||||
public PageResult<IaFile> findList(Map<String, Object> params){
|
public PageResult<IaFile> findList(Map<String, Object> params){
|
||||||
Page<IaFile> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
|
Page<IaFile> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
|
||||||
List<IaFile> list = baseMapper.findList(page, params);
|
List<IaFile> list = baseMapper.findList(page, params);
|
||||||
return PageResult.<IaFile>builder().data(list).code(0).count(page.getTotal()).build();
|
return PageResult.<IaFile>builder().data(list).resp_code(0).count(page.getTotal()).build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-9
@@ -1,18 +1,17 @@
|
|||||||
package com.central.device.service.impl;
|
package com.central.device.service.impl;
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import com.central.common.model.PageResult;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.central.common.model.PageResult;
|
||||||
import com.central.common.service.impl.SuperServiceImpl;
|
import com.central.common.service.impl.SuperServiceImpl;
|
||||||
|
import com.central.device.mapper.LineFileMapper;
|
||||||
|
import com.central.device.model.LineFile;
|
||||||
|
import com.central.device.service.ILineFileService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections4.MapUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.apache.commons.collections4.MapUtils;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import com.central.device.model.LineFile;
|
|
||||||
import com.central.device.mapper.LineFileMapper;
|
|
||||||
import com.central.device.service.ILineFileService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wayline file information
|
* Wayline file information
|
||||||
@@ -32,6 +31,6 @@ public class LineFileServiceImpl extends SuperServiceImpl<LineFileMapper, LineFi
|
|||||||
public PageResult<LineFile> findList(Map<String, Object> params){
|
public PageResult<LineFile> findList(Map<String, Object> params){
|
||||||
Page<LineFile> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
|
Page<LineFile> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
|
||||||
List<LineFile> list = baseMapper.findList(page, params);
|
List<LineFile> list = baseMapper.findList(page, params);
|
||||||
return PageResult.<LineFile>builder().data(list).code(0).count(page.getTotal()).build();
|
return PageResult.<LineFile>builder().data(list).resp_code(0).count(page.getTotal()).build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-9
@@ -1,18 +1,17 @@
|
|||||||
package com.central.device.service.impl;
|
package com.central.device.service.impl;
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import com.central.common.model.PageResult;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.central.common.model.PageResult;
|
||||||
import com.central.common.service.impl.SuperServiceImpl;
|
import com.central.common.service.impl.SuperServiceImpl;
|
||||||
|
import com.central.device.mapper.LineJobMapper;
|
||||||
|
import com.central.device.model.LineJob;
|
||||||
|
import com.central.device.service.ILineJobService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections4.MapUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.apache.commons.collections4.MapUtils;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import com.central.device.model.LineJob;
|
|
||||||
import com.central.device.mapper.LineJobMapper;
|
|
||||||
import com.central.device.service.ILineJobService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wayline mission information of the dock.
|
* Wayline mission information of the dock.
|
||||||
@@ -32,6 +31,6 @@ public class LineJobServiceImpl extends SuperServiceImpl<LineJobMapper, LineJob>
|
|||||||
public PageResult<LineJob> findList(Map<String, Object> params){
|
public PageResult<LineJob> findList(Map<String, Object> params){
|
||||||
Page<LineJob> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
|
Page<LineJob> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
|
||||||
List<LineJob> list = baseMapper.findList(page, params);
|
List<LineJob> list = baseMapper.findList(page, params);
|
||||||
return PageResult.<LineJob>builder().data(list).code(0).count(page.getTotal()).build();
|
return PageResult.<LineJob>builder().data(list).resp_code(0).count(page.getTotal()).build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-9
@@ -1,18 +1,17 @@
|
|||||||
package com.central.device.service.impl;
|
package com.central.device.service.impl;
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import com.central.common.model.PageResult;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.central.common.model.PageResult;
|
||||||
import com.central.common.service.impl.SuperServiceImpl;
|
import com.central.common.service.impl.SuperServiceImpl;
|
||||||
|
import com.central.device.mapper.SFileIndexMapper;
|
||||||
|
import com.central.device.model.SFileIndex;
|
||||||
|
import com.central.device.service.ISFileIndexService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections4.MapUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.apache.commons.collections4.MapUtils;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import com.central.device.model.SFileIndex;
|
|
||||||
import com.central.device.mapper.SFileIndexMapper;
|
|
||||||
import com.central.device.service.ISFileIndexService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The boot index table corresponding to the logs file.
|
* The boot index table corresponding to the logs file.
|
||||||
@@ -32,6 +31,6 @@ public class SFileIndexServiceImpl extends SuperServiceImpl<SFileIndexMapper, SF
|
|||||||
public PageResult<SFileIndex> findList(Map<String, Object> params){
|
public PageResult<SFileIndex> findList(Map<String, Object> params){
|
||||||
Page<SFileIndex> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
|
Page<SFileIndex> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
|
||||||
List<SFileIndex> list = baseMapper.findList(page, params);
|
List<SFileIndex> list = baseMapper.findList(page, params);
|
||||||
return PageResult.<SFileIndex>builder().data(list).code(0).count(page.getTotal()).build();
|
return PageResult.<SFileIndex>builder().data(list).resp_code(0).count(page.getTotal()).build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-9
@@ -1,18 +1,17 @@
|
|||||||
package com.central.device.service.impl;
|
package com.central.device.service.impl;
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import com.central.common.model.PageResult;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.central.common.model.PageResult;
|
||||||
import com.central.common.service.impl.SuperServiceImpl;
|
import com.central.common.service.impl.SuperServiceImpl;
|
||||||
|
import com.central.device.mapper.SFileMapper;
|
||||||
|
import com.central.device.model.SFile;
|
||||||
|
import com.central.device.service.ISFileService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections4.MapUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.apache.commons.collections4.MapUtils;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import com.central.device.model.SFile;
|
|
||||||
import com.central.device.mapper.SFileMapper;
|
|
||||||
import com.central.device.service.ISFileService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs file information
|
* Logs file information
|
||||||
@@ -32,6 +31,6 @@ public class SFileServiceImpl extends SuperServiceImpl<SFileMapper, SFile> imple
|
|||||||
public PageResult<SFile> findList(Map<String, Object> params){
|
public PageResult<SFile> findList(Map<String, Object> params){
|
||||||
Page<SFile> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
|
Page<SFile> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
|
||||||
List<SFile> list = baseMapper.findList(page, params);
|
List<SFile> list = baseMapper.findList(page, params);
|
||||||
return PageResult.<SFile>builder().data(list).code(0).count(page.getTotal()).build();
|
return PageResult.<SFile>builder().data(list).resp_code(0).count(page.getTotal()).build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ server:
|
|||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
name: device-center
|
name: device-center
|
||||||
cloud:
|
# cloud:
|
||||||
nacos:
|
# nacos:
|
||||||
discovery:
|
# discovery:
|
||||||
ip: 81.70.164.178
|
# ip: 81.70.164.178
|
||||||
# cloud:
|
# cloud:
|
||||||
# nacos:
|
# nacos:
|
||||||
# discovery:
|
# discovery:
|
||||||
|
|||||||
+83
-1
@@ -4,10 +4,19 @@ import com.central.common.model.PageResult;
|
|||||||
import com.central.common.model.Result;
|
import com.central.common.model.Result;
|
||||||
import com.central.file.model.FileInfo;
|
import com.central.file.model.FileInfo;
|
||||||
import com.central.file.service.IFileService;
|
import com.central.file.service.IFileService;
|
||||||
|
import com.central.file.utils.HexToJpeg;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import org.springframework.http.*;
|
||||||
|
import org.springframework.util.LinkedMultiValueMap;
|
||||||
|
import org.springframework.util.MultiValueMap;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -20,6 +29,14 @@ public class FileController {
|
|||||||
@Resource
|
@Resource
|
||||||
private IFileService fileService;
|
private IFileService fileService;
|
||||||
|
|
||||||
|
// @Value("tencent.accessTokenUrl")
|
||||||
|
private String accessTokenUrl = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wx30a3c8de94a85584&secret=e64d6e3dcfe88d0daee50e77f5a2ee69";
|
||||||
|
|
||||||
|
// @Value("tencent.getwxacodeUrl")
|
||||||
|
private String getwxacodeUrl = "https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token=";
|
||||||
|
|
||||||
|
private RestTemplate restTemplate = new RestTemplate();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件上传
|
* 文件上传
|
||||||
* 根据fileType选择上传方式
|
* 根据fileType选择上传方式
|
||||||
@@ -28,7 +45,7 @@ public class FileController {
|
|||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@PostMapping("/files-anon")
|
@PostMapping(value = "/files-anon",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||||
public FileInfo upload(@RequestParam("file") MultipartFile file) throws Exception {
|
public FileInfo upload(@RequestParam("file") MultipartFile file) throws Exception {
|
||||||
return fileService.upload(file);
|
return fileService.upload(file);
|
||||||
}
|
}
|
||||||
@@ -63,4 +80,69 @@ public class FileController {
|
|||||||
public String getViewUrl(@PathVariable String id) {
|
public String getViewUrl(@PathVariable String id) {
|
||||||
return fileService.getViewUrl(id);
|
return fileService.getViewUrl(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/type/{id}")
|
||||||
|
public String getFileInfo(@PathVariable String id) {
|
||||||
|
FileInfo fileInfo = fileService.getFileInfo(id);
|
||||||
|
if (fileInfo != null) {
|
||||||
|
return fileInfo.getContentType();
|
||||||
|
}
|
||||||
|
return "image/png";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/qrcode/{codeId}")
|
||||||
|
public Result<Map> uploadQrCodeFile(@PathVariable("codeId") String codeId) throws Exception {
|
||||||
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
|
String accessToken = getAccessTokenUrl();
|
||||||
|
|
||||||
|
FileInfo fileInfo = fileService.upload(codeId+".jpeg",getQRCode(accessToken,codeId));
|
||||||
|
map.put("codeId", codeId);
|
||||||
|
map.put("fileId", fileInfo.getId());
|
||||||
|
map.put("filePath", fileInfo.getPath());
|
||||||
|
return Result.succeed(map);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 获取access_token
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getAccessTokenUrl() {
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
headers.setContentType(org.springframework.http.MediaType.APPLICATION_FORM_URLENCODED);
|
||||||
|
MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
|
||||||
|
HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(params, headers);
|
||||||
|
ResponseEntity<String> responseEntity = restTemplate.exchange(accessTokenUrl, HttpMethod.GET, requestEntity, String.class);
|
||||||
|
|
||||||
|
if (responseEntity.getStatusCode().is2xxSuccessful() && responseEntity.getBody().contains("access_token")) {
|
||||||
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
try {
|
||||||
|
Map map = objectMapper.readValue(responseEntity.getBody(), Map.class);
|
||||||
|
return (String) map.get("access_token");
|
||||||
|
} catch (Exception e) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取qrcode
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public InputStream getQRCode(String accessToken, String codeId) {
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||||
|
Map<String, String> params = new LinkedHashMap<>();
|
||||||
|
params.put("path", "/pages/link/link?uuid=" + codeId);
|
||||||
|
HttpEntity<Map> requestEntity = new HttpEntity<>(params, headers);
|
||||||
|
ResponseEntity<String> responseEntity = restTemplate.exchange(getwxacodeUrl+accessToken, HttpMethod.POST, requestEntity, String.class);
|
||||||
|
|
||||||
|
if (responseEntity.getStatusCode().is2xxSuccessful()) {
|
||||||
|
return new ByteArrayInputStream(HexToJpeg.hexStringToByteArray(responseEntity.getBody()));
|
||||||
|
}else {
|
||||||
|
throw new RuntimeException();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,14 @@
|
|||||||
package com.central.file.mapper;
|
package com.central.file.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.central.db.mapper.SuperMapper;
|
import com.central.db.mapper.SuperMapper;
|
||||||
|
|
||||||
import com.central.file.model.FileInfo;
|
import com.central.file.model.FileInfo;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 上传存储db
|
* 上传存储db
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,59 +1,58 @@
|
|||||||
package com.central.file.model;
|
package com.central.file.model;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.util.Date;
|
||||||
import java.util.Date;
|
|
||||||
|
/**
|
||||||
/**
|
* file实体类
|
||||||
* file实体类
|
*
|
||||||
*
|
* @author 作者 owen E-mail: 624191343@qq.com
|
||||||
* @author 作者 owen E-mail: 624191343@qq.com
|
*/
|
||||||
*/
|
@Data
|
||||||
@Data
|
@EqualsAndHashCode(callSuper = false)
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@TableName("file_info")
|
||||||
@TableName("file_info")
|
public class FileInfo extends Model<FileInfo> {
|
||||||
public class FileInfo extends Model<FileInfo> {
|
private static final long serialVersionUID = -1438078028040922174L;
|
||||||
private static final long serialVersionUID = -1438078028040922174L;
|
|
||||||
|
@TableId
|
||||||
@TableId
|
private String id;
|
||||||
private String id;
|
/**
|
||||||
/**
|
* 原始文件名
|
||||||
* 原始文件名
|
*/
|
||||||
*/
|
private String name;
|
||||||
private String name;
|
/**
|
||||||
/**
|
* 是否图片
|
||||||
* 是否图片
|
*/
|
||||||
*/
|
private Boolean isImg;
|
||||||
private Boolean isImg;
|
/**
|
||||||
/**
|
* 上传文件类型
|
||||||
* 上传文件类型
|
*/
|
||||||
*/
|
private String contentType;
|
||||||
private String contentType;
|
/**
|
||||||
/**
|
* 文件大小
|
||||||
* 文件大小
|
*/
|
||||||
*/
|
private long size;
|
||||||
private long size;
|
/**
|
||||||
/**
|
* 冗余字段
|
||||||
* 冗余字段
|
*/
|
||||||
*/
|
private String path;
|
||||||
private String path;
|
/**
|
||||||
/**
|
* oss访问路径 oss需要设置公共读
|
||||||
* oss访问路径 oss需要设置公共读
|
*/
|
||||||
*/
|
private String url;
|
||||||
private String url;
|
/**
|
||||||
/**
|
* FileType字段
|
||||||
* FileType字段
|
*/
|
||||||
*/
|
private String source;
|
||||||
private String source;
|
@TableField(fill = FieldFill.INSERT)
|
||||||
@TableField(fill = FieldFill.INSERT)
|
private Date createTime;
|
||||||
private Date createTime;
|
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
private Date updateTime;
|
||||||
private Date updateTime;
|
}
|
||||||
}
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.central.common.model.PageResult;
|
|||||||
import com.central.file.model.FileInfo;
|
import com.central.file.model.FileInfo;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -16,6 +17,8 @@ import java.util.Map;
|
|||||||
public interface IFileService extends IService<FileInfo> {
|
public interface IFileService extends IService<FileInfo> {
|
||||||
FileInfo upload(MultipartFile file ) throws Exception;
|
FileInfo upload(MultipartFile file ) throws Exception;
|
||||||
|
|
||||||
|
FileInfo upload(String name, InputStream inputStream) throws Exception;
|
||||||
|
|
||||||
PageResult<FileInfo> findList(Map<String, Object> params);
|
PageResult<FileInfo> findList(Map<String, Object> params);
|
||||||
|
|
||||||
void delete(String id);
|
void delete(String id);
|
||||||
@@ -23,4 +26,6 @@ public interface IFileService extends IService<FileInfo> {
|
|||||||
void out(String id, OutputStream os);
|
void out(String id, OutputStream os);
|
||||||
|
|
||||||
String getViewUrl(String id);
|
String getViewUrl(String id);
|
||||||
|
|
||||||
|
FileInfo getFileInfo(String id);
|
||||||
}
|
}
|
||||||
|
|||||||
+33
-9
@@ -1,21 +1,21 @@
|
|||||||
package com.central.file.service.impl;
|
package com.central.file.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.central.oss.model.ObjectInfo;
|
|
||||||
import org.apache.commons.collections4.MapUtils;
|
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
|
|
||||||
import com.central.common.model.PageResult;
|
import com.central.common.model.PageResult;
|
||||||
import com.central.file.mapper.FileMapper;
|
import com.central.file.mapper.FileMapper;
|
||||||
import com.central.file.model.FileInfo;
|
import com.central.file.model.FileInfo;
|
||||||
import com.central.file.service.IFileService;
|
import com.central.file.service.IFileService;
|
||||||
import com.central.file.utils.FileUtil;
|
import com.central.file.utils.FileUtil;
|
||||||
|
import com.central.oss.model.ObjectInfo;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections4.MapUtils;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AbstractIFileService 抽取类
|
* AbstractIFileService 抽取类
|
||||||
@@ -44,6 +44,23 @@ public abstract class AbstractIFileService extends ServiceImpl<FileMapper, FileI
|
|||||||
return fileInfo;
|
return fileInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FileInfo upload(String name, InputStream inputStream) throws IOException {
|
||||||
|
FileInfo fileInfo = FileUtil.getFileInfo(name, inputStream);
|
||||||
|
if (!fileInfo.getName().contains(FILE_SPLIT)) {
|
||||||
|
throw new IllegalArgumentException("缺少后缀名");
|
||||||
|
}
|
||||||
|
ObjectInfo objectInfo = uploadFile(name, inputStream);
|
||||||
|
fileInfo.setPath(objectInfo.getObjectPath());
|
||||||
|
fileInfo.setUrl(objectInfo.getObjectUrl());
|
||||||
|
// 设置文件来源
|
||||||
|
fileInfo.setSource(fileType());
|
||||||
|
// 将文件信息保存到数据库
|
||||||
|
baseMapper.insert(fileInfo);
|
||||||
|
|
||||||
|
return fileInfo;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件来源
|
* 文件来源
|
||||||
*
|
*
|
||||||
@@ -58,6 +75,13 @@ public abstract class AbstractIFileService extends ServiceImpl<FileMapper, FileI
|
|||||||
*/
|
*/
|
||||||
protected abstract ObjectInfo uploadFile(MultipartFile file);
|
protected abstract ObjectInfo uploadFile(MultipartFile file);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传文件
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
*/
|
||||||
|
protected abstract ObjectInfo uploadFile(String name, InputStream inputStream) throws IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除文件
|
* 删除文件
|
||||||
* @param id 文件id
|
* @param id 文件id
|
||||||
@@ -82,6 +106,6 @@ public abstract class AbstractIFileService extends ServiceImpl<FileMapper, FileI
|
|||||||
public PageResult<FileInfo> findList(Map<String, Object> params) {
|
public PageResult<FileInfo> findList(Map<String, Object> params) {
|
||||||
Page<FileInfo> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
|
Page<FileInfo> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
|
||||||
List<FileInfo> list = baseMapper.findList(page, params);
|
List<FileInfo> list = baseMapper.findList(page, params);
|
||||||
return PageResult.<FileInfo>builder().data(list).code(0).count(page.getTotal()).build();
|
return PageResult.<FileInfo>builder().data(list).resp_code(0).count(page.getTotal()).build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-4
@@ -12,6 +12,8 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -36,6 +38,11 @@ public class CosService extends AbstractIFileService {
|
|||||||
return cosTemplate.upload(file);
|
return cosTemplate.upload(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ObjectInfo uploadFile(String name, InputStream inputStream) throws IOException {
|
||||||
|
return cosTemplate.upload(name, inputStream,inputStream.available(),"image/jpeg");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void deleteFile(String objectPath) {
|
protected void deleteFile(String objectPath) {
|
||||||
COSObject cosObject = parsePath(objectPath);
|
COSObject cosObject = parsePath(objectPath);
|
||||||
@@ -60,6 +67,11 @@ public class CosService extends AbstractIFileService {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FileInfo getFileInfo(String id) {
|
||||||
|
return baseMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
private COSObject parsePath(String path) {
|
private COSObject parsePath(String path) {
|
||||||
COSObject cosObject = new COSObject();
|
COSObject cosObject = new COSObject();
|
||||||
if (StrUtil.isNotEmpty(path)) {
|
if (StrUtil.isNotEmpty(path)) {
|
||||||
@@ -72,8 +84,4 @@ public class CosService extends AbstractIFileService {
|
|||||||
return cosObject;
|
return cosObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getThumbnailFile(COSObject cosObject) {
|
|
||||||
|
|
||||||
return cosTemplate.getViewUrl(cosObject.getBucketName(),cosObject.getKey(),1000);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+12
@@ -1,5 +1,6 @@
|
|||||||
package com.central.file.service.impl;
|
package com.central.file.service.impl;
|
||||||
|
|
||||||
|
import com.central.file.model.FileInfo;
|
||||||
import com.central.oss.model.ObjectInfo;
|
import com.central.oss.model.ObjectInfo;
|
||||||
import com.central.oss.properties.FileServerProperties;
|
import com.central.oss.properties.FileServerProperties;
|
||||||
import com.central.oss.template.FdfsTemplate;
|
import com.central.oss.template.FdfsTemplate;
|
||||||
@@ -8,6 +9,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -33,6 +35,11 @@ public class FastdfsService extends AbstractIFileService {
|
|||||||
return fdfsTemplate.upload(file);
|
return fdfsTemplate.upload(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ObjectInfo uploadFile(String name, InputStream inputStream) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void deleteFile(String objectPath) {
|
protected void deleteFile(String objectPath) {
|
||||||
fdfsTemplate.delete(objectPath);
|
fdfsTemplate.delete(objectPath);
|
||||||
@@ -46,4 +53,9 @@ public class FastdfsService extends AbstractIFileService {
|
|||||||
public String getViewUrl(String id) {
|
public String getViewUrl(String id) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FileInfo getFileInfo(String id) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -38,6 +39,11 @@ public class S3Service extends AbstractIFileService {
|
|||||||
return s3Template.upload(file);
|
return s3Template.upload(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ObjectInfo uploadFile(String name, InputStream inputStream) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void deleteFile(String objectPath) {
|
protected void deleteFile(String objectPath) {
|
||||||
S3Object s3Object = parsePath(objectPath);
|
S3Object s3Object = parsePath(objectPath);
|
||||||
@@ -58,6 +64,11 @@ public class S3Service extends AbstractIFileService {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FileInfo getFileInfo(String id) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Setter
|
@Setter
|
||||||
@Getter
|
@Getter
|
||||||
private class S3Object {
|
private class S3Object {
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
package com.central.file.utils;
|
package com.central.file.utils;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import com.central.file.model.FileInfo;
|
import com.central.file.model.FileInfo;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.codec.digest.DigestUtils;
|
import org.apache.commons.codec.digest.DigestUtils;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件工具类
|
* 文件工具类
|
||||||
*
|
*
|
||||||
@@ -33,6 +33,16 @@ public class FileUtil {
|
|||||||
return fileInfo;
|
return fileInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static FileInfo getFileInfo(String name, InputStream inputStream) {
|
||||||
|
FileInfo fileInfo = new FileInfo();
|
||||||
|
fileInfo.setId(IdUtil.fastSimpleUUID());
|
||||||
|
fileInfo.setName(name);
|
||||||
|
fileInfo.setContentType("image/jpeg");
|
||||||
|
fileInfo.setIsImg(fileInfo.getContentType().startsWith("image/"));
|
||||||
|
fileInfo.setCreateTime(new Date());
|
||||||
|
return fileInfo;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件的md5
|
* 文件的md5
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package com.central.file.utils;
|
||||||
|
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
|
||||||
|
public class HexToJpeg {
|
||||||
|
|
||||||
|
public static void hexToBinary(String hexData, String outputFilePath) {
|
||||||
|
try (FileOutputStream fos = new FileOutputStream(outputFilePath)) {
|
||||||
|
byte[] binaryData = hexStringToByteArray(hexData);
|
||||||
|
fos.write(binaryData);
|
||||||
|
System.out.println("文件已保存至:" + outputFilePath);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static byte[] hexStringToByteArray(String hex) {
|
||||||
|
int len = hex.length();
|
||||||
|
byte[] data = new byte[len / 2];
|
||||||
|
for (int i = 0; i < len; i += 2) {
|
||||||
|
data[i / 2] = (byte) ((Character.digit(hex.charAt(i), 16) << 4)
|
||||||
|
+ Character.digit(hex.charAt(i + 1), 16));
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
spring:
|
spring:
|
||||||
datasource:
|
datasource:
|
||||||
url: jdbc:mysql://${zlt.datasource.ip}/file_center?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&zeroDateTimeBehavior=convertToNull&serverTimezone=Asia/Shanghai
|
url: jdbc:mysql://${zlt.datasource.ip}/file-center?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&zeroDateTimeBehavior=convertToNull&serverTimezone=Asia/Shanghai
|
||||||
username: ${zlt.datasource.username}
|
username: ${zlt.datasource.username}
|
||||||
password: ${zlt.datasource.password}
|
password: ${zlt.datasource.password}
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ server:
|
|||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
name: file-center
|
name: file-center
|
||||||
# cloud:
|
cloud:
|
||||||
# nacos:
|
nacos:
|
||||||
# discovery:
|
discovery:
|
||||||
# ip: 119.45.169.13
|
ip: 119.45.169.13
|
||||||
|
|||||||
@@ -25,4 +25,4 @@
|
|||||||
<include refid="where" />
|
<include refid="where" />
|
||||||
order by t.create_time desc
|
order by t.create_time desc
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
+26
@@ -0,0 +1,26 @@
|
|||||||
|
//package com.central.order.config;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//import lombok.Getter;
|
||||||
|
//import lombok.Setter;
|
||||||
|
//import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
//
|
||||||
|
//@Getter
|
||||||
|
//@Setter
|
||||||
|
//@ConfigurationProperties(prefix = "tencent")
|
||||||
|
//public class TencentPayProperties {
|
||||||
|
//
|
||||||
|
// private String merchantId;
|
||||||
|
//
|
||||||
|
// private String merchantSerialNumber;
|
||||||
|
//
|
||||||
|
// private String apiV3Key;
|
||||||
|
//
|
||||||
|
// private String privateKeyPath;
|
||||||
|
//
|
||||||
|
// private String appId;
|
||||||
|
//
|
||||||
|
// private String appSecret;
|
||||||
|
//
|
||||||
|
// private String notifyUrl;
|
||||||
|
//}
|
||||||
+125
-9
@@ -6,9 +6,15 @@ import com.central.common.model.PageResult;
|
|||||||
import com.central.common.model.Result;
|
import com.central.common.model.Result;
|
||||||
import com.central.common.model.SysUser;
|
import com.central.common.model.SysUser;
|
||||||
import com.central.order.enums.OrderStatus;
|
import com.central.order.enums.OrderStatus;
|
||||||
|
import com.central.order.feign.FileCenterService;
|
||||||
import com.central.order.feign.UserCenterService;
|
import com.central.order.feign.UserCenterService;
|
||||||
import com.central.order.model.Order;
|
import com.central.order.model.Order;
|
||||||
|
import com.central.order.model.OrderFile;
|
||||||
|
import com.central.order.model.QrCode;
|
||||||
|
import com.central.order.service.IOrderFileService;
|
||||||
import com.central.order.service.IOrderService;
|
import com.central.order.service.IOrderService;
|
||||||
|
import com.central.order.service.IQrCodeService;
|
||||||
|
import com.central.order.service.ITourismService;
|
||||||
import com.wechat.pay.java.core.exception.ServiceException;
|
import com.wechat.pay.java.core.exception.ServiceException;
|
||||||
import com.wechat.pay.java.service.payments.jsapi.JsapiServiceExtension;
|
import com.wechat.pay.java.service.payments.jsapi.JsapiServiceExtension;
|
||||||
import com.wechat.pay.java.service.payments.jsapi.model.*;
|
import com.wechat.pay.java.service.payments.jsapi.model.*;
|
||||||
@@ -23,6 +29,9 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -41,11 +50,34 @@ public class OrderController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IOrderService orderService;
|
private IOrderService orderService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IOrderFileService orderFileService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ITourismService tourismService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserCenterService userCenterService;
|
private UserCenterService userCenterService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FileCenterService fileCenterService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private JsapiServiceExtension service;
|
private JsapiServiceExtension service;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IQrCodeService qrCodeService;
|
||||||
|
|
||||||
|
// @Value("tencent.appid")
|
||||||
|
private String appId = "wx30a3c8de94a85584" ;
|
||||||
|
|
||||||
|
// @Value("tencent.merchantId")
|
||||||
|
private String mchid = "1703796518";
|
||||||
|
|
||||||
|
// @Value("tencent.notifyUrl")
|
||||||
|
private String notifyUrl = "http://img.goflytec.com/api-order/wechat/pay/notify" ;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列表
|
* 列表
|
||||||
*/
|
*/
|
||||||
@@ -56,7 +88,53 @@ public class OrderController {
|
|||||||
})
|
})
|
||||||
@GetMapping
|
@GetMapping
|
||||||
public PageResult list(@RequestParam Map<String, Object> params) {
|
public PageResult list(@RequestParam Map<String, Object> params) {
|
||||||
return orderService.findList(params);
|
params.put("userId", LoginUserContextHolder.getUser().getId());
|
||||||
|
return orderService.findListByUser(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列表
|
||||||
|
*/
|
||||||
|
@Operation(summary = "查询列表")
|
||||||
|
@Parameters({
|
||||||
|
@Parameter(name = "page",description = "分页起始位置",required = true,in=ParameterIn.QUERY),
|
||||||
|
@Parameter(name = "limit",description = "分页结束位置",required = true,in=ParameterIn.QUERY)
|
||||||
|
})
|
||||||
|
@GetMapping("/user")
|
||||||
|
public PageResult<Map> listByUser(@RequestParam Map<String, Object> params) {
|
||||||
|
LoginAppUser user = LoginUserContextHolder.getUser();
|
||||||
|
params.put("userId", user.getId());
|
||||||
|
|
||||||
|
// 获取当前日期,格式化为 yyyyMMdd
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
|
||||||
|
PageResult<Order> result = orderService.findListByUser(params);
|
||||||
|
if (result.getCount() > 0){
|
||||||
|
List<Map> page = new ArrayList();
|
||||||
|
for(Order order : result.getData()){
|
||||||
|
Map<String,Object> orderFileMap = new HashMap<>();
|
||||||
|
orderFileMap.put("time", sdf.format(order.getCreateTime()));
|
||||||
|
orderFileMap.put("addr", tourismService.getTourismById(order.getTourismId()).getTourismAddress());
|
||||||
|
orderFileMap.put("orderNo", order.getOrderNo());
|
||||||
|
List<OrderFile> list = orderFileService.getOrderFileByOrderNo(order.getOrderNo());
|
||||||
|
List<Map> resultList = new ArrayList<>();
|
||||||
|
if (list.size() > 0){
|
||||||
|
for (OrderFile orderFile : list){
|
||||||
|
Map imgMap = new HashMap();
|
||||||
|
imgMap.put("url", fileCenterService.getViewUrl(orderFile.getFileId()));
|
||||||
|
OrderFile file = orderFileService.getOrderFileByFileId(orderFile.getFileId());
|
||||||
|
if (file != null){
|
||||||
|
imgMap.put("contentType", file.getFileType());
|
||||||
|
}
|
||||||
|
resultList.add(imgMap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
orderFileMap.put("imgList", resultList);
|
||||||
|
page.add(orderFileMap);
|
||||||
|
}
|
||||||
|
return PageResult.<Map>builder().data(page).resp_code(0).count(result.getCount()).build();
|
||||||
|
}
|
||||||
|
return new PageResult<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -72,6 +150,11 @@ public class OrderController {
|
|||||||
|
|
||||||
LoginAppUser user = LoginUserContextHolder.getUser();
|
LoginAppUser user = LoginUserContextHolder.getUser();
|
||||||
order.setUserId(user.getId());
|
order.setUserId(user.getId());
|
||||||
|
QrCode qrCode = qrCodeService.getByCodeId(order.getCodeId());
|
||||||
|
if (qrCode != null){
|
||||||
|
order.setTourismId(qrCode.getTourismId());
|
||||||
|
order.setDeviceSn(qrCode.getDeviceSn());
|
||||||
|
}
|
||||||
boolean result = orderService.createOrder(order);
|
boolean result = orderService.createOrder(order);
|
||||||
if (result) {
|
if (result) {
|
||||||
return Result.succeed(order,"订单创建成功");
|
return Result.succeed(order,"订单创建成功");
|
||||||
@@ -91,17 +174,23 @@ public class OrderController {
|
|||||||
public Result<PrepayWithRequestPaymentResponse> payOrder(@PathVariable("orderId") Long orderId) {
|
public Result<PrepayWithRequestPaymentResponse> payOrder(@PathVariable("orderId") Long orderId) {
|
||||||
|
|
||||||
SysUser user = userCenterService.findUserById(LoginUserContextHolder.getUser().getId());
|
SysUser user = userCenterService.findUserById(LoginUserContextHolder.getUser().getId());
|
||||||
|
if (user == null){
|
||||||
|
return Result.failed("登录信息失效");
|
||||||
|
}
|
||||||
Order order = orderService.getById(orderId);
|
Order order = orderService.getById(orderId);
|
||||||
|
if (order == null) {
|
||||||
|
return Result.failed("订单数据不存在");
|
||||||
|
}
|
||||||
|
|
||||||
// request.setXxx(val)设置所需参数,具体参数可见Request定义
|
// request.setXxx(val)设置所需参数,具体参数可见Request定义
|
||||||
PrepayRequest request = new PrepayRequest();
|
PrepayRequest request = new PrepayRequest();
|
||||||
Amount amount = new Amount();
|
Amount amount = new Amount();
|
||||||
amount.setTotal(100);
|
amount.setTotal(Integer.parseInt(order.getOrderAmount()));
|
||||||
request.setAmount(amount);
|
request.setAmount(amount);
|
||||||
request.setAppid("wx30a3c8de94a85584");
|
request.setAppid(appId);
|
||||||
request.setMchid("1703796518");
|
request.setMchid(mchid);
|
||||||
request.setDescription("测试商品标题");
|
request.setDescription(order.getOrderNo());
|
||||||
request.setNotifyUrl("https://notify_url");
|
request.setNotifyUrl(notifyUrl);
|
||||||
request.setOutTradeNo(order.getOrderNo());
|
request.setOutTradeNo(order.getOrderNo());
|
||||||
Payer payer = new Payer();
|
Payer payer = new Payer();
|
||||||
payer.setOpenid(user.getOpenId());
|
payer.setOpenid(user.getOpenId());
|
||||||
@@ -110,7 +199,20 @@ public class OrderController {
|
|||||||
// response包含了调起支付所需的所有参数,可直接用于前端调起支付
|
// response包含了调起支付所需的所有参数,可直接用于前端调起支付
|
||||||
PrepayWithRequestPaymentResponse response = service.prepayWithRequestPayment(request);
|
PrepayWithRequestPaymentResponse response = service.prepayWithRequestPayment(request);
|
||||||
|
|
||||||
return Result.succeed(response,"成功");
|
return Result.succeed(response, order.getOrderNo());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取排队总览信息
|
||||||
|
@GetMapping("/queue/info")
|
||||||
|
public Result<Map> getQueueInfo() {
|
||||||
|
Double price = 25.0;
|
||||||
|
long execTime = 3; //一单执行时间默认3分钟
|
||||||
|
Long count = orderService.getOrderCountByStatus(OrderStatus.PAID.getId());
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
map.put("count", count);
|
||||||
|
map.put("time",Math.multiplyExact(count,execTime));
|
||||||
|
map.put("price",price);
|
||||||
|
return Result.succeed(map,"获取成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取排队中的订单列表
|
// 获取排队中的订单列表
|
||||||
@@ -127,8 +229,8 @@ public class OrderController {
|
|||||||
return Result.succeed("排队订单处理已启动");
|
return Result.succeed("排队订单处理已启动");
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/update")
|
@PatchMapping("/update/{orderNo}")
|
||||||
public Result<String> updateOrderStatus(@RequestBody String orderNo) {
|
public Result<String> updateOrderStatus(@PathVariable String orderNo) {
|
||||||
Transaction transaction = queryOrderByOutTradeNo(orderNo);
|
Transaction transaction = queryOrderByOutTradeNo(orderNo);
|
||||||
if (transaction != null && transaction.getTradeState().equals(Transaction.TradeStateEnum.SUCCESS)){
|
if (transaction != null && transaction.getTradeState().equals(Transaction.TradeStateEnum.SUCCESS)){
|
||||||
Order order = orderService.getOrderByNumber(transaction.getOutTradeNo());
|
Order order = orderService.getOrderByNumber(transaction.getOutTradeNo());
|
||||||
@@ -141,6 +243,8 @@ public class OrderController {
|
|||||||
return Result.failed("未查询到订单数据");
|
return Result.failed("未查询到订单数据");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** 商户订单号查询订单 */
|
/** 商户订单号查询订单 */
|
||||||
public Transaction queryOrderByOutTradeNo(String outTradeNo) {
|
public Transaction queryOrderByOutTradeNo(String outTradeNo) {
|
||||||
|
|
||||||
@@ -164,4 +268,16 @@ public class OrderController {
|
|||||||
System.out.printf("reponse body=[%s]\n", e.getResponseBody());
|
System.out.printf("reponse body=[%s]\n", e.getResponseBody());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PutMapping("/{id}")
|
||||||
|
public Result cancelOrder(@PathVariable("id") Long id) {
|
||||||
|
|
||||||
|
Order order = orderService.getById(id);
|
||||||
|
order.setOrderStatus(OrderStatus.CANCELED.getId());
|
||||||
|
boolean res = orderService.updateOrder(order);
|
||||||
|
if (res){
|
||||||
|
return Result.succeed("已取消");
|
||||||
|
}
|
||||||
|
return Result.failed("请重试");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+35
-1
@@ -7,6 +7,7 @@ import com.central.common.model.Result;
|
|||||||
import com.central.order.feign.FileCenterService;
|
import com.central.order.feign.FileCenterService;
|
||||||
import com.central.order.model.OrderFile;
|
import com.central.order.model.OrderFile;
|
||||||
import com.central.order.service.IOrderFileService;
|
import com.central.order.service.IOrderFileService;
|
||||||
|
import com.central.order.service.ITourismService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.Parameters;
|
import io.swagger.v3.oas.annotations.Parameters;
|
||||||
@@ -40,6 +41,9 @@ public class OrderFileController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private FileCenterService fileCenterService;
|
private FileCenterService fileCenterService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ITourismService tourismService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列表
|
* 列表
|
||||||
*/
|
*/
|
||||||
@@ -53,10 +57,26 @@ public class OrderFileController {
|
|||||||
return orderFileService.findList(params);
|
return orderFileService.findList(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列表
|
||||||
|
*/
|
||||||
|
@Operation(summary = "查询用户列表")
|
||||||
|
@Parameters({
|
||||||
|
@Parameter(name = "page",description = "分页起始位置",required = true,in=ParameterIn.QUERY),
|
||||||
|
@Parameter(name = "limit",description = "分页结束位置",required = true,in=ParameterIn.QUERY)
|
||||||
|
})
|
||||||
|
@GetMapping("/user")
|
||||||
|
public PageResult listByUser(@RequestParam Map<String, Object> params) {
|
||||||
|
LoginAppUser user = LoginUserContextHolder.getUser();
|
||||||
|
params.put("userId", user.getId());
|
||||||
|
return orderFileService.findListByUser(params);
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public Result<OrderFile> createOrderFile(@RequestBody OrderFile orderFile) {
|
public Result<OrderFile> createOrderFile(@RequestBody OrderFile orderFile) {
|
||||||
|
|
||||||
LoginAppUser user = LoginUserContextHolder.getUser();
|
LoginAppUser user = LoginUserContextHolder.getUser();
|
||||||
|
orderFile.setFileType(fileCenterService.getFileContentType(orderFile.getFileId()));
|
||||||
orderFile.setUserId(user.getId());
|
orderFile.setUserId(user.getId());
|
||||||
boolean result = orderFileService.createOrderFile(orderFile);
|
boolean result = orderFileService.createOrderFile(orderFile);
|
||||||
if (result) {
|
if (result) {
|
||||||
@@ -74,7 +94,7 @@ public class OrderFileController {
|
|||||||
return Result.succeed(orderFile,"获取成功");
|
return Result.succeed(orderFile,"获取成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/{orderNo}")
|
@GetMapping("/order/{orderNo}")
|
||||||
public Result<List<OrderFile>> getOrderFiles(@PathVariable("orderNo") String orderNo) {
|
public Result<List<OrderFile>> getOrderFiles(@PathVariable("orderNo") String orderNo) {
|
||||||
List<OrderFile> orderFiles = orderFileService.getOrderFileByOrderNo(orderNo);
|
List<OrderFile> orderFiles = orderFileService.getOrderFileByOrderNo(orderNo);
|
||||||
if (!CollectionUtils.isEmpty(orderFiles)) {
|
if (!CollectionUtils.isEmpty(orderFiles)) {
|
||||||
@@ -88,4 +108,18 @@ public class OrderFileController {
|
|||||||
return Result.succeed(orderFiles);
|
return Result.succeed(orderFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/user/{userId}")
|
||||||
|
public Result<Map<String,Object>> getUserOrderFiles(@PathVariable("userId") Long userId) {
|
||||||
|
List<OrderFile> orderFiles = orderFileService.getOrderFileByUserId(userId);
|
||||||
|
if (!CollectionUtils.isEmpty(orderFiles)) {
|
||||||
|
for (OrderFile orderFile : orderFiles) {
|
||||||
|
String viewUrl = fileCenterService.getViewUrl(orderFile.getFileId());
|
||||||
|
orderFile.setViewUrl(viewUrl);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
return Result.failed("暂无数据");
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+83
@@ -0,0 +1,83 @@
|
|||||||
|
package com.central.order.controller;
|
||||||
|
|
||||||
|
import com.central.common.model.PageResult;
|
||||||
|
import com.central.common.model.Result;
|
||||||
|
import com.central.order.feign.FileCenterService;
|
||||||
|
import com.central.order.model.QrCode;
|
||||||
|
import com.central.order.service.IQrCodeService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameters;
|
||||||
|
import io.swagger.v3.oas.annotations.enums.ParameterIn;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* qrcode information
|
||||||
|
*
|
||||||
|
* @author lsl
|
||||||
|
* @date 2024-12-19 17:51:47
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@Tag(name = "Qrcode information")
|
||||||
|
@RequestMapping("/qrcode")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class QrCodeController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IQrCodeService qrCodeService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FileCenterService fileCenterService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列表
|
||||||
|
*/
|
||||||
|
@Operation(summary = "查询列表")
|
||||||
|
@Parameters({
|
||||||
|
@Parameter(name = "page",description = "分页起始位置",required = true,in=ParameterIn.QUERY),
|
||||||
|
@Parameter(name = "limit",description = "分页结束位置",required = true,in=ParameterIn.QUERY)
|
||||||
|
})
|
||||||
|
@GetMapping
|
||||||
|
public PageResult list(@RequestParam Map<String, Object> params) {
|
||||||
|
return qrCodeService.findList(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
public Result<QrCode> createQrCode(@RequestBody QrCode qrCode) throws Exception {
|
||||||
|
String codeId = UUID.randomUUID().toString();
|
||||||
|
Result<Map> result = fileCenterService.uploadQrCodeFile(codeId);
|
||||||
|
if (result.getResp_code() == 0){
|
||||||
|
qrCode.setCodeId(codeId);
|
||||||
|
qrCode.setTourismId(32L);
|
||||||
|
qrCode.setPath(result.getData().get("filePath").toString());
|
||||||
|
qrCode.setFileId(result.getData().get("fileId").toString());
|
||||||
|
boolean res = qrCodeService.save(qrCode);
|
||||||
|
if (res) {
|
||||||
|
return Result.succeed(qrCode,"qrcode创建成功");
|
||||||
|
} else {
|
||||||
|
return Result.failed("qrcode创建失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Result.failed("创建失败");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{codeId}")
|
||||||
|
public Result<QrCode> getQrCode(@PathVariable("codeId") String codeId) {
|
||||||
|
QrCode qrCode = qrCodeService.getByCodeId(codeId);
|
||||||
|
if (qrCode == null) {
|
||||||
|
return Result.failed("暂无数据");
|
||||||
|
}
|
||||||
|
return Result.succeed(qrCode,"获取成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
-69
@@ -1,69 +0,0 @@
|
|||||||
//package com.central.order.controller;
|
|
||||||
//
|
|
||||||
//import org.springframework.beans.factory.annotation.Value;
|
|
||||||
//import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
//import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
//import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
//import org.springframework.web.bind.annotation.RestController;
|
|
||||||
//import org.springframework.web.util.WebUtils;
|
|
||||||
//
|
|
||||||
//import javax.servlet.http.HttpServletRequest;
|
|
||||||
//import javax.servlet.http.HttpServletResponse;
|
|
||||||
//import java.security.MessageDigest;
|
|
||||||
//import java.security.NoSuchAlgorithmException;
|
|
||||||
//import java.util.Arrays;
|
|
||||||
//
|
|
||||||
//@RestController
|
|
||||||
//@RequestMapping("/wechat")
|
|
||||||
//public class WeChatMessageController {
|
|
||||||
//
|
|
||||||
// @Value("${wechat.token}")
|
|
||||||
// private String token;
|
|
||||||
//
|
|
||||||
// @GetMapping("/message")
|
|
||||||
// public String verify(HttpServletRequest request, HttpServletResponse response) {
|
|
||||||
// String signature = request.getParameter("signature");
|
|
||||||
// String timestamp = request.getParameter("timestamp");
|
|
||||||
// String nonce = request.getParameter("nonce");
|
|
||||||
// String echostr = request.getParameter("echostr");
|
|
||||||
// String[] arr = new String[]{token, timestamp, nonce};
|
|
||||||
// Arrays.sort(arr);
|
|
||||||
// StringBuilder content = new StringBuilder();
|
|
||||||
// for (String s : arr) {
|
|
||||||
// content.append(s);
|
|
||||||
// }
|
|
||||||
// String mySignature = null;
|
|
||||||
// try {
|
|
||||||
// mySignature = getSHA1(content.toString());
|
|
||||||
// } catch (NoSuchAlgorithmException e) {
|
|
||||||
// e.printStackTrace();
|
|
||||||
// }
|
|
||||||
// if (mySignature!= null && mySignature.equals(signature)) {
|
|
||||||
// return echostr;
|
|
||||||
// } else {
|
|
||||||
// return "";
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @PostMapping("/message")
|
|
||||||
// public void receiveMessage(HttpServletRequest request, HttpServletResponse response) {
|
|
||||||
// try {
|
|
||||||
// String xmlData = WebUtils.toString(request.getInputStream(), "UTF-8");
|
|
||||||
// // 对 xmlData 进行解析和处理,可根据业务需求添加相应逻辑
|
|
||||||
// System.out.println(xmlData);
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// e.printStackTrace();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private String getSHA1(String str) throws NoSuchAlgorithmException {
|
|
||||||
// MessageDigest md = MessageDigest.getInstance("SHA1");
|
|
||||||
// md.update(str.getBytes());
|
|
||||||
// byte[] digest = md.digest();
|
|
||||||
// StringBuilder hexStr = new StringBuilder();
|
|
||||||
// for (byte b : digest) {
|
|
||||||
// hexStr.append(String.format("%02x", b & 0xFF));
|
|
||||||
// }
|
|
||||||
// return hexStr.toString();
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
@@ -5,7 +5,7 @@ import lombok.Getter;
|
|||||||
/**
|
/**
|
||||||
* 订单状态枚举类型
|
* 订单状态枚举类型
|
||||||
*
|
*
|
||||||
* @author jarvis create by 2023/1/10
|
* @author lsl create by 2025/1/10
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
public enum OrderStatus implements ZltEnum {
|
public enum OrderStatus implements ZltEnum {
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
package com.central.order.feign;
|
package com.central.order.feign;
|
||||||
|
|
||||||
import com.central.common.constant.ServiceNameConstants;
|
import com.central.common.constant.ServiceNameConstants;
|
||||||
|
import com.central.common.model.Result;
|
||||||
import com.central.order.feign.fallback.FileCenterServiceFallbackFactory;
|
import com.central.order.feign.fallback.FileCenterServiceFallbackFactory;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* user-center模块远程调用
|
* user-center模块远程调用
|
||||||
*
|
*
|
||||||
@@ -25,4 +28,10 @@ public interface FileCenterService {
|
|||||||
*/
|
*/
|
||||||
@GetMapping("/files/{id}")
|
@GetMapping("/files/{id}")
|
||||||
String getViewUrl(@PathVariable("id") String id);
|
String getViewUrl(@PathVariable("id") String id);
|
||||||
|
|
||||||
|
@GetMapping("/type/{id}")
|
||||||
|
String getFileContentType(@PathVariable("id") String id);
|
||||||
|
|
||||||
|
@GetMapping("/qrcode/{codeId}")
|
||||||
|
Result<Map> uploadQrCodeFile(@PathVariable("codeId") String codeId) throws Exception;
|
||||||
}
|
}
|
||||||
|
|||||||
+14
@@ -1,10 +1,13 @@
|
|||||||
package com.central.order.feign.fallback;
|
package com.central.order.feign.fallback;
|
||||||
|
|
||||||
|
import com.central.common.model.Result;
|
||||||
import com.central.order.feign.FileCenterService;
|
import com.central.order.feign.FileCenterService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件中心调用失败回调
|
* 文件中心调用失败回调
|
||||||
*
|
*
|
||||||
@@ -25,6 +28,17 @@ public class FileCenterServiceFallbackFactory implements FallbackFactory<FileCen
|
|||||||
public String getViewUrl(String id) {
|
public String getViewUrl(String id) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getFileContentType(String id) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<Map> uploadQrCodeFile(String codeId) throws Exception {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,4 +36,6 @@ public interface OrderFileMapper extends SuperMapper<OrderFile> {
|
|||||||
// 查询所有处于排队状态的订单,用于后续按顺序处理(可根据业务需求添加排序等逻辑)
|
// 查询所有处于排队状态的订单,用于后续按顺序处理(可根据业务需求添加排序等逻辑)
|
||||||
List<OrderFile> getOrderFilesByUserId(@Param("userId") Long userId);
|
List<OrderFile> getOrderFilesByUserId(@Param("userId") Long userId);
|
||||||
|
|
||||||
|
List<OrderFile> findListByUser(Page<OrderFile> page, @Param("p") Map<String, Object> params);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,5 +43,6 @@ public interface OrderMapper extends SuperMapper<Order> {
|
|||||||
// 根据订单编号查询订单信息
|
// 根据订单编号查询订单信息
|
||||||
Order getOrderByNumber(@Param("orderNumber") String orderNumber);
|
Order getOrderByNumber(@Param("orderNumber") String orderNumber);
|
||||||
|
|
||||||
|
List<Order> findListByUser(Page<Order> page, @Param("p") Map<String, Object> params);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package com.central.order.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.central.db.mapper.SuperMapper;
|
||||||
|
import com.central.order.model.QrCode;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Qrcode information
|
||||||
|
*
|
||||||
|
* @author lsl
|
||||||
|
* @date 2024-12-19 17:52:54
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface QrCodeMapper extends SuperMapper<QrCode> {
|
||||||
|
/**
|
||||||
|
* 分页查询用户列表
|
||||||
|
*
|
||||||
|
* @param page
|
||||||
|
* @param params
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<QrCode> findList(Page<QrCode> page, @Param("p") Map<String, Object> params);
|
||||||
|
|
||||||
|
|
||||||
|
// 新增二维码资源
|
||||||
|
int insertQrCode(QrCode qrCode);
|
||||||
|
// ID查询
|
||||||
|
QrCode getByCodeId(@Param("codeId") String codeId);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -7,6 +7,7 @@ import com.central.common.model.SuperEntity;
|
|||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
import org.springframework.data.annotation.Transient;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@@ -32,7 +33,11 @@ public class Order extends SuperEntity {
|
|||||||
|
|
||||||
private String orderAmount;
|
private String orderAmount;
|
||||||
private Integer orderStatus;
|
private Integer orderStatus;
|
||||||
|
|
||||||
private Date payTime;
|
private Date payTime;
|
||||||
|
private String createdTime;
|
||||||
|
@Transient
|
||||||
|
private String codeId;
|
||||||
@TableField(fill = FieldFill.INSERT)
|
@TableField(fill = FieldFill.INSERT)
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ public class OrderFile extends SuperEntity {
|
|||||||
private String viewUrl;
|
private String viewUrl;
|
||||||
// 景区ID
|
// 景区ID
|
||||||
private Long tourismId;
|
private Long tourismId;
|
||||||
|
|
||||||
|
private String fileType;
|
||||||
private String filePath;
|
private String filePath;
|
||||||
@TableField(fill = FieldFill.INSERT)
|
@TableField(fill = FieldFill.INSERT)
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package com.central.order.model;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.central.common.model.SuperEntity;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* qrcodes information
|
||||||
|
*
|
||||||
|
* @author lsl
|
||||||
|
* @date 2024-12-19 17:51:47
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@TableName("qrcodes")
|
||||||
|
public class QrCode extends SuperEntity {
|
||||||
|
|
||||||
|
private static final long serialVersionUID=1L;
|
||||||
|
|
||||||
|
private String codeId;
|
||||||
|
private Long tourismId;
|
||||||
|
|
||||||
|
private String path;
|
||||||
|
private String fileId;
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
private String deviceSn;
|
||||||
|
|
||||||
|
@TableField(fill = FieldFill.INSERT)
|
||||||
|
private Date createTime;
|
||||||
|
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||||
|
private Date updateTime;
|
||||||
|
//租户ID
|
||||||
|
private Long tenantId;
|
||||||
|
private String company;
|
||||||
|
private Integer isDel;
|
||||||
|
}
|
||||||
+6
@@ -21,6 +21,12 @@ public class OrderTimeoutScheduler {
|
|||||||
orderService.checkAndHandleOrderTimeout();
|
orderService.checkAndHandleOrderTimeout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 每隔一定时间(这里设置为每分钟检查一次,可根据实际情况调整)检查订单超时情况
|
||||||
|
@Scheduled(fixedRate = 60 * 1000)
|
||||||
|
public void checkOrderPaySuccess() {
|
||||||
|
orderService.updateOrderStatus();
|
||||||
|
}
|
||||||
|
|
||||||
// 每隔一定时间(这里设置为每分钟检查一次,可根据实际情况调整)检查订单超时情况
|
// 每隔一定时间(这里设置为每分钟检查一次,可根据实际情况调整)检查订单超时情况
|
||||||
@Scheduled(fixedRate = 60 * 1000)
|
@Scheduled(fixedRate = 60 * 1000)
|
||||||
public void processOrdersInQueue() {
|
public void processOrdersInQueue() {
|
||||||
|
|||||||
+7
@@ -21,6 +21,13 @@ public interface IOrderFileService extends ISuperService<OrderFile> {
|
|||||||
*/
|
*/
|
||||||
PageResult<OrderFile> findList(Map<String, Object> params);
|
PageResult<OrderFile> findList(Map<String, Object> params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列表
|
||||||
|
* @param params
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
PageResult<OrderFile> findListByUser(Map<String, Object> params);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建订单文件资源
|
* 创建订单文件资源
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -64,5 +64,24 @@ public interface IOrderService extends ISuperService<Order> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
boolean updateOrder(Order order);
|
boolean updateOrder(Order order);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取特定状态的订单数量
|
||||||
|
* @param status
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Long getOrderCountByStatus(Integer status);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取user订单记录
|
||||||
|
* @param params
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
PageResult findListByUser(Map<String, Object> params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自动查询订单并更新状态
|
||||||
|
*/
|
||||||
|
void updateOrderStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package com.central.order.service;
|
||||||
|
|
||||||
|
import com.central.common.model.PageResult;
|
||||||
|
import com.central.common.service.ISuperService;
|
||||||
|
import com.central.order.model.QrCode;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Qrcode file information
|
||||||
|
*
|
||||||
|
* @author lsl
|
||||||
|
* @date 2024-12-19 17:52:54
|
||||||
|
*/
|
||||||
|
public interface IQrCodeService extends ISuperService<QrCode> {
|
||||||
|
/**
|
||||||
|
* 列表
|
||||||
|
* @param params
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
PageResult<QrCode> findList(Map<String, Object> params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建
|
||||||
|
*
|
||||||
|
* @param qrCode
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean createQrCode(QrCode qrCode) ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id查询
|
||||||
|
* @param codeId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
QrCode getByCodeId(String codeId);
|
||||||
|
}
|
||||||
|
|
||||||
+8
-1
@@ -32,7 +32,14 @@ public class OrderFileServiceImpl extends SuperServiceImpl<OrderFileMapper, Orde
|
|||||||
public PageResult<OrderFile> findList(Map<String, Object> params){
|
public PageResult<OrderFile> findList(Map<String, Object> params){
|
||||||
Page<OrderFile> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
|
Page<OrderFile> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
|
||||||
List<OrderFile> list = baseMapper.findList(page, params);
|
List<OrderFile> list = baseMapper.findList(page, params);
|
||||||
return PageResult.<OrderFile>builder().data(list).code(0).count(page.getTotal()).build();
|
return PageResult.<OrderFile>builder().data(list).resp_code(0).count(page.getTotal()).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<OrderFile> findListByUser(Map<String, Object> params) {
|
||||||
|
Page<OrderFile> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
|
||||||
|
List<OrderFile> list = baseMapper.findListByUser(page, params);
|
||||||
|
return PageResult.<OrderFile>builder().data(list).resp_code(0).count(page.getTotal()).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+54
-5
@@ -9,6 +9,9 @@ import com.central.order.enums.OrderStatus;
|
|||||||
import com.central.order.mapper.OrderMapper;
|
import com.central.order.mapper.OrderMapper;
|
||||||
import com.central.order.model.Order;
|
import com.central.order.model.Order;
|
||||||
import com.central.order.service.IOrderService;
|
import com.central.order.service.IOrderService;
|
||||||
|
import com.wechat.pay.java.service.payments.jsapi.JsapiServiceExtension;
|
||||||
|
import com.wechat.pay.java.service.payments.jsapi.model.QueryOrderByOutTradeNoRequest;
|
||||||
|
import com.wechat.pay.java.service.payments.model.Transaction;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections4.MapUtils;
|
import org.apache.commons.collections4.MapUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -42,6 +45,12 @@ public class OrderServiceImpl extends SuperServiceImpl<OrderMapper, Order> imple
|
|||||||
private DistributedLock lock;
|
private DistributedLock lock;
|
||||||
|
|
||||||
private final ExecutorService executorService = Executors.newFixedThreadPool(10); // 线程池,可根据实际并发量调整大小
|
private final ExecutorService executorService = Executors.newFixedThreadPool(10); // 线程池,可根据实际并发量调整大小
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private JsapiServiceExtension service;
|
||||||
|
|
||||||
|
private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
||||||
|
private SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy MMdd");
|
||||||
/**
|
/**
|
||||||
* 列表
|
* 列表
|
||||||
* @param params
|
* @param params
|
||||||
@@ -50,15 +59,15 @@ public class OrderServiceImpl extends SuperServiceImpl<OrderMapper, Order> imple
|
|||||||
@Override
|
@Override
|
||||||
public PageResult<Order> findList(Map<String, Object> params){
|
public PageResult<Order> findList(Map<String, Object> params){
|
||||||
Page<Order> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
|
Page<Order> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
|
||||||
List<Order> list = baseMapper.findList(page, params);
|
List<Order> list = baseMapper.findListByUser(page, params);
|
||||||
return PageResult.<Order>builder().data(list).code(0).count(page.getTotal()).build();
|
return PageResult.<Order>builder().data(list).resp_code(0).count(page.getTotal()).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建订单,初始状态为“待支付”
|
// 创建订单,初始状态为“待支付”
|
||||||
@Override
|
@Override
|
||||||
public boolean createOrder(Order order) {
|
public boolean createOrder(Order order) {
|
||||||
order.setOrderStatus(OrderStatus.UNPAID.getId());
|
order.setOrderStatus(OrderStatus.UNPAID.getId());
|
||||||
String orderNo = generateOrderNumber(2L);
|
String orderNo = generateOrderNumber(order.getTourismId());
|
||||||
order.setOrderNo(orderNo);
|
order.setOrderNo(orderNo);
|
||||||
try {
|
try {
|
||||||
return super.saveIdempotency(order, lock
|
return super.saveIdempotency(order, lock
|
||||||
@@ -119,7 +128,7 @@ public class OrderServiceImpl extends SuperServiceImpl<OrderMapper, Order> imple
|
|||||||
//TODO
|
//TODO
|
||||||
// 这里假设已经有逻辑判断前面的用户是否消费完成,此处简化处理
|
// 这里假设已经有逻辑判断前面的用户是否消费完成,此处简化处理
|
||||||
// 通知用户进行消费操作(实际可能是推送消息等方式,这里仅打印示例)
|
// 通知用户进行消费操作(实际可能是推送消息等方式,这里仅打印示例)
|
||||||
System.out.println("通知用户 " + order.getUserId() + " 进行消费操作,订单编号:" + order.getId());
|
log.debug("通知用户 " + order.getUserId() + " 进行消费操作,订单编号:" + order.getId());
|
||||||
// 可以在这里更新订单状态为“已消费”等后续操作,根据实际业务完善
|
// 可以在这里更新订单状态为“已消费”等后续操作,根据实际业务完善
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -141,6 +150,46 @@ public class OrderServiceImpl extends SuperServiceImpl<OrderMapper, Order> imple
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getOrderCountByStatus(Integer status) {
|
||||||
|
return baseMapper.selectCount(new QueryWrapper<Order>().eq("order_status", status));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult findListByUser(Map<String, Object> params) {
|
||||||
|
Page<Order> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
|
||||||
|
List<Order> list = baseMapper.findListByUser(page, params);
|
||||||
|
if (list != null && list.size() > 0) {
|
||||||
|
for (Order order : list) {
|
||||||
|
order.setCreatedTime(sdf.format(order.getCreateTime()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return PageResult.<Order>builder().data(list).resp_code(0).count(page.getTotal()).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateOrderStatus() {
|
||||||
|
|
||||||
|
List<Order> orders = baseMapper.getOrdersByStatus(OrderStatus.UNPAID.getId());
|
||||||
|
if (orders != null && orders.size() > 0) {
|
||||||
|
for (Order order : orders) {
|
||||||
|
QueryOrderByOutTradeNoRequest request = new QueryOrderByOutTradeNoRequest();
|
||||||
|
// 调用request.setXxx(val)设置所需参数,具体参数可见Request定义
|
||||||
|
request.setOutTradeNo(order.getOrderNo());
|
||||||
|
request.setMchid("1703796518");
|
||||||
|
Transaction transaction = service.queryOrderByOutTradeNo(request);
|
||||||
|
if (transaction != null && transaction.getTradeState().equals(Transaction.TradeStateEnum.SUCCESS)){
|
||||||
|
|
||||||
|
order.setOrderStatus(OrderStatus.PAID.getId());
|
||||||
|
baseMapper.updateById(order);
|
||||||
|
log.debug("订单状态更新为已支付"+order.getOrderNo());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// 生成订单编号
|
// 生成订单编号
|
||||||
public String generateOrderNumber(Long tourismId) {
|
public String generateOrderNumber(Long tourismId) {
|
||||||
// 获取当前日期,格式化为 yyyyMMdd
|
// 获取当前日期,格式化为 yyyyMMdd
|
||||||
@@ -159,7 +208,7 @@ public class OrderServiceImpl extends SuperServiceImpl<OrderMapper, Order> imple
|
|||||||
int orderSequence = orderCount + 1;
|
int orderSequence = orderCount + 1;
|
||||||
|
|
||||||
// 格式化订单序号,确保序号长度固定(例如不足3位前面补0)
|
// 格式化订单序号,确保序号长度固定(例如不足3位前面补0)
|
||||||
String formattedSequence = String.format("%03d", orderSequence);
|
String formattedSequence = String.format("%05d", orderSequence);
|
||||||
|
|
||||||
// 拼接店铺编号、日期、订单序号形成订单编号
|
// 拼接店铺编号、日期、订单序号形成订单编号
|
||||||
return tourismId + currentDate + formattedSequence;
|
return tourismId + currentDate + formattedSequence;
|
||||||
|
|||||||
+1
-5
@@ -20,8 +20,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.ExecutorService;
|
|
||||||
import java.util.concurrent.Executors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Order information
|
* Order information
|
||||||
@@ -41,8 +39,6 @@ public class PaymentRecordServiceImpl extends SuperServiceImpl<PaymentRecordMapp
|
|||||||
@Autowired
|
@Autowired
|
||||||
private DistributedLock lock;
|
private DistributedLock lock;
|
||||||
|
|
||||||
private final ExecutorService executorService = Executors.newFixedThreadPool(10); // 线程池,可根据实际并发量调整大小
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IOrderService orderService;
|
private IOrderService orderService;
|
||||||
|
|
||||||
@@ -56,7 +52,7 @@ public class PaymentRecordServiceImpl extends SuperServiceImpl<PaymentRecordMapp
|
|||||||
public PageResult<PaymentRecord> findList(Map<String, Object> params) {
|
public PageResult<PaymentRecord> findList(Map<String, Object> params) {
|
||||||
Page<PaymentRecord> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
|
Page<PaymentRecord> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
|
||||||
List<PaymentRecord> list = baseMapper.findList(page, params);
|
List<PaymentRecord> list = baseMapper.findList(page, params);
|
||||||
return PageResult.<PaymentRecord>builder().data(list).code(0).count(page.getTotal()).build();
|
return PageResult.<PaymentRecord>builder().data(list).resp_code(0).count(page.getTotal()).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理订单支付逻辑,处理并发冲突和重复支付等问题
|
// 处理订单支付逻辑,处理并发冲突和重复支付等问题
|
||||||
|
|||||||
+54
@@ -0,0 +1,54 @@
|
|||||||
|
package com.central.order.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.central.common.model.PageResult;
|
||||||
|
import com.central.common.service.impl.SuperServiceImpl;
|
||||||
|
import com.central.order.mapper.QrCodeMapper;
|
||||||
|
import com.central.order.model.QrCode;
|
||||||
|
import com.central.order.service.IQrCodeService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections4.MapUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Order information
|
||||||
|
*
|
||||||
|
* @author lsl
|
||||||
|
* @date 2024-12-19 17:52:54
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class QrCodeServiceImpl extends SuperServiceImpl<QrCodeMapper, QrCode> implements IQrCodeService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列表
|
||||||
|
* @param params
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public PageResult<QrCode> findList(Map<String, Object> params){
|
||||||
|
Page<QrCode> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
|
||||||
|
List<QrCode> list = baseMapper.findList(page, params);
|
||||||
|
return PageResult.<QrCode>builder().data(list).resp_code(0).count(page.getTotal()).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean createQrCode(QrCode qrCode) {
|
||||||
|
int result = baseMapper.insert(qrCode);
|
||||||
|
if(result > 0){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public QrCode getByCodeId(String codeId) {
|
||||||
|
return baseMapper.getByCodeId(codeId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
+1
-1
@@ -32,7 +32,7 @@ public class TourismServiceImpl extends SuperServiceImpl<TourismMapper, Tourism>
|
|||||||
public PageResult<Tourism> findList(Map<String, Object> params){
|
public PageResult<Tourism> findList(Map<String, Object> params){
|
||||||
Page<Tourism> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
|
Page<Tourism> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
|
||||||
List<Tourism> list = baseMapper.findList(page, params);
|
List<Tourism> list = baseMapper.findList(page, params);
|
||||||
return PageResult.<Tourism>builder().data(list).code(0).count(page.getTotal()).build();
|
return PageResult.<Tourism>builder().data(list).resp_code(0).count(page.getTotal()).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -37,6 +37,9 @@ tencent:
|
|||||||
# 微信支付API证书路径(如果需要证书的情况下,这里填写证书相关文件的路径)
|
# 微信支付API证书路径(如果需要证书的情况下,这里填写证书相关文件的路径)
|
||||||
privateKeyPath: ${zlt.wxpay.privateKeyPath}
|
privateKeyPath: ${zlt.wxpay.privateKeyPath}
|
||||||
apiV3Key: ${zlt.wxpay.apiV3Key}
|
apiV3Key: ${zlt.wxpay.apiV3Key}
|
||||||
|
appSecret: ${zlt.security.tencent.app-secret}
|
||||||
|
accessTokenUrl: ${zlt.security.tencent.accessTokenUrl}
|
||||||
|
getwxacodeUrl: https://api.weixin.qq.com/wxa/getwxacode?access_token=
|
||||||
|
|
||||||
#审计日志
|
#审计日志
|
||||||
# audit-log:
|
# audit-log:
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ server:
|
|||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
name: order-center
|
name: order-center
|
||||||
# cloud:
|
cloud:
|
||||||
# nacos:
|
nacos:
|
||||||
# discovery:
|
discovery:
|
||||||
# ip: 119.45.169.13
|
ip: 119.45.169.13
|
||||||
# cloud:
|
# cloud:
|
||||||
# nacos:
|
# nacos:
|
||||||
# discovery:
|
# discovery:
|
||||||
|
|||||||
@@ -6,6 +6,11 @@
|
|||||||
select * from order_files t
|
select * from order_files t
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!-- 动态获取参数采用备参 -->
|
||||||
|
<select id="findListByUser" resultType="com.central.order.model.OrderFile">
|
||||||
|
select * from order_files t WHERE t.user_id = #{param2.userId}
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertOrderFile">
|
<insert id="insertOrderFile">
|
||||||
INSERT INTO order_files (user_id, order_no, file_id,tourism_id,file_path)
|
INSERT INTO order_files (user_id, order_no, file_id,tourism_id,file_path)
|
||||||
VALUES (#{userId}, #{order_no}, #{file_id}, #{tourism_id}, #{file_path})
|
VALUES (#{userId}, #{order_no}, #{file_id}, #{tourism_id}, #{file_path})
|
||||||
@@ -16,7 +21,7 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getFileByFileId" resultType="com.central.order.model.OrderFile">
|
<select id="getFileByFileId" resultType="com.central.order.model.OrderFile">
|
||||||
SELECT * FROM order_files WHERE id = #{fileId}
|
SELECT * FROM order_files WHERE file_id = #{fileId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getOrderFilesByUserId" resultType="com.central.order.model.OrderFile">
|
<select id="getOrderFilesByUserId" resultType="com.central.order.model.OrderFile">
|
||||||
|
|||||||
@@ -6,6 +6,11 @@
|
|||||||
select * from orders t
|
select * from orders t
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!-- 动态获取参数采用备参 -->
|
||||||
|
<select id="findListByUser" resultType="com.central.order.model.Order">
|
||||||
|
select id,order_no,tourism_id,device_sn,workspace_id,code_id,user_id,order_amount,order_status,create_time,update_time from orders t WHERE t.user_id = #{param2.userId}
|
||||||
|
</select>
|
||||||
|
|
||||||
<!-- 根据订单状态查询订单列表 -->
|
<!-- 根据订单状态查询订单列表 -->
|
||||||
<select id="getOrdersByStatus" resultMap="OrderResultMap">
|
<select id="getOrdersByStatus" resultMap="OrderResultMap">
|
||||||
SELECT * FROM orders WHERE order_status = #{status}
|
SELECT * FROM orders WHERE order_status = #{status}
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
|
||||||
|
<mapper namespace="com.central.order.mapper.QrCodeMapper">
|
||||||
|
|
||||||
|
<select id="findList" resultType="com.central.order.model.QrCode">
|
||||||
|
select * from qrcodes t
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<resultMap id="QrCodeResultMap" type="com.central.order.model.QrCode">
|
||||||
|
</resultMap>
|
||||||
|
<select id="getByCodeId" resultMap="QrCodeResultMap">
|
||||||
|
SELECT * FROM qrcodes WHERE code_id = #{codeId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertQrCode">
|
||||||
|
INSERT INTO qrcodes (code_id, tourism_id, device_sn)
|
||||||
|
VALUES (#{codeId}, #{tourismId}, #{deviceSn})
|
||||||
|
</insert>
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
|
||||||
|
<mapper namespace="com.central.order.mapper.TourismMapper">
|
||||||
|
|
||||||
|
<select id="findList" resultType="com.central.order.model.Tourism">
|
||||||
|
select * from tourisms t
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<resultMap id="TourismResultMap" type="com.central.order.model.Tourism">
|
||||||
|
</resultMap>
|
||||||
|
<select id="getTourismById" resultMap="TourismResultMap">
|
||||||
|
SELECT * FROM tourisms WHERE id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertTourism">
|
||||||
|
INSERT INTO tourisms (tourism_no, tourism_name, tourism_address,tourism_phone)
|
||||||
|
VALUES (#{tourismNo}, #{tourismName}, #{tourismAddress},#{tourismPhone})
|
||||||
|
</insert>
|
||||||
|
</mapper>
|
||||||
+10
-7
@@ -8,16 +8,16 @@ import com.central.common.utils.JsonUtil;
|
|||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import org.apache.http.util.EntityUtils;
|
import org.apache.http.util.EntityUtils;
|
||||||
import org.elasticsearch.client.RestHighLevelClient;
|
|
||||||
import org.elasticsearch.client.indices.CreateIndexRequest;
|
|
||||||
import org.elasticsearch.client.indices.CreateIndexResponse;
|
|
||||||
import org.elasticsearch.client.indices.GetIndexRequest;
|
|
||||||
import org.elasticsearch.client.indices.GetIndexResponse;
|
|
||||||
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
|
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
|
||||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||||
import org.elasticsearch.client.Request;
|
import org.elasticsearch.client.Request;
|
||||||
import org.elasticsearch.client.RequestOptions;
|
import org.elasticsearch.client.RequestOptions;
|
||||||
import org.elasticsearch.client.Response;
|
import org.elasticsearch.client.Response;
|
||||||
|
import org.elasticsearch.client.RestHighLevelClient;
|
||||||
|
import org.elasticsearch.client.indices.CreateIndexRequest;
|
||||||
|
import org.elasticsearch.client.indices.CreateIndexResponse;
|
||||||
|
import org.elasticsearch.client.indices.GetIndexRequest;
|
||||||
|
import org.elasticsearch.client.indices.GetIndexResponse;
|
||||||
import org.elasticsearch.cluster.metadata.AliasMetadata;
|
import org.elasticsearch.cluster.metadata.AliasMetadata;
|
||||||
import org.elasticsearch.cluster.metadata.MappingMetadata;
|
import org.elasticsearch.cluster.metadata.MappingMetadata;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
@@ -25,7 +25,10 @@ import org.elasticsearch.common.xcontent.XContentType;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 索引
|
* 索引
|
||||||
@@ -87,7 +90,7 @@ public class IndexServiceImpl implements IIndexService {
|
|||||||
TypeReference<List<Map<String, String>>> typeRef = new TypeReference<List<Map<String, String>>>() {};
|
TypeReference<List<Map<String, String>>> typeRef = new TypeReference<List<Map<String, String>>>() {};
|
||||||
listOfIndicesFromEs = mapper.readValue(rawBody, typeRef);
|
listOfIndicesFromEs = mapper.readValue(rawBody, typeRef);
|
||||||
}
|
}
|
||||||
return PageResult.<Map<String, String>>builder().data(listOfIndicesFromEs).code(0).build();
|
return PageResult.<Map<String, String>>builder().data(listOfIndicesFromEs).resp_code(0).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+9
-7
@@ -1,13 +1,14 @@
|
|||||||
package com.central.user.controller;
|
package com.central.user.controller;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.central.common.constant.CommonConstant;
|
import com.central.common.constant.CommonConstant;
|
||||||
import com.central.common.context.LoginUserContextHolder;
|
import com.central.common.context.LoginUserContextHolder;
|
||||||
import com.central.common.model.*;
|
import com.central.common.model.LoginAppUser;
|
||||||
|
import com.central.common.model.PageResult;
|
||||||
|
import com.central.common.model.Result;
|
||||||
|
import com.central.common.model.SysMenu;
|
||||||
|
import com.central.user.service.ISysMenuService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -16,7 +17,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.cache.annotation.Cacheable;
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import com.central.user.service.ISysMenuService;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 作者 owen E-mail: 624191343@qq.com
|
* @author 作者 owen E-mail: 624191343@qq.com
|
||||||
@@ -125,14 +127,14 @@ public class SysMenuController {
|
|||||||
@GetMapping("/findAlls")
|
@GetMapping("/findAlls")
|
||||||
public PageResult<SysMenu> findAlls() {
|
public PageResult<SysMenu> findAlls() {
|
||||||
List<SysMenu> list = menuService.findAll();
|
List<SysMenu> list = menuService.findAll();
|
||||||
return PageResult.<SysMenu>builder().data(list).code(0).count((long) list.size()).build();
|
return PageResult.<SysMenu>builder().data(list).resp_code(0).count((long) list.size()).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "获取菜单以及顶级菜单")
|
@Operation(summary = "获取菜单以及顶级菜单")
|
||||||
@GetMapping("/findOnes")
|
@GetMapping("/findOnes")
|
||||||
public PageResult<SysMenu> findOnes() {
|
public PageResult<SysMenu> findOnes() {
|
||||||
List<SysMenu> list = menuService.findOnes();
|
List<SysMenu> list = menuService.findOnes();
|
||||||
return PageResult.<SysMenu>builder().data(list).code(0).count((long) list.size()).build();
|
return PageResult.<SysMenu>builder().data(list).resp_code(0).count((long) list.size()).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+6
-9
@@ -1,8 +1,5 @@
|
|||||||
package com.central.user.controller;
|
package com.central.user.controller;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.central.common.constant.CommonConstant;
|
import com.central.common.constant.CommonConstant;
|
||||||
@@ -15,6 +12,7 @@ import com.central.search.model.LogicDelDto;
|
|||||||
import com.central.search.model.SearchDto;
|
import com.central.search.model.SearchDto;
|
||||||
import com.central.user.model.SysUserExcel;
|
import com.central.user.model.SysUserExcel;
|
||||||
import com.central.user.properties.TencentProperties;
|
import com.central.user.properties.TencentProperties;
|
||||||
|
import com.central.user.service.ISysUserService;
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
@@ -22,9 +20,10 @@ import io.swagger.v3.oas.annotations.Parameter;
|
|||||||
import io.swagger.v3.oas.annotations.Parameters;
|
import io.swagger.v3.oas.annotations.Parameters;
|
||||||
import io.swagger.v3.oas.annotations.enums.ParameterIn;
|
import io.swagger.v3.oas.annotations.enums.ParameterIn;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections4.MapUtils;
|
import org.apache.commons.collections4.MapUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
import org.springframework.cache.annotation.CacheEvict;
|
import org.springframework.cache.annotation.CacheEvict;
|
||||||
import org.springframework.cache.annotation.CachePut;
|
import org.springframework.cache.annotation.CachePut;
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
@@ -35,13 +34,11 @@ import org.springframework.http.ResponseEntity;
|
|||||||
import org.springframework.util.LinkedMultiValueMap;
|
import org.springframework.util.LinkedMultiValueMap;
|
||||||
import org.springframework.util.MultiValueMap;
|
import org.springframework.util.MultiValueMap;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import com.central.user.service.ISysUserService;
|
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import java.io.IOException;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 作者 owen E-mail: 624191343@qq.com
|
* @author 作者 owen E-mail: 624191343@qq.com
|
||||||
@@ -332,7 +329,7 @@ public class SysUserController {
|
|||||||
@CachePut(value = "user", key = "#sysUser.username", unless="#result == null")
|
@CachePut(value = "user", key = "#sysUser.username", unless="#result == null")
|
||||||
@AuditLog(operation = "'更新用户:' + #sysUser")
|
@AuditLog(operation = "'更新用户:' + #sysUser")
|
||||||
public void updateSysUserMobile(@RequestParam String code) {
|
public void updateSysUserMobile(@RequestParam String code) {
|
||||||
SysUser sysUser = getLoginAppUser().getDatas();
|
SysUser sysUser = getLoginAppUser().getData();
|
||||||
sysUser.setMobile(getUserPhoneNumber(code));
|
sysUser.setMobile(getUserPhoneNumber(code));
|
||||||
appUserService.updateById(sysUser);
|
appUserService.updateById(sysUser);
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-13
@@ -1,28 +1,26 @@
|
|||||||
package com.central.user.service.impl;
|
package com.central.user.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.central.common.constant.CommonConstant;
|
|
||||||
import com.central.common.context.LoginUserContextHolder;
|
import com.central.common.context.LoginUserContextHolder;
|
||||||
import com.central.common.lock.DistributedLock;
|
import com.central.common.lock.DistributedLock;
|
||||||
import com.central.common.model.*;
|
import com.central.common.model.PageResult;
|
||||||
|
import com.central.common.model.Result;
|
||||||
|
import com.central.common.model.SysRole;
|
||||||
import com.central.common.service.impl.SuperServiceImpl;
|
import com.central.common.service.impl.SuperServiceImpl;
|
||||||
|
import com.central.user.mapper.SysRoleMapper;
|
||||||
|
import com.central.user.mapper.SysRoleMenuMapper;
|
||||||
|
import com.central.user.mapper.SysUserRoleMapper;
|
||||||
|
import com.central.user.service.ISysRoleService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections4.MapUtils;
|
import org.apache.commons.collections4.MapUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import com.central.user.mapper.SysRoleMapper;
|
|
||||||
import com.central.user.mapper.SysRoleMenuMapper;
|
|
||||||
import com.central.user.mapper.SysUserRoleMapper;
|
|
||||||
import com.central.user.service.ISysRoleService;
|
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 作者 owen E-mail: 624191343@qq.com
|
* @author 作者 owen E-mail: 624191343@qq.com
|
||||||
@@ -63,7 +61,7 @@ public class SysRoleServiceImpl extends SuperServiceImpl<SysRoleMapper, SysRole>
|
|||||||
Integer limit = MapUtils.getInteger(params, "limit");
|
Integer limit = MapUtils.getInteger(params, "limit");
|
||||||
Page<SysRole> page = new Page<>(curPage == null ? 0 : curPage, limit == null ? -1 : limit);
|
Page<SysRole> page = new Page<>(curPage == null ? 0 : curPage, limit == null ? -1 : limit);
|
||||||
List<SysRole> list = baseMapper.findList(page, params);
|
List<SysRole> list = baseMapper.findList(page, params);
|
||||||
return PageResult.<SysRole>builder().data(list).code(0).count(page.getTotal()).build();
|
return PageResult.<SysRole>builder().data(list).resp_code(0).count(page.getTotal()).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+6
-9
@@ -1,8 +1,5 @@
|
|||||||
package com.central.user.service.impl;
|
package com.central.user.service.impl;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
@@ -12,10 +9,12 @@ import com.central.common.lock.DistributedLock;
|
|||||||
import com.central.common.model.*;
|
import com.central.common.model.*;
|
||||||
import com.central.common.service.impl.SuperServiceImpl;
|
import com.central.common.service.impl.SuperServiceImpl;
|
||||||
import com.central.user.mapper.SysRoleMenuMapper;
|
import com.central.user.mapper.SysRoleMenuMapper;
|
||||||
|
import com.central.user.mapper.SysUserMapper;
|
||||||
import com.central.user.model.SysRoleUser;
|
import com.central.user.model.SysRoleUser;
|
||||||
import com.central.user.model.SysUserExcel;
|
import com.central.user.model.SysUserExcel;
|
||||||
import com.central.user.mapper.SysUserMapper;
|
|
||||||
import com.central.user.service.ISysRoleUserService;
|
import com.central.user.service.ISysRoleUserService;
|
||||||
|
import com.central.user.service.ISysUserService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections4.MapUtils;
|
import org.apache.commons.collections4.MapUtils;
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@@ -26,11 +25,9 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import com.central.user.service.ISysUserService;
|
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 作者 owen E-mail: 624191343@qq.com
|
* @author 作者 owen E-mail: 624191343@qq.com
|
||||||
@@ -207,7 +204,7 @@ public class SysUserServiceImpl extends SuperServiceImpl<SysUserMapper, SysUser>
|
|||||||
list.forEach(u -> u.setRoles(sysRoles.stream().filter(r -> !ObjectUtils.notEqual(u.getId(), r.getUserId()))
|
list.forEach(u -> u.setRoles(sysRoles.stream().filter(r -> !ObjectUtils.notEqual(u.getId(), r.getUserId()))
|
||||||
.collect(Collectors.toList())));
|
.collect(Collectors.toList())));
|
||||||
}
|
}
|
||||||
return PageResult.<SysUser>builder().data(list).code(0).count(total).build();
|
return PageResult.<SysUser>builder().data(list).resp_code(0).count(total).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -113,5 +113,9 @@
|
|||||||
<artifactId>javax.servlet-api</artifactId>
|
<artifactId>javax.servlet-api</artifactId>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-test</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
+2
@@ -22,4 +22,6 @@ public interface ServiceNameConstants {
|
|||||||
String DEVICE_SERVICE = "device-center";
|
String DEVICE_SERVICE = "device-center";
|
||||||
|
|
||||||
String FILE_SERVICE = "file-center";
|
String FILE_SERVICE = "file-center";
|
||||||
|
|
||||||
|
String ORDER_SERVICE = "order-center";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
package com.central.common.model;
|
package com.central.common.model;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页实体类
|
* 分页实体类
|
||||||
*
|
*
|
||||||
@@ -26,7 +26,7 @@ public class PageResult<T> implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 是否成功:0 成功、1 失败
|
* 是否成功:0 成功、1 失败
|
||||||
*/
|
*/
|
||||||
private int code;
|
private int resp_code;
|
||||||
/**
|
/**
|
||||||
* 当前页结果集
|
* 当前页结果集
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import java.io.Serializable;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class Result<T> implements Serializable {
|
public class Result<T> implements Serializable {
|
||||||
|
|
||||||
private T datas;
|
private T data;
|
||||||
private Integer resp_code;
|
private Integer resp_code;
|
||||||
private String resp_msg;
|
private String resp_msg;
|
||||||
|
|
||||||
|
|||||||
+48
@@ -0,0 +1,48 @@
|
|||||||
|
package com.central.common.utils;
|
||||||
|
|
||||||
|
import org.springframework.mock.web.MockMultipartFile;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class FileToMultipartFileConverterUtil {
|
||||||
|
|
||||||
|
public static MultipartFile convert(File file) throws IOException {
|
||||||
|
String originalFilename = file.getName();
|
||||||
|
String contentType = "application/octet-stream"; // 默认MIME类型,可以根据文件类型设置
|
||||||
|
byte[] content = loadFileContent(file);
|
||||||
|
|
||||||
|
return new MockMultipartFile(
|
||||||
|
"file", // 参数名,即<input type="file" name="...">中的name属性值
|
||||||
|
originalFilename,
|
||||||
|
contentType,
|
||||||
|
content
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static byte[] loadFileContent(File file) throws IOException {
|
||||||
|
try (FileInputStream inputStream = new FileInputStream(file)) {
|
||||||
|
// 创建一个足够大的字节数组来存储文件内容
|
||||||
|
byte[] content = new byte[(int) file.length()];
|
||||||
|
int bytesRead = inputStream.read(content);
|
||||||
|
if (bytesRead != file.length()) {
|
||||||
|
throw new IOException("Could not read the entire file into the byte array.");
|
||||||
|
}
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*public static void main(String[] args) {
|
||||||
|
// 示例用法
|
||||||
|
File file = new File("path/to/your/file.txt");
|
||||||
|
try {
|
||||||
|
MultipartFile multipartFile = convert(file);
|
||||||
|
// 现在你可以使用multipartFile对象,例如在Spring MVC控制器中处理文件上传
|
||||||
|
System.out.println("File converted to MultipartFile successfully.");
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
}
|
||||||
+1
-1
@@ -232,7 +232,7 @@ public class SearchBuilder {
|
|||||||
SearchHits searchHits = response.getHits();
|
SearchHits searchHits = response.getHits();
|
||||||
long totalCnt = searchHits.getTotalHits().value;
|
long totalCnt = searchHits.getTotalHits().value;
|
||||||
List<JsonNode> list = getList(searchHits);
|
List<JsonNode> list = getList(searchHits);
|
||||||
return PageResult.<JsonNode>builder().data(list).code(0).count(totalCnt).build();
|
return PageResult.<JsonNode>builder().data(list).resp_code(0).count(totalCnt).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+20
-1
@@ -80,7 +80,7 @@ public class CosTemplate implements InitializingBean {
|
|||||||
* @param bucketName bucket名称
|
* @param bucketName bucket名称
|
||||||
* @param objectName 对象名
|
* @param objectName 对象名
|
||||||
*/
|
*/
|
||||||
private ObjectInfo upload(String bucketName, String objectName, InputStream is, int size, String contentType) {
|
public ObjectInfo upload(String bucketName, String objectName, InputStream is, int size, String contentType) {
|
||||||
ObjectMetadata objectMetadata = new ObjectMetadata();
|
ObjectMetadata objectMetadata = new ObjectMetadata();
|
||||||
objectMetadata.setContentLength(size);
|
objectMetadata.setContentLength(size);
|
||||||
objectMetadata.setContentType(contentType);
|
objectMetadata.setContentType(contentType);
|
||||||
@@ -95,6 +95,25 @@ public class CosTemplate implements InitializingBean {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传对象
|
||||||
|
* @param objectName 对象名
|
||||||
|
*/
|
||||||
|
public ObjectInfo upload(String objectName, InputStream is, int size, String contentType) {
|
||||||
|
ObjectMetadata objectMetadata = new ObjectMetadata();
|
||||||
|
objectMetadata.setContentLength(size);
|
||||||
|
objectMetadata.setContentType(contentType);
|
||||||
|
PutObjectRequest putObjectRequest = new PutObjectRequest(fileProperties.getCos().getBucketName(), objectName, is, objectMetadata);
|
||||||
|
putObjectRequest.getRequestClientOptions().setReadLimit(size + 1);
|
||||||
|
|
||||||
|
cosClient.putObject(putObjectRequest);
|
||||||
|
|
||||||
|
ObjectInfo obj = new ObjectInfo();
|
||||||
|
obj.setObjectPath(fileProperties.getCos().getBucketName() + PATH_SPLIT + objectName);
|
||||||
|
obj.setObjectUrl(fileProperties.getCos().getEndpoint() + PATH_SPLIT + obj.getObjectPath());
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
public void delete(String objectName) {
|
public void delete(String objectName) {
|
||||||
delete(fileProperties.getCos().getBucketName(), objectName);
|
delete(fileProperties.getCos().getBucketName(), objectName);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,11 @@ zlt.trace.enable=true
|
|||||||
|
|
||||||
zlt.security.tencent.appId=wx30a3c8de94a85584
|
zlt.security.tencent.appId=wx30a3c8de94a85584
|
||||||
zlt.security.tencent.appSecret=e64d6e3dcfe88d0daee50e77f5a2ee69
|
zlt.security.tencent.appSecret=e64d6e3dcfe88d0daee50e77f5a2ee69
|
||||||
|
zlt.security.tencent.token=YPbzETU8oe3XguGgwtA4g1DqlFKvw7pT
|
||||||
|
zlt.security.tencent.encodingAESKey=YPbzETU8oe3XguGgwtA4g1DqlFKvw7pTZiyHTxCiQxh
|
||||||
|
zlt.security.tencent.templateId=YOUR_TEMPLATE_ID
|
||||||
zlt.security.tencent.jscode2sessionUrl=https://api.weixin.qq.com/sns/jscode2session
|
zlt.security.tencent.jscode2sessionUrl=https://api.weixin.qq.com/sns/jscode2session
|
||||||
|
zlt.security.tencent.accessTokenUrl=https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=${zlt.security.tencent.appId}&secret=${zlt.security.tencent.appSecret}
|
||||||
|
|
||||||
# 微信支付商户号
|
# 微信支付商户号
|
||||||
zlt.wxpay.merchantId=1703796518
|
zlt.wxpay.merchantId=1703796518
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
########################## bootstrap级别通用配置 ##########################
|
########################## bootstrap级别通用配置 ##########################
|
||||||
# 默认开发环境
|
# 默认开发环境
|
||||||
spring.profiles.active=dev
|
spring.profiles.active=prod
|
||||||
|
|
||||||
##### nacos(注册中心和配置中心)地址
|
##### nacos(注册中心和配置中心)地址
|
||||||
#spring.cloud.nacos.server-addr=47.94.136.130:8848
|
spring.cloud.nacos.server-addr=47.94.136.130:8848
|
||||||
spring.cloud.nacos.server-addr=127.0.0.1:8848
|
#spring.cloud.nacos.server-addr=127.0.0.1:8848
|
||||||
spring.cloud.nacos.username=nacos
|
spring.cloud.nacos.username=nacos
|
||||||
spring.cloud.nacos.password=nacos
|
spring.cloud.nacos.password=nacos
|
||||||
spring.cloud.nacos.config.file-extension=yml
|
spring.cloud.nacos.config.file-extension=yml
|
||||||
|
|||||||
@@ -118,7 +118,11 @@ knife4j:
|
|||||||
- name: 设备服务
|
- name: 设备服务
|
||||||
service-name: device-center
|
service-name: device-center
|
||||||
url: /api-device/v3/api-docs/default
|
url: /api-device/v3/api-docs/default
|
||||||
context-path: /api-file
|
context-path: /api-device
|
||||||
|
- name: 订单服务
|
||||||
|
service-name: order-center
|
||||||
|
url: /api-order/v3/api-docs/default
|
||||||
|
context-path: /api-order
|
||||||
|
|
||||||
zlt:
|
zlt:
|
||||||
security:
|
security:
|
||||||
|
|||||||
+3
-2
@@ -12,7 +12,8 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统日志
|
* 系统日志
|
||||||
@@ -50,6 +51,6 @@ public class SysLogController {
|
|||||||
} else {
|
} else {
|
||||||
logList = new ArrayList<>(0);
|
logList = new ArrayList<>(0);
|
||||||
}
|
}
|
||||||
return PageResult.<TraceLog>builder().data(logList).code(0).count((long) logList.size()).build();
|
return PageResult.<TraceLog>builder().data(logList).resp_code(0).count((long) logList.size()).build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public class ClientServiceImpl extends SuperServiceImpl<ClientMapper, Client> im
|
|||||||
}
|
}
|
||||||
List<Client> list = baseMapper.findList(page, params);
|
List<Client> list = baseMapper.findList(page, params);
|
||||||
page.setRecords(list);
|
page.setRecords(list);
|
||||||
return PageResult.<Client>builder().data(list).code(0).count(page.getTotal()).build();
|
return PageResult.<Client>builder().data(list).resp_code(0).count(page.getTotal()).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import cn.hutool.core.util.PageUtil;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.central.common.constant.SecurityConstants;
|
import com.central.common.constant.SecurityConstants;
|
||||||
import com.central.common.model.PageResult;
|
import com.central.common.model.PageResult;
|
||||||
import com.central.common.redis.template.RedisRepository;
|
|
||||||
import com.central.oauth.model.TokenVo;
|
import com.central.oauth.model.TokenVo;
|
||||||
import com.central.oauth.service.ITokensService;
|
import com.central.oauth.service.ITokensService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -14,14 +13,11 @@ import org.redisson.api.RBucket;
|
|||||||
import org.redisson.api.RList;
|
import org.redisson.api.RList;
|
||||||
import org.redisson.api.RedissonClient;
|
import org.redisson.api.RedissonClient;
|
||||||
import org.redisson.codec.SerializationCodec;
|
import org.redisson.codec.SerializationCodec;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.data.redis.serializer.RedisSerializer;
|
|
||||||
import org.springframework.security.oauth2.core.OAuth2AccessToken;
|
import org.springframework.security.oauth2.core.OAuth2AccessToken;
|
||||||
import org.springframework.security.oauth2.core.endpoint.OAuth2ParameterNames;
|
import org.springframework.security.oauth2.core.endpoint.OAuth2ParameterNames;
|
||||||
import org.springframework.security.oauth2.server.authorization.OAuth2Authorization;
|
import org.springframework.security.oauth2.server.authorization.OAuth2Authorization;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.time.temporal.ChronoUnit;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -79,7 +75,7 @@ public class RedisTokensServiceImpl implements ITokensService {
|
|||||||
result.add(tokenVo);
|
result.add(tokenVo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return PageResult.<TokenVo>builder().data(result).code(0).count(size).build();
|
return PageResult.<TokenVo>builder().data(result).resp_code(0).count(size).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class RegisteredClientService {
|
|||||||
public PageResult<ClientDto> listClient(Map<String, Object> params, boolean isPage) {
|
public PageResult<ClientDto> listClient(Map<String, Object> params, boolean isPage) {
|
||||||
PageResult<Client> clientPage = clientService.listClient(params, isPage);
|
PageResult<Client> clientPage = clientService.listClient(params, isPage);
|
||||||
PageResult<ClientDto> result = new PageResult<>();
|
PageResult<ClientDto> result = new PageResult<>();
|
||||||
result.setCode(clientPage.getCode());
|
result.setResp_code(clientPage.getResp_code());
|
||||||
result.setCount(clientPage.getCount());
|
result.setCount(clientPage.getCount());
|
||||||
result.setData(BeanUtil.copyToList(clientPage.getData(), ClientDto.class));
|
result.setData(BeanUtil.copyToList(clientPage.getData(), ClientDto.class));
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
Reference in New Issue
Block a user