package com.doumee.api.business;
|
|
import com.alibaba.fastjson.JSONObject;
|
import com.doumee.api.BaseController;
|
import com.doumee.biz.zbom.ZbomIAMService;
|
import com.doumee.biz.zbom.model.IamUpateShopModel;
|
import com.doumee.biz.zbom.model.IamUpateUserModel;
|
import com.doumee.core.exception.BusinessException;
|
import com.doumee.core.model.ApiResponse;
|
import com.doumee.core.utils.Constants;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import org.apache.commons.lang3.StringUtils;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.*;
|
|
import javax.servlet.http.HttpServletRequest;
|
import java.util.List;
|
|
/**
|
* @author 江蹄蹄
|
* @date 2024/07/04 14:40
|
*/
|
@Api(tags = "对外提供接口")
|
@RestController
|
@RequestMapping("/push")
|
public class PushController extends BaseController {
|
@Autowired
|
private ZbomIAMService zbomIAMService;
|
@ApiOperation("组织信息更新推送")
|
@PostMapping("/iam/updateShopInfo")
|
public ApiResponse<String> updateShopInfo(@RequestHeader(name = "token") String token,
|
@RequestHeader(name = "uuid") String uuid ,
|
@RequestHeader(name = "timestamp") String timestamp,
|
@RequestBody List<IamUpateShopModel> shopList,
|
HttpServletRequest request ) {
|
int success = Constants.ZERO;
|
ApiResponse<String> r = null;
|
try {
|
zbomIAMService.updateShopInfo(token,uuid,timestamp,shopList);
|
r = ApiResponse.success("操作成功");
|
}catch (BusinessException e){
|
success = Constants.ONE;
|
r = ApiResponse.failed(StringUtils.defaultString(e.getMessage(),"操作失败"));
|
}catch (Exception e){
|
success = Constants.ONE;
|
r = ApiResponse.failed("操作失败");
|
}finally {
|
zbomIAMService.saveInterfaceLog("/push/iam/updateUserInfo","IAM推送人员账号信息", token, uuid, timestamp, shopList,success, JSONObject.toJSONString(r));
|
}
|
return r;
|
}
|
@ApiOperation("人员账号信息更新推送")
|
@PostMapping("/iam/updateUserInfo")
|
public ApiResponse<String> updateUserInfo(@RequestHeader(name = "token") String token,
|
@RequestHeader(name = "uuid") String uuid ,
|
@RequestHeader(name = "timestamp") String timestamp,
|
@RequestBody IamUpateUserModel upateUserModel,
|
HttpServletRequest request) {
|
int success = Constants.ZERO;
|
ApiResponse<String> r = null;
|
try {
|
zbomIAMService.updateUserInfo(token,uuid,timestamp,upateUserModel);
|
r = ApiResponse.success("操作成功");
|
}catch (BusinessException e){
|
success = Constants.ONE;
|
r = ApiResponse.failed(StringUtils.defaultString(e.getMessage(),"操作失败"));
|
}catch (Exception e){
|
success = Constants.ONE;
|
r = ApiResponse.failed("操作失败");
|
}finally {
|
zbomIAMService.saveInterfaceLog("/push/iam/updateUserInfo","IAM推送人员账号信息", token, uuid, timestamp, upateUserModel,success, JSONObject.toJSONString(r));
|
}
|
return r;
|
}
|
|
}
|