Commit 05951075 authored by zhangc's avatar zhangc

commit 添加日志想关接口

parent d13d83a6
package com.jz.common.utils;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.jz.common.constant.CommonConstant;
import com.jz.common.constant.ResultCode;
import com.jz.common.constant.ResultMsg;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -16,8 +19,8 @@ import java.io.Serializable;
*/
@Data
@ApiModel(value = "接口返回对象", description = "接口返回对象")
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Result<T> implements Serializable {
private static final long serialVersionUID = 1L;
/**
......@@ -30,19 +33,19 @@ public class Result<T> implements Serializable {
* 返回处理消息
*/
@ApiModelProperty(value = "返回处理消息")
private String message = "操作成功!";
private String message;
/**
* 返回代码
*/
@ApiModelProperty(value = "返回代码")
private Integer code = 200;
private Integer code ;
/**
* 返回数据对象 data
*/
@ApiModelProperty(value = "返回数据对象")
private T result;
private T data;
/**
* 时间戳
......@@ -50,66 +53,92 @@ public class Result<T> implements Serializable {
@ApiModelProperty(value = "时间戳")
private long timestamp = System.currentTimeMillis();
public Result() {
}
public Result<T> success(String message) {
this.message = message;
this.code = CommonConstant.SC_OK_200;
this.success = true;
return this;
private Result(Integer code) {
this.code = code;
}
public static long getSerialVersionUID() {
return serialVersionUID;
/**
* 构造函数
* @param code 操作代码
* @param data 数据对象
*/
private Result(Integer code, T data) {
this(code);
this.data = data;
}
public boolean isSuccess() {
return success;
/**
* 构造函数
*
* @param code
* 操作代码
* @param data
* 数据对象
* @param msg
* 提示消息
*/
private Result(Integer code, T data, ResultMsg msg) {
this(code, data);
this.message = msg.getMsg();
}
public void setSuccess(boolean success) {
this.success = success;
public Result setMsg(ResultMsg msg) {
this.message = msg.getMsg();
return this;
}
public String getMessage() {
return message;
public Result setMsg(String msg) {
this.message = msg;
return this;
}
/**
* 构造函数
*
* @param code
* 操作代码
* @param data
* 数据对象
* @param msg
* 提示消息
*/
public void setMessage(String message) {
this.message = message;
private Result(Integer code, T data, String msg) {
this(code, data);
this.message = msg;
}
public Integer getCode() {
return code;
/**new Add*/
public Result() {
this.code = ResultCode.SUCCESS.getCode();
}
public void setCode(Integer code) {
this.code = code;
public static Result of_success(ResultMsg msg,Object data) {
Result resultJson = new Result(ResultCode.SUCCESS.getCode(),data,msg);
return resultJson;
}
public T getResult() {
return result;
public static Result of_success(Object data) {
Result resultJson = new Result(ResultCode.SUCCESS.getCode(),data);
resultJson.setMessage(ResultMsg.SUCCESS.getMsg());
return resultJson;
}
public void setResult(T result) {
this.result = result;
public static Result of_success(ResultMsg msg) {
Result resultJson = new Result(ResultCode.SUCCESS.getCode(),null,msg);
return resultJson;
}
public long getTimestamp() {
return timestamp;
public static Result of_error(ResultMsg msg) {
Result resultJson = new Result(ResultCode.FAILURE.getCode(),null,msg);
return resultJson;
}
public void setTimestamp(long timestamp) {
this.timestamp = timestamp;
public static Result of_error(Object data) {
Result resultJson = new Result(ResultCode.FAILURE.getCode(),data);
return resultJson;
}
@Deprecated
public static Result of_error(String msg) {
Result resultJson = new Result(ResultCode.FAILURE.getCode(),null,msg);
return resultJson;
}
public Result(boolean success, String message) {
this.success = success;
this.message = message;
}
public Result(boolean success, String message, Integer code) {
this.success = success;
this.message = message;
......@@ -120,14 +149,14 @@ public class Result<T> implements Serializable {
this.success = success;
this.message = message;
this.code = code;
this.result = result;
this.data = result;
}
public Result(boolean success, String message, Integer code, T result, long timestamp) {
this.success = success;
this.message = message;
this.code = code;
this.result = result;
this.data = result;
this.timestamp = timestamp;
}
......@@ -151,7 +180,7 @@ public class Result<T> implements Serializable {
Result<Object> r = new Result<Object>();
r.setSuccess(true);
r.setCode(CommonConstant.SC_OK_200);
r.setResult(data);
r.setData(data);
return r;
}
......@@ -173,5 +202,11 @@ public class Result<T> implements Serializable {
this.success = false;
return this;
}
public Result<T> success(String message) {
this.message = message;
this.code = CommonConstant.SC_OK_200;
this.success = true;
return this;
}
}
......@@ -4,6 +4,7 @@ import com.aliyuncs.http.HttpRequest;
import com.jz.common.entity.Department;
import com.jz.common.utils.Result;
import com.jz.dm.mall.moduls.controller.company.bean.CompanyAddReq;
import com.jz.dm.mall.moduls.controller.company.bean.CompanyUpdateReq;
import com.jz.dm.mall.moduls.entity.MallCustomer;
import com.jz.dm.mall.moduls.service.CompanyAuthService;
import io.swagger.annotations.Api;
......@@ -59,4 +60,24 @@ public class CompanyAuthController {
return Result.ok(companyAuthService.selectCompany(type));
});
}
/**
* @Description: 企业认证信息更新
* @Author: Mr.zhang
* @Date: 2020-12-2
*/
@GetMapping("/updateCompany")
@ApiOperation(value = "企业认证信息更新")
public Mono<Result> updateCompany(@RequestBody @Validated CompanyUpdateReq req) {
return Mono.fromSupplier(() ->companyAuthService.updateCompanyInfo(req));
}
/**
* @Description: 企业认证信息更新
* @Author: Mr.zhang
* @Date: 2020-12-2
*/
@GetMapping("/checkCompany")
@ApiOperation(value = "企业认证信息校验")
public Mono<Result> checkCompany() {
return Mono.fromSupplier(() ->companyAuthService.checkCompanyInfo());
}
}
package com.jz.dm.mall.moduls.controller.company.bean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.mall.moduls.controller.company.bean
* @PROJECT_NAME: jz-dm-parent
* @NAME: CompanyUpdateReq
* @USER: key
* @DATE: 2020-12-3/15:32
* @DAY_NAME_SHORT: 周四
* @Description:
**/
@Data
@ApiModel
public class CompanyUpdateReq implements Serializable {
@ApiModelProperty(name = "企业ID",required = true)
@NotNull(message = "企业Id不能为空")
private Long departmentId;
@ApiModelProperty(name = "企业名称",required = true)
@NotNull(message = "企业名称不能为空")
private String departmentName;
@ApiModelProperty(name = "省",required = true)
@NotNull(message = "省信息不能为空")
private String province;
@ApiModelProperty(name = "市",required = true)
@NotNull(message = "市信息不能为空")
private String city;
@ApiModelProperty(name = "公司详细地址",required = true)
@NotNull(message = "公司详细地址不能为空")
private String registeredAddress;
@ApiModelProperty(name = "统一社会编码",required = true)
@NotNull(message = "统一社会编码不能忍为空")
private String unifiedCreditCode;
@ApiModelProperty(name = "营业执照照片",required = true)
@NotNull(message = "营业执照照片不能忍为空")
private String businessLicense;
@ApiModelProperty(name = "开户银行",required = true)
@NotNull(message = "开户银行不能为空")
private String bankName;
@ApiModelProperty(name = "银行账户",required = true)
@NotNull(message = "银行账户不能忍为空")
private String bankCardNumber;
@ApiModelProperty(name = "联系人名称",required = true)
@NotNull(message = "联系人名称不能为空")
private String linkman;
@ApiModelProperty(name = "联系人电话",required = true)
@NotNull(message = "联系人电话不能为空")
private String telephone;
@ApiModelProperty(name = "登录用户id",hidden = true)
private Long customerId;
@ApiModelProperty(name = "登录用户名称",hidden = true)
private String loginName;
}
package com.jz.dm.mall.moduls.controller.company.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.mall.moduls.controller.company.dto
* @PROJECT_NAME: jz-dm-parent
* @NAME: CompanyInfoDto
* @USER: key
* @DATE: 2020-12-3/15:23
* @DAY_NAME_SHORT: 周四
* @Description:
**/
@Data
@ApiModel
public class CompanyInfoDto implements Serializable {
@ApiModelProperty(value = "企业名称")
private String departmentName;
@ApiModelProperty(value = "注册地址")
private String registeredAddress;
@ApiModelProperty(value = "营业执照链接")
private String businessLicense;
@ApiModelProperty(value = "开户行")
private String bankName;
@ApiModelProperty(value = "企业名称")
private String bankCardNumber;
@ApiModelProperty(value = "联系人")
private String linkman;
@ApiModelProperty(value = "联系人手机号")
private String telephone;
@ApiModelProperty(value = "企业自增ID")
private String departmentId;
@ApiModelProperty(value = "审核状态:01待审核,02已审核,03未通过")
private String auditStatus;
}
package com.jz.dm.mall.moduls.controller.customer;
import com.jz.common.utils.Result;
import com.jz.dm.mall.moduls.controller.company.bean.CompanyAddReq;
import com.jz.dm.mall.moduls.service.PersonalUserControllerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import reactor.core.publisher.Mono;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.mall.moduls.controller.customer
* @PROJECT_NAME: jz-dm-parent
* @NAME: PersonalUserController
* @USER: key
* @DATE: 2020-12-3/18:01
* @DAY_NAME_SHORT: 周四
* @Description:
**/
@RestController
@RequestMapping("/personalUser")
@Api(tags = "用户信息controller")
public class PersonalUserController {
@Autowired
private PersonalUserControllerService personalUserControllerService;
/**
* @Description: 查询个人信息
* @Author: Mr.zhang
* @Date: 2020-12-2
*/
@PostMapping("/getPersonalInfo")
@ApiOperation(value = "查询个人信息")
public Mono<Result> getUserInfo() {
return Mono.fromSupplier(() -> personalUserControllerService.getUserInfo());
}
/**
* @Description: 修改用户密码
* @Author: Mr.zhang
* @Date: 2020-12-2
*/
@PostMapping("/updatePassWard")
@ApiOperation(value = "修改用户密码")
public Mono<Result> updateUserPassWard(@RequestParam(value = "oldPassWard") String oldPassWard,
@RequestParam(value = "newPassWard") String newPassWard) {
return Mono.fromSupplier(() -> personalUserControllerService.updateUserPassWard(oldPassWard,newPassWard));
}
}
package com.jz.dm.mall.moduls.controller.log;
import com.jz.common.bean.PageInfoResponse;
import com.jz.common.entity.PlatformLog;
import com.jz.common.utils.Result;
import com.jz.dm.mall.moduls.controller.company.bean.CompanyAddReq;
import com.jz.dm.mall.moduls.controller.log.bean.LogInfoQueryReq;
import com.jz.dm.mall.moduls.controller.order.bean.OrderDto;
import com.jz.dm.mall.moduls.service.LogInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Mono;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.mall.moduls.controller.log
* @PROJECT_NAME: jz-dm-parent
* @NAME: LogInfoController
* @USER: key
* @DATE: 2020-12-3
* @DAY_NAME_SHORT: 周四
* @Description:
**/
@RestController
@RequestMapping("/logInfo")
@Api(tags = "日志信息controller")
public class LogInfoController {
@Autowired
private LogInfoService logInfoService;
/**
* @Description: 添加企业认证信息
* @Author: Mr.zhang
* @Date: 2020-12-2
*/
@PostMapping("/getMallLogInfo")
@ApiOperation(value = "获取商城用户日志信息")
public Mono<Result<PageInfoResponse<PlatformLog>>> getLogInfo(@RequestBody @Validated LogInfoQueryReq req) {
return Mono.fromSupplier(() -> logInfoService.getMallUserLogInfo(req));
}
}
package com.jz.dm.mall.moduls.controller.log.bean;
import com.jz.common.bean.BasePageBean;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import java.io.Serializable;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.mall.moduls.controller.log.bean
* @PROJECT_NAME: jz-dm-parent
* @NAME: LogInfoQueryReq
* @USER: key
* @DATE: 2020-12-3/19:05
* @DAY_NAME_SHORT: 周四
* @Description:
**/
@Data
@ApiModel
public class LogInfoQueryReq extends BasePageBean implements Serializable {
}
......@@ -64,7 +64,7 @@ public class OrderController {
Result<OrderDto> result = new Result<OrderDto>();
if (StringUtils.isNotEmpty(orderId)) {
OrderDto orderDto = orderService.getOrderDetail(orderId);
result.setResult(orderDto);
result.setData(orderDto);
} else {
result.setMessage("参数为不能为空!");
}
......@@ -91,7 +91,7 @@ public class OrderController {
}
//查询接口文档 和参数信息
Map dataGoodsApi = orderService.getApiInterfaceDetail(params);
result.setResult(dataGoodsApi);
result.setData(dataGoodsApi);
return result;
}
}
\ No newline at end of file
......@@ -75,12 +75,24 @@ public class MallCustomer implements Serializable {
* 更新时间
*/
private Date uptTime;
/**
* 更新人
*/
private String uptPerson;
/**
* 删除标识:Y是,N否
*/
private String delFlag;
public String getUptPerson() {
return uptPerson;
}
public void setUptPerson(String uptPerson) {
this.uptPerson = uptPerson;
}
public Long getCustomerId() {
return customerId;
}
......
......@@ -3,6 +3,10 @@ package com.jz.dm.mall.moduls.mapper;
import com.jz.common.base.BaseMapper;
import com.jz.common.entity.Department;
import com.jz.dm.mall.moduls.controller.company.bean.CompanyAddReq;
import com.jz.dm.mall.moduls.controller.company.dto.CompanyInfoDto;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select;
/**
* 企业(TDepartment)表数据库访问层
......@@ -18,4 +22,20 @@ public interface DepartmentDao extends BaseMapper<Department> {
* @return
*/
Department selectDepartmentData(CompanyAddReq req);
/**
* 查询企业状态
* @param departmentId
* @return
*/
@Select("select audit_status AS auditStatus from t_department where department_id =#{departmentId} and del_flag ='N'")
@ResultType(String.class)
String selectCompanyStatus(Long departmentId);
/**
* 根据企业ID查询企业信息
* @param departmentId
* @return
*/
CompanyInfoDto selectCompanyDetail(@Param("departmentId") Long departmentId);
}
\ No newline at end of file
package com.jz.dm.mall.moduls.mapper;
import com.jz.common.base.BaseMapper;
import com.jz.common.entity.PlatformLog;
import com.jz.dm.mall.moduls.controller.order.bean.OrderDto;
import java.util.List;
/**
* 日志管理(TPlatformLog)表数据库访问层
*
* @author Bellamy
* @since 2020-12-01 10:41:42
*/
public interface PlatformLogDao extends BaseMapper<PlatformLog> {
/**
* 查询商城用户日志列表
* @param customerId
* @return
*/
List<PlatformLog> listMallLogInfo(Long customerId);
}
\ No newline at end of file
......@@ -3,6 +3,7 @@ package com.jz.dm.mall.moduls.service;
import com.jz.common.entity.Department;
import com.jz.dm.mall.moduls.controller.company.bean.CompanyAddReq;
import com.jz.common.utils.Result;
import com.jz.dm.mall.moduls.controller.company.bean.CompanyUpdateReq;
/**
* @author ZC
......@@ -27,7 +28,20 @@ public interface CompanyAuthService {
* @param type
* @return
*/
Result<Department> selectCompany(String type);
Result selectCompany(String type);
/**
* 更新企业信息
* @param req
* @return
*/
Result updateCompanyInfo(CompanyUpdateReq req);
/**
* 校验当前用户是否已经企业认证
* @return
*/
Result checkCompanyInfo();
}
package com.jz.dm.mall.moduls.service;
import com.jz.common.bean.PageInfoResponse;
import com.jz.common.entity.PlatformLog;
import com.jz.common.utils.Result;
import com.jz.dm.mall.moduls.controller.log.bean.LogInfoQueryReq;
import com.jz.dm.mall.moduls.controller.order.bean.OrderDto;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.mall.moduls.service
* @PROJECT_NAME: jz-dm-parent
* @NAME: LogInfoService
* @USER: key
* @DATE: 2020-12-3/18:59
* @DAY_NAME_SHORT: 周四
* @Description:
**/
public interface LogInfoService {
/**
* 获取用户调用日志列表
* @param req
* @return
*/
Result<PageInfoResponse<PlatformLog>> getMallUserLogInfo(LogInfoQueryReq req);
}
package com.jz.dm.mall.moduls.service;
import com.jz.common.utils.Result;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.mall.moduls.service
* @PROJECT_NAME: jz-dm-parent
* @NAME: PersonalUserControllerService
* @USER: key
* @DATE: 2020-12-3/18:04
* @DAY_NAME_SHORT: 周四
* @Description:
**/
public interface PersonalUserControllerService {
/**
* 获取登录用户信息
* @return
*/
Result getUserInfo();
/**
* 修改用户密码
* @param oldPassWard
* @param newPassWard
* @return
*/
Result updateUserPassWard(String oldPassWard, String newPassWard);
}
package com.jz.dm.mall.moduls.service.impl;
import com.jz.common.constant.ResultCode;
import com.jz.common.constant.ResultMsg;
import com.jz.common.entity.Department;
import com.jz.common.exception.ResponseException;
import com.jz.dm.mall.moduls.controller.company.bean.CompanyUpdateReq;
import com.jz.dm.mall.moduls.controller.company.dto.CompanyInfoDto;
import com.jz.dm.mall.moduls.entity.FinanceCustomerAssets;
import com.jz.dm.mall.moduls.entity.MallCustomer;
import com.jz.common.utils.Result;
......@@ -40,6 +44,7 @@ public class CompanyAuthServiceImpl implements CompanyAuthService {
private FinanceCustomerAssetsDao financeCustomerAssetsDao;
@Resource
private MallCustomerDao mallCustomerDao;
/**
* 添加企业认证
*
......@@ -47,54 +52,123 @@ public class CompanyAuthServiceImpl implements CompanyAuthService {
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class,propagation = Propagation.REQUIRES_NEW)
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
public Result addCompanyData(CompanyAddReq req) {
//TODO 获取当前用户ID判断当前用户是否已经关联企业
// Long customerId = (Long) UserContextUtil.pop("customer_id");
Long customerId = 0L;
if (null ==customerId){
return Result.error("获取用户信息失败");
if (null == customerId) {
return Result.of_error(ResultMsg.USER_NOT_EXIST);
}
MallCustomer mallCustomer = mallCustomerDao.findById(customerId);
if (null == mallCustomer){
return Result.error("用户信息不存在");
if (null == mallCustomer) {
return Result.of_error(ResultMsg.USER_NOT_EXIST);
}
if (null != mallCustomer.getDepartmentId()){
return Result.error("用户已关联企业,请勿重复操作");
if (null != mallCustomer.getDepartmentId()) {
return Result.of_error("用户已关联企业,请勿重复操作");
}
req.setCustomerId(mallCustomer.getCustomerId());
if (StringUtils.isNotBlank(req.getDepartmentName()) &&
StringUtils.isNotBlank(req.getUnifiedCreditCode())) { //企业名称 && 营业执照
Department department = departmentDao.selectDepartmentData(req);
if (null != department) {
return Result.error("企业用户信息已存在");
return Result.of_error("企业用户信息已存在");
}
}
insetCompany(req);
return Result.ok("添加企业用户成功");
return Result.of_success(ResultMsg.SUCCESS);
}
/**
* 查询企业认证详情
*
* @param type
* @return
*/
@Override
public Result<Department> selectCompany(String type) {
//查询用户判断用户是否认证
// Long customerId = (Long) UserContextUtil.pop("customer_id");
// if (null ==customerId){
// return Result.error("获取用户信息失败");
// }
// MallCustomer mallCustomer = mallCustomerDao.findById(customerId);
// if (null == mallCustomer){
// return Result.error("用户信息不存在");
// }
public Result selectCompany(String type) {
// TODO 查询用户判断用户是否认证
MallCustomer currentUser = getCurrentUser(0L);
if (null == currentUser) {
return Result.error("当前用户信息不存在");
}
if (StringUtils.equals(type, "STATUS")) {//状态
String auditStatus = departmentDao.selectCompanyStatus(currentUser.getDepartmentId());
return Result.of_success(auditStatus);
} else if (StringUtils.equals(type, "DETAIL")) {//详情
CompanyInfoDto department = departmentDao.selectCompanyDetail(currentUser.getDepartmentId());
return Result.of_success(department);
}
return Result.of_error("查询企业信息异常");
}
/**
* 获取登录用户信息
*
* @param customerId
* @return
*/
private MallCustomer getCurrentUser(Long customerId) {
try {
MallCustomer mallCustomer = mallCustomerDao.findById(customerId);
if (null != mallCustomer) {
return mallCustomer;
}
} catch (Exception e) {
log.error("用户:" + customerId + "信息不存在~~~~~~~~~~");
}
return null;
}
/**
* 更新企业信息
*
* @param req
* @return
*/
@Override
public Result updateCompanyInfo(CompanyUpdateReq req) {
Long coustomId = 0L;
MallCustomer currentUser = getCurrentUser(req.getCustomerId());
if (null == currentUser) {
return Result.of_error(ResultMsg.USER_NOT_EXIST);
}
if (!req.getDepartmentId().equals(coustomId)) {
return Result.of_error("更新企业用户信息与绑定企业信息不一致");
}
Department department = new Department();
department.setUptTime(new Date());
department.setUptPerson(req.getLoginName());
BeanUtils.copyProperties(req, department);
if (departmentDao.updateById(department) != 1) {
throw ResponseException.of_error("更新企业信息失败");
}
return Result.of_success(ResultMsg.UPDATE_SUCCESS);
}
/**
* 校验用户是否已经企业认证
*
* @return
*/
@Override
public Result checkCompanyInfo() {
//Todo 获取当前登录用户
Long customId = 0L;
MallCustomer currentUser = getCurrentUser(customId);
if (null == currentUser) {
return Result.of_success(ResultMsg.USER_NOT_EXIST);
}
CompanyInfoDto companyInfoDto = departmentDao.selectCompanyDetail(currentUser.getDepartmentId());
if (null != companyInfoDto && "02".equals(companyInfoDto.getAuditStatus())) {
return Result.of_success("用户已进行企业认证");
}
return Result.of_success("用户未进行企业认证");
}
/**
* 保存企业信息
*
* @param req
*/
private void insetCompany(CompanyAddReq req) {
......@@ -103,8 +177,8 @@ public class CompanyAuthServiceImpl implements CompanyAuthService {
departmentInset.setAuditStatus("01");//待审核
departmentInset.setCreTime(new Date());
departmentInset.setCrePerson(req.getLoginName());
BeanUtils.copyProperties(req,departmentInset);
if (departmentDao.insert(departmentInset) != 1){
BeanUtils.copyProperties(req, departmentInset);
if (departmentDao.insert(departmentInset) != 1) {
throw ResponseException.of_error("保存企业信息失败");
}
//初始化用户资产表
......@@ -112,7 +186,7 @@ public class CompanyAuthServiceImpl implements CompanyAuthService {
finance.setDepartmentId(departmentInset.getDepartmentId());//企业ID
finance.setCreTime(new Date());
finance.setCrePerson(req.getLoginName());
if (financeCustomerAssetsDao.insert(finance) != 1){
if (financeCustomerAssetsDao.insert(finance) != 1) {
throw ResponseException.of_error("初始化用户资产失败");
}
//更新用户企业信息
......@@ -120,8 +194,8 @@ public class CompanyAuthServiceImpl implements CompanyAuthService {
mallCustomer.setCustomerId(req.getCustomerId());//用户ID
mallCustomer.setDepartmentId(departmentInset.getDepartmentId());
mallCustomer.setUptTime(new Date());
// mallCustomer.setUptPerson(req.getLoginName());
if (mallCustomerDao.updateById(mallCustomer) != 1){
mallCustomer.setUptPerson(req.getLoginName());
if (mallCustomerDao.updateById(mallCustomer) != 1) {
throw ResponseException.of_error("更新用户企业信息失败");
}
}
......
package com.jz.dm.mall.moduls.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jz.common.bean.PageInfoResponse;
import com.jz.common.constant.Constants;
import com.jz.common.constant.ResultCode;
import com.jz.common.constant.ResultMsg;
import com.jz.common.entity.PlatformLog;
import com.jz.common.utils.Result;
import com.jz.dm.mall.moduls.controller.log.bean.LogInfoQueryReq;
import com.jz.dm.mall.moduls.controller.order.bean.OrderDto;
import com.jz.dm.mall.moduls.entity.MallCustomer;
import com.jz.dm.mall.moduls.mapper.MallCustomerDao;
import com.jz.dm.mall.moduls.mapper.PlatformLogDao;
import com.jz.dm.mall.moduls.service.LogInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.mall.moduls.service.impl
* @PROJECT_NAME: jz-dm-parent
* @NAME: LogInfoServiceImpl
* @USER: key
* @DATE: 2020-12-3/19:00
* @DAY_NAME_SHORT: 周四
* @Description:
**/
@Slf4j
@Service("logInfoService")
public class LogInfoServiceImpl implements LogInfoService {
@Resource
private PlatformLogDao platformLogDao;
@Resource
private MallCustomerDao mallCustomerDao;
@Override
public Result<PageInfoResponse<PlatformLog>> getMallUserLogInfo(LogInfoQueryReq req) {
Long customerId =0L;
if (null == customerId) {
return Result.of_error(ResultMsg.USER_NOT_EXIST);
}
MallCustomer mallCustomer = mallCustomerDao.findById(customerId);
if (null == mallCustomer) {
return Result.of_error(ResultMsg.USER_NOT_EXIST);
}
PageInfoResponse<PlatformLog> pageInfoResponse = new PageInfoResponse<>();
PageHelper.startPage(req.getPageNum(), req.getPageSize());
List<PlatformLog> list = platformLogDao.listMallLogInfo(mallCustomer.getCustomerId());
PageInfo<PlatformLog> pageInfo = new PageInfo<>(list);
pageInfoResponse.setCode(Constants.SUCCESS_CODE);
pageInfoResponse.setMessage(ResultMsg.SUCCESS.getMsg());
pageInfoResponse.setData(pageInfo);
return Result.of_success(pageInfoResponse);
}
}
package com.jz.dm.mall.moduls.service.impl;
import com.jz.common.constant.ResultMsg;
import com.jz.common.utils.Result;
import com.jz.dm.mall.moduls.entity.MallCustomer;
import com.jz.dm.mall.moduls.mapper.MallCustomerDao;
import com.jz.dm.mall.moduls.service.PersonalUserControllerService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.mall.moduls.service.impl
* @PROJECT_NAME: jz-dm-parent
* @NAME: PersonalUserControllerServiceImpl
* @USER: key
* @DATE: 2020-12-3/18:04
* @DAY_NAME_SHORT: 周四
* @Description:
**/
@Service("personalUserControllerService")
@Slf4j
public class PersonalUserControllerServiceImpl implements PersonalUserControllerService {
@Resource
private MallCustomerDao mallCustomerDao;
@Override
public Result getUserInfo() {
Long customId =0L;
MallCustomer mallCustomer = mallCustomerDao.findById(customId);
if (null == mallCustomer){
return Result.of_error(ResultMsg.USER_NOT_EXIST);
}
return Result.of_success(mallCustomer);
}
/**
* 修改用户密码
* @param oldPassWard
* @param newPassWard
* @return
*/
@Override
public Result updateUserPassWard(String oldPassWard, String newPassWard) {
Long customId =0L;
MallCustomer mallCustomer = mallCustomerDao.findById(customId);
if (null == mallCustomer){
return Result.of_error(ResultMsg.USER_NOT_EXIST);
}
if (!oldPassWard.equals(mallCustomer.getPassword())){
return Result.of_error("旧密码错误");
}
MallCustomer customer = new MallCustomer();
customer.setCustomerId(mallCustomer.getCustomerId());
customer.setPassword(newPassWard);
customer.setUptPerson(mallCustomer.getCustomerName());
customer.setUptTime(new Date());
if (mallCustomerDao.updateById(customer) != 1){
return Result.of_error(ResultMsg.UPDATE_FAIL);
}
return Result.of_success(ResultMsg.UPDATE_SUCCESS);
}
}
......@@ -54,4 +54,19 @@
</if>
</select>
<select id="selectCompanyDetail" resultType="com.jz.dm.mall.moduls.controller.company.dto.CompanyInfoDto">
SELECT
department_id AS departmentId,
audit_status AS auditStatus,
department_name AS departmentName,
registered_address AS registeredAddress,
business_license AS businessLicense,
bank_name AS bankName,
brank_card_number AS bankCardNumber,
linkman AS linkman,
telephone AS telephone
FROM t_department
WHERE department_id=#{departmentId} AND del_flag ='N'
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jz.dm.mall.moduls.mapper.PlatformLogDao">
</mapper>
\ No newline at end of file
......@@ -41,7 +41,7 @@ public class TestUserController extends BaseController {
Result<IPage<User>> result = new Result<IPage<User>>();
IPage<User> pageList = testUserService.queryPage(new Page<User>(1, 2), event);
result.setSuccess(true);
result.setResult(pageList);
result.setData(pageList);
return result;
}
......@@ -51,7 +51,7 @@ public class TestUserController extends BaseController {
Result<IPage<Map>> result = new Result<IPage<Map>>();
IPage<Map> pageList = testUserService.queryListPage(new Page<Map>(1, 2), event);
result.setSuccess(true);
result.setResult(pageList);
result.setData(pageList);
return result;
}
}
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