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 {
/**1有效 0已删除*/
private Integer statusFlag;
private String relationId ;
private String corpid ;
public String getCorpid() {
return corpid;
}
public void setCorpid(String corpid) {
this.corpid = corpid;
}
public String getRelationId() {
return relationId;
......
......@@ -26,6 +26,13 @@ public interface HmQrcodeTempService {
// 删除临时活码
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;
import java.util.List;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSON;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.UniqueIdUtils;
import com.gic.haoban.manage.service.config.Config;
......@@ -14,11 +17,14 @@ 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.pojo.qo.HmQrcodeTempQO;
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;
@Service
public class HmQrcodeTempServiceImpl implements HmQrcodeTempService {
private static final Logger log = LoggerFactory.getLogger(HmQrcodeTempService.class);
@Autowired
private HmQrcodeTempMapper hmQrcodeTempMapper;
@Autowired
......@@ -26,7 +32,6 @@ public class HmQrcodeTempServiceImpl implements HmQrcodeTempService {
@Autowired
private Config config;
@Override
public void save(HmQrcodeTempQO qo) {
TabHmQrcodeTemp entity = EntityUtil.changeEntityByJSON(TabHmQrcodeTemp.class, qo);
......@@ -43,16 +48,22 @@ public class HmQrcodeTempServiceImpl implements HmQrcodeTempService {
}
@Override
public void deleteQrcodeById(Long id) {
this.hmQrcodeTempMapper.deleteByPrimaryKey(id);
}
public void del() {
public void deleteForTimer() {
List<TabHmQrcodeTemp> list = this.hmQrcodeTempMapper.listAll();
String suiteId = config.getWxSuiteid();
if (CollectionUtils.isEmpty(list)) {
for (TabHmQrcodeTemp item : list) {
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);
}
//this.qywxUserApiService.delContactWay(corpid, suiteId, configId) ;
}
}
}
}
......@@ -279,7 +279,7 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
if (openFlag == 1) {
// 门店规则1推荐门店 2附件门店
int storeType = storeRuleObj.getIntValue("store_type");
// 过滤有活码的门店
// 活码的门店
List<HmLinkStoreDTO> storeList = this.hmLinkStoreService.listByLinkId(wxEnterpriseId, enterpriseId,
linkId);
log.info("门店规则={},推荐门店列表={}", storeType, JSON.toJSONString(storeList));
......
......@@ -49,26 +49,26 @@
</foreach>
</insert>
<delete id="deleteByLinkId" parameterType="long">
<update id="deleteByLinkId" parameterType="long">
UPDATE
tab_haoban_hm_link_store SET status_flag = 0 , update_time=now() WHERE
link_id = #{linkId} and status_flag = 1
</delete>
</update>
<delete id="deleteById">
<update id="deleteById">
UPDATE
tab_haoban_hm_link_store SET status_flag = 0 , update_time=now() WHERE
id in <foreach collection="list" item="item" separator="," open="(" close=")" >
#{item}
</foreach>
and status_flag = 1
</delete>
</update>
<select id="listByLinkId"
parameterType="com.gic.haoban.manage.service.entity.hm.TabHmLinkStore"
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>
</mapper>
\ No newline at end of file
......@@ -11,11 +11,12 @@
<result column="update_time" property="updateTime" />
<result column="status_flag" property="statusFlag" />
<result column="relation_id" property="relationId" />
<result column="corpid" property="corpid"/>
</resultMap>
<sql id="Base_Column_List">
wx_config_id,
wx_qrcode,
wx_enterprise_id,
wx_enterprise_id, corpid ,
create_time,
update_time,
status_flag , relation_id
......@@ -30,7 +31,7 @@
wx_enterprise_id,
create_time,
update_time,
status_flag , relation_id
status_flag , relation_id , corpid
)VALUES(
#{id} ,
#{wxConfigId,jdbcType=VARCHAR},
......@@ -38,7 +39,7 @@
#{wxEnterpriseId,jdbcType=CHAR},
#{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP},
#{statusFlag,jdbcType=INTEGER} , #{relationId}
#{statusFlag,jdbcType=INTEGER} , #{relationId} , ${corpid}
)
]]>
</insert>
......@@ -56,10 +57,10 @@
<!-- ============ 查询============= -->
<select id="selectByRelationId" parameterType="String"
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 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>
</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