Commit f57d7759 authored by xinglei's avatar xinglei

*)修改bug

parent c7e8b237
...@@ -14,7 +14,7 @@ public interface IPointClassifyDao extends BaseDao<PointClassify, Long> { ...@@ -14,7 +14,7 @@ public interface IPointClassifyDao extends BaseDao<PointClassify, Long> {
@Modifying @Modifying
@Transactional @Transactional
@Query(value = "select * from p_point_classify where point_id = ?1", nativeQuery = true) @Query(value = "select * from p_point_classify where point_id = ?1 order by order_no", nativeQuery = true)
List<PointClassify> getPointClassifyByPointId(long id); List<PointClassify> getPointClassifyByPointId(long id);
@Modifying @Modifying
......
...@@ -30,6 +30,7 @@ import com.yeejoin.amos.patrol.service.core.util.DateUtil; ...@@ -30,6 +30,7 @@ import com.yeejoin.amos.patrol.service.core.util.DateUtil;
import com.yeejoin.amos.patrol.service.core.util.PoiUtil; import com.yeejoin.amos.patrol.service.core.util.PoiUtil;
import com.yeejoin.amos.patrol.service.core.util.ReflectUtil; import com.yeejoin.amos.patrol.service.core.util.ReflectUtil;
import com.yeejoin.amos.patrol.service.core.util.StringUtil; import com.yeejoin.amos.patrol.service.core.util.StringUtil;
import com.yeejoin.amos.patrol.service.exception.YeeException;
import com.yeejoin.amos.patrol.service.remote.RemoteSecurityService; import com.yeejoin.amos.patrol.service.remote.RemoteSecurityService;
import net.sf.json.JSONArray; import net.sf.json.JSONArray;
import net.sf.json.JSONObject; import net.sf.json.JSONObject;
...@@ -121,7 +122,7 @@ public class CheckServiceImpl implements ICheckService { ...@@ -121,7 +122,7 @@ public class CheckServiceImpl implements ICheckService {
//deptMap = deptList.stream().collect(Collectors.toMap(DepartmentModel::getSequenceNbr, DepartmentModel::getDepartmentName)); //deptMap = deptList.stream().collect(Collectors.toMap(DepartmentModel::getSequenceNbr, DepartmentModel::getDepartmentName));
for (int i = 0; i < deptList.size(); i++) { for (int i = 0; i < deptList.size(); i++) {
deptMap.put(deptList.get(i).get("sequenceNbr").toString(), deptList.get(i).get("departmentName").toString()); deptMap.put(String.valueOf(deptList.get(i).get("sequenceNbr")), String.valueOf(deptList.get(i).get("departmentName")));
} }
...@@ -166,11 +167,11 @@ public class CheckServiceImpl implements ICheckService { ...@@ -166,11 +167,11 @@ public class CheckServiceImpl implements ICheckService {
planTask = planTaskDao.findById(requestParam.getPlanTaskId()).get(); planTask = planTaskDao.findById(requestParam.getPlanTaskId()).get();
// routeParam.put("routeId", planTask.getRouteId()); // routeParam.put("routeId", planTask.getRouteId());
// routeParam.put("pointId", requestParam.getPointId()); // routeParam.put("pointId", requestParam.getPointId());
check.setPlanTaskDetailId(Long.parseLong(detail.get("planTaskDetailId").toString())); check.setPlanTaskDetailId(Long.parseLong(String.valueOf(detail.get("planTaskDetailId"))));
check.setRouteId(Long.parseLong(detail.get("routeId").toString())); check.setRouteId(Long.parseLong(String.valueOf(detail.get("routeId"))));
check.setPlanTaskId(requestParam.getPlanTaskId()); check.setPlanTaskId(requestParam.getPlanTaskId());
check.setPlanId(planTask.getPlanId()); check.setPlanId(planTask.getPlanId());
check.setDepId(detail.get("depId").toString()); check.setDepId(String.valueOf(detail.get("depId")));
} }
} else { } else {
planTask = new PlanTask(); planTask = new PlanTask();
...@@ -1013,8 +1014,8 @@ public class CheckServiceImpl implements ICheckService { ...@@ -1013,8 +1014,8 @@ public class CheckServiceImpl implements ICheckService {
//新安全 //新安全
checkAnalysisVos.forEach(s -> { checkAnalysisVos.forEach(s -> {
listd.forEach(s1 -> { listd.forEach(s1 -> {
if (s.getName().equals(s1.get("sequenceNbr") + "")) { if (s.getName().equals(String.valueOf(s1.get("sequenceNbr")))) {
s.setName(s1.get("departmentName") + ""); s.setName(String.valueOf(s1.get("departmentName")));
} }
}); });
}); });
...@@ -1090,8 +1091,8 @@ public class CheckServiceImpl implements ICheckService { ...@@ -1090,8 +1091,8 @@ public class CheckServiceImpl implements ICheckService {
//新安全 //新安全
checkAnalysisVos.forEach(s -> { checkAnalysisVos.forEach(s -> {
listd.forEach(s1 -> { listd.forEach(s1 -> {
if (!ObjectUtils.isEmpty(s.getName()) && s.getName().equals(s1.get("sequenceNbr"))) { if (!ObjectUtils.isEmpty(s.getName()) && s.getName().equals(String.valueOf(s1.get("sequenceNbr")))) {
s.setName(DeptEnum.getEnumCode(s1.get("departmentName") + "")); s.setName(DeptEnum.getEnumCode(String.valueOf(s1.get("departmentName"))));
} }
}); });
}); });
...@@ -1147,7 +1148,11 @@ public class CheckServiceImpl implements ICheckService { ...@@ -1147,7 +1148,11 @@ public class CheckServiceImpl implements ICheckService {
titles.add("巡检点"); titles.add("巡检点");
titles.add("分类"); titles.add("分类");
titles.add("检查内容"); titles.add("检查内容");
String beginTimeStr = checkMapper.getCheckInfoGroupCheckDate(param).get(0).getBeginTimeStr(); CheckInputBo checkInputBo = checkMapper.getCheckInfoGroupCheckDate(param).get(0);
if (ObjectUtils.isEmpty(checkInputBo)) {
throw new YeeException("技术部门巡检计划为空");
}
String beginTimeStr = checkInputBo.getBeginTimeStr();
sp = beginTimeStr.split(","); sp = beginTimeStr.split(",");
for (int i = 0; i < sp.length; i++) { for (int i = 0; i < sp.length; i++) {
titles.add(sp[i].substring(11, sp[i].length())); titles.add(sp[i].substring(11, sp[i].length()));
...@@ -1243,11 +1248,15 @@ public class CheckServiceImpl implements ICheckService { ...@@ -1243,11 +1248,15 @@ public class CheckServiceImpl implements ICheckService {
setRow(checkInfoList, sheet, contentStyle, alignLeftStyle); setRow(checkInfoList, sheet, contentStyle, alignLeftStyle);
} }
PoiUtil.export(wb, response); //PoiUtil.export(wb, response);
PoiUtil.exportLocal(wb, "D:/upload", "机构客户信息表.xls");
} }
private Map<String, Object> getStateMap(String idState) { private Map<String, Object> getStateMap(String idState) {
Map<String, Object> idStateMap = Maps.newHashMap(); Map<String, Object> idStateMap = Maps.newHashMap();
if (ObjectUtils.isEmpty(idState)) {
return idStateMap;
}
String[] split = idState.split(","); String[] split = idState.split(",");
for (int i = 0; i < split.length; i++) { for (int i = 0; i < split.length; i++) {
String[] sp = split[i].split("_"); String[] sp = split[i].split("_");
...@@ -1396,8 +1405,8 @@ public class CheckServiceImpl implements ICheckService { ...@@ -1396,8 +1405,8 @@ public class CheckServiceImpl implements ICheckService {
boolean flag2 = true; boolean flag2 = true;
for (int i = 0; i < checkInfoList.size(); i++) { for (int i = 0; i < checkInfoList.size(); i++) {
String pointName = checkInfoList.get(i).get("pointName").toString(); String pointName = String.valueOf(checkInfoList.get(i).get("pointName"));
String classifyName = checkInfoList.get(i).get("classifyName").toString(); String classifyName = String.valueOf(checkInfoList.get(i).get("classifyName"));
if (flag1) { if (flag1) {
lastPointName = pointName; lastPointName = pointName;
flag1 = false; flag1 = false;
...@@ -1442,14 +1451,14 @@ public class CheckServiceImpl implements ICheckService { ...@@ -1442,14 +1451,14 @@ public class CheckServiceImpl implements ICheckService {
} }
row = sheet.createRow(i + 3); row = sheet.createRow(i + 3);
HSSFCell cell = row.createCell(0); HSSFCell cell = row.createCell(0);
cell.setCellValue(checkInfoList.get(i).get("pointName").toString()); cell.setCellValue(String.valueOf(checkInfoList.get(i).get("pointName")));
cell.setCellStyle(contentStyle); cell.setCellStyle(contentStyle);
HSSFCell cell1 = row.createCell(1); HSSFCell cell1 = row.createCell(1);
cell1.setCellValue(checkInfoList.get(i).get("classifyName").toString()); cell1.setCellValue(String.valueOf(checkInfoList.get(i).get("classifyName")));
cell1.setCellStyle(contentStyle); cell1.setCellStyle(contentStyle);
HSSFCell cell2 = row.createCell(2); HSSFCell cell2 = row.createCell(2);
cell2.setCellStyle(contentStyle); cell2.setCellStyle(contentStyle);
cell2.setCellValue(checkInfoList.get(i).get("inputItemName").toString()); cell2.setCellValue(String.valueOf(checkInfoList.get(i).get("inputItemName")));
for (int j = 0; j < sp.length; j++) { for (int j = 0; j < sp.length; j++) {
Map<String, Object> checkInfoMap = checkInfoList.get(i); Map<String, Object> checkInfoMap = checkInfoList.get(i);
HSSFCell cellA = row.createCell(3 + j); HSSFCell cellA = row.createCell(3 + j);
...@@ -1468,9 +1477,9 @@ public class CheckServiceImpl implements ICheckService { ...@@ -1468,9 +1477,9 @@ public class CheckServiceImpl implements ICheckService {
children.forEach( children.forEach(
y -> { y -> {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
String key = DeptEnum.getEnumCode(y.get("departmentName").toString()); String key = DeptEnum.getEnumCode(String.valueOf(y.get("departmentName")));
map.put("key", key); map.put("key", key);
map.put("label", y.get("departmentName").toString()); map.put("label", String.valueOf(y.get("departmentName")));
list.add(map); list.add(map);
} }
); );
...@@ -1502,7 +1511,7 @@ public class CheckServiceImpl implements ICheckService { ...@@ -1502,7 +1511,7 @@ public class CheckServiceImpl implements ICheckService {
Collection<Map> children = x.getChildren(); Collection<Map> children = x.getChildren();
children.forEach( children.forEach(
y -> { y -> {
String key = DeptEnum.getEnumCode(y.get("departmentName").toString()); String key = DeptEnum.getEnumCode(String.valueOf(y.get("departmentName")));
List<CheckAnalysisVo> collect = checkAnalysisVos.stream().filter(z -> key.equals(z.getName()) && z.getCheckTime().equals(day)).collect(Collectors.toList()); List<CheckAnalysisVo> collect = checkAnalysisVos.stream().filter(z -> key.equals(z.getName()) && z.getCheckTime().equals(day)).collect(Collectors.toList());
String plantaskCount = getCount(collect, PLANTASK_COUNT); String plantaskCount = getCount(collect, PLANTASK_COUNT);
String checkCount = getCount(collect, CHECK_COUNT); String checkCount = getCount(collect, CHECK_COUNT);
...@@ -1555,7 +1564,7 @@ public class CheckServiceImpl implements ICheckService { ...@@ -1555,7 +1564,7 @@ public class CheckServiceImpl implements ICheckService {
private void getTotal(Map<String, Object> totalMap, String type, String key, Long num) { private void getTotal(Map<String, Object> totalMap, String type, String key, Long num) {
long total = 0; long total = 0;
if (!ObjectUtils.isEmpty(totalMap.get(type + key))) { if (!ObjectUtils.isEmpty(totalMap.get(type + key))) {
total = Long.valueOf(totalMap.get(type + key).toString()); total = Long.valueOf(String.valueOf(totalMap.get(type + key)));
} }
num += total; num += total;
totalMap.put(type + key, num.toString()); totalMap.put(type + key, num.toString());
......
...@@ -1832,99 +1832,10 @@ ...@@ -1832,99 +1832,10 @@
</select> </select>
<select id="getCheckStatisticalByCheck" resultType="com.yeejoin.amos.patrol.service.business.vo.CheckAnalysisVo"> <select id="getCheckStatisticalByCheck" resultType="com.yeejoin.amos.patrol.service.business.vo.CheckAnalysisVo">
<!-- select-->
<!-- a.deptName name,-->
<!-- count(a.checkId) planTaskCount,-->
<!-- sum(a.finish ) checkCount,-->
<!-- sum(a.ok) ok,-->
<!-- sum(a.faild) faild,-->
<!-- sum(a.missed) missed,-->
<!-- sum(a.score) score,-->
<!-- sum(a.missed) / count(a.checkId) * 100 missedRate,-->
<!-- sum(a.faild) / count(a.checkId) * 100 faildRate,-->
<!-- a.checkTime-->
<!-- FROM-->
<!-- (-->
<!-- SELECT-->
<!-- CASE-->
<!-- WHEN c.plan_id = 0 THEN-->
<!-- '计划外'-->
<!-- ELSE-->
<!-- p. NAME-->
<!-- END planName,-->
<!-- c.plan_id planId,-->
<!-- r. NAME routeName,-->
<!-- r.id routeId,-->
<!-- pt. NAME pointName,-->
<!-- pt.id pointId,-->
<!-- c.user_id userId,-->
<!-- c.score,-->
<!-- c.dep_id departmentId,-->
<!-- c.dep_id deptName ,-->
<!-- c.user_id userName ,-->
<!-- c.id checkId,-->
<!-- c.plan_task_detail_id taskDetailId,-->
<!-- c.is_ok isOk,-->
<!-- c.plan_task_id,-->
<!-- DATE_FORMAT(c.check_time,'%Y-%m-%d') checkTime,-->
<!-- DATE_FORMAT(c.check_time,'%Y-%m') checkMonth,-->
<!-- CASE-->
<!-- WHEN c.is_ok = 1 THEN-->
<!-- 1-->
<!-- ELSE-->
<!-- 0-->
<!-- END ok,-->
<!-- CASE-->
<!-- WHEN c.is_ok = 2 THEN-->
<!-- 1-->
<!-- ELSE-->
<!-- 0-->
<!-- END faild,-->
<!-- CASE-->
<!-- WHEN c.is_ok = 3 THEN-->
<!-- 1-->
<!-- ELSE-->
<!-- 0-->
<!-- END missed,-->
<!-- CASE-->
<!-- WHEN c.is_ok = 3 THEN-->
<!-- 0-->
<!-- ELSE-->
<!-- 1-->
<!-- END finish-->
<!-- FROM-->
<!-- p_check c-->
<!-- LEFT JOIN p_plan p ON c.plan_id = p.id-->
<!-- LEFT JOIN p_plan_task pnt ON c.plan_task_id = pnt.id-->
<!-- LEFT JOIN p_route r ON c.route_id = r.id-->
<!-- LEFT JOIN p_point pt ON c.point_id = pt.id-->
<!-- WHERE c.org_code LIKE CONCAT(#{orgCode}, '%')-->
<!-- <if test="userName !=null and userName != '' ">and c.user_name like CONCAT('%', #{userName}, '%')</if>-->
<!-- <if test="pointNo !=null and pointNo != '' ">and pt.point_no like CONCAT('%', #{pointNo}, '%')</if>-->
<!-- <if test="pointName !=null and pointName != '' ">and pt.name like CONCAT('%', #{pointName}, '%')</if>-->
<!-- <if test="isFixed !=null and isFixed != '' ">and pt.is_fixed = #{isFixed}</if>-->
<!-- <choose>-->
<!-- <when test=" processType > 0 and processType == 4 ">-->
<!-- and <![CDATA[ c.plan_id = 0 ]]>-->
<!-- </when>-->
<!-- <when test="processType > 0 and processType != 4 ">-->
<!-- and pnt.status = #{processType}-->
<!-- </when>-->
<!-- </choose>-->
<!-- <if test="isOk !=null and isOk != '' ">and c.isOk = #{isOk}</if>-->
<!-- <if test="planId !=null and planId != '' ">and c.plan_id = #{planId}</if>-->
<!-- <if test="routeId !=null and routeId != '' ">and c.route_id = #{routeId}</if>-->
<!-- <if test="startTime !=null and startTime!= '' "> <![CDATA[ AND c.check_time >= #{startTime} ]]> </if>-->
<!-- <if test="endTime !=null and endTime!='' "><![CDATA[AND c.check_time <= #{endTime} ]]></if>-->
<!-- ) a-->
<!-- GROUP BY-->
<!-- a.deptName,-->
<!-- a.checkTime-->
SELECT SELECT
a.deptName `name`, a.deptName `name`,
sum(a.planTaskCount) planTaskCount, count(1) planTaskCount,
sum(a.finish ) checkCount, sum(a.finish) checkCount,
sum(a.ok) ok, sum(a.ok) ok,
sum(a.faild) faild, sum(a.faild) faild,
sum(a.missed) missed, sum(a.missed) missed,
...@@ -1983,16 +1894,16 @@ ...@@ -1983,16 +1894,16 @@
0 0
END finish END finish
FROM FROM
p_plan_task pnt p_plan_task_detail ptd
LEFT JOIN p_plan_task pnt ON pnt.id = ptd.task_no
LEFT JOIN p_plan p ON p.id = pnt.plan_id
LEFT JOIN p_point pt ON pt.id = ptd.id
LEFT JOIN p_route r ON r.id = pnt.route_id LEFT JOIN p_route r ON r.id = pnt.route_id
LEFT JOIN p_route_point prp ON prp.route_id = r.id LEFT JOIN p_check c ON c.plan_task_id = pnt.id
LEFT JOIN p_point pt ON pt.route_id = r.id
LEFT JOIN p_check c on c.plan_task_id = pnt.id
LEFT JOIN p_plan p ON c.plan_id = p.id
WHERE pnt.org_code LIKE CONCAT(#{orgCode}, '%') WHERE pnt.org_code LIKE CONCAT(#{orgCode}, '%')
<if test="startTime !=null and startTime!= '' "> <![CDATA[ AND pnt.check_date >= #{startTime} ]]> </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="endTime !=null and endTime!='' "><![CDATA[AND pnt.check_date <= #{endTime} ]]></if>
GROUP BY pnt.id, c.id GROUP BY ptd.id
) a ) a
GROUP BY GROUP BY
a.deptName, a.deptName,
......
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