添加客户注册
parent
f856607eaa
commit
e133f507f2
|
|
@ -0,0 +1,74 @@
|
||||||
|
package com.cowr.common.enums;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
100 超市管理员
|
||||||
|
101 超市管理调度
|
||||||
|
102 超市装卸货
|
||||||
|
|
||||||
|
201 物流管理人员
|
||||||
|
202 司机
|
||||||
|
|
||||||
|
300 注册用户
|
||||||
|
400 占位
|
||||||
|
|
||||||
|
500 公司总经理,权限:查看、付费审核、退费审核
|
||||||
|
501 公司财务人员,权限:查看、付费、退费
|
||||||
|
502 公司领导,权限:查看
|
||||||
|
*/
|
||||||
|
public enum RoleEnum {
|
||||||
|
DEVOPS(99),
|
||||||
|
SUPERADMIN(100),
|
||||||
|
SUPERCTRL(101),
|
||||||
|
SUPERSTEVEDORE(102),
|
||||||
|
|
||||||
|
TRANCOADMIN(201),
|
||||||
|
TRANCODRIVER(202),
|
||||||
|
|
||||||
|
CUSTOMER(300),
|
||||||
|
|
||||||
|
PRESIDENT(500),
|
||||||
|
TREASURER(501),
|
||||||
|
PRESIDENTVIEW(502)
|
||||||
|
;
|
||||||
|
|
||||||
|
private Integer roleid;
|
||||||
|
|
||||||
|
public Integer getRoleid() {
|
||||||
|
return roleid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleid(Integer roleid) {
|
||||||
|
this.roleid = roleid;
|
||||||
|
}
|
||||||
|
|
||||||
|
RoleEnum(Integer roleid){
|
||||||
|
this.roleid = roleid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断 roleid 是否合法
|
||||||
|
* @param roleid
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static boolean hasRoleId(int roleid){
|
||||||
|
for(RoleEnum roleEnum : RoleEnum.values()){
|
||||||
|
if(roleEnum.roleid == roleid){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<Integer> getRoleIdArr(){
|
||||||
|
List<Integer> list = new ArrayList<>();
|
||||||
|
for(RoleEnum roleEnum : RoleEnum.values()){
|
||||||
|
list.add(roleEnum.getRoleid());
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -12,6 +12,7 @@ import java.util.regex.Pattern;
|
||||||
|
|
||||||
public class StrUtil {
|
public class StrUtil {
|
||||||
public static final String regphone = "^1[3|4|5|7|8|9][\\d]{9}$"; // 放的比较宽
|
public static final String regphone = "^1[3|4|5|7|8|9][\\d]{9}$"; // 放的比较宽
|
||||||
|
public static final String regphone_tel = "^((0\\d{2,3}-\\d{7,8})|(1[3584]\\d{9}))$"; // 座机或者手机
|
||||||
public static final String DEFAULT_PATH_SEPARATOR = ",";
|
public static final String DEFAULT_PATH_SEPARATOR = ",";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -88,11 +88,11 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* name: phone
|
* name: phone
|
||||||
* type: CHAR(11)
|
* type: VARCHAR(20)
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
* @param phone 开票电话
|
* @param phone 开票电话(可以是座机)
|
||||||
*/
|
*/
|
||||||
@JSONField(name="phone")
|
@JSONField(name="phone")
|
||||||
public void setPhone(String phone) {
|
public void setPhone(String phone) {
|
||||||
|
|
@ -101,7 +101,7 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return phone 开票电话
|
* @return phone 开票电话(可以是座机)
|
||||||
*/
|
*/
|
||||||
@JSONField(name="phone")
|
@JSONField(name="phone")
|
||||||
public String getPhone() {
|
public String getPhone() {
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,7 @@ public abstract class BaseCustomerReceiver<M extends BaseCustomerReceiver<M>> ex
|
||||||
/**
|
/**
|
||||||
* name: lgtd
|
* name: lgtd
|
||||||
* type: DECIMAL(12,8)
|
* type: DECIMAL(12,8)
|
||||||
* isNullable: NO
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
* @param lgtd 收货经度
|
* @param lgtd 收货经度
|
||||||
|
|
@ -155,7 +155,7 @@ public abstract class BaseCustomerReceiver<M extends BaseCustomerReceiver<M>> ex
|
||||||
/**
|
/**
|
||||||
* name: lttd
|
* name: lttd
|
||||||
* type: DECIMAL(12,8)
|
* type: DECIMAL(12,8)
|
||||||
* isNullable: NO
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
* @param lttd 收货纬度
|
* @param lttd 收货纬度
|
||||||
|
|
@ -180,7 +180,7 @@ public abstract class BaseCustomerReceiver<M extends BaseCustomerReceiver<M>> ex
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
* @param memo 欸住
|
* @param memo 备注
|
||||||
*/
|
*/
|
||||||
@JSONField(name="memo")
|
@JSONField(name="memo")
|
||||||
public void setMemo(java.lang.String memo) {
|
public void setMemo(java.lang.String memo) {
|
||||||
|
|
@ -189,7 +189,7 @@ public abstract class BaseCustomerReceiver<M extends BaseCustomerReceiver<M>> ex
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return memo 欸住
|
* @return memo 备注
|
||||||
*/
|
*/
|
||||||
@JSONField(name="memo")
|
@JSONField(name="memo")
|
||||||
public java.lang.String getMemo() {
|
public java.lang.String getMemo() {
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import com.cowr.common.Const;
|
||||||
import com.cowr.common.base.BaseModel;
|
import com.cowr.common.base.BaseModel;
|
||||||
import com.cowr.common.base.BaseService;
|
import com.cowr.common.base.BaseService;
|
||||||
import com.cowr.common.enums.Enums;
|
import com.cowr.common.enums.Enums;
|
||||||
|
import com.cowr.common.enums.RoleEnum;
|
||||||
import com.cowr.common.enums.UserTypeEnum;
|
import com.cowr.common.enums.UserTypeEnum;
|
||||||
import com.cowr.common.view.PageParam;
|
import com.cowr.common.view.PageParam;
|
||||||
import com.cowr.common.view.Result;
|
import com.cowr.common.view.Result;
|
||||||
|
|
@ -92,7 +93,7 @@ public class SysuserSyncService extends BaseService {
|
||||||
*/
|
*/
|
||||||
public boolean isTreasurer(Integer roleid) {
|
public boolean isTreasurer(Integer roleid) {
|
||||||
if (roleid == null) return false;
|
if (roleid == null) return false;
|
||||||
return roleid.equals(501);
|
return roleid.equals(RoleEnum.TREASURER.getRoleid());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -104,12 +105,12 @@ public class SysuserSyncService extends BaseService {
|
||||||
*/
|
*/
|
||||||
public boolean isPresident(Integer roleid) {
|
public boolean isPresident(Integer roleid) {
|
||||||
if (roleid == null) return false;
|
if (roleid == null) return false;
|
||||||
return roleid.equals(500);
|
return roleid.equals(RoleEnum.PRESIDENT.getRoleid());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPresidentView(Integer roleid) {
|
public boolean isPresidentView(Integer roleid) {
|
||||||
if (roleid == null) return false;
|
if (roleid == null) return false;
|
||||||
return roleid.equals(502);
|
return roleid.equals(RoleEnum.PRESIDENTVIEW.getRoleid());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -120,7 +121,7 @@ public class SysuserSyncService extends BaseService {
|
||||||
*/
|
*/
|
||||||
public boolean isTrancoAdmin(Integer roleid) {
|
public boolean isTrancoAdmin(Integer roleid) {
|
||||||
if (roleid == null) return false;
|
if (roleid == null) return false;
|
||||||
return roleid.equals(201);
|
return roleid.equals(RoleEnum.TRANCOADMIN.getRoleid());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -131,12 +132,12 @@ public class SysuserSyncService extends BaseService {
|
||||||
*/
|
*/
|
||||||
public boolean isTrancoDriver(Integer roleid) {
|
public boolean isTrancoDriver(Integer roleid) {
|
||||||
if (roleid == null) return false;
|
if (roleid == null) return false;
|
||||||
return roleid.equals(202);
|
return roleid.equals(RoleEnum.TRANCODRIVER.getRoleid());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isConfigAdmin(Integer roleid) {
|
public boolean isConfigAdmin(Integer roleid) {
|
||||||
if (roleid == null) return false;
|
if (roleid == null) return false;
|
||||||
return roleid.equals(99);
|
return roleid.equals(RoleEnum.DEVOPS.getRoleid());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
# mysql
|
# mysql
|
||||||
# GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.119' IDENTIFIED BY 'Local_1' WITH GRANT OPTION;
|
# GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.119' IDENTIFIED BY 'Local_1' WITH GRANT OPTION;
|
||||||
#jdbcUrl=jdbc:mysql://rm-wz9wa070076b2uge2ro.mysql.rds.aliyuncs.com:3306/ssjy_xsx_dev?characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull&useInformationSchema=true&serverTimezone=GMT%2B8&autoReconnect=true
|
jdbcUrl=jdbc:mysql://rm-wz9wa070076b2uge2ro.mysql.rds.aliyuncs.com:3306/ssjy_xsx_dev?characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull&useInformationSchema=true&serverTimezone=GMT%2B8&autoReconnect=true
|
||||||
#user=ssjy_xsx
|
user=ssjy_xsx
|
||||||
#password=Ssjy_xs_890
|
password=Ssjy_xs_890
|
||||||
|
|
||||||
jdbcUrl=jdbc:mysql://192.168.1.119:3306/ssjy_xsx_dev?characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull&useInformationSchema=true&serverTimezone=GMT%2B8&autoReconnect=true
|
#jdbcUrl=jdbc:mysql://192.168.1.119:3306/ssjy_xsx_dev?characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull&useInformationSchema=true&serverTimezone=GMT%2B8&autoReconnect=true
|
||||||
user=root
|
#user=root
|
||||||
password=Local_1
|
#password=Local_1
|
||||||
|
|
||||||
# redis
|
# redis
|
||||||
redis.basekey = ssjcgl_xsx_dev
|
redis.basekey = ssjcgl_xsx_dev
|
||||||
redis.ip=192.168.1.119
|
redis.ip=r-wz9168ab2f2f7ec4pd.redis.rds.aliyuncs.com
|
||||||
redis.port=6379
|
redis.port=6379
|
||||||
redis.pwd=
|
redis.pwd=CoWR1111
|
||||||
redis.db=
|
redis.db=13
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
package com.cowr.service.ssjygl.system.sysuser;
|
||||||
|
|
||||||
|
import com.cowr.common.utils.StrUtil;
|
||||||
|
import com.cowr.common.validator.CrudParamValidator;
|
||||||
|
import com.cowr.common.view.Result;
|
||||||
|
import com.jfinal.core.Controller;
|
||||||
|
|
||||||
|
public class RegisterUserValidator extends CrudParamValidator {
|
||||||
|
@Override
|
||||||
|
protected void validate(Controller c) {
|
||||||
|
validateRegex("sysuser.phone", StrUtil.regphone, "sysuser.phone", "用户手机号格式错误");
|
||||||
|
validateString("sysuser.name", 1, 8, "sysuser.name", "用户姓名长度在1~8之间"); // 必填项,字段长度必须大于0,不能超过最大长度
|
||||||
|
validateString("sysuser.password", 6, 20, "sysuser.password", "用户密码长度在6~20之间"); // 必填项,字段长度必须大于0,不能超过最大长度
|
||||||
|
|
||||||
|
validateString("customer.texpayer_name", 1, 255, "customer.texpayer_name", "公司名称的长度在1~255之间");
|
||||||
|
validateString("customer.address", 1, 256, "customer.address", "公司地址的长度在1~255之间");
|
||||||
|
validateString("customer.phone", 1, 20, "customer.phone", "开票电话格式不正确");
|
||||||
|
validateString("customer.texpayer_num", 1, 20, "customer.texpayer_num", "纳税人识别号格式不正确");
|
||||||
|
validateString("customer.bank_name", 1, 128, "customer.bank_name", "开户银行名称格式不正确");
|
||||||
|
validateString("customer.bank_account", 1, 20, "customer.bank_account", "开户银行账号格式不正确");
|
||||||
|
validateString("customer.memo", 0, 256, "customer.memo", "备注长度在0~256之间");
|
||||||
|
|
||||||
|
validateString("receiver.name", 1, 128, "receiver.name", "收货人姓名在1~8之间");
|
||||||
|
validateRegex("receiver.phone", StrUtil.regphone, "receiver.phone", "收货人手机号格式不正确");
|
||||||
|
validateString("receiver.address", 1, 256, "receiver.address", "收获地址长度在1~256之间");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void handleError(Controller c) {
|
||||||
|
c.renderJson(Result.failed(getErrmsg()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -4,6 +4,8 @@ import com.cowr.common.Const;
|
||||||
import com.cowr.common.utils.StrUtil;
|
import com.cowr.common.utils.StrUtil;
|
||||||
import com.cowr.common.view.PageParam;
|
import com.cowr.common.view.PageParam;
|
||||||
import com.cowr.common.view.Result;
|
import com.cowr.common.view.Result;
|
||||||
|
import com.cowr.model.Customer;
|
||||||
|
import com.cowr.model.CustomerReceiver;
|
||||||
import com.cowr.model.Sysuser;
|
import com.cowr.model.Sysuser;
|
||||||
import com.cowr.service.ssjygl.main.AuthInterceptor;
|
import com.cowr.service.ssjygl.main.AuthInterceptor;
|
||||||
import com.cowr.ssjygl.system.sysuser.SysuserPKValidator;
|
import com.cowr.ssjygl.system.sysuser.SysuserPKValidator;
|
||||||
|
|
@ -27,7 +29,7 @@ public class SysuserController extends Controller {
|
||||||
* 不存在 data = false
|
* 不存在 data = false
|
||||||
*/
|
*/
|
||||||
@Before(SysuserPKValidator.class)
|
@Before(SysuserPKValidator.class)
|
||||||
public void checkExistsByPk(){
|
public void checkExistsByPk() {
|
||||||
Sysuser model = getModel(Sysuser.class, "", true); // 忽略不在model中的字段
|
Sysuser model = getModel(Sysuser.class, "", true); // 忽略不在model中的字段
|
||||||
renderJson(SysuserSyncService.me.checkExistsByPk(model));
|
renderJson(SysuserSyncService.me.checkExistsByPk(model));
|
||||||
}
|
}
|
||||||
|
|
@ -36,7 +38,7 @@ public class SysuserController extends Controller {
|
||||||
* 新增 sysuser
|
* 新增 sysuser
|
||||||
*/
|
*/
|
||||||
@Before(SysuserValidator.class)
|
@Before(SysuserValidator.class)
|
||||||
public void save(){
|
public void save() {
|
||||||
Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token"));
|
Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token"));
|
||||||
|
|
||||||
if (tokenuser == null) {
|
if (tokenuser == null) {
|
||||||
|
|
@ -52,7 +54,7 @@ public class SysuserController extends Controller {
|
||||||
* 删除 sysuser
|
* 删除 sysuser
|
||||||
*/
|
*/
|
||||||
@Before(SysuserPKValidator.class)
|
@Before(SysuserPKValidator.class)
|
||||||
public void del(){
|
public void del() {
|
||||||
Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token"));
|
Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token"));
|
||||||
|
|
||||||
if (tokenuser == null) {
|
if (tokenuser == null) {
|
||||||
|
|
@ -68,7 +70,7 @@ public class SysuserController extends Controller {
|
||||||
* 恢复 sysuser
|
* 恢复 sysuser
|
||||||
*/
|
*/
|
||||||
@Before(SysuserPKValidator.class)
|
@Before(SysuserPKValidator.class)
|
||||||
public void restore(){
|
public void restore() {
|
||||||
Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token"));
|
Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token"));
|
||||||
|
|
||||||
if (tokenuser == null) {
|
if (tokenuser == null) {
|
||||||
|
|
@ -84,7 +86,7 @@ public class SysuserController extends Controller {
|
||||||
* 修改 sysuser
|
* 修改 sysuser
|
||||||
*/
|
*/
|
||||||
@Before(SysuserValidator.class)
|
@Before(SysuserValidator.class)
|
||||||
public void edit(){
|
public void edit() {
|
||||||
Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token"));
|
Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token"));
|
||||||
|
|
||||||
if (tokenuser == null) {
|
if (tokenuser == null) {
|
||||||
|
|
@ -99,9 +101,9 @@ public class SysuserController extends Controller {
|
||||||
/**
|
/**
|
||||||
* 分页查找 sysuser
|
* 分页查找 sysuser
|
||||||
*/
|
*/
|
||||||
public void find(){
|
public void find() {
|
||||||
PageParam pp = getBean(PageParam.class, "", true);
|
PageParam pp = getBean(PageParam.class, "", true);
|
||||||
String name = get("name", "");
|
String name = get("name", "");
|
||||||
String phone = get("phone", "");
|
String phone = get("phone", "");
|
||||||
Integer del = getInt("del", Const.LOGIC_DEL_VALID); // 默认显示未删除的
|
Integer del = getInt("del", Const.LOGIC_DEL_VALID); // 默认显示未删除的
|
||||||
Integer type = getInt("type");
|
Integer type = getInt("type");
|
||||||
|
|
@ -113,13 +115,13 @@ public class SysuserController extends Controller {
|
||||||
* 按主键查找单个对象 sysuser
|
* 按主键查找单个对象 sysuser
|
||||||
*/
|
*/
|
||||||
@Before(SysuserPKValidator.class)
|
@Before(SysuserPKValidator.class)
|
||||||
public void findByPk(){
|
public void findByPk() {
|
||||||
Sysuser model = getModel(Sysuser.class, "", true); // 忽略不在model中的字段
|
Sysuser model = getModel(Sysuser.class, "", true); // 忽略不在model中的字段
|
||||||
renderJson(SysuserSyncService.me.findByPk(model));
|
renderJson(SysuserSyncService.me.findByPk(model));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Clear(AuthInterceptor.class)
|
@Clear(AuthInterceptor.class)
|
||||||
public void login(){
|
public void login() {
|
||||||
String name = get("name", "").trim();
|
String name = get("name", "").trim();
|
||||||
String phone = get("phone", "").trim();
|
String phone = get("phone", "").trim();
|
||||||
String password = get("password", "");
|
String password = get("password", "");
|
||||||
|
|
@ -130,13 +132,13 @@ public class SysuserController extends Controller {
|
||||||
/**
|
/**
|
||||||
* 检查手机号是否已经存在
|
* 检查手机号是否已经存在
|
||||||
*/
|
*/
|
||||||
public void checkPhone(){
|
public void checkPhone() {
|
||||||
String phone = get("phone", "");
|
String phone = get("phone", "");
|
||||||
|
|
||||||
// 先判断手机号是否符合格式要求,然后再判断数据库是否已经存在
|
// 先判断手机号是否符合格式要求,然后再判断数据库是否已经存在
|
||||||
if(!StrUtil.isPhone(phone)){
|
if (!StrUtil.isPhone(phone)) {
|
||||||
renderJson(Result.success(false));
|
renderJson(Result.success(false));
|
||||||
}else{
|
} else {
|
||||||
renderJson(Result.success(SysuserSyncService.me.checkPhone(phone)));
|
renderJson(Result.success(SysuserSyncService.me.checkPhone(phone)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -144,7 +146,7 @@ public class SysuserController extends Controller {
|
||||||
/**
|
/**
|
||||||
* 修改密码
|
* 修改密码
|
||||||
*/
|
*/
|
||||||
public void modpwd(){
|
public void modpwd() {
|
||||||
String token = get("token", "");
|
String token = get("token", "");
|
||||||
String oldpwd = get("oldpwd", "");
|
String oldpwd = get("oldpwd", "");
|
||||||
String newpwd = get("newpwd", "");
|
String newpwd = get("newpwd", "");
|
||||||
|
|
@ -156,7 +158,7 @@ public class SysuserController extends Controller {
|
||||||
* 按主键查找单个对象 sysuser
|
* 按主键查找单个对象 sysuser
|
||||||
*/
|
*/
|
||||||
@Before(SysuserPKValidator.class)
|
@Before(SysuserPKValidator.class)
|
||||||
public void resetpwd(){
|
public void resetpwd() {
|
||||||
Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token"));
|
Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token"));
|
||||||
|
|
||||||
if (tokenuser == null) {
|
if (tokenuser == null) {
|
||||||
|
|
@ -167,4 +169,18 @@ public class SysuserController extends Controller {
|
||||||
Sysuser model = getModel(Sysuser.class, "", true); // 忽略不在model中的字段
|
Sysuser model = getModel(Sysuser.class, "", true); // 忽略不在model中的字段
|
||||||
renderJson(SysuserSyncService.me.resetPassword(model, tokenuser));
|
renderJson(SysuserSyncService.me.resetPassword(model, tokenuser));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户注册
|
||||||
|
*/
|
||||||
|
@Clear(AuthInterceptor.class)
|
||||||
|
@Before(RegisterUserValidator.class)
|
||||||
|
public void register() {
|
||||||
|
// 两个密码前端验证,提交一个就可以了
|
||||||
|
Sysuser sysuser = getModel(Sysuser.class, "sysuser", true); // 忽略不在model中的字段
|
||||||
|
Customer customer = getModel(Customer.class, "customer", true);
|
||||||
|
CustomerReceiver receiver = getModel(CustomerReceiver.class, "receiver", true);
|
||||||
|
|
||||||
|
renderJson(SysuserSyncService.me.register(sysuser, customer, receiver));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@ package com.cowr.service.ssjygl.system.sysuser;
|
||||||
|
|
||||||
import com.cowr.common.Const;
|
import com.cowr.common.Const;
|
||||||
import com.cowr.common.base.BaseModel;
|
import com.cowr.common.base.BaseModel;
|
||||||
import com.cowr.common.base.BaseService;
|
|
||||||
import com.cowr.common.enums.Enums;
|
import com.cowr.common.enums.Enums;
|
||||||
|
import com.cowr.common.enums.RoleEnum;
|
||||||
import com.cowr.common.enums.UserTypeEnum;
|
import com.cowr.common.enums.UserTypeEnum;
|
||||||
import com.cowr.common.view.PageParam;
|
import com.cowr.common.view.PageParam;
|
||||||
import com.cowr.common.view.Result;
|
import com.cowr.common.view.Result;
|
||||||
|
|
@ -94,7 +94,7 @@ public class SysuserSyncService extends BaseSyncService {
|
||||||
*/
|
*/
|
||||||
public boolean isTreasurer(Integer roleid) {
|
public boolean isTreasurer(Integer roleid) {
|
||||||
if (roleid == null) return false;
|
if (roleid == null) return false;
|
||||||
return roleid.equals(501);
|
return roleid.equals(RoleEnum.TREASURER.getRoleid());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -106,12 +106,12 @@ public class SysuserSyncService extends BaseSyncService {
|
||||||
*/
|
*/
|
||||||
public boolean isPresident(Integer roleid) {
|
public boolean isPresident(Integer roleid) {
|
||||||
if (roleid == null) return false;
|
if (roleid == null) return false;
|
||||||
return roleid.equals(500);
|
return roleid.equals(RoleEnum.PRESIDENT.getRoleid());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPresidentView(Integer roleid) {
|
public boolean isPresidentView(Integer roleid) {
|
||||||
if (roleid == null) return false;
|
if (roleid == null) return false;
|
||||||
return roleid.equals(502);
|
return roleid.equals(RoleEnum.PRESIDENTVIEW.getRoleid());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -122,7 +122,7 @@ public class SysuserSyncService extends BaseSyncService {
|
||||||
*/
|
*/
|
||||||
public boolean isTrancoAdmin(Integer roleid) {
|
public boolean isTrancoAdmin(Integer roleid) {
|
||||||
if (roleid == null) return false;
|
if (roleid == null) return false;
|
||||||
return roleid.equals(201);
|
return roleid.equals(RoleEnum.TRANCOADMIN.getRoleid());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -133,12 +133,12 @@ public class SysuserSyncService extends BaseSyncService {
|
||||||
*/
|
*/
|
||||||
public boolean isTrancoDriver(Integer roleid) {
|
public boolean isTrancoDriver(Integer roleid) {
|
||||||
if (roleid == null) return false;
|
if (roleid == null) return false;
|
||||||
return roleid.equals(202);
|
return roleid.equals(RoleEnum.TRANCODRIVER.getRoleid());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isConfigAdmin(Integer roleid) {
|
public boolean isConfigAdmin(Integer roleid) {
|
||||||
if (roleid == null) return false;
|
if (roleid == null) return false;
|
||||||
return roleid.equals(99);
|
return roleid.equals(RoleEnum.DEVOPS.getRoleid());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -235,13 +235,7 @@ public class SysuserSyncService extends BaseSyncService {
|
||||||
@Override
|
@Override
|
||||||
public boolean run() throws SQLException {
|
public boolean run() throws SQLException {
|
||||||
try {
|
try {
|
||||||
boolean ret = model.save();
|
return model.save() && SyncTaskService.me.save(new SyncTask().addSaveData(model))
|
||||||
|
|
||||||
if (!ret) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return SyncTaskService.me.save(new SyncTask().addSaveData(model))
|
|
||||||
&& ModifyLogService.me.save(model, null, Enums.DataOpType.SAVE.getId(), tokenuser);
|
&& ModifyLogService.me.save(model, null, Enums.DataOpType.SAVE.getId(), tokenuser);
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
|
|
@ -623,4 +617,58 @@ public class SysuserSyncService extends BaseSyncService {
|
||||||
|
|
||||||
return Db.paginate(pp.getPage(), pp.getSize(), "select * ", sqlbuf.toString(), paraList.toArray());
|
return Db.paginate(pp.getPage(), pp.getSize(), "select * ", sqlbuf.toString(), paraList.toArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Result register(Sysuser sysuser, Customer customer, CustomerReceiver receiver){
|
||||||
|
if(sysuser.checkDuplicate("phone")){
|
||||||
|
return Result.failedstr("手机号 %s 已存在", sysuser.getPhone());
|
||||||
|
}
|
||||||
|
|
||||||
|
if(customer.checkDuplicate("name", "texpayer_name", "texpayer_num", "bank_account")){
|
||||||
|
return Result.failed("用户已存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
sysuser.setType(UserTypeEnum.CUSTOMER.getTypeid());
|
||||||
|
sysuser.setPassword(getPwdMD5(sysuser.getPhone(), sysuser.getPassword()));
|
||||||
|
|
||||||
|
customer.setName(customer.getTexpayerName());
|
||||||
|
|
||||||
|
boolean ret = Db.tx(new IAtom() {
|
||||||
|
@Override
|
||||||
|
public boolean run() {
|
||||||
|
try{
|
||||||
|
boolean ret = customer.save();
|
||||||
|
|
||||||
|
if(!ret){
|
||||||
|
log.debug("客户信息保存失败");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
sysuser.setEntityId(customer.getId());
|
||||||
|
sysuser.setRole(RoleEnum.CUSTOMER.getRoleid());
|
||||||
|
|
||||||
|
receiver.setCustomerId(customer.getId());
|
||||||
|
|
||||||
|
ret = sysuser.save() && receiver.save();
|
||||||
|
|
||||||
|
if(!ret){
|
||||||
|
log.debug("用户或者收获信息保存失败");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
SyncTask synctask = new SyncTask();
|
||||||
|
synctask.addSaveData(sysuser);
|
||||||
|
synctask.addSaveData(customer);
|
||||||
|
synctask.addSaveData(receiver);
|
||||||
|
|
||||||
|
return SyncTaskService.me.save(synctask);
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return ret ? Result.success("注册成功") : Result.failed("注册失败");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,11 @@ jdbcUrl=jdbc:mysql://rm-wz9wa070076b2uge2ro.mysql.rds.aliyuncs.com:3306/ssjy_xsx
|
||||||
user=ssjy_xsx
|
user=ssjy_xsx
|
||||||
password=Ssjy_xs_890
|
password=Ssjy_xs_890
|
||||||
|
|
||||||
|
# mysql
|
||||||
|
#jdbcUrl=jdbc:mysql://192.168.1.165:3306/ssjy_xsx_service_dev?characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull&useInformationSchema=true&serverTimezone=GMT%2B8&autoReconnect=true
|
||||||
|
#user=root
|
||||||
|
#password=Local_1
|
||||||
|
|
||||||
# redis
|
# redis
|
||||||
redis.basekey = ssjcgl_xsx_dev
|
redis.basekey = ssjcgl_xsx_dev
|
||||||
redis.ip=r-wz9168ab2f2f7ec4pd.redis.rds.aliyuncs.com
|
redis.ip=r-wz9168ab2f2f7ec4pd.redis.rds.aliyuncs.com
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue