liupeng 4 years ago
parent
commit
ae58362036

+ 1 - 4
code/sapparent/sapcms/src/main/java/org/fouram/controller/ApiController.java

@@ -33,7 +33,6 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.ResponseBody;
 
-import com.alibaba.fastjson.JSON;
 import com.google.common.collect.Maps;
 
 import me.chanjar.weixin.cp.bean.WxCpOauth2UserInfo;
@@ -268,9 +267,7 @@ public class ApiController extends BaseController {
 			String hzFilePath = "/public/excel/userReport" + DateUtil.getTimeStamp() + ".xlsx";
 			List<Map<String, Object>> hzList = sapCheckService.selectReportDayList(dto.getStartDate(), dto.getEndDate(),
 					dto.getDepartId(), dto.getName());
-			LoggerUtil.info("hz:" + hzList.size());
-			LoggerUtil.info("hz:" + JSON.toJSONString(hzList.get(0)));
-			ExcelExportUtil.exportExcelFile(getRootPath() + ysFilePath, hzList, getRootPath() + hzFilePath, 1, 0);
+			ExcelExportUtil.exportExcelFile(getRootPath() + ysFilePath, hzList, getRootPath() + hzFilePath, 0, 0);
 			ysFilePath = hzFilePath;
 			// 明细
 			String resultFilePath = "/public/excel/userReport" + DateUtil.getTimeStamp() + ".xlsx";

+ 16 - 1
code/sapparent/sapservice/src/main/java/org/fouram/service/SapCheckService.java

@@ -17,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import com.alibaba.fastjson.JSONObject;
+import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.google.common.collect.Sets;
 
@@ -253,7 +254,21 @@ public class SapCheckService extends BaseService {
 		pd.put("departId", departId);
 		pd.put("name", name);
 		pd.put("reportDaySql", getReportDaySql(startDate, endDate));
-		return (List<Map<String, Object>>) findList("SapCheckMapper.selectReportDayList", pd);
+
+//		公司 部门 工号	姓名5月25日	5月26日	5月27日	5月28日	5月29日
+		List<String> days = DateUtil.getSubDateList(startDate, endDate);
+		Map<String, Object> headerMap = Maps.newHashMap();
+		headerMap.put("A", "公司");
+		headerMap.put("A", "部门");
+		headerMap.put("A", "工号");
+		headerMap.put("A", "姓名");
+		for (String day : days) {
+			headerMap.put(day, day);
+		}
+		List<Map<String, Object>> result = Lists.newArrayList(headerMap);
+		List<Map<String, Object>> list = (List<Map<String, Object>>) findList("SapCheckMapper.selectReportDayList", pd);
+		list.stream().forEach(check -> result.add(check));
+		return result;
 	}
 
 	private String getReportDaySql(String startDate, String endDate) throws Exception {