第三方服务修改,新增设备审核,第三方仓库,仓库字典修改,第三方单据类型修改,业务单据提交修改等等

master
anthonyywj2 3 years ago
parent 286573c7ba
commit c2c7d8ae49

@ -0,0 +1,18 @@
package com.glxp.api.admin.controller.auth;
import com.glxp.api.admin.req.auth.ConnectRequest;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class ConnectTestController {
@GetMapping("/udiwms/auth/device/connect")
public BaseResponse index(ConnectRequest connequest) {
return ResultVOUtils.success("连接UDI管理系统成功");
}
}

@ -1,10 +1,13 @@
package com.glxp.api.admin.controller.auth;
import cn.hutool.core.util.StrUtil;
import com.glxp.api.admin.entity.auth.AuthCheckEntity;
import com.glxp.api.admin.entity.info.DeviceKeyEntity;
import com.glxp.api.admin.req.auth.LoginRequest;
import com.glxp.api.admin.req.auth.PCLoginRequest;
import com.glxp.api.admin.req.auth.UpdatePasswordRequest;
import com.glxp.api.admin.service.auth.AuthCheckService;
import com.glxp.api.admin.service.auth.DeviceKeyService;
import com.glxp.api.admin.util.*;
import com.glxp.api.common.enums.ResultEnum;
import com.glxp.api.common.res.BaseResponse;
@ -44,6 +47,8 @@ public class LoginController {
@Resource
private AuthCheckService authCheckService;
@Resource
DeviceKeyService deviceKeyService;
/**
*
@ -70,6 +75,18 @@ public class LoginController {
throw new JsonException(ResultEnum.DATA_NOT, "该用户已被禁用!");
}
if (StrUtil.isNotEmpty(loginRequest.getImei())) {
DeviceKeyEntity deviceKeyEntity = deviceKeyService.findDeviceByImei(loginRequest.getImei());
if (deviceKeyEntity == null) {
return ResultVOUtils.error(410, "该设备未注册");
} else if (deviceKeyEntity.getIsCheck() == 0) {
return ResultVOUtils.error(411, "该设备登记审核中,请等待,或联系管理员");
} else if (deviceKeyEntity.getIsCheck() == 2) {
return ResultVOUtils.error(412, "该设备被拒绝登录,请联系管理员!");
}
}
// 更新登录状态
AuthAdmin authAdminUp = new AuthAdmin();
authAdminUp.setId(authAdmin.getId());

@ -10,6 +10,7 @@ import com.glxp.api.admin.req.basic.FilterBasicThirdSysDetailRequest;
import com.glxp.api.admin.req.basic.FilterBasicThirdSysRequest;
import com.glxp.api.admin.res.PageSimpleResponse;
import com.glxp.api.admin.res.basic.BasicThirdSysResponse;
import com.glxp.api.admin.res.basic.BussinessOriginTypeResponse;
import com.glxp.api.admin.service.basic.*;
import com.glxp.api.common.enums.ResultEnum;
import com.glxp.api.common.res.BaseResponse;
@ -239,6 +240,13 @@ public class BasicThirdSysController {
if (null == basicThirdSysBusApiEntity || null == basicThirdSysBusApiEntity.getType()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
BussinessOriginTypeResponse bussinessOriginTypeResponse = bussinessOriginTypeService.finByLocalAction(basicThirdSysBusApiEntity.getCode());
if (bussinessOriginTypeResponse != null) {
basicThirdSysBusApiEntity.setThirdBuyCode(bussinessOriginTypeResponse.getThirdAction());
basicThirdSysBusApiEntity.setThirdBuyName(bussinessOriginTypeResponse.getThirdName());
}
boolean result = basicThirdSysBusApiService.saveBusTypes(basicThirdSysBusApiEntity);
if (result) {
return ResultVOUtils.success();

@ -135,25 +135,36 @@ public class BussinessOriginTypeController {
}
FilterBasicThirdSysDetailRequest filterBasicThirdSysDetailRequest = new FilterBasicThirdSysDetailRequest();
filterBasicThirdSysDetailRequest.setThirdSysFk(bussinessOriginTypeFilterRequest.getThirdSys());
BaseResponse<PageSimpleResponse<BasicThirdSysBusApiEntity>> baseResponse = erpBasicClient.getBusTypes(filterBasicThirdSysDetailRequest);
if (baseResponse != null && baseResponse.getCode() == 20000) {
List<BasicThirdSysBusApiEntity> basicThirdSysBusApiEntities = baseResponse.getData().getList();
if (CollUtil.isNotEmpty(basicThirdSysBusApiEntities)) {
for (BasicThirdSysBusApiEntity basicThirdSysBusApiEntity : basicThirdSysBusApiEntities) {
BussinessOriginTypeEntity bussinessOriginTypeEntity = new BussinessOriginTypeEntity();
bussinessOriginTypeEntity.setName(basicThirdSysBusApiEntity.getName());
bussinessOriginTypeEntity.setAction(basicThirdSysBusApiEntity.getCode());
bussinessOriginTypeEntity.setThirdSys(bussinessOriginTypeFilterRequest.getThirdSys());
bussinessOriginTypeEntity.setInoutType(basicThirdSysBusApiEntity.getInoutType());
bussinessOriginTypeEntity.setEnable(true);
bussinessOriginTypeEntity.setUpdateTime(new Date());
bussinessOriginTypeService.insertBusOriginType(bussinessOriginTypeEntity);
int page = 1;
int limit = 100;
while (true) {
filterBasicThirdSysDetailRequest.setPage(page);
filterBasicThirdSysDetailRequest.setLimit(limit);
BaseResponse<PageSimpleResponse<BasicThirdSysBusApiEntity>> baseResponse = erpBasicClient.getBusTypes(filterBasicThirdSysDetailRequest);
if (baseResponse != null && baseResponse.getCode() == 20000) {
List<BasicThirdSysBusApiEntity> basicThirdSysBusApiEntities = baseResponse.getData().getList();
if (CollUtil.isNotEmpty(basicThirdSysBusApiEntities)) {
for (BasicThirdSysBusApiEntity basicThirdSysBusApiEntity : basicThirdSysBusApiEntities) {
BussinessOriginTypeEntity bussinessOriginTypeEntity = new BussinessOriginTypeEntity();
bussinessOriginTypeEntity.setName(basicThirdSysBusApiEntity.getName());
bussinessOriginTypeEntity.setAction(basicThirdSysBusApiEntity.getCode());
bussinessOriginTypeEntity.setThirdSys(bussinessOriginTypeFilterRequest.getThirdSys());
bussinessOriginTypeEntity.setInoutType(basicThirdSysBusApiEntity.getInoutType());
bussinessOriginTypeEntity.setRemark(basicThirdSysBusApiEntity.getRemark());
bussinessOriginTypeEntity.setEnable(true);
bussinessOriginTypeEntity.setUpdateTime(new Date());
bussinessOriginTypeService.insertBusOriginType(bussinessOriginTypeEntity);
}
if (basicThirdSysBusApiEntities.size() >= 100) {
page++;
}
} else {
break;
}
} else {
return baseResponse;
}
}
return ResultVOUtils.success("下载成功");
}
}

@ -0,0 +1,128 @@
package com.glxp.api.admin.controller.info;
import com.github.pagehelper.PageInfo;
import com.glxp.api.admin.entity.info.DeviceKeyEntity;
import com.glxp.api.admin.req.info.FilterDeviceKeyRequest;
import com.glxp.api.admin.req.inout.DeleteRequest;
import com.glxp.api.admin.res.PageSimpleResponse;
import com.glxp.api.admin.service.auth.DeviceKeyService;
import com.glxp.api.admin.util.DateUtil;
import com.glxp.api.common.enums.ResultEnum;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.security.MessageDigest;
import java.util.List;
@Slf4j
@RestController
public class DeviceKeyController {
// @Value("${spring.mail.username}")
// private String mail;
// @Value("${toMail}")
// private String toMail;
@Resource
DeviceKeyService deviceKeyService;
// @Resource
// private JavaMailSender javaMailSender;
@GetMapping("sale/device/registerList")
public BaseResponse registerList(FilterDeviceKeyRequest filterDeviceKeyRequest) {
List<DeviceKeyEntity> deviceKeyEntities = deviceKeyService.findDeviceKey(filterDeviceKeyRequest);
PageInfo<DeviceKeyEntity> pageInfo;
pageInfo = new PageInfo<>(deviceKeyEntities);
PageSimpleResponse<DeviceKeyEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(deviceKeyEntities);
return ResultVOUtils.success(pageSimpleResponse);
}
@PostMapping("sale/device/check")
public BaseResponse checkRegister(@RequestBody @Valid DeviceKeyEntity deviceKeyEntity,
BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
deviceKeyEntity.setDate(DateUtil.getDate());
deviceKeyService.updateDeviceKey(deviceKeyEntity);
return ResultVOUtils.success("审核成功");
}
@PostMapping("/sale/info/registerKey")
public BaseResponse registerKey(@RequestBody DeviceKeyEntity deviceKeyEntity) {
String key = md5("glxp2020" + deviceKeyEntity.getImei());
FilterDeviceKeyRequest filterDeviceKeyRequest = new FilterDeviceKeyRequest();
filterDeviceKeyRequest.setImei(deviceKeyEntity.getImei());
DeviceKeyEntity deviceKeyEntity1 = deviceKeyService.findDeviceByImei(filterDeviceKeyRequest);
if (deviceKeyEntity1 == null) {
return ResultVOUtils.success("1");
} else if (deviceKeyEntity1.getIsCheck() == 0) {
return ResultVOUtils.success("0");
} else {
return ResultVOUtils.success(key);
}
}
@PostMapping("/sale/info/deleterKey")
public BaseResponse deleterKey(@RequestBody DeleteRequest deleteRequest) {
deviceKeyService.deleteDeviceKey(deleteRequest);
return ResultVOUtils.success("删除成功");
}
@PostMapping("sale/device/register")
public BaseResponse saveRegister(@RequestBody DeviceKeyEntity deviceKeyEntity,
BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
deviceKeyEntity.setDate(DateUtil.getDateTime());
deviceKeyEntity.setIsCheck(0);
deviceKeyService.insertDeviceKey(deviceKeyEntity);
return ResultVOUtils.success("1");
}
// public void sendMail(String title, String content, String to) {
// SimpleMailMessage message = new SimpleMailMessage();
// message.setFrom(mail);
// message.setTo(to);
// message.setSubject(title);
// message.setText(content);
// javaMailSender.send(message);
// }
public String md5(String password) {
try {
MessageDigest digest = MessageDigest.getInstance("MD5");
byte[] bytes = digest.digest(password.getBytes());
StringBuilder sb = new StringBuilder();
for (byte b : bytes) {
int c = b & 0xff; //负数转换成正数
String result = Integer.toHexString(c); //把十进制的数转换成十六进制的书
if (result.length() < 2) {
sb.append(0); //让十六进制全部都是两位数
}
sb.append(result);
}
return sb.toString(); //返回加密后的密文
} catch (Exception ex) {
ex.printStackTrace();
return "";
}
}
}

@ -409,7 +409,7 @@ public class InvWarehouseController {
*/
@AuthRuleAnnotation("")
@PostMapping("/spms/inv/warehouse/bindThrWarehouse")
public BaseResponse bindThrWarehouse(Integer id, Integer thridWarehouseId, String sysId) {
public BaseResponse bindThrWarehouse(Integer id, String thridWarehouseId, String sysId) {
if (null == id || null == thridWarehouseId || StrUtil.isBlank(sysId)) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}

@ -1,11 +1,14 @@
package com.glxp.api.admin.controller.thrsys;
import cn.hutool.core.util.StrUtil;
import com.github.pagehelper.PageInfo;
import com.glxp.api.admin.dao.basic.BasicThirdSysDao;
import com.glxp.api.admin.entity.basic.BasicThirdSysEntity;
import com.glxp.api.admin.entity.thrsys.ThrCorpEntity;
import com.glxp.api.admin.entity.thrsys.ThrInvWarehouseEntity;
import com.glxp.api.admin.req.inout.DeleteRequest;
import com.glxp.api.admin.req.thrsys.FilterThrInvWarehouseRequest;
import com.glxp.api.admin.res.PageSimpleResponse;
import com.glxp.api.admin.res.thrsys.ThrInvWarehouseResponse;
import com.glxp.api.admin.service.thrsys.ThrInvWarehouseService;
import com.glxp.api.common.enums.ResultEnum;
@ -41,11 +44,21 @@ public class ThrInvWarehouseController {
@GetMapping("spms/thrsys/warehouse/filter")
public BaseResponse filterInvWarehouse(FilterThrInvWarehouseRequest filterThrInvWarehouseRequest) {
List<ThrInvWarehouseEntity> thrInvWarehouseEntities = thrInvWarehouseService.filterThrInvWarehouse(filterThrInvWarehouseRequest);
List<ThrInvWarehouseResponse> merge = merge(thrInvWarehouseEntities, 0);
Map<String, Object> restMap = new HashMap<>();
restMap.put("list", merge);
return ResultVOUtils.success(restMap);
PageInfo<ThrInvWarehouseEntity> pageInfo;
pageInfo = new PageInfo<>(thrInvWarehouseEntities);
PageSimpleResponse<ThrInvWarehouseEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(thrInvWarehouseEntities);
return ResultVOUtils.success(pageSimpleResponse);
// List<ThrInvWarehouseResponse> merge = merge(thrInvWarehouseEntities, 0);
//
// Map<String, Object> restMap = new HashMap<>();
// restMap.put("list", merge);
// return ResultVOUtils.success(restMap);
}
public List<ThrInvWarehouseResponse> merge(List<ThrInvWarehouseEntity> thrInvWarehouseEntities, Integer pid) {
@ -83,27 +96,11 @@ public class ThrInvWarehouseController {
thrInvWarehouseEntity.setPid(0); // 默认设置
FilterThrInvWarehouseRequest filterThrInvWarehouseRequest = new FilterThrInvWarehouseRequest();
filterThrInvWarehouseRequest.setPid(thrInvWarehouseEntity.getPid());
// ThrInvWarehouseEntity codeEntity = thrInvWarehouseService.selectMaxCode(filterThrInvWarehouseRequest);
// if(codeEntity == null)
// if (codeEntity == null) {
// int code = Integer.parseInt("1") * 1000;
// thrInvWarehouseEntity.setCode(code + "");
// } else {
// thrInvWarehouseEntity.setCode(Integer.parseInt(codeEntity.getCode()) + 1 + "");
// }
// thrInvWarehouseEntity.setCode(Integer.parseInt(codeEntity.getCode()) + 1 + "");
} else {//货位
FilterThrInvWarehouseRequest filterThrInvWarehouseRequest = new FilterThrInvWarehouseRequest();
filterThrInvWarehouseRequest.setPid(thrInvWarehouseEntity.getPid());
// ThrInvWarehouseEntity codeEntity = thrInvWarehouseService.selectMaxCode(filterThrInvWarehouseRequest);
ThrInvWarehouseEntity pEntity = thrInvWarehouseService.selectById(thrInvWarehouseEntity.getPid() + "");
// if (codeEntity == null) {
// int code = Integer.parseInt(pEntity.getCode()) * 1000;
// thrInvWarehouseEntity.setCode(code + "");
// } else {
// thrInvWarehouseEntity.setCode(Integer.parseInt(codeEntity.getCode()) + 1 + "");
// }
thrInvWarehouseEntity.setAdvanceType(pEntity.getAdvanceType());
thrInvWarehouseEntity.setLevel(pEntity.getLevel());
thrInvWarehouseEntity.setPcode(pEntity.getPcode());
@ -149,6 +146,7 @@ public class ThrInvWarehouseController {
/**
*
*
* @param thirdSysFk
* @return
*/

@ -0,0 +1,24 @@
package com.glxp.api.admin.dao.auth;
import com.glxp.api.admin.entity.info.DeviceKeyEntity;
import com.glxp.api.admin.req.info.FilterDeviceKeyRequest;
import com.glxp.api.admin.req.inout.DeleteRequest;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface DeviceKeyDao {
DeviceKeyEntity findDeviceByImei(FilterDeviceKeyRequest filterDeviceKeyRequest);
List<DeviceKeyEntity> findDeviceKey(FilterDeviceKeyRequest filterDeviceKeyRequest);
void insertDeviceKey(DeviceKeyEntity deviceKeyEntity);
void updateDeviceKey(DeviceKeyEntity deviceKeyEntity);
void updateDeviceKeyByImei(DeviceKeyEntity deviceKeyEntity);
void deleteDeviceKey(DeleteRequest deleteRequest);
}

@ -41,6 +41,6 @@ public interface InvWarehouseDao {
* @param sysId
* @return
*/
boolean updateThridId(@Param("id") Integer id, @Param("thridWarehouseId") Integer thridWarehouseId, @Param("sysId") String sysId);
boolean updateThridId(@Param("id") Integer id, @Param("thridWarehouseId") String thridWarehouseId, @Param("sysId") String sysId);
}

@ -24,4 +24,10 @@ public class BasicThirdSysBusApiEntity {
private String filed4;
/**
* "code": "29104",
* "name": "采购入库",
* "remark": "无形资产入库单",
* "inoutType": "1"
*/
}

@ -0,0 +1,19 @@
package com.glxp.api.admin.entity.info;
import lombok.Data;
@Data
public class DeviceKeyEntity {
private String id;
private String imei;
private int isCheck;
private String companyName;
private String phone;
private String contact;
private String imeiKey;
private String date;
private String creditNum;
private int checkCode;
private String rgType;
private String remark;
}

@ -49,6 +49,7 @@ public class OrderEntity {
private Date updateTime;
private boolean preCheck;
private String thirdBillNo;
}

@ -80,8 +80,6 @@ public class ErpBasicClient {
String url = basicThirdSysEntity.getThridUrl() + "/udiwms/erp/getOrderType";
UdiwmsBusTypeRequest udiwmsBusTypeRequest = new UdiwmsBusTypeRequest();
udiwmsBusTypeRequest.setThirdSys(filterBasicThirdSysDetailRequest.getThirdSysFk());
udiwmsBusTypeRequest.setPage(1);
udiwmsBusTypeRequest.setLimit(100);
String response = HttpClient.uCloudPost(url, udiwmsBusTypeRequest, basicThirdSysEntity);
log.info(response);
try {
@ -99,11 +97,7 @@ public class ErpBasicClient {
public BaseResponse<PageSimpleResponse<UdiwmsWarehouseDetail>> getWarehouse(UdiwmsWarehouseRequest udiwmsWarehouseRequest) {
BasicThirdSysEntity basicThirdSysEntity = basicThirdSysService.selectByThirdId(udiwmsWarehouseRequest.getThirdSys());
String url = basicThirdSysEntity.getThridUrl() + "/udiwms/erp/getWarehouse";
udiwmsWarehouseRequest.setPage(1);
udiwmsWarehouseRequest.setLimit(100);
log.info("查询第三方系统的仓库货位号url{},参数:{}", url, udiwmsWarehouseRequest.toString());
String response = HttpClient.uCloudPost(url, udiwmsWarehouseRequest);
log.info(response);
try {
BaseResponse<PageSimpleResponse<UdiwmsWarehouseDetail>> listBaseResponse =

@ -0,0 +1,8 @@
package com.glxp.api.admin.httpclient;
import lombok.Data;
@Data
public class UdiwmsOrderResponse {
private String thirdBillNo;
}

@ -16,7 +16,8 @@ public class UdiwmsOrderRequest {
private String corpId; //第三方单据往来单位ID
private String corpName; //往来单位
private String thirdSys; //第三方系统ID
private List<UdiwmsOrderDetail> items; //单据详情数组
private String locStorageCode;
private String locStorageName;
private List<UdiwmsOrderDetail> item; //单据详情数组
}

@ -0,0 +1,7 @@
package com.glxp.api.admin.req.auth;
import lombok.Data;
@Data
public class ConnectRequest {
}

@ -16,4 +16,9 @@ public class LoginRequest {
@NotEmpty(message = "密码不能为空")
private String password;
private Integer type;
private String imei;
}

@ -0,0 +1,10 @@
package com.glxp.api.admin.req.info;
import com.glxp.api.admin.req.ListPageRequest;
import lombok.Data;
@Data
public class FilterDeviceKeyRequest extends ListPageRequest {
private String imei;
private String isCheck;
}

@ -36,5 +36,6 @@ public class OrderFilterRequest extends ListPageRequest {
private String locStorageCode;
private String lastUpdateTime;
private Integer unionUser;
private String thirdBillNo;
}

@ -0,0 +1,25 @@
package com.glxp.api.admin.service.auth;
import com.glxp.api.admin.entity.info.DeviceKeyEntity;
import com.glxp.api.admin.req.info.FilterDeviceKeyRequest;
import com.glxp.api.admin.req.inout.DeleteRequest;
import java.util.List;
public interface DeviceKeyService {
List<DeviceKeyEntity> findDeviceKey(FilterDeviceKeyRequest filterDeviceKeyRequest);
DeviceKeyEntity findDeviceByImei(FilterDeviceKeyRequest filterDeviceKeyRequest);
DeviceKeyEntity findDeviceByImei(String imei);
void insertDeviceKey(DeviceKeyEntity deviceKeyEntity);
void updateDeviceKeyByImei(DeviceKeyEntity deviceKeyEntity);
void updateDeviceKey(DeviceKeyEntity deviceKeyEntity);
void deleteDeviceKey(DeleteRequest deleteRequest);
}

@ -0,0 +1,63 @@
package com.glxp.api.admin.service.auth.impl;
import com.github.pagehelper.PageHelper;
import com.glxp.api.admin.dao.auth.DeviceKeyDao;
import com.glxp.api.admin.entity.info.DeviceKeyEntity;
import com.glxp.api.admin.req.info.FilterDeviceKeyRequest;
import com.glxp.api.admin.req.inout.DeleteRequest;
import com.glxp.api.admin.service.auth.DeviceKeyService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
@Service
public class DeviceKeyServiceImpl implements DeviceKeyService {
@Resource
DeviceKeyDao deviceKeyDao;
@Override
public List<DeviceKeyEntity> findDeviceKey(FilterDeviceKeyRequest filterDeviceKeyRequest) {
if (filterDeviceKeyRequest == null) {
return Collections.emptyList();
}
int offset = (filterDeviceKeyRequest.getPage() - 1) * filterDeviceKeyRequest.getLimit();
PageHelper.offsetPage(offset, filterDeviceKeyRequest.getLimit());
return deviceKeyDao.findDeviceKey(filterDeviceKeyRequest);
}
@Override
public DeviceKeyEntity findDeviceByImei(FilterDeviceKeyRequest filterDeviceKeyRequest) {
return deviceKeyDao.findDeviceByImei(filterDeviceKeyRequest);
}
@Override
public DeviceKeyEntity findDeviceByImei(String imei) {
FilterDeviceKeyRequest filterDeviceKeyRequest = new FilterDeviceKeyRequest();
filterDeviceKeyRequest.setImei(imei);
DeviceKeyEntity deviceKeyEntity = deviceKeyDao.findDeviceByImei(filterDeviceKeyRequest);
return deviceKeyEntity;
}
@Override
public void insertDeviceKey(DeviceKeyEntity deviceKeyEntity) {
deviceKeyDao.insertDeviceKey(deviceKeyEntity);
}
@Override
public void updateDeviceKeyByImei(DeviceKeyEntity deviceKeyEntity) {
deviceKeyDao.updateDeviceKeyByImei(deviceKeyEntity);
}
@Override
public void updateDeviceKey(DeviceKeyEntity deviceKeyEntity) {
deviceKeyDao.updateDeviceKey(deviceKeyEntity);
}
@Override
public void deleteDeviceKey(DeleteRequest deleteRequest) {
deviceKeyDao.deleteDeviceKey(deleteRequest);
}
}

@ -46,6 +46,11 @@ public class BussinessOriginTypeServiceImpl implements BussinessOriginTypeServic
@Override
public List<BussinessOriginTypeEntity> filterEnableList(BussinessOriginTypeFilterRequest bussinessOriginTypeFilterRequest) {
if (bussinessOriginTypeFilterRequest.getPage() != null) {
int offset = (bussinessOriginTypeFilterRequest.getPage() - 1) * bussinessOriginTypeFilterRequest.getLimit();
PageHelper.offsetPage(offset, bussinessOriginTypeFilterRequest.getLimit());
}
return bussinessOriginTypeDao.filterEnableList(bussinessOriginTypeFilterRequest);
}
@ -103,7 +108,7 @@ public class BussinessOriginTypeServiceImpl implements BussinessOriginTypeServic
@Override
public BussinessOriginTypeResponse finByLocalAction(String action) {
BussinessOriginTypeFilterRequest bussinessOriginTypeFilterRequest = new BussinessOriginTypeFilterRequest();
bussinessOriginTypeFilterRequest.setThirdAction(action);
bussinessOriginTypeFilterRequest.setLocalAction(action);
List<BussinessOriginTypeResponse> bussinessOriginTypeEntities = bussinessOriginTypeDao.filterJoinList(bussinessOriginTypeFilterRequest);
if (bussinessOriginTypeEntities != null && bussinessOriginTypeEntities.size() > 0) {
return bussinessOriginTypeEntities.get(0);

@ -4,7 +4,11 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.github.pagehelper.PageHelper;
import com.glxp.api.admin.constant.ConstantStatus;
import com.glxp.api.admin.constant.ConstantType;
import com.glxp.api.admin.dao.basic.BasicThirdSysBusApiDao;
import com.glxp.api.admin.dao.basic.BasicThirdSysDao;
@ -13,20 +17,30 @@ import com.glxp.api.admin.dao.basic.UnitMaintainDao;
import com.glxp.api.admin.dao.business.StockOrderDao;
import com.glxp.api.admin.dao.business.StockOrderDetailDao;
import com.glxp.api.admin.dao.inout.OrderDao;
import com.glxp.api.admin.entity.basic.BasicThirdSysBusApiEntity;
import com.glxp.api.admin.entity.basic.BasicThirdSysEntity;
import com.glxp.api.admin.entity.basic.UnitMaintainEntity;
import com.glxp.api.admin.entity.basic.*;
import com.glxp.api.admin.entity.business.StockOrderDetailEntity;
import com.glxp.api.admin.entity.business.StockOrderEntity;
import com.glxp.api.admin.entity.business.StockOrderPrintEntity;
import com.glxp.api.admin.entity.inout.OrderEntity;
import com.glxp.api.admin.entity.inventory.InvWarehouseEntity;
import com.glxp.api.admin.entity.thrsys.ThrInvWarehouseEntity;
import com.glxp.api.admin.httpclient.UdiwmsOrderResponse;
import com.glxp.api.admin.httpclient.req.UdiwmsOrderDetail;
import com.glxp.api.admin.httpclient.req.UdiwmsOrderRequest;
import com.glxp.api.admin.req.basic.BussinessLocalTypeFilterRequest;
import com.glxp.api.admin.req.business.StockOrderDetailFilterRequest;
import com.glxp.api.admin.req.business.StockOrderFilterRequest;
import com.glxp.api.admin.req.business.StockOrderQueryRequest;
import com.glxp.api.admin.res.basic.BussinessTypResponse;
import com.glxp.api.admin.res.business.StockOrderDetailEntityVo;
import com.glxp.api.admin.res.business.StockOrderExportResponse;
import com.glxp.api.admin.service.basic.BussinessLocalTypeService;
import com.glxp.api.admin.service.basic.BussinessTypeService;
import com.glxp.api.admin.service.basic.UdiRelevanceService;
import com.glxp.api.admin.service.business.StockOrderService;
import com.glxp.api.admin.service.inout.OrderService;
import com.glxp.api.admin.service.inventory.InvWarehouseService;
import com.glxp.api.admin.service.thrsys.ThrInvWarehouseService;
import com.glxp.api.admin.util.HttpClient;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
@ -56,6 +70,16 @@ public class StockOrderServiceImpl implements StockOrderService {
private BasicThirdSysDao basicThirdSysDao;
@Resource
private OrderDao orderDao;
@Resource
private OrderService orderService;
@Resource
BussinessLocalTypeService bussinessLocalTypeService;
@Resource
InvWarehouseService invWarehouseService;
@Resource
ThrInvWarehouseService thrInvWarehouseService;
@Resource
UdiRelevanceService udiRelevanceService;
@Override
public List<StockOrderEntity> listStockOrders(StockOrderQueryRequest stockOrderQueryRequest) {
@ -184,15 +208,37 @@ public class StockOrderServiceImpl implements StockOrderService {
UdiwmsOrderRequest udiwmsOrderRequest = new UdiwmsOrderRequest();
udiwmsOrderRequest.setBillDate(stockOrderEntity.getBilldate()); //单据日期
udiwmsOrderRequest.setBillNo(stockOrderEntity.getBillNo()); //单号
//查询往来单位第三方系统对照编码
UnitMaintainEntity unitMaintainEntity = unitMaintainDao.selectThirdInfoByErpId(stockOrderEntity.getCorpId());
udiwmsOrderRequest.setCorpId(unitMaintainEntity.getThirdId()); //往来单位编码需转换为第三方系统的ID
udiwmsOrderRequest.setCorpName(unitMaintainEntity.getThirdName()); //往来单位名称,需转换为第三方系统的名称
udiwmsOrderRequest.setBillFlag(stockOrderEntity.getBillFlag());//单据状态
BussinessLocalTypeEntity bussinessLocalTypeEntity = bussinessLocalTypeService.findBTByAction(stockOrderEntity.getBillType());
//查询第三方系统的单据ID及第三方系统标识
BasicThirdSysBusApiEntity thirdSysBusApiEntity = thirdSysBusApiDao.selectByCode(stockOrderEntity.getBillType());
udiwmsOrderRequest.setThirdSys(thirdSysBusApiEntity.getThirdSys()); //第三方系统标识
udiwmsOrderRequest.setBillType(thirdSysBusApiEntity.getThirdBuyName());
udiwmsOrderRequest.setBillType(thirdSysBusApiEntity.getThirdBuyCode());
if (bussinessLocalTypeEntity.getCorpType() == ConstantStatus.CORP_TYPE_INPUT) {
udiwmsOrderRequest.setCorpId(stockOrderEntity.getCorpName()); //往来单位编码需转换为第三方系统的ID
udiwmsOrderRequest.setCorpName(stockOrderEntity.getCorpName()); //往来单位名称,需转换为第三方系统的名称
} else if (bussinessLocalTypeEntity.getCorpType() == ConstantStatus.CORP_TYPE_INNOR) {
InvWarehouseEntity invWarehouseEntity = invWarehouseService.selectByCode(stockOrderEntity.getCorpId());
ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseService.selectByCode(invWarehouseEntity.getThirdId());
udiwmsOrderRequest.setCorpId(thrInvWarehouseEntity.getCode()); //往来单位编码需转换为第三方系统的ID
udiwmsOrderRequest.setCorpName(thrInvWarehouseEntity.getName()); //往来单位名称,需转换为第三方系统的名称
} else if (bussinessLocalTypeEntity.getCorpType() == ConstantStatus.CORP_TYPE_OUT) {
//查询往来单位第三方系统对照编码
UnitMaintainEntity
unitMaintainEntity = unitMaintainDao.selectThirdInfoByErpId(stockOrderEntity.getCorpId());
udiwmsOrderRequest.setCorpId(unitMaintainEntity.getThirdId()); //往来单位编码需转换为第三方系统的ID
udiwmsOrderRequest.setCorpName(unitMaintainEntity.getThirdName()); //往来单位名称,需转换为第三方系统的名称
}
InvWarehouseEntity invWarehouseEntity = invWarehouseService.selectByCode(stockOrderEntity.getLocStorageCode());
ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseService.selectByCode(invWarehouseEntity.getThirdId());
udiwmsOrderRequest.setLocStorageCode(thrInvWarehouseEntity.getCode());
udiwmsOrderRequest.setLocStorageName(thrInvWarehouseEntity.getName());
udiwmsOrderRequest.setBillFlag(stockOrderEntity.getBillFlag());//单据状态
//查询单据出入库类型
String mainAction = bussinessTypeDao.selectInoutTypebByLocalAction(stockOrderEntity.getBillType());
if (ConstantType.TYPE_PUT.equals(mainAction)) {
@ -206,22 +252,36 @@ public class StockOrderServiceImpl implements StockOrderService {
//组装明细数据
List<UdiwmsOrderDetail> items = new ArrayList<>(stockOrderDetailEntities.size());
for (StockOrderDetailEntity stockOrderDetailEntity : stockOrderDetailEntities) {
UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectById(stockOrderDetailEntity.getRelId());
UdiwmsOrderDetail item = new UdiwmsOrderDetail();
BeanUtil.copyProperties(stockOrderDetailEntity, item);
item.setProductId(udiRelevanceEntity.getThirdId());
item.setProductName(udiRelevanceEntity.getThirdName());
items.add(item);
}
udiwmsOrderRequest.setItems(items);
udiwmsOrderRequest.setItem(items);
//提交单据到第三方服务
BasicThirdSysEntity basicThirdSysEntity = basicThirdSysDao.selectByThirdId(thirdSysBusApiEntity.getThirdSys());
String response = HttpClient.uCloudPost(basicThirdSysEntity.getThridUrl() + "/udiwms/erp/submitOrders", udiwmsOrderRequest);
if (StrUtil.isNotBlank(response)) {
try {
BaseResponse baseResponse = JSONUtil.toBean(response, BaseResponse.class);
BaseResponse<UdiwmsOrderResponse> baseResponse = JSONObject.parseObject(response, new TypeReference<BaseResponse<UdiwmsOrderResponse>>() {
});
if (baseResponse.getCode().equals(20000)) {
UdiwmsOrderResponse udiwmsOrderResponse = baseResponse.getData();
//提交成功,更新导出状态
orderDao.updateExportStatus(stockOrderEntity.getOrderIdFk(), 1);
OrderEntity orderEntity =
orderService.findById(stockOrderEntity.getOrderIdFk());
orderEntity.setExportStatus(1);
if (udiwmsOrderResponse != null) {
orderEntity.setThirdBillNo(udiwmsOrderResponse.getThirdBillNo());
}
orderService.updateOrder(orderEntity);
return ResultVOUtils.success("提交成功");
}
return ResultVOUtils.error(500, "提交失败");

@ -44,7 +44,7 @@ public interface InvWarehouseService {
* @param id
* @param thridWarehouseId
*/
boolean bindThrWarehouse(Integer id, Integer thridWarehouseId, String sysId);
boolean bindThrWarehouse(Integer id, String thridWarehouseId, String sysId);
/**
*

@ -125,7 +125,7 @@ public class InvWarehouseServiceImpl implements InvWarehouseService {
}
@Override
public boolean bindThrWarehouse(Integer id, Integer thridWarehouseId, String sysId) {
public boolean bindThrWarehouse(Integer id, String thridWarehouseId, String sysId) {
return invWarehouseDao.updateThridId(id, thridWarehouseId, sysId);
}

@ -12,6 +12,7 @@ import com.glxp.api.admin.res.erp.UdiwmsWarehouseDetail;
import com.glxp.api.admin.res.erp.UdiwmsWarehouseResponse;
import com.glxp.api.admin.service.thrsys.ThrInvWarehouseService;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -107,28 +108,39 @@ public class ThrInvWarehouseServiceImpl implements ThrInvWarehouseService {
@Transactional(rollbackFor = Exception.class)
@Override
public BaseResponse downloadThirdWarehouse(String thirdSysFk) {
UdiwmsWarehouseRequest udiwmsWarehouseRequest = new UdiwmsWarehouseRequest();
udiwmsWarehouseRequest.setThirdSys(thirdSysFk);
BaseResponse<PageSimpleResponse<UdiwmsWarehouseDetail>> warehouse = erpBasicClient.getWarehouse(udiwmsWarehouseRequest);
if (warehouse.getCode().equals(20000)) {
List<UdiwmsWarehouseDetail> responseList = warehouse.getData().getList();
List<ThrInvWarehouseEntity> list = new ArrayList<>();
for (UdiwmsWarehouseDetail response : responseList) {
ThrInvWarehouseEntity thrInvWarehouseEntity = new ThrInvWarehouseEntity();
//TODO 暂不处理货位数据
thrInvWarehouseEntity.setPid(0);
thrInvWarehouseEntity.setName(response.getName());
thrInvWarehouseEntity.setCode(response.getCode());
thrInvWarehouseEntity.setThirdSysFk(thirdSysFk);
thrInvWarehouseEntity.setAdvanceType(false); //默认是仓库
thrInvWarehouseEntity.setStatus(1);//默认启用
list.add(thrInvWarehouseEntity);
int page = 1;
int limit = 100;
while (true) {
UdiwmsWarehouseRequest udiwmsWarehouseRequest = new UdiwmsWarehouseRequest();
udiwmsWarehouseRequest.setThirdSys(thirdSysFk);
udiwmsWarehouseRequest.setPage(page);
udiwmsWarehouseRequest.setLimit(limit);
BaseResponse<PageSimpleResponse<UdiwmsWarehouseDetail>> baseResponse = erpBasicClient.getWarehouse(udiwmsWarehouseRequest);
if (baseResponse.getCode() == 20000) {
List<UdiwmsWarehouseDetail> responseList = baseResponse.getData().getList();
List<ThrInvWarehouseEntity> list = new ArrayList<>();
for (UdiwmsWarehouseDetail response : responseList) {
ThrInvWarehouseEntity thrInvWarehouseEntity = new ThrInvWarehouseEntity();
thrInvWarehouseEntity.setPid(0);
thrInvWarehouseEntity.setName(response.getName());
thrInvWarehouseEntity.setCode(response.getCode());
thrInvWarehouseEntity.setThirdSysFk(thirdSysFk);
thrInvWarehouseEntity.setAdvanceType(false); //默认是仓库
thrInvWarehouseEntity.setStatus(1);//默认启用
list.add(thrInvWarehouseEntity);
}
//插入数据
thrInvWarehouseDao.insertInvWarehouses(list);
if (list.size() >= limit) {
page++;
} else {
break;
}
} else {
return baseResponse;
}
//插入数据
thrInvWarehouseDao.insertInvWarehouses(list);
warehouse.setData(null);
}
return warehouse;
return ResultVOUtils.success("下载结束!");
}
}

@ -0,0 +1,92 @@
<?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.api.admin.dao.auth.DeviceKeyDao">
<select id="findDeviceKey" parameterType="com.glxp.api.admin.req.info.FilterDeviceKeyRequest"
resultType="com.glxp.api.admin.entity.info.DeviceKeyEntity">
SELECT * FROM device_check
<where>
<if test="imei != null and imei != ''">
and imei = #{imei}
</if>
<if test="isCheck != null and isCheck != ''">
and isCheck = #{isCheck}
</if>
</where>
</select>
<select id="findDeviceByImei" parameterType="com.glxp.api.admin.req.info.FilterDeviceKeyRequest"
resultType="com.glxp.api.admin.entity.info.DeviceKeyEntity">
SELECT * FROM device_check
<where>
<if test="imei != null and imei != ''">
and imei = #{imei}
</if>
</where>
</select>
<update id="updateDeviceKey" parameterType="com.glxp.api.admin.entity.info.DeviceKeyEntity">
UPDATE device_check
<set>
<if test="isCheck != null">isCheck=#{isCheck},</if>
<if test="companyName != null">companyName=#{companyName},</if>
<if test="phone != null">phone=#{phone},</if>
<if test="contact != null">contact=#{contact},</if>
<if test="imeiKey != null">imeiKey=#{imeiKey},</if>
<if test="date != null">date=#{date},</if>
<if test="creditNum != null">creditNum=#{creditNum},</if>
<if test="rgType != null">rgType=#{rgType},</if>
<if test="remark != null">remark=#{remark},</if>
</set>
WHERE id=#{id}
</update>
<update id="updateDeviceKeyByImei" parameterType="com.glxp.api.admin.entity.info.DeviceKeyEntity">
UPDATE device_check
<set>
<if test="isCheck != null">isCheck=#{isCheck},</if>
<if test="companyName != null">companyName=#{companyName},</if>
<if test="phone != null">phone=#{phone},</if>
<if test="contact != null">contact=#{contact},</if>
<if test="imeiKey != null">imeiKey=#{imeiKey},</if>
<if test="date != null">date=#{date},</if>
<if test="imei != null">imei=#{imei},</if>
<if test="creditNum != null">creditNum=#{creditNum},</if>
<if test="rgType != null">rgType=#{rgType},</if>
<if test="remark != null">remark=#{remark},</if>
</set>
WHERE imei=#{imei}
</update>
<insert id="insertDeviceKey" parameterType="com.glxp.api.admin.entity.info.DeviceKeyEntity">
replace INTO device_check(
imei,
isCheck,
companyName,
phone,
contact,
date,
imeiKey,creditNum,rgType,remark) values
(
#{imei},
#{isCheck},
#{companyName},
#{phone},
#{contact},
#{date},
#{imeiKey},#{creditNum},#{rgType},#{remark}
)
</insert>
<delete id="deleteDeviceKey" parameterType="Map">
DELETE FROM device_check WHERE id = #{id}
</delete>
</mapper>

@ -54,7 +54,7 @@
fromCorp, status, remark, exportStatus, fromType, contrastStatus, signStatus,
receiveStatus, erpFk, stockCheckFk, supId,
exportFilePath, locStorageCode, supplementNo, ullageSupNo, createUser, reviewUser,
outChangeEnable, originUllageSupNo,preCheck)
outChangeEnable, originUllageSupNo,preCheck,thirdBillNo)
values (#{id},
#{action},
#{corpOrderId},
@ -73,7 +73,7 @@
#{erpFk},
#{stockCheckFk},
#{supId}, #{exportFilePath}, #{locStorageCode}, #{supplementNo}
, #{ullageSupNo}, #{createUser}, #{reviewUser}, #{outChangeEnable}, #{originUllageSupNo},#{preCheck})
, #{ullageSupNo}, #{createUser}, #{reviewUser}, #{outChangeEnable}, #{originUllageSupNo},#{preCheck},#{thirdBillNo})
</insert>
<insert id="importOrder" keyProperty="id" parameterType="com.glxp.api.admin.entity.inout.OrderEntity">
@ -82,7 +82,7 @@
fromCorp, status, remark, exportStatus, fromType, contrastStatus, signStatus,
receiveStatus, erpFk, stockCheckFk, supId,
exportFilePath, locStorageCode, supplementNo, ullageSupNo, createUser, reviewUser,
outChangeEnable, originUllageSupNo,preCheck)
outChangeEnable, originUllageSupNo,preCheck,thirdBillNo)
values (
#{id},
#{action},
@ -109,7 +109,7 @@
#{createUser},
#{reviewUser},
#{outChangeEnable},
#{originUllageSupNo},#{preCheck}
#{originUllageSupNo},#{preCheck},#{thirdBillNo}
)
</insert>
@ -146,6 +146,7 @@
<if test="outChangeEnable != null">outChangeEnable=#{outChangeEnable},</if>
<if test="originUllageSupNo != null">originUllageSupNo=#{originUllageSupNo},</if>
<if test="preCheck != null">preCheck=#{preCheck},</if>
<if test="thirdBillNo != null">thirdBillNo=#{thirdBillNo},</if>
</trim>
WHERE id = #{id}
@ -275,6 +276,10 @@
<if test="locStorageCode!=null">
and locStorageCode =#{locStorageCode}
</if>
<if test="thirdBillNo!=null">
and thirdBillNo =#{thirdBillNo}
</if>
</where>
group by io_order.id
ORDER BY actDate DESC
@ -346,6 +351,10 @@
<if test="locStorageCode!=null">
and locStorageCode =#{locStorageCode}
</if>
<if test="thirdBillNo!=null">
and thirdBillNo =#{thirdBillNo}
</if>
</where>
group by io_order.id
ORDER BY actDate DESC

@ -225,9 +225,9 @@
WHERE id = #{id}
</update>
<update id="updateThridId">
<update id="updateThridId" parameterType="Map">
update inv_warehouse
set ${sysId} = ${thridWarehouseId}
set ${sysId} = ${thridWarehouseId,jdbcType=VARCHAR}
where id = ${id}
</update>
<insert id="importInvWarehouse" parameterType="java.util.List">

Loading…
Cancel
Save