first commit
This commit is contained in:
+120
@@ -0,0 +1,120 @@
|
||||
package com.linke.finance.infrastructure.factory;
|
||||
|
||||
import com.linke.finance.infrastructure.feign.SpecialLogisticsServiceFeign;
|
||||
import com.mhd.common.core.domain.dto.DispatchFeignDto;
|
||||
import com.mhd.common.core.domain.dto.DispatchWaybillDto;
|
||||
import com.mhd.common.core.domain.dto.OrderDto;
|
||||
import com.mhd.common.core.domain.dto.WaybillDto;
|
||||
import com.mhd.common.core.domain.entity.R;
|
||||
import com.mhd.common.core.domain.po.OrderVerificationPo;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.system.api.RemoteLogService;
|
||||
import com.mhd.system.api.domain.SysLogininforPo;
|
||||
import com.mhd.system.api.domain.SysOperLogPo;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 日志服务降级处理
|
||||
*
|
||||
* @author mhd
|
||||
*/
|
||||
@Component
|
||||
public class SpecialLogisticsFallbackFactory implements FallbackFactory<SpecialLogisticsServiceFeign>
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(SpecialLogisticsFallbackFactory.class);
|
||||
|
||||
@Override
|
||||
public SpecialLogisticsServiceFeign create(Throwable throwable)
|
||||
{
|
||||
log.error("日志服务调用失败:{}", throwable.getMessage());
|
||||
return new SpecialLogisticsServiceFeign()
|
||||
{
|
||||
|
||||
@Override
|
||||
public AjaxResult getInfo(Long branchId) {
|
||||
return AjaxResult.error(throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getBranchByOrganizationId(Long organizationId) {
|
||||
return AjaxResult.error(throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getBranchIdByTopOrganizationId(Long topOrganizationId) {
|
||||
return AjaxResult.error(throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getBusinessInfo(Long branchId) {
|
||||
return AjaxResult.error(throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult update(WaybillDto waybillDto) {
|
||||
return AjaxResult.error(throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult payOrder(OrderDto orderDto) {
|
||||
return AjaxResult.error(throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getWaybillByOrderId(Long orderId) {
|
||||
return AjaxResult.error(throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getOrganizationHead(Long branchId) {
|
||||
return AjaxResult.error(throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getWaybillByOrderNo(String orderNo) {
|
||||
return AjaxResult.error(throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getOrderByOutTradeNo(String outTradeNo) {
|
||||
return AjaxResult.error(throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getOrderByOrderNo(String orderNo) {
|
||||
return AjaxResult.error(throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult editByOrderNo(OrderDto orderDto) {
|
||||
return AjaxResult.error(throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<List<OrderVerificationPo>> selectOrderByWaybillList(List<Long> waybillList) {
|
||||
return R.fail(throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getBranchInfoByTopOrganizationId(Long topOrganizationId) {
|
||||
return AjaxResult.error(throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult syncTmsDispatch(List<DispatchFeignDto> dispatchFeignDtoList) {
|
||||
return AjaxResult.error(throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getIdByWaybillNo(String waybillNumber) {
|
||||
return AjaxResult.error(throwable.getMessage());
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
package com.linke.finance.infrastructure.feign;
|
||||
|
||||
import com.mhd.common.core.domain.entity.R;
|
||||
import com.mhd.common.core.domain.po.OrganizationPo;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
||||
@FeignClient("mhd-product-service")
|
||||
public interface ProductServiceFeign {
|
||||
|
||||
/**
|
||||
* @Description 获取一级组织
|
||||
* @Author Alex
|
||||
* @Date 2022/12/2 13:37
|
||||
*/
|
||||
@GetMapping("/organization/selectTopId/{id}")
|
||||
public AjaxResult selectTopId(@PathVariable("id") Long id);
|
||||
|
||||
/**
|
||||
* @Description 根据组织id获取所有的上级组织id
|
||||
* @Author Alex
|
||||
* @Date 2022/12/2 13:37
|
||||
*/
|
||||
@GetMapping("/organization/selectTopOrganizationList/{id}")
|
||||
public AjaxResult selectTopOrganizationList(@PathVariable("id") Long id);
|
||||
|
||||
/**
|
||||
* 查询当前组织所有的组织id
|
||||
*/
|
||||
@GetMapping(value = "/organization/getOrganizationIdsByOrganizationId/{organizationId}")
|
||||
public AjaxResult getOrganizationIdsByOrganizationId(@PathVariable("organizationId") Long organizationId);
|
||||
|
||||
/**
|
||||
* 查询所有的组织id
|
||||
*/
|
||||
@GetMapping(value = "/organization/selectAllOrganizationId")
|
||||
public AjaxResult selectAllOrganizationId();
|
||||
|
||||
|
||||
/**
|
||||
* 根据applicationName查询定时任务集合
|
||||
*/
|
||||
@GetMapping(value = "/elasticJob/elasticJobList/{applicationName}")
|
||||
public AjaxResult elasticJobList(@PathVariable("applicationName") String applicationName);
|
||||
|
||||
/**
|
||||
* 根据id查询组织信息
|
||||
*/
|
||||
@GetMapping(value = "/organization/getInfo/{id}")
|
||||
public AjaxResult getOrganizationInfo(@PathVariable("id") Long id);
|
||||
|
||||
/**
|
||||
* @Description 根据id查询组织信息(包含所有的子组织id)
|
||||
* @Author Alex
|
||||
* @Date 2022/12/6 22:11
|
||||
*/
|
||||
@GetMapping("/organization/getInfoForIdList/{id}")
|
||||
R<OrganizationPo> getInfoForIdList(@PathVariable("id") Long id);
|
||||
|
||||
}
|
||||
+122
@@ -0,0 +1,122 @@
|
||||
package com.linke.finance.infrastructure.feign;
|
||||
|
||||
import com.mhd.common.core.domain.dto.DispatchFeignDto;
|
||||
import com.mhd.common.core.domain.dto.DispatchWaybillDto;
|
||||
import com.mhd.common.core.domain.dto.OrderDto;
|
||||
import com.mhd.common.core.domain.dto.WaybillDto;
|
||||
import com.mhd.common.core.domain.entity.R;
|
||||
import com.mhd.common.core.domain.po.OrderVerificationPo;
|
||||
import com.mhd.common.core.domain.po.WaybillPo;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.log.annotation.Log;
|
||||
import com.mhd.common.log.enums.BusinessType;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@FeignClient("mhd-special-logistics-service")
|
||||
public interface SpecialLogisticsServiceFeign {
|
||||
|
||||
/**
|
||||
* 获取网点详细信息
|
||||
*/
|
||||
@GetMapping("/branch/getInfo/{branchId}")
|
||||
public AjaxResult getInfo(@PathVariable("branchId") Long branchId);
|
||||
|
||||
/**
|
||||
* 根据组织id查询网点
|
||||
*/
|
||||
@GetMapping(value = "/branch/getBranchByOrganizationId/{organizationId}")
|
||||
public AjaxResult getBranchByOrganizationId(@PathVariable("organizationId") Long organizationId);
|
||||
|
||||
/**
|
||||
* 根据一级组织id查询网点ids
|
||||
*/
|
||||
@GetMapping(value = "/branch/getBranchIdByTopOrganizationId/{topOrganizationId}")
|
||||
public AjaxResult getBranchIdByTopOrganizationId(@PathVariable("topOrganizationId") Long topOrganizationId);
|
||||
|
||||
/**
|
||||
* 获取网点业务配置详细信息
|
||||
*/
|
||||
@GetMapping(value = "/branch/getBusinessInfo/{branchId}")
|
||||
public AjaxResult getBusinessInfo(@PathVariable("branchId") Long branchId);
|
||||
|
||||
/**
|
||||
* @Description 修改运单
|
||||
*/
|
||||
@PutMapping("/waybill/update")
|
||||
public AjaxResult update(@RequestBody WaybillDto waybillDto);
|
||||
|
||||
/**
|
||||
* 编辑订单
|
||||
*/
|
||||
@PostMapping("/OrderApi/payOrder")
|
||||
public AjaxResult payOrder(@RequestBody OrderDto orderDto);
|
||||
|
||||
/**
|
||||
* 根据订单id获取运单列表
|
||||
*/
|
||||
@GetMapping("/waybill/getWaybillByOrderId")
|
||||
public AjaxResult getWaybillByOrderId(@RequestParam("orderId") Long orderId);
|
||||
|
||||
/**
|
||||
* 通过网点id获取组织负责人id
|
||||
*/
|
||||
@GetMapping("/branch/getOrganizationHead/{branchId}")
|
||||
public AjaxResult getOrganizationHead(@PathVariable("branchId") Long branchId);
|
||||
|
||||
/**
|
||||
* 根据订单号查询运单信息
|
||||
* @param orderNo
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/waybill/getWaybillByOrderNo")
|
||||
public AjaxResult getWaybillByOrderNo(@RequestParam("orderNo") String orderNo);
|
||||
|
||||
/**
|
||||
*根据订单号查询订单信息
|
||||
* @param outTradeNo
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/OrderApiPc/getOrderByOutTradeNo")
|
||||
public AjaxResult getOrderByOutTradeNo(@RequestParam("outTradeNo") String outTradeNo);
|
||||
|
||||
/**
|
||||
*根据订单号查询订单信息
|
||||
* @param orderNo
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/OrderApiPc/getOrderByOrderNo")
|
||||
public AjaxResult getOrderByOrderNo(@RequestParam("orderNo") String orderNo);
|
||||
|
||||
/**
|
||||
*根据订单号修改支付状态
|
||||
* @param orderDto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/OrderApiPc/editByOrderNo")
|
||||
public AjaxResult editByOrderNo(@RequestBody OrderDto orderDto);
|
||||
|
||||
/**
|
||||
* 根据运单id列表,查询订单列表
|
||||
*/
|
||||
@GetMapping("/OrderApiPc/selectOrderByWaybillList")
|
||||
R<List<OrderVerificationPo>> selectOrderByWaybillList(@RequestParam(value = "waybillList") List<Long> waybillList);
|
||||
|
||||
/**
|
||||
* 根据一级组织id查询网点ids
|
||||
*/
|
||||
@GetMapping(value = "/branch/getBranchInfoByTopOrganizationId/{topOrganizationId}")
|
||||
public AjaxResult getBranchInfoByTopOrganizationId(@PathVariable("topOrganizationId") Long topOrganizationId);
|
||||
|
||||
/**
|
||||
* 同步tms调度单运费支付
|
||||
*/
|
||||
@PostMapping("/dispatchApi/syncTmsDispatch")
|
||||
public AjaxResult syncTmsDispatch(@RequestBody List<DispatchFeignDto> dispatchFeignDtoList);
|
||||
|
||||
@GetMapping("/waybill/getIdByWaybillNo")
|
||||
AjaxResult getIdByWaybillNo(@RequestParam("waybillNumber") String waybillNumber);
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
package com.linke.finance.infrastructure.feign;
|
||||
|
||||
import com.mhd.common.core.domain.dto.SysMultistageDictDto;
|
||||
import com.mhd.common.core.domain.dto.SysProvinceCityCountyDTO;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.core.web.page.TableDataInfo;
|
||||
import com.mhd.system.api.domain.SysDictData;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@FeignClient("mhd-system")
|
||||
public interface SystemServiceFeign {
|
||||
|
||||
|
||||
@GetMapping("/dict/data/{dictCode}")
|
||||
public AjaxResult getTopOrganization(@PathVariable("dictCode") Long dictCode);
|
||||
|
||||
@PostMapping("/dict/data/findDatalist")
|
||||
public AjaxResult findDatalist(@RequestBody SysDictData sysDictData);
|
||||
|
||||
@GetMapping("/dict/data/type/{dictType}")
|
||||
public AjaxResult selectListByDictType(@PathVariable("dictType") String dictType);
|
||||
|
||||
/**
|
||||
* 查询省市县三级
|
||||
* @param sysProvinceDTO
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/basicApi/selectAreaChildrenList")
|
||||
public TableDataInfo selectAreaChildrenList(@RequestBody SysProvinceCityCountyDTO sysProvinceDTO);
|
||||
|
||||
/**
|
||||
* 根据县级编码,查询省市县信息
|
||||
* @param sysProvinceDTO
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/basicApi/findAreaInfo")
|
||||
public AjaxResult selectFindAreaInfoList(@RequestBody SysProvinceCityCountyDTO sysProvinceDTO);
|
||||
|
||||
/**
|
||||
* 多级分类字典,根据code查询字典信息
|
||||
* 此接口查询多级分类字典,如果是一级字典,则只需传入字典code,如果是二级或三级字典,则还需要传入父类code,否则会查询失败
|
||||
* @param multistageDictCode 本级code
|
||||
* @param parentDictCode 父级code
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/basicApi/getMultistageDictInfoByCode")
|
||||
public AjaxResult getMultistageDictInfoByCode(@RequestParam("multistageDictCode") String multistageDictCode, @RequestParam("parentDictCode") String parentDictCode);
|
||||
|
||||
/**
|
||||
* 查询多级分类字典
|
||||
* @param sysMultistageDictDto
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/basicApi/selectMultistageDictList")
|
||||
public AjaxResult selectMultistageDictList(SysMultistageDictDto sysMultistageDictDto);
|
||||
|
||||
@ApiOperation("根据code查询多级分类字典集合")
|
||||
@GetMapping(value = "/basicApi/getSysMultistageDictList/{code}")
|
||||
public AjaxResult getSysMultistageDictList(@PathVariable(value = "code") String code);
|
||||
|
||||
/**
|
||||
* 获取地址簿详细信息
|
||||
*/
|
||||
@GetMapping("/addressBookApi/getInfo/{addressBookId}")
|
||||
public AjaxResult getInfo(@PathVariable("addressBookId") Long addressBookId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.linke.finance.infrastructure.feign;
|
||||
|
||||
import com.mhd.common.core.domain.dto.VehicleDto;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
@FeignClient("mhd-transport-service")
|
||||
public interface TransportFeign {
|
||||
|
||||
|
||||
@PostMapping("/vehicle/editVehicle")
|
||||
public AjaxResult editVehicle(@RequestBody VehicleDto vehicleDto);
|
||||
|
||||
/**
|
||||
* 获取车辆信息
|
||||
*/
|
||||
@GetMapping(value = "/vehicle/getVehiclePo/{vehicleId}")
|
||||
public AjaxResult getVehiclePoById(@PathVariable("vehicleId") Long vehicleId);
|
||||
|
||||
/**
|
||||
* 根据用户id查询当前绑定车辆信息
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/vehicle/selectVehicleByUserId/{userId}")
|
||||
public AjaxResult selectVehicleByUserId(@PathVariable("userId") Long userId);
|
||||
}
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
package com.linke.finance.infrastructure.feign;
|
||||
|
||||
import com.mhd.common.core.domain.dto.RoleDTO;
|
||||
import com.mhd.common.core.domain.dto.UserDTO;
|
||||
import com.mhd.common.core.domain.dto.UserDataPermissionQueryDTO;
|
||||
import com.mhd.common.core.domain.dto.UserDriverDTO;
|
||||
import com.mhd.common.core.domain.entity.R;
|
||||
import com.mhd.common.core.domain.po.UserPo;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@FeignClient("mhd-userCenter-service")
|
||||
public interface UserServiceFeign {
|
||||
|
||||
/**
|
||||
* @Description 绑定车辆
|
||||
* @Author Alex
|
||||
* @Date 2023/1/5 21:24
|
||||
*/
|
||||
@PostMapping("/userDriverApi/bindVehicle")
|
||||
public AjaxResult bindVehicle(@RequestBody UserDriverDTO userDriverDTO);
|
||||
|
||||
/**
|
||||
* 查询用户数据权限-单条
|
||||
* @param userDataPermissionQueryDTO
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/userApi/findUserDataPermission")
|
||||
public AjaxResult findUserDataPermission(@RequestBody UserDataPermissionQueryDTO userDataPermissionQueryDTO);
|
||||
|
||||
/**
|
||||
* 查询用户数据权限-包含组织和创建人
|
||||
* @param userDataPermissionQueryDTO
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/userApi/findDataPermission")
|
||||
public AjaxResult findDataPermission(@RequestBody UserDataPermissionQueryDTO userDataPermissionQueryDTO);
|
||||
|
||||
/**
|
||||
* 根据用户ID查询用户详细信息
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/userApi/getInfo/{userId}")
|
||||
public AjaxResult getInfo(@PathVariable("userId") Long userId);
|
||||
|
||||
/**
|
||||
* 根据用户id获取公司名称
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/userApi/getCompanyNameByUserId/{userId}")
|
||||
public AjaxResult getCompanyNameByUserId(@PathVariable("userId") Long userId);
|
||||
|
||||
/**
|
||||
* 新增用户
|
||||
* @param userDTO
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/userApi/add")
|
||||
public AjaxResult addUser(@RequestBody UserDTO userDTO);
|
||||
|
||||
/**
|
||||
* 查询角色列表
|
||||
* @param roleDTO
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/roleApi/getListByFeign")
|
||||
public R<List<UserPo>> getListByFeign(@RequestBody RoleDTO roleDTO);
|
||||
|
||||
@ApiOperation("查询承运人汇总数据")
|
||||
@GetMapping("/userDriverApi/getDriverSummaryData/{userId}")
|
||||
public AjaxResult<?> getDriverSummaryData(@PathVariable("userId") Long userId);
|
||||
|
||||
@ApiOperation("根据用户ID查询角色列表")
|
||||
@GetMapping("/roleApi/getRoleListByUserId/{userId}")
|
||||
public AjaxResult getRoleListByUserId(@PathVariable("userId") Long userId);
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.linke.finance.infrastructure.util;
|
||||
|
||||
/**
|
||||
* @author ZhouGY
|
||||
* @title UniqueKeyUtil
|
||||
* @description: 分布式锁-获取唯一key值
|
||||
* @date 023/11/6 11:26
|
||||
**/
|
||||
public class UniqueKeyUtil {
|
||||
private final static String BRANCH_BILL_KEY = "branchBill";// 网点账单 前缀
|
||||
private final static String VERIFICATION_KEY = "verification";// 收入/支出核销 前缀
|
||||
private final static String PAYAUDIT_KEY = "businessDetail";// 支付审核 前缀
|
||||
|
||||
private final static String WITHDRAW_TRANSFER = "withdrawTransfer";// 提现转账 前缀
|
||||
|
||||
/**
|
||||
* @description 获取网点账单key
|
||||
* @author ZhouGY
|
||||
* @date 2023/11/6 11:26
|
||||
* @param key
|
||||
* @return String
|
||||
*/
|
||||
public static String getBranchBillKey(String key){
|
||||
return String.format("%s:%s", BRANCH_BILL_KEY , key);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取收入/支出核销key
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
public static String getVerificationKey(String key){
|
||||
return String.format("%s:%s", VERIFICATION_KEY , key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取收入/支出核销key
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
public static String getPayAuditKey(String key){
|
||||
return String.format("%s:%s", PAYAUDIT_KEY , key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取收入/支出核销key
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
public static String getWithdrawTransferKey(String key){
|
||||
return String.format("%s:%s", WITHDRAW_TRANSFER , key);
|
||||
}
|
||||
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package com.linke.finance.infrastructure.util.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 数据权限注解
|
||||
* @author zg
|
||||
*/
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface DataPermissions {
|
||||
String cacheName();//缓存逻辑名称
|
||||
|
||||
}
|
||||
+217
@@ -0,0 +1,217 @@
|
||||
package com.linke.finance.infrastructure.util.annotation;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.linke.finance.infrastructure.feign.ProductServiceFeign;
|
||||
import com.linke.finance.infrastructure.feign.SpecialLogisticsServiceFeign;
|
||||
import com.linke.finance.infrastructure.feign.UserServiceFeign;
|
||||
import com.mhd.common.core.domain.dto.UserDataPermissionQueryDTO;
|
||||
import com.mhd.common.core.domain.entity.R;
|
||||
import com.mhd.common.core.domain.po.BranchPo;
|
||||
import com.mhd.common.core.domain.po.OrganizationPo;
|
||||
import com.mhd.common.core.domain.po.UserDataPermissionPO;
|
||||
import com.mhd.common.core.domain.po.UserPo;
|
||||
import com.mhd.common.core.enums.RoleEnum;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.UserError;
|
||||
import com.mhd.common.core.utils.StringUtils;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import org.aspectj.lang.JoinPoint;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.annotation.Before;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@Aspect
|
||||
public class SetDataPermissions {
|
||||
@Resource
|
||||
private UserServiceFeign userServiceFeign;
|
||||
@Resource
|
||||
private ProductServiceFeign productServiceFeign;
|
||||
|
||||
@Resource
|
||||
private SpecialLogisticsServiceFeign specialLogisticsServiceFeign;
|
||||
|
||||
@Before("@annotation(dst)")
|
||||
public void dosetFeildValue(JoinPoint pjp, DataPermissions dst) throws Throwable {
|
||||
Object[] args = pjp.getArgs(); //获取目标对象方法参数
|
||||
//获取当前登陆人
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser == null){
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
OrganizationPo organizationPo = loginUser.getOrganizationPo();
|
||||
UserPo userPo = loginUser.getUserPo();
|
||||
String s = dst.cacheName();
|
||||
Long permissionmenuId = getFieldValue(args, "permissionMenuId");
|
||||
//主要权限
|
||||
if ("master".equals(s)){
|
||||
if (loginUser != null) {
|
||||
//判断当前用户是否是超级管理员/租户管理员还是普通用户,如果是超级管理员则返回全部组织,租户管理员则返回租户所属组织的全部组织,普通用户需要判断数据权限
|
||||
if(StringUtils.isNotBlank(loginUser.getUserPo().getRoleCode())
|
||||
&& loginUser.getUserPo().getRoleCode().contains(RoleEnum.SUPER_ADMIN.getCode())){
|
||||
//全部不加限制条件
|
||||
}else if(StringUtils.isNotBlank(loginUser.getUserPo().getRoleCode())
|
||||
&& loginUser.getUserPo().getRoleCode().contains(RoleEnum.PLAT_ADMIN.getCode())) {
|
||||
R<OrganizationPo> organizationInfo = productServiceFeign.getInfoForIdList(loginUser.getUserPo().getOrganizationId());
|
||||
if (ObjectUtil.isNull(organizationInfo) || ObjectUtil.isNull(organizationInfo.getData())) {
|
||||
throw new ServiceException("登录用户组织不存在");
|
||||
}
|
||||
OrganizationPo data = organizationInfo.getData();
|
||||
List<Long> organizationIdList = data.getOrganizationIdList();
|
||||
objectSetValue(args,"organizationIdList",organizationIdList);
|
||||
}else {
|
||||
if (permissionmenuId != null){
|
||||
//获取当前用户数据权限
|
||||
UserDataPermissionQueryDTO userDataPermissionQueryDTO = new UserDataPermissionQueryDTO();
|
||||
userDataPermissionQueryDTO.setMenuId(permissionmenuId);
|
||||
userDataPermissionQueryDTO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||
userDataPermissionQueryDTO.setUserId(loginUser.getUserPo().getUserId());
|
||||
AjaxResult info = userServiceFeign.findDataPermission(userDataPermissionQueryDTO);
|
||||
if("200".equals(String.valueOf(info.get("code")))){
|
||||
UserDataPermissionPO userDataPermissionPO = JSONObject.parseObject(JSONObject.toJSONString(info.get("data")), UserDataPermissionPO.class);
|
||||
List<Long> organizationIdList = userDataPermissionPO.getOrganizationIdList();
|
||||
if(userDataPermissionPO.getUserDataPersonalStatus() != null && userDataPermissionPO.getUserDataPersonalStatus() == 1){
|
||||
objectSetValue(args,"organizationId", loginUser.getUserPo().getOrganizationId());
|
||||
objectSetValue(args,"createBy", loginUser.getUserPo().getUserId());
|
||||
}
|
||||
if (userDataPermissionPO.getUserDataOrganizationStatus() != null && userDataPermissionPO.getUserDataOrganizationStatus() == 1){
|
||||
if (organizationIdList == null){
|
||||
organizationIdList = new ArrayList<>();
|
||||
}
|
||||
organizationIdList.add(loginUser.getUserPo().getOrganizationId());
|
||||
}
|
||||
if (organizationIdList != null){
|
||||
objectSetValue(args,"organizationIdList", organizationIdList);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
objectSetValue(args,"createBy", loginUser.getUserPo().getUserId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ("branch".equals(s)) {
|
||||
if (ObjectUtil.isNotNull(loginUser)) {
|
||||
//判断当前用户是否是超级管理员/租户管理员还是普通用户,如果是超级管理员则返回全部组织,租户管理员则返回租户所属组织的全部组织,普通用户需要判断数据权限
|
||||
if (StringUtils.isNotBlank(loginUser.getUserPo().getRoleCode())
|
||||
&& loginUser.getUserPo().getRoleCode().contains(RoleEnum.SUPER_ADMIN.getCode())) {
|
||||
//全部不加限制条件
|
||||
} else if (StringUtils.isNotBlank(loginUser.getUserPo().getRoleCode())
|
||||
&& loginUser.getUserPo().getRoleCode().contains(RoleEnum.PLAT_ADMIN.getCode()) && 3 == loginUser.getUserPo().getUserAccountType()) {
|
||||
//根据一级组织id查询网点集合
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
List<Long> branchIdList = Collections.singletonList(0L);
|
||||
AjaxResult result = specialLogisticsServiceFeign.getBranchIdByTopOrganizationId(topOrganizationId);
|
||||
if("200".equals(String.valueOf(result.get("code")))){
|
||||
if (result.get("data") != null){
|
||||
branchIdList = JSONUtil.toList(JSONObject.toJSONString(result.get("data")), Long.class);
|
||||
}
|
||||
}
|
||||
objectSetValue(args,"branchIdList", branchIdList);
|
||||
}else {
|
||||
Long organizationId = loginUser.getUserPo().getOrganizationId();
|
||||
// AjaxResult result = specialLogisticsServiceFeign.getBranchByOrganizationId(organizationId);
|
||||
// Long branchId = 0L;
|
||||
// if("200".equals(String.valueOf(result.get("code")))){
|
||||
// if (result.get("data") != null){
|
||||
// BranchPo branchPo = JSONObject.parseObject(JSONObject.toJSONString(result.get("data")), BranchPo.class);
|
||||
// branchId = branchPo.getBranchId();
|
||||
// }
|
||||
// }
|
||||
// objectSetValue(args,"branchId", branchId);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (s.contains("organization")) {
|
||||
String feild = s.substring(s.indexOf("_") + 1);
|
||||
if (organizationPo.getOrganizationState() != null && organizationPo.getOrganizationState() == 1){
|
||||
if (userPo.getUserAccountType() != null && (ObjectUtil.equal(userPo.getUserAccountType(), 3) || ObjectUtil.equal(userPo.getUserAccountType(), 4))){
|
||||
R<OrganizationPo> organizationInfo = productServiceFeign.getInfoForIdList(loginUser.getUserPo().getOrganizationId());
|
||||
if (ObjectUtil.isNull(organizationInfo) || ObjectUtil.isNull(organizationInfo.getData())) {
|
||||
throw new ServiceException("登录用户组织不存在");
|
||||
}
|
||||
OrganizationPo data = organizationInfo.getData();
|
||||
List<Long> organizationIdList = data.getOrganizationIdList();
|
||||
objectSetValue(args,"organizationIdList",organizationIdList);
|
||||
}else {
|
||||
objectSetValue(args,feild,userPo.getUserId());
|
||||
}
|
||||
}else {
|
||||
if (userPo.getUserAccountType() != null && (ObjectUtil.equal(userPo.getUserAccountType(), 2) || ObjectUtil.equal(userPo.getUserAccountType(), 4))){
|
||||
objectSetValue(args,"organizationId",organizationPo.getOrganizationId());
|
||||
} else {
|
||||
objectSetValue(args,feild,userPo.getUserId());
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (s.contains("invoice")) {
|
||||
String feild = s.substring(s.indexOf("_") + 1);
|
||||
if (organizationPo.getOrganizationState() != null && organizationPo.getOrganizationState() == 1){
|
||||
if (userPo.getUserAccountType() != null && (ObjectUtil.equal(userPo.getUserAccountType(), 3) || ObjectUtil.equal(userPo.getUserAccountType(), 4))){
|
||||
objectSetValue(args,"topOrganizationId",organizationPo.getOrganizationId());
|
||||
}else {
|
||||
//企业员工需要查询企业货主创建的数据
|
||||
if (ObjectUtil.equal(userPo.getUserAccountType(), 5)){
|
||||
objectSetValue(args,feild,userPo.getCreateBy());
|
||||
}else {
|
||||
objectSetValue(args,feild,userPo.getUserId());
|
||||
}
|
||||
}
|
||||
}else {
|
||||
if (userPo.getUserAccountType() != null && (ObjectUtil.equal(userPo.getUserAccountType(), 2) || ObjectUtil.equal(userPo.getUserAccountType(), 4))){
|
||||
objectSetValue(args,"organizationId",organizationPo.getOrganizationId());
|
||||
} else {
|
||||
//企业员工需要查询企业货主创建的数据
|
||||
if (ObjectUtil.equal(userPo.getUserAccountType(), 5)){
|
||||
objectSetValue(args,feild,userPo.getCreateBy());
|
||||
}else {
|
||||
objectSetValue(args,feild,userPo.getUserId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public void objectSetValue(Object[] args, String fieldName, Object value) throws Throwable {
|
||||
for (Object arg : args) {
|
||||
Field field = ReflectionUtils.findField(arg.getClass(), fieldName);
|
||||
if(null != field){
|
||||
ReflectionUtils.makeAccessible(field);
|
||||
ReflectionUtils.setField(field, arg, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
public Long getFieldValue(Object[] args, String field) {
|
||||
Long a = null;
|
||||
for (Object arg : args) {
|
||||
try {
|
||||
Field fieldName= arg.getClass().getDeclaredField(field);
|
||||
if (fieldName != null){
|
||||
fieldName.setAccessible(true);
|
||||
Object o = fieldName.get(arg);
|
||||
if (o != null){
|
||||
a = Long.valueOf(o.toString());
|
||||
return a;
|
||||
}
|
||||
}
|
||||
}catch (NoSuchFieldException e){
|
||||
continue;
|
||||
} catch (IllegalAccessException e) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return a;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.linke.finance.infrastructure.vo;
|
||||
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import com.mhd.common.core.annotation.Excel.ColumnType;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 字典数据表 sys_dict_data
|
||||
*
|
||||
* @author mhd
|
||||
*/
|
||||
@Data
|
||||
public class SysDictDataVo
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 字典编码 */
|
||||
@Excel(name = "字典编码", cellType = ColumnType.NUMERIC)
|
||||
private Long dictCode;
|
||||
|
||||
/** 字典排序 */
|
||||
@Excel(name = "字典排序", cellType = ColumnType.NUMERIC)
|
||||
private Long dictSort;
|
||||
|
||||
/** 字典标签 */
|
||||
@Excel(name = "字典标签")
|
||||
private String dictLabel;
|
||||
|
||||
/** 字典键值 */
|
||||
@Excel(name = "字典键值")
|
||||
private String dictValue;
|
||||
|
||||
/** 字典类型 */
|
||||
@Excel(name = "字典类型")
|
||||
private String dictType;
|
||||
|
||||
/** 样式属性(其他样式扩展) */
|
||||
private String cssClass;
|
||||
|
||||
/** 表格字典样式 */
|
||||
private String listClass;
|
||||
|
||||
/** 是否默认(Y是 N否) */
|
||||
@Excel(name = "是否默认", readConverterExp = "Y=是,N=否")
|
||||
private String isDefault;
|
||||
|
||||
/** 状态(0正常 1停用) */
|
||||
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
|
||||
private String status;
|
||||
|
||||
/** 组织表ID */
|
||||
private Long organizationId;
|
||||
|
||||
/** 组织名称 */
|
||||
private String organizationName;
|
||||
|
||||
/** 一级组织表ID */
|
||||
private Long topOrganizationId;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user