cea0dcb8 张雷

禅道BUG修改

1 个父辈 055fa066
......@@ -26,7 +26,10 @@
ajh_meeting m
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
left join (select meet_id,count(id) num from ajh_meeting_send GROUP BY meet_id) s2 on s2.meet_id = m.id
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
left join (select sa.meet_id,sum(ifnull(ma.num,0)) num from ajh_meeting_send sa
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
where sa.meet_id is not null GROUP BY sa.meet_id
) a on a.meet_id = s2.meet_id
WHERE 1 = 1
<if test="ajhMeeting.departId !=null and ajhMeeting.departId!=''">
AND m.depart_id = #{ajhMeeting.departId}
......
......@@ -88,8 +88,8 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
JdbcTemplate masterDB = (JdbcTemplate) SpringContextUtils.getBean("master");
String sql = "select " +
" v1.depart_id,left(v1.time,7) time, " +
" sum(v1.CSL)/10000 ysjsl, " +
" ifnull(tb.clsl_tb,0) tqysjsl, " +
" round(sum(v1.CSL)/10000,4) ysjsl, " +
" round(ifnull(tb.clsl_tb,0),4) tqysjsl, " +
" round(100*(sum(v1.CSL)/10000-ifnull(tb.clsl_tb,0))/ifnull(tb.clsl_tb,sum(v1.CSL)/10000),2) as sjsldbbhl, " +
" v6.ysjsldyqntqyy, " +
" ifnull(v7.qntqsfsl,0) as qntqsfsl, " +
......
......@@ -24,7 +24,8 @@ public interface FactoryCenterMapper {
@Param("view3a24") String view3a24, @Param("view3a24tb") String view3a24tb,
@Param("view2119") String view2119, @Param("view2119tb") String view2119tb);
Map<String, Object> getData(@Param("month") String month, @Param("departId") String departId);
Map<String, Object> getData(@Param("month") String month, @Param("departId") String departId,
@Param("view3a24") String view3a24, @Param("view2119") String view2119);
List<Map<String, Object>> getYhtj(@Param("startDate") String startDate, @Param("endDate") String endDate,
@Param("startDateTb") String startDateTb, @Param("endDateTb") String endDateTb,
......
......@@ -152,8 +152,8 @@
ROUND(SUM( v3.WNL )/(SUM( v2.CSL )/10000),2) as wdscnl,
LEFT ( v3.time, 7 ) AS time
FROM
view_3a24 v3
LEFT JOIN (select CSL,time from view_2119 where LEFT ( time, 7 ) = #{month} and depart_id = #{departId}) v2 ON v2.time = v3.time
${view3a24} v3
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
where LEFT ( v3.time, 7 ) = #{month}
and v3.depart_id = #{departId}
</select>
......
......@@ -691,7 +691,7 @@
LEFT ( v.time, 7 ) as time,
round( SUM(ifnull( v.ydh, 0 )), 2) totalBYYDL,
round( SUM(ifnull( v.ysjsl, 0 )), 2) totalBYCLSL,
round( SUM(ifnull( v.ydh, 0 )) / SUM(ifnull( 10000*v.ysjsl, 0 )), 8 ) dsdh
round( SUM(ifnull( v.ydh, 0 )) / SUM(ifnull( 10000*v.ysjsl, 0 )), 4 ) dsdh
FROM
${dataViewName} v
WHERE
......
......@@ -188,12 +188,20 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService {
@Override
public Map<String, Object> getData(String departId,String month) {
String view2119 = "2119ecbf53a1d2d0708258ff67cfd9e1";
String view3a24 = "3a243d5715b9e1a3753c180872ca0df9";
Map<String, Object> map = new HashMap<>();
String monthTb = "2023-06";
String monthHb = "2024-05";
Map<String, Object> valueMap = factoryCenterMapper.getData(month, departId);
Map<String, Object> hbValueMap = factoryCenterMapper.getData(monthHb, departId);
Map<String, Object> tbValueMap = factoryCenterMapper.getData(monthTb, departId);
String monthTb = getTbMonth(month);
String monthHb = getHbMonth(month);
String dataViewName3a24 = ReportViewUtil.buildViewLike(view3a24,"DLHJ,WNL", departId, month);
String dataViewName2119 = ReportViewUtil.buildViewLike(view2119,"CSL", departId, month);
Map<String, Object> valueMap = factoryCenterMapper.getData(month, departId, dataViewName3a24, dataViewName2119);
String dataViewName3a24Hb = ReportViewUtil.buildViewLike(view3a24,"DLHJ,WNL", departId, monthHb);
String dataViewName2119Hb = ReportViewUtil.buildViewLike(view2119,"CSL", departId, monthHb);
Map<String, Object> hbValueMap = factoryCenterMapper.getData(monthHb, departId, dataViewName3a24Hb, dataViewName2119Hb);
String dataViewName3a24Tb = ReportViewUtil.buildViewLike(view3a24,"DLHJ,WNL", departId, monthTb);
String dataViewName2119Tb = ReportViewUtil.buildViewLike(view2119,"CSL", departId, monthTb);
Map<String, Object> tbValueMap = factoryCenterMapper.getData(monthTb, departId, dataViewName3a24Tb, dataViewName2119Tb);
map.put("yclsl",new HashMap<>());
Map<String, Object> yclslMap = new HashMap<>();
yclslMap.put("unit","万吨");
......@@ -277,6 +285,30 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService {
return map;
}
/**
* 同比
* @param month
* @return
*/
public static String getTbMonth(String month) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM");
YearMonth yearMonth = YearMonth.parse(month, formatter);
YearMonth sameMonthLastYear = yearMonth.minusYears(1);
return sameMonthLastYear.format(formatter); // 同比
}
/**
* 环比
* @param month
* @return
*/
public static String getHbMonth(String month) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM");
YearMonth yearMonth = YearMonth.parse(month, formatter);
YearMonth previousMonth = yearMonth.minusMonths(1);
return previousMonth.format(formatter); // 环比
}
@Override
public List<Map<String, Object>> getCnltj(StatisticsParam statisticsParam) {
String wnReport = "3a243d5715b9e1a3753c180872ca0df9";
......
......@@ -15,6 +15,7 @@ import org.quartz.JobExecutionContext;
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.Resource;
import java.text.DecimalFormat;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -41,6 +42,7 @@ public class DayDataSyncJob implements Job {
public void execute(JobExecutionContext jobExecutionContext) {
log.info("开始同步昨天的数据入报表");
String yesterday = DateUtils.getYesterday();
DecimalFormat df = new DecimalFormat("######0.0000");
List<SysFactoryDevice> deviceList = sysFactoryDeviceService.getList();
if(deviceList.size() > 0){
Map<String, String> tagMap = new HashMap<>();
......@@ -63,7 +65,7 @@ public class DayDataSyncJob implements Job {
if(dataMap.size() != 0){
if(tagMap.get("CSLL-"+departId)!=null){
if(dataMap.get(tagMap.get("CSLL-"+departId)) != null){
data.put("CSL", String.valueOf(24*Double.parseDouble(dataMap.get(tagMap.get("CSLL-"+departId)).toString())));
data.put("CSL", df.format(24*Double.parseDouble(dataMap.get(tagMap.get("CSLL-"+departId)).toString())));
}else{
data.put("CSL", "");
}
......@@ -72,7 +74,7 @@ public class DayDataSyncJob implements Job {
}
if(tagMap.get("JSLL-"+departId)!=null){
if(dataMap.get(tagMap.get("JSLL-"+departId)) != null){
data.put("JSL", String.valueOf(24*Double.parseDouble(dataMap.get(tagMap.get("JSLL-"+departId)).toString())));
data.put("JSL", df.format(24*Double.parseDouble(dataMap.get(tagMap.get("JSLL-"+departId)).toString())));
}else{
data.put("JSL", "");
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!