Kaynağa Gözat

优化加入费用变更记录

Your Name 3 yıl önce
ebeveyn
işleme
52f88cd70f

+ 20 - 0
java110-bean/src/main/java/com/java110/dto/fee/FeeDto.java

@@ -150,6 +150,10 @@ public class FeeDto extends PageDto implements Serializable {
     private String decimalPlace;
     private String units;
 
+    private String operate;
+
+    private String userName;
+
     public String getAmount() {
         return amount;
     }
@@ -728,4 +732,20 @@ public class FeeDto extends PageDto implements Serializable {
     public void setUnits(String units) {
         this.units = units;
     }
+
+    public String getOperate() {
+        return operate;
+    }
+
+    public void setOperate(String operate) {
+        this.operate = operate;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
 }

+ 30 - 0
java110-db/src/main/resources/mapper/report/ReportCommunityServiceDaoImplMapper.xml

@@ -301,4 +301,34 @@
         </if>
     </select>
 
+    <select id="queryHisFeeCount" parameterType="Map" resultType="Map">
+        select count(1) count
+        from business_pay_fee t
+        left join  pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
+        left join c_business cb on t.b_id = cb.b_id
+        left join c_orders co on cb.o_id = co.o_id
+        left join u_user uu on co.user_id = uu.user_id
+        where 1=1
+        and t.fee_id = #{feeId}
+        and t.community_id = #{communityId}
+    </select>
+
+    <select id="queryHisFees" parameterType="Map" resultType="Map">
+        select t.operate,t.start_time startTime,t.end_time endTime,t.create_time createTime,pfc.fee_name feeName,
+        t.amount,
+        uu.`name` userName
+        from business_pay_fee t
+        left join  pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
+        left join c_business cb on t.b_id = cb.b_id
+        left join c_orders co on cb.o_id = co.o_id
+        left join u_user uu on co.user_id = uu.user_id
+        where 1=1
+        and t.fee_id = #{feeId}
+        and t.community_id = #{communityId}
+        order by t.create_time desc,t.operate
+        <if test="page != -1 and page != null ">
+            limit #{page}, #{row}
+        </if>
+    </select>
+
 </mapper>

+ 7 - 0
java110-interface/src/main/java/com/java110/intf/report/IReportCommunityInnerServiceSMO.java

@@ -2,6 +2,7 @@ package com.java110.intf.report;
 
 import com.java110.config.feign.FeignConfiguration;
 import com.java110.dto.RoomDto;
+import com.java110.dto.fee.FeeDto;
 import com.java110.dto.owner.OwnerCarDto;
 import com.java110.dto.owner.OwnerDto;
 import org.springframework.cloud.openfeign.FeignClient;
@@ -71,4 +72,10 @@ public interface IReportCommunityInnerServiceSMO {
 
     @RequestMapping(value = "/queryHisOwners", method = RequestMethod.POST)
     List<OwnerDto> queryHisOwners(@RequestBody OwnerDto ownerDto);
+
+    @RequestMapping(value = "/queryHisFeeCount", method = RequestMethod.POST)
+    int queryHisFeeCount(@RequestBody FeeDto feeDto);
+
+    @RequestMapping(value = "/queryHisFees", method = RequestMethod.POST)
+    List<FeeDto> queryHisFees(@RequestBody FeeDto feeDto);
 }

+ 6 - 6
service-fee/src/main/java/com/java110/fee/cmd/feeConfig/ListFeeConfigsCmd.java

@@ -38,7 +38,7 @@ public class ListFeeConfigsCmd extends Cmd {
     public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
         FeeConfigDto feeConfigDto = BeanConvertUtil.covertBean(reqJson, FeeConfigDto.class);
 
-        if(!StringUtil.isEmpty(reqJson.getString("isFlag")) && reqJson.getString("isFlag").equals("0")){
+        if ("0".equals(reqJson.getString("isFlag"))) {
             feeConfigDto.setPage(PageDto.DEFAULT_PAGE);
         }
 
@@ -49,13 +49,13 @@ public class ListFeeConfigsCmd extends Cmd {
         if (count > 0) {
             feeConfigs = BeanConvertUtil.covertBeanList(feeConfigInnerServiceSMOImpl.queryFeeConfigs(feeConfigDto), ApiFeeConfigDataVo.class);
             //处理 小数点后无效的0
-            for(ApiFeeConfigDataVo feeConfig: feeConfigs){
-                if (!StringUtil.isEmpty(feeConfig.getAdditionalAmount())){
-                    feeConfig.setAdditionalAmount(Double.parseDouble(feeConfig.getAdditionalAmount())+"");
+            for (ApiFeeConfigDataVo feeConfig : feeConfigs) {
+                if (!StringUtil.isEmpty(feeConfig.getAdditionalAmount())) {
+                    feeConfig.setAdditionalAmount(Double.parseDouble(feeConfig.getAdditionalAmount()) + "");
                 }
 
-                if (!StringUtil.isEmpty(feeConfig.getSquarePrice())){
-                    feeConfig.setSquarePrice(Double.parseDouble(feeConfig.getSquarePrice())+"");
+                if (!StringUtil.isEmpty(feeConfig.getSquarePrice())) {
+                    feeConfig.setSquarePrice(Double.parseDouble(feeConfig.getSquarePrice()) + "");
                 }
             }
         } else {

+ 55 - 0
service-report/src/main/java/com/java110/report/cmd/fee/QueryHisFeeCmd.java

@@ -0,0 +1,55 @@
+package com.java110.report.cmd.fee;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.context.ICmdDataFlowContext;
+import com.java110.core.event.cmd.Cmd;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.dto.fee.FeeDto;
+import com.java110.dto.owner.OwnerDto;
+import com.java110.intf.report.IReportCommunityInnerServiceSMO;
+import com.java110.utils.exception.CmdException;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.vo.ResultVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 查询费用变更记录
+ */
+@Java110Cmd(serviceCode = "fee.queryHisFee")
+public class QueryHisFeeCmd extends Cmd {
+
+    @Autowired
+    private IReportCommunityInnerServiceSMO reportCommunityInnerServiceSMOImpl;
+
+    @Override
+    public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException {
+        Assert.hasKeyAndValue(reqJson,"feeId","未包含费用ID");
+        Assert.hasKeyAndValue(reqJson,"communityId","未包含小区");
+
+    }
+
+    @Override
+    public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException {
+        int row = reqJson.getInteger("row");
+        FeeDto feeDto = BeanConvertUtil.covertBean(reqJson, FeeDto.class);
+
+        int total = reportCommunityInnerServiceSMOImpl.queryHisFeeCount(feeDto);
+//        int count = 0;
+        List<FeeDto> feeDtos = null;
+        if (total > 0) {
+            feeDtos = reportCommunityInnerServiceSMOImpl.queryHisFees(feeDto);
+        } else {
+            feeDtos = new ArrayList<>();
+        }
+
+        ResponseEntity<String> responseEntity = ResultVo.createResponseEntity((int) Math.ceil((double) total / (double) row), total, feeDtos);
+        context.setResponseEntity(responseEntity);
+    }
+}

+ 4 - 0
service-report/src/main/java/com/java110/report/dao/IReportCommunityServiceDao.java

@@ -99,4 +99,8 @@ public interface IReportCommunityServiceDao {
     int queryHisOwnerCount(Map info);
 
     List<Map> queryHisOwners(Map info);
+
+    int queryHisFeeCount(Map info);
+
+    List<Map> queryHisFees(Map info);
 }

+ 21 - 0
service-report/src/main/java/com/java110/report/dao/impl/ReportCommunityServiceDaoImpl.java

@@ -169,4 +169,25 @@ public class ReportCommunityServiceDaoImpl extends BaseServiceDao implements IRe
 
         return businessOwnerCarInfos;
     }
+
+    @Override
+    public int queryHisFeeCount(Map info) {
+        logger.debug("查询queryHisFeeCount 入参 info : {}", info);
+
+        List<Map> businessOwnerCarInfos = sqlSessionTemplate.selectList("reportCommunityServiceDaoImpl.queryHisFeeCount", info);
+        if (businessOwnerCarInfos.size() < 1) {
+            return 0;
+        }
+
+        return Integer.parseInt(businessOwnerCarInfos.get(0).get("count").toString());
+    }
+
+    @Override
+    public List<Map> queryHisFees(Map info) {
+        logger.debug("查询 queryHisFees 入参 info : {}", info);
+
+        List<Map> businessOwnerCarInfos = sqlSessionTemplate.selectList("reportCommunityServiceDaoImpl.queryHisFees", info);
+
+        return businessOwnerCarInfos;
+    }
 }

+ 23 - 2
service-report/src/main/java/com/java110/report/smo/impl/ReportCommunityInnerServiceSMOImpl.java

@@ -4,6 +4,7 @@ package com.java110.report.smo.impl;
 import com.java110.core.base.smo.BaseServiceSMO;
 import com.java110.dto.PageDto;
 import com.java110.dto.RoomDto;
+import com.java110.dto.fee.FeeDto;
 import com.java110.dto.owner.OwnerAttrDto;
 import com.java110.dto.owner.OwnerCarDto;
 import com.java110.dto.owner.OwnerDto;
@@ -94,12 +95,12 @@ public class ReportCommunityInnerServiceSMOImpl extends BaseServiceSMO implement
     }
 
     @Override
-    public int queryHisOwnerCount(OwnerDto ownerDto) {
+    public int queryHisOwnerCount(@RequestBody OwnerDto ownerDto) {
         return reportCommunityServiceDaoImpl.queryHisOwnerCount(BeanConvertUtil.beanCovertMap(ownerDto));
     }
 
     @Override
-    public List<OwnerDto> queryHisOwners(OwnerDto ownerDto) {
+    public List<OwnerDto> queryHisOwners(@RequestBody OwnerDto ownerDto) {
         int page = ownerDto.getPage();
 
         if (page != PageDto.DEFAULT_PAGE) {
@@ -127,6 +128,26 @@ public class ReportCommunityInnerServiceSMOImpl extends BaseServiceSMO implement
         return ownerDtos;
     }
 
+    @Override
+    public int queryHisFeeCount(@RequestBody FeeDto feeDto) {
+        return reportCommunityServiceDaoImpl.queryHisFeeCount(BeanConvertUtil.beanCovertMap(feeDto));
+    }
+
+    @Override
+    public List<FeeDto> queryHisFees(@RequestBody FeeDto feeDto) {
+        int page = feeDto.getPage();
+
+        if (page != PageDto.DEFAULT_PAGE) {
+            feeDto.setPage((page - 1) * feeDto.getRow());
+        }
+
+        List<FeeDto> feeDtos = BeanConvertUtil.covertBeanList(
+                reportCommunityServiceDaoImpl.queryHisFees(BeanConvertUtil.beanCovertMap(feeDto)),
+                FeeDto.class);
+
+        return feeDtos;
+    }
+
     /**
      * 获取批量userId
      *