Browse Source

数据中台

master
wangpengfei 2 years ago
parent
commit
178673e57b
  1. 46
      yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/datacenter/DataCenterRest.java
  2. 30
      yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/datacenter/DataCenterService.java
  3. 23
      yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/projectdaily/ProjectDailyService.java
  4. 4
      yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/projectdaily/ProjectDailyVos.java
  5. 4
      yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/reportinventory/ReportInventoryDayGatherMapper.java
  6. 51
      yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/reportinventory/ReportInventoryDayGatherService.java
  7. 5
      yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/feign/monitor/YDeviceFeign.java

46
yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/datacenter/DataCenterRest.java

@ -1,16 +1,22 @@
package com.yxt.supervise.report.biz.datacenter;
import com.yxt.common.core.result.ResultBean;
import com.yxt.supervise.report.api.reportinventorydaygather.ReportInventoryDayGatherVo;
import com.yxt.supervise.report.biz.projectdaily.ProjectDailyQuery;
import com.yxt.supervise.report.biz.projectdaily.ProjectDailyService;
import com.yxt.supervise.report.biz.projectdaily.ProjectDailyVos;
import com.yxt.supervise.report.biz.projectdaily.ProjectDailys;
import com.yxt.supervise.report.biz.reportinventory.ReportInventoryDayGatherService;
import com.yxt.supervise.report.biz.reportinventory.ReportInventoryService;
import com.yxt.supervise.report.feign.monitor.YDeviceFeign;
import com.yxt.supervise.report.feign.monitor.YDeviceImageFeign;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
* @author wangpengfei
* @date 2023/11/13 18:15
@ -24,6 +30,11 @@ public class DataCenterRest {
YDeviceImageFeign yDeviceImageFeign;
@Autowired
YDeviceFeign yDeviceFeign;
@Autowired
ReportInventoryDayGatherService reportInventoryDayGatherService;
@Autowired
DataCenterService dataCenterService;
//数据总览
@PostMapping("/getProjectDaily")
public ResultBean<ProjectDailyVos> getProjectDaily(@RequestBody ProjectDailys ProjectDailys) {
@ -50,23 +61,36 @@ public class DataCenterRest {
}
@ApiOperation("获取指定设备列表")
@GetMapping("/getOtherList")
public ResultBean getOtherList(@RequestParam(value = "type") String type, @RequestParam(value = "ckId") String ckId){
public ResultBean getOtherList( String type, String ckId){
return yDeviceFeign.getOtherList(type, ckId);
}
@ApiOperation("获取状态数量")
@GetMapping("/getStatusCount")
public ResultBean getStatusCount(String deviceType, String statusType, String ckId){
return yDeviceFeign.getStatusCount(deviceType, statusType, ckId);
}
//库存分析图
// @PostMapping("/getProjectDailys")
// public ResultBean<ProjectDailyVos> getProjectDailys(@RequestBody ProjectDailyQuery ProjectDailys) {
@PostMapping("/getReportInventory")
public ResultBean<ProjectDailyVos> getReportInventory() {
ResultBean rb = ResultBean.fireFail();
Map<String,Object> pv = reportInventoryDayGatherService.getReportInventoryByOrderDate();
return rb.success().setData(pv);
}
//告警消息
// @PostMapping("/getRisk")
// public ResultBean<ProjectDailyVos> getRisk() {
// ResultBean rb = ResultBean.fireFail();
//// ResultBean b=projectDailyService.ww(ProjectDailys);
//// if(!b.getCode().equals("200")){
//// return b;
//// }
// ProjectDailyVos pv = projectDailyService.fetchByProjectAndDay2(ProjectDailys);
// List<ReportInventoryDayGatherVo> pv = reportInventoryDayGatherService.getReportInventoryByOrderDate();
// return rb.success().setData(pv);
// }
//告警消息
//仓库库存表
@GetMapping("/getInventory")
public ResultBean getInventory(String orderDate) {
ResultBean rb = ResultBean.fireFail();
Map<String,Object> pv = dataCenterService.getInventoryByOrderDate(orderDate);
return rb.success().setData(pv);
}
}

30
yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/datacenter/DataCenterService.java

@ -2,13 +2,43 @@ package com.yxt.supervise.report.biz.datacenter;
import com.yxt.common.base.service.MybatisBaseService;
import com.yxt.supervise.report.api.dailysalesreport.DailySalesReport;
import com.yxt.supervise.report.api.reportinventorydaygather.ReportInventoryDayGatherVo;
import com.yxt.supervise.report.api.reportinventorydaystore.ReportInventoryDayStoreVo;
import com.yxt.supervise.report.biz.dailysalesreport.DailySalesReportMapper;
import com.yxt.supervise.report.biz.reportinventory.ReportInventoryDayGatherService;
import com.yxt.supervise.report.biz.reportinventory.ReportInventoryDayStoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
/**
* @author wangpengfei
* @date 2023/11/13 18:16
*/
@Service
public class DataCenterService extends MybatisBaseService<DataCenterMapper, DataCenter> {
@Autowired
ReportInventoryDayGatherService reportInventoryDayGatherService;
@Autowired
ReportInventoryDayStoreService reportInventoryDayStoreService;
public Map<String,Object> getInventoryByOrderDate(String orderDate) {
Map<String,Object> map=new HashMap<>();
ReportInventoryDayGatherVo reportInventoryDayGatherVo=reportInventoryDayGatherService.getReportInventoryDayGather(orderDate);
ReportInventoryDayStoreVo reportInventoryDayStoreVo=reportInventoryDayStoreService.getReportInventoryDayStore(orderDate);
if(null!=reportInventoryDayGatherVo){
map.put("changwencang",reportInventoryDayGatherVo.getCountAmount());
}else{
map.put("changwencang",0);
}
if (null!=reportInventoryDayStoreVo){
map.put("mendian",reportInventoryDayStoreVo.getCountAmount());
}else{
map.put("mendian",0);
}
return map;
}
}

23
yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/projectdaily/ProjectDailyService.java

@ -259,29 +259,6 @@ public class ProjectDailyService extends ServiceImpl<ProjectDailyMapper, Project
}
return projectDaily;
}
// public ProjectDailyVos fetchByProjectAndDay2(ProjectDailyQuery params) {
// QueryWrapper<ProjectDaily> qw = new QueryWrapper<>();
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//
// params.setDataDateStart(sdf.format(DateUtil.yesterday()));
// qw.le("STR_TO_DATE(time,'%Y-%m-%d')",params.getDataDateStart());
// params.setDataDateEnd(sdf.format(DateUtil.offsetDay(DateUtil.yesterday(),-14))); ;
// qw.ge("STR_TO_DATE(time,'%Y-%m-%d')",params.getDataDateEnd());
//
// List<ProjectDailyVos> projectDaily=baseMapper.getProjectDailys(qw);
// ProjectInfo projectInfo= crmMapper.getProjectBySid(params.getProjectSid());
// if(null!=projectDaily){
// if(null!=projectInfo) {
// projectDaily.setCreditLimit(projectInfo.getCreditLimit());
// projectDaily.setUseLimit(projectInfo.getUseLimit());
// projectDaily.setBankPledgeRate(projectInfo.getBankPledgeRate());
// if (projectInfo.getBankPledgeRate() >Double.valueOf(projectDaily.getPledgeRatePercent())) {
// projectDaily.setState("1");
// }
// }
// }
// return projectDaily;
// }
public ResultBean<List<ProjectAccountVo>> getAccountByProjectSid(String projectSid) {
ResultBean rb=new ResultBean();
List<ProjectAccountVo> projectStateBySid=crmMapper.getAccountByProjectSid(projectSid);

4
yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/projectdaily/ProjectDailyVos.java

@ -52,10 +52,10 @@ public class ProjectDailyVos {
private String state="2";//质押状态
@TableField(exist = false)
private double creditLimit;//授信额度
private double creditLimitW;//授信额度
private double creditLimitW;//授信额度万元
private double useLimit;//用信额度
private double useLimitW;//用信额度
private double useLimitW;//用信额度 万元
//1: 已上报报表 2 :未上报报表
private String isReport;

4
yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/reportinventory/ReportInventoryDayGatherMapper.java

@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.yxt.supervise.report.api.reportinventorydaygather.ReportInventoryDayGatherVo;
import com.yxt.supervise.report.biz.projectdaily.ProjectDaily;
import com.yxt.supervise.report.biz.projectdaily.ProjectDailyVos;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -93,4 +95,6 @@ public interface ReportInventoryDayGatherMapper extends BaseMapper<ReportInvento
List<ReportInventoryDayGatherVo> getReportInventoryDayGathers(@Param("orderDate") String orderDate);
@Select("select * from report_inventory_day_gather where orderDate=#{orderDate} limit 1")
ReportInventoryDayGatherVo getReportInventoryDayGather(@Param("orderDate") String orderDate);
@Select("select * from report_inventory_day_gather where ${ew.sqlSegment}")
List<ReportInventoryDayGatherVo> getReportInventoryByOrderDate(@Param(Constants.WRAPPER) Wrapper<ReportInventoryDayGather> ew);
}

51
yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/reportinventory/ReportInventoryDayGatherService.java

@ -1,15 +1,14 @@
package com.yxt.supervise.report.biz.reportinventory;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yxt.supervise.report.api.reportinventorydaygather.ReportInventoryDayGatherVo;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.text.SimpleDateFormat;
import java.util.*;
@Service
public class ReportInventoryDayGatherService extends ServiceImpl<ReportInventoryDayGatherMapper, ReportInventoryDayGather> {
@ -87,4 +86,48 @@ public class ReportInventoryDayGatherService extends ServiceImpl<ReportInventory
vo.setList(pagging);
return vo;
}
public Map<String,Object> getReportInventoryByOrderDate() {
Map<String,Object> m=new HashMap<>();
QueryWrapper<ReportInventoryDayGather> qw = new QueryWrapper<>();
QueryWrapper<ReportInventoryDayGather> qw2 = new QueryWrapper<>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String startDate=sdf.format(DateUtil.yesterday());
String EndDate=sdf.format(DateUtil.offsetDay(DateUtil.yesterday(),-14));
qw.le("STR_TO_DATE(orderDate,'%Y-%m-%d')",startDate);
qw.ge("STR_TO_DATE(orderDate,'%Y-%m-%d')",EndDate);
qw.eq("storeType","[101]365常温仓");
List<ReportInventoryDayGatherVo> changwencang=baseMapper.getReportInventoryByOrderDate(qw);
qw2.le("STR_TO_DATE(orderDate,'%Y-%m-%d')",startDate);
qw2.ge("STR_TO_DATE(orderDate,'%Y-%m-%d')",EndDate);
qw2.eq("storeType","[112]供应链仓");
List<ReportInventoryDayGatherVo> gongyinglian=baseMapper.getReportInventoryByOrderDate(qw2);
List<String> a=new ArrayList<>();
List<String> b=new ArrayList<>();
List<String> c=new ArrayList<>();
//14
long i=DateUtil.between(DateUtil.parse(startDate),DateUtil.parse(EndDate), DateUnit.DAY);
for(int k=0;k<i+1;k++){
String date=sdf.format(DateUtil.offsetDay(DateUtil.parse(startDate),-k));
a.add(date);
b.add("0");
c.add("0");
for(ReportInventoryDayGatherVo vo:changwencang){
if(vo.getOrderDate().equals(date)){
b.set(k,String.valueOf(vo.getProductAmount()));
}
}
for(ReportInventoryDayGatherVo vo:gongyinglian){
if(vo.getOrderDate().equals(date)){
c.set(k,String.valueOf(vo.getProductAmount()));
}
}
}
m.put("date",a.toArray());
m.put("changwencang",b.toArray());
m.put("gongyinglian",c.toArray());
return m;
}
}

5
yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/feign/monitor/YDeviceFeign.java

@ -20,4 +20,9 @@ public interface YDeviceFeign {
@ApiOperation("获取指定设备列表")
@GetMapping("/getOtherList")
public ResultBean getOtherList(@RequestParam(value = "type") String type, @RequestParam(value = "ckId") String ckId);
@ApiOperation("获取状态数量")
@GetMapping("/getStatusCount")
public ResultBean getStatusCount(@RequestParam(value = "deviceType")String deviceType,
@RequestParam(value = "statusType")String statusType,
@RequestParam(value = "ckId")String ckId);
}

Loading…
Cancel
Save