Commit 9336156b authored by qinhu's avatar qinhu

标准产值--联调

parent 34f88986
package cn.wise.sc.cement.business.controller; package cn.wise.sc.cement.business.controller;
import cn.wise.sc.cement.business.entity.Project;
import cn.wise.sc.cement.business.model.BaseResponse; import cn.wise.sc.cement.business.model.BaseResponse;
import cn.wise.sc.cement.business.model.PageQuery; import cn.wise.sc.cement.business.model.PageQuery;
import cn.wise.sc.cement.business.model.query.*; import cn.wise.sc.cement.business.model.query.*;
import cn.wise.sc.cement.business.model.vo.EntrustVo;
import cn.wise.sc.cement.business.service.IEntrustService; import cn.wise.sc.cement.business.service.IEntrustService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.models.auth.In;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
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 java.util.List;
import java.util.Map; import java.util.Map;
/** /**
......
package cn.wise.sc.cement.business.controller; package cn.wise.sc.cement.business.controller;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import cn.wise.sc.cement.business.entity.NormProduction; import cn.wise.sc.cement.business.entity.NormProduction;
import cn.wise.sc.cement.business.entity.NormProductionStatistics;
import cn.wise.sc.cement.business.model.BaseResponse; import cn.wise.sc.cement.business.model.BaseResponse;
import cn.wise.sc.cement.business.model.PageQuery; import cn.wise.sc.cement.business.model.PageQuery;
import cn.wise.sc.cement.business.model.vo.NormProductionVo;
import cn.wise.sc.cement.business.service.INormProductionService; import cn.wise.sc.cement.business.service.INormProductionService;
import cn.wise.sc.cement.business.util.PageUtil;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
...@@ -14,6 +24,7 @@ import org.springframework.web.bind.annotation.PutMapping; ...@@ -14,6 +24,7 @@ import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;
/** /**
...@@ -44,7 +55,7 @@ public class NormProductionController { ...@@ -44,7 +55,7 @@ public class NormProductionController {
@GetMapping("/page") @GetMapping("/page")
@ApiOperation("分页查询") @ApiOperation("分页查询")
public BaseResponse<IPage<NormProduction>> page(PageQuery pageQuery) { public BaseResponse<IPage<NormProductionVo>> page(PageQuery pageQuery) {
return iNormProductionService.getPage(pageQuery); return iNormProductionService.getPage(pageQuery);
} }
...@@ -57,11 +68,11 @@ public class NormProductionController { ...@@ -57,11 +68,11 @@ public class NormProductionController {
@GetMapping("/{id}") @GetMapping("/{id}")
@ApiOperation("根据id获取标准产值配置") @ApiOperation("根据id获取标准产值配置")
public BaseResponse<NormProduction> getById(@PathVariable("id") Integer id) { public BaseResponse<NormProduction> getById(@PathVariable("id") Integer id) {
if (id == null || id <= 0) { if (id == null || id <= 0) {
return BaseResponse.errorMsg("id不能为空!"); return BaseResponse.errorMsg("id不能为空!");
} }
NormProduction rts = iNormProductionService.getById(id); NormProduction rts = iNormProductionService.getById(id);
if (rts != null) { if (rts != null) {
return BaseResponse.okData(rts); return BaseResponse.okData(rts);
} else { } else {
...@@ -79,18 +90,47 @@ public class NormProductionController { ...@@ -79,18 +90,47 @@ public class NormProductionController {
return iNormProductionService.activeOrForbidden(id); return iNormProductionService.activeOrForbidden(id);
} }
@GetMapping("/statistics") @GetMapping("/statistics")
@ApiOperation("标准产值统计") @ApiOperation("标准产值统计")
public BaseResponse normProductionStatistics(Long start, Long end) { public BaseResponse normProductionStatistics(String start, String end, String name, PageQuery pageQuery) {
return iNormProductionService.normProductionStatistics(start, end);
Long startTime = null;
Long endTime = null;
if (StrUtil.isNotBlank(start) && StrUtil.isNotBlank(end)) {
startTime = DateUtil.parseDate(start).getTime();
endTime = DateUtil.parseDate(end).getTime();
}
//将list拆分成分页
BaseResponse<List<NormProductionStatistics>> baseResponse = iNormProductionService
.normProductionStatistics(startTime, endTime, name);
if (baseResponse.getCode() == 200) {
List<NormProductionStatistics> data = baseResponse.getData();
if (data.size() != 0) {
Page<NormProductionStatistics> rts = PageUtil.listConvertToPage(data, pageQuery);
return BaseResponse.okData(rts);
}
}
return baseResponse;
} }
@GetMapping("/statistics/detail") @GetMapping("/statistics/detail")
public BaseResponse<List<NormProduction.NormProductionDetail>> normProductionDetails(Integer userId, Long start, Long end) { @ApiOperation("标准产值详情")
List<NormProduction.NormProductionDetail> rts = iNormProductionService.normProductionDetails(userId, start, end); public BaseResponse normProductionDetails(Integer userId, String start,
return BaseResponse.okData(rts); String end, PageQuery pageQuery) {
Long startTime = null;
Long endTime = null;
if (StrUtil.isNotBlank(start) && StrUtil.isNotBlank(end)) {
startTime = DateUtil.parseDate(start).getTime();
endTime = DateUtil.parseDate(end).getTime();
}
List<NormProduction.NormProductionDetail> data = iNormProductionService.normProductionDetails(userId, startTime, endTime);
if (data.size() != 0) {
Page<NormProduction.NormProductionDetail> rts = PageUtil.listConvertToPage(data, pageQuery);
return BaseResponse.okData(rts);
}
return BaseResponse.okData(data);
} }
} }
package cn.wise.sc.cement.business.controller;
import cn.wise.sc.cement.business.entity.EntrustReport;
import cn.wise.sc.cement.business.model.BaseResponse;
import cn.wise.sc.cement.business.model.PageQuery;
import cn.wise.sc.cement.business.service.IEntrustService;
import cn.wise.sc.cement.business.util.PageUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.stream.Collectors;
/**
* @description: Quality
* @author: qh
* @create: 2020-09-28 09:49
**/
@Api(tags = "质量管理")
@Slf4j
@RestController
@RequestMapping("/business/quality")
public class QualityController {
final
IEntrustService iEntrustService;
public QualityController(IEntrustService iEntrustService) {
this.iEntrustService = iEntrustService;
}
@GetMapping("/{entrustId}")
@ApiOperation("获取报告详情")
public BaseResponse<com.baomidou.mybatisplus.extension.plugins.pagination.Page<EntrustReport>> getReportDetail(@PathVariable("entrustId") Integer entrustId, PageQuery pageQuery) {
List<EntrustReport> entrustReports = iEntrustService.getReportDetail(entrustId);
if (entrustReports.size() != 0) {
//过滤 id==null 和 projectType != '常规项目'
List<EntrustReport> list = entrustReports.stream()
.filter(arg -> arg.getId() != null && "质量控制".equals(arg.getProjectType()))
.collect(Collectors.toList());
Page<EntrustReport> rts = PageUtil.listConvertToPage(list, pageQuery);
return BaseResponse.okData(rts);
}
return BaseResponse.errorMsg("没找到相关数据!");
}
}
package cn.wise.sc.cement.business.controller;
import cn.wise.sc.cement.business.entity.EntrustReport;
import cn.wise.sc.cement.business.model.BaseResponse;
import cn.wise.sc.cement.business.model.PageQuery;
import cn.wise.sc.cement.business.model.vo.EntrustVo;
import cn.wise.sc.cement.business.service.IEntrustService;
import cn.wise.sc.cement.business.util.PageUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.stream.Collectors;
/**
* @description: 报告管理
* @author: qh
* @create: 2020-09-25 14:37
**/
@Api(tags = "报告管理")
@Slf4j
@RestController
@RequestMapping("/business/report")
public class ReportController {
final
IEntrustService iEntrustService;
public ReportController(IEntrustService iEntrustService) {
this.iEntrustService = iEntrustService;
}
@ApiOperation(value = "委托分页列表")
@ApiImplicitParams(value = {
@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 = "projectName", value = "项目名称", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "projectCode", value = "项目编号", paramType = "query", dataType = "String")
})
@GetMapping("/getPage")
public BaseResponse<IPage<EntrustVo>> page(PageQuery pageQuery, String startDate, String endDate,
Integer clientId, String projectName, String projectCode) {
return iEntrustService.getReportPage(pageQuery, startDate, endDate, clientId, projectName, projectCode);
}
@ApiOperation(value = "置顶取消置顶 (createTime = updateTime显示置顶,否则显示取消置顶)")
@PostMapping("/setTopping")
public BaseResponse<String> setTopping(Integer id) {
try {
return iEntrustService.setTopping(id);
} catch (Exception e) {
log.debug("置顶取消置顶 {}", e.getMessage());
}
return BaseResponse.errorMsg("失败!");
}
@DeleteMapping("/{id}")
@ApiOperation("删除报告")
public BaseResponse<Boolean> deleteById(@PathVariable("id") Integer id) {
return iEntrustService.deleteById(id);
}
@GetMapping("/{entrustId}")
@ApiOperation("获取报告详情")
public BaseResponse<Page<EntrustReport>> getReportDetail(@PathVariable("entrustId") Integer entrustId, PageQuery pageQuery) {
List<EntrustReport> entrustReports = iEntrustService.getReportDetail(entrustId);
if (entrustReports.size() != 0) {
//过滤 id==null 和 projectType != '常规项目'
List<EntrustReport> list = entrustReports.stream()
.filter(arg -> arg.getId() != null && "常规项目".equals(arg.getProjectType()))
.collect(Collectors.toList());
Page<EntrustReport> rts = PageUtil.listConvertToPage(list, pageQuery);
return BaseResponse.okData(rts);
}
return BaseResponse.errorMsg("没找到相关数据!");
}
}
package cn.wise.sc.cement.business.entity;
import lombok.Data;
/**
* @description: 委托报告
* @author: qh
* @create: 2020-09-25 20:36
**/
@Data
public class EntrustReport {
private Integer id;
/**
* 项目名字
*/
private String projectName;
/**
* 委托人
*/
private String sendName;
/**
* 委托方id
*/
private Integer clintId;
/**
* 样品id
*/
private Integer sampleId;
/**
* 项目id
*/
private Integer entrustId;
/**
* 检测项目ids
*/
private String teamIds;
/**
* 检测项目
*/
private String teamName;
/**
* 检测依据 ids
*/
private String methodNumbers;
/**
* 检测依据名字
*/
private String methodName;
/**
* 样品名字
*/
private String name;
/**
* 校核id
*/
private Integer checkId;
/**
* 机械仪器名字
*/
private String equipmentName;
/**
* 用户id
*/
private Integer userId;
/**
* 项目编号
*/
private String entrustCode;
/**
* 项目类型
*/
private String projectType;
}
...@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.annotation.IdType; ...@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.io.Serializable; import java.io.Serializable;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
...@@ -12,7 +11,7 @@ import lombok.experimental.Accessors; ...@@ -12,7 +11,7 @@ import lombok.experimental.Accessors;
/** /**
* <p> * <p>
* *
* </p> * </p>
* *
* @author ztw * @author ztw
...@@ -23,7 +22,7 @@ import lombok.experimental.Accessors; ...@@ -23,7 +22,7 @@ import lombok.experimental.Accessors;
@Accessors(chain = true) @Accessors(chain = true)
public class SampleCheckTeam implements Serializable { public class SampleCheckTeam implements Serializable {
private static final long serialVersionUID=1L; private static final long serialVersionUID = 1L;
/** /**
* 主键 * 主键
...@@ -34,21 +33,21 @@ public class SampleCheckTeam implements Serializable { ...@@ -34,21 +33,21 @@ public class SampleCheckTeam implements Serializable {
@ApiModelProperty("校核表id") @ApiModelProperty("校核表id")
private Integer checkId; private Integer checkId;
@ApiModelProperty("样品表d") @ApiModelProperty("样品表d")
private Integer sampleId; private Integer sampleId;
@ApiModelProperty("处理人id") @ApiModelProperty("处理人id")
private Integer userId; private Integer userId;
@ApiModelProperty("检测设备表id") @ApiModelProperty("检测设备表id")
private Integer equipmentId; private Integer equipmentId;
@ApiModelProperty("检测设备名称") @ApiModelProperty("检测设备名称")
private String equipmentName; private String equipmentName;
/** /**
* json串 * json串
{"样重m":"40","K值":1.0274,"Vsio2":3.89,................} * {"样重m":"40","K值":1.0274,"Vsio2":3.89,................}
*/ */
@ApiModelProperty("校核人员输入检测结果 json串") @ApiModelProperty("校核人员输入检测结果 json串")
private String inputResult; private String inputResult;
...@@ -56,8 +55,6 @@ public class SampleCheckTeam implements Serializable { ...@@ -56,8 +55,6 @@ public class SampleCheckTeam implements Serializable {
@ApiModelProperty("创建时间") @ApiModelProperty("创建时间")
private LocalDateTime createTime; private LocalDateTime createTime;
@ApiModelProperty("备注") @ApiModelProperty("备注")
private String remark; private String remark;
} }
package cn.wise.sc.cement.business.mapper; package cn.wise.sc.cement.business.mapper;
import cn.wise.sc.cement.business.entity.Entrust; import cn.wise.sc.cement.business.entity.Entrust;
import cn.wise.sc.cement.business.entity.EntrustReport;
import cn.wise.sc.cement.business.model.vo.EntrustVo; import cn.wise.sc.cement.business.model.vo.EntrustVo;
import cn.wise.sc.cement.business.model.vo.ProjectVo; import cn.wise.sc.cement.business.model.vo.ProjectVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
...@@ -9,6 +10,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -9,6 +10,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
...@@ -35,4 +37,5 @@ public interface EntrustMapper extends BaseMapper<Entrust> { ...@@ -35,4 +37,5 @@ public interface EntrustMapper extends BaseMapper<Entrust> {
IPage<EntrustVo> getCheckPage(@Param("page") Page page, @Param("params") Map<String, Object> params); IPage<EntrustVo> getCheckPage(@Param("page") Page page, @Param("params") Map<String, Object> params);
List<EntrustReport> getReportDetail(@Param("entrustId") Integer entrustId);
} }
...@@ -3,7 +3,7 @@ package cn.wise.sc.cement.business.mapper; ...@@ -3,7 +3,7 @@ package cn.wise.sc.cement.business.mapper;
import cn.wise.sc.cement.business.entity.EntrustSample; import cn.wise.sc.cement.business.entity.EntrustSample;
import cn.wise.sc.cement.business.entity.SampleCheckTeam; import cn.wise.sc.cement.business.entity.SampleCheckTeam;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import java.util.List; import java.util.List;
/** /**
...@@ -14,6 +14,7 @@ import java.util.List; ...@@ -14,6 +14,7 @@ import java.util.List;
* @author ztw * @author ztw
* @since 2020-08-24 * @since 2020-08-24
*/ */
@Mapper
public interface SampleCheckTeamMapper extends BaseMapper<SampleCheckTeam> { public interface SampleCheckTeamMapper extends BaseMapper<SampleCheckTeam> {
List<EntrustSample> getEntrustSample(); List<EntrustSample> getEntrustSample();
......
...@@ -7,6 +7,7 @@ import cn.wise.sc.cement.business.model.vo.SampleHandleVo; ...@@ -7,6 +7,7 @@ import cn.wise.sc.cement.business.model.vo.SampleHandleVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import org.apache.tomcat.jni.Local; import org.apache.tomcat.jni.Local;
...@@ -23,6 +24,7 @@ import java.util.Map; ...@@ -23,6 +24,7 @@ import java.util.Map;
* @author ztw * @author ztw
* @since 2020-08-24 * @since 2020-08-24
*/ */
@Mapper
public interface SampleHandleMapper extends BaseMapper<SampleHandle> { public interface SampleHandleMapper extends BaseMapper<SampleHandle> {
......
...@@ -26,11 +26,14 @@ ...@@ -26,11 +26,14 @@
<if test="params.userId != null"> <if test="params.userId != null">
and e.user_id = #{params.userId} and e.user_id = #{params.userId}
</if> </if>
<if test="params.projectType != null and params.projectType != ''">
and e.project_type = #{params.projectType}
</if>
</where> </where>
</sql> </sql>
<select id="getPage" resultType="cn.wise.sc.cement.business.model.vo.EntrustVo"> <select id="getPage" resultType="cn.wise.sc.cement.business.model.vo.EntrustVo">
select e.*, p.name as projectName, c.name as clientName, su.name as userName, select e.*, p.name as projectName, c.name as clientName, su.name as userName,
( (
CASE e.status CASE e.status
WHEN 0 THEN '未评审' WHEN 0 THEN '未评审'
...@@ -49,7 +52,7 @@ ...@@ -49,7 +52,7 @@
left join project p on p.id = e.project_id left join project p on p.id = e.project_id
left join client c on c.id = e.client_id left join client c on c.id = e.client_id
left join sys_user su on su.id = e.user_id left join sys_user su on su.id = e.user_id
<include refid="where" /> <include refid="where"/>
order by e.is_urgent desc, e.update_time desc order by e.is_urgent desc, e.update_time desc
</select> </select>
...@@ -79,7 +82,6 @@ ...@@ -79,7 +82,6 @@
</select> </select>
<select id="getSampleHandlePage" resultType="cn.wise.sc.cement.business.model.vo.EntrustVo"> <select id="getSampleHandlePage" resultType="cn.wise.sc.cement.business.model.vo.EntrustVo">
select e.id as id, e.sample_num as sampleNum,e.entrust_date as entrustDate, select e.id as id, e.sample_num as sampleNum,e.entrust_date as entrustDate,
( (
...@@ -96,7 +98,7 @@ ...@@ -96,7 +98,7 @@
ELSE '' ELSE ''
END END
) as statusValue, ) as statusValue,
p.id as projectId, p.name as projectName, p.code as projectCode, p.id as projectId, p.name as projectName, p.code as projectCode,
su.name as userName su.name as userName
from sample_handle t from sample_handle t
left join sys_user su on su.id = t.user_id left join sys_user su on su.id = t.user_id
...@@ -155,7 +157,7 @@ ...@@ -155,7 +157,7 @@
<!--数据校核分页列表--> <!--数据校核分页列表-->
<select id="getCheckPage" resultType="cn.wise.sc.cement.business.model.vo.EntrustVo"> <select id="getCheckPage" resultType="cn.wise.sc.cement.business.model.vo.EntrustVo">
select e.*, p.name as projectName, c.name as clientName, su.name as userName, select e.*, p.name as projectName, c.name as clientName, su.name as userName,
( (
CASE e.status CASE e.status
WHEN 0 THEN '未评审' WHEN 0 THEN '未评审'
...@@ -174,36 +176,49 @@ ...@@ -174,36 +176,49 @@
left join project p on p.id = e.project_id left join project p on p.id = e.project_id
left join client c on c.id = e.client_id left join client c on c.id = e.client_id
left join sys_user su on su.id = e.user_id left join sys_user su on su.id = e.user_id
<include refid="checkWhere" /> <include refid="checkWhere"/>
order by e.update_time desc order by e.update_time desc
</select> </select>
<select id="getReportDetail" resultType="cn.wise.sc.cement.business.entity.EntrustReport">
SELECT e.id,e.project_name,e.send_name,e.client_id,e.entrust_code,e.project_type,sscct.* FROM entrust e
RIGHT JOIN
(SELECT id as sample_id,entrust_id,team_ids,method_numbers,name,scct.check_id,
scct.equipment_name,scct.user_id FROM sample s
RIGHT JOIN
(SELECT check_id,equipment_name,sample_id,user_id FROM sample_check_team sct
LEFT JOIN
(SELECT entrust_id,id FROM sample_check) sc
ON sct.check_id = sc.id) scct
ON s.sample_id = scct.sample_id) sscct
ON sscct.entrust_id = e.id AND e.id = #{entrustId}
</select>
<sql id="checkWhere"> <sql id="checkWhere">
<where> <where>
and e.is_delete = 1 and e.status >= 6 and e.is_delete = 1 and e.status >= 6
<if test="params.startDate != null and params.startDate != ''"> <if test="params.startDate != null and params.startDate != ''">
and DATE(e.entrust_date) &gt;= #{params.startDate} and DATE(e.entrust_date) &gt;= #{params.startDate}
</if> </if>
<if test="params.endDate != null and params.endDate != ''"> <if test="params.endDate != null and params.endDate != ''">
and DATE(e.entrust_date) &lt;= #{params.endDate} and DATE(e.entrust_date) &lt;= #{params.endDate}
</if> </if>
<if test="params.status != null"> <if test="params.status != null">
and e.status = #{params.status} and e.status = #{params.status}
</if> </if>
<if test="params.clientId != null"> <if test="params.clientId != null">
and e.client_id = #{params.clientId} and e.client_id = #{params.clientId}
</if> </if>
<if test="params.projectName != null and params.projectName != ''"> <if test="params.projectName != null and params.projectName != ''">
and p.name like concat('%', #{params.projectName}, '%') and p.name like concat('%', #{params.projectName}, '%')
</if> </if>
<if test="params.projectCode != null and params.projectCode != ''"> <if test="params.projectCode != null and params.projectCode != ''">
and p.code like concat('%', #{params.projectCode}, '%') and p.code like concat('%', #{params.projectCode}, '%')
</if> </if>
<if test="params.userId != null"> <if test="params.userId != null">
and e.user_id = #{params.userId} and e.user_id = #{params.userId}
</if> </if>
</where> </where>
</sql> </sql>
</mapper> </mapper>
...@@ -39,7 +39,6 @@ public class SampleCheckTeamQuery { ...@@ -39,7 +39,6 @@ public class SampleCheckTeamQuery {
@ApiModelProperty("检测组名称") @ApiModelProperty("检测组名称")
private String teamGroupName; private String teamGroupName;
@ApiModelProperty("主样-检测人员id") @ApiModelProperty("主样-检测人员id")
private Integer mainUserId; private Integer mainUserId;
...@@ -72,10 +71,9 @@ public class SampleCheckTeamQuery { ...@@ -72,10 +71,9 @@ public class SampleCheckTeamQuery {
private Integer secondarySampleId; private Integer secondarySampleId;
@ApiModelProperty("次样检测结果 Map集合") @ApiModelProperty("次样检测结果 Map集合")
private Map<String, Object>secondaryResult; private Map<String, Object> secondaryResult;
@ApiModelProperty("最终校核计算结果 Map集合") @ApiModelProperty("最终校核计算结果 Map集合")
private Map<String, Object> endResult; private Map<String, Object> endResult;
} }
package cn.wise.sc.cement.business.model.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @description:
* @author: qh
* @create: 2020-09-25 13:54
**/
@Data
public class NormProductionVo {
/**
* 主键
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* 检查组id
*/
@ApiModelProperty("检查组id")
private Integer assessId;
/**
* 类型 0:检测组 1:处理项
*/
@ApiModelProperty("类型 0:检测组 1:处理项")
private Integer type;
/**
* 定额工日
*/
@ApiModelProperty("定额工日")
private Double quotaDay;
/**
* 报出分析结果
*/
@ApiModelProperty("报出分析结果")
private Double reportedAnalyseResult;
/**
* 建议系数
*/
@ApiModelProperty("建议系数")
private Double coefficient;
/**
* 考核工值
*/
@ApiModelProperty("考核工值")
private Double assessValue;
/**
* 分析占比
*/
@ApiModelProperty("分析占比")
private Double analyseRate;
/**
* 分样占比
*/
@ApiModelProperty("分样占比")
private Double separateRate;
/**
* 考核占比
*/
@ApiModelProperty("考核占比")
private Double assessRate;
/**
* 报结果占比
*/
@ApiModelProperty("报结果占比")
private Double reportedResultRate;
/**
* 状态
*/
@ApiModelProperty("状态")
private Integer status;
/**
* 检测组名字
*/
@ApiModelProperty("检测组名字")
private String assessName;
}
package cn.wise.sc.cement.business.service; package cn.wise.sc.cement.business.service;
import cn.wise.sc.cement.business.entity.Entrust; import cn.wise.sc.cement.business.entity.Entrust;
import cn.wise.sc.cement.business.entity.EntrustReport;
import cn.wise.sc.cement.business.entity.SampleDistribution; import cn.wise.sc.cement.business.entity.SampleDistribution;
import cn.wise.sc.cement.business.entity.SampleHandleEnclosure; import cn.wise.sc.cement.business.entity.SampleHandleEnclosure;
import cn.wise.sc.cement.business.model.BaseResponse; import cn.wise.sc.cement.business.model.BaseResponse;
...@@ -80,7 +81,9 @@ public interface IEntrustService extends IService<Entrust> { ...@@ -80,7 +81,9 @@ public interface IEntrustService extends IService<Entrust> {
BaseResponse<String> check(CheckQuery query); BaseResponse<String> check(CheckQuery query);
BaseResponse<IPage<EntrustVo>> getReportPage(PageQuery pageQuery, String startDate, String endDate, Integer clientId, String projectName, String projectCode);
BaseResponse<Boolean> deleteById(Integer id);
List<EntrustReport> getReportDetail(Integer entrustId);
} }
...@@ -4,8 +4,10 @@ import cn.wise.sc.cement.business.entity.NormProduction; ...@@ -4,8 +4,10 @@ import cn.wise.sc.cement.business.entity.NormProduction;
import cn.wise.sc.cement.business.entity.NormProductionStatistics; import cn.wise.sc.cement.business.entity.NormProductionStatistics;
import cn.wise.sc.cement.business.model.BaseResponse; import cn.wise.sc.cement.business.model.BaseResponse;
import cn.wise.sc.cement.business.model.PageQuery; import cn.wise.sc.cement.business.model.PageQuery;
import cn.wise.sc.cement.business.model.vo.NormProductionVo;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List; import java.util.List;
/** /**
...@@ -32,7 +34,7 @@ public interface INormProductionService extends IService<NormProduction> { ...@@ -32,7 +34,7 @@ public interface INormProductionService extends IService<NormProduction> {
* @param pageQuery 分页条件 * @param pageQuery 分页条件
* @return 数据 * @return 数据
*/ */
BaseResponse<IPage<NormProduction>> getPage(PageQuery pageQuery); BaseResponse<IPage<NormProductionVo>> getPage(PageQuery pageQuery);
/** /**
* 编辑标准产值 * 编辑标准产值
...@@ -54,10 +56,10 @@ public interface INormProductionService extends IService<NormProduction> { ...@@ -54,10 +56,10 @@ public interface INormProductionService extends IService<NormProduction> {
* 标准产值统计 * 标准产值统计
* *
* @param start 开始时间 * @param start 开始时间
* @param end 结束时间 * @param end 结束时间
* @return BaseResponse * @return BaseResponse
*/ */
BaseResponse<List<NormProductionStatistics>> normProductionStatistics(Long start, Long end); BaseResponse<List<NormProductionStatistics>> normProductionStatistics(Long start, Long end, String name);
/** /**
* 标准产值统计 单人详情 * 标准产值统计 单人详情
...@@ -68,5 +70,5 @@ public interface INormProductionService extends IService<NormProduction> { ...@@ -68,5 +70,5 @@ public interface INormProductionService extends IService<NormProduction> {
* @return 详细信息 * @return 详细信息
*/ */
List<NormProduction.NormProductionDetail> normProductionDetails(Integer userId, List<NormProduction.NormProductionDetail> normProductionDetails(Integer userId,
Long start, Long end); Long start, Long end);
} }
package cn.wise.sc.cement.business.service.impl; package cn.wise.sc.cement.business.service.impl;
import cn.hutool.core.util.StrUtil;
import cn.wise.sc.cement.business.entity.*; import cn.wise.sc.cement.business.entity.*;
import cn.wise.sc.cement.business.mapper.*; import cn.wise.sc.cement.business.mapper.*;
import cn.wise.sc.cement.business.model.BaseResponse; import cn.wise.sc.cement.business.model.BaseResponse;
...@@ -11,6 +12,7 @@ import cn.wise.sc.cement.business.service.*; ...@@ -11,6 +12,7 @@ import cn.wise.sc.cement.business.service.*;
import cn.wise.sc.cement.business.util.CheckCountUtil; import cn.wise.sc.cement.business.util.CheckCountUtil;
import cn.wise.sc.cement.business.util.RedisUtil; import cn.wise.sc.cement.business.util.RedisUtil;
import cn.wise.sc.cement.business.wrapper.page.Query; import cn.wise.sc.cement.business.wrapper.page.Query;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
...@@ -1553,5 +1555,133 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl ...@@ -1553,5 +1555,133 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
return BaseResponse.okMsg("数据校核完成"); return BaseResponse.okMsg("数据校核完成");
} }
@Override
public BaseResponse<IPage<EntrustVo>> getReportPage(PageQuery pageQuery, String startDate, String endDate, Integer clientId, String projectName, String projectCode) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
}
Map<String, Object> params = new HashMap<>();
params.put("startDate", startDate);
params.put("endDate", endDate);
params.put("status", 8);
params.put("clientId", clientId);
params.put("projectName", projectName);
params.put("projectCode", projectCode);
params.put("projectType", "常规项目");
Integer approvalId = sysApprovalMapper.getApprovalId("委托评审");
if (approvalId == null) {
return BaseResponse.errorMsg("委托评审信息错误");
}
if (loginUser.getId() != approvalId) {
params.put("userId", loginUser.getId());
}
Page<EntrustVo> page = new Page<>(pageQuery.getPageNo(), pageQuery.getPageSize());
IPage<EntrustVo> pages = entrustMapper.getPage(page, params);
List<EntrustVo> list = pages.getRecords();
if (list != null && list.size() > 0) {
for (EntrustVo entrustVo : list) {
QueryWrapper<SampleTmp> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("entrust_id", entrustVo.getId());
List<SampleTmp> sampleTmpList = sampleTmpService.list(queryWrapper);
//检测项目名称
String sampleNames = "";
if (sampleTmpList != null && sampleTmpList.size() > 0) {
//样品名称 列表中的拼接
for (SampleTmp sampleTmp : sampleTmpList) {
sampleNames = sampleNames.equals("") ? sampleTmp.getName() : (sampleNames + "、" + sampleTmp.getName());
}
entrustVo.setSampleNames(sampleNames);
//检测项 和检测依据 列表里只显示第一个样品的
SampleTmp sampleTmp = sampleTmpList.get(0);
String teamIds = sampleTmp.getTeamIds();
String checkTeam = "";
if (teamIds != null) {
String[] teamIdS = teamIds.split("、");
for (String teamId : teamIdS) {
Team team = teamMapper.selectById(Integer.valueOf(teamId));
if (team != null) {
checkTeam = checkTeam.equals("") ? team.getName() : (checkTeam + "、" + team.getName());
}
}
}
entrustVo.setCheckTeam(checkTeam);
entrustVo.setCheckMethodNumber(sampleTmp.getMethodNumbers());
}
}
}
pages.setRecords(list);
return BaseResponse.okData(pages);
}
@Override
@Transactional(rollbackFor = Exception.class)
public BaseResponse<Boolean> deleteById(Integer id) {
if (id == null || id <= 0) {
return BaseResponse.errorMsg("id编号不能为空!");
}
Entrust entrust = this.getById(id);
entrust.setIsDelete(0);
boolean b = this.updateById(entrust);
return BaseResponse.okData(b);
}
@Override
public List<EntrustReport> getReportDetail(Integer entrustId) {
List<EntrustReport> list = entrustMapper.getReportDetail(entrustId);
String teamKey = "CACHE:TEAM";
String methodKey = "METHOD:KEY";
//缓存 60s
if (!redisUtil.existsKey(teamKey)) {
List<Team> teams = teamMapper.selectList(new QueryWrapper<>());
String value = JSON.toJSONString(teams);
redisUtil.setString(teamKey, value, 60);
}
if (!redisUtil.existsKey(methodKey)) {
List<Method> methods = methodMapper.selectList(new QueryWrapper<>());
String value = JSON.toJSONString(methods);
redisUtil.setString(methodKey, value, 60);
}
List<Team> teams = JSON.parseArray(redisUtil.getString(teamKey) + "", Team.class);
List<Method> methods = JSON.parseArray(redisUtil.getString(methodKey) + "", Method.class);
list.forEach(arg -> {
String teamIds = arg.getTeamIds();
String[] teamSplit = teamIds.split("、");
for (String idStr : teamSplit) {
int id = Integer.parseInt(idStr);
teams.forEach(opt -> {
if (opt.getId() == id) {
if (StrUtil.isBlank(arg.getTeamName())) {
arg.setTeamName(opt.getName());
} else {
arg.setTeamName(arg.getTeamName() + "、" + opt.getName());
}
}
});
}
String methodNumbers = arg.getMethodNumbers();
String[] methodSplit = methodNumbers.split("、");
for (String idStr : methodSplit) {
int id = Integer.parseInt(idStr);
methods.forEach(opt -> {
if (opt.getId() == id) {
if (StrUtil.isBlank(arg.getMethodName())) {
arg.setMethodName(opt.getName());
} else {
arg.setMethodName(arg.getMethodName() + "、" + opt.getName());
}
}
});
}
});
return list;
}
} }
package cn.wise.sc.cement.business.util;
import cn.wise.sc.cement.business.model.PageQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.poi.ss.formula.functions.T;
import java.util.List;
/**
* @description:
* @author: qh
* @create: 2020-09-27 18:19
**/
public class PageUtil {
public static <T> Page<T> listConvertToPage(List<T> list, PageQuery pageQuery) {
int start = pageQuery.getPageNo();
int end = Math.min((start + pageQuery.getPageSize()), list.size());
Page<T> page = new Page<>(start, end, list.size());
page.setRecords(list.subList(start, end));
return page;
}
}
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