feature 1.增加导入人员信息接口

release
zhenghaiyang@ele-cloud.com 2 years ago
parent 1900a1da6f
commit 983b32ccf9
  1. 41
      order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/buyer/domain/UserInfoExcel.java
  2. 32
      order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/commodity/controller/GroupCommodityCodeController.java
  3. 1
      order-management-consumer/src/main/java/com/dxhy/order/consumer/openapi/service/ISDEnregyService.java
  4. 18
      order-management-consumer/src/main/java/com/dxhy/order/consumer/openapi/service/impl/SDEnregyServiceImpl.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;
}

@ -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<UserInfoExcel> 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<MdmSyncUserReqBO> 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);
}
}
}

@ -56,6 +56,7 @@ public interface ISDEnregyService {
* @return
*/
public R proactiveSyncMdmUser(String code);
String syncMdmUserService(List<MdmSyncUserReqBO> mdmSyncUserReqBO);
/**

@ -373,6 +373,8 @@ 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(
@ -389,8 +391,9 @@ public class SDEnregyServiceImpl extends SDEnregyServiceAbstract {
}
);
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> mdmSyncUserReqBO){
AjaxResult syncResult = this.syncMdmUser(mdmSyncUserReqBO,null);
if (syncResult.isSuccess()) {
return "";
} else {
// return R.error();
return null;
}
}
}

Loading…
Cancel
Save