Commit 170b119b by 徐高华

临时活码删除

parent a1fcec0b
package com.gic.haoban.manage.api.service;
import com.gic.api.base.commons.ServiceResponse;
/**
*
* @ClassName: HaobanTimerApiService
* @Description: 好办定时入口
* @author xugh
* @date 2022年7月16日 上午9:25:11
*
*/
public interface HaobanTimerApiService {
/**
*
* @Title: deleteTempWxHm
* @Description: 定时删除企微临时活码
* @author xugh
* @param params
* @return
* @throws
*/
public ServiceResponse<Void> deleteTempWxHm(String params) ;
}
...@@ -24,6 +24,15 @@ public class TabHmQrcodeTemp implements Serializable { ...@@ -24,6 +24,15 @@ public class TabHmQrcodeTemp implements Serializable {
/**1有效 0已删除*/ /**1有效 0已删除*/
private Integer statusFlag; private Integer statusFlag;
private String relationId ; private String relationId ;
private String corpid ;
public String getCorpid() {
return corpid;
}
public void setCorpid(String corpid) {
this.corpid = corpid;
}
public String getRelationId() { public String getRelationId() {
return relationId; return relationId;
......
...@@ -26,6 +26,13 @@ public interface HmQrcodeTempService { ...@@ -26,6 +26,13 @@ public interface HmQrcodeTempService {
// 删除临时活码 // 删除临时活码
public void deleteQrcode(String relationId); public void deleteQrcode(String relationId);
public void deleteQrcodeById(Long id); /**
*
* @Title: deleteForTimer
* @Description: 定时删除
* @author xugh
* @throws
*/
public void deleteForTimer();
} }
\ No newline at end of file
...@@ -4,9 +4,12 @@ import java.util.Date; ...@@ -4,9 +4,12 @@ import java.util.Date;
import java.util.List; import java.util.List;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSON;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.UniqueIdUtils; import com.gic.commons.util.UniqueIdUtils;
import com.gic.haoban.manage.service.config.Config; import com.gic.haoban.manage.service.config.Config;
...@@ -14,18 +17,20 @@ import com.gic.haoban.manage.service.dao.mapper.hm.HmQrcodeTempMapper; ...@@ -14,18 +17,20 @@ import com.gic.haoban.manage.service.dao.mapper.hm.HmQrcodeTempMapper;
import com.gic.haoban.manage.service.entity.hm.TabHmQrcodeTemp; import com.gic.haoban.manage.service.entity.hm.TabHmQrcodeTemp;
import com.gic.haoban.manage.service.pojo.qo.HmQrcodeTempQO; import com.gic.haoban.manage.service.pojo.qo.HmQrcodeTempQO;
import com.gic.haoban.manage.service.service.hm.HmQrcodeTempService; import com.gic.haoban.manage.service.service.hm.HmQrcodeTempService;
import com.gic.wechat.api.dto.qywx.response.QywxResponseDTO;
import com.gic.wechat.api.service.qywx.QywxUserApiService; import com.gic.wechat.api.service.qywx.QywxUserApiService;
@Service @Service
public class HmQrcodeTempServiceImpl implements HmQrcodeTempService { public class HmQrcodeTempServiceImpl implements HmQrcodeTempService {
private static final Logger log = LoggerFactory.getLogger(HmQrcodeTempService.class);
@Autowired @Autowired
private HmQrcodeTempMapper hmQrcodeTempMapper; private HmQrcodeTempMapper hmQrcodeTempMapper;
@Autowired @Autowired
private QywxUserApiService qywxUserApiService; private QywxUserApiService qywxUserApiService;
@Autowired @Autowired
private Config config; private Config config;
@Override @Override
public void save(HmQrcodeTempQO qo) { public void save(HmQrcodeTempQO qo) {
...@@ -43,16 +48,22 @@ public class HmQrcodeTempServiceImpl implements HmQrcodeTempService { ...@@ -43,16 +48,22 @@ public class HmQrcodeTempServiceImpl implements HmQrcodeTempService {
} }
@Override @Override
public void deleteQrcodeById(Long id) { public void deleteForTimer() {
this.hmQrcodeTempMapper.deleteByPrimaryKey(id);
}
public void del() {
List<TabHmQrcodeTemp> list = this.hmQrcodeTempMapper.listAll(); List<TabHmQrcodeTemp> list = this.hmQrcodeTempMapper.listAll();
String suiteId = config.getWxSuiteid();
if (CollectionUtils.isEmpty(list)) { if (CollectionUtils.isEmpty(list)) {
for (TabHmQrcodeTemp item : list) {
//this.qywxUserApiService.delContactWay(corpid, suiteId, configId) ; try {
String corpid = item.getCorpid();
String configId = item.getWxConfigId();
QywxResponseDTO resp = this.qywxUserApiService.delContactWay(corpid, suiteId, configId);
log.info("删除临时活码={}{},返回={}", configId, corpid, JSON.toJSONString(resp));
this.hmQrcodeTempMapper.deleteByPrimaryKey(item.getId());
} catch (Exception e) {
log.info("删除临时活码异常={}", e);
}
}
} }
} }
} }
...@@ -279,7 +279,7 @@ public class HmLinkApiServiceImpl implements HmLinkApiService { ...@@ -279,7 +279,7 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
if (openFlag == 1) { if (openFlag == 1) {
// 门店规则1推荐门店 2附件门店 // 门店规则1推荐门店 2附件门店
int storeType = storeRuleObj.getIntValue("store_type"); int storeType = storeRuleObj.getIntValue("store_type");
// 过滤有活码的门店 // 活码的门店
List<HmLinkStoreDTO> storeList = this.hmLinkStoreService.listByLinkId(wxEnterpriseId, enterpriseId, List<HmLinkStoreDTO> storeList = this.hmLinkStoreService.listByLinkId(wxEnterpriseId, enterpriseId,
linkId); linkId);
log.info("门店规则={},推荐门店列表={}", storeType, JSON.toJSONString(storeList)); log.info("门店规则={},推荐门店列表={}", storeType, JSON.toJSONString(storeList));
......
...@@ -49,26 +49,26 @@ ...@@ -49,26 +49,26 @@
</foreach> </foreach>
</insert> </insert>
<delete id="deleteByLinkId" parameterType="long"> <update id="deleteByLinkId" parameterType="long">
UPDATE UPDATE
tab_haoban_hm_link_store SET status_flag = 0 , update_time=now() WHERE tab_haoban_hm_link_store SET status_flag = 0 , update_time=now() WHERE
link_id = #{linkId} and status_flag = 1 link_id = #{linkId} and status_flag = 1
</delete> </update>
<delete id="deleteById"> <update id="deleteById">
UPDATE UPDATE
tab_haoban_hm_link_store SET status_flag = 0 , update_time=now() WHERE tab_haoban_hm_link_store SET status_flag = 0 , update_time=now() WHERE
id in <foreach collection="list" item="item" separator="," open="(" close=")" > id in <foreach collection="list" item="item" separator="," open="(" close=")" >
#{item} #{item}
</foreach> </foreach>
and status_flag = 1 and status_flag = 1
</delete> </update>
<select id="listByLinkId" <select id="listByLinkId"
parameterType="com.gic.haoban.manage.service.entity.hm.TabHmLinkStore" parameterType="com.gic.haoban.manage.service.entity.hm.TabHmLinkStore"
resultMap="result-map-tabHaobanHmLinkStore"> resultMap="result-map-tabHaobanHmLinkStore">
select * from tab_haoban_hm_link_store where link_id=#{linkId} and status_flag = 1 select <include refid="Base_Column_List" /> from tab_haoban_hm_link_store where link_id=#{linkId} and status_flag = 1
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -11,11 +11,12 @@ ...@@ -11,11 +11,12 @@
<result column="update_time" property="updateTime" /> <result column="update_time" property="updateTime" />
<result column="status_flag" property="statusFlag" /> <result column="status_flag" property="statusFlag" />
<result column="relation_id" property="relationId" /> <result column="relation_id" property="relationId" />
<result column="corpid" property="corpid"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
wx_config_id, wx_config_id,
wx_qrcode, wx_qrcode,
wx_enterprise_id, wx_enterprise_id, corpid ,
create_time, create_time,
update_time, update_time,
status_flag , relation_id status_flag , relation_id
...@@ -30,7 +31,7 @@ ...@@ -30,7 +31,7 @@
wx_enterprise_id, wx_enterprise_id,
create_time, create_time,
update_time, update_time,
status_flag , relation_id status_flag , relation_id , corpid
)VALUES( )VALUES(
#{id} , #{id} ,
#{wxConfigId,jdbcType=VARCHAR}, #{wxConfigId,jdbcType=VARCHAR},
...@@ -38,7 +39,7 @@ ...@@ -38,7 +39,7 @@
#{wxEnterpriseId,jdbcType=CHAR}, #{wxEnterpriseId,jdbcType=CHAR},
#{createTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{statusFlag,jdbcType=INTEGER} , #{relationId} #{statusFlag,jdbcType=INTEGER} , #{relationId} , ${corpid}
) )
]]> ]]>
</insert> </insert>
...@@ -56,10 +57,10 @@ ...@@ -56,10 +57,10 @@
<!-- ============ 查询============= --> <!-- ============ 查询============= -->
<select id="selectByRelationId" parameterType="String" <select id="selectByRelationId" parameterType="String"
resultMap="result-map-tabHaobanHmQrcodeTemp"> resultMap="result-map-tabHaobanHmQrcodeTemp">
SELECT * FROM tab_haoban_hm_qrcode_temp WHERE relation_id = #{relationId} SELECT <include refid="Base_Column_List" /> FROM tab_haoban_hm_qrcode_temp WHERE relation_id = #{relationId}
</select> </select>
<select id="listAll" resultMap="result-map-tabHaobanHmQrcodeTemp"> <select id="listAll" resultMap="result-map-tabHaobanHmQrcodeTemp">
select * from tab_haoban_hm_qrcode_temp where create_time >= DATE_ADD(now(),INTERVAL 6 HOUR) and status_flag = 1 select <include refid="Base_Column_List" /> from tab_haoban_hm_qrcode_temp where create_time >= DATE_ADD(now(),INTERVAL -6 HOUR) and create_time <![CDATA[<=]]> DATE_ADD(now(),INTERVAL -1 HOUR) and status_flag = 1 limit 10000
</select> </select>
</mapper> </mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment