custauth
This commit is contained in:
parent
dc28f8f895
commit
d28c08788f
|
|
@ -0,0 +1,194 @@
|
||||||
|
package net.xnzn.constant;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public enum SourceTypeEnum {
|
||||||
|
WECHAT_SMALL_PRO(1, "微信小程序"),
|
||||||
|
WECHAT_OFFACCT(2, "微信公众号"),
|
||||||
|
WECHAT_ENTERPRISE(3, "企业微信"),
|
||||||
|
DING_TALK(4, "钉钉"),
|
||||||
|
ALI_LIFE_CODE(5, "支付宝"),
|
||||||
|
ABC_MOBILE(6, "农行掌银"),
|
||||||
|
HT_H5_MOBILE(7, "H5"),
|
||||||
|
OPEN_API(8, "开放接口"),
|
||||||
|
DING_TALK_INSIDE_H5(9, "钉钉内部应用H5"),
|
||||||
|
DING_TALK_SAAS_H5(10, "钉钉第三方企业应用H5"),
|
||||||
|
TENG_YUN_MANAGE_WEB(11, "WEB管理端"),
|
||||||
|
ANDROID_DUAL_SCREEN(20, "双屏消费机"),
|
||||||
|
ANDROID_HANG_CONSUMER(21, "安卓挂式机"),
|
||||||
|
HANDHELD(22, "手持机"),
|
||||||
|
ANDROID_DINING_TABLE(23, "智慧餐台"),
|
||||||
|
ANDROID_SELF_RECHARGE(25, "自助终端"),
|
||||||
|
MEAL_LOCKER(26, "取餐柜"),
|
||||||
|
ANDROID_BINDING(30, "安卓绑定机"),
|
||||||
|
PRINTER(31, "打印机"),
|
||||||
|
PRODUCTION(32, "出品机"),
|
||||||
|
PRODUCTION_TRANSFER(33, "出品机中转设备"),
|
||||||
|
SCAN_CODE_TOLL(34, "扫码收费机"),
|
||||||
|
AUTONOMOUS_WEIGHING(35, "计量主机"),
|
||||||
|
BUFFET(36, "自助点餐机"),
|
||||||
|
WRITE_OFF(37, "核销机"),
|
||||||
|
CALL_MACHINE(38, "叫号机"),
|
||||||
|
COUPON(39, "餐券"),
|
||||||
|
ISSUE(40, "信息发布屏"),
|
||||||
|
VERTICAL_CONSUME(41, "立式消费机"),
|
||||||
|
UFACE_MONITOR(42, "R23WFC-人脸识别终端"),
|
||||||
|
LEAVE_A_PROTOTYPE(43, "留样机"),
|
||||||
|
BATCH_PRODUCTION(44, "批量出品机"),
|
||||||
|
DISH_MANAGE_PAD(46, "排菜平板"),
|
||||||
|
PAYMENT_POS(47, "单屏消费机"),
|
||||||
|
WATER_CONTROL(48, "水控机"),
|
||||||
|
PERSON_FLOW_DETECTOR(49, "客流检测"),
|
||||||
|
AI_DISHES_RECOGNIZER(50, "AI菜品识别"),
|
||||||
|
AI_DISHES_TERMINAL(51, "AI菜品采集终端"),
|
||||||
|
SUPERMARKET_CASH_REGISTER(52, "自助超市收银机"),
|
||||||
|
DUAL_SCREEN_CASH_REGISTER(53, "双屏超市收银机"),
|
||||||
|
WEIGHT_LABEL_PRINT(54, "称重标签打印机"),
|
||||||
|
PRODUCTION_GATEWAY(55, "出品机网关"),
|
||||||
|
SUPERMARKET_PRINT(56, "超市打印机"),
|
||||||
|
PRICE_TAG(57, "营养价签机"),
|
||||||
|
PRICE_TAG_CONTROL(58, "营养价签控制机"),
|
||||||
|
PESTICIDE_RESIDUE_ANALYZER(59, "农药残留检测仪"),
|
||||||
|
DC_TERMINAL(60, "门禁设备"),
|
||||||
|
DC_DOOR(61, "门设备"),
|
||||||
|
GOODS_LOCKER(62, "取货柜"),
|
||||||
|
ORDER_PAD(63, "点餐Pad"),
|
||||||
|
HEIGHT_WEIGHT(64, "身高体重称"),
|
||||||
|
WEIGHT_MARGIN_BOARD(65, "计量主机余量面板"),
|
||||||
|
BUS_DEVICE(66, "车载设备终端"),
|
||||||
|
AI_ELECTRONIC_SCALE(66, "AI电子秤"),
|
||||||
|
WEIGHT_PRODUCTION_IN_ONE(67, "称重出品一体机"),
|
||||||
|
WEIGHT_PRODUCTION_IN_ONE_CONTROLS(68, "称重出品一体机控制终端"),
|
||||||
|
ALI_BUS_FACE_MACHINE(69, "阿里企业码班车刷脸机"),
|
||||||
|
AI_DISHES_UTENSIL_RECOGNIZER(70, "AI菜品餐具识别"),
|
||||||
|
SMART_KEEP_WARM_TERMINAL(71, "智能保温控制终端"),
|
||||||
|
FRESH_CABINET(72, "生鲜柜"),
|
||||||
|
SELF_VISITOR_DEVICE(73, "自助访客机"),
|
||||||
|
SMART_WEIGHT_CONTAINER(74, "智能称货柜"),
|
||||||
|
DISHES_AI(76, "菜品识别服务器"),
|
||||||
|
DUAL_VISITOR_DEVICE(75, "双屏访客机"),
|
||||||
|
OTHER(100, "其他第三方"),
|
||||||
|
OUTER_THIRD_MACHINE(101, "外部第三方设备"),
|
||||||
|
CANTEEN_VOICE(102, "收银喇叭(食堂)"),
|
||||||
|
MARKET_VOICE(103, "收银喇叭(商超)"),
|
||||||
|
UNKNOW(999, "未知设备");
|
||||||
|
|
||||||
|
private final Integer key;
|
||||||
|
private final String desc;
|
||||||
|
|
||||||
|
private SourceTypeEnum(Integer key, String desc) {
|
||||||
|
this.key = key;
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Map<String, Integer> getDescKeyMap() {
|
||||||
|
Map<String, Integer> map = new HashMap();
|
||||||
|
SourceTypeEnum[] var1 = values();
|
||||||
|
int var2 = var1.length;
|
||||||
|
|
||||||
|
for(int var3 = 0; var3 < var2; ++var3) {
|
||||||
|
SourceTypeEnum temp = var1[var3];
|
||||||
|
map.put(temp.getDesc(), temp.getKey());
|
||||||
|
}
|
||||||
|
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SourceTypeEnum getByDesc(Integer key) {
|
||||||
|
SourceTypeEnum[] var1 = values();
|
||||||
|
int var2 = var1.length;
|
||||||
|
|
||||||
|
for(int var3 = 0; var3 < var2; ++var3) {
|
||||||
|
SourceTypeEnum temp = var1[var3];
|
||||||
|
if (temp.getKey().equals(key)) {
|
||||||
|
return temp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return UNKNOW;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getDesc(Integer key) {
|
||||||
|
SourceTypeEnum[] var1 = values();
|
||||||
|
int var2 = var1.length;
|
||||||
|
|
||||||
|
for(int var3 = 0; var3 < var2; ++var3) {
|
||||||
|
SourceTypeEnum temp = var1[var3];
|
||||||
|
if (temp.getKey().equals(key)) {
|
||||||
|
return temp.getDesc();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<Integer> getMachineTypeList() {
|
||||||
|
List<Integer> machineTypeList = new ArrayList();
|
||||||
|
machineTypeList.add(ANDROID_DUAL_SCREEN.getKey());
|
||||||
|
machineTypeList.add(ANDROID_HANG_CONSUMER.getKey());
|
||||||
|
machineTypeList.add(HANDHELD.getKey());
|
||||||
|
machineTypeList.add(ANDROID_DINING_TABLE.getKey());
|
||||||
|
machineTypeList.add(SCAN_CODE_TOLL.getKey());
|
||||||
|
machineTypeList.add(BUFFET.getKey());
|
||||||
|
machineTypeList.add(UFACE_MONITOR.getKey());
|
||||||
|
machineTypeList.add(LEAVE_A_PROTOTYPE.getKey());
|
||||||
|
return machineTypeList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<Integer> getAppTypeList() {
|
||||||
|
List<Integer> appTypeList = new ArrayList();
|
||||||
|
appTypeList.add(WECHAT_SMALL_PRO.getKey());
|
||||||
|
appTypeList.add(WECHAT_OFFACCT.getKey());
|
||||||
|
appTypeList.add(WECHAT_ENTERPRISE.getKey());
|
||||||
|
appTypeList.add(DING_TALK.getKey());
|
||||||
|
appTypeList.add(ALI_LIFE_CODE.getKey());
|
||||||
|
appTypeList.add(ABC_MOBILE.getKey());
|
||||||
|
appTypeList.add(HT_H5_MOBILE.getKey());
|
||||||
|
return appTypeList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<Integer> getMacMealLineMachineTypeList() {
|
||||||
|
List<Integer> appTypeList = new ArrayList();
|
||||||
|
appTypeList.add(ANDROID_DINING_TABLE.getKey());
|
||||||
|
appTypeList.add(ANDROID_BINDING.getKey());
|
||||||
|
appTypeList.add(PRODUCTION.getKey());
|
||||||
|
appTypeList.add(AUTONOMOUS_WEIGHING.getKey());
|
||||||
|
return appTypeList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<Map<String, Object>> getAllEnumsList() {
|
||||||
|
SourceTypeEnum[] typeEnums = values();
|
||||||
|
List<Map<String, Object>> typeList = new ArrayList();
|
||||||
|
SourceTypeEnum[] var2 = typeEnums;
|
||||||
|
int var3 = typeEnums.length;
|
||||||
|
|
||||||
|
for(int var4 = 0; var4 < var3; ++var4) {
|
||||||
|
SourceTypeEnum typeEnum = var2[var4];
|
||||||
|
Map<String, Object> typeMap = new HashMap();
|
||||||
|
typeMap.put("key", typeEnum.getKey());
|
||||||
|
typeMap.put("value", typeEnum.getDesc());
|
||||||
|
typeList.add(typeMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
return typeList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<Integer> getLoginSourceTypeListOfSingleCustCasual() {
|
||||||
|
List<Integer> typeList = new ArrayList();
|
||||||
|
typeList.add(WECHAT_OFFACCT.getKey());
|
||||||
|
typeList.add(ALI_LIFE_CODE.getKey());
|
||||||
|
typeList.add(HT_H5_MOBILE.getKey());
|
||||||
|
return typeList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getKey() {
|
||||||
|
return this.key;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDesc() {
|
||||||
|
return this.desc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -108,6 +108,12 @@
|
||||||
<version>24.12.0-SNAPSHOT</version>
|
<version>24.12.0-SNAPSHOT</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.guava</groupId>
|
||||||
|
<artifactId>guava</artifactId>
|
||||||
|
<version>33.0.0-jre</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.bonus.auth.constant;
|
||||||
|
|
||||||
|
public enum DelFlagEnum {
|
||||||
|
DEL_TRUE(1, "删除"),
|
||||||
|
DEL_FALSE(2, "正常");
|
||||||
|
|
||||||
|
private final Integer key;
|
||||||
|
private final String value;
|
||||||
|
|
||||||
|
private DelFlagEnum(Integer key, String value) {
|
||||||
|
this.key = key;
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer key() {
|
||||||
|
return this.key;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String value() {
|
||||||
|
return this.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
package com.bonus.auth.controller;
|
package com.bonus.auth.controller;
|
||||||
|
|
||||||
import cn.hutool.core.text.CharSequenceUtil;
|
import cn.hutool.core.text.CharSequenceUtil;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
import com.bonus.auth.config.LoginType;
|
import com.bonus.auth.config.LoginType;
|
||||||
import com.bonus.auth.constant.CustLoginTypeEnum;
|
import com.bonus.auth.constant.CustLoginTypeEnum;
|
||||||
|
import com.bonus.auth.constant.DelFlagEnum;
|
||||||
|
import com.bonus.auth.domain.CustCasual;
|
||||||
import com.bonus.auth.domain.CustInfo;
|
import com.bonus.auth.domain.CustInfo;
|
||||||
import com.bonus.auth.domain.CustInfoAppIdLoginDTO;
|
import com.bonus.auth.domain.CustInfoAppIdLoginDTO;
|
||||||
import com.bonus.auth.domain.CustInfoAppIdLoginVO;
|
import com.bonus.auth.domain.CustInfoAppIdLoginVO;
|
||||||
|
|
@ -13,6 +16,7 @@ import com.bonus.auth.mapper.CustCasualMapper;
|
||||||
import com.bonus.auth.mapper.CustInfoMapper;
|
import com.bonus.auth.mapper.CustInfoMapper;
|
||||||
import com.bonus.auth.service.*;
|
import com.bonus.auth.service.*;
|
||||||
import com.bonus.auth.utils.AesEncryptUtil;
|
import com.bonus.auth.utils.AesEncryptUtil;
|
||||||
|
import com.bonus.auth.utils.Id;
|
||||||
import com.bonus.auth.utils.SM4EncryptUtils;
|
import com.bonus.auth.utils.SM4EncryptUtils;
|
||||||
import com.bonus.common.core.constant.SecurityConstants;
|
import com.bonus.common.core.constant.SecurityConstants;
|
||||||
import com.bonus.common.core.domain.R;
|
import com.bonus.common.core.domain.R;
|
||||||
|
|
@ -33,6 +37,7 @@ import net.xnzn.service.TokenService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
|
@ -86,6 +91,7 @@ public class TokenController {
|
||||||
@Resource
|
@Resource
|
||||||
private CustCasualMapper custCasualMapper;
|
private CustCasualMapper custCasualMapper;
|
||||||
|
|
||||||
|
private static final BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
|
||||||
private static final String CUST_LOGIN_TOKEN_KEY = "cust_login_tokens:";
|
private static final String CUST_LOGIN_TOKEN_KEY = "cust_login_tokens:";
|
||||||
|
|
||||||
// @PostMapping("isAdmin")
|
// @PostMapping("isAdmin")
|
||||||
|
|
@ -129,15 +135,6 @@ public class TokenController {
|
||||||
|
|
||||||
@PostMapping("cust-login")
|
@PostMapping("cust-login")
|
||||||
public R<?> login(@RequestBody LoginBody form) {
|
public R<?> login(@RequestBody LoginBody form) {
|
||||||
// 获取相应的登录策略
|
|
||||||
// LoginStrategy strategy = loginStrategyFactory.getStrategy(form.getLoginType());
|
|
||||||
// if (strategy == null) {
|
|
||||||
// return R.fail("不支持的登录方式");
|
|
||||||
// }
|
|
||||||
// if (form.getLoginType()== LoginType.EMAIL_OTP || form.getLoginType()== LoginType.PHONE_OTP ){
|
|
||||||
// form.setPassword(form.getVerificationCode());
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**对系统并发数进行判断*/
|
/**对系统并发数进行判断*/
|
||||||
long concurrency = 100;
|
long concurrency = 100;
|
||||||
AjaxResult result = configService.getConfigKey("sys.backend.concurrency");
|
AjaxResult result = configService.getConfigKey("sys.backend.concurrency");
|
||||||
|
|
@ -149,10 +146,8 @@ public class TokenController {
|
||||||
if (keys.size() >= concurrency){
|
if (keys.size() >= concurrency){
|
||||||
return R.fail("当前系统用户并发数超过系统配置,请稍后再试");
|
return R.fail("当前系统用户并发数超过系统配置,请稍后再试");
|
||||||
}
|
}
|
||||||
|
CustInfoAppIdLoginVO custInfo = custLogin(form);
|
||||||
CustInfoAppIdLoginVO login = custLogin(form);
|
return R.ok(null); //(tokenService.createToken(custInfo));
|
||||||
//logService.saveLogin(form.getUsername(), "登录", "登录成功", null, "成功");
|
|
||||||
return R.ok(null); //(tokenService.createToken(login));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private CustInfoAppIdLoginVO custLogin(LoginBody content) {
|
private CustInfoAppIdLoginVO custLogin(LoginBody content) {
|
||||||
|
|
@ -198,11 +193,38 @@ public class TokenController {
|
||||||
throw new ServiceException("密码错误");
|
throw new ServiceException("密码错误");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
logService.saveLogin(custInfo.getCustName() + "" + custInfo.getMobile(), "登录", "登录成功", null, "成功");
|
||||||
return null; //this.addOrUpdateCustCasual(sourceType, result);
|
return this.addOrUpdateCustCasual(content.getSourceType(), result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CustInfoAppIdLoginVO addOrUpdateCustCasual(Integer sourceType, CustInfoAppIdLoginVO result) {
|
||||||
|
Long custId = result.getCustId();
|
||||||
|
CustCasual custCasual = this.custCasualMapper.selectCustCasualByCustId(custId, sourceType, DelFlagEnum.DEL_FALSE.key());
|
||||||
|
String openid;
|
||||||
|
if (Objects.isNull(custCasual)) {
|
||||||
|
CustCasual insertCasual = new CustCasual();
|
||||||
|
openid = IdUtil.simpleUUID();
|
||||||
|
insertCasual.setCasualId(Id.next());
|
||||||
|
insertCasual.setCasualName(result.getCustName());
|
||||||
|
insertCasual.setCustId(result.getCustId());
|
||||||
|
insertCasual.setMobile(result.getMobile());
|
||||||
|
insertCasual.setOpenid(openid);
|
||||||
|
insertCasual.setSourceType(sourceType);
|
||||||
|
this.custCasualMapper.addCustCasual(insertCasual);
|
||||||
|
} else {
|
||||||
|
openid = custCasual.getOpenid();
|
||||||
|
if (StringUtils.isBlank(openid)) {
|
||||||
|
openid = IdUtil.simpleUUID();
|
||||||
|
this.custCasualMapper.updateCustCasual(custCasual);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
result.setOpenid(openid);
|
||||||
|
result.setMobile(AesEncryptUtil.aesEncrypt(result.getMobile()));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取手机验证码
|
* 获取手机验证码
|
||||||
*
|
*
|
||||||
|
|
@ -270,10 +292,10 @@ public class TokenController {
|
||||||
* @param registerBody 注册表单
|
* @param registerBody 注册表单
|
||||||
* @return 注册结果
|
* @return 注册结果
|
||||||
*/
|
*/
|
||||||
@PostMapping("register")
|
// @PostMapping("register")
|
||||||
public R<?> register(@RequestBody RegisterBody registerBody) {
|
// public R<?> register(@RequestBody RegisterBody registerBody) {
|
||||||
sysLoginService.register(registerBody);
|
// sysLoginService.register(registerBody);
|
||||||
logService.saveRegister(registerBody.getMobile(), "注册", "注册成功", null, "成功");
|
// logService.saveRegister(registerBody.getMobile(), "注册", "注册成功", null, "成功");
|
||||||
return R.ok();
|
// return R.ok();
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,13 @@
|
||||||
package com.bonus.auth.domain;
|
package com.bonus.auth.domain;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
@TableName("cust_casual")
|
|
||||||
@ApiModel("临时人员表")
|
@ApiModel("临时人员表")
|
||||||
public class CustCasual extends Model<CustCasual> {
|
public class CustCasual {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@TableId
|
|
||||||
@ApiModelProperty("主键自增")
|
@ApiModelProperty("主键自增")
|
||||||
private Long id;
|
private Long id;
|
||||||
@ApiModelProperty("临时人员id")
|
@ApiModelProperty("临时人员id")
|
||||||
|
|
@ -198,11 +193,6 @@ public class CustCasual extends Model<CustCasual> {
|
||||||
this.uniqueId = uniqueId;
|
this.uniqueId = uniqueId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
|
||||||
Long var10000 = this.getId();
|
|
||||||
return "CustCasual(id=" + var10000 + ", casualId=" + this.getCasualId() + ", casualName=" + this.getCasualName() + ", custId=" + this.getCustId() + ", mobile=" + this.getMobile() + ", email=" + this.getEmail() + ", address=" + this.getAddress() + ", openid=" + this.getOpenid() + ", sourceType=" + this.getSourceType() + ", ifDel=" + this.getIfDel() + ", revision=" + this.getRevision() + ", crby=" + this.getCrby() + ", crtime=" + String.valueOf(this.getCrtime()) + ", upby=" + this.getUpby() + ", uptime=" + String.valueOf(this.getUptime()) + ", alipayContractNum=" + this.getAlipayContractNum() + ", entCodeEmpId=" + this.getEntCodeEmpId() + ", uniqueId=" + this.getUniqueId() + ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
public CustCasual(final Long id, final Long casualId, final String casualName, final Long custId, final String mobile, final String email, final String address, final String openid, final Integer sourceType, final Integer ifDel, final Integer revision, final String crby, final LocalDateTime crtime, final String upby, final LocalDateTime uptime, final String alipayContractNum, final String entCodeEmpId, final String uniqueId) {
|
public CustCasual(final Long id, final Long casualId, final String casualName, final Long custId, final String mobile, final String email, final String address, final String openid, final Integer sourceType, final Integer ifDel, final Integer revision, final String crby, final LocalDateTime crtime, final String upby, final LocalDateTime uptime, final String alipayContractNum, final String entCodeEmpId, final String uniqueId) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.casualId = casualId;
|
this.casualId = casualId;
|
||||||
|
|
@ -343,10 +333,5 @@ public class CustCasual extends Model<CustCasual> {
|
||||||
public CustCasual build() {
|
public CustCasual build() {
|
||||||
return new CustCasual(this.id, this.casualId, this.casualName, this.custId, this.mobile, this.email, this.address, this.openid, this.sourceType, this.ifDel, this.revision, this.crby, this.crtime, this.upby, this.uptime, this.alipayContractNum, this.entCodeEmpId, this.uniqueId);
|
return new CustCasual(this.id, this.casualId, this.casualName, this.custId, this.mobile, this.email, this.address, this.openid, this.sourceType, this.ifDel, this.revision, this.crby, this.crtime, this.upby, this.uptime, this.alipayContractNum, this.entCodeEmpId, this.uniqueId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
|
||||||
Long var10000 = this.id;
|
|
||||||
return "CustCasual.CustCasualBuilder(id=" + var10000 + ", casualId=" + this.casualId + ", casualName=" + this.casualName + ", custId=" + this.custId + ", mobile=" + this.mobile + ", email=" + this.email + ", address=" + this.address + ", openid=" + this.openid + ", sourceType=" + this.sourceType + ", ifDel=" + this.ifDel + ", revision=" + this.revision + ", crby=" + this.crby + ", crtime=" + String.valueOf(this.crtime) + ", upby=" + this.upby + ", uptime=" + String.valueOf(this.uptime) + ", alipayContractNum=" + this.alipayContractNum + ", entCodeEmpId=" + this.entCodeEmpId + ", uniqueId=" + this.uniqueId + ")";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.bonus.auth.domain;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class CustCasualModel extends CustCasual {
|
||||||
|
private String custNum;
|
||||||
|
private String custName;
|
||||||
|
private Integer age;
|
||||||
|
@ApiModelProperty("身份证号")
|
||||||
|
private String idCard;
|
||||||
|
@ApiModelProperty("登录类型")
|
||||||
|
private Integer loginType;
|
||||||
|
private String password;
|
||||||
|
private String code;
|
||||||
|
private Long custId;
|
||||||
|
}
|
||||||
|
|
@ -1,24 +1,17 @@
|
||||||
package com.bonus.auth.domain;
|
package com.bonus.auth.domain;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import net.xnzn.core.common.encrypt.SM4EncDecHandler;
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
@TableName(
|
|
||||||
value = "cust_info",
|
|
||||||
autoResultMap = true
|
|
||||||
)
|
|
||||||
@ApiModel("人员资料表")
|
@ApiModel("人员资料表")
|
||||||
@Data
|
@Data
|
||||||
public class CustInfo {
|
public class CustInfo {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@TableId
|
|
||||||
@ApiModelProperty("主键自增")
|
@ApiModelProperty("主键自增")
|
||||||
private Long id;
|
private Long id;
|
||||||
@ApiModelProperty("人员id")
|
@ApiModelProperty("人员id")
|
||||||
|
|
@ -26,15 +19,8 @@ public class CustInfo {
|
||||||
@ApiModelProperty("人员编号")
|
@ApiModelProperty("人员编号")
|
||||||
private @NotBlank() String custNum;
|
private @NotBlank() String custNum;
|
||||||
@ApiModelProperty("人员姓名")
|
@ApiModelProperty("人员姓名")
|
||||||
@TableField(
|
|
||||||
value = "cust_name",
|
|
||||||
typeHandler = SM4EncDecHandler.class
|
|
||||||
)
|
|
||||||
private @NotBlank() String custName;
|
private @NotBlank() String custName;
|
||||||
@ApiModelProperty("人员姓名")
|
@ApiModelProperty("人员姓名")
|
||||||
@TableField(
|
|
||||||
value = "cust_name_like"
|
|
||||||
)
|
|
||||||
private String custNameLike;
|
private String custNameLike;
|
||||||
@ApiModelProperty("人员限制id")
|
@ApiModelProperty("人员限制id")
|
||||||
private Integer custLimitId;
|
private Integer custLimitId;
|
||||||
|
|
@ -43,24 +29,12 @@ public class CustInfo {
|
||||||
@ApiModelProperty("推送到设备上,生成的用户id")
|
@ApiModelProperty("推送到设备上,生成的用户id")
|
||||||
private String custDeviceId;
|
private String custDeviceId;
|
||||||
@ApiModelProperty("手机号")
|
@ApiModelProperty("手机号")
|
||||||
@TableField(
|
|
||||||
value = "mobile",
|
|
||||||
typeHandler = SM4EncDecHandler.class
|
|
||||||
)
|
|
||||||
private String mobile;
|
private String mobile;
|
||||||
@ApiModelProperty("手机号")
|
@ApiModelProperty("手机尾号")
|
||||||
@TableField(
|
|
||||||
value = "mobile_suffix",
|
|
||||||
typeHandler = SM4EncDecHandler.class
|
|
||||||
)
|
|
||||||
private String mobileSuffix;
|
private String mobileSuffix;
|
||||||
@ApiModelProperty("登录密码")
|
@ApiModelProperty("登录密码")
|
||||||
private String pwd;
|
private String pwd;
|
||||||
@ApiModelProperty("身份证号")
|
@ApiModelProperty("身份证号")
|
||||||
@TableField(
|
|
||||||
value = "id_card",
|
|
||||||
typeHandler = SM4EncDecHandler.class
|
|
||||||
)
|
|
||||||
private String idCard;
|
private String idCard;
|
||||||
@ApiModelProperty("邮箱")
|
@ApiModelProperty("邮箱")
|
||||||
private String email;
|
private String email;
|
||||||
|
|
@ -69,14 +43,8 @@ public class CustInfo {
|
||||||
@ApiModelProperty("年龄")
|
@ApiModelProperty("年龄")
|
||||||
private Integer age;
|
private Integer age;
|
||||||
@ApiModelProperty("生日")
|
@ApiModelProperty("生日")
|
||||||
@TableField(
|
|
||||||
updateStrategy = FieldStrategy.IGNORED
|
|
||||||
)
|
|
||||||
private LocalDate birthday;
|
private LocalDate birthday;
|
||||||
@ApiModelProperty("民族编码")
|
@ApiModelProperty("民族编码")
|
||||||
@TableField(
|
|
||||||
updateStrategy = FieldStrategy.IGNORED
|
|
||||||
)
|
|
||||||
private Integer ethnicityCode;
|
private Integer ethnicityCode;
|
||||||
@ApiModelProperty("籍贯")
|
@ApiModelProperty("籍贯")
|
||||||
private String nativePlace;
|
private String nativePlace;
|
||||||
|
|
@ -91,21 +59,12 @@ public class CustInfo {
|
||||||
@ApiModelProperty("机构全称")
|
@ApiModelProperty("机构全称")
|
||||||
private String orgFullName;
|
private String orgFullName;
|
||||||
@ApiModelProperty("成本中心id")
|
@ApiModelProperty("成本中心id")
|
||||||
@TableField(
|
|
||||||
updateStrategy = FieldStrategy.IGNORED
|
|
||||||
)
|
|
||||||
private Long costCenterId;
|
private Long costCenterId;
|
||||||
@ApiModelProperty("所属位置")
|
@ApiModelProperty("所属位置")
|
||||||
@TableField(
|
|
||||||
updateStrategy = FieldStrategy.IGNORED
|
|
||||||
)
|
|
||||||
private Long placeId;
|
private Long placeId;
|
||||||
@ApiModelProperty("所属位置名称")
|
@ApiModelProperty("所属位置名称")
|
||||||
private String placeFullName;
|
private String placeFullName;
|
||||||
@ApiModelProperty("人员类别")
|
@ApiModelProperty("人员类别")
|
||||||
@TableField(
|
|
||||||
updateStrategy = FieldStrategy.IGNORED
|
|
||||||
)
|
|
||||||
private Integer psnType;
|
private Integer psnType;
|
||||||
@ApiModelProperty("人员类别名称")
|
@ApiModelProperty("人员类别名称")
|
||||||
private String psnTypeName;
|
private String psnTypeName;
|
||||||
|
|
@ -142,19 +101,10 @@ public class CustInfo {
|
||||||
@ApiModelProperty("职务")
|
@ApiModelProperty("职务")
|
||||||
private String position;
|
private String position;
|
||||||
@ApiModelProperty("入职日期")
|
@ApiModelProperty("入职日期")
|
||||||
@TableField(
|
|
||||||
updateStrategy = FieldStrategy.IGNORED
|
|
||||||
)
|
|
||||||
private LocalDate entryDate;
|
private LocalDate entryDate;
|
||||||
@ApiModelProperty("合同签订日期")
|
@ApiModelProperty("合同签订日期")
|
||||||
@TableField(
|
|
||||||
updateStrategy = FieldStrategy.IGNORED
|
|
||||||
)
|
|
||||||
private LocalDate signingDate;
|
private LocalDate signingDate;
|
||||||
@ApiModelProperty("合同到期日期")
|
@ApiModelProperty("合同到期日期")
|
||||||
@TableField(
|
|
||||||
updateStrategy = FieldStrategy.IGNORED
|
|
||||||
)
|
|
||||||
private LocalDate expiryDate;
|
private LocalDate expiryDate;
|
||||||
@ApiModelProperty("人员状态 1-正常 2-注销")
|
@ApiModelProperty("人员状态 1-正常 2-注销")
|
||||||
private Integer custState;
|
private Integer custState;
|
||||||
|
|
@ -162,28 +112,12 @@ public class CustInfo {
|
||||||
private Long likeBatch;
|
private Long likeBatch;
|
||||||
@ApiModelProperty("乐观锁")
|
@ApiModelProperty("乐观锁")
|
||||||
private Integer revision;
|
private Integer revision;
|
||||||
@TableField(
|
|
||||||
value = "crby",
|
|
||||||
fill = FieldFill.INSERT
|
|
||||||
)
|
|
||||||
@ApiModelProperty("创建人")
|
@ApiModelProperty("创建人")
|
||||||
private String crby;
|
private String crby;
|
||||||
@TableField(
|
|
||||||
value = "crtime",
|
|
||||||
fill = FieldFill.INSERT
|
|
||||||
)
|
|
||||||
@ApiModelProperty("创建时间")
|
@ApiModelProperty("创建时间")
|
||||||
private LocalDateTime crtime;
|
private LocalDateTime crtime;
|
||||||
@TableField(
|
|
||||||
value = "upby",
|
|
||||||
fill = FieldFill.UPDATE
|
|
||||||
)
|
|
||||||
@ApiModelProperty("更新人")
|
@ApiModelProperty("更新人")
|
||||||
private String upby;
|
private String upby;
|
||||||
@TableField(
|
|
||||||
value = "uptime",
|
|
||||||
fill = FieldFill.UPDATE
|
|
||||||
)
|
|
||||||
@ApiModelProperty("更新时间")
|
@ApiModelProperty("更新时间")
|
||||||
private LocalDateTime uptime;
|
private LocalDateTime uptime;
|
||||||
@ApiModelProperty("就诊号")
|
@ApiModelProperty("就诊号")
|
||||||
|
|
|
||||||
|
|
@ -28,5 +28,7 @@ public class LoginBody {
|
||||||
private String idCard;
|
private String idCard;
|
||||||
@ApiModelProperty("验证码")
|
@ApiModelProperty("验证码")
|
||||||
private String code;
|
private String code;
|
||||||
|
@ApiModelProperty("来源类型,参考SourceTypeEnum")
|
||||||
|
private Integer sourceType;
|
||||||
private VerificationCodeType verificationCodeType;
|
private VerificationCodeType verificationCodeType;
|
||||||
}
|
}
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
package com.bonus.auth.mapper;
|
package com.bonus.auth.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.bonus.auth.domain.CustCasual;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.bonus.auth.domain.CustCasualModel;
|
||||||
import net.xnzn.core.customer.dto.CustCasualModel;
|
|
||||||
import net.xnzn.core.customer.model.CustCasual;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.apache.ibatis.annotations.Select;
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
@ -11,16 +9,15 @@ import org.apache.ibatis.annotations.Select;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface CustCasualMapper extends BaseMapper<CustCasual> {
|
public interface CustCasualMapper {
|
||||||
List<CustCasualModel> queryPageCustCasual(Page<CustCasualModel> page, @Param("custCasual") CustCasual custCasual);
|
List<CustCasualModel> queryPageCustCasual(@Param("custCasual") CustCasual custCasual);
|
||||||
|
|
||||||
@Select({"select openid from cust_casual where cust_id = #{custId} and source_type = #{sourceType} and if_del = #{ifDel}"})
|
|
||||||
String selectOpenidByCustId(@Param("custId") Long custId, @Param("sourceType") Integer sourceType, @Param("ifDel") Integer ifDel);
|
String selectOpenidByCustId(@Param("custId") Long custId, @Param("sourceType") Integer sourceType, @Param("ifDel") Integer ifDel);
|
||||||
|
|
||||||
@Select({"select casual_id, openid from cust_casual where cust_id = #{custId} and source_type = #{sourceType} and if_del = #{ifDel}"})
|
|
||||||
CustCasual selectCustCasualByCustId(@Param("custId") Long custId, @Param("sourceType") Integer sourceType, @Param("ifDel") Integer ifDel);
|
CustCasual selectCustCasualByCustId(@Param("custId") Long custId, @Param("sourceType") Integer sourceType, @Param("ifDel") Integer ifDel);
|
||||||
|
|
||||||
int updateCustCasual(CustCasual custCasual);
|
int updateCustCasual(CustCasual custCasual);
|
||||||
|
|
||||||
|
int addCustCasual(CustCasual custCasual);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,11 @@
|
||||||
package com.bonus.auth.mapper;
|
package com.bonus.auth.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
import com.bonus.auth.domain.CustInfo;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.bonus.auth.domain.CustInfoAppIdLoginVO;
|
||||||
import net.xnzn.core.customer.model.CustInfo;
|
|
||||||
import net.xnzn.core.customer.vo.*;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import org.apache.ibatis.annotations.Select;
|
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface CustInfoMapper { //extends BaseMapper<CustInfo> {
|
public interface CustInfoMapper {
|
||||||
|
|
||||||
// @Select({"select cust_id, cust_name, cust_num, cust_photo_url, mobile ,pwd from cust_info ${ew.customSqlSegment}"})
|
|
||||||
// CustInfoAppIdLoginVO selectLoginInfo(@Param("ew") Wrapper<CustInfo> wrapper);
|
|
||||||
|
|
||||||
CustInfoAppIdLoginVO selectLoginInfo(CustInfo custInfo);
|
CustInfoAppIdLoginVO selectLoginInfo(CustInfo custInfo);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -92,71 +92,71 @@ public class SysLoginService {
|
||||||
*
|
*
|
||||||
* @param registerBody 注册信息
|
* @param registerBody 注册信息
|
||||||
*/
|
*/
|
||||||
public void register(RegisterBody registerBody) {
|
// public void register(RegisterBody registerBody) {
|
||||||
long startTime = System.currentTimeMillis(); // 记录开始时间
|
// long startTime = System.currentTimeMillis(); // 记录开始时间
|
||||||
String result = convertAndAppend(registerBody.getNickName(), registerBody.getMobile());
|
// String result = convertAndAppend(registerBody.getNickName(), registerBody.getMobile());
|
||||||
int contactType = getContactType(registerBody.getMobile());
|
// int contactType = getContactType(registerBody.getMobile());
|
||||||
|
//
|
||||||
if (contactType == 0) {
|
// if (contactType == 0) {
|
||||||
R<LoginUser> userResult = remoteUserService.getUserInfoByEmail(registerBody.getMobile() , SecurityConstants.INNER);
|
// R<LoginUser> userResult = remoteUserService.getUserInfoByEmail(registerBody.getMobile() , SecurityConstants.INNER);
|
||||||
if (userResult.getData() != null) {
|
// if (userResult.getData() != null) {
|
||||||
throw new ServiceException("联系方式已经注册账号");
|
// throw new ServiceException("联系方式已经注册账号");
|
||||||
}
|
// }
|
||||||
} else if (contactType == 1) {
|
// } else if (contactType == 1) {
|
||||||
R<LoginUser> userResult = remoteUserService.getUserInfoByPhone(registerBody.getMobile() , SecurityConstants.INNER);
|
// R<LoginUser> userResult = remoteUserService.getUserInfoByPhone(registerBody.getMobile() , SecurityConstants.INNER);
|
||||||
if (userResult.getData() != null) {
|
// if (userResult.getData() != null) {
|
||||||
throw new ServiceException("联系方式已经注册账号");
|
// throw new ServiceException("联系方式已经注册账号");
|
||||||
}
|
// }
|
||||||
}else {
|
// }else {
|
||||||
throw new ServiceException("请输入正确的联系方式");
|
// throw new ServiceException("请输入正确的联系方式");
|
||||||
}
|
// }
|
||||||
registerBody.setUsername(result);
|
// registerBody.setUsername(result);
|
||||||
if (StringUtils.isAnyBlank(registerBody.getUsername(), registerBody.getPassword()) ||
|
// if (StringUtils.isAnyBlank(registerBody.getUsername(), registerBody.getPassword()) ||
|
||||||
registerBody.getUsername().length() < UserConstants.USERNAME_MIN_LENGTH ||
|
// registerBody.getUsername().length() < UserConstants.USERNAME_MIN_LENGTH ||
|
||||||
registerBody.getUsername().length() > UserConstants.USERNAME_MAX_LENGTH) {
|
// registerBody.getUsername().length() > UserConstants.USERNAME_MAX_LENGTH) {
|
||||||
recordLogService.saveLogs(registerBody.getUsername(), startTime, "注册参数无效", "账户或密码长度不符合要求", null, "失败");
|
// recordLogService.saveLogs(registerBody.getUsername(), startTime, "注册参数无效", "账户或密码长度不符合要求", null, "失败");
|
||||||
throw new ServiceException("账户或密码长度不符合要求");
|
// throw new ServiceException("账户或密码长度不符合要求");
|
||||||
}
|
// }
|
||||||
if (systemConfig.getRegistersConfig().isVerificationCode()){
|
// if (systemConfig.getRegistersConfig().isVerificationCode()){
|
||||||
passwordValidatorService.checkPhoneCaptcha(registerBody.getMobile(),registerBody.getVerificationCode());
|
// passwordValidatorService.checkPhoneCaptcha(registerBody.getMobile(),registerBody.getVerificationCode());
|
||||||
}
|
// }
|
||||||
AjaxResult ajaxResult = passwordValidatorService.validatePassword(registerBody.getUsername(), registerBody.getPassword());
|
// AjaxResult ajaxResult = passwordValidatorService.validatePassword(registerBody.getUsername(), registerBody.getPassword());
|
||||||
|
//
|
||||||
if (ajaxResult.isError()) {
|
// if (ajaxResult.isError()) {
|
||||||
throw new ServiceException((String) ajaxResult.get("msg"));
|
// throw new ServiceException((String) ajaxResult.get("msg"));
|
||||||
}
|
// }
|
||||||
SysUser sysUser = new SysUser();
|
// SysUser sysUser = new SysUser();
|
||||||
sysUser.setUserName(registerBody.getUsername());
|
// sysUser.setUserName(registerBody.getUsername());
|
||||||
sysUser.setNickName(registerBody.getNickName());
|
// sysUser.setNickName(registerBody.getNickName());
|
||||||
|
//
|
||||||
if (systemConfig.getRegistersConfig().isApprovalStatus()){
|
// if (systemConfig.getRegistersConfig().isApprovalStatus()){
|
||||||
sysUser.setApprovalStatus("0");
|
// sysUser.setApprovalStatus("0");
|
||||||
sysUser.setStatus("1");
|
// sysUser.setStatus("1");
|
||||||
}else {
|
// }else {
|
||||||
sysUser.setApprovalStatus("1");
|
// sysUser.setApprovalStatus("1");
|
||||||
sysUser.setStatus("0");
|
// sysUser.setStatus("0");
|
||||||
}
|
// }
|
||||||
//有要求另加
|
// //有要求另加
|
||||||
sysUser.setPassword(SecurityUtils.encryptPassword(registerBody.getPassword()));
|
// sysUser.setPassword(SecurityUtils.encryptPassword(registerBody.getPassword()));
|
||||||
if (getContactType(registerBody.getMobile()) == 1) {
|
// if (getContactType(registerBody.getMobile()) == 1) {
|
||||||
sysUser.setPhonenumber(registerBody.getMobile());
|
// sysUser.setPhonenumber(registerBody.getMobile());
|
||||||
} else {
|
// } else {
|
||||||
sysUser.setEmail(registerBody.getMobile());
|
// sysUser.setEmail(registerBody.getMobile());
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
try {
|
// try {
|
||||||
R<?> registerResult = remoteUserService.registerUserInfo(sysUser, SecurityConstants.INNER);
|
// R<?> registerResult = remoteUserService.registerUserInfo(sysUser, SecurityConstants.INNER);
|
||||||
if (R.FAIL == registerResult.getCode()) {
|
// if (R.FAIL == registerResult.getCode()) {
|
||||||
recordLogService.saveLogs(registerBody.getUsername(), startTime, "注册失败", registerResult.getMsg(), null, "失败");
|
// recordLogService.saveLogs(registerBody.getUsername(), startTime, "注册失败", registerResult.getMsg(), null, "失败");
|
||||||
throw new ServiceException(registerResult.getMsg());
|
// throw new ServiceException(registerResult.getMsg());
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
recordLogService.recordLogininfor(registerBody.getUsername(), Constants.REGISTER, "注册成功");
|
// recordLogService.recordLogininfor(registerBody.getUsername(), Constants.REGISTER, "注册成功");
|
||||||
} catch (Exception e) {
|
// } catch (Exception e) {
|
||||||
recordLogService.saveLogs(registerBody.getUsername(), startTime, "注册异常", e.getMessage(), null, "失败");
|
// recordLogService.saveLogs(registerBody.getUsername(), startTime, "注册异常", e.getMessage(), null, "失败");
|
||||||
throw new ServiceException("注册失败,请稍后重试");
|
// throw new ServiceException("注册失败,请稍后重试");
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取联系方式类型
|
* 获取联系方式类型
|
||||||
|
|
@ -196,103 +196,45 @@ public class SysLoginService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* i皖送Web端登录
|
// * 先查,如果没有进行创建
|
||||||
* @param ticket
|
// * @param sysUser
|
||||||
* @param iwsWebAppId
|
// * @param loginUser
|
||||||
* @param iwsWebUrl
|
// */
|
||||||
* @return
|
// private void createUser(SysUser sysUser, LoginUser loginUser) {
|
||||||
*/
|
// //通过用户名获取人员信息
|
||||||
public void iwsWebLogin(String ticket, String iwsWebAppId, String iwsWebUrl,LoginUser loginUser,SysUser sysUser) {
|
// R<LoginUser> userResult = remoteUserService.getUserInfo(sysUser.getUserName(), SecurityConstants.INNER);
|
||||||
Map<String, Object> paramMap = new HashMap<>();
|
// if (userResult.getData() == null || R.FAIL == userResult.getCode()) {
|
||||||
paramMap.put("ticket", ticket);
|
// log.info("登录用户不存在,进行创建----");
|
||||||
paramMap.put("appId", iwsWebAppId);
|
// RegisterBody registerBody = new RegisterBody();
|
||||||
RestTemplate restTemplate = new RestTemplate();
|
// registerBody.setUsername(sysUser.getUserName());
|
||||||
ResponseEntity<String> authResponse = restTemplate.getForEntity(iwsWebUrl, String.class, paramMap);
|
// registerBody.setNickName(sysUser.getNickName());
|
||||||
log.info("authResponse:" + authResponse.toString());
|
// registerBody.setMobile(sysUser.getPhonenumber());
|
||||||
if ("200".equals(authResponse.getStatusCode())){
|
// //获取配置中的初始密码
|
||||||
// 根据ResponseEntity<String> responseEntity对象,获取body部分,body为json格式字符串
|
// AjaxResult result = configService.getConfigKey("sys.user.initPassword");
|
||||||
String content = authResponse.getBody();
|
// if (result.isSuccess())
|
||||||
// 将json字符串转化为json对象
|
// {
|
||||||
JSONObject json = JSONObject.parseObject(content);
|
// sysUser.setPassword(result.get("msg").toString());
|
||||||
// 取出data部分对象
|
// }
|
||||||
JSONObject data = json.getJSONObject("data");
|
// //新用户注册
|
||||||
sysUser.setUserName(data.get("userName").toString());
|
// try {
|
||||||
sysUser.setNickName(data.get("name").toString());
|
// register(registerBody);
|
||||||
sysUser.setPhonenumber(data.get("mobile").toString());
|
// //查询用户信息
|
||||||
loginUser.setSysUser(sysUser);
|
// userResult = remoteUserService.getUserInfo(sysUser.getUserName(), SecurityConstants.INNER);
|
||||||
createUser(sysUser,loginUser);
|
// loginUser = userResult.getData();
|
||||||
}
|
// sysUser = loginUser.getSysUser();
|
||||||
}
|
// //初始化一个角色
|
||||||
|
// Long[] roleIds = new Long[5];
|
||||||
|
// // 将数组的第一个元素赋值为 2
|
||||||
|
// roleIds[0] = 2L;
|
||||||
|
// remoteUserService.insertAuthRole(sysUser.getUserId(),roleIds,SecurityConstants.INNER);
|
||||||
|
// }catch (Exception e){
|
||||||
|
// throw new ServiceException("登录失败,请稍后重试");
|
||||||
|
// }
|
||||||
|
// }else {
|
||||||
|
// loginUser = userResult.getData();
|
||||||
|
// sysUser = loginUser.getSysUser();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
/**
|
|
||||||
* 先查,如果没有进行创建
|
|
||||||
* @param sysUser
|
|
||||||
* @param loginUser
|
|
||||||
*/
|
|
||||||
private void createUser(SysUser sysUser, LoginUser loginUser) {
|
|
||||||
//通过用户名获取人员信息
|
|
||||||
R<LoginUser> userResult = remoteUserService.getUserInfo(sysUser.getUserName(), SecurityConstants.INNER);
|
|
||||||
if (userResult.getData() == null || R.FAIL == userResult.getCode()) {
|
|
||||||
log.info("登录用户不存在,进行创建----");
|
|
||||||
RegisterBody registerBody = new RegisterBody();
|
|
||||||
registerBody.setUsername(sysUser.getUserName());
|
|
||||||
registerBody.setNickName(sysUser.getNickName());
|
|
||||||
registerBody.setMobile(sysUser.getPhonenumber());
|
|
||||||
//获取配置中的初始密码
|
|
||||||
AjaxResult result = configService.getConfigKey("sys.user.initPassword");
|
|
||||||
if (result.isSuccess())
|
|
||||||
{
|
|
||||||
sysUser.setPassword(result.get("msg").toString());
|
|
||||||
}
|
|
||||||
//新用户注册
|
|
||||||
try {
|
|
||||||
register(registerBody);
|
|
||||||
//查询用户信息
|
|
||||||
userResult = remoteUserService.getUserInfo(sysUser.getUserName(), SecurityConstants.INNER);
|
|
||||||
loginUser = userResult.getData();
|
|
||||||
sysUser = loginUser.getSysUser();
|
|
||||||
//初始化一个角色
|
|
||||||
Long[] roleIds = new Long[5];
|
|
||||||
// 将数组的第一个元素赋值为 2
|
|
||||||
roleIds[0] = 2L;
|
|
||||||
remoteUserService.insertAuthRole(sysUser.getUserId(),roleIds,SecurityConstants.INNER);
|
|
||||||
}catch (Exception e){
|
|
||||||
throw new ServiceException("登录失败,请稍后重试");
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
loginUser = userResult.getData();
|
|
||||||
sysUser = loginUser.getSysUser();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* i皖送H5端登录
|
|
||||||
* @param ticket
|
|
||||||
* @param iwsH5AppId
|
|
||||||
* @param iwsH5Url
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public void iwsH5Login(String ticket, String iwsH5AppId, String iwsH5Url,LoginUser loginUser,SysUser sysUser) {
|
|
||||||
Map<String, Object> paramMap = new HashMap<>();
|
|
||||||
paramMap.put("ticket", ticket);
|
|
||||||
paramMap.put("appId", iwsH5AppId);
|
|
||||||
RestTemplate restTemplate = new RestTemplate();
|
|
||||||
ResponseEntity<String> authResponse = restTemplate.getForEntity(iwsH5Url, String.class, paramMap);
|
|
||||||
log.info("authResponse:" + authResponse.toString());
|
|
||||||
if ("200".equals(authResponse.getStatusCode())){
|
|
||||||
// 根据ResponseEntity<String> responseEntity对象,获取body部分,body为json格式字符串
|
|
||||||
String content = authResponse.getBody();
|
|
||||||
// 将json字符串转化为json对象
|
|
||||||
JSONObject json = JSONObject.parseObject(content);
|
|
||||||
// 取出data部分对象
|
|
||||||
JSONObject data = json.getJSONObject("data");
|
|
||||||
JSONObject userInfo = data.getJSONObject("userInfo");
|
|
||||||
sysUser.setUserName(userInfo.get("userName").toString());
|
|
||||||
sysUser.setNickName(userInfo.get("name").toString());
|
|
||||||
sysUser.setPhonenumber(userInfo.get("mobile").toString());
|
|
||||||
loginUser.setSysUser(sysUser);
|
|
||||||
createUser(sysUser,loginUser);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
package com.bonus.auth.utils;
|
||||||
|
|
||||||
|
import com.google.common.base.Preconditions;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
|
||||||
|
public class Id {
|
||||||
|
private static final long EPOCH = LocalDateTime.of(2021, 12, 29, 9, 2).atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
|
||||||
|
private static final long SEQUENCE_BITS = 12L;
|
||||||
|
private static final long WORKER_ID_BITS = 10L;
|
||||||
|
static final long WORKER_ID_MAX_VALUE = 1024L;
|
||||||
|
private static final long SEQUENCE_MASK = 4095L;
|
||||||
|
private static final long WORKER_ID_LEFT_SHIFT_BITS = 12L;
|
||||||
|
private static final long TIMESTAMP_LEFT_SHIFT_BITS = 22L;
|
||||||
|
static Long WORKER_ID;
|
||||||
|
private static long SEQUENCE;
|
||||||
|
private static long LAST_TIME;
|
||||||
|
|
||||||
|
public Id(Long workerId) {
|
||||||
|
WORKER_ID = workerId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static long next() {
|
||||||
|
return nextKey();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String nextString() {
|
||||||
|
return String.valueOf(next());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static synchronized long nextKey() {
|
||||||
|
long currentMillis = System.currentTimeMillis();
|
||||||
|
Preconditions.checkState(LAST_TIME <= currentMillis, "Clock is moving backwards, last time is %d milliseconds, current time is %d milliseconds", LAST_TIME, currentMillis);
|
||||||
|
if (LAST_TIME == currentMillis) {
|
||||||
|
if (0L == (SEQUENCE = SEQUENCE + 1L & 4095L)) {
|
||||||
|
currentMillis = waitUntilNextTime(currentMillis);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
SEQUENCE = 0L;
|
||||||
|
}
|
||||||
|
|
||||||
|
LAST_TIME = currentMillis;
|
||||||
|
return currentMillis - EPOCH << 22 | WORKER_ID << 12 | SEQUENCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static long waitUntilNextTime(final long lastTime) {
|
||||||
|
long time;
|
||||||
|
for(time = System.currentTimeMillis(); time <= lastTime; time = System.currentTimeMillis()) {
|
||||||
|
}
|
||||||
|
|
||||||
|
return time;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,77 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||||
|
<mapper namespace="com.bonus.auth.mapper.CustCasualMapper">
|
||||||
|
|
||||||
|
<resultMap id="custCasualMap" type="com.bonus.auth.domain.CustCasual">
|
||||||
|
<id property="id" column="id"/>
|
||||||
|
<result property="casualId" column="casual_id"/>
|
||||||
|
<result property="casualName" column="casual_name"/>
|
||||||
|
<result property="custId" column="cust_id"/>
|
||||||
|
<result property="mobile" column="mobile"/>
|
||||||
|
<result property="email" column="email"/>
|
||||||
|
<result property="address" column="address"/>
|
||||||
|
<result property="openid" column="openid"/>
|
||||||
|
<result property="sourceType" column="source_type"/>
|
||||||
|
<result property="ifDel" column="if_del"/>
|
||||||
|
<result property="revision" column="revision"/>
|
||||||
|
<result property="crby" column="crby"/>
|
||||||
|
<result property="crtime" column="crtime"/>
|
||||||
|
<result property="upby" column="upby"/>
|
||||||
|
<result property="uptime" column="uptime"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap id="custCasualModel" extends="custCasualMap"
|
||||||
|
type="com.bonus.auth.domain.CustCasualModel">
|
||||||
|
<result property="custNum" column="cust_num"/>
|
||||||
|
<result property="custName" column="cust_name"/>
|
||||||
|
<result property="age" column="age"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<!-- 分页查询临时人员,并关联查询相关人员信息 -->
|
||||||
|
<select id="queryPageCustCasual" resultMap="custCasualModel"
|
||||||
|
parameterType="com.bonus.auth.domain.CustCasual">
|
||||||
|
select *
|
||||||
|
from cust_casual t1
|
||||||
|
left join cust_info t2 on t1.cust_id = t2.cust_id
|
||||||
|
where
|
||||||
|
t2.cust_state = 1
|
||||||
|
<if test="custCasual.casualName != null and custCasual.casualName != ''">
|
||||||
|
and t1.casual_name = #{custCasual.casualName,jdbcType=VARCHAR}
|
||||||
|
</if>
|
||||||
|
<if test="custCasual.custId != null">
|
||||||
|
and t1.cust_id = #{custCasual.custId,jdbcType=BIGINT}
|
||||||
|
</if>
|
||||||
|
<if test="custCasual.mobile != null and custCasual.mobile != ''">
|
||||||
|
and t1.mobile = #{custCasual.mobile,jdbcType=VARCHAR}
|
||||||
|
</if>
|
||||||
|
<if test="custCasual.openid != null and custCasual.openid != ''">
|
||||||
|
and t1.openid = #{custCasual.openid,jdbcType=VARCHAR}
|
||||||
|
</if>
|
||||||
|
<if test="custCasual.sourceType != null">
|
||||||
|
and t1.source_type = #{custCasual.sourceType,jdbcType=INTEGER}
|
||||||
|
</if>
|
||||||
|
<if test="custCasual.ifDel != null">
|
||||||
|
and t1.if_del = #{custCasual.ifDel,jdbcType=INTEGER}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectOpenidByCustId" resultType="String">
|
||||||
|
select openid from cust_casual where cust_id = #{custId} and source_type = #{sourceType} and if_del = #{ifDel}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectCustCasualByCustId" resultType="com.bonus.auth.domain.CustCasual">
|
||||||
|
select casual_id, openid from cust_casual where cust_id = #{custId} and source_type = #{sourceType} and if_del = #{ifDel}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<update id="updateCustCasual">
|
||||||
|
update cust_casual
|
||||||
|
set openid = #{openId}
|
||||||
|
where casual_id = #{casualId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<insert id="addCustCasual">
|
||||||
|
insert into cust_casual (casual_id, casual_name, cast_id, mobile, openid, source_type)
|
||||||
|
values (#{casualId}, #{casualName}, #{casualName}, #{custId}, #{mobile}, #{openid}, #{sourceType})
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||||
|
<mapper namespace="com.bonus.auth.mapper.CustInfoMapper">
|
||||||
|
<!--根据人员id集合获取人员信息-->
|
||||||
|
<select id="selectLoginInfo" resultType="com.bonus.auth.domain.CustInfoAppIdLoginVO">
|
||||||
|
select cust_id, cust_name, cust_num, cust_photo_url, mobile, pwd
|
||||||
|
from cust_info
|
||||||
|
<where>
|
||||||
|
cust_status = 1 and (psn_type != 999 or psn_type is null)
|
||||||
|
<if test="custName != null and custName != ''">
|
||||||
|
and cust_name = #{custName}
|
||||||
|
</if>
|
||||||
|
<if test="custNum != null and custNum != ''">
|
||||||
|
and cust_num = #{custNum}
|
||||||
|
</if>
|
||||||
|
<if test="mobile != null and mobile != ''">
|
||||||
|
and mobile = #{mobile}
|
||||||
|
</if>
|
||||||
|
<if test="idCard != null and idCard != ''">
|
||||||
|
and id_card = #{idCard}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue