bug修复
This commit is contained in:
parent
be99b64aa7
commit
46ab8d0748
@ -0,0 +1,86 @@
|
|||||||
|
package com.zhgd.xmgl.base.entity.vo;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateTime;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自己定义的灵活的大屏
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class FlexibleBigScreenVo {
|
||||||
|
/*
|
||||||
|
eg:
|
||||||
|
{
|
||||||
|
"dimensions": [
|
||||||
|
"月份",
|
||||||
|
"合格数",
|
||||||
|
"不合格数"
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
{
|
||||||
|
"月份": "月份1",
|
||||||
|
"合格数": 120,
|
||||||
|
"不合格数": 130
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* 维度
|
||||||
|
*/
|
||||||
|
private List<String> dimensions;
|
||||||
|
/**
|
||||||
|
* 源数据
|
||||||
|
*/
|
||||||
|
private List<HashMap<String, Object>> source;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 补充空的日期和初始值
|
||||||
|
*
|
||||||
|
* @param rtVo FlexibleBigScreenVo
|
||||||
|
* @param days 日期的list
|
||||||
|
* @param format 需要转换的时间格式
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static FlexibleBigScreenVo fillTrendVos(FlexibleBigScreenVo rtVo, List<String> days, String format) {
|
||||||
|
List<String> dimensions = rtVo.getDimensions();
|
||||||
|
String timeKey = dimensions.get(0);
|
||||||
|
Map<String, HashMap<String, Object>> voMap = rtVo.getSource().stream().collect(Collectors.toMap(o -> o.get(timeKey).toString(), Function.identity()));
|
||||||
|
List<HashMap<String, Object>> rtList = new ArrayList<>();
|
||||||
|
for (String day : days) {
|
||||||
|
HashMap<String, Object> vo = voMap.get(day);
|
||||||
|
if (vo == null) {
|
||||||
|
vo = new HashMap<String, Object>();
|
||||||
|
vo.put(timeKey, day);
|
||||||
|
for (int i = 1; i < dimensions.size(); i++) {
|
||||||
|
String key = dimensions.get(i);
|
||||||
|
vo.put(key, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
vo.put(timeKey, DateUtil.format(parse(vo.get(timeKey).toString(), format), format));
|
||||||
|
rtList.add(vo);
|
||||||
|
}
|
||||||
|
return rtVo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param str
|
||||||
|
* @param format
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private static DateTime parse(String str, String format) {
|
||||||
|
if ("yyyy-MM".equals(format)) {
|
||||||
|
return DateUtil.parse(str, format);
|
||||||
|
}
|
||||||
|
return DateUtil.parse(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ -1,18 +0,0 @@
|
|||||||
package com.zhgd.xmgl.base.entity.vo;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 多列扇形图表
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class MultiSectorVo {
|
|
||||||
@ApiModelProperty("x轴")
|
|
||||||
private List<String> x;
|
|
||||||
@ApiModelProperty("y轴数据")
|
|
||||||
List<MultiSectorOne> data;
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,14 +1,23 @@
|
|||||||
package com.zhgd.xmgl.base.entity.vo;
|
package com.zhgd.xmgl.base.entity.vo;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单列图表y轴
|
||||||
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class MultiSectorOne {
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class MultiTrendOne {
|
||||||
@ApiModelProperty("名称")
|
@ApiModelProperty("名称")
|
||||||
private String name;
|
private String name;
|
||||||
@ApiModelProperty("数值")
|
@ApiModelProperty("数值")
|
||||||
private List<String> data;
|
private List<String> data;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
44
src/main/java/com/zhgd/xmgl/base/entity/vo/MultiTrendVo.java
Normal file
44
src/main/java/com/zhgd/xmgl/base/entity/vo/MultiTrendVo.java
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
package com.zhgd.xmgl.base.entity.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多列图表带总数
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class MultiTrendVo {
|
||||||
|
@ApiModelProperty("x轴")
|
||||||
|
private List<String> x;
|
||||||
|
@ApiModelProperty("y轴数据")
|
||||||
|
List<MultiTrendOne> data;
|
||||||
|
@ApiModelProperty("总数")
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
private String count;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param dataList 数据list
|
||||||
|
* @param allList x的list
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static List<String> fillData(List<TrendVo> dataList, List<String> allList) {
|
||||||
|
ArrayList<String> list = new ArrayList<>();
|
||||||
|
Map<String, TrendVo> map = dataList.stream().collect(Collectors.toMap(trendVo -> trendVo.getX(), Function.identity(), (o, o2) -> o));
|
||||||
|
for (String s : allList) {
|
||||||
|
TrendVo vo = map.get(s);
|
||||||
|
if (vo != null) {
|
||||||
|
list.add(vo.getY());
|
||||||
|
} else {
|
||||||
|
list.add("0");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,5 +1,6 @@
|
|||||||
package com.zhgd.xmgl.modules.smartgrout.controller;
|
package com.zhgd.xmgl.modules.smartgrout.controller;
|
||||||
|
|
||||||
|
import com.zhgd.xmgl.base.entity.vo.FlexibleBigScreenVo;
|
||||||
import com.zhgd.xmgl.modules.smartgrout.entity.SmartGroutData;
|
import com.zhgd.xmgl.modules.smartgrout.entity.SmartGroutData;
|
||||||
import com.zhgd.xmgl.modules.smartgrout.service.ISmartGroutDataService;
|
import com.zhgd.xmgl.modules.smartgrout.service.ISmartGroutDataService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
@ -12,27 +13,15 @@ import java.util.HashMap;
|
|||||||
import springfox.documentation.annotations.ApiIgnore;
|
import springfox.documentation.annotations.ApiIgnore;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.net.URLDecoder;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
|
|
||||||
import com.zhgd.jeecg.common.api.vo.Result;
|
import com.zhgd.jeecg.common.api.vo.Result;
|
||||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
|
||||||
import com.zhgd.jeecg.common.util.oConvertUtils;
|
|
||||||
import org.apache.commons.collections.MapUtils;
|
import org.apache.commons.collections.MapUtils;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
|
||||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
|
||||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
|
||||||
|
|
||||||
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 org.springframework.web.servlet.ModelAndView;
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
|
||||||
|
|
||||||
@ -149,37 +138,14 @@ public class SmartGroutDataController {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@ApiOperation(value = "统计压浆合格情况", notes = "统计压浆合格情况", httpMethod = "POST")
|
||||||
* 导出excel
|
@ApiImplicitParams({
|
||||||
*
|
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "query", required = true, dataType = "String"),
|
||||||
* @param request
|
@ApiImplicitParam(name = "type", value = "类型:1每月", paramType = "query", required = true, dataType = "String"),
|
||||||
* @param response
|
})
|
||||||
*/
|
@PostMapping(value = "/countStatus")
|
||||||
@ApiOperation(value = "导出excel智能压浆-数据信息", notes = "导出excel智能压浆-数据信息", httpMethod = "POST")
|
public Result<FlexibleBigScreenVo> countStatus(@ApiIgnore @RequestBody HashMap<String, Object> paramMap) {
|
||||||
@RequestMapping(value = "/exportXls")
|
return Result.success(smartGroutDataService.countStatus(paramMap));
|
||||||
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
|
|
||||||
// Step.1 组装查询条件
|
|
||||||
QueryWrapper<SmartGroutData> queryWrapper = null;
|
|
||||||
try {
|
|
||||||
String paramsStr = request.getParameter("paramsStr");
|
|
||||||
if (oConvertUtils.isNotEmpty(paramsStr)) {
|
|
||||||
String deString = URLDecoder.decode(paramsStr, "UTF-8");
|
|
||||||
SmartGroutData smartGroutData = JSON.parseObject(deString, SmartGroutData.class);
|
|
||||||
queryWrapper = QueryGenerator.initQueryWrapper(smartGroutData, request.getParameterMap());
|
|
||||||
}
|
|
||||||
} catch (UnsupportedEncodingException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
//Step.2 AutoPoi 导出Excel
|
|
||||||
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
|
||||||
List<SmartGroutData> pageList = smartGroutDataService.list(queryWrapper);
|
|
||||||
//导出文件名称
|
|
||||||
mv.addObject(NormalExcelConstants.FILE_NAME, "智能压浆-数据列表");
|
|
||||||
mv.addObject(NormalExcelConstants.CLASS, SmartGroutData.class);
|
|
||||||
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("智能压浆-数据列表数据", "导出人:Jeecg", "导出信息"));
|
|
||||||
mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
|
|
||||||
return mv;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import org.apache.ibatis.annotations.Mapper;
|
|||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -23,4 +24,6 @@ public interface SmartGroutDataMapper extends BaseMapper<SmartGroutData> {
|
|||||||
List<SmartGroutData> queryList(QueryWrapper<SmartGroutData> queryWrapper);
|
List<SmartGroutData> queryList(QueryWrapper<SmartGroutData> queryWrapper);
|
||||||
|
|
||||||
IPage<SmartGroutData> queryList(Page<SmartGroutData> page, @Param(Constants.WRAPPER) QueryWrapper<SmartGroutData> queryWrapper);
|
IPage<SmartGroutData> queryList(Page<SmartGroutData> page, @Param(Constants.WRAPPER) QueryWrapper<SmartGroutData> queryWrapper);
|
||||||
|
|
||||||
|
List<HashMap<String, Object>> countStatus(HashMap<String, Object> paramMap);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,8 +2,17 @@
|
|||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.zhgd.xmgl.modules.smartgrout.mapper.SmartGroutDataMapper">
|
<mapper namespace="com.zhgd.xmgl.modules.smartgrout.mapper.SmartGroutDataMapper">
|
||||||
<select id="queryList" resultType="com.zhgd.xmgl.modules.smartgrout.entity.SmartGroutData">
|
<select id="queryList" resultType="com.zhgd.xmgl.modules.smartgrout.entity.SmartGroutData">
|
||||||
select sgd.*,d.device_name from smart_grout_data sgd
|
select sgd.*, d.device_name
|
||||||
|
from smart_grout_data sgd
|
||||||
join smart_grout_dev d on d.dev_sn = sgd.dev_sn
|
join smart_grout_dev d on d.dev_sn = sgd.dev_sn
|
||||||
${ew.customSqlSegment}
|
${ew.customSqlSegment}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="countStatus" resultType="java.util.HashMap">
|
||||||
|
select date_format(tension_grout_time, '%Y-%m') 月份, ifnull(sum(if(status=1,1,0)),0)
|
||||||
|
合格,ifnull(sum(if(status=2,1,0)),0) 不合格
|
||||||
|
from smart_grout_data
|
||||||
|
where project_sn = #{projectSn}
|
||||||
|
group by date_format(tension_grout_time, '%Y-%m')
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package com.zhgd.xmgl.modules.smartgrout.service;
|
package com.zhgd.xmgl.modules.smartgrout.service;
|
||||||
|
|
||||||
|
import com.zhgd.xmgl.base.entity.vo.FlexibleBigScreenVo;
|
||||||
import com.zhgd.xmgl.modules.smartgrout.entity.SmartGroutData;
|
import com.zhgd.xmgl.modules.smartgrout.entity.SmartGroutData;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
@ -20,4 +21,6 @@ public interface ISmartGroutDataService extends IService<SmartGroutData> {
|
|||||||
List<SmartGroutData> queryList(HashMap<String, Object> paramMap);
|
List<SmartGroutData> queryList(HashMap<String, Object> paramMap);
|
||||||
|
|
||||||
void add(SmartGroutData smartGroutData);
|
void add(SmartGroutData smartGroutData);
|
||||||
|
|
||||||
|
FlexibleBigScreenVo countStatus(HashMap<String, Object> paramMap);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,15 +16,18 @@ import com.zhgd.xmgl.modules.smartgrout.mapper.SmartGroutDataMapper;
|
|||||||
import com.zhgd.xmgl.modules.smartgrout.mapper.SmartGroutDevMapper;
|
import com.zhgd.xmgl.modules.smartgrout.mapper.SmartGroutDevMapper;
|
||||||
import com.zhgd.xmgl.modules.smartgrout.mapper.SmartGroutSteelBeamDataMapper;
|
import com.zhgd.xmgl.modules.smartgrout.mapper.SmartGroutSteelBeamDataMapper;
|
||||||
import com.zhgd.xmgl.modules.smartgrout.service.ISmartGroutDataService;
|
import com.zhgd.xmgl.modules.smartgrout.service.ISmartGroutDataService;
|
||||||
import com.zhgd.xmgl.modules.smarttension.entity.SmartTensionDev;
|
import com.zhgd.xmgl.util.DateUtils;
|
||||||
import com.zhgd.xmgl.util.PageUtil;
|
import com.zhgd.xmgl.util.PageUtil;
|
||||||
import com.zhgd.xmgl.util.RefUtil;
|
import com.zhgd.xmgl.util.RefUtil;
|
||||||
|
import org.apache.commons.collections.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 java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 智能压浆-数据
|
* @Description: 智能压浆-数据
|
||||||
@ -83,6 +86,25 @@ public class SmartGroutDataServiceImpl extends ServiceImpl<SmartGroutDataMapper,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FlexibleBigScreenVo countStatus(HashMap<String, Object> paramMap) {
|
||||||
|
Integer type = MapUtils.getInteger(paramMap, "type");
|
||||||
|
if (Objects.equals(1, type)) {
|
||||||
|
FlexibleBigScreenVo flexibleBigScreenVo = new FlexibleBigScreenVo();
|
||||||
|
List<HashMap<String, Object>> source = baseMapper.countStatus(paramMap);
|
||||||
|
List<String> dimensions = new ArrayList<>();
|
||||||
|
dimensions.add("月份");
|
||||||
|
dimensions.add("合格");
|
||||||
|
dimensions.add("不合格");
|
||||||
|
flexibleBigScreenVo.setDimensions(dimensions);
|
||||||
|
flexibleBigScreenVo.setSource(source);
|
||||||
|
List<String> strList = DateUtils.getDateStrList(500, "月份M");
|
||||||
|
FlexibleBigScreenVo.fillTrendVos(flexibleBigScreenVo, strList, "月份M");
|
||||||
|
return flexibleBigScreenVo;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
private QueryWrapper<SmartGroutData> getQueryWrapper(HashMap<String, Object> paramMap) {
|
private QueryWrapper<SmartGroutData> getQueryWrapper(HashMap<String, Object> paramMap) {
|
||||||
String alias = "sgd.";
|
String alias = "sgd.";
|
||||||
QueryWrapper<SmartGroutData> queryWrapper = QueryGenerator.initPageQueryWrapper(SmartGroutData.class, paramMap, alias);
|
QueryWrapper<SmartGroutData> queryWrapper = QueryGenerator.initPageQueryWrapper(SmartGroutData.class, paramMap, alias);
|
||||||
|
|||||||
@ -141,37 +141,4 @@ public class StableWaterMixStationDataController {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 导出excel
|
|
||||||
*
|
|
||||||
* @param request
|
|
||||||
* @param response
|
|
||||||
*/
|
|
||||||
@ApiOperation(value = "导出excel水稳拌合站数据信息", notes = "导出excel水稳拌合站数据信息", httpMethod = "POST")
|
|
||||||
@RequestMapping(value = "/exportXls")
|
|
||||||
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
|
|
||||||
// Step.1 组装查询条件
|
|
||||||
QueryWrapper<StableWaterMixStationData> queryWrapper = null;
|
|
||||||
try {
|
|
||||||
String paramsStr = request.getParameter("paramsStr");
|
|
||||||
if (oConvertUtils.isNotEmpty(paramsStr)) {
|
|
||||||
String deString = URLDecoder.decode(paramsStr, "UTF-8");
|
|
||||||
StableWaterMixStationData stableWaterMixStationData = JSON.parseObject(deString, StableWaterMixStationData.class);
|
|
||||||
queryWrapper = QueryGenerator.initQueryWrapper(stableWaterMixStationData, request.getParameterMap());
|
|
||||||
}
|
|
||||||
} catch (UnsupportedEncodingException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
//Step.2 AutoPoi 导出Excel
|
|
||||||
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
|
||||||
List<StableWaterMixStationData> pageList = stableWaterMixStationDataService.list(queryWrapper);
|
|
||||||
//导出文件名称
|
|
||||||
mv.addObject(NormalExcelConstants.FILE_NAME, "水稳拌合站数据列表");
|
|
||||||
mv.addObject(NormalExcelConstants.CLASS, StableWaterMixStationData.class);
|
|
||||||
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("水稳拌合站数据列表数据", "导出人:Jeecg", "导出信息"));
|
|
||||||
mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
|
|
||||||
return mv;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -191,6 +191,9 @@ public class StableWaterMixStationData implements Serializable {
|
|||||||
@Excel(name = "删除标识 Y已删除,N未删除", width = 15)
|
@Excel(name = "删除标识 Y已删除,N未删除", width = 15)
|
||||||
@ApiModelProperty(value = "删除标识 Y已删除,N未删除")
|
@ApiModelProperty(value = "删除标识 Y已删除,N未删除")
|
||||||
private java.lang.String scbz;
|
private java.lang.String scbz;
|
||||||
|
@ApiModelProperty(value = "删除标识名称")
|
||||||
|
private java.lang.String scbzName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生产时间 / 发料时间
|
* 生产时间 / 发料时间
|
||||||
*/
|
*/
|
||||||
@ -232,4 +235,7 @@ public class StableWaterMixStationData implements Serializable {
|
|||||||
@ApiModelProperty(value = "水稳拌合站盘次数据列表")
|
@ApiModelProperty(value = "水稳拌合站盘次数据列表")
|
||||||
private List<StableWaterMixStationSetData> setDataList;
|
private List<StableWaterMixStationSetData> setDataList;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
@ApiModelProperty(value = "设备名称")
|
||||||
|
private java.lang.String devName;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,8 +36,6 @@ public class StableWaterMixStationDev implements Serializable {
|
|||||||
@Excel(name = "设备sn", width = 15)
|
@Excel(name = "设备sn", width = 15)
|
||||||
@ApiModelProperty(value = "设备sn")
|
@ApiModelProperty(value = "设备sn")
|
||||||
private java.lang.String devSn;
|
private java.lang.String devSn;
|
||||||
@ApiModelProperty(value = "站点编码")
|
|
||||||
private java.lang.String siteEncoding;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备名称
|
* 设备名称
|
||||||
@ -83,12 +81,10 @@ public class StableWaterMixStationDev implements Serializable {
|
|||||||
@Excel(name = "拌合站位置", width = 15)
|
@Excel(name = "拌合站位置", width = 15)
|
||||||
@ApiModelProperty(value = "拌合站位置")
|
@ApiModelProperty(value = "拌合站位置")
|
||||||
private java.lang.String mixingStationLocation;
|
private java.lang.String mixingStationLocation;
|
||||||
/**
|
@ApiModelProperty(value = "负责人id")
|
||||||
* 负责人
|
private Long dutyUserId;
|
||||||
*/
|
@ApiModelProperty(value = "负责人名称")
|
||||||
@Excel(name = "负责人", width = 15)
|
private String dutyUserName;
|
||||||
@ApiModelProperty(value = "负责人")
|
|
||||||
private java.lang.String personInCharge;
|
|
||||||
/**
|
/**
|
||||||
* 负责人电话
|
* 负责人电话
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -1,8 +1,15 @@
|
|||||||
package com.zhgd.xmgl.modules.stablewater.mapper;
|
package com.zhgd.xmgl.modules.stablewater.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.zhgd.xmgl.modules.stablewater.entity.StableWaterMixStationData;
|
import com.zhgd.xmgl.modules.stablewater.entity.StableWaterMixStationData;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 水稳拌合站数据
|
* @Description: 水稳拌合站数据
|
||||||
@ -13,4 +20,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||||||
@Mapper
|
@Mapper
|
||||||
public interface StableWaterMixStationDataMapper extends BaseMapper<StableWaterMixStationData> {
|
public interface StableWaterMixStationDataMapper extends BaseMapper<StableWaterMixStationData> {
|
||||||
|
|
||||||
|
List<StableWaterMixStationData> queryList(@Param(Constants.WRAPPER) QueryWrapper<StableWaterMixStationData> queryWrapper);
|
||||||
|
|
||||||
|
IPage<StableWaterMixStationData> queryList(Page<StableWaterMixStationData> page, @Param(Constants.WRAPPER) QueryWrapper<StableWaterMixStationData> queryWrapper);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.zhgd.xmgl.modules.stablewater.mapper.StableWaterMixStationDataMapper">
|
<mapper namespace="com.zhgd.xmgl.modules.stablewater.mapper.StableWaterMixStationDataMapper">
|
||||||
|
<select id="queryList" resultType="com.zhgd.xmgl.modules.stablewater.entity.StableWaterMixStationData">
|
||||||
|
select swmsd.*,d.dev_name from stable_water_mix_station_data swmsd
|
||||||
|
join stable_water_mix_station_dev d on d.dev_sn=swmsd.dev_sn
|
||||||
|
${ew.customSqlSegment}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 水稳拌合站数据
|
* @Description: 水稳拌合站数据
|
||||||
@ -48,7 +49,7 @@ public class StableWaterMixStationDataServiceImpl extends ServiceImpl<StableWate
|
|||||||
public IPage<StableWaterMixStationData> queryPageList(HashMap<String, Object> paramMap) {
|
public IPage<StableWaterMixStationData> queryPageList(HashMap<String, Object> paramMap) {
|
||||||
QueryWrapper<StableWaterMixStationData> queryWrapper = getQueryWrapper(paramMap);
|
QueryWrapper<StableWaterMixStationData> queryWrapper = getQueryWrapper(paramMap);
|
||||||
Page<StableWaterMixStationData> page = PageUtil.getPage(paramMap);
|
Page<StableWaterMixStationData> page = PageUtil.getPage(paramMap);
|
||||||
IPage<StableWaterMixStationData> pageList = this.page(page, queryWrapper);
|
IPage<StableWaterMixStationData> pageList = baseMapper.queryList(page, queryWrapper);
|
||||||
pageList.setRecords(dealList(pageList.getRecords()));
|
pageList.setRecords(dealList(pageList.getRecords()));
|
||||||
return pageList;
|
return pageList;
|
||||||
}
|
}
|
||||||
@ -56,17 +57,24 @@ public class StableWaterMixStationDataServiceImpl extends ServiceImpl<StableWate
|
|||||||
@Override
|
@Override
|
||||||
public List<StableWaterMixStationData> queryList(HashMap<String, Object> paramMap) {
|
public List<StableWaterMixStationData> queryList(HashMap<String, Object> paramMap) {
|
||||||
QueryWrapper<StableWaterMixStationData> queryWrapper = getQueryWrapper(paramMap);
|
QueryWrapper<StableWaterMixStationData> queryWrapper = getQueryWrapper(paramMap);
|
||||||
return dealList(this.list(queryWrapper));
|
return dealList(baseMapper.queryList(queryWrapper));
|
||||||
}
|
}
|
||||||
|
|
||||||
private QueryWrapper<StableWaterMixStationData> getQueryWrapper(HashMap<String, Object> paramMap) {
|
private QueryWrapper<StableWaterMixStationData> getQueryWrapper(HashMap<String, Object> paramMap) {
|
||||||
String alias = "";
|
String alias = "swmsd.";
|
||||||
QueryWrapper<StableWaterMixStationData> queryWrapper = QueryGenerator.initPageQueryWrapper(StableWaterMixStationData.class, paramMap, alias);
|
QueryWrapper<StableWaterMixStationData> queryWrapper = QueryGenerator.initPageQueryWrapper(StableWaterMixStationData.class, paramMap, alias);
|
||||||
queryWrapper.orderByDesc(alias + RefUtil.fieldNameUlc(StableWaterMixStationData::getId));
|
queryWrapper.orderByDesc(alias + RefUtil.fieldNameUlc(StableWaterMixStationData::getId));
|
||||||
return queryWrapper;
|
return queryWrapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<StableWaterMixStationData> dealList(List<StableWaterMixStationData> list) {
|
private List<StableWaterMixStationData> dealList(List<StableWaterMixStationData> list) {
|
||||||
|
for (StableWaterMixStationData data : list) {
|
||||||
|
if (Objects.equals(data.getScbz(), "Y")) {
|
||||||
|
data.setScbzName("已删除");
|
||||||
|
} else if (Objects.equals(data.getScbz(), "N")) {
|
||||||
|
data.setScbzName("未删除");
|
||||||
|
}
|
||||||
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,12 @@ package com.zhgd.xmgl.task;
|
|||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.zhgd.xmgl.modules.stablewater.entity.StableWaterMixStationData;
|
||||||
|
import com.zhgd.xmgl.modules.stablewater.entity.StableWaterMixStationRawMaterialData;
|
||||||
|
import com.zhgd.xmgl.modules.stablewater.entity.StableWaterMixStationSetData;
|
||||||
|
import com.zhgd.xmgl.modules.stablewater.service.IStableWaterMixStationDataService;
|
||||||
import com.zhgd.xmgl.util.ThirdPartRequestUtil;
|
import com.zhgd.xmgl.util.ThirdPartRequestUtil;
|
||||||
import lombok.extern.log4j.Log4j;
|
import lombok.extern.log4j.Log4j;
|
||||||
import net.javacrumbs.shedlock.core.SchedulerLock;
|
import net.javacrumbs.shedlock.core.SchedulerLock;
|
||||||
@ -10,6 +15,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -20,6 +27,9 @@ import java.util.Objects;
|
|||||||
public class StableWaterMixStationTask {
|
public class StableWaterMixStationTask {
|
||||||
@Autowired
|
@Autowired
|
||||||
ThirdPartRequestUtil thirdPartRequestUtil;
|
ThirdPartRequestUtil thirdPartRequestUtil;
|
||||||
|
@Autowired
|
||||||
|
IStableWaterMixStationDataService stableWaterMixStationDataService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 定时拉取广联达的搅拌站数据,https://xmgl.glodon.com/wl/docs/third_help/part2/openapi/pull/mixTotal.html
|
* 定时拉取广联达的搅拌站数据,https://xmgl.glodon.com/wl/docs/third_help/part2/openapi/pull/mixTotal.html
|
||||||
@ -32,7 +42,29 @@ public class StableWaterMixStationTask {
|
|||||||
//String rs = thirdPartRequestUtil.get(url);
|
//String rs = thirdPartRequestUtil.get(url);
|
||||||
//JSONObject jo = JSON.parseObject(rs);
|
//JSONObject jo = JSON.parseObject(rs);
|
||||||
//if (Objects.equals(jo.getBoolean("success"), true)) {
|
//if (Objects.equals(jo.getBoolean("success"), true)) {
|
||||||
// BeanUtil.copyProperties();
|
// JSONObject dataJson = jo.getJSONObject("data");
|
||||||
|
// JSONArray bills = dataJson.getJSONArray("Bills");
|
||||||
|
// for (Object bill : bills) {
|
||||||
|
// StableWaterMixStationData data = new StableWaterMixStationData();
|
||||||
|
// List<StableWaterMixStationSetData> setDataList = new ArrayList<>();
|
||||||
|
// data.setSetDataList(setDataList);
|
||||||
|
// BeanUtil.copyProperties(bill, data, true);
|
||||||
|
// JSONArray pcList = ((JSONObject) bill).getJSONArray("PCList");
|
||||||
|
// for (Object pc : pcList) {
|
||||||
|
// StableWaterMixStationSetData setData = new StableWaterMixStationSetData();
|
||||||
|
// BeanUtil.copyProperties(pc, setData, true);
|
||||||
|
// setDataList.add(setData);
|
||||||
|
// List<StableWaterMixStationRawMaterialData> rawMaterialDataList = new ArrayList<>();
|
||||||
|
// setData.setRawMaterialDataList(rawMaterialDataList);
|
||||||
|
// JSONArray ycList = ((JSONObject) pc).getJSONArray("YCList");
|
||||||
|
// for (Object yc : ycList) {
|
||||||
|
// StableWaterMixStationRawMaterialData rawMaterialData = new StableWaterMixStationRawMaterialData();
|
||||||
|
// BeanUtil.copyProperties(yc, rawMaterialData, true);
|
||||||
|
// rawMaterialDataList.add(rawMaterialData);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// stableWaterMixStationDataService.add(data);
|
||||||
|
// }
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -567,7 +567,7 @@ public class DateUtils {
|
|||||||
*
|
*
|
||||||
* @param type 类型:
|
* @param type 类型:
|
||||||
* 10.近12小时,20.近24小时,30.近半天,40.近一天,50.近两天,60.近一周,70.近两周,80.近一个月,90.近半年,93.近一年
|
* 10.近12小时,20.近24小时,30.近半天,40.近一天,50.近两天,60.近一周,70.近两周,80.近一个月,90.近半年,93.近一年
|
||||||
* 100.今天,200.昨天,300.本周,400.本月,500.本年,600.去年
|
* 100.今天,200.昨天,300.本周,400.本月,500.本年(每月),600.去年
|
||||||
* @param pattern 格式 如:yyyy-MM-dd HH:mm:ss
|
* @param pattern 格式 如:yyyy-MM-dd HH:mm:ss
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -592,11 +592,20 @@ public class DateUtils {
|
|||||||
rtList.add(DateUtil.format(DateUtil.offsetMonth(beginDate, i), pattern));
|
rtList.add(DateUtil.format(DateUtil.offsetMonth(beginDate, i), pattern));
|
||||||
}
|
}
|
||||||
return rtList;
|
return rtList;
|
||||||
|
} else if (type == 500) {
|
||||||
|
ArrayList<String> rtList = new ArrayList<>();
|
||||||
|
DateTime beginDate = DateUtil.beginOfYear(DateTime.now());
|
||||||
|
DateTime endDate = DateUtil.endOfYear(DateTime.now());
|
||||||
|
long offset = DateUtil.betweenMonth(beginDate, endDate, true);
|
||||||
|
for (int i = 0; i < offset + 1; i++) {
|
||||||
|
rtList.add(DateUtil.format(DateUtil.offsetMonth(beginDate, i), pattern));
|
||||||
|
}
|
||||||
|
return rtList;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
System.out.println("2023-11-02".length());
|
System.out.println(getDateStrList(500, "月份M"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user