Commit 7e93502c by zhouhb

[+]代码提交

1 parent 23f29706
......@@ -43,10 +43,10 @@ public class MerchantController {
*/
@ServiceMethod(method = "cn.com.glsx.merchants.merchant.saveMerchant", needInSession = NeedInSessionType.NO)
@ApiOperation("保存商户基础信息")
public RopResponse<Boolean> saveMerchant(MerchantSaveRequest merchantSaveRequest) {
public RopResponse<Integer> saveMerchant(MerchantSaveRequest merchantSaveRequest) {
try {
merchantService.saveMerchant(merchantSaveRequest);
return RopResponse.success(true);
Integer merchant = merchantService.saveMerchant(merchantSaveRequest);
return RopResponse.success(merchant);
} catch (RpcServiceException e) {
log.info("=======MerchantController__invoke__saveMerchant__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
......
......@@ -20,6 +20,8 @@ public class MerchantTreeRopRequest extends DefaultRequest implements Serializab
@ApiModelProperty(notes = "商户id", required = true)
private Integer merchantId;
private List<AccountTypeTreeRequest> accountTypes;
private Integer status;
private String accountTypes;
}
......@@ -70,6 +70,6 @@ public class StaffUpdateRequest extends DefaultRequest {
@ApiModelProperty(notes = "角色id", required = true)
private List<Integer> roleIds;
private FileSaveRequest merchantFileRequest;
private String merchantFileRequest;
}
......@@ -19,6 +19,7 @@ import cn.com.glsx.merchants.util.Pagination;
import com.alibaba.fastjson.JSONObject;
import com.glsx.plat.common.annotation.SysLog;
import com.glsx.plat.common.enums.OperateType;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -47,11 +48,12 @@ public class MerchantService {
* @param merchantSaveRequest 入参
*/
@SysLog(value = "保存商户", action = OperateType.ADD, module = "商户模块")
public void saveMerchant(MerchantSaveRequest merchantSaveRequest) {
RpcResponse<Boolean> booleanRpcResponse = merchantRemote.saveMerchantRemote(converMerchant(merchantSaveRequest));
public Integer saveMerchant(MerchantSaveRequest merchantSaveRequest) {
RpcResponse<Integer> booleanRpcResponse = merchantRemote.saveMerchantRemote(converMerchant(merchantSaveRequest));
if (booleanRpcResponse.isFailed()) {
throw new RpcServiceException(booleanRpcResponse.getException().getErrId(), booleanRpcResponse.getMessage());
return booleanRpcResponse.getResult();
}
throw new RpcServiceException(booleanRpcResponse.getException().getErrId(), booleanRpcResponse.getMessage());
}
private MerchantRequest converMerchant(MerchantSaveRequest merchantSaveRequest) {
......@@ -93,7 +95,12 @@ public class MerchantService {
*/
@SysLog(value = "保存商户权限", action = OperateType.ADD, module = "商户模块")
public void savePermissions(MerchantTreeRopRequest merchantTreeRequest) {
RpcResponse<Boolean> booleanRpcResponse = merchantRemote.savePermissionsRemote(ConvertRequest.convertRequest(merchantTreeRequest, new MerchantTreeRequest()));
MerchantTreeRequest merchantTree = ConvertRequest.convertRequest(merchantTreeRequest, new MerchantTreeRequest());
String accountTypes = merchantTreeRequest.getAccountTypes();
if(StringUtils.isNotEmpty(accountTypes)){
merchantTree.setAccountTypes(JSONObject.parseArray(accountTypes, AccountTypeTreeRequest.class));
}
RpcResponse<Boolean> booleanRpcResponse = merchantRemote.savePermissionsRemote(merchantTree);
if (booleanRpcResponse.isFailed()) {
throw new RpcServiceException(booleanRpcResponse.getException().getErrId(), booleanRpcResponse.getMessage());
}
......@@ -107,7 +114,12 @@ public class MerchantService {
*/
@SysLog(value = "更新商户权限", action = OperateType.EDIT, module = "商户模块")
public void updatePermissions(MerchantTreeRopRequest merchantTreeRequest) {
RpcResponse<Boolean> booleanRpcResponse = merchantRemote.updatePermissionsRemote(ConvertRequest.convertRequest(merchantTreeRequest, new MerchantTreeRequest()));
MerchantTreeRequest merchantTree = ConvertRequest.convertRequest(merchantTreeRequest, new MerchantTreeRequest());
String accountTypes = merchantTreeRequest.getAccountTypes();
if(StringUtils.isNotEmpty(accountTypes)){
merchantTree.setAccountTypes(JSONObject.parseArray(accountTypes, AccountTypeTreeRequest.class));
}
RpcResponse<Boolean> booleanRpcResponse = merchantRemote.updatePermissionsRemote(merchantTree);
if (booleanRpcResponse.isFailed()) {
throw new RpcServiceException(booleanRpcResponse.getException().getErrId(), booleanRpcResponse.getMessage());
}
......
......@@ -69,9 +69,9 @@ public class StaffService {
private MerchantStaffRequest converRequest(StaffUpdateRequest staffUpdateRequest) {
MerchantStaffRequest merchantStaffRequest = ConvertRequest.convertRequest(staffUpdateRequest, new MerchantStaffRequest());
FileSaveRequest merchantFileRequest = staffUpdateRequest.getMerchantFileRequest();
String merchantFileRequest = staffUpdateRequest.getMerchantFileRequest();
if(merchantFileRequest!=null) {
merchantStaffRequest.setMerchantFileRequest(ConvertRequest.convertRequest(merchantFileRequest, new MerchantFileRequest()));
merchantStaffRequest.setMerchantFileRequest(JSONObject.parseObject(merchantFileRequest, MerchantFileRequest.class));
}
return merchantStaffRequest;
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!