优化采购订单速度

product
17602169347 2 years ago
parent d35bd5147a
commit e133116c15

@ -182,13 +182,16 @@ public class PurchaseorderController {
public ActionResult list(@RequestBody PurchaseorderPagination purchaseorderPagination)throws IOException{ public ActionResult list(@RequestBody PurchaseorderPagination purchaseorderPagination)throws IOException{
List<PurchaseorderitemEntity> list= purchaseorderitemService.getList(purchaseorderPagination); List<PurchaseorderitemEntity> list= purchaseorderitemService.getList(purchaseorderPagination);
//处理id字段转名称若无需转或者为空可删除 //处理id字段转名称若无需转或者为空可删除
for(PurchaseorderitemEntity entity:list){ /*for(PurchaseorderitemEntity entity:list){
Map<String,Object> contractCodeMap = new HashMap<>(); Map<String,Object> contractCodeMap = new HashMap<>();
entity.setContractName(generaterSwapUtil.getPopupSelectValue("390143765857220229","id","contract_name",entity.getContractCode(),contractCodeMap)); entity.setContractName(generaterSwapUtil.getPopupSelectValue("390143765857220229","id","contract_name",entity.getContractCode(),contractCodeMap));
Map<String,Object> supplierIdMap = new HashMap<>(); Map<String,Object> supplierIdMap = new HashMap<>();
entity.setSupplierName(generaterSwapUtil.getPopupSelectValue("397751667988199621","id","supplier_name",entity.getSupplierId(),supplierIdMap)); entity.setSupplierName(generaterSwapUtil.getPopupSelectValue("397751667988199621","id","supplier_name",entity.getSupplierId(),supplierIdMap));
entity.setCreatorUserName(generaterSwapUtil.userSelectValue(entity.getCreatorUserName())); entity.setCreatorUserName(generaterSwapUtil.userSelectValue(entity.getCreatorUserName()));
} }*/
List<PurchaseorderListVO> listVO=JsonUtil.getJsonToList(list,PurchaseorderListVO.class); List<PurchaseorderListVO> listVO=JsonUtil.getJsonToList(list,PurchaseorderListVO.class);
for(PurchaseorderListVO purchaseorderVO:listVO){ for(PurchaseorderListVO purchaseorderVO:listVO){
} }

@ -3,8 +3,11 @@ package jnpf.purchaseorder.mapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import jnpf.mobilePort.entity.PurchaseOrderVO; import jnpf.mobilePort.entity.PurchaseOrderVO;
import jnpf.purchaseorder.entity.PurchaseorderitemEntity; import jnpf.purchaseorder.entity.PurchaseorderitemEntity;
import jnpf.purchaseorder.model.purchaseorder.PurchaseorderPagination;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.HashMap; import java.util.HashMap;
@ -23,4 +26,5 @@ public interface PurchaseorderitemMapper extends BaseMapper<PurchaseorderitemEnt
List<HashMap<String,Object>> getPdfInfo(@Param("ew")Wrapper<PurchaseorderitemEntity> queryWrapper); List<HashMap<String,Object>> getPdfInfo(@Param("ew")Wrapper<PurchaseorderitemEntity> queryWrapper);
List<HashMap<String,Object>> getWordExcelInfo(@Param("ew")Wrapper<PurchaseorderitemEntity> queryWrapper); List<HashMap<String,Object>> getWordExcelInfo(@Param("ew")Wrapper<PurchaseorderitemEntity> queryWrapper);
List<HashMap<String,Object>> getVehicleInfo(@Param("ew")Wrapper<PurchaseorderitemEntity> queryWrapper); List<HashMap<String,Object>> getVehicleInfo(@Param("ew")Wrapper<PurchaseorderitemEntity> queryWrapper);
IPage<PurchaseorderitemEntity> queryByKeyword(@Param("page") Page<PurchaseorderitemEntity> page, @Param("purchaseorderPagination") PurchaseorderPagination purchaseorderPagination);
} }

@ -3,6 +3,8 @@ package jnpf.purchaseorder.model.purchaseorder;
import lombok.Data; import lombok.Data;
import jnpf.base.Pagination; import jnpf.base.Pagination;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@ -22,6 +24,8 @@ public class PurchaseorderPagination extends Pagination {
private String supplierName; private String supplierName;
private List<String> creatorTime; private List<String> creatorTime;
private String status; private String status;
private Date startDate;
private Date endDate;
/** /**
* id * id
*/ */

@ -23,6 +23,8 @@ import jnpf.base.controller.BillRuleController;
import jnpf.base.entity.ProvinceEntity; import jnpf.base.entity.ProvinceEntity;
import jnpf.base.mapper.ProvinceMapper; import jnpf.base.mapper.ProvinceMapper;
import jnpf.config.ConfigValueUtil; import jnpf.config.ConfigValueUtil;
import jnpf.contractfile.entity.ContractFileEntity;
import jnpf.contractfile.service.ContractFileService;
import jnpf.customer.entity.CustomerEntity; import jnpf.customer.entity.CustomerEntity;
import jnpf.customer.mapper.CustomerVMapper; import jnpf.customer.mapper.CustomerVMapper;
import jnpf.exception.DataException; import jnpf.exception.DataException;
@ -838,19 +840,89 @@ if (pMap!=null&&pMap.size()>0){
} }
}
} }
} if(StringUtil.isNotEmpty(purchaseorderPagination.getCreatorTime())){
if(StringUtil.isNotEmpty(purchaseorderPagination.getDocumentNo())){ List<String> PoundDateList = purchaseorderPagination.getCreatorTime();
Long fir = Long.valueOf(PoundDateList.get(0));
Long sec = Long.valueOf(PoundDateList.get(1));
purchaseorderPagination.setStartDate(new Date(fir));
purchaseorderPagination.setEndDate(DateUtil.stringToDate(DateUtil.daFormatYmd(sec) + " 23:59:59"));
}
if(StringUtil.isEmpty(purchaseorderPagination.getSidx())){
purchaseorderPagination.setSidx("CREATOR_TIME");
purchaseorderPagination.setSort("DESC");
}else{
try {
String sidx = purchaseorderPagination.getSidx();
PoundlistEntity poundlistEntity = new PoundlistEntity();
Field declaredField = poundlistEntity.getClass().getDeclaredField(sidx);
declaredField.setAccessible(true);
String value = declaredField.getAnnotation(TableField.class).value();
purchaseorderPagination.setSidx(value);
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
Page<PurchaseorderitemEntity> page=new Page<>(purchaseorderPagination.getCurrentPage(), purchaseorderPagination.getPageSize());
IPage<PurchaseorderitemEntity> iPage = purchaseorderitemMapper.queryByKeyword(page, purchaseorderPagination);
return purchaseorderPagination.setData(iPage.getRecords(),iPage.getTotal());
/*if(StringUtil.isNotEmpty(purchaseorderPagination.getDocumentNo())){
purchaseorderNum++; purchaseorderNum++;
purchaseorderQueryWrapper.lambda().like(PurchaseorderitemEntity::getDocumentNo,purchaseorderPagination.getDocumentNo()); purchaseorderQueryWrapper.lambda().like(PurchaseorderitemEntity::getDocumentNo,purchaseorderPagination.getDocumentNo());
} }
if(StringUtil.isNotEmpty(purchaseorderPagination.getStatus())){
purchaseorderNum++;
purchaseorderQueryWrapper.lambda().like(PurchaseorderitemEntity::getStatus,purchaseorderPagination.getStatus());
}
if(StringUtil.isNotEmpty(purchaseorderPagination.getCreatorTime())){
purchaseorderNum++;
List<String> PoundDateList = purchaseorderPagination.getCreatorTime();
Long fir = Long.valueOf(PoundDateList.get(0));
Long sec = Long.valueOf(PoundDateList.get(1));
purchaseorderQueryWrapper.lambda().ge(PurchaseorderitemEntity::getCreatorTime, new Date(fir))
.le(PurchaseorderitemEntity::getCreatorTime, DateUtil.stringToDate(DateUtil.daFormatYmd(sec) + " 23:59:59"));
}
if(StringUtil.isNotEmpty(purchaseorderPagination.getPurchaseName())){
QueryWrapper<ContractFileEntity> contractFileQueryWrapper =new QueryWrapper<>();
contractFileQueryWrapper.lambda().like(ContractFileEntity::getContractName, purchaseorderPagination.getPurchaseName());
contractFileQueryWrapper.lambda().select(ContractFileEntity::getId);
List<String> customerIdList = contractFileService.listObjs(contractFileQueryWrapper).stream().map(o -> (String) o).collect(Collectors.toList());
purchaseorderNum++;
if(customerIdList.size() > 0){
purchaseorderQueryWrapper.lambda().in(PurchaseorderitemEntity::getContractCode,customerIdList);
}else{
purchaseorderQueryWrapper.lambda().eq(PurchaseorderitemEntity::getContractCode, purchaseorderPagination.getPurchaseName());
}
}
if(StringUtil.isNotEmpty(purchaseorderPagination.getSupplierName())){
QueryWrapper<SupplierEntity> customerQueryWrapper =new QueryWrapper<>();
customerQueryWrapper.lambda().like(SupplierEntity::getSupplierName, purchaseorderPagination.getSupplierName());
customerQueryWrapper.lambda().select(SupplierEntity::getId);
List<String> customerIdList = supplierService.listObjs(customerQueryWrapper).stream().map(o -> (String) o).collect(Collectors.toList());
purchaseorderNum++;
if(customerIdList.size() > 0){
purchaseorderQueryWrapper.lambda().in(PurchaseorderitemEntity::getSupplierId,customerIdList);
}else{
purchaseorderQueryWrapper.lambda().eq(PurchaseorderitemEntity::getSupplierId, purchaseorderPagination.getSupplierName());
}
}
if(AllIdList.size()>0){ if(AllIdList.size()>0){
purchaseorderQueryWrapper.lambda().in(PurchaseorderitemEntity::getId, AllIdList); purchaseorderQueryWrapper.lambda().in(PurchaseorderitemEntity::getId, AllIdList);
} }
//排序 //排序
if(StringUtil.isEmpty(purchaseorderPagination.getSidx())){ if(StringUtil.isEmpty(purchaseorderPagination.getSidx())){
purchaseorderQueryWrapper.lambda().orderByDesc(PurchaseorderitemEntity::getId); purchaseorderQueryWrapper.lambda().orderByDesc(PurchaseorderitemEntity::getId);
}else{ }else{
try { try {
String sidx = purchaseorderPagination.getSidx(); String sidx = purchaseorderPagination.getSidx();
@ -864,13 +936,13 @@ if (pMap!=null&&pMap.size()>0){
} }
} }
if((total>0 && AllIdList.size()>0) || total==0){ if((total>0 && AllIdList.size()>0) || total==0){
Page<PurchaseorderitemEntity> page=new Page<>(purchaseorderPagination.getCurrentPage(), purchaseorderPagination.getPageSize()); Page<PurchaseorderitemEntity> page=new Page<>(purchaseorderPagination.getCurrentPage(), purchaseorderPagination.getPageSize());
IPage<PurchaseorderitemEntity> userIPage=this.page(page, purchaseorderQueryWrapper); IPage<PurchaseorderitemEntity> userIPage=this.page(page, purchaseorderQueryWrapper);
return purchaseorderPagination.setData(userIPage.getRecords(),userIPage.getTotal()); return purchaseorderPagination.setData(userIPage.getRecords(),userIPage.getTotal());
}else{ }else{
List<PurchaseorderitemEntity> list = new ArrayList(); List<PurchaseorderitemEntity> list = new ArrayList();
return purchaseorderPagination.setData(list, list.size()); return purchaseorderPagination.setData(list, list.size());
} }*/
} }
@Override @Override
public List<PurchaseorderitemEntity> getTypeList(PurchaseorderPagination purchaseorderPagination, String dataType){ public List<PurchaseorderitemEntity> getTypeList(PurchaseorderPagination purchaseorderPagination, String dataType){

@ -267,4 +267,34 @@
LEFT JOIN jg_vehicle e ON c.vehicle_id = e.id LEFT JOIN jg_vehicle e ON c.vehicle_id = e.id
) aaa ${ew.customSqlSegment} ) aaa ${ew.customSqlSegment}
</select> </select>
<select id="queryByKeyword" resultType="jnpf.purchaseorder.entity.PurchaseorderitemEntity">
SELECT a.*,b.supplier_name supplierName,c.contract_name contractName
from jg_purchaseorder a
LEFT JOIN jg_supplier b on a.supplier_id = b.id
LEFT JOIN jg_contract c on a.contract_code = c.id
WHERE 1=1
<if test="purchaseorderPagination.keyword != null and purchaseorderPagination.keyword != ''">
AND (c.contract_name LIKE CONCAT('%',#{purchaseorderPagination.keyword},'%') OR b.supplier_name LIKE CONCAT('%',#{purchaseorderPagination.keyword},'%'))
</if>
<if test="purchaseorderPagination.startDate != null and purchaseorderPagination.endDate != null">
AND a.creator_time &gt; #{purchaseorderPagination.startDate} AND a.creator_time &lt;= #{purchaseorderPagination.endDate}
</if>
<if test="purchaseorderPagination.documentNo != null and purchaseorderPagination.documentNo != ''">
AND a.document_no = #{purchaseorderPagination.documentNo}
</if>
<if test="purchaseorderPagination.purchaseName != null and purchaseorderPagination.purchaseName != ''">
AND c.contract_name LIKE CONCAT('%',#{purchaseorderPagination.purchaseName},'%')
</if>
<if test="purchaseorderPagination.supplierName != null and purchaseorderPagination.supplierName != ''">
AND b.supplier_name LIKE CONCAT('%',#{purchaseorderPagination.supplierName},'%')
</if>
<if test="purchaseorderPagination.status != null and purchaseorderPagination.status != ''">
AND a.status = #{purchaseorderPagination.status}
</if>
<if test="purchaseorderPagination.sidx != null and purchaseorderPagination.sidx != ''">
ORDER BY ${purchaseorderPagination.sidx} ${purchaseorderPagination.sort}
</if>
</select>
</mapper> </mapper>

@ -543,7 +543,7 @@
} }
const ids = this.multipleSelection.join() const ids = this.multipleSelection.join()
request({ request({
url: `/api/purchaseorderNum = '';/Purchaseorder/batchQueryPurchaseorder/${ids}`, url: `/api/purchaseorder/Purchaseorder/batchQueryPurchaseorder/${ids}`,
method: 'get' method: 'get'
}).then(res => { }).then(res => {
var amountFlag = true; var amountFlag = true;

Loading…
Cancel
Save