增删改查 用户、部门是向正元同步
This commit is contained in:
1 parent
93d7fddad1
commit
546b4efeb4
15 files changed
+222
-78
No files matched your search
-1
@@ -10,7 +10,6 @@ import com.bsd.pjcloud.hard.service.HardThirdZyService;
|
||||
import com.bsd.pjcloud.thirdparty.api.feign.RemoterThirdZyService;
|
||||
import com.bsd.pjcloud.thirdparty.dto.zy.foreign.ZyForeignSyncNativeCardTradeInfoDto;
|
||||
import com.bsd.pjcloud.thirdparty.vo.zy.foreign.ZyForeignSyncNativeCardTradeInfoVo;
|
||||
import com.bsd.pjcloud.wallet.service.MchThirdZyService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
+2
-2
@@ -105,7 +105,7 @@ public class SysDeptController {
|
||||
@PostMapping
|
||||
@HasPermission("sys_dept_add")
|
||||
public R save(@Valid @RequestBody SysDept sysDept) {
|
||||
return R.ok(sysDeptService.save(sysDept));
|
||||
return R.ok(sysDeptService.create(sysDept));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -132,7 +132,7 @@ public class SysDeptController {
|
||||
@HasPermission("sys_dept_edit")
|
||||
public R update(@Valid @RequestBody SysDept sysDept) {
|
||||
sysDept.setUpdateTime(LocalDateTime.now());
|
||||
return R.ok(sysDeptService.updateById(sysDept));
|
||||
return R.ok(sysDeptService.edit(sysDept));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+12
@@ -25,6 +25,7 @@ import com.bsd.pjcloud.admin.api.entity.SysDept;
|
||||
import com.bsd.pjcloud.admin.api.vo.DeptExcelVO;
|
||||
import com.bsd.pjcloud.admin.api.vo.OrgTreeVO;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.validation.BindingResult;
|
||||
|
||||
import java.util.List;
|
||||
@@ -56,6 +57,16 @@ public interface SysDeptService extends IService<SysDept> {
|
||||
*/
|
||||
Boolean removeDeptById(Long id);
|
||||
|
||||
/**
|
||||
* 修改部门
|
||||
*/
|
||||
Boolean edit(@Valid SysDept sysDept);
|
||||
|
||||
/**
|
||||
* 创建部门
|
||||
*/
|
||||
Boolean create(@Valid SysDept sysDept);
|
||||
|
||||
List<DeptExcelVO> listExcelVo();
|
||||
|
||||
R importDept(List<DeptExcelVO> excelVOList, BindingResult bindingResult);
|
||||
@@ -118,4 +129,5 @@ public interface SysDeptService extends IService<SysDept> {
|
||||
* @return
|
||||
*/
|
||||
List<SysDept> selectByNames(List<String> names);
|
||||
|
||||
}
|
||||
+24
@@ -40,6 +40,7 @@ import com.bsd.pjcloud.admin.service.SysDeptService;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.excel.vo.ErrorMessage;
|
||||
import com.bsd.pjcloud.wallet.api.feign.RemoteWalletService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -71,6 +72,8 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
||||
|
||||
private final SysUserPostMapper userPostMapper;
|
||||
|
||||
private final RemoteWalletService remoteWalletService;
|
||||
|
||||
/**
|
||||
* 删除部门
|
||||
*
|
||||
@@ -85,9 +88,30 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
||||
|
||||
Optional.ofNullable(idList).filter(CollUtil::isNotEmpty).ifPresent(this::removeByIds);
|
||||
|
||||
for (Long deptId : idList) {
|
||||
remoteWalletService.deptChange(deptId, Boolean.TRUE);
|
||||
}
|
||||
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改部门
|
||||
*/
|
||||
@Override
|
||||
public Boolean edit(SysDept sysDept) {
|
||||
boolean isEdit = updateById(sysDept);
|
||||
remoteWalletService.deptChange(sysDept.getDeptId(), Boolean.FALSE);
|
||||
return isEdit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean create(SysDept sysDept) {
|
||||
boolean isSave = save(sysDept);
|
||||
remoteWalletService.deptChange(sysDept.getDeptId(), Boolean.FALSE);
|
||||
return isSave;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询全部部门树
|
||||
*
|
||||
|
||||
+14
-10
@@ -20,10 +20,8 @@
|
||||
package com.bsd.pjcloud.admin.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.lang.Validator;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@@ -54,17 +52,13 @@ import com.bsd.pjcloud.common.core.util.CollectionUtils;
|
||||
import com.bsd.pjcloud.common.core.util.MsgUtils;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScopeFuncEnum;
|
||||
import com.bsd.pjcloud.common.data.resolver.ParamResolver;
|
||||
import com.bsd.pjcloud.common.excel.vo.ErrorMessage;
|
||||
import com.bsd.pjcloud.common.file.core.FileProperties;
|
||||
import com.bsd.pjcloud.common.file.core.FileTemplate;
|
||||
import com.bsd.pjcloud.common.security.service.PjcloudUser;
|
||||
import com.bsd.pjcloud.common.security.util.SecurityUtils;
|
||||
import com.bsd.pjcloud.wallet.api.feign.RemoteWalletService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.http.entity.ContentType;
|
||||
import org.apache.poi.ss.usermodel.PictureData;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.cache.Cache;
|
||||
@@ -80,7 +74,6 @@ import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
@@ -168,7 +161,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
}).forEach(sysUserRoleMapper::insert);
|
||||
|
||||
// 创建用户默认钱包
|
||||
CompletableFuture.runAsync(() -> remoteWalletService.createWallet(sysUser.getUserId()));
|
||||
CompletableFuture.runAsync(() -> {
|
||||
remoteWalletService.createWallet(sysUser.getUserId());
|
||||
});
|
||||
remoteWalletService.userChange(sysUser.getUserId(), Boolean.FALSE);
|
||||
|
||||
return sysUser.getUserId();
|
||||
}
|
||||
@@ -263,7 +259,12 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
this.removeBatchByIds(CollUtil.toList(ids));
|
||||
|
||||
// 删除钱包
|
||||
CompletableFuture.runAsync(() -> remoteWalletService.delWallet(List.of(ids)));
|
||||
CompletableFuture.runAsync(() -> {
|
||||
remoteWalletService.delWallet(List.of(ids));
|
||||
});
|
||||
for (Long userId : ids) {
|
||||
remoteWalletService.userChange(userId, Boolean.TRUE);
|
||||
}
|
||||
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
@@ -323,7 +324,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
}
|
||||
|
||||
// 创建用户默认钱包
|
||||
CompletableFuture.runAsync(() -> remoteWalletService.createWallet(userDto.getUserId()));
|
||||
CompletableFuture.runAsync(() -> {
|
||||
remoteWalletService.createWallet(userDto.getUserId());
|
||||
});
|
||||
remoteWalletService.userChange(userDto.getUserId(), Boolean.FALSE);
|
||||
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
+5
@@ -40,4 +40,9 @@ public interface RemoteWalletService {
|
||||
@GetMapping("/wallet-manage/del-wallet")
|
||||
R<Boolean> delWallet(@RequestParam("userIds") List<Long> userIds);
|
||||
|
||||
@GetMapping("/wallet-manage/user-change")
|
||||
R<Boolean> userChange(@RequestParam Long userId, @RequestParam Boolean isDel);
|
||||
|
||||
@GetMapping("/wallet-manage/dept-change")
|
||||
R<Boolean> deptChange(@RequestParam Long deptId, @RequestParam Boolean isDel);
|
||||
}
|
||||
+12
@@ -104,6 +104,18 @@ public class WalletManageController {
|
||||
return R.ok(walletManageService.delWalletByUserIds(userIds));
|
||||
}
|
||||
|
||||
@GetMapping("/user-change")
|
||||
public R<Boolean> userChange(@RequestParam Long userId, @RequestParam Boolean isDel) {
|
||||
walletManageService.userChange(userId, isDel);
|
||||
return R.ok(true);
|
||||
}
|
||||
|
||||
@GetMapping("/dept-change")
|
||||
public R<Boolean> deptChange(@RequestParam Long deptId, @RequestParam Boolean isDel) {
|
||||
walletManageService.deptChange(deptId, isDel);
|
||||
return R.ok(true);
|
||||
}
|
||||
|
||||
/* ************************************* end 远程调用 end ************************************* */
|
||||
|
||||
|
||||
|
||||
+7
-7
@@ -2,7 +2,7 @@ package com.bsd.pjcloud.wallet.controller.third;
|
||||
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
|
||||
import com.bsd.pjcloud.wallet.service.MchThirdZyService;
|
||||
import com.bsd.pjcloud.wallet.service.WalletThirdZyService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -19,35 +19,35 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@Tag(description = "mch-third-zy", name = "正元同步")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
@Validated
|
||||
public class MchThirdZyController {
|
||||
public class WalletThirdZyController {
|
||||
|
||||
private final MchThirdZyService mchThirdZyService;
|
||||
private final WalletThirdZyService walletThirdZyService;
|
||||
|
||||
@GetMapping("/sync-all-mch")
|
||||
@Operation(summary = "同步全部商户")
|
||||
public R<MchManageVo> syncAllMch() {
|
||||
mchThirdZyService.syncAllMch(null);
|
||||
walletThirdZyService.syncAllMch(null);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@GetMapping("/sync-all-dept")
|
||||
@Operation(summary = "同步全部商户部门")
|
||||
public R<MchManageVo> syncAllDept() {
|
||||
mchThirdZyService.syncAllDept(null);
|
||||
walletThirdZyService.syncAllDept(null);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@GetMapping("/sync-all-role")
|
||||
@Operation(summary = "同步全部身份")
|
||||
public R<MchManageVo> syncAllRole() {
|
||||
mchThirdZyService.syncAllRole();
|
||||
walletThirdZyService.syncAllRole();
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@GetMapping("/sync-all-user")
|
||||
@Operation(summary = "同步全部用户")
|
||||
public R<MchManageVo> syncAllUser() {
|
||||
mchThirdZyService.syncAllUser(null);
|
||||
walletThirdZyService.syncAllUser(null);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
+1
@@ -40,6 +40,7 @@ public interface MchManageMapper extends PjcloudBaseMapper<MchManageEntity> {
|
||||
MPJLambdaQueryWrapper<MchManageEntity> wrapper = new MPJLambdaQueryWrapper<MchManageEntity>()
|
||||
.selectAll(MchManageEntity.class)
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getId()), MchManageEntity::getId, dto.getId())
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getDeptId()), MchManageEntity::getDeptId, dto.getDeptId())
|
||||
.likeIfExists(MchManageEntity::getName, dto.getName())
|
||||
.in(ObjectUtil.isNotEmpty(dto.getDeptIds()), MchManageEntity::getDeptId, dto.getDeptIds())
|
||||
.in(ObjectUtil.isNotEmpty(dto.getIds()), MchManageEntity::getId, dto.getIds())
|
||||
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
package com.bsd.pjcloud.wallet.service;
|
||||
|
||||
public interface MchThirdZyService {
|
||||
|
||||
/**
|
||||
* 同步全部商户
|
||||
*/
|
||||
void syncAllMch(Long mchId);
|
||||
|
||||
/**
|
||||
* 同步全部商户部门
|
||||
*/
|
||||
void syncAllDept(Long deptId);
|
||||
|
||||
/**
|
||||
* 同步到正元全部账户信息
|
||||
*/
|
||||
void syncAllUser(Long userId);
|
||||
|
||||
/**
|
||||
* 同步到正元全部身份信息
|
||||
*/
|
||||
void syncAllRole();
|
||||
|
||||
}
|
||||
+10
@@ -114,4 +114,14 @@ public interface WalletManageService extends IService<WalletManageEntity> {
|
||||
* @param dto
|
||||
*/
|
||||
void exportQb(HttpServletResponse response, Page page, WalletManageBalanceDto dto);
|
||||
|
||||
/**
|
||||
* 修改用户
|
||||
*/
|
||||
void userChange(Long userId, Boolean isDel);
|
||||
|
||||
/**
|
||||
* 修改部门
|
||||
*/
|
||||
void deptChange(Long deptId, Boolean isDel);
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package com.bsd.pjcloud.wallet.service;
|
||||
|
||||
public interface WalletThirdZyService {
|
||||
|
||||
/**
|
||||
* 同步商户信息
|
||||
*/
|
||||
void syncAllMch(Long mchId);
|
||||
|
||||
void syncAllMch(Long mchId, Boolean isDel);
|
||||
|
||||
/**
|
||||
* 同步部门信息
|
||||
*/
|
||||
void syncAllDept(Long deptId);
|
||||
|
||||
void syncAllDept(Long deptId, Boolean isDel);
|
||||
|
||||
/**
|
||||
* 同步用户信息
|
||||
*/
|
||||
void syncAllUser(Long userId);
|
||||
|
||||
/**
|
||||
* 同步身份信息
|
||||
*/
|
||||
void syncAllRole();
|
||||
|
||||
}
|
||||
+4
@@ -4,11 +4,14 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.admin.api.dto.UserInfo;
|
||||
import com.bsd.pjcloud.admin.api.entity.SysDept;
|
||||
import com.bsd.pjcloud.admin.api.feign.RemoteDeptService;
|
||||
import com.bsd.pjcloud.admin.api.feign.RemoteFileService;
|
||||
import com.bsd.pjcloud.admin.api.feign.RemoteUserService;
|
||||
import com.bsd.pjcloud.admin.api.utils.DataUtil;
|
||||
import com.bsd.pjcloud.common.core.constant.CacheConstants;
|
||||
import com.bsd.pjcloud.common.core.util.BeanUtils;
|
||||
@@ -50,6 +53,7 @@ public class MchManageServiceImpl extends ServiceImpl<MchManageMapper, MchManage
|
||||
|
||||
private final String TAG = "商户管理";
|
||||
|
||||
private final RemoteUserService remoteUserService;
|
||||
private final RemoteDeptService remoteDeptService;
|
||||
private final RemoteFileService remoteFileService;
|
||||
|
||||
|
||||
+48
-5
@@ -12,6 +12,7 @@ import com.alibaba.excel.write.metadata.WriteSheet;
|
||||
import com.alibaba.excel.write.metadata.fill.FillConfig;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.admin.api.dto.UserInfo;
|
||||
@@ -35,18 +36,19 @@ import com.bsd.pjcloud.wallet.api.constant.WalletTypeEnum;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletManageBalanceDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletManageDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletTypeDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.MchManageEntity;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletActiveEntity;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletManageEntity;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletTypeEntity;
|
||||
import com.bsd.pjcloud.wallet.api.utils.WalletDataUtil;
|
||||
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletManageBalanceVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletManageVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletSettingVo;
|
||||
import com.bsd.pjcloud.wallet.controller.third.WalletThirdZyController;
|
||||
import com.bsd.pjcloud.wallet.mapper.WalletManageMapper;
|
||||
import com.bsd.pjcloud.wallet.mapper.WalletTypeMapper;
|
||||
import com.bsd.pjcloud.wallet.service.WalletActiveService;
|
||||
import com.bsd.pjcloud.wallet.service.WalletManageService;
|
||||
import com.bsd.pjcloud.wallet.service.WalletSettingService;
|
||||
import com.bsd.pjcloud.wallet.service.WalletTypeService;
|
||||
import com.bsd.pjcloud.wallet.service.*;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -84,6 +86,9 @@ public class WalletManageServiceImpl extends ServiceImpl<WalletManageMapper, Wal
|
||||
private final WalletSettingService walletSettingService;
|
||||
@Lazy
|
||||
private final WalletActiveService walletActiveService;
|
||||
@Lazy
|
||||
private final WalletThirdZyService walletThirdZyService;
|
||||
private final MchManageService mchManageService;
|
||||
|
||||
private final RemoteUserService userService;
|
||||
private final RemoteDeptService deptService;
|
||||
@@ -130,7 +135,7 @@ public class WalletManageServiceImpl extends ServiceImpl<WalletManageMapper, Wal
|
||||
}
|
||||
// 默认创建饭卡并绑定饭卡钱包
|
||||
if (ObjectUtil.equals(v.getUniqueCode(), WalletTypeEnum.EAT.getCode())) {
|
||||
walletActiveService.createAndActiveCard(wallet);
|
||||
walletActiveService.createAndActiveCard(wallet);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -403,6 +408,44 @@ public class WalletManageServiceImpl extends ServiceImpl<WalletManageMapper, Wal
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void userChange(Long userId, Boolean isDel) {
|
||||
if (ObjectUtil.isEmpty(userId)) return;
|
||||
if (ObjectUtil.isEmpty(isDel)) return;
|
||||
if (!isDel) {
|
||||
UserInfo userInfo = userService.getByUserId(userId).getData();
|
||||
if (ObjectUtil.isEmpty(userInfo)) return;
|
||||
SysUser sysUser = userInfo.getSysUser();
|
||||
// 修改钱包部门
|
||||
baseMapper.update(new LambdaUpdateWrapper<WalletManageEntity>()
|
||||
.set(WalletManageEntity::getDeptId, sysUser.getDeptId())
|
||||
.ne(WalletManageEntity::getDeptId, sysUser.getDeptId())
|
||||
.eq(WalletManageEntity::getUserId, sysUser.getUserId())
|
||||
);
|
||||
// 修改钱包冻结开卡商户
|
||||
// 查询用户所属于的商户
|
||||
MchManageVo mch = mchManageService.getFirstMchByDeptId(sysUser.getDeptId());
|
||||
if (ObjectUtil.isNotEmpty(mch)) {
|
||||
walletActiveService.update(new LambdaUpdateWrapper<WalletActiveEntity>()
|
||||
.set(WalletActiveEntity::getMerchantId, mch.getId())
|
||||
.ne(WalletActiveEntity::getMerchantId, mch.getId())
|
||||
.eq(WalletActiveEntity::getUserId, sysUser.getUserId())
|
||||
);
|
||||
}
|
||||
// 同步到正元
|
||||
walletThirdZyService.syncAllUser(userId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deptChange(Long deptId, Boolean isDel) {
|
||||
if (ObjectUtil.isEmpty(deptId)) return;
|
||||
if (ObjectUtil.isEmpty(isDel)) return;
|
||||
// 同步到正元
|
||||
walletThirdZyService.syncAllDept(deptId, isDel);
|
||||
}
|
||||
|
||||
private void disposeList(List<WalletManageVo> list, WalletManageDto dto) {
|
||||
if (ObjectUtil.isNotEmpty(list)) {
|
||||
// 用户
|
||||
|
||||
+54
-28
@@ -30,7 +30,7 @@ import com.bsd.pjcloud.wallet.api.entity.WalletTypeEntity;
|
||||
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletManageVo;
|
||||
import com.bsd.pjcloud.wallet.service.MchManageService;
|
||||
import com.bsd.pjcloud.wallet.service.MchThirdZyService;
|
||||
import com.bsd.pjcloud.wallet.service.WalletThirdZyService;
|
||||
import com.bsd.pjcloud.wallet.service.WalletManageService;
|
||||
import com.bsd.pjcloud.wallet.service.WalletTypeService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -46,7 +46,7 @@ import java.util.Optional;
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class MchThirdZyServiceImpl implements MchThirdZyService {
|
||||
public class MchThirdZyServiceImpl implements WalletThirdZyService {
|
||||
|
||||
private static final String TAG = "用户模块同步到正元信息";
|
||||
|
||||
@@ -62,10 +62,15 @@ public class MchThirdZyServiceImpl implements MchThirdZyService {
|
||||
private final WalletTypeService walletTypeService;
|
||||
|
||||
/**
|
||||
* 同步全部商户
|
||||
* 同步商户信息
|
||||
*/
|
||||
@Override
|
||||
public void syncAllMch(Long mchId) {
|
||||
syncAllMch(mchId, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncAllMch(Long mchId, Boolean isDel) {
|
||||
MchManageDto dto = new MchManageDto();
|
||||
dto.setId(mchId);
|
||||
List<MchManageVo> mchList = mchManageService.list(dto);
|
||||
@@ -78,7 +83,7 @@ public class MchThirdZyServiceImpl implements MchThirdZyService {
|
||||
ZyMerSyncDealerInfoDto entity = new ZyMerSyncDealerInfoDto();
|
||||
entity.setDealerKeyObj(v.getId().toString());
|
||||
entity.setDealerName(v.getName());
|
||||
entity.setIsValid(1);
|
||||
entity.setIsValid(getIsValid(v.getDelFlag(), isDel));
|
||||
entity.setEPID(v.getDeptId().toString());
|
||||
entity.setFixId(getSyncAllMchVersion());
|
||||
syncList.add(entity);
|
||||
@@ -92,13 +97,22 @@ public class MchThirdZyServiceImpl implements MchThirdZyService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步全部商户部门
|
||||
* 同步部门信息
|
||||
*/
|
||||
@Override
|
||||
public void syncAllDept(Long mchId) {
|
||||
// List<SysDept> mchList = remoteDeptService.getAllDept(null).getData();
|
||||
public void syncAllDept(Long deptId) {
|
||||
syncAllDept(deptId, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncAllDept(Long deptId, Boolean isDel) {
|
||||
MchManageDto dto = new MchManageDto();
|
||||
dto.setId(mchId);
|
||||
if(ObjectUtil.isNotEmpty(deptId)){
|
||||
MchManageVo mchManageVo = mchManageService.getFirstMchByDeptId(deptId);
|
||||
if(ObjectUtil.isNotEmpty(mchManageVo)){
|
||||
dto.setDeptId(mchManageVo.getDeptId());
|
||||
}
|
||||
}
|
||||
List<MchManageVo> mchList = mchManageService.list(dto);
|
||||
if (ObjectUtil.isEmpty(mchList)) {
|
||||
log.info("|{}|同步到正元全部商户部门信息错误mchList为空", TAG);
|
||||
@@ -110,7 +124,7 @@ public class MchThirdZyServiceImpl implements MchThirdZyService {
|
||||
ZyMerSyncEnterpriseInfoDto entity = new ZyMerSyncEnterpriseInfoDto();
|
||||
entity.setEPID(v.getDeptId().toString());
|
||||
entity.setEPName(v.getDeptName());
|
||||
entity.setIsValid(1);
|
||||
entity.setIsValid(getIsValid(v.getDelFlag(), isDel));
|
||||
entity.setFixId(syncAllMchVersion);
|
||||
syncList.add(entity);
|
||||
}
|
||||
@@ -123,37 +137,43 @@ public class MchThirdZyServiceImpl implements MchThirdZyService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步到正元全部身份信息
|
||||
* 同步身份信息
|
||||
*/
|
||||
@Override
|
||||
public void syncAllRole() {
|
||||
// 查询需要同步的身份信息
|
||||
List<SysRole> roleList = remoteRoleService.findRolesByCodes(List.of(DEFAULT_USER_ROLE_CODE)).getData();
|
||||
if (ObjectUtil.isEmpty(roleList)) {
|
||||
log.info("|{}|同步到正元全部身份信息错误roleList为空", TAG);
|
||||
log.info("|{}| syncAllRole 错误 List为空", TAG);
|
||||
return;
|
||||
}
|
||||
List<ZyMerSyncAccClassInfoDto> syncList = new ArrayList<>();
|
||||
String syncAllMchVersion = getSyncAllMchVersion();
|
||||
for (SysRole v : roleList) {
|
||||
ZyMerSyncAccClassInfoDto entity = new ZyMerSyncAccClassInfoDto();
|
||||
entity.setAccClassID(v.getRoleId().toString());
|
||||
entity.setAccClassName(v.getRoleName());
|
||||
entity.setEPID("1");
|
||||
entity.setFixId(syncAllMchVersion);
|
||||
syncList.add(entity);
|
||||
// 查询商户信息
|
||||
List<MchManageVo> mchList = mchManageService.list(new MchManageDto());
|
||||
if (ObjectUtil.isEmpty(mchList)) {
|
||||
log.info("|{}| syncAllRole 错误 mchList为空", TAG);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
ZyMerSyncAccClassInfoVo res = thirdZyService.syncAccClassInfoApi(syncList).getData();
|
||||
if (ObjectUtil.isEmpty(res)) return;
|
||||
} catch (Exception e) {
|
||||
log.error("|{}syncAllRole 调用第三方接口错误|", TAG);
|
||||
for (MchManageVo i : mchList) {
|
||||
List<ZyMerSyncAccClassInfoDto> syncList = new ArrayList<>();
|
||||
String syncAllMchVersion = getSyncAllMchVersion();
|
||||
for (SysRole j : roleList) {
|
||||
ZyMerSyncAccClassInfoDto entity = new ZyMerSyncAccClassInfoDto();
|
||||
entity.setAccClassID(j.getRoleId().toString());
|
||||
entity.setAccClassName(j.getRoleName());
|
||||
entity.setEPID(i.getDeptId().toString());
|
||||
entity.setFixId(syncAllMchVersion);
|
||||
syncList.add(entity);
|
||||
}
|
||||
try {
|
||||
ZyMerSyncAccClassInfoVo res = thirdZyService.syncAccClassInfoApi(syncList).getData();
|
||||
if (ObjectUtil.isEmpty(res)) return;
|
||||
} catch (Exception e) {
|
||||
log.error("|{}syncAllRole 调用第三方接口错误|", TAG);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步到正元全部账户信息
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void syncAllUser(Long userId) {
|
||||
Page page = new Page();
|
||||
@@ -242,6 +262,12 @@ public class MchThirdZyServiceImpl implements MchThirdZyService {
|
||||
return LocalDateTimeUtil.format(LocalDateTimeUtil.now(), DatePattern.PURE_DATETIME_PATTERN);
|
||||
}
|
||||
|
||||
// 记账单位是否有效0:禁用 1:有效
|
||||
private Integer getIsValid(String delFlag, Boolean isValid) {
|
||||
if (ObjectUtil.isNotEmpty(isValid) && isValid) return 0;
|
||||
return ObjectUtil.equals(delFlag, "1") ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
// 卡片状态,0销卡;1有效;2挂失;3冻结;4预销卡;5锁卡,默认1
|
||||
private Integer getCardStatus(String cardStatus) {
|
||||
|
||||
Reference in new issue
Block a user