package com.java110.user.cmd.user;
|
|
import com.alibaba.fastjson.JSONObject;
|
import com.java110.core.annotation.Java110Cmd;
|
import com.java110.core.context.ICmdDataFlowContext;
|
import com.java110.core.event.cmd.Cmd;
|
import com.java110.core.event.cmd.CmdEvent;
|
import com.java110.intf.user.IUserV1InnerServiceSMO;
|
import com.java110.po.user.UserPo;
|
import com.java110.utils.exception.CmdException;
|
import com.java110.utils.util.Assert;
|
import com.java110.utils.util.BeanConvertUtil;
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import java.text.ParseException;
|
|
@Java110Cmd(serviceCode = "user.staff.disable")
|
public class UserStaffDisableCmd extends Cmd {
|
@Autowired
|
private IUserV1InnerServiceSMO userV1InnerServiceSMOImpl;
|
|
@Override
|
public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
|
Assert.jsonObjectHaveKey(reqJson, "userId", "当前请求报文中未包含userId节点");
|
}
|
|
@Override
|
public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException {
|
UserPo userPo = BeanConvertUtil.covertBean(reqJson, UserPo.class);
|
|
int flag = userV1InnerServiceSMOImpl.updateUser(userPo);
|
|
if (flag < 1) {
|
throw new CmdException("禁用用户失败");
|
}
|
}
|
}
|