java110 před 3 roky
rodič
revize
0b3ff378a9

+ 19 - 0
java110-bean/src/main/java/com/java110/dto/owner/OwnerDto.java

@@ -78,6 +78,9 @@ public class OwnerDto extends PageDto implements Serializable {
     private String ownerFlag;
     private String operate;
 
+    private String startDate;
+    private String endDate;
+
     private List<OwnerAttrDto> ownerAttrDtos;
 
     private List<RoomDto> rooms;
@@ -521,4 +524,20 @@ public class OwnerDto extends PageDto implements Serializable {
     public void setNameLike(String nameLike) {
         this.nameLike = nameLike;
     }
+
+    public String getStartDate() {
+        return startDate;
+    }
+
+    public void setStartDate(String startDate) {
+        this.startDate = startDate;
+    }
+
+    public String getEndDate() {
+        return endDate;
+    }
+
+    public void setEndDate(String endDate) {
+        this.endDate = endDate;
+    }
 }

+ 44 - 0
java110-db/src/main/resources/mapper/report/ReportOrderStatisticsServiceDaoImplMapper.xml

@@ -179,4 +179,48 @@
         and t.status_cd = '0'
     </select>
 
+    <select id="getOwnerReserveGoodsCount" parameterType="Map" resultType="Map">
+        select count(1) count
+        from (
+            select t.owner_id,t.name,t.link,count(1) from building_owner t
+            left join building_owner bom on t.owner_id = bom.owner_id and bom.status_cd = '0'
+            left join reserve_goods_order rgo on (bom.link = rgo.person_tel or t.link = rgo.person_tel) and rgo.status_cd = '0'
+            where t.owner_type_cd = '1001'
+            and t.community_id = #{communityId}
+            and t.create_time &gt; #{startDate}
+            and t.create_time &lt; #{endDate}
+            <if test="name !=null and name != ''">
+                and t.name like concat('%',#{name},'%')
+            </if>
+            <if test="link !=null and link != ''">
+                and t.link= #{link}
+            </if>
+            and t.status_cd = '0'
+            group by t.owner_id,t.name,t.link
+            HAVING count(1) > 0
+        )
+    </select>
+    <select id="getOwnerReserveGoods" parameterType="Map" resultType="Map">
+        select t.owner_id,t.name,t.link,count(1) frequency
+        from building_owner t
+        left join building_owner bom on t.owner_id = bom.owner_id and bom.status_cd = '0'
+        left join reserve_goods_order rgo on (bom.link = rgo.person_tel or t.link = rgo.person_tel) and rgo.status_cd = '0'
+        where t.owner_type_cd = '1001'
+        and t.community_id = #{communityId}
+        and t.create_time &gt; #{startDate}
+        and t.create_time &lt; #{endDate}
+        <if test="name !=null and name != ''">
+            and t.name like concat('%',#{name},'%')
+        </if>
+        <if test="link !=null and link != ''">
+            and t.link= #{link}
+        </if>
+        and t.status_cd = '0'
+        group by t.owner_id,t.name,t.link
+        HAVING count(1) > 0
+        <if test="page != -1 and page != null ">
+            limit #{page}, #{row}
+        </if>
+    </select>
+
 </mapper>

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

@@ -1,6 +1,7 @@
 package com.java110.intf.report;
 
 import com.java110.config.feign.FeignConfiguration;
+import com.java110.dto.owner.OwnerDto;
 import com.java110.dto.report.QueryStatisticsDto;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -83,4 +84,10 @@ public interface IReportOrderStatisticsInnerServiceSMO {
 
     @RequestMapping(value = "/getChargeMonthOrderCount", method = RequestMethod.POST)
     double getChargeMonthOrderCount(@RequestBody QueryStatisticsDto queryStatisticsDto);
+
+    @RequestMapping(value = "/getOwnerReserveGoodsCount", method = RequestMethod.POST)
+    int getOwnerReserveGoodsCount(@RequestBody OwnerDto ownerDto);
+
+    @RequestMapping(value = "/getOwnerReserveGoods", method = RequestMethod.POST)
+    List<Map> getOwnerReserveGoods(@RequestBody OwnerDto ownerDto);
 }

+ 14 - 0
service-fee/src/main/java/com/java110/fee/bmo/payFeeDetail/impl/ImportPayFeeDetailBMOImpl.java

@@ -30,6 +30,7 @@ import org.springframework.stereotype.Service;
 
 import java.text.ParseException;
 import java.util.ArrayList;
+import java.util.Calendar;
 import java.util.List;
 
 @Service("importPayFeeDetailBMOImpl")
@@ -102,6 +103,10 @@ public class ImportPayFeeDetailBMOImpl implements IImportPayFeeBMODetail {
             if (StringUtil.isEmpty(importRoomFee.getRoomId())) {
                 continue;
             }
+
+            String endTime = importRoomFee.getEndTime();
+
+
             importFeeDetail(importRoomFee, storeId, userId, batchId);
         }
     }
@@ -318,6 +323,15 @@ public class ImportPayFeeDetailBMOImpl implements IImportPayFeeBMODetail {
         payFeeDetailPo.setPrimeRate("1.0");
         payFeeDetailPo.setFeeId(tmpFeeDto.getFeeId());
         payFeeDetailPo.setStartTime(importRoomFee.getStartTime());
+        String endTime = importRoomFee.getEndTime();
+        //todo 周期性费用时时间自动加一天,因为物业统计的Excel 一般少一天
+        if (!FeeDto.FEE_FLAG_ONCE.equals(tmpFeeDto.getFeeFlag())) {
+            Calendar calendar = Calendar.getInstance();
+            calendar.setTime(DateUtil.getDateFromStringB(endTime));
+            calendar.add(Calendar.DAY_OF_MONTH, 1);
+            endTime = DateUtil.getFormatTimeStringB(calendar.getTime());
+            importRoomFee.setEndTime(endTime);
+        }
         payFeeDetailPo.setEndTime(importRoomFee.getEndTime());
         payFeeDetailPo.setDetailId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_detailId));
         payFeeDetailPo.setRemark(importRoomFee.getRemark());

+ 67 - 1
service-report/src/main/java/com/java110/report/cmd/owner/QueryOwnerReserveGoodsCmd.java

@@ -1,2 +1,68 @@
-package com.java110.report.cmd.owner;public class QueryOwnerReserveGoodsCmd {
+package com.java110.report.cmd.owner;
+
+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.owner.OwnerDto;
+import com.java110.dto.report.QueryStatisticsDto;
+import com.java110.intf.report.IReportOrderStatisticsInnerServiceSMO;
+import com.java110.report.statistics.IOrderStatistics;
+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;
+import java.util.Map;
+
+/**
+ * 查询业主就餐情况
+ */
+@Java110Cmd(serviceCode = "owner.queryOwnerReserveGoods")
+public class QueryOwnerReserveGoodsCmd extends Cmd {
+
+    @Autowired
+    private IReportOrderStatisticsInnerServiceSMO reportOrderStatisticsInnerServiceSMOImpl;
+
+    @Override
+    public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException {
+        Assert.hasKeyAndValue(reqJson,"communityId","未包含小区");
+        Assert.hasKeyAndValue(reqJson,"startDate","未包含开始时间");
+        Assert.hasKeyAndValue(reqJson,"endDate","未包含结束时间");
+        String startDate = reqJson.getString("startDate");
+        String endDate = reqJson.getString("endDate");
+        if (!startDate.contains(":")) {
+            startDate += " 00:00:00";
+            reqJson.put("startDate", startDate);
+        }
+        if (!endDate.contains(":")) {
+            endDate += " 23:59:59";
+            reqJson.put("endDate", endDate);
+        }
+    }
+
+    @Override
+    public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException {
+        int row = reqJson.getInteger("row");
+        OwnerDto ownerDto = BeanConvertUtil.covertBean(reqJson, OwnerDto.class);
+
+        int total = reportOrderStatisticsInnerServiceSMOImpl.getOwnerReserveGoodsCount(ownerDto);
+//        int count = 0;
+        List<Map> infos = null;
+        if (total > 0) {
+            infos = reportOrderStatisticsInnerServiceSMOImpl.getOwnerReserveGoods(ownerDto);
+        } else {
+            infos = new ArrayList<>();
+        }
+
+        ResponseEntity<String> responseEntity = ResultVo.createResponseEntity((int) Math.ceil((double) total / (double) row), total, infos);
+        context.setResponseEntity(responseEntity);
+
+    }
 }

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

@@ -52,4 +52,8 @@ public interface IReportOrderStatisticsServiceDao {
     double getChargeMachineOrderCount(Map info);
 
     double getChargeMonthOrderCount(Map info);
+
+    int getOwnerReserveGoodsCount(Map info);
+
+    List<Map> getOwnerReserveGoods(Map info);
 }

+ 22 - 0
service-report/src/main/java/com/java110/report/dao/impl/ReportOrderStatisticsServiceDaoImpl.java

@@ -225,4 +225,26 @@ public class ReportOrderStatisticsServiceDaoImpl extends BaseServiceDao implemen
         return Double.parseDouble(infos.get(0).get("chargeMonthMoney").toString());
     }
 
+    @Override
+    public int getOwnerReserveGoodsCount(Map info) {
+        logger.debug("查询 getOwnerReserveGoodsCount 入参 info : {}", JSONObject.toJSONString(info));
+
+        List<Map> infos = sqlSessionTemplate.selectList("reportOrderStatisticsServiceDaoImpl.getOwnerReserveGoodsCount", info);
+
+        if (infos == null || infos.size() < 1) {
+            return 0;
+        }
+
+        return Integer.parseInt(infos.get(0).get("count").toString());
+    }
+
+    @Override
+    public List<Map> getOwnerReserveGoods(Map info) {
+        logger.debug("查询 getOwnerReserveGoods 入参 info : {}", JSONObject.toJSONString(info));
+
+        List<Map> infos = sqlSessionTemplate.selectList("reportOrderStatisticsServiceDaoImpl.getOwnerReserveGoods", info);
+
+        return infos;
+    }
+
 }

+ 13 - 0
service-report/src/main/java/com/java110/report/smo/impl/ReportOrderStatisticsInnerServiceSMOImpl.java

@@ -3,6 +3,7 @@ package com.java110.report.smo.impl;
 
 import com.java110.core.base.smo.BaseServiceSMO;
 import com.java110.dto.PageDto;
+import com.java110.dto.owner.OwnerDto;
 import com.java110.dto.report.QueryStatisticsDto;
 import com.java110.intf.report.IReportFeeStatisticsInnerServiceSMO;
 import com.java110.intf.report.IReportOrderStatisticsInnerServiceSMO;
@@ -136,4 +137,16 @@ public class ReportOrderStatisticsInnerServiceSMOImpl extends BaseServiceSMO imp
         return info;
     }
 
+    @Override
+    public int getOwnerReserveGoodsCount(@RequestBody OwnerDto ownerDto) {
+        int info = reportOrderStatisticsServiceDaoImpl.getOwnerReserveGoodsCount(BeanConvertUtil.beanCovertMap(ownerDto));
+        return info;
+    }
+
+    @Override
+    public List<Map> getOwnerReserveGoods(@RequestBody OwnerDto ownerDto) {
+        List<Map> infos = reportOrderStatisticsServiceDaoImpl.getOwnerReserveGoods(BeanConvertUtil.beanCovertMap(ownerDto));
+        return infos;
+    }
+
 }