diff --git a/hzims-service-api/assets-api/src/main/java/com/hnac/hzims/spare/vo/SpReceiveVO.java b/hzims-service-api/assets-api/src/main/java/com/hnac/hzims/spare/vo/SpReceiveVO.java
index 8b551c0..49f4839 100644
--- a/hzims-service-api/assets-api/src/main/java/com/hnac/hzims/spare/vo/SpReceiveVO.java
+++ b/hzims-service-api/assets-api/src/main/java/com/hnac/hzims/spare/vo/SpReceiveVO.java
@@ -42,6 +42,9 @@ public class SpReceiveVO extends SpReceiveEntity {
@ApiModelProperty(value = "结束时间")
private String endDate;
+ @ApiModelProperty(value = "领用人ID")
+ private Long userId;
+
private Long sign;
/**
* 备品备件列表
diff --git a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/controller/SpAllocationController.java b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/controller/SpAllocationController.java
index d78fd2d..3c13b80 100644
--- a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/controller/SpAllocationController.java
+++ b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/controller/SpAllocationController.java
@@ -23,6 +23,7 @@ import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
+import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
@@ -80,6 +81,13 @@ public class SpAllocationController extends BladeController {
return R.data(pages);
}
+ @GetMapping("/export")
+ @ApiOperationSupport(order = 3)
+ @ApiOperation(value = "导出", notes = "传入sp_allocation")
+ public void export(SpAllocationVO allocationVO, HttpServletResponse response) {
+ sp_allocationService.export(allocationVO,response);
+ }
+
/**
* 新增 代码自定义代号
*/
diff --git a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/controller/SpReceiveController.java b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/controller/SpReceiveController.java
index 9a48d98..7749ed4 100644
--- a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/controller/SpReceiveController.java
+++ b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/controller/SpReceiveController.java
@@ -23,6 +23,7 @@ import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
+import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
@@ -67,6 +68,13 @@ public class SpReceiveController extends BladeController {
return R.data(pages);
}
+ @GetMapping("/export")
+ @ApiOperationSupport(order = 3)
+ @ApiOperation(value = "导出", notes = "传入sp_receive")
+ public void export(HttpServletResponse response, SpReceiveVO receiveVO) {
+ sp_receiveService.export(response, receiveVO);
+ }
+
/**
* 新增 代码自定义代号
*/
diff --git a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/SpReceiveMapper.xml b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/SpReceiveMapper.xml
index 33fad88..25e29b8 100644
--- a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/SpReceiveMapper.xml
+++ b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/SpReceiveMapper.xml
@@ -61,7 +61,7 @@
and wr.CREATE_TIME #{params.endDate}
-
+
and sw.AFFILIATED_UNIT in
#{item}
diff --git a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/ISpAllocationService.java b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/ISpAllocationService.java
index 45c91a5..7e53d73 100644
--- a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/ISpAllocationService.java
+++ b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/ISpAllocationService.java
@@ -6,6 +6,8 @@ import com.hnac.hzims.spare.entity.SpAllocationEntity;
import com.hnac.hzims.spare.vo.SpAllocationVO;
import org.springblade.core.mp.support.Query;
+import javax.servlet.http.HttpServletResponse;
+
/**
* 服务类
*
@@ -34,6 +36,13 @@ public interface ISpAllocationService extends IService {
IPage selectPageList(IPage page, SpAllocationVO allocationVO) ;
/**
+ * 搭配调拨单
+ * @param allocationVO 查询条件
+ * @param response 响应
+ */
+ void export(SpAllocationVO allocationVO, HttpServletResponse response);
+
+ /**
* 修改状态
* @param bladeFlow
* @return
diff --git a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/ISpReceiveService.java b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/ISpReceiveService.java
index 8882b1a..987e511 100644
--- a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/ISpReceiveService.java
+++ b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/ISpReceiveService.java
@@ -7,6 +7,8 @@ import com.hnac.hzims.spare.vo.SpReceiveVO;
import org.springblade.core.mp.support.Query;
+import javax.servlet.http.HttpServletResponse;
+
/**
* 服务类
*
@@ -34,6 +36,9 @@ public interface ISpReceiveService extends IService {
* @return
*/
IPage selectPageList(IPage page, SpReceiveVO receiveVO) ;
+
+ void export(HttpServletResponse response, SpReceiveVO receiveVO);
+
/**
* 修改状态
* @param bladeFlow
diff --git a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/SpAllocationServiceImpl.java b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/SpAllocationServiceImpl.java
index 048ca65..07b0258 100644
--- a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/SpAllocationServiceImpl.java
+++ b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/SpAllocationServiceImpl.java
@@ -1,8 +1,11 @@
package com.hnac.hzims.spare.service.impl;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.google.common.collect.Lists;
import com.hnac.hzims.spare.chche.AssetsNumCache;
import com.hnac.hzims.spare.entity.*;
import com.hnac.hzims.spare.enume.BusinessType;
@@ -10,6 +13,8 @@ import com.hnac.hzims.spare.mapper.SpAllocationMapper;
import com.hnac.hzims.spare.mapper.SpRecordMapper;
import com.hnac.hzims.spare.mapper.WtSpWarehouseMapper;
import com.hnac.hzims.spare.service.*;
+import com.hnac.hzims.spare.utils.ExcelUtil;
+import com.hnac.hzims.spare.vo.SpAllocationExportVO;
import com.hnac.hzims.spare.vo.SpAllocationVO;
import com.hnac.hzims.spare.vo.WtSpBasicVO;
import lombok.AllArgsConstructor;
@@ -21,23 +26,25 @@ import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.CollectionUtil;
+import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.system.entity.Dept;
import org.springblade.system.feign.IDictBizClient;
import org.springblade.system.feign.ISysClient;
+import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User;
import org.springblade.system.user.feign.IUserClient;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
+import java.util.stream.Collectors;
/**
* 服务实现类
@@ -202,55 +209,47 @@ public class SpAllocationServiceImpl extends ServiceImpl selectPageList(IPage page, SpAllocationVO allocationVO) {
+ return page.setRecords(this.selectList(page,allocationVO));
+ }
+
+ private List selectList(IPage page, SpAllocationVO allocationVO) {
Map params = new HashMap<>();
- if(null !=allocationVO.getCode()){
- params.put("code",allocationVO.getCode());
- }
- if(null !=allocationVO.getStatus()){
- params.put("status",allocationVO.getStatus());
- }
- if(null !=allocationVO.getStartDate()){
- params.put("startDate",allocationVO.getStartDate());
- }
- if(null !=allocationVO.getEndDate()){
- params.put("endDate",allocationVO.getEndDate());
- }
- List longList = new ArrayList<>();
- if(null!=allocationVO.getDeptId()){
- R> deptList = sysClient.getDeptChild(allocationVO.getDeptId());
- for (int i = 0; i < deptList.getData().size(); i++) {
- longList.add(deptList.getData().get(i).getId());
+ params.put("code",allocationVO.getCode());
+ params.put("status",allocationVO.getStatus());
+ params.put("startDate",allocationVO.getStartDate());
+ params.put("endDate",allocationVO.getEndDate());
+ if(Func.isNotEmpty(allocationVO.getDeptId())){
+ List deptIdList = new ArrayList<>();
+ deptIdList.add(allocationVO.getDeptId());
+ R> deptListR = sysClient.getDeptChild(allocationVO.getDeptId());
+ if(deptListR.isSuccess() && CollectionUtil.isNotEmpty(deptListR.getData())) {
+ deptIdList.addAll(deptListR.getData().stream().map(Dept::getId).collect(Collectors.toList()));
}
- longList.add(allocationVO.getDeptId());
- }else{
-// longList = personClient.getShuiChangId(AuthUtil.getDeptId());
- }
- if(longList.size()>0){
- params.put("deptList",longList);
- }
- if(null!=allocationVO.getOutWarehouseId()){
- params.put("outWarehouseId",allocationVO.getOutWarehouseId());
+ params.put("deptList", deptIdList);
}
+ params.put("outWarehouseId",allocationVO.getOutWarehouseId());
params.put("tenantId", AuthUtil.getTenantId());
List list = baseMapper.selectPageList(page,params);
- List result = new ArrayList<>();
- for (int i = 0; i < list.size(); i++) {
- SpAllocationVO entity = list.get(i);
- if(null!=entity.getCreateUser()){
- R user = userClient.userInfoById(entity.getCreateUser());
- if(null!=user.getData()){
- entity.setUserName(user.getData().getName());
- }
- }
- WtSpWarehouseEntity inWarehouseEntity = warehouseMapper.selectById(entity.getInWarehouseId());
- if(ObjectUtil.isNotEmpty(inWarehouseEntity)&&StringUtil.isNotBlank(inWarehouseEntity.getName())){
- entity.setInWarehouseName(inWarehouseEntity.getName());
- }else {
- entity.setInWarehouseName("");
- }
- result.add(entity);
+ return list.stream().peek(this::fillWarehouseName).collect(Collectors.toList());
+ }
+
+ private void fillWarehouseName(SpAllocationVO entity) {
+ String userName = Optional.ofNullable(entity).map(SpAllocationVO::getCreateUser)
+ .map(UserCache::getUser).map(User::getName).orElse(null);
+ entity.setUserName(userName);
+ WtSpWarehouseEntity inWarehouseEntity = warehouseMapper.selectById(entity.getInWarehouseId());
+ if(ObjectUtil.isNotEmpty(inWarehouseEntity)&&StringUtil.isNotBlank(inWarehouseEntity.getName())){
+ entity.setInWarehouseName(inWarehouseEntity.getName());
+ }else {
+ entity.setInWarehouseName("");
}
- return page.setRecords(result);
+ }
+
+ @Override
+ public void export(SpAllocationVO allocationVO, HttpServletResponse response) {
+ List allocationList = this.selectList(null, allocationVO);
+ List data = JSONArray.parseArray(JSON.toJSONString(allocationList), SpAllocationExportVO.class);
+ ExcelUtil.export(response, SpAllocationExportVO.class, data, "调拨单报表", "调拨单");
}
public synchronized boolean updateStatus(SpAllocationEntity allocationEntity) {
diff --git a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/SpReceiveServiceImpl.java b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/SpReceiveServiceImpl.java
index a013be4..a79c870 100644
--- a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/SpReceiveServiceImpl.java
+++ b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/SpReceiveServiceImpl.java
@@ -1,5 +1,7 @@
package com.hnac.hzims.spare.service.impl;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -11,8 +13,10 @@ import com.hnac.hzims.spare.mapper.SpReceiveMapper;
import com.hnac.hzims.spare.mapper.SpRecordMapper;
import com.hnac.hzims.spare.mapper.WtSpWarehouseMapper;
import com.hnac.hzims.spare.service.*;
+import com.hnac.hzims.spare.utils.ExcelUtil;
import com.hnac.hzims.spare.vo.SpReceiveVO;
import com.hnac.hzims.spare.vo.WtSpBasicVO;
+import com.hnac.hzims.spare.vo.SpReceiveExportVO;
import lombok.AllArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -23,6 +27,7 @@ import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.entity.Dept;
import org.springblade.system.feign.IDictBizClient;
@@ -33,9 +38,11 @@ import org.springblade.system.user.feign.IUserClient;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import javax.servlet.http.HttpServletResponse;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;
+import java.util.stream.Collectors;
/**
* 服务实现类
@@ -191,76 +198,57 @@ public class SpReceiveServiceImpl extends ServiceImpl selectPageList(IPage page, SpReceiveVO receiveVO) {
+ return page.setRecords(this.selectList(page,receiveVO));
+ }
+
+ private List selectList(IPage page, SpReceiveVO receiveVO) {
Map params = new HashMap<>();
- if(null !=receiveVO.getCode()){
- params.put("code",receiveVO.getCode());
- }
- if(null !=receiveVO.getStatus()){
- params.put("status",receiveVO.getStatus());
- }
- if(null !=receiveVO.getStartDate()){
- params.put("startDate",receiveVO.getStartDate());
- }
- if(null !=receiveVO.getEndDate()){
- params.put("endDate",receiveVO.getEndDate());
- }
- List longList = new ArrayList<>();
- if(null!=receiveVO.getDeptId()){
- R> deptList = sysClient.getDeptChild(receiveVO.getDeptId());
- for (int i = 0; i < deptList.getData().size(); i++) {
- longList.add(deptList.getData().get(i).getId());
- }
- longList.add(receiveVO.getDeptId());
- }else{
-// longList = personClient.getShuiChangId(AuthUtil.getDeptId());
- }
- if(longList.size()>0){
- params.put("deptList",longList);
- }
- if(null!=receiveVO.getStorageRoom()){
- params.put("warehouseId",receiveVO.getStorageRoom());
- }
- List result = new ArrayList<>();
- BladeUser bladeUser = AuthUtil.getUser();
- if(null!=receiveVO.getUserName()){
- R user = userClient.userByAccount(bladeUser.getTenantId(),receiveVO.getUserName());
- if(null!=user){
- if(null!=user.getData()){
- params.put("createUser",user.getData().getId());
- }else{
- return page.setRecords(result);
- }
+ params.put("code",receiveVO.getCode());
+ params.put("status",receiveVO.getStatus());
+ params.put("startDate",receiveVO.getStartDate());
+ params.put("endDate",receiveVO.getEndDate());
+ List deptIdList = new ArrayList<>();
+ if(Func.isNotEmpty(receiveVO.getDeptId())) {
+ deptIdList.add(receiveVO.getDeptId());
+ R> deptListR = sysClient.getDeptChild(receiveVO.getDeptId());
+ if(deptListR.isSuccess() && CollectionUtil.isNotEmpty(deptListR.getData())) {
+ deptIdList.addAll(deptListR.getData().stream().map(Dept::getId).collect(Collectors.toList()));
}
}
+ params.put("deptList",deptIdList);
+ params.put("warehouseId",receiveVO.getStorageRoom());
+ params.put("createUser",receiveVO.getUserId());
params.put("tenantId", AuthUtil.getTenantId());
List list = baseMapper.selectPageList(page,params);
- for (int i = 0; i < list.size(); i++) {
- SpReceiveVO entity = list.get(i);
- if(null!=entity.getCreateUser()){
- R user = userClient.userInfoById(entity.getCreateUser());
- if(null!=user.getData()){
- entity.setUserName(user.getData().getName());
- }
- }
- List k=new ArrayList<>();
- QueryWrapper queryWrapper = new QueryWrapper();
- queryWrapper.lambda().eq(SpReceivesEntity::getVeceiveId,entity.getId());
- queryWrapper.lambda().eq(SpReceivesEntity::getStatus,1);
- List byId = iSpReceivesService.list(queryWrapper);
- k.addAll(byId);
- QueryWrapper queryWrappers = new QueryWrapper();
- queryWrappers.lambda().eq(SpReceivesEntity::getVeceiveId,entity.getId());
- queryWrappers.lambda().eq(SpReceivesEntity::getStatus,3);
- List id = iSpReceivesService.list(queryWrappers);
- k.addAll(id);
- if (null==k||0==k.size()){
- entity.setSign(2L);
- }else {
- entity.setSign(1L);
- }
- result.add(entity);
+ return list.stream().peek(this::fillDetail).collect(Collectors.toList());
+ }
+
+ private void fillDetail(SpReceiveVO entity) {
+ String userName = Optional.ofNullable(entity.getCreateUser()).map(UserCache::getUser).map(User::getName).orElse(null);
+ entity.setUserName(userName);
+ List k=new ArrayList<>();
+ QueryWrapper queryWrapper = new QueryWrapper();
+ queryWrapper.lambda().eq(SpReceivesEntity::getVeceiveId,entity.getId());
+ queryWrapper.lambda().eq(SpReceivesEntity::getStatus,1);
+ List byId = iSpReceivesService.list(queryWrapper);
+ k.addAll(byId);
+ QueryWrapper queryWrappers = new QueryWrapper();
+ queryWrappers.lambda().eq(SpReceivesEntity::getVeceiveId,entity.getId());
+ queryWrappers.lambda().eq(SpReceivesEntity::getStatus,3);
+ List id = iSpReceivesService.list(queryWrappers);
+ k.addAll(id);
+ if (null==k||0==k.size()){
+ entity.setSign(2L);
+ }else {
+ entity.setSign(1L);
}
- return page.setRecords(result);
+ }
+
+ @Override
+ public void export(HttpServletResponse response, SpReceiveVO receiveVO) {
+ List spReceiveVOS = this.selectList(null, receiveVO);
+ List data = JSONArray.parseArray(JSON.toJSONString(spReceiveVOS), SpReceiveExportVO.class);
+ ExcelUtil.export(response,SpReceiveExportVO.class,data,"工具领用报表","工具领用");
}
public synchronized boolean updateStatus(SpReceiveEntity receiveEntity) {
diff --git a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/utils/ExcelUtil.java b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/utils/ExcelUtil.java
index 6e8989f..6219d30 100644
--- a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/utils/ExcelUtil.java
+++ b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/utils/ExcelUtil.java
@@ -4,10 +4,18 @@ import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.EasyExcelFactory;
import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.excel.write.handler.WriteHandler;
+import com.alibaba.excel.write.metadata.style.WriteCellStyle;
+import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
+import com.hnac.hzims.spare.vo.WtSpToolBasicExportVO;
import org.apache.poi.ss.formula.functions.T;
+import org.apache.poi.ss.usermodel.BorderStyle;
+import javax.servlet.http.HttpServletResponse;
import java.io.File;
+import java.io.IOException;
import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -343,5 +351,37 @@ public class ExcelUtil {
EasyExcel.write(filePath, headClazz).excludeColumnFiledNames(excludeCols).sheet(sheetNo, sheetName).doWrite(data);
}
-
+ /**
+ * 导出excel模板
+ * @param response
+ * @param clazz 导出对象class
+ * @param data 导出数据
+ * @param fileName 文件名
+ * @param sheetName sheet名称
+ * @param 数据泛型类
+ */
+ public static void export(HttpServletResponse response, Class clazz, List data, String fileName, String sheetName) {
+ try {
+ fileName = URLEncoder.encode(fileName, "UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ throw new RuntimeException(e);
+ }
+ response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
+ response.setContentType("application/vnd.ms-excel");
+ response.setCharacterEncoding("UTF-8");
+ WriteCellStyle contentWriteCellStyle = new WriteCellStyle();
+ contentWriteCellStyle.setBorderLeft(BorderStyle.THIN);
+ contentWriteCellStyle.setBorderTop(BorderStyle.THIN);
+ contentWriteCellStyle.setBorderRight(BorderStyle.THIN);
+ contentWriteCellStyle.setBorderBottom(BorderStyle.THIN);
+ contentWriteCellStyle.setWrapped(true);
+ try {
+ EasyExcel.write(response.getOutputStream(), clazz)
+ .registerWriteHandler(new HorizontalCellStyleStrategy(new WriteCellStyle(), contentWriteCellStyle))
+ .autoCloseStream(Boolean.FALSE).sheet(sheetName)
+ .doWrite(data);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
}
diff --git a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/vo/SpAllocationExportVO.java b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/vo/SpAllocationExportVO.java
new file mode 100644
index 0000000..c76e6a2
--- /dev/null
+++ b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/vo/SpAllocationExportVO.java
@@ -0,0 +1,43 @@
+package com.hnac.hzims.spare.vo;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.tool.utils.DateUtil;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @Author: huangxing
+ * @Date: 2024/08/06 14:21
+ */
+@Data
+@EqualsAndHashCode
+public class SpAllocationExportVO implements Serializable {
+
+ @ExcelProperty(value = "单据编码",index = 0)
+ @ColumnWidth(25)
+ private String code;
+
+ @ExcelProperty(value = "拨入库房",index = 1)
+ @ColumnWidth(20)
+ private String inWarehouseName;
+
+ @ExcelProperty(value = "拨出库房",index = 2)
+ @ColumnWidth(20)
+ private String outWarehouseName;
+
+ @ExcelProperty(value = "申请人",index = 3)
+ @ColumnWidth(20)
+ private String userName;
+
+ @ExcelProperty(value = "制单时间",index = 4, format = DateUtil.PATTERN_DATETIME)
+ @ColumnWidth(25)
+ private Date createTime;
+
+}
diff --git a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/vo/SpReceiveExportVO.java b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/vo/SpReceiveExportVO.java
new file mode 100644
index 0000000..5a6af18
--- /dev/null
+++ b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/vo/SpReceiveExportVO.java
@@ -0,0 +1,36 @@
+package com.hnac.hzims.spare.vo;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.tool.utils.DateUtil;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @Author: huangxing
+ * @Date: 2024/08/06 18:58
+ */
+@Data
+@EqualsAndHashCode
+public class SpReceiveExportVO implements Serializable {
+
+ @ExcelProperty(value = "单据编码",index = 0)
+ @ColumnWidth(30)
+ private String code;
+
+ @ExcelProperty(value = "出库库房",index = 1)
+ @ColumnWidth(30)
+ private String warehouseName;
+
+ @ExcelProperty(value = "领用人",index = 2)
+ @ColumnWidth(20)
+ private String userName;
+
+ @ExcelProperty(value = "领用时间",index = 3, format = DateUtil.PATTERN_DATETIME)
+ @ColumnWidth(30)
+ private Date createTime;
+
+}
diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/server/impl/RealTimeDataServerImpl.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/server/impl/RealTimeDataServerImpl.java
index c5c4a0c..1e3700c 100644
--- a/hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/server/impl/RealTimeDataServerImpl.java
+++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/server/impl/RealTimeDataServerImpl.java
@@ -39,18 +39,18 @@ public class RealTimeDataServerImpl implements RealTimeDataServer {
@Override
public R> getData(RealDataSearchPO po) {
R> res = analyseDataSearchClient.getRealDataByAnalyzeCode(po);
- String msg = res.getMsg();
- if ("操作成功".equals(msg)) {
+ if(res.isSuccess()) {
R> realDataResult = analyseDataSearchClient.getRealDataByAnalyzeCode(po);
- List data = Lists.newArrayList();
if(realDataResult.isSuccess()) {
- data.addAll(realDataResult.getData());
+ return R.data(realDataResult.getData());
}
- if (CollectionUtil.isNotEmpty(data)) {
- return R.data(data);
+ else {
+ return R.data(Lists.newArrayList());
}
}
- return R.fail(msg);
+ else {
+ return R.data(Lists.newArrayList());
+ }
}
@Override
diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/EventController.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/EventController.java
index b024cde..9f6eb1b 100644
--- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/EventController.java
+++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/EventController.java
@@ -135,9 +135,14 @@ public class EventController{
typeSmall = dictBizClient.getValue(detail.getTypeBig(),detail.getTypeSmall()).getData();
}
String problemStatus = "待处理";
- R result = flowClient.queryProcessInstanceStatus(detail.getProcessInstanceId());
- if(result.isSuccess()){
- problemStatus = ProcessConstant.ProcessInstanceStatusEnum.over.name().equals(result.getData())?"已处理":"处理中";
+ if(StringUtil.isNotBlank(detail.getProcessInstanceId())) {
+ R result = flowClient.queryProcessInstanceStatus(detail.getProcessInstanceId());
+ if(result.isSuccess()){
+ problemStatus = ProcessConstant.ProcessInstanceStatusEnum.over.name().equals(result.getData())?"已处理":"处理中";
+ }
+ }
+ else {
+ problemStatus = "-";
}
v.setProblem(ProblemVO.builder().problemStatus(problemStatus).typeBig(typeBig).typeSmall(typeSmall).problemDetail(detail.getDescription()).build());
}
diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainServiceImpl.java
index 69507d9..94e9967 100644
--- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainServiceImpl.java
+++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainServiceImpl.java
@@ -1125,25 +1125,35 @@ public class ImsDutyMainServiceImpl extends ServiceImpl collect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getId())).collect(Collectors.toList());
+ if(CollectionUtil.isEmpty(collect)){
+ continue;
+ }
List troubleRunReportList = dutyReportVOList.stream().filter(s -> s.getGroupId().equals(collect.get(0).getDutyGroupId().toString())).collect(Collectors.toList());
DutyRunReportVO troubleRunReport = troubleRunReportList.get(0);
troubleRunReport.setDelayChangeShifts(troubleRunReport.getDelayChangeShifts()+1);
}else if (rec.getDelayStatus().equals(HAND_DELAY_STATUS.getStatus())) {
//如果是交班延迟,算当前的班组+1
List handerCollect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getPreDutyId())).collect(Collectors.toList());
+ if(CollectionUtil.isEmpty(handerCollect)){
+ continue;
+ }
List handerRunReportList = dutyReportVOList.stream().filter(s -> s.getGroupId().equals(handerCollect.get(0).getDutyGroupId().toString())).collect(Collectors.toList());
DutyRunReportVO handerRunRepor = handerRunReportList.get(0);
handerRunRepor.setDelayChangeShifts(handerRunRepor.getDelayChangeShifts()+1);
}else {
//交接班延迟,交接班组都+1
List collect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getId())).collect(Collectors.toList());
+ if(CollectionUtil.isNotEmpty(collect)){
List troubleRunReportList = dutyReportVOList.stream().filter(s -> s.getGroupId().equals(collect.get(0).getDutyGroupId().toString())).collect(Collectors.toList());
DutyRunReportVO troubleRunReport = troubleRunReportList.get(0);
troubleRunReport.setDelayChangeShifts(troubleRunReport.getDelayChangeShifts()+1);
+ }
List handerCollect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getPreDutyId())).collect(Collectors.toList());
+ if(CollectionUtil.isNotEmpty(handerCollect)){
List handerRunReportList = dutyReportVOList.stream().filter(s -> s.getGroupId().equals(handerCollect.get(0).getDutyGroupId().toString())).collect(Collectors.toList());
DutyRunReportVO handerRunRepor = handerRunReportList.get(0);
handerRunRepor.setDelayChangeShifts(handerRunRepor.getDelayChangeShifts()+1);
+ }
}
}
}
@@ -1152,25 +1162,35 @@ public class ImsDutyMainServiceImpl extends ServiceImpl collect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getId())).collect(Collectors.toList());
+ if(CollectionUtil.isEmpty(collect)){
+ continue;
+ }
List troubleRunReportList = dutyReportVOList.stream().filter(s -> s.getGroupId().equals(collect.get(0).getDutyGroupId().toString())).collect(Collectors.toList());
DutyRunReportVO troubleRunReport = troubleRunReportList.get(0);
troubleRunReport.setExceptionChangeShifts(troubleRunReport.getExceptionChangeShifts()+1);
}else if (rec.getDelayStatus().equals(HAND_DELAY_STATUS.getStatus())) {
//如果是交班延迟,算当前的班组+1
List handerCollect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getPreDutyId())).collect(Collectors.toList());
+ if(CollectionUtil.isEmpty(handerCollect)){
+ continue;
+ }
List handerRunReportList = dutyReportVOList.stream().filter(s -> s.getGroupId().equals(handerCollect.get(0).getDutyGroupId().toString())).collect(Collectors.toList());
DutyRunReportVO handerRunRepor = handerRunReportList.get(0);
handerRunRepor.setExceptionChangeShifts(handerRunRepor.getExceptionChangeShifts()+1);
}else {
//交接班延迟,交接班组都+1
List collect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getId())).collect(Collectors.toList());
- List troubleRunReportList = dutyReportVOList.stream().filter(s -> s.getGroupId().equals(collect.get(0).getDutyGroupId().toString())).collect(Collectors.toList());
- DutyRunReportVO troubleRunReport = troubleRunReportList.get(0);
- troubleRunReport.setExceptionChangeShifts(troubleRunReport.getExceptionChangeShifts()+1);
+ if(CollectionUtil.isNotEmpty(collect)) {
+ List troubleRunReportList = dutyReportVOList.stream().filter(s -> s.getGroupId().equals(collect.get(0).getDutyGroupId().toString())).collect(Collectors.toList());
+ DutyRunReportVO troubleRunReport = troubleRunReportList.get(0);
+ troubleRunReport.setExceptionChangeShifts(troubleRunReport.getExceptionChangeShifts() + 1);
+ }
List handerCollect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getPreDutyId())).collect(Collectors.toList());
- List handerRunReportList = dutyReportVOList.stream().filter(s -> s.getGroupId().equals(handerCollect.get(0).getDutyGroupId().toString())).collect(Collectors.toList());
- DutyRunReportVO handerRunRepor = handerRunReportList.get(0);
- handerRunRepor.setExceptionChangeShifts(handerRunRepor.getExceptionChangeShifts()+1);
+ if(CollectionUtil.isNotEmpty(handerCollect)) {
+ List handerRunReportList = dutyReportVOList.stream().filter(s -> s.getGroupId().equals(handerCollect.get(0).getDutyGroupId().toString())).collect(Collectors.toList());
+ DutyRunReportVO handerRunRepor = handerRunReportList.get(0);
+ handerRunRepor.setExceptionChangeShifts(handerRunRepor.getExceptionChangeShifts() + 1);
+ }
}
}
}
diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthReportServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthReportServiceImpl.java
index d22c74b..09b1aa1 100644
--- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthReportServiceImpl.java
+++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthReportServiceImpl.java
@@ -368,7 +368,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
String powerTitle = deptName + "水电运维项目各电站发电量环比对比图(万kWh)";
String powerDomainAxis = "发电量";
String powerRangeAxis = "站点名称";
- ImageEntity powerChainHistogram = JFreeUtil.iCreateBarChart(powerTitle, powerDomainAxis, powerRangeAxis, powerDataset, 500, 400);
+ ImageEntity powerChainHistogram = JFreeUtil.iCreateBarChart(powerTitle, powerDomainAxis, powerRangeAxis, powerDataset, 500, 500);
map.put("powerChainHistogram", powerChainHistogram);
//柱状图下添加的表格
ArrayList> powerMap = new ArrayList<>(powerPercentageVoList.size());
diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/MonthReportServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/MonthReportServiceImpl.java
index 56b8cbc..4b94cc2 100644
--- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/MonthReportServiceImpl.java
+++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/MonthReportServiceImpl.java
@@ -34,69 +34,80 @@ import java.util.List;
@Slf4j
public class MonthReportServiceImpl extends ServiceImpl implements IMonthReportService {
- private final IOperPersonalMonthReportService operPersonalMonthReportService;
- private final IOperStationMonthReportService operStationMonthReportService;
- private final ISysClient sysClient;
+ private final IOperPersonalMonthReportService operPersonalMonthReportService;
+ private final IOperStationMonthReportService operStationMonthReportService;
+ private final ISysClient sysClient;
- @Override
- public StationRunReportAllVO getStationMonthReportByStationCode(Long deptId, String month) throws Exception {
- StationRunReportAllVO stationReportAllVO = new StationRunReportAllVO();
- Dept dept = sysClient.getDept(deptId).getData();
- OperMonthReportEntity operMonthReportEntity = this.getOne(new LambdaQueryWrapper(){{
- eq(OperMonthReportEntity::getMonth,month);
- eq(OperMonthReportEntity::getStationCode, dept.getId());
- eq(OperMonthReportEntity::getIsDeleted, 0);
- orderByDesc(OperMonthReportEntity::getObject);
- last("limit 1;");
- }});
- //查询实时数据
- if(ObjectUtil.isEmpty(operMonthReportEntity)){
- stationReportAllVO = operStationMonthReportService.getStationMonthReportV2(month, BeanUtil.copy(dept, DeptVO.class));
- }
- //历史查询定时任务生成的数据
- else{
- stationReportAllVO = ObjectUtil.isNotEmpty(operMonthReportEntity) ? (StationRunReportAllVO) ObjectHelper.byte2obj(operMonthReportEntity.getObject())
- : operStationMonthReportService.getStationMonthReportV2(month, BeanUtil.copy(dept, DeptVO.class));
- }
- return stationReportAllVO;
- }
+ @Override
+ public StationRunReportAllVO getStationMonthReportByStationCode(Long deptId, String month) throws Exception {
+ StationRunReportAllVO stationReportAllVO = new StationRunReportAllVO();
+ Dept dept = sysClient.getDept(deptId).getData();
+ OperMonthReportEntity operMonthReportEntity = this.getOne(new LambdaQueryWrapper() {{
+ eq(OperMonthReportEntity::getMonth, month);
+ eq(OperMonthReportEntity::getStationCode, dept.getId());
+ eq(OperMonthReportEntity::getIsDeleted, 0);
+ orderByDesc(OperMonthReportEntity::getCreateTime);
+ last("limit 1;");
+ }});
+ //查询实时数据
+ if (ObjectUtil.isEmpty(operMonthReportEntity)) {
+ stationReportAllVO = operStationMonthReportService.getStationMonthReportV2(month, BeanUtil.copy(dept, DeptVO.class));
+ if (ObjectUtil.isNotEmpty(stationReportAllVO)) {
+ OperMonthReportEntity saved = new OperMonthReportEntity();
+ saved.setMonth(month);
+ saved.setType(DictConstant.MONTH_REPORT_STATION);
+ saved.setCreateDept(deptId);
+ saved.setStationCode(deptId.toString());
+ try {
+ saved.setObject(ObjectHelper.obj2byte(stationReportAllVO));
+ } catch (IOException e) {
+ log.error("生成统计月报失败{}", e.toString());
+ e.printStackTrace();
+ }
+ //修改为每运行一次,保存一次
+ this.save(operMonthReportEntity);
+ }
+ }
+ //历史查询定时任务生成的数据
+ else {
+ stationReportAllVO = ObjectUtil.isNotEmpty(operMonthReportEntity) ? (StationRunReportAllVO) ObjectHelper.byte2obj(operMonthReportEntity.getObject())
+ : operStationMonthReportService.getStationMonthReportV2(month, BeanUtil.copy(dept, DeptVO.class));
+ }
+ return stationReportAllVO;
+ }
- @Override
- public void setStationMonthReportByStationCode(Long deptId, String month){
- Dept deptVO = sysClient.getDept(deptId).getData();
- log.info("---{}机构---",deptVO.getDeptName());
- //查询该电站该月报是否已生成月报
- OperMonthReportEntity operMonthReportEntityByMonth = this.getOne(new LambdaQueryWrapper() {{
- eq(OperMonthReportEntity::getMonth, month);
- eq(OperMonthReportEntity::getType, DictConstant.MONTH_REPORT_STATION);
- eq(OperMonthReportEntity::getStationCode, deptVO.getId());
- eq(OperMonthReportEntity::getIsDeleted, 0);
- last("limit 1;");
- }});
-
- if (ObjectUtil.isEmpty(operMonthReportEntityByMonth)||month.equals(YearMonth.now().toString())) {
- if (ObjectUtil.isNotEmpty(operMonthReportEntityByMonth)){
- this.removeById(operMonthReportEntityByMonth.getId());
- }
- //按站点生成各电站运维月报
- StationRunReportAllVO stationReportAllVO = operStationMonthReportService.getStationMonthReportV2(month, BeanUtil.copy(deptVO, DeptVO.class));
- if (ObjectUtil.isNotEmpty(stationReportAllVO)) {
- OperMonthReportEntity operMonthReportEntity = new OperMonthReportEntity();
- operMonthReportEntity.setMonth(month);
- operMonthReportEntity.setType(DictConstant.MONTH_REPORT_STATION);
- operMonthReportEntity.setCreateDept(deptVO.getId());
- operMonthReportEntity.setStationCode(deptVO.getId().toString());
- try {
- operMonthReportEntity.setObject(ObjectHelper.obj2byte(stationReportAllVO));
- } catch (IOException e) {
- e.printStackTrace();
- }
- //修改为每运行一次,保存一次
- this.save(operMonthReportEntity);
- }
- } else {
- log.info("该月{}已生成月报", deptVO.getDeptName());
- }
- }
+ @Override
+ public void setStationMonthReportByStationCode(Long deptId, String month) {
+ Dept deptVO = sysClient.getDept(deptId).getData();
+ log.info("---{}机构---", deptVO.getDeptName());
+ //查询该电站该月报是否已生成月报
+ OperMonthReportEntity operMonthReportEntityByMonth = this.getOne(new LambdaQueryWrapper() {{
+ eq(OperMonthReportEntity::getMonth, month);
+ eq(OperMonthReportEntity::getType, DictConstant.MONTH_REPORT_STATION);
+ eq(OperMonthReportEntity::getStationCode, deptVO.getId());
+ eq(OperMonthReportEntity::getIsDeleted, 0);
+ last("limit 1;");
+ }});
+ if (ObjectUtil.isNotEmpty(operMonthReportEntityByMonth)) {
+ this.removeById(operMonthReportEntityByMonth.getId());
+ }
+ //按站点生成各电站运维月报
+ StationRunReportAllVO stationReportAllVO = operStationMonthReportService.getStationMonthReportV2(month, BeanUtil.copy(deptVO, DeptVO.class));
+ if (ObjectUtil.isNotEmpty(stationReportAllVO)) {
+ OperMonthReportEntity operMonthReportEntity = new OperMonthReportEntity();
+ operMonthReportEntity.setMonth(month);
+ operMonthReportEntity.setType(DictConstant.MONTH_REPORT_STATION);
+ operMonthReportEntity.setCreateDept(deptVO.getId());
+ operMonthReportEntity.setStationCode(deptVO.getId().toString());
+ try {
+ operMonthReportEntity.setObject(ObjectHelper.obj2byte(stationReportAllVO));
+ } catch (IOException e) {
+ log.error("生成统计月报失败{}", e.toString());
+ e.printStackTrace();
+ }
+ //修改为每运行一次,保存一次
+ this.save(operMonthReportEntity);
+ }
+ }
}
diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/dto/WorkTicketInfoDto.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/dto/WorkTicketInfoDto.java
index cefe915..d547e45 100644
--- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/dto/WorkTicketInfoDto.java
+++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/dto/WorkTicketInfoDto.java
@@ -64,4 +64,7 @@ public class WorkTicketInfoDto extends WorkTicketInfoEntity implements Serializa
@ApiModelProperty("创建人")
private String createUserName;
+ @ApiModelProperty("站点机构ID")
+ private Long stationDeptId;
+
}
diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java
index 7da2909..b6c0bb8 100644
--- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java
+++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java
@@ -62,6 +62,9 @@ import org.springblade.flow.core.entity.BladeFlow;
import org.springblade.flow.core.feign.IFlowClient;
import org.springblade.flow.core.vo.ComleteTask;
import org.springblade.system.cache.DictCache;
+import org.springblade.system.entity.Dept;
+import org.springblade.system.feign.IDeptClient;
+import org.springblade.system.feign.ISysClient;
import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User;
import org.springblade.system.user.feign.IUserClient;
@@ -114,6 +117,7 @@ public class WorkTicketInfoServiceImpl extends ServiceImpl deptR = sysClient.getDept(req.getStationDeptId());
+ if(deptR.isSuccess() && Func.isNotEmpty(deptR.getData()) && Func.isNotEmpty(deptR.getData().getStationId())) {
+ lqw.eq(WorkTicketInfoEntity::getSignage,deptR.getData().getStationId());
+ }
+ else {
+ lqw.eq(WorkTicketInfoEntity::getCreateDept,req.getStationDeptId());
+ }
+ }
lqw.orderByDesc(WorkTicketInfoEntity::getCreateTime).orderByDesc(WorkTicketInfoEntity::getUpdateTime);
IPage pages = this.page(Condition.getPage(query), lqw);
//数据转换