增加账户
This commit is contained in:
parent
4927dbcf3a
commit
240ebbe008
|
|
@ -6,6 +6,7 @@ import com.bonus.canteen.core.account.v3.extension.ThirdAccountExtensionService;
|
|||
import com.bonus.canteen.core.account.v3.extension.dto.ThirdAccountSupportDTO;
|
||||
import com.bonus.canteen.core.account.v3.extension.dto.ThirdBalanceDTO;
|
||||
import com.bonus.canteen.core.account.v3.extension.vo.ThirdBalanceVO;
|
||||
import com.bonus.canteen.core.account.v3.po.AccInfoAddPO;
|
||||
import com.bonus.canteen.core.account.v3.po.AccInfoUpdatePO;
|
||||
import com.bonus.canteen.core.account.v3.service.AccInfoService;
|
||||
import com.bonus.canteen.core.account.v3.web.dto.AccInfoDetailDTO;
|
||||
|
|
@ -25,6 +26,7 @@ import org.springframework.context.annotation.Lazy;
|
|||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Optional;
|
||||
|
||||
|
|
@ -43,6 +45,10 @@ public class AccInfoServiceV3Api {
|
|||
// @Lazy
|
||||
// private CustomBizApi customBizApi;
|
||||
|
||||
public Long insertAccInfo(@Valid AccInfoAddPO accInfoAddPO) {
|
||||
return this.accInfoService.insertAccInfo(accInfoAddPO);
|
||||
}
|
||||
|
||||
public void updateAccInfo(AccInfoUpdatePO updatePO) {
|
||||
this.accInfoService.updateAccInfo(updatePO);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,74 @@
|
|||
package com.bonus.canteen.core.account.v3.po;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.time.LocalDate;
|
||||
|
||||
public class AccInfoAddPO {
|
||||
@ApiModelProperty("用户id")
|
||||
public @NotNull(
|
||||
message = "请填写用户id"
|
||||
) Long custId;
|
||||
@ApiModelProperty("账户有效截止日期")
|
||||
public LocalDate endDate;
|
||||
|
||||
public static AccInfoAddPOBuilder builder() {
|
||||
return new AccInfoAddPOBuilder();
|
||||
}
|
||||
|
||||
public Long getCustId() {
|
||||
return this.custId;
|
||||
}
|
||||
|
||||
public LocalDate getEndDate() {
|
||||
return this.endDate;
|
||||
}
|
||||
|
||||
public void setCustId(final Long custId) {
|
||||
this.custId = custId;
|
||||
}
|
||||
|
||||
public void setEndDate(final LocalDate endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
Long var10000 = this.getCustId();
|
||||
return "AccInfoAddPO(custId=" + var10000 + ", endDate=" + String.valueOf(this.getEndDate()) + ")";
|
||||
}
|
||||
|
||||
public AccInfoAddPO(final Long custId, final LocalDate endDate) {
|
||||
this.custId = custId;
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
public AccInfoAddPO() {
|
||||
}
|
||||
|
||||
public static class AccInfoAddPOBuilder {
|
||||
private Long custId;
|
||||
private LocalDate endDate;
|
||||
|
||||
AccInfoAddPOBuilder() {
|
||||
}
|
||||
|
||||
public AccInfoAddPOBuilder custId(final Long custId) {
|
||||
this.custId = custId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AccInfoAddPOBuilder endDate(final LocalDate endDate) {
|
||||
this.endDate = endDate;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AccInfoAddPO build() {
|
||||
return new AccInfoAddPO(this.custId, this.endDate);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
Long var10000 = this.custId;
|
||||
return "AccInfoAddPO.AccInfoAddPOBuilder(custId=" + var10000 + ", endDate=" + String.valueOf(this.endDate) + ")";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package com.bonus.canteen.core.account.v3.service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bonus.canteen.core.account.v3.api.vo.AccInfoDetailVO;
|
||||
import com.bonus.canteen.core.account.v3.po.AccInfoAddPO;
|
||||
import com.bonus.canteen.core.account.v3.po.AccInfoUpdatePO;
|
||||
import com.bonus.canteen.core.account.v3.web.dto.*;
|
||||
import com.bonus.canteen.core.account.v3.web.vo.AccExistFrozenListVO;
|
||||
|
|
@ -15,6 +16,7 @@ import java.util.List;
|
|||
public interface AccInfoService {
|
||||
AccInfoDetailVO getAccInfoDetail(AccInfoDetailDTO content);
|
||||
|
||||
Long insertAccInfo(AccInfoAddPO accInfoAddPO);
|
||||
void updateAccInfo(AccInfoUpdatePO updatePO);
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.canteen.core.account.v3.service;
|
||||
|
||||
import com.bonus.canteen.core.account.v3.model.AccWalletInfo;
|
||||
import com.bonus.canteen.core.account.v3.po.AccWalletBalanceUpdatePO;
|
||||
import com.bonus.canteen.core.account.v3.po.AccWalletInfoRechargePO;
|
||||
import com.bonus.canteen.core.account.v3.web.vo.AccUpdateWalletBalanceVO;
|
||||
|
|
@ -11,6 +12,7 @@ import java.util.Map;
|
|||
|
||||
public interface AccWalletInfoService {
|
||||
List<AccWalletInfoVO> findAccWalletInfoVOListByCustId(Long custId);
|
||||
void insertBatch(List<AccWalletInfo> accWalletInfos);
|
||||
BigDecimal calculateSubsidyExpirationAmount(Long custId);
|
||||
void updateAccWalletInfoForUse(Long custId, Integer walletId, BigDecimal amount);
|
||||
AccUpdateWalletBalanceVO updateAccWalletBalance(AccWalletBalanceUpdatePO updatePo);
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bonus.canteen.core.account.v3.model.AccWalletInfo;
|
||||
import com.bonus.canteen.core.account.v3.po.AccInfoAddPO;
|
||||
import com.bonus.canteen.core.account.v3.service.AccOperationRecordService;
|
||||
import com.bonus.canteen.core.account.v3.web.dto.*;
|
||||
import com.bonus.canteen.core.account.v3.web.vo.*;
|
||||
|
|
@ -33,6 +35,7 @@ import com.bonus.canteen.core.account.v4.api.CardInfoServiceV4Api;
|
|||
import com.bonus.canteen.core.customer.api.CustAccTempApi;
|
||||
import com.bonus.common.houqin.constant.LeConstants;
|
||||
import com.bonus.common.houqin.i18n.I18n;
|
||||
import com.bonus.common.houqin.utils.id.Id;
|
||||
import com.github.pagehelper.page.PageMethod;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.slf4j.Logger;
|
||||
|
|
@ -105,6 +108,35 @@ public class AccInfoServiceImpl extends ServiceImpl<AccInfoMapper, AccInfo> impl
|
|||
return accInfoDetailVO;
|
||||
}
|
||||
|
||||
@Transactional(
|
||||
rollbackFor = {Exception.class}
|
||||
)
|
||||
public Long insertAccInfo(AccInfoAddPO accInfoAddPO) {
|
||||
Long accId = Id.next();
|
||||
AccInfo accInfo = new AccInfo();
|
||||
accInfo.setAccId(accId);
|
||||
accInfo.setAccStatus(AccStatusEnum.NORMAL.getKey());
|
||||
accInfo.setCustId(accInfoAddPO.getCustId());
|
||||
accInfo.setEndDate(accInfoAddPO.getEndDate());
|
||||
((AccInfoMapper)this.baseMapper).insert(accInfo);
|
||||
List<AccWalletInfo> accWalletInfos = new ArrayList();
|
||||
AccWalletIdEnum[] var5 = AccWalletIdEnum.values();
|
||||
int var6 = var5.length;
|
||||
|
||||
for(int var7 = 0; var7 < var6; ++var7) {
|
||||
AccWalletIdEnum accWalletIdEnum = var5[var7];
|
||||
AccWalletInfo accWalletInfo = new AccWalletInfo();
|
||||
accWalletInfo.setAccId(accId);
|
||||
accWalletInfo.setCustId(accInfoAddPO.getCustId());
|
||||
accWalletInfo.setWalletId(accWalletIdEnum.getKey());
|
||||
accWalletInfos.add(accWalletInfo);
|
||||
}
|
||||
|
||||
this.accWalletInfoService.insertBatch(accWalletInfos);
|
||||
this.accOperationRecordService.addAccOperationRecord(accInfoAddPO.getCustId(), accInfo.getAccStatus());
|
||||
return accId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void
|
||||
updateAccInfo(AccInfoUpdatePO updatePO) {
|
||||
|
|
|
|||
|
|
@ -43,6 +43,9 @@ public class AccWalletInfoServiceImpl extends ServiceImpl<AccWalletInfoMapper, A
|
|||
return ((AccWalletInfoMapper)this.baseMapper).queryAccWalletInfoVOListByCustId(custId);
|
||||
}
|
||||
|
||||
public void insertBatch(List<AccWalletInfo> accWalletInfos) {
|
||||
this.saveBatch(accWalletInfos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal calculateSubsidyExpirationAmount(Long custId) {
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import com.bonus.common.core.web.page.TableDataInfo;
|
|||
import com.bonus.common.houqin.constant.SourceTypeEnum;
|
||||
import com.bonus.canteen.core.customer.model.CustInfo;
|
||||
import com.bonus.canteen.core.customer.vo.CustInfoVo;
|
||||
import com.bonus.common.houqin.utils.ValidationGroups;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.bonus.canteen.core.customer.service.CustInfoService;
|
||||
|
|
@ -34,6 +35,13 @@ public class CustInfoController extends BaseController {
|
|||
@Autowired
|
||||
CustInfoService custInfoService;
|
||||
|
||||
@ApiOperation("新增")
|
||||
@PostMapping({"/addCustInfo"})
|
||||
public AjaxResult addCustInfo(@Validated({ValidationGroups.Insert.class}) @RequestBody CustInfoModel infoModel) {
|
||||
this.custInfoService.addCustInfo(infoModel);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@ApiOperation("小程序修改密码")
|
||||
@PostMapping({"/change/password"})
|
||||
public AjaxResult changePassword(@Validated @RequestBody CustChangePasswordDTO content) {
|
||||
|
|
|
|||
|
|
@ -47,8 +47,8 @@ public class CustInfo {
|
|||
typeHandler = CipherQueryLikeHandler.class
|
||||
)
|
||||
private String custNameLike;
|
||||
// @ApiModelProperty("人员限制id")
|
||||
// private Integer custLimitId;
|
||||
@ApiModelProperty("人员限制id")
|
||||
private Integer custLimitId;
|
||||
// @ApiModelProperty("第三方人员id")
|
||||
// private String custThirdId;
|
||||
// @ApiModelProperty("推送到设备上,生成的用户id")
|
||||
|
|
@ -113,13 +113,13 @@ public class CustInfo {
|
|||
// updateStrategy = FieldStrategy.IGNORED
|
||||
// )
|
||||
// private Long costCenterId;
|
||||
// @ApiModelProperty("所属位置")
|
||||
// @TableField(
|
||||
// updateStrategy = FieldStrategy.IGNORED
|
||||
// )
|
||||
// private Long placeId;
|
||||
// @ApiModelProperty("所属位置名称")
|
||||
// private String placeFullName;
|
||||
@ApiModelProperty("所属位置")
|
||||
@TableField(
|
||||
updateStrategy = FieldStrategy.IGNORED
|
||||
)
|
||||
private Long placeId;
|
||||
@ApiModelProperty("所属位置名称")
|
||||
private String placeFullName;
|
||||
@ApiModelProperty("人员类别")
|
||||
@TableField(
|
||||
updateStrategy = FieldStrategy.IGNORED
|
||||
|
|
@ -258,10 +258,10 @@ public class CustInfo {
|
|||
return this.custNameLike;
|
||||
}
|
||||
|
||||
// public Integer getCustLimitId() {
|
||||
// return this.custLimitId;
|
||||
// }
|
||||
//
|
||||
public Integer getCustLimitId() {
|
||||
return this.custLimitId;
|
||||
}
|
||||
|
||||
// public String getCustThirdId() {
|
||||
// return this.custThirdId;
|
||||
// }
|
||||
|
|
@ -333,14 +333,14 @@ public class CustInfo {
|
|||
// public Long getCostCenterId() {
|
||||
// return this.costCenterId;
|
||||
// }
|
||||
//
|
||||
// public Long getPlaceId() {
|
||||
// return this.placeId;
|
||||
// }
|
||||
//
|
||||
// public String getPlaceFullName() {
|
||||
// return this.placeFullName;
|
||||
// }
|
||||
|
||||
public Long getPlaceId() {
|
||||
return this.placeId;
|
||||
}
|
||||
|
||||
public String getPlaceFullName() {
|
||||
return this.placeFullName;
|
||||
}
|
||||
|
||||
public Integer getPsnType() {
|
||||
return this.psnType;
|
||||
|
|
@ -523,11 +523,11 @@ public class CustInfo {
|
|||
return this;
|
||||
}
|
||||
|
||||
// public CustInfo setCustLimitId(final Integer custLimitId) {
|
||||
// this.custLimitId = custLimitId;
|
||||
// return this;
|
||||
// }
|
||||
//
|
||||
public CustInfo setCustLimitId(final Integer custLimitId) {
|
||||
this.custLimitId = custLimitId;
|
||||
return this;
|
||||
}
|
||||
|
||||
// public CustInfo setCustThirdId(final String custThirdId) {
|
||||
// this.custThirdId = custThirdId;
|
||||
// return this;
|
||||
|
|
@ -607,16 +607,16 @@ public class CustInfo {
|
|||
// this.costCenterId = costCenterId;
|
||||
// return this;
|
||||
// }
|
||||
//
|
||||
// public CustInfo setPlaceId(final Long placeId) {
|
||||
// this.placeId = placeId;
|
||||
// return this;
|
||||
// }
|
||||
//
|
||||
// public CustInfo setPlaceFullName(final String placeFullName) {
|
||||
// this.placeFullName = placeFullName;
|
||||
// return this;
|
||||
// }
|
||||
|
||||
public CustInfo setPlaceId(final Long placeId) {
|
||||
this.placeId = placeId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CustInfo setPlaceFullName(final String placeFullName) {
|
||||
this.placeFullName = placeFullName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CustInfo setPsnType(final Integer psnType) {
|
||||
this.psnType = psnType;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ public interface CustInfoService extends IService<CustInfo> {
|
|||
|
||||
CustInfoVo queryCustInfoDetail(CustInfo custInfo, Integer sourceType);
|
||||
|
||||
public void addCustInfo(CustInfoModel infoModel);
|
||||
|
||||
AjaxResult custChangePassword(CustChangePasswordDTO content);
|
||||
|
||||
AjaxResult custForgetPassword(CustForgetPasswordDTO content);
|
||||
|
|
|
|||
|
|
@ -4,16 +4,22 @@ import cn.hutool.core.bean.BeanUtil;
|
|||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import cn.hutool.core.util.BooleanUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.nacos.shaded.javax.annotation.Nullable;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bonus.canteen.core.account.v3.constants.AccStatusEnum;
|
||||
import com.bonus.canteen.core.account.v3.po.AccInfoAddPO;
|
||||
import com.bonus.canteen.core.customer.constants.*;
|
||||
import com.bonus.canteen.core.customer.mapper.CustAccTempMapper;
|
||||
import com.bonus.canteen.core.customer.utils.CustomerUtil;
|
||||
import com.bonus.canteen.core.customer.vo.*;
|
||||
import com.bonus.canteen.core.customer.po.CustomerNumByOrgIdMapperPO;
|
||||
import com.bonus.canteen.core.customer.vo.PageCustInfoPhotoVO;
|
||||
|
|
@ -58,6 +64,7 @@ import org.springframework.context.annotation.Lazy;
|
|||
import org.springframework.core.task.AsyncTaskExecutor;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
|
@ -78,7 +85,8 @@ public class CustInfoServiceImpl extends ServiceImpl<CustInfoMapper, CustInfo> i
|
|||
private CustCasualApi custCasualApi;
|
||||
@Autowired
|
||||
private CustInfoMapper custInfoMapper;
|
||||
|
||||
@Autowired
|
||||
private CustAccTempMapper custAccTempMapper;
|
||||
@Autowired
|
||||
@Lazy
|
||||
private CustInfoBurialPointBusiness custInfoBurialPointBusiness;
|
||||
|
|
@ -187,7 +195,44 @@ public class CustInfoServiceImpl extends ServiceImpl<CustInfoMapper, CustInfo> i
|
|||
return custInfoVo;
|
||||
}
|
||||
|
||||
@Transactional(
|
||||
rollbackFor = {Exception.class}
|
||||
)
|
||||
public void addCustInfo(CustInfoModel infoModel) {
|
||||
this.custInfoBurialPointBusiness.willAddOrUpdateCust(infoModel);
|
||||
//infoModel.setCustId(Id.next());
|
||||
//this.custInfoCheckService.checkCustInfoOnlyAndSetRedundantData(infoModel);
|
||||
CustInfo custInfo = new CustInfo();
|
||||
BeanUtil.copyProperties(infoModel, custInfo, new String[0]);
|
||||
custInfo.setCustLimitId(CustomerUtil.getUsableCustLimitId());
|
||||
CustomerCacheUtil.deleteCustomerNumBelongOrgMapCache();
|
||||
this.unbindPlace(infoModel.getPlaceId());
|
||||
this.custDiningPlaceService.save(custInfo.getCustId(), infoModel.getDiningPlace());
|
||||
Long accId = null;
|
||||
if (ObjectUtil.isNull(infoModel.getIsCreateAcc()) || BooleanUtil.isTrue(infoModel.getIsCreateAcc())) {
|
||||
accId = this.accInfoServiceV3Api.insertAccInfo(AccInfoAddPO.builder().custId(infoModel.getCustId()).endDate(infoModel.getAccEndDate()).build());
|
||||
}
|
||||
infoModel.setAccId(accId);
|
||||
this.addCustAccTemp(custInfo);
|
||||
MqUtil.sendDataChange(infoModel.getCustId(), LeMqConstant.DataChangeType.ADD, LeMqConstant.Topic.DATA_CHANGE_CUSTOMER);
|
||||
this.notifyOtherModules(infoModel.getCustId(), LeMqConstant.DataChangeType.ADD);
|
||||
this.custInfoBurialPointBusiness.willAddOrUpdateCustAfter(infoModel, true);
|
||||
}
|
||||
|
||||
protected void unbindPlace(Long placeId) {
|
||||
if (!ObjectUtil.isNull(placeId) && !CustConstant.DATA_DEFAULT_LONG.equals(placeId)) {
|
||||
((CustInfoMapper)this.baseMapper).update((CustInfo) null, (Wrapper)((LambdaUpdateWrapper)Wrappers.lambdaUpdate(CustInfo.class)
|
||||
.eq(CustInfo::getPlaceId, placeId).set(CustInfo::getPlaceId, CustConstant.DATA_DEFAULT_LONG)));
|
||||
}
|
||||
}
|
||||
|
||||
protected void addCustAccTemp(CustInfo custInfo) {
|
||||
CustAccTemp custAccTemp = (CustAccTemp)LeBeanUtil.copyCreateProperties(custInfo, CustAccTemp.class);
|
||||
custAccTemp.setId((Long)null);
|
||||
custAccTemp.setCustState(PersonalStatusEnum.NORMAL.getKey());
|
||||
custAccTemp.setAccStatus(AccStatusEnum.NORMAL.getKey());
|
||||
this.custAccTempMapper.insert(custAccTemp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult custChangePassword(CustChangePasswordDTO content) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue