Commit c2dcfaad by guojuxing

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

parents 562ec1ee 1efae27c
package com.gic.cloud.dto;
import java.io.Serializable;
import java.util.Date;
/**
* @author zhiwj
* @Description:
* @date 2020-07-23 16:21
*/
public class IndexDescDTO implements Serializable {
private static final long serialVersionUID = 9165568005916128353L;
/**
*
*/
private Integer indexDescId;
/**
* 模块id
*/
private String moduleId;
/**
* 指标名称
*/
private String indexName;
/**
* 指标code
*/
private String indexCode;
/**
* 分类名
*/
private String indexGroupName;
/**
*
*/
private Integer status;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
private Integer enterpriseId;
private Integer sort;
private Integer updateTips;
private Integer indexRemark;
public Integer getIndexDescId() {
return indexDescId;
}
public void setIndexDescId(Integer indexDescId) {
this.indexDescId = indexDescId;
}
public String getModuleId() {
return moduleId;
}
public void setModuleId(String moduleId) {
this.moduleId = moduleId;
}
public String getIndexName() {
return indexName;
}
public void setIndexName(String indexName) {
this.indexName = indexName;
}
public String getIndexCode() {
return indexCode;
}
public void setIndexCode(String indexCode) {
this.indexCode = indexCode;
}
public String getIndexGroupName() {
return indexGroupName;
}
public void setIndexGroupName(String indexGroupName) {
this.indexGroupName = indexGroupName;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Integer getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(Integer enterpriseId) {
this.enterpriseId = enterpriseId;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
public Integer getUpdateTips() {
return updateTips;
}
public void setUpdateTips(Integer updateTips) {
this.updateTips = updateTips;
}
public Integer getIndexRemark() {
return indexRemark;
}
public void setIndexRemark(Integer indexRemark) {
this.indexRemark = indexRemark;
}
}
package com.gic.cloud.service;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.cloud.dto.IndexDescDTO;
import java.util.List;
import java.util.Map;
/**
* @author zhiwj
* @Description:
* @date 2020-07-23 14:50
*/
public interface IndexDescApiService {
/**
* 查询某个商户在某个模块下的指标
* @Title: listByEnterpriseAndModule
* @Description:
* @author zhiwj
* @param enterpriseId
* @param moduleId
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>
* @throws
*/
ServiceResponse<Map<String, List<IndexDescDTO>>> listByEnterpriseAndModule(Integer enterpriseId, String moduleId);
/**
* @Title: listByEnterpriseAndModuleDetail
* @Description:
* @author zhiwj
* @param enterpriseId
* @param moduleId
* @return com.gic.api.base.commons.ServiceResponse<com.gic.cloud.dto.IndexEnterpriseGroupDTO>
* @throws
*/
ServiceResponse<Map<String, List<IndexDescDTO>>> listByEnterpriseAndModuleDetail(Integer enterpriseId, String moduleId, Integer userId);
/**
* 回收站中的指标
* @Title: listRecycle
* @Description:
* @author zhiwj
* @param enterpriseId
* @param moduleId
* @return com.gic.api.base.commons.ServiceResponse<com.gic.cloud.dto.IndexEnterpriseGroupDTO>
* @throws
*/
ServiceResponse<List<IndexDescDTO>> listRecycle(Integer enterpriseId, String moduleId);
/**
* 排序
* @Title: sortIndex
* @Description:
* @author zhiwj
* @param enterpriseId 商户id
* @param moduleId
* @param indexId 指标id
* @param seq 排到第几个
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>
* @throws
*/
ServiceResponse<Void> sortIndex(Integer enterpriseId, String moduleId, Integer indexId, Integer seq);
/**
* 移动到回收站
* @Title: moveToRecycle
* @Description:
* @author zhiwj
* @param enterpriseId
* @param moduleId
* @param indexId
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>
* @throws
*/
ServiceResponse<Void> moveToRecycle(Integer enterpriseId, String moduleId, Integer indexId);
}
package com.gic.cloud.dao.mapper;
import com.gic.cloud.entity.TabIndexDescEnterprise;
public interface TabIndexDescEnterpriseMapper {
/**
* 根据主键删除
*
* @param indexDescEnterpriseId 主键
* @return 更新条目数
*/
int deleteByPrimaryKey(Integer indexDescEnterpriseId);
/**
* 插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int insert(TabIndexDescEnterprise record);
/**
* 动态插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int insertSelective(TabIndexDescEnterprise record);
/**
* 根据主键查询
*
* @param indexDescEnterpriseId 主键
* @return 实体对象
*/
TabIndexDescEnterprise selectByPrimaryKey(Integer indexDescEnterpriseId);
/**
* 根据主键动态更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int updateByPrimaryKeySelective(TabIndexDescEnterprise record);
/**
* 根据主键更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int updateByPrimaryKey(TabIndexDescEnterprise record);
}
\ No newline at end of file
package com.gic.cloud.dao.mapper;
import com.gic.cloud.dto.IndexDescDTO;
import com.gic.cloud.entity.TabIndexDesc;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface TabIndexDescMapper {
/**
* 根据主键删除
*
* @param indexDescId 主键
* @return 更新条目数
*/
int deleteByPrimaryKey(Integer indexDescId);
/**
* 插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int insert(TabIndexDesc record);
/**
* 动态插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int insertSelective(TabIndexDesc record);
/**
* 根据主键查询
*
* @param indexDescId 主键
* @return 实体对象
*/
TabIndexDesc selectByPrimaryKey(Integer indexDescId);
/**
* 根据主键动态更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int updateByPrimaryKeySelective(TabIndexDesc record);
/**
* 根据主键更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int updateByPrimaryKey(TabIndexDesc record);
List<IndexDescDTO> listByEnterpriseAndModule(@Param("enterpriseId") Integer enterpriseId, @Param("moduleId") String moduleId);
List<IndexDescDTO> listByEnterpriseAndModuleDetail(@Param("enterpriseId") Integer enterpriseId, @Param("moduleId") String moduleId, @Param("userId") Integer userId);
}
\ No newline at end of file
package com.gic.cloud.entity;
import java.util.Date;
/**
* tab_index_desc
*/
public class TabIndexDesc {
/**
*
*/
private Integer indexDescId;
/**
* 模块id
*/
private String moduleId;
/**
* 指标名称
*/
private String indexName;
/**
* 指标code
*/
private String indexCode;
/**
* 分类名
*/
private String indexGroupName;
/**
*
*/
private Integer status;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
public Integer getIndexDescId() {
return indexDescId;
}
public void setIndexDescId(Integer indexDescId) {
this.indexDescId = indexDescId;
}
public String getModuleId() {
return moduleId;
}
public void setModuleId(String moduleId) {
this.moduleId = moduleId;
}
public String getIndexName() {
return indexName;
}
public void setIndexName(String indexName) {
this.indexName = indexName;
}
public String getIndexCode() {
return indexCode;
}
public void setIndexCode(String indexCode) {
this.indexCode = indexCode;
}
public String getIndexGroupName() {
return indexGroupName;
}
public void setIndexGroupName(String indexGroupName) {
this.indexGroupName = indexGroupName;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}
\ No newline at end of file
package com.gic.cloud.entity;
import java.util.Date;
/**
* tab_index_desc_enterprise
*/
public class TabIndexDescEnterprise {
/**
*
*/
private Integer indexDescEnterpriseId;
/**
*
*/
private String indexCode;
/**
* 商户id
*/
private Integer enterpriseId;
/**
* 1正常 0在回收站
*/
private Integer indexStatus;
/**
* 排序
*/
private Integer sort;
/**
*
*/
private Integer status;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
public Integer getIndexDescEnterpriseId() {
return indexDescEnterpriseId;
}
public void setIndexDescEnterpriseId(Integer indexDescEnterpriseId) {
this.indexDescEnterpriseId = indexDescEnterpriseId;
}
public String getIndexCode() {
return indexCode;
}
public void setIndexCode(String indexCode) {
this.indexCode = indexCode;
}
public Integer getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(Integer enterpriseId) {
this.enterpriseId = enterpriseId;
}
public Integer getIndexStatus() {
return indexStatus;
}
public void setIndexStatus(Integer indexStatus) {
this.indexStatus = indexStatus;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}
\ No newline at end of file
package com.gic.cloud.service;
/**
* @author zhiwj
* @Description:
* @date 2020-07-23 16:46
*/
public interface IndexDescEnterpriseService {
}
package com.gic.cloud.service;
import com.gic.cloud.dto.IndexDescDTO;
import java.util.List;
/**
* @author zhiwj
* @Description:
* @date 2020-07-23 15:11
*/
public interface IndexDescService {
List<IndexDescDTO> listByEnterpriseAndModule(Integer enterpriseId, String moduleId);
List<IndexDescDTO> listByEnterpriseAndModuleDetail(Integer enterpriseId, String moduleId, Integer userId);
}
package com.gic.cloud.service.impl;
import com.gic.cloud.service.IndexDescEnterpriseService;
import org.springframework.stereotype.Service;
/**
* @author zhiwj
* @Description:
* @date 2020-07-23 16:46
*/
@Service
public class IndexDescEnterpriseServiceImpl implements IndexDescEnterpriseService {
}
package com.gic.cloud.service.impl;
import com.gic.cloud.dao.mapper.TabIndexDescMapper;
import com.gic.cloud.dto.IndexDescDTO;
import com.gic.cloud.service.IndexDescService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author zhiwj
* @Description:
* @date 2020-07-23 15:11
*/
@Service
public class IndexDescServiceImpl implements IndexDescService {
@Autowired
private TabIndexDescMapper tabIndexDescMapper;
@Override
public List<IndexDescDTO> listByEnterpriseAndModule(Integer enterpriseId, String moduleId) {
return tabIndexDescMapper.listByEnterpriseAndModule(enterpriseId, moduleId);
}
@Override
public List<IndexDescDTO> listByEnterpriseAndModuleDetail(Integer enterpriseId, String moduleId, Integer userId) {
return tabIndexDescMapper.listByEnterpriseAndModuleDetail(enterpriseId, moduleId, userId);
}
}
package com.gic.cloud.service.outer.impl;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.cloud.dto.IndexDescDTO;
import com.gic.cloud.service.IndexDescApiService;
import com.gic.cloud.service.IndexDescService;
import com.gic.enterprise.response.EnterpriseServiceResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author zhiwj
* @Description:
* @date 2020-07-23 15:10
*/
@Service("indexEnterpriseApiService")
public class IndexEnterpriseApiServiceImpl implements IndexDescApiService {
@Autowired
private IndexDescService indexDescService;
@Override
public ServiceResponse<Map<String, List<IndexDescDTO>>> listByEnterpriseAndModule(Integer enterpriseId, String moduleId) {
List<IndexDescDTO> descList = indexDescService.listByEnterpriseAndModule(enterpriseId, moduleId);
Map<String, List<IndexDescDTO>> resultMap = descList.stream().collect(Collectors.groupingBy(IndexDescDTO::getIndexGroupName, Collectors.mapping(e -> e, Collectors.toList())));
return EnterpriseServiceResponse.success(resultMap);
}
@Override
public ServiceResponse<Map<String, List<IndexDescDTO>>> listByEnterpriseAndModuleDetail(Integer enterpriseId, String moduleId, Integer userId) {
List<IndexDescDTO> descList = indexDescService.listByEnterpriseAndModuleDetail(enterpriseId, moduleId, userId);
Map<String, List<IndexDescDTO>> resultMap = descList.stream().collect(Collectors.groupingBy(IndexDescDTO::getIndexGroupName, Collectors.mapping(e -> e, Collectors.toList())));
return EnterpriseServiceResponse.success(resultMap);
}
@Override
public ServiceResponse<List<IndexDescDTO>> listRecycle(Integer enterpriseId, String moduleId) {
return null;
}
@Override
public ServiceResponse<Void> sortIndex(Integer enterpriseId, String moduleId, Integer indexId, Integer seq) {
return null;
}
@Override
public ServiceResponse<Void> moveToRecycle(Integer enterpriseId, String moduleId, Integer indexId) {
return null;
}
}
<?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">
<mapper namespace="com.gic.cloud.dao.mapper.TabIndexDescEnterpriseMapper">
<resultMap id="BaseResultMap" type="com.gic.cloud.entity.TabIndexDescEnterprise">
<id column="index_desc_enterprise_id" jdbcType="INTEGER" property="indexDescEnterpriseId" />
<result column="index_code" jdbcType="VARCHAR" property="indexCode" />
<result column="enterprise_id" jdbcType="INTEGER" property="enterpriseId" />
<result column="index_status" jdbcType="INTEGER" property="indexStatus" />
<result column="sort" jdbcType="INTEGER" property="sort" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
index_desc_enterprise_id, index_code, enterprise_id, index_status, sort, status,
create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_index_desc_enterprise
where index_desc_enterprise_id = #{indexDescEnterpriseId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tab_index_desc_enterprise
where index_desc_enterprise_id = #{indexDescEnterpriseId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.gic.cloud.entity.TabIndexDescEnterprise">
insert into tab_index_desc_enterprise (index_desc_enterprise_id, index_code,
enterprise_id, index_status, sort,
status, create_time, update_time
)
values (#{indexDescEnterpriseId,jdbcType=INTEGER}, #{indexCode,jdbcType=VARCHAR},
#{enterpriseId,jdbcType=INTEGER}, #{indexStatus,jdbcType=INTEGER}, #{sort,jdbcType=INTEGER},
#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" parameterType="com.gic.cloud.entity.TabIndexDescEnterprise">
insert into tab_index_desc_enterprise
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="indexDescEnterpriseId != null">
index_desc_enterprise_id,
</if>
<if test="indexCode != null">
index_code,
</if>
<if test="enterpriseId != null">
enterprise_id,
</if>
<if test="indexStatus != null">
index_status,
</if>
<if test="sort != null">
sort,
</if>
<if test="status != null">
status,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="indexDescEnterpriseId != null">
#{indexDescEnterpriseId,jdbcType=INTEGER},
</if>
<if test="indexCode != null">
#{indexCode,jdbcType=VARCHAR},
</if>
<if test="enterpriseId != null">
#{enterpriseId,jdbcType=INTEGER},
</if>
<if test="indexStatus != null">
#{indexStatus,jdbcType=INTEGER},
</if>
<if test="sort != null">
#{sort,jdbcType=INTEGER},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.cloud.entity.TabIndexDescEnterprise">
update tab_index_desc_enterprise
<set>
<if test="indexCode != null">
index_code = #{indexCode,jdbcType=VARCHAR},
</if>
<if test="enterpriseId != null">
enterprise_id = #{enterpriseId,jdbcType=INTEGER},
</if>
<if test="indexStatus != null">
index_status = #{indexStatus,jdbcType=INTEGER},
</if>
<if test="sort != null">
sort = #{sort,jdbcType=INTEGER},
</if>
<if test="status != null">
status = #{status,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where index_desc_enterprise_id = #{indexDescEnterpriseId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.cloud.entity.TabIndexDescEnterprise">
update tab_index_desc_enterprise
set index_code = #{indexCode,jdbcType=VARCHAR},
enterprise_id = #{enterpriseId,jdbcType=INTEGER},
index_status = #{indexStatus,jdbcType=INTEGER},
sort = #{sort,jdbcType=INTEGER},
status = #{status,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where index_desc_enterprise_id = #{indexDescEnterpriseId,jdbcType=INTEGER}
</update>
</mapper>
\ No newline at end of file
<?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">
<mapper namespace="com.gic.cloud.dao.mapper.TabIndexDescMapper">
<resultMap id="BaseResultMap" type="com.gic.cloud.entity.TabIndexDesc">
<id column="index_desc_id" jdbcType="INTEGER" property="indexDescId" />
<result column="module_id" jdbcType="VARCHAR" property="moduleId" />
<result column="index_name" jdbcType="VARCHAR" property="indexName" />
<result column="index_code" jdbcType="VARCHAR" property="indexCode" />
<result column="index_group_name" jdbcType="VARCHAR" property="indexGroupName" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<resultMap id="DTOResultMap" type="com.gic.cloud.dto.IndexDescDTO">
<id column="index_desc_id" jdbcType="INTEGER" property="indexDescId" />
<result column="module_id" jdbcType="VARCHAR" property="moduleId" />
<result column="index_name" jdbcType="VARCHAR" property="indexName" />
<result column="index_code" jdbcType="VARCHAR" property="indexCode" />
<result column="index_group_name" jdbcType="VARCHAR" property="indexGroupName" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
index_desc_id, module_id, index_name, index_code, index_group_name, status, create_time,
update_time
</sql>
<sql id="DTO_List" >
${alias}.index_desc_id, ${alias}.module_id, ${alias}.index_name, ${alias}.index_code, ${alias}.index_group_name,
${alias}.status, ${alias}.create_time, ${alias}.update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_index_desc
where index_desc_id = #{indexDescId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tab_index_desc
where index_desc_id = #{indexDescId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.gic.cloud.entity.TabIndexDesc">
insert into tab_index_desc (index_desc_id, module_id, index_name,
index_code, index_group_name, status,
create_time, update_time)
values (#{indexDescId,jdbcType=INTEGER}, #{moduleId,jdbcType=VARCHAR}, #{indexName,jdbcType=VARCHAR},
#{indexCode,jdbcType=VARCHAR}, #{indexGroupName,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.gic.cloud.entity.TabIndexDesc">
insert into tab_index_desc
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="indexDescId != null">
index_desc_id,
</if>
<if test="moduleId != null">
module_id,
</if>
<if test="indexName != null">
index_name,
</if>
<if test="indexCode != null">
index_code,
</if>
<if test="indexGroupName != null">
index_group_name,
</if>
<if test="status != null">
status,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="indexDescId != null">
#{indexDescId,jdbcType=INTEGER},
</if>
<if test="moduleId != null">
#{moduleId,jdbcType=VARCHAR},
</if>
<if test="indexName != null">
#{indexName,jdbcType=VARCHAR},
</if>
<if test="indexCode != null">
#{indexCode,jdbcType=VARCHAR},
</if>
<if test="indexGroupName != null">
#{indexGroupName,jdbcType=VARCHAR},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.cloud.entity.TabIndexDesc">
update tab_index_desc
<set>
<if test="moduleId != null">
module_id = #{moduleId,jdbcType=VARCHAR},
</if>
<if test="indexName != null">
index_name = #{indexName,jdbcType=VARCHAR},
</if>
<if test="indexCode != null">
index_code = #{indexCode,jdbcType=VARCHAR},
</if>
<if test="indexGroupName != null">
index_group_name = #{indexGroupName,jdbcType=VARCHAR},
</if>
<if test="status != null">
status = #{status,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where index_desc_id = #{indexDescId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.cloud.entity.TabIndexDesc">
update tab_index_desc
set module_id = #{moduleId,jdbcType=VARCHAR},
index_name = #{indexName,jdbcType=VARCHAR},
index_code = #{indexCode,jdbcType=VARCHAR},
index_group_name = #{indexGroupName,jdbcType=VARCHAR},
status = #{status,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where index_desc_id = #{indexDescId,jdbcType=INTEGER}
</update>
<select id="listByEnterpriseAndModule" resultMap="BaseResultMap">
select
<include refid="DTO_List" >
<property name="alias" value="t1"/>
</include>
from tab_index_desc t1
left join tab_index_desc_enterprise t2 on t1.index_code = t2.index_code
where t1.status = 1
and t1.enterprise_id = #{enterpriseId}
and t1.module_id = #{moduleId}
order by t2.sort
</select>
<!-- List<IndexDescDTO> listByEnterpriseAndModuleDetail(@Param("enterpriseId") Integer enterpriseId, @Param("moduleId") String moduleId, @Param("userId") Integer userId);-->
<select id="listByEnterpriseAndModuleDetail" resultMap="BaseResultMap">
select
<include refid="DTO_List" >
<property name="alias" value="t1"/>
</include>
from tab_index_desc t1
left join tab_index_desc_enterprise t2 on t1.index_code = t2.index_code
where t1.status = 1
and t1.enterprise_id = #{enterpriseId}
and t1.module_id = #{moduleId}
order by t2.sort
</select>
</mapper>
\ No newline at end of file
......@@ -6,6 +6,9 @@ import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.cloud.dto.DataAuthDTO;
import com.gic.cloud.service.DataAuthApiService;
import com.gic.store.dto.StoreDTO;
import com.gic.store.dto.StoreSearchDTO;
import com.gic.store.service.StoreApiService;
import com.gic.store.service.StoreWidgetApiService;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
......@@ -15,6 +18,7 @@ import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@Component
public class DataAuthUtils {
......@@ -24,6 +28,8 @@ public class DataAuthUtils {
private DataAuthApiService dataAuthApiService;
@Autowired
private StoreWidgetApiService storeWidgetApiService;
@Autowired
private StoreApiService storeApiService;
public StoreAuth getStoreAuth(Integer userId, Integer enterpriseId){
ServiceResponse<DataAuthDTO> response = this.dataAuthApiService.ggetDataAuthByUserId(enterpriseId, userId);
......@@ -37,7 +43,10 @@ public class DataAuthUtils {
storeAuth.setStoreInfoIdList(storeInfoIdList);
storeAuth.setStoreWidgetId(storeWidgetId);
}else {
storeAuth.setStoreInfoIdList(new ArrayList<>());
StoreSearchDTO storeSearchDTO = new StoreSearchDTO();
storeSearchDTO.setEnterpriseId(enterpriseId);
List<StoreDTO> result = this.storeApiService.listStore(storeSearchDTO, 1, 20000).getResult().getResult();
storeAuth.setStoreInfoIdList(result.stream().map(storeDTO -> storeDTO.getStoreInfoId()).collect(Collectors.toList()));
}
}
return storeAuth;
......
package com.gic.cloud.web.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.cloud.dto.AttentionStoreDTO;
import com.gic.cloud.dto.TempStoreConditionDTO;
import com.gic.cloud.service.StoreAttentionApiService;
import com.gic.cloud.service.TempStoreConditionApiService;
import com.gic.cloud.web.auth.DataAuthUtils;
import com.gic.cloud.web.auth.OnLineAuth;
import com.gic.cloud.web.auth.OnLineStore;
import com.gic.cloud.web.auth.StoreAuth;
import com.gic.cloud.web.constant.StoreChannelEnum;
import com.gic.cloud.web.qo.StoreSearchQo;
import com.gic.store.dto.StoreDTO;
import com.gic.store.dto.StoreGroupDTO;
import com.gic.store.dto.StoreSearchDTO;
import com.gic.store.service.StoreApiService;
import com.gic.store.service.StoreGroupApiService;
import com.gic.store.service.StoreWidgetApiService;
import com.google.inject.internal.cglib.core.$ClassEmitter;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.reflections.Store;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.*;
import java.util.stream.Collectors;
@Component
public class StoreSearchUtils {
@Autowired
private DataAuthUtils dataAuthUtils;
@Autowired
private StoreAttentionApiService storeAttentionApiService;
@Autowired
private TempStoreConditionApiService tempStoreConditionApiService;
@Autowired
private StoreWidgetApiService storeWidgetApiService;
@Autowired
private StoreApiService storeApiService;
@Autowired
private StoreGroupApiService storeGroupApiService;
public List<Integer> storeSearch(Integer userId, Integer enterpriseId, String searchJson){
StoreAuth storeAuth = this.dataAuthUtils.getStoreAuth(userId, enterpriseId);
if(!storeAuth.isHasAuth()){
ArrayList<Integer> list = new ArrayList<>();
list.add(0);
return list;
}
if(StringUtils.isNotBlank(searchJson)){
JSONObject json = JSON.parseObject(searchJson);
StoreSearchQo storeSearchQo = json.getObject(StoreChannelEnum.OFFLINE.getChannel().toString(), StoreSearchQo.class);
if(storeSearchQo.getAll() == 1){
return storeAuth.getStoreInfoIdList();
}else {
StoreSearchDTO storeSearchDTO = new StoreSearchDTO();
storeSearchDTO.setEnterpriseId(enterpriseId);
storeSearchDTO.setStoreInfoIds(storeSearchQo.getStoreIds());
storeSearchDTO.setStoreGroupIds(storeSearchQo.getStoreGroupIds());
storeSearchDTO.setRegionIds(storeSearchQo.getRegion());
storeSearchDTO.setStoreTypes(storeSearchQo.getStoreType());
storeSearchDTO.setStoreStatuss(storeSearchQo.getStoreStatus());
storeSearchDTO.setErpStatuss(storeSearchQo.getErpStatus());
storeSearchDTO.setStoreTags(storeSearchQo.getStoreTag());
if(storeSearchQo.getAttentionStore() == 1){
List<AttentionStoreDTO> result = this.storeAttentionApiService.pageStoreAttention(userId, enterpriseId, 1, Integer.MAX_VALUE).getResult().getResult();
List<Integer> list = result.stream().map(t -> t.getStoreId()).collect(Collectors.toList());
String storeInfoIds = StringUtils.join(list, ",");
storeSearchDTO.setStoreInfoIds(storeSearchDTO.getStoreInfoIds()+","+ storeInfoIds);
}
if(storeSearchQo.getTmpStore() == 0){
TempStoreConditionDTO result = this.tempStoreConditionApiService.getTempStoreCondition(enterpriseId).getResult();
if(result != null){
Integer tempStoreId = result.getStoreWidgetId();
List<Integer> tempStoreIdList = this.storeWidgetApiService.listStoreInfoIdByStoreWidgetId(enterpriseId, tempStoreId).getResult();
storeSearchDTO.setStoreIdsOfNot(StringUtils.join(tempStoreIdList, ","));
}
}
ServiceResponse<Page<StoreDTO>> pageServiceResponse = this.storeApiService.listStore(storeSearchDTO, 1, 20000);
if(pageServiceResponse.isSuccess() && pageServiceResponse.getResult() != null){
List<StoreDTO> storeDTOList = pageServiceResponse.getResult().getResult();
List<Integer> storeInfoIdList = storeDTOList.stream().map(storeDTO -> storeDTO.getStoreInfoId()).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(storeAuth.getStoreInfoIdList())){
return storeInfoIdList.stream().filter(s -> {
for(Integer storeInfoId : storeAuth.getStoreInfoIdList()){
if(s.intValue() == storeInfoId.intValue()){
return true;
}
}
return false;
}).collect(Collectors.toList());
}else {
return storeInfoIdList;
}
}
}
}
return storeAuth.getStoreInfoIdList();
}
public List<String> onLineStoreSearch(Integer userId, Integer enterpriseId, String searchJson){
OnLineAuth onlineStoreAuth = this.dataAuthUtils.getOnlineStore(userId, enterpriseId);
List<String> list = new ArrayList<>();
if(onlineStoreAuth.isHasAuth()){
this.getOnlineStoreIds(searchJson, onlineStoreAuth, list, StoreChannelEnum.GICMALL.getChannel());
this.getOnlineStoreIds(searchJson, onlineStoreAuth, list, StoreChannelEnum.WMMALL.getChannel());
this.getOnlineStoreIds(searchJson, onlineStoreAuth, list, StoreChannelEnum.TIANMAO.getChannel());
}else {
list.add("noauth");
}
return list;
}
public Integer getLevel(Integer userId, Integer enterpriseId, String searchJson){
List<Integer> list = this.storeSearch(userId, enterpriseId, searchJson);
StoreSearchDTO storeSearchDTO = new StoreSearchDTO();
storeSearchDTO.setEnterpriseId(enterpriseId);
storeSearchDTO.setStoreInfoIds(StringUtils.join(list, ","));
List<StoreDTO> result = this.storeApiService.listStore(storeSearchDTO, 1, 20000).getResult().getResult();
Map<Integer, Integer> map = new HashMap<>();
result.forEach(storeDTO -> {
List<Integer> storeGroupIdList = storeDTO.getStoreGroupIdList();
storeGroupIdList.forEach(storeGroupId ->{
map.put(storeGroupId, storeGroupId);
});
});
List<StoreGroupDTO> allStoreGroupIdList = this.storeGroupApiService.listStoreGroupByIds(null, enterpriseId).getResult();
Map<Integer, Integer> levelMap = new HashMap<>();
allStoreGroupIdList.forEach(storeGroupDTO -> {
levelMap.put(storeGroupDTO.getGroupLevel(), levelMap.get(storeGroupDTO.getGroupLevel())== null ? 1 : levelMap.get(storeGroupDTO.getGroupLevel())+1);
});
int start = 0;
while (true){
if(levelMap.get(start) != null && levelMap.get(start).intValue() > 1){
return start;
}
start++;
}
}
private void getOnlineStoreIds(String searchJson, OnLineAuth onlineStoreAuth, List<String> list, Integer channel){
StoreSearchQo searchQo = JSON.parseObject(searchJson).getObject(channel.toString(), StoreSearchQo.class);
if(searchQo.getAll() == 1){
onlineStoreAuth.getList().stream().filter(s -> {
if(s.getChannel() == channel){
list.addAll(s.getStoreIdList());
}
return false;
});
}else {
list.addAll(Arrays.asList(searchQo.getStoreGroupIds().split(",")));
}
}
}
......@@ -54,6 +54,8 @@ public class StoreWidgetController {
private WmStoreApiService wmStoreApiService;
@Autowired
private StoreAttentionApiService storeAttentionApiService;
@Autowired
private StoreSearchUtils storeSearchUtils;
@RequestMapping("store-widget-index")
public RestResponse storeWidgetIndex(Integer userId, Integer enterpriseId){
......@@ -79,8 +81,8 @@ public class StoreWidgetController {
if(CollectionUtils.isNotEmpty(onLineStoreVos)){
for(OnLineStoreVo onLineStoreVo : onLineStoreVos){
IndexItemVo indexItemVo = new IndexItemVo();
indexItemVo.setId(onLineStoreVo.getOnStoreId());
indexItemVo.setName(onLineStoreVo.getOnStoreName());
indexItemVo.setId(onLineStoreVo.getId());
indexItemVo.setName(onLineStoreVo.getName());
indexItemVo.setType(2);
items.add(indexItemVo);
}
......@@ -319,7 +321,8 @@ public class StoreWidgetController {
storeSearchVo.setId(dto.getId().toString());
storeSearchVo.setName(dto.getName());
storeSearchVo.setDesc(StoreChannelEnum.GICMALL.getMessage());
storeSearchVo.setNameChain(StoreChannelEnum.GICMALL.getMessage());
storeSearchVo.setIdChain("_" + StoreChannelEnum.GICMALL.getChannel() + "_" + dto.getId() +"_");
storeSearchVo.setNameChain(StoreChannelEnum.GICMALL.getMessage() + "/" + dto.getName());
storeSearchVo.setChannel(StoreChannelEnum.GICMALL.getChannel());
list.add(storeSearchVo);
}
......@@ -335,7 +338,8 @@ public class StoreWidgetController {
storeSearchVo.setId(wmStoreDTO.getWmStoreId());
storeSearchVo.setName(wmStoreDTO.getWmMainAccount());
storeSearchVo.setDesc(StoreChannelEnum.WMMALL.getMessage());
storeSearchVo.setNameChain(StoreChannelEnum.GICMALL.getMessage());
storeSearchVo.setIdChain("_" + StoreChannelEnum.GICMALL.getChannel() + "_" + wmStoreDTO.getWmStoreId() +"_");
storeSearchVo.setNameChain(StoreChannelEnum.GICMALL.getMessage() + "/" + wmStoreDTO.getWmMainAccount());
storeSearchVo.setChannel(StoreChannelEnum.GICMALL.getChannel());
list.add(storeSearchVo);
}
......@@ -352,8 +356,11 @@ public class StoreWidgetController {
}
@RequestMapping("get-store-count")
public RestResponse getStoreCount(String searchJSON){
return RestResponse.success(1);
public RestResponse getStoreCount(String searchJSON, Integer userId, Integer enterpriseId){
List<Integer> list = this.storeSearchUtils.storeSearch(userId, enterpriseId, searchJSON);
List<String> stringList = this.storeSearchUtils.onLineStoreSearch(userId, enterpriseId, searchJSON);
log.info("getStoreCount:{},{},{},{},{}", searchJSON, userId, enterpriseId, list.size(), stringList.size());
return RestResponse.success(list.size() + stringList.size());
}
private Map<Integer, StoreGroupVo> mapStoreGroup(Integer enterpriseId){
......@@ -389,8 +396,10 @@ public class StoreWidgetController {
log.info("shopId:{}", dto.getId());
if(storeIdList.contains(dto.getId().toString())){
OnLineStoreVo onLineStoreVo = new OnLineStoreVo();
onLineStoreVo.setOnStoreId(dto.getId()+"");
onLineStoreVo.setOnStoreName(dto.getName());
onLineStoreVo.setId(dto.getId()+"");
onLineStoreVo.setName(dto.getName());
onLineStoreVo.setIdChain("_" + type + "_" + dto.getId()+"_");
onLineStoreVo.setNameChain(StoreChannelEnum.GICMALL.getMessage() + "/" + dto.getName());
list.add(onLineStoreVo);
}
}
......@@ -399,10 +408,12 @@ public class StoreWidgetController {
List<WmStoreDTO> result = wmStoreApiService.listWmStore(enterpriseId).getResult();
if(CollectionUtils.isNotEmpty(result)){
for(WmStoreDTO wmStoreDTO : result){
if(storeIdList.contains(wmStoreDTO.getWmStoreId())){
if(storeIdList.contains(wmStoreDTO.getWmMallStoreId().toString())){
OnLineStoreVo onLineStoreVo = new OnLineStoreVo();
onLineStoreVo.setOnStoreId(wmStoreDTO.getWmStoreId()+"");
onLineStoreVo.setOnStoreName(wmStoreDTO.getWmMainAccount());
onLineStoreVo.setId(wmStoreDTO.getWmStoreId()+"");
onLineStoreVo.setName(wmStoreDTO.getWmPidName());
onLineStoreVo.setIdChain("_" + type + "_" + wmStoreDTO.getWmStoreId()+"_");
onLineStoreVo.setNameChain(StoreChannelEnum.WMMALL.getMessage() + "/" + wmStoreDTO.getWmPidName());
list.add(onLineStoreVo);
}
}
......
package com.gic.cloud.web.qo;
public class StoreSearchQo {
private Integer all = 0;
private String region;
private String storeType;
private String storeStatus;
private String erpStatus;
private String storeTag;
private Integer attentionStore = 0;
private Integer tmpStore = 0;
private String storeGroupIds; //和线上共享使用,当为线上门店时,该值对应店铺
private String storeIds; //和线上共享使用,当为线上门店时,该值对应店铺下门店id
public Integer getAll() {
return all;
}
public void setAll(Integer all) {
this.all = all;
}
public String getStoreGroupIds() {
return storeGroupIds;
}
public void setStoreGroupIds(String storeGroupIds) {
this.storeGroupIds = storeGroupIds;
}
public String getRegion() {
return region;
}
public void setRegion(String region) {
this.region = region;
}
public String getStoreType() {
return storeType;
}
public void setStoreType(String storeType) {
this.storeType = storeType;
}
public String getStoreStatus() {
return storeStatus;
}
public void setStoreStatus(String storeStatus) {
this.storeStatus = storeStatus;
}
public String getErpStatus() {
return erpStatus;
}
public void setErpStatus(String erpStatus) {
this.erpStatus = erpStatus;
}
public String getStoreTag() {
return storeTag;
}
public void setStoreTag(String storeTag) {
this.storeTag = storeTag;
}
public Integer getAttentionStore() {
return attentionStore;
}
public void setAttentionStore(Integer attentionStore) {
this.attentionStore = attentionStore;
}
public Integer getTmpStore() {
return tmpStore;
}
public void setTmpStore(Integer tmpStore) {
this.tmpStore = tmpStore;
}
public String getStoreIds() {
return storeIds;
}
public void setStoreIds(String storeIds) {
this.storeIds = storeIds;
}
}
package com.gic.cloud.web.vo;
public class OnLineStoreVo {
private String onStoreId;
private String onStoreName;
private String id;
private String name;
private String idChain;
private String nameChain;
private Integer hasChildren = 0;
public String getOnStoreId() {
return onStoreId;
public Integer getHasChildren() {
return hasChildren;
}
public void setOnStoreId(String onStoreId) {
this.onStoreId = onStoreId;
public void setHasChildren(Integer hasChildren) {
this.hasChildren = hasChildren;
}
public String getOnStoreName() {
return onStoreName;
public String getId() {
return id;
}
public void setOnStoreName(String onStoreName) {
this.onStoreName = onStoreName;
public void setId(String id) {
this.id = id;
}
public Integer getHasChildren() {
return hasChildren;
public String getName() {
return name;
}
public void setHasChildren(Integer hasChildren) {
this.hasChildren = hasChildren;
public void setName(String name) {
this.name = name;
}
public String getIdChain() {
return idChain;
}
public void setIdChain(String idChain) {
this.idChain = idChain;
}
public String getNameChain() {
return nameChain;
}
public void setNameChain(String nameChain) {
this.nameChain = nameChain;
}
}
......@@ -142,4 +142,5 @@
<dubbo:reference interface="com.gic.marketing.process.api.service.sms.SmsSendApiService" id="smsSendApiService" timeout="6000" retries="0"/>
<dubbo:reference interface="com.gic.store.service.StoreTagApiService" id="storeTagApiService" timeout="6000" retries="0"/>
<dubbo:reference interface="com.gic.cloud.service.StoreAttentionApiService" id="storeAttentionApiService" timeout="6000" retries="0"/>
<dubbo:reference interface="com.gic.cloud.service.TempStoreConditionApiService" id="tempStoreConditionApiService" timeout="6000" retries="0"/>
</beans>
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