Compare commits

..

No commits in common. "dev" and "dev-aikai-开支日报导出" have entirely different histories.

14 changed files with 69 additions and 105 deletions

View File

@ -7,6 +7,8 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 开支日报分页 Request VO")
@Data
@NoArgsConstructor
@ -23,9 +25,6 @@ public class BpmOAExpensesPageReqVO extends PageParam {
@Schema(description = "费用类型 | 字典值参照bpm_oa_expenses_type")
private Integer type;
@Schema(description = "支付状态 | 0未支付 1已支付")
private Integer status;
@Schema(description = "费用板块 | 1叉车 2打包 3搬运 4运输")
private Integer costSection;

View File

@ -335,7 +335,6 @@ public class BpmOAExpensesServiceImpl extends BpmOABaseService implements BpmOAE
costSectionMap.put(2, "打包");
costSectionMap.put(3, "搬运");
costSectionMap.put(4, "运输");
costSectionMap.put(5, "管理成本");
List<DictDataRespDTO> bpmOaExpensesType = dictDataApi.getDictDataList("bpm_oa_expenses_type").getCheckedData();
Map<String, String> typeMap = bpmOaExpensesType.stream().collect(Collectors.toMap(DictDataRespDTO::getValue, DictDataRespDTO::getLabel));
List<BpmOAExpensesExportVO> vos = new ArrayList<>();

View File

@ -362,8 +362,6 @@ public class BpmOAReimbursementServiceImpl extends BpmOABaseService implements B
List<ReimbursementDTO> reimbursementDTOS = BeanUtils.toBean(reimbursements, ReimbursementDTO.class);
BpmOAReimbursementRespVO bpmOAReimbursementRespVO = BeanUtils.toBean(reimbursementDO, BpmOAReimbursementRespVO.class);
DeptRespDTO deptRespDTO = deptMap.get(reimbursementDO.getPaymentCompany());
bpmOAReimbursementRespVO.setPaymentCompanyName(deptRespDTO == null ? null : deptRespDTO.getName());
bpmOAReimbursementRespVO.setReimbursements(BpmOAReimbursementConvert.INSTANCE.convertList(reimbursementDTOS, deptMap)); //拼接数据
return bpmOAReimbursementRespVO;

View File

@ -29,6 +29,7 @@ import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.BpmTaskRespVO;
import cn.iocoder.yudao.module.bpm.convert.task.BpmProcessInstanceConvert;
import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmProcessCcDO;
import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmProcessDefinitionExtDO;
import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmTaskAssignRuleDO;
import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmUserGroupDO;
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.*;
import cn.iocoder.yudao.module.bpm.dal.dataobject.task.BpmProcessInstanceExtDO;

View File

@ -40,9 +40,6 @@
<if test="pageReqVO.userId != null">
AND b.user_id = #{pageReqVO.userId}
</if>
<if test="pageReqVO.status != null">
AND b.status = #{pageReqVO.status}
</if>
<if test="pageReqVO.factoryId != null">
AND a.dept_id = #{pageReqVO.factoryId}
</if>

View File

@ -11,6 +11,7 @@ import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ErpProduc
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.out.ErpStockOutPageReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.out.ErpStockOutRespVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.out.ErpStockOutSaveReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.sale.ErpCustomerDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockOutDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockOutItemDO;
@ -32,7 +33,6 @@ import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@ -77,7 +77,7 @@ public class ErpStockOutController {
@Operation(summary = "更新其它出库单的状态")
@PreAuthorize("@ss.hasPermission('erp:stock-out:update-status')")
public CommonResult<Boolean> updateStockOutStatus(@RequestParam("id") Long id,
@RequestParam("status") Integer status) {
@RequestParam("status") Integer status) {
stockOutService.updateStockOutStatus(id, status);
return success(true);
}
@ -103,16 +103,13 @@ public class ErpStockOutController {
List<ErpStockOutItemDO> stockOutItemList = stockOutService.getStockOutItemListByOutId(id);
Map<Long, ErpProductRespVO> productMap = productService.getProductVOMap(
convertSet(stockOutItemList, ErpStockOutItemDO::getProductId));
Map<Long, AdminUserRespDTO> customerMap = adminUserApi.getUserMap(Collections.singletonList(stockOut.getCustomerId()));
return success(BeanUtils.toBean(stockOut, ErpStockOutRespVO.class, stockOutVO ->
stockOutVO.setItems(BeanUtils.toBean(stockOutItemList, ErpStockOutRespVO.Item.class, item -> {
ErpStockDO stock = stockService.getStock(item.getProductId(), item.getWarehouseId());
item.setStockCount(stock != null ? stock.getCount() : BigDecimal.ZERO);
MapUtils.findAndThen(productMap, item.getProductId(), product -> item.setProductName(product.getName())
.setProductBarCode(product.getBarCode()).setProductUnitName(product.getUnitName()));
})).setCustomerName(customerMap.get(stockOut.getCustomerId()) != null ? customerMap.get(stockOut.getCustomerId()).getNickname() : null)
));
}))));
}
@GetMapping("/page")
@ -128,7 +125,7 @@ public class ErpStockOutController {
@PreAuthorize("@ss.hasPermission('erp:stock-out:export')")
public void exportStockOutExcel(@Valid ErpStockOutPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<ErpStockOutRespVO> list = buildStockOutVOPageResult(stockOutService.getStockOutPage(pageReqVO)).getList();
// 导出 Excel
@ -147,7 +144,7 @@ public class ErpStockOutController {
Map<Long, ErpProductRespVO> productMap = productService.getProductVOMap(
convertSet(stockOutItemList, ErpStockOutItemDO::getProductId));
// 1.3 客户信息
Map<Long, AdminUserRespDTO> customerMap = adminUserApi.getUserMap(
Map<Long, ErpCustomerDO> customerMap = customerService.getCustomerMap(
convertSet(pageResult.getList(), ErpStockOutDO::getCustomerId));
// 1.4 管理员信息
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(
@ -158,7 +155,7 @@ public class ErpStockOutController {
item -> MapUtils.findAndThen(productMap, item.getProductId(), product -> item.setProductName(product.getName())
.setProductBarCode(product.getBarCode()).setProductUnitName(product.getUnitName()))));
stockOut.setProductNames(CollUtil.join(stockOut.getItems(), "", ErpStockOutRespVO.Item::getProductName));
MapUtils.findAndThen(customerMap, stockOut.getCustomerId(), supplier -> stockOut.setCustomerName(supplier.getNickname()));
MapUtils.findAndThen(customerMap, stockOut.getCustomerId(), supplier -> stockOut.setCustomerName(supplier.getName()));
MapUtils.findAndThen(userMap, Long.parseLong(stockOut.getCreator()), user -> stockOut.setCreatorName(user.getNickname()));
});
}

View File

@ -6,7 +6,6 @@ import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@ -16,7 +15,6 @@ import static cn.iocoder.yudao.module.erp.enums.DictTypeConstants.AUDIT_STATUS;
@Schema(description = "管理后台 - ERP 其它出库单 Response VO")
@Data
@Accessors(chain = true)
@ExcelIgnoreUnannotated
public class ErpStockOutRespVO {
@ -109,4 +107,4 @@ public class ErpStockOutRespVO {
}
}
}

View File

@ -17,11 +17,11 @@ import cn.iocoder.yudao.module.erp.enums.stock.ErpStockRecordBizTypeEnum;
import cn.iocoder.yudao.module.erp.service.product.ErpProductService;
import cn.iocoder.yudao.module.erp.service.sale.ErpCustomerService;
import cn.iocoder.yudao.module.erp.service.stock.bo.ErpStockRecordCreateReqBO;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Collection;
import java.util.Collections;
@ -66,7 +66,7 @@ public class ErpStockOutServiceImpl implements ErpStockOutService {
// 1.1 校验出库项的有效性
List<ErpStockOutItemDO> stockOutItems = validateStockOutItems(createReqVO.getItems());
// 1.2 校验客户
// customerService.validateCustomer(createReqVO.getCustomerId());
customerService.validateCustomer(createReqVO.getCustomerId());
// 1.3 生成出库单号并校验唯一性
String no = noRedisDAO.generate(ErpNoRedisDAO.STOCK_OUT_NO_PREFIX);
if (stockOutMapper.selectByNo(no) != null) {
@ -94,7 +94,7 @@ public class ErpStockOutServiceImpl implements ErpStockOutService {
throw exception(STOCK_OUT_UPDATE_FAIL_APPROVE, stockOut.getNo());
}
// 1.2 校验客户
// customerService.validateCustomer(updateReqVO.getCustomerId());
customerService.validateCustomer(updateReqVO.getCustomerId());
// 1.3 校验出库项的有效性
List<ErpStockOutItemDO> stockOutItems = validateStockOutItems(updateReqVO.getItems());
@ -225,4 +225,4 @@ public class ErpStockOutServiceImpl implements ErpStockOutService {
return stockOutItemMapper.selectListByOutIds(outIds);
}
}
}

View File

@ -4,19 +4,23 @@ spring:
cloud:
nacos:
server-addr: 127.0.0.1:8848 # Nacos 服务器地址
username: # Nacos 账号
password: # Nacos 密码
discovery: # 【配置中心】配置项
namespace: prod # 命名空间。这里使用 dev 开发环境
namespace: dev # 命名空间。这里使用 dev 开发环境
group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
metadata:
version: 1.0.0 # 服务实例的版本号,可用于灰度发布
config: # 【注册中心】配置项
namespace: prod # 命名空间。这里使用 dev 开发环境
namespace: dev # 命名空间。这里使用 dev 开发环境
group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
--- #################### 数据库相关配置 ####################
spring:
# 数据源配置项
autoconfigure:
exclude:
- de.codecentric.boot.admin.client.config.SpringBootAdminClientAutoConfiguration # 禁用 Spring Boot Admin 的 Client 的自动配置
datasource:
druid: # Druid 【监控】相关的全局配置
web-stat-filter:
@ -38,8 +42,8 @@ spring:
multi-statement-allow: true
dynamic: # 多数据源配置
druid: # Druid 【连接池】相关的全局配置
initial-size: 5 # 初始连接数
min-idle: 10 # 最小连接池数量
initial-size: 1 # 初始连接数
min-idle: 1 # 最小连接池数量
max-active: 20 # 最大连接池数量
max-wait: 600000 # 配置获取连接等待超时的时间,单位:毫秒
time-between-eviction-runs-millis: 60000 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位:毫秒
@ -69,9 +73,12 @@ spring:
database: 0 # 数据库索引
password: yhtkj@2024! # 密码,建议生产环境开启
--- #################### MQ 消息队列相关配置 ####################
--- #################### 定时任务相关配置 ####################
xxl:
job:
enabled: false # 是否开启调度中心,默认为 true 开启
admin:
addresses: http://127.0.0.1:9090/xxl-job-admin # 调度中心部署跟地址
--- #################### 服务保障相关配置 ####################
@ -99,11 +106,20 @@ spring:
instance:
service-host-type: IP # 注册实例时,优先使用 IP [IP, HOST_NAME, CANONICAL_HOST_NAME]
# 日志文件配置
logging:
level:
# 配置自己写的 MyBatis Mapper 打印日志
cn.iocoder.yudao.module.erp.dal.mysql: debug
org.springframework.context.support.PostProcessorRegistrationDelegate: ERROR # TODO 芋艿先禁用Spring Boot 3.X 存在部分错误的 WARN 提示
--- #################### 芋道相关配置 ####################
# 芋道配置项,设置当前项目所有自定义的配置
yudao:
env: # 多环境的配置项
tag: ${HOSTNAME}
security:
mock-enable: true
access-log: # 访问日志的配置项
enable: false
demo: false # 关闭演示模式

View File

@ -13,6 +13,3 @@ server:
logging:
file:
name: ${user.home}/logs/${spring.application.name}.log # 日志文件名,全路径
level:
# 配置自己写的 MyBatis Mapper 打印日志
cn.iocoder.yudao.module.erp.dal.mysql: debug

View File

@ -142,15 +142,6 @@ public class FactoryInfoController {
return success(BeanUtils.toBean(factoryInfo, FactorySimpleRespVO.class));
}
@GetMapping("/factory-list-all")
@Operation(summary = "取登录用户工厂列表, 登陆用户无工厂则拉取所有工厂 | 用于前端下拉框 | 无工厂类型限制")
@PreAuthorize("@ss.hasPermission('smartfactory:factory-info:query')")
public CommonResult<List<FactorySimpleRespVO>> getFactoryALlListByLoginUser() {
List<FactoryInfoDO> factoryInfo = factoryInfoService.getFactoryALlListByLoginUser();
return success(BeanUtils.toBean(factoryInfo, FactorySimpleRespVO.class));
}
@GetMapping("/get-tree")
@Operation(summary = "获得工厂树结构")
@PreAuthorize("@ss.hasPermission('smartfactory:factory-info:query')")
@ -214,4 +205,4 @@ public class FactoryInfoController {
ExcelUtils.write(response, "工厂信息.xls", "数据", FactoryInfoRespVO.class,
BeanUtils.toBean(list, FactoryInfoRespVO.class));
}
}
}

View File

@ -34,14 +34,11 @@ public interface FactoryInfoMapper extends BaseMapperX<FactoryInfoDO> {
}
default List<FactoryInfoDO> selectListByType(List<Long> factoryId) {
return this.selectListByType(factoryId, Arrays.asList("2","3"));
}
default List<FactoryInfoDO> selectListByType(List<Long> factoryId, List<String> types) {
return selectList(new LambdaQueryWrapperX<FactoryInfoDO>()
.eq(FactoryInfoDO::getStatus, CommonStatusEnum.ENABLE.getStatus())
.inIfPresent(FactoryInfoDO::getId, factoryId)
.inIfPresent(FactoryInfoDO::getType, types));
.inIfPresent(FactoryInfoDO::getType, Arrays.asList(2,3)));
}
/**
@ -61,4 +58,4 @@ public interface FactoryInfoMapper extends BaseMapperX<FactoryInfoDO> {
List<FactoryProfitVO> selectProfit(@Param("factoryId") Long factoryId,
@Param("month") String month);
}
}

View File

@ -164,10 +164,4 @@ public interface FactoryInfoService {
* @return 工厂列表
*/
List<FactoryInfoDO> getList();
/**
* 取登录用户工厂列表, 登陆用户无工厂则拉取所有工厂 | 用于前端下拉框 | 无工厂类型限制
* @return
*/
List<FactoryInfoDO> getFactoryALlListByLoginUser();
}

View File

@ -9,10 +9,7 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.ip.core.Area;
import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.smartfactory.controller.admin.factoryinfo.vo.FactoryInfoPageReqVO;
import cn.iocoder.yudao.module.smartfactory.controller.admin.factoryinfo.vo.FactoryInfoSaveReqVO;
import cn.iocoder.yudao.module.smartfactory.controller.admin.factoryinfo.vo.FactoryProfitVO;
import cn.iocoder.yudao.module.smartfactory.controller.admin.factoryinfo.vo.FactoryUpdateStatusReqVO;
import cn.iocoder.yudao.module.smartfactory.controller.admin.factoryinfo.vo.*;
import cn.iocoder.yudao.module.smartfactory.controller.admin.screendata.factory.vo.FactoryRollDataRespVO;
import cn.iocoder.yudao.module.smartfactory.controller.admin.screendata.factory.vo.ProvincesDataRespVO;
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.factoryinfo.FactoryInfoDO;
@ -26,7 +23,6 @@ import cn.iocoder.yudao.module.system.api.permission.dto.DeptDataPermissionRespD
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
@ -36,8 +32,7 @@ import java.util.*;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMultiMap;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
import static cn.iocoder.yudao.module.smartfactory.enums.ErrorCodeConstants.FACTORY_INFO_NOT_EXISTS;
import static cn.iocoder.yudao.module.smartfactory.enums.ErrorCodeConstants.FACTOYRY_EXISTS_STAFF;
@ -47,7 +42,6 @@ import static cn.iocoder.yudao.module.smartfactory.enums.ErrorCodeConstants.FACT
*
* @author 姚君
*/
@Slf4j
@Service
@Validated
public class FactoryInfoServiceImpl implements FactoryInfoService {
@ -245,7 +239,27 @@ public class FactoryInfoServiceImpl implements FactoryInfoService {
@Override
public List<FactoryInfoDO> getFactoryListByAuthority() {
List<Long> factoryIds = this.getFactoryIdsByUserId(getLoginUserId());
List<Long> factoryIds = new ArrayList<>();
DeptDataPermissionRespDTO deptDataPermission = permissionApi.getDeptDataPermission(getLoginUserId()).getCheckedData();
// 如果当前登录用户数据权限 不是查看全部数据
if (!deptDataPermission.getAll()) {
// 获取自己所在工厂
DeptRespDTO respDTO = deptApi.getDept(userApi.getUser(getLoginUserId()).getCheckedData().getDeptId()).getCheckedData();
if (respDTO != null && respDTO.getFactoryId() != null) {
factoryIds.add(respDTO.getFactoryId());
}
// 查找担任负责人的工厂信息
List<DeptRespDTO> deptRespDTO = deptApi.getDeptByLeaderId(getLoginUserId()).getCheckedData();
if (deptRespDTO != null) {
factoryIds.addAll(convertList(deptRespDTO, DeptRespDTO::getFactoryId));
}
}
return factoryInfoMapper.selectListByType(factoryIds);
}
@ -305,19 +319,19 @@ public class FactoryInfoServiceImpl implements FactoryInfoService {
// 获取打包扣款明细
List<SettlementItemDTO.Deduction> packageDeduction = item.stream()
.filter(data -> data.getBusinessType() == 1)
.flatMap(data -> data.getDeductionItems().stream())
.flatMap( data -> data.getDeductionItems().stream())
.collect(Collectors.toList());
// 获取叉车扣款明细
List<SettlementItemDTO.Deduction> forkliftDeduction = item.stream()
.filter(data -> data.getBusinessType() == 2)
.flatMap(data -> data.getDeductionItems().stream())
.flatMap( data -> data.getDeductionItems().stream())
.collect(Collectors.toList());
// 获取搬运扣款明细
List<SettlementItemDTO.Deduction> porterageDeduction = item.stream()
.filter(data -> data.getBusinessType() == 3)
.flatMap(data -> data.getDeductionItems().stream())
.flatMap( data -> data.getDeductionItems().stream())
.collect(Collectors.toList());
// 设置打包扣款
@ -326,7 +340,7 @@ public class FactoryInfoServiceImpl implements FactoryInfoService {
vo.setForkliftDeductionItem(getDeduction(forkliftDeduction));
// 设置搬运扣款
vo.setPorterageDeductionItem(getDeduction(porterageDeduction));
} else {
}else {
// 设置打包扣款
vo.setPackageDeductionItem(getDeduction(null));
// 设置叉车扣款
@ -378,14 +392,14 @@ public class FactoryInfoServiceImpl implements FactoryInfoService {
}
return deduction;
}
}
@Override
public List<FactoryInfoDO> getCompanyFactoryList() {
return factoryInfoMapper.selectList(new LambdaQueryWrapperX<FactoryInfoDO>()
.eq(FactoryInfoDO::getStatus, CommonStatusEnum.ENABLE.getStatus())
.in(FactoryInfoDO::getType, Arrays.asList(0, 1)));
.in(FactoryInfoDO::getType, Arrays.asList(0,1)));
}
@Override
@ -416,38 +430,4 @@ public class FactoryInfoServiceImpl implements FactoryInfoService {
.eq(FactoryInfoDO::getStatus, CommonStatusEnum.ENABLE.getStatus())
.orderByAsc(FactoryInfoDO::getType));
}
@Override
public List<FactoryInfoDO> getFactoryALlListByLoginUser() {
List<Long> factoryIds = this.getFactoryIdsByUserId(getLoginUserId());
return factoryInfoMapper.selectListByType(factoryIds, null);
}
/**
* 根据当前登录用户获取到工厂ID - {获取当前登录用户所在部门 - 根据所在部门找到所对应的工厂(如果所在部门没有工厂则全部) 返回对应工厂id}
*
* @param userId
* @return
*/
public List<Long> getFactoryIdsByUserId(Long userId) {
List<Long> factoryIds = new ArrayList<>();
DeptDataPermissionRespDTO deptDataPermission = permissionApi.getDeptDataPermission(userId).getCheckedData();
// 如果当前登录用户数据权限 不是查看全部数据
if (!deptDataPermission.getAll()) {
// 获取自己所在工厂
DeptRespDTO respDTO = deptApi.getDept(userApi.getUser(userId).getCheckedData().getDeptId()).getCheckedData();
if (respDTO != null && respDTO.getFactoryId() != null) {
factoryIds.add(respDTO.getFactoryId());
}
// 查找担任负责人的工厂信息
List<DeptRespDTO> deptRespDTO = deptApi.getDeptByLeaderId(userId).getCheckedData();
if (deptRespDTO != null) {
factoryIds.addAll(convertList(deptRespDTO, DeptRespDTO::getFactoryId));
}
}
return factoryIds;
}
}