| @@ -46,6 +46,9 @@ public class WxMerchant extends TenantEntity { | |||
| @TableField(exist = false) | |||
| private Long rentContractId; | |||
| @TableField(exist = false) | |||
| private Long cUserId; | |||
| @io.swagger.annotations.ApiModelProperty(value="商户编码",name="encode") | |||
| @Excel(name="商户编码",width = 20,orderNum = "1") | |||
| private String encode; | |||
| @@ -23,6 +23,9 @@ public class TtCoupon extends TenantEntity { | |||
| protected Long id; | |||
| @TableField(exist = false) | |||
| private Long cUserId; | |||
| @TableField(exist = false) | |||
| protected List<Integer> types; | |||
| @@ -31,4 +31,7 @@ public class TtUserCollectFollow extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="查询-结束时间",name="enddate") | |||
| private Date enddate; | |||
| @TableField(exist = false) | |||
| private String name; | |||
| } | |||
| @@ -13,6 +13,7 @@ public enum EnumTemplateType { | |||
| ACTIVITY_REMIND(4, "活动开始提醒","386"), // 小程序 | |||
| LIVE_REMIND(5, "直播开播提醒","8501"), // 小程序 | |||
| CREDIT_UPD_REMIND(6, "积分变更提醒","310"), // 小程序 | |||
| AUDIT_MESSAGE(101, "公众号审核结果通知",""), // 公众号 | |||
| VERIFY_RESULT(102, "公众号卡券核销通知",""), // 公众号 | |||
| @@ -63,4 +63,5 @@ public interface TtCouponMapper extends CommonMapper<TtCoupon, Long> { | |||
| */ | |||
| int addPopularity(@Param("id")Long id,@Param("popularity")Integer popularity); | |||
| List<TtCoupon> findCollectList(TtCoupon record); | |||
| } | |||
| @@ -53,4 +53,6 @@ public interface WxMerchantMapper extends CommonMapper<WxMerchant, Long> { | |||
| void reSetCashCount(WxMerchant record); | |||
| WxMerchant getMerchantByEncode(@Param("encode")String encode); | |||
| List<WxMerchant> findFollowList(WxMerchant record); | |||
| } | |||
| @@ -1,6 +1,7 @@ | |||
| package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.dto.WxMerchantDto; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| @@ -161,4 +162,10 @@ 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); | |||
| } | |||
| @@ -12,6 +12,7 @@ import com.iformall.domain.dto.WxMerchantDto; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.po.tt.TtUserFollow; | |||
| import com.iformall.domain.vo.*; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.exception.MallinkException; | |||
| @@ -102,6 +103,9 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| @Autowired | |||
| WxPropertyContractService wxPropertyContractService; | |||
| @Autowired | |||
| TtUserFollowMapper ttUserFollowMapper; | |||
| @Override | |||
| public PageInfo<WxMerchant> listAsPage(WxMerchant record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxMerchantMapper.findList(record)); | |||
| @@ -938,4 +942,42 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| return wxMerchantShopMapper.findShopIds(merchantId); | |||
| } | |||
| @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)); | |||
| } | |||
| } | |||
| @@ -57,6 +57,10 @@ public class WxTemplateMsgServiceImpl implements WxTemplateMsgService { | |||
| wxTemplateMsg.setType(EnumTemplateType.LIVE_REMIND.getCode()); | |||
| wxTemplateMsg.setCustomParam("{\"index\": [\"thing1\", \"date3\", \"thing4\", \"thing5\"], \"emphasis\": \"\"}"); | |||
| wxTemplateMsgMapper.insert(wxTemplateMsg); | |||
| wxTemplateMsg.setId(null); | |||
| wxTemplateMsg.setType(EnumTemplateType.CREDIT_UPD_REMIND.getCode()); | |||
| wxTemplateMsg.setCustomParam("{\"index\": [\"character_string1\", \"character_string2\", \"time4\", \"thing3\"], \"emphasis\": \"\"}"); | |||
| wxTemplateMsgMapper.insert(wxTemplateMsg); | |||
| } | |||
| @Override | |||
| @@ -131,6 +135,15 @@ public class WxTemplateMsgServiceImpl implements WxTemplateMsgService { | |||
| } catch (WxErrorException e) { | |||
| return new ResultData(ErrorCode.TEMPLATE_ADD_ERROR); | |||
| } | |||
| }else if(byId.getType() == EnumTemplateType.CREDIT_UPD_REMIND.getCode()){ | |||
| try { | |||
| s = wxMaService.getSubscribeService().addTemplate(EnumTemplateType.CREDIT_UPD_REMIND.getTid(), | |||
| Lists.newArrayList(1, 2, 4, 3),EnumTemplateType.CREDIT_UPD_REMIND.getMessage()); | |||
| } catch (WxErrorException e) { | |||
| return new ResultData(ErrorCode.TEMPLATE_ADD_ERROR); | |||
| } | |||
| }else{ | |||
| return new ResultData(ErrorCode.TEMPLATE_NOT_FOUND); | |||
| } | |||
| if(StringUtils.isBlank(s)){ | |||
| return new ResultData(ErrorCode.TEMPLATE_ADD_ERROR); | |||
| @@ -1,6 +1,7 @@ | |||
| package com.iformall.service.tt; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.po.tt.TtCoupon; | |||
| @@ -50,11 +51,8 @@ public interface TtCouponService { | |||
| void collectCoupon(TenantEntity tenantEntity,Long memberId, Long id); | |||
| void cancelCollect(Long memberId, Long id); | |||
| int getcollect(Long memberId, Long id); | |||
| PageInfo<TtCoupon> collectListAsPage(TtCoupon record, Integer pageNum, Integer pageSize); | |||
| @Async | |||
| void followMerchant(TenantEntity tenantEntity, Long memberId, Long id); | |||
| void cancelFollow(Long memberId, Long id); | |||
| int getfollow(Long memberId, Long id); | |||
| ResultData auditPass(Long id); | |||
| @@ -64,4 +62,5 @@ public interface TtCouponService { | |||
| int addSeeCount(Long id); | |||
| int addSellCount(Long id); | |||
| } | |||
| @@ -225,36 +225,8 @@ public class TtCouponServiceImpl implements TtCouponService { | |||
| } | |||
| @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)); | |||
| public PageInfo<TtCoupon> collectListAsPage(TtCoupon record, Integer pageNum, Integer pageSize) { | |||
| return PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> ttCouponMapper.findCollectList(record)); | |||
| } | |||
| @Override | |||
| @@ -139,6 +139,32 @@ | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <select id="findCollectList" parameterType="com.iformall.domain.po.tt.TtCoupon" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from tt_user_collect uc | |||
| left join tt_coupon c on c.id = uc.coupon_id | |||
| left join wx_merchant m on m.id = c.merchant_id | |||
| where uc.`is_del` = 0 and uc.`user_id` = ${cUserId} | |||
| and c.`is_del` = 0 and c.`type` != 3 | |||
| <if test=" null != type "> | |||
| and c.`type` = #{type} | |||
| </if> | |||
| <if test=" null != title and ''!=title"> | |||
| and c.`title` like concat('%', #{title},'%') | |||
| </if> | |||
| <if test=" null != status"> | |||
| and c.`status` = #{status} | |||
| </if> | |||
| <if test=" null != mark"> | |||
| and c.`mark` = #{mark} | |||
| </if> | |||
| <if test=" null != businessId "> | |||
| and c.`business_id` = #{businessId} | |||
| </if> | |||
| order by uc.create_date desc | |||
| </select> | |||
| <select id="selectById" parameterType="Long" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns"/> | |||
| from tt_coupon c | |||
| @@ -46,9 +46,9 @@ | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`parent_tenant_id`,`img_url`,`name`,`encode`,`link_phone`,`create_date`,`update_date`,`car_vendor_type`,`car_params`,`status`,`link_person`, | |||
| `business_id`,`business_types`,`sub_business_id`,`shop_type`,`brand`,`type`,`is_public`,email,`title`,`cover_picture`,`is_admin`,`bill_setting`,`qr_code`, | |||
| `introduction`,`action_desc`,`mark`,`is_del`,`talk_user_main`,`talk_user_aux`,link_line_phone,credit_locked,credit_locked,entry_amount,cash_out_count,cash_out_last_time | |||
| m.`id`,m.`tenant_id`,m.`parent_tenant_id`,m.`img_url`,m.`name`,m.`encode`,m.`link_phone`,m.`create_date`,m.`update_date`,m.`car_vendor_type`,m.`car_params`,m.`status`,m.`link_person`, | |||
| m.`business_id`,m.`business_types`,m.`sub_business_id`,m.`shop_type`,m.`brand`,m.`type`,m.`is_public`,m.email,m.`title`,m.`cover_picture`,m.`is_admin`,m.`bill_setting`,m.`qr_code`, | |||
| m.`introduction`,m.`action_desc`,m.`mark`,m.`is_del`,m.`talk_user_main`,m.`talk_user_aux`,m.link_line_phone,m.credit_locked,m.credit_locked,m.entry_amount,m.cash_out_count,m.cash_out_last_time | |||
| </sql> | |||
| <sql id="allColumnsVo"> | |||
| @@ -58,94 +58,94 @@ | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where is_del = 0 | |||
| where m.is_del = 0 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| and m.`id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| and m.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| and m.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != imgUrl "> | |||
| and `img_url` like concat('%', #{imgUrl},'%') | |||
| and m.`img_url` like concat('%', #{imgUrl},'%') | |||
| </if> | |||
| <if test=" null != encode and ''!=encode "> | |||
| and `encode` like concat('%', #{encode},'%') | |||
| and m.`encode` like concat('%', #{encode},'%') | |||
| </if> | |||
| <if test=" null != name and ''!=name "> | |||
| and `name` like concat('%', #{name},'%') | |||
| and m.`name` like concat('%', #{name},'%') | |||
| </if> | |||
| <if test=" null != linkPhone and ''!=linkPhone "> | |||
| and `link_phone` like concat('%', #{linkPhone},'%') | |||
| and m.`link_phone` like concat('%', #{linkPhone},'%') | |||
| </if> | |||
| <if test=" null != createDate "> | |||
| and `create_date` = #{createDate} | |||
| and m.`create_date` = #{createDate} | |||
| </if> | |||
| <if test=" null != updateDate "> | |||
| and `update_date` = #{updateDate} | |||
| and m.`update_date` = #{updateDate} | |||
| </if> | |||
| <if test=" null != carVendorType "> | |||
| and `car_vendor_type` = #{carVendorType} | |||
| and m.`car_vendor_type` = #{carVendorType} | |||
| </if> | |||
| <if test=" null != businessId "> | |||
| and `business_id` = #{businessId} | |||
| and m.`business_id` = #{businessId} | |||
| </if> | |||
| <if test=" null != businessTypes "> | |||
| and JSON_CONTAINS(business_types,JSON_OBJECT('id', #{businessTypes})) | |||
| and JSON_CONTAINS(m.business_types,JSON_OBJECT('id', #{businessTypes})) | |||
| </if> | |||
| <if test=" null != subBusinessId "> | |||
| and `sub_business_id` = #{subBusinessId} | |||
| and m.`sub_business_id` = #{subBusinessId} | |||
| </if> | |||
| <if test=" null != carParams "> | |||
| and `car_params` like concat('%', #{carParams},'%') | |||
| and m.`car_params` like concat('%', #{carParams},'%') | |||
| </if> | |||
| <if test=" null != status "> | |||
| and `status` = #{status} | |||
| and m.`status` = #{status} | |||
| </if> | |||
| <if test=" null != linkPerson "> | |||
| and `link_person` = #{linkPerson} | |||
| and m.`link_person` = #{linkPerson} | |||
| </if> | |||
| <if test=" null != type "> | |||
| and `type` = #{type} | |||
| and m.`type` = #{type} | |||
| </if> | |||
| <if test=" null != isPublic "> | |||
| and `is_public` = #{isPublic} | |||
| and m.`is_public` = #{isPublic} | |||
| </if> | |||
| <if test=" null != email "> | |||
| and `email` = #{email} | |||
| and m.`email` = #{email} | |||
| </if> | |||
| <if test=" null != isAdmin "> | |||
| and `is_admin` = #{isAdmin} | |||
| and m.`is_admin` = #{isAdmin} | |||
| </if> | |||
| <if test=" null != mark "> | |||
| and `mark` = #{mark} | |||
| and m.`mark` = #{mark} | |||
| </if> | |||
| <if test=" null != isDel "> | |||
| and `is_del` = #{isDel} | |||
| and m.`is_del` = #{isDel} | |||
| </if> | |||
| <if test=" null != brand "> | |||
| and `brand` = #{brand} | |||
| and m.`brand` = #{brand} | |||
| </if> | |||
| <if test=" null != creditLocked "> | |||
| and `credit_locked` = #{creditLocked} | |||
| and m.`credit_locked` = #{creditLocked} | |||
| </if> | |||
| <if test=" null != rentShopType "> | |||
| and id not in( | |||
| and m.id not in( | |||
| select merchant_id from wx_rent_contract where rent_shop_type=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| @@ -158,14 +158,14 @@ | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| and m.id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test="(null != floorForRule and '' != floorForRule) or (null != businessForRule and '' != businessForRule)"> | |||
| and id in( | |||
| and m.id in( | |||
| select ms.merchant_id from (select merchant_id,shop_id from wx_merchant_shop where is_del=0) ms | |||
| inner join wx_merchant m on ms.merchant_id = m.id | |||
| inner join wx_shop s on s.id=ms.shop_id | |||
| @@ -200,6 +200,29 @@ | |||
| from wx_merchant m | |||
| <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 | |||
| @@ -236,7 +259,7 @@ | |||
| <select id="getMerchantByEncode" parameterType="String" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_merchant where encode = #{encode} | |||
| from wx_merchant m where m.encode = #{encode} | |||
| </select> | |||
| <sql id="dataRule"> | |||
| @@ -153,74 +153,30 @@ public class TtCouponController extends BaseController { | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("取消收藏") | |||
| @GetMapping("/cancelCollect") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData cancelCollect(@RequestParam Long id) { | |||
| logger.debug("[" + getIpAddr() + "] TtCouponController::collectCoupon"); | |||
| if (id == null) { | |||
| return new ResultData(ResultData.ERROR, "缺少id"); | |||
| } | |||
| Long memberId; | |||
| try { | |||
| memberId = getMemberId(); | |||
| } catch (MallinkException e) { | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| } | |||
| ttCouponService.cancelCollect(memberId,id); | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("是否关注") | |||
| @GetMapping("/isfollow") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData isfollow(@RequestParam Long id) { | |||
| logger.debug("[" + getIpAddr() + "] TtCouponController::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 = ttCouponService.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() + "] TtCouponController::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,"找不到数据"); | |||
| } | |||
| @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 collectList(@ModelAttribute TtCoupon record, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] TtCouponController::collectList"); | |||
| if (record == null) record = new TtCoupon(); | |||
| Long memberId; | |||
| try { | |||
| memberId = getMemberId(); | |||
| } catch (MallinkException e) { | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| } | |||
| ttCouponService.followMerchant(getTenantInfo(),memberId,byId.getId()); | |||
| return new ResultData(); | |||
| record.setCUserId(memberId); | |||
| record.setStatus(EnumTtCouponStatus.TTCOUPON_STATUS_SHELFING.getCode()); | |||
| return new ResultData(ttCouponService.collectListAsPage(record, pageNum, pageSize)); | |||
| } | |||
| @ApiOperation("取消关注") | |||
| @GetMapping("/cancelFollow") | |||
| @ApiOperation("取消收藏") | |||
| @GetMapping("/cancelCollect") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData cancelFollow(@RequestParam Long id) { | |||
| logger.debug("[" + getIpAddr() + "] TtCouponController::cancelFollow"); | |||
| public ResultData cancelCollect(@RequestParam Long id) { | |||
| logger.debug("[" + getIpAddr() + "] TtCouponController::collectCoupon"); | |||
| if (id == null) { | |||
| return new ResultData(ResultData.ERROR, "缺少id"); | |||
| } | |||
| @@ -230,7 +186,7 @@ public class TtCouponController extends BaseController { | |||
| } catch (MallinkException e) { | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| } | |||
| ttCouponService.cancelFollow(memberId,id); | |||
| ttCouponService.cancelCollect(memberId,id); | |||
| return new ResultData(); | |||
| } | |||
| @@ -5,9 +5,11 @@ import com.iformall.common.ResultData; | |||
| import com.iformall.domain.dto.WxMerchantDto; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.po.tt.TtCoupon; | |||
| import com.iformall.domain.vo.WxMerchantVo; | |||
| import com.iformall.enums.EnumMerchantPublic; | |||
| import com.iformall.enums.EnumMerchantStatus; | |||
| import com.iformall.enums.EnumTtCouponStatus; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.WxMerchantService; | |||
| import com.iformall.utils.HashUtil; | |||
| @@ -84,5 +86,88 @@ 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(getTenantInfo(),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(); | |||
| 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(); | |||
| } | |||
| } | |||