往来单位信息代码提交

master
郑明梁 2 years ago
parent f15f5e6eaf
commit 9b2c6851ef

@ -0,0 +1,494 @@
package com.glxp.api.controller.basic;
import com.github.pagehelper.PageInfo;
import com.glxp.api.annotation.AuthRuleAnnotation;
import com.glxp.api.common.enums.ResultEnum;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.constant.ConstantStatus;
import com.glxp.api.entity.basic.BasicCorpEntity;
import com.glxp.api.entity.system.SystemParamConfigEntity;
import com.glxp.api.entity.thrsys.ThrCorpEntity;
import com.glxp.api.entity.thrsys.ThrSystemEntity;
import com.glxp.api.http.ErpBasicClient;
import com.glxp.api.req.basic.BasicUnitMaintainFilterRequest;
import com.glxp.api.req.system.DeleteRequest;
import com.glxp.api.req.thrsys.FilterBasicThirdSysRequest;
import com.glxp.api.req.thrsys.FilterThrCorpRequest;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.res.basic.BasicProductThirdSysResponse;
import com.glxp.api.res.basic.BasicUnitMaintainResponse;
import com.glxp.api.service.basic.BasicUnitMaintainService;
import com.glxp.api.service.system.CompanyService;
import com.glxp.api.service.system.SystemParamConfigService;
import com.glxp.api.service.thrsys.ThrCorpService;
import com.glxp.api.service.thrsys.ThrSystemService;
import com.glxp.api.util.CustomUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
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.util.*;
import java.util.stream.Collectors;
/**
*
*/
@RestController
public class BasicUnitMaintainController {
@Resource
private BasicUnitMaintainService basicUnitMaintainService;
// @Resource
// BasicThirdSysDetailService basicThirdSysDetailService;
@Resource
private SystemParamConfigService systemParamConfigService;
@Resource
private ThrSystemService thrSystemService;
// @Resource
// BasicUnitImportService basicUnitImportService;
@Resource
private ThrCorpService thrCorpService;
@Resource
private CompanyService companyService;
// @Resource
// private OrderService orderService;
@Resource
private ErpBasicClient erpBasicClient;
@GetMapping("/udiwms/basic/unit/maintain/filter")
public BaseResponse filterBasicUnitMaintain(BasicUnitMaintainFilterRequest basicUnitMaintainFilterRequest,
BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
List<BasicCorpEntity> basicUnitMaintainEntities;
basicUnitMaintainFilterRequest.setOutType(ConstantStatus.CORP_SICK_SICK);
basicUnitMaintainEntities = basicUnitMaintainService.filterList(basicUnitMaintainFilterRequest);
PageInfo<BasicCorpEntity> pageInfo = new PageInfo<>(basicUnitMaintainEntities);
PageSimpleResponse<BasicCorpEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(basicUnitMaintainEntities);
SystemParamConfigEntity systemParamConfigEntityBUMErpId = systemParamConfigService.selectByParamKey("basic_unit_maintain_erp_id");
SystemParamConfigEntity systemParamConfigEntityBUMThirdId = systemParamConfigService.selectByParamKey("basic_cops_thirdSys");
Map<String, Object> rMap = new HashMap<>();
rMap.put("BUMErpIdValue",
systemParamConfigEntityBUMErpId != null && StringUtils.isNotBlank(systemParamConfigEntityBUMErpId.getParamValue()) ?
systemParamConfigEntityBUMErpId.getParamValue() : "0");
rMap.put("BUMThirdIdValue",
systemParamConfigEntityBUMThirdId != null && StringUtils.isNotBlank(systemParamConfigEntityBUMThirdId.getParamValue()) ?
systemParamConfigEntityBUMThirdId.getParamValue() : "0");
rMap.put("page", pageSimpleResponse);
return ResultVOUtils.success(rMap);
}
@GetMapping("/udiwms/basic/unit/maintain/filter2")
public BaseResponse filterBasicUnitMaintain2(BasicUnitMaintainFilterRequest basicUnitMaintainFilterRequest,
BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
List<BasicCorpEntity> basicUnitMaintainEntities;
basicUnitMaintainEntities = basicUnitMaintainService.filterList(basicUnitMaintainFilterRequest);
PageInfo<BasicCorpEntity> pageInfo;
pageInfo = new PageInfo<>(basicUnitMaintainEntities);
PageSimpleResponse<BasicCorpEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(basicUnitMaintainEntities);
return ResultVOUtils.success(pageSimpleResponse);
}
@AuthRuleAnnotation("")
@PostMapping("/udiwms/basic/unit/maintain/save")
public BaseResponse save(@RequestBody @Valid BasicCorpEntity basicUnitMaintainSaveRequest,
BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
BasicCorpEntity basicUnitMaintainEntity = new BasicCorpEntity();
BeanUtils.copyProperties(basicUnitMaintainSaveRequest, basicUnitMaintainEntity);
basicUnitMaintainEntity.setErpId(CustomUtil.getId());
basicUnitMaintainEntity.setOutType(ConstantStatus.CORP_SICK_CUS);
basicUnitMaintainEntity.setUpdateTime(new Date());
boolean b = basicUnitMaintainService.insertBasicUnitMaintain(basicUnitMaintainEntity);
if (!b) {
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
}
return ResultVOUtils.success();
}
@AuthRuleAnnotation("")
@PostMapping("/udiwms/basic/unit/maintain/update")
public BaseResponse update(@RequestBody @Valid BasicCorpEntity basicUnitMaintainSaveRequest,BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
basicUnitMaintainService.updateById(basicUnitMaintainSaveRequest);
return ResultVOUtils.success("修改成功");
}
// @AuthRuleAnnotation("")
@GetMapping("/udiwms/unit/download")
public BaseResponse downloadBasicUnit(BasicUnitMaintainFilterRequest basicUnitMaintainFilterRequest,
BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
basicUnitMaintainFilterRequest.setOutType(ConstantStatus.CORP_SICK_SICK);
List<BasicCorpEntity> basicUnitMaintainEntities;
basicUnitMaintainEntities = basicUnitMaintainService.filterList(basicUnitMaintainFilterRequest);
List<BasicUnitMaintainResponse> basicUnitMaintainResponses = basicUnitMaintainEntities.stream().map(item ->
{
BasicUnitMaintainResponse basicUnitMaintainResponse = new BasicUnitMaintainResponse();
BeanUtils.copyProperties(item, basicUnitMaintainResponse);
basicUnitMaintainResponse.setUnitId(item.getErpId());
return basicUnitMaintainResponse;
}).collect(Collectors.toList());
PageInfo<BasicUnitMaintainResponse> pageInfo;
pageInfo = new PageInfo<>(basicUnitMaintainResponses);
PageSimpleResponse<BasicUnitMaintainResponse> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(basicUnitMaintainResponses);
return ResultVOUtils.success(pageSimpleResponse);
}
@AuthRuleAnnotation("")
@GetMapping("/udiwms/basic/unit/download")
public BaseResponse scdownloadBasicUnit(BasicUnitMaintainFilterRequest basicUnitMaintainFilterRequest,
BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
basicUnitMaintainFilterRequest.setOutType(ConstantStatus.CORP_SICK_SICK);
List<BasicCorpEntity> basicUnitMaintainEntities;
basicUnitMaintainEntities = basicUnitMaintainService.filterList(basicUnitMaintainFilterRequest);
List<BasicUnitMaintainResponse> basicUnitMaintainResponses = basicUnitMaintainEntities.stream().map(item ->
{
BasicUnitMaintainResponse basicUnitMaintainResponse = new BasicUnitMaintainResponse();
BeanUtils.copyProperties(item, basicUnitMaintainResponse);
basicUnitMaintainResponse.setUnitId(item.getErpId());
return basicUnitMaintainResponse;
}).collect(Collectors.toList());
PageInfo<BasicUnitMaintainResponse> pageInfo;
pageInfo = new PageInfo<>(basicUnitMaintainResponses);
PageSimpleResponse<BasicUnitMaintainResponse> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(basicUnitMaintainResponses);
return ResultVOUtils.success(pageSimpleResponse);
}
// @AuthRuleAnnotation("")
// @PostMapping("/udiwms/basic/unit/maintain/combine")
// public BaseResponse combine(@RequestBody CombineUnitRequest combineRequest, BindingResult bindingResult) {
//
// if (bindingResult.hasErrors()) {
// return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
// }
// List<ErpUnitsResponse> erpUnitsResponses = combineRequest.getCustmandocResponses();
// if (erpUnitsResponses != null && erpUnitsResponses.size() > 0) {
// for (ErpUnitsResponse erpUnitsResponse : erpUnitsResponses) {
// BasicUnitMaintainEntity basicUnitMaintainEntity = new BasicUnitMaintainEntity();
// if (combineRequest.getThirdSys() != null) {
// if ("thirdId".equals(combineRequest.getThirdSys())) {
// basicUnitMaintainEntity.setThirdId(erpUnitsResponse.getId());
// basicUnitMaintainEntity.setThirdName(erpUnitsResponse.getName());
// } else if ("thirdId1".equals(combineRequest.getThirdSys())) {
// basicUnitMaintainEntity.setThirdId1(erpUnitsResponse.getId());
// basicUnitMaintainEntity.setThirdName1(erpUnitsResponse.getName());
// } else if ("thirdId2".equals(combineRequest.getThirdSys())) {
// basicUnitMaintainEntity.setThirdId2(erpUnitsResponse.getId());
// basicUnitMaintainEntity.setThirdName2(erpUnitsResponse.getName());
// } else if ("thirdId3".equals(combineRequest.getThirdSys())) {
// basicUnitMaintainEntity.setThirdId3(erpUnitsResponse.getId());
// basicUnitMaintainEntity.setThirdName3(erpUnitsResponse.getName());
// } else if ("thirdId4".equals(combineRequest.getThirdSys())) {
// basicUnitMaintainEntity.setThirdId4(erpUnitsResponse.getId());
// basicUnitMaintainEntity.setThirdName4(erpUnitsResponse.getName());
// }
// }
// basicUnitMaintainEntity.setErpId(CustomUtil.getId());
// basicUnitMaintainEntity.setName(erpUnitsResponse.getName());
// basicUnitMaintainEntity.setSpell(erpUnitsResponse.getSpell());
// basicUnitMaintainEntity.setAddr(erpUnitsResponse.getAddr());
// basicUnitMaintainEntity.setCreditNo(erpUnitsResponse.getCreditNo());
// basicUnitMaintainEntity.setContact(erpUnitsResponse.getContact());
// basicUnitMaintainEntity.setMobile(erpUnitsResponse.getMobile());
// basicUnitMaintainEntity.setCorpType(ConstantStatus.CORP_SP);
// basicUnitMaintainEntity.setUpdateTime(new Date());
// basicUnitMaintainService.insertBasicUnitMaintain(basicUnitMaintainEntity);
// }
// }
// return ResultVOUtils.success("选入成功");
// }
//
// @AuthRuleAnnotation("")
// @GetMapping("/udiwms/basic/unit/maintain/combineAll")
// public BaseResponse combineAll(BasicUnitMaintainFilterRequest unitMaintainFilterRequest, BindingResult bindingResult) {
//
// if (bindingResult.hasErrors()) {
// return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
// }
// BasicThirdSysDetailEntity basicThirdSysDetailEntity = basicThirdSysDetailService.selectByKey("corpUrl", unitMaintainFilterRequest.getThirdSys());
// if (basicThirdSysDetailEntity == null || basicThirdSysDetailEntity.getValue() == null)
// return ResultVOUtils.error(500, "往来单位接口地址未定义");
// if (basicThirdSysDetailEntity.getEnabled()) {
// basicUnitImportService.selectAllUnit(basicThirdSysDetailEntity, unitMaintainFilterRequest);
//
// } else {
// return ResultVOUtils.error(500, "第三方系统往来单位接口服务未启用");
// }
//
//
// return ResultVOUtils.success("后台正在添加,请稍后刷新查看!");
// }
//
// @AuthRuleAnnotation("")
// @PostMapping("/udiwms/basic/unit/maintain/combineSingle")
// public BaseResponse combineSingle(@RequestBody CombineSingleUnitRequest combineRequest, BindingResult bindingResult) {
//
// if (bindingResult.hasErrors()) {
// return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
// }
// ErpUnitsResponse erpUnitsResponse = combineRequest.getErpUnitsResponse();
// BasicUnitMaintainEntity basicUnitMaintainEntity = new BasicUnitMaintainEntity();
// basicUnitMaintainEntity.setId(Integer.parseInt(combineRequest.getKey()));
// if (combineRequest.getThirdSys() != null) {
// if ("thirdId".equals(combineRequest.getThirdSys())) {
// basicUnitMaintainEntity.setThirdId(erpUnitsResponse.getId());
// basicUnitMaintainEntity.setThirdName(erpUnitsResponse.getName());
// } else if ("thirdId1".equals(combineRequest.getThirdSys())) {
// basicUnitMaintainEntity.setThirdId1(erpUnitsResponse.getId());
// basicUnitMaintainEntity.setThirdName1(erpUnitsResponse.getName());
// } else if ("thirdId2".equals(combineRequest.getThirdSys())) {
// basicUnitMaintainEntity.setThirdId2(erpUnitsResponse.getId());
// basicUnitMaintainEntity.setThirdName2(erpUnitsResponse.getName());
// } else if ("thirdId3".equals(combineRequest.getThirdSys())) {
// basicUnitMaintainEntity.setThirdId3(erpUnitsResponse.getId());
// basicUnitMaintainEntity.setThirdName3(erpUnitsResponse.getName());
// } else if ("thirdId4".equals(combineRequest.getThirdSys())) {
// basicUnitMaintainEntity.setThirdId4(erpUnitsResponse.getId());
// basicUnitMaintainEntity.setThirdName4(erpUnitsResponse.getName());
// }
// }
//// basicUnitMaintainEntity.setThirdName(erpUnitsResponse.getName());
//// basicUnitMaintainEntity.setSpell(erpUnitsResponse.getSpell());
//// basicUnitMaintainEntity.setAddr(erpUnitsResponse.getAddr());
//// basicUnitMaintainEntity.setCreditNo(erpUnitsResponse.getCreditNo());
//// basicUnitMaintainEntity.setContact(erpUnitsResponse.getContact());
//// basicUnitMaintainEntity.setMobile(erpUnitsResponse.getMobile());
// basicUnitMaintainService.updateById(basicUnitMaintainEntity);
// return ResultVOUtils.success("关联成功");
// }
//
// //解除绑定
// @AuthRuleAnnotation("")
// @GetMapping("/udiwms/unit/thirdSys/removeRl")
// public BaseResponse uploadThirdServcie(RemoveRelRequest removeRelRequest) {
// BasicUnitMaintainEntity udiRelevanceEntity = basicUnitMaintainService.selectById(removeRelRequest.getRelId());
// if (removeRelRequest.getThirdSys().equals("thirdId")) {
// udiRelevanceEntity.setThirdId("");
// udiRelevanceEntity.setThirdName("");
// } else if (removeRelRequest.getThirdSys().equals("thirdId1")) {
// udiRelevanceEntity.setThirdId1("");
// udiRelevanceEntity.setThirdName1("");
// } else if (removeRelRequest.getThirdSys().equals("thirdId2")) {
// udiRelevanceEntity.setThirdId2("");
// udiRelevanceEntity.setThirdName2("");
// } else if (removeRelRequest.getThirdSys().equals("thirdId3")) {
// udiRelevanceEntity.setThirdId3("");
// udiRelevanceEntity.setThirdName3("");
// } else if (removeRelRequest.getThirdSys().equals("thirdId4")) {
// udiRelevanceEntity.setThirdId4("");
// udiRelevanceEntity.setThirdName4("");
// }
// basicUnitMaintainService.updateById(udiRelevanceEntity);
//
// return ResultVOUtils.success("解除绑定成功!");
// }
//
// @AuthRuleAnnotation("")
@PostMapping("/udiwms/basic/unit/maintain/delete")
public BaseResponse deleteBasicUnitMaintain(@RequestBody DeleteRequest deleteRequest, BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
String id = deleteRequest.getId();
BasicCorpEntity basicUnitMaintainEntity = basicUnitMaintainService.selectById(id);
//todo 该功能还未设计
// //判断是否被单据绑定
// OrderFilterRequest orderFilterRequest = new OrderFilterRequest();
// orderFilterRequest.setFromCorpId(basicUnitMaintainEntity.getErpId());
// OrderEntity orderEntity = orderService.findOne(orderFilterRequest);
// if (orderEntity != null) {
// return ResultVOUtils.error(500, "已存在该供应商单据,无法删除!");
// }
basicUnitMaintainService.deleteById(id);
return ResultVOUtils.success("删除成功");
}
//
// //查询ERP往来单位
// @AuthRuleAnnotation("")
// @GetMapping("/udiwms/unitMaintain/filterErp")
// public BaseResponse filterErp(BasicUnitMaintainFilterRequest unitMaintainFilterRequest,
// BindingResult bindingResult) {
//
// if (bindingResult.hasErrors()) {
// return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
// }
// BasicThirdSysDetailEntity basicThirdSysDetailEntity = basicThirdSysDetailService.selectByKey("corpUrl", unitMaintainFilterRequest.getThirdSys());
// if (basicThirdSysDetailEntity == null || basicThirdSysDetailEntity.getValue() == null)
// return ResultVOUtils.error(500, "往来单位接口地址未定义");
// if (basicThirdSysDetailEntity.getEnabled()) {
// if (basicThirdSysDetailEntity.getFromType() == 0 || (unitMaintainFilterRequest.getIsDownThrSys() != null && unitMaintainFilterRequest.getIsDownThrSys())) {
// BaseResponse<PageSimpleResponse<ErpUnitsResponse>> udiDlDeviceResponse =
// erpBasicClient.getErpCrop(unitMaintainFilterRequest);
//
// if (udiDlDeviceResponse.getCode() == 20000) {
// for (ErpUnitsResponse erpUnitsResponse : udiDlDeviceResponse.getData().getList()) {
// BasicUnitMaintainEntity basicUnitMaintainEntity = basicUnitMaintainService.selectByThirdId(erpUnitsResponse.getId(), unitMaintainFilterRequest.getThirdSys());
// if (basicUnitMaintainEntity != null) {
// erpUnitsResponse.setChecked(true);
// } else {
// erpUnitsResponse.setChecked(false);
// }
// }
//
// return udiDlDeviceResponse;
// } else {
// return udiDlDeviceResponse;
// }
//
// } else {
// FilterThrCorpRequest filterThrCorpRequest = new FilterThrCorpRequest();
// BeanUtils.copyProperties(unitMaintainFilterRequest, filterThrCorpRequest);
// filterThrCorpRequest.setThirdSysFk(unitMaintainFilterRequest.getThirdSys());
// List<ThrCorpEntity> thrCorpEntities
// = thrCorpService.filterThrCorps(filterThrCorpRequest);
// List<ThrCorpEntity> thrCorpEntityList = thrCorpEntities.stream().map(item ->
// {
// ThrCorpEntity thrCorpEntity = new ThrCorpEntity();
// BeanUtils.copyProperties(item, thrCorpEntity);
// BasicUnitMaintainEntity basicUnitMaintainEntity = basicUnitMaintainService.selectByThirdId(item.getUnitId(), unitMaintainFilterRequest.getThirdSys());
// if (basicUnitMaintainEntity != null) {
// thrCorpEntity.setChecked(true);
// } else {
// thrCorpEntity.setChecked(false);
// }
// thrCorpEntity.setId(item.getUnitId());
// return thrCorpEntity;
// }).collect(Collectors.toList());
// PageInfo<ThrCorpEntity> pageInfo;
// pageInfo = new PageInfo<>(thrCorpEntities);
// PageSimpleResponse<ThrCorpEntity> pageSimpleResponse = new PageSimpleResponse<>();
// pageSimpleResponse.setTotal(pageInfo.getTotal());
// pageSimpleResponse.setList(thrCorpEntityList);
// return ResultVOUtils.success(pageSimpleResponse);
// }
// } else {
// return ResultVOUtils.error(500, "第三方系统往来单位服务接口未启用");
// }
// }
//
//获取产品信息详情(多平台)
@AuthRuleAnnotation("")
@GetMapping("/udiwms/unitMaintain/thirdSys/detail")
public BaseResponse getThirdSysDetail(BasicUnitMaintainFilterRequest basicUnitMaintainFilterRequest,
BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
BasicCorpEntity basicUnitMaintainEntity = basicUnitMaintainService.selectById(basicUnitMaintainFilterRequest.getId() + "");
FilterBasicThirdSysRequest filterBasicThirdSysRequest = new FilterBasicThirdSysRequest();
filterBasicThirdSysRequest.setEnabled(true);
List<ThrSystemEntity> basicThirdSysEntities = thrSystemService.filterBasicThiSys(filterBasicThirdSysRequest);
List<BasicProductThirdSysResponse> basicProductThirdSysResponses = new ArrayList<>();
for (ThrSystemEntity basicThirdSysEntity : basicThirdSysEntities) {
if (basicThirdSysEntity.getThirdId().equals("thirdId")) {
BasicProductThirdSysResponse basicProductThirdSysResponse = new BasicProductThirdSysResponse();
basicProductThirdSysResponse.setSysId(basicThirdSysEntity.getThirdId());
basicProductThirdSysResponse.setSysName(basicThirdSysEntity.getThirdName());
if (basicUnitMaintainEntity != null) {
basicProductThirdSysResponse.setThirdId(basicUnitMaintainEntity.getThirdId());
basicProductThirdSysResponse.setThirdName(basicUnitMaintainEntity.getThirdName());
}
basicProductThirdSysResponses.add(basicProductThirdSysResponse);
} else if (basicThirdSysEntity.getThirdId().equals("thirdId1")) {
BasicProductThirdSysResponse basicProductThirdSysResponse = new BasicProductThirdSysResponse();
basicProductThirdSysResponse.setSysId(basicThirdSysEntity.getThirdId());
basicProductThirdSysResponse.setSysName(basicThirdSysEntity.getThirdName());
if (basicUnitMaintainEntity != null) {
basicProductThirdSysResponse.setThirdId(basicUnitMaintainEntity.getThirdId1());
basicProductThirdSysResponse.setThirdName(basicUnitMaintainEntity.getThirdName1());
}
basicProductThirdSysResponses.add(basicProductThirdSysResponse);
} else if (basicThirdSysEntity.getThirdId().equals("thirdId2")) {
BasicProductThirdSysResponse basicProductThirdSysResponse = new BasicProductThirdSysResponse();
basicProductThirdSysResponse.setSysId(basicThirdSysEntity.getThirdId());
basicProductThirdSysResponse.setSysName(basicThirdSysEntity.getThirdName());
if (basicUnitMaintainEntity != null) {
basicProductThirdSysResponse.setThirdId(basicUnitMaintainEntity.getThirdId2());
basicProductThirdSysResponse.setThirdName(basicUnitMaintainEntity.getThirdName2());
}
basicProductThirdSysResponses.add(basicProductThirdSysResponse);
} else if (basicThirdSysEntity.getThirdId().equals("thirdId3")) {
BasicProductThirdSysResponse basicProductThirdSysResponse = new BasicProductThirdSysResponse();
basicProductThirdSysResponse.setSysId(basicThirdSysEntity.getThirdId());
basicProductThirdSysResponse.setSysName(basicThirdSysEntity.getThirdName());
if (basicUnitMaintainEntity != null) {
basicProductThirdSysResponse.setThirdId(basicUnitMaintainEntity.getThirdId3());
basicProductThirdSysResponse.setThirdName(basicUnitMaintainEntity.getThirdName3());
}
basicProductThirdSysResponses.add(basicProductThirdSysResponse);
} else if (basicThirdSysEntity.getThirdId().equals("thirdId4")) {
BasicProductThirdSysResponse basicProductThirdSysResponse = new BasicProductThirdSysResponse();
basicProductThirdSysResponse.setSysId(basicThirdSysEntity.getThirdId());
basicProductThirdSysResponse.setSysName(basicThirdSysEntity.getThirdName());
if (basicUnitMaintainEntity != null) {
basicProductThirdSysResponse.setThirdId(basicUnitMaintainEntity.getThirdId4());
basicProductThirdSysResponse.setThirdName(basicUnitMaintainEntity.getThirdName4());
}
basicProductThirdSysResponses.add(basicProductThirdSysResponse);
}
}
PageInfo<BasicProductThirdSysResponse> pageInfo;
pageInfo = new PageInfo<>(basicProductThirdSysResponses);
PageSimpleResponse<BasicProductThirdSysResponse> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(basicProductThirdSysResponses);
return ResultVOUtils.success(pageSimpleResponse);
}
//
// public BasicThirdSysEntity filterThirdSys(String thirdId, List<BasicThirdSysEntity> basicThirdSysEntities) {
// if (basicThirdSysEntities != null && basicThirdSysEntities.size() > 0) {
// for (BasicThirdSysEntity basicThirdSysEntity : basicThirdSysEntities) {
// if (thirdId.equals(basicThirdSysEntity.getThirdId())) {
// return basicThirdSysEntity;
// }
// }
// }
// return null;
// }
}

@ -0,0 +1,39 @@
package com.glxp.api.dao.basic;
import com.glxp.api.entity.basic.BasicCorpEntity;
import com.glxp.api.req.basic.BasicUnitMaintainFilterRequest;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface BasicUnitMaintainDao {
List<BasicCorpEntity> filterList(BasicUnitMaintainFilterRequest basicUnitMaintainFilterRequest);
boolean insertBasicUnitMaintain(BasicCorpEntity basicUnitMaintainEntity);
boolean insertBasicUnitMaintainignore(BasicCorpEntity basicUnitMaintainEntity);
boolean insert(BasicCorpEntity basicUnitMaintainEntity);
boolean updateById(BasicCorpEntity basicUnitMaintainSaveRequest);
BasicCorpEntity selectByThirdId(BasicUnitMaintainFilterRequest basicUnitMaintainFilterRequest);
boolean deleteById(@Param("id") String id);
BasicCorpEntity selectById(@Param("id") String id);
List<BasicCorpEntity> batchSelectByIds(@Param("ids") List<Integer> id);
List<BasicCorpEntity> batchSelectByErpIds(@Param("erpIds") List<String> erpIds);
BasicCorpEntity selectByName(@Param("name") String name);
boolean importBasicUnitMaintain(BasicCorpEntity basicUnitMaintainEntity);
List<BasicCorpEntity> batchSelectByErpIdsAndName(@Param("erpIds") List<String> erpIds, @Param("name") String name);
}

@ -102,13 +102,13 @@ public class BasicCorpEntity {
* 1.23,4.
*/
@TableField(value = "corpType")
private Byte corpType;
private Integer corpType;
/**
* 1.2.
*/
@TableField(value = "outType")
private Byte outType;
private Integer outType;
/**
*

@ -0,0 +1,31 @@
package com.glxp.api.req.basic;
import com.glxp.api.entity.thrsys.ThrCorpEntity;
import com.glxp.api.req.ListPageRequest;
import com.glxp.api.res.thrsys.ThrCorpsResponse;
import lombok.Data;
import java.util.List;
@Data
public class BasicUnitMaintainFilterRequest extends ListPageRequest {
private Integer id;
private String key;
private String unitId;
private String name;
private String thirdSys;
private String thirdSysFk;
private String thirdId;
private String thirdId1;
private String thirdId2;
private String thirdId3;
private String thirdId4;
private String erpId;
private Integer corpType;
private Integer outType;
private Boolean isDownThrSys;
private String lastUpdateTime;
List<ThrCorpsResponse>thrCorpEntities;
}

@ -0,0 +1,30 @@
package com.glxp.api.res.basic;
import lombok.Data;
import java.util.Date;
@Data
public class BasicUnitMaintainResponse {
private Integer id;
private String thirdId;
private String erpId;
private String name;
private String spell;
private String addr;
private String status;
private String type;
private String creditNo;
private String contact;
private String mobile;
private String thirdName;
private String unitId;
private Integer corpType;
private Integer outType;
private String createUser;
private Date createTime;
private String updateUser;
private Date updateTime;
private String remark;
}

@ -0,0 +1,43 @@
package com.glxp.api.service.basic;
import com.glxp.api.entity.basic.BasicCorpEntity;
import com.glxp.api.req.basic.BasicUnitMaintainFilterRequest;
import java.util.List;
public interface BasicUnitMaintainService {
List<BasicCorpEntity> filterList(BasicUnitMaintainFilterRequest basicUnitMaintainFilterRequest);
boolean insertBasicUnitMaintain(BasicCorpEntity basicUnitMaintainEntity);
boolean updateById(BasicCorpEntity basicUnitMaintainEntity);
boolean insert(BasicCorpEntity basicUnitMaintainEntity);
// boolean updateById(BasicUnitMaintainSaveRequest basicUnitMaintainSaveRequest);
boolean deleteById(String id);
BasicCorpEntity selectByThirdId(String thirdId, String thirdSys);
BasicCorpEntity selectById(String id);
BasicCorpEntity selectByErpId(String id);
BasicCorpEntity selectByName(String name);
boolean isExit();
boolean insertBasicUnitMaintainignore(BasicCorpEntity basicUnitMaintainEntity);
List<BasicCorpEntity> batchSelectByIds(List<Integer> id);
List<BasicCorpEntity> batchSelectByErpIds(List<String> erpIds);
List<BasicCorpEntity> batchSelectByErpIdsAndName(List<String> erpIds, String name);
}

@ -0,0 +1,129 @@
package com.glxp.api.service.basic.impl;
import com.github.pagehelper.PageHelper;
import com.glxp.api.dao.basic.BasicUnitMaintainDao;
import com.glxp.api.entity.basic.BasicCorpEntity;
import com.glxp.api.req.basic.BasicUnitMaintainFilterRequest;
import com.glxp.api.service.basic.BasicUnitMaintainService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.Date;
import java.util.List;
@Service
public class BasicUnitMaintainServiceImpl implements BasicUnitMaintainService {
@Resource
BasicUnitMaintainDao basicUnitMaintainDao;
@Override
public List<BasicCorpEntity> filterList(BasicUnitMaintainFilterRequest basicUnitMaintainFilterRequest) {
if (basicUnitMaintainFilterRequest == null) {
return Collections.emptyList();
}
if (basicUnitMaintainFilterRequest.getPage() != null) {
int offset = (basicUnitMaintainFilterRequest.getPage() - 1) * basicUnitMaintainFilterRequest.getLimit();
PageHelper.offsetPage(offset, basicUnitMaintainFilterRequest.getLimit());
}
List<BasicCorpEntity> data = basicUnitMaintainDao.filterList(basicUnitMaintainFilterRequest);
return data;
}
@Override
public boolean insertBasicUnitMaintainignore(BasicCorpEntity basicUnitMaintainEntity) {
return basicUnitMaintainDao.insertBasicUnitMaintainignore(basicUnitMaintainEntity);
}
@Override
public boolean insertBasicUnitMaintain(BasicCorpEntity basicUnitMaintainEntity) {
return basicUnitMaintainDao.insertBasicUnitMaintain(basicUnitMaintainEntity);
}
@Override
public boolean insert(BasicCorpEntity basicUnitMaintainEntity) {
return basicUnitMaintainDao.insert(basicUnitMaintainEntity);
}
@Override
public boolean updateById(BasicCorpEntity basicUnitMaintainSaveRequest) {
basicUnitMaintainSaveRequest.setUpdateTime(new Date());
return basicUnitMaintainDao.updateById(basicUnitMaintainSaveRequest);
}
@Override
public boolean deleteById(String id) {
return basicUnitMaintainDao.deleteById(id);
}
@Override
public BasicCorpEntity selectByThirdId(String thirdId, String thirdSys) {
BasicUnitMaintainFilterRequest filterUdiInfoRequest = new BasicUnitMaintainFilterRequest();
if ("thirdId".equals(thirdSys)) {
filterUdiInfoRequest.setThirdId(thirdId);
} else if ("thirdId1".equals(thirdSys)) {
filterUdiInfoRequest.setThirdId1(thirdId);
} else if ("thirdId2".equals(thirdSys)) {
filterUdiInfoRequest.setThirdId2(thirdId);
} else if ("thirdId3".equals(thirdSys)) {
filterUdiInfoRequest.setThirdId3(thirdId);
} else if ("thirdId4".equals(thirdSys)) {
filterUdiInfoRequest.setThirdId4(thirdId);
}
return basicUnitMaintainDao.selectByThirdId(filterUdiInfoRequest);
}
@Override
public List<BasicCorpEntity> batchSelectByIds(List<Integer> ids) {
return basicUnitMaintainDao.batchSelectByIds(ids);
}
@Override
public List<BasicCorpEntity> batchSelectByErpIds(List<String> erpIds) {
return basicUnitMaintainDao.batchSelectByErpIds(erpIds);
}
@Override
public List<BasicCorpEntity> batchSelectByErpIdsAndName(List<String> erpIds, String name) {
return basicUnitMaintainDao.batchSelectByErpIdsAndName(erpIds, name);
}
@Override
public BasicCorpEntity selectById(String id) {
return basicUnitMaintainDao.selectById(id);
}
@Override
public BasicCorpEntity selectByErpId(String id) {
if (id == null) {
return null;
}
BasicUnitMaintainFilterRequest filterUdiInfoRequest = new BasicUnitMaintainFilterRequest();
filterUdiInfoRequest.setErpId(id);
List<BasicCorpEntity> basicUnitMaintainEntities = basicUnitMaintainDao.filterList(filterUdiInfoRequest);
if (basicUnitMaintainEntities != null && basicUnitMaintainEntities.size() > 0)
return basicUnitMaintainEntities.get(0);
return null;
}
@Override
public BasicCorpEntity selectByName(String name) {
return basicUnitMaintainDao.selectByName(name);
}
@Override
public boolean isExit() {
BasicUnitMaintainFilterRequest filterUdiInfoRequest = new BasicUnitMaintainFilterRequest();
filterUdiInfoRequest.setPage(1);
filterUdiInfoRequest.setLimit(1);
List<BasicCorpEntity> data = filterList(filterUdiInfoRequest);
if (data != null && data.size() > 0) {
return true;
}
return false;
}
}

@ -0,0 +1,295 @@
<?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.dao.basic.BasicUnitMaintainDao">
<select id="filterList" parameterType="com.glxp.api.req.basic.BasicUnitMaintainFilterRequest"
resultType="com.glxp.api.entity.basic.BasicCorpEntity">
SELECT * FROM basic_corp
<where>
<if test="key != '' and key!=null">
and
( name like concat('%',#{key},'%')
or spell like concat('%',#{key},'%')
or erpId like concat('%',#{key},'%')
or creditNo like concat('%',#{key},'%')
or thirdId like concat('%',#{key},'%')
or thirdId1 like concat('%',#{key},'%')
or thirdId2 like concat('%',#{key},'%')
or thirdId3 like concat('%',#{key},'%')
or thirdId4 like concat('%',#{key},'%')
or addr like concat('%',#{key},'%')
)
</if>
<if test="id != '' and id != null">
AND id = #{id}
</if>
<if test="unitId != '' and unitId != null">
AND unitId = #{unitId}
</if>
<if test="erpId != '' and erpId != null">
AND erpId = #{erpId}
</if>
<if test="corpType != null">
AND corpType = #{corpType}
</if>
<if test="outType != null">
AND ( outType <![CDATA[ <> ]]> #{outType} or outType is NULL)
</if>
<if test="lastUpdateTime!=null and lastUpdateTime!=''">
<![CDATA[ and DATE_FORMAT(updateTime, '%Y-%m-%d %H:%i:%S')>= DATE_FORMAT(#{lastUpdateTime}, '%Y-%m-%d %H:%i:%S') ]]>
</if>
</where>
order by updateTime desc
</select>
<select id="selectByThirdId" parameterType="com.glxp.api.req.basic.BasicUnitMaintainFilterRequest"
resultType="com.glxp.api.entity.basic.BasicCorpEntity">
select * FROM basic_corp
<where>
<if test="thirdId != '' and thirdId != null">
AND thirdId = #{thirdId}
</if>
<if test="thirdId1 != '' and thirdId1 != null">
AND thirdId1 = #{thirdId1}
</if>
<if test="thirdId2 != '' and thirdId2 != null">
AND thirdId2 = #{thirdId2}
</if>
<if test="thirdId3 != '' and thirdId3 != null">
AND thirdId3 = #{thirdId3}
</if>
<if test="thirdId4 != '' and thirdId4 != null">
AND thirdId4 = #{thirdId4}
</if>
<if test="corpType != null">
AND corpType = #{corpType}
</if>
</where>
limit 1
</select>
<insert id="insertBasicUnitMaintain" keyProperty="id"
parameterType="com.glxp.api.entity.basic.BasicCorpEntity">
REPLACE
INTO basic_corp
(thirdId,erpId,name,spell,
addr,status,type,creditNo,contact,mobile,thirdId1,thirdId2,thirdId3,thirdId4,
thirdName,thirdName1,thirdName2,thirdName3,thirdName4,updateTime,corpType,outType,createUser,createTime,updateUser,remark)
values
(
#{thirdId},
#{erpId},
#{name},
#{spell},
#{addr},
#{status},
#{type},
#{creditNo},
#{contact},
#{mobile},
#{thirdId1},
#{thirdId2},
#{thirdId3},
#{thirdId4},
#{thirdName},
#{thirdName1},
#{thirdName2},
#{thirdName3},
#{thirdName4},
#{updateTime},
#{corpType},
#{outType},
#{createUser},
#{createTime},
#{updateUser},
#{remark}
)
</insert>
<insert id="insertBasicUnitMaintainignore" keyProperty="id"
parameterType="com.glxp.api.entity.basic.BasicCorpEntity">
insert
ignore
INTO basic_corp
(thirdId,erpId,name,spell,
addr,status,type,creditNo,contact,mobile,thirdId1,thirdId2,thirdId3,thirdId4,
thirdName,thirdName1,thirdName2,thirdName3,thirdName4,updateTime,corpType,outType,createUser,createTime,updateUser,remark)
values
(
#{thirdId},
#{erpId},
#{name},
#{spell},
#{addr},
#{status},
#{type},
#{creditNo},
#{contact},
#{mobile},
#{thirdId1},
#{thirdId2},
#{thirdId3},
#{thirdId4},
#{thirdName},
#{thirdName1},
#{thirdName2},
#{thirdName3},
#{thirdName4},
#{updateTime},
#{corpType},
#{outType},
#{createUser},
#{createTime},
#{updateUser},
#{remark}
)
</insert>
<insert id="insert" parameterType="com.glxp.api.entity.basic.BasicCorpEntity">
insert INTO basic_corp(thirdId, erpId, name, spell, addr,
status, type, creditNo, contact, mobile, thirdId1, thirdId2, thirdId3, thirdId4,
thirdName, thirdName1, thirdName2, thirdName3, thirdName4, updateTime, corpType, outType,createUser,createTime,updateUser,remark)
values (#{thirdId},
#{erpId},
#{name},
#{spell},
#{addr},
#{status},
#{type},
#{creditNo},
#{contact},
#{mobile},
#{thirdId1}, #{thirdId2}, #{thirdId3}, #{thirdId4},
#{thirdName}, #{thirdName1}, #{thirdName2}, #{thirdName3}, #{thirdName4}, #{updateTime}, #{corpType},
#{outType},#{createUser},
#{createTime},
#{updateUser},
#{remark})
</insert>
<update id="updateById" parameterType="com.glxp.api.entity.basic.BasicCorpEntity">
UPDATE basic_corp
<trim prefix="set" suffixOverrides=",">
<if test="thirdId != null">thirdId=#{thirdId},</if>
<if test="erpId != null">erpId=#{erpId},</if>
<if test="name != null">name=#{name},</if>
<if test="spell != null">spell=#{spell},</if>
<if test="addr != null">addr=#{addr},</if>
<if test="status != null">status=#{status},</if>
<if test="type != null">type=#{type},</if>
<if test="creditNo != null">creditNo=#{creditNo},</if>
<if test="contact != null">contact=#{contact},</if>
<if test="mobile != null">mobile=#{mobile},</if>
<if test="thirdId1 != null">thirdId1=#{thirdId1},</if>
<if test="thirdId2 != null">thirdId2=#{thirdId2},</if>
<if test="thirdId3 != null">thirdId3=#{thirdId3},</if>
<if test="thirdId4 != null">thirdId4=#{thirdId4},</if>
<if test="thirdName != null">thirdName=#{thirdName},</if>
<if test="thirdName1 != null">thirdName1=#{thirdName1},</if>
<if test="thirdName2 != null">thirdName2=#{thirdName2},</if>
<if test="thirdName3 != null">thirdName3=#{thirdName3},</if>
<if test="thirdName4 != null">thirdName4=#{thirdName4},</if>
<if test="updateTime != null">updateTime=#{updateTime},</if>
<if test="corpType != null">corpType=#{corpType},</if>
<if test="outType != null">outType=#{outType},</if>
<if test="createUser != null">createUser=#{createUser},</if>
<if test="createTime != null">createTime=#{createTime},</if>
<if test="updateUser != null">updateUser=#{updateUser},</if>
<if test="remark != null">remark=#{remark},</if>
</trim>
WHERE id=#{id}
</update>
<delete id="deleteById" parameterType="Map">
DELETE
FROM basic_corp
WHERE id = #{id}
</delete>
<select id="selectById" parameterType="Map" resultType="com.glxp.api.entity.basic.BasicCorpEntity">
select *
FROM basic_corp
WHERE id = #{id}
</select>
<select id="batchSelectByIds" resultType="com.glxp.api.entity.basic.BasicCorpEntity">
select *
from basic_corp where id in
<foreach collection="ids" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</select>
<select id="batchSelectByErpIds" resultType="com.glxp.api.entity.basic.BasicCorpEntity">
select *
from basic_corp where erpId in
<foreach collection="erpIds" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</select>
<select id="selectByName" parameterType="java.lang.String"
resultType="com.glxp.api.entity.basic.BasicCorpEntity">
SELECT *
FROM basic_corp
WHERE (name = #{name}) limit 1
</select>
<insert id="importBasicUnitMaintain" keyProperty="id">
REPLACE
INTO basic_corp
( thirdId, erpId, `name`, spell,
addr, status, `type`, creditNo, contact, mobile, thirdId1, thirdId2, thirdId3, thirdId4,
thirdName, thirdName1, thirdName2, thirdName3, thirdName4, updateTime, corpType,outType,createUser,createTime,updateUser,remark)
values (
#{thirdId},
#{erpId},
#{name},
#{spell},
#{addr},
#{status},
#{type},
#{creditNo},
#{contact},
#{mobile},
#{thirdId1},
#{thirdId2},
#{thirdId3},
#{thirdId4},
#{thirdName},
#{thirdName1},
#{thirdName2},
#{thirdName3},
#{thirdName4},
#{updateTime},
#{corpType},
#{outType},
#{createUser},
#{createTime},
#{updateUser},
#{remark}
)
</insert>
<select id="batchSelectByErpIdsAndName" resultType="com.glxp.api.entity.basic.BasicCorpEntity">
select *
from basic_corp
<where>
<if test="name != null and name != ''">
AND name like concat('%', #{name}, '%')
</if>
<if test="erpIds != null and erpIds.size() != 0">
AND erpId in
<foreach collection="erpIds" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
</where>
</select>
</mapper>
Loading…
Cancel
Save