|
|
|
@ -1,21 +1,33 @@
|
|
|
|
|
package com.glxp.api.service.sync;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.alibaba.fastjson.TypeReference;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.glxp.api.common.res.BaseResponse;
|
|
|
|
|
import com.glxp.api.common.util.ResultVOUtils;
|
|
|
|
|
import com.glxp.api.constant.SocketMsgType;
|
|
|
|
|
import com.glxp.api.dao.inout.IoOrderDao;
|
|
|
|
|
import com.glxp.api.entity.basic.BasicBussinessTypeEntity;
|
|
|
|
|
import com.glxp.api.entity.basic.BasicCorpEntity;
|
|
|
|
|
import com.glxp.api.entity.basic.UdiRelevanceEntity;
|
|
|
|
|
import com.glxp.api.entity.inout.IoOrderEntity;
|
|
|
|
|
import com.glxp.api.entity.sync.SocketMsgEntity;
|
|
|
|
|
import com.glxp.api.entity.sync.SyncEditLogEntity;
|
|
|
|
|
import com.glxp.api.entity.sync.SyncEditTypeEntity;
|
|
|
|
|
import com.glxp.api.http.sync.SpGetHttpClient;
|
|
|
|
|
import com.glxp.api.req.basic.BasicDataRequest;
|
|
|
|
|
import com.glxp.api.req.basic.DeleteBasicDataRequest;
|
|
|
|
|
import com.glxp.api.req.system.DeleteCompanyFileRequest;
|
|
|
|
|
import com.glxp.api.req.system.DeleteRequest;
|
|
|
|
|
import com.glxp.api.service.basic.*;
|
|
|
|
|
import com.glxp.api.service.inout.IoCodeService;
|
|
|
|
|
import com.glxp.api.service.inout.IoOrderService;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
|
public class SocketMsgService {
|
|
|
|
@ -28,10 +40,47 @@ public class SocketMsgService {
|
|
|
|
|
@Async
|
|
|
|
|
public void dealNoticeMsg(SocketMsgEntity socketMsgEntity) {
|
|
|
|
|
if (socketMsgEntity != null && StrUtil.isNotEmpty(socketMsgEntity.getType())) {
|
|
|
|
|
Map<String, Object> object = null;
|
|
|
|
|
BasicDataRequest basicDataRequest = null;
|
|
|
|
|
BaseResponse baseResponse = null;
|
|
|
|
|
switch (socketMsgEntity.getType()) {
|
|
|
|
|
case SocketMsgType.TASK_INVOICE_CONFIRM:
|
|
|
|
|
invoiceConfirm(socketMsgEntity);
|
|
|
|
|
break;
|
|
|
|
|
case SocketMsgType.BASIC_DATA_DELETE:
|
|
|
|
|
String content = String.valueOf(socketMsgEntity.getContent());
|
|
|
|
|
object = JSON.parseObject(content, Map.class);
|
|
|
|
|
basicDataRequest = JSON.parseObject(content, BasicDataRequest.class);
|
|
|
|
|
baseResponse = deleteById(basicDataRequest.getDeleteRequest());
|
|
|
|
|
//插入日志
|
|
|
|
|
insertLog(basicDataRequest.getDeleteBasicDataRequest(), baseResponse);
|
|
|
|
|
insertType(basicDataRequest.getDeleteBasicDataRequest());
|
|
|
|
|
break;
|
|
|
|
|
case SocketMsgType.BASIC_MANAGE_DELETE:
|
|
|
|
|
|
|
|
|
|
object = JSON.parseObject(String.valueOf(socketMsgEntity.getContent()), Map.class);
|
|
|
|
|
basicDataRequest = JSON.parseObject(String.valueOf(socketMsgEntity.getContent()), BasicDataRequest.class);
|
|
|
|
|
baseResponse = deleteCompanyProductRelevance(basicDataRequest.getDeleteCompanyFileRequest());
|
|
|
|
|
//插入日志
|
|
|
|
|
insertLog(basicDataRequest.getDeleteBasicDataRequest(), baseResponse);
|
|
|
|
|
insertType(basicDataRequest.getDeleteBasicDataRequest());
|
|
|
|
|
break;
|
|
|
|
|
case SocketMsgType.BASIC_CORP_MAINTAIN_DELETE:
|
|
|
|
|
object = JSON.parseObject(String.valueOf(socketMsgEntity.getContent()), Map.class);
|
|
|
|
|
basicDataRequest = JSON.parseObject(String.valueOf(socketMsgEntity.getContent()), BasicDataRequest.class);
|
|
|
|
|
baseResponse = deleteBasicUnitMaintain(basicDataRequest.getDeleteRequest());
|
|
|
|
|
//插入日志
|
|
|
|
|
insertLog(basicDataRequest.getDeleteBasicDataRequest(), baseResponse);
|
|
|
|
|
insertType(basicDataRequest.getDeleteBasicDataRequest());
|
|
|
|
|
break;
|
|
|
|
|
case SocketMsgType.BASIC_BUSINESS_TYPE_DELETE:
|
|
|
|
|
object = JSON.parseObject(String.valueOf(socketMsgEntity.getContent()), Map.class);
|
|
|
|
|
basicDataRequest = JSON.parseObject(String.valueOf(socketMsgEntity.getContent()), BasicDataRequest.class);
|
|
|
|
|
baseResponse = deleteBussinessType(basicDataRequest.getDeleteRequest());
|
|
|
|
|
//插入日志
|
|
|
|
|
insertLog(basicDataRequest.getDeleteBasicDataRequest(), baseResponse);
|
|
|
|
|
insertType(basicDataRequest.getDeleteBasicDataRequest());
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
@ -55,4 +104,96 @@ public class SocketMsgService {
|
|
|
|
|
orderService.updateByBillNo(updateEntity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
UdiRelevanceService udiRelevanceService;
|
|
|
|
|
@Resource
|
|
|
|
|
IoCodeService codeService;
|
|
|
|
|
@Resource
|
|
|
|
|
CompanyProductRelevanceService companyProductRelevanceService;
|
|
|
|
|
@Resource
|
|
|
|
|
UdiProductService udiProductService;
|
|
|
|
|
@Resource
|
|
|
|
|
UdiRlSupService udiRlSupService;
|
|
|
|
|
@Resource
|
|
|
|
|
BasicCorpService basicUnitMaintainService;
|
|
|
|
|
@Resource
|
|
|
|
|
private IBasicBussinessTypeService basicBussinessTypeService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public BaseResponse deleteById(DeleteRequest deleteRequest) {
|
|
|
|
|
|
|
|
|
|
String ids = deleteRequest.getId();
|
|
|
|
|
UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectById(Long.parseLong(ids));
|
|
|
|
|
if (udiRelevanceEntity != null && udiRelevanceEntity.getUuid() != null) {
|
|
|
|
|
if (codeService.isExitByRelId(udiRelevanceEntity.getId() + "")) {
|
|
|
|
|
return ResultVOUtils.error(500, "该产品已关联单据,无法删除!");
|
|
|
|
|
}
|
|
|
|
|
if (companyProductRelevanceService.isExitByRelId(udiRelevanceEntity.getId() + "")) {
|
|
|
|
|
return ResultVOUtils.error(500, "该产品已被已被供应商选入,无法删除!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
udiRelevanceService.deleteById(ids);
|
|
|
|
|
List<UdiRelevanceEntity> udiRelevanceEntities = udiRelevanceService.selectByUuid(udiRelevanceEntity.getUuid());
|
|
|
|
|
if (udiRelevanceEntities == null || udiRelevanceEntities.isEmpty()) {
|
|
|
|
|
udiProductService.deleteByUuid(udiRelevanceEntity.getUuid());
|
|
|
|
|
}
|
|
|
|
|
return ResultVOUtils.success("删除成功");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public BaseResponse deleteCompanyProductRelevance(DeleteCompanyFileRequest deleteCompanyFileRequest) {
|
|
|
|
|
boolean b = udiRlSupService.deleteById(deleteCompanyFileRequest.getId());
|
|
|
|
|
return ResultVOUtils.success("成功");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public BaseResponse deleteBasicUnitMaintain( DeleteRequest deleteRequest) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String id = deleteRequest.getId();
|
|
|
|
|
BasicCorpEntity basicUnitMaintainEntity = basicUnitMaintainService.selectById(id);
|
|
|
|
|
|
|
|
|
|
basicUnitMaintainService.deleteById(id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ResultVOUtils.success("删除成功");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public BaseResponse deleteBussinessType( DeleteRequest deleteRequest) {
|
|
|
|
|
|
|
|
|
|
// if (bindingResult.hasErrors()) {
|
|
|
|
|
// return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
|
|
|
|
// }
|
|
|
|
|
String id = deleteRequest.getId();
|
|
|
|
|
BasicBussinessTypeEntity bussinessTypeEntity = basicBussinessTypeService.selectById(id);
|
|
|
|
|
|
|
|
|
|
return basicBussinessTypeService.deleteBussinessType(id) == true ? ResultVOUtils.success("删除成功") : ResultVOUtils.error(500, "删除失败,系统繁忙");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
SyncEditLogService syncEditLogService;
|
|
|
|
|
@Resource
|
|
|
|
|
SyncEditTypeService syncEditTypeService;
|
|
|
|
|
|
|
|
|
|
public void insertLog(DeleteBasicDataRequest deleteBasicDataRequest, BaseResponse response) {
|
|
|
|
|
SyncEditLogEntity syncEditLogEntity = new SyncEditLogEntity();
|
|
|
|
|
syncEditLogEntity.setRecordCode(deleteBasicDataRequest.getRecordCode());
|
|
|
|
|
syncEditLogEntity.setOperType(2);
|
|
|
|
|
syncEditLogEntity.setDataType(deleteBasicDataRequest.getDataType());
|
|
|
|
|
syncEditLogEntity.setParam(deleteBasicDataRequest.getParam());
|
|
|
|
|
syncEditLogEntity.setJsonResult(response.getMessage());
|
|
|
|
|
syncEditLogEntity.setDirectType(2);
|
|
|
|
|
syncEditLogEntity.setOperUser(deleteBasicDataRequest.getUserId());
|
|
|
|
|
syncEditLogEntity.setUpdateTime(new Date());
|
|
|
|
|
syncEditLogService.insertLog(syncEditLogEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void insertType(DeleteBasicDataRequest deleteBasicDataRequest) {
|
|
|
|
|
SyncEditTypeEntity syncEditTypeEntity = new SyncEditTypeEntity();
|
|
|
|
|
syncEditTypeEntity.setCode(deleteBasicDataRequest.getDataType());
|
|
|
|
|
syncEditTypeEntity.setName(deleteBasicDataRequest.getName());
|
|
|
|
|
syncEditTypeService.insertType(syncEditTypeEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|