diff --git a/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/buyer/domain/UserInfoExcel.java b/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/buyer/domain/UserInfoExcel.java new file mode 100644 index 00000000..788e478b --- /dev/null +++ b/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/buyer/domain/UserInfoExcel.java @@ -0,0 +1,41 @@ +package com.dxhy.order.consumer.modules.buyer.domain; + + +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + +@Data +public class UserInfoExcel { + + // 主编码的值 + @ExcelProperty("CODE") + private String CODE; + + // 姓名的值 + @ExcelProperty("DESC1") + private String DESC1; + + // 手机号码的值 + @ExcelProperty("DESC10") + private String DESC10; + + // 电子邮箱的值 + @ExcelProperty("DESC11") + private String DESC11; + + // 组织代码的值 + @ExcelProperty("DESC14") + private String DESC14; + + // 公司代码的值 + @ExcelProperty("DESC37") + private String DESC37; + + // 公司名称的值 + @ExcelProperty("DESC38") + private String DESC38; + + // 人员状态的值 + @ExcelProperty("DESC4") + private String DESC59; +} diff --git a/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/commodity/controller/GroupCommodityCodeController.java b/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/commodity/controller/GroupCommodityCodeController.java index 70f9a1d2..2e39f498 100644 --- a/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/commodity/controller/GroupCommodityCodeController.java +++ b/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/commodity/controller/GroupCommodityCodeController.java @@ -6,6 +6,7 @@ import com.dxhy.order.baseservice.module.base.service.BaseService; import com.dxhy.order.baseservice.module.buyer.protocol.MdmGmfxxtbMulticodeValuelistBO; import com.dxhy.order.consumer.modules.buyer.domain.BuyerEntityExcel; import com.dxhy.order.consumer.modules.buyer.domain.BuyerEntityYhItemExcel; +import com.dxhy.order.consumer.modules.buyer.domain.UserInfoExcel; import com.dxhy.order.consumer.modules.commodity.domain.dto.CommodityCodeEntityExcel; import com.dxhy.order.consumer.modules.commodity.domain.dto.QueryGroupCommodityDTO; import com.dxhy.order.consumer.modules.commodity.domain.dto.QuoteGroupCommodityDTO; @@ -14,6 +15,7 @@ import com.dxhy.order.consumer.modules.commodity.service.IGroupCommodityCodeServ import com.dxhy.order.consumer.openapi.protocol.v6.sdenergy.MdmGmfxxtbMulticodeBO; import com.dxhy.order.consumer.openapi.protocol.v6.sdenergy.MdmGmfxxtbReqBO; import com.dxhy.order.consumer.openapi.protocol.v6.sdenergy.MdmSyncGroupTaxCodeReqBO; +import com.dxhy.order.consumer.openapi.protocol.v6.sdenergy.MdmSyncUserReqBO; import com.dxhy.order.consumer.openapi.service.ISDEnregyService; import com.dxhy.order.model.PageUtils; import com.dxhy.order.model.R; @@ -102,6 +104,7 @@ public class GroupCommodityCodeController { } } + @RequestMapping("/uploadBuyerInfo") public R uploadBuyerInfo(@RequestParam(value = "file") MultipartFile file) { try { @@ -155,4 +158,33 @@ public class GroupCommodityCodeController { throw new RuntimeException(e); } } + + @RequestMapping("/uploadUserInfo") + public R uploadUserInfo(@RequestParam(value = "file") MultipartFile file) { + try { + List userInfoExcels = EasyExcel.read(file.getInputStream()).sheet(0).head(UserInfoExcel.class).headRowNumber(1).doReadSync(); + log.info("解析的数据:{}", JSONObject.toJSONString(userInfoExcels)); + if (userInfoExcels == null || userInfoExcels.isEmpty() ) { + return R.error("数据解析失败"); + } + List reqBOList = Lists.newArrayList(); + for (UserInfoExcel infoExcel : userInfoExcels) { + MdmSyncUserReqBO userReqBO = new MdmSyncUserReqBO(); + userReqBO.setCODE(infoExcel.getCODE()); + userReqBO.setDESC1(infoExcel.getDESC1()); + userReqBO.setDESC10(infoExcel.getDESC10()); + userReqBO.setDESC11(infoExcel.getDESC11()); + userReqBO.setDESC14(infoExcel.getDESC14()); + userReqBO.setDESC37(infoExcel.getDESC37()); + userReqBO.setDESC38(infoExcel.getDESC38()); + userReqBO.setDESC59(infoExcel.getDESC59()); + userReqBO.setUUID(baseService.getGenerateShotKey()); + reqBOList.add(userReqBO); + } + String str = sdEnregyService.syncMdmUserService(reqBOList); + return R.ok().put("data",str); + } catch (IOException e) { + throw new RuntimeException(e); + } + } } diff --git a/order-management-consumer/src/main/java/com/dxhy/order/consumer/openapi/service/ISDEnregyService.java b/order-management-consumer/src/main/java/com/dxhy/order/consumer/openapi/service/ISDEnregyService.java index d602fcbf..b5648d18 100644 --- a/order-management-consumer/src/main/java/com/dxhy/order/consumer/openapi/service/ISDEnregyService.java +++ b/order-management-consumer/src/main/java/com/dxhy/order/consumer/openapi/service/ISDEnregyService.java @@ -56,6 +56,7 @@ public interface ISDEnregyService { * @return */ public R proactiveSyncMdmUser(String code); + String syncMdmUserService(List mdmSyncUserReqBO); /** diff --git a/order-management-consumer/src/main/java/com/dxhy/order/consumer/openapi/service/impl/SDEnregyServiceImpl.java b/order-management-consumer/src/main/java/com/dxhy/order/consumer/openapi/service/impl/SDEnregyServiceImpl.java index 344aedd0..12161508 100644 --- a/order-management-consumer/src/main/java/com/dxhy/order/consumer/openapi/service/impl/SDEnregyServiceImpl.java +++ b/order-management-consumer/src/main/java/com/dxhy/order/consumer/openapi/service/impl/SDEnregyServiceImpl.java @@ -373,24 +373,27 @@ public class SDEnregyServiceImpl extends SDEnregyServiceAbstract { Boolean isSuccess = addResult != null && addResult.isOk(); mdmSyncUserReqBO.setSuccess(isSuccess); } + String respStr = ""; + if(StringUtils.isNotBlank(requestBody)){ - SDEnergyMdmBaseBO baseBO = JSONObject.parseObject(requestBody, SDEnergyMdmBaseBO.class); - SDEnergyMdmBaseBO result = buildResult( - baseBO, - mdmSyncUserReqBOS, - i -> { - MdmSyncUserReqBO t = (MdmSyncUserReqBO) i; - SDEnergyMdmBaseRespBO resp = new SDEnergyMdmBaseRespBO(); - resp.setCODE(t.getCODE()); - resp.setUUID(t.getUUID()); - resp.setSYNSTATUS(t.getSuccess() ? "0" : "1"); - resp.setSYNRESULT(t.getSuccess() ? "success" : "failed"); - return resp; - } - ); + SDEnergyMdmBaseBO baseBO = JSONObject.parseObject(requestBody, SDEnergyMdmBaseBO.class); + SDEnergyMdmBaseBO result = buildResult( + baseBO, + mdmSyncUserReqBOS, + i -> { + MdmSyncUserReqBO t = (MdmSyncUserReqBO) i; + SDEnergyMdmBaseRespBO resp = new SDEnergyMdmBaseRespBO(); + resp.setCODE(t.getCODE()); + resp.setUUID(t.getUUID()); + resp.setSYNSTATUS(t.getSuccess() ? "0" : "1"); + resp.setSYNRESULT(t.getSuccess() ? "success" : "failed"); + return resp; + } + ); - String resp = JsonUtils.getInstance().toJsonStringNullToEmpty(result); - return AjaxResult.success("success", resp); + respStr = JsonUtils.getInstance().toJsonStringNullToEmpty(result); + } + return AjaxResult.success("success", respStr); } /** @@ -609,4 +612,15 @@ public class SDEnregyServiceImpl extends SDEnregyServiceAbstract { return R.error(syncMdmUserResult.getMsg()); } } + + @Override + public String syncMdmUserService(List mdmSyncUserReqBO){ + AjaxResult syncResult = this.syncMdmUser(mdmSyncUserReqBO,null); + if (syncResult.isSuccess()) { + return ""; + } else { +// return R.error(); + return null; + } + } }