package com.ld.igds.phone35.service.impl; import com.alibaba.fastjson.JSONObject; import com.ld.igds.constant.RespCodeEnum; import com.ld.igds.data.PageResponse; import com.ld.igds.inout.InoutConstant; import com.ld.igds.inout.dto.InoutData; import com.ld.igds.inout.manager.InoutManager; import com.ld.igds.phone35.constant.Phone35Constant; import com.ld.igds.phone35.dto.Phone35AuthUser; import com.ld.igds.phone35.dto.PhoneResponse; import com.ld.igds.phone35.param.Phone35InoutCommonParam; import com.ld.igds.phone35.param.Phone35Request; import com.ld.igds.phone35.service.Phone35Service; import com.ld.igds.phone35.util.PhoneRespUtil; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.Date; /** * 出库登记接口 * * @author chen * @date 2023-01-16 10:04 */ @Service public class Phone35ServiceImpl5202 implements Phone35Service { @Autowired private InoutManager inoutManager; @Override public String getInterfaceId() { return Phone35Constant.API_PHONE_5202; } @SuppressWarnings("unchecked") @Override public PhoneResponse execute(Phone35Request req, Phone35AuthUser phone35AuthUser) throws Exception { //转化为对象 Phone35InoutCommonParam param = JSONObject.parseObject(req.getData().toString(), Phone35InoutCommonParam.class); if (null == param) { return PhoneRespUtil.error(RespCodeEnum.CODE_1111, "参数有误,请重试!!"); } if (StringUtils.isEmpty(param.getPlateNum()) || StringUtils.isEmpty(param.getUserId()) || StringUtils.isEmpty(param.getUserName())) { return PhoneRespUtil.error(RespCodeEnum.CODE_1111, "参数有误,请重试!!"); } //调用出库下一流程 InoutData data = new InoutData(); data.setUserName(param.getUserName()); data.setIntelCard(param.getIntelCard()); data.setUserId(param.getUserId()); data.setUserContact(param.getUserContact()); data.setPlateNum(param.getPlateNum()); data.setType(InoutConstant.TYPE_OUT); data.setCompanyId(phone35AuthUser.getCompanyId()); data.setDeptId(param.getDeptId()); data.setRegisterTime(new Date()); data.setRegisterUser(phone35AuthUser.getCname()); data.setProgress(InoutConstant.PROGRESS_REGISTER); PageResponse result = inoutManager.submitRegisterInout(data); if (RespCodeEnum.CODE_0000.getCode().equals(result.getCode())) { return PhoneRespUtil.success("出库登记成功!", req); } else { return PhoneRespUtil.error(RespCodeEnum.CODE_1111, result.getMsg()); } } }