Commit 734e0a86 by 墨竹

fix:默认返回模板

parent 2301b10a
...@@ -11,10 +11,12 @@ import com.gic.haoban.manage.service.dao.mapper.ApplicationMapper; ...@@ -11,10 +11,12 @@ import com.gic.haoban.manage.service.dao.mapper.ApplicationMapper;
import com.gic.haoban.manage.service.entity.TabHaobanApplication; import com.gic.haoban.manage.service.entity.TabHaobanApplication;
import com.gic.haoban.manage.service.entity.TabHaobanTemplateApplicationRelated; import com.gic.haoban.manage.service.entity.TabHaobanTemplateApplicationRelated;
import com.gic.haoban.manage.service.service.*; import com.gic.haoban.manage.service.service.*;
import org.apache.commons.lang3.StringUtils;
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 java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -22,71 +24,77 @@ import java.util.stream.Collectors; ...@@ -22,71 +24,77 @@ import java.util.stream.Collectors;
@Service @Service
public class ApplicationApiServiceImpl implements ApplicationApiService { public class ApplicationApiServiceImpl implements ApplicationApiService {
@Autowired @Autowired
private ApplicationService applicationService; private ApplicationService applicationService;
@Autowired @Autowired
private ApplicationMapper applicationMapper; private ApplicationMapper applicationMapper;
@Autowired @Autowired
private TemplateEnterpriseRelatedService templateEnterpriseRelatedService; private TemplateEnterpriseRelatedService templateEnterpriseRelatedService;
@Autowired @Autowired
private TemplateApplicationRelatedService templateApplicationRelatedService; private TemplateApplicationRelatedService templateApplicationRelatedService;
@Autowired @Autowired
private ApplicationTemplateService applicationTemplateService; private ApplicationTemplateService applicationTemplateService;
@Autowired @Autowired
private WxEnterpriseService wxEnterpriseService; private WxEnterpriseService wxEnterpriseService;
@Override
public List<ApplicationDTO> listApplication() {
List<TabHaobanApplication> list = applicationService.listApplication();
return EntityUtil.changeEntityListByJSON(ApplicationDTO.class, list);
}
@Override @Override
public List<ApplicationDTO> listByApplications(List<String> applicationIds) { public List<ApplicationDTO> listApplication() {
List<TabHaobanApplication> list = applicationMapper.listByApplicationIds(applicationIds); List<TabHaobanApplication> list = applicationService.listApplication();
if(CollectionUtil.isEmpty(list)){ return EntityUtil.changeEntityListByJSON(ApplicationDTO.class, list);
return null; }
}
List<ApplicationDTO> result = EntityUtil.changeEntityListByJSON(ApplicationDTO.class, list);
return result;
}
@Override @Override
public List<ApplicationDTO> listApplicationByWxEnterpriseId(String wxEnterpriseId) { public List<ApplicationDTO> listByApplications(List<String> applicationIds) {
List<TabHaobanApplication> list = applicationService.listApplication(); List<TabHaobanApplication> list = applicationMapper.listByApplicationIds(applicationIds);
TemplateEnterpriseRelatedDTO template = templateEnterpriseRelatedService.selectByWxEnterpriseId(wxEnterpriseId); if (CollectionUtil.isEmpty(list)) {
if(template == null){ return null;
return Collections.EMPTY_LIST; }
} List<ApplicationDTO> result = EntityUtil.changeEntityListByJSON(ApplicationDTO.class, list);
List<TabHaobanTemplateApplicationRelated> applicatinList = templateApplicationRelatedService.listByTemplateId(template.getApplicationTemplateId()); return result;
}
List<String> applicationIds = applicatinList.stream().map(s->s.getApplicationId()).collect(Collectors.toList());
List<TabHaobanApplication> result = new ArrayList<TabHaobanApplication>();
for (TabHaobanApplication tabHaobanApplication : list) {
if(applicationIds.contains(tabHaobanApplication.getApplicationId())){
result.add(tabHaobanApplication);
}
}
return EntityUtil.changeEntityListByJSON(ApplicationDTO.class, result);
}
@Override @Override
public void insertApplicationRelation(String wxEnterpriseId) { public List<ApplicationDTO> listApplicationByWxEnterpriseId(String wxEnterpriseId) {
TemplateEnterpriseRelatedDTO dto = templateEnterpriseRelatedService.selectByWxEnterpriseId(wxEnterpriseId); List<TabHaobanApplication> list = applicationService.listApplication();
if(dto == null){ List<String> applicationIds = new ArrayList<>();
ApplicationTemplateDTO defaultTemplate = applicationTemplateService.selectDefaultTemplate(); //-1默认模版
if(defaultTemplate != null){ if ("-1".equals(wxEnterpriseId) || StringUtils.isBlank(wxEnterpriseId)) {
dto = new TemplateEnterpriseRelatedDTO(); applicationIds = Arrays.asList("11112", "11113", "11116", "11117", "11118");
dto.setApplicationTemplateId(defaultTemplate.getApplicationTemplateId()); } else {
dto.setWxEnterpriseId(wxEnterpriseId); TemplateEnterpriseRelatedDTO template = templateEnterpriseRelatedService.selectByWxEnterpriseId(wxEnterpriseId);
WxEnterpriseDTO enterprise = wxEnterpriseService.selectById(wxEnterpriseId); if (template == null) {
if(enterprise != null){ return Collections.EMPTY_LIST;
dto.setWxEnterpriseName(enterprise.getCorpName()); }
} List<TabHaobanTemplateApplicationRelated> applicatinList = templateApplicationRelatedService.listByTemplateId(template.getApplicationTemplateId());
templateEnterpriseRelatedService.insert(dto); applicationIds = applicatinList.stream().map(TabHaobanTemplateApplicationRelated::getApplicationId).collect(Collectors.toList());
} }
}
} List<TabHaobanApplication> result = new ArrayList<TabHaobanApplication>();
for (TabHaobanApplication tabHaobanApplication : list) {
if (applicationIds.contains(tabHaobanApplication.getApplicationId())) {
result.add(tabHaobanApplication);
}
}
return EntityUtil.changeEntityListByJSON(ApplicationDTO.class, result);
}
@Override
public void insertApplicationRelation(String wxEnterpriseId) {
TemplateEnterpriseRelatedDTO dto = templateEnterpriseRelatedService.selectByWxEnterpriseId(wxEnterpriseId);
if (dto == null) {
ApplicationTemplateDTO defaultTemplate = applicationTemplateService.selectDefaultTemplate();
if (defaultTemplate != null) {
dto = new TemplateEnterpriseRelatedDTO();
dto.setApplicationTemplateId(defaultTemplate.getApplicationTemplateId());
dto.setWxEnterpriseId(wxEnterpriseId);
WxEnterpriseDTO enterprise = wxEnterpriseService.selectById(wxEnterpriseId);
if (enterprise != null) {
dto.setWxEnterpriseName(enterprise.getCorpName());
}
templateEnterpriseRelatedService.insert(dto);
}
}
}
} }
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.gic.haoban.manage.service.dao.mapper.TabHaobanTemplateEnterpriseRelationMapper" > <mapper namespace="com.gic.haoban.manage.service.dao.mapper.TabHaobanTemplateEnterpriseRelationMapper">
<resultMap id="BaseResultMap" type="com.gic.haoban.manage.service.entity.TabHaobanTemplateEnterpriseRelation" > <resultMap id="BaseResultMap" type="com.gic.haoban.manage.service.entity.TabHaobanTemplateEnterpriseRelation">
<id column="template_enterprise_relation_id" property="templateEnterpriseRelationId" jdbcType="VARCHAR" /> <id column="template_enterprise_relation_id" property="templateEnterpriseRelationId" jdbcType="VARCHAR"/>
<result column="wx_enterprise_id" property="wxEnterpriseId" jdbcType="VARCHAR" /> <result column="wx_enterprise_id" property="wxEnterpriseId" jdbcType="VARCHAR"/>
<result column="wx_enterprise_name" property="wxEnterpriseName" jdbcType="VARCHAR" /> <result column="wx_enterprise_name" property="wxEnterpriseName" jdbcType="VARCHAR"/>
<result column="application_template_id" property="applicationTemplateId" jdbcType="VARCHAR" /> <result column="application_template_id" property="applicationTemplateId" jdbcType="VARCHAR"/>
<result column="status_flag" property="statusFlag" jdbcType="INTEGER" /> <result column="status_flag" property="statusFlag" jdbcType="INTEGER"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" /> <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" /> <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
</resultMap> </resultMap>
<sql id="Base_Column_List" > <sql id="Base_Column_List">
template_enterprise_relation_id, wx_enterprise_id, application_template_id, status_flag,wx_enterprise_name, template_enterprise_relation_id, wx_enterprise_id, application_template_id, status_flag,wx_enterprise_name,
create_time, update_time create_time, update_time
</sql> </sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" > <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String">
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List"/>
from tab_haoban_template_enterprise_relation from tab_haoban_template_enterprise_relation
where template_enterprise_relation_id = #{templateEnterpriseRelationId,jdbcType=VARCHAR} where template_enterprise_relation_id = #{templateEnterpriseRelationId,jdbcType=VARCHAR}
</select> </select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String" > <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from tab_haoban_template_enterprise_relation delete
where template_enterprise_relation_id = #{templateEnterpriseRelationId,jdbcType=VARCHAR} from tab_haoban_template_enterprise_relation
</delete> where template_enterprise_relation_id = #{templateEnterpriseRelationId,jdbcType=VARCHAR}
<insert id="insert" parameterType="com.gic.haoban.manage.service.entity.TabHaobanTemplateEnterpriseRelation" > </delete>
insert into tab_haoban_template_enterprise_relation (template_enterprise_relation_id, wx_enterprise_id, <insert id="insert" parameterType="com.gic.haoban.manage.service.entity.TabHaobanTemplateEnterpriseRelation">
application_template_id, status_flag, create_time, insert into tab_haoban_template_enterprise_relation (template_enterprise_relation_id, wx_enterprise_id,
update_time,wx_enterprise_name) application_template_id, status_flag, create_time,
values (#{templateEnterpriseRelationId,jdbcType=VARCHAR}, #{wxEnterpriseId,jdbcType=VARCHAR}, update_time, wx_enterprise_name)
#{applicationTemplateId,jdbcType=VARCHAR}, #{statusFlag,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, values (#{templateEnterpriseRelationId,jdbcType=VARCHAR}, #{wxEnterpriseId,jdbcType=VARCHAR},
#{updateTime,jdbcType=TIMESTAMP},#{wxEnterpriseName,jdbcType=VARCHAR}) #{applicationTemplateId,jdbcType=VARCHAR}, #{statusFlag,jdbcType=INTEGER},
</insert> #{createTime,jdbcType=TIMESTAMP},
<insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanTemplateEnterpriseRelation" > #{updateTime,jdbcType=TIMESTAMP}, #{wxEnterpriseName,jdbcType=VARCHAR})
insert into tab_haoban_template_enterprise_relation </insert>
<trim prefix="(" suffix=")" suffixOverrides="," > <insert id="insertSelective"
<if test="templateEnterpriseRelationId != null" > parameterType="com.gic.haoban.manage.service.entity.TabHaobanTemplateEnterpriseRelation">
template_enterprise_relation_id, insert into tab_haoban_template_enterprise_relation
</if> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="wxEnterpriseId != null" > <if test="templateEnterpriseRelationId != null">
wx_enterprise_id, template_enterprise_relation_id,
</if> </if>
<if test="wxEnterpriseName != null" > <if test="wxEnterpriseId != null">
wx_enterprise_name, wx_enterprise_id,
</if> </if>
<if test="applicationTemplateId != null" > <if test="wxEnterpriseName != null">
application_template_id, wx_enterprise_name,
</if> </if>
<if test="statusFlag != null" > <if test="applicationTemplateId != null">
status_flag, application_template_id,
</if> </if>
<if test="createTime != null" > <if test="statusFlag != null">
create_time, status_flag,
</if> </if>
<if test="updateTime != null" > <if test="createTime != null">
update_time, create_time,
</if> </if>
</trim> <if test="updateTime != null">
<trim prefix="values (" suffix=")" suffixOverrides="," > update_time,
<if test="templateEnterpriseRelationId != null" > </if>
#{templateEnterpriseRelationId,jdbcType=VARCHAR}, </trim>
</if> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="wxEnterpriseId != null" > <if test="templateEnterpriseRelationId != null">
#{wxEnterpriseId,jdbcType=VARCHAR}, #{templateEnterpriseRelationId,jdbcType=VARCHAR},
</if> </if>
<if test="wxEnterpriseName != null" > <if test="wxEnterpriseId != null">
#{wxEnterpriseName,jdbcType=VARCHAR}, #{wxEnterpriseId,jdbcType=VARCHAR},
</if> </if>
<if test="applicationTemplateId != null" > <if test="wxEnterpriseName != null">
#{applicationTemplateId,jdbcType=VARCHAR}, #{wxEnterpriseName,jdbcType=VARCHAR},
</if> </if>
<if test="statusFlag != null" > <if test="applicationTemplateId != null">
#{statusFlag,jdbcType=INTEGER}, #{applicationTemplateId,jdbcType=VARCHAR},
</if> </if>
<if test="createTime != null" > <if test="statusFlag != null">
#{createTime,jdbcType=TIMESTAMP}, #{statusFlag,jdbcType=INTEGER},
</if> </if>
<if test="updateTime != null" > <if test="createTime != null">
#{updateTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP},
</if> </if>
</trim> <if test="updateTime != null">
</insert> #{updateTime,jdbcType=TIMESTAMP},
<update id="updateByPrimaryKeySelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanTemplateEnterpriseRelation" > </if>
update tab_haoban_template_enterprise_relation </trim>
<set > </insert>
<if test="wxEnterpriseId != null" > <update id="updateByPrimaryKeySelective"
wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}, parameterType="com.gic.haoban.manage.service.entity.TabHaobanTemplateEnterpriseRelation">
</if> update tab_haoban_template_enterprise_relation
<if test="wxEnterpriseName != null" > <set>
wx_enterprise_name = #{wxEnterpriseName,jdbcType=VARCHAR}, <if test="wxEnterpriseId != null">
</if> wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
<if test="applicationTemplateId != null" > </if>
application_template_id = #{applicationTemplateId,jdbcType=VARCHAR}, <if test="wxEnterpriseName != null">
</if> wx_enterprise_name = #{wxEnterpriseName,jdbcType=VARCHAR},
<if test="statusFlag != null" > </if>
status_flag = #{statusFlag,jdbcType=INTEGER}, <if test="applicationTemplateId != null">
</if> application_template_id = #{applicationTemplateId,jdbcType=VARCHAR},
<if test="createTime != null" > </if>
create_time = #{createTime,jdbcType=TIMESTAMP}, <if test="statusFlag != null">
</if> status_flag = #{statusFlag,jdbcType=INTEGER},
<if test="updateTime != null" > </if>
update_time = #{updateTime,jdbcType=TIMESTAMP}, <if test="createTime != null">
</if> create_time = #{createTime,jdbcType=TIMESTAMP},
</set> </if>
where template_enterprise_relation_id = #{templateEnterpriseRelationId,jdbcType=VARCHAR} <if test="updateTime != null">
</update> update_time = #{updateTime,jdbcType=TIMESTAMP},
<update id="updateByPrimaryKey" parameterType="com.gic.haoban.manage.service.entity.TabHaobanTemplateEnterpriseRelation" > </if>
update tab_haoban_template_enterprise_relation </set>
set wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}, where template_enterprise_relation_id = #{templateEnterpriseRelationId,jdbcType=VARCHAR}
wx_enterprise_name = #{wxEnterpriseName,jdbcType=VARCHAR}, </update>
application_template_id = #{applicationTemplateId,jdbcType=VARCHAR}, <update id="updateByPrimaryKey"
status_flag = #{statusFlag,jdbcType=INTEGER}, parameterType="com.gic.haoban.manage.service.entity.TabHaobanTemplateEnterpriseRelation">
create_time = #{createTime,jdbcType=TIMESTAMP}, update tab_haoban_template_enterprise_relation
update_time = #{updateTime,jdbcType=TIMESTAMP} set wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
where template_enterprise_relation_id = #{templateEnterpriseRelationId,jdbcType=VARCHAR} wx_enterprise_name = #{wxEnterpriseName,jdbcType=VARCHAR},
</update> application_template_id = #{applicationTemplateId,jdbcType=VARCHAR},
status_flag = #{statusFlag,jdbcType=INTEGER},
<select id="listEnterpriseByTemplateId" resultMap="BaseResultMap" parameterType="java.lang.String" > create_time = #{createTime,jdbcType=TIMESTAMP},
select update_time = #{updateTime,jdbcType=TIMESTAMP}
<include refid="Base_Column_List" /> where template_enterprise_relation_id = #{templateEnterpriseRelationId,jdbcType=VARCHAR}
from tab_haoban_template_enterprise_relation </update>
where application_template_id = #{templateId,jdbcType=VARCHAR}
and status_flag = 1 <select id="listEnterpriseByTemplateId" resultMap="BaseResultMap" parameterType="java.lang.String">
</select> select
<include refid="Base_Column_List"/>
<select id="selectByWxEnterpriseId" resultMap="BaseResultMap" parameterType="java.lang.String" > from tab_haoban_template_enterprise_relation
select where application_template_id = #{templateId,jdbcType=VARCHAR}
<include refid="Base_Column_List" /> and status_flag = 1
from tab_haoban_template_enterprise_relation </select>
where wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
and status_flag = 1 <select id="selectByWxEnterpriseId" resultMap="BaseResultMap" parameterType="java.lang.String">
</select> select
<include refid="Base_Column_List"/>
<select id="listEnterpriseByParams" resultMap="BaseResultMap" parameterType="java.lang.String" > from tab_haoban_template_enterprise_relation
select where wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
<include refid="Base_Column_List" /> and status_flag = 1
from tab_haoban_template_enterprise_relation </select>
where application_template_id = #{applicationTemplateId,jdbcType=VARCHAR}
and status_flag = 1 <select id="listEnterpriseByParams" resultMap="BaseResultMap" parameterType="java.lang.String">
<if test="wxEnterpriseName != null and wxEnterpriseName != ''"> select
and wx_enterprise_name like CONCAT('%',#{wxEnterpriseName},'%') <include refid="Base_Column_List"/>
</if> from tab_haoban_template_enterprise_relation
<if test="wxEnterpriseIds != null and wxEnterpriseIds.size() > 0"> where application_template_id = #{applicationTemplateId,jdbcType=VARCHAR}
and wx_enterprise_id IN and status_flag = 1
<foreach collection="wxEnterpriseIds" item="id" index="index" open="(" close=")" separator=","> <if test="wxEnterpriseName != null and wxEnterpriseName != ''">
#{id,jdbcType=VARCHAR} and wx_enterprise_name like CONCAT('%',#{wxEnterpriseName},'%')
</foreach> </if>
</if> <if test="wxEnterpriseIds != null and wxEnterpriseIds.size() > 0">
</select> and wx_enterprise_id IN
<foreach collection="wxEnterpriseIds" item="id" index="index" open="(" close=")" separator=",">
#{id,jdbcType=VARCHAR}
</foreach>
</if>
</select>
</mapper> </mapper>
\ No newline at end of file
package com.gic.haoban.manage.web.controller; package com.gic.haoban.manage.web.controller;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
import com.gic.haoban.common.utils.StringUtil;
import com.gic.haoban.manage.web.vo.SdkVersionLimitVo;
import com.gic.redis.data.util.RedisUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import com.gic.haoban.common.utils.HaobanResponse; import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.ApplicationDTO; import com.gic.haoban.manage.api.dto.ApplicationDTO;
import com.gic.haoban.manage.api.dto.ApplicationSettingDTO; import com.gic.haoban.manage.api.dto.ApplicationSettingDTO;
import com.gic.haoban.manage.api.service.ApplicationApiService; import com.gic.haoban.manage.api.service.ApplicationApiService;
import com.gic.haoban.manage.api.service.ApplicationSettingApiService; import com.gic.haoban.manage.api.service.ApplicationSettingApiService;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode; import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.vo.SdkVersionLimitVo;
import com.gic.redis.data.util.RedisUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
@RestController @RestController
public class ApplicationController extends WebBaseController{ public class ApplicationController extends WebBaseController {
@Autowired @Autowired
private ApplicationApiService applicationApiService; private ApplicationApiService applicationApiService;
@Autowired @Autowired
private ApplicationSettingApiService applicationSettingApiService; private ApplicationSettingApiService applicationSettingApiService;
private static final String SDKVERSION_KEY = "haoban-wx-sdk-version"; private static final String SDKVERSION_KEY = "haoban-wx-sdk-version";
@RequestMapping("application-list") @RequestMapping("application-list")
public HaobanResponse applicationList(String wxEnterpriseId) { public HaobanResponse applicationList(String wxEnterpriseId) {
List<ApplicationDTO> list = applicationApiService.listApplicationByWxEnterpriseId(wxEnterpriseId);
List<ApplicationDTO> list = applicationApiService.listApplicationByWxEnterpriseId(wxEnterpriseId); List<String> applicationIds = list.stream().map(s -> s.getApplicationId()).collect(Collectors.toList());
List<ApplicationSettingDTO> settings = applicationSettingApiService.listOpenByWxEnterpriseIdAndApplicationIds(wxEnterpriseId, applicationIds);
List<String> applicationIds = list.stream().map(s->s.getApplicationId()).collect(Collectors.toList()); List<String> openApplicationIds = new ArrayList<String>();
List<ApplicationSettingDTO> settings = applicationSettingApiService.listOpenByWxEnterpriseIdAndApplicationIds(wxEnterpriseId, applicationIds); if (CollectionUtil.isNotEmpty(settings)) {
List<String> openApplicationIds = new ArrayList<String>(); openApplicationIds = settings.stream().map(s -> s.getApplicationId()).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(settings)){ }
openApplicationIds = settings.stream().map(s->s.getApplicationId()).collect(Collectors.toList()); Iterator<ApplicationDTO> it = list.listIterator();
} while (it.hasNext()) {
Iterator<ApplicationDTO> it = list.listIterator(); ApplicationDTO app = it.next();
while(it.hasNext()){ if (!openApplicationIds.contains(app.getApplicationId())) {
ApplicationDTO app = it.next(); it.remove();
if(!openApplicationIds.contains(app.getApplicationId())){ continue;
it.remove(); }
continue ; if ("通讯录".equals(app.getApplicationName())) {
} it.remove();
if("通讯录".equals(app.getApplicationName())){ continue;
it.remove(); }
continue ; if ("卡券赠送".equals(app.getApplicationName())) {
} it.remove();
if("卡券赠送".equals(app.getApplicationName())){ continue;
it.remove(); }
continue ; if ("内购券".equals(app.getApplicationName())) {
} it.remove();
if("内购券".equals(app.getApplicationName())){ continue;
it.remove(); }
continue ; }
}
} return resultResponse(HaoBanErrCode.ERR_1, list);
return resultResponse(HaoBanErrCode.ERR_1,list); }
}
@RequestMapping("sdk-version-check") @RequestMapping("sdk-version-check")
public HaobanResponse sdkVersionCheck(String skdVersion) { public HaobanResponse sdkVersionCheck(String skdVersion) {
...@@ -85,8 +78,8 @@ public class ApplicationController extends WebBaseController{ ...@@ -85,8 +78,8 @@ public class ApplicationController extends WebBaseController{
String limitSdkVersion = cache.toString(); String limitSdkVersion = cache.toString();
sdkVersionLimitVo.setLimitSdkVersion(limitSdkVersion); sdkVersionLimitVo.setLimitSdkVersion(limitSdkVersion);
String[] limitSdk = StringUtils.split(limitSdkVersion, "."); String[] limitSdk = StringUtils.split(limitSdkVersion, ".");
String[] versionSplit = StringUtils.split(skdVersion, "."); String[] versionSplit = StringUtils.split(skdVersion, ".");
int checkFlag = checkNum(Integer.valueOf(limitSdk[0]), Integer.valueOf(versionSplit[0])); int checkFlag = checkNum(Integer.valueOf(limitSdk[0]), Integer.valueOf(versionSplit[0]));
if (checkFlag != 0) { if (checkFlag != 0) {
......
...@@ -198,7 +198,7 @@ public class WxEnterpriseInfoController extends WebBaseController { ...@@ -198,7 +198,7 @@ public class WxEnterpriseInfoController extends WebBaseController {
String wxOpenUseId = staffLoginQO.getWxOpenUseId(); String wxOpenUseId = staffLoginQO.getWxOpenUseId();
//-1 代表游客登录 //-1 代表游客登录
if ("-1".equals(staffId) || StringUtils.isBlank(staffId)) { if ("-1".equals(staffId) || StringUtils.isBlank(staffId)) {
return wellDoneLoginPrivacy(staffLoginQO, request, staffId, wxOpenUseId); return wellDoneTouristsLogin(staffLoginQO, request, staffId, wxOpenUseId);
} }
//用户登录 //用户登录
return wellDoneLogin(staffLoginQO, request, staffId); return wellDoneLogin(staffLoginQO, request, staffId);
...@@ -212,7 +212,7 @@ public class WxEnterpriseInfoController extends WebBaseController { ...@@ -212,7 +212,7 @@ public class WxEnterpriseInfoController extends WebBaseController {
* @param wxOpenUseId * @param wxOpenUseId
* @return * @return
*/ */
private RestResponse<String> wellDoneLoginPrivacy(StaffLoginQO staffLoginQO, HttpServletRequest request, String staffId, String wxOpenUseId) { private RestResponse<String> wellDoneTouristsLogin(StaffLoginQO staffLoginQO, HttpServletRequest request, String staffId, String wxOpenUseId) {
logger.info("游客登录,wxOpenUseId:{}", wxOpenUseId); logger.info("游客登录,wxOpenUseId:{}", wxOpenUseId);
//登录和刷新token兼容 //登录和刷新token兼容
String headerToken = AuthRequestWellDoneUtil.getHeaderToken(); String headerToken = AuthRequestWellDoneUtil.getHeaderToken();
......
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