高级设置
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
package com.cool.store.dao;
|
||||
|
||||
import com.cool.store.entity.HyAdvancedSettingDO;
|
||||
import com.cool.store.mapper.HyAdvancedSettingMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2023/6/14 20:33
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Repository
|
||||
public class HyAdvancedSettingDAO {
|
||||
|
||||
|
||||
@Resource
|
||||
HyAdvancedSettingMapper hyAdvancedSettingMapper;
|
||||
|
||||
|
||||
public int insertSelective(HyAdvancedSettingDO record){
|
||||
return hyAdvancedSettingMapper.insertSelective(record);
|
||||
}
|
||||
|
||||
public int updateByPrimaryKeySelective( HyAdvancedSettingDO record){
|
||||
return hyAdvancedSettingMapper.updateByPrimaryKeySelective(record);
|
||||
}
|
||||
|
||||
|
||||
public HyAdvancedSettingDO selectAdvanceSetting(){
|
||||
return hyAdvancedSettingMapper.selectAdvanceSetting();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -22,4 +22,10 @@ public interface HyAdvancedSettingMapper {
|
||||
* dateTime:2023-05-29 03:49
|
||||
*/
|
||||
int updateByPrimaryKeySelective(@Param("record") HyAdvancedSettingDO record);
|
||||
|
||||
/**
|
||||
* 查询高级设置
|
||||
* @return
|
||||
*/
|
||||
HyAdvancedSettingDO selectAdvanceSetting();
|
||||
}
|
||||
@@ -16,6 +16,13 @@
|
||||
id, partner_url, allocation_roles, tencent_video_account, tencent_video_key, create_time,
|
||||
update_time, create_user_id, update_user_id
|
||||
</sql>
|
||||
|
||||
<select id="selectAdvanceSetting" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List"></include>
|
||||
from hy_advanced_setting
|
||||
</select>
|
||||
|
||||
<insert id="insertSelective" keyColumn="id" keyProperty="record.id" useGeneratedKeys="true">
|
||||
insert into hy_advanced_setting
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
@@ -73,32 +80,11 @@
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective">
|
||||
update hy_advanced_setting
|
||||
<set>
|
||||
<if test="record.partnerUrl != null">
|
||||
set
|
||||
partner_url = #{record.partnerUrl},
|
||||
</if>
|
||||
<if test="record.allocationRoles != null">
|
||||
allocation_roles = #{record.allocationRoles},
|
||||
</if>
|
||||
<if test="record.tencentVideoAccount != null">
|
||||
tencent_video_account = #{record.tencentVideoAccount},
|
||||
</if>
|
||||
<if test="record.tencentVideoKey != null">
|
||||
tencent_video_key = #{record.tencentVideoKey},
|
||||
</if>
|
||||
<if test="record.createTime != null">
|
||||
create_time = #{record.createTime},
|
||||
</if>
|
||||
<if test="record.updateTime != null">
|
||||
update_time = #{record.updateTime},
|
||||
</if>
|
||||
<if test="record.createUserId != null">
|
||||
create_user_id = #{record.createUserId},
|
||||
</if>
|
||||
<if test="record.updateUserId != null">
|
||||
update_user_id = #{record.updateUserId},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{record.id}
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -22,6 +22,4 @@ public class AdvancedSettingRequest {
|
||||
|
||||
private String tencentVideoKey;
|
||||
|
||||
private List<String> roleIdList;
|
||||
|
||||
}
|
||||
|
||||
@@ -22,6 +22,4 @@ public class AdvancedSettingVO {
|
||||
|
||||
private String tencentVideoKey;
|
||||
|
||||
private List<String> roleIdList;
|
||||
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import lombok.Data;
|
||||
public class OrganizationVO {
|
||||
|
||||
@ApiModelProperty("id")
|
||||
private Long id;
|
||||
private String id;
|
||||
@ApiModelProperty("组织机构名称")
|
||||
private String name;
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.cool.store.service;
|
||||
|
||||
import com.cool.store.request.AdvancedSettingRequest;
|
||||
import com.cool.store.vo.AdvancedSettingVO;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2023/6/14 20:31
|
||||
* @Version 1.0
|
||||
*/
|
||||
public interface AdvanceSettingService {
|
||||
|
||||
|
||||
/**
|
||||
* addAdvanceSetting
|
||||
* @param userId
|
||||
* @param advancedSettingRequest
|
||||
* @return
|
||||
*/
|
||||
Boolean addOrUpdateAdvanceSetting(String userId, AdvancedSettingRequest advancedSettingRequest);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询高级设置详情
|
||||
* @return
|
||||
*/
|
||||
AdvancedSettingVO getAdvancedSettingDetail();
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.cool.store.service.impl;
|
||||
|
||||
import com.cool.store.dao.HyAdvancedSettingDAO;
|
||||
import com.cool.store.entity.HyAdvancedSettingDO;
|
||||
import com.cool.store.request.AdvancedSettingRequest;
|
||||
import com.cool.store.service.AdvanceSettingService;
|
||||
import com.cool.store.vo.AdvancedSettingVO;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2023/6/14 20:31
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Service
|
||||
public class AdvanceSettingServiceImpl implements AdvanceSettingService {
|
||||
|
||||
@Resource
|
||||
HyAdvancedSettingDAO hyAdvancedSettingDAO;
|
||||
|
||||
|
||||
@Override
|
||||
public Boolean addOrUpdateAdvanceSetting(String userId, AdvancedSettingRequest advancedSettingRequest) {
|
||||
if (advancedSettingRequest.getId()!=null){
|
||||
//修改
|
||||
updateAdvanceSetting(userId,advancedSettingRequest);
|
||||
}
|
||||
HyAdvancedSettingDO hyAdvancedSettingDO = new HyAdvancedSettingDO();
|
||||
hyAdvancedSettingDO.setCreateUserId(userId);
|
||||
hyAdvancedSettingDO.setPartnerUrl(advancedSettingRequest.getPartnerUrl());
|
||||
hyAdvancedSettingDO.setTencentVideoAccount(advancedSettingRequest.getTencentVideoAccount());
|
||||
hyAdvancedSettingDO.setTencentVideoKey(advancedSettingRequest.getTencentVideoKey());
|
||||
hyAdvancedSettingDAO.insertSelective(hyAdvancedSettingDO);
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
private Boolean updateAdvanceSetting(String userId, AdvancedSettingRequest advancedSettingRequest) {
|
||||
HyAdvancedSettingDO hyAdvancedSettingDO = new HyAdvancedSettingDO();
|
||||
hyAdvancedSettingDO.setCreateUserId(userId);
|
||||
hyAdvancedSettingDO.setId(advancedSettingRequest.getId());
|
||||
hyAdvancedSettingDO.setPartnerUrl(advancedSettingRequest.getPartnerUrl());
|
||||
hyAdvancedSettingDO.setTencentVideoAccount(advancedSettingRequest.getTencentVideoAccount());
|
||||
hyAdvancedSettingDO.setTencentVideoKey(advancedSettingRequest.getTencentVideoKey());
|
||||
hyAdvancedSettingDAO.updateByPrimaryKeySelective(hyAdvancedSettingDO);
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AdvancedSettingVO getAdvancedSettingDetail() {
|
||||
HyAdvancedSettingDO hyAdvancedSettingDO = hyAdvancedSettingDAO.selectAdvanceSetting();
|
||||
if (hyAdvancedSettingDO==null){
|
||||
return null;
|
||||
}
|
||||
AdvancedSettingVO advancedSettingVO = new AdvancedSettingVO();
|
||||
advancedSettingVO.setId(hyAdvancedSettingDO.getId());
|
||||
advancedSettingVO.setPartnerUrl(hyAdvancedSettingDO.getPartnerUrl());
|
||||
advancedSettingVO.setTencentVideoAccount(hyAdvancedSettingDO.getTencentVideoAccount());
|
||||
advancedSettingVO.setTencentVideoKey(hyAdvancedSettingDO.getTencentVideoKey());
|
||||
return advancedSettingVO;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,7 @@
|
||||
package com.cool.store.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cool.store.dao.EnterpriseUserDAO;
|
||||
import com.cool.store.dao.HyIntendDevMappingDAO;
|
||||
import com.cool.store.dao.HyIntendDevZoneInfoDAO;
|
||||
import com.cool.store.dao.HyOpenAreaInfoDAO;
|
||||
import com.cool.store.dao.*;
|
||||
import com.cool.store.dto.partner.ZoneCheckDTO;
|
||||
import com.cool.store.entity.EnterpriseUserDO;
|
||||
import com.cool.store.entity.HyIntendDevZoneInfoDO;
|
||||
@@ -14,6 +11,9 @@ import com.cool.store.enums.ErrorCodeEnum;
|
||||
import com.cool.store.exception.ServiceException;
|
||||
import com.cool.store.request.IntentAreaSettingRequest;
|
||||
import com.cool.store.service.ZoneService;
|
||||
import com.cool.store.utils.StringUtil;
|
||||
import com.cool.store.vo.OpenAreaSingleVO;
|
||||
import com.cool.store.vo.OrganizationVO;
|
||||
import com.cool.store.vo.ZoneCheckVO;
|
||||
import com.cool.store.vo.ZoneVO;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
@@ -22,10 +22,7 @@ import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -47,6 +44,8 @@ public class ZoneServiceImpl implements ZoneService {
|
||||
HyOpenAreaInfoDAO openAreaInfoDAO;
|
||||
@Resource
|
||||
EnterpriseUserDAO enterpriseUserDAO;
|
||||
@Resource
|
||||
RegionDAO regionDAO;
|
||||
|
||||
|
||||
|
||||
@@ -116,14 +115,19 @@ public class ZoneServiceImpl implements ZoneService {
|
||||
List<String> updateUserIdList = list.stream().map(HyIntendDevZoneInfoDO::getUpdateUserId).collect(Collectors.toList());
|
||||
List<EnterpriseUserDO> updateUserList = enterpriseUserDAO.getUserInfoByUserIds(updateUserIdList);
|
||||
Map<String, String> updateUserNameMap = updateUserList.stream().collect(Collectors.toMap(EnterpriseUserDO::getUserId, EnterpriseUserDO::getName));
|
||||
list.forEach(x->{
|
||||
ZoneVO zoneVO = new ZoneVO();
|
||||
zoneVO.setZoneName(x.getZoneName());
|
||||
zoneVO.setId(x.getId());
|
||||
zoneVO.setUpdateTime(x.getUpdateTime());
|
||||
|
||||
zoneVO.setUpdateUserId(x.getUpdateUserId());
|
||||
Set<String> regionSet = new HashSet<>();
|
||||
list.stream().forEach(x->{
|
||||
if (StringUtil.isNotEmpty(x.getAssociatedRegionId())){
|
||||
List<String> regionIds = JSONObject.parseArray(x.getAssociatedRegionId(), String.class);
|
||||
regionSet.addAll(regionIds);
|
||||
}
|
||||
});
|
||||
Map<String, String> regionMap = regionDAO.getRegionMap(new ArrayList<>(regionSet));
|
||||
list.forEach(x->{
|
||||
ZoneVO zoneVO = handleZoneVO(regionMap, x);
|
||||
zoneVO.setUpdateUserName(updateUserNameMap.get(x.getUpdateUserId()));
|
||||
result.add(zoneVO);
|
||||
});
|
||||
hyIntendDevZoneInfoList.setList(result);
|
||||
return hyIntendDevZoneInfoList;
|
||||
@@ -135,8 +139,44 @@ public class ZoneServiceImpl implements ZoneService {
|
||||
if (hyIntendDevZoneInfoDO==null){
|
||||
throw new ServiceException(ErrorCodeEnum.ZONE_NOT_EXIST);
|
||||
}
|
||||
ZoneVO zoneVO = null;
|
||||
EnterpriseUserDO enterpriseUserDO = enterpriseUserDAO.getUserInfoById(hyIntendDevZoneInfoDO.getUpdateUserId());
|
||||
if (StringUtil.isNotEmpty(hyIntendDevZoneInfoDO.getAssociatedRegionId())){
|
||||
List<String> regionIds = JSONObject.parseArray(hyIntendDevZoneInfoDO.getAssociatedRegionId(), String.class);
|
||||
Map<String, String> regionMap = regionDAO.getRegionMap(regionIds);
|
||||
zoneVO = handleZoneVO(regionMap, hyIntendDevZoneInfoDO);
|
||||
zoneVO.setUpdateUserName(enterpriseUserDO.getName());
|
||||
}
|
||||
List<ZoneCheckDTO> zoneCheckDTOS = hyIntendDevMappingDAO.selectByMappingIdList(Arrays.asList(zoneId));
|
||||
List<OpenAreaSingleVO> openAreaVOS = new ArrayList<>();
|
||||
zoneCheckDTOS.forEach(x->{
|
||||
OpenAreaSingleVO openAreaSingleVO = new OpenAreaSingleVO();
|
||||
openAreaSingleVO.setId(x.getOpenAreaMappingId());
|
||||
openAreaVOS.add(openAreaSingleVO);
|
||||
});
|
||||
zoneVO.setOpenAreaVOS(openAreaVOS);
|
||||
return zoneVO;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
private ZoneVO handleZoneVO(Map<String, String> regionMap,HyIntendDevZoneInfoDO hyIntendDevZoneInfoDO){
|
||||
ZoneVO zoneVO = new ZoneVO();
|
||||
zoneVO.setZoneName(hyIntendDevZoneInfoDO.getZoneName());
|
||||
zoneVO.setId(hyIntendDevZoneInfoDO.getId());
|
||||
zoneVO.setUpdateTime(hyIntendDevZoneInfoDO.getUpdateTime());
|
||||
List<OrganizationVO> organizationVOS = new ArrayList<>();
|
||||
if (StringUtil.isNotEmpty(hyIntendDevZoneInfoDO.getAssociatedRegionId())){
|
||||
List<String> regionIds = JSONObject.parseArray(hyIntendDevZoneInfoDO.getAssociatedRegionId(), String.class);
|
||||
regionIds.forEach(regionId->{
|
||||
OrganizationVO organizationVO = new OrganizationVO();
|
||||
organizationVO.setId(regionId);
|
||||
organizationVO.setName(regionMap.get(regionId));
|
||||
organizationVOS.add(organizationVO);
|
||||
});
|
||||
}
|
||||
zoneVO.setOrgVos(organizationVOS);
|
||||
zoneVO.setUpdateUserId(hyIntendDevZoneInfoDO.getUpdateUserId());
|
||||
return zoneVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.cool.store.controller;
|
||||
|
||||
import com.cool.store.context.CurrentUserHolder;
|
||||
import com.cool.store.dao.HyAdvancedSettingDAO;
|
||||
import com.cool.store.request.AdvancedSettingRequest;
|
||||
import com.cool.store.response.ResponseResult;
|
||||
import com.cool.store.service.AdvanceSettingService;
|
||||
import com.cool.store.vo.AdvancedSettingVO;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2023/6/14 20:48
|
||||
* @Version 1.0
|
||||
*/
|
||||
@RestControlle
|
||||
@Slf4j
|
||||
public class AdvanceSettingController {
|
||||
|
||||
@Resource
|
||||
AdvanceSettingService advanceSettingService;
|
||||
|
||||
@GetMapping(path = "/getAdvanceSetting")
|
||||
@ApiOperation("查询企业高级设置")
|
||||
public ResponseResult<AdvancedSettingVO> getAdvanceSetting(){
|
||||
return ResponseResult.success(advanceSettingService.getAdvancedSettingDetail());
|
||||
}
|
||||
|
||||
@GetMapping(path = "/changeAdvanceSetting")
|
||||
@ApiOperation("新增或者修改高级设置")
|
||||
public ResponseResult<Boolean> getAdvanceSetting(@RequestBody AdvancedSettingRequest advancedSettingRequest){
|
||||
return ResponseResult.success(advanceSettingService.addOrUpdateAdvanceSetting(CurrentUserHolder.getUserId(),advancedSettingRequest));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -290,24 +290,6 @@ public class DeskController {
|
||||
|
||||
|
||||
|
||||
@GetMapping(path = "/getAdvanceSetting")
|
||||
@ApiOperation("查询企业高级设置")
|
||||
public ResponseResult<AdvancedSettingVO> getAdvanceSetting(){
|
||||
|
||||
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
@GetMapping(path = "/changeAdvanceSetting")
|
||||
@ApiOperation("新增或者修改高级设置")
|
||||
public ResponseResult<AdvancedSettingVO> getAdvanceSetting(@RequestBody AdvancedSettingRequest advancedSettingRequest){
|
||||
|
||||
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.cool.store.controller;
|
||||
|
||||
import com.cool.store.context.CurrentUserHolder;
|
||||
import com.cool.store.request.IntentAreaSettingRequest;
|
||||
import com.cool.store.response.ResponseResult;
|
||||
import com.cool.store.service.ZoneService;
|
||||
import com.cool.store.vo.ZoneVO;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
@@ -10,6 +12,8 @@ import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2023/6/14 11:40
|
||||
@@ -19,19 +23,20 @@ import org.springframework.web.bind.annotation.*;
|
||||
@Slf4j
|
||||
public class ZoneController {
|
||||
|
||||
@Resource
|
||||
ZoneService zoneService;
|
||||
|
||||
@PostMapping(path = "/addZone")
|
||||
@ApiOperation("新建意向战区/开发战区")
|
||||
public ResponseResult<Boolean> addZone(@RequestBody IntentAreaSettingRequest intentAreaSettingRequest){
|
||||
|
||||
return ResponseResult.success();
|
||||
return ResponseResult.success(zoneService.addZone( CurrentUserHolder.getUserId(),intentAreaSettingRequest));
|
||||
}
|
||||
|
||||
@PostMapping(path = "/updateZone")
|
||||
@ApiOperation("编辑意向战区/开发战区")
|
||||
public ResponseResult<Boolean> updateZone(@RequestBody IntentAreaSettingRequest intentAreaSettingRequest){
|
||||
|
||||
return ResponseResult.success();
|
||||
return ResponseResult.success(zoneService.updateZone(CurrentUserHolder.getUserId(),intentAreaSettingRequest));
|
||||
}
|
||||
|
||||
@GetMapping(path = "/getZoneList")
|
||||
@@ -42,7 +47,7 @@ public class ZoneController {
|
||||
public ResponseResult<PageInfo<ZoneVO>> getZoneList(@RequestParam(value = "type",required = false)String type,
|
||||
@RequestParam(value = "pageNumber",required = false,defaultValue = "1")Integer pageNumber,
|
||||
@RequestParam(value = "pageSize",required = false,defaultValue = "10")Integer pageSize){
|
||||
return ResponseResult.success();
|
||||
return ResponseResult.success(zoneService.getZoneList(type,pageSize,pageNumber));
|
||||
}
|
||||
|
||||
|
||||
@@ -52,6 +57,15 @@ public class ZoneController {
|
||||
@ApiImplicitParam(name = "id", value = "id", required = false),
|
||||
})
|
||||
public ResponseResult<Boolean> deletedZoneList(@RequestParam(value = "id",required = false)Long id){
|
||||
return ResponseResult.success();
|
||||
return ResponseResult.success(zoneService.deletedZone(id));
|
||||
}
|
||||
|
||||
@GetMapping(path = "/zoneDetail")
|
||||
@ApiOperation("战区详情")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "id", required = false),
|
||||
})
|
||||
public ResponseResult<ZoneVO> zoneDetail(@RequestParam(value = "id",required = false)Long id){
|
||||
return ResponseResult.success(zoneService.zoneDetail(id));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user