md
This commit is contained in:
parent
1b353c4683
commit
311b6c0c7f
@ -12,22 +12,32 @@
|
||||
package com.xdadan.erp.oms.web;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.xdadan.erp.oms.common.annotation.Log;
|
||||
import com.xdadan.erp.oms.common.annotation.filter.jackson.JacksonFilter;
|
||||
import com.xdadan.erp.oms.common.constant.UserConstants;
|
||||
import com.xdadan.erp.oms.common.core.controller.BaseController;
|
||||
import com.xdadan.erp.oms.common.core.domain.AjaxResult;
|
||||
import com.xdadan.erp.oms.common.core.domain.entity.SysOmsUser;
|
||||
import com.xdadan.erp.oms.common.core.page.TableDataInfo;
|
||||
import com.xdadan.erp.oms.common.enums.BusinessType;
|
||||
import com.xdadan.erp.oms.common.utils.DBUtil;
|
||||
import com.xdadan.erp.oms.common.utils.SecurityUtils;
|
||||
import com.xdadan.erp.oms.common.utils.VerifyCodeUtil;
|
||||
import com.xdadan.erp.oms.domain.EmisMonthpayUseApply;
|
||||
import com.xdadan.erp.oms.service.IEmisMonthpayUseApplyService;
|
||||
import com.xdadan.erp.oms.service.svc.IRpcStaffSvc;
|
||||
import com.xdadan.erp.oms.service.svc.IRpcWaybillSvc;
|
||||
import com.xdadan.erp.oms.system.service.ISysOmsUserService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -41,6 +51,11 @@ import java.util.List;
|
||||
public class Oms2cStaffController extends BaseController
|
||||
{
|
||||
|
||||
@Autowired
|
||||
private ISysOmsUserService userService;
|
||||
|
||||
@Autowired
|
||||
private IEmisMonthpayUseApplyService emisMonthpayUseApplyService;
|
||||
|
||||
@Autowired
|
||||
private IRpcStaffSvc iRpcStaffSvc;
|
||||
@ -58,5 +73,50 @@ public class Oms2cStaffController extends BaseController
|
||||
}
|
||||
|
||||
|
||||
@Log(title = "添加子账号", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/addChildUser")
|
||||
public AjaxResult addChildUser(@Validated @RequestBody SysOmsUser user)
|
||||
{
|
||||
if (StringUtils.isEmpty(user.getPhone()))
|
||||
{
|
||||
return AjaxResult.error("手机号不能为空");
|
||||
}
|
||||
|
||||
if (StringUtils.isNotEmpty(user.getPhone())
|
||||
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
|
||||
{
|
||||
return AjaxResult.error("新增子账户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||
}
|
||||
|
||||
String monthPayCode=user.getMonthlyPayCode();
|
||||
|
||||
if(StringUtils.isEmpty(monthPayCode)){
|
||||
return AjaxResult.error("非月结主账号不允许添加子账号");
|
||||
}
|
||||
|
||||
user.setCustomerName(user.getNickName());
|
||||
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
||||
// 父账号
|
||||
user.setMainUserId(SecurityUtils.getLoginUser().getUser().getId());
|
||||
|
||||
userService.insertSysOmsUserByPhone(user);
|
||||
// 关联子账号月结账号
|
||||
|
||||
// 生成流水号
|
||||
String applySeqNo = DBUtil.getSeqNoByLen(8);
|
||||
|
||||
EmisMonthpayUseApply emisMonthpayUseApply = new EmisMonthpayUseApply();
|
||||
emisMonthpayUseApply.setCustomerCode(getLoginUser().getUser().getCustomerCode());
|
||||
emisMonthpayUseApply.setCustNo(monthPayCode);
|
||||
emisMonthpayUseApply.setApplySeq(applySeqNo);
|
||||
emisMonthpayUseApply.setApplyName("子账号直接绑定月结账号");
|
||||
emisMonthpayUseApply.setMsgCode("1234");
|
||||
emisMonthpayUseApply.setApplyDate(new Date());
|
||||
emisMonthpayUseApply.setAuditStatus(0);
|
||||
emisMonthpayUseApplyService.insertEmisMonthpayUseApply(emisMonthpayUseApply);
|
||||
|
||||
return AjaxResult.success("添加子账号成功");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user