Commit fe21b714 authored by tangwei's avatar tangwei

解决冲突

parents b4483a91 b0f8c8d0
package com.yeejoin.amos.boot.module.hygf.api.dto;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
/**
* @author DELL
*/
@Data
public class TdHYGFStationDayGenerateDto implements Serializable {
/**
* 创建时间
*/
@ExcelIgnore
private Long createdTime;
/**
* 第三方场站id
*/
@ExcelIgnore
private String thirdStationId;
/**
*日 yyyy-MM-dd
*/
@ExcelProperty(value = "时间")
private String dayTime;
/**
*月 yyyy-MM
*/
@ExcelIgnore
private String yearMonth;
/**
* 发电量
*/
@ExcelProperty(value = "日发电量(kWh)")
private Double generate;
@ExcelProperty(value = "日满发小时数(h)")
private Double fullhour;
@ExcelProperty(value = "当前状态")
private String workstatus;
@ExcelProperty(value = "日收益(元)")
private Double income;
@ExcelProperty(value = "电站编号")
private String stationCode;
@ExcelProperty(value = "电站名称")
private String stationName;
@ExcelProperty(value = "业主姓名")
private String user_name;
@ExcelProperty(value = "电站联系人")
private String station_contact;
}
package com.yeejoin.amos.boot.module.hygf.biz.controller; package com.yeejoin.amos.boot.module.hygf.biz.controller;
import cn.hutool.core.date.DateUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.support.ExcelTypeEnum;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.yeejoin.amos.boot.module.hygf.api.config.UserLimits; import com.yeejoin.amos.boot.module.hygf.api.config.UserLimits;
import com.yeejoin.amos.boot.module.hygf.api.dto.DropDown; import com.yeejoin.amos.boot.module.hygf.api.dto.DropDown;
import com.yeejoin.amos.boot.module.hygf.api.dto.ReviewDto; import com.yeejoin.amos.boot.module.hygf.api.dto.ReviewDto;
...@@ -18,14 +22,20 @@ import io.swagger.annotations.Api; ...@@ -18,14 +22,20 @@ import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.JpStationServiceImpl; import com.yeejoin.amos.boot.module.hygf.biz.service.impl.JpStationServiceImpl;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.hygf.api.dto.JpStationDto; import com.yeejoin.amos.boot.module.hygf.api.dto.JpStationDto;
...@@ -370,7 +380,7 @@ public class JpStationController extends BaseController { ...@@ -370,7 +380,7 @@ public class JpStationController extends BaseController {
List<Map<String,String>> result = new ArrayList<>(); List<Map<String,String>> result = new ArrayList<>();
list.forEach(dropDown -> { list.forEach(dropDown -> {
Map<String,String> item = new HashMap<>(); Map<String,String> item = new HashMap<>();
item.put("name",dropDown.getName()); item.put("text",dropDown.getName());
item.put("value",dropDown.getOrgCode()); item.put("value",dropDown.getOrgCode());
result.add(item); result.add(item);
}); });
...@@ -389,7 +399,7 @@ public class JpStationController extends BaseController { ...@@ -389,7 +399,7 @@ public class JpStationController extends BaseController {
List<Map<String,String>> result = new ArrayList<>(); List<Map<String,String>> result = new ArrayList<>();
list.forEach(dropDown -> { list.forEach(dropDown -> {
Map<String,String> item = new HashMap<>(); Map<String,String> item = new HashMap<>();
item.put("name",dropDown.getName()); item.put("text",dropDown.getName());
item.put("value",dropDown.getOrgCode()); item.put("value",dropDown.getOrgCode());
result.add(item); result.add(item);
}); });
...@@ -634,4 +644,36 @@ public class JpStationController extends BaseController { ...@@ -634,4 +644,36 @@ public class JpStationController extends BaseController {
return list; return list;
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/jpstationReportExport", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "电站日报表导出", notes = "电站日报表导出")
public void jpstationReportExport( @RequestParam(required = false)String time,@RequestParam(required = false) List<String> snCodes, HttpServletResponse response,String type) {
List<JpStation> jpStation=jpStationServiceImpl.getJpStation(new JpStationDto());
List<String> stationIds = jpStation.stream().map(jpStation1 -> jpStation1.getThirdStationId()).collect(Collectors.toList());
if(StringUtils.isEmpty(time)){
time = DateUtil.format(new Date(),"yyyy-MM-dd");
}
List<JpStationDto> jpStationDtos = jpStationServiceImpl.selectReportDate(time, snCodes, type);
try {
setResponseHeadForDowload(response,"电站报表.xls");
EasyExcel.write(response.getOutputStream()).head(JpStationDto.class).excelType(ExcelTypeEnum.XLS).sheet("逆变器日报表").doWrite(jpStationDtos);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public void setResponseHeadForDowload(HttpServletResponse response, String dowloadFileName) {
try {
response.setCharacterEncoding("UTF-8");
response.setHeader("content-Type", "application/vnd.ms-excel");
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
response.setHeader("content-disposition", "attachment;filename=" + URLEncoder.encode(dowloadFileName, "UTF-8"));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
} }
...@@ -335,9 +335,16 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter ...@@ -335,9 +335,16 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter
}else if (date.equals("month")){ }else if (date.equals("month")){
return tdHYGFInverterYearGenerateMapper.selectYearTotal(time, snCode, thirdStationId); return tdHYGFInverterYearGenerateMapper.selectYearTotal(time, snCode, thirdStationId);
}else if (date.equals("year")){ }else if (date.equals("year")){
TdHYGFInverterTotalGenerate tdHYGFInverterTotalGenerate = tdHYGFInverterYearGenerateMapper.selectTotalSum(time, snCode, thirdStationId).get(0); List<TdHYGFInverterTotalGenerate> tdHYGFInverterTotalGenerates = tdHYGFInverterYearGenerateMapper.selectTotalSum(time, snCode, thirdStationId);
if (CollectionUtil.isNotEmpty(tdHYGFInverterTotalGenerates)){
TdHYGFInverterTotalGenerate tdHYGFInverterTotalGenerate = tdHYGFInverterTotalGenerates.get(0);
return Bean.BeantoMap(tdHYGFInverterTotalGenerate) ; return Bean.BeantoMap(tdHYGFInverterTotalGenerate) ;
}
Map<String,Object> map = new HashMap<>();
map.put("fullhour",0);
map.put("income",0);
map.put("generate",0);
return map;
}else { }else {
List<TdHYGFInverterTotalGenerate> maps = tdHYGFInverterYearGenerateMapper.selectTotalSum(null, snCode, thirdStationId); List<TdHYGFInverterTotalGenerate> maps = tdHYGFInverterYearGenerateMapper.selectTotalSum(null, snCode, thirdStationId);
double fullhour = maps.stream().mapToDouble(TdHYGFInverterTotalGenerate::getFullhour).sum(); double fullhour = maps.stream().mapToDouble(TdHYGFInverterTotalGenerate::getFullhour).sum();
......
...@@ -510,9 +510,41 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS ...@@ -510,9 +510,41 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
} }
public List<JpStationDto> selectReportDate(String time, List<String> snCodes,String type) {
//权限
List<String> statioId=new ArrayList();
List<JpStation> dataJpStation= this.getJpStation(new JpStationDto());
for (JpStation jpStation : dataJpStation) {
statioId.add(jpStation.getThirdStationId());
}
List<JpStationDto> list = null;
switch (type){
case"day":
LambdaQueryWrapper<DayGenerate> wapper = new LambdaQueryWrapper<DayGenerate>();
wapper.in(statioId!=null,DayGenerate::getThirdStationId,statioId);
wapper.eq(DayGenerate::getDayTime,time);
List<DayGenerate> listday= dayGenerateMapper.selectList(wapper);
list = getJpStationDtoday( dataJpStation, listday);
break;
case"month":
LambdaQueryWrapper<MonthGenerate> wapper1 = new LambdaQueryWrapper<MonthGenerate>();
wapper1.in(statioId!=null,MonthGenerate::getThirdStationId,statioId);
wapper1.eq(MonthGenerate::getMonthTime,time);
List<MonthGenerate> listmonth= monthGenerateMapper.selectList(wapper1);
list = getJpStationDtomonth( dataJpStation, listmonth);
break;
case"year":
LambdaQueryWrapper<YearGenerate> wapper2 = new LambdaQueryWrapper<YearGenerate>();
wapper2.in(statioId!=null,YearGenerate::getThirdStationId,statioId);
wapper2.eq(YearGenerate::getYear,time);
List<YearGenerate> listyear= yearGenerateMapper.selectList(wapper2);
list = getJpStationDtoyear( dataJpStation, listyear);
break;
default:
list = getJpStationDtoAll(dataJpStation);
}
return list;
}
} }
\ No newline at end of file
...@@ -161,4 +161,10 @@ public class PersonBasic extends BaseEntity { ...@@ -161,4 +161,10 @@ public class PersonBasic extends BaseEntity {
*/ */
@TableField("qrcode_desc") @TableField("qrcode_desc")
private String qrcodeDesc; private String qrcodeDesc;
/**
* 赋码颜色描述
*/
@TableField("qrcode_date")
private Date qrcodeDate;
} }
...@@ -27,6 +27,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper; ...@@ -27,6 +27,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -284,8 +285,11 @@ public class PersonQrCodeController extends BaseController { ...@@ -284,8 +285,11 @@ public class PersonQrCodeController extends BaseController {
item.put("name", name); item.put("name", name);
item.put("faultInfo", "该存在缺陷或者告警"); item.put("faultInfo", "该存在缺陷或者告警");
item.put("faultLevel", "严重"); item.put("faultLevel", "严重");
if (!Objects.isNull(score)) { if (!Objects.isNull(score) && equipYardByPageCount != 0) {
item.put("mark", new BigDecimal(100).subtract(score));
BigDecimal divide = new BigDecimal(100).subtract(score).divide(BigDecimal.valueOf(equipYardByPageCount), 10, 2);
BigDecimal bigDecimal = divide.setScale(PersonBasicServiceImpl.getNonZeroDecimalPlaces(divide), RoundingMode.HALF_UP);
item.put("mark", bigDecimal);
} }
}); });
resultList.setRecords(equipYardByPage); resultList.setRecords(equipYardByPage);
...@@ -300,8 +304,11 @@ public class PersonQrCodeController extends BaseController { ...@@ -300,8 +304,11 @@ public class PersonQrCodeController extends BaseController {
item.put("name", name); item.put("name", name);
item.put("faultInfo", "该任务超时"); item.put("faultInfo", "该任务超时");
item.put("faultLevel", "严重"); item.put("faultLevel", "严重");
if (!Objects.isNull(score)) { if (!Objects.isNull(score) && jobYardByPageCount != 0) {
item.put("mark", new BigDecimal(100).subtract(score));
BigDecimal divide = new BigDecimal(100).subtract(score).divide(BigDecimal.valueOf(jobYardByPageCount), 10, 2);
BigDecimal bigDecimal = divide.setScale(PersonBasicServiceImpl.getNonZeroDecimalPlaces(divide), RoundingMode.HALF_UP);
item.put("mark", bigDecimal);
} }
}); });
resultList.setRecords(jobYardByPage); resultList.setRecords(jobYardByPage);
......
...@@ -23,6 +23,7 @@ import org.typroject.tyboot.component.emq.EmqKeeper; ...@@ -23,6 +23,7 @@ import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -128,8 +129,10 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa ...@@ -128,8 +129,10 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa
item.put("name", name); item.put("name", name);
item.put("faultInfo", "证书不全或临期"); item.put("faultInfo", "证书不全或临期");
item.put("faultLevel", "严重"); item.put("faultLevel", "严重");
if (!Objects.isNull(score)) { if (!Objects.isNull(score) && count != 0) {
item.put("mark", new BigDecimal(100).subtract(score)); BigDecimal divide = new BigDecimal(100).subtract(score).divide(BigDecimal.valueOf(count), 10, 2);
BigDecimal bigDecimal = divide.setScale(getNonZeroDecimalPlaces(divide), RoundingMode.HALF_UP);
item.put("mark", bigDecimal);
} }
}); });
Page<Map<String, Object>> mapPage = new Page<>(); Page<Map<String, Object>> mapPage = new Page<>();
...@@ -140,6 +143,20 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa ...@@ -140,6 +143,20 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa
return mapPage; return mapPage;
} }
public static int getNonZeroDecimalPlaces(BigDecimal number) {
String str = number.stripTrailingZeros().toPlainString();
int index = str.indexOf(".");
if (index < 0) {
return 0;
}
for (int i = index + 1; i < str.length(); i++) {
if (str.charAt(i) != '0') {
return i - index;
}
}
return 0;
}
public Map<String, Object> getPersonDetailInfoByObjectId(String objectId) { public Map<String, Object> getPersonDetailInfoByObjectId(String objectId) {
Map<String, Object> resultMap = personBasicMapper.getPersonDetailInfoByObjectId(objectId); Map<String, Object> resultMap = personBasicMapper.getPersonDetailInfoByObjectId(objectId);
return resultMap; return resultMap;
......
...@@ -14,6 +14,7 @@ import org.typroject.tyboot.component.emq.EmqKeeper; ...@@ -14,6 +14,7 @@ import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.component.emq.EmqxListener; import org.typroject.tyboot.component.emq.EmqxListener;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import java.util.Date;
import java.util.concurrent.BlockingQueue; import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.LinkedBlockingQueue;
...@@ -84,6 +85,7 @@ public class PersonYardMessage extends EmqxListener { ...@@ -84,6 +85,7 @@ public class PersonYardMessage extends EmqxListener {
// } // }
// } else { // } else {
personBasic.setQrcodeColor(codeColor); personBasic.setQrcodeColor(codeColor);
personBasic.setQrcodeDate(new Date());
personBasicMapper.updateById(personBasic); personBasicMapper.updateById(personBasic);
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
......
...@@ -186,7 +186,7 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa ...@@ -186,7 +186,7 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa
PersonBasic personBasic = new PersonBasic(); PersonBasic personBasic = new PersonBasic();
BeanUtils.copyProperties(personUser, personBasic); BeanUtils.copyProperties(personUser, personBasic);
//默认红码 //默认红码
// personBasic.setQrcodeColor(QrcodeColorEnum.RED.getCode()); personBasic.setQrcodeColor(QrcodeColorEnum.RED.getCode());
personBasic.setQrcodeDesc("证书不全"); personBasic.setQrcodeDesc("证书不全");
// 该岗位应获得的证书 // 该岗位应获得的证书
List<String> list2 = new ArrayList<>(); List<String> list2 = new ArrayList<>();
...@@ -221,12 +221,15 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa ...@@ -221,12 +221,15 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa
if (CollectionUtils.isEmpty(list) && isInMonth == 0 && isOver == 0) { if (CollectionUtils.isEmpty(list) && isInMonth == 0 && isOver == 0) {
personBasic.setQrcodeColor(QrcodeColorEnum.GREEN.getCode()); personBasic.setQrcodeColor(QrcodeColorEnum.GREEN.getCode());
personBasic.setQrcodeDesc("证书齐全"); personBasic.setQrcodeDesc("证书齐全");
} else if (CollectionUtils.isEmpty(list) && isOver == 1) { personBasic.setQrcodeDate(new Date());
// personBasic.setQrcodeColor(QrcodeColorEnum.RED.getCode()); } else if ((CollectionUtils.isEmpty(list) && isOver == 1) || (CollectionUtils.isNotEmpty(list))) {
personBasic.setQrcodeColor(QrcodeColorEnum.RED.getCode());
personBasic.setQrcodeDesc("证书不全"); personBasic.setQrcodeDesc("证书不全");
personBasic.setQrcodeDate(new Date());
} else if (CollectionUtils.isEmpty(list) && isOver == 0 && isInMonth == 1) { } else if (CollectionUtils.isEmpty(list) && isOver == 0 && isInMonth == 1) {
// personBasic.setQrcodeColor(QrcodeColorEnum.YELLOW.getCode()); personBasic.setQrcodeColor(QrcodeColorEnum.YELLOW.getCode());
personBasic.setQrcodeDesc("证书临期"); personBasic.setQrcodeDesc("证书临期");
personBasic.setQrcodeDate(new Date());
} }
CompanyModel companyModel = new CompanyModel(); CompanyModel companyModel = new CompanyModel();
//单位 //单位
...@@ -419,12 +422,15 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa ...@@ -419,12 +422,15 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa
if (CollectionUtils.isEmpty(list) && isInMonth == 0 && isOver == 0) { if (CollectionUtils.isEmpty(list) && isInMonth == 0 && isOver == 0) {
personBasic.setQrcodeColor(QrcodeColorEnum.GREEN.getCode()); personBasic.setQrcodeColor(QrcodeColorEnum.GREEN.getCode());
personBasic.setQrcodeDesc("证书齐全"); personBasic.setQrcodeDesc("证书齐全");
} else if (CollectionUtils.isEmpty(list) && isOver == 1) { personBasic.setQrcodeDate(new Date());
} else if ((CollectionUtils.isEmpty(list) && isOver == 1) || (CollectionUtils.isNotEmpty(list))) {
personBasic.setQrcodeColor(QrcodeColorEnum.RED.getCode()); personBasic.setQrcodeColor(QrcodeColorEnum.RED.getCode());
personBasic.setQrcodeDesc("证书不全"); personBasic.setQrcodeDesc("证书不全");
personBasic.setQrcodeDate(new Date());
} else if (CollectionUtils.isEmpty(list) && isOver == 0 && isInMonth == 1) { } else if (CollectionUtils.isEmpty(list) && isOver == 0 && isInMonth == 1) {
personBasic.setQrcodeColor(QrcodeColorEnum.YELLOW.getCode()); personBasic.setQrcodeColor(QrcodeColorEnum.YELLOW.getCode());
personBasic.setQrcodeDesc("证书临期"); personBasic.setQrcodeDesc("证书临期");
personBasic.setQrcodeDate(new Date());
} }
personBasic.setProjectOrgCode(companyModel.getOrgCode()); personBasic.setProjectOrgCode(companyModel.getOrgCode());
personAccount.setProjectName(companyModel.getCompanyName()); personAccount.setProjectName(companyModel.getCompanyName());
......
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