1.调整往来单位和自助平台关联功能

master
x_z 2 years ago
parent 774155618b
commit d25b0321e7

@ -110,4 +110,15 @@ public class StackRulesController {
return ResultVOUtils.success(); return ResultVOUtils.success();
} }
/**
*
*
* @return
*/
@GetMapping("/udims/stackRules/getEnableRulesNum")
public BaseResponse getEnableRulesNum() {
Long num = stackRulesService.getEnableRulesNum();
return ResultVOUtils.success(num);
}
} }

@ -1,20 +1,22 @@
package com.glxp.udi.admin.controller.info; package com.glxp.udi.admin.controller.info;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.glxp.udi.admin.annotation.AuthRuleAnnotation; import com.glxp.udi.admin.annotation.AuthRuleAnnotation;
import com.glxp.udi.admin.common.enums.ResultEnum;
import com.glxp.udi.admin.common.res.BaseResponse; import com.glxp.udi.admin.common.res.BaseResponse;
import com.glxp.udi.admin.common.util.ResultVOUtils;
import com.glxp.udi.admin.entity.info.PlatformEntity; import com.glxp.udi.admin.entity.info.PlatformEntity;
import com.glxp.udi.admin.entity.inout.UnitMaintainEntity; import com.glxp.udi.admin.entity.inout.UnitMaintainPlatform;
import com.glxp.udi.admin.req.info.PlatformLinkRequest;
import com.glxp.udi.admin.req.info.PlatformUserInfoRequest; import com.glxp.udi.admin.req.info.PlatformUserInfoRequest;
import com.glxp.udi.admin.req.inout.DeleteRequest;
import com.glxp.udi.admin.req.inout.PlatformLinkRequest;
import com.glxp.udi.admin.res.PageSimpleResponse; import com.glxp.udi.admin.res.PageSimpleResponse;
import com.glxp.udi.admin.res.info.PlatformLinkResponse; import com.glxp.udi.admin.res.info.PlatformLinkResponse;
import com.glxp.udi.admin.service.info.PlatformService; import com.glxp.udi.admin.service.info.PlatformService;
import com.glxp.udi.admin.service.inout.UnitMaintainService; import com.glxp.udi.admin.service.inout.UnitMaintainService;
import com.glxp.udi.admin.common.enums.ResultEnum;
import com.glxp.udi.admin.common.util.ResultVOUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpEntity; import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
@ -105,14 +107,20 @@ public class PlatformController {
@AuthRuleAnnotation("") @AuthRuleAnnotation("")
@PostMapping("/udims/platform/link") @PostMapping("/udims/platform/link")
public BaseResponse update(@RequestBody UnitMaintainEntity unitMaintainEntity) { public BaseResponse update(@RequestBody PlatformLinkRequest platformLinkRequest) {
PlatformEntity platformEntity = platformService.get(unitMaintainEntity.getPlatformId()); //判断此数据是否重复
String verifyResult = platformService.verifyUnitMaintainPlatform(platformLinkRequest);
if (!verifyResult.equals("success")) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, verifyResult);
}
PlatformEntity platformEntity = platformService.get(platformLinkRequest.getPlatformId());
if (platformEntity != null) { if (platformEntity != null) {
String url = platformEntity.getHost() + "/verify"; String url = platformEntity.getHost() + "/verify";
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
map.put("username", unitMaintainEntity.getPlatformUsername()); map.put("username", platformLinkRequest.getPlatformUsername());
map.put("password", unitMaintainEntity.getPlatformPassword()); map.put("password", platformLinkRequest.getPlatformPassword());
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON_UTF8); headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
@ -129,12 +137,12 @@ public class PlatformController {
Map<String, Object> data = JSON.parseObject(JSON.toJSONString(object.get("data")), Map.class); Map<String, Object> data = JSON.parseObject(JSON.toJSONString(object.get("data")), Map.class);
log.error(JSON.toJSONString(object.get("data"))); log.error(JSON.toJSONString(object.get("data")));
if (data.get("appid") != null) { if (data.get("appid") != null) {
unitMaintainEntity.setAppid(data.get("appid").toString()); platformLinkRequest.setAppid(data.get("appid").toString());
if (data.get("apiKey") != null) { if (data.get("apiKey") != null) {
unitMaintainEntity.setApiKey(data.get("apiKey").toString()); platformLinkRequest.setApiKey(data.get("apiKey").toString());
} }
if (data.get("secretKey") != null) { if (data.get("secretKey") != null) {
unitMaintainEntity.setSecretKey(data.get("secretKey").toString()); platformLinkRequest.setSecretKey(data.get("secretKey").toString());
} }
} else { } else {
return ResultVOUtils.error(500, "关联验证失败,请联系管理人员"); return ResultVOUtils.error(500, "关联验证失败,请联系管理人员");
@ -144,11 +152,12 @@ public class PlatformController {
} else { } else {
return ResultVOUtils.error(500, "关联失败,请联系管理人员"); return ResultVOUtils.error(500, "关联失败,请联系管理人员");
} }
} else { } else {
return ResultVOUtils.error(500, "未查询到平台信息"); return ResultVOUtils.error(500, "未查询到平台信息");
} }
unitMaintainService.updateUnit(unitMaintainEntity); UnitMaintainPlatform unitMaintainPlatform = new UnitMaintainPlatform();
BeanUtil.copyProperties(platformLinkRequest, unitMaintainPlatform);
platformService.saveUnitPlatform(unitMaintainPlatform);
return ResultVOUtils.success("关联成功"); return ResultVOUtils.success("关联成功");
} }
@ -176,11 +185,11 @@ public class PlatformController {
*/ */
@AuthRuleAnnotation("") @AuthRuleAnnotation("")
@PostMapping("/udims/platform/unbind") @PostMapping("/udims/platform/unbind")
public BaseResponse unbindPlatform(String corpId) { public BaseResponse unbindPlatform(DeleteRequest deleteRequest) {
if (StrUtil.isBlank(corpId)) { if (StrUtil.isBlank(deleteRequest.getId())) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL); return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
} }
platformService.unbindPlatform(corpId); platformService.unbindPlatform(deleteRequest.getId());
return ResultVOUtils.success(); return ResultVOUtils.success();
} }

@ -315,66 +315,62 @@ public class OrderController {
if (orderUploadRequest.getOrderIds() != null && orderUploadRequest.getOrderIds().size() > 0) { if (orderUploadRequest.getOrderIds() != null && orderUploadRequest.getOrderIds().size() > 0) {
PostUdimsOrderRequest postUdimsOrderRequest = new PostUdimsOrderRequest(); PostUdimsOrderRequest postUdimsOrderRequest = new PostUdimsOrderRequest();
List<PostUdimsOrderRequest.OrderBean> orderBeans = new ArrayList<>(); List<PostUdimsOrderRequest.OrderBean> orderBeans = new ArrayList<>();
UnitMaintainEntity unitMaintainEntity = null;
String orderId = orderUploadRequest.getOrderIds().get(0); String orderId = orderUploadRequest.getOrderIds().get(0);
OrderEntity orderEntity = orderService.findByOne(orderId); OrderEntity orderEntity = orderService.findByOne(orderId);
if (orderEntity != null) { UnitMaintainPlatform unitMaintainPlatform = platformService.findLinkData(customerService.getCustomerId(), orderEntity.getAction(), orderEntity.getFromCorpId());
unitMaintainEntity = unitMaintainService.selectByUnitId(orderEntity.getFromCorpId()); if (unitMaintainPlatform == null || unitMaintainPlatform.getAppid() == null) {
if (unitMaintainEntity == null || unitMaintainEntity.getAppid() == null) { return ResultVOUtils.error(500, "该往来单位未绑定UDI自助平台");
return ResultVOUtils.error(500, "该往来单位未绑定UDI自助平台"); }
} if (!orderEntity.getAction().equals(unitMaintainPlatform.getSourceAction())) {
if (!orderEntity.getAction().equals(unitMaintainEntity.getSourceAction())) { return ResultVOUtils.error(500, "该单据类型不支持提交!");
return ResultVOUtils.error(500, "该单据类型不支持提交!"); }
} PostUdimsOrderRequest.OrderBean orderBean = new PostUdimsOrderRequest.OrderBean();
PostUdimsOrderRequest.OrderBean orderBean = new PostUdimsOrderRequest.OrderBean(); BeanUtils.copyProperties(orderEntity, orderBean);
BeanUtils.copyProperties(orderEntity, orderBean); orderBean.setAction(unitMaintainPlatform.getTargetAction());
orderBean.setAction(unitMaintainEntity.getTargetAction()); orderBean.setInvStorageCode(unitMaintainPlatform.getInvCode());
orderBean.setInvStorageCode(unitMaintainEntity.getInvCode()); orderBean.setInvWarehouseCode(unitMaintainPlatform.getInvSubCode());
orderBean.setInvWarehouseCode(unitMaintainEntity.getInvSubCode()); WarehouseQueryRequest warehouseQueryRequest = new WarehouseQueryRequest();
WarehouseQueryRequest warehouseQueryRequest = new WarehouseQueryRequest(); warehouseQueryRequest.setOrderId(orderEntity.getOrderId());
warehouseQueryRequest.setOrderId(orderEntity.getOrderId()); List<WarehouseEntity> warehouseEntities = warehouseService.filterWarehouse(warehouseQueryRequest);
List<WarehouseEntity> warehouseEntities = warehouseService.filterWarehouse(warehouseQueryRequest); List<PostUdimsOrderRequest.OrderBean.CodeBean> codeBeans = new ArrayList<>();
List<PostUdimsOrderRequest.OrderBean.CodeBean> codeBeans = new ArrayList<>(); warehouseEntities.forEach(data -> {
UnitMaintainEntity finalUnitMaintainEntity = unitMaintainEntity; PostUdimsOrderRequest.OrderBean.CodeBean codeBean = new PostUdimsOrderRequest.OrderBean.CodeBean();
warehouseEntities.forEach(data -> { BeanUtils.copyProperties(data, codeBean);
PostUdimsOrderRequest.OrderBean.CodeBean codeBean = new PostUdimsOrderRequest.OrderBean.CodeBean(); codeBean.setInvStorageCode(unitMaintainPlatform.getInvCode());
BeanUtils.copyProperties(data, codeBean); codeBean.setInvWarehouseCode(unitMaintainPlatform.getInvSubCode());
codeBean.setInvStorageCode(finalUnitMaintainEntity.getInvCode()); codeBeans.add(codeBean);
codeBean.setInvWarehouseCode(finalUnitMaintainEntity.getInvSubCode()); });
codeBeans.add(codeBean); //查询单据详情
}); FilterOrderDetailRequest filterOrderDetailRequest = new FilterOrderDetailRequest();
//查询单据详情 filterOrderDetailRequest.setOrderId(orderBean.getOrderId());
FilterOrderDetailRequest filterOrderDetailRequest = new FilterOrderDetailRequest(); //单据详情
filterOrderDetailRequest.setOrderId(orderBean.getOrderId()); List<OrderDetailEntity> erpOrderEntities = orderDetailService.filterOrderDetails(filterOrderDetailRequest);
//单据详情 if (CollUtil.isNotEmpty(erpOrderEntities)) {
List<OrderDetailEntity> erpOrderEntities = orderDetailService.filterOrderDetails(filterOrderDetailRequest); List<PostUdimsOrderDetailRequest> orderDetails = new ArrayList<>();
if (CollUtil.isNotEmpty(erpOrderEntities)) { for (OrderDetailEntity orderDetailEntity : erpOrderEntities) {
List<PostUdimsOrderDetailRequest> orderDetails = new ArrayList<>(); PostUdimsOrderDetailRequest orderDetail = new PostUdimsOrderDetailRequest();
for (OrderDetailEntity orderDetailEntity : erpOrderEntities) { orderDetail.setUuidFk(orderDetailEntity.getUuidFk());
PostUdimsOrderDetailRequest orderDetail = new PostUdimsOrderDetailRequest(); orderDetail.setFirstSalesInvNo(orderDetailEntity.getFirstSalesInvNo());
orderDetail.setUuidFk(orderDetailEntity.getUuidFk()); orderDetail.setSecSalesInvNo(orderDetailEntity.getSecSalesInvNo());
orderDetail.setFirstSalesInvNo(orderDetailEntity.getFirstSalesInvNo()); orderDetail.setPrice(orderDetailEntity.getPrice());
orderDetail.setSecSalesInvNo(orderDetailEntity.getSecSalesInvNo()); orderDetail.setInvoiceDate(orderDetailEntity.getInvoiceDate());
orderDetail.setPrice(orderDetailEntity.getPrice()); orderDetail.setSecSalesListNo(orderDetailEntity.getSecSalesListNo());
orderDetail.setInvoiceDate(orderDetailEntity.getInvoiceDate()); orderDetail.setBatchNo(orderDetailEntity.getBatchNo());
orderDetail.setSecSalesListNo(orderDetailEntity.getSecSalesListNo()); orderDetails.add(orderDetail);
orderDetail.setBatchNo(orderDetailEntity.getBatchNo());
orderDetails.add(orderDetail);
}
orderBean.setOrderDetails(orderDetails);
} }
orderBean.setCodes(codeBeans); orderBean.setOrderDetails(orderDetails);
orderBeans.add(orderBean);
postUdimsOrderRequest.setOrderBeans(orderBeans);
} }
PlatformEntity platformEntity = platformService.get(unitMaintainEntity.getPlatformId()); orderBean.setCodes(codeBeans);
orderBeans.add(orderBean);
postUdimsOrderRequest.setOrderBeans(orderBeans);
PlatformEntity platformEntity = platformService.get(unitMaintainPlatform.getPlatformId());
postUdimsOrderRequest.setOrderBeans(orderBeans); postUdimsOrderRequest.setOrderBeans(orderBeans);
log.info("提交单据到自助平台,单据数据:{}", JSONUtil.toJsonStr(postUdimsOrderRequest)); log.info("提交单据到自助平台,单据数据:{}", JSONUtil.toJsonStr(postUdimsOrderRequest));
String response = String response =
HttpClient.uCloudPostSmp(platformEntity.getHost() + "/warehouse/inout/postOrdersUdims", HttpClient.uCloudPostSmp(platformEntity.getHost() + "/warehouse/inout/postOrdersUdims",
postUdimsOrderRequest, unitMaintainEntity.getApiKey(), unitMaintainEntity.getSecretKey()); postUdimsOrderRequest, unitMaintainPlatform.getApiKey(), unitMaintainPlatform.getSecretKey());
log.info("自助平台响应结果:{}", response); log.info("自助平台响应结果:{}", response);
BaseResponse baseResponse = BaseResponse baseResponse =
JSONObject.parseObject(response, new TypeReference<BaseResponse>() { JSONObject.parseObject(response, new TypeReference<BaseResponse>() {

@ -3,7 +3,6 @@ package com.glxp.udi.admin.dao.info;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.glxp.udi.admin.entity.info.PlatformEntity; import com.glxp.udi.admin.entity.info.PlatformEntity;
import com.glxp.udi.admin.res.info.PlatformLinkResponse;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -21,14 +20,6 @@ public interface PlatformDao extends BaseMapper<PlatformEntity> {
PlatformEntity get(String id); PlatformEntity get(String id);
/**
*
*
* @param platformLinkRequest
* @return
*/
List<PlatformLinkResponse> getLinkPlatformList(@Param("customerId") String customerId, @Param("key") String key);
/** /**
* 访 * 访
* *

@ -56,15 +56,6 @@ public interface UnitMaintainDao extends BaseMapper<UnitMaintainEntity> {
*/ */
List<UnitMaintainEntity> getboundUnitMaintains(); List<UnitMaintainEntity> getboundUnitMaintains();
/**
*
*
* @param customerId
* @param action
* @return
*/
Integer checkUpload(@Param("customerId") Long customerId, @Param("action") String action);
/** /**
* *
* *

@ -0,0 +1,100 @@
package com.glxp.udi.admin.entity.inout;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
/**
*
*/
@Data
@TableName(value = "io_unit_maintain_platform")
public class UnitMaintainPlatform {
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* ID
*/
@TableField(value = "unitId")
private String unitId;
/**
* ID
*/
@TableField(value = "customerId")
private Long customerId;
/**
* ID
*/
@TableField(value = "platformId")
private String platformId;
/**
*
*/
@TableField(value = "sourceAction")
private String sourceAction;
/**
*
*/
@TableField(value = "targetAction")
private String targetAction;
/**
*
*/
@TableField(value = "invCode")
private String invCode;
/**
*
*/
@TableField(value = "invSubCode")
private String invSubCode;
/**
*
*/
@TableField(value = "appid")
private String appid;
/**
*
*/
@TableField(value = "secretKey")
private String secretKey;
/**
* ID
*/
@TableField(value = "apiKey")
private String apiKey;
public static final String COL_ID = "id";
public static final String COL_UNITID = "unitId";
public static final String COL_CUSTOMERID = "customerId";
public static final String COL_PLATFORMID = "platformId";
public static final String COL_SOURCEACTION = "sourceAction";
public static final String COL_TARGETACTION = "targetAction";
public static final String COL_INVCODE = "invCode";
public static final String COL_INVSUBCODE = "invSubCode";
public static final String COL_APPID = "appid";
public static final String COL_APIKEY = "apiKey";
public static final String COL_SECRETKEY = "secretKey";
}

@ -1,5 +1,7 @@
package com.glxp.udi.admin.entity.param; package com.glxp.udi.admin.entity.param;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
@ -13,6 +15,7 @@ public class SystemParamConfigCustomerEntity {
/** /**
* ID * ID
*/ */
@TableId(value = "id", type = IdType.AUTO)
private Integer id; private Integer id;
/** /**

@ -1,15 +0,0 @@
package com.glxp.udi.admin.req.info;
import com.glxp.udi.admin.req.ListPageRequest;
import lombok.Data;
/**
*
*/
@Data
public class PlatformLinkRequest extends ListPageRequest {
private String key;
private String customerId;
}

@ -0,0 +1,41 @@
package com.glxp.udi.admin.req.inout;
import com.glxp.udi.admin.req.ListPageRequest;
import lombok.Data;
/**
*
*/
@Data
public class PlatformLinkRequest extends ListPageRequest {
private Integer id;
private String unitId;
private String corpName;
private String platformId;
private String platformUsername;
private String platformPassword;
private String appid;
private String apiKey;
private String secretKey;
private String sourceAction;
private String targetAction;
private String invCode;
private String invSubCode;
private String key;
private String customerId;
}

@ -167,7 +167,7 @@ public class StackRulesService {
} else if (list.size() == 1) { } else if (list.size() == 1) {
for (StackRulesEntity stackRulesEntity : list) { for (StackRulesEntity stackRulesEntity : list) {
if (stackRulesEntity.getId().equals(stackRules.getId())) { if (stackRulesEntity.getId().equals(stackRules.getId())) {
return "succcess"; return "success";
} }
} }
} }
@ -177,4 +177,17 @@ public class StackRulesService {
return "只能启用一个规则"; return "只能启用一个规则";
} }
} }
/**
*
*
* @return
*/
public Long getEnableRulesNum() {
QueryWrapper<StackRulesEntity> wrapper = new QueryWrapper<>();
wrapper.eq("status", 1)
.eq("customerId", authAdminService.getCurrentUserCustomerId());
Long count = stackRulesDao.selectCount(wrapper);
return count;
}
} }

@ -11,13 +11,15 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.glxp.udi.admin.common.enums.ResultEnum; import com.glxp.udi.admin.common.enums.ResultEnum;
import com.glxp.udi.admin.common.res.BaseResponse; import com.glxp.udi.admin.common.res.BaseResponse;
import com.glxp.udi.admin.common.util.ResultVOUtils;
import com.glxp.udi.admin.dao.info.PlatformDao; import com.glxp.udi.admin.dao.info.PlatformDao;
import com.glxp.udi.admin.dao.inout.UnitMaintainDao; import com.glxp.udi.admin.dao.inout.UnitMaintainDao;
import com.glxp.udi.admin.dao.inout.UnitMaintainPlatformDao;
import com.glxp.udi.admin.entity.info.PlatformEntity; import com.glxp.udi.admin.entity.info.PlatformEntity;
import com.glxp.udi.admin.req.info.PlatformLinkRequest; import com.glxp.udi.admin.entity.inout.UnitMaintainPlatform;
import com.glxp.udi.admin.req.inout.PlatformLinkRequest;
import com.glxp.udi.admin.res.info.PlatformLinkResponse; import com.glxp.udi.admin.res.info.PlatformLinkResponse;
import com.glxp.udi.admin.util.HttpClient; import com.glxp.udi.admin.util.HttpClient;
import com.glxp.udi.admin.common.util.ResultVOUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -37,6 +39,8 @@ public class PlatformService {
private PlatformDao platformDao; private PlatformDao platformDao;
@Resource @Resource
private UnitMaintainDao unitMaintainDao; private UnitMaintainDao unitMaintainDao;
@Resource
private UnitMaintainPlatformDao unitMaintainPlatformDao;
public int save(PlatformEntity platformEntity) { public int save(PlatformEntity platformEntity) {
if (StringUtils.isEmpty(platformEntity.getId())) { if (StringUtils.isEmpty(platformEntity.getId())) {
@ -102,28 +106,24 @@ public class PlatformService {
/** /**
* *
* *
* @param customerId * @param platformLinkRequest
* @return * @return
*/ */
public IPage<PlatformLinkResponse> getLinkPlatformList(PlatformLinkRequest platformLinkRequest) { public IPage<PlatformLinkResponse> getLinkPlatformList(PlatformLinkRequest platformLinkRequest) {
if (null == platformLinkRequest) { if (null == platformLinkRequest) {
return new Page<>(); return new Page<>();
} }
IPage<PlatformLinkResponse> page = new Page<>(platformLinkRequest.getPage(), platformLinkRequest.getLimit());
IPage<PlatformLinkResponse> page = new Page<>(); return unitMaintainPlatformDao.getLinkPlatformList(page, platformLinkRequest.getCustomerId(), platformLinkRequest.getKey());
List<PlatformLinkResponse> list = platformDao.getLinkPlatformList(platformLinkRequest.getCustomerId(), platformLinkRequest.getKey());
page.setRecords(list);
page.setTotal(list.size());
return page;
} }
/** /**
* *
* *
* @param corpId * @param id
*/ */
public void unbindPlatform(String corpId) { public void unbindPlatform(String id) {
unitMaintainDao.unbindPlatform(corpId); unitMaintainPlatformDao.deleteById(id);
} }
/** /**
@ -157,12 +157,20 @@ public class PlatformService {
return ResultVOUtils.success(); return ResultVOUtils.success();
} }
String host = platformEntity.getHost(); String host = platformEntity.getHost();
String resp = HttpUtil.get(host + "/spms/inv/warehouse/filterInv/forUdims"); String url = host + "/spms/inv/warehouse/filterInv/forUdims";
log.info("拉取自助平台仓库数据:" + url);
String resp = HttpUtil.get(url);
log.info("拉取结果:" + resp);
if (StrUtil.isNotBlank(resp) && resp.contains("20000")) { if (StrUtil.isNotBlank(resp) && resp.contains("20000")) {
return JSON.parseObject(resp, BaseResponse.class); try {
return JSON.parseObject(resp, BaseResponse.class);
} catch (Exception e) {
log.error("格式化自助平台仓库信息异常", e);
return ResultVOUtils.error(500, "调用自助平台接口异常");
}
} else { } else {
log.error("获取自助平台仓库失败"); log.error("获取自助平台仓库失败");
return ResultVOUtils.error(500, "获取自助平台接口异常"); return ResultVOUtils.error(500, "调用自助平台接口异常");
} }
} }
@ -218,4 +226,67 @@ public class PlatformService {
public PlatformEntity getPlatformById(String platformId) { public PlatformEntity getPlatformById(String platformId) {
return platformDao.selectById(platformId); return platformDao.selectById(platformId);
} }
/**
*
*
* @param unitMaintainPlatform
*/
public void saveUnitPlatform(UnitMaintainPlatform unitMaintainPlatform) {
if (null != unitMaintainPlatform.getId()) {
unitMaintainPlatformDao.updateById(unitMaintainPlatform);
} else {
unitMaintainPlatformDao.insert(unitMaintainPlatform);
}
}
/**
*
*
* @param platformLinkRequest
* @return
*/
public String verifyUnitMaintainPlatform(PlatformLinkRequest platformLinkRequest) {
QueryWrapper<UnitMaintainPlatform> wrapper = new QueryWrapper<>();
wrapper.eq(StrUtil.isNotBlank(platformLinkRequest.getUnitId()), UnitMaintainPlatform.COL_UNITID, platformLinkRequest.getUnitId())
.eq(null != platformLinkRequest.getCustomerId(), UnitMaintainPlatform.COL_CUSTOMERID, platformLinkRequest.getCustomerId())
.eq(StrUtil.isNotBlank(platformLinkRequest.getPlatformId()), UnitMaintainPlatform.COL_PLATFORMID, platformLinkRequest.getPlatformId())
.eq(StrUtil.isNotBlank(platformLinkRequest.getSourceAction()), UnitMaintainPlatform.COL_SOURCEACTION, platformLinkRequest.getSourceAction())
.eq(StrUtil.isNotBlank(platformLinkRequest.getTargetAction()), UnitMaintainPlatform.COL_TARGETACTION, platformLinkRequest.getTargetAction())
.eq(StrUtil.isNotBlank(platformLinkRequest.getInvCode()), UnitMaintainPlatform.COL_INVCODE, platformLinkRequest.getInvCode())
.eq(StrUtil.isNotBlank(platformLinkRequest.getInvSubCode()), UnitMaintainPlatform.COL_INVSUBCODE, platformLinkRequest.getInvSubCode())
.eq(StrUtil.isNotBlank(platformLinkRequest.getAppid()), UnitMaintainPlatform.COL_APPID, platformLinkRequest.getAppid())
.eq(StrUtil.isNotBlank(platformLinkRequest.getApiKey()), UnitMaintainPlatform.COL_APIKEY, platformLinkRequest.getApiKey())
.eq(StrUtil.isNotBlank(platformLinkRequest.getSecretKey()), UnitMaintainPlatform.COL_SECRETKEY, platformLinkRequest.getSecretKey());
List<UnitMaintainPlatform> list = unitMaintainPlatformDao.selectList(wrapper);
if (CollUtil.isEmpty(list)) {
return "success";
} else {
for (UnitMaintainPlatform maintainPlatform : list) {
if (maintainPlatform.getId().equals(platformLinkRequest.getId())) {
return "success";
} else {
return "重复添加";
}
}
}
return "重复添加";
}
/**
*
*
* @param customerId
* @param action
* @param unitId
* @return
*/
public UnitMaintainPlatform findLinkData(long customerId, String action, String unitId) {
QueryWrapper<UnitMaintainPlatform> wrapper = new QueryWrapper<>();
wrapper.eq("customerId", customerId)
.eq("sourceAction", action)
.eq("unitId", unitId);
return unitMaintainPlatformDao.selectOne(wrapper);
}
} }

@ -78,6 +78,8 @@ public class OrderService {
private InvProductDao invProductDao; private InvProductDao invProductDao;
@Resource @Resource
private InvProductDetailDao invProductDetailDao; private InvProductDetailDao invProductDetailDao;
@Resource
private UnitMaintainPlatformDao unitMaintainPlatformDao;
public IPage<OrderEntity> filterList(OrderFilterRequest orderFilterRequest) { public IPage<OrderEntity> filterList(OrderFilterRequest orderFilterRequest) {
@ -265,11 +267,11 @@ public class OrderService {
*/ */
public boolean checkUpload(OrderEntity order) { public boolean checkUpload(OrderEntity order) {
//查询此往来单位的本地单据类型 //查询此往来单位的本地单据类型
Integer count = unitMaintainDao.checkUpload(order.getCustomerId(), order.getAction()); QueryWrapper<UnitMaintainPlatform> wrapper = new QueryWrapper<>();
if (count > 0) { wrapper.eq("customerId", order.getCustomerId())
return true; .eq("sourceAction", order.getAction());
} Long count = unitMaintainPlatformDao.selectCount(wrapper);
return false; return count > 0;
} }
/** /**

@ -2,7 +2,6 @@ package com.glxp.udi.admin.thread;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference; import com.alibaba.fastjson.TypeReference;
@ -10,22 +9,20 @@ import com.glxp.udi.admin.common.res.BaseResponse;
import com.glxp.udi.admin.constant.SystemParamConstant; import com.glxp.udi.admin.constant.SystemParamConstant;
import com.glxp.udi.admin.dao.info.ScheduledDao; import com.glxp.udi.admin.dao.info.ScheduledDao;
import com.glxp.udi.admin.entity.info.PlatformEntity; import com.glxp.udi.admin.entity.info.PlatformEntity;
import com.glxp.udi.admin.entity.info.ScheduledEntity;
import com.glxp.udi.admin.entity.inout.OrderDetailEntity; import com.glxp.udi.admin.entity.inout.OrderDetailEntity;
import com.glxp.udi.admin.entity.inout.OrderEntity; import com.glxp.udi.admin.entity.inout.OrderEntity;
import com.glxp.udi.admin.entity.inout.UnitMaintainEntity; import com.glxp.udi.admin.entity.inout.UnitMaintainEntity;
import com.glxp.udi.admin.entity.inout.WarehouseEntity; import com.glxp.udi.admin.entity.inout.WarehouseEntity;
import com.glxp.udi.admin.entity.param.SystemParamConfigEntity; import com.glxp.udi.admin.entity.param.SystemParamConfigEntity;
import com.glxp.udi.admin.service.inout.OrderDetailService;
import com.glxp.udi.admin.service.inout.OrderService;
import com.glxp.udi.admin.service.inout.WarehouseService;
import com.glxp.udi.admin.req.inout.FilterOrderDetailRequest; import com.glxp.udi.admin.req.inout.FilterOrderDetailRequest;
import com.glxp.udi.admin.req.inout.PostUdimsOrderDetailRequest; import com.glxp.udi.admin.req.inout.PostUdimsOrderDetailRequest;
import com.glxp.udi.admin.req.inout.PostUdimsOrderRequest; import com.glxp.udi.admin.req.inout.PostUdimsOrderRequest;
import com.glxp.udi.admin.req.inout.WarehouseQueryRequest; import com.glxp.udi.admin.req.inout.WarehouseQueryRequest;
import com.glxp.udi.admin.req.udidl.ScheduledRequest;
import com.glxp.udi.admin.service.info.PlatformService; import com.glxp.udi.admin.service.info.PlatformService;
import com.glxp.udi.admin.service.inout.OrderDetailService;
import com.glxp.udi.admin.service.inout.OrderService;
import com.glxp.udi.admin.service.inout.UnitMaintainService; import com.glxp.udi.admin.service.inout.UnitMaintainService;
import com.glxp.udi.admin.service.inout.WarehouseService;
import com.glxp.udi.admin.service.param.SystemParamConfigService; import com.glxp.udi.admin.service.param.SystemParamConfigService;
import com.glxp.udi.admin.service.param.SystemParamCustomerConfigService; import com.glxp.udi.admin.service.param.SystemParamCustomerConfigService;
import com.glxp.udi.admin.util.HttpClient; import com.glxp.udi.admin.util.HttpClient;
@ -34,7 +31,6 @@ import org.springframework.beans.BeanUtils;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.SchedulingConfigurer; import org.springframework.scheduling.annotation.SchedulingConfigurer;
import org.springframework.scheduling.config.ScheduledTaskRegistrar; import org.springframework.scheduling.config.ScheduledTaskRegistrar;
import org.springframework.scheduling.support.CronTrigger;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -69,7 +65,7 @@ public class SubmitOrderToSpmsTask implements SchedulingConfigurer {
@Override @Override
public void configureTasks(ScheduledTaskRegistrar taskRegistrar) { public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
taskRegistrar.addTriggerTask(this::process, triggerContext -> { /* taskRegistrar.addTriggerTask(this::process, triggerContext -> {
ScheduledRequest scheduledRequest = new ScheduledRequest(); ScheduledRequest scheduledRequest = new ScheduledRequest();
scheduledRequest.setCronName("submitOrderToSpmsTask"); scheduledRequest.setCronName("submitOrderToSpmsTask");
ScheduledEntity scheduled = scheduledDao.findScheduled(scheduledRequest); ScheduledEntity scheduled = scheduledDao.findScheduled(scheduledRequest);
@ -78,7 +74,7 @@ public class SubmitOrderToSpmsTask implements SchedulingConfigurer {
log.error("cron is null"); log.error("cron is null");
} }
return new CronTrigger(cron).nextExecutionTime(triggerContext); return new CronTrigger(cron).nextExecutionTime(triggerContext);
}); });*/
} }
private void process() { private void process() {

@ -4,17 +4,14 @@ import cn.hutool.core.collection.CollUtil;
import com.glxp.udi.admin.common.res.BaseResponse; import com.glxp.udi.admin.common.res.BaseResponse;
import com.glxp.udi.admin.constant.SystemParamConstant; import com.glxp.udi.admin.constant.SystemParamConstant;
import com.glxp.udi.admin.dao.info.ScheduledDao; import com.glxp.udi.admin.dao.info.ScheduledDao;
import com.glxp.udi.admin.entity.info.ScheduledEntity;
import com.glxp.udi.admin.entity.inout.OrderEntity; import com.glxp.udi.admin.entity.inout.OrderEntity;
import com.glxp.udi.admin.entity.param.SystemParamConfigEntity; import com.glxp.udi.admin.entity.param.SystemParamConfigEntity;
import com.glxp.udi.admin.service.inout.OrderService; import com.glxp.udi.admin.service.inout.OrderService;
import com.glxp.udi.admin.req.udidl.ScheduledRequest;
import com.glxp.udi.admin.service.param.SystemParamConfigService; import com.glxp.udi.admin.service.param.SystemParamConfigService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.SchedulingConfigurer; import org.springframework.scheduling.annotation.SchedulingConfigurer;
import org.springframework.scheduling.config.ScheduledTaskRegistrar; import org.springframework.scheduling.config.ScheduledTaskRegistrar;
import org.springframework.scheduling.support.CronTrigger;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -38,7 +35,7 @@ public class SupplementOrderTask implements SchedulingConfigurer {
@Override @Override
public void configureTasks(ScheduledTaskRegistrar taskRegistrar) { public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
taskRegistrar.addTriggerTask(this::process, /*taskRegistrar.addTriggerTask(this::process,
triggerContext -> { triggerContext -> {
ScheduledRequest scheduledRequest = new ScheduledRequest(); ScheduledRequest scheduledRequest = new ScheduledRequest();
scheduledRequest.setCronName("supplementOrderTask"); scheduledRequest.setCronName("supplementOrderTask");
@ -48,7 +45,7 @@ public class SupplementOrderTask implements SchedulingConfigurer {
log.error("cron is null"); log.error("cron is null");
} }
return new CronTrigger(cron).nextExecutionTime(triggerContext); return new CronTrigger(cron).nextExecutionTime(triggerContext);
}); });*/
} }
private void process() { private void process() {

@ -4,19 +4,16 @@ import cn.hutool.core.collection.CollUtil;
import com.glxp.udi.admin.constant.ConstantStatus; import com.glxp.udi.admin.constant.ConstantStatus;
import com.glxp.udi.admin.constant.SystemParamConstant; import com.glxp.udi.admin.constant.SystemParamConstant;
import com.glxp.udi.admin.dao.info.ScheduledDao; import com.glxp.udi.admin.dao.info.ScheduledDao;
import com.glxp.udi.admin.entity.info.ScheduledEntity;
import com.glxp.udi.admin.entity.inout.OrderEntity; import com.glxp.udi.admin.entity.inout.OrderEntity;
import com.glxp.udi.admin.entity.param.SystemParamConfigEntity; import com.glxp.udi.admin.entity.param.SystemParamConfigEntity;
import com.glxp.udi.admin.service.inout.OrderService;
import com.glxp.udi.admin.req.inout.OrderFilterRequest; import com.glxp.udi.admin.req.inout.OrderFilterRequest;
import com.glxp.udi.admin.req.udidl.ScheduledRequest; import com.glxp.udi.admin.service.inout.OrderService;
import com.glxp.udi.admin.service.param.SystemParamConfigService; import com.glxp.udi.admin.service.param.SystemParamConfigService;
import com.glxp.udi.admin.service.param.SystemParamCustomerConfigService; import com.glxp.udi.admin.service.param.SystemParamCustomerConfigService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.SchedulingConfigurer; import org.springframework.scheduling.annotation.SchedulingConfigurer;
import org.springframework.scheduling.config.ScheduledTaskRegistrar; import org.springframework.scheduling.config.ScheduledTaskRegistrar;
import org.springframework.scheduling.support.CronTrigger;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -40,7 +37,7 @@ public class TransInoutTask implements SchedulingConfigurer {
@Override @Override
public void configureTasks(ScheduledTaskRegistrar scheduledTaskRegistrar) { public void configureTasks(ScheduledTaskRegistrar scheduledTaskRegistrar) {
scheduledTaskRegistrar.addTriggerTask(this::process, /* scheduledTaskRegistrar.addTriggerTask(this::process,
triggerContext -> { triggerContext -> {
ScheduledRequest scheduledRequest = new ScheduledRequest(); ScheduledRequest scheduledRequest = new ScheduledRequest();
scheduledRequest.setCronName("transInout"); scheduledRequest.setCronName("transInout");
@ -50,7 +47,7 @@ public class TransInoutTask implements SchedulingConfigurer {
log.error("cron is null"); log.error("cron is null");
} }
return new CronTrigger(cron).nextExecutionTime(triggerContext); return new CronTrigger(cron).nextExecutionTime(triggerContext);
}); });*/
} }
private void process() { private void process() {

@ -51,32 +51,6 @@
</where> </where>
</select> </select>
<select id="getLinkPlatformList" resultType="com.glxp.udi.admin.res.info.PlatformLinkResponse">
select u.id,
u.unitId,
u.name corpName,
u.corpType,
u.pinyinCode,
p.name platformName,
p.id platformId,
u.sourceAction,
u.targetAction,
u.invCode,
u.invSubCode
from io_unit_maintain u
left join auth_platform p on u.platformId = p.id
<where>
customerId = #{customerId}
and platformId is not null
<if test="key != null and key != ''">
AND (u.unitId like concat('%', #{key}, '%')
or u.name like concat('%', #{key}, '%')
or u.pinyinCode like concat('%', #{key}, '%')
)
</if>
</where>
</select>
<select id="selectByNameAndHost" resultType="com.glxp.udi.admin.entity.info.PlatformEntity"> <select id="selectByNameAndHost" resultType="com.glxp.udi.admin.entity.info.PlatformEntity">
select * select *
from auth_platform from auth_platform

@ -159,14 +159,6 @@
and targetAction is not null and targetAction is not null
</select> </select>
<select id="checkUpload" resultType="java.lang.Integer">
select count(*)
from io_unit_maintain
where customerId = #{customerId}
and platformId is not null
and sourceAction = #{action}
</select>
<select id="countByName" resultType="java.lang.Integer"> <select id="countByName" resultType="java.lang.Integer">
select count(*) select count(*)
from io_unit_maintain from io_unit_maintain

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.glxp.udi.admin.dao.inout.UnitMaintainPlatformDao">
<select id="getLinkPlatformList" resultType="com.glxp.udi.admin.res.info.PlatformLinkResponse">
select up.id,
up.unitId,
u.name corpName,
u.corpType,
u.pinyinCode,
ap.name platformName,
ap.id platformId,
up.sourceAction,
up.targetAction,
up.invCode,
up.invSubCode
from io_unit_maintain_platform up
left join io_unit_maintain u on up.unitId = u.unitId
left join auth_platform ap on up.platformId = ap.id
where up.customerId = #{customerId}
<if test="key != null and key != ''">
AND (u.unitId like concat('%', #{key}, '%')
or u.name like concat('%', #{key}, '%')
or u.pinyinCode like concat('%', #{key}, '%')
)
</if>
</select>
</mapper>
Loading…
Cancel
Save