|
|
|
@ -2,15 +2,19 @@ package com.logpm.report.service.impl;
|
|
|
|
|
|
|
|
|
|
import com.logpm.basicdata.entity.BasicdataWarehouseEntity; |
|
|
|
|
import com.logpm.basicdata.feign.IBasicdataWarehouseClient; |
|
|
|
|
import com.logpm.report.mapper.BillDataMapper; |
|
|
|
|
import com.logpm.report.service.BillingService; |
|
|
|
|
import com.logpm.report.typepage.TimeType; |
|
|
|
|
import com.logpm.report.vo.indexCount.BillingDataVo; |
|
|
|
|
import com.logpm.report.vo.indexCount.DetailMoneyVo; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
|
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Service |
|
|
|
|
@AllArgsConstructor |
|
|
|
@ -18,35 +22,99 @@ public class BillingServiceImpl implements BillingService {
|
|
|
|
|
|
|
|
|
|
private IBasicdataWarehouseClient warehouseClient; |
|
|
|
|
|
|
|
|
|
private BillDataMapper billDataMapper; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取时间范围内的开单数 |
|
|
|
|
* @param TType |
|
|
|
|
* @param date |
|
|
|
|
* @return Integer |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public Integer BillCount(Integer TType) { |
|
|
|
|
return null; |
|
|
|
|
public Integer BillCount(String TType,HashMap<String,Date> date) { |
|
|
|
|
List<Long> warehouse = getWarehouse(); |
|
|
|
|
return billDataMapper.billCount(warehouse, TType, date); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取时间范围内的收入 |
|
|
|
|
* @param TType |
|
|
|
|
* @param date |
|
|
|
|
* @return BigDecimal |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public BigDecimal BillMoney(Integer TType) { |
|
|
|
|
return null; |
|
|
|
|
public BigDecimal BillMoney(String TType, HashMap<String,Date> date) { |
|
|
|
|
List<Long> warehouse = getWarehouse(); |
|
|
|
|
return billDataMapper.billMoney(warehouse, TType, date); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取时间范围内地的收入明细 |
|
|
|
|
* @param TType |
|
|
|
|
* @param date |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public List<DetailMoneyVo> DetailType(Integer TType) { |
|
|
|
|
public List<DetailMoneyVo> DetailType(String TType,HashMap<String,Date> date) { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取全部开单数据 |
|
|
|
|
* @return BillingDataVo |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public BillingDataVo BillData() { |
|
|
|
|
return null; |
|
|
|
|
BillingDataVo billingDataVo = new BillingDataVo(); |
|
|
|
|
HashMap<String, Date> time1 = getOtherTime(TimeType.all.getValue()); |
|
|
|
|
HashMap<String, Date> time2 = getOtherTime(TimeType.moon.getValue()); |
|
|
|
|
HashMap<String, Date> time3 = getOtherTime(TimeType.day.getValue()); |
|
|
|
|
Integer all = BillCount(TimeType.all.getValue(), time1); |
|
|
|
|
Integer moon = BillCount(TimeType.moon.getValue(), time2); |
|
|
|
|
Integer day = BillCount(TimeType.day.getValue(), time3); |
|
|
|
|
billingDataVo.setAllCount(all); |
|
|
|
|
billingDataVo.setMoonCount(moon); |
|
|
|
|
billingDataVo.setDayCount(day); |
|
|
|
|
return billingDataVo; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取当月/当天时间 |
|
|
|
|
* @param type 2:月:3天 |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
public HashMap<String,Date> getOtherTime(String type){ |
|
|
|
|
HashMap<String, Date> hashMap = new HashMap<>(); |
|
|
|
|
Calendar instance = Calendar.getInstance(); |
|
|
|
|
Date endTime = new Date(); |
|
|
|
|
int typeI = Integer.parseInt(type); |
|
|
|
|
if (typeI ==2){ |
|
|
|
|
instance.set(Calendar.DAY_OF_MONTH,1); |
|
|
|
|
Date time = instance.getTime(); |
|
|
|
|
hashMap.put("stare_time",time); |
|
|
|
|
hashMap.put("end_time",endTime); |
|
|
|
|
}else if (typeI ==3) { |
|
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
|
calendar.set(Calendar.HOUR_OF_DAY, 0); |
|
|
|
|
calendar.set(Calendar.MINUTE, 0); |
|
|
|
|
calendar.set(Calendar.SECOND, 0); |
|
|
|
|
calendar.set(Calendar.MILLISECOND, 0); |
|
|
|
|
Date time = calendar.getTime(); |
|
|
|
|
hashMap.put("stare_time",time); |
|
|
|
|
hashMap.put("end_time",endTime); |
|
|
|
|
} |
|
|
|
|
return hashMap; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 获取用户仓库id |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
private List<Long> getWarehouse(){ |
|
|
|
|
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); |
|
|
|
|
// BasicdataWarehouseEntity myCurrentWarehouse = new BasicdataWarehouseEntity();
|
|
|
|
|
List<Long> ls = new ArrayList<>(); |
|
|
|
|
if (myCurrentWarehouse !=null){ |
|
|
|
|
ls.add(myCurrentWarehouse.getId()); |
|
|
|
|