204 changed files with 1242 additions and 9938 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.33.0.109:8019",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.33.0.99: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);
}
@@ -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();
@@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.33.0.129:8014",configuration = FeignAutoConfiguration.class)
@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.30:8014",configuration = FeignAutoConfiguration.class)
public interface WlhyServiceFeign {
/**
@@ -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.33.0.109: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,14 +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);
}
@@ -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,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.33.0.99:8018", 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,24 +376,4 @@ public class InMaterialDetail extends BaseVOEntity {
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
private Date drinkDate;
@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;
}
@@ -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;
}
@@ -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;
}
@@ -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;
}
};
}
}
@@ -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,12 +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());
}
};
}
}
@@ -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);
+3 -3
View File
@@ -15,7 +15,7 @@ spring:
# 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
#线上正式环境
@@ -24,7 +24,7 @@ spring:
# password: manhuoda@2023
config:
# server-addr: 127.0.0.1:8848
server-addr: 10.102.192.31:6848
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,34 +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 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();
}
@@ -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,184 +0,0 @@
package com.mhd.bi.domain.biPlatformRealData.service;
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.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 org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
/**
* 月台监测-真实数据业务层封装 YMS 跨库查询
* 列名大小写字段类型需以实际库为准 YMS 库无数据/无权限相关方法应返回空/0不影响写死字段写入快照
*/
@Service
public class BiPlatformRealDataService {
@Resource
private BiPlatformRealDataMapper biPlatformRealDataMapper;
public List<RealPlatformVehiclePO> queryVehicles() {
try {
return biPlatformRealDataMapper.queryVehicles();
} catch (Exception 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) {
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) {
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) {
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) {
return 0L;
}
}
public List<RealTaskLoadPO> queryTaskLoadToday() {
try {
return biPlatformRealDataMapper.queryTaskLoadToday();
} catch (Exception e) {
return java.util.Collections.emptyList();
}
}
/**
* 实时组装月台监测数据真实字段查 YMS 写死字段保留静态值
* 每次调用实时查库不经过快照表
*/
public PlatformSurveillanceVO buildRealTimePlatformSurveillance() {
Random r = new Random();
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(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 = 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();
int rate = total > 0 ? (int) Math.round(((double) occ / total) * 100.0) : 0;
template.getPlatformOverview().setCurrentOccupancyRate(rate);
}
long todayTasks = countTodayTasks();
if (template.getPlatformOverview() != null) {
template.getPlatformOverview().setTodayTasks((int) todayTasks);
}
// 作业车辆状态统计
RealVehicleStatusPO vs = 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 = countMonthTasks();
if (template.getMonthlyTaskStatistics() != null) {
template.getMonthlyTaskStatistics().setTaskTotal((int) monthTasks);
}
// 任务负荷今日 24 小时
List<RealTaskLoadPO> loads = queryTaskLoadToday();
if (!loads.isEmpty() && 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) {
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;
try {
String s = label.replace("", "").trim();
return Integer.parseInt(s);
} catch (Exception e) {
return null;
}
}
}
@@ -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,87 +137,9 @@ public class BiReportSnapshotSyncService {
return BiSnapshotWeeklyRandomDataBuilder.warehouseTransport(new Random());
}
/** TODO 业务落地:部分字段改为真实数据,其余仍写死。 */
/** TODO 业务落地:改为查询真实数据。临时实现见 {@link BiSnapshotWeeklyRandomDataBuilder#platformSurveillance(Random)}。 */
protected PlatformSurveillanceVO buildPlatformSurveillanceSnapshot() {
Random r = new Random();
// 写死数据复用原 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();
int rate = total > 0 ? (int) Math.round(((double) occ / total) * 100.0) : 0;
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])
@@ -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,7 +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.biOverallOperation.service.BiOverallOperationReportService;
import com.mhd.bi.domain.biHkMacaoServiceZone.service.BiHkMacaoServiceZoneReportService;
import com.mhd.bi.domain.biTransportOperationZone.service.BiTransportOperationZoneReportService;
@@ -49,9 +48,6 @@ public class BiReportApi extends BaseController {
@Autowired
private BiPlatformSurveillanceReportService biPlatformSurveillanceReportService;
@Autowired
private BiPlatformRealDataService biPlatformRealDataService;
@Autowired
private BiOverallOperationReportService biOverallOperationReportService;
@@ -96,12 +92,12 @@ public class BiReportApi extends BaseController {
}
/**
* 月台监测指标查询实时查 YMS 真实字段 + 写死字段
* 月台监测指标查询按照 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.buildRealTimePlatformSurveillance();
PlatformSurveillanceVO data = biPlatformSurveillanceReportService.loadLatestPlatformSurveillance();
return BiApiResult.ok(data);
}
//园区物流大屏接口----------------------------------------------------------------------
@@ -14,12 +14,6 @@ import lombok.NoArgsConstructor;
@ApiModel("月台监测-作业车辆")
public class PlatformVehicleItemVO {
@ApiModelProperty("预约申请时间")
private String appointmentTime;
@ApiModelProperty("作业楼层")
private String workFloor;
@ApiModelProperty("车牌号码")
private String plateNumber;
+4 -4
View File
@@ -16,12 +16,12 @@ spring:
# 线上测试环境配置 容器名+端口号
# server-addr: 10.33.0.129:6010
# server-addr: 10.102.192.5:6848
username: nacos
password: manhuoda@2023
#线上正式环境
server-addr: 10.102.192.31:6848
# username: nacos
# password: manhuoda@2023
#线上正式环境
server-addr: 10.102.192.31:6848
username: nacos
password: manhuoda@2023
config:
# server-addr: 127.0.0.1:8848
# 线上测试环境配置 容器名+端口号
@@ -1,85 +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):
plateNumber <- qms_main_business.CARNO
status <- qms_main_business.FLOWSTATUS
platformId <- qms_queue_list.WINDOWNAME businessNo = windowNo
platformDuration <- qms_main_business.EXITTIME - ENTRYTIME
appointmentTime <- qms_main_business.CREATE_TIME
workFloor <- qms_window_info.PLATFORMFLOOR platformId
注:列名按达梦默认大写规则;若实际为小写,请反馈调整 -->
<select id="queryVehicles" resultType="com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformVehiclePO">
SELECT
mb.CARNO AS plateNumber,
mb.FLOWSTATUS AS status,
ql.WINDOWNAME AS platformId,
CASE
WHEN mb.EXITTIME IS NOT NULL AND mb.ENTRYTIME IS NOT NULL
THEN CAST((mb.EXITTIME - mb.ENTRYTIME) AS BIGINT)
ELSE 0
END AS platformDuration,
TO_CHAR(mb.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') AS appointmentTime,
wi.PLATFORMFLOOR AS workFloor
FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS mb
LEFT JOIN NGWL_TEST_YMS.QMS_QUEUE_LIST ql ON ql.MAIN_BUSINESS_ID = mb.ID
LEFT JOIN NGWL_TEST_YMS.QMS_WINDOW_INFO wi ON wi.WINDOW_NO = ql.WINDOWNAME
WHERE 1=1
AND mb.DEL_FLAG = 1
ORDER BY mb.CREATE_TIME DESC
LIMIT 50
</select>
<!-- 月台概览:totalPlatforms(总条数)、operatingPlatforms(作业状态=占用/作业中) -->
<select id="queryPlatformOverview" resultType="com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformOverviewPO">
SELECT
COUNT(1) AS totalPlatforms,
SUM(CASE WHEN STATUS = 2 THEN 1 ELSE 0 END) AS operatingPlatforms
FROM NGWL_TEST_YMS.QMS_WINDOW_INFO
WHERE DEL_FLAG = 1
</select>
<!-- 今日作业任务:实际进入时间是今日的 -->
<select id="countTodayTasks" resultType="java.lang.Long">
SELECT COUNT(1)
FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS
WHERE DEL_FLAG = 1
AND TRUNC(ENTRYTIME) = TRUNC(SYSDATE)
</select>
<!-- 车辆状态统计:今日的统计(按预约申请时间 / 流程状态) -->
<select id="queryVehicleStatusToday" resultType="com.mhd.bi.domain.biPlatformRealData.repository.po.RealVehicleStatusPO">
SELECT
SUM(CASE WHEN TRUNC(CREATE_TIME) = TRUNC(SYSDATE) THEN 1 ELSE 0 END) AS todayReservedVehicles,
SUM(CASE WHEN FLOWSTATUS = '已预约' AND TRUNC(CREATE_TIME) = TRUNC(SYSDATE) THEN 1 ELSE 0 END) AS notCheckedIn,
SUM(CASE WHEN FLOWSTATUS IN ('已进场','已称重','已装车','二次称重','已结算','已还卡') AND TRUNC(CREATE_TIME) = TRUNC(SYSDATE) THEN 1 ELSE 0 END) AS operatingVehicles,
SUM(CASE WHEN FLOWSTATUS = '已出场' AND TRUNC(CREATE_TIME) = TRUNC(SYSDATE) THEN 1 ELSE 0 END) AS completedVehicles
FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS
WHERE DEL_FLAG = 1
</select>
<!-- 本月任务量:实际进入时间是本月的 -->
<select id="countMonthTasks" resultType="java.lang.Long">
SELECT COUNT(1)
FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS
WHERE DEL_FLAG = 1
AND ENTRYTIME IS NOT NULL
AND TO_CHAR(ENTRYTIME, 'YYYY-MM') = TO_CHAR(SYSDATE, 'YYYY-MM')
</select>
<!-- 任务负荷(今日 24 小时时段):按 HOUR(ENTRYTIME) 统计 -->
<select id="queryTaskLoadToday" resultType="com.mhd.bi.domain.biPlatformRealData.repository.po.RealTaskLoadPO">
SELECT
HOUR(ENTRYTIME) AS hourOfDay,
COUNT(1) AS taskCount
FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS
WHERE DEL_FLAG = 1
AND ENTRYTIME IS NOT NULL
AND TRUNC(ENTRYTIME) = TRUNC(SYSDATE)
GROUP BY HOUR(ENTRYTIME)
ORDER BY HOUR(ENTRYTIME)
</select>
</mapper>
@@ -33,6 +33,4 @@ public class WarehousePO implements Serializable {
@Excel(name = "仓库名称")
private String warehouseName;
@Excel(name = "是否启用: 1-否 2-是")
private Integer isEnable;
}
@@ -270,7 +270,7 @@ public class LeaseApplicationService {
* 货主租赁明细
* 定时任务每天凌晨1点执行计算前一天的货主租赁明细
*/
// @Scheduled(cron = "0 0 1 * * ?")
@Scheduled(cron = "0 0 1 * * ?")
public void shipperLeaseDetails() {
log.info("开始执行货主租赁明细定时任务");
// 计算前一天的日期将时间设置为当天的0点0分0秒只保留日期部分
@@ -537,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());
@@ -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;
}
}
@@ -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;
}
}
@@ -91,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;
}
@@ -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;
}
@@ -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, "合同导出");
}
}
@@ -14,18 +14,18 @@ spring:
nacos:
discovery:
# server-addr: 127.0.0.1:8848
server-addr: 10.33.0.129:6010
# server-addr: 10.33.0.129:6010
# 线上测试环境配置 容器名+端口号
# server-addr: 10.102.192.31:6848
server-addr: 10.102.192.31:6848
username: nacos
password: manhuoda@2023
#线上正式环境
# server-addr: 10.102.192.105:6848
config:
# server-addr: 127.0.0.1:8848
server-addr: 10.33.0.129:6010
# server-addr: 10.33.0.129:6010
# 线上测试环境配置 容器名+端口号
# server-addr: 10.102.192.31:6848
server-addr: 10.102.192.31:6848
username: nacos
password: manhuoda@2023
#线上正式环境
@@ -148,7 +148,6 @@
AND a.top_organization_id = #{expenseAccountDO.topOrganizationId}
AND a.subject_code = #{expenseAccountDO.subjectCode}
AND a.status = 1
LIMIT 1
</select>
@@ -185,8 +185,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="queryList" parameterType="com.mhd.basic.domain.storageLocation.repository.todo.StorageLocationDO" resultMap="StorageLocationResult">
<include refid="selectStorageLocationPo"/>
<include refid="selectStorageLocationPo1"/>
-- 按照库位名称正序排序,名称相同时按创建时间倒序
order by a.storage_location_name asc, a.create_time desc
-- 按照创建时间倒序排序
order by a.create_time desc
</select>
<select id="getStorageLocationCount" parameterType="com.mhd.basic.domain.storageLocation.repository.todo.StorageLocationDO" resultType="java.lang.Long">
@@ -100,6 +100,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="queryList" parameterType="com.mhd.basic.domain.storageSection.repository.todo.StorageSectionDO" resultMap="StorageSectionResult">
<include refid="selectStorageSectionPo"/>
<include refid="selectStorageSectionPo1"/>
order by a.storage_name asc, a.create_time desc
order by a.create_time desc
</select>
</mapper>
@@ -39,10 +39,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="isEnable" column="IS_ENABLE" />
<result property="workMode" column="WORK_MODE" />
<result property="taskMode" column="TASK_MODE" />
<result property="sampleOutOrderNoPrefix" column="SAMPLE_OUT_ORDER_NO_PREFIX" />
<result property="orderNoGenerateRule" column="ORDER_NO_GENERATE_RULE" />
<result property="inOrderNoPrefix" column="IN_ORDER_NO_PREFIX" />
<result property="outOrderNoPrefix" column="OUT_ORDER_NO_PREFIX" />
</resultMap>
@@ -51,8 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
warehouse_type, warehouse_type_name, warehouse_structure, warehouse_nature, warm_layer_code, warm_layer_name,
director_name, director_phone, region_code, region_name, detail_address, longitude, latitude, building_region,
usage_region, remark, opening_up, nullify, create_time, create_by, create_by_name, update_time, update_by,
update_by_name, del_flag, IS_ENABLE ,WORK_MODE,TASK_MODE,SAMPLE_OUT_ORDER_NO_PREFIX,ORDER_NO_GENERATE_RULE,IN_ORDER_NO_PREFIX,
OUT_ORDER_NO_PREFIX
update_by_name, del_flag, IS_ENABLE ,WORK_MODE,TASK_MODE
from warehouse
</sql>
@@ -1,22 +1,12 @@
package com.mhd.user.application.service;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.mhd.common.security.utils.SecurityUtils;
import com.mhd.user.domain.userAggregate.entity.AgreementDetails;
import com.mhd.user.domain.userAggregate.entity.UserShipperEntity;
import com.mhd.user.domain.userAggregate.repository.mapper.AgreementDetailsMapper;
import com.mhd.user.domain.userAggregate.repository.mapper.UserShipperMapper;
import com.mhd.user.domain.userAggregate.repository.po.AgreementDetailsPo;
import com.mhd.system.api.model.LoginUser;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
@@ -29,87 +19,18 @@ public class AgreementDetailsApplicationService {
@Resource
private AgreementDetailsMapper agreementDetailsMapper;
@Resource
private UserShipperMapper userShipperMapper;
/**
* 根据货主ID查询当前登录用户组织下的协议明细
* 从user_shipper表的orgCode字段解析JSON匹配当前登录用户组织code
* 返回该组织下的agreedaydatas列表
* 根据货主ID查询所有协议明细
*
* @param shipperId 货主ID
* @return 协议明细列表
*/
public List<AgreementDetailsPo> listByShipperId(Long shipperId) {
// 1. 获取当前登录用户组织ID
LoginUser loginUser = SecurityUtils.getLoginUser();
if (ObjectUtil.isNull(loginUser) || ObjectUtil.isNull(loginUser.getUserPo())) {
log.warn("未获取到登录用户信息");
return Collections.emptyList();
}
Long organizationId = loginUser.getUserPo().getOrganizationId();
if (ObjectUtil.isNull(organizationId)) {
log.warn("当前登录用户无组织信息");
return Collections.emptyList();
}
// 2. 根据shipperId查询货主信息获取orgCode字段
UserShipperEntity shipperEntity = userShipperMapper.selectById(shipperId);
if (ObjectUtil.isNull(shipperEntity)) {
log.warn("未找到货主信息,shipperId={}", shipperId);
return Collections.emptyList();
}
String orgCodeJson = shipperEntity.getOrgCode();
if (ObjectUtil.isNull(orgCodeJson) || orgCodeJson.isEmpty()) {
log.warn("货主orgCode为空,shipperId={}", shipperId);
return Collections.emptyList();
}
// 3. 解析orgCode JSON数组匹配当前登录用户组织code
JSONArray orgCodeArray = JSONArray.parseArray(orgCodeJson);
if (orgCodeArray == null || orgCodeArray.isEmpty()) {
return Collections.emptyList();
}
JSONObject matchedOrg = null;
for (int i = 0; i < orgCodeArray.size(); i++) {
JSONObject orgItem = orgCodeArray.getJSONObject(i);
Long code = orgItem.getLong("code");
if (organizationId.equals(code)) {
matchedOrg = orgItem;
break;
}
}
if (matchedOrg == null) {
log.info("未匹配到当前组织的协议信息,shipperId={}organizationId={}", shipperId, organizationId);
return Collections.emptyList();
}
// 4. 获取匹配组织的agreedaydatas
JSONArray agreedaydatas = matchedOrg.getJSONArray("agreedaydatas");
if (agreedaydatas == null || agreedaydatas.isEmpty()) {
log.info("当前组织下无协议天数数据,shipperId={}organizationId={}", shipperId, organizationId);
return Collections.emptyList();
}
// 5. 转换为AgreementDetailsPo列表
List<AgreementDetailsPo> result = new ArrayList<>();
for (int i = 0; i < agreedaydatas.size(); i++) {
JSONObject item = agreedaydatas.getJSONObject(i);
AgreementDetailsPo po = new AgreementDetailsPo();
po.setCode(item.getString("code"));
po.setOrgcode(item.getString("orgcode"));
po.setPtypename(item.getString("ptypename"));
po.setPtype(item.getString("ptype"));
po.setPcode(item.getString("pcode"));
po.setPname(item.getString("pname"));
po.setPday(item.getString("pday"));
result.add(po);
}
log.info("查询协议明细成功,shipperId={}organizationId={},共{}条", shipperId, organizationId, result.size());
return result;
public List<AgreementDetails> listByShipperId(Long shipperId) {
return agreementDetailsMapper.selectList(
new LambdaQueryWrapper<AgreementDetails>()
.eq(AgreementDetails::getShipperId, shipperId)
.orderByDesc(AgreementDetails::getCreateTime)
);
}
/**
@@ -23,10 +23,7 @@ import com.mhd.common.core.enums.MessageTypeEnum;
import com.mhd.common.core.enums.WebsocketTypeEnum;
import com.mhd.common.core.feign.ThirdPartyServiceFeign;
import com.mhd.common.core.service.jPush.AsyncJPushApplicationService;
import com.mhd.common.core.utils.AESUtil;
import com.mhd.common.core.utils.OConvertUtils;
import com.mhd.common.core.utils.StringUtils;
import com.mhd.common.security.utils.password.PasswordUtil;
import com.mhd.system.api.FinanceServiceFeign;
import com.mhd.system.api.WlhyServiceFeign;
import com.mhd.system.api.domain.UserShipperEntityFeign;
@@ -364,7 +361,7 @@ public class UserShipperApplicationService {
/**
* Excel 导入委托方
* 模版列登录账号公司名称联系人联系电话地址详细地址备注结算币种NC客户编码
* 模版列登录账号公司名称联系人联系电话地址详细地址备注结算币种
*/
public com.mhd.common.core.web.domain.AjaxResult importShipperFromExcel(org.springframework.web.multipart.MultipartFile file) {
if (file == null || file.isEmpty()) {
@@ -375,12 +372,6 @@ public class UserShipperApplicationService {
org.apache.poi.ss.usermodel.Sheet sheet = workbook.getSheetAt(0);
int total = 0, success = 0, failed = 0;
java.util.List<String> errors = new java.util.ArrayList<>();
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser == null || loginUser.getUserPo() == null) {
return com.mhd.common.core.web.domain.AjaxResult.error("登录信息失效");
}
Long currentOrgId = loginUser.getUserPo().getOrganizationId();
String currentOrgName = loginUser.getUserPo().getOrganizationName();
for (int i = 1; i <= sheet.getLastRowNum(); i++) {
org.apache.poi.ss.usermodel.Row row = sheet.getRow(i);
if (row == null) continue;
@@ -389,21 +380,14 @@ public class UserShipperApplicationService {
if (org.springframework.util.StringUtils.isEmpty(companyName)) continue;
total++;
try {
String contactName = getCellStr(row.getCell(2));
String contactPhone = getCellStr(row.getCell(3));
String address = getCellStr(row.getCell(4));
String detailedAddress = getCellStr(row.getCell(5));
String remark = getCellStr(row.getCell(6));
String settlementCurrency = getCellStr(row.getCell(7));
String ncCustomerCode = getCellStr(row.getCell(8));
// 先按公司名称查是否已存在委托方
UserShipperEntity existingShipper = findFirstByShipperEnterpriseNameAcrossOrgs(companyName);
if (existingShipper != null && existingShipper.getShipperId() != null) {
// 已存在按模板更新指定字段
updateShipperFromExcel(existingShipper, userAccount, companyName,
contactName, contactPhone, address, detailedAddress,
remark, settlementCurrency, ncCustomerCode, loginUser, currentOrgId);
// 已存在只更新NC客户编码和org_code
appendOrganizationToExistingShipper(existingShipper,
SecurityUtils.getLoginUser().getUserPo().getOrganizationId(),
SecurityUtils.getLoginUser().getUserPo().getOrganizationName(),
userAccount, SecurityUtils.getLoginUser());
success++;
} else {
UserShipperDO shipperDO = new UserShipperDO();
@@ -411,34 +395,31 @@ public class UserShipperApplicationService {
shipperDO.setDataSource(2);
shipperDO.setUserAccount(userAccount);
shipperDO.setShipperEnterpriseName(companyName);
// NC客户编码使用模板中的独立字段不再复用登录账号
shipperDO.setCustomerNcCode(ncCustomerCode);
// 登录账号同时作为NC客户编码
shipperDO.setCustomerNcCode(userAccount);
String contactName = getCellStr(row.getCell(2));
String contactPhone = getCellStr(row.getCell(3));
// 联系人 -> user表 user_name + user_shipper表 user_name_shipper
shipperDO.setUserName(contactName);
shipperDO.setUserNameShipper(contactName);
// 联系电话 -> user表 user_phone
shipperDO.setUserPhone(contactPhone);
// 地址 -> user表 user_area_name详细地址 -> user表 user_area_address
shipperDO.setUserAreaName(address);
shipperDO.setUserAreaAddress(detailedAddress);
shipperDO.setRemark(remark);
shipperDO.setSettlementCurrency(settlementCurrency);
// 新导入账号默认密码 Aa123456按前端加密约定先 AES 加密
shipperDO.setUserPassword(AESUtil.encrypt("Aa123456"));
shipperDO.setUserAreaName(getCellStr(row.getCell(4)));
shipperDO.setUserAreaAddress(getCellStr(row.getCell(5)));
shipperDO.setRemark(getCellStr(row.getCell(6)));
shipperDO.setSettlementCurrency(getCellStr(row.getCell(7)));
// 初始化 orgCode记录当前组织信息和NC客户编码
com.alibaba.fastjson.JSONArray orgCodeArray = new com.alibaba.fastjson.JSONArray();
com.alibaba.fastjson.JSONObject orgItem = new com.alibaba.fastjson.JSONObject();
orgItem.put("name", currentOrgName);
orgItem.put("code", currentOrgId);
orgItem.put("ncCustomer", ncCustomerCode);
orgItem.put("names", currentOrgId);
LoginUser loginUser = SecurityUtils.getLoginUser();
orgItem.put("name", loginUser.getUserPo().getOrganizationName());
orgItem.put("code", loginUser.getUserPo().getOrganizationId());
orgItem.put("ncCustomer", userAccount);
orgItem.put("names", loginUser.getUserPo().getOrganizationId());
orgCodeArray.add(orgItem);
shipperDO.setOrgCode(orgCodeArray.toJSONString());
Map<String, Object> addResult = addShipper(shipperDO);
Object newUserIdObj = addResult.get("userId");
if (newUserIdObj instanceof Long) {
assignCompanyRoleIfMissing((Long) newUserIdObj, currentOrgId);
}
addShipper(shipperDO);
success++;
}
} catch (Exception e) {
@@ -460,149 +441,6 @@ public class UserShipperApplicationService {
}
}
/**
* 导入时若账号没有任何角色则补分配企业货主角色
*/
private void assignCompanyRoleIfMissing(Long userId, Long organizationId) {
if (userId == null || organizationId == null) {
return;
}
List<UserRoleMenuPO> existingRoles = userRoleDomainService.selectRolesByUserId(userId);
if (CollUtil.isNotEmpty(existingRoles)) {
return;
}
// role_code + organization_id 精确匹配角色selectByOrganizationIdAndRoleCode common_where 不含 roleCode 过滤不适用
RolePO rolePO = roleDomainService.selectByRoleCodeAndOrganizationId(RoleEnum.COMPANY.getCode(), organizationId);
if (rolePO == null) {
log.warn("组织{}下未找到{}角色,无法为导入用户{}分配角色", organizationId, RoleEnum.COMPANY.getCode(), userId);
return;
}
// 1. 写入 user_role
UserRoleDo userRoleDo = new UserRoleDo();
userRoleDo.setUserId(userId);
userRoleDo.setRoleId(rolePO.getRoleId());
userRoleDomainService.addUserRole(userRoleDo);
// 2. 同步更新 user 表的 role_code / role_name
UserDO userDO = new UserDO();
userDO.setUserId(userId);
userDO.setRoleCode(RoleEnum.COMPANY.getCode());
userDO.setRoleName(RoleEnum.COMPANY.getName());
userDomainService.updateUser(userDO);
}
/**
* 按Excel模板更新已存在的委托方只更新模板中的字段
*/
private void updateShipperFromExcel(UserShipperEntity existingShipper, String userAccount,
String companyName, String contactName, String contactPhone,
String address, String detailedAddress, String remark,
String settlementCurrency, String ncCustomerCode,
LoginUser loginUser, Long currentOrgId) {
Long userId = existingShipper.getUserId();
// user 主表读取当前登录账号user_shipper 表无 user_account 字段
UserPo existingUser = null;
String existingUserAccount = null;
if (userId != null) {
existingUser = userDomainService.selectByUserId(userId);
if (existingUser != null) {
existingUserAccount = existingUser.getUserAccount();
}
}
if (StringUtils.isBlank(existingUserAccount) && StringUtils.isBlank(userAccount)) {
throw new ServiceException("登录账号不能为空");
}
// 登录账号变更时校验唯一性
if (StringUtils.isNotBlank(userAccount) && !userAccount.equals(existingUserAccount)) {
UserDO checkDO = new UserDO();
checkDO.setUserAccount(userAccount);
checkDO.setTopOrganizationId(existingShipper.getTopOrganizationId());
UserPo existedUser = userDomainService.findByTopOrganizationIdAndUserAccount(checkDO);
if (existedUser != null && !existedUser.getUserId().equals(userId)) {
throw new ServiceException("登录账号已存在:" + userAccount);
}
}
Date now = new Date();
Long updateBy = loginUser.getUserPo().getUserId();
String updateByName = loginUser.getUserPo().getUserName();
// 1. 更新 user_shipper 表指定字段
// 注意user_shipper 表没有 user_account 字段登录账号在 user 主表维护
UserShipperEntity shipperUpdate = new UserShipperEntity();
shipperUpdate.setShipperId(existingShipper.getShipperId());
shipperUpdate.setShipperEnterpriseName(companyName);
shipperUpdate.setUserNameShipper(contactName);
shipperUpdate.setUserAreaName(address);
shipperUpdate.setUserAreaAddress(detailedAddress);
shipperUpdate.setRemark(remark);
shipperUpdate.setSettlementCurrency(settlementCurrency);
shipperUpdate.setCustomerNcCode(ncCustomerCode);
shipperUpdate.setUpdateBy(updateBy);
shipperUpdate.setUpdateByName(updateByName);
shipperUpdate.setUpdateTime(now);
userShipperMapper.updateById(shipperUpdate);
// 2. 同步更新 user 表指定字段
if (userId != null) {
UserDO userDO = new UserDO();
userDO.setUserId(userId);
if (StringUtils.isNotBlank(userAccount)) {
userDO.setUserAccount(userAccount);
}
userDO.setUserName(contactName);
userDO.setUserPhone(contactPhone);
userDO.setUserAreaName(address);
userDO.setUserAreaAddress(detailedAddress);
userDO.setUpdateBy(updateBy);
userDO.setUpdateByName(updateByName);
userDO.setUpdateTime(now);
// 如果现有账号没有密码设置默认密码 Aa123456 addUserInfoShipper 一致的加密流程
if (existingUser != null && StringUtils.isBlank(existingUser.getUserPassword())) {
String finalAccount = StringUtils.isNotBlank(userAccount) ? userAccount : existingUser.getUserAccount();
String salt = OConvertUtils.randomGen(8);
String passwordEncode = PasswordUtil.encrypt(finalAccount, "Aa123456", salt);
userDO.setUserPassword(passwordEncode);
userDO.setUserSalt(salt);
}
userDomainService.updateUser(userDO);
// 如果该账号没有任何角色补分配企业货主角色避免登录报账号未授权角色信息
assignCompanyRoleIfMissing(userId, existingShipper.getOrganizationId());
}
// 3. 更新 orgCode 中当前组织的 ncCustomer
String existingOrgCode = existingShipper.getOrgCode();
com.alibaba.fastjson.JSONArray orgCodeArray = new com.alibaba.fastjson.JSONArray();
boolean hasOrg = false;
if (StringUtils.isNotEmpty(existingOrgCode)) {
try {
orgCodeArray = com.alibaba.fastjson.JSONArray.parseArray(existingOrgCode);
for (int i = 0; i < orgCodeArray.size(); i++) {
com.alibaba.fastjson.JSONObject orgItem = orgCodeArray.getJSONObject(i);
if (currentOrgId != null && currentOrgId.equals(orgItem.getLong("code"))) {
orgItem.put("ncCustomer", ncCustomerCode);
hasOrg = true;
}
}
} catch (Exception e) {
log.error("解析orgCode失败,shipperId={}", existingShipper.getShipperId(), e);
}
}
if (!hasOrg) {
com.alibaba.fastjson.JSONObject newOrgItem = new com.alibaba.fastjson.JSONObject();
newOrgItem.put("name", loginUser.getUserPo().getOrganizationName());
newOrgItem.put("code", currentOrgId);
newOrgItem.put("ncCustomer", ncCustomerCode);
newOrgItem.put("names", currentOrgId);
orgCodeArray.add(newOrgItem);
}
UserShipperEntity orgCodeUpdate = new UserShipperEntity();
orgCodeUpdate.setShipperId(existingShipper.getShipperId());
orgCodeUpdate.setOrgCode(orgCodeArray.toJSONString());
orgCodeUpdate.setUpdateBy(updateBy);
orgCodeUpdate.setUpdateByName(updateByName);
orgCodeUpdate.setUpdateTime(now);
userShipperMapper.updateById(orgCodeUpdate);
}
private String getCellStr(org.apache.poi.ss.usermodel.Cell cell) {
if (cell == null) return null;
cell.setCellType(org.apache.poi.ss.usermodel.CellType.STRING);
@@ -1306,12 +1144,6 @@ public class UserShipperApplicationService {
return userShipperDomainService.userShipperList(userShipperDO);
}
public List<UserShipperPo> userShipperListAllByOrg(Long orgCode) {
UserShipperDO userShipperDO = new UserShipperDO();
userShipperDO.setOrganizationId(orgCode);
return userShipperDomainService.userShipperList(userShipperDO);
}
/**
* E签宝回调接口-认证授权完成
* @param jsonObject 回调参数
@@ -1,32 +0,0 @@
package com.mhd.user.domain.userAggregate.repository.po;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 协议天数PO
*/
@Data
public class AgreementDetailsPo {
@ApiModelProperty("客户编码")
private String code;
@ApiModelProperty("协议组织编码")
private String orgcode;
@ApiModelProperty("协议类型名称")
private String ptypename;
@ApiModelProperty("协议类型:1-付款协议天数,2-收款协议天数")
private String ptype;
@ApiModelProperty("财务系统协议编码")
private String pcode;
@ApiModelProperty("协议天数名称")
private String pname;
@ApiModelProperty("协议天数")
private String pday;
}
@@ -212,15 +212,6 @@ public class UserShipperAPI extends BaseController {
return AjaxResult.success("操作成功",list);
}
@Log(title = "托运人管理-查询租户下所有托运人", description ="查询租户下所有托运人",businessType = BusinessType.INQUIRE)
@ApiOperation("查询租户下所有托运人")
@GetMapping("/userShipperListAllByOrg")
public AjaxResult userShipperListAllByOrg(@RequestParam("orgCode") Long orgCode) {
//转换实体
List<UserShipperPo> list = userShipperApplicationService.userShipperListAllByOrg(orgCode);
return AjaxResult.success("操作成功",list);
}
@Log(title = "托运人管理-修改授权额度 结算天数 使用额度", description ="修改授权额度 结算天数 使用额度",businessType = BusinessType.INQUIRE)
@ApiOperation("修改授权额度和结算天数")
@PutMapping("/settlementInfo")
@@ -20,15 +20,15 @@ spring:
discovery:
# server-addr: 127.0.0.1:8848
# 线上测试环境配置 容器名+端口号
server-addr: 10.33.0.129:6010
# server-addr: 10.102.192.30:6848
# server-addr: 10.33.0.129:6010
server-addr: 10.102.192.30: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
# server-addr: 10.33.0.129:6010
server-addr: 10.102.192.30:6848
username: nacos
password: manhuoda@2023
group: DEFAULT_GROUP # 默认分组就是DEFAULT_GROUP,如果使用默认分组可以不配置
@@ -782,6 +782,10 @@
<if test="organizationId !=null">
AND (
u.organization_id = #{organizationId}
OR b.org_code LIKE concat('%"code":"', #{organizationId}, '"%')
OR b.org_code LIKE concat('%code:', #{organizationId}, '%')
OR b.org_code LIKE concat('%code: ', #{organizationId}, '%')
OR b.org_code LIKE concat('%"code":', #{organizationId}, '%')
)
AND u.organization_name IS NOT NULL
</if>
@@ -381,6 +381,10 @@
<if test="organizationId !=null">
AND (
a.organization_id = #{organizationId}
OR b.org_code LIKE concat('%"code":"', #{organizationId}, '"%')
OR b.org_code LIKE concat('%code:', #{organizationId}, '%')
OR b.org_code LIKE concat('%code: ', #{organizationId}, '%')
OR b.org_code LIKE concat('%"code":', #{organizationId}, '%')
)
</if>
/*组织名称*/
@@ -7,7 +7,6 @@ import com.mhd.bms.application.server.receiptManage.ReceiptManageApplicationServ
import com.mhd.bms.domain.billManage.entity.BillDetail;
import com.mhd.bms.domain.billManage.entity.BillManage;
import com.mhd.bms.domain.billManage.repository.facade.IBillDetailService;
import com.mhd.bms.domain.billManage.repository.facade.IBillManageService;
import com.mhd.bms.domain.billManage.repository.mapper.BillDetailMapper;
import com.mhd.bms.domain.billManage.repository.po.BillDetailPO;
import com.mhd.bms.domain.billManage.repository.po.BillManagePO;
@@ -79,8 +78,6 @@ public class BillManageApplicationService {
private BillDetailMapper billDetailMapper;
@Autowired
private NcLogMapper ncLogMapper;
@Autowired
private IBillManageService billManageService;
/**
@@ -136,12 +133,8 @@ public class BillManageApplicationService {
List<BillManagePO> billManagePOS = billManageDomainService.queryList(billManageDO);
for (BillManagePO billManagePO : billManagePOS) {
String billNumber = billManagePO.getBillNumber(); // 获取账单编号
// 原有 - 前端列表用不变
List<BillDetail> billDetails = billDetailMapper.selectList(new LambdaQueryWrapper<BillDetail>().eq(BillDetail::getBillNumber, billNumber));
billManagePO.setBillDetailList(billDetails);
// 新增 - 导出用LEFT JOIN billing_statement 拿到费用科目
List<BillDetailPO> billDetailPOs = billDetailMapper.getDetailsByBillManageId(billManagePO.getBillManageId());
billManagePO.setBillDetailPOList(billDetailPOs);
}
return billManagePOS;
}
@@ -367,19 +360,6 @@ public class BillManageApplicationService {
billDetailDTO1.setFeeType(billDetailDTO1.getServiceItemsName());
});
}
//同步更新已有计费流水调整账单时可修改已有费用
List<BillDetailDTO> billDetailDTOListHasBillingStatementId = billDetailDTOList.stream()
.filter(billDetailDTO -> billDetailDTO.getBillingStatementId() != null)
.collect(Collectors.toList());
for (BillDetailDTO billDetailDTO : billDetailDTOListHasBillingStatementId) {
BillingStatementDO billingStatementDO = new BillingStatementDO();
BeanUtils.copyProperties(billDetailDTO, billingStatementDO);
billingStatementDO.setBillingStatementId(billDetailDTO.getBillingStatementId());
billingStatementDO.setBillManageId(billManagePO.getBillManageId());
billingStatementDO.setBillingState(3);
billingStatementDO.setAccountExpenseType(billDetailDTO.getBillType());
billingStatementApplicationService.update(billingStatementDO);
}
//保存账单明细
Boolean flag = billDetailDomainService.saveBatch(billDetailDTOList);
//更新账单金额
@@ -448,7 +428,6 @@ public class BillManageApplicationService {
billManageDO.setReconciliationStatus(1);
billManageDO.setCreateTime(new Date());
billManageDO.setCreateBy(loginUser.getUserid());
billManageDO.setSalesmanId(String.valueOf(loginUser.getUserid()));
billManageDO.setCreateByName(loginUser.getUserPo().getUserName());
billManageDO.setUpdateTime(new Date());
billManageDO.setUpdateBy(loginUser.getUserid());
@@ -470,16 +449,6 @@ public class BillManageApplicationService {
for (BillDetailDTO billDetailDTO : billDetailDTOListNoBillingStatementId) {
BillingStatementDTO billingStatementDTO = new BillingStatementDTO();
BeanUtils.copyProperties(billDetailDTO, billingStatementDTO);
String firstSubjectCode = billDetailDTO.getFirstSubjectCode();
Double taxRate = billDetailMapper.getTaxRate(firstSubjectCode);
BigDecimal amount = billingStatementDTO.getBillingAmount();
BigDecimal taxAmount = amount.divide(BigDecimal.ONE.add(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))),10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal taxFreeFee = amount.subtract(taxAmount);
billingStatementDTO.setTaxAmount(taxAmount);
billingStatementDTO.setTaxFreeFee(taxFreeFee);
billingStatementDTO.setTaxRate(taxRate);
billingStatementDTO.setBillingAmount(amount);
billingStatementDTO.setAccountExpenseType(billDetailDTO.getBillType());
billingStatementDTO.setBillManageId(billManageDO.getBillManageId());
billingStatementDTO.setBillingState(3);
@@ -495,47 +464,7 @@ public class BillManageApplicationService {
item.setFeeType(item.getServiceItemsName());
});
}
//同步更新已有计费流水新增账单时可修改已有费用
List<BillDetailDTO> billDetailDTOListHasBillingStatementId = billDetailDTOList.stream()
.filter(item -> item.getBillingStatementId() != null)
.collect(Collectors.toList());
for (BillDetailDTO billDetailDTO : billDetailDTOListHasBillingStatementId) {
BillingStatementDO billingStatementDO = new BillingStatementDO();
BeanUtils.copyProperties(billDetailDTO, billingStatementDO);
billingStatementDO.setBillingStatementId(billDetailDTO.getBillingStatementId());
billingStatementDO.setBillManageId(billManageDO.getBillManageId());
billingStatementDO.setBillingState(3);
billingStatementDO.setAccountExpenseType(billDetailDTO.getBillType());
billingStatementApplicationService.update(billingStatementDO);
}
//保存账单明细
double allTaxRate = 0.0d;
BigDecimal allTaxAmount = BigDecimal.ZERO;
BigDecimal allTaxFreeFee = BigDecimal.ZERO;
for (BillDetailDTO item : billDetailDTOList) {
String firstSubjectCode = item.getFirstSubjectCode();
Double taxRate = billDetailMapper.getTaxRate(firstSubjectCode);
BigDecimal amount = item.getBillingAmount();
BigDecimal taxAmount = amount.divide(BigDecimal.ONE.add(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))),10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal taxFreeFee = amount.subtract(taxAmount);
item.setTaxAmount(taxAmount);
item.setTaxFreeFee(taxFreeFee);
item.setTaxRate(taxRate);
item.setBillManageId(billManageDO.getBillManageId());
item.setBillNumber(billManageDO.getBillNumber());
allTaxRate += taxRate;
allTaxAmount = allTaxAmount.add(taxAmount);
allTaxFreeFee = allTaxFreeFee.add(taxFreeFee);
}
BillManage billManage = billManageService.getById(billManageDO.getBillManageId());
if (billManage != null) {
billManage.setTaxRate(allTaxRate);
billManage.setTaxAmount(allTaxAmount);
billManage.setTaxFreeFee(allTaxFreeFee);
billManage.setSalesmanId(String.valueOf(loginUser.getUserid()));
billManageService.updateById(billManage);
}
Boolean flagTwo = billDetailDomainService.saveBatch(billDetailDTOList);
//保存操作记录
BillOperationLogDO billOperationLogDO = new BillOperationLogDO();
@@ -547,51 +476,105 @@ public class BillManageApplicationService {
}
/**
* 复制账单-获取原账单数据供前端回显
* 前端拿到数据后跳转到类似修改/新增账单的页面用户修改后通过addBill接口提交新增
* 复制账单
*/
public BillManagePO copyBill(BillManageDTO billManageDTO) {
@Transactional
public Boolean copyBill(BillManageDTO billManageDTO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (ObjectUtil.isNull(loginUser)) {
throw new DigitalLogisticsException(UserError.TIMEOUT);
}
if (billManageDTO.getBillManageId() == null) {
throw new ServiceException("原账单id不能为空");
}
// 获取原账单信息
// 1. 获取原账单信息
BillManagePO originalBill = billManageDomainService.getInfo(billManageDTO.getBillManageId());
if (null == originalBill) {
throw new ServiceException("原账单信息未找到");
}
// 获取原账单明细
// 2. 获取原账单明细
List<BillDetailPO> originalDetails = billDetailDomainService.getDetailsByBillManageId(billManageDTO.getBillManageId());
if (originalDetails == null || originalDetails.isEmpty()) {
throw new ServiceException("原账单明细为空,无法复制");
}
// 重置关键字段为初始值清空id等方便前端回显后直接提交新增
originalBill.setBillManageId(null);
originalBill.setBillNumber(null);
originalBill.setBillState(1);
originalBill.setBillStep(1);
originalBill.setReconciliationStatus(0);
originalBill.setIsInvoice(0);
originalBill.setActualReceivedAmount(BigDecimal.ZERO);
originalBill.setBillAmountUnsettled(originalBill.getBillAmount());
originalBill.setBillAmountSettlement(BigDecimal.ZERO);
originalBill.setSynchronousStatus(0);
originalBill.setSkSynchronousStatus(0);
originalBill.setApplyNumber(null);
originalBill.setSettlementTime(null);
originalBill.setSynchronousTime(null);
originalBill.setSkSynchronousTime(null);
originalBill.setInvoiceId(null);
originalBill.setInvoiceMakeTime(null);
originalBill.setNcId(null);
originalBill.setSkNcId(null);
// 明细也清空id
for (BillDetailPO detail : originalDetails) {
detail.setBillDetailId(null);
detail.setBillManageId(null);
detail.setBillNumber(null);
// 3. 创建新账单除账单编号外完全复制原账单
String newBillNumber = OrderSequence.getOrderCode("ZD");
BillManage newBill = new BillManage();
BeanUtils.copyProperties(originalBill, newBill);
newBill.setBillManageId(null);
newBill.setBillNumber(newBillNumber);
newBill.setCreateBy(loginUser.getUserPo().getUserId());
newBill.setCreateByName(loginUser.getUserPo().getUserName());
newBill.setCreateTime(new Date());
newBill.setUpdateBy(loginUser.getUserPo().getUserId());
newBill.setUpdateByName(loginUser.getUserPo().getUserName());
newBill.setUpdateTime(new Date());
newBill.setDelFlag(1);
// 复制后重置状态字段为初始值
// 账单状态对账状态发票状态重置
newBill.setBillState(1); // 1-未确认
newBill.setBillStep(1); // 1-发起对账
newBill.setReconciliationStatus(0); // 1-暂未确认
newBill.setIsInvoice(0); // 0-未索取
// 实收=0未收=账单金额
newBill.setActualReceivedAmount(BigDecimal.ZERO);
newBill.setBillAmountUnsettled(newBill.getBillAmount());
newBill.setBillAmountSettlement(BigDecimal.ZERO);
// NC同步状态重置
newBill.setSynchronousStatus(0); // 0-未同步
newBill.setSkSynchronousStatus(0); // 0-未同步
// 清空发票收款推送相关字段
newBill.setApplyNumber(null); // 发票申请单号
newBill.setSettlementTime(null); // 收款时间
newBill.setSynchronousTime(null); // 应收单推送时间
newBill.setSkSynchronousTime(null); // 收款单推送时间
newBill.setInvoiceId(null); // 发票表ID
newBill.setInvoiceMakeTime(null); // 开票时间
newBill.setNcId(null); // nc唯一标识应收
newBill.setSkNcId(null); // nc唯一标识收款
// 保存新账单
boolean flag = billManageDomainService.saveEntity(newBill);
if (!flag) {
throw new ServiceException("复制账单失败,请重试");
}
originalBill.setBillDetailPOList(originalDetails);
return originalBill;
// 4. 复制账单明细
List<BillDetail> newDetailList = new ArrayList<>();
for (BillDetailPO originalDetail : originalDetails) {
BillDetail newDetail = new BillDetail();
BeanUtils.copyProperties(originalDetail, newDetail);
newDetail.setBillDetailId(null);
newDetail.setBillManageId(newBill.getBillManageId());
newDetail.setBillNumber(newBillNumber);
newDetail.setCreateBy(loginUser.getUserPo().getUserId());
newDetail.setCreateByName(loginUser.getUserPo().getUserName());
newDetail.setCreateTime(new Date());
newDetailList.add(newDetail);
}
Boolean flagTwo = billDetailDomainService.insertBatch(newDetailList);
// 5. 复制计费流水billing_statement
List<BillingStatementPO> originalStatements = billingStatementDomainService.getDetailsByManageId(billManageDTO.getBillManageId());
boolean flagThree = true;
if (originalStatements != null && !originalStatements.isEmpty()) {
List<BillingStatement> newStatementList = new ArrayList<>();
for (BillingStatementPO originalStatement : originalStatements) {
BillingStatement newStatement = new BillingStatement();
BeanUtils.copyProperties(originalStatement, newStatement);
newStatement.setBillingStatementId(null);
newStatement.setBillManageId(newBill.getBillManageId());
newStatement.setCreateBy(loginUser.getUserPo().getUserId());
newStatement.setCreateByName(loginUser.getUserPo().getUserName());
newStatement.setCreateTime(new Date());
newStatementList.add(newStatement);
}
flagThree = billingStatementDomainService.saveEntityBatch(newStatementList);
}
// 6. 保存操作日志
BillOperationLogDO billOperationLogDO = new BillOperationLogDO();
billOperationLogDO.setBillManageId(newBill.getBillManageId());
billOperationLogDO.setOperationInfo(StringUtils.format(BillLogsConstants.copy_bill_text, originalBill.getBillNumber(), newBillNumber));
billOperationLogDO.setOperationType(1);
boolean three = billOperationLogDomainService.saveBillOperationLog(billOperationLogDO);
return flag && flagTwo && flagThree && three;
}
/**
@@ -585,8 +585,6 @@ public class BillingStatementApplicationService {
此方法只进行实体返回并不进行数据保存
*/
LoginUser loginUser = SecurityUtils.getLoginUser();
billingStatementDO.setAccountExpenseType(billingStatementDO.getAccountExpenseType());
if (ObjectUtil.isNull(loginUser)) {
throw new DigitalLogisticsException(UserError.TIMEOUT);
}
@@ -596,10 +594,7 @@ public class BillingStatementApplicationService {
BeanUtils.copyProperties(billingStatementDO,billingStatementPO);
billingStatementPO.setBillingTotalAmount(billingStatementDO.getBillingAmount());
billingStatementPO.setDataSources(2);
// 若传入了计费流水号则直接使用否则自动生成
if (StringUtils.isEmpty(billingStatementPO.getBillingFlow())) {
billingStatementPO.setBillingFlow(OrderSequence.getOrderCode("JFLS"));
}
billingStatementPO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
billingStatementPO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
billingStatementPO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
@@ -274,7 +274,7 @@ public class SettlementCustomersApplicationService {
SyncDictCache dictCache,
List<SettlementCustomers> toInsert,
List<SettlementCustomers> toUpdate) {
AjaxResult ajaxResult = userServiceFeign.userShipperListAllByOrg(loginUser.getUserPo().getOrganizationId());
AjaxResult ajaxResult = userServiceFeign.userShipperListAll();
List<UserShipperPo> userShipperPoList = parseFeignList(ajaxResult, UserShipperPo.class);
if (userShipperPoList.isEmpty()) {
return;
@@ -38,6 +38,4 @@ public interface IBillDetailService extends IService<BillDetail>
public BillDetailPO getInfo(Long billDetailId);
List<BillDetailPO> getDetailsByBillManageId(Long billManageId);
List<BillDetail> getDetailsByBillManageIdAndGroup(Long billManageId);
}
@@ -5,7 +5,6 @@ import com.mhd.bms.domain.billManage.entity.BillDetail;
import com.mhd.bms.domain.billManage.repository.po.BillDetailPO;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.List;
/**
@@ -18,8 +17,4 @@ public interface BillDetailMapper extends BaseMapper<BillDetail>
{
List<BillDetailPO> getDetailsByBillManageId(@Param("billManageId") Long billManageId);
List<BillDetail> getDetailsByBillManageIdAndGroup(@Param("billManageId") Long billManageId);
Double getTaxRate(@Param("code") String code);
}
@@ -44,6 +44,4 @@ public interface BillManageMapper extends BaseMapper<BillManage>
String getDeptName(@Param("dictCode") String dictCode);
String getOrgCodeNc(@Param("organizationId") Long organizationId);
Long getShipperId(@Param("userId") Long userId, @Param("organizationId") Long organizationId);
}
@@ -75,9 +75,4 @@ public class BillDetailImpl extends ServiceImpl<BillDetailMapper, BillDetail> im
public List<BillDetailPO> getDetailsByBillManageId(Long billManageId) {
return billDetailMapper.getDetailsByBillManageId(billManageId);
}
@Override
public List<BillDetail> getDetailsByBillManageIdAndGroup(Long billManageId) {
return billDetailMapper.getDetailsByBillManageIdAndGroup(billManageId);
}
}
@@ -9,11 +9,8 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.mhd.bms.domain.billManage.entity.BillDetail;
import com.mhd.bms.domain.billManage.entity.BillManage;
import com.mhd.bms.domain.billManage.repository.facade.IBillDetailService;
import com.mhd.bms.domain.billManage.repository.facade.IBillManageService;
import com.mhd.bms.domain.billManage.repository.mapper.BillDetailMapper;
import com.mhd.bms.domain.billManage.repository.mapper.BillManageMapper;
import com.mhd.bms.domain.billManage.repository.po.BillManagePO;
import com.mhd.bms.domain.billManage.repository.todo.BillManageDO;
@@ -27,9 +24,6 @@ import com.mhd.bms.domain.ncDataPushConfig.entity.NcDataPushConfig;
import com.mhd.bms.domain.ncDataPushConfig.repository.mapper.NcDataPushConfigMapper;
import com.mhd.bms.domain.ncLog.entity.NcLog;
import com.mhd.bms.domain.ncLog.repository.mapper.NcLogMapper;
import com.mhd.bms.domain.settlementCustomers.entity.SettlementCustomers;
import com.mhd.bms.domain.settlementCustomers.repository.facade.ISettlementCustomersService;
import com.mhd.bms.interfaces.dto.billManage.BillDetailDTO;
import com.mhd.bms.interfaces.dto.billManage.BillManageDTO;
import com.mhd.common.core.domain.dto.ReconciliationDTO;
import com.mhd.common.core.domain.dto.nc.*;
@@ -89,12 +83,6 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
@Autowired
private BillManageMapper billManageMapper;
@Autowired
private IBillDetailService billDetailService;
@Autowired
private IBillManageService billManageService;
@Autowired
private BillDetailMapper billDetailMapper;
@Autowired
private BmsInvoiceListMapper bmsInvoiceListMapper;
//nc测试环境地址
@@ -115,8 +103,6 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
private BmsMakeOutInvoiceMapper bmsMakeOutInvoiceMapper;
@Resource
private BmsMakeOutInvoiceItemMapper bmsMakeOutInvoiceItemMapper;
@Autowired
private ISettlementCustomersService settlementCustomersService;
/**
* 查询账单管理列表
*/
@@ -191,6 +177,7 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
return true;
}
public boolean synchronousNc_TY(String businessDocumentDetaliId) {
BillManage reconciliation=billManageMapper.selectById(businessDocumentDetaliId);
if(reconciliation.getSynchronousStatus()==1){
@@ -203,43 +190,11 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
SimpleDateFormat sdf2 = new SimpleDateFormat("MM");
String dateString = sdf.format(date);
String invoiceId = reconciliation.getInvoiceId();
List<BillDetail> billDetails = billDetailService.getDetailsByBillManageIdAndGroup(Long.parseLong(businessDocumentDetaliId));
//保存税额等
double allTaxRate = 0.0d;
BigDecimal allTaxAmount = BigDecimal.ZERO;
BigDecimal allTaxFreeFee = BigDecimal.ZERO;
for (BillDetail item : billDetails) {
String firstSubjectCode = item.getInvoiceItem();
Double taxRate = billDetailMapper.getTaxRate(firstSubjectCode);
BigDecimal amount = item.getBillingAmount();
BigDecimal taxAmount = amount.divide(BigDecimal.ONE.add(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))),10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal taxFreeFee = amount.subtract(taxAmount);
if (item.getTaxAmount() == null) {
item.setTaxAmount(taxAmount);
}
if (item.getTaxFreeFee() == null) {
item.setTaxFreeFee(taxFreeFee);
}
if (item.getTaxRate() == null) {
item.setTaxRate(taxRate);
}
allTaxRate += taxRate;
allTaxAmount = allTaxAmount.add(taxAmount);
allTaxFreeFee = allTaxFreeFee.add(taxFreeFee);
}
if (reconciliation.getTaxRate() == null) {
reconciliation.setTaxRate(allTaxRate);
}
if (reconciliation.getTaxAmount() == null) {
reconciliation.setTaxAmount(allTaxAmount);
}
if (reconciliation.getTaxFreeFee() == null) {
reconciliation.setTaxFreeFee(allTaxFreeFee);
}
List<BmsMakeOutInvoice> bmsMakeOutInvoices = bmsMakeOutInvoiceMapper.selectList(new LambdaQueryWrapper<BmsMakeOutInvoice>().eq(BmsMakeOutInvoice::getInvoiceId, invoiceId));
if (bmsMakeOutInvoices != null && bmsMakeOutInvoices.size() > 0){
int count = 0;
for (BmsMakeOutInvoice make : bmsMakeOutInvoices) {
count++;
List<Ysitem> ysitemList=new ArrayList<Ysitem>();
String url = "";
Long organizationId = reconciliation.getOrganizationId();
@@ -258,19 +213,8 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
String deptName = billManageMapper.getDeptName(customerUserDept);
String salespersonNcCode = billManageMapper.getsalespersonNcCode(salesmanId);
String salesmanCodeNc=salespersonNcCode;
Long settlementCustomersId = reconciliation.getSettlementCustomersId();
SettlementCustomers settlementCustomers = settlementCustomersService.getById(settlementCustomersId);
if (settlementCustomers==null){
throw new ServiceException("结算对象未找到!");
}
Long settlementEntityId = settlementCustomers.getSettlementEntityId();
Long shipperId = billManageMapper.getShipperId(settlementEntityId, organizationId);
if (shipperId==null||shipperId==0){
throw new ServiceException("结算对象未找到!");
}
String appointShipper=settlementCustomers.getSettlementEntity();
String actualInvoiceCustomerId = String.valueOf(shipperId);
String appointShipper=make.getActualInvoiceCustomerName();
String actualInvoiceCustomerId = make.getActualInvoiceCustomerId();
String customerCodeNc = billManageMapper.getCustomerCodeNc(actualInvoiceCustomerId);
String customerCodeNcJson = billManageMapper.getCustomerCodeNcJson(actualInvoiceCustomerId);
if (customerCodeNcJson != null && !customerCodeNcJson.isEmpty()) {
@@ -297,10 +241,11 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
String documentPreparerNcCode = billManageMapper.getDocumentPreparerNcCode(salesmanId);
String makerCodeNc = documentPreparerNcCode;
String settlementCurrencyNcCode = settlementCurrency;
if (billDetails!=null&&billDetails.size()>0){
for (BillDetail make : billDetails) {
if(make.getBillingAmount().compareTo(BigDecimal.ZERO)>0){
String invoiceNumber=make.getInvoiceNumber();
List<BmsMakeOutInvoiceItem> bmsMakeOutInvoiceItems = bmsMakeOutInvoiceItemMapper.selectList(new LambdaQueryWrapper<BmsMakeOutInvoiceItem>().eq(BmsMakeOutInvoiceItem::getMakeId, make.getId()));
if (bmsMakeOutInvoiceItems != null && bmsMakeOutInvoiceItems.size() > 0) {
for (BmsMakeOutInvoiceItem item1 : bmsMakeOutInvoiceItems) {
if(item1.getInvoiceValue().compareTo(BigDecimal.ZERO)>0){
Ysitem item=new Ysitem();
if (deptValue != null && !deptValue.isEmpty()) {
item.setSo_deptid(deptValue);
@@ -318,56 +263,58 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
item.setCustomer(customerCodeNc);
item.setObjtype("0");
item.setDirection("1");
String invoiceItem = make.getInvoiceItem();
String invoiceItem = item1.getInvoiceItem();
List<String> names = new ArrayList<>();
List<String> nccodes = new ArrayList<>();
if (invoiceItem != null && !invoiceItem.isEmpty()) {
String invoiceItemName1 = billManageMapper.getInvoiceItemName(invoiceItem);
String invoiceItemNcCode1 = billManageMapper.getInvoiceItemNcCode(invoiceItem);
String[] items = invoiceItem.split(",");
for (String s : items) {
String invoiceItemName1 = billManageMapper.getInvoiceItemName(s);
String invoiceItemNcCode1 = billManageMapper.getInvoiceItemNcCode(s);
names.add(invoiceItemName1);
nccodes.add(invoiceItemNcCode1);
}
String invoiceItemName = make.getInvoiceItemName();
}
String invoiceItemName = String.join(",", names);
//item.setDef29(invoiceItemName);
if (deptName != null && !deptName.isEmpty()) {
item.setScomment(deptName+":应收"+appointShipper+invoiceItemName);
item.setScomment(deptName+":应收"+appointShipper+invoiceItemName+invoiceNumber);
} else {
item.setScomment("业务部:应收"+appointShipper+invoiceItemName);
item.setScomment("业务部:应收"+appointShipper+invoiceItemName+invoiceNumber);
}
if (settlementCurrencyNcCode != null && !settlementCurrencyNcCode.isEmpty()) {
// item.setPk_currtype("CNY");
item.setPk_currtype(settlementCurrencyNcCode);
} else {
item.setPk_currtype("CNY");
}
item.setPurchaseorder("");
item.setTaxrate(String.valueOf(make.getTaxRate()));
item.setTaxrate(String.valueOf(item1.getTaxRate()));
item.setQuantity_de("0");
item.setMoney_de(String.valueOf(make.getBillingAmount()));
item.setMoney_bal(String.valueOf(make.getBillingAmount()));
BigDecimal tax_de=make.getTaxAmount();
BigDecimal notax_de=make.getTaxFreeFee();
item.setMoney_de(String.valueOf(item1.getInvoiceValue()));
item.setMoney_bal(String.valueOf(item1.getInvoiceValue()));
BigDecimal tax_de=item1.getTaxAmount();
BigDecimal notax_de=item1.getTaxFreeFee();
item.setNotax_de(String.valueOf(notax_de));
item.setLocal_tax_de(String.valueOf(tax_de));
item.setTax_de(String.valueOf(tax_de));
item.setPrice(String.valueOf(make.getBillingAmount()));
item.setTaxprice(String.valueOf(make.getBillingAmount()));
//费用类别
String feeType = make.getFeeType();
item.setPrice(String.valueOf(item1.getInvoiceValue()));
item.setTaxprice(String.valueOf(item1.getInvoiceValue()));
// 费用类别
String feeType = item1.getFeeType();
String serviceItemsCodeNc = billManageMapper.getServiceItemsCodeNc(feeType);
if (serviceItemsCodeNc != null && !serviceItemsCodeNc.isEmpty()) {
item.setDef75(serviceItemsCodeNc);
} else {
item.setDef75("T04");
}
String invoiceItem1 = make.getInvoiceItem();
String invoiceItem1 = item1.getInvoiceItem();
if (invoiceItem1 != null && !invoiceItem1.isEmpty()) {
item.setDef29(invoiceItem1);
String[] split = invoiceItem1.split(",");
item.setDef29(split[0]);
//item.setDef29(invoiceItem1);
}
if (nccodes != null && !nccodes.isEmpty()&&nccodes.size()>0) {
item.setDef29(nccodes.get(0));
}
item.setTaxcodeid("ZL01");
item.setInvoiceno("");
item.setInvoiceno(invoiceNumber);
ysitemList.add(item);
}
}
@@ -407,7 +354,7 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
billhead.setDef29(reconciliation.getBillNumber());
billhead.setBodys(bodys);
Ysbill bill=new Ysbill();
bill.setId("ys"+String.valueOf(reconciliation.getBillManageId())+"_"+1);
bill.setId("ys"+String.valueOf(reconciliation.getBillManageId())+"_"+count);
bill.setBillhead(billhead);
Ysufinterface ufinterface=new Ysufinterface();
ufinterface.setAccount("NKNC");
@@ -505,8 +452,11 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
e.printStackTrace();
}
}
}
} else {
reconciliation.setSynchronousStatus(2);
billManageMapper.updateById(reconciliation);
}
} catch (JAXBException e) {
reconciliation.setSynchronousStatus(2);
billManageMapper.updateById(reconciliation);
@@ -519,298 +469,6 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
return true;
}
//按发票推送版本
// public boolean synchronousNc_TY(String businessDocumentDetaliId) {
// BillManage reconciliation=billManageMapper.selectById(businessDocumentDetaliId);
// if(reconciliation.getSynchronousStatus()==1){
// throw new ServiceException("该记录已同步,不需要再次同步");
// }
// try {
// Date date = reconciliation.getCreateTime();
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy");
// SimpleDateFormat sdf2 = new SimpleDateFormat("MM");
// String dateString = sdf.format(date);
// String invoiceId = reconciliation.getInvoiceId();
// List<BmsMakeOutInvoice> bmsMakeOutInvoices = bmsMakeOutInvoiceMapper.selectList(new LambdaQueryWrapper<BmsMakeOutInvoice>().eq(BmsMakeOutInvoice::getInvoiceId, invoiceId));
// if (bmsMakeOutInvoices != null && bmsMakeOutInvoices.size() > 0){
// int count = 0;
// for (BmsMakeOutInvoice make : bmsMakeOutInvoices) {
// count++;
// List<Ysitem> ysitemList=new ArrayList<Ysitem>();
// String url = "";
// Long organizationId = reconciliation.getOrganizationId();
// String organizationName = reconciliation.getOrganizationName();
// String ncUrl = billManageMapper.getNcUrl("nc", organizationName, organizationId);
// if (ncUrl!=null&&ncUrl!="") {
// url = ncUrl;
// } else {
// reconciliation.setSynchronousStatus(2);
// billManageMapper.updateById(reconciliation);
// throw new ServiceException("未找到该组织的推送地址!");
// }
// String salesmanId = reconciliation.getSalesmanId();
// String customerUserDept = billManageMapper.getCustomerUserDept(salesmanId);
// String deptValue = billManageMapper.getDeptValue(customerUserDept);
// String deptName = billManageMapper.getDeptName(customerUserDept);
// String salespersonNcCode = billManageMapper.getsalespersonNcCode(salesmanId);
// String salesmanCodeNc=salespersonNcCode;
// String appointShipper=make.getActualInvoiceCustomerName();
// String actualInvoiceCustomerId = make.getActualInvoiceCustomerId();
// String customerCodeNc = billManageMapper.getCustomerCodeNc(actualInvoiceCustomerId);
// String customerCodeNcJson = billManageMapper.getCustomerCodeNcJson(actualInvoiceCustomerId);
// if (customerCodeNcJson != null && !customerCodeNcJson.isEmpty()) {
// ObjectMapper objectMapper = new ObjectMapper();
// List<Map<String, Object>> listNc = objectMapper.readValue(
// customerCodeNcJson,
// new TypeReference<List<Map<String, Object>>>() {}
// );
// if (listNc != null && listNc.size() > 0) {
// Map<String, Object> targetMap = listNc.stream()
// .filter(map -> {
// Object codeObj = map.get("code");
// return codeObj != null && codeObj.toString().equals(reconciliation.getOrganizationId().toString());
// })
// .findFirst()
// .orElse(null);
// if (targetMap != null) {
// customerCodeNc = (String) targetMap.get("ncCustomer");
// }
// }
// }
// String settlementCurrency=reconciliation.getSettlementCurrency();
// String orgCodeNc = billManageMapper.getOrgCodeNc(organizationId);
// String documentPreparerNcCode = billManageMapper.getDocumentPreparerNcCode(salesmanId);
// String makerCodeNc = documentPreparerNcCode;
// String settlementCurrencyNcCode = settlementCurrency;
// String invoiceNumber=make.getInvoiceNumber();
// List<BmsMakeOutInvoiceItem> bmsMakeOutInvoiceItems = bmsMakeOutInvoiceItemMapper.selectList(new LambdaQueryWrapper<BmsMakeOutInvoiceItem>().eq(BmsMakeOutInvoiceItem::getMakeId, make.getId()));
// if (bmsMakeOutInvoiceItems != null && bmsMakeOutInvoiceItems.size() > 0) {
// for (BmsMakeOutInvoiceItem item1 : bmsMakeOutInvoiceItems) {
// if(item1.getInvoiceValue().compareTo(BigDecimal.ZERO)>0){
// Ysitem item=new Ysitem();
// if (deptValue != null && !deptValue.isEmpty()) {
// item.setSo_deptid(deptValue);
// } else {
// item.setSo_deptid("NG0408");
// }
// if (deptValue != null && !deptValue.isEmpty()) {
// item.setPk_deptid(deptValue);
// } else {
// item.setPk_deptid("NG0408");
// }
// //业务员nc
// item.setPk_psndoc(salesmanCodeNc);
// //客户nc
// item.setCustomer(customerCodeNc);
// item.setObjtype("0");
// item.setDirection("1");
// String invoiceItem = item1.getInvoiceItem();
// List<String> names = new ArrayList<>();
// List<String> nccodes = new ArrayList<>();
// if (invoiceItem != null && !invoiceItem.isEmpty()) {
// String[] items = invoiceItem.split(",");
// for (String s : items) {
// String invoiceItemName1 = billManageMapper.getInvoiceItemName(s);
// String invoiceItemNcCode1 = billManageMapper.getInvoiceItemNcCode(s);
// names.add(invoiceItemName1);
// nccodes.add(invoiceItemNcCode1);
// }
// }
// String invoiceItemName = String.join(",", names);
// //item.setDef29(invoiceItemName);
// if (deptName != null && !deptName.isEmpty()) {
// item.setScomment(deptName+":应收"+appointShipper+invoiceItemName+invoiceNumber);
// } else {
// item.setScomment("业务部:应收"+appointShipper+invoiceItemName+invoiceNumber);
// }
// // item.setPk_currtype("CNY");
// item.setPk_currtype(settlementCurrencyNcCode);
// item.setPurchaseorder("");
// item.setTaxrate(String.valueOf(item1.getTaxRate()));
// item.setQuantity_de("0");
// item.setMoney_de(String.valueOf(item1.getInvoiceValue()));
// item.setMoney_bal(String.valueOf(item1.getInvoiceValue()));
// BigDecimal tax_de=item1.getTaxAmount();
// BigDecimal notax_de=item1.getTaxFreeFee();
// item.setNotax_de(String.valueOf(notax_de));
// item.setLocal_tax_de(String.valueOf(tax_de));
// item.setTax_de(String.valueOf(tax_de));
// item.setPrice(String.valueOf(item1.getInvoiceValue()));
// item.setTaxprice(String.valueOf(item1.getInvoiceValue()));
//// 费用类别
// String feeType = item1.getFeeType();
// String serviceItemsCodeNc = billManageMapper.getServiceItemsCodeNc(feeType);
// if (serviceItemsCodeNc != null && !serviceItemsCodeNc.isEmpty()) {
// item.setDef75(serviceItemsCodeNc);
// } else {
// item.setDef75("T04");
// }
// String invoiceItem1 = item1.getInvoiceItem();
// if (invoiceItem1 != null && !invoiceItem1.isEmpty()) {
// String[] split = invoiceItem1.split(",");
// item.setDef29(split[0]);
// //item.setDef29(invoiceItem1);
// }
// if (nccodes != null && !nccodes.isEmpty()&&nccodes.size()>0) {
// item.setDef29(nccodes.get(0));
// }
// item.setTaxcodeid("ZL01");
// item.setInvoiceno(invoiceNumber);
// ysitemList.add(item);
// }
// }
// }
//
// Ysbodys bodys=new Ysbodys();
// bodys.setItem(ysitemList);
// Ysbillhead billhead=new Ysbillhead();
// billhead.setPk_group("CNK");
// if (orgCodeNc != null && !orgCodeNc.isEmpty()) {
// billhead.setPk_org(orgCodeNc);
// billhead.setSett_org(orgCodeNc);
// } else {
// billhead.setPk_org("NG04");
// billhead.setSett_org("NG04");
// }
// billhead.setCreationtime(dateString);
// billhead.setCreator(makerCodeNc);
// billhead.setPk_billtype("F0");
// billhead.setPk_tradetype("D0");
// billhead.setBillclass("ys");
// billhead.setIsinit("N");
// date=reconciliation.getCreateTime();
// dateString = sdf.format(date);
// billhead.setBilldate(dateString);
// billhead.setSyscode("0");
// billhead.setBillno("");
// billhead.setDef59("");
// billhead.setSrc_syscode("0");
// billhead.setBillstatus("0");
// billhead.setBillmaker(makerCodeNc);
// billhead.setPk_busitype("");
// billhead.setBillyear(sdf1.format(date));
// billhead.setBillperiod(sdf2.format(date));
// billhead.setEffectstatus("0");
// billhead.setDef28("nqyw");
// billhead.setDef29(reconciliation.getBillNumber());
// billhead.setBodys(bodys);
// Ysbill bill=new Ysbill();
// bill.setId("ys"+String.valueOf(reconciliation.getBillManageId())+"_"+count);
// bill.setBillhead(billhead);
// Ysufinterface ufinterface=new Ysufinterface();
// ufinterface.setAccount("NKNC");
// ufinterface.setBilltype("F0");
// ufinterface.setBusinessunitcode("");
// ufinterface.setFilename("");
// ufinterface.setIsexchange("Y");
// if (orgCodeNc != null && !orgCodeNc.isEmpty()) {
// ufinterface.setOrgcode(orgCodeNc);
// ufinterface.setReceiver(orgCodeNc);
// } else {
// ufinterface.setOrgcode("NG04");
// ufinterface.setReceiver("NG04");
// }
// ufinterface.setReplace("Y");
// ufinterface.setRoottag("");
// ufinterface.setSender("nqyw");
// ufinterface.setBill(bill);
// JAXBContext jaxbContext = JAXBContext.newInstance(Ysufinterface.class);
// Marshaller marshaller = jaxbContext.createMarshaller();
// marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
// marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); // 格式化输出可选
// StringWriter sw = new StringWriter();
// marshaller.marshal(ufinterface, sw);
// String xmlString = sw.toString(); // 这是要发送的XML字符串
// System.out.println(xmlString);
// NcLog ncLog=new NcLog();
// ncLog.setOrderId(reconciliation.getBillManageId());
// ncLog.setRequestBody(xmlString);
// ncLog.setResponeBody("");
// ncLog.setType(0L);
// ncLog.setSendTime(new Date());
// ncLog.setOrganizationId(reconciliation.getOrganizationId());
// ncLog.setOrganizationName(reconciliation.getOrganizationName());
// ncLog.setTopOrganizationId(reconciliation.getTopOrganizationId());
// ncLogMapper.insert(ncLog);
// reconciliation.setSynchronousStatus(1);
// reconciliation.setSynchronousTime(new Date());
// reconciliation.setNcId("ys"+String.valueOf(reconciliation.getBillManageId()));
// //reconciliationMapper.updateById(reconciliation);
// CloseableHttpClient httpClient = HttpClients.createDefault();
// HttpPost httpPost = new HttpPost(url);
// StringEntity postingString = new StringEntity(xmlString, "UTF-8");
// httpPost.setEntity(postingString);
// httpPost.setHeader("Content-type", "application/xml");
// try {
// CloseableHttpResponse response = httpClient.execute(httpPost);
// String responseString = EntityUtils.toString(response.getEntity());
// System.out.println(responseString);
// ncLog.setResponeBody(responseString);
// // 创建DOM解析器
// DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
// DocumentBuilder builder = factory.newDocumentBuilder();
// Document document = builder.parse(new InputSource(new StringReader(responseString)));
//
// // 获取根元素
// Element root = document.getDocumentElement();
//
// // 获取ufinterface元素的属性
// String billtype = root.getAttribute("billtype");
// String filename = root.getAttribute("filename");
// System.out.println("billtype: " + billtype);
// System.out.println("filename: " + filename);
//
// // 获取sendresult节点
// NodeList sendResultList = root.getElementsByTagName("sendresult");
// if (sendResultList.getLength() > 0) {
// Element sendResult = (Element) sendResultList.item(0);
//
// // 获取子元素内容
// String bdocid = sendResult.getElementsByTagName("bdocid").item(0).getTextContent();
// String resultcode = sendResult.getElementsByTagName("resultcode").item(0).getTextContent();
// String content = sendResult.getElementsByTagName("content").item(0).getTextContent();
//
// System.out.println("bdocid: " + bdocid);
// System.out.println("resultcode: " + resultcode);
// System.out.println("content: " + content);
// if(resultcode.equals("1")){
// reconciliation.setSynchronousStatus(1);
// }else{
// reconciliation.setSynchronousStatus(2);
// }
// }
// ncLogMapper.updateById(ncLog);
// billManageMapper.updateById(reconciliation);
// response.close();
// } catch (Exception e) {
// reconciliation.setSynchronousStatus(2);
// billManageMapper.updateById(reconciliation);
// e.printStackTrace();
// } finally {
// try {
// httpClient.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
// }
// } else {
// reconciliation.setSynchronousStatus(2);
// billManageMapper.updateById(reconciliation);
// }
// } catch (JAXBException e) {
// reconciliation.setSynchronousStatus(2);
// billManageMapper.updateById(reconciliation);
// e.printStackTrace();
// } catch (JsonMappingException e) {
// throw new RuntimeException(e);
// } catch (JsonProcessingException e) {
// throw new RuntimeException(e);
// }
// return true;
// }
@Override
public boolean synchronousNcSK(String businessDocumentDetaliIds) {
String [] businessDocumentDetaliIdArray=businessDocumentDetaliIds.split(",");
@@ -842,45 +500,14 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy");
SimpleDateFormat sdf2 = new SimpleDateFormat("MM");
String dateString = sdf.format(date);
List<BillDetail> billDetails = billDetailService.list(new LambdaQueryWrapper<BillDetail>()
.eq(BillDetail::getBillManageId, reconciliation.getBillManageId())
.eq(BillDetail::getDelFlag, 1));
//保存税额等
double allTaxRate = 0.0d;
BigDecimal allTaxAmount = BigDecimal.ZERO;
BigDecimal allTaxFreeFee = BigDecimal.ZERO;
for (BillDetail item : billDetails) {
String firstSubjectCode = item.getInvoiceItem();
Double taxRate = billDetailMapper.getTaxRate(firstSubjectCode);
BigDecimal amount = item.getBillingAmount();
BigDecimal taxAmount = amount.divide(BigDecimal.ONE.add(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))),10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal taxFreeFee = amount.subtract(taxAmount);
if (item.getTaxAmount() == null) {
item.setTaxAmount(taxAmount);
}
if (item.getTaxFreeFee() == null) {
item.setTaxFreeFee(taxFreeFee);
}
if (item.getTaxRate() == null) {
item.setTaxRate(taxRate);
}
allTaxRate += taxRate;
allTaxAmount = allTaxAmount.add(taxAmount);
allTaxFreeFee = allTaxFreeFee.add(taxFreeFee);
}
if (reconciliation.getTaxRate() == null) {
reconciliation.setTaxRate(allTaxRate);
}
if (reconciliation.getTaxAmount() == null) {
reconciliation.setTaxAmount(allTaxAmount);
}
if (reconciliation.getTaxFreeFee() == null) {
reconciliation.setTaxFreeFee(allTaxFreeFee);
}
String invoiceId = reconciliation.getInvoiceId();
ReconciliationDTO makeQuery=new ReconciliationDTO();
makeQuery.setInnerNumber(invoiceId);
List<BmsMakeOutInvoice> bmsMakeOutInvoices = bmsMakeOutInvoiceMapper.selectList(new LambdaQueryWrapper<BmsMakeOutInvoice>().eq(BmsMakeOutInvoice::getInvoiceId, invoiceId));
if (bmsMakeOutInvoices != null && bmsMakeOutInvoices.size() > 0) {
int count= 0;
for (BmsMakeOutInvoice make : bmsMakeOutInvoices) {
count++;
List<SKitem> ysitemList=new ArrayList<SKitem>();
ReconciliationDTO reconciliationDTO=new ReconciliationDTO();
reconciliationDTO.setInnerNumber(reconciliation.getBillNumber());
@@ -896,23 +523,24 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
billManageMapper.updateById(reconciliation);
throw new ServiceException("未找到该组织的推送地址!");
}
List<BmsMakeOutInvoiceItem> bmsMakeOutInvoiceItems = bmsMakeOutInvoiceItemMapper.selectList(new LambdaQueryWrapper<BmsMakeOutInvoiceItem>().eq(BmsMakeOutInvoiceItem::getMakeId, make.getId()));
String makerCodeNc = "";
if(billDetails != null && billDetails.size() > 0){
if(ObjectUtil.isNotNull(billDetails)){
if(bmsMakeOutInvoiceItems != null && bmsMakeOutInvoiceItems.size() > 0){
if(ObjectUtil.isNotNull(bmsMakeOutInvoiceItems)){
// 汇总 list invoiceValue 的总值
BigDecimal totalInvoiceValue = billDetails.stream()
.map(BillDetail::getBillingAmount)
BigDecimal totalInvoiceValue = bmsMakeOutInvoiceItems.stream()
.map(BmsMakeOutInvoiceItem::getInvoiceValue)
.filter(java.util.Objects::nonNull)
.reduce(BigDecimal.ZERO, BigDecimal::add);
// feeType 拼接起来
String feeTypes = billDetails.stream()
.map(BillDetail::getInvoiceItemName)
String feeTypes = bmsMakeOutInvoiceItems.stream()
.map(BmsMakeOutInvoiceItem::getFeeType)
.filter(java.util.Objects::nonNull)
.collect(java.util.stream.Collectors.joining(""));
// createTime 倒序排序并获取第一条记录
BillDetail firstItem = billDetails.stream()
BmsMakeOutInvoiceItem firstItem = bmsMakeOutInvoiceItems.stream()
.sorted((a, b) -> {
if (a.getCreateTime() == null) return 1;
if (b.getCreateTime() == null) return -1;
@@ -926,18 +554,8 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
String deptName = billManageMapper.getDeptName(customerUserDept);
String salespersonNcCode = billManageMapper.getsalespersonNcCode(salesmanId);
String salesmanCodeNc=salespersonNcCode;
Long settlementCustomersId = reconciliation.getSettlementCustomersId();
SettlementCustomers settlementCustomers = settlementCustomersService.getById(settlementCustomersId);
if (settlementCustomers==null){
throw new ServiceException("结算对象未找到!");
}
Long settlementEntityId = settlementCustomers.getSettlementEntityId();
Long shipperId = billManageMapper.getShipperId(settlementEntityId, organizationId);
if (shipperId==null||shipperId==0){
throw new ServiceException("结算对象未找到!");
}
String appointShipper=settlementCustomers.getSettlementEntity();
String actualInvoiceCustomerId = String.valueOf(shipperId);
String appointShipper=make.getActualInvoiceCustomerName();
String actualInvoiceCustomerId = make.getActualInvoiceCustomerId();
String customerCodeNc = billManageMapper.getCustomerCodeNc(actualInvoiceCustomerId);
String customerCodeNcJson = billManageMapper.getCustomerCodeNcJson(actualInvoiceCustomerId);
if (customerCodeNcJson != null && !customerCodeNcJson.isEmpty()) {
@@ -1006,11 +624,7 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
String[] split = invoiceItem1.split(",");
item.setDef29(split[0]);
}
if (settlementCurrencyNcCode != null && !settlementCurrencyNcCode.isEmpty()) {
item.setPk_currtype(settlementCurrencyNcCode);
} else {
item.setPk_currtype("CNY");
}
item.setMoney_cr(String.valueOf(totalInvoiceValue));
item.setMoney_bal(String.valueOf(totalInvoiceValue));
ysitemList.add(item);
@@ -1047,7 +661,7 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
billhead.setDef29(reconciliation.getBillNumber());
billhead.setBodys(bodys);
SKbill bill=new SKbill();
bill.setId("sk"+String.valueOf(reconciliation.getBillManageId())+"_"+1);
bill.setId("sk"+String.valueOf(reconciliation.getBillManageId())+"_"+count);
bill.setBillhead(billhead);
SKufinterface ufinterface=new SKufinterface();
ufinterface.setAccount("NKNC");
@@ -1148,8 +762,11 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
}
}
}
} else {
reconciliation.setSkSynchronousStatus(2);
billManageMapper.updateById(reconciliation);
}
} catch (JAXBException e) {
reconciliation.setSkSynchronousStatus(2);
billManageMapper.updateById(reconciliation);
@@ -1162,297 +779,6 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
return true;
}
//按发票推送版本
// public boolean synchronousNcSK_TY(String businessDocumentDetaliId) {
// BillManage reconciliation=billManageMapper.selectById(businessDocumentDetaliId);
// if(reconciliation.getSkSynchronousStatus()==1){
// throw new ServiceException("该记录已同步,不需要再次同步");
// }
// try {
// Date date = reconciliation.getCreateTime();
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy");
// SimpleDateFormat sdf2 = new SimpleDateFormat("MM");
// String dateString = sdf.format(date);
// String invoiceId = reconciliation.getInvoiceId();
// ReconciliationDTO makeQuery=new ReconciliationDTO();
// makeQuery.setInnerNumber(invoiceId);
// List<BmsMakeOutInvoice> bmsMakeOutInvoices = bmsMakeOutInvoiceMapper.selectList(new LambdaQueryWrapper<BmsMakeOutInvoice>().eq(BmsMakeOutInvoice::getInvoiceId, invoiceId));
// if (bmsMakeOutInvoices != null && bmsMakeOutInvoices.size() > 0) {
// int count= 0;
// for (BmsMakeOutInvoice make : bmsMakeOutInvoices) {
// count++;
// List<SKitem> ysitemList=new ArrayList<SKitem>();
// ReconciliationDTO reconciliationDTO=new ReconciliationDTO();
// reconciliationDTO.setInnerNumber(reconciliation.getBillNumber());
// String url = "";
// Long organizationId = reconciliation.getOrganizationId();
// String orgCodeNc = billManageMapper.getOrgCodeNc(organizationId);
// String organizationName = reconciliation.getOrganizationName();
// String ncUrl = billManageMapper.getNcUrl("nc", organizationName, organizationId);
// if (ncUrl!=null&&ncUrl!="") {
// url = ncUrl;
// } else {
// reconciliation.setSkSynchronousStatus(2);
// billManageMapper.updateById(reconciliation);
// throw new ServiceException("未找到该组织的推送地址!");
// }
// List<BmsMakeOutInvoiceItem> bmsMakeOutInvoiceItems = bmsMakeOutInvoiceItemMapper.selectList(new LambdaQueryWrapper<BmsMakeOutInvoiceItem>().eq(BmsMakeOutInvoiceItem::getMakeId, make.getId()));
// String makerCodeNc = "";
// if(bmsMakeOutInvoiceItems != null && bmsMakeOutInvoiceItems.size() > 0){
// if(ObjectUtil.isNotNull(bmsMakeOutInvoiceItems)){
// // 汇总 list invoiceValue 的总值
// BigDecimal totalInvoiceValue = bmsMakeOutInvoiceItems.stream()
// .map(BmsMakeOutInvoiceItem::getInvoiceValue)
// .filter(java.util.Objects::nonNull)
// .reduce(BigDecimal.ZERO, BigDecimal::add);
//
// // feeType 拼接起来
// String feeTypes = bmsMakeOutInvoiceItems.stream()
// .map(BmsMakeOutInvoiceItem::getFeeType)
// .filter(java.util.Objects::nonNull)
// .collect(java.util.stream.Collectors.joining(""));
//
// // createTime 倒序排序并获取第一条记录
// BmsMakeOutInvoiceItem firstItem = bmsMakeOutInvoiceItems.stream()
// .sorted((a, b) -> {
// if (a.getCreateTime() == null) return 1;
// if (b.getCreateTime() == null) return -1;
// return b.getCreateTime().compareTo(a.getCreateTime());
// })
// .findFirst()
// .orElse(null);
// String salesmanId = reconciliation.getSalesmanId();
// String customerUserDept = billManageMapper.getCustomerUserDept(salesmanId);
// String deptValue = billManageMapper.getDeptValue(customerUserDept);
// String deptName = billManageMapper.getDeptName(customerUserDept);
// String salespersonNcCode = billManageMapper.getsalespersonNcCode(salesmanId);
// String salesmanCodeNc=salespersonNcCode;
// String appointShipper=make.getActualInvoiceCustomerName();
// String actualInvoiceCustomerId = make.getActualInvoiceCustomerId();
// String customerCodeNc = billManageMapper.getCustomerCodeNc(actualInvoiceCustomerId);
// String customerCodeNcJson = billManageMapper.getCustomerCodeNcJson(actualInvoiceCustomerId);
// if (customerCodeNcJson != null && !customerCodeNcJson.isEmpty()) {
// ObjectMapper objectMapper = new ObjectMapper();
// List<Map<String, Object>> listNc = objectMapper.readValue(
// customerCodeNcJson,
// new TypeReference<List<Map<String, Object>>>() {}
// );
// if (listNc != null && listNc.size() > 0) {
// Map<String, Object> targetMap = listNc.stream()
// .filter(map -> {
// Object codeObj = map.get("code");
// return codeObj != null && codeObj.toString().equals(reconciliation.getOrganizationId().toString());
// })
// .findFirst()
// .orElse(null);
// if (targetMap != null) {
// customerCodeNc = (String) targetMap.get("ncCustomer");
// }
// }
// }
// String documentPreparerNcCode = billManageMapper.getDocumentPreparerNcCode(salesmanId);
// String settlementCurrency=reconciliation.getSettlementCurrency();
// String settlementCurrencyNcCode = settlementCurrency;
// makerCodeNc=documentPreparerNcCode;
// SKitem item=new SKitem();
// if (deptValue != null && !deptValue.isEmpty()) {
// item.setSo_deptid(deptValue);
// } else {
// item.setSo_deptid("NG0408");
// }
// if (deptValue != null && !deptValue.isEmpty()) {
// item.setPk_deptid(deptValue);
// } else {
// item.setPk_deptid("NG0408");
// }
// item.setCheckdirection("ar");
// item.setPk_psndoc(salesmanCodeNc);
// item.setCustomer(customerCodeNc);
// item.setPurchaseorder("");
// item.setObjtype("0");
// item.setDirection("1");
// if (deptName != null && !deptName.isEmpty()) {
// if (feeTypes != null && !feeTypes.isEmpty()) {
// item.setScomment(deptName+""+appointShipper+feeTypes);
// } else {
// item.setScomment(deptName+""+appointShipper+feeTypes);
// }
// } else {
// if (feeTypes != null && !feeTypes.isEmpty()) {
// item.setScomment("业务部:"+appointShipper+feeTypes);
// } else {
// item.setScomment("业务部:"+appointShipper+feeTypes);
// }
// }
// // 费用类别
// String feeType = firstItem.getFeeType();
// String serviceItemsCodeNc = billManageMapper.getServiceItemsCodeNc(feeType);
// if (serviceItemsCodeNc != null && !serviceItemsCodeNc.isEmpty()) {
// item.setDef75(serviceItemsCodeNc);
// } else {
// item.setDef75("T10");
// }
// String invoiceItem1 = firstItem.getInvoiceItem();
// if (invoiceItem1 != null && !invoiceItem1.isEmpty()) {
// String[] split = invoiceItem1.split(",");
// item.setDef29(split[0]);
// }
// item.setPk_currtype(settlementCurrencyNcCode);
// item.setMoney_cr(String.valueOf(totalInvoiceValue));
// item.setMoney_bal(String.valueOf(totalInvoiceValue));
// ysitemList.add(item);
// }
// }
// SKbodys bodys=new SKbodys();
// bodys.setItem(ysitemList);
// SKbillhead billhead=new SKbillhead();
// billhead.setPk_group("CNK");
// if (orgCodeNc != null && !orgCodeNc.isEmpty()) {
// billhead.setPk_org(orgCodeNc);
// billhead.setSett_org(orgCodeNc);
// } else {
// billhead.setPk_org("NG04");
// billhead.setSett_org("NG04");
// }
// billhead.setCreationtime(dateString);
// billhead.setPk_billtype("F2");
// billhead.setCreator(makerCodeNc);
// billhead.setPk_tradetype("D2");
// billhead.setBillclass("sk");
// billhead.setBilldate(dateString);
// billhead.setSyscode("0");
// billhead.setBillno("");
// billhead.setDef59("");
// billhead.setSrc_syscode("0");
// billhead.setBillstatus("0");
// billhead.setBillmaker(makerCodeNc);
// billhead.setPk_busitype("");
// billhead.setBillyear(sdf1.format(date));
// billhead.setBillperiod(sdf2.format(date));
// billhead.setEffectstatus("0");
// billhead.setDef28("nqyw");
// billhead.setDef29(reconciliation.getBillNumber());
// billhead.setBodys(bodys);
// SKbill bill=new SKbill();
// bill.setId("sk"+String.valueOf(reconciliation.getBillManageId())+"_"+count);
// bill.setBillhead(billhead);
// SKufinterface ufinterface=new SKufinterface();
// ufinterface.setAccount("NKNC");
// ufinterface.setBilltype("F2");
// ufinterface.setBusinessunitcode("");
// ufinterface.setFilename("");
// ufinterface.setIsexchange("Y");
// if (orgCodeNc != null && !orgCodeNc.isEmpty()) {
// ufinterface.setOrgcode(orgCodeNc);
// ufinterface.setReceiver(orgCodeNc);
// } else {
// ufinterface.setOrgcode("NG04");
// ufinterface.setReceiver("NG04");
// }
// ufinterface.setReplace("Y");
// ufinterface.setRoottag("");
// ufinterface.setSender("nqyw");
// ufinterface.setBill(bill);
// JAXBContext jaxbContext = null;
// //String xmlString ="<ufinterface account=\"NKNC\" billtype=\"F0\" businessunitcode=\"\" filename=\"\" groupcode=\"CNK\" isexchange=\"Y\" orgcode=\"NG10\" receiver=\"NG10\" replace=\"Y\" roottag=\"\" sender=\"NKT_MY\">";
// jaxbContext = JAXBContext.newInstance(SKufinterface.class);
// Marshaller marshaller = jaxbContext.createMarshaller();
// marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
// marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); // 格式化输出可选
// StringWriter sw = new StringWriter();
// marshaller.marshal(ufinterface, sw);
// String xmlString = sw.toString(); // 这是要发送的XML字符串
// System.out.println(xmlString);
// NcLog ncLog=new NcLog();
// ncLog.setOrderId(reconciliation.getBillManageId());
// ncLog.setRequestBody(xmlString);
// ncLog.setResponeBody("");
// ncLog.setType(1L);
// ncLog.setSendTime(new Date());
// ncLog.setOrganizationId(reconciliation.getOrganizationId());
// ncLog.setOrganizationName(reconciliation.getOrganizationName());
// ncLog.setTopOrganizationId(reconciliation.getTopOrganizationId());
// ncLogMapper.insert(ncLog);
// reconciliation.setSkSynchronousStatus(1);
// reconciliation.setSkSynchronousTime(new Date());
// reconciliation.setSkNcId("sk"+String.valueOf(reconciliation.getBillManageId()));
// //reconciliationMapper.updateById(reconciliation);
// CloseableHttpClient httpClient = HttpClients.createDefault();
// HttpPost httpPost = new HttpPost(url);
// StringEntity postingString = new StringEntity(xmlString, "UTF-8");
// httpPost.setEntity(postingString);
// httpPost.setHeader("Content-type", "application/xml");
// try {
// CloseableHttpResponse response = httpClient.execute(httpPost);
// String responseString = EntityUtils.toString(response.getEntity());
// System.out.println(responseString);
// ncLog.setResponeBody(responseString);
// // 创建DOM解析器
// DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
// DocumentBuilder builder = factory.newDocumentBuilder();
// Document document = builder.parse(new InputSource(new StringReader(responseString)));
//
// // 获取根元素
// Element root = document.getDocumentElement();
//
// // 获取ufinterface元素的属性
// String billtype = root.getAttribute("billtype");
// String filename = root.getAttribute("filename");
// System.out.println("billtype: " + billtype);
// System.out.println("filename: " + filename);
//
// // 获取sendresult节点
// NodeList sendResultList = root.getElementsByTagName("sendresult");
// if (sendResultList.getLength() > 0) {
// Element sendResult = (Element) sendResultList.item(0);
//
// // 获取子元素内容
// String bdocid = sendResult.getElementsByTagName("bdocid").item(0).getTextContent();
// String resultcode = sendResult.getElementsByTagName("resultcode").item(0).getTextContent();
// String content = sendResult.getElementsByTagName("content").item(0).getTextContent();
//
// System.out.println("bdocid: " + bdocid);
// System.out.println("resultcode: " + resultcode);
// System.out.println("content: " + content);
// if(resultcode.equals("1")){
// reconciliation.setSkSynchronousStatus(1);
// }else{
// reconciliation.setSkSynchronousStatus(2);
// }
// }
// ncLogMapper.updateById(ncLog);
// billManageMapper.updateById(reconciliation);
// response.close();
// } catch (Exception e) {
// reconciliation.setSkSynchronousStatus(2);
// billManageMapper.updateById(reconciliation);
// e.printStackTrace();
// } finally {
// try {
// httpClient.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
//
// }
// } else {
// reconciliation.setSkSynchronousStatus(2);
// billManageMapper.updateById(reconciliation);
// }
// } catch (JAXBException e) {
// reconciliation.setSkSynchronousStatus(2);
// billManageMapper.updateById(reconciliation);
// e.printStackTrace();
// } catch (JsonMappingException e) {
// throw new RuntimeException(e);
// } catch (JsonProcessingException e) {
// throw new RuntimeException(e);
// }
// return true;
// }
@Override
public int editIsInvoice(String billNumber, Integer isInvoice, String invoiceId, String invoiceMakeTime,String applyNumber) {
@@ -264,6 +264,4 @@ public class BillManageDO extends BaseVOEntity{
private String paymentAccountId;
@ApiModelProperty("收款帐户名称")
private String paymentAccountName;
@ApiModelProperty("业务员ID")
private String salesmanId;
}
@@ -100,10 +100,6 @@ public class BillingStatementPO extends BaseVOEntity{
@Excel(name = "收支类型", readConverterExp = "1=-应收,2-应付")
private Integer accountExpenseType;
@ApiModelProperty("收支类型(1-应收,2-应付)")
@Excel(name = "收支类型", readConverterExp = "1=-应收,2-应付")
private Integer billType;
@ApiModelProperty("流水备注")
@Excel(name = "流水备注")
private String billingRemark;
@@ -101,10 +101,6 @@ public class BillingStatementDO extends BaseVOEntity{
@Excel(name = "收支类型", readConverterExp = "1=-应收,2-应付")
private Integer accountExpenseType;
@ApiModelProperty("收支类型(1-应收,2-应付)")
@Excel(name = "收支类型", readConverterExp = "1=-应收,2-应付")
private Integer billType;
@ApiModelProperty("流水备注")
@Excel(name = "流水备注")
private String billingRemark;
@@ -1,145 +0,0 @@
package com.mhd.bms.interfaces.dto.billManage;
import com.mhd.common.core.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
@Data
@ApiModel(value = "应收账单导出对象")
public class BillManageExportVO {
/** ====== 原有账单头字段(与 BillManagePO 的 @Excel 一致) ====== */
@Excel(name = "一级组织表ID")
private Long topOrganizationId;
@Excel(name = "组织表ID")
private Long organizationId;
@Excel(name = "组织名称")
private String organizationName;
@Excel(name = "账单编号")
private String billNumber;
@Excel(name = "账单类型", readConverterExp = "1=-应收,2-应付")
private Integer billType;
@Excel(name = "账单状态", readConverterExp = "1=-未确认,2-对账中,3-未收款/付款,4-部分收款/付款,5-已收款/付款,6-已作废,7-已退款")
private Integer billState;
@Excel(name = "账单流程节点", readConverterExp = "1=-发起对账,2-客户确认,3-财务审核,4-收款/付款")
private Integer billStep;
@Excel(name = "系统来源")
private String belongModule;
@Excel(name = "系统来源code")
private String belongModuleCode;
@Excel(name = "结算对象id")
private Long settlementCustomersId;
@Excel(name = "结算对象code")
private String settlementCustomersCode;
@Excel(name = "结算对象")
private String settlementEntity;
@Excel(name = "账单总金额")
private BigDecimal billTotalAmount;
@Excel(name = "优惠金额")
private BigDecimal billDiscountAmount;
@Excel(name = "账单金额")
private BigDecimal billAmount;
@Excel(name = "已收/付金额")
private BigDecimal billAmountSettlement;
@Excel(name = "未收/付金额")
private BigDecimal billAmountUnsettled;
@Excel(name = "期望金额")
private BigDecimal billExpectedAmount;
@Excel(name = "对账状态", readConverterExp = "1=-暂未确认,2-申请调账,3-财务调账,4-核对无误")
private Integer reconciliationStatus;
@Excel(name = "对账意见描述")
private String reconciliationOpinion;
@Excel(name = "客户凭证地址")
private String voucherAddress;
@Excel(name = "财务审核结果(1-同意,2-拒绝)")
private Integer financialReviewFlag;
@Excel(name = "审核意见描述")
private String financialReviewOpinion;
@Excel(name = "周期开始时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date cycleBeginTime;
@Excel(name = "周期结束时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date cycleEndTime;
@Excel(name = "收款/付款时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date settlementTime;
@Excel(name = "备注")
private String billRemark;
@Excel(name = "折扣百分比")
private BigDecimal billDiscount;
@Excel(name = "折扣上限金额")
private BigDecimal billDiscountLimit;
@Excel(name = "费用计算精度code")
private String costAccuracyCode;
@Excel(name = "费用计算精度name")
private String costAccuracyName;
@Excel(name = "尾数计算code")
private String tailCalculationCode;
@Excel(name = "尾数计算name")
private String tailCalculationName;
@Excel(name = "账单金额精度code")
private String amountAccuracyCode;
@Excel(name = "账单金额精度name")
private String amountAccuracyName;
/** ====== 新增明细字段(来源于 bill_detail + billing_statement ====== */
@Excel(name = "费用类别")
private String feeType;
@Excel(name = "费用类型code")
private String serviceItemsCode;
@Excel(name = "费用类型")
private String serviceItemsName;
@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 BigDecimal billingAmount;
}
@@ -102,10 +102,6 @@ public class BillingStatementDTO extends BaseVOEntity{
@Excel(name = "收支类型", readConverterExp = "1=-应收,2-应付")
private Integer accountExpenseType;
@ApiModelProperty("收支类型(1-应收,2-应付)")
@Excel(name = "收支类型", readConverterExp = "1=-应收,2-应付")
private Integer billType;
@ApiModelProperty("流水备注")
@Excel(name = "流水备注")
private String billingRemark;
@@ -6,8 +6,6 @@ import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.io.IOException;
import java.net.URLEncoder;
import com.mhd.bms.application.server.billManage.BillManageApplicationService;
import com.mhd.bms.domain.billManage.repository.po.BillDetailPO;
@@ -15,9 +13,7 @@ import com.mhd.bms.domain.billingStatement.repository.todo.BillingStatementDO;
import com.mhd.bms.domain.ncLog.entity.NcLog;
import com.mhd.bms.infrastructure.utils.UniqueKeyUtil;
import com.mhd.bms.interfaces.dto.billingStatement.BillingStatementDTO;
import com.mhd.bms.interfaces.dto.billManage.BillManageExportVO;
import com.mhd.common.core.exception.ServiceException;
import com.mhd.common.core.utils.poi.ExcelUtil;
import com.mhd.common.log.annotation.Log;
import com.mhd.common.log.enums.BusinessType;
import com.mhd.common.redis.enums.RedisLockTypeEnum;
@@ -35,7 +31,6 @@ import com.mhd.bms.domain.billManage.repository.todo.BillManageDO;
import com.mhd.bms.domain.billManage.repository.po.BillManagePO;
import com.mhd.bms.interfaces.assembler.billManage.BillManageAssembler;
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;
@@ -84,55 +79,6 @@ public class BillManageApi extends BaseController{
return AjaxResult.success(billManageApplicationService.listCount(billManageDO));
}
@ApiOperation("导出应收账单")
@GetMapping(value = "/exportReceivableList", produces = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
public void exportReceivableList(BillManageDTO billManageDTO, HttpServletResponse response) throws IOException
{
//转换实体
BillManageDO billManageDO = new BillManageDO();
BeanUtils.copyProperties(billManageDTO,billManageDO);
billManageDO.setBillType(1);
//查全部不分页
List<BillManagePO> list = billManageApplicationService.queryList(billManageDO);
//扁平化处理一条明细生成一行
List<BillManageExportVO> exportList = new ArrayList<>();
for (BillManagePO bill : list) {
List<BillDetailPO> details = bill.getBillDetailPOList();
if (details != null && !details.isEmpty()) {
for (BillDetailPO detail : details) {
BillManageExportVO vo = new BillManageExportVO();
//复制全部账单头字段
BeanUtils.copyProperties(bill, vo);
//覆盖明细字段
vo.setFeeType(detail.getFeeType());
vo.setServiceItemsCode(detail.getServiceItemsCode());
vo.setServiceItemsName(detail.getServiceItemsName());
vo.setFirstSubjectCode(detail.getFirstSubjectCode());
vo.setFirstSubjectName(detail.getFirstSubjectName());
vo.setSecondSubjectCode(detail.getSecondSubjectCode());
vo.setSecondSubjectName(detail.getSecondSubjectName());
vo.setBillingAmount(detail.getBillingAmount());
exportList.add(vo);
}
} else {
//没有明细也要有一行
BillManageExportVO vo = new BillManageExportVO();
BeanUtils.copyProperties(bill, vo);
exportList.add(vo);
}
}
//设置下载头防止浏览器乱码
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<BillManageExportVO> util = new ExcelUtil<>(BillManageExportVO.class);
util.exportExcel(response, exportList, "应收账单");
}
@ApiOperation("获取nc推送日志")
@GetMapping(value = "/getNcLog")
public AjaxResult getNcLog(@RequestParam(name = "billManageId") Long billManageId, @RequestParam(name = "type") Long type)
@@ -312,7 +258,7 @@ public class BillManageApi extends BaseController{
}
@ApiOperation("复制账单-获取原账单数据用于回显")
@ApiOperation("复制账单")
@PostMapping("/copyBill")
public AjaxResult copyBill(@RequestBody BillManageDTO billManageDTO)
{
@@ -320,8 +266,8 @@ public class BillManageApi extends BaseController{
throw new ServiceException("原账单id不能为空");
}
try {
BillManagePO result = billManageApplicationService.copyBill(billManageDTO);
return AjaxResult.success(result);
Boolean result = billManageApplicationService.copyBill(billManageDTO);
return toAjax(result);
}catch (Exception e){
return AjaxResult.error("复制账单失败:"+e.getMessage());
}
+4 -4
View File
@@ -18,15 +18,15 @@ spring:
discovery:
# server-addr: 127.0.0.1:8848
# 线上测试环境配置 容器名+端口号
server-addr: 10.33.0.129:6010
# server-addr: 10.102.192.30:6848
# server-addr: 10.33.0.129:6010
server-addr: 10.102.192.30: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
# server-addr: 10.33.0.129:6010
server-addr: 10.102.192.30:6848
username: nacos
password: manhuoda@2023
group: DEFAULT_GROUP # 默认分组就是DEFAULT_GROUP,如果使用默认分组可以不配置
@@ -27,35 +27,5 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND bd.bill_manage_id = #{billManageId}
</select>
<select id="getDetailsByBillManageIdAndGroup" resultType="com.mhd.bms.domain.billManage.entity.BillDetail" parameterType="java.lang.Long">
SELECT
SUM(BILLING_AMOUNT) as BILLING_AMOUNT,
SUM(TAX_AMOUNT) as TAX_AMOUNT,
SUM(TAX_FREE_FEE) as TAX_FREE_FEE,
AVG(TAX_RATE) as TAX_RATE,
BILL_MANAGE_ID as BILL_MANAGE_ID,
TOP_ORGANIZATION_ID as TOP_ORGANIZATION_ID,
ORGANIZATION_NAME,
INVOICE_ITEM,
INVOICE_ITEM_NAME,
FEE_TYPE,
BILL_NUMBER
FROM
bill_detail
WHERE
del_flag = 1
AND bill_manage_id = #{billManageId} GROUP BY INVOICE_ITEM,INVOICE_ITEM_NAME,FEE_TYPE
</select>
<select id="getTaxRate" resultType="java.lang.Double" parameterType="java.lang.String">
SELECT
rate
FROM
NGWL_TEST_SYSTEM.EXPENSE_ACCOUNT
WHERE
del_flag = 1
AND SUBJECT_CODE = #{code}
</select>
</mapper>
@@ -162,8 +162,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT NC_CODE FROM NGWL_TEST_PRODUCT."SYS_ORGANIZATION" where DEL_FLAG = 1 and organization_id = #{organizationId} limit 1
</select>
<select id="getShipperId" resultType="java.lang.Long">
SELECT SHIPPER_ID FROM NGWL_TEST_USER."USER_SHIPPER" where DEL_FLAG = '1' and user_id = #{userId} and organization_id = #{organizationId} limit 1
</select>
</mapper>
@@ -89,21 +89,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="billingRulesDO.serviceItemsCode != null and billingRulesDO.serviceItemsCode != ''">
and service_items_code = #{billingRulesDO.serviceItemsCode}
</if>
<if test="billingRulesDO.serviceItemsName != null and billingRulesDO.serviceItemsName != ''">
and service_items_name like concat('%',#{billingRulesDO.serviceItemsName},'%')
</if>
<if test="billingRulesDO.firstSubjectCode != null and billingRulesDO.firstSubjectCode != ''">
and first_subject_code = #{billingRulesDO.firstSubjectCode}
</if>
<if test="billingRulesDO.firstSubjectName != null and billingRulesDO.firstSubjectName != ''">
and first_subject_name like concat('%',#{billingRulesDO.firstSubjectName},'%')
</if>
<if test="billingRulesDO.secondSubjectCode != null and billingRulesDO.secondSubjectCode != ''">
and second_subject_code = #{billingRulesDO.secondSubjectCode}
</if>
<if test="billingRulesDO.secondSubjectName != null and billingRulesDO.secondSubjectName != ''">
and second_subject_name like concat('%',#{billingRulesDO.secondSubjectName},'%')
</if>
<if test="billingRulesDO.billingRulesState != null">
and billing_rules_state = #{billingRulesDO.billingRulesState}
</if>
@@ -166,18 +166,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="businessDocumentDO.contractName != null and businessDocumentDO.contractName != ''">
AND contract_name like concat('%', #{businessDocumentDO.contractName}, '%')
</if>
<!-- <if test="businessDocumentDO.billAmount != null and businessDocumentDO.billAmount != ''">-->
<!-- AND bill_amount like concat('%', #{businessDocumentDO.billAmount}, '%')-->
<!-- </if>-->
<if test="businessDocumentDO.billAmount != null and businessDocumentDO.billAmount != ''">
and bill_amount = #{businessDocumentDO.billAmount}
AND bill_amount like concat('%', #{businessDocumentDO.billAmount}, '%')
</if>
<if test="businessDocumentDO.estimatedCost != null and businessDocumentDO.estimatedCost != ''">
AND estimated_cost = #{businessDocumentDO.estimatedCost}
AND estimated_cost like concat('%', #{businessDocumentDO.estimatedCost}, '%')
</if>
<!-- <if test="businessDocumentDO.estimatedCost != null and businessDocumentDO.estimatedCost != ''">-->
<!-- AND estimated_cost like concat('%', #{businessDocumentDO.estimatedCost}, '%')-->
<!-- </if>-->
<if test="businessDocumentDO.firstSubjectName != null and businessDocumentDO.firstSubjectName != ''">
AND first_subject_name like concat('%', #{businessDocumentDO.firstSubjectName}, '%')
</if>
@@ -199,9 +193,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="businessDocumentDO.documentTypeCode != null and businessDocumentDO.documentTypeCode != ''">
AND document_type_code = #{businessDocumentDO.documentTypeCode}
</if>
<if test="businessDocumentDO.salesmanId != null and businessDocumentDO.salesmanId != ''">
AND document_type_code = #{businessDocumentDO.salesmanId}
</if>
<if test="businessDocumentDO.businessDocumentIdSet != null">
and business_document_id in
<foreach item="id" collection="businessDocumentDO.businessDocumentIdSet" open="(" separator="," close=")">
@@ -200,6 +200,10 @@
<if test="settlementCustomersDO.organizationId != null">
AND (
a.organization_id = #{settlementCustomersDO.organizationId}
OR b.org_code LIKE concat('%"code":"', #{settlementCustomersDO.organizationId}, '"%')
OR b.org_code LIKE concat('%code:', #{settlementCustomersDO.organizationId}, '%')
OR b.org_code LIKE concat('%code: ', #{settlementCustomersDO.organizationId}, '%')
OR b.org_code LIKE concat('%"code":', #{settlementCustomersDO.organizationId}, '%')
)
</if>
<if test="settlementCustomersDO.topOrganizationId != null and settlementCustomersDO.topOrganizationId != ''">
@@ -1,71 +0,0 @@
package com.mhd.oms.domain.electronicSignature.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.mhd.common.core.web.domain.BaseVOEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* 电子签名主表 electronic_signature
*/
@Data
@TableName("ELECTRONIC_SIGNATURE")
public class ElectronicSignature extends BaseVOEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty("签名ID")
@TableId(type = IdType.INPUT)
private Long signatureId;
@ApiModelProperty("订单ID")
private Long orderId;
@ApiModelProperty("订单号")
private String orderNumber;
@ApiModelProperty("订单类型:IN-入库 OUT-出库")
private String orderType;
@ApiModelProperty("签名状态:1-待签名 2-已签名")
private Integer signatureStatus;
@ApiModelProperty("签名时间")
private Date signatureTime;
@ApiModelProperty("手写签名图片")
private String signaturePic;
@ApiModelProperty("拍照取证图片")
private String evidencePics;
@ApiModelProperty("签名备注")
private String signatureRemark;
@ApiModelProperty("签名方式:1-扫描二维码 2-电子签名 3-打印手写签名 4-超时自动签名")
private Integer signatureMode;
@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 String remark;
}
@@ -1,83 +0,0 @@
package com.mhd.oms.domain.electronicSignature.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.mhd.common.core.web.domain.BaseVOEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
* 电子签名物料明细表 electronic_signature_material_detail
*/
@Data
@TableName("ELECTRONIC_SIGNATURE_MATERIAL_DETAIL")
public class ElectronicSignatureMaterialDetail extends BaseVOEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty("明细ID")
@TableId(type = IdType.INPUT)
private Long detailId;
@ApiModelProperty("签名ID")
private Long signatureId;
@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;
@ApiModelProperty("备注")
private String remark;
}
@@ -1,22 +0,0 @@
package com.mhd.oms.domain.electronicSignature.repository.facade;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mhd.oms.domain.electronicSignature.entity.ElectronicSignatureMaterialDetail;
import java.util.List;
/**
* 电子签名物料明细Service接口
*/
public interface IElectronicSignatureMaterialDetailService extends IService<ElectronicSignatureMaterialDetail> {
/**
* 根据签名ID逻辑删除明细
*/
int deleteBySignatureId(Long signatureId);
/**
* 批量插入明细
*/
boolean batchInsert(List<ElectronicSignatureMaterialDetail> detailList);
}
@@ -1,16 +0,0 @@
package com.mhd.oms.domain.electronicSignature.repository.facade;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mhd.oms.domain.electronicSignature.entity.ElectronicSignature;
import com.mhd.oms.domain.electronicSignature.repository.todo.ElectronicSignatureDO;
/**
* 电子签名Service接口
*/
public interface IElectronicSignatureService extends IService<ElectronicSignature> {
/**
* 保存电子签名
*/
Boolean saveSignature(ElectronicSignatureDO electronicSignatureDO);
}
@@ -1,129 +0,0 @@
package com.mhd.oms.domain.electronicSignature.repository.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mhd.oms.domain.electronicSignature.entity.ElectronicSignature;
import com.mhd.oms.domain.electronicSignature.entity.ElectronicSignatureMaterialDetail;
import com.mhd.oms.interfaces.dto.electronicSignature.ElectronicSignatureQueryDTO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.Date;
import java.util.List;
/**
* 电子签名Mapper接口
*/
public interface ElectronicSignatureMapper extends BaseMapper<ElectronicSignature> {
@Select("SELECT NGWL_TEST_OMS.SEQ_ELECTRONIC_SIGNATURE.NEXTVAL FROM DUAL")
Long nextSignatureId();
@Select("SELECT NGWL_TEST_OMS.SEQ_ES_MATERIAL_DETAIL.NEXTVAL FROM DUAL")
Long nextDetailId();
@Select("SELECT * FROM NGWL_TEST_OMS.ELECTRONIC_SIGNATURE WHERE ORDER_ID = #{orderId} AND ORDER_TYPE = #{orderType} AND DEL_FLAG = 1")
ElectronicSignature selectByOrderIdAndType(@Param("orderId") Long orderId, @Param("orderType") String orderType);
/**
* 分页查询电子签名列表需配合PageHelper使用
*/
@Select("<script>"
+ "SELECT s.* FROM NGWL_TEST_OMS.ELECTRONIC_SIGNATURE s WHERE s.DEL_FLAG = 1"
+ "<if test='params.orderType != null and params.orderType != \"\"'> AND s.ORDER_TYPE = #{params.orderType}</if>"
+ "<if test='params.orderNumber != null and params.orderNumber != \"\"'> AND s.ORDER_NUMBER LIKE CONCAT('%', #{params.orderNumber}, '%')</if>"
+ "<if test='params.signatureStatus != null'> AND s.SIGNATURE_STATUS = #{params.signatureStatus}</if>"
+ "<if test='params.signatureMode != null'> AND s.SIGNATURE_MODE = #{params.signatureMode}</if>"
+ "<if test='params.organizationId != null'> AND s.ORGANIZATION_ID = #{params.organizationId}</if>"
+ "<if test='params.organizationName != null and params.organizationName != \"\"'> AND s.ORGANIZATION_NAME LIKE CONCAT('%', #{params.organizationName}, '%')</if>"
+ "<if test='params.warehouseId != null'> AND s.WAREHOUSE_ID = #{params.warehouseId}</if>"
+ "<if test='params.warehouseName != null and params.warehouseName != \"\"'> AND s.WAREHOUSE_NAME LIKE CONCAT('%', #{params.warehouseName}, '%')</if>"
+ "<if test='params.createTimeFrom != null'> AND s.CREATE_TIME &gt;= #{params.createTimeFrom}</if>"
+ "<if test='params.createTimeTo != null'> AND s.CREATE_TIME &lt;= #{params.createTimeTo}</if>"
+ " ORDER BY s.CREATE_TIME DESC"
+ "</script>")
List<ElectronicSignature> selectSignatureList(@Param("params") ElectronicSignatureQueryDTO queryDTO);
/**
* 根据签名ID查询
*/
@Select("SELECT * FROM NGWL_TEST_OMS.ELECTRONIC_SIGNATURE WHERE SIGNATURE_ID = #{signatureId} AND DEL_FLAG = 1")
ElectronicSignature selectBySignatureId(@Param("signatureId") Long signatureId);
/**
* 根据签名ID查询物料明细列表
*/
@Select("SELECT * FROM NGWL_TEST_OMS.ELECTRONIC_SIGNATURE_MATERIAL_DETAIL WHERE SIGNATURE_ID = #{signatureId} AND DEL_FLAG = 1")
List<ElectronicSignatureMaterialDetail> selectMaterialDetailBySignatureId(@Param("signatureId") Long signatureId);
/**
* 批量签名根据签名ID列表更新签名信息
*/
@Update("<script>"
+ "UPDATE NGWL_TEST_OMS.ELECTRONIC_SIGNATURE SET "
+ "SIGNATURE_STATUS = 2, "
+ "SIGNATURE_TIME = #{signatureTime}, "
+ "<if test='signaturePic != null and signaturePic != \"\"'>SIGNATURE_PIC = #{signaturePic}, </if>"
+ "<if test='evidencePics != null and evidencePics != \"\"'>EVIDENCE_PICS = #{evidencePics}, </if>"
+ "<if test='signatureRemark != null and signatureRemark != \"\"'>SIGNATURE_REMARK = #{signatureRemark}, </if>"
+ "<if test='signatureMode != null'>SIGNATURE_MODE = #{signatureMode}, </if>"
+ "UPDATE_TIME = #{signatureTime} "
+ "WHERE SIGNATURE_ID IN "
+ "<foreach collection='signatureIds' item='id' open='(' separator=',' close=')'>#{id}</foreach>"
+ " AND DEL_FLAG = 1 AND SIGNATURE_STATUS = 1"
+ "</script>")
int batchUpdateSign(@Param("signatureIds") List<Long> signatureIds,
@Param("signatureTime") Date signatureTime,
@Param("signaturePic") String signaturePic,
@Param("evidencePics") String evidencePics,
@Param("signatureRemark") String signatureRemark,
@Param("signatureMode") Integer signatureMode);
@Update("<script>"
+ "UPDATE NGWL_TEST_OMS.ELECTRONIC_SIGNATURE SET "
+ "SIGNATURE_STATUS = 2, "
+ "SIGNATURE_TIME = #{signatureTime}, "
+ "<if test='signaturePic != null and signaturePic != \"\"'>SIGNATURE_PIC = #{signaturePic}, </if>"
+ "<if test='evidencePics != null and evidencePics != \"\"'>EVIDENCE_PICS = #{evidencePics}, </if>"
+ "<if test='signatureRemark != null and signatureRemark != \"\"'>SIGNATURE_REMARK = #{signatureRemark}, </if>"
+ "<if test='signatureMode != null'>SIGNATURE_MODE = #{signatureMode}, </if>"
+ "UPDATE_TIME = #{signatureTime} "
+ "WHERE ORDER_ID IN "
+ "<foreach collection='signatureIds' item='id' open='(' separator=',' close=')'>#{id}</foreach>"
+ " AND DEL_FLAG = 1 AND SIGNATURE_STATUS = 1"
+ "</script>")
int batchUpdateSignByOrder(@Param("signatureIds") List<Long> signatureIds,
@Param("signatureTime") Date signatureTime,
@Param("signaturePic") String signaturePic,
@Param("evidencePics") String evidencePics,
@Param("signatureRemark") String signatureRemark,
@Param("signatureMode") Integer signatureMode);
/**
* 根据签名ID列表批量查询
*/
@Select("<script>"
+ "SELECT * FROM NGWL_TEST_OMS.ELECTRONIC_SIGNATURE "
+ "WHERE SIGNATURE_ID IN "
+ "<foreach collection='signatureIds' item='id' open='(' separator=',' close=')'>#{id}</foreach>"
+ " AND DEL_FLAG = 1"
+ "</script>")
List<ElectronicSignature> selectBySignatureIds(@Param("signatureIds") List<Long> signatureIds);
@Select("<script>"
+ "SELECT * FROM NGWL_TEST_OMS.ELECTRONIC_SIGNATURE "
+ "WHERE ORDER_ID IN "
+ "<foreach collection='signatureIds' item='id' open='(' separator=',' close=')'>#{id}</foreach>"
+ " AND DEL_FLAG = 1"
+ "</script>")
List<ElectronicSignature> selectByOrderIds(@Param("signatureIds") List<Long> signatureIds);
@Update("UPDATE NGWL_TEST_WMS.STOCK_IN_ORDER SET SIGNATURE_STATUS = 2,SIGNATURE_TIME =now() WHERE IN_ORDER_ID = #{id}")
int updateIn( @Param("id") Long id);
@Update("UPDATE NGWL_TEST_WMS.STOCK_OUT_ORDER SET SIGNATURE_STATUS = 2,SIGNATURE_TIME =now() WHERE OUT_ORDER_ID = #{id}")
int updateOut(@Param("id") Long id);
}
@@ -1,19 +0,0 @@
package com.mhd.oms.domain.electronicSignature.repository.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mhd.oms.domain.electronicSignature.entity.ElectronicSignatureMaterialDetail;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
/**
* 电子签名物料明细Mapper接口
*/
public interface ElectronicSignatureMaterialDetailMapper extends BaseMapper<ElectronicSignatureMaterialDetail> {
@Update("UPDATE NGWL_TEST_OMS.ELECTRONIC_SIGNATURE_MATERIAL_DETAIL SET DEL_FLAG = 2 WHERE SIGNATURE_ID = #{signatureId} AND DEL_FLAG = 1")
int logicDeleteBySignatureId(@Param("signatureId") Long signatureId);
@Select("SELECT NGWL_TEST_OMS.SEQ_ES_MATERIAL_DETAIL.NEXTVAL FROM DUAL")
Long nextDetailId();
}
@@ -1,30 +0,0 @@
package com.mhd.oms.domain.electronicSignature.repository.persistence;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mhd.oms.domain.electronicSignature.entity.ElectronicSignature;
import com.mhd.oms.domain.electronicSignature.repository.facade.IElectronicSignatureService;
import com.mhd.oms.domain.electronicSignature.repository.mapper.ElectronicSignatureMapper;
import com.mhd.oms.domain.electronicSignature.repository.todo.ElectronicSignatureDO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* 电子签名Service业务层处理
*/
@Service
public class ElectronicSignatureImpl extends ServiceImpl<ElectronicSignatureMapper, ElectronicSignature> implements IElectronicSignatureService {
@Autowired
private ElectronicSignatureMapper electronicSignatureMapper;
@Override
public Boolean saveSignature(ElectronicSignatureDO electronicSignatureDO) {
ElectronicSignature entity = new ElectronicSignature();
BeanUtils.copyProperties(electronicSignatureDO, entity);
Long id = electronicSignatureMapper.nextSignatureId();
entity.setSignatureId(id);
entity.setSignatureMode(2); // 2-电子签名
return this.save(entity);
}
}
@@ -1,38 +0,0 @@
package com.mhd.oms.domain.electronicSignature.repository.persistence;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mhd.oms.domain.electronicSignature.entity.ElectronicSignatureMaterialDetail;
import com.mhd.oms.domain.electronicSignature.repository.facade.IElectronicSignatureMaterialDetailService;
import com.mhd.oms.domain.electronicSignature.repository.mapper.ElectronicSignatureMaterialDetailMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 电子签名物料明细Service业务层处理
*/
@Service
public class ElectronicSignatureMaterialDetailImpl extends ServiceImpl<ElectronicSignatureMaterialDetailMapper, ElectronicSignatureMaterialDetail> implements IElectronicSignatureMaterialDetailService {
@Autowired
private ElectronicSignatureMaterialDetailMapper electronicSignatureMaterialDetailMapper;
@Override
public int deleteBySignatureId(Long signatureId) {
return electronicSignatureMaterialDetailMapper.logicDeleteBySignatureId(signatureId);
}
@Override
public boolean batchInsert(List<ElectronicSignatureMaterialDetail> detailList) {
if (detailList == null || detailList.isEmpty()) {
return true;
}
for (ElectronicSignatureMaterialDetail detail : detailList) {
Long detailId = electronicSignatureMaterialDetailMapper.nextDetailId();
detail.setDetailId(detailId);
this.save(detail);
}
return true;
}
}
@@ -1,49 +0,0 @@
package com.mhd.oms.domain.electronicSignature.repository.todo;
import com.mhd.oms.domain.electronicSignature.entity.ElectronicSignatureMaterialDetail;
import lombok.Data;
import java.util.List;
/**
* 电子签名保存入参
*/
@Data
public class ElectronicSignatureDO {
/** 订单ID */
private Long orderId;
/** 订单号 */
private String orderNumber;
/** 订单类型:IN-入库 OUT-出库 */
private String orderType;
/** 组织ID */
private Long organizationId;
/** 组织名称 */
private String organizationName;
/** 一级组织ID */
private Long topOrganizationId;
/** 仓库ID */
private Long warehouseId;
/** 仓库编码 */
private String warehouseCode;
/** 仓库名称 */
private String warehouseName;
/** 创建人 */
private Long createBy;
/** 创建人姓名 */
private String createByName;
/** 物料明细列表 */
private List<ElectronicSignatureMaterialDetail> materialDetailList;
}
@@ -1,311 +0,0 @@
package com.mhd.oms.domain.electronicSignature.service;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.mhd.oms.domain.electronicSignature.entity.ElectronicSignature;
import com.mhd.oms.domain.electronicSignature.entity.ElectronicSignatureMaterialDetail;
import com.mhd.oms.domain.electronicSignature.repository.facade.IElectronicSignatureMaterialDetailService;
import com.mhd.oms.domain.electronicSignature.repository.facade.IElectronicSignatureService;
import com.mhd.oms.domain.electronicSignature.repository.mapper.ElectronicSignatureMapper;
import com.mhd.oms.domain.electronicSignature.repository.todo.ElectronicSignatureDO;
import com.mhd.oms.interfaces.dto.electronicSignature.ElectronicSignatureBatchSignDTO;
import com.mhd.oms.interfaces.dto.electronicSignature.ElectronicSignatureQueryDTO;
import com.mhd.system.api.WmsServiceFeign;
import com.mhd.system.api.domain.SignatureBatchFeignDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* 电子签名领域服务
*/
@Service
@Slf4j
public class ElectronicSignatureDomainService {
@Autowired
private IElectronicSignatureService electronicSignatureService;
@Autowired
private IElectronicSignatureMaterialDetailService electronicSignatureMaterialDetailService;
@Autowired
private ElectronicSignatureMapper electronicSignatureMapper;
@Autowired(required = false)
private WmsServiceFeign wmsServiceFeign;
/**
* 保存电子签名记录生成待签名记录
* 业务规则
* 1. 查询是否已有签名记录
* 2. 若已签名(SIGNATURE_STATUS=2)跳过
* 3. 若待签名(SIGNATURE_STATUS=1)覆盖明细先逻辑删除旧明细再插入新明细
* 4. 若不存在新增主表+明细
*/
@Transactional(rollbackFor = Exception.class)
public Boolean saveSignature(ElectronicSignatureDO electronicSignatureDO) {
Long orderId = electronicSignatureDO.getOrderId();
String orderType = electronicSignatureDO.getOrderType();
// 查询是否已有签名记录
ElectronicSignature existing = electronicSignatureMapper.selectByOrderIdAndType(orderId, orderType);
if (existing != null) {
// 已签名跳过
if (existing.getSignatureStatus() != null && existing.getSignatureStatus() == 2) {
log.info("订单 {} 已签名,跳过生成签名记录", electronicSignatureDO.getOrderNumber());
return true;
}
// 待签名覆盖逻辑删除旧明细插入新明细
log.info("订单 {} 已有待签名记录,覆盖明细", electronicSignatureDO.getOrderNumber());
electronicSignatureMaterialDetailService.deleteBySignatureId(existing.getSignatureId());
batchInsertDetails(existing.getSignatureId(), electronicSignatureDO.getMaterialDetailList());
return true;
}
// 不存在新增
log.info("订单 {} 生成新的待签名记录", electronicSignatureDO.getOrderNumber());
electronicSignatureService.saveSignature(electronicSignatureDO);
// 查询刚插入的记录以获取签名ID
ElectronicSignature newEntity = electronicSignatureMapper.selectByOrderIdAndType(orderId, orderType);
if (newEntity != null) {
batchInsertDetails(newEntity.getSignatureId(), electronicSignatureDO.getMaterialDetailList());
}
return true;
}
/**
* 保存电子签名记录生成待签名记录
* 业务规则
* 1. 查询是否已有签名记录
* 2. 若已签名(SIGNATURE_STATUS=2)跳过
* 3. 若待签名(SIGNATURE_STATUS=1)覆盖明细先逻辑删除旧明细再插入新明细
* 4. 若不存在新增主表+明细
*/
@Transactional(rollbackFor = Exception.class)
public Boolean inQqcode(ElectronicSignatureDO electronicSignatureDO) {
Long orderId = electronicSignatureDO.getOrderId();
ElectronicSignature existing = electronicSignatureService.getOne(new LambdaQueryWrapper<ElectronicSignature>()
.eq(ElectronicSignature::getOrderId, orderId)
.eq(ElectronicSignature::getDelFlag, 1), false);
if (existing != null) {
existing.setSignatureTime(new Date()); // 设置签名时间
existing.setSignatureStatus(2); // 设置签名状态为已签名
existing.setSignatureMode(1); // 设置签名方式为1-二维码
electronicSignatureService.updateById(existing);
electronicSignatureMapper.updateIn(existing.getOrderId());
}
return true;
}
@Transactional(rollbackFor = Exception.class)
public Boolean outQqcode(ElectronicSignatureDO electronicSignatureDO) {
Long orderId = electronicSignatureDO.getOrderId();
ElectronicSignature existing = electronicSignatureService.getOne(new LambdaQueryWrapper<ElectronicSignature>()
.eq(ElectronicSignature::getOrderId, orderId)
.eq(ElectronicSignature::getDelFlag, 1), false);
if (existing != null) {
existing.setSignatureTime(new Date()); // 设置签名时间
existing.setSignatureStatus(2); // 设置签名状态为已签名
existing.setSignatureMode(1); // 设置签名方式为1-二维码
electronicSignatureService.updateById(existing);
electronicSignatureMapper.updateOut(existing.getOrderId());
}
return true;
}
/**
* 分页查询电子签名列表
*/
public List<ElectronicSignature> querySignatureList(ElectronicSignatureQueryDTO queryDTO) {
return electronicSignatureMapper.selectSignatureList(queryDTO);
}
/**
* 根据订单编号查询电子签名列表
*/
public List<ElectronicSignature> getByOrderNumber(ElectronicSignatureQueryDTO queryDTO) {
return electronicSignatureMapper.selectList(new LambdaQueryWrapper<ElectronicSignature>()
.eq(ElectronicSignature::getOrderNumber, queryDTO.getOrderNumber())
.eq(ElectronicSignature::getDelFlag, 1));
}
/**
* 根据签名ID查询
*/
public ElectronicSignature getSignatureById(Long signatureId) {
return electronicSignatureMapper.selectBySignatureId(signatureId);
}
/**
* 根据签名ID查询物料明细
*/
public List<ElectronicSignatureMaterialDetail> queryMaterialDetailBySignatureId(Long signatureId) {
return electronicSignatureMapper.selectMaterialDetailBySignatureId(signatureId);
}
private void batchInsertDetails(Long signatureId, List<ElectronicSignatureMaterialDetail> detailList) {
if (detailList == null || detailList.isEmpty()) {
return;
}
for (ElectronicSignatureMaterialDetail detail : detailList) {
detail.setSignatureId(signatureId);
}
electronicSignatureMaterialDetailService.batchInsert(detailList);
}
/**
* 批量签名勾选多条记录后批量签名
*
* <p>业务流程
* 1. 查询OMS电子签名表获取每条记录的 orderId + orderType
* 2. 更新OMS ELECTRONIC_SIGNATURE表signatureStatus=2(已签名)signatureTimesignaturePic
* evidencePicssignatureRemarksignatureMode
* 3. 按订单类型分组后调用WMS Feign更新WMS stock_in_order / stock_out_order表
* </p>
*/
@Transactional(rollbackFor = Exception.class)
public int batchSign(ElectronicSignatureBatchSignDTO dto) {
List<Long> signatureIds = dto.getSignatureIds();
if (CollectionUtil.isEmpty(signatureIds)) {
return 0;
}
// 1. 查询签名记录获取 orderId + orderType
List<ElectronicSignature> signatureList = electronicSignatureMapper.selectBySignatureIds(signatureIds);
if (CollectionUtil.isEmpty(signatureList)) {
log.warn("批量签名失败:未找到有效的签名记录");
return 0;
}
// 2. 更新OMS电子签名表
Date now = new Date();
String evidencePicsStr = null;
if (CollectionUtil.isNotEmpty(dto.getEvidencePics())) {
evidencePicsStr = String.join(",", dto.getEvidencePics());
}
int updated = electronicSignatureMapper.batchUpdateSign(
signatureIds, now,
dto.getSignaturePic(),
evidencePicsStr,
dto.getSignatureRemark(),
2);
log.info("批量签名:OMS电子签名表更新 {} 条", updated);
// 3. 按订单类型分组调用WMS更新入/出库表
if (wmsServiceFeign != null) {
try {
// 分组IN-入库OUT-出库
List<Long> inOrderIds = signatureList.stream()
.filter(s -> "IN".equals(s.getOrderType()))
.map(ElectronicSignature::getOrderId)
.distinct()
.collect(Collectors.toList());
List<Long> outOrderIds = signatureList.stream()
.filter(s -> "OUT".equals(s.getOrderType()))
.map(ElectronicSignature::getOrderId)
.distinct()
.collect(Collectors.toList());
// 构建 WMS 批量签名 DTO一次调用同时处理入库+出库
SignatureBatchFeignDTO wmsDto = new SignatureBatchFeignDTO();
wmsDto.setInOrderIds(inOrderIds.isEmpty() ? null : inOrderIds);
wmsDto.setOutOrderIds(outOrderIds.isEmpty() ? null : outOrderIds);
wmsDto.setSignatureStatus(2);
wmsDto.setSignatureTime(now);
wmsDto.setSignaturePic(dto.getSignaturePic());
wmsDto.setEvidencePics(evidencePicsStr);
wmsDto.setSignatureRemark(dto.getSignatureRemark());
log.info("批量签名:调用WMS更新入/出库单,入库{}条,出库{}条",
inOrderIds.size(), outOrderIds.size());
wmsServiceFeign.batchSignWms(wmsDto);
} catch (Exception e) {
log.error("批量签名:调用WMS更新入/出库表失败", e);
// WMS更新失败不影响OMS表更新结果仅记录日志
}
}
return updated;
}
@Transactional(rollbackFor = Exception.class)
public int batchSignByWmsId(ElectronicSignatureBatchSignDTO dto) {
List<Long> signatureIds = dto.getSignatureIds();
if (CollectionUtil.isEmpty(signatureIds)) {
return 0;
}
// 1. 查询签名记录获取 orderId + orderType
List<ElectronicSignature> signatureList = electronicSignatureMapper.selectByOrderIds(signatureIds);
if (CollectionUtil.isEmpty(signatureList)) {
log.warn("批量签名失败:未找到有效的签名记录");
return 0;
}
// 2. 更新OMS电子签名表
Date now = new Date();
String evidencePicsStr = null;
if (CollectionUtil.isNotEmpty(dto.getEvidencePics())) {
evidencePicsStr = String.join(",", dto.getEvidencePics());
}
int updated = electronicSignatureMapper.batchUpdateSignByOrder(
signatureIds, now,
dto.getSignaturePic(),
evidencePicsStr,
dto.getSignatureRemark(),
2);
log.info("批量签名:OMS电子签名表更新 {} 条", updated);
// 3. 按订单类型分组调用WMS更新入/出库表
// if (wmsServiceFeign != null) {
// try {
// // 分组IN-入库OUT-出库
// List<Long> inOrderIds = signatureList.stream()
// .filter(s -> "IN".equals(s.getOrderType()))
// .map(ElectronicSignature::getOrderId)
// .distinct()
// .collect(Collectors.toList());
// List<Long> outOrderIds = signatureList.stream()
// .filter(s -> "OUT".equals(s.getOrderType()))
// .map(ElectronicSignature::getOrderId)
// .distinct()
// .collect(Collectors.toList());
//
// // 构建 WMS 批量签名 DTO一次调用同时处理入库+出库
// SignatureBatchFeignDTO wmsDto = new SignatureBatchFeignDTO();
// wmsDto.setInOrderIds(inOrderIds.isEmpty() ? null : inOrderIds);
// wmsDto.setOutOrderIds(outOrderIds.isEmpty() ? null : outOrderIds);
// wmsDto.setSignatureStatus(2);
// wmsDto.setSignatureTime(now);
// wmsDto.setSignaturePic(dto.getSignaturePic());
// wmsDto.setEvidencePics(evidencePicsStr);
// wmsDto.setSignatureRemark(dto.getSignatureRemark());
//
// log.info("批量签名:调用WMS更新入/出库单,入库{}条,出库{}条",
// inOrderIds.size(), outOrderIds.size());
// wmsServiceFeign.batchSignWms(wmsDto);
// } catch (Exception e) {
// log.error("批量签名:调用WMS更新入/出库表失败", e);
// // WMS更新失败不影响OMS表更新结果仅记录日志
// }
// }
return updated;
}
}
@@ -3,7 +3,6 @@ package com.mhd.oms.domain.executionInMaterialDetail.repository.facade;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mhd.oms.domain.executionInMaterialDetail.entity.ExecutionInMaterialDetail;
import com.mhd.oms.domain.executionInMaterialDetail.repository.po.ExecutionInMaterialDetailPO;
import com.mhd.oms.domain.executionInMaterialDetail.repository.po.ExecutionInMaterialDetailWithOrderPO;
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.InventoryAdjustmentRecordPO;
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.QueryOrderOverStockDO;
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.ExecutionInMaterialDetailBaseDO;
@@ -66,9 +65,4 @@ public interface IExecutionInMaterialDetailService extends IService<ExecutionInM
public ExecutionInMaterialDetailPO getInfo(Long materialDetailId);
public List<InventoryAdjustmentRecordPO> getkctzjl(Long materialBaseInfoId, String orderNumber, String adjustType);
/**
* 入库明细查询关联入库执行单
*/
public List<ExecutionInMaterialDetailWithOrderPO> queryInOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO);
}
@@ -3,7 +3,6 @@ package com.mhd.oms.domain.executionInMaterialDetail.repository.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mhd.oms.domain.executionInMaterialDetail.entity.ExecutionInMaterialDetail;
import com.mhd.oms.domain.executionInMaterialDetail.repository.po.ExecutionInMaterialDetailPO;
import com.mhd.oms.domain.executionInMaterialDetail.repository.po.ExecutionInMaterialDetailWithOrderPO;
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.InventoryAdjustmentRecordPO;
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.QueryOrderOverStockDO;
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.ExecutionInMaterialDetailDO;
@@ -31,9 +30,4 @@ public interface ExecutionInMaterialDetailMapper extends BaseMapper<ExecutionInM
public List<InventoryAdjustmentRecordPO> getkctzjl(@Param("materialBaseInfoId") Long materialBaseInfoId, @Param("orderNumber") String orderNumber, @Param("adjustType") String adjustType);
/**
* 入库明细查询关联入库执行单
*/
public List<ExecutionInMaterialDetailWithOrderPO> queryInOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO);
}
@@ -12,7 +12,6 @@ import com.mhd.oms.domain.executionInMaterialDetail.entity.ExecutionInMaterialDe
import com.mhd.oms.domain.executionInMaterialDetail.repository.facade.IExecutionInMaterialDetailService;
import com.mhd.oms.domain.executionInMaterialDetail.repository.mapper.ExecutionInMaterialDetailMapper;
import com.mhd.oms.domain.executionInMaterialDetail.repository.po.ExecutionInMaterialDetailPO;
import com.mhd.oms.domain.executionInMaterialDetail.repository.po.ExecutionInMaterialDetailWithOrderPO;
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.InventoryAdjustmentRecordPO;
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.QueryOrderOverStockDO;
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.ExecutionInMaterialDetailBaseDO;
@@ -310,12 +309,4 @@ public class ExecutionInMaterialDetailImpl extends ServiceImpl<ExecutionInMateri
return inMaterialDetailMapper.getkctzjl(materialBaseInfoId, orderNumber, adjustType);
}
/**
* 入库明细查询关联入库执行单
*/
@Override
public List<ExecutionInMaterialDetailWithOrderPO> queryInOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO) {
return inMaterialDetailMapper.queryInOrderDetailList(queryOrderOverStockDO);
}
}
@@ -1,30 +0,0 @@
package com.mhd.oms.domain.executionInMaterialDetail.repository.po;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 入库明细查询结果关联入库执行单
*
* @author gen
* @date 2024-07-24
*/
@Data
public class ExecutionInMaterialDetailWithOrderPO extends ExecutionInMaterialDetailPO {
private static final long serialVersionUID = 1L;
@ApiModelProperty("入库单状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库 6-已取消 7-已关闭")
private Integer inOrderStatus;
@ApiModelProperty("入库单审核状态: 1-未审核 2-审核不通过 3-审核通过")
private Integer inOrderAuditStatus;
@ApiModelProperty("货主ID")
private Long orderShipperId;
@ApiModelProperty("货主编码")
private String orderShipperCode;
@ApiModelProperty("货主名称")
private String orderShipperName;
}
@@ -1,69 +0,0 @@
package com.mhd.oms.domain.executionInMaterialDetail.repository.todo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mhd.common.core.web.domain.BaseVOEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* 入库明细查询参数 DTO
*
* @author gen
* @date 2024-07-24
*/
@Data
public class ExecutionInMaterialDetailQueryDTO extends BaseVOEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty("组织表ID")
private Long organizationId;
@ApiModelProperty("一级组织表ID")
private Long topOrganizationId;
@ApiModelProperty("入库单号")
private String inOrderNumber;
@ApiModelProperty("仓库id")
private Long warehouseId;
@ApiModelProperty("仓库编码")
private String warehouseCode;
@ApiModelProperty("仓库名称")
private String warehouseName;
@ApiModelProperty("货主id")
private Long shipperId;
@ApiModelProperty("货主名称")
private String shipperName;
@ApiModelProperty("入库单类型编码")
private String inOrderTypeCode;
@ApiModelProperty("入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库 6-已取消 7-已关闭")
private Integer inStatus;
@ApiModelProperty("预计到货时间 开始")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date inOrderExpectStartTime;
@ApiModelProperty("预计到货时间 结束")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date inOrderExpectEndTime;
@ApiModelProperty("物料基础信息id")
private Long materialBaseInfoId;
@ApiModelProperty("物料编码")
private String materialCode;
@ApiModelProperty("物料名称")
private String materialName;
}
@@ -2,9 +2,7 @@ package com.mhd.oms.domain.executionInMaterialDetail.service;
import com.mhd.common.security.utils.SecurityUtils;
import com.mhd.oms.domain.executionInMaterialDetail.repository.po.ExecutionInMaterialDetailPO;
import com.mhd.oms.domain.executionInMaterialDetail.repository.po.ExecutionInMaterialDetailWithOrderPO;
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.ExecutionInMaterialDetailDO;
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.QueryOrderOverStockDO;
import com.mhd.system.api.model.LoginUser;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -71,18 +69,4 @@ public class ExecutionInMaterialDetailApplicationService {
return inMaterialDetailDomainService.getInfo(materialDetailId);
}
/**
* 入库明细查询关联入库执行单
*/
public List<ExecutionInMaterialDetailWithOrderPO> queryInOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null) {
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1) {
queryOrderOverStockDO.setTopOrganizationId(topOrganizationId);
}
}
return inMaterialDetailDomainService.queryInOrderDetailList(queryOrderOverStockDO);
}
}
@@ -8,8 +8,6 @@ import com.mhd.common.core.utils.bean.BeanUtils;
import com.mhd.common.security.utils.SecurityUtils;
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.ExecutionInMaterialDetailDO;
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.ExecutionInMaterialDetailDTO;
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.ExecutionInMaterialDetailQueryDTO;
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.QueryOrderOverStockDO;
import com.mhd.system.api.model.LoginUser;
import org.springframework.stereotype.Component;
@@ -64,13 +62,4 @@ public class ExecutionInMaterialDetailAssembler {
return inMaterialDetailDO;
}
/**
* 入库明细查询 DTO QueryOrderOverStockDO
*/
public QueryOrderOverStockDO toQueryDO(ExecutionInMaterialDetailQueryDTO queryDTO) {
QueryOrderOverStockDO queryDO = new QueryOrderOverStockDO();
BeanUtils.copyProperties(queryDTO, queryDO, IgnoreNullUtil.getNullPropertyNames(queryDTO));
return queryDO;
}
}
@@ -2,9 +2,7 @@ package com.mhd.oms.domain.executionInMaterialDetail.service;
import com.mhd.oms.domain.executionInMaterialDetail.repository.facade.IExecutionInMaterialDetailService;
import com.mhd.oms.domain.executionInMaterialDetail.repository.po.ExecutionInMaterialDetailPO;
import com.mhd.oms.domain.executionInMaterialDetail.repository.po.ExecutionInMaterialDetailWithOrderPO;
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.ExecutionInMaterialDetailDO;
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.QueryOrderOverStockDO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -64,11 +62,4 @@ public class ExecutionInMaterialDetailDomainService {
}
/**
* 入库明细查询关联入库执行单
*/
public List<ExecutionInMaterialDetailWithOrderPO> queryInOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO) {
return materialDetailService.queryInOrderDetailList(queryOrderOverStockDO);
}
}
@@ -3,7 +3,6 @@ package com.mhd.oms.domain.executionOutMaterialDetail.repository.facade;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mhd.oms.domain.executionOutMaterialDetail.entity.ExecutionOutMaterialDetail;
import com.mhd.oms.domain.executionOutMaterialDetail.repository.po.ExecutionOutMaterialDetailPO;
import com.mhd.oms.domain.executionOutMaterialDetail.repository.po.ExecutionOutMaterialDetailWithOrderPO;
import com.mhd.oms.domain.executionOutMaterialDetail.repository.todo.ExecutionOutMaterialDetailBaseDO;
import com.mhd.oms.domain.executionOutMaterialDetail.repository.todo.ExecutionOutMaterialDetailDO;
import com.mhd.oms.domain.reservationInMaterialDetail.repository.todo.QueryOrderOverStockDO;
@@ -63,9 +62,4 @@ public interface IExecutionOutMaterialDetailService extends IService<ExecutionOu
* 查询物料明细
*/
public ExecutionOutMaterialDetailPO getInfo(Long materialDetailId);
/**
* 出库明细查询关联出库执行单
*/
public List<ExecutionOutMaterialDetailWithOrderPO> queryOutOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO);
}
@@ -3,7 +3,6 @@ package com.mhd.oms.domain.executionOutMaterialDetail.repository.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mhd.oms.domain.executionOutMaterialDetail.entity.ExecutionOutMaterialDetail;
import com.mhd.oms.domain.executionOutMaterialDetail.repository.po.ExecutionOutMaterialDetailPO;
import com.mhd.oms.domain.executionOutMaterialDetail.repository.po.ExecutionOutMaterialDetailWithOrderPO;
import com.mhd.oms.domain.executionOutMaterialDetail.repository.todo.ExecutionOutMaterialDetailDO;
import com.mhd.oms.domain.reservationInMaterialDetail.repository.todo.QueryOrderOverStockDO;
import org.apache.ibatis.annotations.Param;
@@ -68,9 +67,4 @@ public interface ExecutionOutMaterialDetailMapper extends BaseMapper<ExecutionOu
public String getLotByKcId(@Param("id") Long id);
public String getInLotNo(@Param("inOrderNumber") String inOrderNumber, @Param("baseId") Long baseId);
/**
* 出库明细查询关联出库执行单
*/
public List<ExecutionOutMaterialDetailWithOrderPO> queryOutOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO);
}
@@ -12,7 +12,6 @@ import com.mhd.oms.domain.executionOutMaterialDetail.entity.ExecutionOutMaterial
import com.mhd.oms.domain.executionOutMaterialDetail.repository.facade.IExecutionOutMaterialDetailService;
import com.mhd.oms.domain.executionOutMaterialDetail.repository.mapper.ExecutionOutMaterialDetailMapper;
import com.mhd.oms.domain.executionOutMaterialDetail.repository.po.ExecutionOutMaterialDetailPO;
import com.mhd.oms.domain.executionOutMaterialDetail.repository.po.ExecutionOutMaterialDetailWithOrderPO;
import com.mhd.oms.domain.executionOutMaterialDetail.repository.todo.ExecutionOutMaterialDetailBaseDO;
import com.mhd.oms.domain.executionOutMaterialDetail.repository.todo.ExecutionOutMaterialDetailDO;
import com.mhd.oms.domain.executionStockInOrder.repository.mapper.ExecutionStockInOrderMapper;
@@ -262,13 +261,4 @@ public class ExecutionOutMaterialDetailImpl extends ServiceImpl<ExecutionOutMate
BeanUtils.copyProperties(outMaterialDetail, outMaterialDetailPO);
return outMaterialDetailPO;
}
/**
* 出库明细查询关联出库执行单
*/
@Override
public List<ExecutionOutMaterialDetailWithOrderPO> queryOutOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO) {
return outMaterialDetailMapper.queryOutOrderDetailList(queryOrderOverStockDO);
}
}
@@ -1,44 +0,0 @@
package com.mhd.oms.domain.executionOutMaterialDetail.repository.po;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* 出库明细查询结果关联出库执行单
*
* @author gen
* @date 2024-07-24
*/
@Data
public class ExecutionOutMaterialDetailWithOrderPO extends ExecutionOutMaterialDetailPO {
private static final long serialVersionUID = 1L;
@ApiModelProperty("出库单状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-拣货中 6-波次中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭")
private Integer outOrderStatus;
@ApiModelProperty("出库单审核状态: 1-未审核 2-审核不通过 3-审核通过")
private Integer outOrderAuditStatus;
@ApiModelProperty("货主ID")
private Long orderShipperId;
@ApiModelProperty("货主编码")
private String orderShipperCode;
@ApiModelProperty("货主名称")
private String orderShipperName;
@ApiModelProperty("出仓日期")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date orderOutboundDate;
@ApiModelProperty("出库时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date orderOutboundTime;
}
@@ -1,69 +0,0 @@
package com.mhd.oms.domain.executionOutMaterialDetail.repository.todo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mhd.common.core.web.domain.BaseVOEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* 出库明细查询参数 DTO
*
* @author gen
* @date 2024-07-24
*/
@Data
public class ExecutionOutMaterialDetailQueryDTO extends BaseVOEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty("组织表ID")
private Long organizationId;
@ApiModelProperty("一级组织表ID")
private Long topOrganizationId;
@ApiModelProperty("出库单号")
private String outOrderNumber;
@ApiModelProperty("仓库id")
private Long warehouseId;
@ApiModelProperty("仓库编码")
private String warehouseCode;
@ApiModelProperty("仓库名称")
private String warehouseName;
@ApiModelProperty("货主id")
private Long shipperId;
@ApiModelProperty("货主名称")
private String shipperName;
@ApiModelProperty("出库单类型编码")
private String outOrderTypeCode;
@ApiModelProperty("出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-拣货中 6-波次中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭")
private Integer outStatus;
@ApiModelProperty("预计出库时间 开始")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date outOrderExpectStartTime;
@ApiModelProperty("预计出库时间 结束")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date outOrderExpectEndTime;
@ApiModelProperty("物料基础信息id")
private Long materialBaseInfoId;
@ApiModelProperty("物料编码")
private String materialCode;
@ApiModelProperty("物料名称")
private String materialName;
}

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