Commit 8201d98c authored by tangwei's avatar tangwei

解决冲突

parents 82afe199 2d570690
......@@ -1139,7 +1139,12 @@ LEFT JOIN (
(
( SELECT field_value FROM cb_dynamic_form_instance dfi WHERE dfi.field_code = 'peopleType' AND dfi.instance_id = u.sequence_nbr ) = 1601,
1,
0
IF
(
( SELECT field_value FROM cb_dynamic_form_instance dfi WHERE dfi.field_code = 'peopleType' AND dfi.instance_id = u.sequence_nbr ) = 1602,
0,
2
)
) AS is_firefighters,
( SELECT field_value FROM cb_dynamic_form_instance dfi WHERE dfi.field_code = 'personImg' AND dfi.instance_id = u.sequence_nbr ) AS personImg,
cfp.job_title
......
......@@ -47,4 +47,7 @@ public class AnalysisReportLog extends BaseEntity {
@ApiModelProperty(value = "结束时间")
private Date endDate;
@ApiModelProperty(value = "报告地址")
private String url;
}
......@@ -2,6 +2,7 @@ package com.yeejoin.equipmanage.common.utils;
import org.apache.commons.lang3.StringUtils;
import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.ParsePosition;
......@@ -125,7 +126,6 @@ public class DateUtils {
return cal.getTime();
}
/**
* 将长时间格式字符串转换为时间 yyyy-MM-dd HH:mm:ss
*
......@@ -574,7 +574,10 @@ public class DateUtils {
System.out.println(dateTimeToDateStringIfTimeEndZero(dateTimeToDate(new Date())));*/
//System.out.println(dateBetween(dateParse("2017-01-30", null), dateParse("2017-02-01", null)));
//System.out.println(dateBetweenIncludeToday(dateParse("2017-01-30", null), dateParse("2017-02-01", null)));
System.out.println(getDate(dateParse("2017-01-17", null)));
// System.out.println(getDate(dateParse("2017-01-17", null)));
System.out.println(dateTimeToDateString(getBeginDayOfWeek()));
System.out.println("getBeginDayOfWeek() = " + getBeginDayOfWeek());
System.out.println("11111111111111111"+getEndDayOfWeek());
/*
System.out.println(getDaysOfMonth(dateParse("2017-02-01", null)));
System.out.println(getDaysOfYear(dateParse("2017-01-30", null)));*/
......@@ -879,4 +882,43 @@ public class DateUtils {
return now;
}
public static Date getBeginDayOfWeek() {
Date date = new Date();
if (date == null) {
return null;
}
Calendar cal = Calendar.getInstance();
cal.setTime(date);
int dayofweek = cal.get(Calendar.DAY_OF_WEEK);
if (dayofweek == 1) {
dayofweek += 7;
}
cal.add(Calendar.DATE, 2 - dayofweek);
return getDayStartTime(cal.getTime());
}
public static Date getEndDayOfWeek(){
Calendar cal = Calendar.getInstance();
cal.setTime(getBeginDayOfWeek());
cal.add(Calendar.DAY_OF_WEEK, 6);
Date weekEndSta = cal.getTime();
return getDayEndTime(weekEndSta);
}
public static Timestamp getDayEndTime(Date d) {
Calendar calendar = Calendar.getInstance();
if(null != d) calendar.setTime(d);
calendar.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH), 23, 59, 59);
calendar.set(Calendar.MILLISECOND, 999);
return new Timestamp(calendar.getTimeInMillis());
}
public static Timestamp getDayStartTime(Date d) {
Calendar calendar = Calendar.getInstance();
if(null != d) calendar.setTime(d);
calendar.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
calendar.set(Calendar.MILLISECOND, 0);
return new Timestamp(calendar.getTimeInMillis());
}
}
......@@ -17,6 +17,8 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
......@@ -34,6 +36,7 @@ import java.util.stream.Collectors;
@RestController
@Api(tags = "组态需求 -- API")
@RequestMapping(value = "/configure", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@EnableScheduling
public class ConfigureController extends AbstractBaseController {
......@@ -739,6 +742,90 @@ public class ConfigureController extends AbstractBaseController {
}
@Scheduled(cron = "${jobs.month.cron}")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "定时生成 物联报表-月", notes = "物联报表-月")
@GetMapping("/testMouth")
public ResponseModel iotMonthReportScheduled() {
String startDate = null;
String endDate = null;
try {
//上月开始时间
Date start = DateUtils.minDateOfMonth(new Date());
start =DateUtils.dateAddMonths(start,-1);
//上月结束时间
Date end = DateUtils.maxDateOfMonth(new Date());
end =DateUtils.dateAddMonths(end,-1);
startDate = DateUtils.dateTimeToDateString(start);
endDate = DateUtils.dateTimeToDateString(end);
List<Map<String, String>> list = fireFightingSystemMapper.getStationBizOrgCode();
String finalStartDate = startDate;
String finalEndDate = endDate;
list.forEach(e->
iFireFightingSystemService.iotMonthReport(e.get("bizOrgCode"), finalStartDate, finalEndDate)
);
} catch (Exception e) {
e.printStackTrace();
}
return CommonResponseUtil.success();
}
@Scheduled(cron = "${jobs.week.cron}")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "定时生成 物联报表-周", notes = "物联报表-周")
@GetMapping("/testWeek")
public ResponseModel iotWeekReportScheduled() {
String startDate = null;
String endDate = null;
try {
Date start = DateUtils.getBeginDayOfWeek();
start = DateUtils.dateAddDays(start,-7);
Date end = DateUtils.getEndDayOfWeek();
end = DateUtils.dateAddDays(end,-7);
startDate = DateUtils.dateTimeToDateString(start);
endDate = DateUtils.dateTimeToDateString(end);
List<Map<String, String>> list = fireFightingSystemMapper.getStationBizOrgCode();
String finalStartDate = startDate;
String finalEndDate = endDate;
list.forEach(e->
iFireFightingSystemService.iotWeekReport(e.get("bizOrgCode"), finalStartDate, finalEndDate)
);
} catch (Exception e) {
e.printStackTrace();
}
return CommonResponseUtil.success();
}
@Scheduled(cron = "${jobs.day.cron}")
@ApiOperation(httpMethod = "GET", value = "定时生成 物联报表-日", notes = "物联报表-日")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping("/testDay")
public ResponseModel iotDayReportScheduled() {
String startDate = null;
String endDate = null;
try {
Date start = DateUtils.getCurrentDayStartTime(new Date());
start = DateUtils.dateAddDays(start,-1);
Date end = DateUtils.getCurrentDayEndTime(new Date());
end = DateUtils.dateAddDays(end,-1);
startDate = DateUtils.dateTimeToDateString(start);
endDate = DateUtils.dateTimeToDateString(end);
List<Map<String, String>> list = fireFightingSystemMapper.getStationBizOrgCode();
String finalStartDate = startDate;
String finalEndDate = endDate;
list.forEach(e->
iFireFightingSystemService.iotDayReport(e.get("bizOrgCode"), finalStartDate, finalEndDate)
);
} catch (Exception e) {
e.printStackTrace();
}
return CommonResponseUtil.success();
}
@PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/iotWeekReport")
......
......@@ -66,7 +66,7 @@ public class EquipDataDto {
@Excel(name = "生产日期", width = 30, orderNum = "12")
private Date productionDate;
@ExcelProperty(value = "投运日期", index = 13)
@Excel(name = "投运日期", width = 30, orderNum = "13")
//@Excel(name = "品牌", width = 30, orderNum = "4")
private Date deliveryDate;
......
......@@ -268,6 +268,8 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
*/
Map<String, Object> getEquipAlarmInfoNum(@Param("systemCode") String systemCode, @Param("bizOrgCode") String bizOrgCode);
List<Map<String, String>> getStationBizOrgCode();
/**
* 获取消防力量信息(队伍值班等)
*
......
......@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yeejoin.equipmanage.common.dto.AnalysisReportLogDto;
import com.yeejoin.equipmanage.common.entity.AnalysisReportLog;
import com.yeejoin.equipmanage.common.entity.FireFightingSystemEntity;
import com.yeejoin.equipmanage.common.entity.UploadFile;
import com.yeejoin.equipmanage.common.entity.publics.BaseEntity;
import com.yeejoin.equipmanage.common.enums.AnalysisReportEnum;
import com.yeejoin.equipmanage.common.utils.DateUtils;
......@@ -15,6 +16,8 @@ import com.yeejoin.equipmanage.mapper.AnalysisReportMonthMapper;
import com.yeejoin.equipmanage.mapper.AnalysisReportSummaryMapper;
import com.yeejoin.equipmanage.service.IAnalysisReportLogService;
import com.yeejoin.equipmanage.service.IFireFightingSystemService;
import com.yeejoin.equipmanage.service.IUploadFileService;
import liquibase.pro.packaged.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -42,6 +45,8 @@ public class AnalysisReportLogServiceImpl extends ServiceImpl<AnalysisReportLogM
@Autowired
AnalysisReportLogMapper analysisReportLogMapper;
@Autowired
IUploadFileService iUploadFileService;
@Override
public IPage<AnalysisReportLog> listPage(Page page, AnalysisReportLog analysisReportLog) {
......@@ -88,6 +93,8 @@ public class AnalysisReportLogServiceImpl extends ServiceImpl<AnalysisReportLogM
reportLog.setStartDate(beginDate);
reportLog.setEndDate(endDate);
reportLog.setReportDateDesc(buildReportDateDesc(reportEnum, beginDate, endDate));
this.save(reportLog);
}
......@@ -133,6 +140,34 @@ public class AnalysisReportLogServiceImpl extends ServiceImpl<AnalysisReportLogM
@Override
public IPage<AnalysisReportLogDto> iotReportPage(Page page, AnalysisReportLogDto dto) {
return analysisReportLogMapper.iotReportPage(page, dto);
IPage<AnalysisReportLogDto> analysisReportLogDtoIPage = analysisReportLogMapper.iotReportPage(page, dto);
List<AnalysisReportLogDto> records = analysisReportLogDtoIPage.getRecords();
records.forEach(e->{
if (e.getReportType() == 0){
this.setReportUrl(e,dto.getStationCode(),"d-report");
}
if (e.getReportType() == 1) {
this.setReportUrl(e,dto.getStationCode(),"w-report");
}
if (e.getReportType() == 2){
this.setReportUrl(e,dto.getStationCode(),"m-report");
}
});
return analysisReportLogDtoIPage;
}
private void setReportUrl(AnalysisReportLogDto dto,String bizOrgCode,String objType ){
LambdaQueryWrapper<UploadFile> wrapper = new LambdaQueryWrapper<>();
// String[] types = new String[]{"w-report","d-report","m-report"};
//wrapper.in(UploadFile::getObjectType, Arrays.asList(types));
wrapper.eq(UploadFile::getDepartmentOrgcode,bizOrgCode);
wrapper.eq(UploadFile::getObjectType,objType);
List<UploadFile> uploadFiles = iUploadFileService.getBaseMapper().selectList(wrapper);
uploadFiles.forEach(i->{
if (DateUtils.dateCompare(new Date(dto.getStartDate().getTime()), new Date(i.getObjectId())) == 0){
dto.setUrl(i.getUrl());
}
});
}
}
......@@ -28,6 +28,7 @@ import com.yeejoin.equipmanage.common.entity.dto.EquipTypeAmountPageDTO;
import com.yeejoin.equipmanage.common.entity.vo.*;
import com.yeejoin.equipmanage.common.enums.*;
import com.yeejoin.equipmanage.common.utils.ChartsUtils;
import com.yeejoin.equipmanage.common.utils.DateUtils;
import com.yeejoin.equipmanage.common.utils.StringUtil;
import com.yeejoin.equipmanage.common.utils.WordTemplateUtils;
import com.yeejoin.equipmanage.common.vo.*;
......@@ -76,6 +77,8 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
IRiskSourceSceneService iRiskSourceSceneService;
@Autowired
private RemoteSecurityService remoteSecurityService;
@Autowired
private IUploadFileService iUploadFileService;
@Autowired
private EquipmentManageMapper equipmentManageMapper;
......@@ -1613,7 +1616,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
}else {
throw new BadRequest("无效参数");
return null;
}
......@@ -1636,6 +1639,9 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
@Override
public String iotMonthReport(String bizOrgCode, String startDate, String endDate) {
Map<String, Object> DataMap = getData(bizOrgCode, startDate, endDate);
if (DataMap == null){
return null ;
}
WordTemplateUtils instance = WordTemplateUtils.getInstance();
String pdfUrlString = "";
File filepdf = null;
......@@ -1657,6 +1663,21 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
filepdf.delete();
}
}
try {
UploadFile uploadFile = new UploadFile();
uploadFile.setUrl(pdfUrlString);
uploadFile.setFileType("image");
uploadFile.setObjectType("m-report");
long time = DateUtils.longStr2Date(startDate+" 00:00:00").getTime();
uploadFile.setObjectId(time);
uploadFile.setName("换流站月总结分析报告");
uploadFile.setDepartmentOrgcode(bizOrgCode);
iUploadFileService.save(uploadFile);
} catch (Exception e) {
e.printStackTrace();
}
return pdfUrlString;
}
......@@ -1801,7 +1822,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
}
}else {
throw new BadRequest("无效参数");
return null;
}
......@@ -1811,6 +1832,9 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
@Override
public String iotWeekReport(String bizOrgCode, String startDate, String endDate) {
Map<String, Object> dataMap = getWeekData(bizOrgCode, startDate, endDate);
if (dataMap == null) {
return null;
}
WordTemplateUtils instance = WordTemplateUtils.getInstance();
String pdfUrlString = "";
File filepdf = null;
......@@ -1832,6 +1856,19 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
filepdf.delete();
}
}
try {
UploadFile uploadFile = new UploadFile();
uploadFile.setUrl(pdfUrlString);
uploadFile.setFileType("image");
uploadFile.setObjectType("w-report");
long time = DateUtils.longStr2Date(startDate+" 00:00:00").getTime();
uploadFile.setObjectId(time);
uploadFile.setName("换流站周总结分析报告");
uploadFile.setDepartmentOrgcode(bizOrgCode);
iUploadFileService.save(uploadFile);
} catch (Exception e) {
e.printStackTrace();
}
return pdfUrlString;
}
......@@ -1959,7 +1996,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
}
}else {
throw new BadRequest("无效参数");
return null ;
}
......@@ -1969,6 +2006,9 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
@Override
public String iotDayReport(String bizOrgCode, String startDate, String endDate) {
Map<String, Object> dataMap = getDayData(bizOrgCode, startDate, endDate);
if (dataMap == null){
return null;
}
WordTemplateUtils instance = WordTemplateUtils.getInstance();
String pdfUrlString = "";
File filepdf = null;
......@@ -1990,6 +2030,20 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
filepdf.delete();
}
}
try {
UploadFile uploadFile = new UploadFile();
uploadFile.setUrl(pdfUrlString);
uploadFile.setFileType("image");
uploadFile.setObjectType("d-report");
long time = DateUtils.longStr2Date(startDate+" 00:00:00").getTime();
// DateUtils.getCurrentDayStartTime(new Date()).getTime();
uploadFile.setObjectId(time);
uploadFile.setName("换流站日总结分析报告");
uploadFile.setDepartmentOrgcode(bizOrgCode);
iUploadFileService.save(uploadFile);
} catch (Exception e) {
e.printStackTrace();
}
return pdfUrlString;
}
......
......@@ -52,16 +52,18 @@ spring.redis.expire.time=30000
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.10.215:1883
emqx.user-name=admin
emqx.password=public
emqx.client-user-name=admin
emqx.client-password=public
mqtt.scene.host=mqtt://172.16.10.215:8083/mqtt
mqtt.client.product.id=mqtt
mqtt.topic=topic_mqtt
spring.mqtt.completionTimeout=3000
#定时任务
##物联报表定时任务
jobs.month.cron = 0 5 0 1 * ?
jobs.day.cron = 0 5 0 * * ?
jobs.week.cron = 0 5 0 ? * 1
#数据同步开关
systemctl.sync.switch=false
......
......@@ -2249,6 +2249,19 @@
) AS unConfirmInfoNum
</select>
<select id="getStationBizOrgCode" resultType="java.util.Map">
select
org.biz_org_name as bizOrgName,
org.biz_org_code as bizOrgCode,
org.sequence_nbr as id
from cb_org_usr org
right JOIN idx_biz_station_info ibi on ibi.code = org.code
where
org.is_delete = 0 and org.biz_org_type = 'COMPANY'
</select>
<select id="getFireTeamInfoBy117" resultType="java.util.Map">
SELECT
ifnull( count( 0 ), 0 ) AS `total`,
......
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