基本信息(保存)

This commit is contained in:
liux 2025-02-14 15:50:57 +08:00
parent 2c514a177d
commit f6282bfeab
6 changed files with 47 additions and 9 deletions

View File

@ -7,6 +7,7 @@ import cn.hutool.crypto.Padding;
import cn.hutool.crypto.symmetric.AES;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Component;
import javax.crypto.spec.IvParameterSpec;
@ -55,9 +56,10 @@ public class AesEncryptUtil {
}
public static void main(String[] args) {
BCryptPasswordEncoder bCrypt = new BCryptPasswordEncoder();
System.out.println(aesEncrypt("Bonus$2026"));
System.out.println(aesDecode("PCAGz8j5ByU2AzoT6vtlLA=="));
System.out.println();
System.out.println(bCrypt.encode("Bonus$2026"));
System.out.println(aesEncrypt("Bonus$2027"));
System.out.println(aesDecode("MF1Nui79h/OHRGoUx1jhcg=="));
@ -65,5 +67,8 @@ public class AesEncryptUtil {
System.out.println(aesEncrypt("18110922397"));
System.out.println(aesDecode("poEWO1yyC/EaUR9vmrrNSA=="));
System.out.println(aesEncrypt("NXdtxny@2024"));
System.out.println(aesDecode("x5IdUQMFhPin0uTbOQGtJg=="));
}
}

View File

@ -45,10 +45,11 @@ public class CustCasualController extends BaseController {
public AjaxResult updateDetailInfoCasualForApp(@RequestHeader Map<String, String> headers, @RequestBody CustInfoModel infoModel) {
infoModel.setOpenid(this.getOpenidByHeaders(headers));
// infoModel.setCustId(HeaderFetchUtil.getCustId(headers));
infoModel.setSourceType(this.getSourceTypeByHeaders(headers));
// infoModel.setSourceType(this.getSourceTypeByHeaders(headers));
// infoModel.setMobile(this.aesEncryptUtil.aesEncrypt(infoModel.getMobile()));
// infoModel.setIdCard(this.aesEncryptUtil.aesEncrypt(infoModel.getIdCard()));
// infoModel.setPwd(this.aesEncryptUtil.aesEncrypt(infoModel.getPwd()));
infoModel.setPwd(this.aesEncryptUtil.aesDecode(infoModel.getPwd()));
this.custInfoBusiness.updateDetailInfoCasual(infoModel);
return AjaxResult.success();
}

View File

@ -38,6 +38,7 @@ public class CustAccTempServiceImpl extends ServiceImpl<CustAccTempMapper, CustA
private CustMqServiceImpl custMqService;
public void update(CustAccTemp custAccTemp) {
custAccTemp.setUpby("19805657725");
// ((CustAccTempMapper)this.baseMapper).update(custAccTemp, (Wrapper)((LambdaUpdateWrapper)Wrappers.lambdaUpdate(CustAccTemp.class).eq(CustAccTemp::getCustId, custAccTemp.getCustId())).set(ObjectUtil.isNull(custAccTemp.getPsnType()), CustAccTemp::getPsnType, CustConstant.CUST_ACC_TEMP_DEFAULT_PSN_TYPE));
this.baseMapper.update(custAccTemp, Wrappers.lambdaUpdate(CustAccTemp.class)
.eq(CustAccTemp::getCustId, custAccTemp.getCustId())

View File

@ -22,6 +22,8 @@ import com.bonus.domain.CustCasual;
import com.bonus.domain.CustCasualModel;
import com.bonus.domain.CustInfoAppIdLoginDTO;
import com.bonus.domain.CustInfoAppIdLoginVO;
import com.bonus.i18n.I18n;
import com.bonus.utils.RetCodeEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
@ -63,6 +65,10 @@ public class CustInfoBusinessImpl implements CustInfoBusiness {
@Transactional(rollbackFor = {Exception.class})
public void updateDetailInfoCasual(CustInfoModel infoModel) {
CustInfoVo custInfo = this.custInfoService.queryCustInfo((new CustInfoDTO()).setCustId(infoModel.getCustId()));
if(custInfo == null){
RetCodeEnum var10002 = RetCodeEnum.CUST_PERSONAL_NO_EXIT;
throw new ServiceException( var10002+":人员不存在");
}
CustInfoOpenApi.infoModelSetOriginalValue((CustInfo)BeanUtil.copyProperties(custInfo, CustInfo.class, new String[0]), infoModel);
this.custInfoService.updateDetailCustInfo(infoModel);
}

View File

@ -324,6 +324,11 @@ public class CustInfoServiceImpl extends ServiceImpl<CustInfoMapper, CustInfo> i
if (ObjectUtil.isNotEmpty(custInfo.getCustName())) {
custInfo.setCustNameLike(custInfo.getCustName());
}
BCryptPasswordEncoder bCrypt = new BCryptPasswordEncoder();
custInfo.setMobile(SM4EncryptUtils.sm4Encryptbyconfig(custInfo.getMobile()));
custInfo.setMobileSuffix(SM4EncryptUtils.sm4Encryptbyconfig(custInfo.getMobileSuffix()));
custInfo.setIdCard(SM4EncryptUtils.sm4Encryptbyconfig(custInfo.getIdCard()));
custInfo.setPwd(bCrypt.encode(custInfo.getPwd()));
custInfo.setPsnType(custInfo.getPsnType()).setBirthday(custInfo.getBirthday()).setAge(custInfo.getAge()).setPlaceId(custInfo.getPlaceId() == null ? CustConstant.DATA_DEFAULT_LONG : custInfo.getPlaceId()).setSex((Integer)Optional.ofNullable(infoModel.getSex()).orElse(3));
// ((CustInfoMapper)this.baseMapper).update(custInfo, (Wrapper)(new LambdaUpdateWrapper(CustInfo.class)).eq(CustInfo::getCustId, infoModel.getCustId()));
@ -364,7 +369,24 @@ public class CustInfoServiceImpl extends ServiceImpl<CustInfoMapper, CustInfo> i
}
protected void notifyOtherModules(Long custId, LeMqConstant.DataChangeType dataChangeType) {
String currentTraceId = LogUtil.getCurrentTraceId();
log.info("通知其他模块人员变动开始");
log.info("类型[{}]", dataChangeType);
CompletableFuture.runAsync(() -> {
LogUtil.putLogTraceId(currentTraceId);
if (LeMqConstant.DataChangeType.ADD.equals(dataChangeType)) {
this.dcPushUserDataServiceApi.addUser(custId);
log.info("通知门禁结束");
} else if (LeMqConstant.DataChangeType.UPDATE.equals(dataChangeType)) {
this.dcPushUserDataServiceApi.editUser(custId);
log.info("通知门禁结束");
} else if (LeMqConstant.DataChangeType.REMOVE.equals(dataChangeType)) {
this.dcPushUserDataServiceApi.deleteUser(custId);
log.info("通知门禁结束");
}
this.custInfoBurialPointBusiness.didNotifyOtherModules(custId, dataChangeType);
}, this.asyncTaskExecutor);
}
@Override

View File

@ -1,5 +1,8 @@
package com.bonus.core.device.door.api;
import com.bonus.core.device.door.enums.EditUserToDeviceEnum;
import com.bonus.core.device.door.enums.TriggerTypeEnum;
import com.bonus.core.device.door.service.DcCustDoorPwdService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
@ -8,19 +11,19 @@ import org.springframework.stereotype.Component;
@Component
public class DcPushUserDataServiceApi {
// @Autowired
// @Lazy
// private DcCustDoorPwdService dcCustDoorPwdService;
@Autowired
@Lazy
private DcCustDoorPwdService dcCustDoorPwdService;
public void addUser(Long custId) {
//this.dcCustDoorPwdService.checkUserToDevice(custId, TriggerTypeEnum.ADD, EditUserToDeviceEnum.PUSH);
this.dcCustDoorPwdService.checkUserToDevice(custId, TriggerTypeEnum.ADD, EditUserToDeviceEnum.PUSH);
}
public void deleteUser(Long custId) {
//this.dcCustDoorPwdService.checkUserToDevice(custId, TriggerTypeEnum.LOGOUT, EditUserToDeviceEnum.DELETE);
this.dcCustDoorPwdService.checkUserToDevice(custId, TriggerTypeEnum.LOGOUT, EditUserToDeviceEnum.DELETE);
}
public void editUser(Long custId) {
// this.dcCustDoorPwdService.checkUserToDevice(custId, TriggerTypeEnum.EDIT, EditUserToDeviceEnum.PUSH);
this.dcCustDoorPwdService.checkUserToDevice(custId, TriggerTypeEnum.EDIT, EditUserToDeviceEnum.PUSH);
}
}