Browse Source

供应商联系人开发

master
clong 1 year ago
parent
commit
99176063a6
11 changed files with 408 additions and 0 deletions
  1. +44
    -0
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/entity/SupplierContactEntity.java
  2. +7
    -0
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/repository/SupplierContactInfoRepository.java
  3. +16
    -0
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/service/Impl/SupplierContactInfoServiceImpl.java
  4. +7
    -0
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/service/SupplierContactInfoService.java
  5. +52
    -0
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/provider/SupplierContactInfoEAIService.java
  6. +41
    -0
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/provider/impl/SupplierContactInfoEAIServiceImpl.java
  7. +56
    -0
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/supplier/SupplierContactInfoCreateEAIService.java
  8. +49
    -0
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/supplier/SupplierContactInfoDeleteEAIService.java
  9. +59
    -0
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/supplier/SupplierContactInfoGetEAIService.java
  10. +48
    -0
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/supplier/SupplierContactInfoUpdateEAIService.java
  11. +29
    -0
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/supplier/SupplierContactUtil.java

+ 44
- 0
demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/entity/SupplierContactEntity.java View File

@ -0,0 +1,44 @@
package com.digiwin.athena.app.infra.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.digiwin.athena.opt.persistence.domain.BaseMgrEntity;
import com.google.gson.annotations.SerializedName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author CR-7
* create: 2023-09-01 16:12
* Description:
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "cim_supplier_contact", autoResultMap = true)
public class SupplierContactEntity extends BaseMgrEntity<SupplierContactEntity> {
/**
* 供应商编号
*/
@SerializedName(value = "supplier_no")
private String supplierNo;
/**
* 供应商名称
*/
@SerializedName(value = "supplier_name")
private String supplierName;
/**
* 联系人名称
*/
@SerializedName(value = "contact_name")
private String contactName;
/**
* 联系人邮箱
*/
@SerializedName(value = "contact_email")
private String contactEmail;
}

+ 7
- 0
demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/repository/SupplierContactInfoRepository.java View File

@ -0,0 +1,7 @@
package com.digiwin.athena.app.infra.repository;
import com.digiwin.athena.app.infra.entity.SupplierContactEntity;
import com.digiwin.athena.opt.persistence.repository.BaseRepository;
public interface SupplierContactInfoRepository extends BaseRepository<SupplierContactEntity> {
}

+ 16
- 0
demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/service/Impl/SupplierContactInfoServiceImpl.java View File

@ -0,0 +1,16 @@
package com.digiwin.athena.app.infra.service.Impl;
import com.digiwin.athena.app.infra.entity.SupplierContactEntity;
import com.digiwin.athena.app.infra.repository.SupplierContactInfoRepository;
import com.digiwin.athena.app.infra.service.SupplierContactInfoService;
import com.digiwin.athena.opt.persistence.service.impl.AbsBaseService;
import org.springframework.stereotype.Service;
/**
* @author CR-7
* create: 2023-09-01 16:16
* Description:
*/
@Service
public class SupplierContactInfoServiceImpl extends AbsBaseService<SupplierContactInfoRepository, SupplierContactEntity> implements SupplierContactInfoService {
}

+ 7
- 0
demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/service/SupplierContactInfoService.java View File

@ -0,0 +1,7 @@
package com.digiwin.athena.app.infra.service;
import com.digiwin.athena.app.infra.entity.SupplierContactEntity;
import com.digiwin.athena.opt.persistence.service.IBaseService;
public interface SupplierContactInfoService extends IBaseService<SupplierContactEntity> {
}

+ 52
- 0
demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/provider/SupplierContactInfoEAIService.java View File

@ -0,0 +1,52 @@
package com.digiwin.athena.app.provider;
import com.digiwin.app.service.DWEAIResult;
import com.digiwin.app.service.DWService;
import com.digiwin.app.service.eai.EAIService;
import com.digiwin.athena.app.service.supplier.SupplierContactUtil;
import java.util.Map;
public interface SupplierContactInfoEAIService extends DWService {
/**
* 供应商联系人查询
* @param headers
* @param messageBody
* @return
* @throws Exception
*/
@EAIService(id = SupplierContactUtil.DEMO_DATA_CONTACT_INFO_GET)
DWEAIResult get(Map<String, String> headers, String messageBody) throws Exception;
/**
* 供应商联系人新增
* @param headers
* @param messageBody
* @return
* @throws Exception
*/
@EAIService(id = SupplierContactUtil.DEMO_DATA_CONTACT_INFO_CREATE)
DWEAIResult create(Map<String, String> headers, String messageBody) throws Exception;
/**
* 供应商联系人修改
* @param headers
* @param messageBody
* @return
* @throws Exception
*/
@EAIService(id = SupplierContactUtil.DEMO_DATA_CONTACT_INFO_UPDATE)
DWEAIResult update(Map<String, String> headers, String messageBody) throws Exception;
/**
* 供应商联系人删除
* @param headers
* @param messageBody
* @return
* @throws Exception
*/
@EAIService(id = SupplierContactUtil.DEMO_DATA_CONTACT_INFO_DELETE)
DWEAIResult delete(Map<String, String> headers, String messageBody) throws Exception;
}

+ 41
- 0
demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/provider/impl/SupplierContactInfoEAIServiceImpl.java View File

@ -0,0 +1,41 @@
package com.digiwin.athena.app.provider.impl;
import com.digiwin.app.service.DWEAIResult;
import com.digiwin.athena.app.provider.SupplierContactInfoEAIService;
import com.digiwin.athena.app.service.supplier.SupplierContactUtil;
import com.digiwin.athena.opt.common.eai.service.EAIServiceContext;
import javax.annotation.Resource;
import java.util.Map;
/**
* @author CR-7
* create: 2023-09-01 15:54
* Description:
*/
public class SupplierContactInfoEAIServiceImpl implements SupplierContactInfoEAIService {
@Resource
private EAIServiceContext eaiServiceContext;
@Override
public DWEAIResult get(Map<String, String> headers, String messageBody) throws Exception {
return eaiServiceContext.execute(SupplierContactUtil.DEMO_DATA_CONTACT_INFO_GET,headers,messageBody);
}
@Override
public DWEAIResult create(Map<String, String> headers, String messageBody) throws Exception {
return eaiServiceContext.execute(SupplierContactUtil.DEMO_DATA_CONTACT_INFO_CREATE,headers,messageBody);
}
@Override
public DWEAIResult update(Map<String, String> headers, String messageBody) throws Exception {
return eaiServiceContext.execute(SupplierContactUtil.DEMO_DATA_CONTACT_INFO_UPDATE,headers,messageBody);
}
@Override
public DWEAIResult delete(Map<String, String> headers, String messageBody) throws Exception {
return eaiServiceContext.execute(SupplierContactUtil.DEMO_DATA_CONTACT_INFO_DELETE,headers,messageBody);
}
}

+ 56
- 0
demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/supplier/SupplierContactInfoCreateEAIService.java View File

@ -0,0 +1,56 @@
package com.digiwin.athena.app.service.supplier;
import com.alibaba.fastjson.TypeReference;
import com.digiwin.app.service.DWEAIResult;
import com.digiwin.athena.app.infra.entity.SupplierContactEntity;
import com.digiwin.athena.app.infra.service.SupplierContactInfoService;
import com.digiwin.athena.opt.common.eai.EAIRequest;
import com.digiwin.athena.opt.common.eai.EAIUtil;
import com.digiwin.athena.opt.common.eai.service.AbsEAIService;
import com.digiwin.athena.opt.common.generator.SnowflakeWorker;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author CR-7
* create: 2023-09-01 16:03
* Description:
*/
@Log4j2
@Service
public class SupplierContactInfoCreateEAIService extends AbsEAIService {
@Resource
SupplierContactInfoService supplierContactInfoService;
@Override
public String getServiceName() {
return SupplierContactUtil.DEMO_DATA_CONTACT_INFO_CREATE;
}
@Override
public DWEAIResult execute(Map<String, String> headers, String messageBody) throws Exception {
// 入参反序列化
EAIRequest request = new EAIRequest(messageBody);
List<SupplierContactEntity> supplierContactEntityList = request.getObject("contact_info", new TypeReference<List<SupplierContactEntity>>(){});
List<SupplierContactEntity> supplierContactEntities = supplierContactEntityList.stream().map(assemble->{
SupplierContactEntity supplierContactEntity = new SupplierContactEntity();
supplierContactEntity.setId(SnowflakeWorker.nextId());
BeanUtils.copyProperties(assemble,supplierContactEntity);
return supplierContactEntity;
}).collect(Collectors.toList());
this.supplierContactInfoService.saveBatch(supplierContactEntities);
return EAIUtil.buildEAIResult(new HashMap<>());
}
}

+ 49
- 0
demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/supplier/SupplierContactInfoDeleteEAIService.java View File

@ -0,0 +1,49 @@
package com.digiwin.athena.app.service.supplier;
import com.digiwin.app.service.DWEAIResult;
import com.digiwin.athena.app.infra.service.SupplierContactInfoService;
import com.digiwin.athena.opt.common.eai.EAIUtil;
import com.digiwin.athena.opt.common.eai.service.AbsEAIService;
import lombok.extern.log4j.Log4j2;
import org.assertj.core.util.Lists;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.*;
/**
* @author CR-7
* create: 2023-09-01 16:05
* Description:
*/
@Log4j2
@Service
public class SupplierContactInfoDeleteEAIService extends AbsEAIService {
@Resource
SupplierContactInfoService supplierContactInfoService;
@Override
public String getServiceName() {
return SupplierContactUtil.DEMO_DATA_CONTACT_INFO_DELETE;
}
@Override
public DWEAIResult execute(Map<String, String> headers, String messageBody) throws Exception {
// 入参反序列化
JSONObject parameter = new JSONObject(messageBody).getJSONObject("std_data").getJSONObject("parameter");
JSONArray jsonArray = parameter.getJSONArray("contact_info");
ArrayList<Long> list = null;
for(int i=0;i<jsonArray.length();i++){
list = Lists.newArrayList(jsonArray.getJSONObject(i).getLong("id"));
}
this.supplierContactInfoService.removeByIds(list);
return EAIUtil.buildEAIResult(new HashMap<>());
}
}

+ 59
- 0
demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/supplier/SupplierContactInfoGetEAIService.java View File

@ -0,0 +1,59 @@
package com.digiwin.athena.app.service.supplier;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.digiwin.app.service.DWEAIResult;
import com.digiwin.athena.app.infra.entity.SupplierContactEntity;
import com.digiwin.athena.app.infra.service.SupplierContactInfoService;
import com.digiwin.athena.opt.common.eai.EAIUtil;
import com.digiwin.athena.opt.common.eai.service.AbsEAIService;
import com.digiwin.athena.opt.common.security.SecurityUtil;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
* @author CR-7
* create: 2023-09-01 16:02
* Description:
*/
@Log4j2
@Service
public class SupplierContactInfoGetEAIService extends AbsEAIService {
@Resource
SupplierContactInfoService supplierContactInfoService;
@Override
public String getServiceName() {
return SupplierContactUtil.DEMO_DATA_CONTACT_INFO_GET;
}
@Override
public DWEAIResult execute(Map<String, String> headers, String messageBody) throws Exception {
JSONObject parameter = new JSONObject(messageBody).getJSONObject("std_data").getJSONObject("parameter");
JSONArray jsonArray = parameter.getJSONArray("contact_info");
LambdaQueryWrapper<SupplierContactEntity> queryWrapper = Wrappers.<SupplierContactEntity>lambdaQuery()
.eq(SupplierContactEntity::getTenantId, SecurityUtil.getUserProfile().getTenantId())
.in(!StringUtils.isEmpty(jsonArray.getJSONObject(0).get("supplier_no").toString()),
SupplierContactEntity::getSupplierNo, jsonArray.getJSONObject(0).get("supplier_no"));
List<SupplierContactEntity> list = supplierContactInfoService.list(queryWrapper);
return EAIUtil.buildEAIResult(new com.alibaba.fastjson.JSONObject().fluentPut("contact_info",list));
}
}

+ 48
- 0
demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/supplier/SupplierContactInfoUpdateEAIService.java View File

@ -0,0 +1,48 @@
package com.digiwin.athena.app.service.supplier;
import com.alibaba.fastjson.TypeReference;
import com.digiwin.app.service.DWEAIResult;
import com.digiwin.athena.app.infra.entity.SupplierContactEntity;
import com.digiwin.athena.app.infra.service.SupplierContactInfoService;
import com.digiwin.athena.opt.common.eai.EAIRequest;
import com.digiwin.athena.opt.common.eai.EAIUtil;
import com.digiwin.athena.opt.common.eai.service.AbsEAIService;
import com.digiwin.athena.opt.common.generator.SnowflakeWorker;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author CR-7
* create: 2023-09-01 16:04
* Description:
*/
@Log4j2
@Service
public class SupplierContactInfoUpdateEAIService extends AbsEAIService {
@Resource
SupplierContactInfoService supplierContactInfoService;
@Override
public String getServiceName() {
return SupplierContactUtil.DEMO_DATA_CONTACT_INFO_UPDATE;
}
@Override
public DWEAIResult execute(Map<String, String> headers, String messageBody) throws Exception {
// 入参反序列化
EAIRequest request = new EAIRequest(messageBody);
List<SupplierContactEntity> supplierContactEntityList = request.getObject("contact_info", new TypeReference<List<SupplierContactEntity>>(){});
this.supplierContactInfoService.updateBatchById(supplierContactEntityList);
return EAIUtil.buildEAIResult(new HashMap<>());
}
}

+ 29
- 0
demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/supplier/SupplierContactUtil.java View File

@ -0,0 +1,29 @@
package com.digiwin.athena.app.service.supplier;
/**
* @author CR-7
* create: 2023-09-01 15:54
* Description:
*/
public class SupplierContactUtil {
/**
* 供应商联系人查询
*/
public static final String DEMO_DATA_CONTACT_INFO_GET = "demo.data.contact.info.get";
/**
* 供应商联系人新增
*/
public static final String DEMO_DATA_CONTACT_INFO_CREATE = "demo.data.contact.info.create";
/**
* 供应商联系人修改
*/
public static final String DEMO_DATA_CONTACT_INFO_UPDATE = "demo.data.contact.info.update";
/**
* 供应商联系人删除
*/
public static final String DEMO_DATA_CONTACT_INFO_DELETE = "demo.data.contact.info.delete";
}

Loading…
Cancel
Save