优化单行查询(结果集映射)

This commit is contained in:
bgy
2024-09-17 00:35:22 +08:00
parent 38186530c6
commit fe4b315987
4 changed files with 351 additions and 40 deletions
@@ -296,8 +296,8 @@ jeecg:
#webapp文件路径
webapp: /opt/webapp
shiro:
# excludeUrls: /api/internalService/**,/test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**,/api/getUserInfo,/sys/sysDepart/**,/taskSocket/**,/flowSocket/**,/dataCheck/**
excludeUrls: /**/**,/**/**/**
excludeUrls: /api/internalService/**,/test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**,/api/getUserInfo,/sys/sysDepart/**,/taskSocket/**,/flowSocket/**,/dataCheck/**
# excludeUrls: /**/**,/**/**/**
#阿里云oss存储和大鱼短信秘钥配置
oss:
@@ -6,12 +6,14 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostStandardDetail;
import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostStandardResult;
import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostStandardResultService;
import com.zzsmart.qomo.kn.cost.manage.vo.AppSceneCostStandardResultVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -20,6 +22,8 @@ import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
/**
* @Description: app_scene_cost_standard_detail
@@ -47,11 +51,47 @@ public class AppSceneCostStandardResultController extends JeecgController<AppSce
//@AutoLog(value = "app_scene_cost_standard_detail-分页列表查询")
@ApiOperation(value = "app_scene_cost_standard_detail-分页列表查询", notes = "app_scene_cost_standard_detail-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<AppSceneCostStandardResult>> queryPageList(AppSceneCostStandardResult appSceneCostStandardResult, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
public Result<IPage<AppSceneCostStandardResultVO>> queryPageList(AppSceneCostStandardResult appSceneCostStandardResult, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
QueryWrapper<AppSceneCostStandardResult> queryWrapper = QueryGenerator.initQueryWrapper(appSceneCostStandardResult, req.getParameterMap());
Page<AppSceneCostStandardResult> page = new Page<AppSceneCostStandardResult>(pageNo, pageSize);
IPage<AppSceneCostStandardResult> pageList = appSceneCostStandardResultService.page(page, queryWrapper);
return Result.OK(pageList);
IPage<AppSceneCostStandardResultVO> newpageList = new Page<>();
BeanUtils.copyProperties(pageList, newpageList);
List<AppSceneCostStandardResult> list = pageList.getRecords();
List<AppSceneCostStandardResultVO> newList = new ArrayList<>();
for (int i = 0; i < list.size(); i++) {
AppSceneCostStandardResult result = list.get(i);
AppSceneCostStandardResultVO costStandardDetail = AppSceneCostStandardResultVO.builder()
.materialNumber(result.getMaterialNumber())
// .materialName(oldAppSceneCostResultValue.getMarterialNo())
.parentMaterialNumber(result.getParentMatnr())
.versionNumber(result.getVersionNumber())
// .level()
// .sort()
// .figureNumber()
// .dosage(oldAppSceneCostResultValue.getNum() != null ? new Double(oldAppSceneCostResultValue.getNum()) : 0)
// .unit(oldAppSceneCostResultValue.getUnit())
.materialCost(result.getMaterialCostStage())
.laborCost(result.getLaborCostStage())
.equipmentCost(result.getEquipCostStage())
.supplyMaterialCost(result.getAuxiliaryCostStage())
.driveCost(result.getBurningCostStage())
.logisticsCost(result.getStageLogisticsCost())
.otherCost(result.getOtherCostStage())
.currentStandardCost(result.getTotalStandardCostInter())
.totalMaterialCost(result.getMaterialCostAccumulated())
.totalLaborCost(result.getLaborCostAccumulated())
.totalEquipmentCost(result.getEquipCostAccumulated())
.totalSupplyMaterialCost(result.getAuxiliaryCostAccumulated())
.totalDriveCost(result.getBurningCostAccumulated())
.totalLogisticsCost(result.getTotalLogisticsCost())
.totalOtherCost(result.getOtherCostAccumulated())
.totalStandardCost(result.getTotalStandardCost())
.createTime(result.getCreatedTime()).build();
newList.add(costStandardDetail);
}
newpageList.setRecords(newList);
return Result.OK(newpageList);
}
//
// /**
@@ -138,7 +178,7 @@ public class AppSceneCostStandardResultController extends JeecgController<AppSce
* @param appSceneCostStandardDetail
*/
// //@RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_standard_detail:exportXls")
@RequestMapping(value = "/exportXls")
@GetMapping(value = "/exportXls")
@ApiOperation(value = "cost-单行查询导出", notes = "cost-单行查询导出")
public ModelAndView exportXls(HttpServletRequest request, AppSceneCostStandardResult appSceneCostStandardDetail) {
return super.exportXls(request, appSceneCostStandardDetail, AppSceneCostStandardResult.class, "标准成本单行导出");
@@ -32,127 +32,189 @@ import java.util.Date;
public class AppSceneCostStandardDetail implements Serializable {
private static final long serialVersionUID = 1L;
/**id*/
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "id")
private String id;
/**图号*/
/**
* 图号
*/
@Excel(name = "图号", width = 15)
@ApiModelProperty(value = "图号")
private String figureNumber;
/**物料号,关联kn_new_sap_mara表matnr字段*/
/**
* 物料号,关联kn_new_sap_mara表matnr字段
*/
@Excel(name = "物料号,关联kn_new_sap_mara表matnr字段", width = 15)
@ApiModelProperty(value = "物料号,关联kn_new_sap_mara表matnr字段")
private String materialNumber;
/**物料名称*/
/**
* 物料名称
*/
@Excel(name = "物料名称", width = 15)
@ApiModelProperty(value = "物料名称")
private String materialName;
/**父类物料号*/
/**
* 父类物料号
*/
@Excel(name = "父类物料号", width = 15)
@ApiModelProperty(value = "父类物料号")
private String parentMaterialNumber;
/**版本号*/
/**
* 版本号
*/
@Excel(name = "版本号", width = 15)
@ApiModelProperty(value = "版本号")
private String versionNumber;
/**层级*/
/**
* 层级
*/
@Excel(name = "层级", width = 15)
@ApiModelProperty(value = "层级")
private Integer level;
/**序号*/
/**
* 序号
*/
@Excel(name = "序号", width = 15)
@ApiModelProperty(value = "序号")
private Integer sort;
/**用量*/
/**
* 用量
*/
@Excel(name = "用量", width = 15)
@ApiModelProperty(value = "用量")
private Double dosage;
/**单位*/
/**
* 单位
*/
@Excel(name = "单位", width = 15)
@ApiModelProperty(value = "单位")
private String unit;
/**本阶材料费*/
/**
* 本阶材料费
*/
@Excel(name = "本阶材料费", width = 15)
@ApiModelProperty(value = "本阶材料费")
private BigDecimal materialCost;
/**本阶人工费*/
/**
* 本阶人工费
*/
@Excel(name = "本阶人工陈本", width = 15)
@ApiModelProperty(value = "本阶人工成本")
private BigDecimal laborCost;
/**本阶辅料费*/
/**
* 本阶辅料费
*/
@Excel(name = "本阶辅料费", width = 15)
@ApiModelProperty(value = "本阶辅料费")
private BigDecimal supplyMaterialCost;
/**本阶机器折旧费*/
/**
* 本阶机器折旧费
*/
@Excel(name = "本阶机器折旧费", width = 15)
@ApiModelProperty(value = "本阶机器折旧费")
private BigDecimal equipmentCost;
/**本阶水电费(燃动费)*/
/**
* 本阶水电费(燃动费)
*/
@Excel(name = "本阶水电费(燃动费)", width = 15)
@ApiModelProperty(value = "本阶水电费(燃动费)")
private BigDecimal driveCost;
/**本阶其他制造费*/
/**
* 本阶其他制造费
*/
@Excel(name = "本阶其他费用", width = 15)
@ApiModelProperty(value = "本阶其他费用")
private BigDecimal otherCost;
/**本阶物流费*/
/**
* 本阶物流费
*/
@Excel(name = "本阶物流费", width = 15)
@ApiModelProperty(value = "本阶物流费")
private BigDecimal logisticsCost;
/**累计物料成本*/
/**
* 累计物料成本
*/
@Excel(name = "累计物料成本", width = 15)
@ApiModelProperty(value = "累计物料成本")
private BigDecimal totalMaterialCost;
/**累计人工成本*/
/**
* 累计人工成本
*/
@Excel(name = "累计人工成本", width = 15)
@ApiModelProperty(value = "累计人工成本")
private BigDecimal totalLaborCost;
/**累计辅料费*/
/**
* 累计辅料费
*/
@Excel(name = "累计辅料费", width = 15)
@ApiModelProperty(value = "累计辅料费")
private BigDecimal totalSupplyMaterialCost;
/**累计机器折旧费*/
/**
* 累计机器折旧费
*/
@Excel(name = "累计机器折旧费", width = 15)
@ApiModelProperty(value = "累计机器折旧费")
private BigDecimal totalEquipmentCost;
/**累计水电费(燃动费)*/
/**
* 累计水电费(燃动费)
*/
@Excel(name = "累计水电费(燃动费)", width = 15)
@ApiModelProperty(value = "累计水电费(燃动费)")
private BigDecimal totalDriveCost;
/**累计其他费用*/
/**
* 累计其他费用
*/
@Excel(name = "累计其他费用", width = 15)
@ApiModelProperty(value = "累计其他费用")
private BigDecimal totalOtherCost;
/**累计物流费用*/
/**
* 累计物流费用
*/
@Excel(name = "累计物流费用", width = 15)
@ApiModelProperty(value = "累计物流费用")
private BigDecimal totalLogisticsCost;
/**本阶标准成本*/
/**
* 本阶标准成本
*/
@Excel(name = "本阶标准成本", width = 15)
@ApiModelProperty(value = "本阶标准成本")
private BigDecimal currentStandardCost;
/**累计标准成本*/
/**
* 累计标准成本
*/
@Excel(name = "累计标准成本", width = 15)
@ApiModelProperty(value = "累计标准成本")
private BigDecimal totalStandardCost;
/**创建人*/
/**
* 创建人
*/
@ApiModelProperty(value = "创建人")
private String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
/**
* 创建日期
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期")
private Date createTime;
/**修改人*/
/**
* 修改人
*/
@ApiModelProperty(value = "修改人")
private String updateBy;
/**修改日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
/**
* 修改日期
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "修改日期")
private Date updateTime;
/**备注*/
/**
* 备注
*/
@Excel(name = "备注", width = 15)
@ApiModelProperty(value = "备注")
private String remark;
@@ -0,0 +1,209 @@
package com.zzsmart.qomo.kn.cost.manage.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.util.Date;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class AppSceneCostStandardResultVO {
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "id")
private String id;
/**
* 图号
*/
@Excel(name = "图号", width = 15)
@ApiModelProperty(value = "图号")
private String figureNumber;
/**
* 物料号,关联kn_new_sap_mara表matnr字段
*/
@Excel(name = "物料号,关联kn_new_sap_mara表matnr字段", width = 15)
@ApiModelProperty(value = "物料号,关联kn_new_sap_mara表matnr字段")
private String materialNumber;
/**
* 物料名称
*/
@Excel(name = "物料名称", width = 15)
@ApiModelProperty(value = "物料名称")
private String materialName;
/**
* 父类物料号
*/
@Excel(name = "父类物料号", width = 15)
@ApiModelProperty(value = "父类物料号")
private String parentMaterialNumber;
/**
* 版本号
*/
@Excel(name = "版本号", width = 15)
@ApiModelProperty(value = "版本号")
private String versionNumber;
/**
* 层级
*/
@Excel(name = "层级", width = 15)
@ApiModelProperty(value = "层级")
private Integer level;
/**
* 序号
*/
@Excel(name = "序号", width = 15)
@ApiModelProperty(value = "序号")
private Integer sort;
/**
* 用量
*/
@Excel(name = "用量", width = 15)
@ApiModelProperty(value = "用量")
private Double dosage;
/**
* 单位
*/
@Excel(name = "单位", width = 15)
@ApiModelProperty(value = "单位")
private String unit;
/**
* 本阶材料费
*/
@Excel(name = "本阶材料费", width = 15)
@ApiModelProperty(value = "本阶材料费")
private BigDecimal materialCost;
/**
* 本阶人工费
*/
@Excel(name = "本阶人工陈本", width = 15)
@ApiModelProperty(value = "本阶人工成本")
private BigDecimal laborCost;
/**
* 本阶辅料费
*/
@Excel(name = "本阶辅料费", width = 15)
@ApiModelProperty(value = "本阶辅料费")
private BigDecimal supplyMaterialCost;
/**
* 本阶机器折旧费
*/
@Excel(name = "本阶机器折旧费", width = 15)
@ApiModelProperty(value = "本阶机器折旧费")
private BigDecimal equipmentCost;
/**
* 本阶水电费(燃动费)
*/
@Excel(name = "本阶水电费(燃动费)", width = 15)
@ApiModelProperty(value = "本阶水电费(燃动费)")
private BigDecimal driveCost;
/**
* 本阶其他制造费
*/
@Excel(name = "本阶其他费用", width = 15)
@ApiModelProperty(value = "本阶其他费用")
private BigDecimal otherCost;
/**
* 本阶物流费
*/
@Excel(name = "本阶物流费", width = 15)
@ApiModelProperty(value = "本阶物流费")
private BigDecimal logisticsCost;
/**
* 累计物料成本
*/
@Excel(name = "累计物料成本", width = 15)
@ApiModelProperty(value = "累计物料成本")
private BigDecimal totalMaterialCost;
/**
* 累计人工成本
*/
@Excel(name = "累计人工成本", width = 15)
@ApiModelProperty(value = "累计人工成本")
private BigDecimal totalLaborCost;
/**
* 累计辅料费
*/
@Excel(name = "累计辅料费", width = 15)
@ApiModelProperty(value = "累计辅料费")
private BigDecimal totalSupplyMaterialCost;
/**
* 累计机器折旧费
*/
@Excel(name = "累计机器折旧费", width = 15)
@ApiModelProperty(value = "累计机器折旧费")
private BigDecimal totalEquipmentCost;
/**
* 累计水电费(燃动费)
*/
@Excel(name = "累计水电费(燃动费)", width = 15)
@ApiModelProperty(value = "累计水电费(燃动费)")
private BigDecimal totalDriveCost;
/**
* 累计其他费用
*/
@Excel(name = "累计其他费用", width = 15)
@ApiModelProperty(value = "累计其他费用")
private BigDecimal totalOtherCost;
/**
* 累计物流费用
*/
@Excel(name = "累计物流费用", width = 15)
@ApiModelProperty(value = "累计物流费用")
private BigDecimal totalLogisticsCost;
/**
* 本阶标准成本
*/
@Excel(name = "本阶标准成本", width = 15)
@ApiModelProperty(value = "本阶标准成本")
private BigDecimal currentStandardCost;
/**
* 累计标准成本
*/
@Excel(name = "累计标准成本", width = 15)
@ApiModelProperty(value = "累计标准成本")
private BigDecimal totalStandardCost;
/**
* 创建人
*/
@ApiModelProperty(value = "创建人")
private String createBy;
/**
* 创建日期
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期")
private Date createTime;
/**
* 修改人
*/
@ApiModelProperty(value = "修改人")
private String updateBy;
/**
* 修改日期
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "修改日期")
private Date updateTime;
/**
* 备注
*/
@Excel(name = "备注", width = 15)
@ApiModelProperty(value = "备注")
private String remark;
}