|
|
|
@ -1,10 +1,16 @@
|
|
|
|
|
package com.glxp.api.service.collect;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
|
|
import com.glxp.api.common.res.BaseResponse;
|
|
|
|
|
import com.glxp.api.dao.collect.IoCollectCodeBackMapper;
|
|
|
|
|
import com.glxp.api.dao.collect.IoCollectCodeMapper;
|
|
|
|
|
import com.glxp.api.dao.collect.IoCollectOrderBizBackupMapper;
|
|
|
|
|
import com.glxp.api.entity.collect.IoCollectCode;
|
|
|
|
|
import com.glxp.api.entity.collect.IoCollectCodeBackup;
|
|
|
|
|
import com.glxp.api.entity.collect.IoCollectOrderBizBackup;
|
|
|
|
|
import com.glxp.api.http.ErpBasicClient;
|
|
|
|
|
import com.glxp.api.req.collect.CollectOrderBizRequest;
|
|
|
|
@ -27,6 +33,8 @@ public class IoCollectOrderBizBackupService extends ServiceImpl<IoCollectOrderBi
|
|
|
|
|
IoCollectOrderBizBackupMapper ioCollectOrderBizBackupMapper;
|
|
|
|
|
@Resource
|
|
|
|
|
private ErpBasicClient erpBasicClient;
|
|
|
|
|
@Resource
|
|
|
|
|
private IoCollectCodeBackMapper ioCollectCodeBackMapper;
|
|
|
|
|
|
|
|
|
|
public List<CollectOrderBizResponse> filterList(CollectOrderBizRequest collectOrderRequest) {
|
|
|
|
|
if (collectOrderRequest == null) {
|
|
|
|
@ -48,13 +56,20 @@ public class IoCollectOrderBizBackupService extends ServiceImpl<IoCollectOrderBi
|
|
|
|
|
Map<String, String[]> buyTypeMap = new HashMap<>();
|
|
|
|
|
List<String> buyTypeBuyer = new ArrayList<>();
|
|
|
|
|
List<String> buyTypeSales = new ArrayList<>();
|
|
|
|
|
Integer buyerCount = 0;
|
|
|
|
|
Integer salesCount = 0;
|
|
|
|
|
// Integer buyerCount = 0;
|
|
|
|
|
// Integer salesCount = 0;
|
|
|
|
|
Integer buyerScanCount = 0;
|
|
|
|
|
Integer salesScanCount = 0;
|
|
|
|
|
BigDecimal buyerCentage = new BigDecimal(0);
|
|
|
|
|
BigDecimal salesCentage = new BigDecimal(0);
|
|
|
|
|
Integer codeCount = 0;
|
|
|
|
|
|
|
|
|
|
Integer fifoSplitOneCount = 0;
|
|
|
|
|
Integer fifoSplitTwoCount = 0;
|
|
|
|
|
Integer fifoSplitThreeCount = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (list != null && list.size() > 0) {
|
|
|
|
|
BaseResponse<Map<String, String[]>> baseResponse = erpBasicClient.getBuyType("thirdId");
|
|
|
|
|
if (baseResponse.getCode() == 20000) {
|
|
|
|
@ -67,47 +82,71 @@ public class IoCollectOrderBizBackupService extends ServiceImpl<IoCollectOrderBi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (CollectOrderBizResponse collectOrderBizResponse : list) {
|
|
|
|
|
for (String buyType : buyTypeBuyer) {
|
|
|
|
|
if (buyType.equals(collectOrderBizResponse.getBusType())) {
|
|
|
|
|
buyerCount += collectOrderBizResponse.getCount();
|
|
|
|
|
// 只有已上传的码才是正确的码
|
|
|
|
|
if (2 == collectOrderBizResponse.getUploadStatus()) {
|
|
|
|
|
buyerScanCount += collectOrderBizResponse.getScanCount();
|
|
|
|
|
collectOrderBizResponse.setCount(collectOrderBizResponse.getCount() == null ? 0 : collectOrderBizResponse.getCount());
|
|
|
|
|
collectOrderBizResponse.setScanCount(collectOrderBizResponse.getScanCount() == null ? 0 : collectOrderBizResponse.getScanCount());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(2 == collectOrderBizResponse.getUploadStatus()){
|
|
|
|
|
for (String buyType : buyTypeSales) {
|
|
|
|
|
if (buyType.equals(collectOrderBizResponse.getBusType())) {
|
|
|
|
|
// salesCount += collectOrderBizResponse.getCount();
|
|
|
|
|
salesScanCount ++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for (String buyType : buyTypeSales) {
|
|
|
|
|
if (buyType.equals(collectOrderBizResponse.getBusType())) {
|
|
|
|
|
salesCount += collectOrderBizResponse.getCount();
|
|
|
|
|
if (2 == collectOrderBizResponse.getUploadStatus()) {
|
|
|
|
|
salesScanCount += collectOrderBizResponse.getScanCount();
|
|
|
|
|
for (String buyType : buyTypeBuyer) {
|
|
|
|
|
if (buyType.equals(collectOrderBizResponse.getBusType())) {
|
|
|
|
|
// buyerCount += collectOrderBizResponse.getCount();
|
|
|
|
|
// 只有已上传的码才是正确的码
|
|
|
|
|
buyerScanCount ++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(collectOrderBizResponse.getFifoSplit() == 1){
|
|
|
|
|
fifoSplitOneCount ++;
|
|
|
|
|
}else if(collectOrderBizResponse.getFifoSplit() == 2){
|
|
|
|
|
fifoSplitTwoCount ++;
|
|
|
|
|
}else if(collectOrderBizResponse.getFifoSplit() == 3){
|
|
|
|
|
fifoSplitThreeCount ++;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
codeCount++;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 计算采购率和销售率
|
|
|
|
|
|
|
|
|
|
BigDecimal buyerCountBigDecimal = BigDecimal.valueOf(buyerCount);
|
|
|
|
|
BigDecimal buyerScanCountBigDecimal = BigDecimal.valueOf(buyerScanCount);
|
|
|
|
|
if(buyerCountBigDecimal.equals(new BigDecimal(0))){
|
|
|
|
|
buyerCentage = new BigDecimal(0).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
}else {
|
|
|
|
|
buyerCentage = buyerScanCountBigDecimal.divide(buyerCountBigDecimal,4, BigDecimal.ROUND_HALF_UP ).multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BigDecimal salesCountBigDecimal = BigDecimal.valueOf(salesCount);
|
|
|
|
|
BigDecimal salesScanCountBigDecimal = BigDecimal.valueOf(salesScanCount);
|
|
|
|
|
if(salesCountBigDecimal.equals(new BigDecimal(0))){
|
|
|
|
|
salesCentage = new BigDecimal(0).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
}else {
|
|
|
|
|
salesCentage = salesScanCountBigDecimal.divide(salesCountBigDecimal,4, BigDecimal.ROUND_HALF_UP ).multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
}
|
|
|
|
|
codeCount = buyerScanCount + salesScanCount;
|
|
|
|
|
// BigDecimal buyerCountBigDecimal = BigDecimal.valueOf(buyerCount);
|
|
|
|
|
// BigDecimal buyerScanCountBigDecimal = BigDecimal.valueOf(buyerScanCount);
|
|
|
|
|
// if(buyerCountBigDecimal.equals(new BigDecimal(0))){
|
|
|
|
|
// buyerCentage = new BigDecimal(0).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
// }else {
|
|
|
|
|
// buyerCentage = buyerScanCountBigDecimal.divide(buyerCountBigDecimal,4, BigDecimal.ROUND_HALF_UP ).multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// BigDecimal salesCountBigDecimal = BigDecimal.valueOf(salesCount);
|
|
|
|
|
// BigDecimal salesScanCountBigDecimal = BigDecimal.valueOf(salesScanCount);
|
|
|
|
|
// if(salesCountBigDecimal.equals(new BigDecimal(0))){
|
|
|
|
|
// salesCentage = new BigDecimal(0).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
// }else {
|
|
|
|
|
// salesCentage = salesScanCountBigDecimal.divide(salesCountBigDecimal,4, BigDecimal.ROUND_HALF_UP ).multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
// }
|
|
|
|
|
// codeCount = buyerScanCount + salesScanCount;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
collectOrderUploadCountResponse.setBuyerCentage(buyerCentage);
|
|
|
|
|
collectOrderUploadCountResponse.setSalesCentage(salesCentage);
|
|
|
|
|
collectOrderUploadCountResponse.setBuyerScanCount(buyerScanCount);
|
|
|
|
|
collectOrderUploadCountResponse.setSalesScanCount(salesScanCount);
|
|
|
|
|
collectOrderUploadCountResponse.setCodeCount(codeCount);
|
|
|
|
|
// collectOrderUploadCountResponse.setCount(buyerCount+salesCount);
|
|
|
|
|
|
|
|
|
|
collectOrderUploadCountResponse.setFifoSplitOneCount(fifoSplitOneCount);
|
|
|
|
|
collectOrderUploadCountResponse.setFifoSplitTwoCount(fifoSplitTwoCount);
|
|
|
|
|
collectOrderUploadCountResponse.setFifoSplitThreeCount(fifoSplitThreeCount);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|