18 changed files with 855 additions and 304 deletions
@ -1,39 +0,0 @@ |
|||
package com.zdxt.enforcementcode.controller.web.supervision; |
|||
|
|||
import com.zdxt.enforcementcode.domain.bo.AreaQuarterStatQueryBo; |
|||
import com.zdxt.enforcementcode.domain.vo.AreaQuarterStatCategoryVo; |
|||
import lombok.RequiredArgsConstructor; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.dromara.common.web.core.BaseController; |
|||
import org.dromara.common.core.domain.R; |
|||
import com.zdxt.enforcementcode.service.IDashboardTrendAreaStatService; |
|||
|
|||
/** |
|||
* 大屏-趋势行为分析-区域统计 |
|||
* |
|||
* @author Lion Li |
|||
* @date 2026-05-27 |
|||
*/ |
|||
@Validated |
|||
@RequiredArgsConstructor |
|||
@RestController |
|||
@RequestMapping("/web/dashboard/trendAreaStat") |
|||
public class DashboardTrendAreaStatController extends BaseController { |
|||
|
|||
private final IDashboardTrendAreaStatService dashboardTrendAreaStatService; |
|||
|
|||
|
|||
/** |
|||
* 查询区域季度统计数据(按检查数量分类统计) |
|||
* 统计检查数量=0和检查数量>150的区域数量 |
|||
* |
|||
* @param queryBo 查询参数 |
|||
*/ |
|||
@GetMapping("/areaQuarterStatByCategory") |
|||
public R<AreaQuarterStatCategoryVo> getAreaQuarterStatByCategory(@Validated AreaQuarterStatQueryBo queryBo) { |
|||
AreaQuarterStatCategoryVo result = dashboardTrendAreaStatService.queryAreaQuarterStatByCategory(queryBo); |
|||
return R.ok(result); |
|||
} |
|||
|
|||
} |
|||
@ -1,48 +0,0 @@ |
|||
package com.zdxt.enforcementcode.controller.web.supervision; |
|||
|
|||
import java.util.List; |
|||
|
|||
import lombok.RequiredArgsConstructor; |
|||
import jakarta.servlet.http.HttpServletResponse; |
|||
import jakarta.validation.constraints.*; |
|||
import cn.dev33.satoken.annotation.SaCheckPermission; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.dromara.common.idempotent.annotation.RepeatSubmit; |
|||
import org.dromara.common.log.annotation.Log; |
|||
import org.dromara.common.web.core.BaseController; |
|||
import org.dromara.common.mybatis.core.page.PageQuery; |
|||
import org.dromara.common.core.domain.R; |
|||
import org.dromara.common.core.validate.AddGroup; |
|||
import org.dromara.common.core.validate.EditGroup; |
|||
import org.dromara.common.log.enums.BusinessType; |
|||
import org.dromara.common.excel.utils.ExcelUtil; |
|||
import com.zdxt.enforcementcode.domain.vo.DashboardTrendDomainStatVo; |
|||
import com.zdxt.enforcementcode.domain.bo.DashboardTrendDomainStatBo; |
|||
import com.zdxt.enforcementcode.service.IDashboardTrendDomainStatService; |
|||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|||
|
|||
/** |
|||
* 大屏-趋势行为分析-领域统计 |
|||
* |
|||
* @author Lion Li |
|||
* @date 2026-05-27 |
|||
*/ |
|||
@Validated |
|||
@RequiredArgsConstructor |
|||
@RestController |
|||
@RequestMapping("/web/dashboard/trendDomainStat") |
|||
public class DashboardTrendDomainStatController extends BaseController { |
|||
|
|||
private final IDashboardTrendDomainStatService dashboardTrendDomainStatService; |
|||
|
|||
/** |
|||
* 查询趋势行为分析-领域统计列表 |
|||
*/ |
|||
@SaCheckPermission("enforcementcode:trendDomainStat:list") |
|||
@GetMapping("/list") |
|||
public TableDataInfo<DashboardTrendDomainStatVo> list(DashboardTrendDomainStatBo bo, PageQuery pageQuery) { |
|||
return dashboardTrendDomainStatService.queryPageList(bo, pageQuery); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,74 @@ |
|||
package com.zdxt.enforcementcode.controller.web.supervision; |
|||
|
|||
import cn.dev33.satoken.annotation.SaCheckPermission; |
|||
import com.zdxt.enforcementcode.domain.bo.DashboardTrendStatBo; |
|||
import com.zdxt.enforcementcode.domain.bo.DashboardTrendStatQueryBo; |
|||
import com.zdxt.enforcementcode.domain.vo.AreaQuarterStatVo; |
|||
import com.zdxt.enforcementcode.domain.vo.DashboardTrendStatVo; |
|||
import com.zdxt.enforcementcode.domain.vo.DomainQuarterStatVo; |
|||
import com.zdxt.enforcementcode.service.IDashboardTrendStatService; |
|||
import lombok.RequiredArgsConstructor; |
|||
import org.dromara.common.core.domain.R; |
|||
import org.dromara.common.mybatis.core.page.PageQuery; |
|||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|||
import org.dromara.common.web.core.BaseController; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 大屏-趋势行为分析 |
|||
* |
|||
* @author Lion Li |
|||
* @date 2026-05-27 |
|||
*/ |
|||
@Validated |
|||
@RequiredArgsConstructor |
|||
@RestController |
|||
@RequestMapping("/web/dashboard/trendStat") |
|||
public class DashboardTrendStatController extends BaseController { |
|||
|
|||
private final IDashboardTrendStatService dashboardTrendStatService; |
|||
|
|||
/** |
|||
* 区域+季节(信用)检查次数 |
|||
* |
|||
* @param bo 查询参数 |
|||
* @return 分类统计结果 |
|||
*/ |
|||
@GetMapping("/areaQuarterCheck") |
|||
public R<List<AreaQuarterStatVo>> areaQuarterCheck(@Validated DashboardTrendStatQueryBo bo) { |
|||
List<AreaQuarterStatVo> list = dashboardTrendStatService.areaQuarterCheck(bo); |
|||
return R.ok(list); |
|||
} |
|||
|
|||
|
|||
|
|||
/** |
|||
* 区域+季节+领域检查次数 |
|||
* |
|||
* @param bo 查询参数 |
|||
* @return 分类统计结果 |
|||
*/ |
|||
@GetMapping("/areaQuarterDomainCheck") |
|||
public R<List<DashboardTrendStatVo>> areaQuarterDomainCheck(@Validated DashboardTrendStatQueryBo bo) { |
|||
List<DashboardTrendStatVo> list = dashboardTrendStatService.areaQuarterDomainCheck(bo); |
|||
return R.ok(list); |
|||
} |
|||
|
|||
/** |
|||
* 领域+季节(+信用)检查次数 |
|||
* |
|||
* @param bo 查询参数 |
|||
* @return 分类统计结果 |
|||
*/ |
|||
@GetMapping("/domainQuarterCheck") |
|||
public R<List<DomainQuarterStatVo>> domainQuarterCheck(@Validated DashboardTrendStatQueryBo bo) { |
|||
List<DomainQuarterStatVo> list = dashboardTrendStatService.domainQuarterCheck(bo); |
|||
return R.ok(list); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,69 @@ |
|||
package com.zdxt.enforcementcode.domain.bo; |
|||
|
|||
|
|||
import com.zdxt.enforcementcode.domain.bean.DashboardTrendStat; |
|||
import io.github.linpeilie.annotations.AutoMapper; |
|||
import jakarta.validation.constraints.NotBlank; |
|||
import jakarta.validation.constraints.NotNull; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import org.dromara.common.core.validate.AddGroup; |
|||
import org.dromara.common.core.validate.EditGroup; |
|||
import org.dromara.common.mybatis.core.domain.BaseEntity; |
|||
|
|||
/** |
|||
* 趋势行为分析-领域统计业务对象 dashboard_trend_domain_stat |
|||
* |
|||
* @author Lion Li |
|||
* @date 2026-05-27 |
|||
*/ |
|||
@Data |
|||
public class DashboardTrendStatQueryBo extends BaseEntity { |
|||
|
|||
/** |
|||
* 年份(可选,不传则默认查询前四个季度) |
|||
*/ |
|||
private Long year; |
|||
|
|||
/** |
|||
* 起始年份(用于跨年查询) |
|||
*/ |
|||
private Long startYear; |
|||
|
|||
/** |
|||
* 起始季度(用于跨年查询) |
|||
*/ |
|||
private Integer startQuarter; |
|||
|
|||
/** |
|||
* 结束年份(用于跨年查询) |
|||
*/ |
|||
private Long endYear; |
|||
|
|||
/** |
|||
* 结束季度(用于跨年查询) |
|||
*/ |
|||
private Integer endQuarter; |
|||
|
|||
/** |
|||
* 区编码(可选) |
|||
*/ |
|||
private String districtCode; |
|||
|
|||
/** |
|||
* 区名称(可选) |
|||
*/ |
|||
private String districtName; |
|||
|
|||
|
|||
/** |
|||
* 领域ID |
|||
*/ |
|||
private String lyid; |
|||
|
|||
/** |
|||
* 领域名称 |
|||
*/ |
|||
private String lymc; |
|||
|
|||
} |
|||
@ -0,0 +1,83 @@ |
|||
package com.zdxt.enforcementcode.domain.vo; |
|||
|
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serial; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 区域季度统计VO(按区域+季节统计检查次数和评级数量) |
|||
* |
|||
* @author Lion Li |
|||
* @date 2026-05-28 |
|||
*/ |
|||
@Data |
|||
public class AreaQuarterStatVo implements Serializable { |
|||
|
|||
@Serial |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 区编码 |
|||
*/ |
|||
|
|||
private String districtCode; |
|||
|
|||
/** |
|||
* 区名称 |
|||
*/ |
|||
private String districtName; |
|||
|
|||
/** |
|||
* 年份 |
|||
*/ |
|||
private Long year; |
|||
|
|||
/** |
|||
* 季度:1-一季度 2-二季度 3-三季度 4-四季度 |
|||
*/ |
|||
private Long quarter; |
|||
|
|||
/** |
|||
* 检查次数 |
|||
*/ |
|||
private Long jccs; |
|||
|
|||
/** |
|||
* 评级A+数量 |
|||
*/ |
|||
|
|||
private Long djAPlus; |
|||
|
|||
/** |
|||
* 评级A数量 |
|||
*/ |
|||
private Long djA; |
|||
|
|||
/** |
|||
* 评级B数量 |
|||
*/ |
|||
private Long djB; |
|||
|
|||
/** |
|||
* 评级C数量 |
|||
*/ |
|||
private Long djC; |
|||
|
|||
/** |
|||
* 评级D数量 |
|||
*/ |
|||
private Long djD; |
|||
|
|||
/** |
|||
* 评级E数量 |
|||
*/ |
|||
private Long djE; |
|||
|
|||
/** |
|||
* 违规次数 |
|||
*/ |
|||
private Long wgcs; |
|||
|
|||
} |
|||
@ -0,0 +1,78 @@ |
|||
package com.zdxt.enforcementcode.domain.vo; |
|||
|
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serial; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 领域季度统计VO(按领域+季节统计检查次数和评级数量) |
|||
* |
|||
* @author Lion Li |
|||
* @date 2026-05-28 |
|||
*/ |
|||
@Data |
|||
|
|||
|
|||
public class DomainQuarterStatVo implements Serializable { |
|||
|
|||
@Serial |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 领域名称 |
|||
*/ |
|||
private String lymc; |
|||
|
|||
/** |
|||
* 年份 |
|||
*/ |
|||
private Long year; |
|||
|
|||
/** |
|||
* 季度:1-一季度 2-二季度 3-三季度 4-四季度 |
|||
*/ |
|||
private Long quarter; |
|||
|
|||
/** |
|||
* 检查次数 |
|||
*/ |
|||
private Long jccs; |
|||
|
|||
/** |
|||
* 评级A+数量 |
|||
*/ |
|||
private Long djAPlus; |
|||
|
|||
/** |
|||
* 评级A数量 |
|||
*/ |
|||
private Long djA; |
|||
|
|||
/** |
|||
* 评级B数量 |
|||
*/ |
|||
private Long djB; |
|||
|
|||
/** |
|||
* 评级C数量 |
|||
*/ |
|||
private Long djC; |
|||
|
|||
/** |
|||
* 评级D数量 |
|||
*/ |
|||
private Long djD; |
|||
|
|||
/** |
|||
* 评级E数量 |
|||
*/ |
|||
private Long djE; |
|||
|
|||
/** |
|||
* 违规次数 |
|||
*/ |
|||
private Long wgcs; |
|||
|
|||
} |
|||
@ -1,16 +0,0 @@ |
|||
package com.zdxt.enforcementcode.mapper; |
|||
|
|||
|
|||
import com.zdxt.enforcementcode.domain.bean.DashboardTrendDomainStat; |
|||
import com.zdxt.enforcementcode.domain.vo.DashboardTrendDomainStatVo; |
|||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; |
|||
|
|||
/** |
|||
* 趋势行为分析-领域统计Mapper接口 |
|||
* |
|||
* @author Lion Li |
|||
* @date 2026-05-27 |
|||
*/ |
|||
public interface DashboardTrendDomainStatMapper extends BaseMapperPlus<DashboardTrendDomainStat, DashboardTrendDomainStatVo> { |
|||
|
|||
} |
|||
@ -0,0 +1,50 @@ |
|||
package com.zdxt.enforcementcode.mapper; |
|||
|
|||
|
|||
import com.zdxt.enforcementcode.domain.bean.DashboardTrendStat; |
|||
import com.zdxt.enforcementcode.domain.bo.DashboardTrendStatQueryBo; |
|||
import com.zdxt.enforcementcode.domain.vo.AreaQuarterStatVo; |
|||
import com.zdxt.enforcementcode.domain.vo.AreaQuarterStatVo; |
|||
import com.zdxt.enforcementcode.domain.vo.DashboardTrendStatVo; |
|||
import com.zdxt.enforcementcode.domain.vo.DomainQuarterStatVo; |
|||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 趋势行为分析-领域统计Mapper接口 |
|||
* |
|||
* @author Lion Li |
|||
* @date 2026-05-27 |
|||
*/ |
|||
public interface DashboardTrendStatMapper extends BaseMapperPlus<DashboardTrendStat, DashboardTrendStatVo> { |
|||
|
|||
/** |
|||
* 区域+季节(信用)检查次数 |
|||
* |
|||
* @param queryBo 查询参数 |
|||
* @return 区域季度统计列表 |
|||
*/ |
|||
List<AreaQuarterStatVo> areaQuarterCheck(DashboardTrendStatQueryBo queryBo); |
|||
|
|||
|
|||
/** |
|||
* 区域+季节+领域检查次数 |
|||
* |
|||
* @param queryBo 查询参数 |
|||
* @return 领域季度统计列表 |
|||
*/ |
|||
List<DashboardTrendStatVo> areaQuarterDomainCheck(DashboardTrendStatQueryBo queryBo); |
|||
|
|||
|
|||
/** |
|||
* 领域+季节(+信用)检查次数 |
|||
* |
|||
* @param queryBo 查询参数 |
|||
* @return 领域季度统计列表 |
|||
*/ |
|||
List<DomainQuarterStatVo> domainQuarterCheck(DashboardTrendStatQueryBo queryBo); |
|||
|
|||
|
|||
|
|||
} |
|||
@ -1,151 +0,0 @@ |
|||
package com.zdxt.enforcementcode.service.impl; |
|||
|
|||
import com.zdxt.enforcementcode.domain.bean.DashboardTrendDomainStat; |
|||
import org.dromara.common.core.utils.MapstructUtils; |
|||
import org.dromara.common.core.utils.StringUtils; |
|||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|||
import org.dromara.common.mybatis.core.page.PageQuery; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Service; |
|||
import com.zdxt.enforcementcode.domain.bo.DashboardTrendDomainStatBo; |
|||
import com.zdxt.enforcementcode.domain.vo.DashboardTrendDomainStatVo; |
|||
import com.zdxt.enforcementcode.mapper.DashboardTrendDomainStatMapper; |
|||
import com.zdxt.enforcementcode.service.IDashboardTrendDomainStatService; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.Collection; |
|||
|
|||
/** |
|||
* 趋势行为分析-领域统计Service业务层处理 |
|||
* |
|||
* @author Lion Li |
|||
* @date 2026-05-27 |
|||
*/ |
|||
@Slf4j |
|||
@RequiredArgsConstructor |
|||
@Service |
|||
public class DashboardTrendDomainStatServiceImpl implements IDashboardTrendDomainStatService { |
|||
|
|||
private final DashboardTrendDomainStatMapper baseMapper; |
|||
|
|||
/** |
|||
* 查询趋势行为分析-领域统计 |
|||
* |
|||
* @param id 主键 |
|||
* @return 趋势行为分析-领域统计 |
|||
*/ |
|||
@Override |
|||
public DashboardTrendDomainStatVo queryById(String id){ |
|||
return baseMapper.selectVoById(id); |
|||
} |
|||
|
|||
/** |
|||
* 分页查询趋势行为分析-领域统计列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @param pageQuery 分页参数 |
|||
* @return 趋势行为分析-领域统计分页列表 |
|||
*/ |
|||
@Override |
|||
public TableDataInfo<DashboardTrendDomainStatVo> queryPageList(DashboardTrendDomainStatBo bo, PageQuery pageQuery) { |
|||
LambdaQueryWrapper<DashboardTrendDomainStat> lqw = buildQueryWrapper(bo); |
|||
Page<DashboardTrendDomainStatVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); |
|||
return TableDataInfo.build(result); |
|||
} |
|||
|
|||
/** |
|||
* 查询符合条件的趋势行为分析-领域统计列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @return 趋势行为分析-领域统计列表 |
|||
*/ |
|||
@Override |
|||
public List<DashboardTrendDomainStatVo> queryList(DashboardTrendDomainStatBo bo) { |
|||
LambdaQueryWrapper<DashboardTrendDomainStat> lqw = buildQueryWrapper(bo); |
|||
return baseMapper.selectVoList(lqw); |
|||
} |
|||
|
|||
private LambdaQueryWrapper<DashboardTrendDomainStat> buildQueryWrapper(DashboardTrendDomainStatBo bo) { |
|||
Map<String, Object> params = bo.getParams(); |
|||
LambdaQueryWrapper<DashboardTrendDomainStat> lqw = Wrappers.lambdaQuery(); |
|||
lqw.orderByAsc(DashboardTrendDomainStat::getId); |
|||
lqw.eq(bo.getYear() != null, DashboardTrendDomainStat::getYear, bo.getYear()); |
|||
lqw.eq(bo.getQuarter() != null, DashboardTrendDomainStat::getQuarter, bo.getQuarter()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getDistrictCode()), DashboardTrendDomainStat::getDistrictCode, bo.getDistrictCode()); |
|||
lqw.like(StringUtils.isNotBlank(bo.getDistrictName()), DashboardTrendDomainStat::getDistrictName, bo.getDistrictName()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getLyid()), DashboardTrendDomainStat::getLyid, bo.getLyid()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getLymc()), DashboardTrendDomainStat::getLymc, bo.getLymc()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getZfdwid()), DashboardTrendDomainStat::getZfdwid, bo.getZfdwid()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getZfdwmc()), DashboardTrendDomainStat::getZfdwmc, bo.getZfdwmc()); |
|||
lqw.eq(bo.getJccs() != null, DashboardTrendDomainStat::getJccs, bo.getJccs()); |
|||
lqw.eq(bo.getDjAPlus() != null, DashboardTrendDomainStat::getDjAPlus, bo.getDjAPlus()); |
|||
lqw.eq(bo.getDjA() != null, DashboardTrendDomainStat::getDjA, bo.getDjA()); |
|||
lqw.eq(bo.getDjB() != null, DashboardTrendDomainStat::getDjB, bo.getDjB()); |
|||
lqw.eq(bo.getDjC() != null, DashboardTrendDomainStat::getDjC, bo.getDjC()); |
|||
lqw.eq(bo.getDjD() != null, DashboardTrendDomainStat::getDjD, bo.getDjD()); |
|||
lqw.eq(bo.getDjE() != null, DashboardTrendDomainStat::getDjE, bo.getDjE()); |
|||
lqw.eq(bo.getWgcs() != null, DashboardTrendDomainStat::getWgcs, bo.getWgcs()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getIsDelete()), DashboardTrendDomainStat::getIsDelete, bo.getIsDelete()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getBureauDeptId()), DashboardTrendDomainStat::getBureauDeptId, bo.getBureauDeptId()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getDeptId()), DashboardTrendDomainStat::getDeptId, bo.getDeptId()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getOrganId()), DashboardTrendDomainStat::getOrganId, bo.getOrganId()); |
|||
return lqw; |
|||
} |
|||
|
|||
/** |
|||
* 新增趋势行为分析-领域统计 |
|||
* |
|||
* @param bo 趋势行为分析-领域统计 |
|||
* @return 是否新增成功 |
|||
*/ |
|||
@Override |
|||
public Boolean insertByBo(DashboardTrendDomainStatBo bo) { |
|||
DashboardTrendDomainStat add = MapstructUtils.convert(bo, DashboardTrendDomainStat.class); |
|||
validEntityBeforeSave(add); |
|||
boolean flag = baseMapper.insert(add) > 0; |
|||
if (flag) { |
|||
bo.setId(add.getId()); |
|||
} |
|||
return flag; |
|||
} |
|||
|
|||
/** |
|||
* 修改趋势行为分析-领域统计 |
|||
* |
|||
* @param bo 趋势行为分析-领域统计 |
|||
* @return 是否修改成功 |
|||
*/ |
|||
@Override |
|||
public Boolean updateByBo(DashboardTrendDomainStatBo bo) { |
|||
DashboardTrendDomainStat update = MapstructUtils.convert(bo, DashboardTrendDomainStat.class); |
|||
validEntityBeforeSave(update); |
|||
return baseMapper.updateById(update) > 0; |
|||
} |
|||
|
|||
/** |
|||
* 保存前的数据校验 |
|||
*/ |
|||
private void validEntityBeforeSave(DashboardTrendDomainStat entity){ |
|||
//TODO 做一些数据校验,如唯一约束
|
|||
} |
|||
|
|||
/** |
|||
* 校验并批量删除趋势行为分析-领域统计信息 |
|||
* |
|||
* @param ids 待删除的主键集合 |
|||
* @param isValid 是否进行有效性校验 |
|||
* @return 是否删除成功 |
|||
*/ |
|||
@Override |
|||
public Boolean deleteWithValidByIds(Collection<String> ids, Boolean isValid) { |
|||
if(isValid){ |
|||
//TODO 做一些业务上的校验,判断是否需要校验
|
|||
} |
|||
return baseMapper.deleteByIds(ids) > 0; |
|||
} |
|||
} |
|||
@ -0,0 +1,306 @@ |
|||
package com.zdxt.enforcementcode.service.impl; |
|||
|
|||
import cn.hutool.core.collection.CollUtil; |
|||
import com.zdxt.enforcementcode.domain.bean.DashboardTrendStat; |
|||
import com.zdxt.enforcementcode.domain.bo.DashboardTrendStatQueryBo; |
|||
import com.zdxt.enforcementcode.domain.vo.AreaQuarterStatVo; |
|||
import com.zdxt.enforcementcode.domain.vo.DomainQuarterStatVo; |
|||
import org.dromara.common.core.utils.MapstructUtils; |
|||
import org.dromara.common.core.utils.StringUtils; |
|||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|||
import org.dromara.common.mybatis.core.page.PageQuery; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Service; |
|||
import com.zdxt.enforcementcode.domain.bo.DashboardTrendStatBo; |
|||
import com.zdxt.enforcementcode.domain.vo.DashboardTrendStatVo; |
|||
import com.zdxt.enforcementcode.mapper.DashboardTrendStatMapper; |
|||
import com.zdxt.enforcementcode.service.IDashboardTrendStatService; |
|||
|
|||
import java.util.*; |
|||
|
|||
/** |
|||
* 趋势行为分析-领域统计Service业务层处理 |
|||
* |
|||
* @author Lion Li |
|||
* @date 2026-05-27 |
|||
*/ |
|||
@Slf4j |
|||
@RequiredArgsConstructor |
|||
@Service |
|||
public class DashboardTrendStatServiceImpl implements IDashboardTrendStatService { |
|||
|
|||
private final DashboardTrendStatMapper baseMapper; |
|||
|
|||
/** |
|||
* 查询趋势行为分析-领域统计 |
|||
* |
|||
* @param id 主键 |
|||
* @return 趋势行为分析-领域统计 |
|||
*/ |
|||
@Override |
|||
public DashboardTrendStatVo queryById(String id){ |
|||
return baseMapper.selectVoById(id); |
|||
} |
|||
|
|||
/** |
|||
* 分页查询趋势行为分析-领域统计列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @param pageQuery 分页参数 |
|||
* @return 趋势行为分析-领域统计分页列表 |
|||
*/ |
|||
@Override |
|||
public TableDataInfo<DashboardTrendStatVo> queryPageList(DashboardTrendStatBo bo, PageQuery pageQuery) { |
|||
LambdaQueryWrapper<DashboardTrendStat> lqw = buildQueryWrapper(bo); |
|||
Page<DashboardTrendStatVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); |
|||
return TableDataInfo.build(result); |
|||
} |
|||
|
|||
/** |
|||
* 查询符合条件的趋势行为分析-领域统计列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @return 趋势行为分析-领域统计列表 |
|||
*/ |
|||
@Override |
|||
public List<DashboardTrendStatVo> queryList(DashboardTrendStatBo bo) { |
|||
LambdaQueryWrapper<DashboardTrendStat> lqw = buildQueryWrapper(bo); |
|||
return baseMapper.selectVoList(lqw); |
|||
} |
|||
|
|||
private LambdaQueryWrapper<DashboardTrendStat> buildQueryWrapper(DashboardTrendStatBo bo) { |
|||
Map<String, Object> params = bo.getParams(); |
|||
LambdaQueryWrapper<DashboardTrendStat> lqw = Wrappers.lambdaQuery(); |
|||
lqw.orderByAsc(DashboardTrendStat::getId); |
|||
lqw.eq(bo.getYear() != null, DashboardTrendStat::getYear, bo.getYear()); |
|||
lqw.eq(bo.getQuarter() != null, DashboardTrendStat::getQuarter, bo.getQuarter()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getDistrictCode()), DashboardTrendStat::getDistrictCode, bo.getDistrictCode()); |
|||
lqw.like(StringUtils.isNotBlank(bo.getDistrictName()), DashboardTrendStat::getDistrictName, bo.getDistrictName()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getLyid()), DashboardTrendStat::getLyid, bo.getLyid()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getLymc()), DashboardTrendStat::getLymc, bo.getLymc()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getZfdwid()), DashboardTrendStat::getZfdwid, bo.getZfdwid()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getZfdwmc()), DashboardTrendStat::getZfdwmc, bo.getZfdwmc()); |
|||
lqw.eq(bo.getJccs() != null, DashboardTrendStat::getJccs, bo.getJccs()); |
|||
lqw.eq(bo.getDjAPlus() != null, DashboardTrendStat::getDjAPlus, bo.getDjAPlus()); |
|||
lqw.eq(bo.getDjA() != null, DashboardTrendStat::getDjA, bo.getDjA()); |
|||
lqw.eq(bo.getDjB() != null, DashboardTrendStat::getDjB, bo.getDjB()); |
|||
lqw.eq(bo.getDjC() != null, DashboardTrendStat::getDjC, bo.getDjC()); |
|||
lqw.eq(bo.getDjD() != null, DashboardTrendStat::getDjD, bo.getDjD()); |
|||
lqw.eq(bo.getDjE() != null, DashboardTrendStat::getDjE, bo.getDjE()); |
|||
lqw.eq(bo.getWgcs() != null, DashboardTrendStat::getWgcs, bo.getWgcs()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getIsDelete()), DashboardTrendStat::getIsDelete, bo.getIsDelete()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getBureauDeptId()), DashboardTrendStat::getBureauDeptId, bo.getBureauDeptId()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getDeptId()), DashboardTrendStat::getDeptId, bo.getDeptId()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getOrganId()), DashboardTrendStat::getOrganId, bo.getOrganId()); |
|||
return lqw; |
|||
} |
|||
|
|||
/** |
|||
* 新增趋势行为分析-领域统计 |
|||
* |
|||
* @param bo 趋势行为分析-领域统计 |
|||
* @return 是否新增成功 |
|||
*/ |
|||
@Override |
|||
public Boolean insertByBo(DashboardTrendStatBo bo) { |
|||
DashboardTrendStat add = MapstructUtils.convert(bo, DashboardTrendStat.class); |
|||
validEntityBeforeSave(add); |
|||
boolean flag = baseMapper.insert(add) > 0; |
|||
if (flag) { |
|||
bo.setId(add.getId()); |
|||
} |
|||
return flag; |
|||
} |
|||
|
|||
/** |
|||
* 修改趋势行为分析-领域统计 |
|||
* |
|||
* @param bo 趋势行为分析-领域统计 |
|||
* @return 是否修改成功 |
|||
*/ |
|||
@Override |
|||
public Boolean updateByBo(DashboardTrendStatBo bo) { |
|||
DashboardTrendStat update = MapstructUtils.convert(bo, DashboardTrendStat.class); |
|||
validEntityBeforeSave(update); |
|||
return baseMapper.updateById(update) > 0; |
|||
} |
|||
|
|||
/** |
|||
* 保存前的数据校验 |
|||
*/ |
|||
private void validEntityBeforeSave(DashboardTrendStat entity){ |
|||
//TODO 做一些数据校验,如唯一约束
|
|||
} |
|||
|
|||
/** |
|||
* 校验并批量删除趋势行为分析-领域统计信息 |
|||
* |
|||
* @param ids 待删除的主键集合 |
|||
* @param isValid 是否进行有效性校验 |
|||
* @return 是否删除成功 |
|||
*/ |
|||
@Override |
|||
public Boolean deleteWithValidByIds(Collection<String> ids, Boolean isValid) { |
|||
if(isValid){ |
|||
//TODO 做一些业务上的校验,判断是否需要校验
|
|||
} |
|||
return baseMapper.deleteByIds(ids) > 0; |
|||
} |
|||
|
|||
/** |
|||
* 区域+季节(信用)检查次数 |
|||
* |
|||
* @param queryBo 查询参数 |
|||
* @return 分类统计结果 |
|||
*/ |
|||
@Override |
|||
public List<AreaQuarterStatVo> areaQuarterCheck(DashboardTrendStatQueryBo queryBo) { |
|||
// 如果未指定起始和结束季度,默认查询当前系统日期前四个季度的数据(不包含当前季度)
|
|||
if (queryBo.getStartYear() == null || queryBo.getStartQuarter() == null |
|||
|| queryBo.getEndYear() == null || queryBo.getEndQuarter() == null) { |
|||
java.time.LocalDate now = java.time.LocalDate.now(); |
|||
int currentMonth = now.getMonthValue(); |
|||
int currentYear = now.getYear(); |
|||
|
|||
// 计算当前季度
|
|||
int currentQuarter = (currentMonth - 1) / 3 + 1; |
|||
|
|||
// 计算结束季度(当前季度的前一个季度)
|
|||
int endQuarter; |
|||
int endYear; |
|||
if (currentQuarter == 1) { |
|||
// 如果当前是Q1,结束季度是上一年的Q4
|
|||
endQuarter = 4; |
|||
endYear = currentYear - 1; |
|||
} else { |
|||
// 否则结束季度是当前年份的前一个季度
|
|||
endQuarter = currentQuarter - 1; |
|||
endYear = currentYear; |
|||
} |
|||
|
|||
// 计算起始季度(往前推3个季度)
|
|||
int startQuarter; |
|||
int startYear; |
|||
if (endQuarter >= 4) { |
|||
startQuarter = endQuarter - 3; |
|||
startYear = endYear; |
|||
} else { |
|||
startQuarter = endQuarter + 1; |
|||
startYear = endYear - 1; |
|||
} |
|||
|
|||
queryBo.setStartYear((long) startYear); |
|||
queryBo.setStartQuarter(startQuarter); |
|||
queryBo.setEndYear((long) endYear); |
|||
queryBo.setEndQuarter(endQuarter); |
|||
} |
|||
|
|||
return baseMapper.areaQuarterCheck(queryBo); |
|||
} |
|||
|
|||
/** |
|||
* 区域+季节+领域检查次数 |
|||
* |
|||
* @param queryBo 查询参数 |
|||
* @return 分类统计结果 |
|||
*/ |
|||
@Override |
|||
public List<DashboardTrendStatVo> areaQuarterDomainCheck(DashboardTrendStatQueryBo queryBo) { |
|||
// 如果未指定起始和结束季度,默认查询当前系统日期前四个季度的数据(不包含当前季度)
|
|||
if (queryBo.getStartYear() == null || queryBo.getStartQuarter() == null |
|||
|| queryBo.getEndYear() == null || queryBo.getEndQuarter() == null) { |
|||
java.time.LocalDate now = java.time.LocalDate.now(); |
|||
int currentMonth = now.getMonthValue(); |
|||
int currentYear = now.getYear(); |
|||
|
|||
// 计算当前季度
|
|||
int currentQuarter = (currentMonth - 1) / 3 + 1; |
|||
|
|||
// 计算结束季度(当前季度的前一个季度)
|
|||
int endQuarter; |
|||
int endYear; |
|||
if (currentQuarter == 1) { |
|||
// 如果当前是Q1,结束季度是上一年的Q4
|
|||
endQuarter = 4; |
|||
endYear = currentYear - 1; |
|||
} else { |
|||
// 否则结束季度是当前年份的前一个季度
|
|||
endQuarter = currentQuarter - 1; |
|||
endYear = currentYear; |
|||
} |
|||
|
|||
// 计算起始季度(往前推3个季度)
|
|||
int startQuarter; |
|||
int startYear; |
|||
if (endQuarter >= 4) { |
|||
startQuarter = endQuarter - 3; |
|||
startYear = endYear; |
|||
} else { |
|||
startQuarter = endQuarter + 1; |
|||
startYear = endYear - 1; |
|||
} |
|||
|
|||
queryBo.setStartYear((long) startYear); |
|||
queryBo.setStartQuarter(startQuarter); |
|||
queryBo.setEndYear((long) endYear); |
|||
queryBo.setEndQuarter(endQuarter); |
|||
} |
|||
|
|||
return baseMapper.areaQuarterDomainCheck(queryBo); |
|||
} |
|||
|
|||
/** |
|||
* 领域+季节(+信用)检查次数 |
|||
* |
|||
* @param queryBo 查询参数 |
|||
* @return 分类统计结果 |
|||
*/ |
|||
@Override |
|||
public List<DomainQuarterStatVo> domainQuarterCheck(DashboardTrendStatQueryBo queryBo) { |
|||
// 如果未指定起始和结束季度,默认查询当前系统日期前四个季度的数据(不包含当前季度)
|
|||
if (queryBo.getStartYear() == null || queryBo.getStartQuarter() == null |
|||
|| queryBo.getEndYear() == null || queryBo.getEndQuarter() == null) { |
|||
java.time.LocalDate now = java.time.LocalDate.now(); |
|||
int currentMonth = now.getMonthValue(); |
|||
int currentYear = now.getYear(); |
|||
|
|||
// 计算当前季度
|
|||
int currentQuarter = (currentMonth - 1) / 3 + 1; |
|||
|
|||
// 计算结束季度(当前季度的前一个季度)
|
|||
int endQuarter; |
|||
int endYear; |
|||
if (currentQuarter == 1) { |
|||
// 如果当前是Q1,结束季度是上一年的Q4
|
|||
endQuarter = 4; |
|||
endYear = currentYear - 1; |
|||
} else { |
|||
// 否则结束季度是当前年份的前一个季度
|
|||
endQuarter = currentQuarter - 1; |
|||
endYear = currentYear; |
|||
} |
|||
|
|||
// 计算起始季度(往前推3个季度)
|
|||
int startQuarter; |
|||
int startYear; |
|||
if (endQuarter >= 4) { |
|||
startQuarter = endQuarter - 3; |
|||
startYear = endYear; |
|||
} else { |
|||
startQuarter = endQuarter + 1; |
|||
startYear = endYear - 1; |
|||
} |
|||
|
|||
queryBo.setStartYear((long) startYear); |
|||
queryBo.setStartQuarter(startQuarter); |
|||
queryBo.setEndYear((long) endYear); |
|||
queryBo.setEndQuarter(endQuarter); |
|||
} |
|||
|
|||
return baseMapper.domainQuarterCheck(queryBo); |
|||
} |
|||
} |
|||
@ -1,6 +0,0 @@ |
|||
<?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.zdxt.enforcementcode.mapper.DashboardTrendDomainStatMapper"> |
|||
</mapper> |
|||
@ -0,0 +1,142 @@ |
|||
<?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.zdxt.enforcementcode.mapper.DashboardTrendStatMapper"> |
|||
|
|||
<!-- 区域+季节(信用)检查次数 --> |
|||
<select id="areaQuarterCheck" resultType="com.zdxt.enforcementcode.domain.vo.AreaQuarterStatVo"> |
|||
SELECT |
|||
a.district_code, |
|||
a.district_name, |
|||
a.year, |
|||
a.quarter, |
|||
IFNULL(SUM(a.jccs), 0) AS jccs, |
|||
IFNULL(SUM(a.dj_a_plus), 0) AS djAPlus, |
|||
IFNULL(SUM(a.dj_a), 0) AS djA, |
|||
IFNULL(SUM(a.dj_b), 0) AS djB, |
|||
IFNULL(SUM(a.dj_c), 0) AS djC, |
|||
IFNULL(SUM(a.dj_d), 0) AS djD, |
|||
IFNULL(SUM(a.dj_e), 0) AS djE, |
|||
IFNULL(SUM(a.wgcs), 0) AS wgcs |
|||
FROM dashboard_trend_stat a |
|||
WHERE a.is_delete = '0' |
|||
<if test="startYear != null and startQuarter != null and endYear != null and endQuarter != null"> |
|||
AND ( |
|||
(a.year = #{startYear} AND a.quarter >= #{startQuarter}) |
|||
OR (a.year > #{startYear} AND a.year < #{endYear}) |
|||
OR (a.year = #{endYear} AND a.quarter <= #{endQuarter}) |
|||
) |
|||
</if> |
|||
|
|||
<if test="districtCode != null and districtCode != ''"> |
|||
AND a.district_code = #{districtCode} |
|||
</if> |
|||
|
|||
<if test="districtName != null and districtName != ''"> |
|||
AND a.district_name LIKE CONCAT('%', #{districtName}, '%') |
|||
</if> |
|||
|
|||
GROUP BY |
|||
a.district_code, |
|||
a.district_name, |
|||
a.year, |
|||
a.quarter |
|||
|
|||
ORDER BY |
|||
a.district_name, |
|||
a.year, |
|||
a.quarter |
|||
</select> |
|||
|
|||
|
|||
<!-- 区域+季节+领域检查次数 --> |
|||
<select id="areaQuarterDomainCheck" resultType="com.zdxt.enforcementcode.domain.vo.DashboardTrendStatVo"> |
|||
SELECT |
|||
a.* |
|||
FROM dashboard_trend_stat a |
|||
WHERE a.is_delete = '0' |
|||
<if test="startYear != null and startQuarter != null and endYear != null and endQuarter != null"> |
|||
AND ( |
|||
(a.year = #{startYear} AND a.quarter >= #{startQuarter}) |
|||
OR (a.year > #{startYear} AND a.year < #{endYear}) |
|||
OR (a.year = #{endYear} AND a.quarter <= #{endQuarter}) |
|||
) |
|||
</if> |
|||
|
|||
<if test="districtCode != null and districtCode != ''"> |
|||
AND a.district_code = #{districtCode} |
|||
</if> |
|||
|
|||
<if test="districtName != null and districtName != ''"> |
|||
AND a.district_name LIKE CONCAT('%', #{districtName}, '%') |
|||
</if> |
|||
|
|||
<if test="lyid != null and lyid != ''"> |
|||
AND a.lyid = #{lyid} |
|||
</if> |
|||
|
|||
<if test="lymc != null and lymc != ''"> |
|||
AND a.lymc LIKE CONCAT('%', #{lymc}, '%') |
|||
</if> |
|||
|
|||
ORDER BY |
|||
lymc, |
|||
a.year, |
|||
a.quarter |
|||
</select> |
|||
|
|||
|
|||
|
|||
<!-- 领域+季节(+信用)检查次数 --> |
|||
<select id="domainQuarterCheck" resultType="com.zdxt.enforcementcode.domain.vo.DomainQuarterStatVo"> |
|||
SELECT |
|||
a.lymc, |
|||
a.year, |
|||
a.quarter, |
|||
IFNULL(SUM(a.jccs), 0) AS jccs, |
|||
IFNULL(SUM(a.dj_a_plus), 0) AS djAPlus, |
|||
IFNULL(SUM(a.dj_a), 0) AS djA, |
|||
IFNULL(SUM(a.dj_b), 0) AS djB, |
|||
IFNULL(SUM(a.dj_c), 0) AS djC, |
|||
IFNULL(SUM(a.dj_d), 0) AS djD, |
|||
IFNULL(SUM(a.dj_e), 0) AS djE, |
|||
IFNULL(SUM(a.wgcs), 0) AS wgcs |
|||
FROM dashboard_trend_stat a |
|||
WHERE a.is_delete = '0' |
|||
<if test="startYear != null and startQuarter != null and endYear != null and endQuarter != null"> |
|||
AND ( |
|||
(a.year = #{startYear} AND a.quarter >= #{startQuarter}) |
|||
OR (a.year > #{startYear} AND a.year < #{endYear}) |
|||
OR (a.year = #{endYear} AND a.quarter <= #{endQuarter}) |
|||
) |
|||
</if> |
|||
|
|||
<if test="districtCode != null and districtCode != ''"> |
|||
AND a.district_code = #{districtCode} |
|||
</if> |
|||
|
|||
<if test="districtName != null and districtName != ''"> |
|||
AND a.district_name LIKE CONCAT('%', #{districtName}, '%') |
|||
</if> |
|||
|
|||
<if test="lyid != null and lyid != ''"> |
|||
AND a.lyid = #{lyid} |
|||
</if> |
|||
|
|||
<if test="lymc != null and lymc != ''"> |
|||
AND a.lymc LIKE CONCAT('%', #{lymc}, '%') |
|||
</if> |
|||
|
|||
GROUP BY |
|||
a.lymc, |
|||
a.year, |
|||
a.quarter |
|||
|
|||
ORDER BY |
|||
a.lymc, |
|||
a.year, |
|||
a.quarter |
|||
</select> |
|||
|
|||
</mapper> |
|||
Loading…
Reference in new issue