512 changed files with 2513 additions and 25899 deletions
BIN
View File
Binary file not shown.
@@ -18,7 +18,7 @@ import java.util.Set;
/**
* bms财务结算系统feign调用接口
*/
@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.3:8012",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class)
@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.3:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class)
public interface BmsServiceFeign {
@@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
import java.util.concurrent.CompletableFuture;
@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.4:8017",fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class)
@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.4:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class)
public interface OmsServiceFeign {
@@ -66,8 +66,4 @@ public interface OmsServiceFeign {
@ApiOperation("批量推送")
@PostMapping("/reservationStockOutOrderApi/batchPushByNumber")
public AjaxResult batchPushByNumber(@RequestBody List<String> numberList);
@ApiOperation("保存电子签名记录")
@PostMapping("/electronicSignatureApi/saveSignature")
public AjaxResult saveSignature(@RequestBody ElectronicSignatureSyncDTO saveDTO);
}
@@ -237,12 +237,6 @@ public interface SystemServiceFeign {
@GetMapping("/warehouseApi/getInfo/{warehouseId}")
public AjaxResult getWarehouseInfoByWarehouseId(@PathVariable("warehouseId") Long warehouseId);
/**
* 根据warehouseId获取仓库及下库区及库位树(与前端 warehouseApi/getWarehouseChildren 一致,用于PC上架页默认库位回显)
*/
@GetMapping("/warehouseApi/getWarehouseChildren")
public AjaxResult getWarehouseChildren(@RequestParam("warehouseId") Long warehouseId);
/**
* 根据storageSectionId获取对应库区信息
*/
@@ -165,10 +165,6 @@ public interface UserServiceFeign {
@GetMapping("/userShipperApi/userShipperListAll")
public AjaxResult<?> userShipperListAll();
@ApiOperation("查询租户下全部托运人")
@GetMapping("/userShipperApi/userShipperListAllByOrg")
public AjaxResult<?> userShipperListAllByOrg(@RequestParam("orgCode") Long orgCode);
@ApiOperation("查询租户下全部承运人")
@GetMapping("/userDriverApi/userDriverListAll")
public AjaxResult<?> userDriverListAll();
@@ -21,7 +21,7 @@ import java.util.Map;
* @description: TODO
* @date 2024/5/10 8:58
**/
@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.102.192.3:8016",fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class)
@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.102.192.3:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class)
public interface WmsServiceFeign {
/**
@@ -141,22 +141,4 @@ public interface WmsServiceFeign {
@ApiOperation("生成拣货单")
@PostMapping("/stockOutOrderApi/genPickingOrderByOms")
public AjaxResult genPickingOrderByOms(@RequestBody com.mhd.system.api.domain.StockOutOrderDTO stockOutOrderDTO);
/**
* OMS批量签名:更新WMS入/出库单签名字段
*
* <p>OMS端勾选记录批量签名后,通过此Feign调用WMS的 /stockSignatureApi/batchSign 接口,
* 同步更新WMS stock_in_order / stock_out_order 表的签名状态、签名时间、签名图片、签名备注。</p>
*/
@ApiOperation("OMS批量签名-同步WMS入/出库单签名字段")
@PostMapping("/stockSignatureApi/batchSign")
public AjaxResult batchSignWms(@RequestBody SignatureBatchFeignDTO dto);
/**
* OMS查询WMS线路管理列表(按线路编码模糊查,OMS侧自行精确匹配),
* 出库导入时校验送貨線號/車次并回填线路名称
*/
@ApiOperation("OMS查询WMS线路管理列表")
@GetMapping("/lineManagementApi/listByApp")
public AjaxResult listLineManagement(@RequestParam("routeCode") String routeCode);
}
@@ -1,23 +0,0 @@
package com.mhd.system.api;
import com.mhd.common.core.constant.ServiceNameConstants;
import com.mhd.common.core.domain.entity.R;
import com.mhd.common.core.domain.dto.YmsSysUserDTO;
import com.mhd.system.api.domain.YmsLoginUser;
import com.mhd.system.api.factory.RemoteBmsFeignFallbackFactory;
import com.mhd.system.api.factory.RemoteXxlJobFeignFallbackFactory;
import com.mhd.system.api.feign.FeignAutoConfiguration;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
@FeignClient(contextId = "XxlJobService", value = ServiceNameConstants.XXL_JOB_SERVICE,url = "http://127.0.0.1:8020",fallbackFactory = RemoteXxlJobFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class)
public interface XxlJobServiceFeign {
@GetMapping("/user/openFeignTest")
public R<Map<String, Object>> openFeignTest(@RequestParam("param") String string);
}
@@ -9,7 +9,7 @@ import com.mhd.system.api.feign.FeignAutoConfiguration;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,url = "http://10.102.192.4:8018",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class)
@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.102.192.4:8018", configuration = FeignAutoConfiguration.class)
public interface YmsServiceFeign {
/**
@@ -1,108 +0,0 @@
package com.mhd.system.api.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
/**
* 电子签名同步DTOWMS端通过Feign调用OMS
*/
@Data
public class ElectronicSignatureSyncDTO {
@ApiModelProperty("订单ID")
private Long orderId;
@ApiModelProperty("订单号")
private String orderNumber;
@ApiModelProperty("订单类型:IN-入库 OUT-出库")
private String orderType;
@ApiModelProperty("组织ID")
private Long organizationId;
@ApiModelProperty("组织名称")
private String organizationName;
@ApiModelProperty("一级组织ID")
private Long topOrganizationId;
@ApiModelProperty("仓库ID")
private Long warehouseId;
@ApiModelProperty("仓库编码")
private String warehouseCode;
@ApiModelProperty("仓库名称")
private String warehouseName;
@ApiModelProperty("创建人")
private Long createBy;
@ApiModelProperty("创建人姓名")
private String createByName;
@ApiModelProperty("物料明细列表")
private List<MaterialDetailItem> materialDetailList;
@Data
public static class MaterialDetailItem {
@ApiModelProperty("物料基础信息ID")
private Long materialBaseInfoId;
@ApiModelProperty("物料编码")
private String materialCode;
@ApiModelProperty("物料名称")
private String materialName;
@ApiModelProperty("数量")
private BigDecimal quantity;
@ApiModelProperty("单位代码")
private String unitCode;
@ApiModelProperty("单位名称")
private String unitName;
@ApiModelProperty("批次号")
private String batchNumber;
@ApiModelProperty("LOT编号")
private String lotNumber;
@ApiModelProperty("仓库ID")
private Long warehouseId;
@ApiModelProperty("仓库编码")
private String warehouseCode;
@ApiModelProperty("仓库名称")
private String warehouseName;
@ApiModelProperty("库区ID")
private Long storageSectionId;
@ApiModelProperty("库区编码")
private String storageSectionCode;
@ApiModelProperty("库区名称")
private String storageSectionName;
@ApiModelProperty("库位ID")
private Long storageLocationId;
@ApiModelProperty("库位编码")
private String storageLocationCode;
@ApiModelProperty("库位名称")
private String storageLocationName;
@ApiModelProperty("业务唯一ID")
private Long uniqueId;
}
}
@@ -240,7 +240,9 @@ public class InMaterialDetail extends BaseVOEntity {
@ApiModelProperty("父级唯一Id")
private Long parentUniqueId;
@ApiModelProperty("备注")
@Excel(name = "备注")
private String remark;
@ApiModelProperty("越库单id")
private Long overStockId;
@@ -374,29 +376,4 @@ public class InMaterialDetail extends BaseVOEntity {
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
private Date drinkDate;
@ApiModelProperty("过期日期")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date expiryDate;
@ApiModelProperty("来货验收是否合格;1 合格,0 不合格")
@Excel(name = "来货验收是否合格;1 合格,0 不合格")
private String arrivalAcceptQualified;
@ApiModelProperty("包装是否破损;1 破损,0 完好")
@Excel(name = "包装是否破损;1 破损,0 完好")
private String packageDamaged;
@ApiModelProperty("是否解冻 / 水渍;1 是,0 否")
@Excel(name = "是否解冻 / 水渍;1 是,0 否")
private String isThawWaterstain;
@ApiModelProperty("问题货是否已通知客户;1 已通知,0 未通知")
@Excel(name = "问题货是否已通知客户;1 已通知,0 未通知")
private String notifyCustomerAbnormal;
@ApiModelProperty("备注")
@Excel(name = "备注")
private String remark;
}
@@ -244,10 +244,4 @@ public class MaterialBaseInfoFeign extends BaseVOEntity{
@ApiModelProperty(name = "单位")
private String unit;
@ApiModelProperty(name = "组织(多个用,分开)")
private String orgId;
@ApiModelProperty(name = "是否正常物料: 0-是 1-否")
private Integer isNormalMaterial;
}
@@ -83,8 +83,6 @@ public class MaterialInventoryOmsParamDO extends BaseVOEntity {
private Date productionDate;
//过期日期
private Date expiryDate;
//进货日期
private Date purchaseDate;
private String executioOrderNumber;
@@ -1,42 +0,0 @@
package com.mhd.system.api.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import java.util.List;
/**
* OMS→WMS 批量签名 Feign DTO
*
* <p>OMS端批量签名时,通过此DTO调用WMS的批量签名接口,
* 更新WMS stock_in_order / stock_out_order 表的签名字段。</p>
*/
@Data
public class SignatureBatchFeignDTO {
@ApiModelProperty("入库单ID列表")
private List<Long> inOrderIds;
@ApiModelProperty("出库单ID列表")
private List<Long> outOrderIds;
@ApiModelProperty("签名状态:2-已签名")
private Integer signatureStatus;
@ApiModelProperty("签名时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date signatureTime;
@ApiModelProperty("手写签名图片(base64或URL,单张)")
private String signaturePic;
@ApiModelProperty("拍照取证图片(逗号分隔多张URL")
private String evidencePics;
@ApiModelProperty("签名备注")
private String signatureRemark;
}
@@ -50,8 +50,8 @@ public class StockOutOrder extends BaseVOEntity {
@Excel(name = "出库单号")
private String outOrderNumber;
@ApiModelProperty("出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-波次中 6-拣货中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭 12-已复核 13-已交接")
@Excel(name = "出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-波次中 6-拣货中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭 12-已复核 13-已交接")
@ApiModelProperty("出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-波次中 6-拣货中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭 12-已复核")
@Excel(name = "出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-波次中 6-拣货中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭 12-已复核")
private Integer status;
@ApiModelProperty("出库单审核状态: 1-未审核 2-审核不通过 3-审核通过")
@@ -405,13 +405,4 @@ public class StockOutOrder extends BaseVOEntity {
@Excel(name = "车次")
private Integer trainNo;
@ApiModelProperty("线路编码(取自WMS线路管理)")
private String lineCode;
@ApiModelProperty("线路名称(冗余存储)")
private String lineName;
@ApiModelProperty("车次序号(显示: 线路编码-车次, 如31-4)")
private String shuttleNo;
}
@@ -124,20 +124,4 @@ public class WarehouseFeignPO extends BaseVOEntity{
@Excel(name = "作业模式")
private String workMode;
@ApiModelProperty("订单号生成规则(0-日期累加 1-历史累加)")
@Excel(name = "单号生成规则")
private String orderNoGenerateRule;
@ApiModelProperty("入库单号首字母前缀")
@Excel(name = "入库单号首字母前缀")
private String inOrderNoPrefix;
@ApiModelProperty("出库单号首字母前缀")
@Excel(name = "出库单号首字母前缀")
private String outOrderNoPrefix;
@ApiModelProperty("样品出库单号首字母前缀")
@Excel(name = "样品出库单号首字母前缀")
private String sampleOutOrderNoPrefix;
}
@@ -1,30 +0,0 @@
package com.mhd.system.api.domain;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 仓库联动树节点(Feign侧)
* 镜像system端WarehouseLinkagePO/StorageSectionLinkagePO/StorageLocationLinkagePO三级结构:仓库→库区→库位
*
* @author rcx
* @date 2026-08-22
*/
@Data
public class WarehouseLinkageFeignPO implements Serializable {
private static final long serialVersionUID = 1L;
/** 仓库id / 库区id(storageSectionId) / 库位id(storageLocationId) */
private Long id;
/** warehouseCode / storageCode / storageLocationCode */
private String code;
/** warehouseName / storageName / storageLocationName */
private String name;
/** 下级节点:仓库下为库区列表,库区下为库位列表,库位无children */
private List<WarehouseLinkageFeignPO> children;
}
@@ -90,11 +90,6 @@ public class RemoteOmsFeignFallbackFactory implements FallbackFactory<OmsService
public AjaxResult batchPushByNumber(List<String> numberList) {
return null;
}
@Override
public AjaxResult saveSignature(ElectronicSignatureSyncDTO saveDTO) {
return null;
}
};
}
}
@@ -20,7 +20,6 @@ import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@@ -185,11 +184,6 @@ public class RemoteSystemFeignFallbackFactory implements FallbackFactory<SystemS
return AjaxResult.error("根据仓库ID获取仓库信息失败");
}
@Override
public AjaxResult getWarehouseChildren(@RequestParam("warehouseId") Long warehouseId) {
return AjaxResult.error("根据仓库ID获取仓库及下库区及库位树失败");
}
@Override
public AjaxResult getStorageSectionInfoByStorageSectionId(@PathVariable("storageSectionId") Long storageSectionId) {
return AjaxResult.error("根据库区ID获取库区信息失败");
@@ -140,11 +140,6 @@ public class RemoteUserFeignFallbackFactory implements FallbackFactory<UserServi
return AjaxResult.error("获取租户托运人失败");
}
@Override
public AjaxResult<?> userShipperListAllByOrg(Long orgCode) {
return null;
}
@Override
public AjaxResult<?> userDriverListAll() {
return AjaxResult.error("获取租户承运人失败");
@@ -119,18 +119,6 @@ public class RemoteWmsFallbackFactory implements FallbackFactory<WmsServiceFeign
public AjaxResult genPickingOrderByOms(StockOutOrderDTO stockOutOrderDTO) {
return null;
}
@Override
public AjaxResult batchSignWms(SignatureBatchFeignDTO dto) {
log.error("WMS批量签名调用失败");
return AjaxResult.error("WMS批量签名调用失败:" + cause.getMessage());
}
@Override
public AjaxResult listLineManagement(String routeCode) {
log.error("OMS查询WMS线路管理失败, routeCode:{}", routeCode);
return AjaxResult.error("WMS线路管理查询失败:" + cause.getMessage());
}
};
}
}
@@ -1,44 +0,0 @@
package com.mhd.system.api.factory;
import com.mhd.common.core.domain.dto.BusinessDataPushDTO;
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 com.mhd.system.api.BmsServiceFeign;
import com.mhd.system.api.ProductServiceFeign;
import com.mhd.system.api.XxlJobServiceFeign;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* @Description
* @Author zg
* @Version 1.0
* @Date 2023/11/3 14:37
*/
@Component
public class RemoteXxlJobFeignFallbackFactory implements FallbackFactory<XxlJobServiceFeign> {
private static final Logger log = LoggerFactory.getLogger(RemoteXxlJobFeignFallbackFactory.class);
@Override
public XxlJobServiceFeign create(Throwable throwable) {
log.error("系统服务调用失败:{}", throwable.getMessage());
return new XxlJobServiceFeign() {
@Override
public R<Map<String, Object>> openFeignTest(String string) {
return null;
}
};
}
}
@@ -179,67 +179,34 @@ public class TokenLoginApplicationService {
}
/**
* App注册(手机号 + 注册短信验证码 + 密码)
* 注册
*/
public void register(LoginDTO loginDTO) {
String userPhone = loginDTO.getUserPhone(); // LoginDTO.java:27-28
String verificationCode = loginDTO.getVerificationCode(); // LoginDTO.java:30-31
String password = loginDTO.getPassword();
// 1. 基础校验
if (StringUtils.isAnyBlank(userPhone, verificationCode, password)) {
throw new ServiceException("手机号、验证码、密码必须填写");
public void register(String username, String password) {
// 用户名或密码为空 错误
if (StringUtils.isAnyBlank(username, password)) {
throw new ServiceException("用户/密码必须填写");
}
if (!RegexUtil.isPhoneLegal(userPhone)) {
throw new DigitalLogisticsException(UserError.USER_PHONE_REG_ERROR);
if (username.length() < UserConstants.USERNAME_MIN_LENGTH
|| username.length() > UserConstants.USERNAME_MAX_LENGTH) {
throw new ServiceException("账户长度必须在2到20个字符之间");
}
if (password.length() < UserConstants.PASSWORD_MIN_LENGTH
|| password.length() > UserConstants.PASSWORD_MAX_LENGTH) {
throw new ServiceException("密码长度必须在5到20个字符之间");
}
// 2. 校验注册短信验证码(发送时写入 redis,见 SmsApplicationService.java:112, :165
String key = CacheConstants.SMS_REGISTER + userPhone; // "sms_register:" CacheConstants.java:51
Object cache = redisService.getCacheObject(key);
if (cache == null || !ObjectUtil.equal(String.valueOf(cache), verificationCode)) {
recordLogininfor(userPhone, Constants.LOGIN_FAIL, "注册验证码错误", 1);
throw new ServiceException("验证码错误或已过期");
}
// 注册用户信息
SysUser sysUser = new SysUser();
sysUser.setUserName(username);
sysUser.setNickName(username);
sysUser.setPassword(SecurityUtils.encryptPassword(password));
//TODO app注册没写
/*R<?> registerResult = userServiceFeign.registerUserInfo(sysUser, SecurityConstants.INNER);
// 3. 域名 → 一级组织(与 loginByVerificationCode :103-110 一致)
String path = loginDTO.getPath();
AjaxResult topOrganizationIdR = organizationServiceFeign.getOrganizationByPath(path);
if (ObjectUtil.isNull(topOrganizationIdR) || ObjectUtil.isNull(topOrganizationIdR.get("data"))) {
throw new ServiceException("组织不存在,请检查登录域名");
}
SysTenantsPo sysTenantsPo = JSON.parseObject(JSON.toJSONString(topOrganizationIdR.get("data")), SysTenantsPo.class);
Long topOrganizationId = sysTenantsPo.getOrganizationId();
Long selectedOrgId = loginDTO.getOrganizationId(); // LoginDTO.java:37-38App 选择组织时传
Long organizationId = (selectedOrgId != null) ? selectedOrgId : topOrganizationId;
// 4. 手机号已注册则直接提示(UserMapper.xml:199 按 user_phone+top_organization_id 查)
UserDTO query = new UserDTO();
query.setUserPhone(userPhone);
query.setTopOrganizationId(topOrganizationId);
R<LoginUser> exist = userServiceFeign.getUserByTopOrganizationUserPhone(query, SecurityConstants.INNER);
if (exist != null && exist.getData() != null && exist.getData().getUserPo() != null) {
throw new ServiceException("该手机号已注册,请直接登录");
}
// 5. 创建用户(复用验证码登录自动注册的同一链路:
// auth feign UserServiceFeign.java:47-48 → user-center UserAPI.java:332-336
// → UserApplicationService.registerAddUser:1820-1927,内部已处理默认角色/YMS同步)
UserDTO userDTO = new UserDTO();
userDTO.setUserPhone(userPhone);
userDTO.setUserPassword(SecurityUtils.encryptPassword(password));
userDTO.setTopOrganizationId(topOrganizationId);
userDTO.setOrganizationId(organizationId);
userDTO.setOrganizationName(StringUtils.isNotBlank(loginDTO.getOrganizationName())
? loginDTO.getOrganizationName() : sysTenantsPo.getOrganizationName());
R<LoginUser> registerResult = userServiceFeign.registerAddUser(userDTO, SecurityConstants.INNER);
if (R.FAIL == registerResult.getCode()) {
throw new ServiceException(registerResult.getMsg());
}
// 6. 注册成功后清掉验证码并记日志
redisService.deleteObject(key);
recordLogininfor(userPhone, Constants.REGISTER, "注册成功", 2);
}*/
// recordLogininfor(username, Constants.REGISTER, "注册成功");
}
/**
@@ -72,9 +72,9 @@ public class AppTokenController extends BaseController {
@PostMapping("register")
public R<?> register(@RequestBody LoginDTO loginDTO) {
// 用户注册(手机号+短信验证码+密码)
tokenLoginApplicationService.register(loginDTO);
return R.ok("注册成功");
// 用户注册
tokenLoginApplicationService.register(loginDTO.getUsername(), loginDTO.getPassword());
return R.ok();
}
/**
@@ -79,7 +79,6 @@ public class SsoAuthorizeController {
// 5. 重定向到前端页面,token通过URL参数传递
// 前端页面需读取URL中的token参数并存入localStorage
log.info("SSO单点登录成功, account={}", account);
log.info("SSO单点登录成功, account={}, token={} , redirectUrl={}", account, accessToken, redirectUrl);
response.sendRedirect(redirectUrl + "?token=" + URLEncoder.encode(accessToken, StandardCharsets.UTF_8.name()));
} catch (Exception e) {
@@ -50,7 +50,7 @@ public class SsoAuthorizeService {
@Value("${sso.public-key}")
private String publicKeyStr;
@Value("${sso.redirect-url}")
@Value("https://diglog.namkwong.com.mo/main_app/sso")
private String redirectUrl;
@Resource
@@ -550,11 +550,11 @@ public class SysLoginService {
throw new ServiceException("请输入手机号和短信验证码");
}
// //调用工具类校验,校验手机号格式错误
// if (!RegexUtil.isPhoneLegal(userPhone)) {
// recordLogininfor(userPhone, Constants.LOGIN_FAIL, UserError.USER_PHONE_REG_ERROR.errmsg(), 1);
// throw new DigitalLogisticsException(UserError.USER_PHONE_REG_ERROR);
// }
//调用工具类校验,校验手机号格式错误
if (!RegexUtil.isPhoneLegal(userPhone)) {
recordLogininfor(userPhone, Constants.LOGIN_FAIL, UserError.USER_PHONE_REG_ERROR.errmsg(), 1);
throw new DigitalLogisticsException(UserError.USER_PHONE_REG_ERROR);
}
//根据域名获取一级组织ID
AjaxResult topOrganizationIdR = organizationServiceFeign.getOrganizationByPath(path, SecurityConstants.INNER);
@@ -28,7 +28,6 @@ import com.mhd.common.redis.service.RedisService;
import com.mhd.common.security.utils.password.PasswordUtil;
import com.mhd.system.api.RemoteLogService;
import com.mhd.system.api.domain.SysLogininforPo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -40,7 +39,6 @@ import javax.annotation.Resource;
* @description: 登录密码方法
* @date 2023/12/26 15:33
**/
@Slf4j
@Component
public class SysPasswordService
{
@@ -78,31 +76,29 @@ public class SysPasswordService
if (retryCount == null) {
retryCount = 0;
}
//TODO 从三方配置表中取值失败时用默认值保证登录错误提示可用
int maxRetryCount = 5; // 默认密码错5次锁定
long lockTime = 30L; // 默认锁定30分钟
try {
SysDepartInterfaceInfoDTO dto = new SysDepartInterfaceInfoDTO();
dto.setTopOrganizationId(userPo.getTopOrganizationId());
dto.setInterfaceType("login");
dto.setInterfaceTypeKey("maxRetryCount");
List<SysDepartInterfaceInfoPo> pos = thirdPartyServiceFeign.queryListByFeign(dto);
if (pos != null && !pos.isEmpty()) {
maxRetryCount = Integer.parseInt(pos.get(0).getInterfaceTypeValue());
} else {
log.warn("组织[{}]缺少登录配置 login/maxRetryCount,使用默认值{}", userPo.getTopOrganizationId(), maxRetryCount);
}
dto.setInterfaceTypeKey("lockTime");
pos = thirdPartyServiceFeign.queryListByFeign(dto);
if (pos != null && !pos.isEmpty()) {
lockTime = Long.parseLong(pos.get(0).getInterfaceTypeValue());
} else {
log.warn("组织[{}]缺少登录配置 login/lockTime,使用默认值{}", userPo.getTopOrganizationId(), lockTime);
}
} catch (Exception e) {
log.warn("读取登录配置失败,使用默认重试策略", e);
//TODO 从三方配置表中取值
SysDepartInterfaceInfoDTO sysDepartInterfaceInfoDTO = new SysDepartInterfaceInfoDTO();
sysDepartInterfaceInfoDTO.setTopOrganizationId(userPo.getTopOrganizationId());
sysDepartInterfaceInfoDTO.setInterfaceType("login");
sysDepartInterfaceInfoDTO.setInterfaceTypeKey("maxRetryCount");
List<SysDepartInterfaceInfoPo> sysDepartInterfaceInfoPos = thirdPartyServiceFeign.queryListByFeign(sysDepartInterfaceInfoDTO);
if (sysDepartInterfaceInfoPos.isEmpty()){
String errMsg = "缺少登录信息配置,请联系管理员";
recordLogininfor(userPo, Constants.LOGIN_FAIL, errMsg, 1);
throw new ServiceException(errMsg);
}
if (retryCount >= maxRetryCount) {
SysDepartInterfaceInfoPo sysDepartInterfaceInfoPo = sysDepartInterfaceInfoPos.get(0);
Integer maxRetryCount = Integer.valueOf(sysDepartInterfaceInfoPo.getInterfaceTypeValue());
sysDepartInterfaceInfoDTO.setInterfaceTypeKey("lockTime");
sysDepartInterfaceInfoPos = thirdPartyServiceFeign.queryListByFeign(sysDepartInterfaceInfoDTO);
if (sysDepartInterfaceInfoPos.isEmpty()){
String errMsg = "缺少登录信息配置,请联系管理员";
recordLogininfor(userPo, Constants.LOGIN_FAIL, errMsg, 1);
throw new ServiceException(errMsg);
}
sysDepartInterfaceInfoPo = sysDepartInterfaceInfoPos.get(0);
Long lockTime = Long.valueOf(sysDepartInterfaceInfoPo.getInterfaceTypeValue());
if (retryCount >= maxRetryCount){
String errMsg = String.format("密码输入错误%s次,帐户锁定%s分钟", maxRetryCount, lockTime);
recordLogininfor(userPo, Constants.LOGIN_FAIL, errMsg, 1);
throw new ServiceException(errMsg);
+5 -5
View File
@@ -12,10 +12,10 @@ spring:
cloud:
nacos:
discovery:
server-addr: 127.0.0.1:8848
# server-addr: 127.0.0.1:8848
# 线上测试环境配置 容器名+端口号
# server-addr: 10.33.0.129:6010
# server-addr: 10.102.192.31:6848
server-addr: 10.102.192.30:6848
username: nacos
password: manhuoda@2023
#线上正式环境
@@ -23,8 +23,8 @@ spring:
# username: nacos
# password: manhuoda@2023
config:
server-addr: 127.0.0.1:8848
# server-addr: 10.102.192.31:6848
# server-addr: 127.0.0.1:8848
server-addr: 10.102.192.30:6848
# 测试环境配置 容器名+端口号
# server-addr: 10.33.0.129:6010
# 线上测试环境配置 容器名+端口号
@@ -52,4 +52,4 @@ sso:
AwIDAQAB
-----END PUBLIC KEY-----
# SSO登录成功后跳转的前端页面地址
redirect-url: "https://diglog.namkwong.com.mo/main_app/sso"
redirect-url: "/"
@@ -1,46 +0,0 @@
package com.mhd.bi.domain.biPlatformRealData.repository.mapper;
import com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformVehiclePO;
import com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformOverviewPO;
import com.mhd.bi.domain.biPlatformRealData.repository.po.RealVehicleStatusPO;
import com.mhd.bi.domain.biPlatformRealData.repository.po.RealTaskLoadPO;
import com.mhd.bi.domain.biPlatformRealData.repository.po.RealBusinessTypeStatPO;
import com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformFloorStatPO;
import com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformInfoPO;
import java.util.List;
/**
* 月台监测-真实数据 Mapper
* 数据来源TEST_NGWL_YMS 达梦跨库访问
* 列名按达梦默认大写规则若实际库中小写请反馈调整
*/
public interface BiPlatformRealDataMapper {
/** 作业车辆状态列表 */
List<RealPlatformVehiclePO> queryVehicles();
/** 月台实时概览(总数 / 当前作业中) */
RealPlatformOverviewPO queryPlatformOverview();
/** 今日作业任务数 */
Long countTodayTasks();
/** 车辆状态统计(今日) */
RealVehicleStatusPO queryVehicleStatusToday();
/** 本月任务量 */
Long countMonthTasks();
/** 任务负荷(今日 24 小时) */
List<RealTaskLoadPO> queryTaskLoadToday();
/** 今日预约-业务类型统计(按 businessName 分组统计今日预约数量) */
List<RealBusinessTypeStatPO> queryTodayBusinessTypeStats();
/** 月台监控-按楼层统计月台车辆(楼层、月台数量、今日预约车辆、当前作业车辆) */
List<RealPlatformFloorStatPO> queryPlatformFloorStats();
/** 月台管理列表(YMS qms_window_info,含机构/鹤位/状态/楼层/UUID 等完整信息) */
List<RealPlatformInfoPO> queryPlatformInfoList();
}
@@ -1,20 +0,0 @@
package com.mhd.bi.domain.biPlatformRealData.repository.po;
import lombok.Data;
import java.io.Serializable;
/**
* 今日预约-业务类型统计真实数据来自 TEST_NGWL_YMS.QMS_MAIN_BUSINESS
* 按业务类型分组统计今日预约数量
*/
@Data
public class RealBusinessTypeStatPO implements Serializable {
private static final long serialVersionUID = 1L;
/** 业务类型名称(qms_main_business.businessName */
private String businessName;
/** 今日预约数量 */
private Long count;
}
@@ -1,26 +0,0 @@
package com.mhd.bi.domain.biPlatformRealData.repository.po;
import lombok.Data;
import java.io.Serializable;
/**
* 月台监控-月台车辆统计按楼层分组
* 数据来源TEST_NGWL_YMS.QMS_WINDOW_INFO楼层+月台 QMS_MAIN_BUSINESS当日预约/作业
*/
@Data
public class RealPlatformFloorStatPO implements Serializable {
private static final long serialVersionUID = 1L;
/** 楼层(从叫号月台 WINDOW_NAME 解析,如 S1-01 -> F1 */
private String floorNo;
/** 该楼层的月台数量 */
private Long platformCount;
/** 今日预约车辆数(按 WINDOW_NAME 关联楼层) */
private Long todayReservedVehicles;
/** 当前作业车辆数(FLOW_STATUS IN 5,6,7,8,9,10 */
private Long operatingVehicles;
}
@@ -1,59 +0,0 @@
package com.mhd.bi.domain.biPlatformRealData.repository.po;
import lombok.Data;
import java.io.Serializable;
/**
* 月台管理列表真实数据来自 TEST_NGWL_YMS.QMS_WINDOW_INFO
* 对应 YMS qms_window_info 月台/鹤位窗口表
*/
@Data
public class RealPlatformInfoPO implements Serializable {
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
/** 机构代码(org_no */
private String orgNo;
/** 机构名称(dept_name */
private String deptName;
/** 鹤位号/月台号(window_number */
private String windowNumber;
/** 鹤位名称/月台名称(window_name */
private String windowName;
/** 优先级别(priority_set */
private String prioritySet;
/** 鹤位状态/月台状态(running_status */
private String runningStatus;
/** uuid */
private String uuid;
/** 鹤位屏名字集合/绑定月台屏(berr_names */
private String berrNames;
/** 最新业务状态(new_flow_status */
private String newFlowStatus;
/** 月台图片(guide_images */
private String guideImages;
/** 月台楼层(platform_floor */
private String platformFloor;
/** 作业状态 0-空闲 1-占用(job_status */
private Integer jobStatus;
/** 创建人(create_by */
private String createBy;
/** 创建时间(create_time */
private String createTime;
}
@@ -1,18 +0,0 @@
package com.mhd.bi.domain.biPlatformRealData.repository.po;
import lombok.Data;
import java.io.Serializable;
/**
* 月台实时概览真实数据来自 TEST_NGWL_YMS.QMS_WINDOW_INFO
*/
@Data
public class RealPlatformOverviewPO implements Serializable {
private static final long serialVersionUID = 1L;
/** 月台总数 */
private Long totalPlatforms;
/** 当前作业中(月台作业状态=占用) */
private Long operatingPlatforms;
}
@@ -1,30 +0,0 @@
package com.mhd.bi.domain.biPlatformRealData.repository.po;
import lombok.Data;
import java.io.Serializable;
/**
* 月台监测-作业车辆真实数据来自 TEST_NGWL_YMS.QMS_MAIN_BUSINESS
*/
@Data
public class RealPlatformVehiclePO implements Serializable {
private static final long serialVersionUID = 1L;
/** 车牌号(qms_main_business.CARNO */
private String plateNumber;
/** 流程状态(qms_main_business.FLOWSTATUS */
private String status;
/** 叫号月台(qms_queue_list.WINDOWNAME */
private String platformId;
/** 月台作业时长,分钟(EXITTIME - ENTRYTIME */
private Long platformDuration;
/** 预约申请时间(qms_main_business.CREATE_TIME */
private String appointmentTime;
/** 作业楼层(qms_window_info.PLATFORMFLOOR */
private String workFloor;
}
@@ -1,18 +0,0 @@
package com.mhd.bi.domain.biPlatformRealData.repository.po;
import lombok.Data;
import java.io.Serializable;
/**
* 任务负荷统计按小时来自 TEST_NGWL_YMS.QMS_MAIN_BUSINESS
*/
@Data
public class RealTaskLoadPO implements Serializable {
private static final long serialVersionUID = 1L;
/** 0-23 小时 */
private Integer hourOfDay;
/** 该小时段任务数 */
private Long taskCount;
}
@@ -1,24 +0,0 @@
package com.mhd.bi.domain.biPlatformRealData.repository.po;
import lombok.Data;
import java.io.Serializable;
/**
* 作业车辆状态统计真实数据来自 TEST_NGWL_YMS.QMS_MAIN_BUSINESS
*/
@Data
public class RealVehicleStatusPO implements Serializable {
private static final long serialVersionUID = 1L;
/** 今日预约车辆 */
private Long todayReservedVehicles;
/** 当前未签到 */
private Long notCheckedIn;
/** 当前作业中 */
private Long operatingVehicles;
/** 作业完成 */
private Long completedVehicles;
}
@@ -1,350 +0,0 @@
package com.mhd.bi.domain.biPlatformRealData.service;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.mhd.bi.domain.biPlatformRealData.repository.mapper.BiPlatformRealDataMapper;
import com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformVehiclePO;
import com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformOverviewPO;
import com.mhd.bi.domain.biPlatformRealData.repository.po.RealVehicleStatusPO;
import com.mhd.bi.domain.biPlatformRealData.repository.po.RealTaskLoadPO;
import com.mhd.bi.domain.biPlatformRealData.repository.po.RealBusinessTypeStatPO;
import com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformFloorStatPO;
import com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformInfoPO;
import com.mhd.bi.domain.biPlatformSurveillance.repository.mapper.BiPlatformSurveillanceReportMapper;
import com.mhd.bi.domain.biSnapshotSync.repository.mapper.BiSnapshotWriteMapper;
import com.mhd.bi.domain.biSnapshotSync.support.BiSnapshotWeeklyRandomDataBuilder;
import com.mhd.bi.interfaces.facadeApi.biReport.vo.platform.PlatformSurveillanceVO;
import com.mhd.bi.interfaces.facadeApi.biReport.vo.platform.PlatformVehicleItemVO;
import com.mhd.bi.interfaces.facadeApi.biReport.vo.platform.TaskLoadItemVO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Random;
/**
* 月台监测-真实数据业务层封装 YMS 跨库查询
* 列名大小写字段类型需以实际库为准 YMS 库无数据/无权限相关方法应返回空/0不影响写死字段写入快照
*/
@Slf4j
@Service
public class BiPlatformRealDataService {
@Resource
private BiPlatformRealDataMapper biPlatformRealDataMapper;
@Resource
private BiSnapshotWriteMapper biSnapshotWriteMapper;
@Resource
private BiPlatformSurveillanceReportMapper biPlatformSurveillanceReportMapper;
@Resource
private ObjectMapper objectMapper;
private static final String REMARK_REALTIME = "realtime platform-surveillance";
/**
* 实时组装月台监测数据仅当真实业务数据YMS 库查出的字段发生变化时
* 才覆盖更新 BI_PLATFORM_SURVEILLANCE_SNAPSHOT 快照表最新一条后返回
* 写死字段变化不触发更新表中尚无记录时插入一条兜底
*/
public PlatformSurveillanceVO buildRealTimePlatformSurveillanceAndPersist() {
PlatformSurveillanceVO vo = buildRealTimePlatformSurveillance();
try {
String fullJson = objectMapper.writeValueAsString(vo);
String fingerprint = realDataFingerprint(vo);
String latestJson = biPlatformSurveillanceReportMapper.selectLatestPayloadJson();
if (StringUtils.isNotBlank(latestJson)) {
PlatformSurveillanceVO latestVo = objectMapper.readValue(latestJson.trim(), PlatformSurveillanceVO.class);
if (Objects.equals(fingerprint, realDataFingerprint(latestVo))) {
log.info("BI 月台监测真实业务数据未变化,跳过落库");
return vo;
}
}
int rows = biSnapshotWriteMapper.updateLatestPlatformSurveillanceSnapshot(fullJson, REMARK_REALTIME);
if (rows < 1) {
// 表中无最新记录可更新插入一条兜底
biSnapshotWriteMapper.insertPlatformSurveillanceSnapshot(fullJson, REMARK_REALTIME);
}
log.info("BI 月台监测实时数据已落库(覆盖最新, 数据变化), affectedRows={}", rows);
} catch (Exception e) {
log.error("BI 月台监测实时数据落库失败", e);
}
return vo;
}
/**
* 提取月台监测的真实业务数据指纹仅含 YMS 库查出的字段用于判断业务数据是否变化
* 写死/随机字段不纳入指纹故其变化不会触发更新
*/
private String realDataFingerprint(PlatformSurveillanceVO vo) throws Exception {
Map<String, Object> fp = new LinkedHashMap<>();
if (vo.getPlatformOverview() != null) {
fp.put("totalPlatforms", vo.getPlatformOverview().getTotalPlatforms());
fp.put("operatingPlatforms", vo.getPlatformOverview().getOperatingPlatforms());
fp.put("todayTasks", vo.getPlatformOverview().getTodayTasks());
}
if (vo.getVehicleStatus() != null) {
fp.put("todayReservedVehicles", vo.getVehicleStatus().getTodayReservedVehicles());
fp.put("notCheckedIn", vo.getVehicleStatus().getNotCheckedIn());
fp.put("operatingVehicles", vo.getVehicleStatus().getOperatingVehicles());
fp.put("completedVehicles", vo.getVehicleStatus().getCompletedVehicles());
}
if (vo.getMonthlyTaskStatistics() != null) {
fp.put("taskTotal", vo.getMonthlyTaskStatistics().getTaskTotal());
}
if (vo.getVehicles() != null) {
List<Map<String, Object>> vehicles = new ArrayList<>();
for (PlatformVehicleItemVO v : vo.getVehicles()) {
Map<String, Object> m = new LinkedHashMap<>();
m.put("appointmentTime", v.getAppointmentTime());
m.put("workFloor", v.getWorkFloor());
m.put("plateNumber", v.getPlateNumber());
m.put("status", v.getStatus());
m.put("platformId", v.getPlatformId());
m.put("platformDuration", v.getPlatformDuration());
vehicles.add(m);
}
fp.put("vehicles", vehicles);
}
if (vo.getTaskLoadStatistics() != null) {
List<Map<String, Object>> loads = new ArrayList<>();
for (TaskLoadItemVO item : vo.getTaskLoadStatistics()) {
Map<String, Object> m = new LinkedHashMap<>();
m.put("time", item.getTime());
m.put("taskCount", item.getTaskCount());
loads.add(m);
}
fp.put("taskLoadStatistics", loads);
}
return objectMapper.writeValueAsString(fp);
}
public List<RealPlatformVehiclePO> queryVehicles() {
try {
return biPlatformRealDataMapper.queryVehicles();
} catch (Exception e) {
log.error("【YMS】查询作业车辆列表失败: {}", e.getMessage(), e);
return java.util.Collections.emptyList();
}
}
public RealPlatformOverviewPO queryPlatformOverview() {
try {
RealPlatformOverviewPO po = biPlatformRealDataMapper.queryPlatformOverview();
if (po == null) {
po = new RealPlatformOverviewPO();
}
if (po.getTotalPlatforms() == null) po.setTotalPlatforms(0L);
if (po.getOperatingPlatforms() == null) po.setOperatingPlatforms(0L);
return po;
} catch (Exception e) {
log.error("【YMS】查询月台概览失败: {}", e.getMessage(), e);
RealPlatformOverviewPO po = new RealPlatformOverviewPO();
po.setTotalPlatforms(0L);
po.setOperatingPlatforms(0L);
return po;
}
}
public long countTodayTasks() {
try {
Long n = biPlatformRealDataMapper.countTodayTasks();
return n == null ? 0L : n;
} catch (Exception e) {
log.error("【YMS】统计今日作业任务失败: {}", e.getMessage(), e);
return 0L;
}
}
public RealVehicleStatusPO queryVehicleStatusToday() {
try {
RealVehicleStatusPO po = biPlatformRealDataMapper.queryVehicleStatusToday();
if (po == null) po = new RealVehicleStatusPO();
if (po.getTodayReservedVehicles() == null) po.setTodayReservedVehicles(0L);
if (po.getNotCheckedIn() == null) po.setNotCheckedIn(0L);
if (po.getOperatingVehicles() == null) po.setOperatingVehicles(0L);
if (po.getCompletedVehicles() == null) po.setCompletedVehicles(0L);
return po;
} catch (Exception e) {
log.error("【YMS】统计车辆状态失败: {}", e.getMessage(), e);
RealVehicleStatusPO po = new RealVehicleStatusPO();
po.setTodayReservedVehicles(0L);
po.setNotCheckedIn(0L);
po.setOperatingVehicles(0L);
po.setCompletedVehicles(0L);
return po;
}
}
public long countMonthTasks() {
try {
Long n = biPlatformRealDataMapper.countMonthTasks();
return n == null ? 0L : n;
} catch (Exception e) {
log.error("【YMS】统计本月任务量失败: {}", e.getMessage(), e);
return 0L;
}
}
public List<RealTaskLoadPO> queryTaskLoadToday() {
try {
return biPlatformRealDataMapper.queryTaskLoadToday();
} catch (Exception e) {
log.error("【YMS】统计任务负荷失败: {}", e.getMessage(), e);
return java.util.Collections.emptyList();
}
}
/**
* 今日预约-业务类型统计按业务类型分组统计今日预约数量
* 今日预约航空打板 3 返回 {businessName:"航空打板", count:3}
*/
public List<RealBusinessTypeStatPO> queryTodayBusinessTypeStats() {
try {
return biPlatformRealDataMapper.queryTodayBusinessTypeStats();
} catch (Exception e) {
log.error("【YMS】统计今日业务类型失败: {}", e.getMessage(), e);
return java.util.Collections.emptyList();
}
}
/**
* 月台监控-按楼层统计月台车辆返回 {floorNo, platformCount, todayReservedVehicles, operatingVehicles}
* 实时查 YMS 不落库
*/
public List<RealPlatformFloorStatPO> queryPlatformFloorStats() {
try {
return biPlatformRealDataMapper.queryPlatformFloorStats();
} catch (Exception e) {
log.error("【YMS】月台监控按楼层统计失败: {}", e.getMessage(), e);
return java.util.Collections.emptyList();
}
}
/**
* 月台管理列表实时查 YMS qms_window_info返回月台/鹤位窗口完整信息不落库
*/
public List<RealPlatformInfoPO> queryPlatformInfoList() {
try {
return biPlatformRealDataMapper.queryPlatformInfoList();
} catch (Exception e) {
log.error("【YMS】查询月台管理列表失败: {}", e.getMessage(), e);
return java.util.Collections.emptyList();
}
}
/**
* 实时组装月台监测数据原则有真实数据源用真实无真实数据源用写死模拟
* 有真实数据源的字段vehicles / platformOverview / vehicleStatus / taskLoad / taskTotal
* 无条件用 YMS 真实查询覆盖真实为空即为空不用模板兜底
* 无真实数据源的字段效率统计趋势告警任务类型等保留模板写死值
* 每次调用实时查库不经过快照表
*/
public PlatformSurveillanceVO buildRealTimePlatformSurveillance() {
// 固定种子生成写死模板仅用于没有真实数据源的字段
Random r = new Random(20260825L);
PlatformSurveillanceVO template = BiSnapshotWeeklyRandomDataBuilder.platformSurveillance(r);
// 作业车辆列表真实数据源无条件覆盖真实为空则返回空列表不用模板模拟
List<RealPlatformVehiclePO> realVehicles = queryVehicles();
List<PlatformVehicleItemVO> vehicleVos = new ArrayList<>();
for (RealPlatformVehiclePO rv : realVehicles) {
PlatformVehicleItemVO v = new PlatformVehicleItemVO();
v.setAppointmentTime(rv.getAppointmentTime());
v.setWorkFloor(rv.getWorkFloor());
v.setPlateNumber(rv.getPlateNumber());
v.setStatus(translateFlowStatus(rv.getStatus()));
v.setPlatformId(rv.getPlatformId());
v.setPlatformDuration(rv.getPlatformDuration() == null ? 0 : rv.getPlatformDuration().intValue());
vehicleVos.add(v);
}
template.setVehicles(vehicleVos);
// 月台实时概览真实数据源无条件覆盖
if (template.getPlatformOverview() != null) {
RealPlatformOverviewPO ov = queryPlatformOverview();
int total = ov.getTotalPlatforms().intValue();
int occ = ov.getOperatingPlatforms().intValue();
double rate = total > 0 ? Math.round(((double) occ / total) * 100.0 * 100.0) / 100.0 : 0d;
template.getPlatformOverview().setTotalPlatforms(total);
template.getPlatformOverview().setOperatingPlatforms(occ);
template.getPlatformOverview().setCurrentOccupancyRate(rate);
template.getPlatformOverview().setTodayTasks((int) countTodayTasks());
}
// 作业车辆状态统计真实数据源无条件覆盖
if (template.getVehicleStatus() != null) {
RealVehicleStatusPO vs = queryVehicleStatusToday();
template.getVehicleStatus().setTodayReservedVehicles(vs.getTodayReservedVehicles().intValue());
template.getVehicleStatus().setNotCheckedIn(vs.getNotCheckedIn().intValue());
template.getVehicleStatus().setOperatingVehicles(vs.getOperatingVehicles().intValue());
template.getVehicleStatus().setCompletedVehicles(vs.getCompletedVehicles().intValue());
}
// 本月任务统计taskTotal 有真实数据源无条件覆盖YoY 等无真实数据源保留模板写死值
if (template.getMonthlyTaskStatistics() != null) {
template.getMonthlyTaskStatistics().setTaskTotal((int) countMonthTasks());
}
// 任务负荷有真实数据源真实为空则清空不用模板模拟有数据则按真实小时覆盖
List<RealTaskLoadPO> loads = queryTaskLoadToday();
if (loads.isEmpty()) {
template.setTaskLoadStatistics(new ArrayList<>());
} else if (template.getTaskLoadStatistics() != null) {
Map<Integer, Long> hourMap = new HashMap<>();
for (RealTaskLoadPO l : loads) {
hourMap.put(l.getHourOfDay(), l.getTaskCount());
}
for (TaskLoadItemVO item : template.getTaskLoadStatistics()) {
Integer hour = parseHourFromLabel(item.getTime());
if (hour != null && hourMap.containsKey(hour)) {
item.setTaskCount(hourMap.get(hour).intValue());
}
}
}
return template;
}
private static Integer parseHourFromLabel(String label) {
if (label == null) return null;
try {
String s = label.replace("", "").trim();
return Integer.parseInt(s);
} catch (Exception e) {
return null;
}
}
/**
* FLOW_STATUS 数字转中文1已预约 2已签到 3已叫号 4已过号 5已进场 6已称重 7已装车 8二次称重 9已结算 10已还卡 11已出场 12已取消
*/
private static String translateFlowStatus(String flowStatus) {
if (flowStatus == null) return null;
switch (flowStatus.trim()) {
case "1": return "已预约";
case "2": return "已签到";
case "3": return "已叫号";
case "4": return "已过号";
case "5": return "已进场";
case "6": return "已称重";
case "7": return "已装车";
case "8": return "二次称重";
case "9": return "已结算";
case "10": return "已还卡";
case "11": return "已出场";
case "12": return "已取消";
default: return flowStatus;
}
}
}
@@ -85,7 +85,7 @@ public final class BiReportSnapshotMapperSupport {
.entryOvertimeRate(0).overtimeCount(0).platformOnTimeRate(0)
.avgPlatformDuration(0d).yardOnTimeRate(0).avgYardDuration(0d).build())
.platformOverview(PlatformOverviewVO.builder()
.totalPlatforms(0).currentOccupancyRate(0d).operatingPlatforms(0).todayTasks(0).build())
.totalPlatforms(0).currentOccupancyRate(0).operatingPlatforms(0).todayTasks(0).build())
.vehicleStatus(VehicleStatusVO.builder()
.todayReservedVehicles(0).notCheckedIn(0).operatingVehicles(0).completedVehicles(0).build())
.avgOperationDurationTrend(Collections.emptyList())
@@ -13,8 +13,6 @@ public interface BiSnapshotWriteMapper {
int insertPlatformSurveillanceSnapshot(@Param("payloadJson") String payloadJson, @Param("remark") String remark);
int updateLatestPlatformSurveillanceSnapshot(@Param("payloadJson") String payloadJson, @Param("remark") String remark);
int insertOverallOperationSnapshot(@Param("payloadJson") String payloadJson, @Param("remark") String remark);
int insertWarehouseOperationZoneSnapshot(@Param("payloadJson") String payloadJson, @Param("remark") String remark);
@@ -13,20 +13,10 @@ import com.mhd.bi.interfaces.facadeApi.biReport.vo.platform.PlatformSurveillance
import com.mhd.bi.interfaces.facadeApi.biReport.vo.hkMacaoZone.HkMacaoServiceZoneVO;
import com.mhd.bi.interfaces.facadeApi.biReport.vo.transportZone.TransportOperationZoneVO;
import com.mhd.bi.interfaces.facadeApi.biReport.vo.warehouseZone.WarehouseOperationZoneVO;
import com.mhd.bi.interfaces.facadeApi.biReport.vo.platform.PlatformVehicleItemVO;
import com.mhd.bi.domain.biPlatformRealData.service.BiPlatformRealDataService;
import com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformVehiclePO;
import com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformOverviewPO;
import com.mhd.bi.domain.biPlatformRealData.repository.po.RealVehicleStatusPO;
import com.mhd.bi.domain.biPlatformRealData.repository.po.RealTaskLoadPO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.util.Random;
/**
@@ -44,7 +34,6 @@ public class BiReportSnapshotSyncService {
private final BiSnapshotWriteMapper biSnapshotWriteMapper;
private final ObjectMapper objectMapper;
private final BiPlatformRealDataService biPlatformRealDataService;
/**
* 依次同步各快照表单表失败不影响其它表只记日志
@@ -148,88 +137,9 @@ public class BiReportSnapshotSyncService {
return BiSnapshotWeeklyRandomDataBuilder.warehouseTransport(new Random());
}
/** TODO 业务落地:部分字段改为真实数据,其余仍写死。 */
/** TODO 业务落地:改为查询真实数据。临时实现见 {@link BiSnapshotWeeklyRandomDataBuilder#platformSurveillance(Random)}。 */
protected PlatformSurveillanceVO buildPlatformSurveillanceSnapshot() {
// 固定种子保证写死字段每次生成值一致真实字段随后实时覆盖
Random r = new Random(20260825L);
// 写死数据复用原 builder
PlatformSurveillanceVO template = BiSnapshotWeeklyRandomDataBuilder.platformSurveillance(r);
// ====== 真实数据作业车辆列表 ======
List<RealPlatformVehiclePO> realVehicles = biPlatformRealDataService.queryVehicles();
List<PlatformVehicleItemVO> vehicleVos = new ArrayList<>();
for (RealPlatformVehiclePO rv : realVehicles) {
PlatformVehicleItemVO v = new PlatformVehicleItemVO();
v.setAppointmentTime(rv.getAppointmentTime());
v.setWorkFloor(rv.getWorkFloor());
v.setPlateNumber(rv.getPlateNumber());
v.setStatus(rv.getStatus());
v.setPlatformId(rv.getPlatformId());
v.setPlatformDuration(rv.getPlatformDuration() == null ? 0 : rv.getPlatformDuration().intValue());
vehicleVos.add(v);
}
if (!vehicleVos.isEmpty()) {
template.setVehicles(vehicleVos);
}
// ====== 真实数据月台实时概览 ======
RealPlatformOverviewPO ov = biPlatformRealDataService.queryPlatformOverview();
if (template.getPlatformOverview() != null) {
template.getPlatformOverview().setTotalPlatforms(ov.getTotalPlatforms().intValue());
template.getPlatformOverview().setOperatingPlatforms(ov.getOperatingPlatforms().intValue());
int total = ov.getTotalPlatforms().intValue();
int occ = ov.getOperatingPlatforms().intValue();
double rate = total > 0 ? Math.round(((double) occ / total) * 100.0 * 100.0) / 100.0 : 0d;
template.getPlatformOverview().setCurrentOccupancyRate(rate);
}
long todayTasks = biPlatformRealDataService.countTodayTasks();
if (template.getPlatformOverview() != null) {
template.getPlatformOverview().setTodayTasks((int) todayTasks);
}
// ====== 真实数据作业车辆状态统计 ======
RealVehicleStatusPO vs = biPlatformRealDataService.queryVehicleStatusToday();
if (template.getVehicleStatus() != null) {
template.getVehicleStatus().setTodayReservedVehicles(vs.getTodayReservedVehicles().intValue());
template.getVehicleStatus().setNotCheckedIn(vs.getNotCheckedIn().intValue());
template.getVehicleStatus().setOperatingVehicles(vs.getOperatingVehicles().intValue());
template.getVehicleStatus().setCompletedVehicles(vs.getCompletedVehicles().intValue());
}
// ====== 真实数据本月任务统计 taskTotal ======
long monthTasks = biPlatformRealDataService.countMonthTasks();
if (template.getMonthlyTaskStatistics() != null) {
template.getMonthlyTaskStatistics().setTaskTotal((int) monthTasks);
}
// ====== 真实数据任务负荷今日 24 小时 ======
List<RealTaskLoadPO> loads = biPlatformRealDataService.queryTaskLoadToday();
if (!loads.isEmpty() && template.getTaskLoadStatistics() != null) {
Map<Integer, Long> hourMap = new HashMap<>();
for (RealTaskLoadPO l : loads) {
hourMap.put(l.getHourOfDay(), l.getTaskCount());
}
for (com.mhd.bi.interfaces.facadeApi.biReport.vo.platform.TaskLoadItemVO item : template.getTaskLoadStatistics()) {
Integer hour = parseHourFromLabel(item.getTime());
if (hour != null) {
Long n = hourMap.get(hour);
if (n != null) item.setTaskCount(n.intValue());
}
}
}
return template;
}
private static Integer parseHourFromLabel(String label) {
if (label == null) return null;
// "15时" -> 15
try {
String s = label.replace("", "").trim();
return Integer.parseInt(s);
} catch (Exception e) {
return null;
}
return BiSnapshotWeeklyRandomDataBuilder.platformSurveillance(new Random());
}
/**
@@ -127,8 +127,6 @@ public final class BiSnapshotWeeklyRandomDataBuilder {
for (String[] row : Baseline.P_PLATES) {
int dur = jitterInt(Integer.parseInt(row[3]), r);
vehicles.add(PlatformVehicleItemVO.builder()
.appointmentTime(Baseline.P_APPOINTMENT_TIME)
.workFloor(Baseline.P_WORK_FLOOR)
.plateNumber(row[0])
.status(row[1])
.platformId(row[2])
@@ -147,7 +145,7 @@ public final class BiSnapshotWeeklyRandomDataBuilder {
PlatformOverviewVO overview = PlatformOverviewVO.builder()
.totalPlatforms(Math.max(1, jitterInt(Baseline.P_TOT_PL, r)))
.currentOccupancyRate((double) jitterPercentInt(Baseline.P_OCC, r))
.currentOccupancyRate(jitterPercentInt(Baseline.P_OCC, r))
.operatingPlatforms(Math.max(0, jitterInt(Baseline.P_OP, r)))
.todayTasks(Math.max(0, jitterInt(Baseline.P_TASKS, r)))
.build();
@@ -396,8 +394,6 @@ public final class BiSnapshotWeeklyRandomDataBuilder {
static final String[] W_CUST_NAMES = {"华东冷链", "华南汽配", "西南快消", "华北家电", "跨境达"};
static final int[] W_CUST_AMT = {198, 172, 205, 189, 221};
static final String P_APPOINTMENT_TIME = "2026-08-03 09:30:00";
static final String P_WORK_FLOOR = "一楼";
static final String[][] P_PLATES = {
{"粤A12345", "待入场", "#12", "88"},
{"闽D99887", "作业中", "#07", "142"},
@@ -3,10 +3,6 @@ package com.mhd.bi.interfaces.facadeApi.biReport;
import com.mhd.bi.domain.biSnapshotSync.service.BiReportSnapshotSyncService;
import com.mhd.bi.domain.biComprehensive.service.BiComprehensiveReportService;
import com.mhd.bi.domain.biPlatformSurveillance.service.BiPlatformSurveillanceReportService;
import com.mhd.bi.domain.biPlatformRealData.service.BiPlatformRealDataService;
import com.mhd.bi.domain.biPlatformRealData.repository.po.RealBusinessTypeStatPO;
import com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformFloorStatPO;
import com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformInfoPO;
import com.mhd.bi.domain.biOverallOperation.service.BiOverallOperationReportService;
import com.mhd.bi.domain.biHkMacaoServiceZone.service.BiHkMacaoServiceZoneReportService;
import com.mhd.bi.domain.biTransportOperationZone.service.BiTransportOperationZoneReportService;
@@ -33,8 +29,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* BI 报表接口
*/
@@ -54,9 +48,6 @@ public class BiReportApi extends BaseController {
@Autowired
private BiPlatformSurveillanceReportService biPlatformSurveillanceReportService;
@Autowired
private BiPlatformRealDataService biPlatformRealDataService;
@Autowired
private BiOverallOperationReportService biOverallOperationReportService;
@@ -101,42 +92,12 @@ public class BiReportApi extends BaseController {
}
/**
* 月台监测指标查询实时查 YMS 真实字段 + 写死字段并落库一条到 BI_PLATFORM_SURVEILLANCE_SNAPSHOT
* 月台监测指标查询按照 del_flag=1 create_time 最新一条
*/
@ApiOperation(value = "月台监测指标查询", notes = "每次调用实时查询 YMS 库组装并写入快照表;部分字段为真实业务数据,部分为写死数据")
@ApiOperation(value = "月台监测指标查询", notes = "返回 DEL_FLAG=1 且 CREATE_TIME 最新的一条快照")
@GetMapping("/platformSurveillance")
public BiApiResult<PlatformSurveillanceVO> platformSurveillance() {
PlatformSurveillanceVO data = biPlatformRealDataService.buildRealTimePlatformSurveillanceAndPersist();
return BiApiResult.ok(data);
}
/**
* 今日预约-业务类型统计实时查 YMS 不落库
*/
@ApiOperation(value = "今日预约业务类型统计", notes = "按业务类型分组统计今日预约数量,实时查询 YMS 库,不落库;例:航空打板 3 条")
@GetMapping("/businessTypeStats")
public BiApiResult<List<RealBusinessTypeStatPO>> businessTypeStats() {
List<RealBusinessTypeStatPO> data = biPlatformRealDataService.queryTodayBusinessTypeStats();
return BiApiResult.ok(data);
}
/**
* 月台监控-按楼层统计月台车辆实时查 YMS 不落库
*/
@ApiOperation(value = "月台车辆统计(按楼层)", notes = "按楼层统计月台数量、今日预约车辆、当前作业车辆,实时查询 YMS 库,不落库")
@GetMapping("/platformFloorStats")
public BiApiResult<List<RealPlatformFloorStatPO>> platformFloorStats() {
List<RealPlatformFloorStatPO> data = biPlatformRealDataService.queryPlatformFloorStats();
return BiApiResult.ok(data);
}
/**
* 月台管理列表实时查 YMS qms_window_info不落库
*/
@ApiOperation(value = "月台管理列表", notes = "实时查询 YMS 库 qms_window_info,返回月台/鹤位窗口列表(机构、月台号、月台名称、楼层、绑定屏、UUID、状态等),不落库")
@GetMapping("/platformInfoList")
public BiApiResult<List<RealPlatformInfoPO>> platformInfoList() {
List<RealPlatformInfoPO> data = biPlatformRealDataService.queryPlatformInfoList();
PlatformSurveillanceVO data = biPlatformSurveillanceReportService.loadLatestPlatformSurveillance();
return BiApiResult.ok(data);
}
//园区物流大屏接口----------------------------------------------------------------------
@@ -18,7 +18,7 @@ public class PlatformOverviewVO {
private Integer totalPlatforms;
@ApiModelProperty("当前占用率,单位:%")
private Double currentOccupancyRate;
private Integer currentOccupancyRate;
@ApiModelProperty("当前作业中,单位:个")
private Integer operatingPlatforms;
@@ -14,12 +14,6 @@ import lombok.NoArgsConstructor;
@ApiModel("月台监测-作业车辆")
public class PlatformVehicleItemVO {
@ApiModelProperty("预约申请时间")
private String appointmentTime;
@ApiModelProperty("作业楼层")
private String workFloor;
@ApiModelProperty("车牌号码")
private String plateNumber;
@@ -1,146 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mhd.bi.domain.biPlatformRealData.repository.mapper.BiPlatformRealDataMapper">
<!-- 作业车辆状态列表(vehicles):仅查询预约日期是今天(TARGET_DATE)的车辆
plateNumber <- qms_main_business.CAR_NO
status <- qms_main_business.FLOW_STATUS
platformId <- qms_main_business.WINDOW_NAME
platformDuration <- qms_main_business.EXIT_TIME - ENTRY_TIME
appointmentTime <- qms_main_business.CREATE_TIME
workFloor <- qms_window_info.PLATFORM_FLOOR WINDOW_NAME
-->
<select id="queryVehicles" resultType="com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformVehiclePO">
SELECT
mb.CAR_NO AS plateNumber,
mb.FLOW_STATUS AS status,
mb.WINDOW_NAME AS platformId,
CASE
WHEN mb.EXIT_TIME IS NOT NULL AND mb.ENTRY_TIME IS NOT NULL
THEN CAST((mb.EXIT_TIME - mb.ENTRY_TIME) * 24 * 60 AS BIGINT)
ELSE 0
END AS platformDuration,
TO_CHAR(mb.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') AS appointmentTime,
wi.PLATFORM_FLOOR AS workFloor
FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS mb
LEFT JOIN NGWL_TEST_YMS.QMS_WINDOW_INFO wi
ON wi.WINDOW_NAME = mb.WINDOW_NAME
WHERE mb.TARGET_DATE IS NOT NULL
AND TRUNC(mb.TARGET_DATE) = TRUNC(SYSDATE)
ORDER BY mb.CREATE_TIME DESC
</select>
<!-- 月台概览:totalPlatforms(总条数)、operatingPlatforms(作业状态=占用,JOB_STATUS: 0空闲 1占用) -->
<select id="queryPlatformOverview" resultType="com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformOverviewPO">
SELECT
COUNT(1) AS totalPlatforms,
SUM(CASE WHEN JOB_STATUS = 1 THEN 1 ELSE 0 END) AS operatingPlatforms
FROM NGWL_TEST_YMS.QMS_WINDOW_INFO
</select>
<!-- 今日作业任务:实际进入时间是今日的 -->
<select id="countTodayTasks" resultType="java.lang.Long">
SELECT COUNT(1)
FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS
WHERE ENTRY_TIME IS NOT NULL
AND TRUNC(ENTRY_TIME) = TRUNC(SYSDATE)
</select>
<!-- 车辆状态统计:今日的统计(按创建时间 CREATE_TIME / 流程状态)
todayReservedVehicles 改为按预约日期 TARGET_DATE(其它 3 项保持 CREATE_TIME
FLOW_STATUS: 1已预约 2已签到 3已叫号 4已过号 5已进场 6已称重 7已装车 8二次称重 9已结算 10已还卡 11已出场 12已取消 -->
<select id="queryVehicleStatusToday" resultType="com.mhd.bi.domain.biPlatformRealData.repository.po.RealVehicleStatusPO">
SELECT
SUM(CASE WHEN TRUNC(TARGET_DATE) = TRUNC(SYSDATE) THEN 1 ELSE 0 END) AS todayReservedVehicles,
SUM(CASE WHEN FLOW_STATUS = '1' AND TRUNC(CREATE_TIME) = TRUNC(SYSDATE) THEN 1 ELSE 0 END) AS notCheckedIn,
SUM(CASE WHEN FLOW_STATUS IN ('5','6','7','8','9','10') AND TRUNC(CREATE_TIME) = TRUNC(SYSDATE) THEN 1 ELSE 0 END) AS operatingVehicles,
SUM(CASE WHEN FLOW_STATUS = '11' AND TRUNC(CREATE_TIME) = TRUNC(SYSDATE) THEN 1 ELSE 0 END) AS completedVehicles
FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS
</select>
<!-- 本月任务量:实际进入时间是本月的 -->
<select id="countMonthTasks" resultType="java.lang.Long">
SELECT COUNT(1)
FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS
WHERE ENTRY_TIME IS NOT NULL
AND TO_CHAR(ENTRY_TIME, 'YYYY-MM') = TO_CHAR(SYSDATE, 'YYYY-MM')
</select>
<!-- 今日预约-业务名称统计:按 BUSINESS_NAME(业务名称)分组统计今日预约数量,按预约日期 TARGET_DATE 过滤 -->
<select id="queryTodayBusinessTypeStats" resultType="com.mhd.bi.domain.biPlatformRealData.repository.po.RealBusinessTypeStatPO">
SELECT
BUSINESS_NAME AS businessName,
COUNT(1) AS count
FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS
WHERE BUSINESS_NAME IS NOT NULL
AND TRUNC(TARGET_DATE) = TRUNC(SYSDATE)
GROUP BY BUSINESS_NAME
ORDER BY COUNT(1) DESC
</select>
<!-- 月台监控-按楼层统计:楼层从叫号月台 WINDOW_NAME 解析(如 S1-01 / N1-02 -> F1),不依赖字母前缀,只取 - 前面那段的数字
platformCount 来自 QMS_WINDOW_INFOtodayReservedVehicles/operatingVehicles 来自 QMS_MAIN_BUSINESS(按 TARGET_DATE=今天) -->
<select id="queryPlatformFloorStats" resultType="com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformFloorStatPO">
SELECT
'F' || SUBSTR(W.WINDOW_NAME, INSTR(W.WINDOW_NAME,'-')-1, 1) AS floorNo,
COUNT(DISTINCT W.WINDOW_NAME) AS platformCount,
COUNT(DISTINCT CASE
WHEN TRUNC(mb.TARGET_DATE) = TRUNC(SYSDATE) THEN mb.CAR_NO
END) AS todayReservedVehicles,
COUNT(DISTINCT CASE
WHEN TRUNC(mb.TARGET_DATE) = TRUNC(SYSDATE)
AND mb.FLOW_STATUS IN ('5','6','7','8','9','10')
THEN mb.CAR_NO
END) AS operatingVehicles
FROM NGWL_TEST_YMS.QMS_WINDOW_INFO W
LEFT JOIN NGWL_TEST_YMS.QMS_MAIN_BUSINESS mb
ON mb.WINDOW_NAME = W.WINDOW_NAME
WHERE W.WINDOW_NAME LIKE '%-%'
GROUP BY SUBSTR(W.WINDOW_NAME, INSTR(W.WINDOW_NAME,'-')-1, 1)
ORDER BY 1 DESC
</select>
<!-- 任务负荷(今日 24 小时时段):按 EXTRACT(HOUR FROM ENTRY_TIME) 统计 -->
<select id="queryTaskLoadToday" resultType="com.mhd.bi.domain.biPlatformRealData.repository.po.RealTaskLoadPO">
SELECT
EXTRACT(HOUR FROM ENTRY_TIME) AS hourOfDay,
COUNT(1) AS taskCount
FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS
WHERE ENTRY_TIME IS NOT NULL
AND TRUNC(ENTRY_TIME) = TRUNC(SYSDATE)
GROUP BY EXTRACT(HOUR FROM ENTRY_TIME)
ORDER BY EXTRACT(HOUR FROM ENTRY_TIME)
</select>
<!-- 月台管理列表:查询 YMS qms_window_info 月台/鹤位窗口
机构名称 deptName <- sys_dept.DEPT_NAMEd.dept_id = a.ORG_NO
鹤位屏名称 berrNames <- qms_window_berr(WINDOW_ID/BERR_ID) join qms_berr_config(ID/BERR_NAME)WM_CONCAT
其余列来自 qms_window_info 本身 -->
<select id="queryPlatformInfoList" resultType="com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformInfoPO">
SELECT
a.ID AS id,
a.ORG_NO AS orgNo,
d.DEPT_NAME AS deptName,
a.WINDOW_NUMBER AS windowNumber,
a.WINDOW_NAME AS windowName,
a.PRIORITY_SET AS prioritySet,
a.RUNNING_STATUS AS runningStatus,
a.CREATE_BY AS createBy,
TO_CHAR(a.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') AS createTime,
a.UUID AS uuid,
a.GUIDE_IMAGES AS guideImages,
a.PLATFORM_FLOOR AS platformFloor,
a.JOB_STATUS AS jobStatus,
(
SELECT WM_CONCAT(qbc.BERR_NAME)
FROM NGWL_TEST_YMS.QMS_WINDOW_BERR qwb
LEFT JOIN NGWL_TEST_YMS.QMS_BERR_CONFIG qbc ON qbc.ID = qwb.BERR_ID
WHERE qwb.WINDOW_ID = a.ID
) AS berrNames
FROM NGWL_TEST_YMS.QMS_WINDOW_INFO a
LEFT JOIN NGWL_TEST_YMS.SYS_DEPT d ON d.DEPT_ID = a.ORG_NO
ORDER BY a.PLATFORM_FLOOR, a.WINDOW_NUMBER
</select>
</mapper>
@@ -18,15 +18,6 @@
values (#{payloadJson}, SYSDATE, SYSDATE, 1, #{remark})
</insert>
<update id="updateLatestPlatformSurveillanceSnapshot">
update NGWL_TEST_BI.BI_PLATFORM_SURVEILLANCE_SNAPSHOT
set PAYLOAD_JSON = #{payloadJson},
UPDATE_TIME = SYSDATE,
REMARK = #{remark}
where DEL_FLAG = 1
and ID = (select max(t.ID) from NGWL_TEST_BI.BI_PLATFORM_SURVEILLANCE_SNAPSHOT t where t.DEL_FLAG = 1)
</update>
<insert id="insertOverallOperationSnapshot">
insert into NGWL_TEST_BI.BI_OVERALL_OPERATION_SNAPSHOT (PAYLOAD_JSON, CREATE_TIME, UPDATE_TIME, DEL_FLAG, REMARK)
values (#{payloadJson}, SYSDATE, SYSDATE, 1, #{remark})
@@ -66,9 +66,6 @@ public class ServiceNameConstants
//YMS系统
public static final String YMS_SERVICE = "mhd-yms-service";
//YMS系统
public static final String XXL_JOB_SERVICE = "xxl-job-service";
}
@@ -33,6 +33,4 @@ public class WarehousePO implements Serializable {
@Excel(name = "仓库名称")
private String warehouseName;
@Excel(name = "是否启用: 1-否 2-是")
private Integer isEnable;
}
@@ -16,8 +16,7 @@ public enum RoleEnum {
STORE_ADMIN("店铺管理员", "store_admin"),
OWNER_CARGO("货主", "ownerCargo"),
SUPPLIER("供应商", "supplier"),
CUSTOMER("客户", "customer"),
TENANT("租户", "tenant");
CUSTOMER("客户", "customer");
private String name;
private String code;
@@ -26,7 +26,7 @@ import java.io.InputStream;
import java.util.List;
import java.util.Map;
@FeignClient(value = "mhd-third-party-service",url = "http://10.102.192.30:8012",configuration = FeignAutoConfiguration.class)
@FeignClient(value = "mhd-third-party-service", configuration = FeignAutoConfiguration.class)
public interface ThirdPartyServiceFeign {
//查询当前组织所有三方接口信息
@@ -88,8 +88,7 @@ public class GlobalExceptionHandler
{
String requestURI = request.getRequestURI();
log.error("请求地址'{}',发生未知异常.", requestURI, e);
String msg = StringUtils.isEmpty(e.getMessage()) ? "系统繁忙,请稍后重试" : e.getMessage();
return AjaxResult.error(msg);
return AjaxResult.error(e.getMessage());
}
/**
@@ -100,8 +99,7 @@ public class GlobalExceptionHandler
{
String requestURI = request.getRequestURI();
log.error("请求地址'{}',发生系统异常.", requestURI, e);
String msg = StringUtils.isEmpty(e.getMessage()) ? "系统繁忙,请稍后重试" : e.getMessage();
return AjaxResult.error(msg);
return AjaxResult.error(e.getMessage());
}
/**
@@ -34,8 +34,6 @@ public class CaptchaConfig
properties.setProperty(KAPTCHA_SESSION_CONFIG_KEY, "kaptchaCode");
// 验证码文本字符长度 默认为5
properties.setProperty(KAPTCHA_TEXTPRODUCER_CHAR_LENGTH, "4");
// 验证码文本字符源 默认为abcde2345678gfynmnpqr 改为纯数字
properties.setProperty(KAPTCHA_TEXTPRODUCER_CHAR_STRING, "0123456789");
// 验证码文本字体样式 默认为new Font("Arial", 1, fontSize), new Font("Courier", 1, fontSize)
properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_NAMES, "Arial,Courier");
// 图片样式 水纹com.google.code.kaptcha.impl.WaterRipple 鱼眼com.google.code.kaptcha.impl.FishEyeGimpy 阴影com.google.code.kaptcha.impl.ShadowGimpy
+13 -6
View File
@@ -14,16 +14,23 @@ spring:
nacos:
discovery:
server-addr: 127.0.0.1:8848
# server-addr: 10.102.192.30:6848
# 线上测试环境配置 容器名+端口号
# server-addr: 10.102.192.31:6848
# server-addr: 10.33.0.129:6010
username: nacos
password: manhuoda@2023
#线上正式环境
# server-addr: 127.0.0.1:8848
# server-addr: 10.102.192.31:6848
# username: nacos
# password: manhuoda@2023
config:
server-addr: 127.0.0.1:8848
# 线上测试环境配置 容器名+端口号
# server-addr: 10.33.0.129:6010
# server-addr: 10.102.192.30:6848
username: nacos
password: manhuoda@2023
#线上正式环境
# server-addr: 127.0.0.1:8848
# server-addr: 10.102.192.31:6848
# username: nacos
# password: manhuoda@2023
group: DEFAULT_GROUP # 默认分组就是DEFAULT_GROUP,如果使用默认分组可以不配置
file-extension: yml #默认properties
# 共享配置
@@ -40,14 +40,6 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import com.mhd.basic.interfaces.dto.shipperLeaseDetailsApi.WarehouseLeaseExportVO;
import com.mhd.common.core.utils.poi.ExcelUtil;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.Map;
import java.math.BigDecimal;
import java.time.LocalDate;
@@ -278,15 +270,14 @@ public class LeaseApplicationService {
* 货主租赁明细
* 定时任务每天凌晨1点执行计算前一天的货主租赁明细
*/
// @Scheduled(cron = "0 0 1 * * ?")
@Scheduled(cron = "0 0 1 * * ?")
public void shipperLeaseDetails() {
log.info("开始执行货主租赁明细定时任务");
// 计算前一天的日期将时间设置为当天的0点0分0秒只保留日期部分
final Date yesterday = DateUtil.beginOfDay(DateUtil.offsetDay(new Date(), -1));
LeaseDO leaseDO = new LeaseDO();
leaseDO.setTime(yesterday); // 设置查询时间
leaseDO.setStatus(1); // 只查询启用状态的租赁停用的不参与出租率计算
leaseDO.setTime(yesterday);
//查询有效期内的租赁
List<LeasePO> leasePOS = queryList(leaseDO);
List<LeasePO> entireUnit = leasePOS.stream()
@@ -503,103 +494,6 @@ public class LeaseApplicationService {
return warehouseOccupancyRatesList;
}
/**
* 导出仓库出租率及客户租赁明细 sheet明细行带仓库当日汇总列
* 参数与 /warehouseOccupancyRate/list 一致
*/
public void exportOccupancyRate(HttpServletResponse response, ShipperLeaseDetailsDO shipperLeaseDetailsDO) throws IOException {
// 注意本方法不调用 warehouseOccupancyRate()因为该方法在不传 warehouseId
// totalArea 会算成全系统所有仓库库区面积之和 6168导致导出面积/日租率错误
// 这里自行按 (业务日期 + 仓库) 维度计算保证多仓库导出时每个仓库的面积/日租率正确
// ===== 1. 查全部明细用副本 DO避免影响外部=====
ShipperLeaseDetailsDO detailDO = new ShipperLeaseDetailsDO();
BeanUtils.copyProperties(shipperLeaseDetailsDO, detailDO);
List<ShipperLeaseDetailsPO> detailList = shipperLeaseDetailsService.queryList(detailDO);
if (detailList == null) {
detailList = new ArrayList<>();
}
// ===== 2. 预算每个仓库的总面积启用库区的 storageRegion 累加 warehouseId -> totalArea 映射 =====
Set<Long> warehouseIds = detailList.stream()
.map(ShipperLeaseDetailsPO::getWarehouseId)
.filter(Objects::nonNull)
.collect(Collectors.toSet());
Map<Long, BigDecimal> warehouseTotalAreaMap = new HashMap<>();
for (Long wid : warehouseIds) {
StorageSectionDO storageSectionDO = new StorageSectionDO();
storageSectionDO.setWarehouseId(wid);
storageSectionDO.setOpeningUp(1);
List<StorageSectionPO> sections = storageSectionApplicationService.queryList(storageSectionDO);
BigDecimal area = BigDecimal.ZERO;
for (StorageSectionPO s : sections) {
area = area.add(s.getStorageRegion() == null ? BigDecimal.ZERO : s.getStorageRegion());
}
warehouseTotalAreaMap.put(wid, area);
}
// ===== 3. (业务日期 + 仓库ID) 聚合算每个仓库当天的整租/散租面积 =====
// summaryMap: key -> [整租面积, 散租面积]
SimpleDateFormat keySdf = new SimpleDateFormat("yyyy-MM-dd");
Map<String, BigDecimal[]> summaryMap = new HashMap<>();
for (ShipperLeaseDetailsPO d : detailList) {
String key = (d.getBusinessDate() == null ? "" : keySdf.format(d.getBusinessDate()))
+ "_" + d.getWarehouseId();
BigDecimal[] arr = summaryMap.computeIfAbsent(key, k -> new BigDecimal[]{BigDecimal.ZERO, BigDecimal.ZERO});
BigDecimal leaseArea = d.getLeaseArea() == null ? BigDecimal.ZERO : d.getLeaseArea();
if ("整租".equals(d.getLeaseType())) {
arr[0] = arr[0].add(leaseArea);
} else {
arr[1] = arr[1].add(leaseArea);
}
}
// ===== 4. 明细为主每行拼上对应仓库当天的汇总总面积/日租率按仓库单独算=====
List<WarehouseLeaseExportVO> exportList = new ArrayList<>();
for (ShipperLeaseDetailsPO d : detailList) {
WarehouseLeaseExportVO vo = new WarehouseLeaseExportVO();
// 明细列
vo.setBusinessDate(d.getBusinessDate());
vo.setOrganizationName(d.getOrganizationName());
vo.setWarehouseName(d.getWarehouseName());
vo.setCargoOwnerName(d.getCargoOwnerName());
vo.setLeaseType(d.getLeaseType());
vo.setLeaseArea(d.getLeaseArea());
// 汇总列
String key = (d.getBusinessDate() == null ? "" : keySdf.format(d.getBusinessDate()))
+ "_" + d.getWarehouseId();
BigDecimal[] arr = summaryMap.get(key);
BigDecimal entireLeaseArea = (arr != null) ? arr[0] : BigDecimal.ZERO;
BigDecimal fractionalLeaseArea = (arr != null) ? arr[1] : BigDecimal.ZERO;
vo.setEntireLeaseArea(entireLeaseArea);
vo.setFractionalLeaseArea(fractionalLeaseArea);
// 该仓库的总面积按仓库单独算不再用全局总和
BigDecimal widTotalArea = warehouseTotalAreaMap.getOrDefault(d.getWarehouseId(), BigDecimal.ZERO);
vo.setTotalArea(widTotalArea);
// 日租率 = (整租+散租) / 总面积 × 100保留2位小数直接输出百分比值 10.00
BigDecimal leaseSum = entireLeaseArea.add(fractionalLeaseArea);
BigDecimal dailyRate = widTotalArea.compareTo(BigDecimal.ZERO) == 0
? BigDecimal.ZERO
: leaseSum.multiply(new BigDecimal("100")).divide(widTotalArea, 2, BigDecimal.ROUND_HALF_UP);
vo.setDailyRentalRate(dailyRate);
exportList.add(vo);
}
// ===== 5. 按业务日期降序仓库名升序排序null 排最后=====
exportList.sort(Comparator
.comparing(WarehouseLeaseExportVO::getBusinessDate, Comparator.nullsLast(Comparator.reverseOrder()))
.thenComparing(WarehouseLeaseExportVO::getWarehouseName, Comparator.nullsLast(Comparator.naturalOrder())));
// ===== 6. ExcelUtil 导出项目通用做法 sheet=====
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<WarehouseLeaseExportVO> util = new ExcelUtil<>(WarehouseLeaseExportVO.class);
util.exportExcel(response, exportList, "仓库出租率");
}
/**
* 定时任务整租推送到bms
@@ -643,7 +537,7 @@ public class LeaseApplicationService {
/**
* 定时任务散租推送到bms
*/
// @Scheduled(cron = "0 0 0 * * ?")
@Scheduled(cron = "0 0 0 * * ?")
public void ScatteredRentalSynchronization() {
LeaseDO leaseDO = new LeaseDO();
leaseDO.setTime(new Date());
@@ -687,25 +581,6 @@ public class LeaseApplicationService {
}
}
/**
* 启用/停用租赁
* @param leaseIds 租赁ID列表
* @param status 目标状态1=启用0=停用
*/
public Boolean updateStatus(List<Long> leaseIds, Integer status) {
LoginUser loginUser = SecurityUtils.getLoginUser();
Long updateBy = loginUser != null ? loginUser.getUserid() : null;
String updateByName = loginUser != null ? loginUser.getUsername() : null;
if (leaseIds == null || leaseIds.isEmpty()) {
throw new ServiceException("租赁ID不能为空");
}
if (status == null || (status != 0 && status != 1)) {
throw new ServiceException("状态值无效:1=启用,0=停用");
}
log.info("启用/停用租赁--结束,leaseIds={},状态={},更新人id={},更新人名称={}",leaseIds,status==0?"停用":"启用",updateBy,updateByName);
return leaseDomainService.updateStatus(leaseIds, status, updateBy, updateByName);
}
// /**
// * @description 设置数据字典键值
// * @author ZhouGY
@@ -461,8 +461,7 @@ public class MessageManageApplicationService
//获取当前登录人
LoginUser loginUser = SecurityUtils.getLoginUser();
if(null == loginUser){
//未登录(游客)返回空消息中心结构保证小程序界面正常展示而不报错
return buildEmptyAppNoticeList();
throw new ServiceException("获取登录人失败");
}
noticeMessageLoggingDo.setUserId(loginUser.getUserid());
//获取每种类型的最新一条
@@ -523,27 +522,6 @@ public class MessageManageApplicationService
return result;
}
/**
* 未登录(游客)时返回空的消息中心结构避免前端页面因无登录上下文而报错
* @return NoticeMessageLoggingAppListPo
*/
private NoticeMessageLoggingAppListPo buildEmptyAppNoticeList() {
NoticeMessageLoggingAppListPo result = new NoticeMessageLoggingAppListPo();
NoticeMessageLoggingAppListPo.CommonNotice serviceNotice = new NoticeMessageLoggingAppListPo.CommonNotice();
serviceNotice.setUnreadNum("0");
NoticeMessageLoggingAppListPo.CommonNotice activityNotice = new NoticeMessageLoggingAppListPo.CommonNotice();
activityNotice.setUnreadNum("0");
NoticeMessageLoggingAppListPo.CommonNotice logisticsNotice = new NoticeMessageLoggingAppListPo.CommonNotice();
logisticsNotice.setUnreadNum("0");
NoticeMessageLoggingAppListPo.CommonNotice systemNotice = new NoticeMessageLoggingAppListPo.CommonNotice();
systemNotice.setUnreadNum("0");
result.setServiceNotice(serviceNotice);
result.setActivityNotice(activityNotice);
result.setLogisticsNotice(logisticsNotice);
result.setSystemNotice(systemNotice);
return result;
}
/**
* APP根据类型获取消息通知
* @param noticeMessageLoggingDo
@@ -1124,51 +1124,4 @@ public class ContractManageApplicationService {
public ContractManagePO getGeneralContract() {
return contractManageDomainService.getGeneralContract();
}
/**
* 合同导出合同头字段 + 明细拍平成一行一条明细
*/
public List<ContractManageExportVO> buildExportList(ContractManageDO contractManageDO) {
List<ContractManagePO> contractList = this.queryList(contractManageDO);
List<ContractManageExportVO> exportList = new ArrayList<>();
if (contractList == null || contractList.isEmpty()) {
return exportList;
}
List<Long> contractManageIds = contractList.stream()
.map(ContractManagePO::getContractManageId)
.collect(Collectors.toList());
Map<Long, List<ContractManageDetailPO>> detailMap = contractManageDetailDomainService
.queryListByManageIds(contractManageIds).stream()
.collect(Collectors.groupingBy(ContractManageDetailPO::getContractManageId));
for (ContractManagePO contract : contractList) {
List<ContractManageDetailPO> details = detailMap.get(contract.getContractManageId());
if (details != null && !details.isEmpty()) {
for (ContractManageDetailPO detail : details) {
ContractManageExportVO vo = new ContractManageExportVO();
// 合同头字段整体复制
BeanUtils.copyProperties(contract, vo);
// 明细字段显式赋值合同头/明细存在同名字段避免互相覆盖
vo.setSubjectType(detail.getSubjectType());
vo.setFirstSubjectCode(detail.getFirstSubjectCode());
vo.setFirstSubjectName(detail.getFirstSubjectName());
vo.setSecondSubjectCode(detail.getSecondSubjectCode());
vo.setSecondSubjectName(detail.getSecondSubjectName());
vo.setAccountingStrategy(detail.getAccountingStrategy());
vo.setBillingAttributes(detail.getBillingAttributes());
vo.setSubjectEffectiveDate(detail.getSubjectEffectiveDate());
vo.setSubjectExpirationDate(detail.getSubjectExpirationDate());
vo.setDocumentType(detail.getDocumentType());
vo.setServiceItemsName(detail.getServiceItemsName());
exportList.add(vo);
}
} else {
// 无明细的合同也保留一行头字段
ContractManageExportVO vo = new ContractManageExportVO();
BeanUtils.copyProperties(contract, vo);
exportList.add(vo);
}
}
return exportList;
}
}
@@ -13,7 +13,6 @@ 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;
@@ -28,11 +27,14 @@ 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;
import java.util.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -380,55 +382,6 @@ 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
@@ -627,46 +580,6 @@ public class ExpenseAccountApplicationService {
return expenseAccountDomainService.getInfoByCode2(subjectCode,topOrganizationId);
}
/**
* 根据编码和组织ID查询
*/
public ExpenseAccountPO getInfoByOrgAndCode(String subjectCode, Long organizationId) {
if(!StringUtils.isNotEmpty(subjectCode)){
throw new ServiceException("费用科目编码不能为空");
}
if(organizationId == null){
throw new ServiceException("组织ID不能为空");
}
ExpenseAccountPO expenseAccountPO = expenseAccountDomainService.getInfoByOrgAndCode(subjectCode, organizationId);
// // 组装计费单位列表单位-单位英文
// List<String> unit = new ArrayList<>();
// if (expenseAccountPO != null) {
// unit.add(expenseAccountPO.getBillingUnit() + "-" + expenseAccountPO.getBillingUnitEn());
// unit.add(expenseAccountPO.getBillingUnit2() + "-" + expenseAccountPO.getBillingUnitEn2());
// expenseAccountPO.setUnit(unit);
// }
// 组装计费单位列表(数组)中文和英文都为null时过滤掉避免出现"null-null"
List<Map<String, String>> unit = new ArrayList<>();
if (expenseAccountPO != null) {
addUnitIfPresent(unit, expenseAccountPO.getBillingUnit(), expenseAccountPO.getBillingUnitEn());
addUnitIfPresent(unit, expenseAccountPO.getBillingUnit2(), expenseAccountPO.getBillingUnitEn2());
expenseAccountPO.setUnit(unit);
}
return expenseAccountPO;
}
/**
* 组装计费单位中文和英文都为null时不加入列表
*/
private void addUnitIfPresent(List<Map<String, String>> unit, String billingUnit, String billingUnitEn) {
if (billingUnit == null && billingUnitEn == null) {
return;
}
Map<String, String> unitMap = new HashMap<>();
unitMap.put("unit", billingUnit + "-" + billingUnitEn);
unit.add(unitMap);
}
public List<QueryExpenseAccountPO> selectExpenseAccount(SearchExpenseAccountDO searchExpenseAccountDO){
setDataPermissionForSearch(searchExpenseAccountDO);
return expenseAccountDomainService.selectExpenseAccount(searchExpenseAccountDO);
@@ -157,18 +157,15 @@ public class MaterialBaseInfoApplicationService {
* @param materialBaseInfoDO
*/
private void shipperParam(MaterialBaseInfoDO materialBaseInfoDO){
Long shipperId = materialBaseInfoDO.getShipperId();
if (shipperId != null && shipperId != 0l) {
AjaxResult ajaxResult = userServiceFeign.getInfo(materialBaseInfoDO.getShipperId());
if(!"200".equals(String.valueOf(ajaxResult.get("code")))){
throw new ServiceException("获取货主信息失败");
}
UserPo userPo = JSON.parseObject(JSONObject.toJSONString(ajaxResult.get("data")), UserPo.class);
// 如果原始shipperName不为空保留原始值导入或手动输入时应该保留完整名称
// 只有在原始shipperName为空时才使用查询到的userName
if (materialBaseInfoDO.getShipperName() == null || materialBaseInfoDO.getShipperName().trim().isEmpty()) {
materialBaseInfoDO.setShipperName(userPo.getUserName());
}
AjaxResult ajaxResult = userServiceFeign.getInfo(materialBaseInfoDO.getShipperId());
if(!"200".equals(String.valueOf(ajaxResult.get("code")))){
throw new ServiceException("获取货主信息失败");
}
UserPo userPo = JSON.parseObject(JSONObject.toJSONString(ajaxResult.get("data")), UserPo.class);
// 如果原始shipperName不为空保留原始值导入或手动输入时应该保留完整名称
// 只有在原始shipperName为空时才使用查询到的userName
if (materialBaseInfoDO.getShipperName() == null || materialBaseInfoDO.getShipperName().trim().isEmpty()) {
materialBaseInfoDO.setShipperName(userPo.getUserName());
}
}
@@ -185,4 +182,4 @@ public class MaterialBaseInfoApplicationService {
//return materialBaseInfoDomainService.getMaterialStockList(shipperName,materialName,machineCode,topOrganizationId,pageNum,pageSize);/**/
return null;
}
}
}
@@ -6,7 +6,6 @@ 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;
@@ -208,39 +207,6 @@ 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,7 +21,6 @@ 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
@@ -43,32 +42,11 @@ 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) {
@@ -113,6 +91,7 @@ public class StorageSectionApplicationService {
}
}
}
return storageSectionDomainService.queryList(storageSectionDO);
}
@@ -126,18 +126,6 @@ public class ContractManage extends BaseVOEntity{
@Excel(name = "其他附件地址")
private String otherAttachmentsUrl;
@ApiModelProperty("合同正本附件原始文件名")
private String contractOriginalName;
@ApiModelProperty("廉政协议附件原始文件名")
private String integrityAgreementName;
@ApiModelProperty("安全协议附件原始文件名")
private String securityProtocolName;
@ApiModelProperty("其他附件原始文件名(多文件时与 otherAttachmentsUrl 同分隔符、同顺序)")
private String otherAttachmentsName;
@ApiModelProperty("我司签订人")
@Excel(name = "我司签订人")
private String ourSinged;
@@ -124,18 +124,6 @@ public class ContractManagePO extends BaseVOEntity{
@Excel(name = "其他附件地址")
private String otherAttachmentsUrl;
@ApiModelProperty("合同正本附件原始文件名")
private String contractOriginalName;
@ApiModelProperty("廉政协议附件原始文件名")
private String integrityAgreementName;
@ApiModelProperty("安全协议附件原始文件名")
private String securityProtocolName;
@ApiModelProperty("其他附件原始文件名(多文件时与 otherAttachmentsUrl 同分隔符、同顺序)")
private String otherAttachmentsName;
@ApiModelProperty("我司签订人")
@Excel(name = "我司签订人")
private String ourSinged;
@@ -121,18 +121,6 @@ public class ContractManageDO extends BaseVOEntity{
@Excel(name = "其他附件地址")
private String otherAttachmentsUrl;
@ApiModelProperty("合同正本附件原始文件名")
private String contractOriginalName;
@ApiModelProperty("廉政协议附件原始文件名")
private String integrityAgreementName;
@ApiModelProperty("安全协议附件原始文件名")
private String securityProtocolName;
@ApiModelProperty("其他附件原始文件名(多文件时与 otherAttachmentsUrl 同分隔符、同顺序)")
private String otherAttachmentsName;
@ApiModelProperty("我司签订人")
@Excel(name = "我司签订人")
private String ourSinged;
@@ -98,10 +98,4 @@ public class ContractManageDetail extends BaseVOEntity{
@ApiModelProperty("单据类型")
private String documentType;
@ApiModelProperty("费用类别编码")
private String serviceItemsCode;
@ApiModelProperty("费用类别名称")
private String serviceItemsName;
}
@@ -97,10 +97,4 @@ public class ContractManageDetailPO extends BaseVOEntity{
@ApiModelProperty("单据类型")
private String documentType;
@ApiModelProperty("费用类别编码")
private String serviceItemsCode;
@ApiModelProperty("费用类别名称")
private String serviceItemsName;
}
@@ -102,10 +102,4 @@ public class ContractManageDetailDO extends BaseVOEntity{
@ApiModelProperty("单据类型")
private String documentType;
@ApiModelProperty("费用类别编码")
private String serviceItemsCode;
@ApiModelProperty("费用类别名称")
private String serviceItemsName;
}
@@ -11,7 +11,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
/**
* 合同管理详情
@@ -96,29 +95,5 @@ public class ContractManageDetailDomainService {
return resultList;
}
/**
* 根据多个合同管理id批量查询合同科目详情一次SQL查询避免逐合同N+1
* @param contractManageIds 合同管理id集合
* @return 合同科目详情列表
*/
public List<ContractManageDetailPO> queryListByManageIds(Collection<Long> contractManageIds) {
List<ContractManageDetailPO> resultList = new ArrayList<>();
if (contractManageIds == null || contractManageIds.isEmpty()) {
return resultList;
}
LambdaQueryWrapper<ContractManageDetail> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(ContractManageDetail::getContractManageId, contractManageIds);
queryWrapper.eq(ContractManageDetail::getDelFlag, 1);
List<ContractManageDetail> contractManageDetails = contractManageDetailService.list(queryWrapper);
if (contractManageDetails != null && contractManageDetails.size() > 0) {
for (ContractManageDetail contractManageDetail : contractManageDetails) {
ContractManageDetailPO contractManageDetailPO = new ContractManageDetailPO();
BeanUtils.copyProperties(contractManageDetail, contractManageDetailPO);
resultList.add(contractManageDetailPO);
}
}
return resultList;
}
}
@@ -58,11 +58,6 @@ public interface IExpenseAccountService extends IService<ExpenseAccount>
*/
ExpenseAccountPO getInfoByCode(ExpenseAccountDO expenseAccountDO);
/**
* 根据费用科目code和组织ID查询费用信息
*/
ExpenseAccountPO getInfoByOrgAndCode(ExpenseAccountDO expenseAccountDO);
public List<QueryExpenseAccountPO> selectExpenseAccount(SearchExpenseAccountDO searchExpenseAccountDO);
public List<QueryExpenseAccountPO> selectOtherExpenseAccount(SearchExpenseAccountDO searchExpenseAccountDO);
@@ -39,11 +39,6 @@ public interface ExpenseAccountMapper extends BaseMapper<ExpenseAccount>
*/
ExpenseAccountPO getInfoByCode(@Param("expenseAccountDO") ExpenseAccountDO expenseAccountDO);
/**
* 根据费用科目code和组织ID查询费用信息
*/
ExpenseAccountPO getInfoByOrgAndCode(@Param("expenseAccountDO") ExpenseAccountDO expenseAccountDO);
public List<QueryExpenseAccountPO> selectExpenseAccount(@Param("searchExpenseAccountDO") SearchExpenseAccountDO searchExpenseAccountDO);
public List<QueryExpenseAccountPO> selectOtherExpenseAccount(@Param("searchExpenseAccountDO") SearchExpenseAccountDO searchExpenseAccountDO);
@@ -129,11 +129,6 @@ public class ExpenseAccountImpl extends ServiceImpl<ExpenseAccountMapper, Expens
return expenseAccountMapper.getInfoByCode(expenseAccountDO);
}
@Override
public ExpenseAccountPO getInfoByOrgAndCode(ExpenseAccountDO expenseAccountDO) {
return expenseAccountMapper.getInfoByOrgAndCode(expenseAccountDO);
}
/**
* 系统科目查询
* 社会车辆service_items_code='SHCL'upper_subject_code='shcl_clyf'society_status=1
@@ -9,7 +9,6 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import com.mhd.common.core.web.domain.BaseVOEntity;
@@ -160,8 +159,4 @@ public class ExpenseAccountPO extends BaseVOEntity{
@ApiModelProperty("nc科目编码")
private String ncSubjectCode;
@ApiModelProperty("计费单位列表(单位-单位英文)")
private List<Map<String, String>> unit;
}
@@ -101,16 +101,6 @@ public class ExpenseAccountDomainService {
expenseAccountDO.setTopOrganizationId(topOrganizationId);
return expenseAccountService.getInfoByCode(expenseAccountDO);
}
/**
* 根据编码和组织ID查询费用科目信息
*/
public ExpenseAccountPO getInfoByOrgAndCode(String subjectCode, Long organizationId) {
ExpenseAccountDO expenseAccountDO = new ExpenseAccountDO();
expenseAccountDO.setSubjectCode(subjectCode);
expenseAccountDO.setOrganizationId(organizationId);
return expenseAccountService.getInfoByOrgAndCode(expenseAccountDO);
}
public List<QueryExpenseAccountPO> selectExpenseAccount(SearchExpenseAccountDO searchExpenseAccountDO){
return expenseAccountService.selectExpenseAccount(searchExpenseAccountDO);
}
@@ -96,7 +96,4 @@ public class Lease extends BaseVOEntity{
@ApiModelProperty("业务员ID")
private String salesmanId;
@ApiModelProperty("状态:1=正常,0=停用")
private Integer status;
}
@@ -97,7 +97,4 @@ public class LeasePO extends BaseVOEntity{
@ApiModelProperty("业务员ID")
private String salesmanId;
@ApiModelProperty("状态:1=正常,0=停用")
private Integer status;
}
@@ -113,7 +113,4 @@ public class LeaseDO extends BaseVOEntity{
@ApiModelProperty("业务员ID")
private String salesmanId;
@ApiModelProperty("状态:1=正常,0=停用")
private Integer status;
}
@@ -89,22 +89,4 @@ public class LeaseDomainService {
.in(Lease::getId, leaseIds)
.eq(Lease::getDelFlag, 1));
}
/**
* 启用/停用租赁
* @param leaseIds 租赁ID列表
* @param status 目标状态1=启用0=停用
* @param updateBy 操作人ID
* @param updateByName 操作人名称
*/
public Boolean updateStatus(List<Long> leaseIds, Integer status, Long updateBy, String updateByName) {
return leaseService.update(new UpdateWrapper<Lease>().lambda()
.set(Lease::getStatus, status)
.set(Lease::getUpdateBy, updateBy)
.set(Lease::getUpdateByName, updateByName)
.set(Lease::getUpdateTime, new Date())
.in(Lease::getId, leaseIds)
.eq(Lease::getDelFlag, 1));
}
}
@@ -1,6 +1,5 @@
package com.mhd.basic.domain.materialBaseInfo.entity;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
@@ -45,17 +44,14 @@ public class MaterialBaseInfo extends BaseVOEntity{
@ApiModelProperty("货主id")
@Excel(name = "货主id")
@TableField(updateStrategy = FieldStrategy.IGNORED)
private Long shipperId;
@ApiModelProperty("货主名称")
@Excel(name = "货主名称")
@TableField(updateStrategy = FieldStrategy.IGNORED)
private String shipperName;
@ApiModelProperty("物料编码")
@Excel(name = "物料编码")
@TableField(updateStrategy = FieldStrategy.IGNORED)
private String materialCode;
@ApiModelProperty("物料名称")
@@ -408,9 +404,4 @@ public class MaterialBaseInfo extends BaseVOEntity{
@ApiModelProperty(name = "收费标准")
private BigDecimal chargeStandard;
@ApiModelProperty(name = "组织(多个用,分开)")
private String orgId;
@ApiModelProperty(name = "是否正常物料: 0-是 1-否")
private Integer isNormalMaterial;
}
@@ -393,10 +393,4 @@ public class MaterialBaseInfoPO extends BaseVOEntity{
@ApiModelProperty(name = "收费标准")
private BigDecimal chargeStandard;
@ApiModelProperty(name = "组织(多个用,分开)")
private String orgId;
@ApiModelProperty(name = "是否正常物料: 0-是 1-否")
private Integer isNormalMaterial;
}
@@ -399,10 +399,4 @@ public class MaterialBaseInfoDO extends BaseVOEntity{
@ApiModelProperty(name = "收费标准")
private BigDecimal chargeStandard;
@ApiModelProperty(name = "组织(多个用,分开)")
private String orgId;
@ApiModelProperty(name = "是否正常物料: 0-是 1-否")
private Integer isNormalMaterial;
}
@@ -5,7 +5,6 @@ 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;
/**
@@ -21,11 +20,6 @@ public interface IStorageSectionService extends IService<StorageSection>
*/
public List<StorageSectionPO> queryList(StorageSectionDO storageSectionDO);
/**
* 库区面积合计 queryList 相同筛选条件
*/
public BigDecimal sumStorageRegion(StorageSectionDO storageSectionDO);
/**
* 新增库区
*/
@@ -1,6 +1,5 @@
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;
@@ -20,9 +19,4 @@ public interface StorageSectionMapper extends BaseMapper<StorageSection>
*/
public List<StorageSectionPO> queryList(StorageSectionDO storageSectionDO);
/**
* 库区面积合计 queryList 相同筛选条件
*/
public BigDecimal sumStorageRegion(StorageSectionDO storageSectionDO);
}
@@ -10,7 +10,6 @@ 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;
@@ -34,15 +33,6 @@ public class StorageSectionImpl extends ServiceImpl<StorageSectionMapper, Storag
return storageSectionMapper.queryList(storageSectionDO);
}
/**
* 库区面积合计 queryList 相同筛选条件
*/
@Override
public BigDecimal sumStorageRegion(StorageSectionDO storageSectionDO)
{
return storageSectionMapper.sumStorageRegion(storageSectionDO);
}
/**
* 新增库区
*/
@@ -21,7 +21,6 @@ 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;
@@ -54,13 +53,6 @@ public class StorageSectionDomainService {
return storageSectionService.queryList(storageSectionDO);
}
/**
* 库区面积合计 queryList 相同筛选条件
*/
public BigDecimal sumStorageRegion(StorageSectionDO storageSectionDO) {
return storageSectionService.sumStorageRegion(storageSectionDO);
}
/**
* 新增库区
@@ -99,15 +91,31 @@ public class StorageSectionDomainService {
public Boolean update(StorageSectionDO storageSectionDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId == null || topOrganizationId == 0) {
throw new ServiceException("获取当前登陆人组织失败!");
AssociationWarehouseCacheDO associationWarehouseCacheDO = SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
if (topOrganizationId == null || topOrganizationId == 0 || associationWarehouseCacheDO == null) {
throw new ServiceException("获取当前登陆人组织与登陆仓库失败!");
}
// 直接用记录自身的 warehouseId 做唯一校验不再依赖缓存仓库
checkStorageSectionDuplicate(topOrganizationId, storageSectionDO.getWarehouseId(),
checkStorageSectionDuplicate(topOrganizationId, associationWarehouseCacheDO.getWarehouseId(),
storageSectionDO.getStorageCode(), storageSectionDO.getStorageName(),
storageSectionDO.getStorageSectionId());
//设置仓库
setWarehouseInfo(storageSectionDO);
String storageCode = storageSectionDO.getStorageCode();
String storageName = storageSectionDO.getStorageName();
Long warehouseId = storageSectionDO.getWarehouseId();
List<StorageSection> codelist = storageSectionService.list(new QueryWrapper<StorageSection>().lambda()
.eq(StorageSection::getStorageCode, storageCode)
.eq(StorageSection::getWarehouseId, warehouseId)
.ne(StorageSection::getStorageSectionId, storageSectionDO.getStorageSectionId())
.eq(StorageSection::getDelFlag, 1));
List<StorageSection> namelist = storageSectionService.list(new QueryWrapper<StorageSection>().lambda()
.eq(StorageSection::getStorageName, storageName)
.eq(StorageSection::getWarehouseId, warehouseId)
.ne(StorageSection::getStorageSectionId, storageSectionDO.getStorageSectionId())
.eq(StorageSection::getDelFlag, 1));
if ((codelist != null && codelist.size() > 0) || (namelist != null && namelist.size() > 0)) {
throw new ServiceException("库区编码或名称已存在");
}
return storageSectionService.update(storageSectionDO);
}
@@ -130,20 +130,4 @@ public class Warehouse extends BaseVOEntity{
@Excel(name = "作业模式")
private String workMode;
@ApiModelProperty("订单号生成规则0日期累加1历史累加")
@Excel(name = "单号生成规则")
private String orderNoGenerateRule;
@ApiModelProperty("入库单号首字母前缀")
@Excel(name = "入库单号首字母前缀")
private String inOrderNoPrefix;
@ApiModelProperty("出库单号首字母前缀")
@Excel(name = "出库单号首字母前缀")
private String outOrderNoPrefix;
@ApiModelProperty("样品出库单号首字母前缀")
@Excel(name = "样品出库单号首字母前缀")
private String sampleOutOrderNoPrefix;
}
@@ -131,21 +131,4 @@ public class WarehousePO extends BaseVOEntity{
@ApiModelProperty("作业模式")
@Excel(name = "作业模式")
private String workMode;
@ApiModelProperty("订单号生成规则")
@Excel(name = "单号生成规则")
private String orderNoGenerateRule;
@ApiModelProperty("入库单号首字母前缀")
@Excel(name = "入库单号首字母前缀")
private String inOrderNoPrefix;
@ApiModelProperty("出库单号首字母前缀")
@Excel(name = "出库单号首字母前缀")
private String outOrderNoPrefix;
@ApiModelProperty("样品出库单号首字母前缀")
@Excel(name = "样品出库单号首字母前缀")
private String sampleOutOrderNoPrefix;
}
@@ -139,21 +139,4 @@ public class WarehouseDO extends BaseVOEntity{
@ApiModelProperty("作业模式")
@Excel(name = "作业模式")
private String workMode;
@ApiModelProperty("订单号生成规则")
@Excel(name = "单号生成规则")
private String orderNoGenerateRule;
@ApiModelProperty("入库单号首字母前缀")
@Excel(name = "入库单号首字母前缀")
private String inOrderNoPrefix;
@ApiModelProperty("出库单号首字母前缀")
@Excel(name = "出库单号首字母前缀")
private String outOrderNoPrefix;
@ApiModelProperty("样品出库单号首字母前缀")
@Excel(name = "样品出库单号首字母前缀")
private String sampleOutOrderNoPrefix;
}
@@ -168,11 +168,9 @@ public class WarehouseDomainService {
warehouseLinkagePO.setName(warehousePO.getWarehouseName());
StorageSectionDO storageSectionDO = new StorageSectionDO();
storageSectionDO.setWarehouseId(warehousePO.getWarehouseId());
storageSectionDO.setNullify(1);
List<StorageSectionPO> storageSectionPOList = storageSectionService.queryList(storageSectionDO);
StorageLocationDO storageLocationDO = new StorageLocationDO();
storageLocationDO.setWarehouseId(warehousePO.getWarehouseId());
storageLocationDO.setNullify(1);
List<StorageLocationPO> storageLocationPOList = storageLocationService.queryList(storageLocationDO);
//根据库区唯一标识进行分组
Map<String, List<StorageLocationPO>> storageLocationListMap = storageLocationPOList.stream().collect(Collectors.groupingBy(StorageLocationPO::getStorageCode));
@@ -121,18 +121,6 @@ public class ContractManageDTO extends BaseVOEntity{
@Excel(name = "其他附件地址")
private String otherAttachmentsUrl;
@ApiModelProperty("合同正本附件原始文件名")
private String contractOriginalName;
@ApiModelProperty("廉政协议附件原始文件名")
private String integrityAgreementName;
@ApiModelProperty("安全协议附件原始文件名")
private String securityProtocolName;
@ApiModelProperty("其他附件原始文件名(多文件时与 otherAttachmentsUrl 同分隔符、同顺序)")
private String otherAttachmentsName;
@ApiModelProperty("我司签订人")
@Excel(name = "我司签订人")
private String ourSinged;
@@ -1,102 +0,0 @@
package com.mhd.basic.interfaces.dto.contractManage;
import com.mhd.common.core.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* 合同管理导出对象合同头字段 + 科目明细字段拍平为一行一条明细
*
* @author gen
* @date 2024-06-07
*/
@Data
@ApiModel(value = "合同管理导出对象", description = "合同管理导出对象(含明细)")
public class ContractManageExportVO {
/** ====== 合同头字段(与 ContractManagePO 的 @Excel 一致) ====== */
@Excel(name = "合同编号")
private String contractNumber;
@Excel(name = "合同名称")
private String contractName;
@Excel(name = "是否通用合同", readConverterExp = "1=是,2=否")
private Integer commonContractFlag;
@Excel(name = "合同类型", readConverterExp = "1=仓储,2=运输,3=其他")
private Integer contractType;
@Excel(name = "合同状态", readConverterExp = "1=未生效,2=使用中,3=已过期,4=已作废")
private Integer contractState;
@Excel(name = "签订单位")
private String signingUnit;
@Excel(name = "结算主体")
private String settlementCustomers;
@Excel(name = "我司身份", readConverterExp = "1=甲方,2=乙方")
private Integer ourIdentity;
@Excel(name = "账期", readConverterExp = "1=每月,2=双月,3=季度")
private Integer accountingPeriod;
@Excel(name = "合同签订日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date signingDate;
@Excel(name = "合同生效日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date effectiveDate;
@Excel(name = "合同到期日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date expirationDate;
@Excel(name = "组织名称")
private String organizationName;
@Excel(name = "客户类型")
private String customerType;
@Excel(name = "是否自动出账", readConverterExp = "1=是,2=否")
private Integer automaticFlag;
@Excel(name = "备注")
private String remark;
/** ====== 明细字段(来源于 contract_manage_detail ====== */
@Excel(name = "结算科目类型", readConverterExp = "1=通用,2=临时")
private Integer subjectType;
@Excel(name = "一级费用科目code")
private String firstSubjectCode;
@Excel(name = "一级费用科目")
private String firstSubjectName;
@Excel(name = "二级费用科目code")
private String secondSubjectCode;
@Excel(name = "二级费用科目")
private String secondSubjectName;
@Excel(name = "计费策略")
private String accountingStrategy;
@Excel(name = "计费周期")
private String billingAttributes;
@Excel(name = "科目生效日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date subjectEffectiveDate;
@Excel(name = "科目到期日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date subjectExpirationDate;
@Excel(name = "单据类型")
private String documentType;
@Excel(name = "费用类别")
private String serviceItemsName;
}
@@ -102,10 +102,4 @@ public class ContractManageDetailDTO extends BaseVOEntity{
@ApiModelProperty("单据类型")
private String documentType;
@ApiModelProperty("费用类别编码")
private String serviceItemsCode;
@ApiModelProperty("费用类别名称")
private String serviceItemsName;
}
@@ -1,69 +0,0 @@
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;
}
@@ -110,7 +110,4 @@ public class LeaseDTO extends BaseVOEntity{
@ApiModelProperty("业务员ID")
private String salesmanId;
@ApiModelProperty("状态:1=正常,0=停用")
private Integer status;
}
@@ -379,10 +379,4 @@ public class MaterialBaseInfoDTO extends BaseVOEntity{
@ApiModelProperty(name = "收费标准")
private BigDecimal chargeStandard;
@ApiModelProperty(name = "组织(多个用,分开)")
private String orgId;
@ApiModelProperty(name = "是否正常物料: 0-是 1-否")
private Integer isNormalMaterial;
}
@@ -1,65 +0,0 @@
package com.mhd.basic.interfaces.dto.shipperLeaseDetailsApi;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mhd.common.core.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.util.Date;
/**
* 仓库出租率及客户租赁明细 导出VO sheet
* 明细为主行附该仓库当日汇总列
*/
@Data
public class WarehouseLeaseExportVO {
private static final long serialVersionUID = 1L;
@ApiModelProperty("仓库")
@Excel(name = "仓库")
private String warehouseName;
@ApiModelProperty("业务日期")
@Excel(name = "业务日期", width = 20, dateFormat = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date businessDate;
@ApiModelProperty("整租面积(m²)")
@Excel(name = "整租面积(m²)")
private BigDecimal entireLeaseArea;
@ApiModelProperty("散租面积(m²)")
@Excel(name = "散租面积(m²)")
private BigDecimal fractionalLeaseArea;
@ApiModelProperty("总面积(m²)")
@Excel(name = "总面积(m²)")
private BigDecimal totalArea;
@ApiModelProperty("日租率(%)")
@Excel(name = "日租率(%)")
private BigDecimal dailyRentalRate;
@ApiModelProperty("组织名称")
@Excel(name = "组织名称")
private String organizationName;
@ApiModelProperty("货主名称")
@Excel(name = "货主名称")
private String cargoOwnerName;
@ApiModelProperty("租赁方式")
@Excel(name = "租赁方式")
private String leaseType;
@ApiModelProperty("租赁面积(m²)")
@Excel(name = "租赁面积(m²)")
private BigDecimal leaseArea;
// ===== 以下为仓库当日汇总列同一仓库同一天的多行会重复属正常=====
}
@@ -144,21 +144,4 @@ public class WarehouseDTO extends BaseVOEntity{
@ApiModelProperty("作业模式")
@Excel(name = "作业模式")
private String workMode;
@ApiModelProperty("订单号生成规则")
@Excel(name = "单号生成规则")
private String orderNoGenerateRule;
@ApiModelProperty("入库单号首字母前缀")
@Excel(name = "入库单号首字母前缀")
private String inOrderNoPrefix;
@ApiModelProperty("出库单号首字母前缀")
@Excel(name = "出库单号首字母前缀")
private String outOrderNoPrefix;
@ApiModelProperty("样品出库单号首字母前缀")
@Excel(name = "样品出库单号首字母前缀")
private String sampleOutOrderNoPrefix;
}
@@ -1,11 +1,8 @@
package com.mhd.basic.interfaces.facade.contractManage;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.List;
import com.mhd.basic.interfaces.assember.contractManage.ContractManageAssembler;
import com.mhd.basic.interfaces.dto.contractManage.ContractManageExportVO;
import com.mhd.basic.interfaces.dto.contractManage.SubjectAndPriceDTO;
import com.mhd.basic.interfaces.dto.contractManage.SubjectAndPriceReturn;
import io.swagger.annotations.ApiOperation;
@@ -17,11 +14,9 @@ import com.mhd.basic.domain.contractManage.repository.todo.ContractManageDO;
import com.mhd.basic.domain.contractManage.repository.po.ContractManagePO;
import com.mhd.basic.application.service.contractManage.ContractManageApplicationService;
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;
import com.mhd.common.core.utils.poi.ExcelUtil;
/**
* 合同管理Api
@@ -210,24 +205,7 @@ public class ContractManageApi extends BaseController{
return AjaxResult.success(list);
}
@ApiOperation("导出合同(含明细)")
@GetMapping(value = "/export", produces = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
public void export(ContractManageDTO contractManageDTO, HttpServletResponse response) throws IOException
{
//转换实体
ContractManageDO contractManageDO = new ContractManageDO();
BeanUtils.copyProperties(contractManageDTO, contractManageDO);
//查询全量不分页并拍平明细
List<ContractManageExportVO> list = contractManageApplicationService.buildExportList(contractManageDO);
//设置下载头防止浏览器乱码
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<ContractManageExportVO> util = new ExcelUtil<>(ContractManageExportVO.class);
util.exportExcel(response, list, "合同导出");
}
}
@@ -1,7 +1,5 @@
package com.mhd.basic.interfaces.facade.expenseAccount;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
@@ -15,11 +13,9 @@ 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;
@@ -30,7 +26,6 @@ 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;
@@ -333,53 +328,5 @@ public class ExpenseAccountApi extends BaseController{
return AjaxResult.success(expenseAccountPO);
}
@ApiOperation("根据code和组织ID获取数据")
@GetMapping(value = "/getInfoByOrgAndCode")
public AjaxResult getInfoByOrgAndCode(@RequestParam("subjectCode") String subjectCode,@RequestParam("organizationId") Long organizationId)
{
ExpenseAccountPO expenseAccountPO = expenseAccountApplicationService.getInfoByOrgAndCode(subjectCode, organizationId);
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, "费用科目");
}
}
@@ -130,18 +130,4 @@ public class LeaseApi extends BaseController{
return AjaxResult.success();
}
/**
* 启用/停用租赁
* @param leaseIds 租赁ID集合
* @param status 目标状态启用/停用
* @return 操作结果
*/
@ApiOperation("启用/停用租赁")
@PutMapping("/updateStatus/{leaseIds}/{status}")
public AjaxResult updateStatus(@PathVariable("leaseIds") List<Long> leaseIds,
@PathVariable("status") Integer status)
{
return toAjax(leaseApplicationService.updateStatus(leaseIds, status));
}
}
@@ -20,8 +20,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
@@ -159,17 +157,5 @@ public class ShipperLeaseDetailsApi extends BaseController{
return getDataTable(warehouseOccupancyRates);
}
/**
* 导出仓库出租率及客户租赁明细
* 参数与 /warehouseOccupancyRate/list 一致
*/
@ApiOperation("导出仓库出租率及客户租赁明细")
@GetMapping(value = "/export", produces = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
public void export(ShipperLeaseDetailsDTO shipperLeaseDetailsDTO, HttpServletResponse response) throws IOException
{
ShipperLeaseDetailsDO shipperLeaseDetailsDO = shipperLeaseDetailsAssembler.toDO(shipperLeaseDetailsDTO);
leaseApplicationService.exportOccupancyRate(response, shipperLeaseDetailsDO);
}
}
@@ -19,7 +19,6 @@ 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;
@@ -128,24 +127,6 @@ 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)

Some files were not shown because too many files have changed in this diff Show More