新增委托验收

master
anthonywj 2 years ago
parent a1a8172dd1
commit f3f717cf17

@ -30,6 +30,7 @@ import com.glxp.api.res.inout.IoOrderDetailResultResponse;
import com.glxp.api.res.inout.IoOrderResponse;
import com.glxp.api.res.sync.SpsSyncOrderResponse;
import com.glxp.api.service.auth.AuthAdminService;
import com.glxp.api.service.auth.InvBusUserService;
import com.glxp.api.service.basic.EntrustReceService;
import com.glxp.api.service.basic.IBasicBussinessTypeService;
import com.glxp.api.service.inout.*;
@ -48,6 +49,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.awt.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -435,6 +437,11 @@ public class IoOrderReviewController extends BaseController {
if (StrUtil.isEmpty(reviewSpmsRequest.getBillNo())) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
Long userId = getUserId();
String errMsg = checkReviewAuth(billNo, userId + "");
if (StrUtil.isNotEmpty(errMsg)) {
return ResultVOUtils.error(500, errMsg);
}
AcceptOrderResponse acceptOrderEntity = new AcceptOrderResponse();
acceptOrderEntity.setBillNo(billNo);
List<IoOrderDetailResultResponse> datas = (List<IoOrderDetailResultResponse>) redisUtil.get(ConstantStatus.REDIS_BILLNO + billNo);
@ -456,7 +463,7 @@ public class IoOrderReviewController extends BaseController {
acceptOrderEntity.setExitAccept(false);
} else {
//获取自助平台待审核单据,并插入到数据库
BaseResponse<SpsSyncOrderResponse> baseResponse = spGetHttp.getReviewOrder(reviewSpmsRequest);
BaseResponse<SpsSyncOrderResponse> baseResponse = spGetHttp.getReviewOrder(reviewSpmsRequest, userId + "");
if (baseResponse.getCode() == 20000) {
SpsSyncOrderResponse spsSyncOrderResponse = baseResponse.getData();
List<IoOrderEntity> orderEntities = spsSyncOrderResponse.getOrderEntities();
@ -490,5 +497,26 @@ public class IoOrderReviewController extends BaseController {
return ResultVOUtils.success(acceptOrderEntity);
}
@Resource
InvBusUserService invBusUserService;
//校验用户是否验收权限
private String checkReviewAuth(String orderId, String userId) {
IoOrderEntity orderEntity = orderService.findByBillNo(orderId);
if (orderEntity.getStatus() != ConstantStatus.ORDER_STATUS_CHECK_REW || orderEntity.getStatus() != ConstantStatus.ORDER_STATUS_CHECK_SUCCESS) {
return "单据非未验收状态,无法审核!";
}
if (!invBusUserService.exitBus(userId, orderEntity.getAction())) {
EntrustReceEntity entrustReceEntity = entrustReceService.findByUnique(orderEntity.getAction(), Long.parseLong(userId));
if (entrustReceEntity == null) {
return "无验收权限!";
}
} else {
return "无验收权限!";
}
return null;
}
}

@ -1,5 +1,8 @@
package com.glxp.api.http.sync;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
@ -10,6 +13,7 @@ import com.glxp.api.entity.basic.ProductInfoEntity;
import com.glxp.api.entity.sync.BasicExportStatusEntity;
import com.glxp.api.entity.sync.IOOrderStatusEntity;
import com.glxp.api.entity.system.SyncDataSetEntity;
import com.glxp.api.idc.service.FileService;
import com.glxp.api.req.basic.ProductInfoFilterRequest;
import com.glxp.api.req.inout.ReviewFinishRequest;
import com.glxp.api.req.inout.ReviewSpmsRequest;
@ -106,9 +110,12 @@ public class SpGetHttpClient {
//获取自助平台验收单据---直连接口
public BaseResponse<SpsSyncOrderResponse> getReviewOrder(ReviewSpmsRequest reviewSpmsRequest) {
public BaseResponse<SpsSyncOrderResponse> getReviewOrder(ReviewSpmsRequest reviewSpmsRequest, String userId) {
String json = JSONUtil.toJsonStr(reviewSpmsRequest);
String result = okHttpCli.doPostJson(getIpUrl() + "/directToSpms" + "/udiwms/order/getReviews", json, buildHeader());
List<String> header = (List<String>) Convert.toList(buildHeader());
header.add("ADMIN_ID");
header.add(userId);
String result = okHttpCli.doPostJson(getIpUrl() + "/directToSpms" + "/udiwms/order/getReviews", json, Convert.toStrArray(header));
BaseResponse<SpsSyncOrderResponse> response =
JSONObject.parseObject(result, new TypeReference<BaseResponse<SpsSyncOrderResponse>>() {
});
@ -372,12 +379,17 @@ public class SpGetHttpClient {
* @param fileNameList
* @return
*/
public BaseResponse<String> postTemplateFile(List<Map<String, String>> fileNameList) {
String json = JSONUtil.toJsonStr(fileNameList);
String result = okHttpCli.doPostJson(getIpUrl() + "/spssync/file/download", json, buildHeader());
BaseResponse<String> response =
JSONObject.parseObject(result, new TypeReference<BaseResponse<String>>() {
});
return response;
@Resource
FileService fileService;
public BaseResponse<String> postTemplateFile(List<String> fileNameList) {
return fileService.upload(fileNameList);
// String json = JSONUtil.toJsonStr(fileNameList);
// String result = okHttpCli.doPostJson(getIpUrl() + "/spssync/file/download", json, buildHeader());
// BaseResponse<String> response =
// JSONObject.parseObject(result, new TypeReference<BaseResponse<String>>() {
// });
// return response;
}
}

@ -5,6 +5,7 @@ import com.glxp.api.entity.auth.InvBusUserEntity;
import com.glxp.api.entity.auth.WarehouseBussinessTypeEntity;
import com.glxp.api.req.auth.FilterInvBusUserRequest;
import com.glxp.api.res.auth.InvBusUserResponse;
import java.util.List;
public interface InvBusUserService {
@ -24,6 +25,9 @@ public interface InvBusUserService {
boolean deleteById(String id);
boolean deleteByUnion(String userId, String subInvCode);
boolean deleteByscAction( String subInvCode, List<String> selectedCodes);
boolean deleteByscAction(String subInvCode, List<String> selectedCodes);
boolean exitBus(String userId, String action);
}

@ -1,6 +1,7 @@
package com.glxp.api.service.auth.impl;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.glxp.api.dao.auth.InvBusUserDao;
import com.glxp.api.entity.auth.InvBusUserEntity;
@ -98,10 +99,15 @@ public class InvBusUserServiceImpl implements InvBusUserService {
}
@Override
public boolean deleteByscAction(String subInvCode,List<String> selectedCodes) {
public boolean deleteByscAction(String subInvCode, List<String> selectedCodes) {
if (CollectionUtils.isEmpty(selectedCodes) || StrUtil.isEmpty(subInvCode)) {
return false;
}
return invBusUserDao.deleteByscAction(subInvCode,selectedCodes);
return invBusUserDao.deleteByscAction(subInvCode, selectedCodes);
}
@Override
public boolean exitBus(String userId, String action) {
return invBusUserDao.exists(new QueryWrapper<InvBusUserEntity>().eq("userId", userId).eq("action", action));
}
}

@ -1338,16 +1338,10 @@ public class HeartService {
//若模板记录不为空,则将模板文件同步过去
String uploadFileLog = "";
if (CollUtil.isNotEmpty(spsSyncSysSettingResponse.getSystemPDFTemplateEntities())) {
List<Map<String, String>> list = new ArrayList<>(spsSyncSysSettingResponse.getSystemPDFTemplateEntities().size() * 2);
// List<Map<String, String>> list = new ArrayList<>(spsSyncSysSettingResponse.getSystemPDFTemplateEntities().size() * 2);
List<String> list = new ArrayList<>();
spsSyncSysSettingResponse.getSystemPDFTemplateEntities().forEach(systemPDFTemplateEntity -> {
//分切文件并封装参数
Map<String, String> pathFileMap = new HashMap<>(1);
pathFileMap.put("fileName", StrUtil.split(systemPDFTemplateEntity.getPath(), "template/").get(1));
list.add(pathFileMap);
Map<String, String> jrxmlPathFileMap = new HashMap<>(1);
jrxmlPathFileMap.put("fileName", StrUtil.split(systemPDFTemplateEntity.getJrxmlPath(), "template/").get(1));
list.add(jrxmlPathFileMap);
list.add(systemPDFTemplateEntity.getPath());
});
BaseResponse<String> response = spGetHttp.postTemplateFile(list);

Loading…
Cancel
Save