|
@@ -1,6 +1,9 @@
|
|
|
package com.ym.mec.web.controller.education;
|
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
|
import com.ym.mec.biz.dal.dao.EmployeeDao;
|
|
|
import com.ym.mec.biz.dal.dao.StudentInstrumentDao;
|
|
@@ -12,21 +15,26 @@ import com.ym.mec.biz.dal.enums.OrderTypeEnum;
|
|
|
import com.ym.mec.biz.dal.page.*;
|
|
|
import com.ym.mec.biz.service.*;
|
|
|
import com.ym.mec.common.controller.BaseController;
|
|
|
+import com.ym.mec.common.dto.BrandDto;
|
|
|
import com.ym.mec.common.entity.HttpResponseResult;
|
|
|
import com.ym.mec.common.page.PageInfo;
|
|
|
import com.ym.mec.common.page.QueryInfo;
|
|
|
+import com.ym.mec.mall.MallFeignService;
|
|
|
import com.ym.mec.util.date.DateUtil;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
+import org.apache.commons.lang.math.NumberUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Objects;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@RequestMapping("${app-config.url.web:}/eduRepair")
|
|
|
@Api(tags = "教务维修服务")
|
|
@@ -53,6 +61,8 @@ public class EduRepairController extends BaseController {
|
|
|
private StudentInstrumentService studentInstrumentService;
|
|
|
@Autowired
|
|
|
private StudentInstrumentDao studentInstrumentDao;
|
|
|
+ @Resource
|
|
|
+ private MallFeignService mallFeignService;
|
|
|
|
|
|
@ApiOperation("获取学生列表")
|
|
|
@GetMapping(value = "/getStudents")
|
|
@@ -113,7 +123,26 @@ public class EduRepairController extends BaseController {
|
|
|
public HttpResponseResult getStudentRepairList(RepairStudentQueryInfo queryInfo) {
|
|
|
queryInfo.setEmployeeId(sysUserService.getUserId());
|
|
|
queryInfo.setPayStatus(2);
|
|
|
- return succeed(studentRepairService.queryPage(queryInfo));
|
|
|
+ PageInfo<StudentRepair> repairPageInfo = studentRepairService.queryPage(queryInfo);
|
|
|
+ List<StudentRepair> rows = repairPageInfo.getRows();
|
|
|
+ if (!rows.isEmpty()) {
|
|
|
+ Map<Long, String> brandIdNameMap = mallFeignService.getList().stream().collect(Collectors.toMap(BrandDto::getId, BrandDto::getName));
|
|
|
+ rows.forEach(row -> {
|
|
|
+ String goodsJson = row.getGoodsJson();
|
|
|
+ if (StringUtils.isNotEmpty(goodsJson)) {
|
|
|
+ JSONArray goods = JSON.parseArray(goodsJson);
|
|
|
+ for (Object good : goods) {
|
|
|
+ JSONObject goodObject = (JSONObject) good;
|
|
|
+ String brand = goodObject.getString("brand");
|
|
|
+ if (Objects.nonNull(brand) && NumberUtils.isNumber(brand)) {
|
|
|
+ goodObject.put("brandName", brandIdNameMap.getOrDefault(Long.valueOf(brand), ""));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ row.setGoodsJson(JSON.toJSONString(goods));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return succeed(repairPageInfo);
|
|
|
}
|
|
|
|
|
|
@ApiOperation("获取乐器种类")
|