cea0dcb8 张雷

禅道BUG修改

1 个父辈 055fa066
...@@ -26,7 +26,10 @@ ...@@ -26,7 +26,10 @@
26 ajh_meeting m 26 ajh_meeting m
27 left join (select meet_id,count(id) num from ajh_meeting_send where send_status = 1 GROUP BY meet_id) s1 on s1.meet_id = m.id 27 left join (select meet_id,count(id) num from ajh_meeting_send where send_status = 1 GROUP BY meet_id) s1 on s1.meet_id = m.id
28 left join (select meet_id,count(id) num from ajh_meeting_send GROUP BY meet_id) s2 on s2.meet_id = m.id 28 left join (select meet_id,count(id) num from ajh_meeting_send GROUP BY meet_id) s2 on s2.meet_id = m.id
29 left join (select DISTINCT sa.meet_id,ma.num from ajh_meeting_send sa left join (select meets_id,count(id) num from ajh_meeting_attend GROUP BY meets_id) ma on ma.meets_id = sa.id) a on a.meet_id = s2.meet_id 29 left join (select sa.meet_id,sum(ifnull(ma.num,0)) num from ajh_meeting_send sa
30 left join (select meets_id,ifnull(count(id),0) num from ajh_meeting_attend GROUP BY meets_id) ma on ma.meets_id = sa.id
31 where sa.meet_id is not null GROUP BY sa.meet_id
32 ) a on a.meet_id = s2.meet_id
30 WHERE 1 = 1 33 WHERE 1 = 1
31 <if test="ajhMeeting.departId !=null and ajhMeeting.departId!=''"> 34 <if test="ajhMeeting.departId !=null and ajhMeeting.departId!=''">
32 AND m.depart_id = #{ajhMeeting.departId} 35 AND m.depart_id = #{ajhMeeting.departId}
......
...@@ -88,8 +88,8 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa ...@@ -88,8 +88,8 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
88 JdbcTemplate masterDB = (JdbcTemplate) SpringContextUtils.getBean("master"); 88 JdbcTemplate masterDB = (JdbcTemplate) SpringContextUtils.getBean("master");
89 String sql = "select " + 89 String sql = "select " +
90 " v1.depart_id,left(v1.time,7) time, " + 90 " v1.depart_id,left(v1.time,7) time, " +
91 " sum(v1.CSL)/10000 ysjsl, " + 91 " round(sum(v1.CSL)/10000,4) ysjsl, " +
92 " ifnull(tb.clsl_tb,0) tqysjsl, " + 92 " round(ifnull(tb.clsl_tb,0),4) tqysjsl, " +
93 " round(100*(sum(v1.CSL)/10000-ifnull(tb.clsl_tb,0))/ifnull(tb.clsl_tb,sum(v1.CSL)/10000),2) as sjsldbbhl, " + 93 " round(100*(sum(v1.CSL)/10000-ifnull(tb.clsl_tb,0))/ifnull(tb.clsl_tb,sum(v1.CSL)/10000),2) as sjsldbbhl, " +
94 " v6.ysjsldyqntqyy, " + 94 " v6.ysjsldyqntqyy, " +
95 " ifnull(v7.qntqsfsl,0) as qntqsfsl, " + 95 " ifnull(v7.qntqsfsl,0) as qntqsfsl, " +
......
...@@ -24,7 +24,8 @@ public interface FactoryCenterMapper { ...@@ -24,7 +24,8 @@ public interface FactoryCenterMapper {
24 @Param("view3a24") String view3a24, @Param("view3a24tb") String view3a24tb, 24 @Param("view3a24") String view3a24, @Param("view3a24tb") String view3a24tb,
25 @Param("view2119") String view2119, @Param("view2119tb") String view2119tb); 25 @Param("view2119") String view2119, @Param("view2119tb") String view2119tb);
26 26
27 Map<String, Object> getData(@Param("month") String month, @Param("departId") String departId); 27 Map<String, Object> getData(@Param("month") String month, @Param("departId") String departId,
28 @Param("view3a24") String view3a24, @Param("view2119") String view2119);
28 29
29 List<Map<String, Object>> getYhtj(@Param("startDate") String startDate, @Param("endDate") String endDate, 30 List<Map<String, Object>> getYhtj(@Param("startDate") String startDate, @Param("endDate") String endDate,
30 @Param("startDateTb") String startDateTb, @Param("endDateTb") String endDateTb, 31 @Param("startDateTb") String startDateTb, @Param("endDateTb") String endDateTb,
......
...@@ -152,8 +152,8 @@ ...@@ -152,8 +152,8 @@
152 ROUND(SUM( v3.WNL )/(SUM( v2.CSL )/10000),2) as wdscnl, 152 ROUND(SUM( v3.WNL )/(SUM( v2.CSL )/10000),2) as wdscnl,
153 LEFT ( v3.time, 7 ) AS time 153 LEFT ( v3.time, 7 ) AS time
154 FROM 154 FROM
155 view_3a24 v3 155 ${view3a24} v3
156 LEFT JOIN (select CSL,time from view_2119 where LEFT ( time, 7 ) = #{month} and depart_id = #{departId}) v2 ON v2.time = v3.time 156 LEFT JOIN (select v.CSL,v.time from ${view2119} v where LEFT ( v.time, 7 ) = #{month} and v.depart_id = #{departId}) v2 ON v2.time = v3.time
157 where LEFT ( v3.time, 7 ) = #{month} 157 where LEFT ( v3.time, 7 ) = #{month}
158 and v3.depart_id = #{departId} 158 and v3.depart_id = #{departId}
159 </select> 159 </select>
......
...@@ -691,7 +691,7 @@ ...@@ -691,7 +691,7 @@
691 LEFT ( v.time, 7 ) as time, 691 LEFT ( v.time, 7 ) as time,
692 round( SUM(ifnull( v.ydh, 0 )), 2) totalBYYDL, 692 round( SUM(ifnull( v.ydh, 0 )), 2) totalBYYDL,
693 round( SUM(ifnull( v.ysjsl, 0 )), 2) totalBYCLSL, 693 round( SUM(ifnull( v.ysjsl, 0 )), 2) totalBYCLSL,
694 round( SUM(ifnull( v.ydh, 0 )) / SUM(ifnull( 10000*v.ysjsl, 0 )), 8 ) dsdh 694 round( SUM(ifnull( v.ydh, 0 )) / SUM(ifnull( 10000*v.ysjsl, 0 )), 4 ) dsdh
695 FROM 695 FROM
696 ${dataViewName} v 696 ${dataViewName} v
697 WHERE 697 WHERE
......
...@@ -188,12 +188,20 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService { ...@@ -188,12 +188,20 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService {
188 188
189 @Override 189 @Override
190 public Map<String, Object> getData(String departId,String month) { 190 public Map<String, Object> getData(String departId,String month) {
191 String view2119 = "2119ecbf53a1d2d0708258ff67cfd9e1";
192 String view3a24 = "3a243d5715b9e1a3753c180872ca0df9";
191 Map<String, Object> map = new HashMap<>(); 193 Map<String, Object> map = new HashMap<>();
192 String monthTb = "2023-06"; 194 String monthTb = getTbMonth(month);
193 String monthHb = "2024-05"; 195 String monthHb = getHbMonth(month);
194 Map<String, Object> valueMap = factoryCenterMapper.getData(month, departId); 196 String dataViewName3a24 = ReportViewUtil.buildViewLike(view3a24,"DLHJ,WNL", departId, month);
195 Map<String, Object> hbValueMap = factoryCenterMapper.getData(monthHb, departId); 197 String dataViewName2119 = ReportViewUtil.buildViewLike(view2119,"CSL", departId, month);
196 Map<String, Object> tbValueMap = factoryCenterMapper.getData(monthTb, departId); 198 Map<String, Object> valueMap = factoryCenterMapper.getData(month, departId, dataViewName3a24, dataViewName2119);
199 String dataViewName3a24Hb = ReportViewUtil.buildViewLike(view3a24,"DLHJ,WNL", departId, monthHb);
200 String dataViewName2119Hb = ReportViewUtil.buildViewLike(view2119,"CSL", departId, monthHb);
201 Map<String, Object> hbValueMap = factoryCenterMapper.getData(monthHb, departId, dataViewName3a24Hb, dataViewName2119Hb);
202 String dataViewName3a24Tb = ReportViewUtil.buildViewLike(view3a24,"DLHJ,WNL", departId, monthTb);
203 String dataViewName2119Tb = ReportViewUtil.buildViewLike(view2119,"CSL", departId, monthTb);
204 Map<String, Object> tbValueMap = factoryCenterMapper.getData(monthTb, departId, dataViewName3a24Tb, dataViewName2119Tb);
197 map.put("yclsl",new HashMap<>()); 205 map.put("yclsl",new HashMap<>());
198 Map<String, Object> yclslMap = new HashMap<>(); 206 Map<String, Object> yclslMap = new HashMap<>();
199 yclslMap.put("unit","万吨"); 207 yclslMap.put("unit","万吨");
...@@ -277,6 +285,30 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService { ...@@ -277,6 +285,30 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService {
277 return map; 285 return map;
278 } 286 }
279 287
288 /**
289 * 同比
290 * @param month
291 * @return
292 */
293 public static String getTbMonth(String month) {
294 DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM");
295 YearMonth yearMonth = YearMonth.parse(month, formatter);
296 YearMonth sameMonthLastYear = yearMonth.minusYears(1);
297 return sameMonthLastYear.format(formatter); // 同比
298 }
299
300 /**
301 * 环比
302 * @param month
303 * @return
304 */
305 public static String getHbMonth(String month) {
306 DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM");
307 YearMonth yearMonth = YearMonth.parse(month, formatter);
308 YearMonth previousMonth = yearMonth.minusMonths(1);
309 return previousMonth.format(formatter); // 环比
310 }
311
280 @Override 312 @Override
281 public List<Map<String, Object>> getCnltj(StatisticsParam statisticsParam) { 313 public List<Map<String, Object>> getCnltj(StatisticsParam statisticsParam) {
282 String wnReport = "3a243d5715b9e1a3753c180872ca0df9"; 314 String wnReport = "3a243d5715b9e1a3753c180872ca0df9";
......
...@@ -15,6 +15,7 @@ import org.quartz.JobExecutionContext; ...@@ -15,6 +15,7 @@ import org.quartz.JobExecutionContext;
15 import org.springframework.beans.factory.annotation.Autowired; 15 import org.springframework.beans.factory.annotation.Autowired;
16 16
17 import javax.annotation.Resource; 17 import javax.annotation.Resource;
18 import java.text.DecimalFormat;
18 import java.util.HashMap; 19 import java.util.HashMap;
19 import java.util.List; 20 import java.util.List;
20 import java.util.Map; 21 import java.util.Map;
...@@ -41,6 +42,7 @@ public class DayDataSyncJob implements Job { ...@@ -41,6 +42,7 @@ public class DayDataSyncJob implements Job {
41 public void execute(JobExecutionContext jobExecutionContext) { 42 public void execute(JobExecutionContext jobExecutionContext) {
42 log.info("开始同步昨天的数据入报表"); 43 log.info("开始同步昨天的数据入报表");
43 String yesterday = DateUtils.getYesterday(); 44 String yesterday = DateUtils.getYesterday();
45 DecimalFormat df = new DecimalFormat("######0.0000");
44 List<SysFactoryDevice> deviceList = sysFactoryDeviceService.getList(); 46 List<SysFactoryDevice> deviceList = sysFactoryDeviceService.getList();
45 if(deviceList.size() > 0){ 47 if(deviceList.size() > 0){
46 Map<String, String> tagMap = new HashMap<>(); 48 Map<String, String> tagMap = new HashMap<>();
...@@ -63,7 +65,7 @@ public class DayDataSyncJob implements Job { ...@@ -63,7 +65,7 @@ public class DayDataSyncJob implements Job {
63 if(dataMap.size() != 0){ 65 if(dataMap.size() != 0){
64 if(tagMap.get("CSLL-"+departId)!=null){ 66 if(tagMap.get("CSLL-"+departId)!=null){
65 if(dataMap.get(tagMap.get("CSLL-"+departId)) != null){ 67 if(dataMap.get(tagMap.get("CSLL-"+departId)) != null){
66 data.put("CSL", String.valueOf(24*Double.parseDouble(dataMap.get(tagMap.get("CSLL-"+departId)).toString()))); 68 data.put("CSL", df.format(24*Double.parseDouble(dataMap.get(tagMap.get("CSLL-"+departId)).toString())));
67 }else{ 69 }else{
68 data.put("CSL", ""); 70 data.put("CSL", "");
69 } 71 }
...@@ -72,7 +74,7 @@ public class DayDataSyncJob implements Job { ...@@ -72,7 +74,7 @@ public class DayDataSyncJob implements Job {
72 } 74 }
73 if(tagMap.get("JSLL-"+departId)!=null){ 75 if(tagMap.get("JSLL-"+departId)!=null){
74 if(dataMap.get(tagMap.get("JSLL-"+departId)) != null){ 76 if(dataMap.get(tagMap.get("JSLL-"+departId)) != null){
75 data.put("JSL", String.valueOf(24*Double.parseDouble(dataMap.get(tagMap.get("JSLL-"+departId)).toString()))); 77 data.put("JSL", df.format(24*Double.parseDouble(dataMap.get(tagMap.get("JSLL-"+departId)).toString())));
76 }else{ 78 }else{
77 data.put("JSL", ""); 79 data.put("JSL", "");
78 } 80 }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!