|
|
@@ -29,8 +29,9 @@ import org.springblade.los.finance.stl.mapper.FinStlBillsMapper;
|
|
|
import org.springblade.los.statisticAnalysis.*;
|
|
|
import org.springblade.los.statisticAnalysis.service.IStatisticAnalysisService;
|
|
|
import org.springblade.los.trade.entity.Agent;
|
|
|
+import org.springblade.los.trade.entity.DispatchVehicles;
|
|
|
import org.springblade.los.trade.mapper.AgentMapper;
|
|
|
-import org.springblade.los.trade.service.IAgentService;
|
|
|
+import org.springblade.los.trade.mapper.DispatchVehiclesMapper;
|
|
|
import org.springblade.los.view.entity.BoxNumberProfit;
|
|
|
import org.springblade.los.view.mapper.BoxNumberProfitMapper;
|
|
|
import org.springblade.los.view.mapper.FinanceProfitMapper;
|
|
|
@@ -70,6 +71,8 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
|
|
|
private final AgentMapper agentMapper;
|
|
|
|
|
|
+ private final DispatchVehiclesMapper dispatchVehiclesMapper;
|
|
|
+
|
|
|
@Override
|
|
|
public R<IPage<DecisionAnalysis>> decisionAnalysis(DecisionAnalysis decisionAnalysis, IPage<DecisionAnalysis> page) {
|
|
|
return R.data(page.setRecords(billsMapper.decisionAnalysis(decisionAnalysis, page)));
|
|
|
@@ -598,12 +601,12 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public R<Map<String, Object>> completionRate(String dateStart, String dateEnd,String type ) {
|
|
|
+ public R<Map<String, Object>> completionRate(String dateStart, String dateEnd, String type) {
|
|
|
long sum;
|
|
|
long refurbishment;
|
|
|
long complete;
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
- if ("1".equals(type)){
|
|
|
+ if ("1".equals(type)) {
|
|
|
LambdaQueryWrapper<Bills> lambdaQueryWrapperSE = new LambdaQueryWrapper<>();
|
|
|
lambdaQueryWrapperSE.eq(Bills::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(Bills::getIsDeleted, 0)
|
|
|
@@ -643,7 +646,7 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
} else {
|
|
|
map.put("rate", new BigDecimal(complete).divide(new BigDecimal(sum), MathContext.DECIMAL32).setScale(2, RoundingMode.HALF_UP).multiply(new BigDecimal("100")));
|
|
|
}
|
|
|
- }else if ("2".equals(type)){
|
|
|
+ } else if ("2".equals(type)) {
|
|
|
LambdaQueryWrapper<AeaBills> aeaBillsLambdaQueryWrapperAE = new LambdaQueryWrapper<>();
|
|
|
aeaBillsLambdaQueryWrapperAE.eq(AeaBills::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(AeaBills::getIsDeleted, 0)
|
|
|
@@ -683,7 +686,7 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
} else {
|
|
|
map.put("rate", new BigDecimal(complete).divide(new BigDecimal(sum), MathContext.DECIMAL32).setScale(2, RoundingMode.HALF_UP).multiply(new BigDecimal("100")));
|
|
|
}
|
|
|
- }else if ("3".equals(type)){
|
|
|
+ } else if ("3".equals(type)) {
|
|
|
LambdaQueryWrapper<Agent> agentLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
agentLambdaQueryWrapper.eq(Agent::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(Agent::getIsDeleted, 0)
|
|
|
@@ -719,7 +722,7 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
} else if ("3".equals(type)) {
|
|
|
List<Map<String, Object>> mapList = agentMapper.trend(AuthUtil.getTenantId(), date);
|
|
|
return R.data(mapList);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
return R.fail("参数错误");
|
|
|
}
|
|
|
}
|
|
|
@@ -1398,10 +1401,10 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
map.put("amountProfitLoc", amountProfitLoc);
|
|
|
amountProfitSum = amountProfitSum.add(amountProfitLoc);
|
|
|
amountDrLocSum = amountDrLocSum.add(amountDrLoc);
|
|
|
- if (new BigDecimal("0.00").compareTo(amountProfitLoc) != 0 && new BigDecimal("0.00").compareTo(amountDrLoc) != 0){
|
|
|
+ if (new BigDecimal("0.00").compareTo(amountProfitLoc) != 0 && new BigDecimal("0.00").compareTo(amountDrLoc) != 0) {
|
|
|
BigDecimal profitMargin = amountProfitLoc.divide(amountDrLoc, MathContext.DECIMAL32).setScale(2, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
|
|
|
map.put("profitMargin", profitMargin);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
map.put("profitMargin", new BigDecimal("0.00"));
|
|
|
}
|
|
|
mapList.add(map);
|
|
|
@@ -1410,9 +1413,9 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
mapSum.put("corpName", "总计");
|
|
|
mapSum.put("teu", teuSum);
|
|
|
mapSum.put("amountProfitLoc", amountProfitSum);
|
|
|
- if (new BigDecimal("0.00").compareTo(amountProfitSum) != 0 && new BigDecimal("0.00").compareTo(amountDrLocSum) != 0){
|
|
|
+ if (new BigDecimal("0.00").compareTo(amountProfitSum) != 0 && new BigDecimal("0.00").compareTo(amountDrLocSum) != 0) {
|
|
|
mapSum.put("profitMargin", amountProfitSum.divide(amountDrLocSum, MathContext.DECIMAL32).setScale(2, RoundingMode.HALF_UP).multiply(new BigDecimal("100")));
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
mapSum.put("profitMargin", new BigDecimal("0.00"));
|
|
|
}
|
|
|
mapList.add(0, mapSum);
|
|
|
@@ -1438,10 +1441,10 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
map.put("amountProfitLoc", amountProfitLoc);
|
|
|
amountProfitSum = amountProfitSum.add(amountProfitLoc);
|
|
|
amountDrLocSum = amountDrLocSum.add(amountDrLoc);
|
|
|
- if (new BigDecimal("0.00").compareTo(amountProfitLoc) != 0 && new BigDecimal("0.00").compareTo(amountDrLoc) != 0){
|
|
|
+ if (new BigDecimal("0.00").compareTo(amountProfitLoc) != 0 && new BigDecimal("0.00").compareTo(amountDrLoc) != 0) {
|
|
|
BigDecimal profitMargin = amountProfitLoc.divide(amountDrLoc, MathContext.DECIMAL32).setScale(2, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
|
|
|
map.put("profitMargin", profitMargin);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
map.put("profitMargin", new BigDecimal("0.00"));
|
|
|
}
|
|
|
mapList.add(map);
|
|
|
@@ -1450,9 +1453,9 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
mapSum.put("corpName", "总计");
|
|
|
mapSum.put("teu", teuSum);
|
|
|
mapSum.put("amountProfitLoc", amountProfitSum);
|
|
|
- if (new BigDecimal("0.00").compareTo(amountProfitSum) != 0 && new BigDecimal("0.00").compareTo(amountDrLocSum) != 0){
|
|
|
+ if (new BigDecimal("0.00").compareTo(amountProfitSum) != 0 && new BigDecimal("0.00").compareTo(amountDrLocSum) != 0) {
|
|
|
mapSum.put("profitMargin", amountProfitSum.divide(amountDrLocSum, MathContext.DECIMAL32).setScale(2, RoundingMode.HALF_UP).multiply(new BigDecimal("100")));
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
mapSum.put("profitMargin", new BigDecimal("0.00"));
|
|
|
}
|
|
|
mapList.add(0, mapSum);
|
|
|
@@ -1478,10 +1481,10 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
map.put("amountProfitLoc", amountProfitLoc);
|
|
|
amountProfitSum = amountProfitSum.add(amountProfitLoc);
|
|
|
amountDrLocSum = amountDrLocSum.add(amountDrLoc);
|
|
|
- if (new BigDecimal("0.00").compareTo(amountProfitLoc) != 0 && new BigDecimal("0.00").compareTo(amountDrLoc) != 0){
|
|
|
+ if (new BigDecimal("0.00").compareTo(amountProfitLoc) != 0 && new BigDecimal("0.00").compareTo(amountDrLoc) != 0) {
|
|
|
BigDecimal profitMargin = amountProfitLoc.divide(amountDrLoc, MathContext.DECIMAL32).setScale(2, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
|
|
|
map.put("profitMargin", profitMargin);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
map.put("profitMargin", new BigDecimal("0.00"));
|
|
|
}
|
|
|
mapList.add(map);
|
|
|
@@ -1490,9 +1493,9 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
mapSum.put("corpName", "总计");
|
|
|
mapSum.put("teu", teuSum);
|
|
|
mapSum.put("amountProfitLoc", amountProfitSum);
|
|
|
- if (new BigDecimal("0.00").compareTo(amountProfitSum) != 0 && new BigDecimal("0.00").compareTo(amountDrLocSum) != 0){
|
|
|
+ if (new BigDecimal("0.00").compareTo(amountProfitSum) != 0 && new BigDecimal("0.00").compareTo(amountDrLocSum) != 0) {
|
|
|
mapSum.put("profitMargin", amountProfitSum.divide(amountDrLocSum, MathContext.DECIMAL32).setScale(2, RoundingMode.HALF_UP).multiply(new BigDecimal("100")));
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
mapSum.put("profitMargin", new BigDecimal("0.00"));
|
|
|
}
|
|
|
mapList.add(0, mapSum);
|
|
|
@@ -1500,4 +1503,85 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
}
|
|
|
return R.data(mapList);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public R<List<Map<String, Object>>> boxReturnReminder() {
|
|
|
+ List<Map<String, Object>> mapList = new ArrayList<>();
|
|
|
+ List<Bills> billsList = billsMapper.selectList(new LambdaQueryWrapper<Bills>()
|
|
|
+ .eq(Bills::getIsDeleted, 0)
|
|
|
+ .eq(Bills::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(Bills::getBusinessType, "SE"));
|
|
|
+ List<Long> billId = billsList.stream().map(Bills::getId).collect(Collectors.toList());
|
|
|
+ List<DispatchVehicles> dispatchVehiclesList = dispatchVehiclesMapper.selectList(new LambdaQueryWrapper<DispatchVehicles>()
|
|
|
+ .eq(DispatchVehicles::getIsDeleted, 0)
|
|
|
+ .eq(DispatchVehicles::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(DispatchVehicles::getWhetherReturn, "0")
|
|
|
+ .in(DispatchVehicles::getPid, billId));
|
|
|
+ if (dispatchVehiclesList.isEmpty()) {
|
|
|
+ return R.data(mapList);
|
|
|
+ }
|
|
|
+ Date date = new Date();
|
|
|
+ SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ for (Bills item : billsList) {
|
|
|
+ if (dispatchVehiclesList.stream().anyMatch(e -> e.getPid().equals(item.getId()))) {
|
|
|
+ if (ObjectUtils.isNotNull(item.getEta()) && ObjectUtils.isNotNull(item.getIqNo())) {
|
|
|
+ int count = Integer.parseInt(item.getIqNo());
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.setTime(item.getEta());
|
|
|
+ calendar.add(Calendar.DAY_OF_MONTH, count - 2);
|
|
|
+ Date newDate = calendar.getTime();
|
|
|
+ if (date.compareTo(newDate) == 0) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("id", item.getId());
|
|
|
+ map.put("mblno", item.getMblno());
|
|
|
+ map.put("corpName", item.getCorpCnName());
|
|
|
+ map.put("eta", formatter.format(item.getEta()));
|
|
|
+ map.put("iqNo", item.getIqNo());
|
|
|
+ mapList.add(map);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return R.data(mapList);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public R<List<Map<String, Object>>> withdrawalReminder() {
|
|
|
+ List<Map<String, Object>> mapList = new ArrayList<>();
|
|
|
+ List<Bills> billsList = billsMapper.selectList(new LambdaQueryWrapper<Bills>()
|
|
|
+ .eq(Bills::getIsDeleted, 0)
|
|
|
+ .eq(Bills::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(Bills::getBusinessType, "SE"));
|
|
|
+ List<Long> billId = billsList.stream().map(Bills::getId).collect(Collectors.toList());
|
|
|
+ List<DispatchVehicles> dispatchVehiclesList = dispatchVehiclesMapper.selectList(new LambdaQueryWrapper<DispatchVehicles>()
|
|
|
+ .eq(DispatchVehicles::getIsDeleted, 0)
|
|
|
+ .eq(DispatchVehicles::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(DispatchVehicles::getWhetherReturn, "1")
|
|
|
+ .in(DispatchVehicles::getPid, billId));
|
|
|
+ if (dispatchVehiclesList.isEmpty()) {
|
|
|
+ return R.data(mapList);
|
|
|
+ }
|
|
|
+ Date date = new Date();
|
|
|
+ SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ for (DispatchVehicles item : dispatchVehiclesList) {
|
|
|
+ if (ObjectUtils.isNotNull(item.getReturnDate())) {
|
|
|
+ Bills bills = billsList.stream().filter(e-> e.getId().equals(item.getPid())).findFirst().orElse(null);
|
|
|
+ if (bills != null){
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.setTime(item.getReturnDate());
|
|
|
+ calendar.add(Calendar.DAY_OF_MONTH, 5);
|
|
|
+ Date newDate = calendar.getTime();
|
|
|
+ if (date.compareTo(newDate) == 0) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("id", item.getId());
|
|
|
+ map.put("mblno", bills.getMblno());
|
|
|
+ map.put("corpName", bills.getCorpCnName());
|
|
|
+ map.put("eta", formatter.format(item.getReturnDate()));
|
|
|
+ mapList.add(map);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return R.data(mapList);
|
|
|
+ }
|
|
|
}
|