|
|
@@ -26,12 +26,15 @@ import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.secure.utils.SecureUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
+import org.springblade.system.user.entity.User;
|
|
|
+import org.springblade.system.user.feign.IUserClient;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import javax.validation.Valid;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
@@ -47,6 +50,7 @@ import java.util.List;
|
|
|
public class CorpsDescController extends BladeController {
|
|
|
|
|
|
private final ICorpsDescService corpsDescService;
|
|
|
+ private final IUserClient userClient;
|
|
|
|
|
|
/**
|
|
|
* 详情
|
|
|
@@ -69,6 +73,23 @@ public class CorpsDescController extends BladeController {
|
|
|
corpsDesc.setIsDeleted(0);//默认查有效的
|
|
|
corpsDesc.setTenantId(SecureUtil.getTenantId());
|
|
|
IPage<CorpsDescVO> pages = corpsDescService.selectCorpsDescPage(Condition.getPage(query), corpsDesc);
|
|
|
+ if (CollectionUtils.isNotEmpty(pages.getRecords())){
|
|
|
+ pages.getRecords().stream().forEach(item ->{
|
|
|
+ if(StringUtils.isNotBlank(item.getAdminProfiles())){
|
|
|
+ List<String> list = Arrays.asList(item.getAdminProfiles().split(","));
|
|
|
+ StringBuffer stringBuffer = new StringBuffer();
|
|
|
+ if (CollectionUtils.isNotEmpty(list)){
|
|
|
+ list.stream().forEach(items ->{
|
|
|
+ R<User> user = userClient.userInfoById(Long.valueOf(items));
|
|
|
+ if (user.isSuccess() && user.getData() != null){
|
|
|
+ stringBuffer.append(user.getData().getName()+",");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ item.setAdminProfilesName(stringBuffer.toString());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
return R.data(pages);
|
|
|
}
|
|
|
|
|
|
@@ -152,13 +173,13 @@ public class CorpsDescController extends BladeController {
|
|
|
@PostMapping("/import-desc")
|
|
|
@ApiOperationSupport(order = 12)
|
|
|
@ApiOperation(value = "导入客户资料", notes = "传入excel")
|
|
|
- public R importUser(MultipartFile file) {
|
|
|
+ public R importUser(@RequestParam("file") MultipartFile file,@RequestParam("corpType")String corpType) {
|
|
|
List<CorpsExcel> excelList = ExcelUtil.read(file, CorpsExcel.class);
|
|
|
if(CollectionUtils.isEmpty(excelList))
|
|
|
{
|
|
|
throw new SecurityException("数据不能为空");
|
|
|
}
|
|
|
- return corpsDescService.importUser(excelList,false);
|
|
|
+ return corpsDescService.importUser(excelList,false,corpType);
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -170,7 +191,7 @@ public class CorpsDescController extends BladeController {
|
|
|
@ApiOperation(value = "导出模板")
|
|
|
public void exportPrice(HttpServletResponse response) {
|
|
|
List<CorpsExcel> list = new ArrayList<>();
|
|
|
- ExcelUtil.export(response, "客户导入模板", "客户导入数据表", list, CorpsExcel.class);
|
|
|
+ ExcelUtil.export(response, "导入模板", "导入数据表", list, CorpsExcel.class);
|
|
|
}
|
|
|
/**
|
|
|
* 客户信息
|