OMS-GW推送-企业币值
This commit is contained in:
+59
@@ -0,0 +1,59 @@
|
||||
package com.mhd.oms.application.service.exchangeRate;
|
||||
|
||||
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.core.web.page.TableDataInfo;
|
||||
import com.mhd.system.api.WlhyServiceFeign;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ExchangeRateApplicationService {
|
||||
|
||||
@Resource
|
||||
private WlhyServiceFeign wlhyServiceFeign;
|
||||
|
||||
public TableDataInfo queryExchangeRateList(Integer pageNum, Integer pageSize, String pushStatus, String organizationId) {
|
||||
try {
|
||||
log.info("查询汇率列表: pageNum={}, pageSize={}, pushStatus={}, organizationId={}",
|
||||
pageNum, pageSize, pushStatus, organizationId);
|
||||
AjaxResult<?> result = wlhyServiceFeign.queryList(pageNum, pageSize, pushStatus, organizationId);
|
||||
log.info("查询汇率列表结果: code={}, result={}", result.get("code"), result.get("result"));
|
||||
|
||||
if (result != null) {
|
||||
Object wlhyResult = result.get("result");
|
||||
if (wlhyResult != null) {
|
||||
Map<?, ?> map = (Map<?, ?>) wlhyResult;
|
||||
Object records = map.get("records");
|
||||
Object total = map.get("total");
|
||||
List<?> list = records instanceof List ? (List<?>) records : new ArrayList<>();
|
||||
|
||||
TableDataInfo tableDataInfo = new TableDataInfo();
|
||||
tableDataInfo.setData(list);
|
||||
tableDataInfo.setTotal(total instanceof Number ? ((Number) total).longValue() : list.size());
|
||||
tableDataInfo.setCode(200);
|
||||
return tableDataInfo;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("查询汇率列表异常: {}", e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
return buildTableDataInfo(new ArrayList<>());
|
||||
}
|
||||
|
||||
private TableDataInfo buildTableDataInfo(List<?> list) {
|
||||
TableDataInfo tableDataInfo = new TableDataInfo();
|
||||
tableDataInfo.setData(list);
|
||||
tableDataInfo.setTotal(list.size());
|
||||
tableDataInfo.setCode(200);
|
||||
return tableDataInfo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.mhd.oms.interfaces.facade.exchangeRate;
|
||||
|
||||
|
||||
import com.mhd.common.core.web.page.TableDataInfo;
|
||||
import com.mhd.oms.application.service.exchangeRate.ExchangeRateApplicationService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static com.mhd.common.core.utils.PageUtils.startPage;
|
||||
|
||||
|
||||
@Api(tags = "汇率管理")
|
||||
@RestController
|
||||
@RequestMapping("exchangeRateApi")
|
||||
public class ExchangeRateApi {
|
||||
|
||||
@Resource
|
||||
private ExchangeRateApplicationService exchangeRateApplicationService;
|
||||
|
||||
@ApiOperation("查询汇率列表")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(value = "pushStatus", required = false) String pushStatus,
|
||||
@RequestParam(value = "organizationId", required = false) String organizationId) {
|
||||
startPage();
|
||||
return exchangeRateApplicationService.queryExchangeRateList(pageNum, pageSize, pushStatus, organizationId);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user