Commit e2d755af authored by xinglei's avatar xinglei

修改bug

parent 51694ad2
......@@ -1175,7 +1175,7 @@ public class CheckServiceImpl implements ICheckService {
if (!stateMap.containsKey(finalSp[i])) {
properties.put(finalSp[i], "");
} else {
properties.put(finalSp[i], CheckStatusEnum.getEnum(stateMap.get(finalSp[i]).toString()).getName());
properties.put(finalSp[i], stateMap.get(finalSp[i]));
}
}
try {
......@@ -1236,10 +1236,11 @@ public class CheckServiceImpl implements ICheckService {
sheet.addMergedRegion(new CellRangeAddress(1, 1, 0, mergeNum));
//第一行
String title = String.format("%s %s 每日巡检情况表", companyName, linkMap.get("departmentName").toString());
PoiUtil.setTitleValue(sheet.createRow(rowNum++), title, headerStyle);
String title1 = String.format("%s %s 每日巡检情况表", companyName, linkMap.get("departmentName").toString());
String title2 = String.format("巡检人:____________ 日期:%s 至 %s", param.getBeginDate(), param.getEndDate());
PoiUtil.setTitleValue(sheet.createRow(rowNum++), title1, headerStyle);
//第二行
PoiUtil.setTitleValue(sheet.createRow(rowNum++), "巡检人:____________ 日期: ___年___月___日至___日", headerStyle);
PoiUtil.setTitleValue(sheet.createRow(rowNum++), title2, headerStyle);
HSSFRow row = sheet.createRow(rowNum++);
HSSFCell cell = null;
......@@ -1260,6 +1261,11 @@ public class CheckServiceImpl implements ICheckService {
//PoiUtil.exportLocal(wb, "D:/upload", "机构客户信息表.xls");
}
/**
* 返回时间-状态Map
* @param idState
* @return
*/
private Map<String, Object> getStateMap(String idState) {
Map<String, Object> idStateMap = Maps.newHashMap();
if (ObjectUtils.isEmpty(idState)) {
......@@ -1268,8 +1274,12 @@ public class CheckServiceImpl implements ICheckService {
String[] split = idState.split(",");
for (int i = 0; i < split.length; i++) {
String[] sp = split[i].split("_");
if (ObjectUtils.isEmpty(sp[1])) {//文本类的输入值
idStateMap.put(sp[0], CheckStatusEnum.getEnum(sp[2]).getName());
} else {
idStateMap.put(sp[0], sp[1]);
}
}
return idStateMap;
}
......@@ -1403,7 +1413,7 @@ public class CheckServiceImpl implements ICheckService {
cell3.setCellValue(checkInputBo.getInputItemName());
cell3.setCellStyle(alignLeftStyle);
HSSFCell cell4 = row.createCell(4);
if ("选择".equals(checkInputBo.getItemType())){
if ("选择".equals(checkInputBo.getItemType()) && ObjectUtils.isEmpty(checkInputBo.getInputValue())) {
cell4.setCellValue(checkInputBo.getIsOK());
} else {
cell4.setCellValue(checkInputBo.getInputValue());
......
......@@ -707,4 +707,16 @@ public class DateUtil {
public static String splitDate(String Date){
return Date.substring(11, Date.length());
}
/**
* 当前日期毫秒.xls
*
* @return
*/
public static String formatName() {
Calendar calen = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddhhmmss");
String name = sdf.format(calen.getTime());
return name;
}
}
......@@ -10,6 +10,7 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URLEncoder;
/**
* @Author: xinglei
......@@ -81,6 +82,31 @@ public class PoiUtil {
}
/**
* 导出(前端导出,带文件名)
*/
public static void exportFile( HSSFWorkbook wb, String fileName, HttpServletResponse response) {
OutputStream out = null;
try {
out = response.getOutputStream();
String name = URLEncoder.encode(fileName, "UTF-8");
response.setCharacterEncoding("UTF-8");
response.setContentType("application/force-download");
response.setHeader("Content-Disposition", "attachment;filename=" + name + ".xls");
wb.write(out);
out.close();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (out != null) {
try {
out.close();
} catch (Exception e2) {
}
}
}
}
/**
* 导出(本地导出,测试用)
*/
public static void exportLocal(HSSFWorkbook wb, String path, String name) {
......
package com.yeejoin.amos.patrol.service.core.util;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
......@@ -12,7 +17,6 @@ import static com.yeejoin.amos.patrol.service.constants.XJConstant.JOINT;
* 字符串工具类
*
* @author as-youjun
*
*/
public class StringUtil {
......@@ -58,6 +62,7 @@ public class StringUtil {
/**
* 判断是否数字表示
* 源字符串
*
* @return 是否数字的标志
*/
public static boolean isNumeric(String str) {
......@@ -89,7 +94,7 @@ public class StringUtil {
/**
* 截取前后都不是0的数字字符串
*
* <p>
* 12010102 => 12010102 12010100 => 120101 ab1201100b => 12011
*
* @param str
......@@ -106,7 +111,6 @@ public class StringUtil {
}
/**
*
* <pre>
* 移除字符串后面的0
* </pre>
......@@ -161,4 +165,21 @@ public class StringUtil {
String str = str1 + JOINT + str2;
return str;
}
/**
* List去重
*
* @param list
* @return
*/
public static List getNewList(List<String> list) {
Set set = new HashSet();
List newList = new ArrayList();
for (String cd : list) {
if (!ObjectUtils.isEmpty(cd) && set.add(cd)) {
newList.add(cd);
}
}
return newList;
}
}
......@@ -173,6 +173,7 @@
ci.id checkInputId,
ci.input_id inputId,
ci.input_value AS InputValue,
pc.order_no orderNo,
(
CASE ci.is_ok
WHEN 1 THEN
......@@ -185,8 +186,8 @@
) AS IsOK,
ii.`name` AS inputItemName,
ii.item_type as itemType,
c.id checkId,
c.upload_time AS UploadTime,
u.`name` AS RealName,
ci.score AS Score,
ci.point_classify_id classifyId,
ci.point_classify_name classifyName,
......@@ -205,21 +206,23 @@
p_check_input ci
LEFT JOIN p_input_item ii ON ci.input_id = ii.id
LEFT JOIN p_check c ON ci.check_id = c.id
LEFT JOIN s_user u ON c.user_id = u.id
LEFT JOIN p_point p ON c.point_id = p.id
LEFT JOIN p_plan_task_detail ptd ON c.plan_task_detail_id = ptd.id
LEFT JOIN p_plan_task pt ON pt.id = ptd.task_no
LEFT JOIN p_point_classify pc on pc.id = ci.point_classify_id
<trim prefix="WHERE" prefixOverrides="AND ">
<if test="beginDate!=null and endDate!=null">and c.check_time BETWEEN #{beginDate} and #{endDate}</if>
<if test="orgCode!=null">and c.org_Code like concat(#{orgCode},"%")</if>
<if test="departmentId!=null">and c.dep_id = #{departmentId}</if>
</trim>
GROUP BY inputId, classifyId, beginTime
GROUP BY inputId, classifyId, beginTime, checkInputId
ORDER BY
beginTime is null,
beginTime ASC,
pointId ASC,
classifyId ASC
planTaskId ASC,
checkDate ASC,
orderNo ASC
</when>
<otherwise>
select
......@@ -234,10 +237,11 @@
c.upload_time AS UploadTime,
pt.id planTaskId,
pt.begin_time beginTime,
GROUP_CONCAT(DISTINCT pt.begin_time, '_', ci.is_ok) as idStateStr,
GROUP_CONCAT(DISTINCT pt.begin_time, '_', IFNULL(ci.input_value,''), '_', ci.is_ok) as idStateStr,
ci.id checkInputId,
ci.input_id inputId,
ci.input_value AS InputValue,
pc.order_no orderNo,
(
CASE ci.is_ok
WHEN 1 THEN
......@@ -259,6 +263,7 @@
LEFT JOIN p_check_input ci ON c.id = ci.check_id
LEFT JOIN p_input_item ii ON ci.input_id = ii.id
LEFT JOIN p_plan_task pt ON pt.id = ptd.task_no
LEFT JOIN p_point_classify pc on pc.id = ci.point_classify_id
<trim prefix="WHERE" prefixOverrides="AND ">
<if test="beginDate!=null and endDate!=null">and c.check_time BETWEEN #{beginDate} and #{endDate}</if>
<if test="orgCode!=null">and c.org_Code like concat(#{orgCode},"%")</if>
......@@ -266,7 +271,7 @@
and (pt.id is NOT NULL or pt.id = '')
</trim>
group by pointId, inputId, classifyId
order BY pointId, classifyId
order BY pointId, orderNo ASC, classifyId
</otherwise>
</choose>
</select>
......@@ -981,7 +986,7 @@
'漏检'
END
) AS IsOK,
ii.`name` AS NAME,
ii.`name` AS inputItemName,
c.upload_time AS UploadTime,
u.`name` AS RealName,
ci.score AS Score,
......@@ -1912,8 +1917,8 @@
LEFT JOIN p_route r ON r.id = pnt.route_id
LEFT JOIN p_check c ON c.plan_task_detail_id = ptd.id
WHERE pnt.org_code LIKE CONCAT(#{orgCode}, '%')
<if test="startTime !=null and startTime!= '' "> <![CDATA[ AND pnt.check_date >= #{startTime} ]]> </if>
<if test="endTime !=null and endTime!='' "><![CDATA[AND pnt.check_date <= #{endTime} ]]></if>
<if test="startTime !=null and startTime!= '' "> <![CDATA[ AND pnt.begin_time >= #{startTime} ]]> </if>
<if test="endTime !=null and endTime!='' "><![CDATA[AND pnt.begin_time <= #{endTime} ]]></if>
GROUP BY ptd.id
) a
GROUP BY
......@@ -1992,8 +1997,8 @@
</when>
</choose>
<if test="isOk !=null and isOk != '' ">and c.isOk = #{isOk}</if>
<if test="startTime !=null and startTime!= '' "> <![CDATA[ AND pnt.check_date >= #{startTime} ]]> </if>
<if test="endTime !=null and endTime!='' "><![CDATA[AND pnt.check_date <= #{endTime} ]]></if>
<if test="startTime !=null and startTime!= '' "> <![CDATA[ AND pnt.begin_time >= #{startTime} ]]> </if>
<if test="endTime !=null and endTime!='' "><![CDATA[AND pnt.begin_time <= #{endTime} ]]></if>
GROUP BY
pnt.id
) a
......
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