Commit 29a479c0 by xiongzs

Merge all from rop-merchant-scrm_v3.12.0-转化加员工列表支持、服务中心商户详情接口支持

1 parent ddb7b336
......@@ -15,7 +15,7 @@
<dependency>
<groupId>cn.com.glsx.merchants</groupId>
<artifactId>platform-merchants-api</artifactId>
<version>3.11.0-SNAPSHOT</version>
<version>3.12.0-SNAPSHOT</version>
</dependency>
<!--引用GSON,用于打印-->
<dependency>
......
......@@ -10,11 +10,11 @@ import cn.com.glsx.merchants.request.merchant.*;
import cn.com.glsx.merchants.request.open.*;
import cn.com.glsx.merchants.request.serviceCenter.*;
import cn.com.glsx.merchants.request.staff.MerchantNoListByStaffPhone;
import cn.com.glsx.merchants.request.staff.PhoneRopRequest;
import cn.com.glsx.merchants.request.staff.StaffListRequest;
import cn.com.glsx.merchants.response.*;
import cn.com.glsx.merchants.response.serviceCenter.SearchServiceMerchantRopResponse;
import cn.com.glsx.merchants.response.serviceCenter.ServiceStaffRopResponse;
import cn.com.glsx.merchants.response.serviceCenter.VisibleMerchantRopResponse;
import cn.com.glsx.merchants.response.serviceCenter.*;
import cn.com.glsx.merchants.response.staff.StaffVisibleMerchantRopResponse;
import cn.com.glsx.merchants.service.OpenService;
import cn.com.glsx.merchants.service.StaffService;
import cn.com.glsx.merchants.util.Pagination;
......@@ -605,7 +605,7 @@ public class OpenController {
@ServiceMethod(method = "merchants.api.open.serviceCenter.visibleMerByStaff", needInSession = NeedInSessionType.NO)
@ApiOperation("服务中心-查询员工可见商户信息")
public RopResponse<List<VisibleMerchantRopResponse>> visibleMerByStaff(StaffVisibleMerRopRequest ropRequest) {
public RopResponse<StaffVisibleMerchantRopResponse> visibleMerByStaff(StaffVisibleMerRopRequest ropRequest) {
try {
return RopResponse.success(openService.visibleMerByStaff(ropRequest));
} catch (RpcServiceException e) {
......@@ -647,4 +647,40 @@ public class OpenController {
return RopResponse.error(DefaultErrorEnum.UNKNOW_ERROR,e.getMessage());
}
}
}
\ No newline at end of file
@ServiceMethod(method = "merchants.api.open.serviceCenter.merchantPage", needInSession = NeedInSessionType.NO)
@ApiOperation("服务中心-商户列表分页查询")
public RopResponse<Pagination<MerchantPageRopResponse>> searchMerchantPage(MerchantPageRpcRequest ropRequest){
try {
return RopResponse.success(openService.searchMerchantPage(ropRequest));
}catch (Exception e) {
log.info("服务中心-查询客户列表异常:{}", e);
return RopResponse.error(DefaultErrorEnum.UNKNOW_ERROR,e.getMessage());
}
}
@ServiceMethod(method = "merchants.api.open.serviceCenter.merchantInfo", needInSession = NeedInSessionType.NO)
@ApiOperation("服务中心-查看商户信息")
public RopResponse<MerchantDetailRopResponse> merchantInfo(MerchantNoRopRequest ropRequest){
try {
return RopResponse.success(openService.merchantInfo(ropRequest));
}catch (Exception e) {
log.info("服务中心-查看商户信息:{}", e);
return RopResponse.error(DefaultErrorEnum.UNKNOW_ERROR,e.getMessage());
}
}
@ApiOperation("检查是否有员工账号")
@ServiceMethod(method = "merchants.api.open.isStaffPhone", needInSession = NeedInSessionType.NO)
public RopResponse<Boolean> isStaffPhone(PhoneRopRequest request){
try {
return RopResponse.success(openService.isStaffPhone(request.getPhone()));
} catch (Exception e) {
log.info("检查是否有员工账号:{}",e);
return RopResponse.error(e.getMessage());
}
}
}
......@@ -6,12 +6,18 @@ import cn.com.glsx.merchants.request.staff.*;
import cn.com.glsx.merchants.response.StaffResponse;
import cn.com.glsx.merchants.service.StaffService;
import cn.com.glsx.merchants.util.Pagination;
import cn.com.glsx.merchants.util.PaginationDJ;
import com.rop.annotation.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
......@@ -192,6 +198,36 @@ public class StaffController {
}
/**
* 查询员工分页列表(智享后台-人员列表)
*
* @param staffPageRequest 入参
* @return
*/
@ServiceMethod(method = "merchants.api.staff.findStaffByPageForDJ", needInSession = NeedInSessionType.NO)
@ApiOperation("查询员工分页列表")
public RopResponse<PaginationDJ<StaffResponse>> findStaffByPageForDJ(StaffPageDJRequest staffPageRequest) {
try {
StaffPageRequest request = new StaffPageRequest();
BeanUtils.copyProperties(staffPageRequest,request);
request.setPageNum(staffPageRequest.getCurrentPage());
Pagination<StaffResponse> list = staffService.findStaffByPage(request);
PaginationDJ<StaffResponse> paginationDJ = new PaginationDJ<>();
paginationDJ.setPageSize(list.getPageSize());
paginationDJ.setPageNum(list.getPageNum());
paginationDJ.setTotal(list.getCount());
List<StaffResponse> resultList = list.getData();
if (CollectionUtils.isNotEmpty(resultList)){
resultList.forEach(v-> v.setLabelList(StringUtils.isNotEmpty(v.getStaffLabel()) ? Arrays.asList(v.getStaffLabel().split(",")) : new ArrayList<>()));
}
paginationDJ.setList(resultList);
return RopResponse.success(paginationDJ);
} catch (RpcServiceException e) {
log.info("=======MerchantMenuController__invoke__findStaffByPageForDJ__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
/**
* 查询员工分页列表
*
* @param staffExportRequest 入参
......@@ -229,7 +265,7 @@ public class StaffController {
}
@ServiceMethod(method = "merchants.api.staff.insertStaffBatchByPhone", needInSession = NeedInSessionType.NO)
@ApiOperation("批量新增员工")
@ApiOperation("批量新增售后专员和续保专员")
public RopResponse<Boolean> insertStaffBatchByPhone(StaffJsonRopRequest ropRequest) {
try {
staffService.insertStaffBatchByPhone(ropRequest.getMerchantNos());
......@@ -239,4 +275,16 @@ public class StaffController {
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
@ServiceMethod(method = "merchants.api.staff.updateStaffBatch", needInSession = NeedInSessionType.NO)
@ApiOperation("批量更新员工")
public RopResponse<Boolean> updateStaffBatch(UpdateStaffBatchRequest request){
try {
staffService.updateStaffBatch(request);
return RopResponse.success(true);
} catch (RpcServiceException e) {
log.info("=======StaffController__invoke__updateStaffBatch__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
}
package cn.com.glsx.merchants.request.merchant;
import com.rop.AbstractRopRequest;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class MerchantNoRopRequest extends AbstractRopRequest {
@ApiModelProperty(notes = "商户号",required = true)
private Integer merchantNo;
}
package cn.com.glsx.merchants.request.serviceCenter;
import cn.com.glsx.merchants.model.request.MerchantBrandRequest;
import cn.com.glsx.merchants.request.DefaultRequest;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class CreateMerchantRopRequest extends DefaultRequest {
public class CreateMerchantRopRequest extends DefaultRequest implements Serializable{
@ApiModelProperty(notes = "商户名",required = true)
private String merchantName;
......@@ -31,4 +34,28 @@ public class CreateMerchantRopRequest extends DefaultRequest {
@ApiModelProperty(notes = "创建人(服务商商户名)")
private String createdAccount;
@ApiModelProperty(notes = "品牌")
private String merchantBrandListJson;
@ApiModelProperty(notes = "经度")
private Float lng;
@ApiModelProperty(notes = "纬度")
private Float lat;
@ApiModelProperty(notes = "省编码")
private String provinceCode;
@ApiModelProperty(notes = "省名称")
private String provinceName;
@ApiModelProperty(notes = "市编码")
private String cityCode;
@ApiModelProperty(notes = "市名称")
private String cityName;
@ApiModelProperty(notes = "商户详情地址")
private String merchantAddress;
}
package cn.com.glsx.merchants.request.serviceCenter;
import cn.com.glsx.merchants.request.DefaultRequest;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class MerchantPageRpcRequest extends DefaultRequest implements Serializable {
@ApiModelProperty(notes = "商户号",required = true)
private List<Integer> merchantNoList;
@ApiModelProperty(notes = "页码",required = true)
private Integer pageNum;
@ApiModelProperty(notes = "页大小",required = true)
private Integer pageSize;
}
package cn.com.glsx.merchants.request.serviceCenter;
import cn.com.glsx.merchants.model.request.MerchantBrandRequest;
import cn.com.glsx.merchants.request.DefaultRequest;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class UpdateMerchantRopRequest extends DefaultRequest {
public class UpdateMerchantRopRequest extends DefaultRequest implements Serializable{
@ApiModelProperty(notes = "商户号",required = true)
private Integer merchantNo;
......@@ -25,4 +29,28 @@ public class UpdateMerchantRopRequest extends DefaultRequest {
@ApiModelProperty(notes = "登录密码")
private String password;
@ApiModelProperty(notes = "品牌")
private String merchantBrandListJson;
@ApiModelProperty(notes = "经度")
private Float lng;
@ApiModelProperty(notes = "纬度")
private Float lat;
@ApiModelProperty(notes = "省编码")
private String provinceCode;
@ApiModelProperty(notes = "省名称")
private String provinceName;
@ApiModelProperty(notes = "市编码")
private String cityCode;
@ApiModelProperty(notes = "市名称")
private String cityName;
@ApiModelProperty(notes = "商户详情地址")
private String merchantAddress;
}
package cn.com.glsx.merchants.request.staff;
import com.rop.AbstractRopRequest;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class PhoneRopRequest extends AbstractRopRequest {
@ApiModelProperty(notes = "手机号",required = true)
private String phone;
}
package cn.com.glsx.merchants.request.staff;
import cn.com.glsx.merchants.request.DefaultRequest;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.List;
@Data
public class StaffPageDJRequest extends DefaultRequest {
@ApiModelProperty(notes = "员工状态, 0:启用, 2: 禁用, 3: 关联企微, 4: 不关联企微")
private Integer status;
@ApiModelProperty(notes = "员工姓名")
private String staffName;
@ApiModelProperty(notes = "员工手机号")
private String staffPhone;
@ApiModelProperty(notes = "创建人")
private String createdName;
@ApiModelProperty(notes = "商户id")
private Integer merchantId;
@ApiModelProperty(notes = "商户号", required = true)
private List<Integer> merchantNoList;
@ApiModelProperty(notes = "角色id")
private Integer roleId;
@ApiModelProperty(notes = "角色名字")
private String roleName;
@ApiModelProperty(notes = "创建来源")
private Integer createdSource;
@ApiModelProperty(notes = "员工标签:0-「会员权益/升级」,1-「精品升级」,2-「次新车转化」,3-「售后众筹」4-[膨胀金活动]")
private String staffLabel;
@ApiModelProperty(notes = "部门")
private Integer department;
@NotNull
@ApiModelProperty(notes = "分页数", name = "pageSize", dataType = "Integer", required = true)
private Integer pageSize;
@NotNull
@ApiModelProperty(notes = "当前页", name = "currentPage", dataType = "Integer", required = true)
private Integer currentPage;
}
package cn.com.glsx.merchants.request.staff;
import cn.com.glsx.merchants.request.DefaultRequest;
import com.rop.AbstractRopRequest;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
* @author zhouhaibao
......@@ -31,17 +31,30 @@ public class StaffPageRequest extends DefaultRequest {
@ApiModelProperty(notes = "商户id")
private Integer merchantId;
@ApiModelProperty(notes = "商户号",required = true)
private List<Integer> merchantNoList;
@ApiModelProperty(notes = "角色id")
private Integer roleId;
@ApiModelProperty(notes = "角色名称")
private String roleName;
@ApiModelProperty(notes = "创建来源")
private Integer createdSource;
@ApiModelProperty(notes = "员工标签:0-「会员权益/升级」,1-「精品升级」,2-「次新车转化」,3-「售后众筹」4-[膨胀金活动]")
private String staffLabel;
@ApiModelProperty(notes = "部门")
private Integer department;
@NotNull
@ApiModelProperty(notes = "分页数", name = "pageSize", dataType = "Integer")
@ApiModelProperty(notes = "分页数", name = "pageSize", dataType = "Integer",required = true)
private Integer pageSize;
@NotNull
@ApiModelProperty(notes = "当前页", name = "pageNum", dataType = "Integer")
@ApiModelProperty(notes = "当前页", name = "pageNum", dataType = "Integer",required = true)
private Integer pageNum;
}
......@@ -5,6 +5,7 @@ import cn.com.glsx.merchants.request.file.FileSaveRequest;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
......@@ -14,66 +15,67 @@ import java.util.List;
* @date 2021/7/22 13:47
*/
@Data
public class StaffUpdateRequest extends DefaultRequest {
public class StaffUpdateRequest extends DefaultRequest implements Serializable {
/**
* 员工姓名
*/
@ApiModelProperty(notes = "员工姓名", required = true)
@ApiModelProperty(notes = "员工姓名")
private String staffName;
/**
* id
*/
@ApiModelProperty(notes = "员工id", required = true)
@ApiModelProperty(notes = "员工id",required = true)
private Integer id;
/**
* 职务
*/
@ApiModelProperty(notes = "职务", required = true)
@ApiModelProperty(notes = "职务")
private String staffJob;
/**
* 可见下级商户id
*/
@ApiModelProperty(notes = "可见下级商户id", required = true)
@ApiModelProperty(notes = "可见下级商户id")
private String visibleInferiorMer;
/**
* 手机号
*/
@ApiModelProperty(notes = "手机号", required = true)
@ApiModelProperty(notes = "手机号")
private String staffPhone;
/**
* 密码
*/
@ApiModelProperty(notes = "密码", required = true)
@ApiModelProperty(notes = "密码")
private String password;
/**
* 商户id
*/
@ApiModelProperty(notes = "商户id", required = true)
@ApiModelProperty(notes = "商户id")
private Integer merchantId;
/**
* 邮箱
*/
@ApiModelProperty(notes = "邮箱", required = true)
@ApiModelProperty(notes = "邮箱")
private String staffEmail;
/**
* 角色id
*/
@ApiModelProperty(notes = "角色id", required = true)
@ApiModelProperty(notes = "角色id")
private List<Integer> roleIds;
private String merchantFileRequest;
@ApiModelProperty(notes = "员工标签:0-「1.0新车权益销售」,1-「1.1次新车精品升级」,2-「1.2次新车线上转化」,3-「1.3存量用户众筹」")
private String staffLabel;
@ApiModelProperty(notes = "1-销售部、2-售后部、3-客服部、4-续保部")
private Integer department;
......
package cn.com.glsx.merchants.request.staff;
import cn.com.glsx.merchants.request.DefaultRequest;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class UpdateStaffBatchRequest extends DefaultRequest implements Serializable {
@ApiModelProperty(notes = "员工集合",required = true)
private List<StaffUpdateRequest> staffList;
}
......@@ -128,6 +128,7 @@ public class StaffResponse implements Serializable {
private Integer status;
private String visibleInferiorMerName;
/**
......@@ -140,6 +141,10 @@ public class StaffResponse implements Serializable {
*/
private MerchantUserResponse merchantUserResponse;
@ApiModelProperty(notes = "部门名称")
private String departmentName;
/**
* 员工权限
*/
......@@ -169,6 +174,17 @@ public class StaffResponse implements Serializable {
private Integer merchantNo;
/**
* 商户联系人
*/
@ApiModelProperty(notes = "商户联系人")
private String merchantLegalPerson;
/**
* 商户联系人电话
*/
@ApiModelProperty(notes = "商户联系人电话")
private String merchantLegalPersonPhone;
/**
* 微信
*/
//微信小程序openId
......@@ -191,6 +207,9 @@ public class StaffResponse implements Serializable {
private String weChatPhone;
@ApiModelProperty(notes = "员工标签:0-「1.0新车权益销售」,1-「1.1次新车精品升级」,2-「1.2次新车线上转化」,3-「1.3存量用户众筹」", dataType = "String")
private String staffLabel;
@ApiModelProperty(notes = "员工标签")
private List<String> labelList;
@ApiModelProperty(notes = "0-其他、1-销售部、2-售后部、3-客服部、4-续保部", dataType = "Integer")
private Integer department;
......
package cn.com.glsx.merchants.response.serviceCenter;
import cn.com.glsx.merchants.dto.MerchantBrandDTO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@Data
public class MerchantDetailRopResponse implements Serializable {
@ApiModelProperty(example = "商户id")
private Integer id;
@ApiModelProperty(example = "商户号")
private Integer merchantNo;
@ApiModelProperty(example = "商户名")
private String merchantName;
@ApiModelProperty(example = "联系人")
private String merchantLegalPerson;
@ApiModelProperty("商户层级")
private Integer merchantAccountLevel;
@ApiModelProperty("账户类型")
private String accountType;
@ApiModelProperty(example = "联系电话")
private String merchantLegalPersonPhone;
@ApiModelProperty(notes = "经度")
private Float lng;
@ApiModelProperty(notes = "纬度")
private Float lat;
@ApiModelProperty(notes = "省编码")
private String provinceCode;
@ApiModelProperty(notes = "省名称")
private String provinceName;
@ApiModelProperty(notes = "市编码")
private String cityCode;
@ApiModelProperty(notes = "市名称")
private String cityName;
@ApiModelProperty(notes = "商户详情地址")
private String merchantAddress;
@ApiModelProperty(notes = "主营品牌-一级")
private String merchantBrandCars;
@ApiModelProperty(notes = "主营品牌-二级")
private String merchantBrandMain;
@ApiModelProperty(notes = "车品牌树")
private List<MerchantBrandDTO> brandTreeList;
@ApiModelProperty(notes = "登录账号")
private String merchantLoginAccount;
@ApiModelProperty(example = "登录密码")
private String merchantLoginPassword;
}
package cn.com.glsx.merchants.response.serviceCenter;
import cn.com.glsx.merchants.model.response.serviceCenter.ServiceStaffRpcResponse;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
@Data
public class MerchantPageRopResponse implements Serializable {
@ApiModelProperty(example = "商户id")
private Integer merchantId;
@ApiModelProperty(example = "商户号")
private Integer merchantNo;
@ApiModelProperty(example = "商户名")
private String merchantName;
@ApiModelProperty(example = "联系人")
private String merchantLegalPerson;
@ApiModelProperty(example = "联系电话")
private String merchantLegalPersonPhone;
@ApiModelProperty(notes = "员工个数")
private Integer staffCount;
@ApiModelProperty(example = "创建时间")
@JsonFormat(pattern = "yyyy.MM.dd", timezone = "GMT+8")
private Date createdDate;
}
package cn.com.glsx.merchants.response.staff;
import cn.com.glsx.merchants.response.serviceCenter.VisibleMerchantRopResponse;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class StaffVisibleMerchantRopResponse implements Serializable {
@ApiModelProperty(notes = "园区店员工可见下级4s店商户范围:0全部可见 1:部分可见")
private Integer visualType;
@ApiModelProperty(notes = "可见商户列表")
private List<VisibleMerchantRopResponse> merchantList;
}
......@@ -7,13 +7,17 @@ import cn.com.glsx.merchants.contants.Contants;
import cn.com.glsx.merchants.convert.ConvertRequest;
import cn.com.glsx.merchants.convert.ConvertResponse;
import cn.com.glsx.merchants.model.request.*;
import cn.com.glsx.merchants.model.request.MerchantBrandRequest;
import cn.com.glsx.merchants.model.request.merchant.FindBySupMerchantNoRpcRequest;
import cn.com.glsx.merchants.model.request.merchant.MerchantListByConditionRpcRequest;
import cn.com.glsx.merchants.model.request.merchant.MerchantNoRpcRequest;
import cn.com.glsx.merchants.model.request.serviceCenter.*;
import cn.com.glsx.merchants.model.response.*;
import cn.com.glsx.merchants.model.response.serviceCenter.MerchantDetailResponse;
import cn.com.glsx.merchants.model.response.serviceCenter.SearchMerchantRpcResponse;
import cn.com.glsx.merchants.model.response.serviceCenter.ServiceStaffRpcResponse;
import cn.com.glsx.merchants.model.response.serviceCenter.VisibleMerchantRpcResponse;
import cn.com.glsx.merchants.model.response.staff.VisualMerchantListRpcResponse;
import cn.com.glsx.merchants.remote.MerchantRemote;
import cn.com.glsx.merchants.remote.MerchantStaffRemote;
import cn.com.glsx.merchants.remote.MerchantUserRemote;
......@@ -24,9 +28,8 @@ import cn.com.glsx.merchants.request.open.*;
import cn.com.glsx.merchants.request.open.MerchantListOpenRequest;
import cn.com.glsx.merchants.request.serviceCenter.*;
import cn.com.glsx.merchants.response.*;
import cn.com.glsx.merchants.response.serviceCenter.SearchServiceMerchantRopResponse;
import cn.com.glsx.merchants.response.serviceCenter.ServiceStaffRopResponse;
import cn.com.glsx.merchants.response.serviceCenter.VisibleMerchantRopResponse;
import cn.com.glsx.merchants.response.serviceCenter.*;
import cn.com.glsx.merchants.response.staff.StaffVisibleMerchantRopResponse;
import cn.com.glsx.merchants.util.ListUtils;
import cn.com.glsx.merchants.util.Pagination;
import com.alibaba.fastjson.JSONObject;
......@@ -405,6 +408,9 @@ public class OpenService {
public MerchantNoNameRopResponse createMerchant(CreateMerchantRopRequest ropRequest) {
CreateMerchantRpcRequest remoteRequest = ConvertRequest.convertRequest(ropRequest,new CreateMerchantRpcRequest());
if (StringUtils.isNotEmpty(ropRequest.getMerchantBrandListJson())){
remoteRequest.setMerchantBrandList(JSONObject.parseArray(ropRequest.getMerchantBrandListJson(), MerchantBrandRequest.class));
}
RpcResponse<MerchantNoNameRpcResponse> rpcResponse = merchantRemote.createMerchant(remoteRequest);;
if (rpcResponse.isSuccess())
return ConvertResponse.convertObject(rpcResponse.getResult(),MerchantNoNameRopResponse.class);
......@@ -413,6 +419,10 @@ public class OpenService {
public Boolean updateMerchant(UpdateMerchantRopRequest ropRequest) {
UpdateMerchantRpcRequest remoteRequest = ConvertRequest.convertRequest(ropRequest,new UpdateMerchantRpcRequest());
if (StringUtils.isNotEmpty(ropRequest.getMerchantBrandListJson())){
remoteRequest.setMerchantBrandList(JSONObject.parseArray(ropRequest.getMerchantBrandListJson(), MerchantBrandRequest.class));
}
RpcResponse<Boolean> rpcResponse = merchantRemote.updateServiceCenterMerchant(remoteRequest);;
if (rpcResponse.isSuccess())
return rpcResponse.getResult();
......@@ -460,11 +470,11 @@ public class OpenService {
throw new RpcServiceException(merchantListByPageRemote.getException().getErrId(), merchantListByPageRemote.getMessage());
}
public List<VisibleMerchantRopResponse> visibleMerByStaff(StaffVisibleMerRopRequest ropRequest) {
public StaffVisibleMerchantRopResponse visibleMerByStaff(StaffVisibleMerRopRequest ropRequest) {
StaffVisibleMerRpcRequest remoteRequest = ConvertRequest.convertRequest(ropRequest,new StaffVisibleMerRpcRequest());
RpcResponse<List<VisibleMerchantRpcResponse>> rpcResponse = merchantStaffRemote.visibleMerByStaff(remoteRequest);
RpcResponse<VisualMerchantListRpcResponse> rpcResponse = merchantStaffRemote.visibleMerByStaff(remoteRequest);
if (rpcResponse.isSuccess())
return ConvertResponse.convertList(rpcResponse.getResult(),VisibleMerchantRopResponse.class);
return ConvertResponse.convertObject(rpcResponse.getResult(),StaffVisibleMerchantRopResponse.class);
throw new RpcServiceException(rpcResponse.getException().getErrId(), rpcResponse.getMessage());
}
......@@ -476,4 +486,30 @@ public class OpenService {
}
throw new RpcServiceException(response.getError(),response.getException().getErrId(), response.getMessage());
}
public Pagination<MerchantPageRopResponse> searchMerchantPage(MerchantPageRpcRequest ropRequest) {
SearchMerchantRpcRequest rpcRequest = ConvertRequest.convertRequest(ropRequest, new SearchMerchantRpcRequest());
RpcResponse<RpcPagination<SearchMerchantRpcResponse>> rpcResponse = merchantRemote.searchByMerchantNos(rpcRequest);
if (rpcResponse.isSuccess()) {
return ConvertResponse.convertPage(rpcResponse.getResult(), MerchantPageRopResponse.class);
}
throw new RpcServiceException(rpcResponse.getError(),rpcResponse.getException().getErrId(), rpcResponse.getMessage());
}
public MerchantDetailRopResponse merchantInfo(MerchantNoRopRequest ropRequest) {
MerchantNoRpcRequest rpcRequest = ConvertRequest.convertRequest(ropRequest, new MerchantNoRpcRequest());
RpcResponse<MerchantDetailResponse> rpcResponse = merchantRemote.searMerchantDetail(rpcRequest);
if (rpcResponse.isSuccess()) {
return ConvertResponse.convertObject(rpcResponse.getResult(), MerchantDetailRopResponse.class);
}
throw new RpcServiceException(rpcResponse.getError(),rpcResponse.getException().getErrId(), rpcResponse.getMessage());
}
public Boolean isStaffPhone(String phone) {
RpcResponse<Boolean> rpcResponse = merchantUserRemote.isStaffPhone(phone);
if (rpcResponse.isSuccess()) {
return rpcResponse.getResult();
}
throw new RpcServiceException(rpcResponse.getError(),rpcResponse.getException().getErrId(), rpcResponse.getMessage());
}
}
......@@ -10,6 +10,8 @@ import cn.com.glsx.merchants.model.request.StaffBatchRequest;
import cn.com.glsx.merchants.model.request.MerchantFileRequest;
import cn.com.glsx.merchants.model.request.MerchantStaffRequest;
import cn.com.glsx.merchants.model.request.staff.InsertStaffBatchRpcRequest;
import cn.com.glsx.merchants.model.request.staff.StaffUpdateRpcRequest;
import cn.com.glsx.merchants.model.request.staff.UpdateStaffBatchRpcRequest;
import cn.com.glsx.merchants.model.response.MerchantStaffResponse;
import cn.com.glsx.merchants.remote.MerchantStaffRemote;
import cn.com.glsx.merchants.request.staff.*;
......@@ -23,6 +25,7 @@ import com.alibaba.fastjson.JSONObject;
import com.glsx.cloudframework.core.util.StringUtil;
import com.glsx.plat.common.utils.DateUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -231,4 +234,14 @@ public class StaffService {
throw new RpcServiceException(rpcResponse.getException().getErrId(), rpcResponse.getMessage());
}
}
public void updateStaffBatch(UpdateStaffBatchRequest request) {
UpdateStaffBatchRpcRequest rpcRequest = new UpdateStaffBatchRpcRequest();
List<StaffUpdateRpcRequest> rpcList = ConvertRequest.convertListRequest(request.getStaffList(), StaffUpdateRpcRequest.class);
rpcRequest.setStaffList(rpcList);
RpcResponse<Boolean> rpcResponse = merchantStaffRemote.updateStaffBatch(rpcRequest);
if (rpcResponse.isFailed()) {
throw new RpcServiceException(rpcResponse.getException().getErrId(), rpcResponse.getMessage());
}
}
}
package cn.com.glsx.merchants.util;
import lombok.Data;
import java.util.List;
/**
* 分页对象
*/
@Data
public class PaginationDJ<T> {
private Integer pageSize;
private Integer pageNum;
private Integer total;
private List<T> list;
}
package cn.com.glsx.merchants.controller;
import com.alibaba.fastjson.JSONObject;
import org.junit.Test;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
public class OpenControllerTest extends BaseControllerTest{
@Test
public void saveServiceMerchantTest() throws Exception{
MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>(4);
params.add("v", "1.0.0");
params.add("method", "merchants.api.open.serviceCenter.createMerchant");
params.add("merchantName", "测试服务中心0609");
params.add("password", "a123456");
params.add("merchantLegalPerson", "18902928172");
params.add("merchantLegalPersonPhone", "熊正顺");
params.add("createType", "1");
params.add("createdSource", "1");
params.add("createdAccount", "xiongzs");
params.add("merchantBrandListJson", "[{\"cars\":2125,\"merchantBrandId\":[2126]},{\"cars\":2129,\"merchantBrandId\":[2130]}]");
params.add("address.lng", "114.086");
params.add("address.lat", "22.5471");
params.add("address.provinceCode", "440000");
params.add("address.provinceName", "广东省");
params.add("address.cityCode", "440300");
params.add("address.cityName", "深圳市");
params.add("address.merchantAddress", "广东省深圳市桃园街道南山智园");
System.out.println(post(params));
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!