This commit is contained in:
parent
bd745ff6aa
commit
981d6e6d3e
|
|
@ -0,0 +1,121 @@
|
|||
package com.bonus.gzgqj.business.bases.controller;
|
||||
|
||||
import com.bonus.gzgqj.business.app.entity.PartApplyAppVo;
|
||||
import com.bonus.gzgqj.business.app.entity.PartApplyDetailAppVo;
|
||||
import com.bonus.gzgqj.business.bases.entity.PaTypeVo;
|
||||
import com.bonus.gzgqj.business.bases.entity.PartBackVo;
|
||||
import com.bonus.gzgqj.business.bases.entity.PartCheckVo;
|
||||
import com.bonus.gzgqj.business.bases.entity.ProjectInfoVo;
|
||||
import com.bonus.gzgqj.business.bases.service.StatisticsServiceImpl;
|
||||
import com.bonus.gzgqj.business.plan.entity.FileUploadVo;
|
||||
import com.bonus.gzgqj.manager.annotation.DecryptAndVerify;
|
||||
import com.bonus.gzgqj.manager.core.entity.EncryptedReq;
|
||||
import com.bonus.gzgqj.manager.webResult.ServerResponse;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 统计查询
|
||||
* @author 黑子
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/backstage/statistic")
|
||||
@Slf4j
|
||||
public class StatisticsController {
|
||||
|
||||
@Autowired
|
||||
private StatisticsServiceImpl service;
|
||||
|
||||
/**
|
||||
* 领料出库 查询
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("getPaTypeStatistics")
|
||||
public ServerResponse getPaTypeStatistics() {
|
||||
Map<String, String> map=service.getPaTypeStatistics();
|
||||
return ServerResponse.createSuccess(map);
|
||||
}
|
||||
/**
|
||||
* 分页查询配件入库
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("findByPage")
|
||||
@DecryptAndVerify(decryptedClass = PaTypeVo.class)
|
||||
public PageInfo<PaTypeVo> findByPage(EncryptedReq<PaTypeVo> dto) {
|
||||
PageHelper.startPage(dto.getPageNum(),dto.getPageSize());
|
||||
List<PaTypeVo> list = service.findByPage(dto.getData());;
|
||||
PageInfo<PaTypeVo> pageInfo = new PageInfo<>(list);
|
||||
return pageInfo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询配件入库
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("getProListPage")
|
||||
@DecryptAndVerify(decryptedClass = ProjectInfoVo.class)
|
||||
public PageInfo<ProjectInfoVo> getProListPage(EncryptedReq<ProjectInfoVo> dto) {
|
||||
PageHelper.startPage(dto.getPageNum(),dto.getPageSize());
|
||||
List<ProjectInfoVo> list = service.getProListPage(dto.getData());;
|
||||
PageInfo<ProjectInfoVo> pageInfo = new PageInfo<>(list);
|
||||
return pageInfo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询工程领用信息
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("getProDetails")
|
||||
@DecryptAndVerify(decryptedClass = PartApplyAppVo.class)
|
||||
public ServerResponse getProDetails(EncryptedReq<PartApplyAppVo> dto) {
|
||||
return service.getProDetails(dto.getData());
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询配件入库(proId)
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("getProDetailsPage")
|
||||
@DecryptAndVerify(decryptedClass = ProjectInfoVo.class)
|
||||
public PageInfo<PartApplyDetailAppVo> getProDetailsPage(EncryptedReq<ProjectInfoVo> dto) {
|
||||
PageHelper.startPage(dto.getPageNum(),dto.getPageSize());
|
||||
List<PartApplyDetailAppVo> list = service.getProDetailsPage(dto.getData());;
|
||||
PageInfo<PartApplyDetailAppVo> pageInfo = new PageInfo<>(list);
|
||||
return pageInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询工程 领料单-文件 (proId)
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("getProDetailsFilePage")
|
||||
@DecryptAndVerify(decryptedClass = FileUploadVo.class)
|
||||
public PageInfo<FileUploadVo> getProDetailsFilePage(EncryptedReq<FileUploadVo> dto) {
|
||||
PageHelper.startPage(dto.getPageNum(),dto.getPageSize());
|
||||
List<FileUploadVo> list = service.getProDetailsFilePage(dto.getData());;
|
||||
PageInfo<FileUploadVo> pageInfo = new PageInfo<>(list);
|
||||
return pageInfo;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -79,5 +79,7 @@ public class PaTypeVo {
|
|||
*/
|
||||
private int bfNum;
|
||||
|
||||
private String isWarn;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,38 @@
|
|||
package com.bonus.gzgqj.business.bases.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 黑子
|
||||
*/
|
||||
@Data
|
||||
public class ProjectInfoVo {
|
||||
/**
|
||||
* 工程id
|
||||
*/
|
||||
private String proId;
|
||||
/**
|
||||
* 领用单数量
|
||||
*/
|
||||
private String lydNum;
|
||||
/**
|
||||
* 工程名称
|
||||
*/
|
||||
private String proName;
|
||||
|
||||
private String proStatus;
|
||||
/**
|
||||
* 维修单数量
|
||||
*/
|
||||
private int wxdNum;
|
||||
/**
|
||||
* 领用单数量
|
||||
*/
|
||||
private String lyNum;
|
||||
/**
|
||||
* 维修单数量
|
||||
*/
|
||||
private String lyMoney;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
package com.bonus.gzgqj.business.bases.mapper;
|
||||
|
||||
import com.bonus.gzgqj.business.app.entity.PartApplyAppVo;
|
||||
import com.bonus.gzgqj.business.app.entity.PartApplyDetailAppVo;
|
||||
import com.bonus.gzgqj.business.bases.entity.PaTypeVo;
|
||||
import com.bonus.gzgqj.business.bases.entity.ProjectInfoVo;
|
||||
import com.bonus.gzgqj.business.plan.entity.FileUploadVo;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 统计类数据层
|
||||
* @author 黑子
|
||||
*/
|
||||
@Repository
|
||||
public interface StatisticsMapper {
|
||||
|
||||
/**
|
||||
* 配件统计
|
||||
* @return
|
||||
*/
|
||||
List<String> getPaTypeStatistics();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
List<PaTypeVo> findByPage(PaTypeVo data);
|
||||
|
||||
/**
|
||||
* 工程统计数据接口
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
List<ProjectInfoVo> getProListPage(ProjectInfoVo data);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
List<PartApplyDetailAppVo> getProDetailsPage(ProjectInfoVo data);
|
||||
|
||||
/**
|
||||
* 查询工程领料单文件
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
List<FileUploadVo> getProDetailsFilePage(FileUploadVo data);
|
||||
|
||||
/**
|
||||
* 查询工程统计
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
ProjectInfoVo getProDetails(PartApplyAppVo data);
|
||||
}
|
||||
|
|
@ -0,0 +1,123 @@
|
|||
package com.bonus.gzgqj.business.bases.service;
|
||||
|
||||
import com.bonus.gzgqj.business.app.entity.PartApplyAppVo;
|
||||
import com.bonus.gzgqj.business.app.entity.PartApplyDetailAppVo;
|
||||
import com.bonus.gzgqj.business.bases.entity.PaTypeVo;
|
||||
import com.bonus.gzgqj.business.bases.entity.ProjectInfoVo;
|
||||
import com.bonus.gzgqj.business.bases.mapper.StatisticsMapper;
|
||||
import com.bonus.gzgqj.business.plan.entity.FileUploadVo;
|
||||
import com.bonus.gzgqj.manager.webResult.ServerResponse;
|
||||
import com.google.common.collect.Maps;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 统计业务接口处理层
|
||||
*
|
||||
* @author 黑子
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class StatisticsServiceImpl {
|
||||
|
||||
@Autowired
|
||||
private StatisticsMapper mapper;
|
||||
|
||||
/**
|
||||
* 统计一拆想你
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Map<String, String> getPaTypeStatistics() {
|
||||
Map<String, String> map = Maps.newHashMap();
|
||||
try {
|
||||
List<String> list = mapper.getPaTypeStatistics();
|
||||
map.put("type",list.get(0));
|
||||
map.put("kcNum",list.get(1));
|
||||
map.put("money",list.get(2));
|
||||
map.put("warn",list.get(3));
|
||||
} catch (Exception e) {
|
||||
map.put("type","0");
|
||||
map.put("kcNum","0");
|
||||
map.put("money","0");
|
||||
map.put("warn","0");
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
public List<PaTypeVo> findByPage(PaTypeVo data) {
|
||||
List<PaTypeVo> list=new ArrayList<>();
|
||||
try{
|
||||
list=mapper.findByPage(data);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 工程统计查询
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
public List<ProjectInfoVo> getProListPage(ProjectInfoVo data) {
|
||||
List<ProjectInfoVo> list=new ArrayList<>();
|
||||
try{
|
||||
list=mapper.getProListPage(data);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 已工程维度查询领用详情
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
public ServerResponse getProDetails(PartApplyAppVo data) {
|
||||
try{
|
||||
ProjectInfoVo vo=mapper.getProDetails(data);
|
||||
return ServerResponse.createSuccess(vo);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return ServerResponse.createSuccess(new ProjectInfoVo());
|
||||
}
|
||||
/**
|
||||
* 查询工程领料单详情
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
public List<PartApplyDetailAppVo> getProDetailsPage(ProjectInfoVo data) {
|
||||
List<PartApplyDetailAppVo> list=new ArrayList<>();
|
||||
try{
|
||||
list=mapper.getProDetailsPage(data);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询工程 领料附件
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
public List<FileUploadVo> getProDetailsFilePage(FileUploadVo data) {
|
||||
List<FileUploadVo> list=new ArrayList<>();
|
||||
try{
|
||||
list=mapper.getProDetailsFilePage(data);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
|
@ -52,5 +52,7 @@ public class FileUploadVo {
|
|||
*/
|
||||
private String type;
|
||||
|
||||
private String proId;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,115 @@
|
|||
<?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.bonus.gzgqj.business.bases.mapper.StatisticsMapper" >
|
||||
|
||||
<select id="getPaTypeStatistics" resultType="java.lang.String">
|
||||
select IFNULL( count(1),0) NUM
|
||||
FROM pa_type
|
||||
where pa_type.`level`=1 AND is_active=1
|
||||
UNION ALL
|
||||
select IFNULL( count(1),0)
|
||||
FROM pa_type
|
||||
where pa_type.`level`=3 AND is_active=1
|
||||
UNION ALL
|
||||
select IFNULL(SUM(price*num),0)
|
||||
FROM pa_type
|
||||
where pa_type.`level`=3 AND is_active=1
|
||||
UNION ALL
|
||||
select IFNULL( count(1),0)
|
||||
FROM pa_type
|
||||
where pa_type.`level`=3 AND is_active=1 and (num=0 or num is null)
|
||||
</select>
|
||||
<select id="findByPage" resultType="com.bonus.gzgqj.business.bases.entity.PaTypeVo">
|
||||
select pt.id, pt.parent_id parentId,pt.name model ,pt.num,
|
||||
pt.price,pt.unit ,pt.weight,pt.is_consumables ,
|
||||
pt.remarks,pt.is_active ,pt.level,pt.warn_num,pt1.`name` name ,pt2.name type
|
||||
FROM pa_type pt
|
||||
left join pa_type pt1 on pt.parent_id=pt1.id and pt1.`level`=2 and pt1.is_active=1
|
||||
left join pa_type pt2 on pt1.parent_id=pt2.id and pt2.`level`=1 and pt2.is_active=1
|
||||
WHERE pt.is_active=1 and pt.`level`=3
|
||||
<if test="type!=null and type !=''">
|
||||
and pt2.name like concat('%',#{type},'%')
|
||||
</if>
|
||||
<if test="name!=null and name !=''">
|
||||
and pt1.name like concat('%',#{name},'%')
|
||||
</if>
|
||||
<if test="model!=null and model !=''">
|
||||
and pt.name like concat('%',#{model},'%')
|
||||
</if>
|
||||
<if test='isWarn=="1"'>
|
||||
and pt.num=0
|
||||
</if>
|
||||
<if test='isWarn=="2"'>
|
||||
and pt.num>0
|
||||
</if>
|
||||
</select>
|
||||
<!--工程统计领料单查询-->
|
||||
<select id="getProListPage" resultType="com.bonus.gzgqj.business.bases.entity.ProjectInfoVo">
|
||||
SELECT pro.id proId,pro.name proName,tpa.lyNum lyNum,tpa.lydNum,mm.money lyMoney
|
||||
FROM bm_project pro
|
||||
left join(
|
||||
select count(1) lydNum ,sum(IFNULL(apply_num,0)) lyNum ,pro_id
|
||||
from t_part_apply
|
||||
where pro_id is not null and status=4
|
||||
GROUP BY pro_id
|
||||
)tpa on tpa.pro_id=pro.id
|
||||
LEFT JOIN (
|
||||
select sum(pad.apply_num*pt.price) money, tpa.pro_id
|
||||
from t_part_apply tpa
|
||||
LEFT JOIN t_part_apply_details pad on pad.apply_id=tpa.id
|
||||
left join pa_type pt on pad.part_id=pt.id
|
||||
where tpa.pro_id is not null and tpa.status=4
|
||||
GROUP BY pro_id ) mm on mm.pro_id=pro.id
|
||||
<where >
|
||||
<if test="proName!=null and proName!=''">
|
||||
and pro.name like concat('%',#{proName},'%')
|
||||
</if>
|
||||
</where>
|
||||
|
||||
</select>
|
||||
<!--以工程为维度查询领料单详情-->
|
||||
<select id="getProDetailsPage" resultType="com.bonus.gzgqj.business.app.entity.PartApplyDetailAppVo">
|
||||
select pad.part_id partId,pad.part_type partType,pad.part_name partName,pad.part_model partModel,pad.part_unit partUnit,
|
||||
sum(pad.apply_num) applyNum,pt.price,sum(pad.apply_num*pt.price) money
|
||||
from t_part_apply tpa
|
||||
LEFT JOIN t_part_apply_details pad on pad.apply_id=tpa.id
|
||||
left join pa_type pt on pad.part_id=pt.id
|
||||
where tpa.`status`=4 and tpa.pro_id=#{proId}
|
||||
<if test="partType!=null and partType !=''">
|
||||
and tpa.part_type like concat('%',#{partType},'%')
|
||||
</if>
|
||||
<if test="partName!=null and partName !=''">
|
||||
and tpa.part_name like concat('%',#{partName},'%')
|
||||
</if>
|
||||
<if test="partModel!=null and partModel !=''">
|
||||
and tpa.part_model like concat('%',#{partModel},'%')
|
||||
</if>
|
||||
GROUP BY pad.part_id
|
||||
</select>
|
||||
<select id="getProDetailsFilePage" resultType="com.bonus.gzgqj.business.plan.entity.FileUploadVo">
|
||||
select file.id, file.file_name fileName,
|
||||
file.file_url fileUrl, file.create_time createTime,file.creator creator, file.model_table,
|
||||
file.own_id ownId , file.suffix,file.type, file.file_type fileType,file.create_name createName
|
||||
FROM t_part_apply tpa
|
||||
left join bm_file_upload file on tpa.id=file.own_id and file.model_table='t_part_apply'
|
||||
where tpa.`status`=4 and file.id is not null amd tpa.pro_id=#{proId}
|
||||
</select>
|
||||
<select id="getProDetails" resultType="com.bonus.gzgqj.business.bases.entity.ProjectInfoVo">
|
||||
SELECT pro.id proId,pro.name proName,tpa.lyNum lyNum,tpa.lydNum,mm.money lyMoney
|
||||
FROM bm_project pro
|
||||
left join(
|
||||
select count(1) lydNum ,sum(IFNULL(apply_num,0)) lyNum ,pro_id
|
||||
from t_part_apply
|
||||
where pro_id is not null and status=4
|
||||
GROUP BY pro_id
|
||||
)tpa on tpa.pro_id=pro.id
|
||||
LEFT JOIN (
|
||||
select sum(pad.apply_num*pt.price) money, tpa.pro_id
|
||||
from t_part_apply tpa
|
||||
LEFT JOIN t_part_apply_details pad on pad.apply_id=tpa.id
|
||||
left join pa_type pt on pad.part_id=pt.id
|
||||
where tpa.pro_id is not null and tpa.status=4
|
||||
GROUP BY pro_id ) mm on mm.pro_id=pro.id
|
||||
where pro.id=#{proId}
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue