Commit 3af4c9cb by 墨竹

Merge remote-tracking branch 'origin/developer' into developer

parents 11491e2b 34984a5f
...@@ -62,7 +62,7 @@ public class WelcomeRelationServiceImpl implements WelcomeRelationService { ...@@ -62,7 +62,7 @@ public class WelcomeRelationServiceImpl implements WelcomeRelationService {
public HmWelcomeRelationBO queryWelcomeRelation(String referId, Integer status) { public HmWelcomeRelationBO queryWelcomeRelation(String referId, Integer status) {
String welcomeRelationCacheKey = WELCOME_RELATION_KEY + referId; String welcomeRelationCacheKey = WELCOME_RELATION_KEY + referId;
HmWelcomeRelationBO cache = RedisUtil.getCache(welcomeRelationCacheKey, HmWelcomeRelationBO.class); HmWelcomeRelationBO cache = RedisUtil.getCache(welcomeRelationCacheKey, HmWelcomeRelationBO.class);
if (cache != null){ if (cache != null) {
return cache; return cache;
} }
List<TabHaobanWelcomeTemplateRelation> welcomeTemplateRelations = welcomeTemplateRelationMapper.queryWelTemplateRelation(null, referId, status); List<TabHaobanWelcomeTemplateRelation> welcomeTemplateRelations = welcomeTemplateRelationMapper.queryWelTemplateRelation(null, referId, status);
...@@ -133,6 +133,13 @@ public class WelcomeRelationServiceImpl implements WelcomeRelationService { ...@@ -133,6 +133,13 @@ public class WelcomeRelationServiceImpl implements WelcomeRelationService {
@Transactional(rollbackFor = RuntimeException.class) @Transactional(rollbackFor = RuntimeException.class)
public Boolean saveHmWelcomeRelation(HmWelcomeRelationBO hmWelcomeRelationBO) { public Boolean saveHmWelcomeRelation(HmWelcomeRelationBO hmWelcomeRelationBO) {
log.info("[saveHmWelcomeRelation] params:{}", JSON.toJSONString(hmWelcomeRelationBO)); log.info("[saveHmWelcomeRelation] params:{}", JSON.toJSONString(hmWelcomeRelationBO));
if (StringUtils.isAnyBlank(hmWelcomeRelationBO.getWelcomeId(), hmWelcomeRelationBO.getReferId(),
hmWelcomeRelationBO.getEnterpriseId(), hmWelcomeRelationBO.getWxEnterpriseId(), hmWelcomeRelationBO.getReferName())) {
return Boolean.FALSE;
}
if (hmWelcomeRelationBO.getType() == null) {
return Boolean.FALSE;
}
TabHaobanWelcomeTemplateRelation welcomeTemplateRelation = new TabHaobanWelcomeTemplateRelation(); TabHaobanWelcomeTemplateRelation welcomeTemplateRelation = new TabHaobanWelcomeTemplateRelation();
welcomeTemplateRelation.setRelationId(UniqueIdUtils.uniqueLong()); welcomeTemplateRelation.setRelationId(UniqueIdUtils.uniqueLong());
welcomeTemplateRelation.setEnterpriseId(hmWelcomeRelationBO.getEnterpriseId()); welcomeTemplateRelation.setEnterpriseId(hmWelcomeRelationBO.getEnterpriseId());
...@@ -152,7 +159,7 @@ public class WelcomeRelationServiceImpl implements WelcomeRelationService { ...@@ -152,7 +159,7 @@ public class WelcomeRelationServiceImpl implements WelcomeRelationService {
/** /**
* 删除关联关系 * 删除关联关系
* *
* @param hmWelcomeRelationBO * @param hmWelcomeRelationBO
* @return * @return
*/ */
@Override @Override
...@@ -162,22 +169,25 @@ public class WelcomeRelationServiceImpl implements WelcomeRelationService { ...@@ -162,22 +169,25 @@ public class WelcomeRelationServiceImpl implements WelcomeRelationService {
// 取消该referId已有的引用 // 取消该referId已有的引用
List<TabHaobanWelcomeTemplateRelation> tabHaobanWelcomeTemplateRelations = List<TabHaobanWelcomeTemplateRelation> tabHaobanWelcomeTemplateRelations =
welcomeTemplateRelationMapper.queryWelTemplateRelation(null, hmWelcomeRelationBO.getReferId(), WelcomeRelationStatusEnum.ENABLE.getCode()); welcomeTemplateRelationMapper.queryWelTemplateRelation(null, hmWelcomeRelationBO.getReferId(), WelcomeRelationStatusEnum.ENABLE.getCode());
TabHaobanWelcomeTemplateRelation welcomeTemplateRelation = tabHaobanWelcomeTemplateRelations.get(0); if (CollectionUtils.isNotEmpty(tabHaobanWelcomeTemplateRelations)) {
if (StringUtils.equals(welcomeTemplateRelation.getReferId(), hmWelcomeRelationBO.getReferId())){ TabHaobanWelcomeTemplateRelation welcomeTemplateRelation = tabHaobanWelcomeTemplateRelations.get(0);
return Boolean.TRUE; if (StringUtils.equals(welcomeTemplateRelation.getWelcomeId(), hmWelcomeRelationBO.getWelcomeId())) {
return Boolean.TRUE;
}
welcomeTemplateRelation.setUpdateTime(new Date());
welcomeTemplateRelation.setStatus(WelcomeRelationStatusEnum.DISABLE.getCode());
welcomeTemplateRelationMapper.updateByPrimaryKeySelective(welcomeTemplateRelation);
// 定义
this.removeWelcomeRelationCache(welcomeTemplateRelation.getReferId());
} }
welcomeTemplateRelation.setUpdateTime(new Date()); if (StringUtils.isNotBlank(hmWelcomeRelationBO.getWelcomeId())) {
welcomeTemplateRelation.setStatus(WelcomeRelationStatusEnum.ENABLE.getCode());
welcomeTemplateRelationMapper.updateByPrimaryKeySelective(welcomeTemplateRelation);
// 定义
this.removeWelcomeRelationCache(welcomeTemplateRelation.getReferId());
if (StringUtils.isNotBlank(welcomeTemplateRelation.getWelcomeId())) {
return this.saveHmWelcomeRelation(hmWelcomeRelationBO); return this.saveHmWelcomeRelation(hmWelcomeRelationBO);
} }
return Boolean.TRUE; return Boolean.TRUE;
} }
private void removeWelcomeRelationCache(String referId){ private void removeWelcomeRelationCache(String referId) {
String welcomeRelationCacheKey = WELCOME_RELATION_KEY + referId; String welcomeRelationCacheKey = WELCOME_RELATION_KEY + referId;
RedisUtil.delCache(welcomeRelationCacheKey); RedisUtil.delCache(welcomeRelationCacheKey);
} }
......
...@@ -142,7 +142,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService { ...@@ -142,7 +142,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
int saveResult = hmQrcodeService.insert(hmQrcodeQDTO); int saveResult = hmQrcodeService.insert(hmQrcodeQDTO);
if (saveResult == 1) { if (saveResult == 1) {
// save welcome relation // save welcome relation
this.saveWelcomeRelation(hmQrcodeQDTO); this.updateWelcomeRelation(hmQrcodeQDTO);
} }
setLoggerContext(hmQrcodeQDTO.getEnterpriseId(), wxEnterpriseId, hmQrcodeQDTO.getCreatorId(), hmQrcodeQDTO.getCreatorName()); setLoggerContext(hmQrcodeQDTO.getEnterpriseId(), wxEnterpriseId, hmQrcodeQDTO.getCreatorId(), hmQrcodeQDTO.getCreatorName());
GicLogRecordEvaluationContext.putAttribute("logContent", "【" + hmId + "-" + hmQrcodeQDTO.getName() + "】"); GicLogRecordEvaluationContext.putAttribute("logContent", "【" + hmId + "-" + hmQrcodeQDTO.getName() + "】");
......
...@@ -8,9 +8,12 @@ import com.gic.haoban.manage.api.dto.hm.HmPageDTO; ...@@ -8,9 +8,12 @@ import com.gic.haoban.manage.api.dto.hm.HmPageDTO;
import com.gic.haoban.manage.api.dto.hm.HmPageRelationDTO; import com.gic.haoban.manage.api.dto.hm.HmPageRelationDTO;
import com.gic.haoban.manage.api.dto.qdto.hm.HmPageQDTO; import com.gic.haoban.manage.api.dto.qdto.hm.HmPageQDTO;
import com.gic.haoban.manage.api.dto.qdto.hm.HmPageRelationQDTO; import com.gic.haoban.manage.api.dto.qdto.hm.HmPageRelationQDTO;
import com.gic.haoban.manage.api.enums.hm.HmWelcomeReferType;
import com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService; import com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService;
import com.gic.haoban.manage.api.service.hm.HmGroupApiService; import com.gic.haoban.manage.api.service.hm.HmGroupApiService;
import com.gic.haoban.manage.api.service.hm.HmPageApiService; import com.gic.haoban.manage.api.service.hm.HmPageApiService;
import com.gic.haoban.manage.service.pojo.bo.hm.HmWelcomeRelationBO;
import com.gic.haoban.manage.service.service.hm.WelcomeRelationService;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -69,4 +72,33 @@ public class HmPageServiceTest { ...@@ -69,4 +72,33 @@ public class HmPageServiceTest {
System.out.println(JSON.toJSONString(pageServiceResponse)); System.out.println(JSON.toJSONString(pageServiceResponse));
} }
@Autowired
private WelcomeRelationService welcomeRelationService;
@Test
public void saveWelcomeRelation(){
HmWelcomeRelationBO welcomeRelationBo = new HmWelcomeRelationBO();
welcomeRelationBo.setEnterpriseId("1231321312312");
welcomeRelationBo.setWxEnterpriseId("31312312312");
welcomeRelationBo.setReferId("313131");
welcomeRelationBo.setReferCode("HM1312312312");
welcomeRelationBo.setReferName("活码名称");
welcomeRelationBo.setType(HmWelcomeReferType.HM.getCode());
welcomeRelationService.saveHmWelcomeRelation(welcomeRelationBo);
}
@Test
public void updateWelcomeRelationTest(){
HmWelcomeRelationBO welcomeRelationBo = new HmWelcomeRelationBO();
welcomeRelationBo.setEnterpriseId("1231321312312");
welcomeRelationBo.setWxEnterpriseId("31312312312");
welcomeRelationBo.setReferId("313131");
welcomeRelationBo.setReferCode("HM1312312dada");
welcomeRelationBo.setReferName("活码名称");
welcomeRelationBo.setType(HmWelcomeReferType.HM.getCode());
welcomeRelationService.updateWelcomeRelation(welcomeRelationBo);
}
} }
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