6 changed files with 97 additions and 21 deletions
@ -0,0 +1,16 @@ |
|||
package com.win.module.wms.api.team; |
|||
|
|||
|
|||
import com.win.module.wms.api.team.dto.TeamDTO; |
|||
|
|||
import javax.validation.Valid; |
|||
import javax.validation.constraints.NotNull; |
|||
|
|||
public interface TeamServiceAPI { |
|||
/** |
|||
* 获取team信息 |
|||
* @param teamCode |
|||
* @return |
|||
*/ |
|||
TeamDTO getTeam(@Valid @NotNull String teamCode); |
|||
} |
@ -0,0 +1,17 @@ |
|||
package com.win.module.wms.api.team.dto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Data |
|||
public class TeamDTO { |
|||
/** |
|||
* 成员json |
|||
*/ |
|||
private List<String> membersCode; |
|||
/** |
|||
* 班组负责人编码 |
|||
*/ |
|||
private String teamLeaderCode; |
|||
} |
@ -0,0 +1,29 @@ |
|||
package com.win.module.wms.api.team; |
|||
|
|||
import cn.hutool.json.JSONArray; |
|||
import cn.hutool.json.JSONObject; |
|||
import com.win.module.wms.api.team.dto.TeamDTO; |
|||
import com.win.module.wms.dal.dataobject.team.TeamDO; |
|||
import com.win.module.wms.dal.mysql.team.TeamMapper; |
|||
import org.springframework.validation.annotation.Validated; |
|||
|
|||
import javax.annotation.Resource; |
|||
import java.util.stream.Collectors; |
|||
|
|||
@Validated |
|||
public class TeamServiceAPIImpl implements TeamServiceAPI { |
|||
@Resource |
|||
private TeamMapper teamMapper; |
|||
@Override |
|||
public TeamDTO getTeam(String teamCode) { |
|||
TeamDO team = teamMapper.selectOne(TeamDO::getCode,teamCode); |
|||
if (team == null){ |
|||
return null; |
|||
} |
|||
TeamDTO dto = new TeamDTO(){{ |
|||
setTeamLeaderCode(team.getTeamMonitorCode()); |
|||
setMembersCode(new JSONArray(team.getMembers()).stream().map(item-> new JSONObject(item).getStr("username")).collect(Collectors.toList())); |
|||
}}; |
|||
return dto; |
|||
} |
|||
} |
Loading…
Reference in new issue