Merge branch 'refs/heads/dev-ty1.2' into dev

# Conflicts:
#	mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java
#	mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java
#	mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java
#	mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java
#	mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java
#	mhd-common/mhd-common-core/src/main/java/com/mhd/common/core/feign/ThirdPartyServiceFeign.java
#	mhd_oms/src/main/java/com/mhd/oms/infrastructure/feign/ThirdPartyServiceFeign.java
#	mhd_oms/src/main/resources/bootstrap.yml
This commit is contained in:
rcx
2026-09-01 23:49:08 +08:00
111 changed files with 4773 additions and 320 deletions
@@ -13,6 +13,7 @@ import com.mhd.basic.application.service.contractManage.ContractManageApplicatio
import com.mhd.basic.domain.expenseAccount.service.ExpenseAccountDomainService;
import com.mhd.basic.infrastructure.feign.vo.SysDictDataVo;
import com.mhd.basic.interfaces.dto.expenseAccount.ExpenseAccountDTO;
import com.mhd.basic.interfaces.dto.expenseAccount.ExpenseAccountExportVO;
import com.mhd.basic.interfaces.dto.expenseAccount.SearchExpenseAccountDTO;
import com.mhd.common.core.enums.DictCode;
import com.mhd.common.core.exception.ServiceException;
@@ -27,6 +28,7 @@ import com.mhd.system.api.SystemServiceFeign;
import com.mhd.system.api.model.LoginUser;
import com.mhd.common.core.domain.po.UserPo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -378,6 +380,55 @@ public class ExpenseAccountApplicationService {
return expenseAccountDomainService.getInfo(expenseAccountId);
}
/**
* 复制费用科目-获取原科目数据供前端回显
* <p>前端拿到数据后回显到新增弹窗,用户填写新科目编码后通过 /edit 接口(id 为空走新增)提交保存。
* 清空科目编码是为了避免直接复制出重复编码(费用科目编码无唯一性校验)。</p>
*/
public ExpenseAccountPO copy(ExpenseAccountDTO expenseAccountDTO) {
if (expenseAccountDTO == null || expenseAccountDTO.getExpenseAccountId() == null) {
throw new ServiceException("原费用科目id不能为空");
}
// 获取原费用科目信息
ExpenseAccountPO original = expenseAccountDomainService.getInfo(expenseAccountDTO.getExpenseAccountId());
if (null == original) {
throw new ServiceException("原费用科目信息未找到");
}
// 清空主键,前端提交时走新增
original.setExpenseAccountId(null);
// 清空科目编码,强制用户输入新编码,避免编码重复
original.setSubjectCode(null);
// 清空审计字段,新增时由 ExpenseAccountAssembler 重新生成
original.setCreateBy(null);
original.setCreateByName(null);
original.setCreateTime(null);
original.setUpdateBy(null);
original.setUpdateByName(null);
original.setUpdateTime(null);
original.setDelFlag(null);
// 清空非表字段
original.setUnit(null);
original.setExpenseAccountPOList(null);
return original;
}
/**
* 构建费用科目导出数据(不分页全量,按列表页查询条件 + 数据权限过滤)
*/
public List<ExpenseAccountExportVO> buildExportList(ExpenseAccountDO expenseAccountDO) {
List<ExpenseAccountExportVO> exportList = new ArrayList<>();
List<ExpenseAccountPO> list = this.queryList(expenseAccountDO);
if (list == null || list.isEmpty()) {
return exportList;
}
for (ExpenseAccountPO po : list) {
ExpenseAccountExportVO vo = new ExpenseAccountExportVO();
BeanUtils.copyProperties(po, vo);
exportList.add(vo);
}
return exportList;
}
/**
* 修改状态
* @param expenseAccountDTO
@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSON;
import com.mhd.basic.domain.storageLocation.repository.po.StorageLocationPO;
import com.mhd.basic.domain.storageLocation.repository.todo.StorageLocationDO;
import com.mhd.basic.domain.storageLocation.service.StorageLocationDomainService;
import com.mhd.basic.interfaces.dto.storageLocation.StorageLocationDTO;
import com.mhd.basic.domain.storageSection.repository.todo.StorageSectionDO;
import com.mhd.basic.infrastructure.feign.vo.SysDictDataVo;
import com.mhd.common.core.domain.po.UserPo;
@@ -207,6 +208,39 @@ public class StorageLocationApplicationService {
return storageLocationDomainService.getInfo(storageLocationId);
}
/**
* 复制库位-获取原库位数据供前端回显
* 前端拿到数据后跳转到新增库位页面,用户修改编码后通过edit接口提交新增
*/
public StorageLocationPO copyStorageLocation(StorageLocationDTO storageLocationDTO) {
if (storageLocationDTO.getStorageLocationId() == null) {
throw new ServiceException("原库位id不能为空");
}
// 获取原库位信息
StorageLocationPO originalStorageLocation = storageLocationDomainService.getInfo(storageLocationDTO.getStorageLocationId());
if (null == originalStorageLocation) {
throw new ServiceException("原库位信息未找到");
}
// 清空唯一性字段:库位id不清空会导致提交后走修改分支覆盖原库位;
// 库位编码同组织同仓库唯一,须由用户重新填写;条码为物理唯一标识,一并清空
originalStorageLocation.setStorageLocationId(null);
originalStorageLocation.setStorageLocationCode(null);
originalStorageLocation.setLocationBarCode(null);
// 状态重置为初始值:新库位无库存(空)、启用、未作废
originalStorageLocation.setStatus(1);
originalStorageLocation.setOpeningUp(1);
originalStorageLocation.setNullify(1);
// 清空审计字段,提交新增时由Assembler按当前登录人重新生成
originalStorageLocation.setCreateBy(null);
originalStorageLocation.setCreateByName(null);
originalStorageLocation.setCreateTime(null);
originalStorageLocation.setUpdateBy(null);
originalStorageLocation.setUpdateByName(null);
originalStorageLocation.setUpdateTime(null);
// 其余业务字段(仓库/库区/库位组、分类/种类/混放策略、限制、长宽高、坐标、备注)保留回显
return originalStorageLocation;
}
public int getStorageLocationCount(StorageLocationDO storageLocationDO)
{
return storageLocationDomainService.getStorageLocationCount(storageLocationDO);
@@ -21,6 +21,7 @@ import com.mhd.system.service.ISysDictTypeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.List;
/**
* 库区ApplicationService
@@ -42,11 +43,32 @@ public class StorageSectionApplicationService {
*/
public List<StorageSectionPO> queryList(StorageSectionDO storageSectionDO) {
//设置查询数据权限
applyQueryDataPermission(storageSectionDO);
return storageSectionDomainService.queryList(storageSectionDO);
}
/**
* 库区面积合计:与 /list 相同的数据权限和筛选条件,SQL 直接 SUM(库区面积),
* 保证合计数与列表中各行库区面积之和一致
*/
public BigDecimal sumStorageRegion(StorageSectionDO storageSectionDO) {
//与 /list 共用同一数据权限,保证合计与列表口径一致
applyQueryDataPermission(storageSectionDO);
return storageSectionDomainService.sumStorageRegion(storageSectionDO);
}
/**
* @description 设置查询数据权限(queryList 与 sumStorageRegion 共用)
* @author ZhouGY
* @param storageSectionDO
*/
private void applyQueryDataPermission(StorageSectionDO storageSectionDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null && loginUser.getUserPo() != null) {
Long userOrganizationId = loginUser.getUserPo().getOrganizationId();
Long frontendOrganizationId = storageSectionDO.getOrganizationId(); // 前端传递的 organizationId
// 数据权限:根据 organizationId 来设置查询权限
// 当前登录用户的 organizationId 为 2827 时,可查全部组织数据;其他组织只能查自己
if (userOrganizationId != null && userOrganizationId == 2827L) {
@@ -91,7 +113,6 @@ public class StorageSectionApplicationService {
}
}
}
return storageSectionDomainService.queryList(storageSectionDO);
}
@@ -5,6 +5,7 @@ import com.mhd.basic.domain.storageSection.entity.StorageSection;
import com.mhd.basic.domain.storageSection.repository.po.StorageSectionPO;
import com.mhd.basic.domain.storageSection.repository.todo.StorageSectionDO;
import java.math.BigDecimal;
import java.util.List;
/**
@@ -20,6 +21,11 @@ public interface IStorageSectionService extends IService<StorageSection>
*/
public List<StorageSectionPO> queryList(StorageSectionDO storageSectionDO);
/**
* 库区面积合计(与 queryList 相同筛选条件)
*/
public BigDecimal sumStorageRegion(StorageSectionDO storageSectionDO);
/**
* 新增库区
*/
@@ -1,5 +1,6 @@
package com.mhd.basic.domain.storageSection.repository.mapper;
import java.math.BigDecimal;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mhd.basic.domain.storageSection.entity.StorageSection;
@@ -19,4 +20,9 @@ public interface StorageSectionMapper extends BaseMapper<StorageSection>
*/
public List<StorageSectionPO> queryList(StorageSectionDO storageSectionDO);
/**
* 库区面积合计(与 queryList 相同筛选条件)
*/
public BigDecimal sumStorageRegion(StorageSectionDO storageSectionDO);
}
@@ -10,6 +10,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
@@ -33,6 +34,15 @@ public class StorageSectionImpl extends ServiceImpl<StorageSectionMapper, Storag
return storageSectionMapper.queryList(storageSectionDO);
}
/**
* 库区面积合计(与 queryList 相同筛选条件)
*/
@Override
public BigDecimal sumStorageRegion(StorageSectionDO storageSectionDO)
{
return storageSectionMapper.sumStorageRegion(storageSectionDO);
}
/**
* 新增库区
*/
@@ -21,6 +21,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
@@ -53,6 +54,13 @@ public class StorageSectionDomainService {
return storageSectionService.queryList(storageSectionDO);
}
/**
* 库区面积合计(与 queryList 相同筛选条件)
*/
public BigDecimal sumStorageRegion(StorageSectionDO storageSectionDO) {
return storageSectionService.sumStorageRegion(storageSectionDO);
}
/**
* 新增库区
@@ -0,0 +1,69 @@
package com.mhd.basic.interfaces.dto.expenseAccount;
import com.mhd.common.core.annotation.Excel;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* 费用科目导出对象 expense_account
*
* @author rcx
* @date 2026-08-28
*/
@Data
public class ExpenseAccountExportVO {
/** 费用类别(关联服务项名称) */
@Excel(name = "费用类别")
private String serviceItemsName;
@Excel(name = "上级科目")
private String upperSubject;
@Excel(name = "费用代码")
private String subjectCode;
@Excel(name = "费用名称")
private String subjectName;
@Excel(name = "税率")
private BigDecimal taxRate;
@Excel(name = "创建订单固定显示", readConverterExp = "0=否,1=是")
private Integer fixedOrderDisplay;
@Excel(name = "入库显示", readConverterExp = "0=否,1=是")
private Integer inOrderDisplay;
@Excel(name = "出库显示", readConverterExp = "0=否,1=是")
private Integer outOrderDisplay;
@Excel(name = "自有车辆固定显示", readConverterExp = "1=是,2=否")
private Integer ownStatus;
@Excel(name = "社会车辆固定显示", readConverterExp = "1=是,2=否")
private Integer societyStatus;
@Excel(name = "备注信息")
private String remark;
@Excel(name = "状态", readConverterExp = "1=启用,2=停用")
private Integer status;
@Excel(name = "创建人")
private String createByName;
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
@Excel(name = "更新人")
private String updateByName;
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
@Excel(name = "所属组织")
private String organizationName;
}
@@ -1,5 +1,7 @@
package com.mhd.basic.interfaces.facade.expenseAccount;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
@@ -13,9 +15,11 @@ import com.mhd.basic.domain.expenseAccount.repository.todo.SearchExpenseAccountD
import com.mhd.basic.domain.sysMultistageDict.repository.po.SysMultistageDictPo;
import com.mhd.basic.interfaces.assember.expenseAccount.ExpenseAccountAssembler;
import com.mhd.basic.interfaces.dto.expenseAccount.ExpenseAccountDTO;
import com.mhd.basic.interfaces.dto.expenseAccount.ExpenseAccountExportVO;
import com.mhd.basic.interfaces.dto.expenseAccount.SearchExpenseAccountDTO;
import com.mhd.common.core.constant.HttpStatus;
import com.mhd.common.core.domain.entity.R;
import com.mhd.common.core.utils.poi.ExcelUtil;
import com.sun.org.apache.bcel.internal.generic.NEW;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang.StringUtils;
@@ -26,6 +30,7 @@ import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import com.mhd.common.core.web.controller.BaseController;
import com.mhd.common.core.web.domain.AjaxResult;
import com.mhd.common.core.web.page.TableDataInfo;
@@ -336,5 +341,45 @@ public class ExpenseAccountApi extends BaseController{
return AjaxResult.success(expenseAccountPO.getUnit());
}
/**
* 复制费用科目
* 返回原科目数据(已清空主键、科目编码等字段)供前端回显到新增弹窗,用户填写新科目编码后通过 /edit 接口提交新增
*/
@ApiOperation("复制费用科目-获取原科目数据用于回显")
@PostMapping("/copy")
public AjaxResult copy(@RequestBody ExpenseAccountDTO expenseAccountDTO)
{
try {
ExpenseAccountPO expenseAccountPO = expenseAccountApplicationService.copy(expenseAccountDTO);
return AjaxResult.success(expenseAccountPO);
}catch (Exception e){
return AjaxResult.error(e.getMessage());
}
}
/**
* 导出费用科目
* 按列表页当前查询条件 + 数据权限过滤,不分页全量导出
*/
@ApiOperation("导出费用科目")
@RequestMapping(value = "/export", method = {RequestMethod.GET, RequestMethod.POST},
produces = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
public void export(ExpenseAccountDTO expenseAccountDTO, HttpServletResponse response) throws IOException
{
//转换实体(不用Assembler,避免其自动填充createByName/updateByName干扰查询条件,与/list一致)
ExpenseAccountDO expenseAccountDO = new ExpenseAccountDO();
BeanUtils.copyProperties(expenseAccountDTO, expenseAccountDO);
//查询全量(不分页),并转换为导出对象
List<ExpenseAccountExportVO> list = expenseAccountApplicationService.buildExportList(expenseAccountDO);
//设置下载头,防止浏览器乱码
String fileName = URLEncoder.encode("费用科目导出", "UTF-8").replaceAll("\\+", "%20");
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setCharacterEncoding("utf-8");
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
ExcelUtil<ExpenseAccountExportVO> util = new ExcelUtil<>(ExpenseAccountExportVO.class);
util.exportExcel(response, list, "费用科目");
}
}
@@ -19,6 +19,7 @@ import com.mhd.basic.domain.storageLocation.repository.todo.StorageLocationDO;
import com.mhd.basic.domain.storageLocation.repository.po.StorageLocationPO;
import com.mhd.basic.application.service.storageLocation.StorageLocationApplicationService;
import com.mhd.basic.interfaces.assember.storageLocation.StorageLocationAssembler;
import com.mhd.common.core.exception.ServiceException;
import javax.annotation.Resource;
import com.mhd.common.core.web.controller.BaseController;
import com.mhd.common.core.web.domain.AjaxResult;
@@ -127,6 +128,24 @@ public class StorageLocationApi extends BaseController{
{
return AjaxResult.success(storageLocationApplicationService.getInfo(storageLocationId));
}
/**
* 复制库位-获取原库位数据用于回显
*/
@ApiOperation("复制库位-获取原库位数据用于回显")
@PostMapping("/copyStorageLocation")
public AjaxResult copyStorageLocation(@RequestBody StorageLocationDTO storageLocationDTO)
{
if(storageLocationDTO.getStorageLocationId() == null){
throw new ServiceException("原库位id不能为空");
}
try {
StorageLocationPO result = storageLocationApplicationService.copyStorageLocation(storageLocationDTO);
return AjaxResult.success(result);
}catch (Exception e){
return AjaxResult.error("复制库位失败:"+e.getMessage());
}
}
@ApiOperation("获取库位总数")
@PostMapping(value = "/getStorageLocationCount")
public AjaxResult getStorageLocationCount(@RequestBody StorageLocationDTO storageLocationDTO)
@@ -55,6 +55,18 @@ public class StorageSectionApi extends BaseController{
return getDataTable(list);
}
/**
* 库区面积合计:与 /list 相同的筛选条件,返回库区面积总和
*/
@ApiOperation("查询库区面积合计(与库区列表相同筛选条件,SUM(库区面积))")
@GetMapping("/sumStorageRegion")
public AjaxResult sumStorageRegion(StorageSectionDTO storageSectionDTO)
{
//转换实体
StorageSectionDO storageSectionDO = storageSectionAssembler.toDO(storageSectionDTO);
return AjaxResult.success(storageSectionApplicationService.sumStorageRegion(storageSectionDO));
}
/**
* 分页查询库区列表
*/
@@ -102,4 +102,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectStorageSectionPo1"/>
order by a.storage_name asc, a.create_time desc
</select>
<!-- 库区面积合计:与 queryList 相同筛选条件,SUM(库区面积),无数据时返回 0 -->
<select id="sumStorageRegion" parameterType="com.mhd.basic.domain.storageSection.repository.todo.StorageSectionDO" resultType="java.math.BigDecimal">
select IFNULL(SUM(a.storage_region), 0)
from storage_section a
LEFT JOIN warehouse w ON a.warehouse_id = w.warehouse_id AND w.del_flag = 1
<include refid="selectStorageSectionPo1"/>
</select>
</mapper>