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

人员产值统计导出功能

parent da2fd0e2
...@@ -113,13 +113,13 @@ public class NonStandardApplyController { ...@@ -113,13 +113,13 @@ public class NonStandardApplyController {
return BaseResponse.errorMsg("失败!"); return BaseResponse.errorMsg("失败!");
} }
@ApiOperation("非标产值申请导出列表") @ApiOperation("导出-非标产值申请列表")
@PostMapping("/exportList") @PostMapping("/exportList")
public void exportList(String filename, Integer userId, String name, HttpServletResponse response) { public void exportList(String filename, Integer userId, String name, HttpServletResponse response) {
try { try {
iNonStandardApplyService.exportList(filename, userId, name, response); iNonStandardApplyService.exportList(filename, userId, name, response);
} catch (Exception e) { } catch (Exception e) {
log.debug("非标产值申请导出列表{}", e); log.debug("导出-非标产值申请导出列表{}", e);
} }
} }
} }
...@@ -132,13 +132,13 @@ public class NonStandardApprovalController { ...@@ -132,13 +132,13 @@ public class NonStandardApprovalController {
return BaseResponse.errorMsg("失败!"); return BaseResponse.errorMsg("失败!");
} }
@ApiOperation("委托单位审批导出列表") @ApiOperation("导出-委托单位审批列表")
@PostMapping("/exportList") @PostMapping("/exportList")
public void exportList(String filename, String userId, String name, HttpServletResponse response) { public void exportList(String filename, String userId, String name, HttpServletResponse response) {
try { try {
iNonStandardApprovalService.exportList(filename, userId, name, response); iNonStandardApprovalService.exportList(filename, userId, name, response);
} catch (Exception e) { } catch (Exception e) {
log.debug("非标产值申请导出列表{}", e); log.debug("导出-非标产值申请导出列表{}", e);
} }
} }
} }
package cn.wise.sc.cement.business.controller; package cn.wise.sc.cement.business.controller;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.wise.sc.cement.business.entity.NonStandardValue; import cn.wise.sc.cement.business.entity.NonStandardValue;
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.NonStandardApplyVo;
import cn.wise.sc.cement.business.model.vo.NonStandardValueVo;
import cn.wise.sc.cement.business.service.INonStandardValueService; import cn.wise.sc.cement.business.service.INonStandardValueService;
import cn.wise.sc.cement.business.util.PageUtil; import cn.wise.sc.cement.business.util.PageUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
...@@ -19,7 +16,6 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -19,7 +16,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.xml.crypto.Data;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -40,8 +36,8 @@ public class NonStandardValueController { ...@@ -40,8 +36,8 @@ public class NonStandardValueController {
@Autowired @Autowired
private INonStandardValueService inonStandardValueService; private INonStandardValueService inonStandardValueService;
@GetMapping("/user_id")
@ApiOperation("产值统计-非标产值") @ApiOperation("产值统计-非标产值")
@GetMapping("/user_id")
public BaseResponse nonValue(PageQuery pageQuery, String start, String end, Integer groups,String name) { public BaseResponse nonValue(PageQuery pageQuery, String start, String end, Integer groups,String name) {
Date startParse = null; Date startParse = null;
if (StrUtil.isNotBlank(start)) { if (StrUtil.isNotBlank(start)) {
...@@ -99,13 +95,26 @@ public class NonStandardValueController { ...@@ -99,13 +95,26 @@ public class NonStandardValueController {
return BaseResponse.errorMsg("失败!"); return BaseResponse.errorMsg("失败!");
} }
@ApiOperation("非标产值信息导出列表") @ApiOperation("导出-产值统计-非标产值信息列表")
@PostMapping("/exportList") @PostMapping("/exportList")
public void exportList(String filename, Integer userId, String name, HttpServletResponse response) { public void exportList(String filename, Integer userId, String name, HttpServletResponse response) {
try { try {
inonStandardValueService.exportList(filename, userId, name, response); inonStandardValueService.exportList(filename, userId, name, response);
} catch (Exception e) { } catch (Exception e) {
log.debug("非标产值信息导出列表{}", e); log.debug("导出-产值统计-非标产值信息列表{}", e);
}
}
@ApiOperation("导出-产值统计-非标产值信息列表")
@PostMapping("/exportDetailList")
public void exportDetailList(Date start, Date end, Integer userId, String name, String filename,HttpServletResponse response) {
try {
inonStandardValueService.exportDetailList(start, end, userId, name, filename, response);
} catch (Exception e) {
log.debug("导出-产值统计-非标产值信息列表{}", e);
} }
} }
} }
...@@ -155,6 +155,11 @@ public class NormProductionController { ...@@ -155,6 +155,11 @@ public class NormProductionController {
} }
@GetMapping("/statistics/detail") @GetMapping("/statistics/detail")
@ApiImplicitParams(value = {
@ApiImplicitParam(name = "startDate", value = "开始日期", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "endDate", value = "结束日期", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "userId", value = "用户id(必传)", paramType = "query", dataType = "Integer")
})
@ApiOperation("产值统计-标准产值-个人详情") @ApiOperation("产值统计-标准产值-个人详情")
public BaseResponse normProductionDetails(PageQuery pageQuery, String startDate, String endDate, Integer userId) { public BaseResponse normProductionDetails(PageQuery pageQuery, String startDate, String endDate, Integer userId) {
try { try {
...@@ -167,6 +172,13 @@ public class NormProductionController { ...@@ -167,6 +172,13 @@ public class NormProductionController {
@GetMapping("/statistics/specificDetail") @GetMapping("/statistics/specificDetail")
@ApiImplicitParams(value = {
@ApiImplicitParam(name = "startDate", value = "开始日期", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "endDate", value = "结束日期", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "userId", value = "用户id(必传)", paramType = "query", dataType = "Integer"),
@ApiImplicitParam(name = "type", value = "类型 0:处理项 1:检测组 2:检测项", paramType = "query", dataType = "Integer"),
@ApiImplicitParam(name = "objId", value = "对象id(非必传)", paramType = "query", dataType = "Integer")
})
@ApiOperation("产值统计-标准产值-个人详情-检测项目详情") @ApiOperation("产值统计-标准产值-个人详情-检测项目详情")
public BaseResponse normProductionSpecificDetails(PageQuery pageQuery, public BaseResponse normProductionSpecificDetails(PageQuery pageQuery,
String startDate, String endDate, Integer userId, Integer type, Integer objId) { String startDate, String endDate, Integer userId, Integer type, Integer objId) {
...@@ -181,6 +193,12 @@ public class NormProductionController { ...@@ -181,6 +193,12 @@ public class NormProductionController {
@GetMapping("/total/production") @GetMapping("/total/production")
@ApiImplicitParams(value = {
@ApiImplicitParam(name = "start", value = "开始日期", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "end", value = "结束日期", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "name", value = "姓名", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "groupId", value = "工作组id", paramType = "query", dataType = "Integer")
})
@ApiOperation("产值统计-总产值统计") @ApiOperation("产值统计-总产值统计")
public BaseResponse<Page<ProductionVo>> production(PageQuery pageQuery, String name, String start, String end, Integer groupId) { public BaseResponse<Page<ProductionVo>> production(PageQuery pageQuery, String name, String start, String end, Integer groupId) {
Long startTime = null; Long startTime = null;
...@@ -200,44 +218,60 @@ public class NormProductionController { ...@@ -200,44 +218,60 @@ public class NormProductionController {
//****************************导出***************************************************** //****************************导出*****************************************************
@ApiOperation("导出-产值统计-标准产值-列表")
@ApiImplicitParams(value = {
@ApiImplicitParam(name = "startDate", value = "开始日期", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "endDate", value = "结束日期", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "userName", value = "姓名", paramType = "query", dataType = "String")
})
@PostMapping("/export/statistics")
public void exportStatisticsList(String startDate, String endDate, String userName, String fileName, HttpServletResponse response) {
/* @PostMapping("/export/statistics") try {
@ApiOperation("导出标准产值列表") iPrecipriceService.exportStatisticsList(startDate, endDate, userName, fileName, response);
public void exportNormProductionStatistics(String start, String end, String name, Integer groupId, HttpServletResponse response) { } catch (Exception e) {
Long startTime = null; log.debug("导出-产值统计-标准产值-列表{}", e);
Long endTime = null; }
if (StrUtil.isNotBlank(start) && StrUtil.isNotBlank(end)) {
startTime = DateUtil.parseDate(start).getTime();
endTime = DateUtil.parseDate(end).offsetNew(DateField.DAY_OF_MONTH, 1).getTime();
} }
iNormProductionService.exportNormProductionStatistics(startTime, endTime, name, groupId, response);
}*/
/* @PostMapping("/export/statistics/detail")
@ApiOperation("导出个人标准产值详情列表") @ApiOperation("导出-产值统计-标准产值-个人详情")
public void exportNormProductionDetails(Integer userId, String start, @ApiImplicitParams(value = {
String end, HttpServletResponse response) { @ApiImplicitParam(name = "startDate", value = "开始日期", paramType = "query", dataType = "String"),
Long startTime = null; @ApiImplicitParam(name = "endDate", value = "结束日期", paramType = "query", dataType = "String"),
Long endTime = null; @ApiImplicitParam(name = "userId", value = "用户id(必传)", paramType = "query", dataType = "Integer")
if (StrUtil.isNotBlank(start) && StrUtil.isNotBlank(end)) { })
startTime = DateUtil.parseDate(start).getTime(); @PostMapping("/export/statisticsDetail")
endTime = DateUtil.parseDate(end).offsetNew(DateField.DAY_OF_MONTH, 1).getTime(); public void exportStatisticsDetail(String startDate, String endDate, Integer userId, String fileName, HttpServletResponse response) {
try {
iPrecipriceService.exportStatisticsDetail(startDate, endDate, userId, fileName, response);
} catch (Exception e) {
log.debug("导出-产值统计-标准产值-个人详情{}", e);
}
} }
iPrecipriceService.exportNormProductionDetail(userId, startTime, endTime, response);
}*/
/* @PostMapping("/export/total/production") @ApiOperation("导出-产值统计-产值统计-总产值统计")
@ApiOperation("导出总产值") @ApiImplicitParams(value = {
public void exportProduction(String name, String start, String end, Integer groupId, HttpServletResponse response) { @ApiImplicitParam(name = "start", value = "开始日期", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "end", value = "结束日期", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "name", value = "姓名", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "groupId", value = "工作组id", paramType = "query", dataType = "Integer")
})
@PostMapping("/export/total/production")
public void exportProduction(String name, String start, String end, Integer groupId, String fileName, HttpServletResponse response) {
Long startTime = null; Long startTime = null;
Long endTime = null; Long endTime = null;
if (StrUtil.isNotBlank(start) && StrUtil.isNotBlank(end)) { if (StrUtil.isNotBlank(start) && StrUtil.isNotBlank(end)) {
startTime = DateUtil.parseDate(start).getTime(); startTime = DateUtil.parseDate(start).getTime();
endTime = DateUtil.parseDate(end).offsetNew(DateField.DAY_OF_MONTH, 1).getTime(); endTime = DateUtil.parseDate(end).offsetNew(DateField.DAY_OF_MONTH, 1).getTime();
} }
try {
iNormProductionService.exportProduction(name, startTime, endTime, groupId, response); iPrecipriceService.exportProduction(name, startTime, endTime, groupId, fileName, response);
}*/ } catch (Exception e) {
log.debug("导出-产值统计-产值统计-总产值统计{}", e);
}
}
} }
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
<select id="exportList" resultType="java.util.HashMap"> <select id="exportList" resultType="java.util.HashMap">
SELECT SELECT
IF(ISNULL(na.id),'',na.id) as 序号, (@i:=@i+1) as 序号,
IF(ISNULL(su.name),'',su.name) as 姓名, IF(ISNULL(su.name),'',su.name) as 姓名,
IF(ISNULL(su.username),'',su.username) as 账户, IF(ISNULL(su.username),'',su.username) as 账户,
IF(ISNULL(na.statistical),'',na.statistical) as 起止时间, IF(ISNULL(na.statistical),'',na.statistical) as 起止时间,
...@@ -58,6 +58,7 @@ ...@@ -58,6 +58,7 @@
)as 状态 )as 状态
FROM nonstandard_apply na FROM nonstandard_apply na
LEFT JOIN sys_user su ON su.id = na.user_id LEFT JOIN sys_user su ON su.id = na.user_id
,(select @i:=0)aa
<include refid="where"/> <include refid="where"/>
order by na.start_time desc order by na.start_time desc
</select> </select>
......
...@@ -40,33 +40,22 @@ ...@@ -40,33 +40,22 @@
<include refid="where"/> <include refid="where"/>
order by na.start_time desc order by na.start_time desc
</select> </select>
<!-- <select id="getByUserId" resultType="cn.wise.sc.cement.business.model.vo.NonStandardValueVo">-->
<!-- select na.*,su.name as name,su.username as account,na.start_time as startTime,su.group_id as groups,sg.name as-->
<!-- groupname-->
<!-- from nonstandard_apply na-->
<!-- LEFT JOIN sys_user su ON su.id = na.user_id-->
<!-- LEFT JOIN sys_group sg ON sg.id = su.group_id-->
<!-- <include refid="where"/>-->
<!-- order by na.id asc-->
<!-- </select>-->
<select id="exportList" resultType="java.util.HashMap"> <select id="exportList" resultType="java.util.HashMap">
SELECT SELECT
IF(ISNULL(na.id),'',na.id) as 序号, (@i:=@i+1) as 序号,
IF(ISNULL(su.name),'',su.name) su.name as 姓名, IF(ISNULL(su.name),'',su.name) as 姓名,
IF(ISNULL(su.username),'',su.username) as 账户, IF(ISNULL(su.username),'',su.username) as 账户,
IF(ISNULL(na.statistical),'',na.statistical) as 起止日期,
IF(ISNULL(na.reported_hours),'',na.reported_hours) as 上报工日, IF(ISNULL(na.reported_hours),'',na.reported_hours) as 上报工日,
IF(ISNULL(na.approval_hours),'',na.approval_hours) as 审批工日, IF(ISNULL(na.approval_hours),'',na.approval_hours) as 审批工日,
IF(ISNULL(na.final_value),'',na.final_value) as 最终产值, IF(ISNULL(na.final_value),'',na.final_value) as 最终产值
IF(ISNULL(na.work_type),'',na.work_type) as 工作类别,
IF(ISNULL(na.work_description),'',na.work_description) as 工作描述,
IF(ISNULL(su.group_id),'',su.group_id) as 部门id,
IF(ISNULL(sg.name),'',sg.name) as 部门名
FROM nonstandard_apply na FROM nonstandard_apply na
left join sys_user su on na.user_id = su.id left join sys_user su on na.user_id = su.id
LEFT JOIN sys_group sg ON sg.id = su.group_id ,(select @i:=0)aa
<include refid="where"/> <include refid="where"/>
order by na.start_time desc order by na.start_time desc
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -39,13 +39,8 @@ public interface INonStandardValueService extends IService<NonStandardValue> { ...@@ -39,13 +39,8 @@ public interface INonStandardValueService extends IService<NonStandardValue> {
*/ */
BaseResponse<List<NonStandardValueVo>> getList(Date start, Date end, Integer groups, String name); BaseResponse<List<NonStandardValueVo>> getList(Date start, Date end, Integer groups, String name);
/**
* 非标产值列表导出
*
* @param filename 文件名
* @param userId 用户id
* @param name 姓名
* @param response
*/
void exportList(String filename, Integer userId, String name, HttpServletResponse response); void exportList(String filename, Integer userId, String name, HttpServletResponse response);
void exportDetailList(Date start, Date end, Integer userId, String name, String filename,HttpServletResponse response);
} }
...@@ -32,6 +32,8 @@ public interface INormProductionService extends IService<NormProduction> { ...@@ -32,6 +32,8 @@ public interface INormProductionService extends IService<NormProduction> {
BaseResponse<IPage<NormProductionVo>> getPage(PageQuery pageQuery, Integer type); BaseResponse<IPage<NormProductionVo>> getPage(PageQuery pageQuery, Integer type);
List<NormProductionVo> getList();
BaseResponse<Integer> activeOrForbidden(Integer id); BaseResponse<Integer> activeOrForbidden(Integer id);
......
...@@ -9,6 +9,8 @@ import cn.wise.sc.cement.business.model.vo.ProductionVo; ...@@ -9,6 +9,8 @@ import cn.wise.sc.cement.business.model.vo.ProductionVo;
import cn.wise.sc.cement.business.model.vo.WorkloadStatisticsVo; import cn.wise.sc.cement.business.model.vo.WorkloadStatisticsVo;
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 javax.servlet.http.HttpServletResponse;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -38,4 +40,16 @@ public interface IPrecipriceService extends IService<Preciprice> { ...@@ -38,4 +40,16 @@ public interface IPrecipriceService extends IService<Preciprice> {
List<ProductionVo> production(String name, Long start, Long end, Integer groupId); List<ProductionVo> production(String name, Long start, Long end, Integer groupId);
boolean updateStatusByEntrustId(Integer entrustId); boolean updateStatusByEntrustId(Integer entrustId);
void exportStatisticsList(String startDate, String endDate, String userName, String fileName, HttpServletResponse response);
void exportStatisticsDetail(String startDate, String endDate, Integer userId, String fileName, HttpServletResponse response);
void exportProduction(String name, Long start, Long end, Integer groupId, String fileName, HttpServletResponse response);
} }
package cn.wise.sc.cement.business.service.impl; package cn.wise.sc.cement.business.service.impl;
import cn.wise.sc.cement.business.entity.NonStandardValue; import cn.wise.sc.cement.business.entity.NonStandardValue;
import cn.wise.sc.cement.business.entity.SysUser;
import cn.wise.sc.cement.business.mapper.NonStandardValueMapper; import cn.wise.sc.cement.business.mapper.NonStandardValueMapper;
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.NonStandardApplyVo; import cn.wise.sc.cement.business.model.vo.NonStandardApplyVo;
import cn.wise.sc.cement.business.model.vo.NonStandardValueVo; import cn.wise.sc.cement.business.model.vo.NonStandardValueVo;
import cn.wise.sc.cement.business.service.INonStandardValueService; import cn.wise.sc.cement.business.service.INonStandardValueService;
import cn.wise.sc.cement.business.service.ISysUserService;
import cn.wise.sc.cement.business.util.ExcelUtil; import cn.wise.sc.cement.business.util.ExcelUtil;
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;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
...@@ -33,6 +37,8 @@ public class NonStandardValueServiceImpl extends ServiceImpl<NonStandardValueMap ...@@ -33,6 +37,8 @@ public class NonStandardValueServiceImpl extends ServiceImpl<NonStandardValueMap
@Resource @Resource
private NonStandardValueMapper nonStandardValueMapper; private NonStandardValueMapper nonStandardValueMapper;
@Autowired
private ISysUserService userService;
@Override @Override
public BaseResponse<IPage<NonStandardValueVo>> getPage(PageQuery pageQuery, Integer userId, String name,Date start, Date end) { public BaseResponse<IPage<NonStandardValueVo>> getPage(PageQuery pageQuery, Integer userId, String name,Date start, Date end) {
...@@ -47,18 +53,6 @@ public class NonStandardValueServiceImpl extends ServiceImpl<NonStandardValueMap ...@@ -47,18 +53,6 @@ public class NonStandardValueServiceImpl extends ServiceImpl<NonStandardValueMap
return BaseResponse.okData(pages); return BaseResponse.okData(pages);
} }
// public BaseResponse<List<NonStandardValue>> userValue(Date start, Date end,Integer userId){
// List<NonStandardValueVo> data = getList(start, end, userId).getData();
// List<NonStandardValue> rts = new ArrayList<>();
// NonStandardValue finalNonStandardValue = new NonStandardValue();
// finalNonStandardValue.setFinalValue(0D);
// for (NonStandardValueVo nonStandardValueVo:data){
// Double newFinalValue = nonStandardValueVo.getFinalValue() + finalNonStandardValue.getFinalValue();
// finalNonStandardValue.setFinalValue(newFinalValue);
// }
// rts.add(finalNonStandardValue);
// return BaseResponse.okData(rts);
// }
@Override @Override
//计算每个用户提交的非标产值 //计算每个用户提交的非标产值
...@@ -139,13 +133,7 @@ public class NonStandardValueServiceImpl extends ServiceImpl<NonStandardValueMap ...@@ -139,13 +133,7 @@ public class NonStandardValueServiceImpl extends ServiceImpl<NonStandardValueMap
return BaseResponse.okData(rts); return BaseResponse.okData(rts);
} }
// @Override
// public BaseResponse<List<NonStandardValueVo>> getByUserId(Integer userId) {
// Map<String, Object> params = new HashMap<>();
// params.put("userId", userId);
// List<NonStandardValueVo> list = nonStandardValueMapper.getByUserId(params);
// return BaseResponse.okData(list);
// }
@Override @Override
public BaseResponse<List<NonStandardValueVo>> getList(Date start, Date end, Integer groups,String name) { public BaseResponse<List<NonStandardValueVo>> getList(Date start, Date end, Integer groups,String name) {
...@@ -159,8 +147,16 @@ public class NonStandardValueServiceImpl extends ServiceImpl<NonStandardValueMap ...@@ -159,8 +147,16 @@ public class NonStandardValueServiceImpl extends ServiceImpl<NonStandardValueMap
return BaseResponse.okData(list); return BaseResponse.okData(list);
} }
/**
* 导出-产值统计-非标产值-信息列表
* @param filename 文件名
* @param userId 用户id
* @param name 姓名
* @param response
*/
@Override @Override
public void exportList(String filename, Integer userId, String name, HttpServletResponse response) { public void exportList(String filename, Integer userId, String name, HttpServletResponse response) {
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("userId", userId); params.put("userId", userId);
params.put("name", name); params.put("name", name);
...@@ -168,19 +164,13 @@ public class NonStandardValueServiceImpl extends ServiceImpl<NonStandardValueMap ...@@ -168,19 +164,13 @@ public class NonStandardValueServiceImpl extends ServiceImpl<NonStandardValueMap
if (!CollectionUtils.isEmpty(list)) { if (!CollectionUtils.isEmpty(list)) {
Map<String, Object> map = list.get(0); Map<String, Object> map = list.get(0);
String[] headers = new String[11]; String[] headers = new String[6];
headers[0] = "序号"; headers[0] = "序号";
headers[1] = "姓名"; headers[1] = "姓名";
headers[2] = "账户"; headers[2] = "账户";
headers[3] = "起止日期"; headers[3] = "上报工日";
headers[4] = "上报工日"; headers[4] = "审批工日";
headers[5] = "审批工日"; headers[5] = "最终产值";
headers[6] = "最终产值";
headers[7] = "工作类别";
headers[8] = "工作描述";
headers[9] = "部门id";
headers[10] = "部门名";
List<Object[]> datas = new ArrayList<>(list.size()); List<Object[]> datas = new ArrayList<>(list.size());
for (Map<String, Object> m : list) { for (Map<String, Object> m : list) {
Object[] objects = new Object[headers.length]; Object[] objects = new Object[headers.length];
...@@ -199,4 +189,55 @@ public class NonStandardValueServiceImpl extends ServiceImpl<NonStandardValueMap ...@@ -199,4 +189,55 @@ public class NonStandardValueServiceImpl extends ServiceImpl<NonStandardValueMap
datas, response); datas, response);
} }
} }
/**
* 导出-产值统计-非标产值-详情信息列表
* @param start
* @param end
* @param userId
* @param name
* @param filename
* @param response
*/
@Override
public void exportDetailList(Date start, Date end, Integer userId, String name, String filename,HttpServletResponse response) {
Assert.notNull(userId, "用户id不能为空!");
SysUser sysUser = userService.getById(userId);
Map<String, Object> params = new HashMap<>();
params.put("start", start);
params.put("end", end);
params.put("userId", userId);
params.put("name", name);
params.put("status",2);
List<NonStandardValueVo> list = nonStandardValueMapper.getList(params);
if (!CollectionUtils.isEmpty(list)) {
String[] headers = new String[7];
headers[0] = "序号";
headers[1] = "姓名";
headers[2] = "工作类型";
headers[3] = "工作描述";
headers[4] = "上报工日";
headers[5] = "审批工日";
headers[6] = "最终产值";
List<Object[]> datas = new ArrayList<>(list.size());
int i = 0;
for (NonStandardValueVo target : list) {
Object[] objs = new Object[7];
objs[0] = i++;
objs[1] = target.getName();
objs[2] = target.getWorkType();
objs[3] = target.getWorkDescription();
objs[4] = target.getReportedHours();
objs[5] = target.getApprovalHours();
objs[6] = target.getFinalValue();
datas.add(objs);
}
ExcelUtil.excelExport(
filename == null || filename.trim().length() <= 0 ? "非标产值-"+sysUser.getName() : filename, headers,
datas, response);
}
}
} }
...@@ -128,6 +128,7 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper, ...@@ -128,6 +128,7 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper,
} }
//如果是处理项 只能添加一次 //如果是处理项 只能添加一次
if(normProduction.getType() == 0){ if(normProduction.getType() == 0){
normProduction.setAssessId(null);
//判断配置项目是否已存在 //判断配置项目是否已存在
QueryWrapper<NormProduction> qw = new QueryWrapper<>(); QueryWrapper<NormProduction> qw = new QueryWrapper<>();
qw.eq("type", normProduction.getType()); qw.eq("type", normProduction.getType());
...@@ -225,6 +226,7 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper, ...@@ -225,6 +226,7 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper,
//如果是处理项 只能添加一次 //如果是处理项 只能添加一次
if(normProduction.getType() == 0){ if(normProduction.getType() == 0){
normProduction.setAssessId(null);
//判断配置项目是否已存在 //判断配置项目是否已存在
QueryWrapper<NormProduction> qw = new QueryWrapper<>(); QueryWrapper<NormProduction> qw = new QueryWrapper<>();
qw.eq("type", normProduction.getType()); qw.eq("type", normProduction.getType());
...@@ -373,6 +375,69 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper, ...@@ -373,6 +375,69 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper,
return BaseResponse.okData(rts); return BaseResponse.okData(rts);
} }
/**
* 产值配置列表
* @return
*/
@Override
public List<NormProductionVo> getList() {
QueryWrapper<NormProduction> qw = new QueryWrapper<>();
//关联名字
List<NormProduction> normProductions = this.list(qw);
List<Integer> npTeamGroupIds = new ArrayList<>(normProductions.size());
List<Integer> npTeamIds = new ArrayList<>(normProductions.size());
normProductions.forEach(arg -> {
if(arg.getType() == 1) {
npTeamGroupIds.add(arg.getAssessId());
}else if(arg.getType() == 2) {
npTeamIds.add(arg.getAssessId());
}
});
List<TeamGroup> teamGroups = new ArrayList<>();
if (npTeamGroupIds.size() != 0) {
teamGroups = iTeamGroupService.listByIds(npTeamGroupIds);
}
List<Team> teams = new ArrayList<>();
if (npTeamIds.size() != 0) {
teams = iTeamService.listByIds(npTeamIds);
}
List<NormProductionVo> records = new ArrayList<>();
List<TeamGroup> finalTeamGroups = teamGroups;
List<Team> finalTeams = teams;
normProductions.forEach(arg -> {
NormProductionVo normProductionVo = new NormProductionVo();
BeanUtil.copyProperties(arg, normProductionVo);
normProductionVo.setAssessName("/");
if (arg.getType() == 0) {
normProductionVo.setAssessName("处理项");
} else if(arg.getType() == 1) {
finalTeamGroups.stream()
.filter(opt -> opt.getId().intValue() == arg.getAssessId())
.findFirst()
.ifPresent(opt -> normProductionVo.setAssessName(opt.getName()));
} else if(arg.getType() == 2) {
finalTeams.stream()
.filter(opt -> opt.getId().intValue() == arg.getAssessId())
.findFirst()
.ifPresent(opt -> normProductionVo.setAssessName(opt.getName()));
}
if (arg.getType() == 0) {
normProductionVo.setType("处理项");
}else if(arg.getType() == 1) {
normProductionVo.setType("检测组");
}else if(arg.getType() == 2) {
normProductionVo.setType("检测项");
}
records.add(normProductionVo);
});
return records;
}
/** /**
* 启用禁用标准产值 * 启用禁用标准产值
* @param id id * @param id id
...@@ -395,6 +460,4 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper, ...@@ -395,6 +460,4 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper,
} }
} }
...@@ -10,10 +10,7 @@ import cn.wise.sc.cement.business.mapper.*; ...@@ -10,10 +10,7 @@ import cn.wise.sc.cement.business.mapper.*;
import cn.wise.sc.cement.business.model.BaseResponse; import cn.wise.sc.cement.business.model.BaseResponse;
import cn.wise.sc.cement.business.model.LoginUser; import cn.wise.sc.cement.business.model.LoginUser;
import cn.wise.sc.cement.business.model.PageQuery; import cn.wise.sc.cement.business.model.PageQuery;
import cn.wise.sc.cement.business.model.vo.EntrustVo; import cn.wise.sc.cement.business.model.vo.*;
import cn.wise.sc.cement.business.model.vo.NormProductionStatisticsVo;
import cn.wise.sc.cement.business.model.vo.ProductionVo;
import cn.wise.sc.cement.business.model.vo.WorkloadStatisticsVo;
import cn.wise.sc.cement.business.service.*; import cn.wise.sc.cement.business.service.*;
import cn.wise.sc.cement.business.util.ExcelUtil; import cn.wise.sc.cement.business.util.ExcelUtil;
import cn.wise.sc.cement.business.util.PageUtil; import cn.wise.sc.cement.business.util.PageUtil;
...@@ -36,14 +33,7 @@ import java.time.LocalDate; ...@@ -36,14 +33,7 @@ import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneId; import java.time.ZoneId;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.*;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -81,6 +71,9 @@ public class PrecipriceServiceImpl extends ServiceImpl<PrecipriceMapper, Precipr ...@@ -81,6 +71,9 @@ public class PrecipriceServiceImpl extends ServiceImpl<PrecipriceMapper, Precipr
private NonStandardApplyMapper nonStandardApplyMapper; private NonStandardApplyMapper nonStandardApplyMapper;
@Autowired @Autowired
private INonStandardValueService nonStandardValueService; private INonStandardValueService nonStandardValueService;
@Autowired
private INormProductionService normProductionService;
/** /**
* 计算产值 * 计算产值
...@@ -258,6 +251,50 @@ public class PrecipriceServiceImpl extends ServiceImpl<PrecipriceMapper, Precipr ...@@ -258,6 +251,50 @@ public class PrecipriceServiceImpl extends ServiceImpl<PrecipriceMapper, Precipr
return BaseResponse.okData(productionStatistics); return BaseResponse.okData(productionStatistics);
} }
/**
* 导出-产值统计-标准产值-列表
* @param startDate
* @param endDate
* @param userName
*/
@Override
public void exportStatisticsList(String startDate, String endDate, String userName, String fileName, HttpServletResponse response) {
BaseResponse<List<NormProductionStatisticsVo>> listBaseResponse = statisticsList(startDate, endDate, userName);
if (listBaseResponse.getCode() == 200) {
List<NormProductionStatisticsVo> data = listBaseResponse.getData();
if (CollectionUtil.isNotEmpty(data)) {
String[] headers = new String[6];
headers[0] = "序号";
headers[1] = "姓名";
headers[2] = "账户";
headers[3] = "性别";
headers[4] = "检测项目数";
headers[5] = "产值绩效";
List<Object[]> exportData = new ArrayList<>(data.size());
int i=0;
for (NormProductionStatisticsVo vo : data) {
Object[] objs = new Object[headers.length];
objs[0] = i++;
objs[1] = vo.getUserName();
objs[2] = vo.getAccount();
objs[3] = vo.getSex();
objs[4] = vo.getCount();
objs[5] = vo.getCoefficient();
exportData.add(objs);
}
ExcelUtil.excelExport(
fileName == null || fileName.trim().length() <= 0 ? "标准产值统计": fileName, headers,
exportData, response);
}
}
}
/** /**
* 产值统计-标准产值-个人详情 * 产值统计-标准产值-个人详情
* @param pageQuery * @param pageQuery
...@@ -349,6 +386,145 @@ public class PrecipriceServiceImpl extends ServiceImpl<PrecipriceMapper, Precipr ...@@ -349,6 +386,145 @@ public class PrecipriceServiceImpl extends ServiceImpl<PrecipriceMapper, Precipr
return BaseResponse.okData(new Page<>()); return BaseResponse.okData(new Page<>());
} }
/**
* 导出-产值统计-标准产值-个人详情
* @param startDate
* @param endDate
* @param userId
* @param fileName
* @param response
*/
@Override
public void exportStatisticsDetail(String startDate, String endDate, Integer userId, String fileName, HttpServletResponse response) {
Assert.notNull(userId, "用户id不能为空!");
SysUser sysUser = userService.getById(userId);
QueryWrapper<Preciprice> qw = new QueryWrapper<>();
if (StrUtil.isNotBlank(startDate)) {
qw.gt("create_time", DateUtil.parseDate(startDate).getTime());
}
if (StrUtil.isNotBlank(endDate)) {
qw.le("create_time", DateUtil.parseDate(endDate).getTime());
}
if (!BeanUtil.isEmpty(userId)) {
qw.eq("user_id", userId);
}
qw.eq("status", 1);
qw.orderByDesc("create_time");
List<Preciprice> list = this.list(qw);
List<NormProduction.NormProductionUserDetail> rts = new ArrayList<>(list.size());
//处理项
List<Preciprice> handlelist =list.stream().filter(arg ->(arg.getType()==0)).collect(Collectors.toList());
if(handlelist != null && handlelist.size()>0){
NormProduction.NormProductionUserDetail UserDetailRts = new NormProduction.NormProductionUserDetail();
UserDetailRts.setType(0);
UserDetailRts.setUserName(sysUser.getName());
UserDetailRts.setObjId(null);
UserDetailRts.setObjName("处理项");
UserDetailRts.setCountNums(handlelist.size());
UserDetailRts.setCountPricel(handlelist.stream().map(Preciprice::getPreciprice).reduce(BigDecimal.ZERO,BigDecimal::add));
rts.add(UserDetailRts);
}
//检测组
List<Preciprice> teamGrouplist = list.stream().filter(arg ->(arg.getType()==1)).collect(Collectors.toList());
if(teamGrouplist != null && teamGrouplist.size()>0){
Map<Integer, List<Preciprice>> mapByGroupId = teamGrouplist.stream().collect(Collectors.groupingBy(Preciprice::getTargetId, Collectors.toList()));
for(Map.Entry<Integer, List<Preciprice>> entry : mapByGroupId.entrySet()){
NormProduction.NormProductionUserDetail UserDetailRts = new NormProduction.NormProductionUserDetail();
UserDetailRts.setType(1);
UserDetailRts.setUserName(sysUser.getName());
UserDetailRts.setObjId(entry.getKey());
UserDetailRts.setObjName(entry.getValue().get(0).getGroupTeamName());
UserDetailRts.setCountNums(entry.getValue().size());
UserDetailRts.setCountPricel(entry.getValue().stream().map(Preciprice::getPreciprice).reduce(BigDecimal.ZERO,BigDecimal::add));
rts.add(UserDetailRts);
}
}
//检测项
List<Preciprice> teamlist = list.stream().filter(arg ->(arg.getType()==2)).collect(Collectors.toList());
if(teamlist != null && teamlist.size()>0){
Map<Integer, List<Preciprice>> mapByTeamId = teamGrouplist.stream().collect(Collectors.groupingBy(Preciprice::getTargetId, Collectors.toList()));
for(Map.Entry<Integer, List<Preciprice>> entry : mapByTeamId.entrySet()){
NormProduction.NormProductionUserDetail UserDetailRts = new NormProduction.NormProductionUserDetail();
UserDetailRts.setType(2);
UserDetailRts.setUserName(sysUser.getName());
UserDetailRts.setObjId(entry.getKey());
UserDetailRts.setObjName(entry.getValue().get(0).getGroupTeamName());
UserDetailRts.setCountNums(entry.getValue().size());
UserDetailRts.setCountPricel(entry.getValue().stream().map(Preciprice::getPreciprice).reduce(BigDecimal.ZERO,BigDecimal::add));
rts.add(UserDetailRts);
}
}
List<NormProductionVo> normProductions = normProductionService.getList();
if (CollectionUtil.isNotEmpty(rts)) {
String[] headers = new String[14];
headers[0] = "序号";
headers[1] = "姓名";
headers[2] = "检测项目";
headers[3] = "数量";
headers[4] = "合计";
headers[5] = "产值设置:";
headers[6] = "额定工日";
headers[7] = "报出对应分析结果";
headers[8] = "建议系数";
headers[9] = "考核工值";
headers[10] = "分析占比";
headers[11] = "分样占比";
headers[12] = "校核占比";
headers[13] = "报结果占比";
List<Object[]> exportData = new ArrayList<>(rts.size());
int i=0;
for (NormProduction.NormProductionUserDetail target : rts) {
Object[] objs = new Object[14];
objs[0] = i++;
objs[1] = target.getUserName();
objs[2] = target.getObjName();
objs[3] = target.getCountNums();
objs[4] = target.getCountPricel();
// objs[5] = "";
NormProductionVo vo = null;
if(target.getType() == 0){
vo =normProductions.stream()
.filter(arg -> (arg.getType().equals("处理项") && arg.getAssessId()==null)).findFirst().get();
}else if(target.getType() == 1){
vo =normProductions.stream()
.filter(arg -> (arg.getType().equals("检测组") && arg.getAssessId().equals(target.getObjId()))).findFirst().get();
}else if(target.getType() == 2){
vo =normProductions.stream()
.filter(arg -> (arg.getType().equals("检测项") && arg.getAssessId().equals(target.getObjId()))).findFirst().get();
}
if(vo != null){
objs[6] = vo.getQuotaDay();
objs[7] = vo.getReportedAnalyseResult();
objs[8] = vo.getCoefficient();
objs[9] = vo.getAssessValue();
objs[10] = vo.getAnalyseRate();
objs[11] = vo.getSeparateRate();
objs[12] = vo.getAssessRate();
objs[13] = vo.getReportedResultRate();
}
exportData.add(objs);
}
ExcelUtil.excelExport(fileName == null || fileName.trim().length() <= 0 ? "标准产值详情-"+sysUser.getName(): fileName , headers, exportData, response);
}
}
/** /**
* 产值统计-标准产值-个人详情-检测项目详情 * 产值统计-标准产值-个人详情-检测项目详情
...@@ -478,6 +654,50 @@ public class PrecipriceServiceImpl extends ServiceImpl<PrecipriceMapper, Precipr ...@@ -478,6 +654,50 @@ public class PrecipriceServiceImpl extends ServiceImpl<PrecipriceMapper, Precipr
return rts; return rts;
} }
/**
* 导出-产值统计-产值统计-总产值统计
* @param name
* @param start
* @param end
* @param groupId
* @param fileName
* @param response
*/
@Override
public void exportProduction(String name, Long start, Long end, Integer groupId, String fileName, HttpServletResponse response) {
List<ProductionVo> list = production(name, start, end, groupId);
list.stream()
.forEach(arg -> {
arg.setId(Integer.valueOf(arg.getUserId()));
arg.setProductionTotalValue(arg.getProductionValue() + arg.getNonProductionValue());
});
List<ProductionVo> data = list.stream().sorted(Comparator.comparing(ProductionVo::getId)).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(data)) {
String[] headers = new String[6];
headers[0] = "序号";
headers[1] = "姓名";
headers[2] = "账户";
headers[3] = "标准产值";
headers[4] = "非标准产值";
headers[5] = "产值统计";
List<Object[]> exportData = new ArrayList<>(data.size());
int i = 0;
for (ProductionVo target : data) {
Object[] objs = new Object[6];
objs[0] = i++;
objs[1] = target.getUserName();
objs[2] = target.getAccount();
objs[3] = target.getProductionValue();
objs[4] = target.getNonProductionValue();
objs[5] = target.getProductionTotalValue();
exportData.add(objs);
}
ExcelUtil.excelExport(fileName == null || fileName.trim().length() <= 0 ? "产值统计": fileName , headers, exportData, response);
}
}
/** /**
* 根据报告id更新 * 根据报告id更新
......
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