| @@ -56,8 +56,6 @@ public interface WxMerchantMapper extends CommonMapper<WxMerchant, Long> { | |||
| WxMerchant getMerchantByEncode(@Param("encode")String encode); | |||
| List<WxMerchant> findFollowList(WxMerchant record); | |||
| int recordedAmount(WxMerchant record); | |||
| List<Map<String, Object>> findMerchantByShop(@Param("shopId")Long shopId); | |||
| @@ -166,12 +166,6 @@ public interface WxMerchantService { | |||
| List<Long> getMerchantShopIds(Long merchantId); | |||
| void followMerchant(TenantEntity tenantEntity, Long memberId, Long id); | |||
| void cancelFollow(Long memberId, Long id); | |||
| int getfollow(Long memberId, Long id); | |||
| PageInfo<WxMerchant> followListAsPage(WxMerchant record, Integer pageNum, Integer pageSize); | |||
| ResultData damark(WxMerchant wxMerchant, TenantEntity tenantInfo); | |||
| ResultData downmark(WxMerchant wxMerchant); | |||
| @@ -1077,43 +1077,6 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| return wxMerchantShopMapper.findShopIds(merchantIds); | |||
| } | |||
| @Override | |||
| public void followMerchant(TenantEntity tenantEntity, Long memberId, Long id) { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| TtUserFollow userFollow = new TtUserFollow(); | |||
| userFollow.setId(idWorker.nextId()); | |||
| userFollow.updateTenantInfo(tenantEntity); | |||
| userFollow.setUserId(memberId); | |||
| userFollow.setMerchernId(id); | |||
| userFollow.setCreateDate(new Date()); | |||
| userFollow.setUpdateDate(new Date()); | |||
| try { | |||
| ttUserFollowMapper.insert(userFollow); | |||
| } catch (Exception e) { | |||
| // e.printStackTrace(); | |||
| } | |||
| } | |||
| @Override | |||
| public void cancelFollow(Long memberId, Long id) { | |||
| TtUserFollow userFollow = new TtUserFollow(); | |||
| userFollow.setUserId(memberId); | |||
| userFollow.setMerchernId(id); | |||
| int delete = ttUserFollowMapper.delete(new QueryWrapper<>(userFollow)); | |||
| } | |||
| @Override | |||
| public int getfollow(Long memberId, Long id) { | |||
| TtUserFollow userFollow = new TtUserFollow(); | |||
| userFollow.setUserId(memberId); | |||
| userFollow.setMerchernId(id); | |||
| return ttUserFollowMapper.selectCount(new QueryWrapper<>(userFollow)); | |||
| } | |||
| @Override | |||
| public PageInfo<WxMerchant> followListAsPage(WxMerchant record, Integer pageNum, Integer pageSize) { | |||
| return PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxMerchantMapper.findFollowList(record)); | |||
| } | |||
| @Override | |||
| public ResultData damark(WxMerchant wxMerchant, TenantEntity tenantInfo) { | |||
| @@ -215,29 +215,6 @@ | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <select id="findFollowList" parameterType="com.iformall.domain.po.WxMerchant" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| form tt_user_follow uf | |||
| left join wx_merchant m on uf.merchern_id = m.id | |||
| where uf.is_del = 0 and uf.user_id = ${cUserId} | |||
| and m.is_del = 0 | |||
| <if test=" null != status "> | |||
| and m.`status` = #{status} | |||
| </if> | |||
| <if test=" null != isPublic "> | |||
| and m.`is_public` = #{isPublic} | |||
| </if> | |||
| <if test=" null != name and ''!=name "> | |||
| and m.`name` like concat('%', #{name},'%') | |||
| </if> | |||
| <if test=" null != businessTypes "> | |||
| and JSON_CONTAINS(m.business_types,JSON_OBJECT('id', #{businessTypes})) | |||
| </if> | |||
| order by uf.create_date desc | |||
| </select> | |||
| <select id="findListVo" parameterType="com.iformall.domain.po.WxMerchant" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumnsVo"/> | |||
| @@ -75,89 +75,4 @@ public class WxMerchantController extends BaseController { | |||
| return new ResultData(wxMerchant); | |||
| } | |||
| @ApiOperation("是否关注") | |||
| @GetMapping("/isfollow") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData isfollow(@RequestParam Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::isfollow"); | |||
| if (id == null) { | |||
| return new ResultData(ResultData.ERROR, "缺少id"); | |||
| } | |||
| Long memberId; | |||
| try { | |||
| memberId = getMemberId(); | |||
| } catch (MallinkException e) { | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| } | |||
| int count = wxMerchantService.getfollow(memberId,id); | |||
| if(count > 0){ | |||
| return new ResultData(true); | |||
| }else{ | |||
| return new ResultData(false); | |||
| } | |||
| } | |||
| @ApiOperation("关注") | |||
| @GetMapping("/followMerchant") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData followMerchant(@RequestParam Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::followMerchant"); | |||
| if (id == null) { | |||
| return new ResultData(ResultData.ERROR, "缺少id"); | |||
| } | |||
| WxMerchant byId = wxMerchantService.getById(id); | |||
| if(byId == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,"找不到数据"); | |||
| } | |||
| Long memberId; | |||
| try { | |||
| memberId = getMemberId(); | |||
| } catch (MallinkException e) { | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| } | |||
| wxMerchantService.followMerchant(byId,memberId,byId.getId()); | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("分页关注列表接口") | |||
| @GetMapping("collectList") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData followList(@ModelAttribute WxMerchant record, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::followList"); | |||
| if (record == null) record = new WxMerchant(); | |||
| record.updateTenantInfo(getParentTenantInfo()); | |||
| Long memberId; | |||
| try { | |||
| memberId = getMemberId(); | |||
| } catch (MallinkException e) { | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| } | |||
| record.setCUserId(memberId); | |||
| record.setStatus(EnumMerchantStatus.VALID.getCode()); | |||
| record.setIsPublic(EnumMerchantPublic.PUBLIC.getCode()); | |||
| return new ResultData(wxMerchantService.followListAsPage(record, pageNum, pageSize)); | |||
| } | |||
| @ApiOperation("取消关注") | |||
| @GetMapping("/cancelFollow") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData cancelFollow(@RequestParam Long id) { | |||
| logger.debug("[" + getIpAddr() + "] TtCouponController::cancelFollow"); | |||
| if (id == null) { | |||
| return new ResultData(ResultData.ERROR, "缺少id"); | |||
| } | |||
| Long memberId; | |||
| try { | |||
| memberId = getMemberId(); | |||
| } catch (MallinkException e) { | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| } | |||
| wxMerchantService.cancelFollow(memberId,id); | |||
| return new ResultData(); | |||
| } | |||
| } | |||