Procházet zdrojové kódy

1.控制台利润分析变动成本金额调整

wuhp před 1 rokem
rodič
revize
de216d219d

+ 10 - 0
src/main/java/com/ydtech/modules/admin/model/report/profitAnalysis/ProfitAnalysisDto.java

@@ -59,4 +59,14 @@ public class ProfitAnalysisDto {
     @ApiModelProperty("净利润")
     @TableField(value="net_profit")
     private BigDecimal netProfit;
+
+
+    @ApiModelProperty("变动金额")
+    private BigDecimal applyAmount;
+
+    @ApiModelProperty("转入银行卡")
+    private String enterCardNum;
+
+    @ApiModelProperty("转出银行卡")
+    private String outCardNum;
 }

+ 4 - 0
src/main/java/com/ydtech/modules/admin/model/report/profitAnalysis/ProfitAnalysisQueryDto.java

@@ -39,4 +39,8 @@ public class ProfitAnalysisQueryDto {
     @ApiModelProperty("部门ids")
     private List<String> deptIds;
 
+
+    @ApiModelProperty("年月")
+    private String yearAndMonth;
+
 }

+ 29 - 2
src/main/java/com/ydtech/modules/admin/service/impl/ProfitAnalysisServiceImpl.java

@@ -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.utils.SliceUpDateUtil;
 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.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.math.BigDecimal;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.HashMap;
@@ -22,7 +27,8 @@ import java.util.List;
  */
 @Service
 public class ProfitAnalysisServiceImpl implements ProfitAnalysisService {
-
+    @Autowired
+    private InvAccountMapper invAccountMapper;
 
     @Autowired
     private InsPlyIncomeMapper insPlyIncomeMapper;
@@ -52,7 +58,28 @@ public class ProfitAnalysisServiceImpl implements ProfitAnalysisService {
         HashMap<String, String> dateMapByType = getDateMapByType(profitAnalysisQueryDto.getDateType(), profitAnalysisQueryDto.getYear());
         profitAnalysisQueryDto.setBeginDate(dateMapByType.get("startDate"));
         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;
     }
 
     /**

+ 3 - 0
src/main/java/com/ydtech/modules/fnc/dao/InsPlyIncomeMapper.java

@@ -225,4 +225,7 @@ public interface InsPlyIncomeMapper extends BaseMapper<InsPlyIncome> {
      * @return  合计金额
      */
     List<InsPlyIncome> totalBxAmountNew(HashMap<String, Object> params);
+
+    List<ProfitAnalysisDto> changeAmount(@Param("vo") ProfitAnalysisQueryDto profitAnalysisQueryDto);
+
 }

+ 3 - 0
src/main/java/com/ydtech/modules/inv/dao/InvAccountMapper.java

@@ -32,6 +32,9 @@ public interface InvAccountMapper extends BaseMapper<InvAccount> {
      *  @Description:  通过账户名和银行卡号查询账户列表
      */
     Page<InvAccountCard> queryPage(@Param("page") Page<InvAccountCard> page, @Param("vo") InvAccountCardQueryDto invAccountCardQueryDto);
+
+    InvAccountCardVo getByCarNumber(String cardNum);
+
 }
 
 

+ 6 - 0
src/main/java/com/ydtech/modules/inv/model/InvAccountCardVo.java

@@ -35,4 +35,10 @@ public class InvAccountCardVo {/**
     @ApiModelProperty(value = "账户Id")
     private String accountId;
 
+    @ApiModelProperty(value = "账户性质")
+    private String accountQuality;
+
+    @ApiModelProperty(value = "外部账户标识(0内部账户 1外部账户)")
+    private String outerFlag;
+
 }

+ 31 - 0
src/main/resources/mapper/modules/fnc/InsPlyIncomeMapper.xml

@@ -3040,6 +3040,37 @@
 
     </select>
 
+    <select id="changeAmount" resultType="com.ydtech.modules.admin.model.report.profitAnalysis.ProfitAnalysisDto">
+        SELECT
+            a.apply_amount as "applyAmount",
+            a.enter_card_num as "enterCardNum",
+            a.out_card_num as "outCardNum"
+        FROM
+            inv_account_operate a
+                left  join  (
+                select a.category as "aCategory",b. category as "bCategory",a.expenditure_details as "expenditureDetails" from  inv_account_expenses a
+                left  join  inv_account_expenses  b  on a.parent_id =b.expenses_id
+                where   b.category  is  not  null
+            )  b on a.fund_use  = b.bCategory  and  a.fund_fen  = b.aCategory
+        where
+            a.out_card_num IN (
+                SELECT
+                    bank_card_num
+                FROM
+                    inv_account_card iac
+                        LEFT JOIN inv_account ia ON iac.account_id = ia.account_id
+                WHERE
+                    ia.del_flag = '0'
+                  AND ia.outer_flag LIKE concat( '%', '0', '%' )
+            )
+          AND a.del_flag = '0'
+          AND b.expenditureDetails = '3'
+          AND a.revenue_outlay = '0'
+        <if test="vo.yearAndMonth != null  and vo.yearAndMonth !=''">
+          AND   DATE_FORMAT( a.create_time, '%Y-%m' ) =#{vo.yearAndMonth}
+        </if>
+    </select>
+
 
     <select id="getInvociAmount" resultType="com.ydtech.modules.fnc.dto.InsuranceHandlingSettlementMonthDto" >
         select

+ 11 - 0
src/main/resources/mapper/modules/inv/InvAccountMapper.xml

@@ -220,4 +220,15 @@
         a.account_id,
         b.bank_card_num
     </select>
+
+    <select id="getByCarNumber" resultType="com.ydtech.modules.inv.model.InvAccountCardVo">
+        select  ia.outer_flag as "outerFlag" from inv_account_card iac
+        LEFT JOIN inv_account ia ON iac.account_id = ia.account_id
+        <where>
+            <if test="cardNum !=null  and  cardNum!=''">
+                iac.bank_card_num  =#{cardNum}
+            </if>
+        </where>
+
+    </select>
 </mapper>