提醒关注微信公众号

master
382696293@qq.com 2 years ago
parent fe0837c486
commit 384d05eabe

@ -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();
}
}

@ -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<WxNoRemindRecord> 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);
}

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.flossom.common.core.mapper.WxNoRemindRecordMapper">
<resultMap type="WxNoRemindRecord" id="WxNoRemindRecordResult">
<result property="id" column="id" />
<result property="openid" column="openid" />
<result property="type" column="type" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectWxNoRemindRecordVo">
select id, openid, type, create_time from wx_no_remind_record
</sql>
<select id="selectWxNoRemindRecordList" parameterType="WxNoRemindRecord" resultMap="WxNoRemindRecordResult">
<include refid="selectWxNoRemindRecordVo"/>
<where>
<if test="openid != null and openid != ''"> and openid = #{openid}</if>
<if test="type != null "> and type = #{type}</if>
</where>
</select>
<select id="selectWxNoRemindRecordById" parameterType="Long" resultMap="WxNoRemindRecordResult">
<include refid="selectWxNoRemindRecordVo"/>
where id = #{id}
</select>
<select id="selectWxNoRemindRecordByOpenid" resultType="java.lang.Integer">
SELECT
count(1)
FROM
`wx_no_remind_record`
WHERE
openid = #{openid}
AND YEAR (create_time) = YEAR (sysdate())
</select>
<insert id="insertWxNoRemindRecord" parameterType="WxNoRemindRecord" useGeneratedKeys="true" keyProperty="id">
insert into wx_no_remind_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="openid != null">openid,</if>
<if test="type != null">type,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="openid != null">#{openid},</if>
<if test="type != null">#{type},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateWxNoRemindRecord" parameterType="WxNoRemindRecord">
update wx_no_remind_record
<trim prefix="SET" suffixOverrides=",">
<if test="openid != null">openid = #{openid},</if>
<if test="type != null">type = #{type},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteWxNoRemindRecordById" parameterType="Long">
delete from wx_no_remind_record where id = #{id}
</delete>
<delete id="deleteWxNoRemindRecordByIds" parameterType="String">
delete from wx_no_remind_record where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

@ -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();
}
}

@ -0,0 +1,11 @@
package com.flossom.miniProgram.service;
import com.flossom.common.core.domain.entity.WxNoRemindRecord;
public interface IWxNoRemindService {
Integer officialAccount();
void closeOfficialAccount();
}

@ -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);
}
}
Loading…
Cancel
Save