Commit a86c85db by 徐高华

链接

parent 08dd04f4
......@@ -60,4 +60,7 @@ public interface HmLinkMapper {
@Param("enterpriseId") String enterpriseId, @Param("startDate") Date startDate,
@Param("endDate") Date endDate, @Param("linkType") Integer linkType,
@Param("searchParams") String searchParams);
public List<TabHmLink> queryPageRelationList(@Param("pageId") Long pageId,
@Param("enterpriseId") String enterpriseId);
}
\ No newline at end of file
......@@ -11,11 +11,11 @@ import com.gic.haoban.manage.service.pojo.bo.hm.HmLinkBO;
public interface HmLinkService {
public HmLinkBO getByLinkId(String wxEnterpriseId, String enterprieId,Long linkId);
public HmLinkBO getByLinkId(String wxEnterpriseId, String enterprieId, Long linkId);
public HmLinkBO getByLinkShortCode(String shortCode);
public HmLinkBO getByLinkIdFormCache(String wxEnterpriseId, String enterprieId,Long linkId);
public HmLinkBO getByLinkIdFormCache(String wxEnterpriseId, String enterprieId, Long linkId);
public List<HmLinkBO> listForSms(String wxEnterpriseId, String enterprieId, String linkName, Integer linkType);
......@@ -23,4 +23,6 @@ public interface HmLinkService {
public Page<HmLinkBO> listPage(HmLinkSearchQDTO qdto, BasePageInfo basePageInfo);
public Page<HmLinkBO> queryPageRelationList(Long pageId, String enterpriseId, BasePageInfo basePageInfo);
}
......@@ -19,11 +19,14 @@ import com.gic.commons.util.UniqueIdUtils;
import com.gic.haoban.manage.api.dto.hm.HmLinkDTO;
import com.gic.haoban.manage.api.dto.hm.HmLinkStoreDTO;
import com.gic.haoban.manage.api.dto.qdto.hm.HmLinkSearchQDTO;
import com.gic.haoban.manage.api.enums.hm.HmWelcomeReferType;
import com.gic.haoban.manage.service.dao.mapper.hm.HmLinkMapper;
import com.gic.haoban.manage.service.entity.hm.TabHmLink;
import com.gic.haoban.manage.service.pojo.bo.hm.HmLinkBO;
import com.gic.haoban.manage.service.pojo.bo.hm.HmWelcomeRelationBO;
import com.gic.haoban.manage.service.service.hm.HmLinkService;
import com.gic.haoban.manage.service.service.hm.HmLinkStoreService;
import com.gic.haoban.manage.service.service.hm.WelcomeRelationService;
import com.gic.redis.data.util.RedisUtil;
import com.github.pagehelper.PageHelper;
......@@ -41,6 +44,8 @@ public class HmLinkServiceImpl implements HmLinkService {
private HmLinkMapper linkMapper;
@Autowired
private HmLinkStoreService hmLinkStoreService;
@Autowired
private WelcomeRelationService welcomeRelationService;
@Override
public HmLinkBO getByLinkId(String wxEnterpriseId, String enterprieId, Long linkId) {
......@@ -86,6 +91,7 @@ public class HmLinkServiceImpl implements HmLinkService {
public String saveLink(HmLinkDTO dto, List<HmLinkStoreDTO> storeList) {
// 新增
Long linkId = dto.getLinkId();
String oldWelcomeId = null;
if (null == linkId) {
linkId = UniqueIdUtils.uniqueLong();
StringBuilder sb = new StringBuilder("LJ").append("0").append(dto.getLinkType()).append(linkId);
......@@ -97,6 +103,8 @@ public class HmLinkServiceImpl implements HmLinkService {
TabHmLink entity = EntityUtil.changeEntityByJSON(TabHmLink.class, dto);
this.linkMapper.insert(entity);
} else {
TabHmLink oldLink = this.linkMapper.selectById(linkId);
oldWelcomeId = oldLink.getWelcomeId();
TabHmLink entity = EntityUtil.changeEntityByJSON(TabHmLink.class, dto);
this.linkMapper.update(entity);
}
......@@ -106,10 +114,32 @@ public class HmLinkServiceImpl implements HmLinkService {
item.setEnterpriseId(dto.getEnterpriseId());
});
}
String newWelcomeId = dto.getWelcomeId();
this.saveWelcomeRelation(oldWelcomeId, newWelcomeId, dto);
this.hmLinkStoreService.saveStore(linkId, storeList);
return dto.getLinkCode();
}
private void saveWelcomeRelation(String oldWelcomeId, String newWelcomeId, HmLinkDTO dto) {
// 如果一样就返回
if ((null == oldWelcomeId && null == newWelcomeId)
|| (null != oldWelcomeId && null != newWelcomeId && oldWelcomeId.equals(newWelcomeId))) {
return;
}
HmWelcomeRelationBO welcome = new HmWelcomeRelationBO();
welcome.setWxEnterpriseId(dto.getWxEnterpriseId());
welcome.setEnterpriseId(dto.getEnterpriseId());
welcome.setReferName(dto.getName());
welcome.setRelationId(dto.getLinkId());
welcome.setReferCode(dto.getLinkCode());
welcome.setType(HmWelcomeReferType.LINK.getCode());
// 新增
if (!(null != oldWelcomeId && newWelcomeId == null)) {
welcome.setWelcomeId(newWelcomeId);
}
this.welcomeRelationService.updateWelcomeRelation(welcome);
}
@Override
public Page<HmLinkBO> listPage(HmLinkSearchQDTO qdto, BasePageInfo basePageInfo) {
PageHelper.startPage(basePageInfo);
......@@ -123,6 +153,15 @@ public class HmLinkServiceImpl implements HmLinkService {
Page<HmLinkBO> retPage = PageHelperUtils.changePageHelperToCurrentPage(list, HmLinkBO.class);
return retPage;
}
@Override
public Page<HmLinkBO> queryPageRelationList(Long pageId, String enterpriseId, BasePageInfo basePageInfo) {
PageHelper.startPage(basePageInfo);
List<TabHmLink> list = this.linkMapper.queryPageRelationList(pageId, enterpriseId);
Page<HmLinkBO> retPage = PageHelperUtils.changePageHelperToCurrentPage(list, HmLinkBO.class);
return retPage;
}
public String shortCode(String enterpriseId) {
StringBuilder sb = new StringBuilder();
......@@ -146,6 +185,7 @@ public class HmLinkServiceImpl implements HmLinkService {
if (null == link) {
return code;
}
log.info("code重复={}", code);
return shortCode(enterpriseId);
}
......
......@@ -147,4 +147,9 @@
and status_flag = 1
</select>
<select id="queryPageRelationList" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/>
from tab_haoban_hm_link where page_id = #{pageId} and enterprise_id=#{enterpriseId}
</select>
</mapper>
\ No newline at end of file
......@@ -107,6 +107,9 @@ public class HmLinkController {
ServiceResponse<String> saveResp = this.hmLinkApiService.save(dto);
if (saveResp.isSuccess()) {
String logContent = this.getUpdateLog(oldDTO, dto);
if(StringUtils.isBlank(logContent)) {
GicLogRecordEvaluationContext.noWriteLog();
}
logger.info(logContent);
GicLogRecordEvaluationContext.putAttribute("logValue", logContent);
GicLogRecordEvaluationContext.putOptTargetId(AuthWebRequestUtil.getLoginUser().getClerkId());
......
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