Commit d8591742 authored by ysongq's avatar ysongq

commit

parent 644a8841
alter table t_data_goods add use_person varchar(64) DEFAULT '0' COMMENT '使用人数'; alter table t_data_goods add use_person varchar(64) DEFAULT '0' COMMENT '使用人数';
\ No newline at end of file alter table t_mall_customer add head_portrait_url varchar(512) COMMENT '头像';
\ No newline at end of file
...@@ -7,6 +7,8 @@ import com.jz.common.utils.Result; ...@@ -7,6 +7,8 @@ import com.jz.common.utils.Result;
import com.jz.common.utils.SessionUtils; import com.jz.common.utils.SessionUtils;
import com.jz.common.utils.StatusCode; import com.jz.common.utils.StatusCode;
import com.jz.dm.mall.moduls.controller.customer.bean.CustomerDto; import com.jz.dm.mall.moduls.controller.customer.bean.CustomerDto;
import com.jz.dm.mall.moduls.controller.customer.bean.req.CustomerRequest;
import com.jz.dm.mall.moduls.controller.customer.bean.req.LoginRequest;
import com.jz.dm.mall.moduls.entity.MallCustomer; import com.jz.dm.mall.moduls.entity.MallCustomer;
import com.jz.dm.mall.moduls.service.MallCustomerService; import com.jz.dm.mall.moduls.service.MallCustomerService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -43,14 +45,13 @@ public class LoginController { ...@@ -43,14 +45,13 @@ public class LoginController {
/** /**
* 登录功能 * 登录功能
* *
* @param username 账号
* @param password 密码
* @return * @return
*/ */
@PostMapping(value = "/login") @PostMapping(value = "/login")
@ApiOperation(value = "登录功能", notes = "登录功能") @ApiOperation(value = "登录功能", notes = "登录功能")
public Result<CustomerDto> login(@RequestParam(value = "username") String username, public Result<CustomerDto> login(@RequestBody LoginRequest customer, HttpServletRequest request) throws Exception {
@RequestParam(value = "password") String password, HttpServletRequest request) throws Exception { String username = customer.getUsername();
String password = customer.getPassword();
// 手机 // 手机
String ph = "^[1][34578]\\d{9}$"; String ph = "^[1][34578]\\d{9}$";
// 如果是手机验证 // 如果是手机验证
...@@ -59,7 +60,7 @@ public class LoginController { ...@@ -59,7 +60,7 @@ public class LoginController {
request.getSession().getAttribute("mallCustomer"); request.getSession().getAttribute("mallCustomer");
if (mallCustomer != null) { if (mallCustomer != null) {
if (mallCustomer.getCustomerPhone().equals(username) && mallCustomer.getPassword().equals(password)) { if (mallCustomer.getCustomerPhone().equals(username) && mallCustomer.getPassword().equals(password)) {
return new Result<>(true, "登录成功!", StatusCode.OK); return new Result<>(true, "登录成功!", StatusCode.OK, mallCustomer);
} }
return new Result<>(false, "用户名或密码错误!", StatusCode.ERROR); return new Result<>(false, "用户名或密码错误!", StatusCode.ERROR);
} }
...@@ -67,7 +68,7 @@ public class LoginController { ...@@ -67,7 +68,7 @@ public class LoginController {
CustomerDto mallCustomer = mallCustomerService.selectByAccount(username, request); CustomerDto mallCustomer = mallCustomerService.selectByAccount(username, request);
if (mallCustomer != null) { if (mallCustomer != null) {
if (mallCustomer.getCustomerAccount().equals(username) && mallCustomer.getPassword().equals(password)) { if (mallCustomer.getCustomerAccount().equals(username) && mallCustomer.getPassword().equals(password)) {
return new Result<>(true, "登录成功!", StatusCode.OK); return new Result<>(true, "登录成功!", StatusCode.OK, mallCustomer);
} }
} }
......
...@@ -9,6 +9,7 @@ import com.jz.common.constant.ResultCode; ...@@ -9,6 +9,7 @@ import com.jz.common.constant.ResultCode;
import com.jz.common.constant.ResultMsg; import com.jz.common.constant.ResultMsg;
import com.jz.common.utils.SessionUtils; import com.jz.common.utils.SessionUtils;
import com.jz.dm.mall.moduls.controller.customer.bean.CustomerDto; import com.jz.dm.mall.moduls.controller.customer.bean.CustomerDto;
import com.jz.dm.mall.moduls.controller.customer.bean.req.CustomerRequest;
import com.jz.dm.mall.moduls.entity.MallCustomer; import com.jz.dm.mall.moduls.entity.MallCustomer;
import com.jz.common.utils.Result; import com.jz.common.utils.Result;
import com.jz.common.utils.StatusCode; import com.jz.common.utils.StatusCode;
...@@ -47,32 +48,31 @@ public class MallCustomerController extends BaseController { ...@@ -47,32 +48,31 @@ public class MallCustomerController extends BaseController {
/** /**
* 添加用户 * 添加用户
* @param paramMap * @param customer
* @return * @return
*/ */
@PostMapping("/saveCustomer") @PostMapping("/saveCustomer")
@ApiOperation(value = "注册用户", notes = "添加用户") @ApiOperation(value = "注册用户", notes = "添加用户")
public Result saveCustomer(@RequestParam(required = true) Map<String, String> paramMap, HttpServletRequest request) { public Result saveCustomer(@RequestBody CustomerRequest customer, HttpServletRequest request) {
if (paramMap != null) { if (!StringUtils.isEmpty(customer)) {
String username = paramMap.get("username");
String telephone = paramMap.get("telephone");
String ph = "^[1][34578]\\d{9}$"; String ph = "^[1][34578]\\d{9}$";
String telephone= customer.getTelephone();
if (telephone.matches(ph)) { if (telephone.matches(ph)) {
MallCustomer mallCustomer = mallCustomerService.selectByPhone(telephone); MallCustomer mallCustomer = mallCustomerService.selectByPhone(customer.getTelephone());
if (mallCustomer != null) { if (mallCustomer != null) {
if (mallCustomer.getCustomerPhone().equals(telephone)) { if (mallCustomer.getCustomerPhone().equals(customer.getTelephone())) {
return new Result(false, "手机号相同", StatusCode.ERROR); return new Result(false, "手机号相同", StatusCode.ERROR);
} }
} }
} }
// 根据手机号查询用户信息 // 根据手机号查询用户信息
CustomerDto mallCustomer = mallCustomerService.selectByAccount(username, request); CustomerDto mallCustomer = mallCustomerService.selectByAccount(customer.getUsername(), request);
if (mallCustomer != null) { if (mallCustomer != null) {
if (mallCustomer.getCustomerAccount().equals(username)) { if (mallCustomer.getCustomerAccount().equals(customer.getUsername())) {
return new Result(false, "用户名相同", StatusCode.ERROR); return new Result(false, "用户名相同", StatusCode.ERROR);
} }
} }
mallCustomerService.saveCustomer(paramMap); mallCustomerService.saveCustomer(customer);
return new Result(true, "注册成功!", StatusCode.OK); return new Result(true, "注册成功!", StatusCode.OK);
} }
return new Result(false, "注册失败!", StatusCode.ERROR); return new Result(false, "注册失败!", StatusCode.ERROR);
...@@ -84,7 +84,7 @@ public class MallCustomerController extends BaseController { ...@@ -84,7 +84,7 @@ public class MallCustomerController extends BaseController {
* @return * @return
*/ */
@GetMapping("/getLoginUserName") @GetMapping("/getLoginUserName")
@ApiOperation(value = "获取用户信息") @ApiOperation(value = "获取当前登录用户信息")
public Result getLoginUserName (HttpServletRequest request) { public Result getLoginUserName (HttpServletRequest request) {
// 从session中获取id // 从session中获取id
try { try {
...@@ -102,7 +102,7 @@ public class MallCustomerController extends BaseController { ...@@ -102,7 +102,7 @@ public class MallCustomerController extends BaseController {
@PostMapping(value = "/updatePassword") @PostMapping(value = "/updatePassword")
@ApiOperation(value = "密码修改") @ApiOperation(value = "密码修改")
public Result updatePassword(@RequestParam(value = "oldPassWard") String oldPassword, public Result updatePassword(@RequestParam(value = "oldPassWard") String oldPassword,
@RequestParam(value = "newPassword")String newPassword,HttpServletRequest request) throws Exception { @RequestParam(value = "newPassword") String newPassword,HttpServletRequest request) throws Exception {
// 获取用户信息 // 获取用户信息
MallCustomer mallCustomer = (MallCustomer) getLoginUserName(request).getData(); MallCustomer mallCustomer = (MallCustomer) getLoginUserName(request).getData();
// 如果密码一致 // 如果密码一致
......
...@@ -14,6 +14,7 @@ import org.springframework.data.redis.core.RedisTemplate; ...@@ -14,6 +14,7 @@ import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -40,7 +41,7 @@ public class ValidateCodeController { ...@@ -40,7 +41,7 @@ public class ValidateCodeController {
*/ */
@PostMapping(value = "/sendForLogin") @PostMapping(value = "/sendForLogin")
@ApiOperation(value = "注册时发送的验证码") @ApiOperation(value = "注册时发送的验证码")
public Result sendForLogin(String telephone) { public Result sendForLogin(@RequestParam(value = "telephone") String telephone) {
String key = RedisMessageConstant.SENDTYPE_LOGIN + "_" + telephone; String key = RedisMessageConstant.SENDTYPE_LOGIN + "_" + telephone;
// 通过手机号从redis获取验证码 // 通过手机号从redis获取验证码
String codeInRedis = (String) redisTemplate.opsForValue().get(key); String codeInRedis = (String) redisTemplate.opsForValue().get(key);
...@@ -71,7 +72,7 @@ public class ValidateCodeController { ...@@ -71,7 +72,7 @@ public class ValidateCodeController {
*/ */
@PostMapping("/send4Code") @PostMapping("/send4Code")
@ApiOperation(value = "修改密码发送验证码") @ApiOperation(value = "修改密码发送验证码")
public Result send4Code(String telephone) { public Result send4Code(@RequestParam(value = "telephone") String telephone) {
String key = RedisMessageConstant.SENDTYPE_LOGIN + "_" + telephone; String key = RedisMessageConstant.SENDTYPE_LOGIN + "_" + telephone;
// 通过手机号从redis获取验证码 // 通过手机号从redis获取验证码
String codeInRedis = (String) redisTemplate.opsForValue().get(key); String codeInRedis = (String) redisTemplate.opsForValue().get(key);
......
package com.jz.dm.mall.moduls.controller.customer.bean; package com.jz.dm.mall.moduls.controller.customer.bean;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/** /**
* @ClassName: CustomerDto * @ClassName: CustomerDto
...@@ -15,33 +16,51 @@ public class CustomerDto { ...@@ -15,33 +16,51 @@ public class CustomerDto {
/** /**
* 用户id * 用户id
*/ */
@ApiModelProperty(value = "账户id")
private Long customerId; private Long customerId;
/** /**
* 企业id * 企业id
*/ */
@ApiModelProperty(value = "企业id")
private Long departmentId; private Long departmentId;
/** /**
* 密码 * 密码
*/ */
@ApiModelProperty(value = "密码")
private String password; private String password;
/** /**
* 账户 * 账户
*/ */
@ApiModelProperty(value = "账户")
private String customerAccount; private String customerAccount;
/** /**
* 用户真实姓名 * 用户真实姓名
*/ */
@ApiModelProperty(value = "真实姓名")
private String customerName; private String customerName;
/** /**
* 联系电话 * 联系电话
*/ */
@ApiModelProperty(value = "电话")
private String customerPhone; private String customerPhone;
/** /**
* 资产账户id * 资产账户id
*/ */
@ApiModelProperty(value = "资产账户id")
private String assetsId; private String assetsId;
@ApiModelProperty(value = "头像")
private String headPortraitUrl;
public String getHeadPortraitUrl() {
return headPortraitUrl;
}
public void setHeadPortraitUrl(String headPortraitUrl) {
this.headPortraitUrl = headPortraitUrl;
}
public Long getCustomerId() { public Long getCustomerId() {
return customerId; return customerId;
} }
......
package com.jz.dm.mall.moduls.controller.customer.bean.req;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @ClassName:
* @Author: Carl
* @Date: 2020/12/17
* @Version:
*/
@ApiModel(value = "注册用户接受的参数")
public class CustomerRequest {
@ApiModelProperty(value = "用户名")
private String username;
@ApiModelProperty(value = "手机号")
private String telephone;
@ApiModelProperty(value = "验证码")
private String vailCode;
@ApiModelProperty(value = "密码")
private String password;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getTelephone() {
return telephone;
}
public void setTelephone(String telephone) {
this.telephone = telephone;
}
public String getVailCode() {
return vailCode;
}
public void setVailCode(String vailCode) {
this.vailCode = vailCode;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
package com.jz.dm.mall.moduls.controller.customer.bean.req;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @ClassName:
* @Author: Carl
* @Date: 2020/12/17
* @Version:
*/
@ApiModel(value = "用户登录接受的参数")
public class LoginRequest {
@ApiModelProperty(value = "验证码")
private String vailCode;
@ApiModelProperty(value = "密码")
private String password;
@ApiModelProperty(value = "用户名")
private String username;
public String getVailCode() {
return vailCode;
}
public void setVailCode(String vailCode) {
this.vailCode = vailCode;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
}
package com.jz.dm.mall.moduls.service; package com.jz.dm.mall.moduls.service;
import com.jz.dm.mall.moduls.controller.customer.bean.CustomerDto; import com.jz.dm.mall.moduls.controller.customer.bean.CustomerDto;
import com.jz.dm.mall.moduls.controller.customer.bean.req.CustomerRequest;
import com.jz.dm.mall.moduls.entity.MallCustomer; import com.jz.dm.mall.moduls.entity.MallCustomer;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
...@@ -30,9 +31,9 @@ public interface MallCustomerService { ...@@ -30,9 +31,9 @@ public interface MallCustomerService {
/** /**
* 注册账号 * 注册账号
* @param paramMap * @param customerRequest
*/ */
void saveCustomer(Map<String, String> paramMap); void saveCustomer(CustomerRequest customerRequest);
/** /**
* 通过手机号查询是否已注册 * 通过手机号查询是否已注册
......
...@@ -7,6 +7,7 @@ import com.jz.common.enums.UserTypeEnum; ...@@ -7,6 +7,7 @@ import com.jz.common.enums.UserTypeEnum;
import com.jz.common.utils.DateUtils; import com.jz.common.utils.DateUtils;
import com.jz.common.utils.SessionUtils; import com.jz.common.utils.SessionUtils;
import com.jz.dm.mall.moduls.controller.customer.bean.CustomerDto; import com.jz.dm.mall.moduls.controller.customer.bean.CustomerDto;
import com.jz.dm.mall.moduls.controller.customer.bean.req.CustomerRequest;
import com.jz.dm.mall.moduls.entity.MallCustomer; import com.jz.dm.mall.moduls.entity.MallCustomer;
import com.jz.dm.mall.moduls.mapper.MallCustomerDao; import com.jz.dm.mall.moduls.mapper.MallCustomerDao;
import com.jz.dm.mall.moduls.service.MallCustomerService; import com.jz.dm.mall.moduls.service.MallCustomerService;
...@@ -91,15 +92,15 @@ public class MallCustomerServiceImpl implements MallCustomerService { ...@@ -91,15 +92,15 @@ public class MallCustomerServiceImpl implements MallCustomerService {
/** /**
* 注册账号 * 注册账号
* *
* @param paramMap * @param
*/ */
@Override @Override
public void saveCustomer(Map<String, String> paramMap) { public void saveCustomer(CustomerRequest customerRequest) {
MallCustomer mallCustomer = new MallCustomer(); MallCustomer mallCustomer = new MallCustomer();
// 获取验证码 // 获取验证码
String vailCode = paramMap.get("vailCode"); String vailCode = customerRequest.getVailCode();
String username = paramMap.get("username"); String username = customerRequest.getUsername();
String telephone = paramMap.get("telephone"); String telephone = customerRequest.getTelephone();
// 从redis获取验证码 // 从redis获取验证码
// String key = RedisMessageConstant.SENDTYPE_LOGIN + "_" + telephone; // String key = RedisMessageConstant.SENDTYPE_LOGIN + "_" + telephone;
...@@ -108,7 +109,7 @@ public class MallCustomerServiceImpl implements MallCustomerService { ...@@ -108,7 +109,7 @@ public class MallCustomerServiceImpl implements MallCustomerService {
String codeInRedis = "147826"; String codeInRedis = "147826";
if (codeInRedis.equals(vailCode)) { if (codeInRedis.equals(vailCode)) {
mallCustomer.setCustomerAccount(username); mallCustomer.setCustomerAccount(username);
mallCustomer.setPassword(paramMap.get("password")); mallCustomer.setPassword(customerRequest.getPassword());
mallCustomer.setCustomerPhone(telephone); mallCustomer.setCustomerPhone(telephone);
mallCustomer.setCreTime(DateUtils.getToday()); mallCustomer.setCreTime(DateUtils.getToday());
mallCustomer.setRegisterTime(DateUtils.getToday()); mallCustomer.setRegisterTime(DateUtils.getToday());
......
...@@ -173,6 +173,7 @@ ...@@ -173,6 +173,7 @@
t1.customer_account as customerAccount, t1.customer_account as customerAccount,
t1.customer_name as customerName, t1.customer_name as customerName,
t1.customer_phone as customerPhone, t1.customer_phone as customerPhone,
t1.head_portrait_url as headPortraitUrl,
t3.assets_id as assetsId t3.assets_id as assetsId
from t_mall_customer t1 from t_mall_customer t1
left join t_department t2 on t1.department_id=t2.department_id left join t_department t2 on t1.department_id=t2.department_id
...@@ -188,6 +189,7 @@ ...@@ -188,6 +189,7 @@
t1.customer_account as customerAccount, t1.customer_account as customerAccount,
t1.customer_name as customerName, t1.customer_name as customerName,
t1.customer_phone as customerPhone, t1.customer_phone as customerPhone,
t1.head_portrait_url as headPortraitUrl,
t3.assets_id as assetsId t3.assets_id as assetsId
from t_mall_customer t1 from t_mall_customer t1
left join t_department t2 on t1.department_id=t2.department_id left join t_department t2 on t1.department_id=t2.department_id
......
...@@ -63,7 +63,7 @@ public class DepartmentController extends BaseController { ...@@ -63,7 +63,7 @@ public class DepartmentController extends BaseController {
* @param req * @param req
* @return * @return
*/ */
@GetMapping(value = "/{id}") @GetMapping(value = "/getDepartment/{id}")
@ApiOperation(value = "主键查询用户企业详情信息") @ApiOperation(value = "主键查询用户企业详情信息")
public Result<CompanyDetailsDto> selectById(@PathVariable(value = "id") Long id, HttpServletRequest req) { public Result<CompanyDetailsDto> selectById(@PathVariable(value = "id") Long id, HttpServletRequest req) {
if (id != null) { if (id != null) {
...@@ -80,19 +80,26 @@ public class DepartmentController extends BaseController { ...@@ -80,19 +80,26 @@ public class DepartmentController extends BaseController {
*/ */
@PostMapping(value = "/audit/{id}") @PostMapping(value = "/audit/{id}")
@ApiModelProperty(value = "企业审核") @ApiModelProperty(value = "企业审核")
public Result audit(@PathVariable(value = "id") Long id) { public Result audit(@PathVariable(value = "id") Long id, HttpServletRequest req) {
if (id != null) { if (id != null) {
departmentService.audit(id); departmentService.audit(id, req);
return new Result<CompanyDetailsDto>(true, "企业审核成功!", StatusCode.OK); return new Result<CompanyDetailsDto>(true, "企业审核成功!", StatusCode.OK);
} }
return new Result<CompanyDetailsDto>(false, "企业审核失败!", StatusCode.ERROR); return new Result<CompanyDetailsDto>(false, "企业审核失败!", StatusCode.ERROR);
} }
/**
* 添加用户
* @param saveCustomerRequest
* @param req
* @return
* @throws Exception
*/
@PostMapping(value = "/add") @PostMapping(value = "/add")
@ApiModelProperty(value = "添加用户") @ApiModelProperty(value = "添加用户")
public Result add(@RequestBody SaveCustomerRequest saveCustomerRequest, HttpServletRequest req) throws Exception { public Result add(@RequestBody SaveCustomerRequest saveCustomerRequest, HttpServletRequest req) throws Exception {
if (saveCustomerRequest != null) { if (saveCustomerRequest != null) {
Result result = departmentService.add(saveCustomerRequest); Result result = departmentService.add(saveCustomerRequest, req);
result.getMessage(); result.getMessage();
result.getCode(); result.getCode();
return result; return result;
......
...@@ -37,11 +37,11 @@ public interface DepartmentService { ...@@ -37,11 +37,11 @@ public interface DepartmentService {
* 企业审核信息 * 企业审核信息
* @param id * @param id
*/ */
void audit(Long id); void audit(Long id, HttpServletRequest req);
/** /**
* 添加用户 * 添加用户
* @param saveCustomerRequest * @param saveCustomerRequest
*/ */
Result add(SaveCustomerRequest saveCustomerRequest); Result add(SaveCustomerRequest saveCustomerRequest, HttpServletRequest req);
} }
\ No newline at end of file
...@@ -3,6 +3,7 @@ package com.jz.manage.moduls.service.impl; ...@@ -3,6 +3,7 @@ package com.jz.manage.moduls.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.jz.common.bean.MallCustomerApiDto;
import com.jz.common.bean.PageInfoResponse; import com.jz.common.bean.PageInfoResponse;
import com.jz.common.constant.Constants; import com.jz.common.constant.Constants;
import com.jz.common.constant.ResultCode; import com.jz.common.constant.ResultCode;
...@@ -10,11 +11,13 @@ import com.jz.common.exception.ResponseException; ...@@ -10,11 +11,13 @@ import com.jz.common.exception.ResponseException;
import com.jz.common.utils.DateUtils; import com.jz.common.utils.DateUtils;
import com.jz.common.utils.Result; import com.jz.common.utils.Result;
import com.jz.common.utils.SessionUtils;
import com.jz.manage.moduls.controller.customer.bean.dto.CompanyDetailsDto; import com.jz.manage.moduls.controller.customer.bean.dto.CompanyDetailsDto;
import com.jz.manage.moduls.controller.customer.bean.dto.EnterpriseAuditDto; import com.jz.manage.moduls.controller.customer.bean.dto.EnterpriseAuditDto;
import com.jz.manage.moduls.controller.customer.bean.request.EnterpriseAuditRequest; import com.jz.manage.moduls.controller.customer.bean.request.EnterpriseAuditRequest;
import com.jz.manage.moduls.controller.customer.bean.request.SaveCustomerRequest; import com.jz.manage.moduls.controller.customer.bean.request.SaveCustomerRequest;
import com.jz.manage.moduls.controller.sys.bean.SysUserDto;
import com.jz.manage.moduls.entity.Department; import com.jz.manage.moduls.entity.Department;
import com.jz.manage.moduls.entity.FinanceCustomerAssets; import com.jz.manage.moduls.entity.FinanceCustomerAssets;
import com.jz.manage.moduls.entity.FinanceCustomerBalance; import com.jz.manage.moduls.entity.FinanceCustomerBalance;
...@@ -113,7 +116,7 @@ public class DepartmentServiceImpl implements DepartmentService { ...@@ -113,7 +116,7 @@ public class DepartmentServiceImpl implements DepartmentService {
*/ */
@Override @Override
@Transactional @Transactional
public void audit(Long id) { public void audit(Long id ,HttpServletRequest req) {
QueryWrapper queryWrapper = new QueryWrapper(); QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("department_id", id); queryWrapper.eq("department_id", id);
// 获取企业详细信息 // 获取企业详细信息
...@@ -121,21 +124,21 @@ public class DepartmentServiceImpl implements DepartmentService { ...@@ -121,21 +124,21 @@ public class DepartmentServiceImpl implements DepartmentService {
// if (department.getAuditStatus().equals("02") ) { // if (department.getAuditStatus().equals("02") ) {
// throw ResponseException.of(ResultCode.FAILURE, "已审核!不用在审核!"); // throw ResponseException.of(ResultCode.FAILURE, "已审核!不用在审核!");
// } // }
// 从session获取商城用户id // 从session获取平台用户id
SysUserDto sysUser = (SysUserDto) SessionUtils.getUserCurrent(req, "sysUser");
// 更新信息: 将企业审核状态改为已审核,企业信息更新 // 更新信息: 将企业审核状态改为已审核,企业信息更新
department.setAuditStatus("02"); department.setAuditStatus("02");
department.setAuditPerson("1"); department.setAuditPerson(sysUser.getUserId() + "");
department.setAuditTime(DateUtils.getToday()); department.setAuditTime(DateUtils.getToday());
department.setUptTime(DateUtils.getToday()); department.setUptTime(DateUtils.getToday());
department.setUptPerson(department.getUptPerson()); department.setUptPerson(sysUser.getUserId()+ "");
tDepartmentDao.updateById(department); tDepartmentDao.updateById(department);
// 新增企业客户资产 // 新增企业客户资产
FinanceCustomerAssets financeCustomerAssets = new FinanceCustomerAssets(); FinanceCustomerAssets financeCustomerAssets = new FinanceCustomerAssets();
financeCustomerAssets.setDepartmentId(department.getDepartmentId()); financeCustomerAssets.setDepartmentId(department.getDepartmentId());
financeCustomerAssets.setCreTime(DateUtils.getToday()); financeCustomerAssets.setCreTime(DateUtils.getToday());
financeCustomerAssets.setCrePerson("1"); financeCustomerAssets.setCrePerson(sysUser.getUserId() + "");
financeCustomerAssetsDao.insert(financeCustomerAssets); financeCustomerAssetsDao.insert(financeCustomerAssets);
} }
...@@ -147,15 +150,16 @@ public class DepartmentServiceImpl implements DepartmentService { ...@@ -147,15 +150,16 @@ public class DepartmentServiceImpl implements DepartmentService {
*/ */
@Override @Override
@Transactional() @Transactional()
public Result add(SaveCustomerRequest saveCustomerReq) { public Result add(SaveCustomerRequest saveCustomerReq, HttpServletRequest req) {
// 校验信息 // 校验信息
Result s = userCheck(saveCustomerReq); Result s = userCheck(saveCustomerReq);
boolean success = s.isSuccess(); boolean success = s.isSuccess();
if (!success) { if (!success) {
return Result.error("添加用户失败!"); return Result.error("添加用户失败!");
} }
SysUserDto sysUser = (SysUserDto) SessionUtils.getUserCurrent(req, "sysUser");
// 保存企业信息 // 保存企业信息
Long departmentId = saveCompany(saveCustomerReq); Long departmentId = saveCompany(saveCustomerReq, req);
if (departmentId != null) { if (departmentId != null) {
// 保存账号信息 // 保存账号信息
MallCustomer mallCustomer = new MallCustomer(); MallCustomer mallCustomer = new MallCustomer();
...@@ -165,10 +169,9 @@ public class DepartmentServiceImpl implements DepartmentService { ...@@ -165,10 +169,9 @@ public class DepartmentServiceImpl implements DepartmentService {
mallCustomer.setPassword(saveCustomerReq.getPassword()); mallCustomer.setPassword(saveCustomerReq.getPassword());
mallCustomer.setCreTime(DateUtils.getToday()); mallCustomer.setCreTime(DateUtils.getToday());
mallCustomer.setCustomerPoint(0L); mallCustomer.setCustomerPoint(0L);
mallCustomer.setCrePerson("1"); mallCustomer.setCrePerson(sysUser.getUserId()+"");
mallCustomer.setDelFlag("N"); mallCustomer.setDelFlag("N");
mallCustomerDao.insert(mallCustomer); mallCustomerDao.insert(mallCustomer);
System.out.println(mallCustomer.getCustomerId());
// 如果充值金额不为空 // 如果充值金额不为空
if (saveCustomerReq.getBalanceMoney() != null) { if (saveCustomerReq.getBalanceMoney() != null) {
...@@ -214,10 +217,11 @@ public class DepartmentServiceImpl implements DepartmentService { ...@@ -214,10 +217,11 @@ public class DepartmentServiceImpl implements DepartmentService {
* 保存企业信息 * 保存企业信息
* @param saveCustomerReq * @param saveCustomerReq
*/ */
private Long saveCompany(SaveCustomerRequest saveCustomerReq) { private Long saveCompany(SaveCustomerRequest saveCustomerReq, HttpServletRequest req) {
Department department = new Department(); Department department = new Department();
SysUserDto sysUser = (SysUserDto) SessionUtils.getUserCurrent(req, "sysUser");
// 添加创建人/创建时间 // 添加创建人/创建时间
department.setCrePerson("1"); department.setCrePerson(sysUser.getUserId() + "");
department.setCreTime(DateUtils.getToday()); department.setCreTime(DateUtils.getToday());
// 基本信息 // 基本信息
department.setDepartmentName(saveCustomerReq.getDepartmentName()); department.setDepartmentName(saveCustomerReq.getDepartmentName());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment