|
@@ -10,6 +10,7 @@ import com.winsea.svc.base.security.util.AuthSecurityUtils;
|
|
|
import com.yh.saas.plugin.yiliangyiyun.entity.*;
|
|
|
import com.yh.saas.plugin.yiliangyiyun.entity.view.BiViewInfo;
|
|
|
import com.yh.saas.plugin.yiliangyiyun.mapper.ContractManagementInfoMapper;
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.mapper.PaymentManagementMapper;
|
|
|
import com.yh.saas.plugin.yiliangyiyun.mapper.WarehouseInOutInfoMapper;
|
|
|
import com.yh.saas.plugin.yiliangyiyun.mapper.WarehousePositionStorageInfoMapper;
|
|
|
import com.yh.saas.plugin.yiliangyiyun.service.*;
|
|
@@ -74,6 +75,8 @@ public class BiInfoController {
|
|
|
private IStockSaleReceiptReportService stockSaleReceiptReportService;
|
|
|
@Autowired
|
|
|
private IStockPurchaseReceiptReportService stockPurchaseReceiptReportService;
|
|
|
+ @Autowired
|
|
|
+ private PaymentManagementMapper paymentManagementMapper;
|
|
|
private String companyId;
|
|
|
@Autowired
|
|
|
private CacheComponent cacheComponent;
|
|
@@ -117,7 +120,7 @@ public class BiInfoController {
|
|
|
// 执行中的所有合同-已完成量、待完成量 2 执行中的合同额 -已开票、待开票 3 已付款 未付款
|
|
|
getCompletedAndNotQuantity(contractManagementInfos, biViewInfos);
|
|
|
// 采购
|
|
|
- getBuyInfo(contractManagementInfos, biViewInfos);
|
|
|
+ getBuyInfo(contractManagementInfos, biViewInfos, seachMoth);
|
|
|
// 车辆
|
|
|
getTranCount(biViewInfos, seachMoth);
|
|
|
// 库存成本
|
|
@@ -140,7 +143,7 @@ public class BiInfoController {
|
|
|
public List<BiViewInfo> selectBiInfoNew(String compId, String seachMoth) {
|
|
|
if(AuthSecurityUtils.getCurrentUserInfo() != null && AuthSecurityUtils.getCurrentUserInfo().getUserId() != null){
|
|
|
String userId = AuthSecurityUtils.getCurrentUserInfo().getUserId();
|
|
|
- List<BiViewInfo> listRedis = cacheComponent.getObjList(Const.ADMIN_BI_INFO+userId, BiViewInfo.class);
|
|
|
+ List<BiViewInfo> listRedis = cacheComponent.getObjList(Const.ADMIN_BI_INFO+userId+seachMoth, BiViewInfo.class);
|
|
|
if (listRedis != null && listRedis.size() > 0) {
|
|
|
return listRedis;
|
|
|
}
|
|
@@ -176,26 +179,26 @@ public class BiInfoController {
|
|
|
contractManagementInfoEntityWrapper.eq("joint_venture_parties", "洮南市二龙乡瀚城农产品有限公司");
|
|
|
}
|
|
|
}
|
|
|
- if (seachMoth != null) {
|
|
|
- if (!seachMoth.contains("-")) {
|
|
|
- contractManagementInfoEntityWrapper.and("YEAR(create_date)='" + seachMoth + "'");
|
|
|
- } else {
|
|
|
- contractManagementInfoEntityWrapper.like("create_date", seachMoth + "%");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
+// if (seachMoth != null) {
|
|
|
+// if (!seachMoth.contains("-")) {
|
|
|
+// contractManagementInfoEntityWrapper.and("YEAR(create_date)='" + seachMoth + "'");
|
|
|
+// } else {
|
|
|
+// contractManagementInfoEntityWrapper.like("create_date", seachMoth + "%");
|
|
|
+// }
|
|
|
+// }
|
|
|
+ contractManagementInfoEntityWrapper.gt("create_date",seachMoth);
|
|
|
List<ContractManagementInfo> contractManagementInfos = contractManagementInfoService.selectList(contractManagementInfoEntityWrapper);
|
|
|
// 执行中的所有合同-已完成量、待完成量 2 执行中的合同额 -已开票、待开票 3 已付款 未付款
|
|
|
getCompletedAndNotQuantity(contractManagementInfos, biViewInfos);
|
|
|
// 采购
|
|
|
- getBuyInfo(contractManagementInfos, biViewInfos);
|
|
|
+ getBuyInfo(contractManagementInfos, biViewInfos, seachMoth);
|
|
|
// 收入支出毛利润
|
|
|
getMoney(biViewInfos, seachMoth);
|
|
|
|
|
|
|
|
|
if(AuthSecurityUtils.getCurrentUserInfo() != null && AuthSecurityUtils.getCurrentUserInfo().getUserId() != null){
|
|
|
String userId = AuthSecurityUtils.getCurrentUserInfo().getUserId();
|
|
|
- cacheComponent.putRaw(Const.ADMIN_BI_INFO+userId, JSONObject.toJSONString(biViewInfos), 60 * 20);
|
|
|
+ cacheComponent.putRaw(Const.ADMIN_BI_INFO+userId+seachMoth, JSONObject.toJSONString(biViewInfos), 60 * 20);
|
|
|
}
|
|
|
return biViewInfos;
|
|
|
}
|
|
@@ -214,6 +217,7 @@ public class BiInfoController {
|
|
|
EntityWrapper<ContractManagementInfo> contractManagementInfoEntityWrapper = new EntityWrapper<ContractManagementInfo>();
|
|
|
contractManagementInfoEntityWrapper.eq("delete_flag", "0");
|
|
|
contractManagementInfoEntityWrapper.eq("comp_id", companyId);
|
|
|
+ contractManagementInfoEntityWrapper.gt("create_date", seachMoth);
|
|
|
contractManagementInfoEntityWrapper.orderBy("create_date",false);
|
|
|
if(AuthSecurityUtils.getCurrentUserInfo() != null && AuthSecurityUtils.getCurrentUserInfo().getUserId() != null){
|
|
|
String userId = AuthSecurityUtils.getCurrentUserInfo().getUserId();
|
|
@@ -471,9 +475,12 @@ public class BiInfoController {
|
|
|
// }
|
|
|
// }
|
|
|
// List<CostManagementInfo> costManagementInfos = costManagementInfoService.selectList(costManagementInfoEntityWrapper);
|
|
|
- Double sumAct = warehousePositionStorageInfoService.selectSumStoreage(companyId);
|
|
|
- Double sumBuy = contractManagementInfoService.selectSumBuy(companyId);
|
|
|
- Double sumSale = contractManagementInfoService.selectSumSale(companyId);
|
|
|
+// Double sumAct = warehousePositionStorageInfoService.selectSumStoreage(companyId);
|
|
|
+ Double inWeight = warehousePositionStorageInfoMapper.selectSumWareNew(companyId, null,"2",seachMoth);
|
|
|
+ Double outWeight = warehousePositionStorageInfoMapper.selectSumWareNew(companyId, null,"1",seachMoth);
|
|
|
+ Double sumAct = inWeight - outWeight;
|
|
|
+ Double sumBuy = contractManagementInfoService.selectSumBuy(companyId,seachMoth);
|
|
|
+ Double sumSale = contractManagementInfoService.selectSumSale(companyId,seachMoth);
|
|
|
// if (CollectionUtils.isNotEmpty(costManagementInfos)) {
|
|
|
// for (int i = 0; i < costManagementInfos.size(); i++) {
|
|
|
// CostManagementInfo costManagementInfo = costManagementInfos.get(i);
|
|
@@ -512,42 +519,19 @@ public class BiInfoController {
|
|
|
biViewInfos.add(biViewInfo);
|
|
|
|
|
|
// 粮食储存总量
|
|
|
- EntityWrapper<CostManagementInfo> costManagementInfoEntityWrapper1 = new EntityWrapper<CostManagementInfo>();
|
|
|
- costManagementInfoEntityWrapper1.eq("comp_id", companyId);
|
|
|
- costManagementInfoEntityWrapper1.groupBy("goods_name_key");
|
|
|
-// if(seachMoth != null) {
|
|
|
-// if (!seachMoth.contains("-")) {
|
|
|
-// costManagementInfoEntityWrapper1.and("YEAR(create_date)='" + seachMoth + "'");
|
|
|
-// } else {
|
|
|
-// costManagementInfoEntityWrapper1.and("(YEAR(create_date)+\"-\"+MONTH(create_date))='" + seachMoth + "'");
|
|
|
-//
|
|
|
-// }
|
|
|
-// }
|
|
|
- List<CostManagementInfo> costManagementInfoList = costManagementInfoService.selectList(costManagementInfoEntityWrapper1);
|
|
|
+ CostManagementInfo costManagementInfo = new CostManagementInfo();
|
|
|
+ costManagementInfo.setCompId(companyId);
|
|
|
+ costManagementInfo.setSearchMoth(seachMoth);
|
|
|
+ List<CostManagementInfo> costManagementInfoList = costManagementInfoService.selectCostManagementInfoBi(costManagementInfo);
|
|
|
BiViewInfo biViewInfo4 = new BiViewInfo();
|
|
|
List<BiViewInfo> biViewInfos1 = new ArrayList<>();
|
|
|
if (CollectionUtils.isNotEmpty(costManagementInfoList)) {
|
|
|
+ Double weight = 0d;
|
|
|
for (int i = 0; i < costManagementInfoList.size(); i++) {
|
|
|
- CostManagementInfo costManagementInfo = costManagementInfoList.get(i);
|
|
|
BiViewInfo biViewInfo3 = new BiViewInfo();
|
|
|
- EntityWrapper<CostManagementInfo> costManagementInfoEntityWrapper2 = new EntityWrapper<CostManagementInfo>();
|
|
|
- costManagementInfoEntityWrapper2.eq("comp_id", companyId);
|
|
|
- costManagementInfoEntityWrapper2.eq("goods_name_key", costManagementInfo.getGoodsNameKey());
|
|
|
-// if(seachMoth != null) {
|
|
|
-// if (!seachMoth.contains("-")) {
|
|
|
-// costManagementInfoEntityWrapper1.and("YEAR(create_date)='" + seachMoth + "'");
|
|
|
-// } else {
|
|
|
-// costManagementInfoEntityWrapper1.and("(YEAR(create_date)+\"-\"+MONTH(create_date))='" + seachMoth + "'");
|
|
|
-//
|
|
|
-// }
|
|
|
-// }
|
|
|
- List<CostManagementInfo> costManagementInfoList1 = costManagementInfoService.selectList(costManagementInfoEntityWrapper2);
|
|
|
- Double weight = 0d;
|
|
|
- for (int j = 0; j < costManagementInfoList1.size(); j++) {
|
|
|
- CostManagementInfo costManagementInfo1 = costManagementInfoList1.get(j);
|
|
|
- weight = weight + costManagementInfo1.getStorage();
|
|
|
- }
|
|
|
- biViewInfo3.setName(costManagementInfo.getGoodsName());
|
|
|
+ CostManagementInfo costManagementInfo1 = costManagementInfoList.get(i);
|
|
|
+ weight = weight + costManagementInfo1.getStorage();
|
|
|
+ biViewInfo3.setName(costManagementInfo1.getGoodsName());
|
|
|
biViewInfo3.setCount(String.valueOf(weight));
|
|
|
biViewInfos1.add(biViewInfo3);
|
|
|
}
|
|
@@ -757,7 +741,7 @@ public class BiInfoController {
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
- private List<BiViewInfo> getBuyInfo(List<ContractManagementInfo> contractManagementInfos, List<BiViewInfo> biViewInfos) {
|
|
|
+ private List<BiViewInfo> getBuyInfo(List<ContractManagementInfo> contractManagementInfos, List<BiViewInfo> biViewInfos,String seachMoth) {
|
|
|
// 采购合同总量
|
|
|
Double sumTotal = 0d;
|
|
|
// 采购合同完成量
|
|
@@ -770,11 +754,11 @@ public class BiInfoController {
|
|
|
Double payTotal = 0.00;
|
|
|
for (int i = 0; i < contractManagementInfos.size(); i++) {
|
|
|
ContractManagementInfo contractManagementInfo1 = contractManagementInfos.get(i);
|
|
|
- sumTotal = sumTotal + contractManagementInfo1.getWeight();
|
|
|
// moneyTotal = moneyTotal + contractManagementInfo1.getTotalContractPrice();
|
|
|
|
|
|
//现货自运采购合同
|
|
|
if ("1".equals(contractManagementInfo1.getGoodsType()) && "1".equals(contractManagementInfo1.getDeliverType()) && "2".equals(contractManagementInfo1.getContractType())) {
|
|
|
+ sumTotal = sumTotal + contractManagementInfo1.getWeight();
|
|
|
//定义出库量
|
|
|
Double outWeight = 0.0d;
|
|
|
//查询同名临时库出库量
|
|
@@ -801,10 +785,11 @@ public class BiInfoController {
|
|
|
returnWeight = returnWeight + Float.valueOf(String.valueOf(warehouseInOutInfo.getNetWeight()));
|
|
|
}
|
|
|
}
|
|
|
- sumTotal += outWeight - returnWeight;
|
|
|
+ completedQuantity += outWeight - returnWeight;
|
|
|
}
|
|
|
//现货他运采购合同
|
|
|
else if ("1".equals(contractManagementInfo1.getGoodsType()) && "2".equals(contractManagementInfo1.getDeliverType()) && "2".equals(contractManagementInfo1.getContractType())) {
|
|
|
+ sumTotal = sumTotal + contractManagementInfo1.getWeight();
|
|
|
//定义出库量
|
|
|
Double inWeight = 0.0d;
|
|
|
//查询同合同编号入库量
|
|
@@ -820,6 +805,11 @@ public class BiInfoController {
|
|
|
|
|
|
completedQuantity += inWeight;
|
|
|
}
|
|
|
+// else if("3".equals(contractManagementInfo1.getContractType())){
|
|
|
+// Double sum = paymentManagementMapper.selectPayNum(companyId,seachMoth);
|
|
|
+// invoicingTotal += sum;
|
|
|
+// payTotal += sum;
|
|
|
+// }
|
|
|
// 查询已开票未开票
|
|
|
ContractProcessInfo contractProcessInfo = contractProcessInfoService.selectOne(new EntityWrapper<ContractProcessInfo>().eq(ContractGoodsInfo.QueryFiles.CONTRACT_ID, contractManagementInfo1.getId()));
|
|
|
invoicingTotal = invoicingTotal + (contractProcessInfo.getGoodsName() != null ? contractProcessInfo.getGoodsName() : 0.00);
|
|
@@ -828,12 +818,12 @@ public class BiInfoController {
|
|
|
// 执行中的所有合同量求和-- 已完成量、待完成量
|
|
|
BiViewInfo biViewInfo = new BiViewInfo();
|
|
|
biViewInfo.setBiType("4-采购合同(已完成量、待完成量)");
|
|
|
- BigDecimal bg = new BigDecimal(sumTotal);
|
|
|
+ BigDecimal bg = new BigDecimal(Math.round(sumTotal*100)/100);
|
|
|
biViewInfo.setTotal(String.valueOf(bg));
|
|
|
List<BiViewInfo> biViewInfos1 = new ArrayList<>();
|
|
|
BiViewInfo biViewInfo1 = new BiViewInfo();
|
|
|
biViewInfo1.setName("已完成量");
|
|
|
- biViewInfo1.setCount(String.valueOf(completedQuantity));
|
|
|
+ biViewInfo1.setCount(String.valueOf(Math.round(completedQuantity*100)/100));
|
|
|
biViewInfo1.setPercentage(completedQuantity / sumTotal * 100 + "");
|
|
|
BiViewInfo biViewInfo2 = new BiViewInfo();
|
|
|
biViewInfo2.setName("待完成量");
|