Commit c36fac64 authored by renjie's avatar renjie

公司月报

企业认证bug
parent 34530148
......@@ -34,6 +34,8 @@ public class CompanyAuthorize {
this.companyName = companyAuthorizeDto.getCompanyName();
if (companyAuthorizeDto.getRegisterNumber() != null)
this.registerNumber = companyAuthorizeDto.getRegisterNumber();
if (companyAuthorizeDto.getCoporationPlace() != null)
this.coporationPlace = companyAuthorizeDto.getCoporationPlace();
this.writePerson = companyAuthorizeDto.getWritePerson();
}
......
......@@ -15,6 +15,10 @@ public class CompanyMonthReport {
private float companyExpenseAmount; //公司支出
private float companyWithDrawnAmount; //公司提现
private float companyBankTransferAmount; //公司银行转账
public int getYear() {
return year;
......@@ -55,4 +59,20 @@ public class CompanyMonthReport {
public void setCompanyIncomeAmount(float companyIncomeAmount) {
this.companyIncomeAmount = companyIncomeAmount;
}
public float getCompanyBankTransferAmount() {
return companyBankTransferAmount;
}
public void setCompanyBankTransferAmount(float companyBankTransferAmount) {
this.companyBankTransferAmount = companyBankTransferAmount;
}
public float getCompanyWithDrawnAmount() {
return companyWithDrawnAmount;
}
public void setCompanyWithDrawnAmount(float companyWithDrawnAmount) {
this.companyWithDrawnAmount = companyWithDrawnAmount;
}
}
......@@ -33,6 +33,8 @@ public class CompanyAuthorizeDto {
this.companyName = companyAuthorize.getCompanyName();
if (companyAuthorize.getRegisterNumber() != null)
this.registerNumber = companyAuthorize.getRegisterNumber();
if (companyAuthorize.getCoporationPlace() != null)
this.coporationPlace = companyAuthorize.getCoporationPlace();
this.writePerson = companyAuthorize.getWritePerson();
}
......
......@@ -18,6 +18,10 @@ public interface UserPrePaidBillingRepositoryCustom {
float companyExpenseAmount(int year, int month);
float companyWithdrawAmount(int year, int month);
float companyBankTransferAmount(int year, int month);
Page<UserPrePaidBilling> findByUsernameAndChargeTypes(Pageable pageable, String username, String[] chargeTypes, int year, int month, int day, String zoneId);
Page<UserPrePaidBilling> findBillsByCondition(Pageable pageable, String username, BillQueryCriteriaDto billQueryCriteriaDto, long dayBeginTime, long dayEndTime);
......
......@@ -63,7 +63,9 @@ public class UserPrePaidBillingRepositoryCustomImpl implements UserPrePaidBillin
@Override
public float companyExpenseAmount(int year, int month) {
MatchOperation matchOperation = Aggregation.match(where("year").is(year).and("month").is(month).and("payMethod").in(Arrays.asList(0,3,4)));
Criteria criteria = new Criteria();
criteria.where("year").is(year).and("month").is(month).orOperator(where("payMethod").is(3), where("chargeType").is(4));
MatchOperation matchOperation = Aggregation.match(criteria);
GroupOperation groupOperation = Aggregation.group("month").sum("total").as("prepaidAmount");
AggregationResults<Map> totalSum = mongoTemplate.aggregate(Aggregation.newAggregation(matchOperation, groupOperation),
......@@ -114,6 +116,58 @@ public class UserPrePaidBillingRepositoryCustomImpl implements UserPrePaidBillin
}
}
@Override
public float companyWithdrawAmount(int year, int month) {
MatchOperation matchOperation = Aggregation.match(where("year").is(year).and("month").is(month).and("chargeType").is(4));
GroupOperation groupOperation = Aggregation.group("month").sum("total").as("prepaidAmount");
AggregationResults<Map> totalSum = mongoTemplate.aggregate(Aggregation.newAggregation(matchOperation, groupOperation),
UserPrePaidBilling.class, Map.class);
if (totalSum.getMappedResults() == null || totalSum.getMappedResults().size() == 0) {
return 0;
} else {
Map map = totalSum.getMappedResults().get(0);
if (map == null) {
return 0;
} else {
Double sum = (Double) map.get("prepaidAmount");
if (sum == null) {
return 0;
} else {
return sum.floatValue();
}
}
}
}
@Override
public float companyBankTransferAmount(int year, int month) {
MatchOperation matchOperation = Aggregation.match(where("year").is(year).and("month").is(month).and("payMethod").is(3));
GroupOperation groupOperation = Aggregation.group("month").sum("total").as("prepaidAmount");
AggregationResults<Map> totalSum = mongoTemplate.aggregate(Aggregation.newAggregation(matchOperation, groupOperation),
UserPrePaidBilling.class, Map.class);
if (totalSum.getMappedResults() == null || totalSum.getMappedResults().size() == 0) {
return 0;
} else {
Map map = totalSum.getMappedResults().get(0);
if (map == null) {
return 0;
} else {
Double sum = (Double) map.get("prepaidAmount");
if (sum == null) {
return 0;
} else {
return sum.floatValue();
}
}
}
}
@Override
public Page<UserPrePaidBilling> findByUsernameAndChargeTypes(Pageable pageable, String username, String[] chargeTypes, int year, int month, int day, String zoneId) {
......
......@@ -39,12 +39,16 @@ public class PrepaidBillingCountTaskScheduler {
int count = new Long(userPrePaidBillingRepository.countPrepaidOrderNum(i, j)).intValue();
float companyExpenseAmount = userPrePaidBillingRepository.companyExpenseAmount(i, j);
float companyIncomeAmount = userPrePaidBillingRepository.companyIncomeAmount(i, j);
float companyWithdrawAmount = userPrePaidBillingRepository.companyWithdrawAmount(i, j);
float companyBankTransferAmount = userPrePaidBillingRepository.companyBankTransferAmount(i, j);
CompanyMonthReport companyMonthReport = new CompanyMonthReport();
companyMonthReport.setYear(i);
companyMonthReport.setMonth(j);
companyMonthReport.setBillingCount(count);
companyMonthReport.setCompanyExpenseAmount(companyExpenseAmount);
companyMonthReport.setCompanyIncomeAmount(companyIncomeAmount);
companyMonthReport.setCompanyWithDrawnAmount(companyWithdrawAmount);
companyMonthReport.setCompanyBankTransferAmount(companyBankTransferAmount);
monthReportRepository.save(companyMonthReport);
}else {
continue;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment