diff --git a/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/entity/WxNoRemindRecord.java b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/entity/WxNoRemindRecord.java new file mode 100644 index 0000000..c97b2c9 --- /dev/null +++ b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/entity/WxNoRemindRecord.java @@ -0,0 +1,67 @@ +package com.flossom.common.core.domain.entity; + +import com.flossom.common.core.annotation.Excel; +import com.flossom.common.core.web.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 微信用户关闭提醒记录对象 wx_no_remind_record + * + * @author flossom + * @date 2023-12-16 + */ +public class WxNoRemindRecord extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * id + */ + private Long id; + + /** + * 用户openid + */ + @Excel(name = "用户openid") + private String openid; + + /** + * 类型:1公众号 + */ + @Excel(name = "类型:1公众号") + private Integer type; + + public void setId(Long id) { + this.id = id; + } + + public Long getId() { + return id; + } + + public void setOpenid(String openid) { + this.openid = openid; + } + + public String getOpenid() { + return openid; + } + + public void setType(Integer type) { + this.type = type; + } + + public Integer getType() { + return type; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("openid", getOpenid()) + .append("type", getType()) + .append("createTime", getCreateTime()) + .toString(); + } +} diff --git a/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/mapper/WxNoRemindRecordMapper.java b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/mapper/WxNoRemindRecordMapper.java new file mode 100644 index 0000000..38230c9 --- /dev/null +++ b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/mapper/WxNoRemindRecordMapper.java @@ -0,0 +1,65 @@ +package com.flossom.common.core.mapper; + +import com.flossom.common.core.domain.entity.WxNoRemindRecord; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + + +/** + * 微信用户关闭提醒记录Mapper接口 + * + * @author flossom + * @date 2023-12-16 + */ +public interface WxNoRemindRecordMapper { + /** + * 查询微信用户关闭提醒记录 + * + * @param id 微信用户关闭提醒记录主键 + * @return 微信用户关闭提醒记录 + */ + public WxNoRemindRecord selectWxNoRemindRecordById(Long id); + + /** + * 查询微信用户关闭提醒记录列表 + * + * @param wxNoRemindRecord 微信用户关闭提醒记录 + * @return 微信用户关闭提醒记录集合 + */ + public List selectWxNoRemindRecordList(WxNoRemindRecord wxNoRemindRecord); + + /** + * 新增微信用户关闭提醒记录 + * + * @param wxNoRemindRecord 微信用户关闭提醒记录 + * @return 结果 + */ + public int insertWxNoRemindRecord(WxNoRemindRecord wxNoRemindRecord); + + /** + * 修改微信用户关闭提醒记录 + * + * @param wxNoRemindRecord 微信用户关闭提醒记录 + * @return 结果 + */ + public int updateWxNoRemindRecord(WxNoRemindRecord wxNoRemindRecord); + + /** + * 删除微信用户关闭提醒记录 + * + * @param id 微信用户关闭提醒记录主键 + * @return 结果 + */ + public int deleteWxNoRemindRecordById(Long id); + + /** + * 批量删除微信用户关闭提醒记录 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWxNoRemindRecordByIds(Long[] ids); + + int selectWxNoRemindRecordByOpenid(@Param("openid") String openid); +} diff --git a/flossom-common/flossom-common-core/src/main/resources/mapper/WxNoRemindRecordMapper.xml b/flossom-common/flossom-common-core/src/main/resources/mapper/WxNoRemindRecordMapper.xml new file mode 100644 index 0000000..544e1d7 --- /dev/null +++ b/flossom-common/flossom-common-core/src/main/resources/mapper/WxNoRemindRecordMapper.xml @@ -0,0 +1,75 @@ + + + + + + + + + + + + + select id, openid, type, create_time from wx_no_remind_record + + + + + + + + + + insert into wx_no_remind_record + + openid, + type, + create_time, + + + #{openid}, + #{type}, + #{createTime}, + + + + + update wx_no_remind_record + + openid = #{openid}, + type = #{type}, + create_time = #{createTime}, + + where id = #{id} + + + + delete from wx_no_remind_record where id = #{id} + + + + delete from wx_no_remind_record where id in + + #{id} + + + \ No newline at end of file diff --git a/flossom-modules/flossom-mini-program/src/main/java/com/flossom/miniProgram/controller/WxNoRemindController.java b/flossom-modules/flossom-mini-program/src/main/java/com/flossom/miniProgram/controller/WxNoRemindController.java new file mode 100644 index 0000000..cdf36ad --- /dev/null +++ b/flossom-modules/flossom-mini-program/src/main/java/com/flossom/miniProgram/controller/WxNoRemindController.java @@ -0,0 +1,43 @@ +package com.flossom.miniProgram.controller; + + +import com.flossom.common.core.domain.R; +import com.flossom.common.core.web.controller.BaseController; +import com.flossom.common.core.web.domain.AjaxResult; +import com.flossom.miniProgram.service.IWxNoRemindService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/noRemind") +public class WxNoRemindController extends BaseController { + + @Autowired + private IWxNoRemindService wxNoRemindService; + + /** + * 查询用户是否关闭了 ·提醒关注微信公众号· + * + * @return + * @throws Exception + */ + @GetMapping("/getOfficialAccount") + public R officialAccount() { + return R.ok(wxNoRemindService.officialAccount() > 0 ? true : false); + } + + /** + * 关闭 ·提醒关注微信公众号· + * + * @return + * @throws Exception + */ + @GetMapping("/closeOfficialAccount") + public AjaxResult closeOfficialAccount() { + wxNoRemindService.closeOfficialAccount(); + return AjaxResult.success(); + } + +} diff --git a/flossom-modules/flossom-mini-program/src/main/java/com/flossom/miniProgram/service/IWxNoRemindService.java b/flossom-modules/flossom-mini-program/src/main/java/com/flossom/miniProgram/service/IWxNoRemindService.java new file mode 100644 index 0000000..27679af --- /dev/null +++ b/flossom-modules/flossom-mini-program/src/main/java/com/flossom/miniProgram/service/IWxNoRemindService.java @@ -0,0 +1,11 @@ +package com.flossom.miniProgram.service; + +import com.flossom.common.core.domain.entity.WxNoRemindRecord; + +public interface IWxNoRemindService { + + Integer officialAccount(); + + void closeOfficialAccount(); + +} diff --git a/flossom-modules/flossom-mini-program/src/main/java/com/flossom/miniProgram/service/impl/WxNoRemindServiceImpl.java b/flossom-modules/flossom-mini-program/src/main/java/com/flossom/miniProgram/service/impl/WxNoRemindServiceImpl.java new file mode 100644 index 0000000..ecd24fd --- /dev/null +++ b/flossom-modules/flossom-mini-program/src/main/java/com/flossom/miniProgram/service/impl/WxNoRemindServiceImpl.java @@ -0,0 +1,31 @@ +package com.flossom.miniProgram.service.impl; + +import com.flossom.common.core.domain.R; +import com.flossom.common.core.domain.entity.WxNoRemindRecord; +import com.flossom.common.core.mapper.WxNoRemindRecordMapper; +import com.flossom.common.core.utils.DateUtils; +import com.flossom.common.core.web.domain.AjaxResult; +import com.flossom.common.security.utils.SecurityUtils; +import com.flossom.miniProgram.service.IWxNoRemindService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class WxNoRemindServiceImpl implements IWxNoRemindService { + + @Autowired + private WxNoRemindRecordMapper wxNoRemindRecordMapper; + + @Override + public Integer officialAccount() { + return wxNoRemindRecordMapper.selectWxNoRemindRecordByOpenid(SecurityUtils.getLoginUser().getWxUserMember().getOpenid()); + } + + @Override + public void closeOfficialAccount() { + WxNoRemindRecord wxNoRemindRecord = new WxNoRemindRecord(); + wxNoRemindRecord.setOpenid(SecurityUtils.getLoginUser().getWxUserMember().getOpenid()); + wxNoRemindRecord.setCreateTime(DateUtils.getNowDate()); + wxNoRemindRecordMapper.insertWxNoRemindRecord(wxNoRemindRecord); + } +}