|
@@ -5,10 +5,15 @@ import com.ydtech.modules.admin.model.report.profitAnalysis.ProfitAnalysisQueryD
|
|
|
import com.ydtech.modules.admin.service.ProfitAnalysisService;
|
|
import com.ydtech.modules.admin.service.ProfitAnalysisService;
|
|
|
import com.ydtech.modules.admin.utils.SliceUpDateUtil;
|
|
import com.ydtech.modules.admin.utils.SliceUpDateUtil;
|
|
|
import com.ydtech.modules.fnc.dao.InsPlyIncomeMapper;
|
|
import com.ydtech.modules.fnc.dao.InsPlyIncomeMapper;
|
|
|
|
|
+import com.ydtech.modules.inv.dao.InvAccountMapper;
|
|
|
|
|
+import com.ydtech.modules.inv.model.InvAccount;
|
|
|
|
|
+import com.ydtech.modules.inv.model.InvAccountCardVo;
|
|
|
|
|
+import com.ydtech.utils.BigDecimalUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.Calendar;
|
|
import java.util.Calendar;
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
@@ -22,7 +27,8 @@ import java.util.List;
|
|
|
*/
|
|
*/
|
|
|
@Service
|
|
@Service
|
|
|
public class ProfitAnalysisServiceImpl implements ProfitAnalysisService {
|
|
public class ProfitAnalysisServiceImpl implements ProfitAnalysisService {
|
|
|
-
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private InvAccountMapper invAccountMapper;
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private InsPlyIncomeMapper insPlyIncomeMapper;
|
|
private InsPlyIncomeMapper insPlyIncomeMapper;
|
|
@@ -52,7 +58,28 @@ public class ProfitAnalysisServiceImpl implements ProfitAnalysisService {
|
|
|
HashMap<String, String> dateMapByType = getDateMapByType(profitAnalysisQueryDto.getDateType(), profitAnalysisQueryDto.getYear());
|
|
HashMap<String, String> dateMapByType = getDateMapByType(profitAnalysisQueryDto.getDateType(), profitAnalysisQueryDto.getYear());
|
|
|
profitAnalysisQueryDto.setBeginDate(dateMapByType.get("startDate"));
|
|
profitAnalysisQueryDto.setBeginDate(dateMapByType.get("startDate"));
|
|
|
profitAnalysisQueryDto.setEndDate(dateMapByType.get("endDate"));
|
|
profitAnalysisQueryDto.setEndDate(dateMapByType.get("endDate"));
|
|
|
- return insPlyIncomeMapper.getProfitAnalysisQueryList(profitAnalysisQueryDto);
|
|
|
|
|
|
|
+ List<ProfitAnalysisDto> profitAnalysisQueryList = insPlyIncomeMapper.getProfitAnalysisQueryList(profitAnalysisQueryDto);
|
|
|
|
|
+ if(!profitAnalysisQueryList.isEmpty()){
|
|
|
|
|
+ for (ProfitAnalysisDto profitAnalysisDto : profitAnalysisQueryList) {
|
|
|
|
|
+ BigDecimal variableCost = BigDecimal.ZERO;
|
|
|
|
|
+ String yearAndMonth = profitAnalysisDto.getYearAndMonth();
|
|
|
|
|
+ profitAnalysisQueryDto.setYearAndMonth(yearAndMonth);
|
|
|
|
|
+ List<ProfitAnalysisDto> profitAnalysisDto1 = insPlyIncomeMapper.changeAmount(profitAnalysisQueryDto);
|
|
|
|
|
+ for (ProfitAnalysisDto analysisDto : profitAnalysisDto1) {
|
|
|
|
|
+ String outCardNum = analysisDto.getOutCardNum();
|
|
|
|
|
+ String enterCardNum = analysisDto.getEnterCardNum();
|
|
|
|
|
+ InvAccountCardVo outAccount = invAccountMapper.getByCarNumber(outCardNum);
|
|
|
|
|
+ InvAccountCardVo enterAccount = invAccountMapper.getByCarNumber(enterCardNum);
|
|
|
|
|
+ if(StringUtils.isNotEmpty(outAccount.getOuterFlag()) && StringUtils.isNotEmpty(enterAccount.getOuterFlag())){
|
|
|
|
|
+ if(!enterAccount.getOuterFlag().equals(outAccount.getOuterFlag())){
|
|
|
|
|
+ variableCost=variableCost.add(analysisDto.getApplyAmount());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ profitAnalysisDto.setVariableCost(variableCost);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return profitAnalysisQueryList;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|