稽核区域配置

This commit is contained in:
zhangchenbiao
2023-07-19 16:04:17 +08:00
parent 4517f2e770
commit fc0aedae7a
28 changed files with 1185 additions and 29 deletions

View File

@@ -82,6 +82,7 @@ public enum ErrorCodeEnum {
SIGN_FAIL(600000, "验签失败", null), SIGN_FAIL(600000, "验签失败", null),
GET_ACCESSTOKEN_ERROR(600001, "获取小程序TOKEN错误", null), GET_ACCESSTOKEN_ERROR(600001, "获取小程序TOKEN错误", null),
NEW_MOBILE_HAS_EXIST(600002,"加盟商用户信息已存在",null), NEW_MOBILE_HAS_EXIST(600002,"加盟商用户信息已存在",null),
INSPECTION_USER_OCCUPY(600002,"当前稽核人已经配置其他战区",null),
; ;

View File

@@ -11,6 +11,8 @@ import org.springframework.stereotype.Repository;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional;
import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@@ -109,7 +111,22 @@ public class EnterpriseUserDAO {
return userList.stream().filter(o->!StringUtils.isAnyBlank(o.getMobile(), o.getName())).collect(Collectors.toMap(k -> k.getUserId(), v -> v.getName() + " " + v.getMobile())); return userList.stream().filter(o->!StringUtils.isAnyBlank(o.getMobile(), o.getName())).collect(Collectors.toMap(k -> k.getUserId(), v -> v.getName() + " " + v.getMobile()));
} }
public Map<String, String> getUserNameMap(List<String> userIds){
List<EnterpriseUserDO> userList = getUserInfoByUserIds(userIds);
return userList.stream().filter(o->!StringUtils.isAnyBlank(o.getMobile(), o.getName())).collect(Collectors.toMap(k -> k.getUserId(), v -> v.getName()));
}
public Map<String, EnterpriseUserDO> getUserMap(List<String> userIds){
List<EnterpriseUserDO> userList = getUserInfoByUserIds(userIds);
return userList.stream().filter(o->!StringUtils.isAnyBlank(o.getMobile(), o.getName())).collect(Collectors.toMap(k -> k.getUserId(), Function.identity()));
}
public String selectByMobile(String mobile) { public String selectByMobile(String mobile) {
return enterpriseUserMapper.selectByMobile(mobile); return enterpriseUserMapper.selectByMobile(mobile);
} }
public String getUserName(String userId){
EnterpriseUserDO userInfo = getUserInfoById(userId);
return Optional.ofNullable(userInfo).map(EnterpriseUserDO::getName).orElse(StringUtils.EMPTY);
}
} }

View File

@@ -0,0 +1,90 @@
package com.cool.store.dao;
import com.cool.store.entity.HyInspectionSettingDO;
import com.cool.store.mapper.HyInspectionSettingMapper;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.util.List;
import java.util.Objects;
/**
* @author zhangchenbiao
* @FileName: HyInspectionSettingDAO
* @Description:
* @date 2023-07-18 16:29
*/
@Repository
public class HyInspectionSettingDAO {
@Resource
private HyInspectionSettingMapper hyInspectionSettingMapper;
/**
* 获取分页
* @param pageNum
* @param pageSize
* @return
*/
public Page<HyInspectionSettingDO> getInspectionSettingPage(Integer pageNum, Integer pageSize){
PageHelper.startPage(pageNum, pageSize);
Page<HyInspectionSettingDO> resultPage = hyInspectionSettingMapper.getInspectionSettingPage();
return resultPage;
}
/**
* 获取稽查详情
* @param inspectionSettingId
* @return
*/
public HyInspectionSettingDO getInspectionSettingDetail(Long inspectionSettingId){
if(Objects.isNull(inspectionSettingId)){
return null;
}
return hyInspectionSettingMapper.getInspectionSettingDetail(inspectionSettingId);
}
public Long addInspectionSetting(HyInspectionSettingDO param){
hyInspectionSettingMapper.insertSelective(param);
return param.getId();
}
public Integer updateInspectionSetting(HyInspectionSettingDO param){
return hyInspectionSettingMapper.updateByPrimaryKeySelective(param);
}
public List<String> getInspectionUserIds(){
return hyInspectionSettingMapper.getInspectionUserIds();
}
/**
* 获取配置列表
* @param inspectionSettingIds
* @return
*/
public List<HyInspectionSettingDO> getHyInspectionSettingByIds(List<Long> inspectionSettingIds){
if(CollectionUtils.isEmpty(inspectionSettingIds)){
return Lists.newArrayList();
}
return hyInspectionSettingMapper.getHyInspectionSettingByIds(inspectionSettingIds);
}
/**
* 获取用户配置的区域 编辑的时候排除某个配置
* @param inspectionUserId
* @param excludeInspectionSettingId
* @return
*/
public List<HyInspectionSettingDO> getHyInspectionSettingByUserId(String inspectionUserId, Long excludeInspectionSettingId){
if(StringUtils.isBlank(inspectionUserId)){
return Lists.newArrayList();
}
return hyInspectionSettingMapper.getHyInspectionSettingByUserId(inspectionUserId, excludeInspectionSettingId);
}
}

View File

@@ -0,0 +1,99 @@
package com.cool.store.dao;
import com.cool.store.constants.CommonConstants;
import com.cool.store.entity.HyInspectionSettingMappingDO;
import com.cool.store.mapper.HyInspectionSettingMappingMapper;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
/**
* @author zhangchenbiao
* @FileName: HyInspectionSettingMappingDAO
* @Description:
* @date 2023-07-18 16:29
*/
@Repository
public class HyInspectionSettingMappingDAO {
@Resource
private HyInspectionSettingMappingMapper hyInspectionSettingMappingMapper;
/**
* 获取区域ids
* @param inspectionSettingId
* @return
*/
public List<Long> getOpenAreaMappingIds(Long inspectionSettingId){
if(Objects.isNull(inspectionSettingId)){
return Lists.newArrayList();
}
return hyInspectionSettingMappingMapper.getOpenAreaMappingIds(inspectionSettingId);
}
/**
* 新增映射关系
* @param inspectionSettingId
* @param openAreaMappingIds
* @return
*/
public Integer addInspectionSettingMapping(Long inspectionSettingId, List<Long> openAreaMappingIds){
if(CollectionUtils.isEmpty(openAreaMappingIds) || Objects.isNull(inspectionSettingId)){
return CommonConstants.ZERO;
}
List<HyInspectionSettingMappingDO> insertList = new ArrayList<>();
for (Long openAreaMappingId : openAreaMappingIds) {
HyInspectionSettingMappingDO insert = new HyInspectionSettingMappingDO();
insert.setInspectionSettingId(inspectionSettingId);
insert.setOpenAreaMappingId(openAreaMappingId);
insert.setCreateTime(new Date());
insert.setDeleted(Boolean.FALSE);
insertList.add(insert);
}
return hyInspectionSettingMappingMapper.batchInsertSelective(insertList);
}
/**
* 更新映射关系
* @param inspectionSettingId
* @param openAreaMappingIds
* @return
*/
public Integer updateInspectionSettingMapping(Long inspectionSettingId, List<Long> openAreaMappingIds){
hyInspectionSettingMappingMapper.deleteNotInOpenAreaMappingIds(inspectionSettingId, openAreaMappingIds);
return addInspectionSettingMapping(inspectionSettingId, openAreaMappingIds);
}
/**
* 删除映射关系
* @param inspectionSettingId
* @return
*/
public Integer deleteInspectionSettingMapping(Long inspectionSettingId){
if(Objects.isNull(inspectionSettingId)){
return CommonConstants.ZERO;
}
return hyInspectionSettingMappingMapper.deleteInspectionSettingMapping(inspectionSettingId);
}
/**
* 获取冲突的映射关系
* @param inspectionSettingId
* @param openAreaMappingIds
* @return
*/
public List<HyInspectionSettingMappingDO> getConflictInspectionSetting(Long inspectionSettingId, List<Long> openAreaMappingIds){
if(CollectionUtils.isEmpty(openAreaMappingIds)){
return Lists.newArrayList();
}
return hyInspectionSettingMappingMapper.getConflictInspectionSetting(inspectionSettingId, openAreaMappingIds);
}
}

View File

@@ -89,6 +89,14 @@ public class HyOpenAreaInfoDAO {
return hyOpenAreaInfoMapper.selectByIds(ids); return hyOpenAreaInfoMapper.selectByIds(ids);
} }
public Map<Long, String> getNameMapByIds(List<Long> ids){
if (CollectionUtils.isEmpty(ids)){
return Maps.newHashMap();
}
List<HyOpenAreaInfoDO> hyOpenAreaInfoDOS = hyOpenAreaInfoMapper.selectByIds(ids);
return ListUtils.emptyIfNull(hyOpenAreaInfoDOS).stream().collect(Collectors.toMap(k->k.getId(), v->v.getAreaName(), (k1, k2)->k1));
}
public Map<String, String> selectNameMapByIds(List<Long> ids){ public Map<String, String> selectNameMapByIds(List<Long> ids){
if (CollectionUtils.isEmpty(ids)){ if (CollectionUtils.isEmpty(ids)){
return Maps.newHashMap(); return Maps.newHashMap();

View File

@@ -108,4 +108,16 @@ public class RegionDAO {
List<String> regionPathList = regionList.stream().map(RegionDO::getRegionPath).collect(Collectors.toList()); List<String> regionPathList = regionList.stream().map(RegionDO::getRegionPath).collect(Collectors.toList());
return regionMapper.getSubRegionIds(regionPathList); return regionMapper.getSubRegionIds(regionPathList);
} }
/**
* 获取子部门
* @param regionId
* @return
*/
public List<RegionDO> getSubRegion(String regionId){
if(StringUtils.isBlank(regionId)){
return Lists.newArrayList();
}
return regionMapper.getSubRegion(regionId);
}
} }

View File

@@ -0,0 +1,61 @@
package com.cool.store.mapper;
import com.cool.store.entity.HyInspectionSettingDO;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author zhangchenbiao
* @date 2023-07-18 04:27
*/
public interface HyInspectionSettingMapper {
/**
*
* 默认插入方法,只会给有值的字段赋值
* 会对传进来的字段做判空处理如果字段为空则使用数据库默认字段或者null
* dateTime:2023-07-18 04:27
*/
int insertSelective(HyInspectionSettingDO record);
/**
*
* 默认更新方法根据主键更新不会把null值更新到数据库避免覆盖之前有值的
* dateTime:2023-07-18 04:27
*/
int updateByPrimaryKeySelective(HyInspectionSettingDO record);
/**
* 获取稽核区域设置分页
* @return
*/
Page<HyInspectionSettingDO> getInspectionSettingPage();
/**
* 获取稽核详情
* @param inspectionSettingId
* @return
*/
HyInspectionSettingDO getInspectionSettingDetail(@Param("inspectionSettingId") Long inspectionSettingId);
/**
* 获取已经配置的稽核人
* @return
*/
List<String> getInspectionUserIds();
/**
* 根据id批量获取
* @param inspectionSettingIds
* @return
*/
List<HyInspectionSettingDO> getHyInspectionSettingByIds(@Param("inspectionSettingIds") List<Long> inspectionSettingIds);
/**
*
* @param inspectionUserId
* @return
*/
List<HyInspectionSettingDO> getHyInspectionSettingByUserId(String inspectionUserId, Long excludeInspectionSettingId);
}

View File

@@ -0,0 +1,57 @@
package com.cool.store.mapper;
import com.cool.store.entity.HyInspectionSettingMappingDO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author zhangchenbiao
* @date 2023-07-18 04:28
*/
public interface HyInspectionSettingMappingMapper {
/**
*
* 默认插入方法,只会给有值的字段赋值
* 会对传进来的字段做判空处理如果字段为空则使用数据库默认字段或者null
* dateTime:2023-07-18 04:28
*/
int batchInsertSelective(@Param("insertList") List<HyInspectionSettingMappingDO> insertList);
/**
*
* 默认更新方法根据主键更新不会把null值更新到数据库避免覆盖之前有值的
* dateTime:2023-07-18 04:28
*/
int updateByPrimaryKeySelective(HyInspectionSettingMappingDO record);
/**
* 获取区域ids
* @param inspectionSettingId
* @return
*/
List<Long> getOpenAreaMappingIds(@Param("inspectionSettingId") Long inspectionSettingId);
/**
* 删除不在的城市
* @param inspectionSettingId
* @param openAreaMappingIds
* @return
*/
Integer deleteNotInOpenAreaMappingIds(@Param("inspectionSettingId") Long inspectionSettingId, @Param("openAreaMappingIds") List<Long> openAreaMappingIds);
/**
* 删除
* @param inspectionSettingId
* @return
*/
Integer deleteInspectionSettingMapping(@Param("inspectionSettingId") Long inspectionSettingId);
/**
*
* @param inspectionSettingId
* @param openAreaMappingIds
* @return
*/
List<HyInspectionSettingMappingDO> getConflictInspectionSetting(@Param("inspectionSettingId") Long inspectionSettingId, @Param("openAreaMappingIds") List<Long> openAreaMappingIds);
}

View File

@@ -78,4 +78,11 @@ public interface RegionMapper {
* @return * @return
*/ */
List<String> getSubRegionIds(@Param("regionPathList") List<String> regionPathList); List<String> getSubRegionIds(@Param("regionPathList") List<String> regionPathList);
/**
* 获取子部门
* @param regionId
* @return
*/
List<RegionDO> getSubRegion(@Param("regionId") String regionId);
} }

View File

@@ -0,0 +1,138 @@
<?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.cool.store.mapper.HyInspectionSettingMapper">
<resultMap id="BaseResultMap" type="com.cool.store.entity.HyInspectionSettingDO">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="zone_name" jdbcType="VARCHAR" property="zoneName"/>
<result column="inspection_user_id" jdbcType="VARCHAR" property="inspectionUserId"/>
<result column="create_user_id" jdbcType="VARCHAR" property="createUserId"/>
<result column="update_user_id" jdbcType="VARCHAR" property="updateUserId"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="deleted" jdbcType="BIT" property="deleted" />
</resultMap>
<sql id="Base_Column_List">
id, zone_name, inspection_user_id, create_user_id, update_user_id, create_time, update_time, deleted
</sql>
<insert id="insertSelective" keyColumn="id" keyProperty="id" useGeneratedKeys="true">
insert into hy_inspection_setting
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="zoneName != null">
zone_name,
</if>
<if test="inspectionUserId != null">
inspection_user_id,
</if>
<if test="createUserId != null">
create_user_id,
</if>
<if test="updateUserId != null">
update_user_id,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="deleted != null">
deleted,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="zoneName != null">
#{zoneName},
</if>
<if test="inspectionUserId != null">
#{inspectionUserId},
</if>
<if test="createUserId != null">
#{createUserId},
</if>
<if test="updateUserId != null">
#{updateUserId},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
<if test="deleted != null">
#{deleted},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective">
update hy_inspection_setting
<set>
<if test="zoneName != null">
zone_name = #{zoneName},
</if>
<if test="inspectionUserId != null">
inspection_user_id = #{inspectionUserId},
</if>
<if test="createUserId != null">
create_user_id = #{createUserId},
</if>
<if test="updateUserId != null">
update_user_id = #{updateUserId},
</if>
<if test="createTime != null">
create_time = #{createTime},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
<if test="deleted != null">
deleted = #{deleted},
</if>
</set>
where id = #{id}
</update>
<select id="getInspectionSettingPage" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from
hy_inspection_setting
where
deleted = '0'
order by create_time desc
</select>
<select id="getInspectionSettingDetail" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from
hy_inspection_setting
where
deleted = '0' and id = #{inspectionSettingId}
</select>
<select id="getInspectionUserIds" resultType="string">
select inspection_user_id from hy_inspection_setting where deleted = '0'
</select>
<select id="getHyInspectionSettingByIds" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from
hy_inspection_setting
where
deleted = '0' and id in <foreach collection="inspectionSettingIds" item="inspectionSettingId" open="(" close=")" separator=",">#{inspectionSettingId}</foreach>
</select>
<select id="getHyInspectionSettingByUserId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from
hy_inspection_setting
where
deleted = '0' and inspection_user_id = #{excludeInspectionSettingId}
<if test="excludeInspectionSettingId != null">
and id != #{excludeInspectionSettingId}
</if>
</select>
</mapper>

View File

@@ -0,0 +1,109 @@
<?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.cool.store.mapper.HyInspectionSettingMappingMapper">
<resultMap id="BaseResultMap" type="com.cool.store.entity.HyInspectionSettingMappingDO">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="inspection_setting_id" jdbcType="BIGINT" property="inspectionSettingId"/>
<result column="open_area_mapping_id" jdbcType="BIGINT" property="openAreaMappingId"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="deleted" jdbcType="BIT" property="deleted" />
</resultMap>
<sql id="Base_Column_List">
id, inspection_setting_id, open_area_mapping_id, create_time, update_time, deleted
</sql>
<insert id="batchInsertSelective">
<foreach collection="insertList" item="record" separator=";">
insert into hy_inspection_setting_mapping
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="record.inspectionSettingId != null">
inspection_setting_id,
</if>
<if test="record.openAreaMappingId != null">
open_area_mapping_id,
</if>
<if test="record.createTime != null">
create_time,
</if>
<if test="record.updateTime != null">
update_time,
</if>
<if test="record.deleted != null">
deleted,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="record.inspectionSettingId != null">
#{record.inspectionSettingId},
</if>
<if test="record.openAreaMappingId != null">
#{record.openAreaMappingId},
</if>
<if test="record.createTime != null">
#{record.createTime},
</if>
<if test="record.updateTime != null">
#{record.updateTime},
</if>
<if test="record.deleted != null">
#{record.deleted},
</if>
</trim>
ON DUPLICATE KEY UPDATE update_time = now(), deleted = values(deleted)
</foreach>
</insert>
<update id="updateByPrimaryKeySelective">
update hy_inspection_setting_mapping
<set>
<if test="inspectionSettingId != null">
inspection_setting_id = #{inspectionSettingId},
</if>
<if test="openAreaMappingId != null">
open_area_mapping_id = #{openAreaMappingId},
</if>
<if test="createTime != null">
create_time = #{createTime},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
<if test="deleted != null">
deleted = #{deleted},
</if>
</set>
where id = #{id}
</update>
<select id="getOpenAreaMappingIds" resultType="long">
select open_area_mapping_id from hy_inspection_setting_mapping where inspection_setting_id = #{inspectionSettingId} and deleted = '0'
</select>
<update id="deleteNotInOpenAreaMappingIds">
update
hy_inspection_setting_mapping
set
deleted = '1' , update_time = new()
where
inspection_setting_id = #{inspectionSettingId} and open_area_mapping_id not in
<foreach collection="openAreaMappingIds" separator="," open="(" close=")" item="openAreaMappingId" >#{openAreaMappingId}</foreach>
</update>
<update id="deleteInspectionSettingMapping">
update hy_inspection_setting_mapping set deleted = '1' , update_time = new() where inspection_setting_id = #{inspectionSettingId}
</update>
<select id="getConflictInspectionSetting" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from
hy_inspection_setting_mapping
where
deleted = '0'
and
open_area_mapping_id in
<foreach collection="openAreaMappingIds" separator="," open="(" close=")" item="openAreaMappingId" >#{openAreaMappingId}</foreach>
<if test="inspectionSettingId != null">
and inspection_setting_id != #{inspectionSettingId}
</if>
</select>
</mapper>

View File

@@ -208,4 +208,13 @@
<select id="getSubRegionIds" resultType="string"> <select id="getSubRegionIds" resultType="string">
select region_id from region where deleted = 0 and <foreach collection="regionPathList" item="regionPath" open="(" close=")" separator="or"> region_path like concat(#{regionPath}, '%')</foreach> select region_id from region where deleted = 0 and <foreach collection="regionPathList" item="regionPath" open="(" close=")" separator="or"> region_path like concat(#{regionPath}, '%')</foreach>
</select> </select>
<select id="getSubRegion" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from
region
where
deleted = 0 and parent_id = #{regionId}
</select>
</mapper> </mapper>

View File

@@ -131,15 +131,15 @@
</update> </update>
<select id="getUserListByRegionId" resultType="string"> <select id="getUserListByRegionId" resultType="string">
select user_id from user_region_mapping where region_id = #{regionId} select user_id from user_region_mapping where region_id = #{regionId} and deleted = '0'
</select> </select>
<select id="getRegionIdsByUserId" resultType="string"> <select id="getRegionIdsByUserId" resultType="string">
select region_id from user_region_mapping where user_id = #{userId} select region_id from user_region_mapping where user_id = #{userId} and deleted = '0'
</select> </select>
<select id="getUserListByRegionIds" resultType="string"> <select id="getUserListByRegionIds" resultType="string">
select user_id from user_region_mapping where region_id in <foreach collection="regionIds" item="regionId" open="(" close=")" separator=",">#{regionId}</foreach> select user_id from user_region_mapping where deleted = '0' and region_id in <foreach collection="regionIds" item="regionId" open="(" close=")" separator=",">#{regionId}</foreach>
</select> </select>
</mapper> </mapper>

View File

@@ -3,4 +3,4 @@ jdbc.url = jdbc:mysql://dingpushcoolcollege.mysql.rds.aliyuncs.com:3306/coolcoll
jdbc.user= coolstore jdbc.user= coolstore
jdbc.password = CSCErYcXniNYm7bT jdbc.password = CSCErYcXniNYm7bT
table.name = sys_menu table.name = hy_inspection_setting_mapping

View File

@@ -0,0 +1,23 @@
package com.cool.store.dto.inspection.setting;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author zhangchenbiao
* @FileName: DeleteInspectionSettingDTO
* @Description: 删除稽核区域设置
* @date 2023-07-17 14:41
*/
@Data
public class CheckInspectionSettingDTO {
@ApiModelProperty("id")
private Long inspectionSettingId;
@ApiModelProperty("归属地ids")
private List<Long> openAreaMappingIds;
}

View File

@@ -0,0 +1,44 @@
package com.cool.store.entity;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
*
* @author zhangchenbiao
* @date 2023-07-18 04:27
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class HyInspectionSettingDO implements Serializable {
@ApiModelProperty("主键id")
private Long id;
@ApiModelProperty("区域名称")
private String zoneName;
@ApiModelProperty("关联稽核人user_id")
private String inspectionUserId;
@ApiModelProperty("新建人ID")
private String createUserId;
@ApiModelProperty("更新人ID")
private String updateUserId;
@ApiModelProperty("创建时间")
private Date createTime;
@ApiModelProperty("修改时间")
private Date updateTime;
@ApiModelProperty("删除标识")
private Boolean deleted;
}

View File

@@ -0,0 +1,38 @@
package com.cool.store.entity;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
*
* @author zhangchenbiao
* @date 2023-07-18 04:28
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class HyInspectionSettingMappingDO implements Serializable {
@ApiModelProperty("主键id")
private Long id;
@ApiModelProperty("稽核区域配置表id,hy_inspection_setting.id")
private Long inspectionSettingId;
@ApiModelProperty("hy_open_area_info.id")
private Long openAreaMappingId;
@ApiModelProperty("创建时间")
private Date createTime;
@ApiModelProperty("修改时间")
private Date updateTime;
@ApiModelProperty("删除标识")
private Boolean deleted;
}

View File

@@ -0,0 +1,52 @@
package com.cool.store.vo.inspection.setting;
import com.cool.store.entity.HyInspectionSettingDO;
import com.cool.store.entity.HyInspectionSettingMappingDO;
import com.google.common.collect.Lists;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.collections4.CollectionUtils;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* @author zhangchenbiao
* @FileName: InspectionSettingPageVO
* @Description:
* @date 2023-07-17 14:32
*/
@Data
public class InspectionSettingCheckVO {
@ApiModelProperty("区域名称")
private String zoneName;
@ApiModelProperty("省市区")
private String areaName;
@ApiModelProperty("稽核人名称")
private String inspectionUsername;
public static List<InspectionSettingCheckVO> convertVO(List<HyInspectionSettingMappingDO> conflictInspectionSetting, List<HyInspectionSettingDO> inspectionSettingList, Map<String, String> userNameMap, Map<Long, String> areaNameMap){
if(CollectionUtils.isEmpty(conflictInspectionSetting) || CollectionUtils.isEmpty(inspectionSettingList)){
return Lists.newArrayList();
}
Map<Long, HyInspectionSettingDO> inspectionSettingMap = inspectionSettingList.stream().collect(Collectors.toMap(k -> k.getId(), Function.identity()));
List<InspectionSettingCheckVO> resultList = new ArrayList<>();
for (HyInspectionSettingMappingDO hyInspectionSettingMapping : conflictInspectionSetting) {
HyInspectionSettingDO inspectionSetting = inspectionSettingMap.get(hyInspectionSettingMapping.getInspectionSettingId());
if(Objects.isNull(inspectionSetting)){
continue;
}
InspectionSettingCheckVO inspectionSettingCheck = new InspectionSettingCheckVO();
inspectionSettingCheck.setInspectionUsername(userNameMap.get(inspectionSetting.getInspectionUserId()));
inspectionSettingCheck.setZoneName(inspectionSetting.getZoneName());
inspectionSettingCheck.setAreaName(areaNameMap.get(hyInspectionSettingMapping.getOpenAreaMappingId()));
resultList.add(inspectionSettingCheck);
}
return resultList;
}
}

View File

@@ -1,10 +1,12 @@
package com.cool.store.vo.inspection.setting; package com.cool.store.vo.inspection.setting;
import com.cool.store.entity.HyInspectionSettingDO;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Objects;
/** /**
* @author zhangchenbiao * @author zhangchenbiao
@@ -25,9 +27,22 @@ public class InspectionSettingDetailVO {
private String inspectionUserId; private String inspectionUserId;
@ApiModelProperty("稽核人名称") @ApiModelProperty("稽核人名称")
private String inspectionUsername; private String inspectionUserName;
@ApiModelProperty("归属地ids") @ApiModelProperty("归属地ids")
private List<Long> openAreaMappingIds; private List<Long> openAreaMappingIds;
public static InspectionSettingDetailVO convertVO(HyInspectionSettingDO param, String inspectionUserName, List<Long> openAreaMappingIds){
if(Objects.isNull(param)){
return null;
}
InspectionSettingDetailVO result = new InspectionSettingDetailVO();
result.setInspectionSettingId(param.getId());
result.setZoneName(param.getZoneName());
result.setInspectionUserId(param.getInspectionUserId());
result.setInspectionUserName(inspectionUserName);
result.setOpenAreaMappingIds(openAreaMappingIds);
return result;
}
} }

View File

@@ -1,9 +1,16 @@
package com.cool.store.vo.inspection.setting; package com.cool.store.vo.inspection.setting;
import com.cool.store.entity.HyInspectionSettingDO;
import com.github.pagehelper.Page;
import com.google.common.collect.Lists;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.apache.commons.collections4.CollectionUtils;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List;
import java.util.Map;
/** /**
* @author zhangchenbiao * @author zhangchenbiao
@@ -24,7 +31,7 @@ public class InspectionSettingPageVO {
private String inspectionUserId; private String inspectionUserId;
@ApiModelProperty("稽核人名称") @ApiModelProperty("稽核人名称")
private String inspectionUsername; private String inspectionUserName;
@ApiModelProperty("更新时间") @ApiModelProperty("更新时间")
private Date updateTime; private Date updateTime;
@@ -32,4 +39,28 @@ public class InspectionSettingPageVO {
@ApiModelProperty("更新人名称") @ApiModelProperty("更新人名称")
private String updateUsername; private String updateUsername;
/**
* dto转vo
* @param pageList
* @param userNameMap
* @return
*/
public static List<InspectionSettingPageVO> convert(Page<HyInspectionSettingDO> pageList, Map<String, String> userNameMap){
if(CollectionUtils.isEmpty(pageList)){
return Lists.newArrayList();
}
List<InspectionSettingPageVO> resultList = new ArrayList<>();
for (HyInspectionSettingDO inspectionSetting : pageList) {
InspectionSettingPageVO result = new InspectionSettingPageVO();
result.setInspectionSettingId(inspectionSetting.getId());
result.setZoneName(inspectionSetting.getZoneName());
result.setInspectionUserId(inspectionSetting.getInspectionUserId());
result.setInspectionUserName(userNameMap.get(inspectionSetting.getInspectionUserId()));
result.setUpdateTime(inspectionSetting.getUpdateTime());
result.setUpdateUsername(userNameMap.get(inspectionSetting.getUpdateUserId()));
resultList.add(result);
}
return resultList;
}
} }

View File

@@ -0,0 +1,89 @@
package com.cool.store.vo.region;
import com.cool.store.entity.EnterpriseUserDO;
import com.cool.store.entity.RegionDO;
import com.google.common.collect.Lists;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
import java.util.Map;
import java.util.Objects;
/**
* @author zhangchenbiao
* @FileName: RegionUserAndSubRegionVO
* @Description:
* @date 2023-07-17 19:34
*/
@Data
public class RegionUserAndSubRegionVO {
@ApiModelProperty("区域列表")
private List<RegionInfo> regionList;
@ApiModelProperty("用户列表")
private List<UserInfo> userList;
public RegionUserAndSubRegionVO(List<RegionInfo> regionList, List<UserInfo> userList) {
this.regionList = regionList;
this.userList = userList;
}
public RegionUserAndSubRegionVO() {
this.regionList = Lists.newArrayList();
this.userList = Lists.newArrayList();
}
@Data
public static class RegionInfo{
@ApiModelProperty("区域id")
private String regionId;
@ApiModelProperty("区域名称")
private String name;
}
@Data
public static class UserInfo{
@ApiModelProperty("用户id")
private String userId;
@ApiModelProperty("用户名")
private String username;
@ApiModelProperty("手机号")
private String mobile;
@ApiModelProperty("头像url")
private String avatar;
}
public static RegionUserAndSubRegionVO convertVO(List<RegionDO> subRegionList, List<String> userIds, Map<String, EnterpriseUserDO> userMap){
List<RegionInfo> regionList = Lists.newArrayList();
List<UserInfo> userList = Lists.newArrayList();
for (RegionDO regionDO : subRegionList) {
RegionInfo region = new RegionInfo();
region.setRegionId(regionDO.getRegionId());
region.setName(regionDO.getName());
regionList.add(region);
}
for (String userId : userIds) {
EnterpriseUserDO enterpriseUser = userMap.get(userId);
if(Objects.isNull(enterpriseUser)){
continue;
}
UserInfo userInfo = new UserInfo();
userInfo.setUserId(userId);
userInfo.setUsername(enterpriseUser.getName());
userInfo.setMobile(enterpriseUser.getMobile());
userInfo.setAvatar(enterpriseUser.getAvatar());
userList.add(userInfo);
}
return new RegionUserAndSubRegionVO(regionList, userList);
}
}

View File

@@ -0,0 +1,74 @@
package com.cool.store.service;
import com.cool.store.dto.inspection.setting.AddInspectionSettingDTO;
import com.cool.store.dto.inspection.setting.CheckInspectionSettingDTO;
import com.cool.store.dto.inspection.setting.DeleteInspectionSettingDTO;
import com.cool.store.dto.inspection.setting.UpdateInspectionSettingDTO;
import com.cool.store.vo.inspection.setting.InspectionSettingCheckVO;
import com.cool.store.vo.inspection.setting.InspectionSettingDetailVO;
import com.cool.store.vo.inspection.setting.InspectionSettingPageVO;
import com.github.pagehelper.PageInfo;
import java.util.List;
/**
* @author zhangchenbiao
* @FileName: InspectionSettingService
* @Description:
* @date 2023-07-18 15:57
*/
public interface InspectionSettingService {
/**
*稽核区域设置列表
* @param pageNum
* @param pageSize
* @return
*/
PageInfo<InspectionSettingPageVO> getInspectionSettingPage(Integer pageNum, Integer pageSize);
/**
* 获取详情
* @param inspectionSettingId
* @return
*/
InspectionSettingDetailVO getInspectionSettingDetail(Long inspectionSettingId);
/**
* 新增稽核区域设置
* @param userId
* @param param
* @return
*/
Long addInspectionSetting(String userId, AddInspectionSettingDTO param);
/**
* 更新稽核区域设置
* @param userId
* @param param
* @return
*/
Integer updateInspectionSetting(String userId, UpdateInspectionSettingDTO param);
/**
* 删除稽核区域设置
* @param userId
* @param inspectionSettingId
* @return
*/
Integer deleteInspectionSetting(String userId, Long inspectionSettingId);
/**
* 校验稽核区域设置
* @param param
* @return
*/
List<InspectionSettingCheckVO> checkInspectionSetting(CheckInspectionSettingDTO param);
/**
* 获取已经绑定的人员
* @return
*/
List<String> getBingUser();
}

View File

@@ -1,6 +1,7 @@
package com.cool.store.service; package com.cool.store.service;
import com.cool.store.vo.region.RegionBaseInfoVO; import com.cool.store.vo.region.RegionBaseInfoVO;
import com.cool.store.vo.region.RegionUserAndSubRegionVO;
import java.util.List; import java.util.List;
@@ -18,4 +19,13 @@ public interface RegionService {
*/ */
RegionBaseInfoVO getRegionBaseInfoList(); RegionBaseInfoVO getRegionBaseInfoList();
/**
* 获取部门下的子部门和人
* @param regionId
* @return
*/
RegionUserAndSubRegionVO getRegionUserAndSubRegion(String regionId);
} }

View File

@@ -0,0 +1,143 @@
package com.cool.store.service.impl;
import com.cool.store.dao.EnterpriseUserDAO;
import com.cool.store.dao.HyInspectionSettingDAO;
import com.cool.store.dao.HyInspectionSettingMappingDAO;
import com.cool.store.dao.HyOpenAreaInfoDAO;
import com.cool.store.dto.inspection.setting.AddInspectionSettingDTO;
import com.cool.store.dto.inspection.setting.CheckInspectionSettingDTO;
import com.cool.store.dto.inspection.setting.UpdateInspectionSettingDTO;
import com.cool.store.entity.HyInspectionSettingDO;
import com.cool.store.entity.HyInspectionSettingMappingDO;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.service.InspectionSettingService;
import com.cool.store.vo.inspection.setting.InspectionSettingCheckVO;
import com.cool.store.vo.inspection.setting.InspectionSettingDetailVO;
import com.cool.store.vo.inspection.setting.InspectionSettingPageVO;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author zhangchenbiao
* @FileName: InspectionSettingServiceImpl
* @Description:
* @date 2023-07-18 16:06
*/
@Service
public class InspectionSettingServiceImpl implements InspectionSettingService {
@Resource
private HyInspectionSettingDAO hyInspectionSettingDAO;
@Resource
private HyInspectionSettingMappingDAO hyInspectionSettingMappingDAO;
@Resource
private EnterpriseUserDAO enterpriseUserDAO;
@Resource
private HyOpenAreaInfoDAO hyOpenAreaInfoDAO;
@Override
public PageInfo<InspectionSettingPageVO> getInspectionSettingPage(Integer pageNum, Integer pageSize) {
Page<HyInspectionSettingDO> inspectionSettingPage = hyInspectionSettingDAO.getInspectionSettingPage(pageNum, pageSize);
Map<String, String> userNameMap = new HashMap<>();
if(CollectionUtils.isNotEmpty(inspectionSettingPage)){
List<String> userIds = inspectionSettingPage.stream().map(HyInspectionSettingDO::getInspectionUserId).distinct().collect(Collectors.toList());
List<String> updateUserIds = inspectionSettingPage.stream().map(HyInspectionSettingDO::getUpdateUserId).distinct().collect(Collectors.toList());
userIds.addAll(updateUserIds);
userNameMap = enterpriseUserDAO.getUserNameMap(userIds);
}
List<InspectionSettingPageVO> resultList = InspectionSettingPageVO.convert(inspectionSettingPage, userNameMap);
PageInfo resultPage = new PageInfo(inspectionSettingPage);
resultPage.setList(resultList);
return resultPage;
}
@Override
public InspectionSettingDetailVO getInspectionSettingDetail(Long inspectionSettingId) {
HyInspectionSettingDO inspectionSetting = hyInspectionSettingDAO.getInspectionSettingDetail(inspectionSettingId);
if(Objects.isNull(inspectionSetting)){
return null;
}
List<Long> openAreaMappingIds = hyInspectionSettingMappingDAO.getOpenAreaMappingIds(inspectionSettingId);
String inspectionUsername = enterpriseUserDAO.getUserName(inspectionSetting.getInspectionUserId());
return InspectionSettingDetailVO.convertVO(inspectionSetting, inspectionUsername, openAreaMappingIds);
}
@Override
@Transactional(rollbackFor = Exception.class)
public Long addInspectionSetting(String userId, AddInspectionSettingDTO param) {
List<HyInspectionSettingDO> inspectionUserSetting = hyInspectionSettingDAO.getHyInspectionSettingByUserId(param.getInspectionUserId(), null);
if(CollectionUtils.isNotEmpty(inspectionUserSetting)){
throw new ServiceException(ErrorCodeEnum.INSPECTION_USER_OCCUPY);
}
HyInspectionSettingDO inspectionSetting = new HyInspectionSettingDO();
inspectionSetting.setInspectionUserId(param.getInspectionUserId());
inspectionSetting.setZoneName(param.getZoneName());
inspectionSetting.setCreateUserId(userId);
inspectionSetting.setCreateTime(new Date());
Long inspectionSettingId = hyInspectionSettingDAO.addInspectionSetting(inspectionSetting);
List<Long> openAreaMappingIds = param.getOpenAreaMappingIds();
hyInspectionSettingMappingDAO.addInspectionSettingMapping(inspectionSettingId, openAreaMappingIds);
return inspectionSettingId;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Integer updateInspectionSetting(String userId, UpdateInspectionSettingDTO param) {
List<HyInspectionSettingDO> inspectionUserSetting = hyInspectionSettingDAO.getHyInspectionSettingByUserId(param.getInspectionUserId(), param.getInspectionSettingId());
if(CollectionUtils.isNotEmpty(inspectionUserSetting)){
throw new ServiceException(ErrorCodeEnum.INSPECTION_USER_OCCUPY);
}
HyInspectionSettingDO inspectionSetting = new HyInspectionSettingDO();
inspectionSetting.setId(param.getInspectionSettingId());
inspectionSetting.setInspectionUserId(param.getInspectionUserId());
inspectionSetting.setZoneName(param.getZoneName());
inspectionSetting.setUpdateUserId(userId);
inspectionSetting.setUpdateTime(new Date());
hyInspectionSettingDAO.updateInspectionSetting(inspectionSetting);
List<Long> openAreaMappingIds = param.getOpenAreaMappingIds();
return hyInspectionSettingMappingDAO.updateInspectionSettingMapping(param.getInspectionSettingId(), openAreaMappingIds);
}
@Override
@Transactional(rollbackFor = Exception.class)
public Integer deleteInspectionSetting(String userId, Long inspectionSettingId) {
HyInspectionSettingDO inspectionSetting = new HyInspectionSettingDO();
inspectionSetting.setId(inspectionSettingId);
inspectionSetting.setUpdateUserId(userId);
inspectionSetting.setUpdateTime(new Date());
inspectionSetting.setDeleted(Boolean.TRUE);
hyInspectionSettingDAO.updateInspectionSetting(inspectionSetting);
hyInspectionSettingMappingDAO.deleteInspectionSettingMapping(inspectionSettingId);
return hyInspectionSettingDAO.updateInspectionSetting(inspectionSetting);
}
@Override
public List<InspectionSettingCheckVO> checkInspectionSetting(CheckInspectionSettingDTO param) {
if(CollectionUtils.isEmpty(param.getOpenAreaMappingIds())){
return Lists.newArrayList();
}
List<HyInspectionSettingMappingDO> conflictInspectionSetting = hyInspectionSettingMappingDAO.getConflictInspectionSetting(param.getInspectionSettingId(), param.getOpenAreaMappingIds());
List<Long> inspectionSettingIds = ListUtils.emptyIfNull(conflictInspectionSetting).stream().map(HyInspectionSettingMappingDO::getInspectionSettingId).distinct().collect(Collectors.toList());
List<HyInspectionSettingDO> inspectionSettingList = hyInspectionSettingDAO.getHyInspectionSettingByIds(inspectionSettingIds);
List<String> inspectionUserIds = ListUtils.emptyIfNull(inspectionSettingList).stream().map(HyInspectionSettingDO::getInspectionUserId).distinct().collect(Collectors.toList());
List<Long> openAreaMappingIds = ListUtils.emptyIfNull(conflictInspectionSetting).stream().map(HyInspectionSettingMappingDO::getOpenAreaMappingId).distinct().collect(Collectors.toList());
Map<Long, String> areaNameMap = hyOpenAreaInfoDAO.getNameMapByIds(openAreaMappingIds);
Map<String, String> userNameMap = enterpriseUserDAO.getUserNameMap(inspectionUserIds);
return InspectionSettingCheckVO.convertVO(conflictInspectionSetting, inspectionSettingList, userNameMap, areaNameMap);
}
@Override
public List<String> getBingUser() {
return hyInspectionSettingDAO.getInspectionUserIds();
}
}

View File

@@ -1,16 +1,21 @@
package com.cool.store.service.impl; package com.cool.store.service.impl;
import com.cool.store.dao.EnterpriseUserDAO;
import com.cool.store.dao.RegionDAO; import com.cool.store.dao.RegionDAO;
import com.cool.store.dao.UserRegionMappingDAO;
import com.cool.store.entity.EnterpriseUserDO;
import com.cool.store.entity.RegionDO; import com.cool.store.entity.RegionDO;
import com.cool.store.mq.producer.SimpleMessageService; import com.cool.store.mq.producer.SimpleMessageService;
import com.cool.store.service.RegionService; import com.cool.store.service.RegionService;
import com.cool.store.utils.RedisConstantUtil; import com.cool.store.utils.RedisConstantUtil;
import com.cool.store.utils.RedisUtil; import com.cool.store.utils.RedisUtil;
import com.cool.store.vo.region.RegionBaseInfoVO; import com.cool.store.vo.region.RegionBaseInfoVO;
import com.cool.store.vo.region.RegionUserAndSubRegionVO;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @author zhangchenbiao * @author zhangchenbiao
@@ -25,6 +30,10 @@ public class RegionServiceImpl implements RegionService {
private RedisUtil redisUtil; private RedisUtil redisUtil;
@Resource @Resource
private RegionDAO regionDAO; private RegionDAO regionDAO;
@Resource
private UserRegionMappingDAO userRegionMappingDAO;
@Resource
private EnterpriseUserDAO enterpriseUserDAO;
@Override @Override
@@ -32,4 +41,12 @@ public class RegionServiceImpl implements RegionService {
List<RegionDO> regionBaseInfoList = regionDAO.getRegionBaseInfoList(); List<RegionDO> regionBaseInfoList = regionDAO.getRegionBaseInfoList();
return RegionBaseInfoVO.convertTree(regionBaseInfoList); return RegionBaseInfoVO.convertTree(regionBaseInfoList);
} }
@Override
public RegionUserAndSubRegionVO getRegionUserAndSubRegion(String regionId) {
List<RegionDO> subRegionList = regionDAO.getSubRegion(regionId);
List<String> userIds = userRegionMappingDAO.getUserListByRegionId(regionId);
Map<String, EnterpriseUserDO> userMap = enterpriseUserDAO.getUserMap(userIds);
return RegionUserAndSubRegionVO.convertVO(subRegionList, userIds, userMap);
}
} }

View File

@@ -9,10 +9,8 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile; import org.springframework.context.annotation.Profile;
import springfox.documentation.RequestHandler; import springfox.documentation.RequestHandler;
import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.ParameterBuilder;
import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors; import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.schema.ModelRef;
import springfox.documentation.service.ApiInfo; import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Parameter; import springfox.documentation.service.Parameter;
import springfox.documentation.spi.DocumentationType; import springfox.documentation.spi.DocumentationType;
@@ -54,16 +52,13 @@ public class Swagger2Config {
.groupName(groupName) .groupName(groupName)
.select() .select()
.apis(this.scanBasePackage(packages)) .apis(this.scanBasePackage(packages))
.paths(PathSelectors.regex(".*/inspection/setting/.*|.*getRegionUserAndSubRegion"))
.build() .build()
.globalOperationParameters(pars); .globalOperationParameters(pars);
} }
private List<Parameter> getParameters() { private List<Parameter> getParameters() {
List<Parameter> pars = new ArrayList<>(); List<Parameter> pars = new ArrayList<>();
pars.add(new ParameterBuilder().name("accessToken").description("令牌").required(true)
.modelRef(new ModelRef("string"))
.defaultValue("{{accessToken}}")
.parameterType("query").build());
return pars; return pars;
} }

View File

@@ -1,15 +1,22 @@
package com.cool.store.controller; package com.cool.store.controller;
import com.cool.store.context.CurrentUserHolder;
import com.cool.store.dto.inspection.setting.AddInspectionSettingDTO; import com.cool.store.dto.inspection.setting.AddInspectionSettingDTO;
import com.cool.store.dto.inspection.setting.CheckInspectionSettingDTO;
import com.cool.store.dto.inspection.setting.DeleteInspectionSettingDTO; import com.cool.store.dto.inspection.setting.DeleteInspectionSettingDTO;
import com.cool.store.dto.inspection.setting.UpdateInspectionSettingDTO; import com.cool.store.dto.inspection.setting.UpdateInspectionSettingDTO;
import com.cool.store.response.ResponseResult; import com.cool.store.response.ResponseResult;
import com.cool.store.service.InspectionSettingService;
import com.cool.store.vo.inspection.setting.InspectionSettingCheckVO;
import com.cool.store.vo.inspection.setting.InspectionSettingDetailVO;
import com.cool.store.vo.inspection.setting.InspectionSettingPageVO; import com.cool.store.vo.inspection.setting.InspectionSettingPageVO;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
/** /**
@@ -23,46 +30,49 @@ import java.util.List;
@Api(tags = "稽核区域设置") @Api(tags = "稽核区域设置")
public class InspectionSettingController { public class InspectionSettingController {
@Resource
private InspectionSettingService inspectionSettingService;
@ApiOperation("稽核区域设置列表") @ApiOperation("稽核区域设置列表")
@GetMapping("/inspection/setting/page") @GetMapping("/inspection/setting/page")
public ResponseResult<InspectionSettingPageVO> getInspectionSettingPage(@RequestParam("pageNum")Integer pageNum, @RequestParam("pageSize")Integer pageSize){ public ResponseResult<PageInfo<InspectionSettingPageVO>> getInspectionSettingPage(@RequestParam("pageNum")Integer pageNum, @RequestParam("pageSize")Integer pageSize){
return ResponseResult.success(); return ResponseResult.success(inspectionSettingService.getInspectionSettingPage(pageNum, pageSize));
} }
@ApiOperation("稽核区域设置详情") @ApiOperation("稽核区域设置详情")
@GetMapping("/inspection/setting/detail") @GetMapping("/inspection/setting/detail")
public ResponseResult<InspectionSettingPageVO> getInspectionSettingDetail(@RequestParam("inspectionSettingId")Long inspectionSettingId){ public ResponseResult<InspectionSettingDetailVO> getInspectionSettingDetail(@RequestParam("inspectionSettingId")Long inspectionSettingId){
return ResponseResult.success(); return ResponseResult.success(inspectionSettingService.getInspectionSettingDetail(inspectionSettingId));
} }
@ApiOperation("新增稽核区域设置") @ApiOperation("新增稽核区域设置")
@PostMapping("/inspection/setting/add") @PostMapping("/inspection/setting/add")
public ResponseResult<Long> addInspectionSetting(@RequestBody AddInspectionSettingDTO param){ public ResponseResult<Long> addInspectionSetting(@RequestBody AddInspectionSettingDTO param){
return ResponseResult.success(); return ResponseResult.success(inspectionSettingService.addInspectionSetting(CurrentUserHolder.getUserId(), param));
} }
@ApiOperation("编辑稽核区域设置") @ApiOperation("编辑稽核区域设置")
@PostMapping("/inspection/setting/update") @PostMapping("/inspection/setting/update")
public ResponseResult<Integer> updateInspectionSetting(@RequestBody UpdateInspectionSettingDTO param){ public ResponseResult<Integer> updateInspectionSetting(@RequestBody UpdateInspectionSettingDTO param){
return ResponseResult.success(); return ResponseResult.success(inspectionSettingService.updateInspectionSetting(CurrentUserHolder.getUserId(), param));
} }
@ApiOperation("删除稽核区域设置") @ApiOperation("删除稽核区域设置")
@DeleteMapping("/inspection/setting/delete") @PostMapping("/inspection/setting/delete")
public ResponseResult<Integer> deleteInspectionSetting(@RequestBody DeleteInspectionSettingDTO param){ public ResponseResult<Integer> deleteInspectionSetting(@RequestBody DeleteInspectionSettingDTO param){
return ResponseResult.success(); return ResponseResult.success(inspectionSettingService.deleteInspectionSetting(CurrentUserHolder.getUserId(), param.getInspectionSettingId()));
}
@ApiOperation("校验稽核区域设置")
@PostMapping("/inspection/setting/check")
public ResponseResult<List<InspectionSettingCheckVO>> checkInspectionSetting(@RequestBody CheckInspectionSettingDTO param){
return ResponseResult.success(inspectionSettingService.checkInspectionSetting(param));
} }
@ApiOperation("查询已经关联的稽核人") @ApiOperation("查询已经关联的稽核人")
@DeleteMapping("/inspection/setting/bind/users") @GetMapping("/inspection/setting/bind/users")
public ResponseResult<List<String>> getBingUser(){ public ResponseResult<List<String>> getBingUser(){
return ResponseResult.success(); return ResponseResult.success(inspectionSettingService.getBingUser());
}
@ApiOperation("查询已经配置的归属地")
@DeleteMapping("/inspection/setting/bind/open/area")
public ResponseResult<List<Long>> getBingOpenArea(){
return ResponseResult.success();
} }
} }

View File

@@ -4,6 +4,7 @@ import com.cool.store.response.ResponseResult;
import com.cool.store.service.RegionService; import com.cool.store.service.RegionService;
import com.cool.store.service.ZoneService; import com.cool.store.service.ZoneService;
import com.cool.store.vo.region.RegionBaseInfoVO; import com.cool.store.vo.region.RegionBaseInfoVO;
import com.cool.store.vo.region.RegionUserAndSubRegionVO;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
@@ -34,7 +35,7 @@ public class RegionController {
@Resource @Resource
private RegionService regionService; private RegionService regionService;
@Resource @Resource
ZoneService zoneService; private ZoneService zoneService;
@GetMapping("/getRegionList") @GetMapping("/getRegionList")
public ResponseResult<List<RegionBaseInfoVO>> getRegionBaseInfoList(){ public ResponseResult<List<RegionBaseInfoVO>> getRegionBaseInfoList(){
@@ -52,4 +53,10 @@ public class RegionController {
return ResponseResult.success(zoneService.queryAllBingZoneRegionList(type)); return ResponseResult.success(zoneService.queryAllBingZoneRegionList(type));
} }
@ApiOperation("获取部门下的人和部门")
@GetMapping("/getRegionUserAndSubRegion")
public ResponseResult<RegionUserAndSubRegionVO> getRegionUserAndSubRegion(@RequestParam(value = "regionId")String regionId){
return ResponseResult.success(regionService.getRegionUserAndSubRegion(regionId));
}
} }