Просмотр исходного кода

加入查询小区店铺的功能

java110 лет назад: 3
Родитель
Сommit
6a360ee796

+ 62 - 31
java110-bean/src/main/java/com/java110/dto/parkingCouponShop/ParkingCouponShopDto.java

@@ -1,6 +1,7 @@
 package com.java110.dto.parkingCouponShop;
 
 import com.java110.dto.PageDto;
+
 import java.io.Serializable;
 import java.util.Date;
 
@@ -15,16 +16,17 @@ import java.util.Date;
 public class ParkingCouponShopDto extends PageDto implements Serializable {
 
     private String quantity;
-private String paName;
-private String paId;
-private String shopName;
-private String couponShopId;
-private String communityName;
-private String startTime;
-private String shopId;
-private String endTime;
-private String couponId;
-private String communityId;
+    private String paName;
+    private String paId;
+    private String shopName;
+    private String couponShopId;
+    private String communityName;
+    private String startTime;
+    private String shopId;
+    private String[] shopIds;
+    private String endTime;
+    private String couponId;
+    private String communityId;
 
 
     private Date createTime;
@@ -35,67 +37,88 @@ private String communityId;
     public String getQuantity() {
         return quantity;
     }
-public void setQuantity(String quantity) {
+
+    public void setQuantity(String quantity) {
         this.quantity = quantity;
     }
-public String getPaName() {
+
+    public String getPaName() {
         return paName;
     }
-public void setPaName(String paName) {
+
+    public void setPaName(String paName) {
         this.paName = paName;
     }
-public String getPaId() {
+
+    public String getPaId() {
         return paId;
     }
-public void setPaId(String paId) {
+
+    public void setPaId(String paId) {
         this.paId = paId;
     }
-public String getShopName() {
+
+    public String getShopName() {
         return shopName;
     }
-public void setShopName(String shopName) {
+
+    public void setShopName(String shopName) {
         this.shopName = shopName;
     }
-public String getCouponShopId() {
+
+    public String getCouponShopId() {
         return couponShopId;
     }
-public void setCouponShopId(String couponShopId) {
+
+    public void setCouponShopId(String couponShopId) {
         this.couponShopId = couponShopId;
     }
-public String getCommunityName() {
+
+    public String getCommunityName() {
         return communityName;
     }
-public void setCommunityName(String communityName) {
+
+    public void setCommunityName(String communityName) {
         this.communityName = communityName;
     }
-public String getStartTime() {
+
+    public String getStartTime() {
         return startTime;
     }
-public void setStartTime(String startTime) {
+
+    public void setStartTime(String startTime) {
         this.startTime = startTime;
     }
-public String getShopId() {
+
+    public String getShopId() {
         return shopId;
     }
-public void setShopId(String shopId) {
+
+    public void setShopId(String shopId) {
         this.shopId = shopId;
     }
-public String getEndTime() {
+
+    public String getEndTime() {
         return endTime;
     }
-public void setEndTime(String endTime) {
+
+    public void setEndTime(String endTime) {
         this.endTime = endTime;
     }
-public String getCouponId() {
+
+    public String getCouponId() {
         return couponId;
     }
-public void setCouponId(String couponId) {
+
+    public void setCouponId(String couponId) {
         this.couponId = couponId;
     }
-public String getCommunityId() {
+
+    public String getCommunityId() {
         return communityId;
     }
-public void setCommunityId(String communityId) {
+
+    public void setCommunityId(String communityId) {
         this.communityId = communityId;
     }
 
@@ -115,4 +138,12 @@ public void setCommunityId(String communityId) {
     public void setStatusCd(String statusCd) {
         this.statusCd = statusCd;
     }
+
+    public String[] getShopIds() {
+        return shopIds;
+    }
+
+    public void setShopIds(String[] shopIds) {
+        this.shopIds = shopIds;
+    }
 }

+ 10 - 0
java110-bean/src/main/java/com/java110/dto/shopCommunity/ShopCommunityDto.java

@@ -42,6 +42,8 @@ public class ShopCommunityDto extends ShopDto implements Serializable {
 
     private String returnTel;
 
+    private String parkingCouponCount;
+
 
     public String getCommunityName() {
         return communityName;
@@ -187,4 +189,12 @@ public class ShopCommunityDto extends ShopDto implements Serializable {
     public void setReturnTel(String returnTel) {
         this.returnTel = returnTel;
     }
+
+    public String getParkingCouponCount() {
+        return parkingCouponCount;
+    }
+
+    public void setParkingCouponCount(String parkingCouponCount) {
+        this.parkingCouponCount = parkingCouponCount;
+    }
 }

+ 139 - 131
java110-db/src/main/resources/mapper/acct/ParkingCouponShopV1ServiceDaoImplMapper.xml

@@ -5,156 +5,164 @@
 <mapper namespace="parkingCouponShopV1ServiceDaoImpl">
 
 
-
-
-
     <!-- 保存商家停车卷信息 add by wuxw 2018-07-03 -->
     <insert id="saveParkingCouponShopInfo" parameterType="Map">
         insert into parking_coupon_shop(
-quantity,pa_name,pa_id,shop_name,coupon_shop_id,community_name,start_time,shop_id,end_time,coupon_id,community_id
-) values (
-#{quantity},#{paName},#{paId},#{shopName},#{couponShopId},#{communityName},#{startTime},#{shopId},#{endTime},#{couponId},#{communityId}
-)
+        quantity,pa_name,pa_id,shop_name,coupon_shop_id,community_name,start_time,shop_id,end_time,coupon_id,community_id
+        ) values (
+        #{quantity},#{paName},#{paId},#{shopName},#{couponShopId},#{communityName},#{startTime},#{shopId},#{endTime},#{couponId},#{communityId}
+        )
     </insert>
 
 
-
     <!-- 查询商家停车卷信息 add by wuxw 2018-07-03 -->
     <select id="getParkingCouponShopInfo" parameterType="Map" resultType="Map">
-        select  t.quantity,t.pa_name,t.pa_name paName,t.pa_id,t.pa_id paId,t.shop_name,t.shop_name shopName,t.coupon_shop_id,t.coupon_shop_id couponShopId,t.community_name,t.community_name communityName,t.start_time,t.start_time startTime,t.status_cd,t.status_cd statusCd,t.shop_id,t.shop_id shopId,t.end_time,t.end_time endTime,t.coupon_id,t.coupon_id couponId,t.community_id,t.community_id communityId 
-from parking_coupon_shop t 
-where 1 =1 
-<if test="quantity !=null and quantity != ''">
-   and t.quantity= #{quantity}
-</if> 
-<if test="paName !=null and paName != ''">
-   and t.pa_name= #{paName}
-</if> 
-<if test="paId !=null and paId != ''">
-   and t.pa_id= #{paId}
-</if> 
-<if test="shopName !=null and shopName != ''">
-   and t.shop_name= #{shopName}
-</if> 
-<if test="couponShopId !=null and couponShopId != ''">
-   and t.coupon_shop_id= #{couponShopId}
-</if> 
-<if test="communityName !=null and communityName != ''">
-   and t.community_name= #{communityName}
-</if> 
-<if test="startTime !=null and startTime != ''">
-   and t.start_time= #{startTime}
-</if> 
-<if test="statusCd !=null and statusCd != ''">
-   and t.status_cd= #{statusCd}
-</if> 
-<if test="shopId !=null and shopId != ''">
-   and t.shop_id= #{shopId}
-</if> 
-<if test="endTime !=null and endTime != ''">
-   and t.end_time= #{endTime}
-</if> 
-<if test="couponId !=null and couponId != ''">
-   and t.coupon_id= #{couponId}
-</if> 
-<if test="communityId !=null and communityId != ''">
-   and t.community_id= #{communityId}
-</if> 
-order by t.create_time desc
-<if test="page != -1 and page != null ">
-   limit #{page}, #{row}
-</if> 
+        select t.quantity,t.pa_name,t.pa_name paName,t.pa_id,t.pa_id paId,t.shop_name,t.shop_name
+        shopName,t.coupon_shop_id,t.coupon_shop_id couponShopId,t.community_name,t.community_name
+        communityName,t.start_time,t.start_time startTime,t.status_cd,t.status_cd statusCd,t.shop_id,t.shop_id
+        shopId,t.end_time,t.end_time endTime,t.coupon_id,t.coupon_id couponId,t.community_id,t.community_id communityId
+        from parking_coupon_shop t
+        where 1 =1
+        <if test="quantity !=null and quantity != ''">
+            and t.quantity= #{quantity}
+        </if>
+        <if test="paName !=null and paName != ''">
+            and t.pa_name= #{paName}
+        </if>
+        <if test="paId !=null and paId != ''">
+            and t.pa_id= #{paId}
+        </if>
+        <if test="shopName !=null and shopName != ''">
+            and t.shop_name= #{shopName}
+        </if>
+        <if test="couponShopId !=null and couponShopId != ''">
+            and t.coupon_shop_id= #{couponShopId}
+        </if>
+        <if test="communityName !=null and communityName != ''">
+            and t.community_name= #{communityName}
+        </if>
+        <if test="startTime !=null and startTime != ''">
+            and t.start_time= #{startTime}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="shopId !=null and shopId != ''">
+            and t.shop_id= #{shopId}
+        </if>
+        <if test="endTime !=null and endTime != ''">
+            and t.end_time= #{endTime}
+        </if>
+        <if test="couponId !=null and couponId != ''">
+            and t.coupon_id= #{couponId}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        order by t.create_time desc
+        <if test="page != -1 and page != null ">
+            limit #{page}, #{row}
+        </if>
 
     </select>
 
 
-
-
     <!-- 修改商家停车卷信息 add by wuxw 2018-07-03 -->
     <update id="updateParkingCouponShopInfo" parameterType="Map">
-        update  parking_coupon_shop t set t.status_cd = #{statusCd}
-<if test="newBId != null and newBId != ''">
-,t.b_id = #{newBId}
-</if> 
-<if test="quantity !=null and quantity != ''">
-, t.quantity= #{quantity}
-</if> 
-<if test="paName !=null and paName != ''">
-, t.pa_name= #{paName}
-</if> 
-<if test="paId !=null and paId != ''">
-, t.pa_id= #{paId}
-</if> 
-<if test="shopName !=null and shopName != ''">
-, t.shop_name= #{shopName}
-</if> 
-<if test="communityName !=null and communityName != ''">
-, t.community_name= #{communityName}
-</if> 
-<if test="startTime !=null and startTime != ''">
-, t.start_time= #{startTime}
-</if> 
-<if test="shopId !=null and shopId != ''">
-, t.shop_id= #{shopId}
-</if> 
-<if test="endTime !=null and endTime != ''">
-, t.end_time= #{endTime}
-</if> 
-<if test="couponId !=null and couponId != ''">
-, t.coupon_id= #{couponId}
-</if> 
-<if test="communityId !=null and communityId != ''">
-, t.community_id= #{communityId}
-</if> 
- where 1=1 <if test="couponShopId !=null and couponShopId != ''">
-and t.coupon_shop_id= #{couponShopId}
-</if> 
+        update parking_coupon_shop t set t.status_cd = #{statusCd}
+        <if test="newBId != null and newBId != ''">
+            ,t.b_id = #{newBId}
+        </if>
+        <if test="quantity !=null and quantity != ''">
+            , t.quantity= #{quantity}
+        </if>
+        <if test="paName !=null and paName != ''">
+            , t.pa_name= #{paName}
+        </if>
+        <if test="paId !=null and paId != ''">
+            , t.pa_id= #{paId}
+        </if>
+        <if test="shopName !=null and shopName != ''">
+            , t.shop_name= #{shopName}
+        </if>
+        <if test="communityName !=null and communityName != ''">
+            , t.community_name= #{communityName}
+        </if>
+        <if test="startTime !=null and startTime != ''">
+            , t.start_time= #{startTime}
+        </if>
+        <if test="shopId !=null and shopId != ''">
+            , t.shop_id= #{shopId}
+        </if>
+        <if test="endTime !=null and endTime != ''">
+            , t.end_time= #{endTime}
+        </if>
+        <if test="couponId !=null and couponId != ''">
+            , t.coupon_id= #{couponId}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            , t.community_id= #{communityId}
+        </if>
+        where 1=1
+        <if test="couponShopId !=null and couponShopId != ''">
+            and t.coupon_shop_id= #{couponShopId}
+        </if>
 
     </update>
 
     <!-- 查询商家停车卷数量 add by wuxw 2018-07-03 -->
-     <select id="queryParkingCouponShopsCount" parameterType="Map" resultType="Map">
-        select  count(1) count 
-from parking_coupon_shop t 
-where 1 =1 
-<if test="quantity !=null and quantity != ''">
-   and t.quantity= #{quantity}
-</if> 
-<if test="paName !=null and paName != ''">
-   and t.pa_name= #{paName}
-</if> 
-<if test="paId !=null and paId != ''">
-   and t.pa_id= #{paId}
-</if> 
-<if test="shopName !=null and shopName != ''">
-   and t.shop_name= #{shopName}
-</if> 
-<if test="couponShopId !=null and couponShopId != ''">
-   and t.coupon_shop_id= #{couponShopId}
-</if> 
-<if test="communityName !=null and communityName != ''">
-   and t.community_name= #{communityName}
-</if> 
-<if test="startTime !=null and startTime != ''">
-   and t.start_time= #{startTime}
-</if> 
-<if test="statusCd !=null and statusCd != ''">
-   and t.status_cd= #{statusCd}
-</if> 
-<if test="shopId !=null and shopId != ''">
-   and t.shop_id= #{shopId}
-</if> 
-<if test="endTime !=null and endTime != ''">
-   and t.end_time= #{endTime}
-</if> 
-<if test="couponId !=null and couponId != ''">
-   and t.coupon_id= #{couponId}
-</if> 
-<if test="communityId !=null and communityId != ''">
-   and t.community_id= #{communityId}
-</if> 
+    <select id="queryParkingCouponShopsCount" parameterType="Map" resultType="Map">
+        select count(1) count
+        from parking_coupon_shop t
+        where 1 =1
+        <if test="quantity !=null and quantity != ''">
+            and t.quantity= #{quantity}
+        </if>
+        <if test="paName !=null and paName != ''">
+            and t.pa_name= #{paName}
+        </if>
+        <if test="paId !=null and paId != ''">
+            and t.pa_id= #{paId}
+        </if>
+        <if test="shopName !=null and shopName != ''">
+            and t.shop_name= #{shopName}
+        </if>
+        <if test="couponShopId !=null and couponShopId != ''">
+            and t.coupon_shop_id= #{couponShopId}
+        </if>
+        <if test="communityName !=null and communityName != ''">
+            and t.community_name= #{communityName}
+        </if>
+        <if test="startTime !=null and startTime != ''">
+            and t.start_time= #{startTime}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="shopId !=null and shopId != ''">
+            and t.shop_id= #{shopId}
+        </if>
+        <if test="endTime !=null and endTime != ''">
+            and t.end_time= #{endTime}
+        </if>
+        <if test="couponId !=null and couponId != ''">
+            and t.coupon_id= #{couponId}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
 
 
-     </select>
+    </select>
 
+    <select id="queryParkingCouponShopStatistics" parameterType="Map" resultType="Map">
+        select t.shop_id shopId,sum(t.quantity) quantity
+        from parking_coupon_shop t
+        where 1 =1
+        and t.shop_id in
+        <foreach collection="shopIds" item="item" index="index" open="(" close=")" separator=",">
+            #{item}
+        </foreach>
+        group by t.shop_id
+    </select>
 </mapper>

+ 8 - 0
java110-interface/src/main/java/com/java110/intf/acct/IParkingCouponShopV1InnerServiceSMO.java

@@ -65,4 +65,12 @@ public interface IParkingCouponShopV1InnerServiceSMO {
      */
     @RequestMapping(value = "/queryParkingCouponShopsCount", method = RequestMethod.POST)
     int queryParkingCouponShopsCount(@RequestBody ParkingCouponShopDto parkingCouponShopDto);
+
+    /**
+     * 按 商铺id shopId 查询 各个商铺的停车卷数量
+     * @param parkingCouponShopDto
+     * @return
+     */
+    @RequestMapping(value = "/queryParkingCouponShopStatistics", method = RequestMethod.POST)
+    List<ParkingCouponShopDto> queryParkingCouponShopStatistics(@RequestBody ParkingCouponShopDto parkingCouponShopDto);
 }

+ 1 - 0
service-acct/src/main/java/com/java110/acct/dao/IParkingCouponShopV1ServiceDao.java

@@ -74,4 +74,5 @@ public interface IParkingCouponShopV1ServiceDao {
      */
     int queryParkingCouponShopsCount(Map info);
 
+    List<Map>  queryParkingCouponShopStatistics(Map info);
 }

+ 14 - 0
service-acct/src/main/java/com/java110/acct/dao/impl/ParkingCouponShopV1ServiceDaoImpl.java

@@ -108,5 +108,19 @@ public class ParkingCouponShopV1ServiceDaoImpl extends BaseServiceDao implements
         return Integer.parseInt(businessParkingCouponShopInfos.get(0).get("count").toString());
     }
 
+    /**
+     * 根据shopId 统计 店铺 停车卷数量
+     * @param info
+     * @return
+     */
+    @Override
+    public List<Map> queryParkingCouponShopStatistics(Map info) {
+        logger.debug("查询 queryParkingCouponShopStatistics 入参 info : {}",info);
+
+        List<Map> businessParkingCouponShopInfos = sqlSessionTemplate.selectList("parkingCouponShopV1ServiceDaoImpl.queryParkingCouponShopStatistics",info);
+
+        return businessParkingCouponShopInfos;
+    }
+
 
 }

+ 12 - 0
service-acct/src/main/java/com/java110/acct/smo/impl/ParkingCouponShopV1InnerServiceSMOImpl.java

@@ -86,4 +86,16 @@ public class ParkingCouponShopV1InnerServiceSMOImpl extends BaseServiceSMO imple
     public int queryParkingCouponShopsCount(@RequestBody ParkingCouponShopDto parkingCouponShopDto) {
         return parkingCouponShopV1ServiceDaoImpl.queryParkingCouponShopsCount(BeanConvertUtil.beanCovertMap(parkingCouponShopDto));    }
 
+    /**
+     * 按 商铺id shopId 查询 各个商铺的停车卷数量
+     * @param parkingCouponShopDto
+     * @return
+     */
+    @Override
+    public List<ParkingCouponShopDto> queryParkingCouponShopStatistics(@RequestBody ParkingCouponShopDto parkingCouponShopDto) {
+        List<ParkingCouponShopDto> parkingCouponShops = BeanConvertUtil.covertBeanList(parkingCouponShopV1ServiceDaoImpl.queryParkingCouponShopStatistics(BeanConvertUtil.beanCovertMap(parkingCouponShopDto)), ParkingCouponShopDto.class);
+
+        return parkingCouponShops;
+    }
+
 }

+ 42 - 0
service-store/src/main/java/com/java110/store/cmd/store/ListCommunityStoreShopCmd.java

@@ -6,8 +6,10 @@ import com.java110.core.context.ICmdDataFlowContext;
 import com.java110.core.event.cmd.Cmd;
 import com.java110.core.event.cmd.CmdEvent;
 import com.java110.doc.annotation.*;
+import com.java110.dto.parkingCouponShop.ParkingCouponShopDto;
 import com.java110.dto.shopCommunity.ShopCommunityDto;
 import com.java110.dto.storeShopCommunity.StoreShopCommunityDto;
+import com.java110.intf.acct.IParkingCouponShopV1InnerServiceSMO;
 import com.java110.intf.mall.IShopCommunityInnerServiceSMO;
 import com.java110.intf.store.IStoreShopCommunityV1InnerServiceSMO;
 import com.java110.utils.cache.MappingCache;
@@ -58,6 +60,9 @@ public class ListCommunityStoreShopCmd extends Cmd {
     @Autowired
     private IStoreShopCommunityV1InnerServiceSMO storeShopCommunityV1InnerServiceSMOImpl;
 
+    @Autowired
+    private IParkingCouponShopV1InnerServiceSMO parkingCouponShopV1InnerServiceSMOImpl;
+
     @Override
     public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
         super.validatePageInfo(reqJson);
@@ -87,6 +92,10 @@ public class ListCommunityStoreShopCmd extends Cmd {
             }
         }
 
+
+        freshParkingCoupon(storeShopCommunityDtos);
+
+
         ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) reqJson.getInteger("row")), count, storeShopCommunityDtos);
 
         ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
@@ -94,4 +103,37 @@ public class ListCommunityStoreShopCmd extends Cmd {
         context.setResponseEntity(responseEntity);
 
     }
+
+    private void freshParkingCoupon(List<ShopCommunityDto> storeShopCommunityDtos) {
+        /**
+         * 刷入停车卷数
+         */
+        if (storeShopCommunityDtos == null || storeShopCommunityDtos.size() < 1) {
+            return;
+        }
+
+        if (storeShopCommunityDtos.size() > 20) {
+            return;
+        }
+
+        List<String> shopIds = new ArrayList<>();
+
+        for (ShopCommunityDto shopCommunityDto : storeShopCommunityDtos) {
+            shopIds.add(shopCommunityDto.getShopId());
+        }
+
+        ParkingCouponShopDto parkingCouponShopDto = new ParkingCouponShopDto();
+        parkingCouponShopDto.setShopIds(shopIds.toArray(new String[shopIds.size()]));
+        List<ParkingCouponShopDto> parkingCouponShopDtos = parkingCouponShopV1InnerServiceSMOImpl.queryParkingCouponShopStatistics(parkingCouponShopDto);
+
+        for (ShopCommunityDto shopCommunityDto : storeShopCommunityDtos) {
+            for (ParkingCouponShopDto parkingCouponShopDto1 : parkingCouponShopDtos) {
+                if (!parkingCouponShopDto1.getShopId().equals(shopCommunityDto.getShopId())) {
+                    continue;
+                }
+
+                shopCommunityDto.setParkingCouponCount(parkingCouponShopDto1.getQuantity());
+            }
+        }
+    }
 }