diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/entity/SupplierContactEntity.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/entity/SupplierContactEntity.java new file mode 100644 index 0000000..0f7de1b --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/entity/SupplierContactEntity.java @@ -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 { + + /** + * 供应商编号 + */ + @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; +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/repository/SupplierContactInfoRepository.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/repository/SupplierContactInfoRepository.java new file mode 100644 index 0000000..57f7174 --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/repository/SupplierContactInfoRepository.java @@ -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 { +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/service/Impl/SupplierContactInfoServiceImpl.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/service/Impl/SupplierContactInfoServiceImpl.java new file mode 100644 index 0000000..2e19bdc --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/service/Impl/SupplierContactInfoServiceImpl.java @@ -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 implements SupplierContactInfoService { +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/service/SupplierContactInfoService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/service/SupplierContactInfoService.java new file mode 100644 index 0000000..39094ee --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/service/SupplierContactInfoService.java @@ -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 { +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/provider/SupplierContactInfoEAIService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/provider/SupplierContactInfoEAIService.java new file mode 100644 index 0000000..d0526cc --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/provider/SupplierContactInfoEAIService.java @@ -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 headers, String messageBody) throws Exception; + + /** + * 供应商联系人新增 + * @param headers + * @param messageBody + * @return + * @throws Exception + */ + @EAIService(id = SupplierContactUtil.DEMO_DATA_CONTACT_INFO_CREATE) + DWEAIResult create(Map headers, String messageBody) throws Exception; + + /** + * 供应商联系人修改 + * @param headers + * @param messageBody + * @return + * @throws Exception + */ + @EAIService(id = SupplierContactUtil.DEMO_DATA_CONTACT_INFO_UPDATE) + DWEAIResult update(Map headers, String messageBody) throws Exception; + + + /** + * 供应商联系人删除 + * @param headers + * @param messageBody + * @return + * @throws Exception + */ + @EAIService(id = SupplierContactUtil.DEMO_DATA_CONTACT_INFO_DELETE) + DWEAIResult delete(Map headers, String messageBody) throws Exception; +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/provider/impl/SupplierContactInfoEAIServiceImpl.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/provider/impl/SupplierContactInfoEAIServiceImpl.java new file mode 100644 index 0000000..f1f1b84 --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/provider/impl/SupplierContactInfoEAIServiceImpl.java @@ -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 headers, String messageBody) throws Exception { + return eaiServiceContext.execute(SupplierContactUtil.DEMO_DATA_CONTACT_INFO_GET,headers,messageBody); + } + + @Override + public DWEAIResult create(Map headers, String messageBody) throws Exception { + return eaiServiceContext.execute(SupplierContactUtil.DEMO_DATA_CONTACT_INFO_CREATE,headers,messageBody); + } + + @Override + public DWEAIResult update(Map headers, String messageBody) throws Exception { + return eaiServiceContext.execute(SupplierContactUtil.DEMO_DATA_CONTACT_INFO_UPDATE,headers,messageBody); + } + + @Override + public DWEAIResult delete(Map headers, String messageBody) throws Exception { + return eaiServiceContext.execute(SupplierContactUtil.DEMO_DATA_CONTACT_INFO_DELETE,headers,messageBody); + } +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/supplier/SupplierContactInfoCreateEAIService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/supplier/SupplierContactInfoCreateEAIService.java new file mode 100644 index 0000000..2b3e25e --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/supplier/SupplierContactInfoCreateEAIService.java @@ -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 headers, String messageBody) throws Exception { + // 入参反序列化 + EAIRequest request = new EAIRequest(messageBody); + List supplierContactEntityList = request.getObject("contact_info", new TypeReference>(){}); + + List 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<>()); + } +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/supplier/SupplierContactInfoDeleteEAIService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/supplier/SupplierContactInfoDeleteEAIService.java new file mode 100644 index 0000000..6b60720 --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/supplier/SupplierContactInfoDeleteEAIService.java @@ -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 headers, String messageBody) throws Exception { + // 入参反序列化 + JSONObject parameter = new JSONObject(messageBody).getJSONObject("std_data").getJSONObject("parameter"); + JSONArray jsonArray = parameter.getJSONArray("contact_info"); + + ArrayList list = null; + for(int i=0;i()); + } +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/supplier/SupplierContactInfoGetEAIService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/supplier/SupplierContactInfoGetEAIService.java new file mode 100644 index 0000000..853b111 --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/supplier/SupplierContactInfoGetEAIService.java @@ -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 headers, String messageBody) throws Exception { + JSONObject parameter = new JSONObject(messageBody).getJSONObject("std_data").getJSONObject("parameter"); + JSONArray jsonArray = parameter.getJSONArray("contact_info"); + + + LambdaQueryWrapper queryWrapper = Wrappers.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 list = supplierContactInfoService.list(queryWrapper); + + return EAIUtil.buildEAIResult(new com.alibaba.fastjson.JSONObject().fluentPut("contact_info",list)); + } +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/supplier/SupplierContactInfoUpdateEAIService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/supplier/SupplierContactInfoUpdateEAIService.java new file mode 100644 index 0000000..be6a77a --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/supplier/SupplierContactInfoUpdateEAIService.java @@ -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 headers, String messageBody) throws Exception { + // 入参反序列化 + EAIRequest request = new EAIRequest(messageBody); + List supplierContactEntityList = request.getObject("contact_info", new TypeReference>(){}); + + this.supplierContactInfoService.updateBatchById(supplierContactEntityList); + + return EAIUtil.buildEAIResult(new HashMap<>()); + } +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/supplier/SupplierContactUtil.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/supplier/SupplierContactUtil.java new file mode 100644 index 0000000..2b21c14 --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/supplier/SupplierContactUtil.java @@ -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"; +}