代码优化

This commit is contained in:
TL
2025-07-14 13:47:48 +08:00
parent e0f14aa4bf
commit 849bbe998b
18 changed files with 247 additions and 229 deletions

View File

@ -2,7 +2,9 @@ package com.chinaunicom.zyhy.ebtp.supplier.coscosupplier.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.chinaunicom.mall.ebtp.common.base.controller.BaseController;
import com.chinaunicom.mall.ebtp.common.base.entity.BaseCacheUser;
import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse;
import com.chinaunicom.mall.ebtp.common.base.util.TokenUtil;
import com.chinaunicom.zyhy.ebtp.supplier.coscosupplier.entity.*;
import com.chinaunicom.zyhy.ebtp.supplier.coscosupplier.service.ICoscoAccessWorkCategoryService;
import io.swagger.annotations.ApiOperation;
@ -33,6 +35,9 @@ public class CoscoAccessWorkCategoryController extends BaseController {
@ApiOperation("查询分页数据")
@PostMapping("/getPage")
public BaseResponse<IPage<CoscoAccessWork>> getPage(@ApiParam(value = "对象数据", required = true) @RequestBody CoscoAccessWork data) {
BaseCacheUser currentUser = TokenUtil.getCurrentUser();
String userId = currentUser.getUserId();
data.setCreateBy(userId);
return BaseResponse.success(coscoAccessWorkCategoryService.getPage(data));
}

View File

@ -30,7 +30,7 @@ public class CoscoAccessWorkController extends BaseController {
/**
* 供应商准入管理列表&供应商准入评审列表
* 供应商准入管理列表
* @return 返回结果
*/
@ApiOperation("查询分页数据")
@ -39,10 +39,26 @@ public class CoscoAccessWorkController extends BaseController {
//判断当前登录人是否是组长
BaseCacheUser currentUser = TokenUtil.getCurrentUser();
String userId = currentUser.getUserId();
data.setUserId(userId);
data.setCreateBy(userId);
return BaseResponse.success(coscoAccessWorkService.getPage(data));
}
/**
* 供应商准入评审列表
* @return 返回结果
*/
@ApiOperation("查询分页数据")
@PostMapping("/getReviewPage")
public BaseResponse<IPage<CoscoAccessWork>> getUserReviewPage(@ApiParam(value = "对象数据", required = true) @RequestBody CoscoAccessWork data) {
//判断当前登录人是否是组长
BaseCacheUser currentUser = TokenUtil.getCurrentUser();
String userId = currentUser.getUserId();
data.setUserId(userId);
return BaseResponse.success(coscoAccessWorkService.selectCoscoAccessWorkUserReviewPage(data));
}
/**
* 供应商准入审批管理列表
* @return 返回结果

View File

@ -286,7 +286,6 @@ public class CoscoSupplierBaseController extends BaseController {
@ApiOperation("查询数据")
@GetMapping("/{id}")
public BaseResponse<CoscoSupplierVo> get(@ApiParam(value = "主键id", required = true) @PathVariable String id){
return BaseResponse.success(coscoSupplierBaseService.selectCoscoSupplierBaseById(id));
}

View File

@ -48,7 +48,7 @@ public class CoscoSupplierChangeApplyController extends BaseController {
*/
@ApiOperation("查询数据")
@GetMapping("/supplierChangeApplyById/{id}")
public BaseResponse<CoscoSupplierDiffVo> supplierChangeApplyById(@ApiParam(value = "主键id", required = true) @PathVariable String id){
public BaseResponse<CoscoSupplierChangeApply> supplierChangeApplyById(@ApiParam(value = "主键id", required = true) @PathVariable String id){
return BaseResponse.success(coscoSupplierChangeApplyService.supplierChangeApplyById(id));
}

View File

@ -2,7 +2,9 @@ package com.chinaunicom.zyhy.ebtp.supplier.coscosupplier.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.chinaunicom.mall.ebtp.common.base.controller.BaseController;
import com.chinaunicom.mall.ebtp.common.base.entity.BaseCacheUser;
import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse;
import com.chinaunicom.mall.ebtp.common.base.util.TokenUtil;
import com.chinaunicom.zyhy.ebtp.supplier.coscosupplier.entity.CoscoAccessSupplierCategory;
import com.chinaunicom.zyhy.ebtp.supplier.coscosupplier.entity.CoscoSupplierexit;
import com.chinaunicom.zyhy.ebtp.supplier.coscosupplier.entity.CoscoSupplierexitSupplierCategory;
@ -34,6 +36,9 @@ public class CoscoSupplierexitController extends BaseController {
@ApiOperation("查询分页数据")
@PostMapping("/getPage")
public BaseResponse<IPage<CoscoSupplierexit>> getPage(@ApiParam(value = "对象数据", required = true) @RequestBody CoscoSupplierexit data) {
BaseCacheUser currentUser = TokenUtil.getCurrentUser();
String userId = currentUser.getUserId();
data.setCreateBy(userId);
return BaseResponse.success(coscoSupplierexitService.getPage(data));
}

View File

@ -14,9 +14,24 @@ import java.util.List;
*/
public interface CoscoAccessWorkMapper {
/**
* 供应商准入管理列表
* @param page
* @param vo
* @return
*/
IPage<CoscoAccessWork> selectPageList(IPage<CoscoAccessWork> page, @Param("vo") CoscoAccessWork vo);
/**
* 供应商准入评审列表
* @param page
* @param vo
* @return
*/
IPage<CoscoAccessWork> selectCoscoAccessWorkUserReviewPage(IPage<CoscoAccessWork> page, @Param("vo") CoscoAccessWork vo);
IPage<CoscoAccessWork> selectApproveList(CoscoAccessWork coscoAccessWork);
/**

View File

@ -1,6 +1,5 @@
package com.chinaunicom.zyhy.ebtp.supplier.coscosupplier.dao.mapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.chinaunicom.mall.ebtp.common.base.dao.IBaseMapper;
import com.chinaunicom.zyhy.ebtp.supplier.coscoBlack.vo.BlackSupplierVo;

View File

@ -1,18 +0,0 @@
package com.chinaunicom.zyhy.ebtp.supplier.coscosupplier.entity;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class CoscoSupplierDiffVo implements Serializable {
private static final long serialVersionUID = 1L;
//主体任务
private CoscoSupplierChangeApply coscoSupplierChangeApply;
//变更内容集合
private List<CoscoSupplierChangeHistory> coscoSupplierChangeHistoryList;
}

View File

@ -25,6 +25,9 @@ public interface ICoscoAccessWorkService {
*/
IPage<CoscoAccessWork> getPage(CoscoAccessWork data);
IPage<CoscoAccessWork> selectCoscoAccessWorkUserReviewPage(CoscoAccessWork data);
IPage<CoscoAccessWork> getApprovePage(CoscoAccessWork data);

View File

@ -2,8 +2,6 @@ package com.chinaunicom.zyhy.ebtp.supplier.coscosupplier.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.chinaunicom.zyhy.ebtp.supplier.coscosupplier.entity.CoscoSupplierChangeApply;
import com.chinaunicom.zyhy.ebtp.supplier.coscosupplier.entity.CoscoSupplierChangeApplyVo;
import com.chinaunicom.zyhy.ebtp.supplier.coscosupplier.entity.CoscoSupplierDiffVo;
/**
* 中远海运_供应商_供应商信息变更申请Service接口
@ -19,7 +17,7 @@ public interface ICoscoSupplierChangeApplyService {
public CoscoSupplierDiffVo supplierChangeApplyById(String id);
public CoscoSupplierChangeApply supplierChangeApplyById(String id);
public CoscoSupplierChangeApply selectById(String id);

View File

@ -110,6 +110,14 @@ public class CoscoAccessWorkServiceImpl implements ICoscoAccessWorkService {
return coscoAccessWorkMapper.selectPageList(page, data);
}
@Override
public IPage<CoscoAccessWork> selectCoscoAccessWorkUserReviewPage(CoscoAccessWork data) {
IPage<CoscoAccessWork> page = new Page<>(data.getPageNo(), data.getPageSize());
//只查询供应商准入
data.setApplyType(CoscoType.APPLY_TYPE_GYSZR);
return coscoAccessWorkMapper.selectCoscoAccessWorkUserReviewPage(page, data);
}
@Override
public IPage<CoscoAccessWork> getApprovePage(CoscoAccessWork data) {
// 创建分页对象(当前页,每页大小)
@ -477,7 +485,7 @@ public class CoscoAccessWorkServiceImpl implements ICoscoAccessWorkService {
coscoAccessUser.setLastUpdateTime(date);
coscoAccessUserMapper.updateCoscoAccessUserByUserId(coscoAccessUser);
//查询组员待评审的还剩下几条
//查询当前任务下组员待评审的数据还剩下几条,如果所有组员都评审完,将主任务状态修改为结果汇总中,否则修改进行中
CoscoAccessUser coscoAccessUser2 = new CoscoAccessUser();
coscoAccessUser2.setAccessWorkId(vo.getAccessWorkId());
coscoAccessUser2.setStatus(CoscoType.COSCO_ACCESS_USER_STATUS_D);

View File

@ -106,8 +106,11 @@ public class CoscoSupplierBaseServiceImpl extends BaseServiceImpl<CoscoSupplierB
public IPage<CoscoSupplierBase> selectWzrPageList(CoscoSupplierBase coscoSupplierBase) {
IPage<CoscoSupplierBase> page = new Page<>(coscoSupplierBase.getPageNo(), coscoSupplierBase.getPageSize());
//查询当前登录人的部门本级、上级、下级所有已发起和已准入供应商id
BaseCacheUser currentUser = TokenUtil.getCurrentUser();
String userId = currentUser.getUserId();
List<String> deptIds = new ArrayList<>();
deptIds.add("100");
deptIds.add("222");
coscoSupplierBase.setDeptIdList(deptIds);
//查询当前登录人的部门本级、上级、下级,以外的供应商数据
return coscoSupplierBaseMapper.selectWzrPageList(page,coscoSupplierBase);
@ -409,6 +412,8 @@ public class CoscoSupplierBaseServiceImpl extends BaseServiceImpl<CoscoSupplierB
@Transactional
public Integer update(CoscoSupplierVo vo) {
Date date = CoscoDateUtils.getNowDate();
BaseCacheUser currentUser = TokenUtil.getCurrentUser();
String userId = currentUser.getUserId();
//基本信息新增
CoscoSupplierBase coscoSupplierBase = vo.getCoscoSupplierBase();
@ -429,7 +434,7 @@ public class CoscoSupplierBaseServiceImpl extends BaseServiceImpl<CoscoSupplierB
}
//修改基本信息
coscoSupplierBase.setUpdateBy("1");
coscoSupplierBase.setUpdateBy(userId);
coscoSupplierBase.setUpdateTime(date);
coscoSupplierBase.setLastUpdateTime(date);
return coscoSupplierBaseMapper.updateCoscoSupplierBase(coscoSupplierBase);
@ -459,18 +464,20 @@ public class CoscoSupplierBaseServiceImpl extends BaseServiceImpl<CoscoSupplierB
public Integer insertCoscoSupplierChangeApply(CoscoSupplierBase newCoscoSupplierBase,CoscoSupplierBase oldCoscoSupplierBase,CoscoSupplierVo vo) {
Date date = CoscoDateUtils.getNowDate();
String applyId = PropertyUtils.getSnowflakeId();
BaseCacheUser currentUser = TokenUtil.getCurrentUser();
String userId = currentUser.getUserId();
//主体信息---待审批
CoscoSupplierChangeApply coscoSupplierChangeApply = new CoscoSupplierChangeApply();
coscoSupplierChangeApply.setId(applyId);
coscoSupplierChangeApply.setSupplierId(newCoscoSupplierBase.getId());
coscoSupplierChangeApply.setTitle(vo.getTitle());
coscoSupplierChangeApply.setChangeDesc(vo.getChangeDesc());
coscoSupplierChangeApply.setChangeBy("1");
coscoSupplierChangeApply.setChangeBy(userId);
coscoSupplierChangeApply.setChangeTime(date);
coscoSupplierChangeApply.setApproveStatus(CoscoType.APPROVE_STATUS_SPZ);
coscoSupplierChangeApply.setCreateBy("1");
coscoSupplierChangeApply.setCreateBy(userId);
coscoSupplierChangeApply.setCreateTime(date);
coscoSupplierChangeApply.setUpdateBy("1");
coscoSupplierChangeApply.setUpdateBy(userId);
coscoSupplierChangeApply.setUpdateTime(date);
coscoSupplierChangeApply.setLastUpdateTime(date);
@ -494,9 +501,9 @@ public class CoscoSupplierBaseServiceImpl extends BaseServiceImpl<CoscoSupplierB
for(CoscoSupplierSurveyAttachments coscoSupplierSurveyAttachments : vo.getCoscoSupplierSurveyAttachments()){
coscoSupplierSurveyAttachments.setId(CoscoIdUtil.getId());
coscoSupplierSurveyAttachments.setSupplierId(oldCoscoSupplierBase.getId());
coscoSupplierSurveyAttachments.setCreateBy("1");
coscoSupplierSurveyAttachments.setCreateBy(userId);
coscoSupplierSurveyAttachments.setCreateTime(CoscoDateUtils.getNowDate());
coscoSupplierSurveyAttachments.setUpdateBy("1");
coscoSupplierSurveyAttachments.setUpdateBy(userId);
coscoSupplierSurveyAttachments.setUpdateTime(CoscoDateUtils.getNowDate());
coscoSupplierSurveyAttachments.setLastUpdateTime(CoscoDateUtils.getNowDate());
coscoSupplierSurveyAttachmentsMapper.insertCoscoSupplierSurveyAttachments(coscoSupplierSurveyAttachments);
@ -507,14 +514,21 @@ public class CoscoSupplierBaseServiceImpl extends BaseServiceImpl<CoscoSupplierB
return coscoSupplierChangeApplyMapper.insertCoscoSupplierChangeApply(coscoSupplierChangeApply);
}
/**
* 字段比对方法
* @param newCoscoSupplierBase
* @param oldCoscoSupplierBase
* @param supplierChangeApplyId
* @return
*/
public List<CoscoSupplierChangeHistory> compareSupplierChanges(
CoscoSupplierBase newCoscoSupplierBase,
CoscoSupplierBase oldCoscoSupplierBase,
String supplierChangeApplyId) {
List<CoscoSupplierChangeHistory> changeHistories = new ArrayList<>();
BaseCacheUser currentUser = TokenUtil.getCurrentUser();
String userId = currentUser.getUserId();
// 获取对象的所有字段
Field[] fields = CoscoSupplierBase.class.getDeclaredFields();
@ -543,9 +557,9 @@ public class CoscoSupplierBaseServiceImpl extends BaseServiceImpl<CoscoSupplierB
history.setOldValue(Optional.ofNullable(oldValue).map(Object::toString).orElse(null));
history.setNewValue(Optional.ofNullable(newValue).map(Object::toString).orElse(null));
history.setCreateBy("1");
history.setCreateBy(userId);
history.setCreateTime(CoscoDateUtils.getNowDate());
history.setUpdateBy("1");
history.setUpdateBy(userId);
history.setUpdateTime(CoscoDateUtils.getNowDate());
history.setLastUpdateTime(CoscoDateUtils.getNowDate());
changeHistories.add(history);

View File

@ -4,8 +4,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.chinaunicom.zyhy.ebtp.supplier.coscosupplier.dao.mapper.*;
import com.chinaunicom.zyhy.ebtp.supplier.coscosupplier.entity.CoscoSupplierChangeApply;
import com.chinaunicom.zyhy.ebtp.supplier.coscosupplier.entity.CoscoSupplierChangeHistory;
import com.chinaunicom.zyhy.ebtp.supplier.coscosupplier.entity.CoscoSupplierDiffVo;
import com.chinaunicom.zyhy.ebtp.supplier.coscosupplier.service.ICoscoSupplierChangeApplyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -23,8 +21,6 @@ public class CoscoSupplierChangeApplyServiceImpl implements ICoscoSupplierChange
@Autowired
private CoscoSupplierChangeApplyMapper coscoSupplierChangeApplyMapper;
@Autowired
private CoscoSupplierChangeHistoryMapper coscoSupplierChangeHistoryMapper;
@Override
public IPage<CoscoSupplierChangeApply> getPage(CoscoSupplierChangeApply data) {
@ -50,18 +46,8 @@ public class CoscoSupplierChangeApplyServiceImpl implements ICoscoSupplierChange
@Override
public CoscoSupplierDiffVo supplierChangeApplyById(String id) {
CoscoSupplierDiffVo diffVo = new CoscoSupplierDiffVo();
//变更主表 基本信息
CoscoSupplierChangeApply coscoSupplierChangeApply = coscoSupplierChangeApplyMapper.selectCoscoSupplierChangeApplyById(id);
diffVo.setCoscoSupplierChangeApply(coscoSupplierChangeApply);
//变更基本内容
CoscoSupplierChangeHistory coscoSupplierChangeHistory = new CoscoSupplierChangeHistory();
coscoSupplierChangeHistory.setSupplierChangeApplyId(id);
List<CoscoSupplierChangeHistory> coscoSupplierChangeHistoryList = coscoSupplierChangeHistoryMapper.selectCoscoSupplierChangeHistoryList(coscoSupplierChangeHistory);
diffVo.setCoscoSupplierChangeHistoryList(coscoSupplierChangeHistoryList);
return diffVo;
public CoscoSupplierChangeApply supplierChangeApplyById(String id) {
return coscoSupplierChangeApplyMapper.selectCoscoSupplierChangeApplyById(id);
}
@Override