首页跳转修改

This commit is contained in:
10002327 2024-08-08 14:24:47 +08:00
parent a896dbd22e
commit c09b3ab368
5 changed files with 49 additions and 18 deletions

View File

@ -16,6 +16,8 @@ import com.nflg.product.material.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import nflg.product.common.vo.ResultVO;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@ -39,6 +41,7 @@ import java.util.stream.Collectors;
@Api(tags = "主数据平台首页")
@RestController
@RequestMapping("home")
@RefreshScope
public class MaterialHomeApi extends BaseApi {
@Resource
@ -62,6 +65,9 @@ public class MaterialHomeApi extends BaseApi {
@Resource
private StandardCategoryService standardCategoryService;
@Value("${material.home.day:30}")
private Integer homeDay;
@GetMapping("materialManagement")
@ApiOperation("物料管理")
public ResultVO<Map<String,List<MaterialHomeMainVO>>> materialManagement(){
@ -88,7 +94,7 @@ public class MaterialHomeApi extends BaseApi {
@ApiOperation("标准部件")
public ResultVO<Map<String, List<StandardPartPickRuleHomeVO>>> standardPartList(){
//仅取90天内的数据
Date date90 = DateUtil.offsetDay(new Date(),-90);
Date date90 = DateUtil.offsetDay(new Date(),-homeDay);
Map<String, List<StandardPartPickRuleHomeVO>> mp = Maps.newHashMap();
AuthorityDepartmentEntity auDept = authorityDepartmentService.getById(SessionUtil.getPartRowId());

View File

@ -25,11 +25,17 @@ public class MaterialHomeMainVO implements Serializable {
@ApiModelProperty(value = "物料名称")
private String materialName;
@ApiModelProperty(value = "物料分类编码")
private String materialCategoryCode;
@ApiModelProperty(value = "对应的物料大类")
private String relCategoryCode;
@ApiModelProperty(value = "流程状态")
private Integer processState;
@ApiModelProperty(value = "流程状态名称")
private String processStateName;
}

View File

@ -161,6 +161,9 @@ public class MaterialMainService extends ServiceImpl<MaterialMainMapper, Materia
@Resource
private ConnectPooled connectPooled;
@Value("${material.home.day:30}")
private Integer homeDay;
/**
* 分页查询所有数据
*
@ -2886,8 +2889,8 @@ public class MaterialMainService extends ServiceImpl<MaterialMainMapper, Materia
*/
public List<MaterialHomeMainVO> listByHome(Integer processState,Integer limitNums){
List<MaterialHomeMainVO> rlist = Lists.newArrayList();
//仅取90天内的数据
Date date90 = DateUtil.offsetDay(new Date(),-90);
//仅取30天内的数据
Date date90 = DateUtil.offsetDay(new Date(),-homeDay);
LambdaQueryWrapper<MaterialMainEntity> lw = Wrappers.<MaterialMainEntity>lambdaQuery()
.eq(MaterialMainEntity::getCreatedBy, SessionUtil.getUserCode());
//消息提醒仅获取已驳回的记录
@ -2895,18 +2898,27 @@ public class MaterialMainService extends ServiceImpl<MaterialMainMapper, Materia
lw.eq(MaterialMainEntity::getProcessState,processState);
lw.ge(MaterialMainEntity::getRejectTime,date90).orderByDesc(MaterialMainEntity::getRejectTime);
}else{
lw.ge(MaterialMainEntity::getCreatedTime,date90).orderByDesc(MaterialMainEntity::getCreatedTime);
lw.ge(MaterialMainEntity::getCreatedTime,date90)
.orderByAsc(MaterialMainEntity::getProcessState).orderByDesc(MaterialMainEntity::getCreatedTime);
}
lw.last(String.format("limit %d",limitNums));
List<MaterialMainEntity> mainList = this.list(lw);
if(!mainList.isEmpty()){
List<String> categoryCodeList = mainList.stream().map(MaterialMainEntity::getMaterialCategoryCode)
.distinct().collect(Collectors.toList());
List<MaterialCategoryEntity> categoryList = materialCategoryService.list(Wrappers.<MaterialCategoryEntity>lambdaQuery()
.in(MaterialCategoryEntity::getCategoryCode,categoryCodeList));
Map<String,String> categoryMap = categoryList.stream().collect(Collectors
.toMap(MaterialCategoryEntity::getCategoryCode,MaterialCategoryEntity::getRelCategoryCode,(k1,k2)->k1));
rlist = Convert.toList(MaterialHomeMainVO.class,mainList);
rlist.forEach(r -> r.setProcessStateName(Optional.ofNullable(MaterialProcessStateEnum.findDescriptionByValue(r.getProcessState()))
.map(MaterialProcessStateEnum::getDescription).orElse("") ));
rlist.forEach(r -> {
r.setProcessStateName(Optional.ofNullable(MaterialProcessStateEnum.findDescriptionByValue(r.getProcessState()))
.map(MaterialProcessStateEnum::getDescription).orElse("") );
r.setRelCategoryCode(categoryMap.getOrDefault(r.getMaterialCategoryCode(),""));
});
}
return rlist;
}
}

View File

@ -39,6 +39,7 @@ import nflg.product.common.vo.ResultVO;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody;
@ -84,6 +85,9 @@ public class MaterialUpdateBillService extends ServiceImpl<MaterialUpdateBillMap
@Resource
AuthorityDepartmentService departmentService;
@Value("${material.home.day:30}")
private Integer homeDay;
/**
* 分页查询所有数据
*
@ -975,7 +979,7 @@ public class MaterialUpdateBillService extends ServiceImpl<MaterialUpdateBillMap
public List<MaterialHomeMainVO> listByHome(Integer billState,Integer limitNums){
List<MaterialHomeMainVO> rlist = Lists.newArrayList();
//仅取90天内的数据
Date date90 = DateUtil.offsetDay(new Date(),-90);
Date date90 = DateUtil.offsetDay(new Date(),-homeDay);
LambdaQueryWrapper<MaterialUpdateBillEntity> lw = Wrappers.<MaterialUpdateBillEntity>lambdaQuery()
.eq(MaterialUpdateBillEntity::getCreatedBy,SessionUtil.getUserCode());
@ -987,16 +991,12 @@ public class MaterialUpdateBillService extends ServiceImpl<MaterialUpdateBillMap
.orderByDesc(MaterialUpdateBillEntity::getRejectTime);
}else{
lw.ge(MaterialUpdateBillEntity::getCreatedTime,date90)
.orderByAsc(MaterialUpdateBillEntity::getBillState)
.orderByDesc(MaterialUpdateBillEntity::getCreatedTime);
}
lw.last(String.format("limit %d",limitNums));
List<MaterialUpdateBillEntity> entityList = this.list(Wrappers.<MaterialUpdateBillEntity>lambdaQuery()
.eq(MaterialUpdateBillEntity::getCreatedBy,SessionUtil.getUserCode())
.eq(null != billState,MaterialUpdateBillEntity::getBillState,billState)
.ge(MaterialUpdateBillEntity::getCreatedTime,date90)
.orderByDesc(MaterialUpdateBillEntity::getCreatedTime)
.last(String.format("limit %d",limitNums)));
List<MaterialUpdateBillEntity> entityList = this.list(lw);
if(!entityList.isEmpty()){
entityList.forEach(e -> {
MaterialHomeMainVO r = Convert.convert(MaterialHomeMainVO.class,e);
@ -1006,6 +1006,7 @@ public class MaterialUpdateBillService extends ServiceImpl<MaterialUpdateBillMap
r.setProcessState(e.getBillState());
r.setProcessStateName(Optional.ofNullable(MaterialUpdateBillStateEnum.findDescriptionByValue(e.getBillState()))
.map(MaterialUpdateBillStateEnum::getDescription).orElse(""));
r.setMaterialCategoryCode(Optional.ofNullable(e.getNewCategoryCode()).orElse(e.getOldCategoryCode()));
rlist.add(r);
});
}

View File

@ -31,6 +31,7 @@ import io.swagger.annotations.ApiOperation;
import nflg.product.common.constant.STATE;
import nflg.product.common.vo.ResultVO;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.ttzero.excel.entity.ListSheet;
@ -81,6 +82,9 @@ public class EbomApi extends BaseApi {
@Resource
private BomNewNoticeNumService bomNewNoticeNumService;
@Value("${material.home.day:30}")
private Integer homeDay;
@PostMapping("workDetailsListByPage")
@ApiOperation("Ebom-工作明细列表")
@ -567,11 +571,12 @@ public class EbomApi extends BaseApi {
public ResultVO<Map<String,List<BomNewHomeBomVO>>> byHome(){
Map<String,List<BomNewHomeBomVO>> mp = Maps.newHashMap();
//仅取90天内的数据
Date date90 = DateUtil.offsetDay(new Date(),-90);
Date date90 = DateUtil.offsetDay(new Date(),-homeDay);
int limitNums = 5;
List<BomNewEbomParentEntity> eList = bomNewEbomParentService.list(Wrappers.<BomNewEbomParentEntity>lambdaQuery()
.eq(BomNewEbomParentEntity::getCreatedBy,SessionUtil.getUserCode())
.ge(BomNewEbomParentEntity::getCreatedTime,date90)
.orderByAsc(BomNewEbomParentEntity::getEditStatus)
.orderByDesc(BomNewEbomParentEntity::getCreatedTime)
.last(String.format("limit %d",limitNums)));
List<BomNewHomeBomVO> ebomList = Convert.toList(BomNewHomeBomVO.class,eList);
@ -581,6 +586,7 @@ public class EbomApi extends BaseApi {
List<BomNewPbomParentEntity> pList = bomNewPbomParentService.list(Wrappers.<BomNewPbomParentEntity>lambdaQuery()
.eq(BomNewPbomParentEntity::getCreatedBy,SessionUtil.getUserCode())
.ge(BomNewPbomParentEntity::getCreatedTime,date90)
.orderByAsc(BomNewPbomParentEntity::getEditStatus)
.orderByDesc(BomNewPbomParentEntity::getCreatedTime)
.last(String.format("limit %d",limitNums)));