springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/convenient/ConvenientMerchantDTO.java
@@ -121,4 +121,12 @@ public void setPeriod(MerchantBusinessPeriod period) { this.period = period; } public Boolean getBusinessStatus() { return businessStatus.intValue() == 1; } public void setBusinessStatus(Boolean businessStatus) { this.businessStatus = businessStatus ? 1 : 0; } } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/convenient/ConvenientProductDTO.java
@@ -55,4 +55,12 @@ @ApiModelProperty(value = "所属商家", hidden = true) private Long merchantId; public Boolean getOnShelf() { return onShelf.intValue() == 1; } public void setOnShelf(Boolean onShelf) { this.onShelf = onShelf ? 1 : 0; } } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/convenient/PageSearchDTO.java
@@ -32,4 +32,9 @@ @NotNull(message = "分页参数不能为空") @Min(value = 1) private Long pageSize; @ApiModelProperty(value = "社区id") @NotNull(message = "社区id不能为空") @Min(value = 1) private Long communityId; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/convenient/ExportMerchantVO.java
@@ -14,6 +14,8 @@ @Data public class ExportMerchantVO { private Long id; @ExcelProperty("商家名称") private String name; springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ConvenientMerchantDAO.java
@@ -88,11 +88,11 @@ IPage<ConvenientMerchantVO> pageSearchMerchant(@Param("page") Page page, @Param("pageSearchDTO") PageSearchDTO pageSearchDTO, @Param("currentMon") String currentMon); /** * 获取商家导出数据 * 根据查询条件获取商家导出数据 * @param exportMerchantDTO * @return */ List<ExportMerchantVO> exportMerchant(@Param("exportMerchantDTO") ExportMerchantDTO exportMerchantDTO); List<ExportMerchantVO> exportMerchantBySearch(@Param("exportMerchantDTO") ExportMerchantDTO exportMerchantDTO); /** * 批量更新商家咨询量 @@ -107,4 +107,11 @@ * @return */ int batchUpdateMerchantViewNum(@Param("viewVOList") List<ConvenientViewStatisticsVO> viewVOList); /** * 根据指定id获取商家导出数据 * @param needExportIds * @return */ List<ExportMerchantVO> exportMerchantByIds(@Param("needExportIds") List<Long> needExportIds); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ConvenientMerchantDO.java
@@ -96,6 +96,10 @@ */ private Integer consultationVolume; /** * 浏览量 */ private Integer viewNum; /** * 是否删除 */ private Boolean isDel; springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ConvenientMerchantServiceImpl.java
@@ -11,6 +11,7 @@ import javax.annotation.Resource; import com.panzhihua.common.model.vos.community.convenient.ExportMerchantVO; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -159,6 +160,15 @@ page.setSize(pageConvenientMerchantDTO.getPageSize()); page.setCurrent(pageConvenientMerchantDTO.getPageNum()); IPage<ConvenientMerchantVO> iPage = this.baseMapper.pageMerchant(page, pageConvenientMerchantDTO); if (nonNull(pageConvenientMerchantDTO.getServiceId())) { List<ConvenientMerchantVO> records = iPage.getRecords(); if (!records.isEmpty()) { records.forEach(record -> { String serviceScope = convenientServiceCategoryDAO.selectServiceScopeByMerchantId(record.getId()); record.setServiceScope(serviceScope); }); } } return R.ok(iPage); } @@ -261,6 +271,13 @@ page.setSize(pageClassifyMerchantDTO.getPageSize()); page.setCurrent(pageClassifyMerchantDTO.getPageNum()); IPage<ConvenientMerchantVO> merchantVOList = this.baseMapper.getClassifyMerchants(page, pageClassifyMerchantDTO, currentMon); List<ConvenientMerchantVO> records = merchantVOList.getRecords(); if (!records.isEmpty()) { records.forEach(record -> { String serviceScope = convenientServiceCategoryDAO.selectServiceScopeByMerchantId(record.getId()); record.setServiceScope(serviceScope); }); } return R.ok(merchantVOList); } @@ -313,6 +330,10 @@ @Override public R consultMerchant(Long merchantId) { ConvenientMerchantDO merchantDO = this.baseMapper.selectById(merchantId); if (isNull(merchantDO)) { return R.fail("商家不存在"); } SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); String nowDate = simpleDateFormat.format(new Date()); ConvenientConsultationStatisticsDO statisticsDO = convenientConsultationStatisticsDAO.selectOne(new LambdaQueryWrapper<ConvenientConsultationStatisticsDO>() @@ -327,6 +348,10 @@ @Override public R incrMerchantView(Long merchantId) { ConvenientMerchantDO merchantDO = this.baseMapper.selectById(merchantId); if (isNull(merchantDO)) { return R.fail("商家不存在"); } SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); String nowDate = simpleDateFormat.format(new Date()); ConvenientViewStatisticsDO statisticsDO = convenientViewStatisticsDAO.selectOne(new LambdaQueryWrapper<ConvenientViewStatisticsDO>() @@ -341,7 +366,19 @@ @Override public R exportMerchant(ExportMerchantDTO exportMerchantDTO) { return R.ok(this.baseMapper.exportMerchant(exportMerchantDTO)); List<Long> needExportIds = exportMerchantDTO.getIds(); if (nonNull(needExportIds) && !needExportIds.isEmpty()) { //根据id导出 return R.ok(this.baseMapper.exportMerchantByIds(needExportIds)); } List<ExportMerchantVO> exportMerchantVOList = this.baseMapper.exportMerchantBySearch(exportMerchantDTO); if (nonNull(exportMerchantDTO.getServiceId()) && !exportMerchantVOList.isEmpty()) { exportMerchantVOList.forEach(merchant -> { String serviceScope = convenientServiceCategoryDAO.selectServiceScopeByMerchantId(merchant.getId()); merchant.setServiceScope(serviceScope); }); } return R.ok(exportMerchantVOList); } /** springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ConvenientConsultationStatisticsMapper.xml
@@ -22,12 +22,14 @@ WHERE merchant_id = #{merchantId} AND statistic_date = #{nowDate} </update> <select id="selectMonthConsultationVolume" resultType="java.lang.Integer"> SELECT SUM(consultation_volume) FROM com_convenient_consultation_statistics WHERE merchant_id = #{merchantId} AND statistic_date LIKE CONCAT(#{moth}, '%') SELECT IF(SUM(consultation_volume) IS NULL,0,SUM(consultation_volume)) FROM com_convenient_consultation_statistics WHERE merchant_id = #{merchantId} AND (statistic_date LIKE CONCAT(#{moth}, '%') OR statistic_date IS NULL) </select> <select id="selectDayConsultationVolume" resultType="java.lang.Integer"> SELECT consultation_volume FROM com_convenient_consultation_statistics WHERE merchant_id = #{merchantId} AND statistic_date = #{day} SELECT IF(SUM(consultation_volume) IS NULL,0,SUM(consultation_volume)) FROM com_convenient_consultation_statistics WHERE merchant_id = #{merchantId} AND (statistic_date = #{day} OR statistic_date IS NULL) </select> <select id="selectSumForConsultationNum" resultType="com.panzhihua.common.model.vos.community.convenient.ConvenientConsultationStatisticsVO"> SELECT merchant_id, SUM(consultation_volume) AS totalConsultationNum springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ConvenientMerchantMapper.xml
@@ -22,6 +22,7 @@ <id column="business_status" property="businessStatus" /> <id column="user_id" property="userId" /> <id column="consultation_volume" property="consultationVolume" /> <id column="view_num" property="viewNum" /> <id column="is_del" property="isDel" /> <id column="created_at" property="createdAt" /> <id column="created_by" property="createdBy" /> @@ -54,8 +55,8 @@ </if> <if test="pageConvenientMerchantDTO.keyword != null and pageConvenientMerchantDTO.keyword != """> AND ccm.name LIKE CONCAT('%', #{pageConvenientMerchantDTO.keyword}, '%') OR ccm.address LIKE CONCAT('%', #{pageConvenientMerchantDTO.keyword}, '%') OR ccm.phone LIKE CONCAT('%', #{pageConvenientMerchantDTO.keyword}, '%') AND ccm.address LIKE CONCAT('%', #{pageConvenientMerchantDTO.keyword}, '%') AND ccm.phone LIKE CONCAT('%', #{pageConvenientMerchantDTO.keyword}, '%') </if> GROUP BY ccm.id </select> @@ -68,35 +69,35 @@ <select id="getPopularMerchants" resultType="com.panzhihua.common.model.vos.community.convenient.ConvenientMerchantVO"> SELECT temp.id, temp.name, temp.introduction, temp.logo, temp.serviceScope, SUM(temp.consultation_volume) as monthConsultationVolume temp.serviceScope, IF(SUM(temp.consultation_volume) is null, 0, SUM(temp.consultation_volume)) as monthConsultationVolume FROM ( SELECT ccm.id, ccm.name, ccm.introduction, ccm.logo, cccs.consultation_volume,GROUP_CONCAT(ccss.service_name) AS serviceScope FROM com_convenient_merchants ccm INNER JOIN com_convenient_consultation_statistics cccs ON ccm.id = cccs.merchant_id LEFT JOIN com_convenient_consultation_statistics cccs ON ccm.id = cccs.merchant_id LEFT JOIN com_convenient_service_scope ccss ON ccm.id = ccss.merchant_id WHERE ccm.community_id = #{communityId} AND cccs.statistic_date LIKE #{currentMon} GROUP BY cccs.id WHERE ccm.community_id = #{communityId} AND (cccs.statistic_date LIKE #{currentMon} OR cccs.statistic_date IS NULL) GROUP BY cccs.id ) temp GROUP BY temp.id ORDER BY SUM(temp.consultation_volume) DESC </select> <select id="getClassifyMerchants" resultType="com.panzhihua.common.model.vos.community.convenient.ConvenientMerchantVO"> SELECT temp.id, temp.name, temp.introduction, temp.logo, temp.serviceScope, SUM(temp.consultation_volume) as monthConsultationVolume IF(SUM(temp.consultation_volume) is null,0,SUM(temp.consultation_volume)) as monthConsultationVolume FROM ( SELECT ccm.id, ccm.name, ccm.introduction, ccm.logo, cccs.consultation_volume,GROUP_CONCAT(ccss.service_name) AS serviceScope ccm.id, ccm.name, ccm.introduction, ccm.logo, cccs.consultation_volume FROM com_convenient_merchants ccm INNER JOIN com_convenient_consultation_statistics cccs ON ccm.id = cccs.merchant_id LEFT JOIN com_convenient_consultation_statistics cccs ON ccm.id = cccs.merchant_id LEFT JOIN com_convenient_service_scope ccss ON ccm.id = ccss.merchant_id WHERE ccm.community_id = #{pageClassifyMerchantDTO.communityId} AND ccss.service_category_id = #{pageClassifyMerchantDTO.serviceId} AND cccs.statistic_date LIKE #{currentMon} GROUP BY cccs.id WHERE ccm.community_id = #{pageClassifyMerchantDTO.communityId} AND ccss.service_category_id = #{pageClassifyMerchantDTO.serviceId} AND (cccs.statistic_date LIKE #{currentMon} OR cccs.statistic_date IS NULL) GROUP BY cccs.id ) temp GROUP BY temp.id ORDER BY SUM(temp.consultation_volume) DESC </select> <select id="getMerchantDetail" resultType="com.panzhihua.common.model.vos.community.convenient.ConvenientMerchantVO"> SELECT temp.id, temp.name, temp.introduction, temp.logo, temp.phone, temp.begin_at, temp.end_at, temp.period, temp.address, temp.lat, temp.lon, temp.serviceScope, SUM(temp.consultation_volume) as monthConsultationVolume temp.address, temp.lat, temp.lon, temp.serviceScope, IF(SUM(temp.consultation_volume) is null,0,SUM(temp.consultation_volume)) as monthConsultationVolume FROM ( SELECT ccm.id, ccm.name, ccm.introduction, ccm.logo, ccm.phone, ccm.begin_at, ccm.end_at, ccm.period, @@ -104,13 +105,13 @@ FROM com_convenient_merchants ccm INNER JOIN com_convenient_consultation_statistics cccs ON ccm.id = cccs.merchant_id LEFT JOIN com_convenient_service_scope ccss ON ccm.id = ccss.merchant_id WHERE ccm.id = #{merchantId} AND cccs.statistic_date LIKE #{currentMon} GROUP BY cccs.id WHERE ccm.id = #{merchantId} AND (cccs.statistic_date LIKE #{currentMon} OR cccs.statistic_date IS NULL) GROUP BY cccs.id ) temp GROUP BY temp.id ORDER BY SUM(temp.consultation_volume) DESC </select> <select id="pageSearchMerchant" resultType="com.panzhihua.common.model.vos.community.convenient.ConvenientMerchantVO"> SELECT temp.id, temp.name, temp.introduction, temp.logo, temp.serviceScope, SUM(temp.consultation_volume) as monthConsultationVolume temp.serviceScope, IF(SUM(temp.consultation_volume) is null,0,SUM(temp.consultation_volume)) as monthConsultationVolume FROM ( SELECT ccm.id, ccm.name, ccm.introduction, ccm.logo, @@ -118,10 +119,11 @@ FROM com_convenient_merchants ccm INNER JOIN com_convenient_consultation_statistics cccs ON ccm.id = cccs.merchant_id LEFT JOIN com_convenient_service_scope ccss ON ccm.id = ccss.merchant_id WHERE ccm.`name` LIKE CONCAT('%', #{pageSearchDTO.keyword}, '%') AND ccm.is_del = 0 AND cccs.statistic_date LIKE #{currentMon} GROUP BY cccs.id WHERE ccm.community_id = #{pageSearchDTO.communityId} AND ccm.`name` LIKE CONCAT('%', #{pageSearchDTO.keyword}, '%') AND ccm.is_del = 0 AND (cccs.statistic_date LIKE #{currentMon} OR cccs.statistic_date IS NULL) GROUP BY cccs.id ) temp GROUP BY temp.id ORDER BY SUM(temp.consultation_volume) DESC </select> <select id="exportMerchant" resultType="com.panzhihua.common.model.vos.community.convenient.ExportMerchantVO"> <select id="exportMerchantBySearch" resultType="com.panzhihua.common.model.vos.community.convenient.ExportMerchantVO"> SELECT ccm.*, su.account, su.status AS accountStatus, GROUP_CONCAT(ccss.service_name) AS serviceScope, CONCAT(ccm.period,DATE_FORMAT(ccm.begin_at,'%T'),'~',DATE_FORMAT(ccm.end_at,'%T')) AS businessTime FROM com_convenient_merchants ccm @@ -139,11 +141,23 @@ </if> <if test="exportMerchantDTO.keyword != null and exportMerchantDTO.keyword != """> AND ccm.name LIKE CONCAT('%', #{exportMerchantDTO.keyword}, '%') OR ccm.address LIKE CONCAT('%', #{exportMerchantDTO.keyword}, '%') OR ccm.phone LIKE CONCAT('%', #{exportMerchantDTO.keyword}, '%') AND ccm.address LIKE CONCAT('%', #{exportMerchantDTO.keyword}, '%') AND ccm.phone LIKE CONCAT('%', #{exportMerchantDTO.keyword}, '%') </if> GROUP BY ccm.id </select> <select id="exportMerchantByIds" resultType="com.panzhihua.common.model.vos.community.convenient.ExportMerchantVO"> SELECT ccm.*, su.account, su.status AS accountStatus, GROUP_CONCAT(ccss.service_name) AS serviceScope, CONCAT(ccm.period,DATE_FORMAT(ccm.begin_at,'%T'),'~',DATE_FORMAT(ccm.end_at,'%T')) AS businessTime FROM com_convenient_merchants ccm LEFT JOIN sys_user su ON ccm.user_id = su.user_id LEFT JOIN com_convenient_service_scope ccss ON ccm.id = ccss.merchant_id WHERE ccm.id IN <foreach collection="needExportIds" open="(" separator="," close=")" index="index" item="item"> #{item} </foreach> GROUP BY ccm.id </select> <update id="deleteMerchantById"> UPDATE com_convenient_merchants SET is_del = 1, updated_by = #{operator} WHERE id = #{merchantId} </update> springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ConvenientProductMapper.xml
@@ -53,7 +53,7 @@ </if> </select> <select id="getMerchantProduct" resultType="com.panzhihua.common.model.vos.community.convenient.ConvenientProductVO"> SELECT ccp.id, ccp.name, ccp.category_id, ccp.on_shelf_at, ccpc.name AS categoryName SELECT ccp.id, ccp.name, ccp.category_id, ccp.on_shelf_at, ccp.introduction, ccpc.name AS categoryName FROM com_convenient_products ccp LEFT JOIN com_convenient_product_categories ccpc ON ccp.category_id = ccpc.id INNER JOIN com_convenient_product_specifications ccps ON ccp.id = ccps.product_id @@ -68,7 +68,9 @@ WHERE ccp.merchant_id = #{merchantId} AND ccp.is_del = 0 AND ccp.on_shelf = 1 AND ccps.is_del = 0 </select> <select id="pageSearchProduct" resultType="com.panzhihua.common.model.vos.community.convenient.ConvenientProductVO"> SELECT id,`name`,category_id,merchant_id,introduction FROM com_convenient_products WHERE `name` LIKE CONCAT('%', #{pageSearchDTO.keyword}, '%') SELECT ccp.id,ccp.`name`,ccp.category_id,ccp.merchant_id,ccp.introduction FROM com_convenient_products ccp LEFT JOIN com_convenient_merchants ccm ON ccp.merchant_id = ccm.id WHERE ccm.community_id = #{pageSearchDTO.communityId} AND ccp.`name` LIKE CONCAT('%', #{pageSearchDTO.keyword}, '%') </select> </mapper> springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ConvenientViewStatisticsMapper.xml
@@ -22,12 +22,14 @@ WHERE merchant_id = #{merchantId} AND statistic_date = #{nowDate} </update> <select id="selectMonthViewNum" resultType="java.lang.Integer"> SELECT SUM(view_num) FROM com_convenient_view_statistics WHERE merchant_id = #{merchantId} AND statistic_date LIKE CONCAT(#{moth}, '%') SELECT IF(SUM(view_num) IS NULL,0,SUM(view_num)) FROM com_convenient_view_statistics WHERE merchant_id = #{merchantId} AND (statistic_date LIKE CONCAT(#{moth}, '%') OR statistic_date IS NULL) </select> <select id="selectDayViewNum" resultType="java.lang.Integer"> SELECT view_num FROM com_convenient_view_statistics WHERE merchant_id = #{merchantId} AND statistic_date = #{day} SELECT IF(SUM(view_num) IS NULL,0,SUM(view_num)) FROM com_convenient_view_statistics WHERE merchant_id = #{merchantId} AND (statistic_date = #{day} OR statistic_date IS NULL) </select> <select id="selectSumForViewNum" resultType="com.panzhihua.common.model.vos.community.convenient.ConvenientViewStatisticsVO"> SELECT merchant_id, SUM(view_num) AS totalViewNum springcloud_k8s_panzhihuazhihuishequ/zuul/src/main/java/com/panzhihua/zuul/filters/JWTAuthenticationTokenFilter.java
@@ -249,6 +249,17 @@ noLoginUrl.add("/api/applets/community/volunteer"); noLoginUrl.add("/api/applets/discuss/increase-view-num"); noLoginUrl.add("/api/applets/community/evaluate/page"); noLoginUrl.add("/api/applets/convenient/service-category/suitable"); noLoginUrl.add("/api/applets/convenient/merchant/popular"); noLoginUrl.add("/api/applets/convenient/merchant/classify"); noLoginUrl.add("/api/applets/convenient/merchant/detail"); noLoginUrl.add("/api/applets/convenient/product/list"); noLoginUrl.add("/api/applets/convenient/product/detail"); noLoginUrl.add("/api/applets/convenient/merchant/search"); noLoginUrl.add("/api/applets/convenient/product/search"); noLoginUrl.add("/api/applets/convenient/merchant/incr-consult"); noLoginUrl.add("/api/applets/convenient/merchant/incr-view"); noLoginUrl.add("/api/applets/convenient/product/incr-view"); if (noLoginUrl.contains(requestURI)) { List<SimpleGrantedAuthority> authorities = new ArrayList<>(); authorities.add(new SimpleGrantedAuthority(SecurityConstants.ROLE_APPLETS));