parent
f5e54ba1aa
commit
a101719d3d
@ -0,0 +1,47 @@ |
|||||||
|
package com.bellmann.controller; |
||||||
|
|
||||||
|
import com.alibaba.excel.EasyExcel; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import com.bellmann.common.result.PageResult; |
||||||
|
import com.bellmann.model.query.ReportBasicQuery; |
||||||
|
import com.bellmann.model.vo.DetailExportVO; |
||||||
|
import com.bellmann.model.vo.DetailInventoryStatisticsVO; |
||||||
|
import com.bellmann.service.ReportService; |
||||||
|
import io.swagger.v3.oas.annotations.Operation; |
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse; |
||||||
|
import java.io.IOException; |
||||||
|
import java.net.URLEncoder; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@Tag(name = "31.家庭用户-报表") |
||||||
|
@RestController |
||||||
|
@RequiredArgsConstructor |
||||||
|
@RequestMapping("/api/report/v1") |
||||||
|
public class ReportController { |
||||||
|
|
||||||
|
private final ReportService reportService; |
||||||
|
|
||||||
|
@PostMapping("/detail-inventory-statistics") |
||||||
|
@Operation(summary = "运行报表") |
||||||
|
public PageResult<DetailInventoryStatisticsVO> detailPage(@RequestBody ReportBasicQuery query){ |
||||||
|
Page<DetailInventoryStatisticsVO> page = reportService.detailPage(query); |
||||||
|
return PageResult.success(page); |
||||||
|
} |
||||||
|
|
||||||
|
@Operation(summary = "导出详细清单统计报表") |
||||||
|
@GetMapping("/_export") |
||||||
|
public void exportDetail(ReportBasicQuery queryParams, HttpServletResponse response) throws IOException { |
||||||
|
String fileName = "详细清单统计报表.xlsx"; |
||||||
|
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
||||||
|
response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode(fileName, "UTF-8")); |
||||||
|
|
||||||
|
List<DetailExportVO> exportUserList = reportService.listExportDetail(queryParams); |
||||||
|
EasyExcel.write(response.getOutputStream(), DetailExportVO.class).sheet("详细清单统计报表") |
||||||
|
.doWrite(exportUserList); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,15 @@ |
|||||||
|
package com.bellmann.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import com.bellmann.model.entity.ViewDeviceTotal; |
||||||
|
import com.bellmann.model.query.ReportBasicQuery; |
||||||
|
import com.bellmann.model.vo.DetailInventoryStatisticsVO; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
|
||||||
|
@Mapper |
||||||
|
public interface ViewDeviceTotalMapper extends BaseMapper<ViewDeviceTotal> { |
||||||
|
|
||||||
|
Page<DetailInventoryStatisticsVO> detailInventoryStatisticsPage(Page<DetailInventoryStatisticsVO> page, @Param("form") ReportBasicQuery query); |
||||||
|
} |
@ -0,0 +1,76 @@ |
|||||||
|
package com.bellmann.model.entity; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.util.Date; |
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
/** |
||||||
|
* (VZjDeviceTotal)实体类 |
||||||
|
* |
||||||
|
* @author makejava |
||||||
|
* @since 2024-07-30 09:54:58 |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
public class ViewDeviceTotal implements Serializable { |
||||||
|
private static final long serialVersionUID = 882370856173531679L; |
||||||
|
|
||||||
|
private Long devId; |
||||||
|
|
||||||
|
private Long typeAndVerId; |
||||||
|
|
||||||
|
private Long custId; |
||||||
|
|
||||||
|
private String devSno; |
||||||
|
|
||||||
|
private String devPppoe; |
||||||
|
|
||||||
|
private String devAdNo; |
||||||
|
|
||||||
|
private String devStatus; |
||||||
|
|
||||||
|
private Date devCreateTime; |
||||||
|
|
||||||
|
private Date devModifyTime; |
||||||
|
|
||||||
|
private Date devOnlineTime; |
||||||
|
|
||||||
|
private String devRemark1; |
||||||
|
|
||||||
|
private String devRemark3; |
||||||
|
|
||||||
|
private String devRemark4; |
||||||
|
|
||||||
|
private Long devTypeId; |
||||||
|
|
||||||
|
private String softVer; |
||||||
|
|
||||||
|
private Long tr069VerId; |
||||||
|
|
||||||
|
private String devVendorName; |
||||||
|
|
||||||
|
private String devVendorOui; |
||||||
|
|
||||||
|
private String devTypeName; |
||||||
|
|
||||||
|
private String devHardVer; |
||||||
|
|
||||||
|
private String devAccessType; |
||||||
|
|
||||||
|
private String devTypeNamea; |
||||||
|
|
||||||
|
private String devTypeNameNew; |
||||||
|
|
||||||
|
private Long groupid; |
||||||
|
|
||||||
|
private String groupname; |
||||||
|
|
||||||
|
private Long parentgroupid; |
||||||
|
|
||||||
|
private String groupdescription; |
||||||
|
|
||||||
|
private String groupcode; |
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
|
|
@ -0,0 +1,36 @@ |
|||||||
|
package com.bellmann.model.query; |
||||||
|
|
||||||
|
import com.bellmann.common.base.BasePageQuery; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true) |
||||||
|
@Data |
||||||
|
public class ReportBasicQuery extends BasePageQuery { |
||||||
|
private Long area; |
||||||
|
|
||||||
|
private Long subarea; |
||||||
|
|
||||||
|
private String category; |
||||||
|
|
||||||
|
private String devName; |
||||||
|
|
||||||
|
private String accessType; |
||||||
|
|
||||||
|
private String devType; |
||||||
|
|
||||||
|
private String gateWayType; |
||||||
|
|
||||||
|
private String firstStartTime; |
||||||
|
|
||||||
|
private String firstEndTime; |
||||||
|
|
||||||
|
private String lastStartTime; |
||||||
|
|
||||||
|
private String lastEndTime; |
||||||
|
|
||||||
|
private String onLineStartTime; |
||||||
|
|
||||||
|
private String onLineEndTime; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,41 @@ |
|||||||
|
package com.bellmann.model.vo; |
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty; |
||||||
|
import com.alibaba.excel.annotation.write.style.ColumnWidth; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
@Data |
||||||
|
@ColumnWidth(25) |
||||||
|
public class DetailExportVO { |
||||||
|
@ExcelProperty(value = "分公司") |
||||||
|
private String area; |
||||||
|
@ExcelProperty(value = "区局") |
||||||
|
private String subArea; |
||||||
|
@ExcelProperty(value = "设备Id") |
||||||
|
private Long devId; |
||||||
|
@ExcelProperty(value = "厂商") |
||||||
|
private String category; |
||||||
|
@ExcelProperty(value = "设备型号") |
||||||
|
private String oui; |
||||||
|
@ExcelProperty(value = "设备序列号") |
||||||
|
private String devSno; |
||||||
|
@ExcelProperty(value = "硬件版本") |
||||||
|
private String devHard; |
||||||
|
@ExcelProperty(value = "软件版本") |
||||||
|
private String devSoft; |
||||||
|
@ExcelProperty(value = "网关类型") |
||||||
|
private String gateWayType; |
||||||
|
@ExcelProperty(value = "逻辑ID") |
||||||
|
private String sno; |
||||||
|
@ExcelProperty(value = "宽带账号") |
||||||
|
private String pppoe; |
||||||
|
@ExcelProperty(value = "首次装机时间") |
||||||
|
private String createTime; |
||||||
|
@ExcelProperty(value = "最近一次装机时间") |
||||||
|
private String modifyTime; |
||||||
|
@ExcelProperty(value = "最近一次上线时间") |
||||||
|
private String onLineTime; |
||||||
|
@ExcelProperty(value = "接入类型") |
||||||
|
private String rgMode; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,37 @@ |
|||||||
|
package com.bellmann.model.vo; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class DetailInventoryStatisticsVO { |
||||||
|
private String area; |
||||||
|
|
||||||
|
private String subArea; |
||||||
|
|
||||||
|
private Long devId; |
||||||
|
|
||||||
|
private String category; |
||||||
|
|
||||||
|
private String devName; |
||||||
|
|
||||||
|
private String oui; |
||||||
|
|
||||||
|
private String devSno; |
||||||
|
|
||||||
|
private String devHard; |
||||||
|
|
||||||
|
private String devSoft; |
||||||
|
|
||||||
|
private String gateWayType; |
||||||
|
|
||||||
|
private String sno; |
||||||
|
|
||||||
|
private String pppoe; |
||||||
|
|
||||||
|
private String createTime; |
||||||
|
private String modifyTime; |
||||||
|
private String onLineTime; |
||||||
|
|
||||||
|
private String rgMode; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,14 @@ |
|||||||
|
package com.bellmann.service; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import com.bellmann.model.query.ReportBasicQuery; |
||||||
|
import com.bellmann.model.vo.DetailExportVO; |
||||||
|
import com.bellmann.model.vo.DetailInventoryStatisticsVO; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
public interface ReportService { |
||||||
|
Page<DetailInventoryStatisticsVO> detailPage(ReportBasicQuery query); |
||||||
|
|
||||||
|
List<DetailExportVO> listExportDetail(ReportBasicQuery queryParams); |
||||||
|
} |
@ -0,0 +1,52 @@ |
|||||||
|
package com.bellmann.service.impl; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import com.bellmann.converter.DeviceStaticConverter; |
||||||
|
import com.bellmann.manger.ServiceManager; |
||||||
|
import com.bellmann.mapper.DeviceStaticMapper; |
||||||
|
import com.bellmann.mapper.ViewDeviceTotalMapper; |
||||||
|
import com.bellmann.model.query.ReportBasicQuery; |
||||||
|
import com.bellmann.model.vo.DetailExportVO; |
||||||
|
import com.bellmann.model.vo.DetailInventoryStatisticsVO; |
||||||
|
import com.bellmann.service.ReportService; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@Service |
||||||
|
@RequiredArgsConstructor |
||||||
|
public class ReportServiceImpl implements ReportService { |
||||||
|
private final ViewDeviceTotalMapper viewDeviceTotalMapper; |
||||||
|
|
||||||
|
private final DeviceStaticMapper deviceStaticMapper; |
||||||
|
|
||||||
|
private final ServiceManager serviceManager; |
||||||
|
|
||||||
|
private final DeviceStaticConverter deviceStaticConverter; |
||||||
|
@Override |
||||||
|
public Page<DetailInventoryStatisticsVO> detailPage(ReportBasicQuery query) { |
||||||
|
int pageNum = query.getPageNum(); |
||||||
|
int pageSize = query.getPageSize(); |
||||||
|
Page<DetailInventoryStatisticsVO> page = new Page<>(pageNum,pageSize); |
||||||
|
Page<DetailInventoryStatisticsVO> voPage = viewDeviceTotalMapper.detailInventoryStatisticsPage(page, query); |
||||||
|
|
||||||
|
voPage.getRecords().forEach(obj->{ |
||||||
|
obj.setRgMode(serviceManager.getConnType(obj.getDevId())); |
||||||
|
}); |
||||||
|
return voPage; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public List<DetailExportVO> listExportDetail(ReportBasicQuery queryParams) { |
||||||
|
int pageNum = queryParams.getPageNum(); |
||||||
|
int pageSize = queryParams.getPageSize(); |
||||||
|
Page<DetailInventoryStatisticsVO> page = new Page<>(pageNum,pageSize); |
||||||
|
List<DetailInventoryStatisticsVO> records = viewDeviceTotalMapper.detailInventoryStatisticsPage(page, queryParams).getRecords(); |
||||||
|
records.forEach(obj->{ |
||||||
|
obj.setRgMode(serviceManager.getConnType(obj.getDevId())); |
||||||
|
}); |
||||||
|
return deviceStaticConverter.detailVO2ExportVO(records); |
||||||
|
|
||||||
|
} |
||||||
|
} |
@ -0,0 +1,69 @@ |
|||||||
|
<?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.bellmann.mapper.ViewDeviceTotalMapper"> |
||||||
|
<select id="detailInventoryStatisticsPage" resultType="com.bellmann.model.vo.DetailInventoryStatisticsVO"> |
||||||
|
SELECT |
||||||
|
t2.groupname AS area, |
||||||
|
t1.groupname AS subArea, |
||||||
|
t1.dev_id AS devId, |
||||||
|
t1.dev_vendor_name AS category, |
||||||
|
t1.dev_type_name AS devName, |
||||||
|
t1.dev_remark3 AS oui, |
||||||
|
t1.dev_sno AS devSno, |
||||||
|
t1.dev_hard_ver AS devHard, |
||||||
|
t1.soft_ver AS devSoft, |
||||||
|
CASE |
||||||
|
t1.dev_type_name_new |
||||||
|
WHEN 'ITMS' THEN |
||||||
|
'家庭' |
||||||
|
WHEN 'BBMS' THEN |
||||||
|
'政企' ELSE'其他' |
||||||
|
END AS gateWayType, |
||||||
|
t1.dev_ad_no AS sno, |
||||||
|
t1.dev_pppoe AS pppoe, |
||||||
|
to_char( t1.dev_create_time, 'yyyy-MM-dd HH:mm:ss' ) AS createTime, |
||||||
|
to_char( t1.dev_modify_time, 'yyyy-MM-dd HH:mm:ss' ) AS modifyTime, |
||||||
|
to_char( t1.dev_online_time, 'yyyy-MM-dd HH:mm:ss' ) AS onLineTime |
||||||
|
FROM |
||||||
|
V_ZJ_DEVICE_TOTAL t1 |
||||||
|
LEFT JOIN GROUP_INFO_TAB t2 ON t1.parentgroupid = t2.groupid |
||||||
|
<where> |
||||||
|
<if test="form.area !=0 and form.area!=null"> |
||||||
|
and t1.PARENTGROUPID = #{form.area} |
||||||
|
</if> |
||||||
|
<if test="form.subarea !=null "> |
||||||
|
and t1.groupid = #{form.subarea} |
||||||
|
</if> |
||||||
|
<if test="form.category!=null and form.category!= '' and form.category!= '-1' "> |
||||||
|
and UPPER(t1.DEV_VENDOR_NAME) = UPPER(#{form.category}) |
||||||
|
</if> |
||||||
|
<if test="form.devName!=null and form.devName!='' and form.devName!='-1' "> |
||||||
|
and t1.DEV_TYPE_NAME = #{form.devName} |
||||||
|
</if> |
||||||
|
<if test="form.accessType!=null and form.accessType!=''"> |
||||||
|
and t1.DEV_ACCESS_TYPE = #{form.accessType} |
||||||
|
</if> |
||||||
|
<if test="form.devType!=null and form.devType!=''"> |
||||||
|
and t1.dev_type_namea = #{form.devType} |
||||||
|
</if> |
||||||
|
<if test="form.gateWayType!=null and form.gateWayType!=''"> |
||||||
|
and t1.dev_type_name_new = #{form.gateWayType} |
||||||
|
</if> |
||||||
|
<if test="form.firstStartTime!=null and form.firstEndTime!=null"> |
||||||
|
and t1.dev_create_time >= to_date(#{form.firstStartTime}, 'yyyy-MM-dd HH24:mi:ss') |
||||||
|
and t1.dev_create_time<= to_date(#{form.firstEndTime},'yyyy-MM-dd HH24:mi:ss') |
||||||
|
</if> |
||||||
|
<if test="form.lastStartTime!=null and form.lastEndTime!=null "> |
||||||
|
and t1.dev_modify_time >= to_date(#{form.lastStartTime}, 'yyyy-MM-dd HH24:mi:ss') |
||||||
|
and t1.dev_modify_time<= to_date(#{form.lastEndTime},'yyyy-MM-dd HH24:mi:ss') |
||||||
|
</if> |
||||||
|
<if test="form.onLineStartTime!=null and form.onLineEndTime!=null"> |
||||||
|
and t1.dev_online_time >= to_date(#{form.onLineStartTime}, 'yyyy-MM-dd HH24:mi:ss') |
||||||
|
and t1.dev_online_time<= to_date(#{form.onLineEndTime},'yyyy-MM-dd HH24:mi:ss') |
||||||
|
</if> |
||||||
|
</where> |
||||||
|
</select> |
||||||
|
|
||||||
|
</mapper> |
Loading…
Reference in new issue