Commit 9e9e8faa by qwmqiuwenmin

fix

parent e9ca0c1b
...@@ -8,6 +8,8 @@ public class TemplateEnterpriseRelatedDTO implements Serializable{ ...@@ -8,6 +8,8 @@ public class TemplateEnterpriseRelatedDTO implements Serializable{
private String templateEnterpriseRelationId; private String templateEnterpriseRelationId;
private String wxEnterpriseId; private String wxEnterpriseId;
private String wxEnterpriseName;
private String applicationTemplateId; private String applicationTemplateId;
...@@ -67,4 +69,13 @@ public class TemplateEnterpriseRelatedDTO implements Serializable{ ...@@ -67,4 +69,13 @@ public class TemplateEnterpriseRelatedDTO implements Serializable{
this.updateTime = updateTime; this.updateTime = updateTime;
} }
public String getWxEnterpriseName() {
return wxEnterpriseName;
}
public void setWxEnterpriseName(String wxEnterpriseName) {
this.wxEnterpriseName = wxEnterpriseName;
}
} }
...@@ -24,7 +24,7 @@ public interface ApplicationTemplateApiService { ...@@ -24,7 +24,7 @@ public interface ApplicationTemplateApiService {
void delTemplateEnterprise(String wxEnterpriseId); void delTemplateEnterprise(String wxEnterpriseId);
List<ApplicationEnterpriseRelatedDTO> listTemplateEnterprise(String applicationTemplateId); List<ApplicationEnterpriseRelatedDTO> listTemplateEnterprise(String applicationTemplateId, String wxEnterpriseName, String enterpriseName);
void setDefaultTemplateEnterprise(String applicationTemplateId); void setDefaultTemplateEnterprise(String applicationTemplateId);
......
package com.gic.haoban.manage.service.dao.mapper; package com.gic.haoban.manage.service.dao.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import com.gic.haoban.manage.service.entity.TabHaobanTemplateEnterpriseRelation; import com.gic.haoban.manage.service.entity.TabHaobanTemplateEnterpriseRelation;
...@@ -17,7 +19,11 @@ public interface TabHaobanTemplateEnterpriseRelationMapper { ...@@ -17,7 +19,11 @@ public interface TabHaobanTemplateEnterpriseRelationMapper {
int updateByPrimaryKey(TabHaobanTemplateEnterpriseRelation record); int updateByPrimaryKey(TabHaobanTemplateEnterpriseRelation record);
TabHaobanTemplateEnterpriseRelation listEnterpriseByTemplateId(@Param("templateId")String templateId); List<TabHaobanTemplateEnterpriseRelation> listEnterpriseByTemplateId(@Param("templateId")String templateId);
TabHaobanTemplateEnterpriseRelation selectByWxEnterpriseId(@Param("wxEnterpriseId")String wxEnterpriseId); TabHaobanTemplateEnterpriseRelation selectByWxEnterpriseId(@Param("wxEnterpriseId")String wxEnterpriseId);
List<TabHaobanTemplateEnterpriseRelation> listEnterpriseByParams(@Param("applicationTemplateId")String applicationTemplateId, @Param("wxEnterpriseIds")List<String> wxEnterpriseIds,
@Param("wxEnterpriseName")String wxEnterpriseName);
} }
\ No newline at end of file
...@@ -11,6 +11,8 @@ public class TabHaobanTemplateEnterpriseRelation implements Serializable { ...@@ -11,6 +11,8 @@ public class TabHaobanTemplateEnterpriseRelation implements Serializable {
private String applicationTemplateId; private String applicationTemplateId;
private Integer statusFlag; private Integer statusFlag;
private String wxEnterpriseName;
private Date createTime; private Date createTime;
...@@ -65,4 +67,14 @@ public class TabHaobanTemplateEnterpriseRelation implements Serializable { ...@@ -65,4 +67,14 @@ public class TabHaobanTemplateEnterpriseRelation implements Serializable {
public void setUpdateTime(Date updateTime) { public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime; this.updateTime = updateTime;
} }
public String getWxEnterpriseName() {
return wxEnterpriseName;
}
public void setWxEnterpriseName(String wxEnterpriseName) {
this.wxEnterpriseName = wxEnterpriseName;
}
} }
\ No newline at end of file
...@@ -14,4 +14,6 @@ public interface TemplateEnterpriseRelatedService { ...@@ -14,4 +14,6 @@ public interface TemplateEnterpriseRelatedService {
void update(TemplateEnterpriseRelatedDTO dto); void update(TemplateEnterpriseRelatedDTO dto);
List<TemplateEnterpriseRelatedDTO> listEnterpriseByParams(String applicationTemplateId, List<String> wxEnterpriseIds, String wxEnterpriseName);
} }
...@@ -42,4 +42,10 @@ public class TemplateEnterpriseRelatedServiceImpl implements TemplateEnterpriseR ...@@ -42,4 +42,10 @@ public class TemplateEnterpriseRelatedServiceImpl implements TemplateEnterpriseR
mapper.updateByPrimaryKeySelective(EntityUtil.changeEntityByJSON(TabHaobanTemplateEnterpriseRelation.class, dto)); mapper.updateByPrimaryKeySelective(EntityUtil.changeEntityByJSON(TabHaobanTemplateEnterpriseRelation.class, dto));
} }
@Override
public List<TemplateEnterpriseRelatedDTO> listEnterpriseByParams(String applicationTemplateId, List<String> wxEnterpriseIds,
String wxEnterpriseName) {
return EntityUtil.changeEntityListByJSON(TemplateEnterpriseRelatedDTO.class, mapper.listEnterpriseByParams(applicationTemplateId,wxEnterpriseIds,wxEnterpriseName));
}
} }
package com.gic.haoban.manage.service.service.out.impl; package com.gic.haoban.manage.service.service.out.impl;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
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 org.springframework.util.StringUtils;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
import com.gic.enterprise.api.dto.EnterpriseDTO;
import com.gic.enterprise.api.service.EnterpriseService;
import com.gic.haoban.manage.api.dto.ApplicationEnterpriseRelatedDTO; import com.gic.haoban.manage.api.dto.ApplicationEnterpriseRelatedDTO;
import com.gic.haoban.manage.api.dto.ApplicationTemplateDTO; import com.gic.haoban.manage.api.dto.ApplicationTemplateDTO;
import com.gic.haoban.manage.api.dto.EnterpriseDetailDTO;
import com.gic.haoban.manage.api.dto.TemplateEnterpriseRelatedDTO; import com.gic.haoban.manage.api.dto.TemplateEnterpriseRelatedDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.service.ApplicationTemplateApiService; import com.gic.haoban.manage.api.service.ApplicationTemplateApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService;
import com.gic.haoban.manage.service.entity.TabHaobanTemplateApplicationRelated; import com.gic.haoban.manage.service.entity.TabHaobanTemplateApplicationRelated;
import com.gic.haoban.manage.service.service.ApplicationTemplateService; import com.gic.haoban.manage.service.service.ApplicationTemplateService;
import com.gic.haoban.manage.service.service.TemplateApplicationRelatedService; import com.gic.haoban.manage.service.service.TemplateApplicationRelatedService;
import com.gic.haoban.manage.service.service.TemplateEnterpriseRelatedService; import com.gic.haoban.manage.service.service.TemplateEnterpriseRelatedService;
import cn.hutool.core.collection.CollectionUtil;
@Service @Service
public class ApplicationTemplateApiServiceImpl implements ApplicationTemplateApiService { public class ApplicationTemplateApiServiceImpl implements ApplicationTemplateApiService {
...@@ -27,6 +39,15 @@ public class ApplicationTemplateApiServiceImpl implements ApplicationTemplateApi ...@@ -27,6 +39,15 @@ public class ApplicationTemplateApiServiceImpl implements ApplicationTemplateApi
@Autowired @Autowired
private TemplateApplicationRelatedService templateApplicationRelatedService; private TemplateApplicationRelatedService templateApplicationRelatedService;
@Autowired
private WxEnterpriseApiService wxEnterpriseApiService;
@Autowired
private EnterpriseService enterpriseService;
@Autowired
private WxEnterpriseRelatedApiService wxEnterpriseRelatedApiService;
@Override @Override
public ApplicationTemplateDTO selectByTemplateName(String templateName) { public ApplicationTemplateDTO selectByTemplateName(String templateName) {
return applicationTemplateService.selectByTemplateName(templateName); return applicationTemplateService.selectByTemplateName(templateName);
...@@ -84,11 +105,15 @@ public class ApplicationTemplateApiServiceImpl implements ApplicationTemplateApi ...@@ -84,11 +105,15 @@ public class ApplicationTemplateApiServiceImpl implements ApplicationTemplateApi
String[] wxEnterpriseIdArr = wxEnterpriseIds.split(","); String[] wxEnterpriseIdArr = wxEnterpriseIds.split(",");
for (String wxEnterpriseId : wxEnterpriseIdArr) { for (String wxEnterpriseId : wxEnterpriseIdArr) {
TemplateEnterpriseRelatedDTO dto = templateEnterpriseRelatedService.selectByWxEnterpriseId(wxEnterpriseId); TemplateEnterpriseRelatedDTO dto = templateEnterpriseRelatedService.selectByWxEnterpriseId(wxEnterpriseId);
if(dto == null){ if(dto != null){
continue; continue;
} }
dto = new TemplateEnterpriseRelatedDTO(); dto = new TemplateEnterpriseRelatedDTO();
dto.setWxEnterpriseId(wxEnterpriseId); dto.setWxEnterpriseId(wxEnterpriseId);
WxEnterpriseDTO enterprise = wxEnterpriseApiService.getOne(wxEnterpriseId);
if(enterprise != null){
dto.setWxEnterpriseName(enterprise.getCorpName());
}
dto.setApplicationTemplateId(applicationTemplateId); dto.setApplicationTemplateId(applicationTemplateId);
templateEnterpriseRelatedService.insert(dto); templateEnterpriseRelatedService.insert(dto);
} }
...@@ -105,8 +130,22 @@ public class ApplicationTemplateApiServiceImpl implements ApplicationTemplateApi ...@@ -105,8 +130,22 @@ public class ApplicationTemplateApiServiceImpl implements ApplicationTemplateApi
} }
@Override @Override
public List<ApplicationEnterpriseRelatedDTO> listTemplateEnterprise(String applicationTemplateId) { public List<ApplicationEnterpriseRelatedDTO> listTemplateEnterprise(String applicationTemplateId, String wxEnterpriseName, String enterpriseName) {
return EntityUtil.changeEntityListByJSON(ApplicationEnterpriseRelatedDTO.class, templateEnterpriseRelatedService.listEnterpriseByTemplateId(applicationTemplateId)); List<String> wxEnterpriseIds = new ArrayList<String>();
if(!StringUtils.isEmpty(enterpriseName)){
List<EnterpriseDTO> enterpriseNames = enterpriseService.getEnterpriseByName(enterpriseName);
if(CollectionUtil.isNotEmpty(enterpriseNames)){
List<String>enterpriseIds = enterpriseNames.stream().map(s->s.getEnterpriseId()).collect(Collectors.toList());
List<EnterpriseDetailDTO> wxEnterpriseIdDTOs = wxEnterpriseRelatedApiService.listEnterpriseByEnterpriseIds(enterpriseIds);
if(CollectionUtil.isNotEmpty(wxEnterpriseIdDTOs)){
wxEnterpriseIds = wxEnterpriseIdDTOs.stream().map(s->s.getWxEnterpriseId()).collect(Collectors.toList());
}
}
if(CollectionUtil.isEmpty(wxEnterpriseIds)){
wxEnterpriseIds = Arrays.asList("-9999");
}
}
return EntityUtil.changeEntityListByJSON(ApplicationEnterpriseRelatedDTO.class, templateEnterpriseRelatedService.listEnterpriseByParams(applicationTemplateId,wxEnterpriseIds,wxEnterpriseName));
} }
@Override @Override
......
...@@ -4,13 +4,14 @@ ...@@ -4,13 +4,14 @@
<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="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, 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" >
...@@ -26,10 +27,10 @@ ...@@ -26,10 +27,10 @@
<insert id="insert" parameterType="com.gic.haoban.manage.service.entity.TabHaobanTemplateEnterpriseRelation" > <insert id="insert" parameterType="com.gic.haoban.manage.service.entity.TabHaobanTemplateEnterpriseRelation" >
insert into tab_haoban_template_enterprise_relation (template_enterprise_relation_id, wx_enterprise_id, insert into tab_haoban_template_enterprise_relation (template_enterprise_relation_id, wx_enterprise_id,
application_template_id, status_flag, create_time, application_template_id, status_flag, create_time,
update_time) update_time,wx_enterprise_name)
values (#{templateEnterpriseRelationId,jdbcType=VARCHAR}, #{wxEnterpriseId,jdbcType=VARCHAR}, values (#{templateEnterpriseRelationId,jdbcType=VARCHAR}, #{wxEnterpriseId,jdbcType=VARCHAR},
#{applicationTemplateId,jdbcType=VARCHAR}, #{statusFlag,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{applicationTemplateId,jdbcType=VARCHAR}, #{statusFlag,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP}) #{updateTime,jdbcType=TIMESTAMP},#{wxEnterpriseName,jdbcType=VARCHAR})
</insert> </insert>
<insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanTemplateEnterpriseRelation" > <insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanTemplateEnterpriseRelation" >
insert into tab_haoban_template_enterprise_relation insert into tab_haoban_template_enterprise_relation
...@@ -40,6 +41,9 @@ ...@@ -40,6 +41,9 @@
<if test="wxEnterpriseId != null" > <if test="wxEnterpriseId != null" >
wx_enterprise_id, wx_enterprise_id,
</if> </if>
<if test="wxEnterpriseName != null" >
wx_enterprise_name,
</if>
<if test="applicationTemplateId != null" > <if test="applicationTemplateId != null" >
application_template_id, application_template_id,
</if> </if>
...@@ -60,6 +64,9 @@ ...@@ -60,6 +64,9 @@
<if test="wxEnterpriseId != null" > <if test="wxEnterpriseId != null" >
#{wxEnterpriseId,jdbcType=VARCHAR}, #{wxEnterpriseId,jdbcType=VARCHAR},
</if> </if>
<if test="wxEnterpriseName != null" >
#{wxEnterpriseName,jdbcType=VARCHAR},
</if>
<if test="applicationTemplateId != null" > <if test="applicationTemplateId != null" >
#{applicationTemplateId,jdbcType=VARCHAR}, #{applicationTemplateId,jdbcType=VARCHAR},
</if> </if>
...@@ -80,6 +87,9 @@ ...@@ -80,6 +87,9 @@
<if test="wxEnterpriseId != null" > <if test="wxEnterpriseId != null" >
wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}, wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
</if> </if>
<if test="wxEnterpriseName != null" >
wx_enterprise_name = #{wxEnterpriseName,jdbcType=VARCHAR},
</if>
<if test="applicationTemplateId != null" > <if test="applicationTemplateId != null" >
application_template_id = #{applicationTemplateId,jdbcType=VARCHAR}, application_template_id = #{applicationTemplateId,jdbcType=VARCHAR},
</if> </if>
...@@ -98,6 +108,7 @@ ...@@ -98,6 +108,7 @@
<update id="updateByPrimaryKey" parameterType="com.gic.haoban.manage.service.entity.TabHaobanTemplateEnterpriseRelation" > <update id="updateByPrimaryKey" parameterType="com.gic.haoban.manage.service.entity.TabHaobanTemplateEnterpriseRelation" >
update tab_haoban_template_enterprise_relation update tab_haoban_template_enterprise_relation
set wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}, set wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
wx_enterprise_name = #{wxEnterpriseName,jdbcType=VARCHAR},
application_template_id = #{applicationTemplateId,jdbcType=VARCHAR}, application_template_id = #{applicationTemplateId,jdbcType=VARCHAR},
status_flag = #{statusFlag,jdbcType=INTEGER}, status_flag = #{statusFlag,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP}, create_time = #{createTime,jdbcType=TIMESTAMP},
...@@ -120,4 +131,21 @@ ...@@ -120,4 +131,21 @@
where wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR} where wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
and status_flag = 1 and status_flag = 1
</select> </select>
<select id="listEnterpriseByParams" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_template_enterprise_relation
where application_template_id = #{applicationTemplateId,jdbcType=VARCHAR}
and status_flag = 1
<if test="wxEnterpriseName != null and wxEnterpriseName != ''">
and wx_enterprise_name like CONCAT('%',#{wxEnterpriseName},'%')
</if>
<if test="wxEnterpriseIds != null and wxEnterpriseIds.size() > 0">
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
...@@ -85,8 +85,8 @@ public class ApplicationTemplateController extends WebBaseController{ ...@@ -85,8 +85,8 @@ public class ApplicationTemplateController extends WebBaseController{
} }
@RequestMapping("view-template-enterprise") @RequestMapping("view-template-enterprise")
public HaobanResponse viewTemplateEnterprise(String applicationTemplateId){ public HaobanResponse viewTemplateEnterprise(String applicationTemplateId,String wxEnterpriseName,String enterpriseName){
List<ApplicationEnterpriseRelatedDTO> list = applicationTemplateApiService.listTemplateEnterprise(applicationTemplateId); List<ApplicationEnterpriseRelatedDTO> list = applicationTemplateApiService.listTemplateEnterprise(applicationTemplateId,wxEnterpriseName,enterpriseName);
return resultResponse(HaoBanErrCode.ERR_1,list); return resultResponse(HaoBanErrCode.ERR_1,list);
} }
......
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