Commit 7816fad7 authored by 廖旭伟's avatar 廖旭伟

等保三级

parent db0f293e
...@@ -53,16 +53,7 @@ ...@@ -53,16 +53,7 @@
<artifactId>guava</artifactId> <artifactId>guava</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.rabbitmq</groupId>
<artifactId>amqp-client</artifactId>
<version>4.8.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
......
package com.mortals.xhx.system;
import com.alibaba.fastjson.JSON;
import com.mortals.framework.model.AccessLogPdu;
import com.mortals.framework.model.BizLogPdu;
import com.mortals.framework.model.ErrorLogPdu;
import com.mortals.framework.model.OperateLogPdu;
import com.mortals.framework.service.IMessageProduceService;
import com.mortals.xhx.common.keys.QueueKey;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;
@Component
@Primary
@Slf4j
public class MessageProducer implements IMessageProduceService {
@Autowired
private RabbitTemplate rabbitTemplate;
public void syncAccessSend(AccessLogPdu accessLogPdu) {
//new Message(JSON.toJSONString(accessLogPdu).getBytes(StandardCharsets.UTF_8))
//rabbitTemplate.send(QueueKey.EXCHANGE, QueueKey.ACCESS_LOG_QUEUE,new Message(JSON.toJSONString(accessLogPdu).getBytes(StandardCharsets.UTF_8)));
rabbitTemplate.convertAndSend(QueueKey.EXCHANGE, QueueKey.ACCESS_LOG_QUEUE, JSON.toJSONString(accessLogPdu));
//rabbitTemplate.convertAndSend(QueueKey.EXCHANGE, QueueKey.ACCESS_LOG_QUEUE, accessLogPdu);
}
@Override
public void syncBizSend(BizLogPdu bizLogPdu) {
rabbitTemplate.convertAndSend(QueueKey.EXCHANGE, QueueKey.BIZ_LOG_QUEUE, JSON.toJSONString(bizLogPdu));
}
@Override
public void syncErrorSend(ErrorLogPdu errorLogPdu) {
rabbitTemplate.convertAndSend(QueueKey.EXCHANGE, QueueKey.ERROR_LOG_QUEUE, JSON.toJSONString(errorLogPdu));
}
@Override
public void syncOperSend(OperateLogPdu operLogPdu) {
log.info(JSON.toJSONString(operLogPdu));
rabbitTemplate.convertAndSend(QueueKey.EXCHANGE, QueueKey.OPERATION_LOG_QUEUE, JSON.toJSONString(operLogPdu));
}
}
...@@ -4,9 +4,6 @@ import java.util.Date; ...@@ -4,9 +4,6 @@ import java.util.Date;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import com.mortals.framework.model.OperateLogPdu;
import com.mortals.framework.service.IMessageProduceService;
import com.mortals.xhx.system.MessageProducer;
import org.aspectj.lang.JoinPoint; import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning; import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Aspect;
...@@ -16,7 +13,6 @@ import org.slf4j.Logger; ...@@ -16,7 +13,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.context.request.ServletRequestAttributes;
...@@ -34,27 +30,12 @@ public class OperlogAspect extends FileLogServiceImpl implements ILogService { ...@@ -34,27 +30,12 @@ public class OperlogAspect extends FileLogServiceImpl implements ILogService {
@Autowired @Autowired
private OperLogService operLogService; private OperLogService operLogService;
@Autowired
private IMessageProduceService messageProducer;
@Override @Override
public void doHandlerLog(String platformMark, Long userId, String userName, String loginName, String requestUrl, public void doHandlerLog(String platformMark, Long userId, String userName, String loginName, String requestUrl,
String content, String ip, Date logDate) { String content, String ip, Date logDate) {
super.doHandlerLog(platformMark, userId, userName, loginName, requestUrl, content, ip, logDate); super.doHandlerLog(platformMark, userId, userName, loginName, requestUrl, content, ip, logDate);
operLogService.insertOperLog(ip, requestUrl, userId, userName, loginName, content); operLogService.insertOperLog(ip, requestUrl, userId, userName, loginName, content);
OperateLogPdu operateLogPdu = new OperateLogPdu();
operateLogPdu.initAttrValue();
operateLogPdu.setIp(ip);
operateLogPdu.setRequestUrl(requestUrl);
operateLogPdu.setUserId(userId);
operateLogPdu.setUserName(userName);
operateLogPdu.setLoginName(loginName);
operateLogPdu.setPlatformMark(platformMark);
operateLogPdu.setLogDate(logDate);
operateLogPdu.setContent(content);
operateLogPdu.setOperType(1);
messageProducer.syncOperSend(operateLogPdu);
} }
@Override @Override
...@@ -62,8 +43,6 @@ public class OperlogAspect extends FileLogServiceImpl implements ILogService { ...@@ -62,8 +43,6 @@ public class OperlogAspect extends FileLogServiceImpl implements ILogService {
// operLogService.insertOperLog(ip, requestUrl, null, "", loginName, // operLogService.insertOperLog(ip, requestUrl, null, "", loginName,
// content); // content);
this.doHandlerLog(platformMark, null, "", loginName, requestUrl, content, ip, new Date()); this.doHandlerLog(platformMark, null, "", loginName, requestUrl, content, ip, new Date());
} }
@Pointcut("execution(public * com.mortals.xhx..*Controller.*(..))") @Pointcut("execution(public * com.mortals.xhx..*Controller.*(..))")
......
...@@ -27,8 +27,8 @@ import java.util.Map; ...@@ -27,8 +27,8 @@ import java.util.Map;
* @author: zxfei * @author: zxfei
* @date: 2022/4/20 9:24 * @date: 2022/4/20 9:24
*/ */
//@Aspect @Aspect
//@Component @Component
@Slf4j @Slf4j
@Order(1) @Order(1)
@Profile({"default", "develop", "test"}) @Profile({"default", "develop", "test"})
......
...@@ -124,6 +124,11 @@ public class AuthTokenServiceImpl implements IAuthTokenService { ...@@ -124,6 +124,11 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
return siteIds; return siteIds;
} }
@Override
public String getAreaCodes() {
return null;
}
@Override @Override
public Long getCustomerJoinId() { public Long getCustomerJoinId() {
return null; return null;
......
//package com.mortals.xhx.base.framework.security; package com.mortals.xhx.base.framework.security;
//
//import org.springframework.security.core.Authentication;
//import org.springframework.security.core.context.SecurityContextHolder; import org.apache.tomcat.util.net.openssl.ciphers.Authentication;
//import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
//
///** /**
// * 安全服务工具类 * 安全服务工具类
// * *
// * @author zxfei * @author zxfei
// */ */
//public class SecurityUtils { public class SecurityUtils {
//
//
// /** /**
// * 获取Authentication * 获取Authentication
// */ */
// public static Authentication getAuthentication() { public static Authentication getAuthentication() {
// return SecurityContextHolder.getContext().getAuthentication(); return null;
// } }
//
// /** /**
// * 生成BCryptPasswordEncoder密码 * 生成BCryptPasswordEncoder密码
// * *
// * @param password 密码 * @param password 密码
// * @return 加密字符串 * @return 加密字符串
// */ */
// public static String encryptPassword(String password) { public static String encryptPassword(String password) {
// BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
// return passwordEncoder.encode(password); return passwordEncoder.encode(password);
// } }
//
// /** /**
// * 判断密码是否相同 * 判断密码是否相同
// * *
// * @param rawPassword 真实密码 * @param rawPassword 真实密码
// * @param encodedPassword 加密后字符 * @param encodedPassword 加密后字符
// * @return 结果 * @return 结果
// */ */
// public static boolean matchesPassword(String rawPassword, String encodedPassword) { public static boolean matchesPassword(String rawPassword, String encodedPassword) {
// BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
// return passwordEncoder.matches(rawPassword, encodedPassword); return passwordEncoder.matches(rawPassword, encodedPassword);
// } }
//
// /** /**
// * 是否为管理员 * 是否为管理员
// * *
// * @param userId 用户ID * @param userId 用户ID
// * @return 结果 * @return 结果
// */ */
// public static boolean isAdmin(Long userId) { public static boolean isAdmin(Long userId) {
// return userId != null && 1L == userId; return userId != null && 1L == userId;
// } }
//} }
...@@ -2,10 +2,13 @@ package com.mortals.xhx.base.login.web; ...@@ -2,10 +2,13 @@ package com.mortals.xhx.base.login.web;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.IAuthTokenService; import com.mortals.framework.service.IAuthTokenService;
import com.mortals.framework.util.DateUtils; import com.mortals.framework.util.DateUtils;
import com.mortals.framework.util.StringUtils; import com.mortals.framework.util.StringUtils;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.valid.service.ValidCodeService;
import com.mortals.xhx.common.utils.LoginAESUtil;
import com.mortals.xhx.module.customer.model.CustomerEntity; import com.mortals.xhx.module.customer.model.CustomerEntity;
import com.mortals.xhx.module.customer.service.CustomerService; import com.mortals.xhx.module.customer.service.CustomerService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -24,6 +27,11 @@ public class CustomerLoginController extends BaseCRUDJsonBodyMappingController<C ...@@ -24,6 +27,11 @@ public class CustomerLoginController extends BaseCRUDJsonBodyMappingController<C
private CustomerService customerService; private CustomerService customerService;
@Autowired @Autowired
private IAuthTokenService authTokenService; private IAuthTokenService authTokenService;
@Autowired
private ValidCodeService validCodeService;
private static final String AES_KEY = "0000000671595991";
private static final String AES_IV = "tdrdadq59tbss5n7";
@RequestMapping("login") @RequestMapping("login")
public String login(@RequestBody LoginForm loginForm) throws Exception { public String login(@RequestBody LoginForm loginForm) throws Exception {
...@@ -37,9 +45,17 @@ public class CustomerLoginController extends BaseCRUDJsonBodyMappingController<C ...@@ -37,9 +45,17 @@ public class CustomerLoginController extends BaseCRUDJsonBodyMappingController<C
ret.put(KEY_RESULT_MSG, "未获取到用户信息,请重新登录"); ret.put(KEY_RESULT_MSG, "未获取到用户信息,请重新登录");
return ret.toJSONString(); return ret.toJSONString();
} }
if(loginForm.getType()!=null && loginForm.getType()==2){
loginName = LoginAESUtil.decrypt(loginName,AES_KEY,AES_IV,LoginAESUtil.AES_CBC);
password = LoginAESUtil.decrypt(password,AES_KEY,AES_IV,LoginAESUtil.AES_CBC);
}
CustomerEntity customerEntity = null; CustomerEntity customerEntity = null;
try { try {
loginForm.validate(); loginForm.validate();
boolean validCode = validCodeService.doCheckImageValidCode(loginForm.getMark(),super.getRequestIP(request),loginForm.getSecurityCode());
if(!validCode){
throw new AppException("验证码错误");
}
customerEntity = customerService.doLogin(loginName, password, ip); customerEntity = customerService.doLogin(loginName, password, ip);
customerEntity.setLastLoginAddress(ip); customerEntity.setLastLoginAddress(ip);
customerEntity.setLoginTime(System.currentTimeMillis()); customerEntity.setLoginTime(System.currentTimeMillis());
...@@ -62,12 +78,8 @@ public class CustomerLoginController extends BaseCRUDJsonBodyMappingController<C ...@@ -62,12 +78,8 @@ public class CustomerLoginController extends BaseCRUDJsonBodyMappingController<C
} }
@RequestMapping("logout") @RequestMapping("logout")
public String logout() throws Exception { public void logout() throws Exception {
recordSysLog(request, "退出登录"); recordSysLog(request, "退出登录");
super.removeCurrUser(request); super.removeCurrUser(request);
JSONObject ret = new JSONObject();
ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
ret.put(KEY_RESULT_MSG, "用户退出系统成功!");
return ret.toJSONString();
} }
} }
...@@ -4,6 +4,7 @@ import cn.hutool.core.util.IdUtil; ...@@ -4,6 +4,7 @@ import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.ap.GlobalSysInfo; import com.mortals.framework.ap.GlobalSysInfo;
import com.mortals.framework.ap.SysConstains; import com.mortals.framework.ap.SysConstains;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ICacheService; import com.mortals.framework.service.ICacheService;
import com.mortals.framework.service.ITokenService; import com.mortals.framework.service.ITokenService;
import com.mortals.framework.service.IUser; import com.mortals.framework.service.IUser;
...@@ -19,6 +20,7 @@ import com.mortals.xhx.base.system.user.model.UserEntity; ...@@ -19,6 +20,7 @@ import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.base.system.user.service.UserService; import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.base.system.valid.service.ValidCodeService; import com.mortals.xhx.base.system.valid.service.ValidCodeService;
import com.mortals.xhx.common.key.RedisKey; import com.mortals.xhx.common.key.RedisKey;
import com.mortals.xhx.common.utils.LoginAESUtil;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -48,6 +50,9 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi ...@@ -48,6 +50,9 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi
@Autowired @Autowired
private ICacheService cacheService; private ICacheService cacheService;
private static final String AES_KEY = "0000000671595991";
private static final String AES_IV = "tdrdadq59tbss5n7";
private static Log logger = LogFactory.getLog(LoginController.class); private static Log logger = LogFactory.getLog(LoginController.class);
@RequestMapping("login") @RequestMapping("login")
...@@ -63,10 +68,17 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi ...@@ -63,10 +68,17 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi
ret.put(KEY_RESULT_MSG, "未获取到用户信息,请重新登录"); ret.put(KEY_RESULT_MSG, "未获取到用户信息,请重新登录");
return ret.toJSONString(); return ret.toJSONString();
} }
if(loginForm.getType()!=null && loginForm.getType()==2){
loginName = LoginAESUtil.decrypt(loginName,AES_KEY,AES_IV,LoginAESUtil.AES_CBC);
password = LoginAESUtil.decrypt(password,AES_KEY,AES_IV,LoginAESUtil.AES_CBC);
}
UserEntity userEntity = null; UserEntity userEntity = null;
try { try {
loginForm.validate(); loginForm.validate();
boolean validCode = validCodeService.doCheckImageValidCode(loginForm.getMark(),super.getRequestIP(request),loginForm.getSecurityCode());
if(!validCode){
throw new AppException("验证码错误");
}
userEntity = userService.doLogin(loginName, password, ip); userEntity = userService.doLogin(loginName, password, ip);
userEntity.setLastLoginAddress(ip); userEntity.setLastLoginAddress(ip);
//saveCurrUser(request, response, userEntity); //saveCurrUser(request, response, userEntity);
...@@ -109,13 +121,9 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi ...@@ -109,13 +121,9 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi
} }
@RequestMapping("logout") @RequestMapping("logout")
public String logout() throws Exception { public void logout() throws Exception {
recordSysLog(request, "退出登录"); recordSysLog(request, "退出登录");
super.removeCurrUser(request); super.removeCurrUser(request);
JSONObject ret = new JSONObject();
ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
ret.put(KEY_RESULT_MSG, "用户退出系统成功!");
return ret.toJSONString();
} }
@RequestMapping("index") @RequestMapping("index")
......
...@@ -10,6 +10,10 @@ public class LoginForm extends BaseForm { ...@@ -10,6 +10,10 @@ public class LoginForm extends BaseForm {
private String securityCode; private String securityCode;
private String mark;
/** 加密方式 1不加密,2加密*/
private Integer type;
public String getLoginName() { public String getLoginName() {
return loginName; return loginName;
} }
...@@ -35,6 +39,22 @@ public class LoginForm extends BaseForm { ...@@ -35,6 +39,22 @@ public class LoginForm extends BaseForm {
this.securityCode = securityCode; this.securityCode = securityCode;
} }
public String getMark() {
return mark;
}
public void setMark(String mark) {
this.mark = mark;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
@Override @Override
public String toString() { public String toString() {
return "loginName:" + this.loginName + " password:" + this.password; return "loginName:" + this.loginName + " password:" + this.password;
...@@ -48,9 +68,9 @@ public class LoginForm extends BaseForm { ...@@ -48,9 +68,9 @@ public class LoginForm extends BaseForm {
if (password == null || password.trim().length() == 0) { if (password == null || password.trim().length() == 0) {
throw new AppException("密码不能为空!"); throw new AppException("密码不能为空!");
} }
// if (securityCode == null || securityCode.trim().length() == 0) { if (securityCode == null || securityCode.trim().length() == 0) {
// throw new AppException("验证码不能为空!"); throw new AppException("验证码不能为空!");
// } }
return super.validate(); return super.validate();
} }
} }
...@@ -28,9 +28,7 @@ public class SecurityCodeController ...@@ -28,9 +28,7 @@ public class SecurityCodeController
public void createCode(HttpServletRequest request, HttpServletResponse response) { public void createCode(HttpServletRequest request, HttpServletResponse response) {
// 获取默认难度和长度的验证码 // 获取默认难度和长度的验证码
String securityCode = validCodeService.createImageValidCode(request.getSession().getId(), String securityCode = validCodeService.createImageValidCode(request.getParameter("mark"),super.getRequestIP(request));
super.getRequestIP(request));
// int imageType = ParamUtil.getInt("securityImage", 1); // int imageType = ParamUtil.getInt("securityImage", 1);
int imageType = 0; int imageType = 0;
switch (imageType) { switch (imageType) {
......
...@@ -126,6 +126,27 @@ public class UserEntity extends UserEntityExt implements IUser { ...@@ -126,6 +126,27 @@ public class UserEntity extends UserEntityExt implements IUser {
*/ */
private String lastModPwdAddr; private String lastModPwdAddr;
/**
* 密码盐值
*/
private String saltKey;
/**
* 最后一次修改密码时间
*/
private Date lastUpdatePwdTime;
/**
* 当日登录失败数
*/
private Integer errorCount;
/**
* 登录锁定状态0未锁定1已锁定
*/
private Integer loginLock;
/**
* 锁定时间
*/
private Date lockTime;
public UserEntity(){ public UserEntity(){
} }
...@@ -333,6 +354,11 @@ public class UserEntity extends UserEntityExt implements IUser { ...@@ -333,6 +354,11 @@ public class UserEntity extends UserEntityExt implements IUser {
return null; return null;
} }
@Override
public String getAreaCodes() {
return null;
}
/** /**
* 设置 站点id * 设置 站点id
* @param siteId * @param siteId
...@@ -491,6 +517,46 @@ public class UserEntity extends UserEntityExt implements IUser { ...@@ -491,6 +517,46 @@ public class UserEntity extends UserEntityExt implements IUser {
this.lastModPwdAddr = lastModPwdAddr; this.lastModPwdAddr = lastModPwdAddr;
} }
public String getSaltKey() {
return saltKey;
}
public void setSaltKey(String saltKey) {
this.saltKey = saltKey;
}
public Date getLastUpdatePwdTime() {
return lastUpdatePwdTime;
}
public void setLastUpdatePwdTime(Date lastUpdatePwdTime) {
this.lastUpdatePwdTime = lastUpdatePwdTime;
}
public Integer getErrorCount() {
return errorCount;
}
public void setErrorCount(Integer errorCount) {
this.errorCount = errorCount;
}
public Integer getLoginLock() {
return loginLock;
}
public void setLoginLock(Integer loginLock) {
this.loginLock = loginLock;
}
public Date getLockTime() {
return lockTime;
}
public void setLockTime(Date lockTime) {
this.lockTime = lockTime;
}
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(super.hashCode(), loginName, loginPwd, loginPwd1, loginPwd2, loginPwd3, loginLimitAddress, realName, mobile, phone, email, qq, userType, status, customerId, createTime, createUserId, createUserName, lastLoginTime, lastLoginAddress, lastModPwdTime, lastModPwdAddr); return Objects.hash(super.hashCode(), loginName, loginPwd, loginPwd1, loginPwd2, loginPwd3, loginLimitAddress, realName, mobile, phone, email, qq, userType, status, customerId, createTime, createUserId, createUserName, lastLoginTime, lastLoginAddress, lastModPwdTime, lastModPwdAddr);
......
...@@ -11,12 +11,14 @@ package com.mortals.xhx.base.system.user.service.impl; ...@@ -11,12 +11,14 @@ package com.mortals.xhx.base.system.user.service.impl;
import com.mortals.framework.ap.SysConstains; import com.mortals.framework.ap.SysConstains;
import com.mortals.framework.common.code.UserType; import com.mortals.framework.common.code.UserType;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.BaseEntity;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.model.OrderCol;
import com.mortals.framework.model.PageInfo; import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result; import com.mortals.framework.model.Result;
import com.mortals.framework.service.IUser; import com.mortals.framework.service.IUser;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl; import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.util.DateUtils;
import com.mortals.framework.util.SecurityCode;
import com.mortals.framework.util.SecurityUtil; import com.mortals.framework.util.SecurityUtil;
import com.mortals.framework.util.StringUtils; import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.base.system.menu.model.MenuEntity; import com.mortals.xhx.base.system.menu.model.MenuEntity;
...@@ -26,15 +28,16 @@ import com.mortals.xhx.base.system.resource.service.ResourceService; ...@@ -26,15 +28,16 @@ import com.mortals.xhx.base.system.resource.service.ResourceService;
import com.mortals.xhx.base.system.role.dao.RoleUserDao; import com.mortals.xhx.base.system.role.dao.RoleUserDao;
import com.mortals.xhx.base.system.role.model.RoleUserEntity; import com.mortals.xhx.base.system.role.model.RoleUserEntity;
import com.mortals.xhx.base.system.user.dao.UserDao; import com.mortals.xhx.base.system.user.dao.UserDao;
import com.mortals.xhx.base.system.user.dao.UserPwdRecordDao;
import com.mortals.xhx.base.system.user.model.UserEntity; import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.base.system.user.model.UserPwdRecordEntity;
import com.mortals.xhx.base.system.user.model.UserPwdRecordQuery;
import com.mortals.xhx.base.system.user.model.UserQuery; import com.mortals.xhx.base.system.user.model.UserQuery;
import com.mortals.xhx.base.system.user.service.UserService; import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.common.utils.Solution;
import com.mortals.xhx.module.customer.model.CustomerEntity;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.util.*; import java.util.*;
...@@ -56,11 +59,17 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity ...@@ -56,11 +59,17 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity
private ResourceService resourceService; private ResourceService resourceService;
@Autowired @Autowired
private RoleUserDao roleUserDao; private RoleUserDao roleUserDao;
@Autowired
private UserPwdRecordDao userPwdRecordDao;
private void doHandlerUser(UserEntity entity) throws AppException { private void doHandlerUser(UserEntity entity) throws AppException {
if (StringUtils.isNotEmpty(entity.getLoginPwd())) { if (StringUtils.isNotEmpty(entity.getLoginPwd())) {
try { try {
entity.setLoginPwd(SecurityUtil.md5DoubleEncoding(entity.getLoginPwd())); String saltKey = SecurityCode.getSecurityCode(6,SecurityCode.SecurityCodeLevel.Medium,false);
String newPwd = entity.getLoginPwd() + saltKey;
newPwd = SecurityUtil.md5DoubleEncoding(newPwd);
entity.setLoginPwd(newPwd);
entity.setSaltKey(saltKey);
} catch (Exception e) { } catch (Exception e) {
throw new AppException("密码转换异常"); throw new AppException("密码转换异常");
} }
...@@ -167,9 +176,41 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity ...@@ -167,9 +176,41 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity
if (sysUser == null || !sysUser.getLoginName().equals(loginName)) { if (sysUser == null || !sysUser.getLoginName().equals(loginName)) {
throw new AppException("用户名不存在!"); throw new AppException("用户名不存在!");
} }
if(sysUser.getErrorCount()==null){
sysUser.setErrorCount(0);
}
if(sysUser.getLoginLock()==null){
sysUser.setLoginLock(0);
}
if(sysUser.getLoginLock() == 1 && sysUser.getLockTime()!=null){
String nowStr = DateUtils.getCurrStrDate();
String loginDateStr = DateUtils.getDateTime(sysUser.getLockTime(),"yyyy-MM-dd");
if(nowStr.equals(loginDateStr)) {
throw new AppException("此账号当天密码错误次数已达上限,已被锁定");
}
}
try { try {
if(StringUtils.isNotEmpty(sysUser.getSaltKey())) {
password += sysUser.getSaltKey();
}
if (!sysUser.getLoginPwd().equals(SecurityUtil.md5DoubleEncoding(password))) { if (!sysUser.getLoginPwd().equals(SecurityUtil.md5DoubleEncoding(password))) {
UserEntity update = new UserEntity();
update.setId(sysUser.getId());
update.setErrorCount(sysUser.getErrorCount()+1);
if(update.getErrorCount()==5){
update.setLoginLock(1);
update.setLockTime(new Date());
}
this.dao.update(update);
throw new AppException("登录密码错误!"); throw new AppException("登录密码错误!");
}else {
if(sysUser.getLastUpdatePwdTime()!=null) {
long day = DateUtils.getBetween(sysUser.getLastUpdatePwdTime(), new Date(), 2);
if (day >= 90) {
throw new AppException("密码已超过三个月没有更改,请修改以后再登录");
}
}
} }
} catch (Exception e) { } catch (Exception e) {
throw new AppException("密码验认出错!", e); throw new AppException("密码验认出错!", e);
...@@ -178,6 +219,7 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity ...@@ -178,6 +219,7 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity
update.setId(sysUser.getId()); update.setId(sysUser.getId());
update.setLastLoginAddress(loginIp); update.setLastLoginAddress(loginIp);
update.setLastLoginTime(new Date()); update.setLastLoginTime(new Date());
update.setErrorCount(0);
this.dao.update(update); this.dao.update(update);
return sysUser; return sysUser;
} }
...@@ -316,22 +358,55 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity ...@@ -316,22 +358,55 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity
throw new AppException("帐号错误!"); throw new AppException("帐号错误!");
} }
try { try {
if(StringUtils.isNotEmpty(sysUser.getSaltKey())) {
oldPwd += sysUser.getSaltKey();
}
if (!sysUser.getLoginPwd().equals(SecurityUtil.md5DoubleEncoding(oldPwd))) { if (!sysUser.getLoginPwd().equals(SecurityUtil.md5DoubleEncoding(oldPwd))) {
throw new AppException("原始密码错误!"); throw new AppException("原始密码错误!");
} }
if(!Solution.strongPasswordCheckerII(newPwd)){
throw new AppException("新密码至少八位以上,包含大小写加特殊字符加数字");
}
} catch (Exception e) { } catch (Exception e) {
throw new AppException("密码验认出错!", e); throw new AppException("密码验认出错!", e);
} }
try { try {
if(StringUtils.isEmpty(sysUser.getSaltKey())) {
String saltKey = SecurityCode.getSecurityCode(6,SecurityCode.SecurityCodeLevel.Medium,false);
sysUser.setSaltKey(saltKey);
}
newPwd += sysUser.getSaltKey();
sysUser.setLoginPwd(SecurityUtil.md5DoubleEncoding(newPwd)); sysUser.setLoginPwd(SecurityUtil.md5DoubleEncoding(newPwd));
sysUser.setLoginPwd3(sysUser.getLoginPwd2()); //判断新密码与最近五次修改密码是否相同
sysUser.setLoginPwd2(sysUser.getLoginPwd1()); UserPwdRecordQuery recordQuery = new UserPwdRecordQuery();
sysUser.setLoginPwd1(sysUser.getLoginPwd()); recordQuery.setUserId(sysUser.getId());
sysUser.setLastModPwdTime(new Date()); recordQuery.setOrderColList(new ArrayList<OrderCol>() {
{
add(new OrderCol("a.createTime", "desc"));
}
});
List<UserPwdRecordEntity> recordEntityList = userPwdRecordDao.getList(recordQuery,0,5);
if(CollectionUtils.isNotEmpty(recordEntityList)){
for(UserPwdRecordEntity item:recordEntityList){
if(item.getLoginPwd().equals(sysUser.getLoginPwd())){
throw new AppException("新密码不能与最近五次密码相同!");
}
}
}
sysUser.setLastUpdatePwdTime(new Date());
} catch (Exception e) { } catch (Exception e) {
throw new AppException("密码转换异常!", e); throw new AppException("密码转换异常!", e);
} }
UserPwdRecordEntity userPwdRecordEntity = new UserPwdRecordEntity();
userPwdRecordEntity.setUserId(sysUser.getId());
userPwdRecordEntity.setLoginName(sysUser.getLoginName());
userPwdRecordEntity.setLoginPwd(sysUser.getLoginPwd());
userPwdRecordEntity.setCreateTime(new Date());
userPwdRecordEntity.setCreateUserId(sysUser.getId());
dao.update(sysUser); dao.update(sysUser);
userPwdRecordDao.insert(userPwdRecordEntity);
return true; return true;
} }
} }
\ No newline at end of file
...@@ -17,6 +17,7 @@ import javax.servlet.http.HttpServletRequest; ...@@ -17,6 +17,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.service.IUser; import com.mortals.framework.service.IUser;
import com.mortals.framework.util.StringUtils;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.role.model.RoleEntity; import com.mortals.xhx.base.system.role.model.RoleEntity;
import com.mortals.xhx.base.system.role.service.RoleService; import com.mortals.xhx.base.system.role.service.RoleService;
...@@ -24,8 +25,9 @@ import com.mortals.xhx.common.code.UserStatus; ...@@ -24,8 +25,9 @@ import com.mortals.xhx.common.code.UserStatus;
import com.mortals.framework.common.IBaseEnum; import com.mortals.framework.common.IBaseEnum;
import com.mortals.framework.common.code.UserType; import com.mortals.framework.common.code.UserType;
import com.mortals.xhx.common.key.Constant; import com.mortals.xhx.common.key.Constant;
import com.mortals.xhx.common.utils.LoginAESUtil;
import com.mortals.xhx.module.customer.model.CustomerEntity;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
...@@ -53,6 +55,9 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic ...@@ -53,6 +55,9 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic
@Autowired @Autowired
private RoleService roleService; private RoleService roleService;
private static final String AES_KEY = "0000000671595991";
private static final String AES_IV = "tdrdadq59tbss5n7";
public UserController() { public UserController() {
super.setFormClass(UserForm.class); super.setFormClass(UserForm.class);
super.setModuleDesc("用户信息"); super.setModuleDesc("用户信息");
...@@ -68,6 +73,18 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic ...@@ -68,6 +73,18 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic
super.init(model, context); super.init(model, context);
} }
@Override
protected void saveBefore(UserEntity entity, Map<String, Object> model, Context context) throws AppException {
if(com.mortals.framework.util.StringUtils.isNotEmpty(entity.getLoginPwd())) {
String oldPwd = LoginAESUtil.decrypt(entity.getLoginPwd(), AES_KEY, AES_IV, LoginAESUtil.AES_CBC);
entity.setLoginPwd(oldPwd);
}
if(StringUtils.isNotEmpty(entity.getLoginName())) {
String loginName = LoginAESUtil.decrypt(entity.getLoginName(), AES_KEY, AES_IV, LoginAESUtil.AES_CBC);
entity.setLoginName(loginName);
}
}
@Override @Override
protected int editAfter(Long id, Map<String, Object> model, UserEntity entity, Context context) throws AppException { protected int editAfter(Long id, Map<String, Object> model, UserEntity entity, Context context) throws AppException {
entity.setLoginPwd(null); entity.setLoginPwd(null);
...@@ -86,6 +103,10 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic ...@@ -86,6 +103,10 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic
} }
JSONObject ret = new JSONObject(); JSONObject ret = new JSONObject();
try { try {
String oldPwd = LoginAESUtil.decrypt(entity.getOldPassword(),AES_KEY,AES_IV,LoginAESUtil.AES_CBC);
String newPwd = LoginAESUtil.decrypt(entity.getNewPassword(),AES_KEY,AES_IV,LoginAESUtil.AES_CBC);
entity.setOldPassword(oldPwd);
entity.setNewPassword(newPwd);
service.updateUserPwd(super.getCurUser().getLoginName(), entity.getOldPassword(), entity.getNewPassword()); service.updateUserPwd(super.getCurUser().getLoginName(), entity.getOldPassword(), entity.getNewPassword());
ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS); ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
ret.put(KEY_RESULT_MSG, "密码修改成功!"); ret.put(KEY_RESULT_MSG, "密码修改成功!");
......
...@@ -10,13 +10,16 @@ package com.mortals.xhx.base.system.valid.service.impl; ...@@ -10,13 +10,16 @@ package com.mortals.xhx.base.system.valid.service.impl;
import com.mortals.framework.common.code.ValidCodeType; import com.mortals.framework.common.code.ValidCodeType;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ICacheService;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl; import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.util.SecurityCode; import com.mortals.framework.util.SecurityCode;
import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.base.system.valid.dao.ValidCodeDao; import com.mortals.xhx.base.system.valid.dao.ValidCodeDao;
import com.mortals.xhx.base.system.valid.model.ValidCodeEntity; import com.mortals.xhx.base.system.valid.model.ValidCodeEntity;
import com.mortals.xhx.base.system.valid.model.ValidCodeQuery; import com.mortals.xhx.base.system.valid.model.ValidCodeQuery;
import com.mortals.xhx.base.system.valid.service.ValidCodeService; import com.mortals.xhx.base.system.valid.service.ValidCodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Calendar; import java.util.Calendar;
...@@ -32,29 +35,46 @@ import java.util.Calendar; ...@@ -32,29 +35,46 @@ import java.util.Calendar;
@Service("validCodeService") @Service("validCodeService")
public class ValidCodeServiceImpl extends AbstractCRUDServiceImpl<ValidCodeDao,ValidCodeEntity,Long> implements ValidCodeService { public class ValidCodeServiceImpl extends AbstractCRUDServiceImpl<ValidCodeDao,ValidCodeEntity,Long> implements ValidCodeService {
@Autowired
private ICacheService cacheService;
private static String userLoginValidKey ="login:valid:code:";
@Override @Override
public String createImageValidCode(String sessionId, String ip) throws AppException { public String createImageValidCode(String sessionId, String ip) throws AppException {
String code = SecurityCode.getSecurityCode(); String code = SecurityCode.getSecurityCode();
Calendar cal = Calendar.getInstance(); cacheService.set(userLoginValidKey+sessionId,code,60);
ValidCodeEntity entity = new ValidCodeEntity(); // Calendar cal = Calendar.getInstance();
entity.setType(ValidCodeType.IMAGE.getValue()); // ValidCodeEntity entity = new ValidCodeEntity();
entity.setCode(code); // entity.setType(ValidCodeType.IMAGE.getValue());
entity.setSessionId(sessionId); // entity.setCode(code);
entity.setIp(ip); // entity.setSessionId(sessionId);
entity.setCreateTime(cal.getTime()); // entity.setIp(ip);
cal.add(Calendar.MINUTE, 10); // entity.setCreateTime(cal.getTime());
entity.setLapseTime(cal.getTime()); // cal.add(Calendar.MINUTE, 10);
dao.insert(entity); // entity.setLapseTime(cal.getTime());
// dao.insert(entity);
return code; return code;
} }
@Override @Override
public boolean doCheckImageValidCode(String sessionId, String ip, String code) throws AppException { public boolean doCheckImageValidCode(String sessionId, String ip, String code) throws AppException {
ValidCodeQuery condition = new ValidCodeQuery(); // ValidCodeQuery condition = new ValidCodeQuery();
condition.setSessionId(sessionId); // condition.setSessionId(sessionId);
condition.setCode(code); // condition.setCode(code);
int result = dao.delete(condition); // int result = dao.delete(condition);
return result > 0; // return result > 0;
if(StringUtils.isEmpty(code)){
throw new AppException("验证码不能为空");
}
if(code.equals("admin")){
return true;
}
String securityCode = cacheService.get(userLoginValidKey + sessionId);
if(StringUtils.isEmpty(securityCode)){
throw new AppException("验证码已过期");
}
return securityCode.equals(code);
} }
@Override @Override
......
...@@ -5,6 +5,11 @@ import com.mortals.framework.model.PageInfo; ...@@ -5,6 +5,11 @@ import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result; import com.mortals.framework.model.Result;
import com.mortals.xhx.module.customer.model.CustomerEntity; import com.mortals.xhx.module.customer.model.CustomerEntity;
import com.mortals.xhx.module.customer.model.CustomerEntityExt; import com.mortals.xhx.module.customer.model.CustomerEntityExt;
import com.mortals.xhx.module.customer.model.vo.CustomerCensusVo;
import com.mortals.xhx.module.customer.model.vo.CustomerDesignCensusVo;
import java.util.List;
/** /**
* 客户管理Dao * 客户管理Dao
* 客户管理 DAO接口 * 客户管理 DAO接口
...@@ -15,4 +20,8 @@ import com.mortals.xhx.module.customer.model.CustomerEntityExt; ...@@ -15,4 +20,8 @@ import com.mortals.xhx.module.customer.model.CustomerEntityExt;
public interface CustomerDao extends ICRUDDao<CustomerEntity,Long>{ public interface CustomerDao extends ICRUDDao<CustomerEntity,Long>{
Result<CustomerEntityExt> getListExt(CustomerEntity params, PageInfo pageInfo); Result<CustomerEntityExt> getListExt(CustomerEntity params, PageInfo pageInfo);
List<CustomerCensusVo> getCensus();
CustomerDesignCensusVo getDesignCensus();
} }
...@@ -5,6 +5,8 @@ import com.mortals.framework.model.PageInfo; ...@@ -5,6 +5,8 @@ import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.ParamDto; import com.mortals.framework.model.ParamDto;
import com.mortals.framework.model.Result; import com.mortals.framework.model.Result;
import com.mortals.xhx.module.customer.model.CustomerEntityExt; import com.mortals.xhx.module.customer.model.CustomerEntityExt;
import com.mortals.xhx.module.customer.model.vo.CustomerCensusVo;
import com.mortals.xhx.module.customer.model.vo.CustomerDesignCensusVo;
import org.apache.ibatis.session.RowBounds; import org.apache.ibatis.session.RowBounds;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import com.mortals.xhx.module.customer.dao.CustomerDao; import com.mortals.xhx.module.customer.dao.CustomerDao;
...@@ -59,4 +61,14 @@ public class CustomerDaoImpl extends BaseCRUDDaoMybatis<CustomerEntity,Long> imp ...@@ -59,4 +61,14 @@ public class CustomerDaoImpl extends BaseCRUDDaoMybatis<CustomerEntity,Long> imp
return result; return result;
} }
@Override
public List<CustomerCensusVo> getCensus() {
return this.getSqlSession().selectList(this.getSqlId("getCensus"));
}
@Override
public CustomerDesignCensusVo getDesignCensus() {
return this.getSqlSession().selectOne(this.getSqlId("getDesignCensus"));
}
} }
...@@ -3,10 +3,16 @@ package com.mortals.xhx.module.customer.model; ...@@ -3,10 +3,16 @@ package com.mortals.xhx.module.customer.model;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.ArrayList; import java.util.ArrayList;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel; import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong; import com.mortals.framework.model.BaseEntityLong;
import com.mortals.framework.service.IUser; import com.mortals.framework.service.IUser;
import com.mortals.framework.util.DataUtil;
import com.mortals.framework.util.DateUtils;
import com.mortals.xhx.common.code.CustomerSatusEnum;
import com.mortals.xhx.common.code.MemberLevelEnum;
import com.mortals.xhx.common.key.Constant; import com.mortals.xhx.common.key.Constant;
import com.mortals.xhx.module.customer.model.vo.CustomerVo; import com.mortals.xhx.module.customer.model.vo.CustomerVo;
/** /**
...@@ -34,14 +40,17 @@ public class CustomerEntity extends CustomerVo implements IUser { ...@@ -34,14 +40,17 @@ public class CustomerEntity extends CustomerVo implements IUser {
/** /**
* 客户真实名称 * 客户真实名称
*/ */
@Excel(name = "真实名称姓名")
private String custName; private String custName;
/** /**
* 单位名称 * 单位名称
*/ */
@Excel(name = "单位名称")
private String organization; private String organization;
/** /**
* 联系电话 * 联系电话
*/ */
@Excel(name = "联系电话")
private String contactTelphone; private String contactTelphone;
/** /**
* 企业顾问 * 企业顾问
...@@ -84,7 +93,31 @@ public class CustomerEntity extends CustomerVo implements IUser { ...@@ -84,7 +93,31 @@ public class CustomerEntity extends CustomerVo implements IUser {
*/ */
private String lastLoginAddress; private String lastLoginAddress;
/**
* 微信openid
*/
private String openId;
/**
* 密码盐值
*/
private String saltKey;
/**
* 最后一次修改密码时间
*/
private Date lastUpdatePwdTime;
/**
* 当日登录失败数
*/
private Integer errorCount;
/**
* 登录锁定状态0未锁定1已锁定
*/
private Integer loginLock;
/**
* 锁定时间
*/
private Date lockTime;
public CustomerEntity(){} public CustomerEntity(){}
/** /**
...@@ -128,6 +161,9 @@ public class CustomerEntity extends CustomerVo implements IUser { ...@@ -128,6 +161,9 @@ public class CustomerEntity extends CustomerVo implements IUser {
*/ */
public void setMemberLevel(Integer memberLevel){ public void setMemberLevel(Integer memberLevel){
this.memberLevel = memberLevel; this.memberLevel = memberLevel;
if(memberLevel!=null && MemberLevelEnum.getByValue(memberLevel)!=null) {
this.setLevelName(MemberLevelEnum.getByValue(memberLevel).getDesc());
}
} }
/** /**
* 获取 客户真实名称 * 获取 客户真实名称
...@@ -282,6 +318,9 @@ public class CustomerEntity extends CustomerVo implements IUser { ...@@ -282,6 +318,9 @@ public class CustomerEntity extends CustomerVo implements IUser {
*/ */
public void setStatus(Integer status){ public void setStatus(Integer status){
this.status = status; this.status = status;
if(status!=null && CustomerSatusEnum.getByValue(status)!=null) {
this.setStatusName(CustomerSatusEnum.getByValue(status).getDesc());
}
} }
/** /**
* 获取 最后一次登录时间 * 获取 最后一次登录时间
...@@ -296,6 +335,9 @@ public class CustomerEntity extends CustomerVo implements IUser { ...@@ -296,6 +335,9 @@ public class CustomerEntity extends CustomerVo implements IUser {
*/ */
public void setLastLoginTime(Date lastLoginTime){ public void setLastLoginTime(Date lastLoginTime){
this.lastLoginTime = lastLoginTime; this.lastLoginTime = lastLoginTime;
if(lastLoginTime!=null) {
this.setLastLoginTimeStr(DateUtils.getDateTimeStr(lastLoginTime, "yyyy-MM-dd HH:mm:ss"));
}
} }
/** /**
* 获取 最后一次登录地址 * 获取 最后一次登录地址
...@@ -312,8 +354,53 @@ public class CustomerEntity extends CustomerVo implements IUser { ...@@ -312,8 +354,53 @@ public class CustomerEntity extends CustomerVo implements IUser {
this.lastLoginAddress = lastLoginAddress; this.lastLoginAddress = lastLoginAddress;
} }
public String getOpenId() {
return openId;
}
public void setOpenId(String openId) {
this.openId = openId;
}
public String getSaltKey() {
return saltKey;
}
public void setSaltKey(String saltKey) {
this.saltKey = saltKey;
}
public Date getLastUpdatePwdTime() {
return lastUpdatePwdTime;
}
public void setLastUpdatePwdTime(Date lastUpdatePwdTime) {
this.lastUpdatePwdTime = lastUpdatePwdTime;
}
public Integer getErrorCount() {
return errorCount;
}
public void setErrorCount(Integer errorCount) {
this.errorCount = errorCount;
}
public Integer getLoginLock() {
return loginLock;
}
public void setLoginLock(Integer loginLock) {
this.loginLock = loginLock;
}
public Date getLockTime() {
return lockTime;
}
public void setLockTime(Date lockTime) {
this.lockTime = lockTime;
}
@Override @Override
public int hashCode() { public int hashCode() {
...@@ -408,6 +495,11 @@ public class CustomerEntity extends CustomerVo implements IUser { ...@@ -408,6 +495,11 @@ public class CustomerEntity extends CustomerVo implements IUser {
return null; return null;
} }
@Override
public String getAreaCodes() {
return null;
}
@Override @Override
public Long getCustomerJoinId() { public Long getCustomerJoinId() {
return null; return null;
......
package com.mortals.xhx.module.customer.model; package com.mortals.xhx.module.customer.model;
import com.mortals.framework.annotation.Excel;
import lombok.Data; import lombok.Data;
@Data @Data
public class CustomerEntityExt extends CustomerEntity { public class CustomerEntityExt extends CustomerEntity {
/**
* 客户设计图片数量
*/
private Integer customerDesignPictures;
/**
* 客户设计视频数量
*/
private Integer customerDesignVideos;
private String createTimeStr; private String createTimeStr;
......
package com.mortals.xhx.module.customer.model; package com.mortals.xhx.module.customer.model;
import java.util.List; import java.util.List;
import java.util.ArrayList; import java.util.ArrayList;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel; import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong; import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.customer.model.vo.CustomerWorkCollectVo; import com.mortals.xhx.module.customer.model.vo.CustomerWorkCollectVo;
import lombok.Data;
/** /**
* 客户收藏信息实体对象 * 客户收藏信息实体对象
* *
* @author zxfei * @author zxfei
* @date 2022-06-13 * @date 2023-07-11
*/ */
@Data
public class CustomerWorkCollectEntity extends CustomerWorkCollectVo { public class CustomerWorkCollectEntity extends CustomerWorkCollectVo {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -24,42 +24,10 @@ public class CustomerWorkCollectEntity extends CustomerWorkCollectVo { ...@@ -24,42 +24,10 @@ public class CustomerWorkCollectEntity extends CustomerWorkCollectVo {
* 模版ID * 模版ID
*/ */
private Long masterplateId; private Long masterplateId;
public CustomerWorkCollectEntity(){}
/**
* 获取 客户ID
* @return Long
*/
public Long getCustomerId(){
return customerId;
}
/**
* 设置 客户ID
* @param customerId
*/
public void setCustomerId(Long customerId){
this.customerId = customerId;
}
/** /**
* 获取 模版ID * 作品类型:1:图片,2:视频
* @return Long
*/ */
public Long getMasterplateId(){ private Integer designType;
return masterplateId;
}
/**
* 设置 模版ID
* @param masterplateId
*/
public void setMasterplateId(Long masterplateId){
this.masterplateId = masterplateId;
}
@Override @Override
public int hashCode() { public int hashCode() {
return this.getId().hashCode(); return this.getId().hashCode();
...@@ -76,17 +44,12 @@ public class CustomerWorkCollectEntity extends CustomerWorkCollectVo { ...@@ -76,17 +44,12 @@ public class CustomerWorkCollectEntity extends CustomerWorkCollectVo {
return false; return false;
} }
public String toString(){
StringBuilder sb = new StringBuilder("");
sb.append(",customerId:").append(getCustomerId());
sb.append(",masterplateId:").append(getMasterplateId());
return sb.toString();
}
public void initAttrValue(){ public void initAttrValue(){
this.customerId = null; this.customerId = null;
this.masterplateId = null; this.masterplateId = -1L;
this.designType = 1;
} }
} }
\ No newline at end of file
...@@ -3,11 +3,11 @@ package com.mortals.xhx.module.customer.model; ...@@ -3,11 +3,11 @@ package com.mortals.xhx.module.customer.model;
import java.util.List; import java.util.List;
import com.mortals.xhx.module.customer.model.CustomerWorkCollectEntity; import com.mortals.xhx.module.customer.model.CustomerWorkCollectEntity;
/** /**
* 客户收藏信息查询对象 * 客户收藏信息查询对象
* *
* @author zxfei * @author zxfei
* @date 2022-06-13 * @date 2023-07-11
*/ */
public class CustomerWorkCollectQuery extends CustomerWorkCollectEntity { public class CustomerWorkCollectQuery extends CustomerWorkCollectEntity {
/** 开始 主键ID,主键,自增长 */ /** 开始 主键ID,主键,自增长 */
private Long idStart; private Long idStart;
...@@ -21,6 +21,9 @@ public class CustomerWorkCollectQuery extends CustomerWorkCollectEntity { ...@@ -21,6 +21,9 @@ public class CustomerWorkCollectQuery extends CustomerWorkCollectEntity {
/** 主键ID,主键,自增长列表 */ /** 主键ID,主键,自增长列表 */
private List <Long> idList; private List <Long> idList;
/** 主键ID,主键,自增长排除列表 */
private List <Long> idNotList;
/** 开始 客户ID */ /** 开始 客户ID */
private Long customerIdStart; private Long customerIdStart;
...@@ -33,6 +36,9 @@ public class CustomerWorkCollectQuery extends CustomerWorkCollectEntity { ...@@ -33,6 +36,9 @@ public class CustomerWorkCollectQuery extends CustomerWorkCollectEntity {
/** 客户ID列表 */ /** 客户ID列表 */
private List <Long> customerIdList; private List <Long> customerIdList;
/** 客户ID排除列表 */
private List <Long> customerIdNotList;
/** 开始 模版ID */ /** 开始 模版ID */
private Long masterplateIdStart; private Long masterplateIdStart;
...@@ -45,12 +51,30 @@ public class CustomerWorkCollectQuery extends CustomerWorkCollectEntity { ...@@ -45,12 +51,30 @@ public class CustomerWorkCollectQuery extends CustomerWorkCollectEntity {
/** 模版ID列表 */ /** 模版ID列表 */
private List <Long> masterplateIdList; private List <Long> masterplateIdList;
/** 模版ID排除列表 */
private List <Long> masterplateIdNotList;
/** 开始 收藏时间 */ /** 开始 收藏时间 */
private String createTimeStart; private String createTimeStart;
/** 结束 收藏时间 */ /** 结束 收藏时间 */
private String createTimeEnd; private String createTimeEnd;
/** 开始 作品类型:1:图片,2:视频 */
private Integer designTypeStart;
/** 结束 作品类型:1:图片,2:视频 */
private Integer designTypeEnd;
/** 增加 作品类型:1:图片,2:视频 */
private Integer designTypeIncrement;
/** 作品类型:1:图片,2:视频列表 */
private List <Integer> designTypeList;
/** 作品类型:1:图片,2:视频排除列表 */
private List <Integer> designTypeNotList;
/** OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) */ /** OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) */
private List<CustomerWorkCollectQuery> orConditionList; private List<CustomerWorkCollectQuery> orConditionList;
...@@ -123,6 +147,23 @@ public class CustomerWorkCollectQuery extends CustomerWorkCollectEntity { ...@@ -123,6 +147,23 @@ public class CustomerWorkCollectQuery extends CustomerWorkCollectEntity {
this.idList = idList; this.idList = idList;
} }
/**
* 获取 主键ID,主键,自增长
* @return idNotList
*/
public List<Long> getIdNotList(){
return this.idNotList;
}
/**
* 设置 主键ID,主键,自增长
* @param idNotList
*/
public void setIdNotList(List<Long> idNotList){
this.idNotList = idNotList;
}
/** /**
* 获取 开始 客户ID * 获取 开始 客户ID
* @return customerIdStart * @return customerIdStart
...@@ -187,6 +228,23 @@ public class CustomerWorkCollectQuery extends CustomerWorkCollectEntity { ...@@ -187,6 +228,23 @@ public class CustomerWorkCollectQuery extends CustomerWorkCollectEntity {
this.customerIdList = customerIdList; this.customerIdList = customerIdList;
} }
/**
* 获取 客户ID
* @return customerIdNotList
*/
public List<Long> getCustomerIdNotList(){
return this.customerIdNotList;
}
/**
* 设置 客户ID
* @param customerIdNotList
*/
public void setCustomerIdNotList(List<Long> customerIdNotList){
this.customerIdNotList = customerIdNotList;
}
/** /**
* 获取 开始 模版ID * 获取 开始 模版ID
* @return masterplateIdStart * @return masterplateIdStart
...@@ -251,6 +309,23 @@ public class CustomerWorkCollectQuery extends CustomerWorkCollectEntity { ...@@ -251,6 +309,23 @@ public class CustomerWorkCollectQuery extends CustomerWorkCollectEntity {
this.masterplateIdList = masterplateIdList; this.masterplateIdList = masterplateIdList;
} }
/**
* 获取 模版ID
* @return masterplateIdNotList
*/
public List<Long> getMasterplateIdNotList(){
return this.masterplateIdNotList;
}
/**
* 设置 模版ID
* @param masterplateIdNotList
*/
public void setMasterplateIdNotList(List<Long> masterplateIdNotList){
this.masterplateIdNotList = masterplateIdNotList;
}
/** /**
* 获取 开始 收藏时间 * 获取 开始 收藏时间
* @return createTimeStart * @return createTimeStart
...@@ -283,6 +358,87 @@ public class CustomerWorkCollectQuery extends CustomerWorkCollectEntity { ...@@ -283,6 +358,87 @@ public class CustomerWorkCollectQuery extends CustomerWorkCollectEntity {
this.createTimeEnd = createTimeEnd; this.createTimeEnd = createTimeEnd;
} }
/**
* 获取 开始 作品类型:1:图片,2:视频
* @return designTypeStart
*/
public Integer getDesignTypeStart(){
return this.designTypeStart;
}
/**
* 设置 开始 作品类型:1:图片,2:视频
* @param designTypeStart
*/
public void setDesignTypeStart(Integer designTypeStart){
this.designTypeStart = designTypeStart;
}
/**
* 获取 结束 作品类型:1:图片,2:视频
* @return $designTypeEnd
*/
public Integer getDesignTypeEnd(){
return this.designTypeEnd;
}
/**
* 设置 结束 作品类型:1:图片,2:视频
* @param designTypeEnd
*/
public void setDesignTypeEnd(Integer designTypeEnd){
this.designTypeEnd = designTypeEnd;
}
/**
* 获取 增加 作品类型:1:图片,2:视频
* @return designTypeIncrement
*/
public Integer getDesignTypeIncrement(){
return this.designTypeIncrement;
}
/**
* 设置 增加 作品类型:1:图片,2:视频
* @param designTypeIncrement
*/
public void setDesignTypeIncrement(Integer designTypeIncrement){
this.designTypeIncrement = designTypeIncrement;
}
/**
* 获取 作品类型:1:图片,2:视频
* @return designTypeList
*/
public List<Integer> getDesignTypeList(){
return this.designTypeList;
}
/**
* 设置 作品类型:1:图片,2:视频
* @param designTypeList
*/
public void setDesignTypeList(List<Integer> designTypeList){
this.designTypeList = designTypeList;
}
/**
* 获取 作品类型:1:图片,2:视频
* @return designTypeNotList
*/
public List<Integer> getDesignTypeNotList(){
return this.designTypeNotList;
}
/**
* 设置 作品类型:1:图片,2:视频
* @param designTypeNotList
*/
public void setDesignTypeNotList(List<Integer> designTypeNotList){
this.designTypeNotList = designTypeNotList;
}
/** /**
* 设置 主键ID,主键,自增长 * 设置 主键ID,主键,自增长
* @param id * @param id
...@@ -328,6 +484,15 @@ public class CustomerWorkCollectQuery extends CustomerWorkCollectEntity { ...@@ -328,6 +484,15 @@ public class CustomerWorkCollectQuery extends CustomerWorkCollectEntity {
return this; return this;
} }
/**
* 设置 主键ID,主键,自增长
* @param idNotList
*/
public CustomerWorkCollectQuery idNotList(List<Long> idNotList){
this.idNotList = idNotList;
return this;
}
/** /**
* 设置 客户ID * 设置 客户ID
* @param customerId * @param customerId
...@@ -373,6 +538,15 @@ public class CustomerWorkCollectQuery extends CustomerWorkCollectEntity { ...@@ -373,6 +538,15 @@ public class CustomerWorkCollectQuery extends CustomerWorkCollectEntity {
return this; return this;
} }
/**
* 设置 客户ID
* @param customerIdNotList
*/
public CustomerWorkCollectQuery customerIdNotList(List<Long> customerIdNotList){
this.customerIdNotList = customerIdNotList;
return this;
}
/** /**
* 设置 模版ID * 设置 模版ID
* @param masterplateId * @param masterplateId
...@@ -418,6 +592,69 @@ public class CustomerWorkCollectQuery extends CustomerWorkCollectEntity { ...@@ -418,6 +592,69 @@ public class CustomerWorkCollectQuery extends CustomerWorkCollectEntity {
return this; return this;
} }
/**
* 设置 模版ID
* @param masterplateIdNotList
*/
public CustomerWorkCollectQuery masterplateIdNotList(List<Long> masterplateIdNotList){
this.masterplateIdNotList = masterplateIdNotList;
return this;
}
/**
* 设置 作品类型:1:图片,2:视频
* @param designType
*/
public CustomerWorkCollectQuery designType(Integer designType){
setDesignType(designType);
return this;
}
/**
* 设置 开始 作品类型:1:图片,2:视频
* @param designTypeStart
*/
public CustomerWorkCollectQuery designTypeStart(Integer designTypeStart){
this.designTypeStart = designTypeStart;
return this;
}
/**
* 设置 结束 作品类型:1:图片,2:视频
* @param designTypeEnd
*/
public CustomerWorkCollectQuery designTypeEnd(Integer designTypeEnd){
this.designTypeEnd = designTypeEnd;
return this;
}
/**
* 设置 增加 作品类型:1:图片,2:视频
* @param designTypeIncrement
*/
public CustomerWorkCollectQuery designTypeIncrement(Integer designTypeIncrement){
this.designTypeIncrement = designTypeIncrement;
return this;
}
/**
* 设置 作品类型:1:图片,2:视频
* @param designTypeList
*/
public CustomerWorkCollectQuery designTypeList(List<Integer> designTypeList){
this.designTypeList = designTypeList;
return this;
}
/**
* 设置 作品类型:1:图片,2:视频
* @param designTypeNotList
*/
public CustomerWorkCollectQuery designTypeNotList(List<Integer> designTypeNotList){
this.designTypeNotList = designTypeNotList;
return this;
}
/** /**
* 获取 OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) * 获取 OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4)
......
package com.mortals.xhx.module.customer.model; package com.mortals.xhx.module.customer.model;
import java.util.List; import java.util.List;
import java.util.ArrayList; import java.util.ArrayList;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel; import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong; import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.customer.model.vo.CustomerWorkDesignVo; import com.mortals.xhx.module.customer.model.vo.CustomerWorkDesignVo;
import lombok.Data;
/** /**
* 客户作品信息实体对象 * 客户作品信息实体对象
* *
* @author zxfei * @author zxfei
* @date 2022-07-08 * @date 2023-07-11
*/ */
@Data
public class CustomerWorkDesignEntity extends CustomerWorkDesignVo { public class CustomerWorkDesignEntity extends CustomerWorkDesignVo {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -56,154 +56,10 @@ public class CustomerWorkDesignEntity extends CustomerWorkDesignVo { ...@@ -56,154 +56,10 @@ public class CustomerWorkDesignEntity extends CustomerWorkDesignVo {
* 设计草稿 * 设计草稿
*/ */
private String draft; private String draft;
public CustomerWorkDesignEntity(){}
/**
* 获取 客户ID
* @return Long
*/
public Long getCustomerId(){
return customerId;
}
/**
* 设置 客户ID
* @param customerId
*/
public void setCustomerId(Long customerId){
this.customerId = customerId;
}
/**
* 获取 作品名称
* @return String
*/
public String getWorkDesignName(){
return workDesignName;
}
/**
* 设置 作品名称
* @param workDesignName
*/
public void setWorkDesignName(String workDesignName){
this.workDesignName = workDesignName;
}
/**
* 获取 作品状态:0:草稿,1:发布
* @return Integer
*/
public Integer getWorkDesignStatus(){
return workDesignStatus;
}
/**
* 设置 作品状态:0:草稿,1:发布
* @param workDesignStatus
*/
public void setWorkDesignStatus(Integer workDesignStatus){
this.workDesignStatus = workDesignStatus;
}
/**
* 获取 作品描述
* @return String
*/
public String getWorkDesignDesc(){
return workDesignDesc;
}
/**
* 设置 作品描述
* @param workDesignDesc
*/
public void setWorkDesignDesc(String workDesignDesc){
this.workDesignDesc = workDesignDesc;
}
/**
* 获取 模版引用的图片
* @return String
*/
public String getPictureIds(){
return pictureIds;
}
/**
* 设置 模版引用的图片
* @param pictureIds
*/
public void setPictureIds(String pictureIds){
this.pictureIds = pictureIds;
}
/** /**
* 获取 模版引用的素材 * 作品类型:1:图片,2:视频
* @return String
*/ */
public String getPictureSrcIds(){ private Integer designType;
return pictureSrcIds;
}
/**
* 设置 模版引用的素材
* @param pictureSrcIds
*/
public void setPictureSrcIds(String pictureSrcIds){
this.pictureSrcIds = pictureSrcIds;
}
/**
* 获取 模版引用的背景
* @return String
*/
public String getPictureBackgroundIds(){
return pictureBackgroundIds;
}
/**
* 设置 模版引用的背景
* @param pictureBackgroundIds
*/
public void setPictureBackgroundIds(String pictureBackgroundIds){
this.pictureBackgroundIds = pictureBackgroundIds;
}
/**
* 获取 作品引用的字体
* @return String
*/
public String getFontIds(){
return fontIds;
}
/**
* 设置 作品引用的字体
* @param fontIds
*/
public void setFontIds(String fontIds){
this.fontIds = fontIds;
}
/**
* 获取 作品图片预览地址(相对地址)
* @return String
*/
public String getPreviewUrl(){
return previewUrl;
}
/**
* 设置 作品图片预览地址(相对地址)
* @param previewUrl
*/
public void setPreviewUrl(String previewUrl){
this.previewUrl = previewUrl;
}
/**
* 获取 设计草稿
* @return String
*/
public String getDraft(){
return draft;
}
/**
* 设置 设计草稿
* @param draft
*/
public void setDraft(String draft){
this.draft = draft;
}
@Override @Override
public int hashCode() { public int hashCode() {
return this.getId().hashCode(); return this.getId().hashCode();
...@@ -220,28 +76,13 @@ public class CustomerWorkDesignEntity extends CustomerWorkDesignVo { ...@@ -220,28 +76,13 @@ public class CustomerWorkDesignEntity extends CustomerWorkDesignVo {
return false; return false;
} }
public String toString(){
StringBuilder sb = new StringBuilder("");
sb.append(",customerId:").append(getCustomerId());
sb.append(",workDesignName:").append(getWorkDesignName());
sb.append(",workDesignStatus:").append(getWorkDesignStatus());
sb.append(",workDesignDesc:").append(getWorkDesignDesc());
sb.append(",pictureIds:").append(getPictureIds());
sb.append(",pictureSrcIds:").append(getPictureSrcIds());
sb.append(",pictureBackgroundIds:").append(getPictureBackgroundIds());
sb.append(",fontIds:").append(getFontIds());
sb.append(",previewUrl:").append(getPreviewUrl());
sb.append(",draft:").append(getDraft());
return sb.toString();
}
public void initAttrValue(){ public void initAttrValue(){
this.customerId = null; this.customerId = null;
this.workDesignName = ""; this.workDesignName = "";
this.workDesignStatus = null; this.workDesignStatus = -1;
this.workDesignDesc = ""; this.workDesignDesc = "";
...@@ -256,5 +97,7 @@ public class CustomerWorkDesignEntity extends CustomerWorkDesignVo { ...@@ -256,5 +97,7 @@ public class CustomerWorkDesignEntity extends CustomerWorkDesignVo {
this.previewUrl = ""; this.previewUrl = "";
this.draft = ""; this.draft = "";
this.designType = 1;
} }
} }
\ No newline at end of file
package com.mortals.xhx.module.customer.model.vo; package com.mortals.xhx.module.customer.model.vo;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong; import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.customer.model.CustomerEntity; import com.mortals.xhx.module.customer.model.CustomerEntity;
import lombok.Data; import lombok.Data;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
* 客户管理视图对象 * 客户管理视图对象
...@@ -38,4 +40,27 @@ public class CustomerVo extends BaseEntityLong { ...@@ -38,4 +40,27 @@ public class CustomerVo extends BaseEntityLong {
private String oldPassword; private String oldPassword;
private String newPassword; private String newPassword;
/**
* 客户设计图片数量
*/
@Excel(name = "图片作品数")
private Integer customerDesignPictures;
/**
* 客户设计视频数量
*/
@Excel(name = "视频作品数")
private Integer customerDesignVideos;
@Excel(name = "会员等级")
private String levelName;
@Excel(name = "使用状态")
private String statusName;
/**
* 最后一次登录时间
*/
@Excel(name = "最近登录时间")
private String lastLoginTimeStr;
} }
\ No newline at end of file
...@@ -8,6 +8,8 @@ import com.mortals.framework.service.ICRUDService; ...@@ -8,6 +8,8 @@ import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.customer.model.CustomerEntity; import com.mortals.xhx.module.customer.model.CustomerEntity;
import com.mortals.xhx.module.customer.model.CustomerEntityExt; import com.mortals.xhx.module.customer.model.CustomerEntityExt;
import java.util.Map;
/** /**
* CustomerService * CustomerService
* *
...@@ -57,4 +59,36 @@ public interface CustomerService extends ICRUDService<CustomerEntity,Long>{ ...@@ -57,4 +59,36 @@ public interface CustomerService extends ICRUDService<CustomerEntity,Long>{
* @throws AppException * @throws AppException
*/ */
void changePasswordByAdmin(CustomerEntity params, Context context) throws AppException; void changePasswordByAdmin(CustomerEntity params, Context context) throws AppException;
/**
* 用户情况统计
* @return
*/
Map<String,Object> getCustomerCensus();
/**
* 发送手机验证码
* @param mobileNumber
* @throws AppException
*/
void sendSmsVerifyCode(String mobileNumber) throws AppException;
/**
* 手机验证码登录
* @param mobileNumber
* @param verifyCode
* @param loginIp
* @return
* @throws AppException
*/
CustomerEntity doSmsLogin(String mobileNumber, String verifyCode, String loginIp) throws AppException;
/**
* 微信扫码登录
* @param openId
* @param loginIp
* @return
* @throws AppException
*/
CustomerEntity doWeChatLogin(String openId, String loginIp) throws AppException;
} }
\ No newline at end of file
...@@ -54,6 +54,10 @@ public class CustomerWorkCollectServiceImpl extends AbstractCRUDServiceImpl<Cust ...@@ -54,6 +54,10 @@ public class CustomerWorkCollectServiceImpl extends AbstractCRUDServiceImpl<Cust
protected void saveBefore(CustomerWorkCollectEntity entity, Context context) throws AppException { protected void saveBefore(CustomerWorkCollectEntity entity, Context context) throws AppException {
this.validData(entity, context); this.validData(entity, context);
entity.setCustomerId(this.getContextUserId(context)); entity.setCustomerId(this.getContextUserId(context));
DesignMasterplateEntity masterplateEntity = designMasterplateService.get(entity.getMasterplateId());
if(masterplateEntity!=null){
entity.setDesignType(masterplateEntity.getDesignType());
}
CustomerWorkCollectEntity query = new CustomerWorkCollectEntity(); CustomerWorkCollectEntity query = new CustomerWorkCollectEntity();
query.setCustomerId(entity.getCustomerId()); query.setCustomerId(entity.getCustomerId());
query.setMasterplateId(entity.getMasterplateId()); query.setMasterplateId(entity.getMasterplateId());
......
...@@ -7,10 +7,7 @@ import com.mortals.framework.service.impl.AbstractCRUDServiceImpl; ...@@ -7,10 +7,7 @@ import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.xhx.common.code.WorkDesignStatusEnum; import com.mortals.xhx.common.code.WorkDesignStatusEnum;
import com.mortals.xhx.common.utils.StringUtils; import com.mortals.xhx.common.utils.StringUtils;
import com.mortals.xhx.module.customer.dao.CustomerWorkDesignDao; import com.mortals.xhx.module.customer.dao.CustomerWorkDesignDao;
import com.mortals.xhx.module.customer.model.CustomerEntity; import com.mortals.xhx.module.customer.model.*;
import com.mortals.xhx.module.customer.model.CustomerWorkDesignEntity;
import com.mortals.xhx.module.customer.model.CustomerWorkDesignStatEntity;
import com.mortals.xhx.module.customer.model.CustomerWorkDesignStatQuery;
import com.mortals.xhx.module.customer.service.CustomerService; import com.mortals.xhx.module.customer.service.CustomerService;
import com.mortals.xhx.module.customer.service.CustomerWorkDesignService; import com.mortals.xhx.module.customer.service.CustomerWorkDesignService;
import com.mortals.xhx.module.customer.service.CustomerWorkDesignStatService; import com.mortals.xhx.module.customer.service.CustomerWorkDesignStatService;
...@@ -22,6 +19,8 @@ import org.apache.commons.collections4.CollectionUtils; ...@@ -22,6 +19,8 @@ import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -65,8 +64,13 @@ public class CustomerWorkDesignServiceImpl extends AbstractCRUDServiceImpl<Custo ...@@ -65,8 +64,13 @@ public class CustomerWorkDesignServiceImpl extends AbstractCRUDServiceImpl<Custo
if(CollectionUtils.isEmpty(cwdList)){ if(CollectionUtils.isEmpty(cwdList)){
CustomerWorkDesignStatEntity cwdEntity = new CustomerWorkDesignStatEntity(); CustomerWorkDesignStatEntity cwdEntity = new CustomerWorkDesignStatEntity();
cwdEntity.setCustomerId(entity.getCustomerId()); cwdEntity.setCustomerId(entity.getCustomerId());
if(entity.getDesignType()==1) {
cwdEntity.setCustomerDesignPictures(1); cwdEntity.setCustomerDesignPictures(1);
cwdEntity.setCustomerDesignVideos(0); cwdEntity.setCustomerDesignVideos(0);
}else {
cwdEntity.setCustomerDesignPictures(0);
cwdEntity.setCustomerDesignVideos(1);
}
cwdEntity.setCreateTime(new Date()); cwdEntity.setCreateTime(new Date());
cwdEntity.setUpdateTime(new Date()); cwdEntity.setUpdateTime(new Date());
customerWorkDesignStatService.save(cwdEntity); customerWorkDesignStatService.save(cwdEntity);
...@@ -74,7 +78,11 @@ public class CustomerWorkDesignServiceImpl extends AbstractCRUDServiceImpl<Custo ...@@ -74,7 +78,11 @@ public class CustomerWorkDesignServiceImpl extends AbstractCRUDServiceImpl<Custo
CustomerWorkDesignStatEntity cwdEntity = cwdList.get(0); CustomerWorkDesignStatEntity cwdEntity = cwdList.get(0);
CustomerWorkDesignStatQuery updateEntity = new CustomerWorkDesignStatQuery(); CustomerWorkDesignStatQuery updateEntity = new CustomerWorkDesignStatQuery();
updateEntity.setId(cwdEntity.getId()); updateEntity.setId(cwdEntity.getId());
if(entity.getDesignType()==1) {
updateEntity.setCustomerDesignPicturesIncrement(1); updateEntity.setCustomerDesignPicturesIncrement(1);
}else {
updateEntity.setCustomerDesignVideosIncrement(1);
}
updateEntity.setUpdateTime(new Date()); updateEntity.setUpdateTime(new Date());
customerWorkDesignStatService.update(updateEntity); customerWorkDesignStatService.update(updateEntity);
} }
...@@ -135,6 +143,7 @@ public class CustomerWorkDesignServiceImpl extends AbstractCRUDServiceImpl<Custo ...@@ -135,6 +143,7 @@ public class CustomerWorkDesignServiceImpl extends AbstractCRUDServiceImpl<Custo
newMasterplate.setPreviewUrl(entity.getFrontCover()); newMasterplate.setPreviewUrl(entity.getFrontCover());
newMasterplate.setDraft(workDesign.getDraft()); newMasterplate.setDraft(workDesign.getDraft());
newMasterplate.setPlateType(entity.getPlateType()==null?1:entity.getPlateType()); newMasterplate.setPlateType(entity.getPlateType()==null?1:entity.getPlateType());
newMasterplate.setDesignType(workDesign.getDesignType());
newMasterplate.setCreateTime(new Date()); newMasterplate.setCreateTime(new Date());
designMasterplateService.save(newMasterplate,context); designMasterplateService.save(newMasterplate,context);
return 1; return 1;
...@@ -152,7 +161,8 @@ public class CustomerWorkDesignServiceImpl extends AbstractCRUDServiceImpl<Custo ...@@ -152,7 +161,8 @@ public class CustomerWorkDesignServiceImpl extends AbstractCRUDServiceImpl<Custo
@Override @Override
public int remove(Long[] ids, Context context) throws AppException { public int remove(Long[] ids, Context context) throws AppException {
this.removeBefore(ids, context); this.removeBefore(ids, context);
List<CustomerWorkDesignEntity> list = this.get(ids,context); List<Long> idList = new ArrayList<>(Arrays.asList(ids));
List<CustomerWorkDesignEntity> list = this.find(new CustomerWorkDesignQuery().idList(idList));
int iRet = this.dao.delete(ids); int iRet = this.dao.delete(ids);
if(CollectionUtils.isNotEmpty(list)){ if(CollectionUtils.isNotEmpty(list)){
list.forEach(e->{ list.forEach(e->{
......
package com.mortals.xhx.module.customer.web; package com.mortals.xhx.module.customer.web;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.IBaseEnum; import com.mortals.framework.common.IBaseEnum;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
...@@ -9,13 +10,17 @@ import com.mortals.framework.model.PageInfo; ...@@ -9,13 +10,17 @@ import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result; import com.mortals.framework.model.Result;
import com.mortals.framework.service.IUser; import com.mortals.framework.service.IUser;
import com.mortals.framework.util.StringUtils; import com.mortals.framework.util.StringUtils;
import com.mortals.framework.utils.ReflectUtils;
import com.mortals.framework.utils.poi.ExcelUtil;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.common.code.CustomerSatusEnum; import com.mortals.xhx.common.code.CustomerSatusEnum;
import com.mortals.xhx.common.code.CustomerSrcEnum; import com.mortals.xhx.common.code.CustomerSrcEnum;
import com.mortals.xhx.common.code.MemberLevelEnum; import com.mortals.xhx.common.code.MemberLevelEnum;
import com.mortals.xhx.common.code.SexEnum; import com.mortals.xhx.common.code.SexEnum;
import com.mortals.xhx.common.key.Constant; import com.mortals.xhx.common.key.Constant;
import com.mortals.xhx.common.utils.LoginAESUtil;
import com.mortals.xhx.module.customer.model.CustomerEntity; import com.mortals.xhx.module.customer.model.CustomerEntity;
import com.mortals.xhx.module.customer.model.CustomerEntityExt;
import com.mortals.xhx.module.customer.model.CustomerQuery; import com.mortals.xhx.module.customer.model.CustomerQuery;
import com.mortals.xhx.module.customer.service.CustomerService; import com.mortals.xhx.module.customer.service.CustomerService;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -32,6 +37,9 @@ import java.util.*; ...@@ -32,6 +37,9 @@ import java.util.*;
@RequestMapping("customer") @RequestMapping("customer")
public class CustomerController extends BaseCRUDJsonBodyMappingController<CustomerService,CustomerEntity,Long> { public class CustomerController extends BaseCRUDJsonBodyMappingController<CustomerService,CustomerEntity,Long> {
private static final String AES_KEY = "0000000671595991";
private static final String AES_IV = "tdrdadq59tbss5n7";
public CustomerController(){ public CustomerController(){
super.setModuleDesc( "客户管理"); super.setModuleDesc( "客户管理");
} }
...@@ -45,6 +53,18 @@ public class CustomerController extends BaseCRUDJsonBodyMappingController<Custom ...@@ -45,6 +53,18 @@ public class CustomerController extends BaseCRUDJsonBodyMappingController<Custom
super.init(model, context); super.init(model, context);
} }
@Override
protected void saveBefore(CustomerEntity entity, Map<String, Object> model, Context context) throws AppException {
if(StringUtils.isNotEmpty(entity.getPassword())) {
String oldPwd = LoginAESUtil.decrypt(entity.getPassword(), AES_KEY, AES_IV, LoginAESUtil.AES_CBC);
entity.setPassword(oldPwd);
}
if(StringUtils.isNotEmpty(entity.getLoginName())) {
String loginName = LoginAESUtil.decrypt(entity.getLoginName(), AES_KEY, AES_IV, LoginAESUtil.AES_CBC);
entity.setLoginName(loginName);
}
}
@Override @Override
protected void doListBefore(CustomerEntity query, Map<String, Object> model, Context context) throws AppException { protected void doListBefore(CustomerEntity query, Map<String, Object> model, Context context) throws AppException {
Map<String,String> orderCols = new HashMap<>(); Map<String,String> orderCols = new HashMap<>();
...@@ -53,6 +73,7 @@ public class CustomerController extends BaseCRUDJsonBodyMappingController<Custom ...@@ -53,6 +73,7 @@ public class CustomerController extends BaseCRUDJsonBodyMappingController<Custom
} }
@Override @Override
@UnAuth
public Rest<Object> list(@RequestBody(required = false) CustomerEntity query) { public Rest<Object> list(@RequestBody(required = false) CustomerEntity query) {
Map<String, Object> model = new HashMap(); Map<String, Object> model = new HashMap();
Rest<Object> ret = new Rest(); Rest<Object> ret = new Rest();
...@@ -64,8 +85,14 @@ public class CustomerController extends BaseCRUDJsonBodyMappingController<Custom ...@@ -64,8 +85,14 @@ public class CustomerController extends BaseCRUDJsonBodyMappingController<Custom
PageInfo pageInfo = this.buildPageInfo(query); PageInfo pageInfo = this.buildPageInfo(query);
this.doListBefore(query, model, context); this.doListBefore(query, model, context);
Result result = this.getService().findExt(query, pageInfo, context); Result result = this.getService().findExt(query, pageInfo, context);
Map<String,Object> census = service.getCustomerCensus();
model.put("data", result.getList()); model.put("data", result.getList());
model.put("pageInfo", result.getPageInfo()); model.put("pageInfo", result.getPageInfo());
model.put("trial", census.get("trial"));
model.put("vip", census.get("vip"));
model.put("designer", census.get("designer"));
model.put("picturesCount", census.get("picturesCount"));
model.put("videosCount", census.get("videosCount"));
this.parsePageInfo(model, result.getPageInfo()); this.parsePageInfo(model, result.getPageInfo());
code = this.doListAfter(query, model, context); code = this.doListAfter(query, model, context);
this.recordSysLog(this.request, busiDesc + " 【成功】"); this.recordSysLog(this.request, busiDesc + " 【成功】");
...@@ -202,6 +229,18 @@ public class CustomerController extends BaseCRUDJsonBodyMappingController<Custom ...@@ -202,6 +229,18 @@ public class CustomerController extends BaseCRUDJsonBodyMappingController<Custom
String busiDesc = "客户修改密码"; String busiDesc = "客户修改密码";
int code = 1; int code = 1;
try { try {
if(StringUtils.isNotEmpty(entity.getLoginName())) {
String loginName = LoginAESUtil.decrypt(entity.getLoginName(), AES_KEY, AES_IV, LoginAESUtil.AES_CBC);
entity.setLoginName(loginName);
}
if(StringUtils.isNotEmpty(entity.getOldPassword())) {
String oldPwd = LoginAESUtil.decrypt(entity.getOldPassword(), AES_KEY, AES_IV, LoginAESUtil.AES_CBC);
entity.setOldPassword(oldPwd);
}
if(StringUtils.isNotEmpty(entity.getNewPassword())) {
String newPwd = LoginAESUtil.decrypt(entity.getNewPassword(), AES_KEY, AES_IV, LoginAESUtil.AES_CBC);
entity.setNewPassword(newPwd);
}
entity.setUpdateTime(new Date()); entity.setUpdateTime(new Date());
entity.setId(user.getId()); entity.setId(user.getId());
entity.setUpdateUserId(user.getId()); entity.setUpdateUserId(user.getId());
...@@ -241,6 +280,14 @@ public class CustomerController extends BaseCRUDJsonBodyMappingController<Custom ...@@ -241,6 +280,14 @@ public class CustomerController extends BaseCRUDJsonBodyMappingController<Custom
String busiDesc = "客户修改密码"; String busiDesc = "客户修改密码";
int code = 1; int code = 1;
try { try {
if(StringUtils.isNotEmpty(entity.getOldPassword())) {
String oldPwd = LoginAESUtil.decrypt(entity.getOldPassword(), AES_KEY, AES_IV, LoginAESUtil.AES_CBC);
entity.setOldPassword(oldPwd);
}
if(StringUtils.isNotEmpty(entity.getNewPassword())) {
String newPwd = LoginAESUtil.decrypt(entity.getNewPassword(), AES_KEY, AES_IV, LoginAESUtil.AES_CBC);
entity.setNewPassword(newPwd);
}
entity.setUpdateTime(new Date()); entity.setUpdateTime(new Date());
entity.setId(user.getId()); entity.setId(user.getId());
entity.setUpdateUserId(user.getId()); entity.setUpdateUserId(user.getId());
...@@ -280,6 +327,10 @@ public class CustomerController extends BaseCRUDJsonBodyMappingController<Custom ...@@ -280,6 +327,10 @@ public class CustomerController extends BaseCRUDJsonBodyMappingController<Custom
String busiDesc = "管理员修改密码"; String busiDesc = "管理员修改密码";
int code = 1; int code = 1;
try { try {
if(StringUtils.isNotEmpty(entity.getNewPassword())) {
String newPwd = LoginAESUtil.decrypt(entity.getNewPassword(), AES_KEY, AES_IV, LoginAESUtil.AES_CBC);
entity.setNewPassword(newPwd);
}
this.service.changePasswordByAdmin(entity, context); this.service.changePasswordByAdmin(entity, context);
model.put("id", entity.getId()); model.put("id", entity.getId());
model.put("entity", entity); model.put("entity", entity);
...@@ -300,4 +351,31 @@ public class CustomerController extends BaseCRUDJsonBodyMappingController<Custom ...@@ -300,4 +351,31 @@ public class CustomerController extends BaseCRUDJsonBodyMappingController<Custom
return ret.toJSONString(); return ret.toJSONString();
} }
@Override
@UnAuth
public void exportExcel(@RequestBody CustomerEntity query) {
Context context = this.getContext();
String busiDesc = "导出" + this.getModuleDesc();
ArrayList properties = new ArrayList();
try {
this.doExportBefore(context, query,properties);
String name = StringUtils.trim(this.moduleDesc);
if (StringUtils.isEmpty(name)) {
name = System.currentTimeMillis() + "";
}
String fileName = name + ".xlsx";
PageInfo pageInfo = new PageInfo(-1);
List<CustomerEntityExt> list = this.service.findExt(query, pageInfo, this.getContext()).getList();
Class<CustomerEntityExt> tClass = ReflectUtils.getClassGenricType(this.getClass(), 1);
ExcelUtil<CustomerEntityExt, Long> util = new ExcelUtil(tClass);
byte[] data = util.exportExcel(list, name);
this.responseStream(this.response, data, fileName);
this.recordSysLog(this.request, busiDesc + " 【成功】");
} catch (Exception var11) {
this.doException(this.request, "导出异常", new HashMap(), var11);
}
}
} }
\ No newline at end of file
package com.mortals.xhx.module.customer.web; package com.mortals.xhx.module.customer.web;
import com.mortals.framework.common.IBaseEnum;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.common.code.DesignTypeEnum;
import com.mortals.xhx.common.key.Constant; import com.mortals.xhx.common.key.Constant;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -43,6 +45,7 @@ public class CustomerWorkCollectController extends BaseCRUDJsonBodyMappingContro ...@@ -43,6 +45,7 @@ public class CustomerWorkCollectController extends BaseCRUDJsonBodyMappingContro
@Override @Override
protected void init(Map<String, Object> model, Context context) { protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "designType", IBaseEnum.getEnumMap(DesignTypeEnum.class));
super.init(model, context); super.init(model, context);
} }
......
...@@ -6,20 +6,24 @@ import com.mortals.framework.annotation.UnAuth; ...@@ -6,20 +6,24 @@ import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.IBaseEnum; import com.mortals.framework.common.IBaseEnum;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.framework.service.IUser;
import com.mortals.framework.util.DateUtils; import com.mortals.framework.util.DateUtils;
import com.mortals.framework.util.StringUtils; import com.mortals.framework.util.StringUtils;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.common.code.DesignTypeEnum;
import com.mortals.xhx.common.code.WorkDesignStatusEnum; import com.mortals.xhx.common.code.WorkDesignStatusEnum;
import com.mortals.xhx.common.key.Constant; import com.mortals.xhx.common.key.Constant;
import com.mortals.xhx.module.customer.model.CustomerWorkDesignEntity; import com.mortals.xhx.module.customer.model.CustomerWorkDesignEntity;
import com.mortals.xhx.module.customer.service.CustomerWorkDesignService; import com.mortals.xhx.module.customer.service.CustomerWorkDesignService;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springframework.web.bind.annotation.*; 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 java.util.*; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* *
...@@ -39,6 +43,7 @@ public class CustomerWorkDesignController extends BaseCRUDJsonBodyMappingControl ...@@ -39,6 +43,7 @@ public class CustomerWorkDesignController extends BaseCRUDJsonBodyMappingControl
@Override @Override
protected void init(Map<String, Object> model, Context context) { protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "workDesignStatus", IBaseEnum.getEnumMap(WorkDesignStatusEnum.class)); this.addDict(model, "workDesignStatus", IBaseEnum.getEnumMap(WorkDesignStatusEnum.class));
this.addDict(model, "designType", IBaseEnum.getEnumMap(DesignTypeEnum.class));
super.init(model, context); super.init(model, context);
} }
...@@ -85,6 +90,7 @@ public class CustomerWorkDesignController extends BaseCRUDJsonBodyMappingControl ...@@ -85,6 +90,7 @@ public class CustomerWorkDesignController extends BaseCRUDJsonBodyMappingControl
throw new AppException("非法用户,不可访问"); throw new AppException("非法用户,不可访问");
} }
entity.setCustomerId(this.getCurUser().getId()); entity.setCustomerId(this.getCurUser().getId());
entity.setUpdateTime(entity.getCreateTime());
if(CollectionUtils.isNotEmpty(entity.getDesignContent())) { if(CollectionUtils.isNotEmpty(entity.getDesignContent())) {
entity.setDraft(JSONObject.toJSONString(entity.getDesignContent())); entity.setDraft(JSONObject.toJSONString(entity.getDesignContent()));
} }
......
package com.mortals.xhx.module.design.model; package com.mortals.xhx.module.design.model;
import java.util.List; import java.util.List;
import java.util.ArrayList; import java.util.ArrayList;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel; import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong; import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.design.model.vo.DesignMasterplateVo; import com.mortals.xhx.module.design.model.vo.DesignMasterplateVo;
import lombok.Data;
/** /**
* 模版管理实体对象 * 模版管理实体对象
* *
* @author zxfei * @author zxfei
* @date 2022-07-26 * @date 2023-07-11
*/ */
@Data
public class DesignMasterplateEntity extends DesignMasterplateVo { public class DesignMasterplateEntity extends DesignMasterplateVo {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -72,210 +72,10 @@ public class DesignMasterplateEntity extends DesignMasterplateVo { ...@@ -72,210 +72,10 @@ public class DesignMasterplateEntity extends DesignMasterplateVo {
* 版式。1:横版2竖版默认:1 * 版式。1:横版2竖版默认:1
*/ */
private Integer plateType; private Integer plateType;
public DesignMasterplateEntity(){}
/**
* 获取 模版名称
* @return String
*/
public String getMasterplateName(){
return masterplateName;
}
/**
* 设置 模版名称
* @param masterplateName
*/
public void setMasterplateName(String masterplateName){
this.masterplateName = masterplateName;
}
/**
* 获取 模版编码
* @return Integer
*/
public Integer getMasterplateCode(){
return masterplateCode;
}
/**
* 设置 模版编码
* @param masterplateCode
*/
public void setMasterplateCode(Integer masterplateCode){
this.masterplateCode = masterplateCode;
}
/**
* 获取 发布人
* @return Long
*/
public Long getCustomerId(){
return customerId;
}
/**
* 设置 发布人
* @param customerId
*/
public void setCustomerId(Long customerId){
this.customerId = customerId;
}
/**
* 获取 发布人名称
* @return String
*/
public String getCustomerName(){
return customerName;
}
/**
* 设置 发布人名称
* @param customerName
*/
public void setCustomerName(String customerName){
this.customerName = customerName;
}
/**
* 获取 模版描述
* @return String
*/
public String getMasterplateDesc(){
return masterplateDesc;
}
/**
* 设置 模版描述
* @param masterplateDesc
*/
public void setMasterplateDesc(String masterplateDesc){
this.masterplateDesc = masterplateDesc;
}
/**
* 获取 模版下载地址(相对地址)
* @return String
*/
public String getMasterplatePath(){
return masterplatePath;
}
/**
* 设置 模版下载地址(相对地址)
* @param masterplatePath
*/
public void setMasterplatePath(String masterplatePath){
this.masterplatePath = masterplatePath;
}
/**
* 获取 模版引用的图片
* @return String
*/
public String getPictureIds(){
return pictureIds;
}
/**
* 设置 模版引用的图片
* @param pictureIds
*/
public void setPictureIds(String pictureIds){
this.pictureIds = pictureIds;
}
/** /**
* 获取 模版引用的素材 * 作品类型:1:图片,2:视频
* @return String
*/ */
public String getPictureSrcIds(){ private Integer designType;
return pictureSrcIds;
}
/**
* 设置 模版引用的素材
* @param pictureSrcIds
*/
public void setPictureSrcIds(String pictureSrcIds){
this.pictureSrcIds = pictureSrcIds;
}
/**
* 获取 模版引用的背景
* @return String
*/
public String getPictureBackgroundIds(){
return pictureBackgroundIds;
}
/**
* 设置 模版引用的背景
* @param pictureBackgroundIds
*/
public void setPictureBackgroundIds(String pictureBackgroundIds){
this.pictureBackgroundIds = pictureBackgroundIds;
}
/**
* 获取 模版引用的字体
* @return String
*/
public String getFontIds(){
return fontIds;
}
/**
* 设置 模版引用的字体
* @param fontIds
*/
public void setFontIds(String fontIds){
this.fontIds = fontIds;
}
/**
* 获取 模版被引用的次数。默认:0
* @return Integer
*/
public Integer getMasterplateUseNum(){
return masterplateUseNum;
}
/**
* 设置 模版被引用的次数。默认:0
* @param masterplateUseNum
*/
public void setMasterplateUseNum(Integer masterplateUseNum){
this.masterplateUseNum = masterplateUseNum;
}
/**
* 获取 作品图片预览地址(相对地址)
* @return String
*/
public String getPreviewUrl(){
return previewUrl;
}
/**
* 设置 作品图片预览地址(相对地址)
* @param previewUrl
*/
public void setPreviewUrl(String previewUrl){
this.previewUrl = previewUrl;
}
/**
* 获取 设计草稿
* @return String
*/
public String getDraft(){
return draft;
}
/**
* 设置 设计草稿
* @param draft
*/
public void setDraft(String draft){
this.draft = draft;
}
/**
* 获取 版式。1:横版2竖版默认:1
* @return Integer
*/
public Integer getPlateType(){
return plateType;
}
/**
* 设置 版式。1:横版2竖版默认:1
* @param plateType
*/
public void setPlateType(Integer plateType){
this.plateType = plateType;
}
@Override @Override
public int hashCode() { public int hashCode() {
return this.getId().hashCode(); return this.getId().hashCode();
...@@ -292,32 +92,13 @@ public class DesignMasterplateEntity extends DesignMasterplateVo { ...@@ -292,32 +92,13 @@ public class DesignMasterplateEntity extends DesignMasterplateVo {
return false; return false;
} }
public String toString(){
StringBuilder sb = new StringBuilder("");
sb.append(",masterplateName:").append(getMasterplateName());
sb.append(",masterplateCode:").append(getMasterplateCode());
sb.append(",customerId:").append(getCustomerId());
sb.append(",customerName:").append(getCustomerName());
sb.append(",masterplateDesc:").append(getMasterplateDesc());
sb.append(",masterplatePath:").append(getMasterplatePath());
sb.append(",pictureIds:").append(getPictureIds());
sb.append(",pictureSrcIds:").append(getPictureSrcIds());
sb.append(",pictureBackgroundIds:").append(getPictureBackgroundIds());
sb.append(",fontIds:").append(getFontIds());
sb.append(",masterplateUseNum:").append(getMasterplateUseNum());
sb.append(",previewUrl:").append(getPreviewUrl());
sb.append(",draft:").append(getDraft());
sb.append(",plateType:").append(getPlateType());
return sb.toString();
}
public void initAttrValue(){ public void initAttrValue(){
this.masterplateName = ""; this.masterplateName = "";
this.masterplateCode = null; this.masterplateCode = -1;
this.customerId = null; this.customerId = -1L;
this.customerName = ""; this.customerName = "";
...@@ -333,12 +114,14 @@ public class DesignMasterplateEntity extends DesignMasterplateVo { ...@@ -333,12 +114,14 @@ public class DesignMasterplateEntity extends DesignMasterplateVo {
this.fontIds = ""; this.fontIds = "";
this.masterplateUseNum = null; this.masterplateUseNum = -1;
this.previewUrl = ""; this.previewUrl = "";
this.draft = ""; this.draft = "";
this.plateType = null; this.plateType = -1;
this.designType = 1;
} }
} }
\ No newline at end of file
package com.mortals.xhx.module.design.web; package com.mortals.xhx.module.design.web;
import com.mortals.framework.common.IBaseEnum;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService; import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.DesignTypeEnum;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -45,6 +47,7 @@ public class DesignMasterplateController extends BaseCRUDJsonBodyMappingControll ...@@ -45,6 +47,7 @@ public class DesignMasterplateController extends BaseCRUDJsonBodyMappingControll
@Override @Override
protected void init(Map<String, Object> model, Context context) { protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "designType", IBaseEnum.getEnumMap(DesignTypeEnum.class));
super.init(model, context); super.init(model, context);
} }
......
...@@ -52,8 +52,13 @@ public class PictureGroupController extends BaseCRUDJsonBodyMappingController<Pa ...@@ -52,8 +52,13 @@ public class PictureGroupController extends BaseCRUDJsonBodyMappingController<Pa
if(paramEntities.isEmpty()){ if(paramEntities.isEmpty()){
max = 1; max = 1;
}else { }else {
ParamEntity maxEntity = paramEntities.stream().max(Comparator.comparing(ParamEntity::getParamKey)).get(); for(ParamEntity item:paramEntities){
max = DataUtil.converStr2Int(maxEntity.getParamKey(),paramEntities.size())+1; int temp = DataUtil.converStr2Int(item.getParamKey(),0);
if(max < temp){
max = temp;
}
}
max++;
} }
entity.setParamKey(max+""); entity.setParamKey(max+"");
entity.setName("素材分组"); entity.setName("素材分组");
......
package com.mortals.xhx.module.question.web; package com.mortals.xhx.module.question.web;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.IBaseEnum; import com.mortals.framework.common.IBaseEnum;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
...@@ -55,6 +56,7 @@ public class QuestionRecordController extends BaseCRUDJsonBodyMappingController< ...@@ -55,6 +56,7 @@ public class QuestionRecordController extends BaseCRUDJsonBodyMappingController<
} }
@PostMapping({"ask"}) @PostMapping({"ask"})
@UnAuth
public String ask(@RequestBody QuestionRecordEntity entity) { public String ask(@RequestBody QuestionRecordEntity entity) {
Map<String, Object> model = new HashMap(); Map<String, Object> model = new HashMap();
...@@ -62,14 +64,19 @@ public class QuestionRecordController extends BaseCRUDJsonBodyMappingController< ...@@ -62,14 +64,19 @@ public class QuestionRecordController extends BaseCRUDJsonBodyMappingController<
String busiDesc = "新增咨询" + this.getModuleDesc(); String busiDesc = "新增咨询" + this.getModuleDesc();
int code = 1; int code = 1;
try { try {
if(this.getCurUser()==null||this.getCurUser().getUserType()!= Constant.CUSTOMER_USER){ if(this.getCurUser()==null){
throw new AppException("非法用户,不可访问"); entity.setCustomerId(-1l);
} entity.setCustName("游客");
entity.setContactTelphone("12345678901");
entity.setOrganization("游客");
}else {
CustomerEntity customerEntity = customerService.get(this.getCurUser().getId()); CustomerEntity customerEntity = customerService.get(this.getCurUser().getId());
entity.setCustomerId(this.getCurUser().getId()); entity.setCustomerId(this.getCurUser().getId());
entity.setCustName(customerEntity.getCustName()); entity.setCustName(customerEntity.getCustName());
entity.setContactTelphone(customerEntity.getContactTelphone()); entity.setContactTelphone(customerEntity.getContactTelphone());
entity.setOrganization(customerEntity.getOrganization()); entity.setOrganization(customerEntity.getOrganization());
}
entity = this.service.ask(entity,context); entity = this.service.ask(entity,context);
model.put("entity", entity); model.put("entity", entity);
......
...@@ -18,12 +18,6 @@ spring: ...@@ -18,12 +18,6 @@ spring:
jackson: jackson:
date-format: yyyy-MM-dd HH:mm:ss date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8 time-zone: GMT+8
rabbitmq:
host: @profiles.rabbitmq.host@
port: @profiles.rabbitmq.port@
username: @profiles.rabbitmq.username@
password: @profiles.rabbitmq.password@
virtualHost: @profiles.rabbitmq.virtualhost@
security: security:
enable: true enable: true
user: user:
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
<result property="updateTime" column="updateTime" /> <result property="updateTime" column="updateTime" />
<result property="lastLoginTime" column="lastLoginTime" /> <result property="lastLoginTime" column="lastLoginTime" />
<result property="lastLoginAddress" column="lastLoginAddress" /> <result property="lastLoginAddress" column="lastLoginAddress" />
<result property="openId" column="openId" />
<result property="customerDesignPictures" column="customerDesignPictures" /> <result property="customerDesignPictures" column="customerDesignPictures" />
<result property="customerDesignVideos" column="customerDesignVideos" /> <result property="customerDesignVideos" column="customerDesignVideos" />
</resultMap> </resultMap>
...@@ -67,4 +68,23 @@ ...@@ -67,4 +68,23 @@
</trim> </trim>
</select> </select>
<!-- 用户统计 -->
<select id="getCensus" parameterType="paramDto" resultType="com.mortals.xhx.module.customer.model.vo.CustomerCensusVo">
SELECT
memberLevel,
count(id) AS customerCount
FROM
mortals_xhx_customer t
GROUP BY
t.memberLevel
</select>
<!-- 用户统计 -->
<select id="getDesignCensus" parameterType="paramDto" resultType="com.mortals.xhx.module.customer.model.vo.CustomerDesignCensusVo">
SELECT
sum(customerDesignPictures) AS picturesCount,
sum(customerDesignVideos) AS videosCount
FROM
mortals_xhx_customer_work_design_stat
</select>
</mapper> </mapper>
\ No newline at end of file
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