| | |
| | | import javax.validation.Valid; |
| | | |
| | | import com.panzhihua.common.model.dtos.community.convenient.PageClassifyMerchantDTO; |
| | | import com.panzhihua.common.model.dtos.community.convenient.PageMerchantProductDTO; |
| | | import com.panzhihua.common.model.dtos.community.convenient.PagePopularMerchantDTO; |
| | | import com.panzhihua.common.model.vos.community.convenient.ConvenientMerchantVO; |
| | | import com.panzhihua.common.model.vos.community.convenient.ConvenientProductVO; |
| | | import com.panzhihua.common.model.vos.community.convenient.ConvenientServiceCategoryVO; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | public R getClassifyMerchants(@RequestBody @Valid PageClassifyMerchantDTO pageClassifyMerchantDTO) { |
| | | return communityService.getClassifyMerchants(pageClassifyMerchantDTO); |
| | | } |
| | | |
| | | @ApiOperation(value = "商家详情", response = ConvenientMerchantVO.class) |
| | | @GetMapping("/merchant/detail") |
| | | public R getMerchantDetail(@RequestParam("merchantId") Long merchantId) { |
| | | return communityService.getMerchantDetail(merchantId); |
| | | } |
| | | |
| | | @ApiOperation(value = "分页获取商家产品", response = ConvenientProductVO.class) |
| | | @PostMapping("/merchant/product") |
| | | public R getMerchantProduct(@RequestBody @Valid PageMerchantProductDTO pageMerchantProductDTO) { |
| | | return communityService.getMerchantProduct(pageMerchantProductDTO); |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.dtos.community.convenient; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.Min; |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | /** |
| | | * @title: PageMerchantProductDTO |
| | | * @projectName: 成都呐喊信息技术有限公司-智慧社区项目 |
| | | * @description: 分页获取商家所属产品信息请求参数 |
| | | * @author: hans |
| | | * @date: 2021/09/22 22:51 |
| | | */ |
| | | @Data |
| | | @ApiModel("分页获取商家所属产品信息请求参数") |
| | | public class PageMerchantProductDTO { |
| | | |
| | | @ApiModelProperty(value = "商家id") |
| | | @NotNull(message = "商家id不能为空") |
| | | @Min(value = 1) |
| | | private Long merchantId; |
| | | |
| | | @ApiModelProperty(value = "分页-当前页数", example = "1") |
| | | @NotNull(message = "分页参数不能为空") |
| | | @Min(value = 1) |
| | | private Long pageNum; |
| | | |
| | | @ApiModelProperty(value = "分页-每页记录数", example = "10") |
| | | @NotNull(message = "分页参数不能为空") |
| | | @Min(value = 1) |
| | | private Long pageSize; |
| | | |
| | | } |
| | |
| | | @ApiModelProperty("所属分类") |
| | | private Long categoryId; |
| | | |
| | | @ApiModelProperty("所属商家") |
| | | private Long merchantId; |
| | | |
| | | @ApiModelProperty("所属分类名称") |
| | | private String categoryName; |
| | | |
| | |
| | | import com.panzhihua.common.model.dtos.community.convenient.PageConvenientProductCategoryDTO; |
| | | import com.panzhihua.common.model.dtos.community.convenient.PageConvenientProductDTO; |
| | | import com.panzhihua.common.model.dtos.community.convenient.PageConvenientServiceCategoryDTO; |
| | | import com.panzhihua.common.model.dtos.community.convenient.PageMerchantProductDTO; |
| | | import com.panzhihua.common.model.dtos.community.convenient.PagePopularMerchantDTO; |
| | | import com.panzhihua.common.model.dtos.community.convenient.ResetPasswordConvenientMerchantDTO; |
| | | import com.panzhihua.common.model.dtos.community.discuss.ComActDiscussDetailDTO; |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/convenient/merchant/classify") |
| | | R getClassifyMerchants(PageClassifyMerchantDTO pageClassifyMerchantDTO); |
| | | R getClassifyMerchants(@RequestBody PageClassifyMerchantDTO pageClassifyMerchantDTO); |
| | | |
| | | /** |
| | | * 获取商家详情 |
| | | * @param merchantId |
| | | * @return |
| | | */ |
| | | @GetMapping("/convenient/merchant/detail") |
| | | R getMerchantDetail(@RequestParam("merchantId") Long merchantId); |
| | | |
| | | /** |
| | | * 获取商家产品 |
| | | * @param pageMerchantProductDTO |
| | | * @return |
| | | */ |
| | | @PostMapping("/convenient/merchant/product") |
| | | R getMerchantProduct(@RequestBody PageMerchantProductDTO pageMerchantProductDTO); |
| | | } |
| | |
| | | import javax.validation.Valid; |
| | | |
| | | import com.panzhihua.common.model.dtos.community.convenient.PageClassifyMerchantDTO; |
| | | import com.panzhihua.common.model.dtos.community.convenient.PageMerchantProductDTO; |
| | | import com.panzhihua.common.model.dtos.community.convenient.PagePopularMerchantDTO; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/merchant/classify") |
| | | public R getClassifyMerchants(PageClassifyMerchantDTO pageClassifyMerchantDTO) { |
| | | public R getClassifyMerchants(@RequestBody PageClassifyMerchantDTO pageClassifyMerchantDTO) { |
| | | return convenientMerchantService.getClassifyMerchants(pageClassifyMerchantDTO); |
| | | } |
| | | |
| | | /** |
| | | * 小程序获取商家详情 |
| | | * @param merchantId |
| | | * @return |
| | | */ |
| | | @GetMapping("/merchant/detail") |
| | | public R getMerchantDetail(@RequestParam("merchantId") Long merchantId) { |
| | | return convenientMerchantService.getMerchantDetail(merchantId); |
| | | } |
| | | |
| | | /** |
| | | * 小程序获取商家产品 |
| | | * @param pageMerchantProductDTO |
| | | * @return |
| | | */ |
| | | @PostMapping("/merchant/product") |
| | | public R getMerchantProduct(@RequestBody PageMerchantProductDTO pageMerchantProductDTO) { |
| | | return convenientProductService.getMerchantProduct(pageMerchantProductDTO); |
| | | } |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | IPage<ConvenientMerchantVO> getClassifyMerchants(@Param("page") Page page, @Param("pageClassifyMerchantDTO") PageClassifyMerchantDTO pageClassifyMerchantDTO, @Param("currentMon") String currentMon); |
| | | |
| | | /** |
| | | * 获取商家详情 |
| | | * @param merchantId |
| | | * @param currentMon |
| | | * @return |
| | | */ |
| | | ConvenientMerchantVO getMerchantDetail(@Param("merchantId") Long merchantId, @Param("currentMon") String currentMon); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.panzhihua.common.model.dtos.community.convenient.PageConvenientProductDTO; |
| | | import com.panzhihua.common.model.dtos.community.convenient.PageMerchantProductDTO; |
| | | import com.panzhihua.common.model.vos.community.convenient.ConvenientProductVO; |
| | | import com.panzhihua.service_community.model.dos.ConvenientProductDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | |
| | | * @return |
| | | */ |
| | | int batchOnShelfOrOffShelfByIds(@Param("needDealIds") List<Long> needDealIds, @Param("updatedBy") Long updatedBy, @Param("saleStatus") boolean saleStatus); |
| | | |
| | | /** |
| | | * 小程序获取商家产品 |
| | | * @param page |
| | | * @param pageMerchantProductDTO |
| | | * @return |
| | | */ |
| | | IPage<ConvenientProductVO> getMerchantProduct(@Param("page") Page page, @Param("pageMerchantProductDTO") PageMerchantProductDTO pageMerchantProductDTO); |
| | | } |
| | |
| | | */ |
| | | private Long categoryId; |
| | | /** |
| | | * 产品所属商家 |
| | | */ |
| | | private Long merchantId; |
| | | /** |
| | | * 是否上架 |
| | | */ |
| | | private Boolean onShelf; |
| | |
| | | * @return |
| | | */ |
| | | R getClassifyMerchants(PageClassifyMerchantDTO pageClassifyMerchantDTO); |
| | | |
| | | /** |
| | | * 小程序获取商家详情 |
| | | * @param merchantId |
| | | * @return |
| | | */ |
| | | R getMerchantDetail(Long merchantId); |
| | | } |
| | |
| | | import com.panzhihua.common.model.dtos.community.convenient.DeleteConvenientProductDTO; |
| | | import com.panzhihua.common.model.dtos.community.convenient.OnShelfOrOffShelfProductDTO; |
| | | import com.panzhihua.common.model.dtos.community.convenient.PageConvenientProductDTO; |
| | | import com.panzhihua.common.model.dtos.community.convenient.PageMerchantProductDTO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.service_community.model.dos.ConvenientProductDO; |
| | | |
| | |
| | | * @return |
| | | */ |
| | | R onShelfOrOffShelfProduct(OnShelfOrOffShelfProductDTO onShelfOrOffShelfProductDTO); |
| | | |
| | | /** |
| | | * 小程序获取商家产品 |
| | | * @param pageMerchantProductDTO |
| | | * @return |
| | | */ |
| | | R getMerchantProduct(PageMerchantProductDTO pageMerchantProductDTO); |
| | | } |
| | |
| | | package com.panzhihua.service_community.service.impl; |
| | | |
| | | import static java.util.Objects.isNull; |
| | | import static java.util.Objects.nonNull; |
| | | import static org.apache.commons.lang3.StringUtils.isNotBlank; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | |
| | | import com.panzhihua.service_community.model.dos.ConvenientMerchantDO; |
| | | import com.panzhihua.service_community.model.dos.ConvenientServiceCategoryDO; |
| | | import com.panzhihua.service_community.service.ConvenientMerchantService; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import static java.util.Objects.isNull; |
| | | import static java.util.Objects.nonNull; |
| | | import static org.apache.commons.lang3.StringUtils.isNotBlank; |
| | | |
| | | /** |
| | | * @title: ConvenientMerchantServiceImpl |
| | |
| | | IPage<ConvenientMerchantVO> merchantVOList = this.baseMapper.getClassifyMerchants(page, pageClassifyMerchantDTO, currentMon); |
| | | return R.ok(merchantVOList); |
| | | } |
| | | |
| | | /** |
| | | * 小程序获取商家详情 |
| | | * @param merchantId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R getMerchantDetail(Long merchantId) { |
| | | Date nowDate = new Date(); |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM"); |
| | | String currentMon = simpleDateFormat.format(nowDate).concat("%"); |
| | | return R.ok(this.baseMapper.getMerchantDetail(merchantId, currentMon)); |
| | | } |
| | | } |
| | |
| | | import com.panzhihua.common.model.dtos.community.convenient.DeleteConvenientProductDTO; |
| | | import com.panzhihua.common.model.dtos.community.convenient.OnShelfOrOffShelfProductDTO; |
| | | import com.panzhihua.common.model.dtos.community.convenient.PageConvenientProductDTO; |
| | | import com.panzhihua.common.model.dtos.community.convenient.PageMerchantProductDTO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.convenient.ConvenientProductSpecificationVO; |
| | | import com.panzhihua.common.model.vos.community.convenient.ConvenientProductVO; |
| | |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 小程序获取商家产品 |
| | | * @param pageMerchantProductDTO |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R getMerchantProduct(PageMerchantProductDTO pageMerchantProductDTO) { |
| | | Page page = new Page<>(); |
| | | page.setSize(pageMerchantProductDTO.getPageSize()); |
| | | page.setCurrent(pageMerchantProductDTO.getPageNum()); |
| | | IPage<ConvenientProductVO> productVOIPage = this.baseMapper.getMerchantProduct(page, pageMerchantProductDTO); |
| | | return null; |
| | | } |
| | | } |
| | |
| | | WHERE ccm.community_id = #{pageClassifyMerchantDTO.communityId} AND ccss.service_category_id = #{pageClassifyMerchantDTO.serviceId} AND cccs.statistic_date LIKE #{currentMon} 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 |
| | | FROM ( |
| | | SELECT |
| | | ccm.id, ccm.name, ccm.introduction, ccm.logo, ccm.phone, ccm.begin_at, ccm.end_at, ccm.period, |
| | | ccm.address, ccm.lat, ccm.lon, 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_service_scope ccss ON ccm.id = ccss.merchant_id |
| | | WHERE ccm.id = #{merchantId} AND cccs.statistic_date LIKE #{currentMon} GROUP BY cccs.id |
| | | ) temp GROUP BY temp.id ORDER BY SUM(temp.consultation_volume) DESC |
| | | </select> |
| | | <update id="deleteMerchantById"> |
| | | UPDATE com_convenient_merchants SET is_del = 1, updated_by = #{operator} WHERE id = #{merchantId} |
| | | </update> |
| | |
| | | <id column="id" property="id" /> |
| | | <id column="name" property="name" /> |
| | | <id column="category_id" property="categoryId" /> |
| | | <id column="merchant_id" property="merchantId" /> |
| | | <id column="on_shelf" property="onShelf" /> |
| | | <id column="introduction" property="introduction" /> |
| | | <id column="is_del" property="isDel" /> |
| | |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id,`name`,category_id,on_shelf,introduction,is_del,view_num,created_at,created_by,updated_at,updated_by |
| | | id,`name`,category_id,merchant_id,on_shelf,introduction,is_del,view_num,created_at,created_by,updated_at,updated_by |
| | | </sql> |
| | | <update id="batchDeleteByIds"> |
| | | UPDATE com_convenient_products SET is_del = 1 WHERE id IN |
| | |
| | | AND ccp.on_shelf = #{pageConvenientProductDTO.onShelf} |
| | | </if> |
| | | </select> |
| | | <select id="getMerchantProduct" resultType="com.panzhihua.common.model.vos.community.convenient.ConvenientProductVO"> |
| | | SELECT ccp.id, ccp.name, ccp. |
| | | FROM com_convenient_products ccp |
| | | LEFT JOIN com_convenient_product_specifications ccps ON ccp.id = ccps.product_id |
| | | WHERE ccp.merchant_id = #{pageMerchantProductDTO.merchantId} |
| | | </select> |
| | | </mapper> |