feat:装修团队配置
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package com.cool.store.enums.Decoration;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2025/10/30 14:35
|
||||
* @Version 1.0
|
||||
*/
|
||||
public enum DecorationUseSystemEnum {
|
||||
|
||||
CRM(1,"CRM"),
|
||||
HQT(2,"红圈通");
|
||||
|
||||
|
||||
private Integer code;
|
||||
|
||||
private String userSystemName;
|
||||
|
||||
|
||||
DecorationUseSystemEnum(Integer code, String userSystemName) {
|
||||
this.code = code;
|
||||
this.userSystemName = userSystemName;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.cool.store.dao.decoration;
|
||||
|
||||
import com.cool.store.dto.decoration.DecorationTeamDTO;
|
||||
import com.cool.store.entity.decoration.DecorationTeamConfigDO;
|
||||
import com.cool.store.mapper.decoration.DecorationTeamConfigMapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
@@ -33,5 +34,9 @@ public class DecorationTeamConfigDAO {
|
||||
return decorationTeamConfigMapper.selectByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public List<DecorationTeamDTO> listByCondition(){
|
||||
return decorationTeamConfigMapper.listByCondition();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.cool.store.dao.decoration;
|
||||
|
||||
import com.aliyun.openservices.shade.com.google.common.collect.Maps;
|
||||
import com.cool.store.dto.decoration.TeamAreaMappingDTO;
|
||||
import com.cool.store.entity.decoration.TeamAreaMappingDO;
|
||||
import com.cool.store.mapper.decoration.TeamAreaMappingMapper;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
@@ -7,6 +9,8 @@ import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
@@ -47,6 +51,14 @@ public class TeamAreaMappingDAO {
|
||||
}
|
||||
|
||||
|
||||
public Map<Long, List<TeamAreaMappingDTO>> listByTeamIdList(List<Long> teamIdList){
|
||||
if (CollectionUtils.isEmpty(teamIdList)){
|
||||
return Maps.newHashMap();
|
||||
}
|
||||
List<TeamAreaMappingDTO> teamAreaMappingDTOS = teamAreaMappingMapper.listByTeamIdList(teamIdList);
|
||||
Map<Long, List<TeamAreaMappingDTO>> map = teamAreaMappingDTOS.stream().collect(Collectors.groupingBy(TeamAreaMappingDTO::getTeamId));
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,20 @@
|
||||
package com.cool.store.mapper.decoration;
|
||||
|
||||
import com.cool.store.dto.decoration.DecorationTeamDTO;
|
||||
import com.cool.store.entity.decoration.DecorationTeamConfigDO;
|
||||
import tk.mybatis.mapper.common.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface DecorationTeamConfigMapper extends Mapper<DecorationTeamConfigDO> {
|
||||
|
||||
|
||||
/**
|
||||
* 查询团队
|
||||
* @return
|
||||
*/
|
||||
List<DecorationTeamDTO> listByCondition();
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -13,4 +13,15 @@
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
<result column="deleted" jdbcType="TINYINT" property="deleted" />
|
||||
</resultMap>
|
||||
|
||||
<select id="listByCondition" resultType="com.cool.store.dto.decoration.DecorationTeamDTO">
|
||||
select
|
||||
t.id,
|
||||
t.team_name,
|
||||
t.team_code,
|
||||
t.use_system
|
||||
from
|
||||
zxjp_decoration_team_config
|
||||
where deleted = 0
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -2,6 +2,8 @@ package com.cool.store.dto.decoration;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2025/10/29 18:41
|
||||
@@ -9,4 +11,15 @@ import lombok.Data;
|
||||
*/
|
||||
@Data
|
||||
public class DecorationTeamDTO {
|
||||
|
||||
private Long id;
|
||||
|
||||
private String teamName;
|
||||
|
||||
private String teamCode;
|
||||
|
||||
private Integer useSystem;
|
||||
|
||||
private List<TeamAreaMappingDTO> cityList;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
package com.cool.store.service;
|
||||
|
||||
import com.cool.store.common.PageBasicInfo;
|
||||
import com.cool.store.dto.decoration.DecorationTeamDTO;
|
||||
import com.cool.store.request.decoration.AddTeamRequest;
|
||||
import com.cool.store.request.decoration.UpdateTeamRequest;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
@@ -32,6 +37,13 @@ public interface DecorationHandleService {
|
||||
*/
|
||||
Boolean deleteByTeamId(Long teamId);
|
||||
|
||||
/**
|
||||
* pageBasicInfo
|
||||
* 根据条件查询团队
|
||||
* @return
|
||||
*/
|
||||
PageInfo<DecorationTeamDTO> listByCondition(PageBasicInfo pageBasicInfo );
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package com.cool.store.service.impl;
|
||||
|
||||
import com.cool.store.common.PageBasicInfo;
|
||||
import com.cool.store.dao.decoration.DecorationTeamConfigDAO;
|
||||
import com.cool.store.dao.decoration.TeamAreaMappingDAO;
|
||||
import com.cool.store.dto.decoration.DecorationTeamDTO;
|
||||
import com.cool.store.dto.decoration.TeamAreaMappingDTO;
|
||||
import com.cool.store.entity.decoration.DecorationTeamConfigDO;
|
||||
import com.cool.store.enums.ErrorCodeEnum;
|
||||
import com.cool.store.exception.ServiceException;
|
||||
@@ -10,11 +13,16 @@ import com.cool.store.request.decoration.UpdateTeamRequest;
|
||||
import com.cool.store.service.DecorationHandleService;
|
||||
import com.cool.store.utils.RedisUtilPool;
|
||||
import com.cool.store.utils.StringUtil;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
@@ -80,6 +88,22 @@ public class DecorationHandleServiceImpl implements DecorationHandleService {
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageInfo<DecorationTeamDTO> listByCondition(PageBasicInfo pageBasicInfo) {
|
||||
PageHelper.startPage(pageBasicInfo.getPageNum(), pageBasicInfo.getPageSize());
|
||||
List<DecorationTeamDTO> list = decorationTeamConfigDAO.listByCondition();
|
||||
if (CollectionUtils.isEmpty(list)){
|
||||
return new PageInfo<>();
|
||||
}
|
||||
List<Long> teamIds = list.stream().map(DecorationTeamDTO::getId).collect(Collectors.toList());
|
||||
Map<Long, List<TeamAreaMappingDTO>> listMap = teamAreaMappingDAO.listByTeamIdList(teamIds);
|
||||
list.forEach(x->{
|
||||
x.setCityList(listMap.get(x.getId()));
|
||||
});
|
||||
PageInfo<DecorationTeamDTO> result = new PageInfo<>(list);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public String getNextNumber() {
|
||||
Long current = redisUtilPool.incrby("counter_key", 1);
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.cool.store.controller.webb;
|
||||
|
||||
import com.cool.store.common.PageBasicInfo;
|
||||
import com.cool.store.dto.decoration.DecorationTeamDTO;
|
||||
import com.cool.store.request.decoration.AddTeamRequest;
|
||||
import com.cool.store.request.decoration.UpdateTeamRequest;
|
||||
import com.cool.store.service.DecorationHandleService;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2025/10/30 18:00
|
||||
* @Version 1.0
|
||||
*/
|
||||
@RequestMapping("/pc/decoration")
|
||||
@RestController
|
||||
@Api(tags = "装修分配团队")
|
||||
@Slf4j
|
||||
public class DecorationAllocationController {
|
||||
|
||||
@Resource
|
||||
private DecorationHandleService decorationHandleService;
|
||||
|
||||
|
||||
@PostMapping("/addTeam")
|
||||
@ApiOperation("添加团队")
|
||||
public Boolean addTeam(AddTeamRequest request){
|
||||
return decorationHandleService.addTeam(request);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
@ApiOperation("修改团队")
|
||||
public Boolean update(UpdateTeamRequest request){
|
||||
return decorationHandleService.update(request);
|
||||
}
|
||||
|
||||
@PostMapping("/deleteByTeamId")
|
||||
@ApiOperation("删除团队")
|
||||
public Boolean deleteByTeamId(Long teamId){
|
||||
return decorationHandleService.deleteByTeamId(teamId);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/listByCondition")
|
||||
@ApiOperation("查询团队")
|
||||
public PageInfo<DecorationTeamDTO> listByCondition(PageBasicInfo pageBasicInfo){
|
||||
return decorationHandleService.listByCondition(pageBasicInfo);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user