java110 %!s(int64=3) %!d(string=hai) anos
pai
achega
a13573d5ef

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

@@ -227,4 +227,52 @@
         </if>
     </select>
 
+    <select id="getOwnerDiningCount" parameterType="Map" resultType="Map">
+        select count(1) count
+        from reserve_goods_confirm_order t
+        left join reserve_goods_order rgo on t.order_id = rgo.order_id and t.goods_id = rgo.goods_id and rgo.status_cd = '0'
+        left join reserve_goods_order_time rgco on t.time_id = rgco.time_id and rgco.order_id = rgo.order_id and rgco.status_cd = '0'
+        left join reserve_goods rg on t.goods_id = rg.goods_id and rg.status_cd = '0'
+        left join building_owner bo on rgo.person_tel = bo.link and bo.status_cd = '0'
+        left join building_owner bo1 on bo.owner_id = bo1.owner_id and bo1.owner_type_cd = '1001' and bo1.status_cd = '0'
+        where 1 =1
+        and t.community_id = #{communityId}
+        <if test="startDate !=null and startDate != ''">
+            and t.create_time &gt; #{startDate}
+            and t.create_time &lt; #{endDate}
+        </if>
+        <if test="ownerName !=null and ownerName != ''">
+            and bol.name like concat('%',#{ownerName},'%')
+        </if>
+        <if test="personName !=null and personName != ''">
+            and rgo.person_name like concat('%',#{personName},'%')
+        </if>
+    </select>
+    <select id="getOwnerDinings" parameterType="Map" resultType="Map">
+        select t.time_id,t.time_id timeId,t.order_id,t.order_id orderId,t.goods_id,t.goods_id goodsId,t.co_id,t.co_id
+        coId,t.remark,t.status_cd,t.status_cd statusCd,t.type,t.community_id,t.community_id communityId,
+        rgo.person_name personName,rgo.person_tel personTel,rgo.appointment_time appointmentTime,rgco.hours,rgco.quantity,
+        rg.goods_name goodsName,rg.img_url imgUrl,t.create_time createTime,bo1.name ownerName
+        from reserve_goods_confirm_order t
+        left join reserve_goods_order rgo on t.order_id = rgo.order_id and t.goods_id = rgo.goods_id and rgo.status_cd = '0'
+        left join reserve_goods_order_time rgco on t.time_id = rgco.time_id and rgco.order_id = rgo.order_id and rgco.status_cd = '0'
+        left join reserve_goods rg on t.goods_id = rg.goods_id and rg.status_cd = '0'
+        left join building_owner bo on rgo.person_tel = bo.link and bo.status_cd = '0'
+        left join building_owner bo1 on bo.owner_id = bo1.owner_id and bo1.owner_type_cd = '1001' and bo1.status_cd = '0'
+        where 1 =1
+        and t.community_id = #{communityId}
+        <if test="startDate !=null and startDate != ''">
+            and t.create_time &gt; #{startDate}
+            and t.create_time &lt; #{endDate}
+        </if>
+        <if test="ownerName !=null and ownerName != ''">
+            and bol.name like concat('%',#{ownerName},'%')
+        </if>
+        <if test="personName !=null and personName != ''">
+            and rgo.person_name like concat('%',#{personName},'%')
+        </if>
+        <if test="page != -1 and page != null ">
+            limit #{page}, #{row}
+        </if>
+    </select>
 </mapper>

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

@@ -90,4 +90,10 @@ public interface IReportOrderStatisticsInnerServiceSMO {
 
     @RequestMapping(value = "/getOwnerReserveGoods", method = RequestMethod.POST)
     List<Map> getOwnerReserveGoods(@RequestBody OwnerDto ownerDto);
+
+    @RequestMapping(value = "/getOwnerDiningCount", method = RequestMethod.POST)
+    int getOwnerDiningCount(@RequestBody OwnerDto ownerDto);
+
+    @RequestMapping(value = "/getOwnerDinings", method = RequestMethod.POST)
+    List<Map> getOwnerDinings(@RequestBody OwnerDto ownerDto);
 }

+ 66 - 0
service-report/src/main/java/com/java110/report/cmd/owner/QueryOwnerDiningCmd.java

@@ -0,0 +1,66 @@
+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.intf.report.IReportOrderStatisticsInnerServiceSMO;
+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.queryOwnerDining")
+public class QueryOwnerDiningCmd 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);
+
+        // todo 查询总数量
+        int total = reportOrderStatisticsInnerServiceSMOImpl.getOwnerDiningCount(ownerDto);
+//        int count = 0;
+        List<Map> infos = null;
+        if (total > 0) {
+            infos = reportOrderStatisticsInnerServiceSMOImpl.getOwnerDinings(ownerDto);
+        } else {
+            infos = new ArrayList<>();
+        }
+
+        ResponseEntity<String> responseEntity = ResultVo.createResponseEntity((int) Math.ceil((double) total / (double) row), total, infos);
+        context.setResponseEntity(responseEntity);
+    }
+}

+ 0 - 2
service-report/src/main/java/com/java110/report/cmd/owner/QueryOwnerReserveGoodsCmd.java

@@ -6,9 +6,7 @@ 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;

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

@@ -56,4 +56,10 @@ public interface IReportOrderStatisticsServiceDao {
     int getOwnerReserveGoodsCount(Map info);
 
     List<Map> getOwnerReserveGoods(Map info);
+
+
+    int getOwnerDiningCount(Map info);
+
+    List<Map> getOwnerDinings(Map info);
+
 }

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

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

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

@@ -155,4 +155,22 @@ public class ReportOrderStatisticsInnerServiceSMOImpl extends BaseServiceSMO imp
         return infos;
     }
 
+    @Override
+    public int getOwnerDiningCount(@RequestBody OwnerDto ownerDto) {
+        int info = reportOrderStatisticsServiceDaoImpl.getOwnerDiningCount(BeanConvertUtil.beanCovertMap(ownerDto));
+        return info;
+    }
+
+    @Override
+    public List<Map> getOwnerDinings(@RequestBody OwnerDto ownerDto) {
+        int page = ownerDto.getPage();
+
+        if (page != PageDto.DEFAULT_PAGE) {
+            ownerDto.setPage((page - 1) * ownerDto.getRow());
+        }
+
+        List<Map> infos = reportOrderStatisticsServiceDaoImpl.getOwnerDinings(BeanConvertUtil.beanCovertMap(ownerDto));
+        return infos;
+    }
+
 }

+ 3 - 0
service-store/src/main/java/com/java110/store/cmd/reserveOrder/ListReserveGoodsConfirmOrderCmd.java

@@ -22,6 +22,7 @@ import com.java110.core.event.cmd.Cmd;
 import com.java110.core.event.cmd.CmdEvent;
 import com.java110.intf.store.IReserveGoodsConfirmOrderV1InnerServiceSMO;
 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;
@@ -54,6 +55,8 @@ public class ListReserveGoodsConfirmOrderCmd extends Cmd {
     @Override
     public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
         super.validatePageInfo(reqJson);
+        Assert.hasKeyAndValue(reqJson, "communityId", "未包含小区");
+
     }
 
     @Override

+ 3 - 0
service-store/src/main/java/com/java110/store/cmd/reserveOrder/ListReserveGoodsOrderCmd.java

@@ -24,6 +24,7 @@ import com.java110.dto.reserve.ReserveGoodsOrderTimeDto;
 import com.java110.intf.store.IReserveGoodsOrderTimeV1InnerServiceSMO;
 import com.java110.intf.store.IReserveGoodsOrderV1InnerServiceSMO;
 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;
@@ -61,6 +62,8 @@ public class ListReserveGoodsOrderCmd extends Cmd {
     @Override
     public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
         super.validatePageInfo(reqJson);
+        Assert.hasKeyAndValue(reqJson, "communityId", "未包含小区");
+
     }
 
     @Override