Commit d832aad3 authored by 竹天卫's avatar 竹天卫

统计的导出功能

parent 0e362a24
......@@ -74,12 +74,14 @@ public class DataStatisticsController {
@ApiImplicitParams(value = {
@ApiImplicitParam(name = "cycle", value = "统计周期1:本周 2:本月 3:本年", paramType = "query", dataType = "Integer"),
@ApiImplicitParam(name = "startDate", value = "开始日期", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "endDate", value = "结束日期", paramType = "query", dataType = "String")
@ApiImplicitParam(name = "endDate", value = "结束日期", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "clientId", value = "委托单位Id", paramType = "query", dataType = "Integer"),
@ApiImplicitParam(name = "clientName", value = "委托单位名称", paramType = "query", dataType = "String")
})
@GetMapping("/countEntrustStatus")
public BaseResponse countEntrustStatus(Integer cycle, String startDate, String endDate) {
public BaseResponse countEntrustStatus(Integer cycle, String startDate, String endDate, Integer clientId, String clientName) {
try {
return dataStatisticsService.countEntrustStatus(cycle, startDate, endDate);
return dataStatisticsService.countEntrustStatus(cycle, startDate, endDate, clientId, clientName);
} catch (Exception e) {
log.debug("统计概览-委托单进展统计{}", e);
}
......@@ -92,19 +94,30 @@ public class DataStatisticsController {
@ApiImplicitParam(name = "cycle", value = "统计周期1:本周 2:本月 3:本年", paramType = "query", dataType = "Integer"),
@ApiImplicitParam(name = "startDate", value = "开始日期", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "endDate", value = "结束日期", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "clientId", value = "委托单位Id", paramType = "query", dataType = "Integer"),
@ApiImplicitParam(name = "clientName", value = "委托单位名称", paramType = "query", dataType = "String")
})
@GetMapping("/countEntrustPage")
public BaseResponse countEntrustPage(PageQuery pageQuery, Integer cycle, String startDate, String endDate, String clientName) {
public BaseResponse countEntrustPage(PageQuery pageQuery, Integer cycle, String startDate, String endDate, Integer clientId, String clientName) {
try {
return dataStatisticsService.countEntrustPage(pageQuery, cycle, startDate, endDate, clientName);
return dataStatisticsService.countEntrustPage(pageQuery, cycle, startDate, endDate, clientId, clientName);
} catch (Exception e) {
log.debug("委托单进展统计-列表{}", e);
}
return BaseResponse.errorMsg("失败!");
}
//todo 委托单进展统计-列表导出
@ApiOperation("列表导出-委托单进展统计")
@PostMapping("/exportEntrustList")
public void exportEntrustList(Integer cycle, String startDate,
String endDate, Integer clientId, String clientName, String fileName, HttpServletResponse response) {
try {
dataStatisticsService.exportEntrustList(cycle, startDate, endDate, clientId, clientName, fileName, response);
} catch (Exception e) {
log.debug("列表导出-委托单进展统计{}", e);
}
}
@ApiOperation(value = "统计概览-进行中任务数量统计")
@GetMapping("/countTaskIng")
......@@ -153,8 +166,16 @@ public class DataStatisticsController {
return BaseResponse.errorMsg("失败!");
}
//todo 检测项"检测项统计-列表导出
@ApiOperation("列表导出-检测项统计")
@PostMapping("/exportTeamList")
public void exportTeamList(Integer cycle, String startDate, String endDate, String fileName, HttpServletResponse response) {
try {
dataStatisticsService.exportTeamList(cycle, startDate, endDate, fileName, response);
} catch (Exception e) {
log.debug("检测项统计-列表导出{}", e);
}
}
@ApiOperation(value = "各委托单位项目数量统计")
......
......@@ -601,6 +601,18 @@ public class EntrustController {
return BaseResponse.errorMsg("失败!");
}
@ApiOperation(value = "检测结果查看附件(只显示公开的附件)")
@GetMapping("/getClientEnclosureList")
public BaseResponse getClientEnclosureList(Integer sampleDistributionId) {
try {
return entrustService.getClientEnclosureList(sampleDistributionId);
} catch (Exception e) {
log.debug("检测结果查看附件(只显示公开的附件){}", e);
}
return BaseResponse.errorMsg("失败!");
}
@ApiOperation(value = "样品检测/校核上传附件")
@PostMapping("/uploadEnclosurePF")
public BaseResponse uploadEnclosurePF(SampleHandleEnclosureQuery query) {
......
......@@ -34,6 +34,7 @@ public class SampleDistributionEnclosure implements Serializable {
*/
private Integer sampleDistributionId;
/**
* 处理项表id
*/
......
......@@ -30,12 +30,16 @@ public interface DataStatisticsMapper {
List<DataStatisticsVo> countTeamByOrigin(@Param("params") Map<String, Object> params);
Integer countEntrustSumNum(@Param("params") Map<String, Object> params);
List<DataStatisticsVo> countEntrustStatus(@Param("params") Map<String, Object> params);
List<DataStatisticsVo> countEntrustType(@Param("params") Map<String, Object> params);
IPage<EntrustVo> countEntrustPage(@Param("page") Page page, @Param("params") Map<String, Object> params);
List<Map<String, Object>> exportEntrustList(@Param("params") Map<String, Object> params);
IPage<DataStatisticsVo> countHandlePage(@Param("page") Page page);
Integer countHandleWeek(@Param("userId") Integer userId, @Param("weekType") Integer weekType);
......@@ -50,9 +54,7 @@ public interface DataStatisticsMapper {
IPage<DataStatisticsTeamVo> countTeamPage(@Param("page") Page page, @Param("params") Map<String, Object> params);
List<Map<String, Object>> exportTeamList(@Param("params") Map<String, Object> params);
Integer countEntrustNum(@Param("teamId") Integer teamId);
......
......@@ -50,4 +50,6 @@ public interface EntrustMapper extends BaseMapper<Entrust> {
IPage<SampleReturnHandleVo> getSampleReturnDistributioPage(@Param("page") Page page, @Param("params") Map<String, Object> params);
IPage<EntrustVo> getSampleReturnCheckPage(@Param("page") Page page, @Param("params") Map<String, Object> params);
}
......@@ -21,10 +21,9 @@
<if test="params.endDate != null and params.endDate != ''">
and DATE(sd.create_time) &lt;= #{params.endDate}
</if>
<if test="params.endDate = null and params.endDate = null">
<if test="params.startDate == null and params.endDate == null">
and date(sd.create_time) > date_sub(curdate(),interval 30 day)
</if>
group by name
</select>
......@@ -52,6 +51,26 @@
group by s.origin
</select>
<select id="countEntrustSumNum" resultType="integer">
SELECT count(*)
FROM entrust e
left join client c on c.id = e.client_id
where e.status != 0 and e.project_type is not null
<if test="params.startDate != null and params.startDate != ''">
and DATE(e.create_time) &gt;= #{params.startDate}
</if>
<if test="params.endDate != null and params.endDate != ''">
and DATE(e.create_time) &lt;= #{params.endDate}
</if>
<if test="params.clientId != null">
and e.clientId = #{clientId}
</if>
<if test="params.clientName != null and params.clientName != ''">
and c.name like concat('%', #{params.clientName}, '%')
</if>
</select>
<select id="countEntrustStatus" resultType="cn.wise.sc.cement.business.model.vo.DataStatisticsVo">
SELECT (
......@@ -71,6 +90,7 @@
) as name,
count(*) as value
FROM entrust e
left join client c on c.id = e.client_id
where e.status != 0 and e.project_type is not null
<if test="params.cycle == 1 ">
and YEARWEEK(date_format(e.create_time,'%Y-%m-%d' ) ) = YEARWEEK(now())
......@@ -86,6 +106,12 @@
</if>
<if test="params.endDate != null and params.endDate != ''">
and DATE(e.create_time) &lt;= #{params.endDate}
</if>
<if test="params.clientId != null">
and e.clientId = #{clientId}
</if>
<if test="params.clientName != null and params.clientName != ''">
and c.name like concat('%', #{params.clientName}, '%')
</if>
group by e.status
</select>
......@@ -93,6 +119,7 @@
<select id="countEntrustType" resultType="cn.wise.sc.cement.business.model.vo.DataStatisticsVo">
select e.project_type as name, count(*) as value
from entrust e
left join client c on c.id = e.client_id
where e.status != 0 and e.project_type is not null
<if test="params.cycle == 1 ">
and YEARWEEK(date_format(e.create_time,'%Y-%m-%d' ) ) = YEARWEEK(now())
......@@ -109,6 +136,12 @@
<if test="params.endDate != null and params.endDate != ''">
and DATE(e.create_time) &lt;= #{params.endDate}
</if>
<if test="params.clientId != null">
and e.clientId = #{clientId}
</if>
<if test="params.clientName != null and params.clientName != ''">
and c.name like concat('%', #{params.clientName}, '%')
</if>
group by e.project_type
</select>
......@@ -125,6 +158,7 @@
WHEN 6 THEN '样品检测完成'
WHEN 7 THEN '校核中'
WHEN 8 THEN '校核完成'
WHEN 9 THEN '修改待确认'
ELSE ''
END
) as statusValue
......@@ -133,6 +167,9 @@
left join client c on c.id = e.client_id
left join sys_user su on su.id = e.user_id
where e.status != 0 and e.project_type is not null
<if test="params.clientId != null">
and e.clientId = #{clientId}
</if>
<if test="params.clientName != null and params.clientName != ''">
and c.name like concat('%', #{params.clientName}, '%')
</if>
......@@ -145,6 +182,54 @@
order by create_time desc
</select>
<select id="exportEntrustList" resultType="java.util.HashMap">
SELECT
(@i:=@i+1) as 序号,
e.id as entrustId,
IF(ISNULL(e.entrust_code),'',e.entrust_code) as 委托单号,
IF(ISNULL(p.name),'',p.name) as 项目名称,
IF(ISNULL(p.name),'',p.name) as 项目编号,
e.project_type as 项目类型,
IF(ISNULL(su.name),'',su.name) as 委托人,
IF(ISNULL(c.name),'',c.name) as 委托单位,
IF(ISNULL(e.entrust_date),'',e.entrust_date) as 委托日期,
IF(ISNULL(e.sample_num),'',e.sample_num) as 样品数量,
(
CASE e.status
WHEN 0 THEN '未评审'
WHEN 1 THEN '已通过'
WHEN 2 THEN '未通过'
WHEN 3 THEN '样品处理中'
WHEN 4 THEN '样品处理完成'
WHEN 5 THEN '样品检测中'
WHEN 6 THEN '样品检测完成'
WHEN 7 THEN '校核中'
WHEN 8 THEN '校核完成'
WHEN 9 THEN '修改待确认'
ELSE ''
END
) as 状态
from entrust e
left join project p on p.id = e.project_id
left join client c on c.id = e.client_id
left join sys_user su on su.id = e.user_id
,(select @i:=0)aa
where e.status != 0 and e.project_type is not null
<if test="params.clientId != null">
and e.clientId = #{clientId}
</if>
<if test="params.clientName != null and params.clientName != ''">
and c.name like concat('%', #{params.clientName}, '%')
</if>
<if test="params.startDate != null and params.startDate != ''">
and DATE(e.create_time) &gt;= #{params.startDate}
</if>
<if test="params.endDate != null and params.endDate != ''">
and DATE(e.create_time) &lt;= #{params.endDate}
</if>
order by 序号
</select>
<select id="countHandlePage" resultType="cn.wise.sc.cement.business.model.vo.DataStatisticsVo">
SELECT su.id as id, su.name as name, count(*) as value FROM sample_handle sh
......@@ -249,6 +334,31 @@
group by sd.team_id
</select>
<select id="exportTeamList" resultType="java.util.HashMap">
SELECT (@i:=@i+1) as 序号,t.id as id, t.name as 检测项目, count(*) as 检测项数量
FROM sample_distribution sd
left join team t on t.id = sd.team_id
,(select @i:=0)t
where 1=1
<if test="params.cycle == 1 ">
and YEARWEEK(date_format(sd.create_time,'%Y-%m-%d' ) ) = YEARWEEK(now())
</if>
<if test="params.cycle == 2 ">
and DATE_FORMAT( sd.create_time, '%Y%m' ) = DATE_FORMAT( CURDATE( ) ,'%Y%m')
</if>
<if test="params.cycle == 3 ">
and YEAR(sd.create_time) = YEAR( NOW( ) )
</if>
<if test="params.startDate != null and params.startDate != ''">
and DATE(sd.create_time) &gt;= #{params.startDate}
</if>
<if test="params.endDate != null and params.endDate != ''">
and DATE(sd.create_time) &lt;= #{params.endDate}
</if>
group by sd.team_id
order by 序号
</select>
<select id="countEntrustNum" resultType="integer">
select count(*) as entrustNum from (
SELECT sd.entrust_id as id, count(*) as entrustNum FROM sample_distribution sd
......
......@@ -72,7 +72,7 @@
SELECT
(@i:=@i+1) as 序号,
e.id as entrustId,
IF(ISNULL(e.entrust_code),'',e.entrust_code) as 委托号,
IF(ISNULL(e.entrust_code),'',e.entrust_code) as 委托号,
(
CASE e.is_urgent
WHEN 0 THEN '不加急'
......
......@@ -19,9 +19,13 @@
<if test="params.userId != null">
and t.user_id = #{params.userId}
</if>
<if test="params.isPublic != null">
and t.is_public = #{params.isPublic}
</if>
order by t.id ASC
</select>
</mapper>
......@@ -32,9 +32,12 @@ public interface IDataStatisticsService {
BaseResponse<List<DataStatisticsVo>> countTeamByOrigin(Integer cycle, String startDate, String endDate);
BaseResponse<Map<String, Object>> countEntrustStatus(Integer cycle, String startDate, String endDate);
BaseResponse<Map<String, Object>> countEntrustStatus(Integer cycle, String startDate, String endDate, Integer clientId, String clientName);
BaseResponse<IPage<EntrustVo>> countEntrustPage(PageQuery pageQuery, Integer cycle, String startDate, String endDate, String clientName);
BaseResponse<IPage<EntrustVo>> countEntrustPage(PageQuery pageQuery, Integer cycle, String startDate, String endDate, Integer clientId, String clientName);
void exportEntrustList(Integer cycle, String startDate,
String endDate, Integer clientId, String clientName, String fileName, HttpServletResponse response);
BaseResponse<Map<String, Object>> countTaskIng(PageQuery pageQuery);
......@@ -44,6 +47,8 @@ public interface IDataStatisticsService {
BaseResponse<IPage<DataStatisticsTeamVo>> countTeamList(PageQuery pageQuery, Integer cycle, String startDate, String endDate);
void exportTeamList(Integer cycle, String startDate, String endDate, String fileName, HttpServletResponse response);
BaseResponse<List<DataStatisticsVo>> countByClient();
/**
......
......@@ -110,6 +110,8 @@ public interface IEntrustService extends IService<Entrust> {
BaseResponse<List<SampleDistributionEnclosureVo>> getSampleDistributionEnclosureList(Integer sampleDistributionId);
BaseResponse<List<SampleDistributionEnclosureVo>> getClientEnclosureList(Integer sampleDistributionId);
BaseResponse<SampleDistributionEnclosure> uploadEnclosurePF(SampleHandleEnclosureQuery query);
BaseResponse<String> deleteEnclosure(Integer id,Integer type);
......
......@@ -1107,7 +1107,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
List<SampleDistributionTeamVo> sdtvList = sampleTeamGroupVo2.getSampleDistributionTeamVoList();
sdtvList.add(sampleDistributionTeamVo);
sampleTeamGroupVo2.setSampleDistributionTeamVoList(sdtvList);
sampleTeamGroupVoListed.add(sampleTeamGroupVo2);
// sampleTeamGroupVoListed.add(sampleTeamGroupVo2);
}
}
sampleVo.setSampleTeamGroupVoList(sampleTeamGroupVoListed);
......@@ -3655,6 +3655,59 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
return BaseResponse.okData(list);
}
/**
* 检测结果查看附件 (平行样的样品附件 也都展示在一个检测项下面里面)
* @param sampleDistributionId
* @return
*/
@Override
public BaseResponse<List<SampleDistributionEnclosureVo>> getClientEnclosureList(Integer sampleDistributionId) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
}
if(sampleDistributionId == null){
return BaseResponse.errorMsg("参数错误");
}
Map<String, Object> params = new HashMap<>();
params.put("sampleDistributionId", sampleDistributionId);
params.put("isPublic", 1);
List<SampleDistributionEnclosureVo> list = sampleDistributionEnclosureMapper.getList(params);
//如果有平行样
SampleDistribution sampleDistribution = distributionMapper.selectById(sampleDistributionId);
Sample sample = sampleMapper.selectById(sampleDistribution.getSampleId());
List<Sample> otherSampleList = sampleMapper.getOtherSampleList(sampleDistribution.getEntrustId(), sample.getCementCode(),sample.getId());
if(otherSampleList != null && otherSampleList.size()>0){
for(Sample s : otherSampleList){
QueryWrapper<SampleDistribution> sdWrapper = new QueryWrapper<>();
sdWrapper.eq("entrust_id",sampleDistribution.getEntrustId());
sdWrapper.eq("sample_id",s.getId());
sdWrapper.eq("team_group_id",sampleDistribution.getTeamGroupId());
sdWrapper.eq("team_id",sampleDistribution.getTeamId());
List<SampleDistribution> sdList = distributionMapper.selectList(sdWrapper);
if(sdList != null && sdList.size()>0 ){
for(SampleDistribution sd : sdList){
Map<String, Object> params2 = new HashMap<>();
params2.put("sampleDistributionId", sd.getId());
params.put("isPublic", 1);
List<SampleDistributionEnclosureVo> sdevList = sampleDistributionEnclosureMapper.getList(params2);
if(sdevList != null && sdevList.size()>0){
for(SampleDistributionEnclosureVo sdev : sdevList){
list.add(sdev);
}
}
}
}
}
}
return BaseResponse.okData(list);
}
/**
* 样品处理上传附件
*
......
......@@ -5,21 +5,10 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import cn.wise.sc.cement.business.entity.Entrust;
import cn.wise.sc.cement.business.entity.Handle;
import cn.wise.sc.cement.business.entity.NonStandardApply;
import cn.wise.sc.cement.business.entity.NonStandardValue;
import cn.wise.sc.cement.business.entity.NormProduction;
import cn.wise.sc.cement.business.entity.NormProductionStatistics;
import cn.wise.sc.cement.business.entity.Preciprice;
import cn.wise.sc.cement.business.entity.Sample;
import cn.wise.sc.cement.business.entity.SampleDistribution;
import cn.wise.sc.cement.business.entity.SysGroup;
import cn.wise.sc.cement.business.entity.SysPost;
import cn.wise.sc.cement.business.entity.SysUser;
import cn.wise.sc.cement.business.entity.TeamGroup;
import cn.wise.sc.cement.business.entity.*;
import cn.wise.sc.cement.business.mapper.EntrustMapper;
import cn.wise.sc.cement.business.mapper.PrecipriceMapper;
import cn.wise.sc.cement.business.mapper.ProjectMapper;
import cn.wise.sc.cement.business.mapper.SampleMapper;
import cn.wise.sc.cement.business.model.BaseResponse;
import cn.wise.sc.cement.business.model.LoginUser;
......@@ -104,6 +93,10 @@ public class PrecipriceServiceImpl extends ServiceImpl<PrecipriceMapper, Precipr
PrecipriceMapper precipriceMapper;
@Resource
private SampleMapper sampleMapper;
@Resource
private EntrustMapper entrustMapper;
@Resource
private ProjectMapper projectMapper;
public PrecipriceServiceImpl(EntrustMapper iEntrustService,
......@@ -621,6 +614,16 @@ public class PrecipriceServiceImpl extends ServiceImpl<PrecipriceMapper, Precipr
rts.setCementCode(sample.getCementCode());
}
}
//增加项目信息
if(preciprice.getEntrustId() != null){
Entrust entrust = entrustMapper.selectById(preciprice.getEntrustId());
if(entrust != null && entrust.getProjectId() != null){
Project project = projectMapper.selectById(entrust.getProjectId());
if(project != null && project.getName() != null){
rts.setProjectName(project.getName());
}
}
}
rts.setAssessId(preciprice.getTargetId());
rts.setWorkTimeCoefficient(preciprice.getPreciprice());
rts.setCheckTime(getDateTimeOfTimestamp(preciprice.getCreateTime()));
......
......@@ -21,10 +21,9 @@
<if test="params.endDate != null and params.endDate != ''">
and DATE(sd.create_time) &lt;= #{params.endDate}
</if>
<if test="params.endDate = null and params.endDate = null">
<if test="params.startDate == null and params.endDate == null">
and date(sd.create_time) > date_sub(curdate(),interval 30 day)
</if>
group by name
</select>
......@@ -52,6 +51,26 @@
group by s.origin
</select>
<select id="countEntrustSumNum" resultType="integer">
SELECT count(*)
FROM entrust e
left join client c on c.id = e.client_id
where e.status != 0 and e.project_type is not null
<if test="params.startDate != null and params.startDate != ''">
and DATE(e.create_time) &gt;= #{params.startDate}
</if>
<if test="params.endDate != null and params.endDate != ''">
and DATE(e.create_time) &lt;= #{params.endDate}
</if>
<if test="params.clientId != null">
and e.clientId = #{clientId}
</if>
<if test="params.clientName != null and params.clientName != ''">
and c.name like concat('%', #{params.clientName}, '%')
</if>
</select>
<select id="countEntrustStatus" resultType="cn.wise.sc.cement.business.model.vo.DataStatisticsVo">
SELECT (
......@@ -71,6 +90,7 @@
) as name,
count(*) as value
FROM entrust e
left join client c on c.id = e.client_id
where e.status != 0 and e.project_type is not null
<if test="params.cycle == 1 ">
and YEARWEEK(date_format(e.create_time,'%Y-%m-%d' ) ) = YEARWEEK(now())
......@@ -86,6 +106,12 @@
</if>
<if test="params.endDate != null and params.endDate != ''">
and DATE(e.create_time) &lt;= #{params.endDate}
</if>
<if test="params.clientId != null">
and e.clientId = #{clientId}
</if>
<if test="params.clientName != null and params.clientName != ''">
and c.name like concat('%', #{params.clientName}, '%')
</if>
group by e.status
</select>
......@@ -93,6 +119,7 @@
<select id="countEntrustType" resultType="cn.wise.sc.cement.business.model.vo.DataStatisticsVo">
select e.project_type as name, count(*) as value
from entrust e
left join client c on c.id = e.client_id
where e.status != 0 and e.project_type is not null
<if test="params.cycle == 1 ">
and YEARWEEK(date_format(e.create_time,'%Y-%m-%d' ) ) = YEARWEEK(now())
......@@ -109,6 +136,12 @@
<if test="params.endDate != null and params.endDate != ''">
and DATE(e.create_time) &lt;= #{params.endDate}
</if>
<if test="params.clientId != null">
and e.clientId = #{clientId}
</if>
<if test="params.clientName != null and params.clientName != ''">
and c.name like concat('%', #{params.clientName}, '%')
</if>
group by e.project_type
</select>
......@@ -125,6 +158,7 @@
WHEN 6 THEN '样品检测完成'
WHEN 7 THEN '校核中'
WHEN 8 THEN '校核完成'
WHEN 9 THEN '修改待确认'
ELSE ''
END
) as statusValue
......@@ -133,6 +167,9 @@
left join client c on c.id = e.client_id
left join sys_user su on su.id = e.user_id
where e.status != 0 and e.project_type is not null
<if test="params.clientId != null">
and e.clientId = #{clientId}
</if>
<if test="params.clientName != null and params.clientName != ''">
and c.name like concat('%', #{params.clientName}, '%')
</if>
......@@ -145,6 +182,54 @@
order by create_time desc
</select>
<select id="exportEntrustList" resultType="java.util.HashMap">
SELECT
(@i:=@i+1) as 序号,
e.id as entrustId,
IF(ISNULL(e.entrust_code),'',e.entrust_code) as 委托单号,
IF(ISNULL(p.name),'',p.name) as 项目名称,
IF(ISNULL(p.name),'',p.name) as 项目编号,
e.project_type as 项目类型,
IF(ISNULL(su.name),'',su.name) as 委托人,
IF(ISNULL(c.name),'',c.name) as 委托单位,
IF(ISNULL(e.entrust_date),'',e.entrust_date) as 委托日期,
IF(ISNULL(e.sample_num),'',e.sample_num) as 样品数量,
(
CASE e.status
WHEN 0 THEN '未评审'
WHEN 1 THEN '已通过'
WHEN 2 THEN '未通过'
WHEN 3 THEN '样品处理中'
WHEN 4 THEN '样品处理完成'
WHEN 5 THEN '样品检测中'
WHEN 6 THEN '样品检测完成'
WHEN 7 THEN '校核中'
WHEN 8 THEN '校核完成'
WHEN 9 THEN '修改待确认'
ELSE ''
END
) as 状态
from entrust e
left join project p on p.id = e.project_id
left join client c on c.id = e.client_id
left join sys_user su on su.id = e.user_id
,(select @i:=0)aa
where e.status != 0 and e.project_type is not null
<if test="params.clientId != null">
and e.clientId = #{clientId}
</if>
<if test="params.clientName != null and params.clientName != ''">
and c.name like concat('%', #{params.clientName}, '%')
</if>
<if test="params.startDate != null and params.startDate != ''">
and DATE(e.create_time) &gt;= #{params.startDate}
</if>
<if test="params.endDate != null and params.endDate != ''">
and DATE(e.create_time) &lt;= #{params.endDate}
</if>
order by 序号
</select>
<select id="countHandlePage" resultType="cn.wise.sc.cement.business.model.vo.DataStatisticsVo">
SELECT su.id as id, su.name as name, count(*) as value FROM sample_handle sh
......@@ -249,6 +334,31 @@
group by sd.team_id
</select>
<select id="exportTeamList" resultType="java.util.HashMap">
SELECT (@i:=@i+1) as 序号,t.id as id, t.name as 检测项目, count(*) as 检测项数量
FROM sample_distribution sd
left join team t on t.id = sd.team_id
,(select @i:=0)t
where 1=1
<if test="params.cycle == 1 ">
and YEARWEEK(date_format(sd.create_time,'%Y-%m-%d' ) ) = YEARWEEK(now())
</if>
<if test="params.cycle == 2 ">
and DATE_FORMAT( sd.create_time, '%Y%m' ) = DATE_FORMAT( CURDATE( ) ,'%Y%m')
</if>
<if test="params.cycle == 3 ">
and YEAR(sd.create_time) = YEAR( NOW( ) )
</if>
<if test="params.startDate != null and params.startDate != ''">
and DATE(sd.create_time) &gt;= #{params.startDate}
</if>
<if test="params.endDate != null and params.endDate != ''">
and DATE(sd.create_time) &lt;= #{params.endDate}
</if>
group by sd.team_id
order by 序号
</select>
<select id="countEntrustNum" resultType="integer">
select count(*) as entrustNum from (
SELECT sd.entrust_id as id, count(*) as entrustNum FROM sample_distribution sd
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment