Commit 169620c3 authored by 竹天卫's avatar 竹天卫

导出委托进展

parent bea3477f
......@@ -5,6 +5,7 @@ import cn.wise.sc.cement.business.model.PageQuery;
import cn.wise.sc.cement.business.model.query.CountItemDistributionQuery;
import cn.wise.sc.cement.business.model.vo.ItemDistributionVo;
import cn.wise.sc.cement.business.service.IDataStatisticsService;
import cn.wise.sc.cement.business.service.IEntrustService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
......@@ -34,6 +35,8 @@ public class DataStatisticsController {
@Autowired
private IDataStatisticsService dataStatisticsService;
@Autowired
private IEntrustService entrustService;
@ApiOperation(value = "统计概览-重要数值统计")
......@@ -112,24 +115,14 @@ public class DataStatisticsController {
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);
}
}
// dataStatisticsService.exportEntrustList(cycle, startDate, endDate, clientId, clientName, fileName, response);
dataStatisticsService.exportConsignation(cycle, startDate, endDate, clientId, clientName, fileName, response);
@ApiOperation("委托单进展统计-列表导出(新)")
@PostMapping("/exportEntrustIngList")
public void exportEntrustIngList(Integer cycle, String startDate,
String endDate, Integer clientId, String clientName, String fileName, HttpServletResponse response) {
try {
dataStatisticsService.exportEntrustIngList(cycle, startDate, endDate, clientId, clientName, fileName, response);
} catch (Exception e) {
log.debug("委托单进展统计-列表导出(新){}", e);
log.debug("列表导出-委托单进展统计{}", e);
}
}
@ApiOperation(value = "统计概览-进行中任务数量统计")
@GetMapping("/countTaskIng")
public BaseResponse countTaskIng(PageQuery pageQuery, String startDate, String endDate) {
......
......@@ -81,12 +81,10 @@ public class EntrustController {
public void export(String startDate, String endDate, Integer status,
Integer clientId, String projectName, String projectCode,
String fileName, HttpServletResponse response) {
long a = System.currentTimeMillis();
try {
entrustService.exportConsignation(startDate, endDate, status,
entrustService.export(startDate, endDate, status,
clientId, projectName, projectCode,
fileName, response);
System.out.println(System.currentTimeMillis()-a);
} catch (Exception e) {
log.debug("委托列表导出{}", e);
}
......
......@@ -39,6 +39,7 @@ public interface DataStatisticsMapper {
IPage<EntrustVo> countEntrustPage(@Param("page") Page page, @Param("params") Map<String, Object> params);
List<Map<String, Object>> exportEntrustList(@Param("params") Map<String, Object> params);
List<Map<String, Object>> exportEntrustNewList(@Param("params") Map<String, Object> params);
IPage<DataStatisticsVo> countHandlePage(@Param("page") Page page, @Param("params") Map<String, Object> params);
......
......@@ -188,7 +188,7 @@
IF(ISNULL(e.id),'',e.id) as entrustId,
IF(ISNULL(e.entrust_code),'',e.entrust_code) as 委托单号,
IF(ISNULL(c.name),'',c.name) as 委托单位,
IF(ISNULL(p.name),'',p.name) as 项目编号,
IF(ISNULL(p.code),'',p.code) as 项目编号,
IF(ISNULL(p.name),'',p.name) as 项目名称,
IF(ISNULL(su.name),'',su.name) as 委托人,
IF(ISNULL(e.sample_num),'',e.sample_num) as 样品数量,
......@@ -222,6 +222,61 @@
order by 序号
</select>
<select id="exportEntrustNewList" resultType="java.util.HashMap">
SELECT
(@i:=@i+1) as 序号,
e.id as entrustId,
IF(ISNULL(e.entrust_code),'',e.entrust_code) as 委托单号,
(
CASE e.is_urgent
WHEN 0 THEN '不加急'
WHEN 1 THEN '加急'
ELSE NULL
END
) as 是否加急,
IF(ISNULL(p.name),'',p.name) as 项目名称,
IF(ISNULL(p.code),'',p.code) 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 '修改待确认'
WHEN 10 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
......
......@@ -82,7 +82,7 @@
END
) as 是否加急,
IF(ISNULL(p.name),'',p.name) as 项目名称,
IF(ISNULL(p.name),'',p.name) as 项目编号,
IF(ISNULL(p.code),'',p.code) as 项目编号,
IF(ISNULL(su.name),'',su.name) as 委托人,
IF(ISNULL(c.name),'',c.name) as 委托单位,
IF(ISNULL(e.entrust_date),'',e.entrust_date) as 委托日期,
......
......@@ -39,8 +39,10 @@ public interface IDataStatisticsService {
void exportEntrustList(Integer cycle, String startDate,
String endDate, Integer clientId, String clientName, String fileName, HttpServletResponse response);
void exportEntrustIngList(Integer cycle, String startDate,
String endDate, Integer clientId, String clientName, String fileName, HttpServletResponse response);
void exportConsignation(Integer cycle, String startDate,
String endDate, Integer clientId, String clientName,
String fileName, HttpServletResponse response);
BaseResponse<Map<String, Object>> countTaskIng(PageQuery pageQuery, String startDate, String endDate);
......
......@@ -144,9 +144,8 @@ public interface IEntrustService extends IService<Entrust> {
Integer clientId, String projectName, String projectCode,
String fileName, HttpServletResponse response);
void exportConsignation(String startDate, String endDate, Integer status,
Integer clientId, String projectName, String projectCode,
String fileName, HttpServletResponse response);
void exportConsignation(Integer cycle, String startDate,
String endDate, Integer clientId, String clientName, String fileName, HttpServletResponse response);
BaseResponse<EntrustVo> getBaseDtail(Integer id);
......
......@@ -5347,24 +5347,25 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
private ISampleDistributionService sampleDistributionService;
@Override
public void exportConsignation(String startDate, String endDate, Integer status,
Integer clientId, String projectName, String projectCode,
public void exportConsignation(Integer cycle, String startDate,
String endDate, Integer clientId, String clientName,
String fileName, HttpServletResponse response) {
//1.首先查询所有可见的检测项
QueryWrapper<Team> teamQueryWrapper = new QueryWrapper<>();
teamQueryWrapper.eq("is_display", 1);
teamQueryWrapper.eq("status", 1);
List<Team> teamList = teamService.list(teamQueryWrapper);
//转化成id为key的map
Map<Integer, Team> teamMap = teamList.stream().collect(Collectors.toMap(Team::getId, a -> a, (k1, k2) -> k1));
// Map<Integer, Team> teamMap = teamList.stream().collect(Collectors.toMap(Team::getId, a -> a, (k1, k2) -> k1));
//2.条件查询委托单项
Map<String, Object> params = new HashMap<>();
params.put("cycle", cycle);
params.put("startDate", startDate);
params.put("endDate", endDate);
params.put("status", status);
params.put("clientId", clientId);
params.put("projectName", projectName);
params.put("projectCode", projectCode);
params.put("clientName", clientName);
List<Map<String, Object>> entrustList = entrustMapper.exportList(params);
//获取所有的委托单号
List<Integer> queryList = entrustList.stream().map(x -> Integer.parseInt(x.get("entrustId").toString())).collect(Collectors.toList());
......@@ -5396,7 +5397,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
"项目名称",
"委托人",
"样品数量",
"发样日期",
"委托日期",
"是否加急",
"实际产值",
};
......@@ -5414,9 +5415,19 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
//处理委托人信息表头
for (int i = 0; i < infoHeader.size(); i++) {
XSSFCell tempCell = row0.createCell(i);
if(infoHeader.get(i).equals("实际产值")){
Double outPutValue = sampleList
.stream()
.filter(x -> x.getCementCode().equals(x.getParallelCode()) && x.getEntrustId() == entrustId )
.mapToDouble(item -> item.getOutputValue().doubleValue()).sum();
tempCell.setCellValue(outPutValue == null ? "" : outPutValue.toString());
tempCell.setCellStyle(style);
}else{
tempCell.setCellValue(entrust.get(infoHeader.get(i)) == null ? "" : entrust.get(infoHeader.get(i)).toString());
tempCell.setCellStyle(style);
}
}
//处理检测项总产值表头
for (int i = infoHeader.size(); i < teamList.size() + infoHeader.size(); i++) {
XSSFCell tempCell = row0.createCell(i);
......
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