Commit eba18bf8 by songyinghui

feat: 关联详情code

parent cb2de771
......@@ -16,7 +16,7 @@ public class HmPageRelationDTO implements Serializable {
/**
* 落地页模板code
*/
private String pageTemplateCode;
private String pageCode;
/**
......@@ -34,6 +34,8 @@ public class HmPageRelationDTO implements Serializable {
*/
private String referId;
private String referCode;
/**
* 引用方名称
*/
......@@ -46,12 +48,14 @@ public class HmPageRelationDTO implements Serializable {
*/
private Integer type;
public String getPageTemplateCode() {
return pageTemplateCode;
private String releationId;
public String getPageCode() {
return pageCode;
}
public void setPageTemplateCode(String pageTemplateCode) {
this.pageTemplateCode = pageTemplateCode;
public void setPageCode(String pageCode) {
this.pageCode = pageCode;
}
public String getEnterpriseId() {
......@@ -93,4 +97,20 @@ public class HmPageRelationDTO implements Serializable {
public void setType(Integer type) {
this.type = type;
}
public String getReleationId() {
return releationId;
}
public void setReleationId(String releationId) {
this.releationId = releationId;
}
public String getReferCode() {
return referCode;
}
public void setReferCode(String referCode) {
this.referCode = referCode;
}
}
......@@ -11,23 +11,25 @@ import java.io.Serializable;
public class HmWelcomeRelationDTO implements Serializable {
private static final long serialVersionUID = 6717298152613202083L;
private Long relationId;
private String relationId;
private String referName;
private String referId;
private String referCode;
private Integer type;
private String typeText;
private Integer status;
public Long getRelationId() {
public String getRelationId() {
return relationId;
}
public void setRelationId(Long relationId) {
public void setRelationId(String relationId) {
this.relationId = relationId;
}
......@@ -70,4 +72,12 @@ public class HmWelcomeRelationDTO implements Serializable {
public void setStatus(Integer status) {
this.status = status;
}
public String getReferCode() {
return referCode;
}
public void setReferCode(String referCode) {
this.referCode = referCode;
}
}
......@@ -13,6 +13,8 @@ public class TabHaobanHmPageRelation {
private String referId;
private String referCode;
private String referName;
private Date createTime;
......@@ -102,4 +104,12 @@ public class TabHaobanHmPageRelation {
public void setStatus(Integer status) {
this.status = status;
}
public String getReferCode() {
return referCode;
}
public void setReferCode(String referCode) {
this.referCode = referCode;
}
}
\ No newline at end of file
......@@ -13,6 +13,8 @@ public class TabHaobanWelcomeTemplateRelation {
private String referId;
private String referCode;
private String referName;
private Date createTime;
......@@ -105,4 +107,12 @@ public class TabHaobanWelcomeTemplateRelation {
public void setStatus(Integer status) {
this.status = status;
}
public String getReferCode() {
return referCode;
}
public void setReferCode(String referCode) {
this.referCode = referCode;
}
}
\ No newline at end of file
......@@ -35,6 +35,8 @@ public class HmPageRelationBO implements Serializable {
*/
private String referId;
private String referCode;
/**
* 引用方名称
*/
......@@ -109,4 +111,12 @@ public class HmPageRelationBO implements Serializable {
public void setStatus(Integer status) {
this.status = status;
}
public String getReferCode() {
return referCode;
}
public void setReferCode(String referCode) {
this.referCode = referCode;
}
}
......@@ -22,6 +22,8 @@ public class HmWelcomeRelationBO implements Serializable {
private String referId;
private String referCode;
private String referName;
private Date createTime;
......@@ -114,4 +116,12 @@ public class HmWelcomeRelationBO implements Serializable {
public void setStatus(Integer status) {
this.status = status;
}
public String getReferCode() {
return referCode;
}
public void setReferCode(String referCode) {
this.referCode = referCode;
}
}
......@@ -45,6 +45,9 @@ public class HmGroupServiceImpl implements HmGroupService {
@Override
public Boolean updateGroupRelationCount(Long groupId, Integer changeCount) {
if (groupId == null){
return Boolean.TRUE;
}
TabHaobanHmGroupSetting tabHaobanHmGroupSetting = haobanHmGroupSettingMapper.selectByPrimaryKey(groupId);
if (tabHaobanHmGroupSetting == null || !HmGroupStatus.ENABLE.getCode().equals(tabHaobanHmGroupSetting.getStatus())){
return Boolean.FALSE;
......
......@@ -125,6 +125,7 @@ public class WelcomeRelationServiceImpl implements WelcomeRelationService {
welcomeTemplateRelation.setWxEnterpriseId(hmWelcomeRelationBO.getWxEnterpriseId());
welcomeTemplateRelation.setWelcomeId(hmWelcomeRelationBO.getWelcomeId());
welcomeTemplateRelation.setReferId(hmWelcomeRelationBO.getReferId());
welcomeTemplateRelation.setReferCode(hmWelcomeRelationBO.getReferCode());
welcomeTemplateRelation.setReferName(hmWelcomeRelationBO.getReferName());
welcomeTemplateRelation.setType(hmWelcomeRelationBO.getType());
welcomeTemplateRelation.setStatus(WelcomeRelationStatusEnum.ENABLE.getCode());
......
......@@ -17,6 +17,7 @@ import com.gic.haoban.manage.service.pojo.qo.HmPageRelationQO;
import com.gic.haoban.manage.service.pojo.qo.HmPageTemplateQO;
import com.gic.haoban.manage.service.service.hm.HmPageRelationService;
import com.gic.haoban.manage.service.service.hm.HmPageService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -27,6 +28,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* @Author MUSI
......@@ -120,7 +122,8 @@ public class HmPageApiServiceImpl implements HmPageApiService {
hmPageRelationQo.setPageCode(relationQueryDTO.getPageId() + "");
hmPageRelationQo.setStatus(HmPageStatus.ENABLE.getCode());
Page<HmPageRelationBO> hmPageRelationPage = pageRelationService.queryPageRelationWithSearchText(hmPageRelationQo);
return ServiceResponse.success(PageUtil.changeToCurrentPage(hmPageRelationPage, HmPageRelationDTO.class));
Page<HmPageRelationDTO> pageRelationResult = PageUtil.changeToCurrentPage(hmPageRelationPage, HmPageRelationDTO.class);
return ServiceResponse.success(pageRelationResult);
}
/**
......
......@@ -16,17 +16,21 @@ import com.gic.haoban.manage.api.dto.hm.HmQrcodeStoreDTO;
import com.gic.haoban.manage.api.dto.qdto.hm.HmClerkRelationQDTO;
import com.gic.haoban.manage.api.dto.qdto.hm.HmQrcodeListQDTO;
import com.gic.haoban.manage.api.dto.qdto.hm.HmQrcodeQDTO;
import com.gic.haoban.manage.api.enums.hm.HmWelcomeReferType;
import com.gic.haoban.manage.api.service.hm.HmQrcodeApiService;
import com.gic.haoban.manage.service.config.Config;
import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise;
import com.gic.haoban.manage.service.pojo.bo.hm.HmClerkRelationBO;
import com.gic.haoban.manage.service.pojo.bo.hm.HmQrcodeBO;
import com.gic.haoban.manage.service.pojo.bo.hm.HmWelcomeRelationBO;
import com.gic.haoban.manage.service.service.StaffClerkRelationService;
import com.gic.haoban.manage.service.service.StaffService;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.haoban.manage.service.service.hm.HmClerkRelationService;
import com.gic.haoban.manage.service.service.hm.HmGroupService;
import com.gic.haoban.manage.service.service.hm.HmQrcodeService;
import com.gic.haoban.manage.service.service.hm.WelcomeRelationService;
import com.gic.haoban.manage.service.util.QwFriendLimitCountUtil;
import com.gic.redis.data.util.RedisUtil;
import com.gic.wechat.api.dto.qywx.welcome.QywxExternalcontactDTO;
......@@ -72,6 +76,10 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
private StoreService storeService;
@Autowired
private StaffService staffService;
@Autowired
private HmGroupService groupService;
@Autowired
private WelcomeRelationService welcomeRelationService;
@Override
@Transactional(rollbackFor = Exception.class)
......@@ -108,9 +116,31 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
hmQrcodeQDTO.setWxQrcode(qywxExternalcontactResultDTO.getQr_code());
hmQrcodeQDTO.setWxConfigId(qywxExternalcontactResultDTO.getConfig_id());
}
return hmQrcodeService.insert(hmQrcodeQDTO);
int saveResult = hmQrcodeService.insert(hmQrcodeQDTO);
if (saveResult == 1){
// update group refer count
if (hmQrcodeQDTO.getHmGroupId() != null){
groupService.updateGroupRelationCount(hmQrcodeQDTO.getHmGroupId(), 1);
}
// save welcome relation
this.saveWelcomeRelation(hmQrcodeQDTO);
}
return saveResult;
}
private void saveWelcomeRelation(HmQrcodeQDTO hmQrcodeQDTO){
HmWelcomeRelationBO welcomeRelationBo = new HmWelcomeRelationBO();
welcomeRelationBo.setEnterpriseId(hmQrcodeQDTO.getEnterpriseId());
welcomeRelationBo.setWxEnterpriseId(hmQrcodeQDTO.getWxEnterpriseId());
welcomeRelationBo.setWelcomeId(hmQrcodeQDTO.getWelcomeId());
welcomeRelationBo.setReferId(hmQrcodeQDTO.getHmId()+"");
welcomeRelationBo.setReferCode(hmQrcodeQDTO.getHmCode());
welcomeRelationBo.setReferName(hmQrcodeQDTO.getName());
welcomeRelationBo.setType(HmWelcomeReferType.HM.getCode());
welcomeRelationService.saveHmWelcomeRelation(welcomeRelationBo);
}
@Override
@Transactional(rollbackFor = Exception.class)
......@@ -140,7 +170,30 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
logger.error("更新企微活码失败");
return 0;
}
return hmQrcodeService.update(hmQrcodeQDTO);
int updateResult = hmQrcodeService.update(hmQrcodeQDTO);
if (updateResult == 1){
// 更新分组引用次数
// 更新欢迎语引用次数
this.updateWelcomeRelation(hmQrcodeQDTO);
}
return updateResult;
}
/**
* 更新活码 欢迎语引用关系
* @param hmQrcodeQDTO
*/
private void updateWelcomeRelation(HmQrcodeQDTO hmQrcodeQDTO){
HmWelcomeRelationBO welcomeRelationBo = new HmWelcomeRelationBO();
welcomeRelationBo.setEnterpriseId(hmQrcodeQDTO.getEnterpriseId());
welcomeRelationBo.setWxEnterpriseId(hmQrcodeQDTO.getWxEnterpriseId());
welcomeRelationBo.setWelcomeId(hmQrcodeQDTO.getWelcomeId());
welcomeRelationBo.setReferId(hmQrcodeQDTO.getHmId()+"");
welcomeRelationBo.setReferCode(hmQrcodeQDTO.getHmCode());
welcomeRelationBo.setReferName(hmQrcodeQDTO.getName());
welcomeRelationBo.setType(HmWelcomeReferType.HM.getCode());
welcomeRelationService.updateWelcomeRelationStatus(welcomeRelationBo);
}
/**
......
......@@ -7,6 +7,7 @@
<result column="wx_enterprise_id" property="wxEnterpriseId" jdbcType="VARCHAR"/>
<result column="welcome_id" property="welcomeId" jdbcType="VARCHAR"/>
<result column="refer_id" property="referId" jdbcType="VARCHAR"/>
<result column="refer_code" property="referCode" jdbcType="VARCHAR"/>
<result column="refer_name" property="referName" jdbcType="VARCHAR"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
......@@ -16,7 +17,7 @@
<sql id="Base_Column_List">
relation_id
, enterprise_id, wx_enterprise_id, welcome_id, refer_id, refer_name, create_time,
update_time, type, status
update_time, type, status, refer_code
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">
select
......@@ -33,11 +34,11 @@
insert into tab_haoban_welcome_template_relation (relation_id, enterprise_id, wx_enterprise_id,
welcome_id, refer_id, refer_name,
create_time, update_time, type,
status)
status, refer_code)
values (#{relationId,jdbcType=BIGINT}, #{enterpriseId,jdbcType=VARCHAR}, #{wxEnterpriseId,jdbcType=VARCHAR},
#{welcomeId,jdbcType=VARCHAR}, #{referId,jdbcType=VARCHAR}, #{referName,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{type,jdbcType=INTEGER},
#{status,jdbcType=INTEGER})
#{status,jdbcType=INTEGER}, #{referCode,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective"
parameterType="com.gic.haoban.manage.service.entity.hm.TabHaobanWelcomeTemplateRelation">
......@@ -58,6 +59,9 @@
<if test="referId != null">
refer_id,
</if>
<if test="referCode != null">
refer_code,
</if>
<if test="referName != null">
refer_name,
</if>
......@@ -90,6 +94,9 @@
<if test="referId != null">
#{referId,jdbcType=VARCHAR},
</if>
<if test="referCode != null">
#{referCode,jdbcType=VARCHAR},
</if>
<if test="referName != null">
#{referName,jdbcType=VARCHAR},
</if>
......@@ -123,6 +130,9 @@
<if test="referId != null">
refer_id = #{referId,jdbcType=VARCHAR},
</if>
<if test="referCode != null">
refer_code = #{referCode,jdbcType=VARCHAR},
</if>
<if test="referName != null">
refer_name = #{referName,jdbcType=VARCHAR},
</if>
......@@ -148,6 +158,7 @@
wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
welcome_id = #{welcomeId,jdbcType=VARCHAR},
refer_id = #{referId,jdbcType=VARCHAR},
refer_code = #{referCode,jdbcType=VARCHAR},
refer_name = #{referName,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
......
......@@ -7,6 +7,7 @@
<result column="enterprise_id" property="enterpriseId" jdbcType="VARCHAR"/>
<result column="wx_enterprise_id" property="wxEnterpriseId" jdbcType="VARCHAR"/>
<result column="refer_id" property="referId" jdbcType="VARCHAR"/>
<result column="refer_code" property="referCode" jdbcType="VARCHAR"/>
<result column="refer_name" property="referName" jdbcType="VARCHAR"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
......@@ -16,7 +17,7 @@
<sql id="Base_Column_List">
relation_id
, page_code, enterprise_id, wx_enterprise_id, refer_id, refer_name,
create_time, update_time, type, status
create_time, update_time, type, status, refer_code
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">
select
......@@ -33,11 +34,11 @@
insert into tab_haoban_hm_page_relation (relation_id, page_code, enterprise_id,
wx_enterprise_id, refer_id, refer_name,
create_time, update_time, type,
status)
status, refer_code)
values (#{relationId,jdbcType=BIGINT}, #{pageCode,jdbcType=VARCHAR}, #{enterpriseId,jdbcType=VARCHAR},
#{wxEnterpriseId,jdbcType=VARCHAR}, #{referId,jdbcType=VARCHAR}, #{referName,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{type,jdbcType=INTEGER},
#{status,jdbcType=INTEGER})
#{status,jdbcType=INTEGER}, #{referCode,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.hm.TabHaobanHmPageRelation">
insert into tab_haoban_hm_page_relation
......@@ -57,6 +58,9 @@
<if test="referId != null">
refer_id,
</if>
<if test="referCode != null">
refer_code,
</if>
<if test="referName != null">
refer_name,
</if>
......@@ -89,6 +93,9 @@
<if test="referId != null">
#{referId,jdbcType=VARCHAR},
</if>
<if test="referCode != null">
#{referCode,jdbcType=VARCHAR},
</if>
<if test="referName != null">
#{referName,jdbcType=VARCHAR},
</if>
......@@ -122,6 +129,9 @@
<if test="referId != null">
refer_id = #{referId,jdbcType=VARCHAR},
</if>
<if test="referCode != null">
refer_code = #{referCode,jdbcType=VARCHAR},
</if>
<if test="referName != null">
refer_name = #{referName,jdbcType=VARCHAR},
</if>
......@@ -146,6 +156,7 @@
enterprise_id = #{enterpriseId,jdbcType=VARCHAR},
wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
refer_id = #{referId,jdbcType=VARCHAR},
refer_code = #{referCode,jdbcType=VARCHAR},
refer_name = #{referName,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
......
......@@ -183,7 +183,7 @@ public class HmPageController {
pageRelationQueryDTO.setPageNum(pageRelationVO.getPageNum());
pageRelationQueryDTO.setPageSize(pageRelationVO.getPageSize());
pageRelationQueryDTO.setSearchText(pageRelationVO.getSearchContent());
pageRelationQueryDTO.setPageId(pageRelationQueryDTO.getPageId());
pageRelationQueryDTO.setPageId(pageRelationVO.getPageId());
ServiceResponse<Page<HmPageRelationDTO>> serviceResponse = pageApiService.queryPageRelation(pageRelationQueryDTO);
PageResult2 pageInfo = PageUtil.getPageInfo(serviceResponse.getResult());
return RestResponse.successResult(pageInfo);
......
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