Commit e9aef5b1 by 李小惠

修改导出功能

parent 6738fb42
...@@ -75,4 +75,6 @@ public class TjOrgCountDto implements Serializable { ...@@ -75,4 +75,6 @@ public class TjOrgCountDto implements Serializable {
private Integer level; private Integer level;
private Integer levelNum;
} }
\ No newline at end of file
...@@ -10,10 +10,9 @@ public class TjOrgEqsDto { ...@@ -10,10 +10,9 @@ public class TjOrgEqsDto {
@ExcelProperty("序号") @ExcelProperty("序号")
private Integer numId; private Integer numId;
/**
* 组织机构id
*/
private Integer level; private Integer level;
private Integer levelNum;
/** /**
* 组织机构id * 组织机构id
*/ */
...@@ -70,5 +69,5 @@ public class TjOrgEqsDto { ...@@ -70,5 +69,5 @@ public class TjOrgEqsDto {
private Integer destructionNumber; private Integer destructionNumber;
private List<TjOrgEqsDto> list;
} }
...@@ -27,25 +27,34 @@ public class TjOrgPriceDto { ...@@ -27,25 +27,34 @@ public class TjOrgPriceDto {
private Long parentId; private Long parentId;
// 年初数量 // 年初数量
private Integer startNum; private Integer startNum;
// 年初金额 // 年初金额
private BigDecimal startPrice; private BigDecimal startPrice;
// 年末数量 // 年末数量
private Integer endNum; private Integer endNum;
// 年末金额 // 年末金额
private BigDecimal endPrice; private BigDecimal endPrice;
// 本年度新增数量 // 本年度新增数量
private Integer addNum; private Integer addNum;
private BigDecimal addPrice; private BigDecimal addPrice;
// 本年度销毁数量 // 本年度销毁数量
private Integer destoryNum; private Integer destoryNum;
private BigDecimal destoryPrice; private BigDecimal destoryPrice;
private String sizeId; private String sizeId;
private String sizeName; private String sizeName;
private String typeId; private String typeId;
private String typeName; private String typeName;
//0表示本级数据,1表示直属下级不包含下一级的组织机构 //0表示本级数据,1表示直属下级不包含下一级的组织机构
private Integer level; private Integer level;
private Integer levelNum;
} }
...@@ -16,6 +16,8 @@ public class TjOrgEqsReq extends BaseRequest { ...@@ -16,6 +16,8 @@ public class TjOrgEqsReq extends BaseRequest {
private Integer level; private Integer level;
private String order;
private String column;
// 添加一个用逗号分隔typeIdsList的方法 // 添加一个用逗号分隔typeIdsList的方法
public String getTypeIdsAsString() { public String getTypeIdsAsString() {
return String.join(",", typeIdsList); return String.join(",", typeIdsList);
...@@ -23,4 +25,6 @@ public class TjOrgEqsReq extends BaseRequest { ...@@ -23,4 +25,6 @@ public class TjOrgEqsReq extends BaseRequest {
public String getSizesAsString() { public String getSizesAsString() {
return String.join(",", sizeNameList); return String.join(",", sizeNameList);
} }
} }
...@@ -21,5 +21,7 @@ public class TjOrgPriceReq extends BaseRequest { ...@@ -21,5 +21,7 @@ public class TjOrgPriceReq extends BaseRequest {
private Integer levelNum; private Integer levelNum;
private Integer level; private Integer level;
private String order;
private String column;
} }
...@@ -49,6 +49,7 @@ public class WarehouseReq extends BaseRequest { ...@@ -49,6 +49,7 @@ public class WarehouseReq extends BaseRequest {
private Long orderId; private Long orderId;
private String IncludeLowerLevel; private String IncludeLowerLevel;
private Date startTime; private Date startTime;
private Date endTime; private Date endTime;
} }
\ No newline at end of file
package com.junmp.jyzb.api.bean.vo; package com.junmp.jyzb.api.bean.vo;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.converters.bigdecimal.BigDecimalNumberConverter;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal; import java.math.BigDecimal;
@Data @Data
public class InOrderInfo { public class InOrderInfoVo {
@ExcelProperty("序号") @ExcelProperty("序号")
private Integer numId; private Integer numId;
......
package com.junmp.jyzb.api.bean.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentFontStyle;
import com.alibaba.excel.annotation.write.style.ContentStyle;
import com.alibaba.excel.enums.poi.BorderStyleEnum;
import com.alibaba.excel.enums.poi.VerticalAlignmentEnum;
import lombok.Data;
import static com.alibaba.excel.enums.poi.HorizontalAlignmentEnum.CENTER;
@Data
public class TjOrgCountExportVo {
/**
* 类型名称
*/
@ExcelProperty("类型名称")
@ColumnWidth(10)
@ContentFontStyle(fontName = "宋体",fontHeightInPoints = 11)
@ContentStyle(horizontalAlignment = CENTER ,verticalAlignment = VerticalAlignmentEnum.CENTER,
borderLeft = BorderStyleEnum.THIN, borderBottom = BorderStyleEnum.THIN,
borderTop = BorderStyleEnum.THIN, borderRight = BorderStyleEnum.THIN)
private String typeName;
/**
* 号型名称
*/
@ExcelProperty("号型名称")
@ColumnWidth(10)
@ContentFontStyle(fontName = "宋体",fontHeightInPoints = 11)
@ContentStyle(horizontalAlignment = CENTER ,verticalAlignment = VerticalAlignmentEnum.CENTER,
borderLeft = BorderStyleEnum.THIN, borderBottom = BorderStyleEnum.THIN,
borderTop = BorderStyleEnum.THIN, borderRight = BorderStyleEnum.THIN)
private String sizeName;
/**
* 装备总数
*/
@ExcelProperty("装备总数")
@ColumnWidth(10)
@ContentFontStyle(fontName = "宋体",fontHeightInPoints = 11)
@ContentStyle(horizontalAlignment = CENTER ,verticalAlignment = VerticalAlignmentEnum.CENTER,
borderLeft = BorderStyleEnum.THIN, borderBottom = BorderStyleEnum.THIN,
borderTop = BorderStyleEnum.THIN, borderRight = BorderStyleEnum.THIN)
private Integer number;
/**
* 使用次数
*/
@ExcelProperty("使用次数")
@ColumnWidth(10)
@ContentFontStyle(fontName = "宋体",fontHeightInPoints = 11)
@ContentStyle(horizontalAlignment = CENTER ,verticalAlignment = VerticalAlignmentEnum.CENTER,
borderLeft = BorderStyleEnum.THIN, borderBottom = BorderStyleEnum.THIN,
borderTop = BorderStyleEnum.THIN, borderRight = BorderStyleEnum.THIN)
private Integer useCount;
/**
* 维修次数
*/
@ExcelProperty("维修次数")
@ColumnWidth(10)
@ContentFontStyle(fontName = "宋体",fontHeightInPoints = 11)
@ContentStyle(horizontalAlignment = CENTER ,verticalAlignment = VerticalAlignmentEnum.CENTER,
borderLeft = BorderStyleEnum.THIN, borderBottom = BorderStyleEnum.THIN,
borderTop = BorderStyleEnum.THIN, borderRight = BorderStyleEnum.THIN)
private Integer fixCount;
}
package com.junmp.jyzb.api.bean.vo;
import lombok.Data;
@Data
public class TjOrgEqsExportVo {
}
package com.junmp.jyzb.api.bean.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentFontStyle;
import com.alibaba.excel.annotation.write.style.ContentStyle;
import com.alibaba.excel.enums.poi.BorderStyleEnum;
import com.alibaba.excel.enums.poi.VerticalAlignmentEnum;
import lombok.Data;
import static com.alibaba.excel.enums.poi.HorizontalAlignmentEnum.CENTER;
@Data
public class TjOrgPoliceExportVo {
@ExcelProperty("装备名称")
@ColumnWidth(10)
@ContentFontStyle(fontName = "宋体",fontHeightInPoints = 11)
@ContentStyle(horizontalAlignment = CENTER ,verticalAlignment = VerticalAlignmentEnum.CENTER,
borderLeft = BorderStyleEnum.THIN, borderBottom = BorderStyleEnum.THIN,
borderTop = BorderStyleEnum.THIN, borderRight = BorderStyleEnum.THIN)
private String typeName;
@ExcelProperty("号型")
@ColumnWidth(10)
@ContentFontStyle(fontName = "宋体",fontHeightInPoints = 11)
@ContentStyle(horizontalAlignment = CENTER ,verticalAlignment = VerticalAlignmentEnum.CENTER,
borderLeft = BorderStyleEnum.THIN, borderBottom = BorderStyleEnum.THIN,
borderTop = BorderStyleEnum.THIN, borderRight = BorderStyleEnum.THIN)
private String sizeName;
@ExcelProperty("装备总数")
@ColumnWidth(10)
@ContentFontStyle(fontName = "宋体",fontHeightInPoints = 11)
@ContentStyle(horizontalAlignment = CENTER ,verticalAlignment = VerticalAlignmentEnum.CENTER,
borderLeft = BorderStyleEnum.THIN, borderBottom = BorderStyleEnum.THIN,
borderTop = BorderStyleEnum.THIN, borderRight = BorderStyleEnum.THIN)
private Integer num;
@ExcelProperty("在库数")
@ColumnWidth(10)
@ContentFontStyle(fontName = "宋体",fontHeightInPoints = 11)
@ContentStyle(horizontalAlignment = CENTER ,verticalAlignment = VerticalAlignmentEnum.CENTER,
borderLeft = BorderStyleEnum.THIN, borderBottom = BorderStyleEnum.THIN,
borderTop = BorderStyleEnum.THIN, borderRight = BorderStyleEnum.THIN)
private Integer inNum;
@ExcelProperty("出库数")
@ColumnWidth(10)
@ContentFontStyle(fontName = "宋体",fontHeightInPoints = 11)
@ContentStyle(horizontalAlignment = CENTER ,verticalAlignment = VerticalAlignmentEnum.CENTER,
borderLeft = BorderStyleEnum.THIN, borderBottom = BorderStyleEnum.THIN,
borderTop = BorderStyleEnum.THIN, borderRight = BorderStyleEnum.THIN)
private Integer outNum;
}
package com.junmp.jyzb.api.bean.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentFontStyle;
import com.alibaba.excel.annotation.write.style.ContentStyle;
import com.alibaba.excel.enums.poi.BorderStyleEnum;
import com.alibaba.excel.enums.poi.VerticalAlignmentEnum;
import lombok.Data;
import java.math.BigDecimal;
import static com.alibaba.excel.enums.poi.HorizontalAlignmentEnum.CENTER;
@Data
public class TjOrgPriceExportVo {
@ExcelProperty("装备名称")
@ColumnWidth(10)
@ContentFontStyle(fontName = "宋体",fontHeightInPoints = 11)
@ContentStyle(horizontalAlignment = CENTER ,verticalAlignment = VerticalAlignmentEnum.CENTER,
borderLeft = BorderStyleEnum.THIN, borderBottom = BorderStyleEnum.THIN,
borderTop = BorderStyleEnum.THIN, borderRight = BorderStyleEnum.THIN)
private String typeName;
// 年初数量
@ExcelProperty("年初数量")
@ColumnWidth(10)
@ContentFontStyle(fontName = "宋体",fontHeightInPoints = 11)
@ContentStyle(horizontalAlignment = CENTER ,verticalAlignment = VerticalAlignmentEnum.CENTER,
borderLeft = BorderStyleEnum.THIN, borderBottom = BorderStyleEnum.THIN,
borderTop = BorderStyleEnum.THIN, borderRight = BorderStyleEnum.THIN)
private Integer startNum;
// 年初金额
@ExcelProperty("年初金额")
@ColumnWidth(10)
@ContentFontStyle(fontName = "宋体",fontHeightInPoints = 11)
@ContentStyle(horizontalAlignment = CENTER ,verticalAlignment = VerticalAlignmentEnum.CENTER,
borderLeft = BorderStyleEnum.THIN, borderBottom = BorderStyleEnum.THIN,
borderTop = BorderStyleEnum.THIN, borderRight = BorderStyleEnum.THIN)
private BigDecimal startPrice;
// 年末数量
@ExcelProperty("年末数量")
@ColumnWidth(10)
@ContentFontStyle(fontName = "宋体",fontHeightInPoints = 11)
@ContentStyle(horizontalAlignment = CENTER ,verticalAlignment = VerticalAlignmentEnum.CENTER,
borderLeft = BorderStyleEnum.THIN, borderBottom = BorderStyleEnum.THIN,
borderTop = BorderStyleEnum.THIN, borderRight = BorderStyleEnum.THIN)
private Integer endNum;
// 年末金额
@ExcelProperty("年末金额")
@ColumnWidth(10)
@ContentFontStyle(fontName = "宋体",fontHeightInPoints = 11)
@ContentStyle(horizontalAlignment = CENTER ,verticalAlignment = VerticalAlignmentEnum.CENTER,
borderLeft = BorderStyleEnum.THIN, borderBottom = BorderStyleEnum.THIN,
borderTop = BorderStyleEnum.THIN, borderRight = BorderStyleEnum.THIN)
private BigDecimal endPrice;
// 本年度新增数量
@ExcelProperty("本年度新增数量")
@ColumnWidth(10)
@ContentFontStyle(fontName = "宋体",fontHeightInPoints = 11)
@ContentStyle(horizontalAlignment = CENTER ,verticalAlignment = VerticalAlignmentEnum.CENTER,
borderLeft = BorderStyleEnum.THIN, borderBottom = BorderStyleEnum.THIN,
borderTop = BorderStyleEnum.THIN, borderRight = BorderStyleEnum.THIN)
private Integer addNum;
// 本年度销毁数量
@ExcelProperty("本年度销毁数量")
@ColumnWidth(10)
@ContentFontStyle(fontName = "宋体",fontHeightInPoints = 11)
@ContentStyle(horizontalAlignment = CENTER ,verticalAlignment = VerticalAlignmentEnum.CENTER,
borderLeft = BorderStyleEnum.THIN, borderBottom = BorderStyleEnum.THIN,
borderTop = BorderStyleEnum.THIN, borderRight = BorderStyleEnum.THIN)
private Integer destoryNum;
}
...@@ -82,6 +82,7 @@ public class TjController { ...@@ -82,6 +82,7 @@ public class TjController {
tjService.TjOrgEqsExport(req); tjService.TjOrgEqsExport(req);
} }
/** /**
*-------------------------------------财务统计报表------------------------------------------ *-------------------------------------财务统计报表------------------------------------------
*/ */
...@@ -116,6 +117,13 @@ public class TjController { ...@@ -116,6 +117,13 @@ public class TjController {
return ApiRes.success(tjService.TjOrgPriceDetailList(req)); return ApiRes.success(tjService.TjOrgPriceDetailList(req));
} }
@PostMapping(path="/TjOrgPriceExport",name="财务报表导出#logType=30")
@ApiOperation("财务报表导出")
public void TjOrgPriceExport(@RequestBody TjOrgPriceReq req){
tjService.TjOrgPriceExport(req);
}
/** /**
* --------------------------------------使用统计报表------------------------------------------- * --------------------------------------使用统计报表-------------------------------------------
*/ */
...@@ -170,6 +178,12 @@ public class TjController { ...@@ -170,6 +178,12 @@ public class TjController {
return ApiRes.success(tjService.TjOutAndInCount(req)); return ApiRes.success(tjService.TjOutAndInCount(req));
} }
@PostMapping(path="/TjOrgCountExport",name="使用报表导出#logType=30")
@ApiOperation("使用报表导出")
public void TjOrgCountExport(@RequestBody TjOrgCountReq req){
tjService.TjOrgCountExport(req);
}
/** /**
* --------------------------------------人员统计报表------------------------------------------- * --------------------------------------人员统计报表-------------------------------------------
*/ */
...@@ -196,18 +210,28 @@ public class TjController { ...@@ -196,18 +210,28 @@ public class TjController {
return ApiRes.success(tjService.TjOrgPoliceDetailList(req)); return ApiRes.success(tjService.TjOrgPoliceDetailList(req));
} }
@PostMapping(path="/TjOrgPoliceExport",name="人员报表导出#logType=30")
@ApiOperation("人员报表导出")
public void TjOrgPoliceExport(@RequestBody TjOrgPoliceReq req){
tjService.TjOrgPoliceExport(req);
}
/** /**
* --------------------------------------温湿度记录------------------------------------------- * --------------------------------------温湿度记录-------------------------------------------
*/ */
@PostMapping("showHumidityAndtemperature") @PostMapping("/showHumidityAndtemperature")
@ApiOperation("展示温湿度记录") @ApiOperation("展示温湿度记录")
public ApiRes<List<HumidityAndtemperature>> showHumidityAndtemperature(@RequestBody WarehouseReq req){ public ApiRes<List<HumidityAndtemperature>> showHumidityAndtemperature(@RequestBody WarehouseReq req){
return ApiRes.success(warehouseService.showHumidityAndtemperature(req)); return ApiRes.success(warehouseService.showHumidityAndtemperature(req));
} }
@PostMapping(path="/HumidityAndtemperatureExport",name="温湿度报表导出#logType=30")
@ApiOperation("温湿度报表导出")
public void HumidityAndtemperatureExport(@RequestBody WarehouseReq req){
warehouseService.HumidityAndtemperatureExport(req);
}
......
...@@ -28,7 +28,7 @@ public interface DeviceConfigMapper extends BaseMapper<DeviceConfig> { ...@@ -28,7 +28,7 @@ public interface DeviceConfigMapper extends BaseMapper<DeviceConfig> {
@Param("pageSize") Long pageSize); @Param("pageSize") Long pageSize);
List<String> alignDeviceConfigInfo(@Param("orgId") Long orgId, List<String> alignDeviceConfigInfo(@Param("orgId") Long orgId,
@Param("deviceCode") String deviceCode, @Param("deviceType") Integer deviceType,
@Param("date") String date); @Param("date") String date);
} }
......
...@@ -53,7 +53,7 @@ public interface EquipmentCountSummaryMapper extends BaseMapper<EquipmentCountSu ...@@ -53,7 +53,7 @@ public interface EquipmentCountSummaryMapper extends BaseMapper<EquipmentCountSu
@Param("typeParentId")String typeParentId, @Param("typeParentId")String typeParentId,
@Param("monthList") List<Integer> monthList, @Param("monthList") List<Integer> monthList,
@Param("levelNum")Integer levelNum, @Param("levelNum")Integer levelNum,
@Param("level")Integer level); @Param("level")Integer level,@Param("column")String column,@Param("order")String order);
FinalTjOrgCountDto TjOrgCountSum(@Param("orgId") Long orgId, FinalTjOrgCountDto TjOrgCountSum(@Param("orgId") Long orgId,
......
...@@ -62,7 +62,7 @@ public interface InventorySummaryMapper extends BaseMapper<InventorySummary> { ...@@ -62,7 +62,7 @@ public interface InventorySummaryMapper extends BaseMapper<InventorySummary> {
// @Param("sizeNameList") List<String> sizeNameList, @Param("levelNum") Integer levelNum); // @Param("sizeNameList") List<String> sizeNameList, @Param("levelNum") Integer levelNum);
List<TjOrgEqsDto> getTotalDataDetail(@Param("orgId") String orgId, @Param("typeIdsList") List<String> typeIdsList, List<TjOrgEqsDto> getTotalDataDetail(@Param("orgId") String orgId, @Param("typeIdsList") List<String> typeIdsList,
@Param("sizeNameList") List<String> sizeNameList, @Param("levelNum") Integer levelNum, @Param("sizeNameList") List<String> sizeNameList, @Param("levelNum") Integer levelNum,
@Param("level")Integer level); @Param("level")Integer level,@Param("column")String column,@Param("order")String order);
void useViewOrgeqs(@Param("sql") String sql,@Param("orgId") Long orgId,@Param("sql1") String sql1); void useViewOrgeqs(@Param("sql") String sql,@Param("orgId") Long orgId,@Param("sql1") String sql1);
......
...@@ -13,7 +13,6 @@ import java.util.List; ...@@ -13,7 +13,6 @@ import java.util.List;
public interface TjService { public interface TjService {
List<TjOrgEqsDto> showOrgEqsList(InventoryReq req);
FinalTjOrgEqsDto test(TjOrgEqsReq req); FinalTjOrgEqsDto test(TjOrgEqsReq req);
...@@ -66,4 +65,10 @@ public interface TjService { ...@@ -66,4 +65,10 @@ public interface TjService {
void TjOrgEqsExport(TjOrgEqsReq req); void TjOrgEqsExport(TjOrgEqsReq req);
void TjOrgPriceExport(TjOrgPriceReq req);
void TjOrgCountExport(TjOrgCountReq req);
void TjOrgPoliceExport(TjOrgPoliceReq req);
} }
...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService; ...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.junmp.jyzb.api.bean.dto.FetchingDataDto.WarehouseInfoDto; import com.junmp.jyzb.api.bean.dto.FetchingDataDto.WarehouseInfoDto;
import com.junmp.jyzb.api.bean.dto.WarehouseDto; import com.junmp.jyzb.api.bean.dto.WarehouseDto;
import com.junmp.jyzb.api.bean.query.PolicemanReq; import com.junmp.jyzb.api.bean.query.PolicemanReq;
import com.junmp.jyzb.api.bean.query.TjReq.TjOrgPriceReq;
import com.junmp.jyzb.api.bean.query.WarehouseReq; import com.junmp.jyzb.api.bean.query.WarehouseReq;
import com.junmp.jyzb.api.bean.req.UpdateWarehouseReq; import com.junmp.jyzb.api.bean.req.UpdateWarehouseReq;
import com.junmp.jyzb.entity.Temp.HumidityAndtemperature; import com.junmp.jyzb.entity.Temp.HumidityAndtemperature;
...@@ -56,4 +57,6 @@ public interface WarehouseService extends IService<Warehouse> { ...@@ -56,4 +57,6 @@ public interface WarehouseService extends IService<Warehouse> {
boolean updateHumidityAndtemperature(HumidityAndtemperature req); boolean updateHumidityAndtemperature(HumidityAndtemperature req);
List<HumidityAndtemperature> showHumidityAndtemperature(WarehouseReq req); List<HumidityAndtemperature> showHumidityAndtemperature(WarehouseReq req);
void HumidityAndtemperatureExport(WarehouseReq req);
} }
package com.junmp.jyzb.service.impl; package com.junmp.jyzb.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
...@@ -27,6 +28,7 @@ import org.springframework.stereotype.Service; ...@@ -27,6 +28,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
...@@ -110,7 +112,16 @@ public class DeviceConfigServiceImpl extends ServiceImpl<DeviceConfigMapper, Dev ...@@ -110,7 +112,16 @@ public class DeviceConfigServiceImpl extends ServiceImpl<DeviceConfigMapper, Dev
@Override @Override
public List<String> alignDeviceConfigInfo(UpdateDeivceConfigReq req) { public List<String> alignDeviceConfigInfo(UpdateDeivceConfigReq req) {
String date = DateTimeUtil.TimeLongToString(req.getUpdateTime()); String date = DateTimeUtil.TimeLongToString(req.getUpdateTime());
return deviceConfigMapper.alignDeviceConfigInfo(req.getOrgId(), req.getDeviceCode(), date); String deviceConfigString="";
List<String> deviceConfigList = deviceConfigMapper.alignDeviceConfigInfo(req.getOrgId(), req.getDeviceType(), date);
if (CollectionUtil.isNotEmpty(deviceConfigList) && deviceConfigList.size()>1 && req.getDeviceType()==1){
deviceConfigString = deviceConfigList.get(0);
deviceConfigList.clear();
deviceConfigList.add(deviceConfigString);
}
return deviceConfigList;
} }
......
...@@ -17,7 +17,7 @@ import com.junmp.jyzb.api.bean.query.*; ...@@ -17,7 +17,7 @@ import com.junmp.jyzb.api.bean.query.*;
import com.junmp.jyzb.api.bean.query.InAndOutRecordReq.DetailJsonReq; import com.junmp.jyzb.api.bean.query.InAndOutRecordReq.DetailJsonReq;
import com.junmp.jyzb.api.bean.req.UpdateOrderDetailReq; import com.junmp.jyzb.api.bean.req.UpdateOrderDetailReq;
import com.junmp.jyzb.api.bean.req.UpdateOrderReq; import com.junmp.jyzb.api.bean.req.UpdateOrderReq;
import com.junmp.jyzb.api.bean.vo.InOrderInfo; import com.junmp.jyzb.api.bean.vo.InOrderInfoVo;
import com.junmp.jyzb.api.exception.JYZBAppException; import com.junmp.jyzb.api.exception.JYZBAppException;
import com.junmp.jyzb.api.exception.enums.InventoryExceptionEnum; import com.junmp.jyzb.api.exception.enums.InventoryExceptionEnum;
import com.junmp.jyzb.api.exception.enums.OrderExceptionEnum; import com.junmp.jyzb.api.exception.enums.OrderExceptionEnum;
...@@ -1509,9 +1509,9 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain ...@@ -1509,9 +1509,9 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
@Override @Override
public void InOrderExport(OrderMainReq req) { public void InOrderExport(OrderMainReq req) {
LambdaQueryWrapper<OrderMain> wrapper = createWrapper(req); LambdaQueryWrapper<OrderMain> wrapper = createWrapper(req);
List<InOrderInfo> collect = list(wrapper).stream().map(orderMain -> { List<InOrderInfoVo> collect = list(wrapper).stream().map(orderMain -> {
InOrderInfo inOrderInfo = new InOrderInfo(); InOrderInfoVo inOrderInfoVo = new InOrderInfoVo();
BeanPlusUtil.copyProperties(orderMain, inOrderInfo); BeanPlusUtil.copyProperties(orderMain, inOrderInfoVo);
//装备名称 //装备名称
String inventoryName = ""; String inventoryName = "";
List<OrderDetail> orderDetailList = orderDetailService.QueryList(orderMain.getId()); List<OrderDetail> orderDetailList = orderDetailService.QueryList(orderMain.getId());
...@@ -1519,13 +1519,13 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain ...@@ -1519,13 +1519,13 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
inventoryName = inventoryName + orderDetail.getTypeName() + "/"; inventoryName = inventoryName + orderDetail.getTypeName() + "/";
} }
String substring = inventoryName.substring(0, inventoryName.length() - 1); String substring = inventoryName.substring(0, inventoryName.length() - 1);
inOrderInfo.setInventoryName(substring); inOrderInfoVo.setInventoryName(substring);
//查询字典表设置入库类型 //查询字典表设置入库类型
// List<SysDictItem> list = sysDictItemService.list(new LambdaQueryWrapper<SysDictItem>() // List<SysDictItem> list = sysDictItemService.list(new LambdaQueryWrapper<SysDictItem>()
// .eq(SysDictItem::getItemValue, orderMain.getBussinessType())); // .eq(SysDictItem::getItemValue, orderMain.getBussinessType()));
//// inOrderInfo.setOrderType(itemText); //// inOrderInfo.setOrderType(itemText);
// System.out.println("list = " + list); // System.out.println("list = " + list);
return inOrderInfo; return inOrderInfoVo;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
//设置导出的单据序号 //设置导出的单据序号
...@@ -1535,7 +1535,7 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain ...@@ -1535,7 +1535,7 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
HttpServletResponse response = HttpServletUtil.getResponse(); HttpServletResponse response = HttpServletUtil.getResponse();
ExcelExportParam param = new ExcelExportParam(); ExcelExportParam param = new ExcelExportParam();
param.setDataList(collect); param.setDataList(collect);
param.setClazz(InOrderInfo.class); param.setClazz(InOrderInfoVo.class);
param.setResponse(response); param.setResponse(response);
param.setFileName("入库单据列表.xls"); param.setFileName("入库单据列表.xls");
//对数据进行导出 //对数据进行导出
...@@ -1546,9 +1546,9 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain ...@@ -1546,9 +1546,9 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
@Override @Override
public void OutOrderExport(OrderMainReq req) { public void OutOrderExport(OrderMainReq req) {
LambdaQueryWrapper<OrderMain> wrapper = createWrapper(req); LambdaQueryWrapper<OrderMain> wrapper = createWrapper(req);
List<InOrderInfo> collect = list(wrapper).stream().map(orderMain -> { List<InOrderInfoVo> collect = list(wrapper).stream().map(orderMain -> {
InOrderInfo inOrderInfo = new InOrderInfo(); InOrderInfoVo inOrderInfoVo = new InOrderInfoVo();
BeanPlusUtil.copyProperties(orderMain, inOrderInfo); BeanPlusUtil.copyProperties(orderMain, inOrderInfoVo);
//装备名称 //装备名称
String inventoryName = ""; String inventoryName = "";
List<OrderDetail> orderDetailList = orderDetailService.QueryList(orderMain.getId()); List<OrderDetail> orderDetailList = orderDetailService.QueryList(orderMain.getId());
...@@ -1556,13 +1556,13 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain ...@@ -1556,13 +1556,13 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
inventoryName = inventoryName + orderDetail.getTypeName() + "/"; inventoryName = inventoryName + orderDetail.getTypeName() + "/";
} }
String substring = inventoryName.substring(0, inventoryName.length() - 1); String substring = inventoryName.substring(0, inventoryName.length() - 1);
inOrderInfo.setInventoryName(substring); inOrderInfoVo.setInventoryName(substring);
//查询字典表设置出库类型 //查询字典表设置出库类型
// List<SysDictItem> list = sysDictItemService.list(new LambdaQueryWrapper<SysDictItem>() // List<SysDictItem> list = sysDictItemService.list(new LambdaQueryWrapper<SysDictItem>()
// .eq(SysDictItem::getItemValue, orderMain.getBussinessType())); // .eq(SysDictItem::getItemValue, orderMain.getBussinessType()));
//// inOrderInfo.setOrderType(itemText); //// inOrderInfo.setOrderType(itemText);
// System.out.println("list = " + list); // System.out.println("list = " + list);
return inOrderInfo; return inOrderInfoVo;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
//设置导出的单据序号 //设置导出的单据序号
...@@ -1572,7 +1572,7 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain ...@@ -1572,7 +1572,7 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
HttpServletResponse response = HttpServletUtil.getResponse(); HttpServletResponse response = HttpServletUtil.getResponse();
ExcelExportParam param = new ExcelExportParam(); ExcelExportParam param = new ExcelExportParam();
param.setDataList(collect); param.setDataList(collect);
param.setClazz(InOrderInfo.class); param.setClazz(InOrderInfoVo.class);
param.setResponse(response); param.setResponse(response);
param.setFileName("出库单据列表.xls"); param.setFileName("出库单据列表.xls");
//对数据进行导出 //对数据进行导出
......
package com.junmp.jyzb.service.impl; package com.junmp.jyzb.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.alibaba.excel.support.ExcelTypeEnum;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.junmp.jyzb.api.bean.dto.EqsSumDto; import com.junmp.jyzb.api.bean.dto.EqsSumDto;
import com.junmp.jyzb.api.bean.dto.InventorySumDto; import com.junmp.jyzb.api.bean.dto.InventorySumDto;
...@@ -11,21 +11,22 @@ import com.junmp.jyzb.api.bean.query.TjReq.TjOrgCountReq; ...@@ -11,21 +11,22 @@ import com.junmp.jyzb.api.bean.query.TjReq.TjOrgCountReq;
import com.junmp.jyzb.api.bean.query.TjReq.TjOrgEqsReq; import com.junmp.jyzb.api.bean.query.TjReq.TjOrgEqsReq;
import com.junmp.jyzb.api.bean.query.TjReq.TjOrgPoliceReq; import com.junmp.jyzb.api.bean.query.TjReq.TjOrgPoliceReq;
import com.junmp.jyzb.api.bean.query.TjReq.TjOrgPriceReq; import com.junmp.jyzb.api.bean.query.TjReq.TjOrgPriceReq;
import com.junmp.jyzb.api.bean.vo.InOrderInfo; import com.junmp.jyzb.api.bean.vo.InOrderInfoVo;
import com.junmp.jyzb.api.bean.vo.TjOrgCountExportVo;
import com.junmp.jyzb.api.bean.vo.TjOrgPoliceExportVo;
import com.junmp.jyzb.api.bean.vo.TjOrgPriceExportVo;
import com.junmp.jyzb.entity.PubOrg; import com.junmp.jyzb.entity.PubOrg;
import com.junmp.jyzb.mapper.*; import com.junmp.jyzb.mapper.*;
import com.junmp.jyzb.service.EquipmentSizeService;
import com.junmp.jyzb.service.InventorySummaryService; import com.junmp.jyzb.service.InventorySummaryService;
import com.junmp.jyzb.service.PubOrgService; import com.junmp.jyzb.service.PubOrgService;
import com.junmp.jyzb.service.TjService; import com.junmp.jyzb.service.TjService;
import com.junmp.v2.common.util.BeanPlusUtil;
import com.junmp.v2.common.util.HttpServletUtil; import com.junmp.v2.common.util.HttpServletUtil;
import com.junmp.v2.db.api.factory.PageFactory; import com.junmp.v2.db.api.factory.PageFactory;
import com.junmp.v2.db.api.factory.PageResultFactory; import com.junmp.v2.db.api.factory.PageResultFactory;
import com.junmp.v2.db.api.page.PageResult; import com.junmp.v2.db.api.page.PageResult;
import com.junmp.v2.dict.service.SysDictItemService;
import com.junmp.v2.office.api.OfficeExcelApi; import com.junmp.v2.office.api.OfficeExcelApi;
import com.junmp.v2.office.api.bean.ExcelExportParam; import com.junmp.v2.office.api.bean.ExcelExportParam;
import liquibase.pro.packaged.Z;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -35,7 +36,6 @@ import java.lang.reflect.Field; ...@@ -35,7 +36,6 @@ import java.lang.reflect.Field;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Service @Service
...@@ -63,60 +63,6 @@ public class TjServiceImpl implements TjService { ...@@ -63,60 +63,6 @@ public class TjServiceImpl implements TjService {
@Resource @Resource
private InventorySummaryService inventorySummaryService; private InventorySummaryService inventorySummaryService;
//装备统计报表 //装备统计报表
@Override
public List<TjOrgEqsDto> showOrgEqsList(InventoryReq req) {
//我先查询出他组织机构id中的数据,然后放在list的第一个,然后将他的下一层全部查询出来以后,根据组织机构编号进行比较,最终输出一个有序的list返回
List<TjOrgEqsDto> list= inventorySummaryMapper.getByOrgId(req.getOrgId());
List<Long> collect1 = list.stream().map(tjOrgEqsDto -> {
Long orgId=tjOrgEqsDto.getOrgId();
return orgId;
}).collect(Collectors.toList());
//将组织机构下库存信息信息查询出来
List<EqsSumDto> childrenList=inventorySummaryMapper.getEqsByOrgId(collect1,req.getTypeId(),req.getSizeId());
Map<Long, List<EqsSumDto>> eqsSumDtoMap = new HashMap<>();
for (EqsSumDto eqsSumDto : childrenList) {
Long orgId = eqsSumDto.getOrgId();
if (eqsSumDtoMap.containsKey(orgId)) {
List<EqsSumDto> eqsSumDtoList = eqsSumDtoMap.get(orgId);
eqsSumDtoList.add(eqsSumDto);
} else {
List<EqsSumDto> eqsSumDtoList = new ArrayList<>();
eqsSumDtoList.add(eqsSumDto);
eqsSumDtoMap.put(orgId, eqsSumDtoList);
}
}
for (TjOrgEqsDto tjOrgEqsDto : list) {
Long orgId = tjOrgEqsDto.getOrgId();
if (eqsSumDtoMap.containsKey(orgId)) {
List<EqsSumDto> eqsSumDtoList = eqsSumDtoMap.get(orgId);
}
}
//对查询的组织机构进行有序排列
List<TjOrgEqsDto> collect = list.stream()
.sorted((o1, o2) -> {
String orgCode1 = o1.getOrgCode();
String orgCode2 = o2.getOrgCode();
// Check if either orgCode contains letters
boolean hasLetter1 = orgCode1.matches(".*[a-zA-Z].*");
boolean hasLetter2 = orgCode2.matches(".*[a-zA-Z].*");
if (hasLetter1 && hasLetter2) {
return orgCode1.compareTo(orgCode2); // Alphabetical order
} else if (hasLetter1) {
return 1; // o2 with letters should come first
} else if (hasLetter2) {
return -1; // o1 with letters should come first
} else {
return orgCode1.compareTo(orgCode2); // Numeric order
}
})
.collect(Collectors.toList());
return collect;
}
@Override @Override
public FinalTjOrgEqsDto test(TjOrgEqsReq req) { public FinalTjOrgEqsDto test(TjOrgEqsReq req) {
...@@ -184,8 +130,14 @@ public class TjServiceImpl implements TjService { ...@@ -184,8 +130,14 @@ public class TjServiceImpl implements TjService {
//将组织机构进行排序后再进行返回 //将组织机构进行排序后再进行返回
Comparator<TjOrgEqsDto> orgComparator = createOrgComparator(); if ((req.getColumn().equals("createTime") && req.getOrder().equals("desc")) ||
Collections.sort(allData, orgComparator); (req.getColumn().equals("createTime") && req.getOrder().equals("asc"))){
Comparator<TjOrgEqsDto> orgComparator = createOrgComparator();
Collections.sort(allData, orgComparator);
}else {
Comparator<Object> columnOrderComparator = createColumnOrderComparator(req.getColumn(), req.getOrder());
Collections.sort(allData, columnOrderComparator);
}
if (ObjectUtil.isNull(req.getPageNo()) && ObjectUtil.isNull(req.getPageSize())) { if (ObjectUtil.isNull(req.getPageNo()) && ObjectUtil.isNull(req.getPageSize())) {
req.setPageNo(1L); req.setPageNo(1L);
...@@ -277,8 +229,15 @@ public class TjServiceImpl implements TjService { ...@@ -277,8 +229,15 @@ public class TjServiceImpl implements TjService {
public List<TjOrgEqsDto> GetTjDataDetail(TjOrgEqsReq req) { public List<TjOrgEqsDto> GetTjDataDetail(TjOrgEqsReq req) {
//先拿到符合条件的组织机构,再遍历组织机构组成数据 //先拿到符合条件的组织机构,再遍历组织机构组成数据
//(如果传其他不是数据库字段参数或者排序规则不是deac或者asc可能会出现错误)
List<TjOrgEqsDto> allData=inventorySummaryMapper.getTotalDataDetail(String.valueOf(req.getOrgId()),req.getTypeIdsList(),req.getSizeNameList(),req.getLevelNum(),req.getLevel()); if (ObjectUtil.isNotNull(req.getColumn()) && !req.getColumn().trim().isEmpty() &&
(req.getOrder().equalsIgnoreCase("asc")|| req.getOrder().equalsIgnoreCase("desc")) &&
ObjectUtil.isNotNull(req.getOrder()) && !req.getOrder().trim().isEmpty()) {
//修改字段,和数据库字段进行统一
req.setColumn(req.getColumn().replaceAll("[A-Z]", "_$0").toLowerCase());
req.setOrder(req.getOrder().toLowerCase());
}
List<TjOrgEqsDto> allData=inventorySummaryMapper.getTotalDataDetail(String.valueOf(req.getOrgId()),req.getTypeIdsList(),req.getSizeNameList(),req.getLevelNum(),req.getLevel(),req.getColumn(),req.getOrder());
if (req.getRemoveEmpty())//如果需要删除数据为0的话,前端传true,否则保留数据为0 if (req.getRemoveEmpty())//如果需要删除数据为0的话,前端传true,否则保留数据为0
...@@ -296,24 +255,119 @@ public class TjServiceImpl implements TjService { ...@@ -296,24 +255,119 @@ public class TjServiceImpl implements TjService {
//装备统计数据导出 //装备统计数据导出
@Override @Override
// public void TjOrgEqsExport(TjOrgEqsReq req) {
// PubOrg pubOrg = pubOrgService.PubOrgExist(req.getOrgId());
// //先拿到符合条件的组织机构,再遍历组织机构组成数据
// //(下一层数据组织机构数据)
// List<String> orgList= inventorySummaryMapper.getTotalData(String.valueOf(req.getOrgId()));
// List<TjOrgEqsDto> allData=new ArrayList<>();
//
// List<CompletableFuture<TjOrgEqsDto>> futures = orgList.stream()
// .map(orgId -> CompletableFuture.supplyAsync(() -> {
// return inventorySummaryMapper.GetInvSum(
// orgId,
// req.getTypeIdsList().isEmpty() ? null : req.getTypeIdsAsString(),
// req.getSizeNameList().isEmpty() ? null : req.getSizesAsString());
// }))
// .collect(Collectors.toList());
//
// CompletableFuture<Void> allOf = CompletableFuture.allOf(futures.toArray(new CompletableFuture[0]));
//
// allOf.join(); // 等待所有 CompletableFuture 完成
//
// allData = futures.stream()
// .map(CompletableFuture::join)
// .collect(Collectors.toList());
// if (req.getOrgId()!=1369509498032808905L)
// {
// TjOrgEqsDto OrgDataSelf=inventorySummaryMapper.GetInvSelfSum(String.valueOf(req.getOrgId()),
// req.getTypeIdsList().isEmpty() ? null : req.getTypeIdsAsString(),
// req.getSizeNameList().isEmpty() ? null : req.getSizesAsString());
// OrgDataSelf.setLevel(0);
// OrgDataSelf.setOrgName(OrgDataSelf.getOrgName()+"本级");
// OrgDataSelf.setDName(OrgDataSelf.getDName()+"本级");
// TjOrgEqsDto OrgData = inventorySummaryMapper.GetSumLeve4(String.valueOf(req.getOrgId()),
// req.getTypeIdsList().isEmpty() ? null : req.getTypeIdsAsString(),
// req.getSizeNameList().isEmpty() ? null : req.getSizesAsString(),pubOrg.getLevelFlag());
// OrgData.setLevel(1);
// OrgData.setOrgName(OrgData.getOrgName()+"直属下级");
// OrgData.setDName(OrgData.getDName()+"直属下级");
// allData.add(OrgDataSelf);//把本级数据加进去
// allData.add(OrgData);//把下级数据加进去
// }
// //查询出来的组织机构进行判断,如果该组织机构下的装备装备总数为0,那么将该组织机构从list中移除
// if (req.getRemoveEmpty()) {
// allData.removeIf(tjOrgEqsDto -> tjOrgEqsDto.getTotalNumber() == 0);
// }
// //将组织机构进行排序后再进行返回
// Comparator<TjOrgEqsDto> orgComparator = createOrgComparator();
// Collections.sort(allData, orgComparator);
// List<TjOrgEqsDto> collect=new ArrayList<>() ;
// for (TjOrgEqsDto tjOrgEqsDto:allData) {
// if (tjOrgEqsDto.getLevel()==1 || tjOrgEqsDto.getLevel()==0){
// tjOrgEqsDto.setLevelNum(1);
// }else {
// tjOrgEqsDto.setLevelNum(0);
// }
// TjOrgEqsReq tjOrgEqsReq = new TjOrgEqsReq();
// BeanPlusUtil.copyProperties(tjOrgEqsDto,tjOrgEqsReq);
// List<TjOrgEqsDto> tjOrgEqsDtos = GetTjDataDetail(tjOrgEqsReq);
// for (int i = 1; i <= tjOrgEqsDtos.size() ; i++) {
// collect.get(i-1).setNumId(i);
// }
// collect.addAll(tjOrgEqsDtos);
// }
// HttpServletResponse response = HttpServletUtil.getResponse();
// ExcelExportParam param = new ExcelExportParam();
// param.setDataList(collect);
// param.setClazz(InOrderInfo.class);
// param.setResponse(response);
// param.setFileName("入库单据列表.xls");
// //对数据进行导出
//
// officeExcelApi.easyExportDownload(param);
//
// }
public void TjOrgEqsExport(TjOrgEqsReq req) { public void TjOrgEqsExport(TjOrgEqsReq req) {
PubOrg pubOrg = pubOrgService.PubOrgExist(req.getOrgId()); PubOrg pubOrg = pubOrgService.PubOrgExist(req.getOrgId());
//先拿到符合条件的组织机构,再遍历组织机构组成数据 //先拿到符合条件的组织机构,再遍历组织机构组成数据
//(下一层数据组织机构数据) //(下一层数据组织机构数据)
List<String> orgList= inventorySummaryMapper.getTotalData(String.valueOf(req.getOrgId())); List<String> orgList= inventorySummaryMapper.getTotalData(String.valueOf(req.getOrgId()));
List<TjOrgEqsDto> allData=new ArrayList<>(); List<TjOrgEqsDto> allData=new ArrayList<>();
for (String orgId:orgList) {
TjOrgEqsDto OrgData=inventorySummaryMapper.GetInvSum( orgId, List<CompletableFuture<TjOrgEqsDto>> futures = orgList.stream()
.map(orgId -> CompletableFuture.supplyAsync(() -> {
return inventorySummaryMapper.GetInvSum(
orgId,
req.getTypeIdsList().isEmpty() ? null : req.getTypeIdsAsString(),
req.getSizeNameList().isEmpty() ? null : req.getSizesAsString());
}))
.collect(Collectors.toList());
CompletableFuture<Void> allOf = CompletableFuture.allOf(futures.toArray(new CompletableFuture[0]));
allOf.join(); // 等待所有 CompletableFuture 完成
allData = futures.stream()
.map(CompletableFuture::join)
.collect(Collectors.toList());
if (req.getOrgId()!=1369509498032808905L)
{
TjOrgEqsDto OrgDataSelf=inventorySummaryMapper.GetInvSelfSum(String.valueOf(req.getOrgId()),
req.getTypeIdsList().isEmpty() ? null : req.getTypeIdsAsString(), req.getTypeIdsList().isEmpty() ? null : req.getTypeIdsAsString(),
req.getSizeNameList().isEmpty() ? null : req.getSizesAsString()); req.getSizeNameList().isEmpty() ? null : req.getSizesAsString());
allData.add(OrgData); OrgDataSelf.setLevel(0);
} OrgDataSelf.setOrgName(OrgDataSelf.getOrgName()+"本级");
if (req.getOrgId()!=1369509498032808905L) { OrgDataSelf.setDName(OrgDataSelf.getDName()+"本级");
TjOrgEqsDto OrgData = inventorySummaryMapper.GetSumLeve4(String.valueOf(req.getOrgId()), TjOrgEqsDto OrgData = inventorySummaryMapper.GetSumLeve4(String.valueOf(req.getOrgId()),
req.getTypeIdsList().isEmpty() ? null : req.getTypeIdsAsString(), req.getTypeIdsList().isEmpty() ? null : req.getTypeIdsAsString(),
req.getSizeNameList().isEmpty() ? null : req.getSizesAsString(),pubOrg.getLevelFlag()); req.getSizeNameList().isEmpty() ? null : req.getSizesAsString(),pubOrg.getLevelFlag());
allData.add(OrgData);//把本级数据加进去 OrgData.setLevel(1);
OrgData.setOrgName(OrgData.getOrgName()+"直属下级");
OrgData.setDName(OrgData.getDName()+"直属下级");
allData.add(OrgDataSelf);//把本级数据加进去
allData.add(OrgData);//把下级数据加进去
} }
//查询出来的组织机构进行判断,如果该组织机构下的装备装备总数为0,那么将该组织机构从list中移除 //查询出来的组织机构进行判断,如果该组织机构下的装备装备总数为0,那么将该组织机构从list中移除
if (req.getRemoveEmpty()) { if (req.getRemoveEmpty()) {
...@@ -324,7 +378,14 @@ public class TjServiceImpl implements TjService { ...@@ -324,7 +378,14 @@ public class TjServiceImpl implements TjService {
Collections.sort(allData, orgComparator); Collections.sort(allData, orgComparator);
List<TjOrgEqsDto> collect=new ArrayList<>() ; List<TjOrgEqsDto> collect=new ArrayList<>() ;
for (TjOrgEqsDto tjOrgEqsDto:allData) { for (TjOrgEqsDto tjOrgEqsDto:allData) {
List<TjOrgEqsDto> tjOrgEqsDtos = GetTjDataDetail(req); if (tjOrgEqsDto.getLevel()==1 || tjOrgEqsDto.getLevel()==0){
tjOrgEqsDto.setLevelNum(1);
}else {
tjOrgEqsDto.setLevelNum(0);
}
TjOrgEqsReq tjOrgEqsReq = new TjOrgEqsReq();
BeanPlusUtil.copyProperties(tjOrgEqsDto,tjOrgEqsReq);
List<TjOrgEqsDto> tjOrgEqsDtos = GetTjDataDetail(tjOrgEqsReq);
for (int i = 1; i <= tjOrgEqsDtos.size() ; i++) { for (int i = 1; i <= tjOrgEqsDtos.size() ; i++) {
collect.get(i-1).setNumId(i); collect.get(i-1).setNumId(i);
} }
...@@ -333,7 +394,7 @@ public class TjServiceImpl implements TjService { ...@@ -333,7 +394,7 @@ public class TjServiceImpl implements TjService {
HttpServletResponse response = HttpServletUtil.getResponse(); HttpServletResponse response = HttpServletUtil.getResponse();
ExcelExportParam param = new ExcelExportParam(); ExcelExportParam param = new ExcelExportParam();
param.setDataList(collect); param.setDataList(collect);
param.setClazz(InOrderInfo.class); param.setClazz(InOrderInfoVo.class);
param.setResponse(response); param.setResponse(response);
param.setFileName("入库单据列表.xls"); param.setFileName("入库单据列表.xls");
//对数据进行导出 //对数据进行导出
...@@ -343,29 +404,6 @@ public class TjServiceImpl implements TjService { ...@@ -343,29 +404,6 @@ public class TjServiceImpl implements TjService {
} }
private String setSql(TjOrgEqsReq req){
String sql="and 1=1";
// if (!ObjectUtil.isEmpty(req.getTypeIdsList()) && req.getTypeIdsList().size()>0){
// sql+="and type_id in (";
// for (String typeId:req.getTypeIdsList()) {
// sql+=typeId+",";
// }
// sql = sql.substring(0, sql.length() - 1);
// sql+=")";
// }
// if (!ObjectUtil.isEmpty(req.getSizeNameList()) && req.getSizeNameList().size()>0){
// sql+="and size_name in (";
// for (String sizeName:req.getSizeNameList()) {
// sql+="'"+sizeName+"',";
// }
// sql = sql.substring(0, sql.length() - 1);
// sql+=")";
// }
return sql;
}
//查看装备统计详情 //查看装备统计详情
@Override @Override
public PageResult<InventorySumDto> TjOrgEqsDetailPage(TjOrgEqsReq req) { public PageResult<InventorySumDto> TjOrgEqsDetailPage(TjOrgEqsReq req) {
...@@ -389,6 +427,7 @@ public class TjServiceImpl implements TjService { ...@@ -389,6 +427,7 @@ public class TjServiceImpl implements TjService {
req.getSizeNameList(),null,null); req.getSizeNameList(),null,null);
return returnList; return returnList;
} }
//------------------------------------------------财务统计报表-------------------------------------------------------- //------------------------------------------------财务统计报表--------------------------------------------------------
...@@ -413,7 +452,6 @@ public class TjServiceImpl implements TjService { ...@@ -413,7 +452,6 @@ public class TjServiceImpl implements TjService {
.map(CompletableFuture::join) .map(CompletableFuture::join)
.collect(Collectors.toList()); .collect(Collectors.toList());
if (req.getOrgId()!=1369509498032808905L){ if (req.getOrgId()!=1369509498032808905L){
//获取本级数据 //获取本级数据
TjOrgPriceDto OrgDataSelf=priceSumSummaryMapper.TjOrgPriceBySelf(req.getOrgId(), req.getYear(),req.getTypeIdsList(), TjOrgPriceDto OrgDataSelf=priceSumSummaryMapper.TjOrgPriceBySelf(req.getOrgId(), req.getYear(),req.getTypeIdsList(),
...@@ -440,8 +478,14 @@ public class TjServiceImpl implements TjService { ...@@ -440,8 +478,14 @@ public class TjServiceImpl implements TjService {
} }
//对组织机构进行排序 //对组织机构进行排序
Comparator<TjOrgPriceDto> orgComparator = createOrgComparator(); if ((req.getColumn().equals("createTime") && req.getOrder().equals("desc")) ||
Collections.sort(tjOrgPriceDtoList, orgComparator); (req.getColumn().equals("createTime") && req.getOrder().equals("asc"))){
Comparator<TjOrgPriceDto> orgComparator = createOrgComparator();
Collections.sort(tjOrgPriceDtoList, orgComparator);
}else {
Comparator<Object> columnOrderComparator = createColumnOrderComparator(req.getColumn(), req.getOrder());
Collections.sort(tjOrgPriceDtoList, columnOrderComparator);
}
Page<TjOrgPriceDto> page = PageFactory.getDefaultPage(req.getPageNo(), req.getPageSize()); Page<TjOrgPriceDto> page = PageFactory.getDefaultPage(req.getPageNo(), req.getPageSize());
if (ObjectUtil.isNull(req.getPageNo()) && ObjectUtil.isNull(req.getPageSize())) { if (ObjectUtil.isNull(req.getPageNo()) && ObjectUtil.isNull(req.getPageSize())) {
req.setPageNo(1L); req.setPageNo(1L);
...@@ -568,82 +612,91 @@ public class TjServiceImpl implements TjService { ...@@ -568,82 +612,91 @@ public class TjServiceImpl implements TjService {
//自定义排序规则(根据某个字段值进行排序) //自定义排序规则(根据某个字段值进行排序)
public <T> Comparator<T> createColumnOrderComparator(String column,String order) {
return (object1, object2) -> {
try {
Field field = object1.getClass().getDeclaredField(column);
field.setAccessible(true);
Object fieldValue1 = field.get(object1);
Object fieldValue2 = field.get(object2);
if (fieldValue1 instanceof Comparable && fieldValue2 instanceof Comparable) {
int result = ((Comparable) fieldValue1).compareTo(fieldValue2);
return order.equalsIgnoreCase("desc") ? -result : result;
}
} catch (Exception e) {
e.printStackTrace();
}
return 0;
};
}
public <T> Comparator<T> createOrgComparator() { @Override
return (org1,org2) ->{ public void TjOrgPriceExport(TjOrgPriceReq req) {
PubOrg pubOrg = pubOrgService.PubOrgExist(req.getOrgId());
//先拿到符合条件的组织机构,再遍历组织机构组成数据
//(下一层数据组织机构数据)
List<String> orgList= inventorySummaryMapper.getTotalData(String.valueOf(req.getOrgId()));
List<TjOrgPriceDto> tjOrgPriceDtoList=new ArrayList<>();
List<CompletableFuture<TjOrgPriceDto>> futures = orgList.stream()
.map(orgId -> CompletableFuture.supplyAsync(() ->
priceSumSummaryMapper.TjOrgPrice(orgId, req.getYear(),req.getTypeIdsList(),req.getSizeNameList() )
))
.collect(Collectors.toList());
// 等待所有 CompletableFuture 完成
CompletableFuture<Void> allOf = CompletableFuture.allOf(futures.toArray(new CompletableFuture[0]));
//
// 等待所有 CompletableFuture 完成
allOf.join();
try { tjOrgPriceDtoList = futures.stream()
String orgCode1 = (String) org1.getClass().getMethod("getOrgCode").invoke(org1); .map(CompletableFuture::join)
String orgCode2 = (String) org2.getClass().getMethod("getOrgCode").invoke(org2); .collect(Collectors.toList());
// 判断是否包含字母 if (req.getOrgId()!=1369509498032808905L){
boolean hasLetter1 = orgCode1.matches(".*[a-zA-Z]+.*"); //获取本级数据
boolean hasLetter2 = orgCode2.matches(".*[a-zA-Z]+.*"); TjOrgPriceDto OrgDataSelf=priceSumSummaryMapper.TjOrgPriceBySelf(req.getOrgId(), req.getYear(),req.getTypeIdsList(),
req.getSizeNameList());
OrgDataSelf.setLevel(0);
OrgDataSelf.setOrgName(OrgDataSelf.getOrgName()+"本级");
OrgDataSelf.setDName(OrgDataSelf.getDName()+"本级");
OrgDataSelf = fillingEqsEmptyData(OrgDataSelf);
//获取下级数据
TjOrgPriceDto OrgData=priceSumSummaryMapper.TjOrgPriceLeve4(req.getOrgId(), req.getYear(),req.getTypeIdsList(),
req.getSizeNameList(),pubOrg.getLevelFlag());
OrgData.setLevel(1);
OrgData.setOrgName(OrgData.getOrgName()+"直属下级");
OrgData.setDName(OrgData.getDName()+"直属下级");
OrgData=fillingEqsEmptyData(OrgData);
tjOrgPriceDtoList.add(OrgData);//把直属下级数据加进去
tjOrgPriceDtoList.add(OrgDataSelf);//把本级数据加进去
}
// 如果其中一个包含字母,则将其放到排序的最后 //查询出来的组织机构进行判断,如果该组织机构下的装备装备总数为0,那么将该组织机构从list中移除
if (hasLetter1 && !hasLetter2) { if (req.getRemoveEmpty()){
return 1; // orgCode1包含字母,orgCode2不包含字母,orgCode1排在orgCode2后面 tjOrgPriceDtoList.removeIf(tjOrgEqsDto -> tjOrgEqsDto.getStartNum() == 0 && tjOrgEqsDto.getEndNum() == 0
} else if (!hasLetter1 && hasLetter2) { && tjOrgEqsDto.getDestoryNum()==0);
return -1; // orgCode1不包含字母,orgCode2包含字母,orgCode1排在orgCode2前面 }
}
// 如果两个orgCode都不含有字母,则按照每两位进行排序 //对组织机构进行排序
String[] orgCodeArray1 = orgCode1.split("(?<=\\G..)"); Map<String, List<?>> map = new LinkedHashMap<>();
String[] orgCodeArray2 = orgCode2.split("(?<=\\G..)"); Comparator<TjOrgPriceDto> orgComparator = createOrgComparator();
Collections.sort(tjOrgPriceDtoList, orgComparator);
for (TjOrgPriceDto dto: tjOrgPriceDtoList) {
TjOrgPriceReq tjOrgPriceReq = new TjOrgPriceReq();
if (req.getLevel()!=null){
dto.setLevelNum(1);
}else {
dto.setLevelNum(0);
}
BeanPlusUtil.copyProperties(dto,tjOrgPriceReq);
tjOrgPriceReq.setRemoveEmpty(req.getRemoveEmpty());
tjOrgPriceReq.setYear(req.getYear());
List<TjOrgPriceDto> tjOrgPriceDtos = TjOrgPriceDetail(tjOrgPriceReq);
List<TjOrgPriceExportVo> collect = tjOrgPriceDtos.stream().map(tjOrgPriceDto -> {
TjOrgPriceExportVo tjOrgPriceExportVo = new TjOrgPriceExportVo();
BeanPlusUtil.copyProperties(tjOrgPriceDto, tjOrgPriceExportVo);
return tjOrgPriceExportVo;
}).collect(Collectors.toList());
map.put(dto.getDName(),collect);// 将要导出的数据列表放入 map 中,其中 "orgName" 是 sheet 的名称
}
// 从最后一组(即最后两位)开始比较数字大小 HttpServletResponse response = HttpServletUtil.getResponse();
int index1 = orgCodeArray1.length - 1; ExcelExportParam excelExportParam = new ExcelExportParam();
int index2 = orgCodeArray2.length - 1; excelExportParam.setResponse(response); // 设置 HttpServletResponse
while (index1 >= 0 && index2 >= 0) { excelExportParam.setClazz(TjOrgPriceExportVo.class); // 设置实体类的类型
String codeValue1 = orgCodeArray1[index1]; excelExportParam.setFileName("财务统计报表"); // 设置文件名
String codeValue2 = orgCodeArray2[index2]; excelExportParam.setExcelTypeEnum(ExcelTypeEnum.XLSX); // 设置 Excel 类型,比如 XLSX 或 XLS
excelExportParam.setMap(map);
// 调用方法进行导出
officeExcelApi.easyExportManySheet(excelExportParam);
}
// 判断是否可以转换为整数,如果不能,则说明包含字母,直接返回结果
try {
int intValue1 = Integer.parseInt(codeValue1, 10);
int intValue2 = Integer.parseInt(codeValue2, 10);
int compareResult = Integer.compare(intValue1, intValue2);
if (compareResult != 0) {
return compareResult;
}
} catch (NumberFormatException e) {
// orgCode包含字母,直接返回结果
return codeValue1.compareTo(codeValue2);
}
index1--;
index2--;
}
// 在数字比较的基础上,再根据level进行排序 //-------------------------------------------使用统计报表----------------------------------------------------------
Integer level1 = (Integer) org1.getClass().getMethod("getLevel").invoke(org1);
Integer level2 = (Integer) org2.getClass().getMethod("getLevel").invoke(org2);
return Integer.compare(level1, level2);
} catch (Exception e) {
e.printStackTrace();
return 0;
}
};
}
@Override @Override
public PageResult<TjOrgCountDto> TjOrgCount(TjOrgCountReq req) { public PageResult<TjOrgCountDto> TjOrgCount(TjOrgCountReq req) {
...@@ -784,9 +837,16 @@ public class TjServiceImpl implements TjService { ...@@ -784,9 +837,16 @@ public class TjServiceImpl implements TjService {
@Override @Override
public List<TjOrgCountDto> TjOrgCountDetail(TjOrgCountReq req) { public List<TjOrgCountDto> TjOrgCountDetail(TjOrgCountReq req) {
if (ObjectUtil.isNotNull(req.getColumn()) && !req.getColumn().trim().isEmpty() &&
(req.getOrder().equalsIgnoreCase("asc")|| req.getOrder().equalsIgnoreCase("desc")) &&
ObjectUtil.isNotNull(req.getOrder()) && !req.getOrder().trim().isEmpty()) {
//修改字段,和数据库字段进行统一
req.setColumn(req.getColumn().replaceAll("[A-Z]", "_$0").toLowerCase());
req.setOrder(req.getOrder().toLowerCase());
}
List<TjOrgCountDto> tjOrgCountDtoList=equipmentCountSummaryMapper.TjOrgCountTotalNum(req.getOrgId(), List<TjOrgCountDto> tjOrgCountDtoList=equipmentCountSummaryMapper.TjOrgCountTotalNum(req.getOrgId(),
req.getTypeIdsList(),req.getSizeNameList(),req.getYear(),req.getTypeParentId(), req.getTypeIdsList(),req.getSizeNameList(),req.getYear(),req.getTypeParentId(),
req.getMonthList(),req.getLevelNum(),req.getLevel()); req.getMonthList(),req.getLevelNum(),req.getLevel(),req.getColumn(),req.getOrder());
if (req.getRemoveEmpty()){ if (req.getRemoveEmpty()){
tjOrgCountDtoList.removeIf(tjOrgCountDto -> tjOrgCountDto.getNumber()==0 ); tjOrgCountDtoList.removeIf(tjOrgCountDto -> tjOrgCountDto.getNumber()==0 );
} }
...@@ -836,9 +896,100 @@ public class TjServiceImpl implements TjService { ...@@ -836,9 +896,100 @@ public class TjServiceImpl implements TjService {
List<TjOutAndInDto> returnList=logSummaryMapper.TjOutAndInCount(req); List<TjOutAndInDto> returnList=logSummaryMapper.TjOutAndInCount(req);
return returnList; return returnList;
} }
@Override
public void TjOrgCountExport(TjOrgCountReq req) {
PubOrg pubOrg = pubOrgService.PubOrgExist(req.getOrgId());
List<String> orgList= inventorySummaryMapper.getTotalData(String.valueOf(req.getOrgId()));
List<TjOrgCountDto> tjOrgCountList=new ArrayList<>();
List<CompletableFuture<TjOrgCountDto>> futures = orgList.stream()
.map(orgId -> CompletableFuture.supplyAsync(() ->
equipmentCountSummaryMapper.TjOrgCount(orgId,
req.getTypeIdsList(), req.getSizeNameList(),
req.getYear(), req.getTypeParentId(), req.getMonthList()))
)
.collect(Collectors.toList());
// 等待所有 CompletableFuture 完成
CompletableFuture<Void> allOf = CompletableFuture.allOf( futures.toArray(new CompletableFuture[0]));
allOf.join();
tjOrgCountList = futures.stream()
.map(CompletableFuture::join)
.collect(Collectors.toList());
if (req.getOrgId()!=1369509498032808905L){
TjOrgCountDto OrgDataSelf=equipmentCountSummaryMapper.TjOrgCountSelf(req.getOrgId(),
req.getTypeIdsList(),req.getSizeNameList(),req.getYear(),req.getTypeParentId(),
req.getMonthList());
OrgDataSelf.setLevel(0);
OrgDataSelf.setOrgName(OrgDataSelf.getOrgName()+"本级");
OrgDataSelf.setDName(OrgDataSelf.getDName()+"本级");
OrgDataSelf=fillingPriceEmptyData(OrgDataSelf);
TjOrgCountDto OrgData =equipmentCountSummaryMapper.TjOrgCountleve4(req.getOrgId(),
req.getTypeIdsList(),req.getSizeNameList(),req.getYear(),req.getTypeParentId(),
req.getMonthList(),pubOrg.getLevelFlag());
OrgData.setLevel(1);
OrgData.setOrgName(OrgData.getOrgName()+"直属下级");
OrgData.setDName(OrgData.getDName()+"直属下级");
OrgData=fillingPriceEmptyData(OrgData);
tjOrgCountList.add(OrgData);
tjOrgCountList.add(OrgDataSelf);
}
//查询出来的组织机构进行判断,如果该组织机构下的装备装备总数为0,那么将该组织机构从list中移除
if (req.getRemoveEmpty()){
tjOrgCountList.removeIf(TjOrgCountDto -> TjOrgCountDto.getNumber() == 0 );
}
//对组织机构进行排序
//判断是否有排序规则,如果有排序规则且排序规则不是create_time desc,那么直接按照排序规则进行排序,否则按照默认的组织机构code编码进行排序
if ((req.getColumn().equals("createTime") && req.getOrder().equals("desc")) ||
(req.getColumn().equals("createTime") && req.getOrder().equals("asc"))){
Comparator<TjOrgCountDto> orgComparator = createOrgComparator();
Collections.sort(tjOrgCountList, orgComparator);
}else {
Comparator<Object> columnOrderComparator = createColumnOrderComparator(req.getColumn(), req.getOrder());
Collections.sort(tjOrgCountList, columnOrderComparator);
}
//对组织机构进行排序
Map<String, List<?>> map = new LinkedHashMap<>();
for (TjOrgCountDto dto: tjOrgCountList) {
TjOrgCountReq tjOrgCountReq = new TjOrgCountReq();
if (req.getLevel()!=null){
dto.setLevelNum(1);
}else {
dto.setLevelNum(0);
}
BeanPlusUtil.copyProperties(dto,tjOrgCountReq);
tjOrgCountReq.setRemoveEmpty(req.getRemoveEmpty());
tjOrgCountReq.setYear(req.getYear());
List<TjOrgCountDto> tjOrgCountDtoList = TjOrgCountDetail(req);
List<TjOrgCountExportVo> collect = tjOrgCountDtoList.stream().map(tjOrgCountDto -> {
TjOrgCountExportVo tjOrgCountExportVo = new TjOrgCountExportVo();
BeanPlusUtil.copyProperties(tjOrgCountDto, tjOrgCountExportVo);
return tjOrgCountExportVo;
}).collect(Collectors.toList());
map.put(dto.getDName(),collect);// 将要导出的数据列表放入 map 中,其中 "orgName" 是 sheet 的名称
}
HttpServletResponse response = HttpServletUtil.getResponse();
ExcelExportParam excelExportParam = new ExcelExportParam();
excelExportParam.setResponse(response); // 设置 HttpServletResponse
excelExportParam.setClazz(TjOrgCountExportVo.class); // 设置实体类的类型
excelExportParam.setFileName("使用统计报表"); // 设置文件名
excelExportParam.setExcelTypeEnum(ExcelTypeEnum.XLSX); // 设置 Excel 类型,比如 XLSX 或 XLS
excelExportParam.setMap(map);
// 调用方法进行导出
officeExcelApi.easyExportManySheet(excelExportParam);
}
//-------------------------------------------人员统计报表----------------------------------------------------------
@Override @Override
public PageResult<TjOrgPoliceDto> TjOrgPolice(TjOrgPoliceReq req) { public PageResult<TjOrgPoliceDto> TjOrgPolice(TjOrgPoliceReq req) {
int size=policeEquipmentMapper.getCount(req); int size=policeEquipmentMapper.getCount(req);
...@@ -883,5 +1034,116 @@ public class TjServiceImpl implements TjService { ...@@ -883,5 +1034,116 @@ public class TjServiceImpl implements TjService {
return returnList; return returnList;
} }
@Override
public void TjOrgPoliceExport(TjOrgPoliceReq req) {
List<TjOrgPoliceDto> list= policeEquipmentMapper.TjOrgPolice(req,null,null);
Map<String, List<?>> map = new LinkedHashMap<>();
for (TjOrgPoliceDto dto: list) {
req.setPoliceId(dto.getPoliceId());
List<TjOrgPoliceDto> tjOrgPoliceDtos = TjOrgPoliceDetailList(req);
List<TjOrgPoliceExportVo> collect = tjOrgPoliceDtos.stream().map(tjOrgPoliceDto -> {
TjOrgPoliceExportVo tjOrgPoliceExportVo = new TjOrgPoliceExportVo();
BeanPlusUtil.copyProperties(tjOrgPoliceDto, tjOrgPoliceExportVo);
return tjOrgPoliceExportVo;
}).collect(Collectors.toList());
map.put(dto.getPoliceName(),collect);// 将要导出的数据列表放入 map 中,其中 "policeName" 是 sheet 的名称
}
HttpServletResponse response = HttpServletUtil.getResponse();
ExcelExportParam excelExportParam = new ExcelExportParam();
excelExportParam.setResponse(response); // 设置 HttpServletResponse
excelExportParam.setClazz(TjOrgPoliceExportVo.class); // 设置实体类的类型
excelExportParam.setFileName("人员统计报表"); // 设置文件名
excelExportParam.setExcelTypeEnum(ExcelTypeEnum.XLSX); // 设置 Excel 类型,比如 XLSX 或 XLS
excelExportParam.setMap(map);
// 调用方法进行导出
officeExcelApi.easyExportManySheet(excelExportParam);
}
//-----------------------------------------------排序规则方法-------------------------------------------------
//自定义排序
public <T> Comparator<T> createColumnOrderComparator(String column,String order) {
return (object1, object2) -> {
try {
Field field = object1.getClass().getDeclaredField(column);
field.setAccessible(true);
Object fieldValue1 = field.get(object1);
Object fieldValue2 = field.get(object2);
if (fieldValue1 instanceof Comparable && fieldValue2 instanceof Comparable) {
int result = ((Comparable) fieldValue1).compareTo(fieldValue2);
return order.equalsIgnoreCase("desc") ? -result : result;
}
} catch (Exception e) {
e.printStackTrace();
}
return 0;
};
}
//组织机构排序
public <T> Comparator<T> createOrgComparator() {
return (org1,org2) ->{
try {
String orgCode1 = (String) org1.getClass().getMethod("getOrgCode").invoke(org1);
String orgCode2 = (String) org2.getClass().getMethod("getOrgCode").invoke(org2);
// 判断是否包含字母
boolean hasLetter1 = orgCode1.matches(".*[a-zA-Z]+.*");
boolean hasLetter2 = orgCode2.matches(".*[a-zA-Z]+.*");
// 如果其中一个包含字母,则将其放到排序的最后
if (hasLetter1 && !hasLetter2) {
return 1; // orgCode1包含字母,orgCode2不包含字母,orgCode1排在orgCode2后面
} else if (!hasLetter1 && hasLetter2) {
return -1; // orgCode1不包含字母,orgCode2包含字母,orgCode1排在orgCode2前面
}
// 如果两个orgCode都不含有字母,则按照每两位进行排序
String[] orgCodeArray1 = orgCode1.split("(?<=\\G..)");
String[] orgCodeArray2 = orgCode2.split("(?<=\\G..)");
// 从最后一组(即最后两位)开始比较数字大小
int index1 = orgCodeArray1.length - 1;
int index2 = orgCodeArray2.length - 1;
while (index1 >= 0 && index2 >= 0) {
String codeValue1 = orgCodeArray1[index1];
String codeValue2 = orgCodeArray2[index2];
// 判断是否可以转换为整数,如果不能,则说明包含字母,直接返回结果
try {
int intValue1 = Integer.parseInt(codeValue1, 10);
int intValue2 = Integer.parseInt(codeValue2, 10);
int compareResult = Integer.compare(intValue1, intValue2);
if (compareResult != 0) {
return compareResult;
}
} catch (NumberFormatException e) {
// orgCode包含字母,直接返回结果
return codeValue1.compareTo(codeValue2);
}
index1--;
index2--;
}
// 在数字比较的基础上,再根据level进行排序
Integer level1 = (Integer) org1.getClass().getMethod("getLevel").invoke(org1);
Integer level2 = (Integer) org2.getClass().getMethod("getLevel").invoke(org2);
return Integer.compare(level1, level2);
} catch (Exception e) {
e.printStackTrace();
return 0;
}
};
}
} }
...@@ -8,8 +8,10 @@ import com.junmp.jyzb.api.bean.dto.FetchingDataDto.WarehouseInfoDto; ...@@ -8,8 +8,10 @@ import com.junmp.jyzb.api.bean.dto.FetchingDataDto.WarehouseInfoDto;
import com.junmp.jyzb.api.bean.dto.MQDto; import com.junmp.jyzb.api.bean.dto.MQDto;
import com.junmp.jyzb.api.bean.dto.WarehouseDto; import com.junmp.jyzb.api.bean.dto.WarehouseDto;
import com.junmp.jyzb.api.bean.query.PolicemanReq; import com.junmp.jyzb.api.bean.query.PolicemanReq;
import com.junmp.jyzb.api.bean.query.TjReq.TjOrgPriceReq;
import com.junmp.jyzb.api.bean.query.WarehouseReq; import com.junmp.jyzb.api.bean.query.WarehouseReq;
import com.junmp.jyzb.api.bean.req.UpdateWarehouseReq; import com.junmp.jyzb.api.bean.req.UpdateWarehouseReq;
import com.junmp.jyzb.api.bean.vo.InOrderInfoVo;
import com.junmp.jyzb.api.exception.enums.WarehouseExceptionEnum; import com.junmp.jyzb.api.exception.enums.WarehouseExceptionEnum;
import com.junmp.jyzb.cache.TemperatureRedisCache; import com.junmp.jyzb.cache.TemperatureRedisCache;
import com.junmp.jyzb.entity.*; import com.junmp.jyzb.entity.*;
...@@ -21,12 +23,16 @@ import com.junmp.jyzb.service.WarehouseService; ...@@ -21,12 +23,16 @@ import com.junmp.jyzb.service.WarehouseService;
import com.junmp.jyzb.utils.*; import com.junmp.jyzb.utils.*;
import com.junmp.v2.common.exception.base.ServiceException; import com.junmp.v2.common.exception.base.ServiceException;
import com.junmp.v2.common.util.BeanPlusUtil; import com.junmp.v2.common.util.BeanPlusUtil;
import com.junmp.v2.common.util.HttpServletUtil;
import com.junmp.v2.office.api.OfficeExcelApi;
import com.junmp.v2.office.api.bean.ExcelExportParam;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
...@@ -50,6 +56,9 @@ public class WarehouseServiceImpl extends ServiceImpl<WarehouseMapper,Warehouse> ...@@ -50,6 +56,9 @@ public class WarehouseServiceImpl extends ServiceImpl<WarehouseMapper,Warehouse>
@Autowired @Autowired
private RabbitMQSendMsg MQ; private RabbitMQSendMsg MQ;
@Resource
private OfficeExcelApi officeExcelApi;
@Override @Override
...@@ -237,5 +246,18 @@ public class WarehouseServiceImpl extends ServiceImpl<WarehouseMapper,Warehouse> ...@@ -237,5 +246,18 @@ public class WarehouseServiceImpl extends ServiceImpl<WarehouseMapper,Warehouse>
return collect; return collect;
} }
@Override
public void HumidityAndtemperatureExport(WarehouseReq req) {
List<HumidityAndtemperature> collect = showHumidityAndtemperature(req);
HttpServletResponse response = HttpServletUtil.getResponse();
ExcelExportParam param = new ExcelExportParam();
param.setDataList(collect);
param.setClazz(InOrderInfoVo.class);
param.setResponse(response);
param.setFileName("入库单据列表.xls");
//对数据进行导出
officeExcelApi.easyExportDownload(param);
}
} }
...@@ -17,7 +17,7 @@ public class BusinessUtil { ...@@ -17,7 +17,7 @@ public class BusinessUtil {
/** /**
* 创建补齐空数据 * 创建补齐空数据(页面显示补齐数据,如每页10条,当前只有6条数据,再创建4条空数据进行补齐)
*/ */
public static <T> List<T> createNullData(Long size,Long pageNo,Long pageSize,Class<T> clazz) { public static <T> List<T> createNullData(Long size,Long pageNo,Long pageSize,Class<T> clazz) {
......
...@@ -59,15 +59,17 @@ ...@@ -59,15 +59,17 @@
) as a ) as a
</select> </select>
<select id="alignDeviceConfigInfo" resultType="java.lang.String"> <select id="alignDeviceConfigInfo" resultType="java.lang.String">
select device_config from base_device_config where org_id=#{orgId} select device_config from base_device_config where org_id=#{orgId} and device_type=#{deviceType}
<!-- <if test="deviceCode != null and deviceCode != ''">--> <!-- <if test="deviceCode != null and deviceCode != ''">-->
<!-- and device_code=#{deviceCode}--> <!-- and device_code=#{deviceCode}-->
<!-- </if>--> <!-- </if>-->
<!-- <if test="deviceCode == null or deviceCode == ''">--> <!-- <if test="deviceCode == null or deviceCode == ''">-->
<!-- and device_type=0--> <!-- and device_type=0-->
<!-- </if>--> <!-- </if>-->
<if test="date != null and date!= ''"> <if test="date != null and date!= ''">
and update_time &gt; #{date} and update_time &gt; #{date}
</if> </if>
order by update_time desc
</select> </select>
</mapper> </mapper>
...@@ -545,6 +545,9 @@ ...@@ -545,6 +545,9 @@
t.size_id,t.size_name,t.type_id,t.type_name t.size_id,t.size_name,t.type_id,t.type_name
ORDER BY ORDER BY
t.type_id,size_id t.type_id,size_id
<if test="column != null and column != '' and order != null and order != '' ">
order by ${column} ${order}
</if>
</select> </select>
......
...@@ -591,5 +591,32 @@ ...@@ -591,5 +591,32 @@
</if> </if>
</select> </select>
<!-- <select id="alignInventoryInfo" resultType="com.junmp.jyzb.api.bean.dto.FetchingDataDto.EquipmentDto"-->
<!-- parameterType="com.junmp.jyzb.api.bean.query.InventoryReq">-->
<!-- SELECT wi.type_id,wi.size_id,wi.epc,-->
<!-- wi.org_id,wi.location_id,wi.location_type,wi.create_time,wi.update_time-->
<!-- FROM `base_warehouse_inventory` wi-->
<!-- join base_inventory i on i.epc=wi.epc-->
<!-- where wi.org_id=#{orgId}-->
<!-- <if test="locationId!= null and locationId != ''">-->
<!-- and wi.location_id=#{locationId}-->
<!-- </if>-->
<!-- <if test="date!= null and date != ''">-->
<!-- and wi.update_time &gt; #{date}-->
<!-- </if>-->
<!-- <if test="typeIdList != null and typeIdList.size()>0">-->
<!-- and wi.type_id in-->
<!-- <foreach collection="typeIdList" item="item" open="(" separator="," close=")">-->
<!-- #{item}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- <if test="sizeIdList != null and sizeIdList.size()>0">-->
<!-- and wi.size_id in-->
<!-- <foreach collection="sizeIdList" item="item" open="(" separator="," close=")">-->
<!-- #{item}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- </select>-->
</mapper> </mapper>
\ No newline at end of file
...@@ -533,6 +533,9 @@ ...@@ -533,6 +533,9 @@
</foreach> </foreach>
</if> </if>
GROUP BY `po`.`org_id`,`po`.`org_code`,`po`.`org_parent_id`,`po`.`org_name` GROUP BY `po`.`org_id`,`po`.`org_code`,`po`.`org_parent_id`,`po`.`org_name`
<if test="column != null and column != '' and order != null and order != '' ">
order by ${column} ${order}
</if>
</select> </select>
<select id="getSumByViewOrgeqsSum" resultType="com.junmp.jyzb.api.bean.dto.TjDto.FinalTjOrgEqsDto"> <select id="getSumByViewOrgeqsSum" resultType="com.junmp.jyzb.api.bean.dto.TjDto.FinalTjOrgEqsDto">
select sum(total_number) as total_number, select sum(total_number) as total_number,
......
...@@ -29,6 +29,9 @@ ...@@ -29,6 +29,9 @@
and pe.police_name like CONCAT('%', #{req.policeName}, '%') and pe.police_name like CONCAT('%', #{req.policeName}, '%')
</if> </if>
GROUP BY pe.police_id GROUP BY pe.police_id
<if test="pageNo != null and pageNo != '' and pageSize != null and pageSize != '' ">
limit #{pageNo},#{pageSize}
</if>
</select> </select>
<select id="getCount" resultType="java.lang.Integer" <select id="getCount" resultType="java.lang.Integer"
parameterType="com.junmp.jyzb.api.bean.query.TjReq.TjOrgPoliceReq"> parameterType="com.junmp.jyzb.api.bean.query.TjReq.TjOrgPoliceReq">
......
...@@ -62,7 +62,7 @@ mybatis-plus: ...@@ -62,7 +62,7 @@ mybatis-plus:
lazy-loading-enabled: true lazy-loading-enabled: true
multiple-result-sets-enabled: true multiple-result-sets-enabled: true
map-underscore-to-camel-case: true #开启驼峰命名 map-underscore-to-camel-case: true #开启驼峰命名
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl #控制台打印sql语句 log-impl: org.apache.ibatis.logging.stdout.StdOutImpl #控制台打印sql语句
global-config: global-config:
banner: false banner: false
enable-sql-runner: true enable-sql-runner: true
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论