|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
package com.glxp.api.controller.basic;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
|
|
import cn.hutool.core.thread.ThreadUtil;
|
|
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
@ -26,6 +27,7 @@ import com.glxp.api.service.basic.BasicSkProjectService;
|
|
|
|
|
import com.glxp.api.service.basic.UdiRelevanceService;
|
|
|
|
|
import com.glxp.api.service.basic.impl.BasicDestinyRelService;
|
|
|
|
|
import com.glxp.api.util.BeanCopyUtils;
|
|
|
|
|
import com.glxp.api.util.StringUtils;
|
|
|
|
|
import com.glxp.api.util.udi.FilterUdiUtils;
|
|
|
|
|
import org.springframework.validation.BindingResult;
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
@ -37,9 +39,12 @@ import org.springframework.web.context.request.ServletRequestAttributes;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
@RestController
|
|
|
|
|
public class BasicDestinyRelController {
|
|
|
|
@ -64,6 +69,14 @@ public class BasicDestinyRelController {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
|
|
|
|
}
|
|
|
|
|
List<BasicSkProjectResponse> basicSkProjectResponses = basicSkProjectService.filterList(basicSkProjectRequest);
|
|
|
|
|
if (CollectionUtil.isNotEmpty(basicSkProjectResponses)){
|
|
|
|
|
List<Long> pId = basicSkProjectResponses.stream().map(BasicSkProjectResponse::getId).collect(Collectors.toList());
|
|
|
|
|
Map<Long,BigDecimal> priceMap = basicDestinyRelService.sumPriceByRedIds(pId);
|
|
|
|
|
basicSkProjectResponses.forEach( x -> {
|
|
|
|
|
BigDecimal price = priceMap.get(x.getId());
|
|
|
|
|
x.setPrice(String.valueOf(price));
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
PageInfo<BasicSkProjectResponse> pageInfo = new PageInfo<>(basicSkProjectResponses);
|
|
|
|
|
PageSimpleResponse<BasicSkProjectResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
|
|
|
|
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
|
|
|
@ -91,6 +104,7 @@ public class BasicDestinyRelController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AuthAdmin authAdmin = customerService.getUserBean();
|
|
|
|
|
basicSkProjectEntity.setStatus(1);//草稿
|
|
|
|
|
basicSkProjectEntity.setId(IdUtil.getSnowflakeNextId());
|
|
|
|
|
basicSkProjectEntity.setCreateTime(new Date());
|
|
|
|
|
basicSkProjectEntity.setUpdateTime(new Date());
|
|
|
|
@ -287,5 +301,27 @@ public class BasicDestinyRelController {
|
|
|
|
|
return ResultVOUtils.success("后台已开始下载,请稍后刷新查看!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PostMapping("/udiwms/basic/destiny/model/submitSkSkProject")
|
|
|
|
|
public BaseResponse submitSkSkProject(@RequestBody BasicSkProjectEntity basicSkProjectEntity) {
|
|
|
|
|
|
|
|
|
|
Long id = basicSkProjectEntity.getId();
|
|
|
|
|
if (id == null){
|
|
|
|
|
return ResultVOUtils.error(999, "提交失败,id不可以为空!");
|
|
|
|
|
}
|
|
|
|
|
Boolean falgf = basicSkProjectService.generateProduct(id);
|
|
|
|
|
if (!falgf) {
|
|
|
|
|
return ResultVOUtils.error(999, "生成产品失败!");
|
|
|
|
|
}
|
|
|
|
|
AuthAdmin authAdmin = customerService.getUserBean();
|
|
|
|
|
basicSkProjectEntity.setStatus(3);//审核通过
|
|
|
|
|
basicSkProjectEntity.setUpdateTime(new Date());
|
|
|
|
|
basicSkProjectEntity.setUpdateUser(authAdmin.getId() + "");
|
|
|
|
|
|
|
|
|
|
Boolean falg = basicSkProjectService.updateById(basicSkProjectEntity);
|
|
|
|
|
if (!falg) {
|
|
|
|
|
return ResultVOUtils.error(999, "编辑失败!");
|
|
|
|
|
}
|
|
|
|
|
return ResultVOUtils.success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|