优化报表的排序逻辑

This commit is contained in:
jishenghua
2023-12-25 23:41:33 +08:00
parent 9f738b51b4
commit 313f101a82
7 changed files with 131 additions and 114 deletions

View File

@@ -6,40 +6,31 @@ import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.DepotHead;
import com.jsh.erp.datasource.entities.DepotHeadVo4Body;
import com.jsh.erp.datasource.entities.Supplier;
import com.jsh.erp.datasource.vo.DepotHeadVo4InDetail;
import com.jsh.erp.datasource.vo.DepotHeadVo4InOutMCount;
import com.jsh.erp.datasource.vo.DepotHeadVo4List;
import com.jsh.erp.datasource.vo.DepotHeadVo4StatementAccount;
import com.jsh.erp.exception.BusinessParamCheckingException;
import com.jsh.erp.service.accountHead.AccountHeadService;
import com.jsh.erp.service.depot.DepotService;
import com.jsh.erp.service.depotHead.DepotHeadService;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.redis.RedisService;
import com.jsh.erp.service.supplier.SupplierService;
import com.jsh.erp.service.systemConfig.SystemConfigService;
import com.jsh.erp.utils.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.sql.Date;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
import static com.jsh.erp.utils.Tools.getNow3;
/**
* @author ji-sheng-hua 752*718*920
@@ -59,9 +50,6 @@ public class DepotHeadController {
@Resource
private SystemConfigService systemConfigService;
@Resource
private RedisService redisService;
/**
* 批量设置状态-审核或者反审核
* @param jsonObject
@@ -100,17 +88,19 @@ public class DepotHeadController {
@GetMapping(value = "/findInOutDetail")
@ApiOperation(value = "入库出库明细接口")
public BaseResponseInfo findInOutDetail(@RequestParam("currentPage") Integer currentPage,
@RequestParam("pageSize") Integer pageSize,
@RequestParam(value = "organId", required = false) Integer oId,
@RequestParam("number") String number,
@RequestParam("materialParam") String materialParam,
@RequestParam(value = "depotId", required = false) Long depotId,
@RequestParam("beginTime") String beginTime,
@RequestParam("endTime") String endTime,
@RequestParam("type") String type,
@RequestParam(value = "creator", required = false) Long creator,
@RequestParam("remark") String remark,
HttpServletRequest request)throws Exception {
@RequestParam("pageSize") Integer pageSize,
@RequestParam(value = "organId", required = false) Integer oId,
@RequestParam("number") String number,
@RequestParam("materialParam") String materialParam,
@RequestParam(value = "depotId", required = false) Long depotId,
@RequestParam("beginTime") String beginTime,
@RequestParam("endTime") String endTime,
@RequestParam("type") String type,
@RequestParam(value = "creator", required = false) Long creator,
@RequestParam("remark") String remark,
@RequestParam(value = "column", required = false) String column,
@RequestParam(value = "order", required = false) String order,
HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>();
try {
@@ -134,7 +124,8 @@ public class DepotHeadController {
Boolean forceFlag = systemConfigService.getForceApprovalFlag();
Boolean inOutManageFlag = systemConfigService.getInOutManageFlag();
List<DepotHeadVo4InDetail> list = depotHeadService.findInOutDetail(beginTime, endTime, type, creatorArray, organArray, forceFlag, inOutManageFlag,
StringUtil.toNull(materialParam), depotList, oId, StringUtil.toNull(number), creator, remark, (currentPage-1)*pageSize, pageSize);
StringUtil.toNull(materialParam), depotList, oId, StringUtil.toNull(number), creator, remark,
StringUtil.safeSqlParse(column), StringUtil.safeSqlParse(order), (currentPage-1)*pageSize, pageSize);
int total = depotHeadService.findInOutDetailCount(beginTime, endTime, type, creatorArray, organArray, forceFlag, inOutManageFlag,
StringUtil.toNull(materialParam), depotList, oId, StringUtil.toNull(number), creator, remark);
map.put("total", total);
@@ -171,14 +162,16 @@ public class DepotHeadController {
@GetMapping(value = "/findInOutMaterialCount")
@ApiOperation(value = "入库出库统计接口")
public BaseResponseInfo findInOutMaterialCount(@RequestParam("currentPage") Integer currentPage,
@RequestParam("pageSize") Integer pageSize,
@RequestParam(value = "organId", required = false) Integer oId,
@RequestParam("materialParam") String materialParam,
@RequestParam(value = "depotId", required = false) Long depotId,
@RequestParam("beginTime") String beginTime,
@RequestParam("endTime") String endTime,
@RequestParam("type") String type,
HttpServletRequest request)throws Exception {
@RequestParam("pageSize") Integer pageSize,
@RequestParam(value = "organId", required = false) Integer oId,
@RequestParam("materialParam") String materialParam,
@RequestParam(value = "depotId", required = false) Long depotId,
@RequestParam("beginTime") String beginTime,
@RequestParam("endTime") String endTime,
@RequestParam("type") String type,
@RequestParam(value = "column", required = false) String column,
@RequestParam(value = "order", required = false) String order,
HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>();
try {
@@ -198,7 +191,8 @@ public class DepotHeadController {
Boolean forceFlag = systemConfigService.getForceApprovalFlag();
Boolean inOutManageFlag = systemConfigService.getInOutManageFlag();
List<DepotHeadVo4InOutMCount> list = depotHeadService.findInOutMaterialCount(beginTime, endTime, type, forceFlag, inOutManageFlag,
StringUtil.toNull(materialParam), depotList, oId, (currentPage-1)*pageSize, pageSize);
StringUtil.toNull(materialParam), depotList, oId, StringUtil.safeSqlParse(column), StringUtil.safeSqlParse(order),
(currentPage-1)*pageSize, pageSize);
int total = depotHeadService.findInOutMaterialCountTotal(beginTime, endTime, type, forceFlag, inOutManageFlag,
StringUtil.toNull(materialParam), depotList, oId);
map.put("total", total);
@@ -239,6 +233,8 @@ public class DepotHeadController {
@RequestParam("endTime") String endTime,
@RequestParam("subType") String subType,
@RequestParam("remark") String remark,
@RequestParam(value = "column", required = false) String column,
@RequestParam(value = "order", required = false) String order,
HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>();
@@ -270,7 +266,8 @@ public class DepotHeadController {
endTime = Tools.parseDayToTime(endTime,BusinessConstants.DAY_LAST_TIME);
Boolean forceFlag = systemConfigService.getForceApprovalFlag();
List<DepotHeadVo4InDetail> list = depotHeadService.findAllocationDetail(beginTime, endTime, subType, StringUtil.toNull(number),
creatorArray, forceFlag, StringUtil.toNull(materialParam), depotList, depotFList, remark, (currentPage-1)*pageSize, pageSize);
creatorArray, forceFlag, StringUtil.toNull(materialParam), depotList, depotFList, remark,
StringUtil.safeSqlParse(column), StringUtil.safeSqlParse(order), (currentPage-1)*pageSize, pageSize);
int total = depotHeadService.findAllocationDetailCount(beginTime, endTime, subType, StringUtil.toNull(number),
creatorArray, forceFlag, StringUtil.toNull(materialParam), depotList, depotFList, remark);
map.put("rows", list);

View File

@@ -595,9 +595,8 @@ public class MaterialController {
@RequestParam(value = "position", required = false) String position,
@RequestParam("materialParam") String materialParam,
@RequestParam("zeroStock") Integer zeroStock,
@RequestParam("mpList") String mpList,
@RequestParam("column") String column,
@RequestParam("order") String order,
@RequestParam(value = "column", required = false) String column,
@RequestParam(value = "order", required = false) String order,
HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<>();

View File

@@ -77,6 +77,8 @@ public interface DepotHeadMapperEx {
@Param("number") String number,
@Param("creator") Long creator,
@Param("remark") String remark,
@Param("column") String column,
@Param("order") String order,
@Param("offset") Integer offset,
@Param("rows") Integer rows);
@@ -106,6 +108,8 @@ public interface DepotHeadMapperEx {
@Param("oId") Integer oId,
@Param("creatorArray") String[] creatorArray,
@Param("organArray") String[] organArray,
@Param("column") String column,
@Param("order") String order,
@Param("offset") Integer offset,
@Param("rows") Integer rows);
@@ -132,6 +136,8 @@ public interface DepotHeadMapperEx {
@Param("depotList") List<Long> depotList,
@Param("depotFList") List<Long> depotFList,
@Param("remark") String remark,
@Param("column") String column,
@Param("order") String order,
@Param("offset") Integer offset,
@Param("rows") Integer rows);

View File

@@ -6,25 +6,25 @@ import java.util.Date;
public class DepotHeadVo4InDetail {
private String Number;
private String number;
private String barCode;
private String MName;
private String mname;
private String Model;
private String model;
private String standard;
private BigDecimal UnitPrice;
private BigDecimal unitPrice;
private String mUnit;
private String newRemark;
private BigDecimal OperNumber;
private BigDecimal operNumber;
private BigDecimal AllPrice;
private BigDecimal allPrice;
private BigDecimal taxRate;
@@ -32,22 +32,22 @@ public class DepotHeadVo4InDetail {
private BigDecimal taxLastMoney;
private String SName;
private String sname;
private String DName;
private String dname;
private String OperTime;
private String operTime;
private String NewType;
private String newType;
private Long tenantId;
public String getNumber() {
return Number;
return number;
}
public void setNumber(String number) {
Number = number;
this.number = number;
}
public String getBarCode() {
@@ -58,20 +58,20 @@ public class DepotHeadVo4InDetail {
this.barCode = barCode;
}
public String getMName() {
return MName;
public String getMname() {
return mname;
}
public void setMName(String MName) {
this.MName = MName;
public void setMname(String mname) {
this.mname = mname;
}
public String getModel() {
return Model;
return model;
}
public void setModel(String model) {
Model = model;
this.model = model;
}
public String getStandard() {
@@ -83,11 +83,11 @@ public class DepotHeadVo4InDetail {
}
public BigDecimal getUnitPrice() {
return UnitPrice;
return unitPrice;
}
public void setUnitPrice(BigDecimal unitPrice) {
UnitPrice = unitPrice;
this.unitPrice = unitPrice;
}
public String getmUnit() {
@@ -107,19 +107,19 @@ public class DepotHeadVo4InDetail {
}
public BigDecimal getOperNumber() {
return OperNumber;
return operNumber;
}
public void setOperNumber(BigDecimal operNumber) {
OperNumber = operNumber;
this.operNumber = operNumber;
}
public BigDecimal getAllPrice() {
return AllPrice;
return allPrice;
}
public void setAllPrice(BigDecimal allPrice) {
AllPrice = allPrice;
this.allPrice = allPrice;
}
public BigDecimal getTaxRate() {
@@ -146,36 +146,36 @@ public class DepotHeadVo4InDetail {
this.taxLastMoney = taxLastMoney;
}
public String getSName() {
return SName;
public String getSname() {
return sname;
}
public void setSName(String SName) {
this.SName = SName;
public void setSname(String sname) {
this.sname = sname;
}
public String getDName() {
return DName;
public String getDname() {
return dname;
}
public void setDName(String DName) {
this.DName = DName;
public void setDname(String dname) {
this.dname = dname;
}
public String getOperTime() {
return OperTime;
return operTime;
}
public void setOperTime(String operTime) {
OperTime = operTime;
this.operTime = operTime;
}
public String getNewType() {
return NewType;
return newType;
}
public void setNewType(String newType) {
NewType = newType;
this.newType = newType;
}
public Long getTenantId() {

View File

@@ -1,17 +1,16 @@
package com.jsh.erp.datasource.vo;
import java.math.BigDecimal;
public class DepotHeadVo4InOutMCount {
private Long MaterialId;
private Long materialId;
private String barCode;
private String mName;
private String Model;
private String model;
private String standard;
@@ -26,11 +25,11 @@ public class DepotHeadVo4InOutMCount {
private Long tenantId;
public Long getMaterialId() {
return MaterialId;
return materialId;
}
public void setMaterialId(Long materialId) {
MaterialId = materialId;
this.materialId = materialId;
}
public String getBarCode() {
@@ -50,11 +49,11 @@ public class DepotHeadVo4InOutMCount {
}
public String getModel() {
return Model;
return model;
}
public void setModel(String model) {
Model = model;
this.model = model;
}
public String getStandard() {

View File

@@ -660,11 +660,11 @@ public class DepotHeadService {
public List<DepotHeadVo4InDetail> findInOutDetail(String beginTime, String endTime, String type, String [] creatorArray,
String [] organArray, Boolean forceFlag, Boolean inOutManageFlag,
String materialParam, List<Long> depotList, Integer oId, String number,
Long creator, String remark, Integer offset, Integer rows) throws Exception{
Long creator, String remark, String column, String order, Integer offset, Integer rows) throws Exception{
List<DepotHeadVo4InDetail> list = null;
try{
list =depotHeadMapperEx.findInOutDetail(beginTime, endTime, type, creatorArray, organArray, forceFlag, inOutManageFlag,
materialParam, depotList, oId, number, creator, remark, offset, rows);
materialParam, depotList, oId, number, creator, remark, column, order, offset, rows);
}catch(Exception e){
JshException.readFail(logger, e);
}
@@ -686,14 +686,15 @@ public class DepotHeadService {
public List<DepotHeadVo4InOutMCount> findInOutMaterialCount(String beginTime, String endTime, String type,
Boolean forceFlag, Boolean inOutManageFlag, String materialParam,
List<Long> depotList, Integer oId, Integer offset, Integer rows)throws Exception {
List<Long> depotList, Integer oId, String column, String order,
Integer offset, Integer rows)throws Exception {
List<DepotHeadVo4InOutMCount> list = null;
try{
String [] creatorArray = getCreatorArray();
String subType = "出库".equals(type)? "销售" : "";
String [] organArray = getOrganArray(subType, "");
list =depotHeadMapperEx.findInOutMaterialCount(beginTime, endTime, type, forceFlag, inOutManageFlag, materialParam, depotList, oId,
creatorArray, organArray, offset, rows);
creatorArray, organArray, column, order, offset, rows);
}catch(Exception e){
JshException.readFail(logger, e);
}
@@ -718,11 +719,11 @@ public class DepotHeadService {
public List<DepotHeadVo4InDetail> findAllocationDetail(String beginTime, String endTime, String subType, String number,
String [] creatorArray, Boolean forceFlag, String materialParam, List<Long> depotList, List<Long> depotFList,
String remark, Integer offset, Integer rows) throws Exception{
String remark, String column, String order, Integer offset, Integer rows) throws Exception{
List<DepotHeadVo4InDetail> list = null;
try{
list =depotHeadMapperEx.findAllocationDetail(beginTime, endTime, subType, number, creatorArray, forceFlag,
materialParam, depotList, depotFList, remark, offset, rows);
materialParam, depotList, depotFList, remark, column, order, offset, rows);
}catch(Exception e){
JshException.readFail(logger, e);
}