Merge branch 'dev_20260429' into dev_WMS20260401

# Conflicts:
#	mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java
#	mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/UserServiceFeign.java
#	mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/factory/RemoteOmsFeignFallbackFactory.java
#	mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/factory/RemoteUserFeignFallbackFactory.java
#	mhd-modules/mhd-system/src/main/java/com/mhd/basic/application/service/batchDetail/BatchDetailApplicationService.java
#	mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/batchDetail/service/BatchDetailDomainService.java
#	mhd_oms/src/main/java/com/mhd/oms/interfaces/facade/sysTableConfig/SysTableConfigApi.java
This commit is contained in:
王奎兴
2026-05-15 13:55:42 +08:00
162 changed files with 7447 additions and 285 deletions
@@ -18,7 +18,7 @@ import java.util.Set;
/**
* bms财务结算系统feign调用接口
*/
@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.3: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 {
@@ -8,6 +8,7 @@ import com.mhd.system.api.factory.RemoteOmsFeignFallbackFactory;
import com.mhd.system.api.feign.FeignAutoConfiguration;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@@ -39,4 +40,13 @@ public interface OmsServiceFeign {
@ApiOperation("库存调整记录插入")
@PostMapping("/reservationInventoryAdjustmentRecordApi/edit")
AjaxResult inventoryAdjustmentRecordInsert(InventoryAdjustmentRecord inventoryAdjustmentRecord);
@ApiOperation("查询企业单位列表-新增物料时显示下拉框数据")
@GetMapping("/erpEnterpriseUnitApi/unitList")
public AjaxResult getUnitList(ErpEnterpriseUnitDTO erpEnterpriseUnitDTO);
//查询企业国别列表-新增物料时显示下拉框数据
@ApiOperation("查询企业国别列表-新增物料时显示下拉框数据")
@GetMapping("/erpCountryApi/countryList")
public AjaxResult getCountryList(ErpCountryDTO erpCountryDTO);
}
@@ -363,6 +363,9 @@ public interface SystemServiceFeign {
@GetMapping("/contractManageApi/getInfoByCustomer2")
public AjaxResult getInfoByCustomer2(@RequestParam("settlementCustomersCode") String settlementCustomersCode,@RequestParam("contractType") Integer contractType,@RequestParam("topOrganizationId") Long topOrganizationId);
@GetMapping("/contractManageApi/getInfoByCustomerAndOrganizationId")
public AjaxResult getInfoByCustomerAndOrganizationId(@RequestParam("settlementCustomersCode") String settlementCustomersCode,@RequestParam("contractType") Integer contractType,@RequestParam("topOrganizationId") Long topOrganizationId,@RequestParam("organizationId") Long organizationId);
@GetMapping("/contractManageApi/queryList")
public AjaxResult queryList();
@@ -377,4 +380,4 @@ public interface SystemServiceFeign {
public AjaxResult matchForMaterialImport(@RequestParam("keyword") String keyword,
@RequestParam("organizationId") Long organizationId);
}
}
@@ -9,15 +9,19 @@ import com.mhd.common.core.domain.dto.UserDriverDTO;
import com.mhd.common.core.domain.entity.R;
import com.mhd.common.core.domain.todo.StatisticalMattersDo;
import com.mhd.common.core.web.domain.AjaxResult;
import com.mhd.common.core.web.page.TableDataInfo;
import com.mhd.system.api.domain.UserDTO;
import com.mhd.system.api.domain.UserShipperQueryDTO;
import com.mhd.system.api.domain.UserUpdateDTO;
import com.mhd.system.api.factory.RemoteUserFeignFallbackFactory;
import com.mhd.system.api.feign.FeignAutoConfiguration;
import com.mhd.system.api.model.LoginUser;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
import java.util.Map;
@@ -195,4 +199,19 @@ public interface UserServiceFeign {
@ApiOperation("设置路线")
@PostMapping("/userApi/updateLineManagement")
public AjaxResult updateLineManagement(@RequestBody UserDTO userDTO);
@ApiOperation("商业合作伙伴-分页查询托运人列表")
@GetMapping("/userShipperApi/userShipperList")
public TableDataInfo userShipperList(@SpringQueryMap UserShipperQueryDTO userShipperQueryDTO);
@PostMapping("/userShipperApi/updatePushStatus")
public AjaxResult<?> updatePushStatus(@RequestParam(value = "shipperId") Long shipperId,
@RequestParam(value = "pushStatus", required = false) Integer pushStatus,
@RequestParam(value = "pushTime", required = false) String pushTime,
@RequestParam(value = "pushBy", required = false) Long pushBy,
@RequestParam(value = "pushByName", required = false) String pushByName);
}
@@ -538,4 +538,19 @@ public interface WlhyServiceFeign {
@GetMapping("/feign/order/cancelIssueDocuments")
public AjaxResult cancelIssueDocuments(@RequestParam(name="executeOrderId") String executeOrderId);
@GetMapping(value = "/ntocc/tmsSettlementExchangeRate/queryList")
public AjaxResult<?> queryList(@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
@RequestParam(name="pushStatus", required = false) String pushStatus,
@RequestParam(name="organizationId", required = false) String organizationId);
@ApiOperation("汇率-更新推送状态")
@PostMapping("/ntocc/tmsSettlementExchangeRate/updatePushStatus")
void updateExchangeRatePushStatus(@RequestParam("id") String id,
@RequestParam("pushStatus") Integer pushStatus,
@RequestParam(name="pushTime",required = false) String pushTime,
@RequestParam(name="pushBy",required = false) Long pushBy,
@RequestParam(name="pushByName",required = false) String pushByName);
}
@@ -2,6 +2,7 @@ package com.mhd.system.api;
import com.mhd.common.core.constant.ServiceNameConstants;
import com.mhd.common.core.web.domain.AjaxResult;
import com.mhd.common.core.web.page.TableDataInfo;
import com.mhd.system.api.domain.*;
import com.mhd.system.api.factory.RemoteWmsFallbackFactory;
import com.mhd.system.api.feign.FeignAutoConfiguration;
@@ -95,4 +96,16 @@ public interface WmsServiceFeign {
@ApiOperation("oms下发单明细保存")
@PostMapping(value = "/stockInOrderApi/omsInOrderAddDetail")
public void omsInOrderAddDetail(@RequestBody List<InMaterialDetail> inMaterialDetails);
@ApiOperation("oms查询物料列表")
@GetMapping("/materialBaseInfoApi/queryList")
public TableDataInfo getMaterialBaseInfoList(MaterialInfoDTO materialInfoDTO);
@ApiOperation("oms物料列表推送-更新推送信息")
@PostMapping("/materialBaseInfoApi/updatePushStatus")
public AjaxResult<?> updateMaterialPushStatus(@RequestParam("materialBaseInfoId") Long materialBaseInfoId,
@RequestParam("pushStatus") Integer pushStatus,
@RequestParam(value = "pushTime",required = false) String pushTime,
@RequestParam(value = "pushBy",required = false) Long pushBy,
@RequestParam(value = "pushByName",required = false) String pushByName);
}
@@ -0,0 +1,24 @@
package com.mhd.system.api.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(description = "企业国别DTO")
public class ErpCountryDTO {
@ApiModelProperty("主键id")
private Long id;
@ApiModelProperty("ERP国别编码")
private String erpCountryCode;
@ApiModelProperty("ERP国别名称")
private String erpCountryName;
@ApiModelProperty("所属组织ID")
private Long organizationId;
}
@@ -0,0 +1,22 @@
package com.mhd.system.api.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(description = "企业单位DTO")
public class ErpEnterpriseUnitDTO {
@ApiModelProperty("企业单位id")
private Long id;
@ApiModelProperty("企业单位名称")
private String erpName;
@ApiModelProperty("企业单位编码")
private String erpCode;
@ApiModelProperty("组织ID")
private Long organizationId;
}
@@ -207,6 +207,14 @@ public class MaterialBaseInfoFeign extends BaseVOEntity{
@Excel(name = "是否抄码: 1-是 2-否")
private Integer copyCode;
@ApiModelProperty("货物类型:0-物料 1-半成品 2-成品")
@Excel(name = "货物类型:0-物料 1-半成品 2-成品")
private Integer goodsType;
@ApiModelProperty("毛重(kg")
@Excel(name = "毛重(kg")
private BigDecimal grossWeight;
/**
* 规格型号
*/
@@ -0,0 +1,57 @@
package com.mhd.system.api.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(description = "物料信息查询DTO")
public class MaterialInfoDTO {
@ApiModelProperty("物料id")
private Long materialBaseInfoId;
@ApiModelProperty("物料id")
private String materialCode;
@ApiModelProperty("物料名称")
private String materialName;
@ApiModelProperty("货物类型 0-料件 1-半成品 2-成品")
private Integer goodsType;
@ApiModelProperty("组织ID")
private Long organizationId;
@ApiModelProperty("创建时间起")
private String createTimeStart;
@ApiModelProperty("创建时间止")
private String createTimeEnd;
@ApiModelProperty("更新时间起")
private String updateTimeStart;
@ApiModelProperty("更新时间止")
private String updateTimeEnd;
@ApiModelProperty("推送状态")
private Integer pushStatus;
@ApiModelProperty("推送时间起")
private String pushTimeStart;
@ApiModelProperty("推送时间止")
private String pushTimeEnd;
@ApiModelProperty(value = "页码")
private Integer pageNum = 1;
@ApiModelProperty(value = "每页数量")
private Integer pageSize = 10;
}
@@ -34,6 +34,45 @@ public class SysDictType extends BaseEntity
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
private String status;
/** 组织表ID */
private Long organizationId;
/** 组织名称 */
private String organizationName;
/** 一级组织表ID */
private Long topOrganizationId;
public Long getOrganizationId()
{
return organizationId;
}
public void setOrganizationId(Long organizationId)
{
this.organizationId = organizationId;
}
public String getOrganizationName()
{
return organizationName;
}
public void setOrganizationName(String organizationName)
{
this.organizationName = organizationName;
}
public Long getTopOrganizationId()
{
return topOrganizationId;
}
public void setTopOrganizationId(Long topOrganizationId)
{
this.topOrganizationId = topOrganizationId;
}
public Long getDictId()
{
return dictId;
@@ -86,6 +125,9 @@ public class SysDictType extends BaseEntity
.append("dictName", getDictName())
.append("dictType", getDictType())
.append("status", getStatus())
.append("organizationId", getOrganizationId())
.append("organizationName", getOrganizationName())
.append("topOrganizationId", getTopOrganizationId())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
@@ -0,0 +1,52 @@
package com.mhd.system.api.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class UserShipperQueryDTO {
@ApiModelProperty(value = "页码")
private Integer pageNum = 1;
@ApiModelProperty(value = "每页数量")
private Integer pageSize = 10;
@ApiModelProperty(value = "登录账号")
private String userAccount;
@ApiModelProperty(value = "企业名称")
private String shipperEnterpriseName;
@ApiModelProperty(value = "组织ID")
private String organizationId;
@ApiModelProperty(value = "组织名称")
private String organizationName;
@ApiModelProperty(value = "创建时间起")
private String createTimeFrom;
@ApiModelProperty(value = "创建时间止")
private String createTimeTo;
@ApiModelProperty(value = "更新时间起")
private String updateTimeFrom;
@ApiModelProperty(value = "更新时间止")
private String updateTimeTo;
@ApiModelProperty(value = "货主类型")
private String shipperType;
@ApiModelProperty(value = "推送状态")
private Integer pushStatus;
@ApiModelProperty(value = "推送时间起")
private String pushTimeFrom;
@ApiModelProperty(value = "推送时间止")
private String pushTimeTo;
}
@@ -58,6 +58,16 @@ public class RemoteOmsFeignFallbackFactory implements FallbackFactory<OmsService
public AjaxResult inventoryAdjustmentRecordInsert(InventoryAdjustmentRecord inventoryAdjustmentRecord) {
return null;
}
@Override
public AjaxResult getUnitList(ErpEnterpriseUnitDTO erpEnterpriseUnitDTO) {
return null;
}
@Override
public AjaxResult getCountryList(ErpCountryDTO erpCountryDTO) {
return null;
}
};
}
}
@@ -289,6 +289,11 @@ public class RemoteSystemFeignFallbackFactory implements FallbackFactory<SystemS
return AjaxResult.error("查询失败");
}
@Override
public AjaxResult getInfoByCustomerAndOrganizationId(String settlementCustomersCode, Integer contractType, Long topOrganizationId, Long organizationId) {
return null;
}
@Override
public AjaxResult queryList() {
return AjaxResult.error("查询失败");
@@ -5,8 +5,10 @@ import com.mhd.common.core.domain.dto.StatisticalMattersDTO;
import com.mhd.common.core.domain.dto.UserDataPermissionQueryDTO;
import com.mhd.common.core.domain.dto.UserDriverDTO;
import com.mhd.common.core.web.domain.AjaxResult;
import com.mhd.common.core.web.page.TableDataInfo;
import com.mhd.system.api.UserServiceFeign;
import com.mhd.system.api.domain.UserDTO;
import com.mhd.system.api.domain.UserShipperQueryDTO;
import com.mhd.system.api.domain.UserUpdateDTO;
import com.mhd.system.api.model.LoginUser;
import com.mhd.common.core.domain.entity.R;
@@ -19,6 +21,8 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
@@ -186,6 +190,22 @@ public class RemoteUserFeignFallbackFactory implements FallbackFactory<UserServi
public AjaxResult updateLineManagement(UserDTO userDTO) {
return AjaxResult.error("失败" + throwable.getMessage());
}
@Override
public TableDataInfo userShipperList(UserShipperQueryDTO userShipperQueryDTO) {
TableDataInfo tableDataInfo = new TableDataInfo();
tableDataInfo.setData(new ArrayList<>());
tableDataInfo.setTotal(0);
tableDataInfo.setCode(500);
tableDataInfo.setMsg("查询失败:" + throwable.getMessage());
return tableDataInfo;
}
@Override
public AjaxResult<?> updatePushStatus(Long shipperId, Integer pushStatus, String pushTime, Long pushBy, String pushByName) {
return AjaxResult.error("更新失败" + throwable.getMessage());
}
};
}
}
@@ -550,6 +550,16 @@ public class RemoteWlhyFallbackFactory implements FallbackFactory<WlhyServiceFei
public AjaxResult cancelIssueDocuments(String executeOrderId) {
return AjaxResult.error(cause.getMessage());
}
@Override
public AjaxResult<?> queryList(Integer pageNo, Integer pageSize, String pushStatus, String organizationId) {
return AjaxResult.error(cause.getMessage());
}
@Override
public void updateExchangeRatePushStatus(String id, Integer pushStatus, String pushTime, Long pushBy, String pushByName) {
}
};
}
}
@@ -2,6 +2,7 @@ package com.mhd.system.api.factory;
import com.mhd.common.core.domain.entity.R;
import com.mhd.common.core.web.domain.AjaxResult;
import com.mhd.common.core.web.page.TableDataInfo;
import com.mhd.system.api.WlhyServiceFeign;
import com.mhd.system.api.WmsServiceFeign;
import com.mhd.system.api.domain.*;
@@ -11,6 +12,7 @@ import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PathVariable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -69,6 +71,20 @@ public class RemoteWmsFallbackFactory implements FallbackFactory<WmsServiceFeign
@Override
public void omsInOrderAddDetail(List<InMaterialDetail> inMaterialDetails) {
}
@Override
public TableDataInfo getMaterialBaseInfoList(MaterialInfoDTO materialInfoDTO) {
TableDataInfo tableDataInfo = new TableDataInfo();
tableDataInfo.setData(new ArrayList<>());
tableDataInfo.setTotal(0);
tableDataInfo.setCode(500);
return tableDataInfo;
}
@Override
public AjaxResult<?> updateMaterialPushStatus(Long materialBaseInfoId, Integer pushStatus, String pushTime, Long pushBy, String pushByName) {
return AjaxResult.error(cause.getMessage());
}
};
}
}
@@ -1,5 +1,6 @@
package com.mhd.common.core.domain.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.mhd.common.core.annotation.Excel;
import lombok.Data;
import java.util.Date;
@@ -233,4 +234,15 @@ public class BusinessDocumentDTO extends BaseVOEntity{
private String paymentAccountId;
@ApiModelProperty("收款帐户名称")
private String paymentAccountName;
@ApiModelProperty("计费单位")
private String billingUnit;
@ApiModelProperty("计费单位2")
private String billingUnit2;
@ApiModelProperty("预计费金额")
private BigDecimal billingNum;
@ApiModelProperty("预计费金额")
private BigDecimal billingUnitPrice;
@ApiModelProperty("nc科目编码")
private String ncSubjectCode;
}
@@ -27,6 +27,8 @@ public class TmsShipperDTO implements Serializable {
/**货主类型(0-个人货主,1-企业货主))*/
@ApiModelProperty(value = "货主类型(0-个人货主,1-企业货主))")
private Integer shipperType;
@ApiModelProperty(name = "货主账号")
private String userAccount;
@ApiModelProperty(name = "最高组织id")
private Long topOrganizationId;
@ApiModelProperty(name = "归属组织id")
@@ -1,6 +1,7 @@
package com.mhd.common.core.domain.po;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.mhd.common.core.annotation.Excel;
import com.mhd.common.core.annotation.fieldsetvalue.NeedSetValue;
import io.swagger.annotations.ApiModelProperty;
@@ -12,6 +13,7 @@ import java.math.BigDecimal;
import java.util.Date;
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class UserShipperPo {
private static final long serialVersionUID = 1L;
@@ -266,6 +268,9 @@ public class UserShipperPo {
@ApiModelProperty("结算币种")
private String settlementCurrency;
@ApiModelProperty("货主code")
private String roleCodeShipper;
}
@@ -65,27 +65,67 @@ public class IpUtil {
public static IpLocation getLocation(String ip) {
IpLocation location = new IpLocation();
location.setIp(ip);
try (InputStream inputStream = IpUtils.class.getResourceAsStream("/ip2region.xdb");) {
if (StrUtil.isBlank(ip) || "unknown".equalsIgnoreCase(ip.trim()))
{
return location;
}
String ipv4 = ip.trim();
if (ipv4.contains(","))
{
ipv4 = ipv4.substring(0, ipv4.indexOf(',')).trim();
}
// ip2region xdb 对 IPv6 / 非法串可能抛 ArrayIndexOutOfBoundsException,仅对 IPv4 做库查询
if (!isLikelyIpv4(ipv4))
{
return location;
}
try (InputStream inputStream = IpUtils.class.getResourceAsStream("/ip2region.xdb"))
{
if (inputStream == null)
{
log.warn("ip2region.xdb 未找到,跳过 IP 归属解析");
return location;
}
byte[] bytes = IoUtil.readBytes(inputStream);
Searcher searcher = Searcher.newWithBuffer(bytes);
String region = searcher.search(ip);
if (StrUtil.isAllNotBlank(region)) {
// xdb返回格式 国家|区域|省份|城市|ISP,
// 只有中国的数据绝大部分精确到了城市,其他国家部分数据只能定位到国家,后前的选项全部是0
String[] result = region.split("\\|");
location.setCountry(ZERO.equals(result[0]) ? StrUtil.EMPTY : result[0]);
location.setProvince(ZERO.equals(result[2]) ? StrUtil.EMPTY : result[2]);
location.setCity(ZERO.equals(result[3]) ? StrUtil.EMPTY : result[3]);
location.setIsp(ZERO.equals(result[4]) ? StrUtil.EMPTY : result[4]);
try
{
String region = searcher.search(ipv4);
if (StrUtil.isNotBlank(region))
{
// xdb返回格式 国家|区域|省份|城市|ISP,
String[] result = region.split("\\|");
if (result.length >= 5)
{
location.setCountry(ZERO.equals(result[0]) ? StrUtil.EMPTY : result[0]);
location.setProvince(ZERO.equals(result[2]) ? StrUtil.EMPTY : result[2]);
location.setCity(ZERO.equals(result[3]) ? StrUtil.EMPTY : result[3]);
location.setIsp(ZERO.equals(result[4]) ? StrUtil.EMPTY : result[4]);
}
}
}
searcher.close();
} catch (Exception e) {
log.error("ip地址解析异常,error:", e);
finally
{
searcher.close();
}
}
catch (Exception e)
{
log.warn("ip地址解析失败,ip={}, msg={}", ipv4, e.getMessage());
return location;
}
return location;
}
private static boolean isLikelyIpv4(String ip)
{
if (ip == null || ip.contains(":"))
{
return false;
}
return ip.chars().filter(ch -> ch == '.').count() == 3L;
}
/**
* 根据iP获取归属地信息 - 拼接
*
@@ -93,7 +133,7 @@ public class IpUtil {
*/
public static String getLocationSplicing(String ip) {
IpLocation location = getLocation(ip);
return location.getProvince()+location.getCity();
return StrUtil.nullToEmpty(location.getProvince()) + StrUtil.nullToEmpty(location.getCity());
}
public static void main(String[] args) {
@@ -80,7 +80,15 @@ public class LogAspect
// 请求的地址
String ip = IpUtils.getIpAddr(ServletUtils.getRequest());
operLog.setOperIp(ip);
operLog.setOperLocation(StrUtil.isNotEmpty(operLog.getOperIp()) ? IpUtil.getLocationSplicing(operLog.getOperIp()) : "");
try
{
operLog.setOperLocation(StrUtil.isNotEmpty(operLog.getOperIp()) ? IpUtil.getLocationSplicing(operLog.getOperIp()) : "");
}
catch (Throwable t)
{
log.warn("操作日志 IP 归属解析跳过: {}", t.getMessage());
operLog.setOperLocation("");
}
operLog.setOperUrl(ServletUtils.getRequest().getRequestURI());
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null){
@@ -72,4 +72,13 @@ public class DictUtils
{
return Constants.SYS_DICT_KEY + configKey;
}
/**
* 字典缓存键:同一 dict_type 在不同组织下可并存,需带上组织维度(null 视为 0 平台)
*/
public static String dictTypeOrgCacheKey(String dictType, Long organizationId)
{
long oid = organizationId == null ? 0L : organizationId.longValue();
return dictType + "@" + oid;
}
}
@@ -106,10 +106,10 @@ public class BatchDetailApplicationService {
throw new ServiceException("获取物料规则信息失败");
}
MaterialGoodsRuleFeign materialGoodsRuleFeign = JSON.parseObject(JSONObject.toJSONString(ajaxResult.get("data")), MaterialGoodsRuleFeign.class);
// 无商品规则或未绑定批次模板时,不返回任何批次属性(避免 batchId 空导致查全表)
if (ObjectUtil.isNull(materialGoodsRuleFeign) || materialGoodsRuleFeign.getBatchId() == null) {
// 未绑定批次时只返回空列表,不可按空 batchId 全表查 batch_detail
return new ArrayList<>();
}
return getBatchDetailListByBatchId(materialGoodsRuleFeign.getBatchId());
}
}
}
@@ -337,6 +337,165 @@ public class ContractManageApplicationService {
return result;
}
/** 单据类型「仓库进出仓单」编码(与 BMS / WMS 推送一致) */
public static final String DOCUMENT_TYPE_CODE_WAREHOUSE_IN_OUT_ORDER = "WMS_ckjccd";
/**
* 按结算主体取仓储合同结算设置中,单据类型包含指定类型的费用科目编码(按明细行顺序,可重复,调用方去重)。
* 科目编码优先取二级 {@code second_subject_code},为空则取一级 {@code first_subject_code}。
* settlementCustomersCode 为空时与同模块合同逻辑一致:使用通用仓储合同(commonContractFlag=1)。
*/
public List<String> listSecondSubjectCodesBySettlementAndDocumentType(String settlementCustomersCode,
Long organizationId,
Long topOrganizationId,
String documentTypeCode) {
if (StringUtils.isEmpty(documentTypeCode)) {
return Collections.emptyList();
}
ContractManagePO contractManagePO = getInfoByCustomerAndOrganizationId(settlementCustomersCode, 1, topOrganizationId, organizationId);
if (contractManagePO == null || contractManagePO.getContractManageId() == null) {
return Collections.emptyList();
}
List<ContractManageDetailPO> detailPOS = contractManageDetailDomainService.queryListByManageId(contractManagePO.getContractManageId());
if (detailPOS == null || detailPOS.isEmpty()) {
return Collections.emptyList();
}
List<String> codes = new ArrayList<>();
for (ContractManageDetailPO detail : detailPOS) {
if (detail == null) {
continue;
}
String subjectCode = resolveContractDetailExpenseSubjectCode(detail);
if (StringUtils.isEmpty(subjectCode)) {
continue;
}
if (!matchesContractDetailWarehouseInOut(detail, documentTypeCode)) {
continue;
}
codes.add(subjectCode);
}
return codes;
}
/**
* 合同结算行的费用科目编码:有二级科目用二级,否则用一级。
*/
private static String resolveContractDetailExpenseSubjectCode(ContractManageDetailPO detail) {
if (detail == null) {
return null;
}
if (!StringUtils.isEmpty(detail.getSecondSubjectCode())) {
return detail.getSecondSubjectCode().trim();
}
if (!StringUtils.isEmpty(detail.getFirstSubjectCode())) {
return detail.getFirstSubjectCode().trim();
}
return null;
}
/**
* 是否属于「仓库进出仓单」类结算行:优先按单据类型编码精确匹配(含逗号分隔多编码),
* 避免因 BMS 主数据编码与 WMS 计费推送编码(如 WMS_ckjccd)不一致导致筛掉全部行;
* 兼容按单据类型名称包含「仓库进出仓」判定(合同保存时会拼接中文名称)。
*/
private static boolean matchesContractDetailWarehouseInOut(ContractManageDetailPO detail, String documentTypeCode) {
if (detail == null || StringUtils.isEmpty(documentTypeCode)) {
return false;
}
if (contractDetailContainsDocumentType(detail.getDocumentTypeCode(), documentTypeCode)) {
return true;
}
String typeNames = detail.getDocumentType();
if (StringUtils.isEmpty(typeNames)) {
return false;
}
return Stream.of(typeNames.split(","))
.map(String::trim)
.filter(s -> !StringUtils.isEmpty(s))
.anyMatch(n -> n.contains("仓库进出仓"));
}
private static boolean contractDetailContainsDocumentType(String detailDocumentTypeCodes, String documentTypeCode) {
if (StringUtils.isEmpty(detailDocumentTypeCodes)) {
return false;
}
return Stream.of(detailDocumentTypeCodes.split(","))
.map(String::trim)
.filter(s -> !StringUtils.isEmpty(s))
.anyMatch(code -> code.equalsIgnoreCase(documentTypeCode));
}
/**
* 按单据类型取合同结算行上的计费单价(计费策略展开的 isFee 项)。
* <p>多条结算明细共用同一计费策略(accounting_strategy_id 相同)时,只展开一次策略参数,
* 避免前端出现重复的单价列。</p>
*/
public List<SubjectAndPriceReturn> getPrice(String documentTypeCode, String settlementCustomersCode,Long organizationId,Long topOrganizationId) {
List<SubjectAndPriceReturn> result = new ArrayList<>();
ContractManagePO contractManagePO = getInfoByCustomerAndOrganizationId(settlementCustomersCode, 1, topOrganizationId, organizationId);
List<ContractManageDetailPO> detailPOS = contractManageDetailDomainService.queryListByManageId(contractManagePO.getContractManageId());
contractManagePO.setContractManageDetailPOList(detailPOS);
if (contractManagePO != null) {
List<ContractManageDetailPO> contractManageDetailPOList = contractManagePO.getContractManageDetailPOList();
if (contractManageDetailPOList != null && contractManageDetailPOList.size() > 0) {
List<ContractManageDetailPO> contractManageDetailPOs = contractManageDetailPOList.stream()
.filter(item -> contractDetailContainsDocumentType(item.getDocumentTypeCode(), documentTypeCode))
.collect(Collectors.toList());
if (contractManageDetailPOs != null && contractManageDetailPOs.size() > 0) {
Set<Long> expandedAccountingStrategyIds = new HashSet<>();
for (ContractManageDetailPO contractManageDetailPO : contractManageDetailPOs) {
Long accountingStrategyId = contractManageDetailPO.getAccountingStrategyId();
if (accountingStrategyId == null || !expandedAccountingStrategyIds.add(accountingStrategyId)) {
continue;
}
List<BillingParamsPO> billingParams = contractManageDetailMapper.getBillingParams(accountingStrategyId);
if (billingParams != null && billingParams.size() > 0) {
//if (billingParams != null && billingParams.size() > 0) {
BillingParamsPO billingParam = billingParams.get(0);
String billingParamsJson = billingParam.getBillingParamsJson();
String preSetRules = billingParam.getPreSetRules();
Long billingParamsId = billingParam.getBillingParamsId();
List<Map<String, Object>> preSetRulesList = JSON.parseObject(preSetRules, new TypeReference<List<Map<String, Object>>>() {});
List<Map<String, Object>> billingParamsList = JSON.parseObject(billingParamsJson, new TypeReference<List<Map<String, Object>>>() {});
if (preSetRulesList != null && preSetRulesList.size() > 0) {
Map<String, Object> stringObjectMap1 = preSetRulesList.get(0);
for (Map<String, Object> stringObjectMap : billingParamsList) {
String fieldsName = (String) stringObjectMap.get("fieldsName");
String isShow = (String) stringObjectMap.get("isShow");
String isFee = (String) stringObjectMap.get("isFee");
String isPush = (String) stringObjectMap.get("isPush");
if ("1".equals(isFee)) {
Integer sort = (Integer) stringObjectMap.get("sort");
String chargingId = (String) stringObjectMap.get("chargingId");
String fields = (String) stringObjectMap.get("fields");
String price = (String) stringObjectMap1.get("fields" + sort);
SubjectAndPriceReturn subjectAndPriceReturn = new SubjectAndPriceReturn();
subjectAndPriceReturn.setName(fieldsName);
subjectAndPriceReturn.setPrice(new BigDecimal(price));
subjectAndPriceReturn.setChargingId(chargingId);
subjectAndPriceReturn.setFields(fields);
subjectAndPriceReturn.setBillingRulesId(accountingStrategyId);
subjectAndPriceReturn.setIsShow(isShow);
subjectAndPriceReturn.setIsFee(isFee);
subjectAndPriceReturn.setIsPush(isPush);
subjectAndPriceReturn.setRulesId(billingParamsId);
result.add(subjectAndPriceReturn);
}
}
}
//}
} else {
throw new ServiceException("计费参数不存在");
}
}
}
}
} else {
throw new ServiceException("合同信息不存在");
}
return result;
}
public List<SubjectAndPriceReturn> getSubject(SubjectAndPriceDTO contractManageDTO) {
List<SubjectAndPriceReturn> result = new ArrayList<>();
Long settlementCustomersId = contractManageDTO.getSettlementCustomersId();
@@ -757,6 +916,100 @@ public class ContractManageApplicationService {
return resultContract;
}
/**
* 根据结算主体获取合同信息
* @param settlementCustomersCode 结算主体code
* @param contractType 合同类型
*/
public ContractManagePO getInfoByCustomerAndOrganizationId(String settlementCustomersCode,Integer contractType, Long topOrganizationId, Long organizationId) {
/*
首先根据合同类型(仓储、运输),以及结算客户,查询合同信息
如果传了结算主体,则根据结算主体以及当前时间查询有效的特殊合同,如果特殊合同没有,则查询通用合同
*/
//获取当前登录人信息
LoginUser loginUser = SecurityUtils.getLoginUser();
if (ObjectUtil.isNull(loginUser) && topOrganizationId == null) {
throw new DigitalLogisticsException(UserError.TIMEOUT);
}
if(contractType==null){
throw new ServiceException("合同类型不能为空");
}
ContractManagePO resultContract = new ContractManagePO();
//查询当前日期在有效期内的合同
ContractManageDO queryParam = new ContractManageDO();
queryParam.setNowDateString(DateUtil.format(new Date(),"yyyy-MM-dd"));
if (!ObjectUtil.isNull(loginUser)) {
queryParam.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
}else {
queryParam.setTopOrganizationId(topOrganizationId);
}
if (ObjectUtil.isNotEmpty(organizationId)) {
queryParam.setOrganizationId(organizationId);
}
List<ContractManagePO> contractManagePOList = contractManageDomainService.queryList(queryParam);
if(contractManagePOList != null && contractManagePOList.size()>0){
if(StringUtils.isNotEmpty(settlementCustomersCode)){
//根据结算对象,及合同的类型 查询对应合同信息
ContractManagePO contractManagePO = contractManagePOList.stream()
.filter(item -> item.getSettlementCustomersCode().equals(settlementCustomersCode) && Objects.equals(item.getContractType(), contractType)).findFirst().orElse(null);
if(null == contractManagePO){
if(contractType==1){
//仓储合同
resultContract = contractManagePOList.stream()
.filter(item ->
item.getContractType()==1 &&
item.getCommonContractFlag() == 1 && item.getContractState() ==2)
.findFirst().orElse(null);
}else{
//运输合同
resultContract = contractManagePOList.stream().filter(item -> item.getContractType()==2
&& item.getCommonContractFlag() == 1 && item.getContractState() ==2).findFirst().orElse(null);
}
}else {
resultContract = contractManagePO;
}
}else {
if(contractType==1){
//仓储合同
resultContract = contractManagePOList.stream().filter(contractManagePO -> contractManagePO.getContractType()==1
&& contractManagePO.getCommonContractFlag() == 1 && contractManagePO.getContractState() ==2).findFirst().orElse(null);
}else{
//运输合同
resultContract = contractManagePOList.stream().filter(contractManagePO -> contractManagePO.getContractType()==2
&& contractManagePO.getCommonContractFlag() == 1 && contractManagePO.getContractState() ==2).findFirst().orElse(null);
}
}
if(null == resultContract){
throw new ServiceException("找不到匹配的合同,请重试");
}
//得到合同后,查询合同明细
List<ContractManageDetailPO> contractManageDetailPOList = contractManageDetailDomainService.queryListByManageId(resultContract.getContractManageId());
List<ContractManageDetailPO> contractManageDetailSaveList = new ArrayList<>();
if(contractManageDetailPOList != null && contractManageDetailPOList.size()>0){
//将临时合同中没有,但是通用合同中有的数据过滤出(使用 ObjectUtil.equal 避免 firstSubjectCode/secondSubjectCode 为 null 时 NPE
contractManageDetailSaveList = contractManageDetailPOList.stream().filter(item -> contractManageDetailPOList.stream().noneMatch(item1 -> ObjectUtil.equal(item1.getFirstSubjectCode(), item.getFirstSubjectCode()) && ObjectUtil.equal(item1.getSecondSubjectCode(), item.getSecondSubjectCode()) && item1.getSubjectType()==1)).collect(Collectors.toList());
//首先根据结算科目类型将临时合同过滤出
List<ContractManageDetailPO> tempContractManageDetailPOList = contractManageDetailPOList.stream().filter(item -> item.getSubjectType()==2).collect(Collectors.toList());
//遍历两个集合,将相同费用科目code的数据,进行比较,如果结算科目类型是临时且合同有效期有效,则使用该条数据,将另一条移除
for (ContractManageDetailPO manageDetailPO : tempContractManageDetailPOList) {
for (ContractManageDetailPO contractManageDetailPO : contractManageDetailPOList) {
if(ObjectUtil.equal(contractManageDetailPO.getFirstSubjectCode(), manageDetailPO.getFirstSubjectCode()) && ObjectUtil.equal(contractManageDetailPO.getSecondSubjectCode(), manageDetailPO.getSecondSubjectCode())){
//判断如果是临时合同在有效期内,则将该条数据保存到集合contractManageDetailSaveList
DateTime start = DateUtil.parseDate(DateUtil.format(manageDetailPO.getSubjectEffectiveDate(),"yyyy-MM-dd"));
DateTime end = DateUtil.parseDateTime(DateUtil.format(manageDetailPO.getSubjectEffectiveDate(),"yyyy-MM-dd"));
DateTime now = DateUtil.beginOfDay(DateUtil.date());
if (now.isAfterOrEquals(start) && now.isBefore(end)) {
contractManageDetailSaveList.add(manageDetailPO);
}
}
}
}
}
resultContract.setContractManageDetailPOList(contractManageDetailSaveList);
}
return resultContract;
}
/**
* 作废合同
* @param contractManageDTO
@@ -9,6 +9,7 @@ import com.mhd.basic.domain.expenseAccount.repository.po.QueryExpenseAccountPO;
import com.mhd.basic.domain.expenseAccount.repository.todo.ExpenseAccountDO;
import com.mhd.basic.domain.expenseAccount.repository.todo.ExpenseAccountDoMap;
import com.mhd.basic.domain.expenseAccount.repository.todo.SearchExpenseAccountDO;
import com.mhd.basic.application.service.contractManage.ContractManageApplicationService;
import com.mhd.basic.domain.expenseAccount.service.ExpenseAccountDomainService;
import com.mhd.basic.infrastructure.feign.vo.SysDictDataVo;
import com.mhd.basic.interfaces.dto.expenseAccount.ExpenseAccountDTO;
@@ -27,8 +28,10 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -45,8 +48,64 @@ public class ExpenseAccountApplicationService {
@Autowired
private ExpenseAccountDomainService expenseAccountDomainService;
@Autowired
private ContractManageApplicationService contractManageApplicationService;
@Autowired
private SystemServiceFeign systemServiceFeign;
/**
* 入库/出库费用登记等场景:按仓储合同「仓库进出仓单」结算行取科目(二级编码优先,否则一级),再关联费用科目主数据。
* <p>科目范围以合同结算设置为准;若 {@code expenseAccountDO.inOrderDisplay} 或 {@code expenseAccountDO.outOrderDisplay} 非空,
* 再按主数据「入库单是否固定显示 / 出库单是否固定显示」(0-否 1-是)与入参相等过滤,二者同时传则同时满足(AND)。</p>
* settlementCustomersCode 不传或为空时使用通用仓储合同。
*/
public List<ExpenseAccountPO> queryListFromContractWarehouseInOutSettlement(ExpenseAccountDO expenseAccountDO, String settlementCustomersCode) {
Long topOrgIdForExpense = expenseAccountDO.getTopOrganizationId();
if (topOrgIdForExpense == null) {
LoginUser lu = SecurityUtils.getLoginUser();
if (lu != null && lu.getUserPo() != null && lu.getUserPo().getTopOrganizationId() != null) {
topOrgIdForExpense = lu.getUserPo().getTopOrganizationId();
}
}
List<String> orderedCodes = contractManageApplicationService.listSecondSubjectCodesBySettlementAndDocumentType(
settlementCustomersCode,
expenseAccountDO.getOrganizationId(),
topOrgIdForExpense,
ContractManageApplicationService.DOCUMENT_TYPE_CODE_WAREHOUSE_IN_OUT_ORDER);
log.info("按合同取费用科目编码:topOrgIdForExpense={}, 命中结算行科目数={}", topOrgIdForExpense,
orderedCodes != null ? orderedCodes.size() : 0);
boolean filterIn = expenseAccountDO.getInOrderDisplay() != null;
boolean filterOut = expenseAccountDO.getOutOrderDisplay() != null;
if (filterIn || filterOut) {
log.info("合同科目叠加主数据出入库显示过滤:inOrderDisplay={}, outOrderDisplay={}",
expenseAccountDO.getInOrderDisplay(), expenseAccountDO.getOutOrderDisplay());
}
List<ExpenseAccountPO> result = new ArrayList<>();
for (String code : orderedCodes) {
if (StringUtils.isEmpty(code)) {
continue;
}
ExpenseAccountPO po = expenseAccountDomainService.getInfoByCode2(code.trim(), topOrgIdForExpense);
if (po != null && po.getExpenseAccountId() != null && passWarehouseInOutDisplayFilter(po, expenseAccountDO)) {
result.add(po);
}
}
return result;
}
/**
* 合同路径下可选:与主数据 in_order_display / out_order_display 一致才保留(入参为 null 的维度不参与过滤)。
*/
private static boolean passWarehouseInOutDisplayFilter(ExpenseAccountPO po, ExpenseAccountDO filter) {
if (filter.getInOrderDisplay() != null
&& !Objects.equals(po.getInOrderDisplay(), filter.getInOrderDisplay())) {
return false;
}
if (filter.getOutOrderDisplay() != null
&& !Objects.equals(po.getOutOrderDisplay(), filter.getOutOrderDisplay())) {
return false;
}
return true;
}
/**
* 分页查询费用科目列表
@@ -107,7 +107,31 @@ public class AssociationWarehouseImpl extends ServiceImpl<AssociationWarehouseMa
associationWarehouseDO.setWarehouseId(associationWarehouseDO.getWarehouseIdIdList().get(0));
//设置仓库信息
warehouseParam(associationWarehouseDO);
for (Long correlationId : associationWarehouseDO.getCorrelationIdList()){
// 先删该仓下「非默认仓」绑定,再批量插入本次提交的用户;保留 is_default=2(如新建仓自动写入的创建人默认仓),避免前端列表不展示该条却全量保存时被误删
remove(new QueryWrapper<AssociationWarehouse>().lambda()
.eq(AssociationWarehouse::getWarehouseId, associationWarehouseDO.getWarehouseId())
.eq(AssociationWarehouse::getDelFlag, 1)
.and(w -> w.isNull(AssociationWarehouse::getIsDefault)
.or()
.ne(AssociationWarehouse::getIsDefault, 2)));
List<AssociationWarehouse> stillBoundRows = associationWarehouseMapper.selectList(new QueryWrapper<AssociationWarehouse>().lambda()
.eq(AssociationWarehouse::getWarehouseId, associationWarehouseDO.getWarehouseId())
.eq(AssociationWarehouse::getDelFlag, 1));
Set<Long> alreadyBoundCorrelationIds = stillBoundRows.stream()
.map(AssociationWarehouse::getCorrelationId)
.filter(Objects::nonNull)
.collect(Collectors.toSet());
LinkedHashSet<Long> distinctCorrelationIds = CollectionUtils.isEmpty(associationWarehouseDO.getCorrelationIdList())
? new LinkedHashSet<>()
: new LinkedHashSet<>(associationWarehouseDO.getCorrelationIdList());
for (Long correlationId : distinctCorrelationIds) {
if (correlationId == null) {
continue;
}
// 仍在库内的绑定(多为创建人默认仓 is_default=2)不再插入,否则撞唯一 IDX_ASS_COR_WAR_ID
if (alreadyBoundCorrelationIds.contains(correlationId)) {
continue;
}
AssociationWarehouse associationWarehouse = new AssociationWarehouse();
associationWarehouse.setOrganizationId(loginUser.getUserPo().getOrganizationId());
associationWarehouse.setOrganizationName(loginUser.getUserPo().getOrganizationName());
@@ -121,13 +145,6 @@ public class AssociationWarehouseImpl extends ServiceImpl<AssociationWarehouseMa
associationWarehouse.setCreateTime(new Date());
associationWarehouseList.add(associationWarehouse);
}
// 先删该仓下「非默认仓」绑定,再批量插入本次提交的用户;保留 is_default=2(如新建仓自动写入的创建人默认仓),避免前端列表不展示该条却全量保存时被误删
remove(new QueryWrapper<AssociationWarehouse>().lambda()
.eq(AssociationWarehouse::getWarehouseId, associationWarehouseDO.getWarehouseId())
.eq(AssociationWarehouse::getDelFlag, 1)
.and(w -> w.isNull(AssociationWarehouse::getIsDefault)
.or()
.ne(AssociationWarehouse::getIsDefault, 2)));
}
return saveBatch(associationWarehouseList);
}
@@ -75,4 +75,4 @@ public class BatchDetailDomainService {
batchDetailDO.setBatchId(batchId);
return batchDetailService.queryList(batchDetailDO);
}
}
}
@@ -1,6 +1,7 @@
package com.mhd.basic.domain.expenseAccount.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.mhd.common.core.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
@@ -113,4 +114,25 @@ public class ExpenseAccount extends BaseVOEntity{
@ApiModelProperty("费率")
private BigDecimal rate;
@ApiModelProperty("计费单位")
private String billingUnit;
@ApiModelProperty("计费单位英文")
private String billingUnitEn;
@ApiModelProperty("计费单位2")
private String billingUnit2;
@ApiModelProperty("计费单位2英文")
private String billingUnitEn2;
@ApiModelProperty("计费单位中文默认")
private String billingUnitDefaultCn;
@ApiModelProperty("计费单位英文默认")
private String billingUnitDefaultEn;
@ApiModelProperty("nc科目编码")
private String ncSubjectCode;
}
@@ -1,5 +1,6 @@
package com.mhd.basic.domain.expenseAccount.repository.po;
import com.baomidou.mybatisplus.annotation.TableField;
import com.mhd.common.core.annotation.Excel;
import lombok.Data;
import java.util.Date;
@@ -136,4 +137,26 @@ public class ExpenseAccountPO extends BaseVOEntity{
@ApiModelProperty(name = "出库单是否固定显示 0-否 1-是")
private Integer outOrderDisplay;
@ApiModelProperty("计费单位")
private String billingUnit;
@ApiModelProperty("计费单位英文")
private String billingUnitEn;
@ApiModelProperty("计费单位2")
private String billingUnit2;
@ApiModelProperty("计费单位2英文")
private String billingUnitEn2;
@ApiModelProperty("计费单位中文默认")
private String billingUnitDefaultCn;
@ApiModelProperty("计费单位英文默认")
private String billingUnitDefaultEn;
@ApiModelProperty("nc科目编码")
private String ncSubjectCode;
}
@@ -153,4 +153,32 @@ public class ExpenseAccountDO extends BaseVOEntity{
@ApiModelProperty(name = "创建者姓名")
private String updateByName;
@ApiModelProperty("计费单位")
private String billingUnit;
@ApiModelProperty("计费单位英文")
private String billingUnitEn;
@ApiModelProperty("计费单位2")
private String billingUnit2;
@ApiModelProperty("计费单位2英文")
private String billingUnitEn2;
@ApiModelProperty("计费单位中文默认")
private String billingUnitDefaultCn;
@ApiModelProperty("计费单位英文默认")
private String billingUnitDefaultEn;
@ApiModelProperty("nc科目编码")
private String ncSubjectCode;
/** 查询参数:是否按仓储合同结算设置拉取科目 */
private Boolean contractSettlementQuery;
/** 查询参数:结算主体编码(货主编码等) */
private String settlementCustomersCode;
}
@@ -389,4 +389,13 @@ public class MaterialBaseInfo extends BaseVOEntity{
@ApiModelProperty("是否抄码: 1-是 2-否")
@Excel(name = "是否抄码: 1-是 2-否")
private Integer copyCode;
@ApiModelProperty("货物类型:0-物料 1-半成品 2-成品")
@Excel(name = "货物类型:0-物料 1-半成品 2-成品")
private Integer goodsType;
@ApiModelProperty("毛重(kg")
@Excel(name = "毛重(kg")
private BigDecimal grossWeight;
}
@@ -365,6 +365,14 @@ public class MaterialBaseInfoPO extends BaseVOEntity{
@Excel(name = "是否抄码: 1-是 2-否")
private Integer copyCode;
@ApiModelProperty("货物类型:0-物料 1-半成品 2-成品")
@Excel(name = "货物类型:0-物料 1-半成品 2-成品")
private Integer goodsType;
@ApiModelProperty("毛重(kg")
@Excel(name = "毛重(kg")
private BigDecimal grossWeight;
@ApiModelProperty("商品规则")
private MaterialGoodsRuleFeign materialGoodsRule;
@@ -385,4 +385,12 @@ public class MaterialBaseInfoDO extends BaseVOEntity{
@ApiModelProperty("是否抄码: 1-是 2-否")
@Excel(name = "是否抄码: 1-是 2-否")
private Integer copyCode;
@ApiModelProperty("货物类型:0-物料 1-半成品 2-成品")
@Excel(name = "货物类型:0-物料 1-半成品 2-成品")
private Integer goodsType;
@ApiModelProperty("毛重(kg")
@Excel(name = "毛重(kg")
private BigDecimal grossWeight;
}
@@ -138,4 +138,35 @@ public class ExpenseAccountDTO extends BaseVOEntity{
@ApiModelProperty(name = "出库单是否固定显示 0-否 1-是")
private Integer outOrderDisplay;
@ApiModelProperty("计费单位")
private String billingUnit;
@ApiModelProperty("计费单位英文")
private String billingUnitEn;
@ApiModelProperty("计费单位2")
private String billingUnit2;
@ApiModelProperty("计费单位2英文")
private String billingUnitEn2;
@ApiModelProperty("计费单位中文默认")
private String billingUnitDefaultCn;
@ApiModelProperty("计费单位英文默认")
private String billingUnitDefaultEn;
@ApiModelProperty("nc科目编码")
private String ncSubjectCode;
/**
* 为 true 时从仓储合同「结算设置」取费用科目(入库/出库费用登记等)
*/
@ApiModelProperty("是否按合同结算设置查询费用科目(入库/出库费用登记;为 true 时可传 inOrderDisplay=1 或 outOrderDisplay=1 再按主数据入库/出库显示过滤)")
private Boolean contractSettlementQuery;
@ApiModelProperty("结算主体编码(通常为货主编码);不传则按通用仓储合同的结算设置取科目")
private String settlementCustomersCode;
}
@@ -364,4 +364,13 @@ public class MaterialBaseInfoDTO extends BaseVOEntity{
@ApiModelProperty("是否抄码: 1-是 2-否")
@Excel(name = "是否抄码: 1-是 2-否")
private Integer copyCode;
@ApiModelProperty("货物类型:0-物料 1-半成品 2-成品")
@Excel(name = "货物类型:0-物料 1-半成品 2-成品")
private Integer goodsType;
@ApiModelProperty("毛重(kg")
@Excel(name = "毛重(kg")
private BigDecimal grossWeight;
}
@@ -70,6 +70,19 @@ public class ContractManageApi extends BaseController{
return AjaxResult.success(contractManageApplicationService.getSubject(subjectAndPriceDTO));
}
/**
* 获取单价
*/
@ApiOperation("获取单价")
@GetMapping(value = "/getPrice")
public AjaxResult getPrice(@RequestParam("documentTypeCode") String documentTypeCode,
@RequestParam("settlementCustomersCode") String settlementCustomersCode,
@RequestParam("organizationId") Long organizationId,
@RequestParam("topOrganizationId") Long topOrganizationId)
{
return AjaxResult.success(contractManageApplicationService.getPrice(documentTypeCode,settlementCustomersCode,organizationId,topOrganizationId));
}
/**
* 获取科目和单价
*/
@@ -154,6 +167,13 @@ public class ContractManageApi extends BaseController{
return AjaxResult.success(contractManageApplicationService.getInfoByCustomer(settlementCustomersCode,contractType,topOrganizationId));
}
@ApiOperation("根据结算主体获取合同信息")
@GetMapping(value = "/getInfoByCustomerAndOrganizationId")
public AjaxResult getInfoByCustomerAndOrganizationId(@RequestParam("settlementCustomersCode") String settlementCustomersCode,@RequestParam("contractType") Integer contractType,@RequestParam("topOrganizationId") Long topOrganizationId,@RequestParam("organizationId") Long organizationId)
{
return AjaxResult.success(contractManageApplicationService.getInfoByCustomerAndOrganizationId(settlementCustomersCode,contractType,topOrganizationId,organizationId));
}
@ApiOperation("根据合同编码获取合同管理")
@GetMapping(value = "/getInfoByCode")
public AjaxResult getInfoByCode(@RequestParam(value = "contractNumber",required = true) String contractNumber)
@@ -50,6 +50,11 @@ public class ExpenseAccountApi extends BaseController{
/**
* 分页查询费用科目列表
*
* <p>入库/出库费用登记等场景传 {@code contractSettlementQuery=true}(与单据类型「仓库进出仓单」合同结算行一致),
* 科目来源、结算主体为空走通用合同等逻辑<strong>入库与出库相同</strong>。
* 先按合同结算行取科目,再关联主数据;若请求中传入 {@code inOrderDisplay} 或 {@code outOrderDisplay}0-否 1-是),
* 则再按主数据「入库单 / 出库单是否固定显示」与入参相等过滤(二者都传则同时满足)。不传则不在此维度过滤。</p>
*/
@ApiOperation("查询费用科目列表")
@GetMapping("/list")
@@ -62,6 +67,18 @@ public class ExpenseAccountApi extends BaseController{
expenseAccountDTO = new ExpenseAccountDTO();
logger.info("expenseAccountDTO 为 null,创建新对象");
}
if (Boolean.TRUE.equals(expenseAccountDTO.getContractSettlementQuery())) {
ExpenseAccountDO contractQueryDO = new ExpenseAccountDO();
BeanUtils.copyProperties(expenseAccountDTO, contractQueryDO);
logger.info("按合同结算设置查询费用科目,settlementCustomersCode={}inOrderDisplay={}outOrderDisplay={}",
expenseAccountDTO.getSettlementCustomersCode(),
expenseAccountDTO.getInOrderDisplay(), expenseAccountDTO.getOutOrderDisplay());
List<ExpenseAccountPO> contractList =
expenseAccountApplicationService.queryListFromContractWarehouseInOutSettlement(
contractQueryDO, expenseAccountDTO.getSettlementCustomersCode());
logger.info("按合同结算设置查询完成,条数:{}", contractList != null ? contractList.size() : 0);
return getDataTable(contractList != null ? contractList : new ArrayList<>());
}
ExpenseAccountDO expenseAccountDO = new ExpenseAccountDO();
BeanUtils.copyProperties(expenseAccountDTO, expenseAccountDO);
logger.info("转换后的 ExpenseAccountDO{}", expenseAccountDO);
@@ -5,6 +5,9 @@ import com.mhd.basic.interfaces.vo.MaterialStockInfoVo;
import java.util.List;
import java.util.stream.Collectors;
import com.mhd.system.api.OmsServiceFeign;
import com.mhd.system.api.domain.ErpCountryDTO;
import com.mhd.system.api.domain.ErpEnterpriseUnitDTO;
import com.mhd.system.api.domain.MaterialBarCodeFeign;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
@@ -41,6 +44,9 @@ public class MaterialBaseInfoApi extends BaseController{
@Resource
private MaterialBaseInfoAssembler materialBaseInfoAssembler;
@Resource
private OmsServiceFeign omsServiceFeign;
/**
* 分页查询物料基础信息列表
*/
@@ -108,4 +114,16 @@ public class MaterialBaseInfoApi extends BaseController{
return R.ok(materialBaseInfoApplicationService.getMaterialStockList(shipperName,materialName,machineCode,pageNum,pageSize));
}
@ApiOperation("获取企业单位列表-申报单位下拉框用")
@GetMapping("/getDeclarationUnitList")
public AjaxResult getDeclarationUnitList(ErpEnterpriseUnitDTO erpEnterpriseUnitDTO) {
return omsServiceFeign.getUnitList(erpEnterpriseUnitDTO);
}
@ApiOperation("获取企业国别列表-原产国下拉框用")
@GetMapping("/getCountryList")
public AjaxResult getCountryList(ErpCountryDTO erpCountryDTO) {
return omsServiceFeign.getCountryList(erpCountryDTO);
}
}
@@ -15,6 +15,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.mhd.common.core.constant.UserConstants;
import com.mhd.common.core.domain.po.UserPo;
import com.mhd.common.core.utils.StringUtils;
import com.mhd.common.core.utils.poi.ExcelUtil;
import com.mhd.common.core.web.controller.BaseController;
import com.mhd.common.core.web.domain.AjaxResult;
@@ -23,6 +25,7 @@ import com.mhd.common.log.annotation.Log;
import com.mhd.common.log.enums.BusinessType;
import com.mhd.common.security.utils.SecurityUtils;
import com.mhd.system.api.domain.SysDictType;
import com.mhd.system.api.model.LoginUser;
/**
* 数据字典信息
@@ -73,14 +76,56 @@ public class SysDictTypeController extends BaseController
@PostMapping
public AjaxResult add(@Validated @RequestBody SysDictType dict)
{
fillDictTypeOrganization(dict);
if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
{
return AjaxResult.error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
return AjaxResult.error("新增字典'" + dict.getDictName() + "'失败,字典类型编码「" + dict.getDictType() + "」已存在(全局不可重复)");
}
dict.setCreateBy(SecurityUtils.getUsername());
return toAjax(dictTypeService.insertDictType(dict));
}
/**
* 写入组织维度优先使用请求体中选择的组织未传时使用当前登录用户所属组织无登录上下文时按平台0处理
*/
private void fillDictTypeOrganization(SysDictType dict)
{
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser == null || loginUser.getUserPo() == null)
{
if (dict.getOrganizationId() == null)
{
dict.setOrganizationId(0L);
}
return;
}
UserPo userPo = loginUser.getUserPo();
if (dict.getOrganizationId() == null)
{
dict.setOrganizationId(userPo.getOrganizationId());
if (StringUtils.isEmpty(dict.getOrganizationName()))
{
dict.setOrganizationName(userPo.getOrganizationName());
}
if (dict.getTopOrganizationId() == null)
{
dict.setTopOrganizationId(userPo.getTopOrganizationId());
}
}
else
{
if (dict.getTopOrganizationId() == null)
{
dict.setTopOrganizationId(userPo.getTopOrganizationId());
}
if (StringUtils.isEmpty(dict.getOrganizationName())
&& java.util.Objects.equals(dict.getOrganizationId(), userPo.getOrganizationId()))
{
dict.setOrganizationName(userPo.getOrganizationName());
}
}
}
/**
* 修改字典类型
*/
@@ -89,9 +134,10 @@ public class SysDictTypeController extends BaseController
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysDictType dict)
{
fillDictTypeOrganization(dict);
if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
{
return AjaxResult.error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
return AjaxResult.error("修改字典'" + dict.getDictName() + "'失败,字典类型编码「" + dict.getDictType() + "」已存在(全局不可重复)");
}
dict.setUpdateBy(SecurityUtils.getUsername());
return toAjax(dictTypeService.updateDictType(dict));
@@ -98,4 +98,12 @@ public interface SysDictDataMapper extends BaseMapper<SysDictData>
* @return 结果
*/
public int updateDictDataType(@Param("oldDictType") String oldDictType, @Param("newDictType") String newDictType);
/**
* 按字典类型批量同步字典数据的组织信息与字典类型归属一致
*/
int updateDictDataOrganizationByDictType(@Param("dictType") String dictType,
@Param("organizationId") Long organizationId,
@Param("organizationName") String organizationName,
@Param("topOrganizationId") Long topOrganizationId);
}
@@ -79,5 +79,5 @@ public interface SysDictTypeMapper
* @param dictType 字典类型
* @return 结果
*/
public SysDictType checkDictTypeUnique(String dictType);
public SysDictType checkDictTypeUnique(SysDictType dictType);
}
@@ -4,17 +4,24 @@ import java.util.ArrayList;
import java.util.List;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mhd.basic.infrastructure.feign.ProductServiceFeign;
import com.mhd.basic.infrastructure.util.annotation.DataPermissions;
import com.mhd.common.core.domain.po.OrganizationPo;
import com.mhd.common.core.exception.ServiceException;
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
import com.mhd.common.core.exception.digitalLogisticsException.UserError;
import com.mhd.common.core.utils.StringUtils;
import com.mhd.common.core.web.domain.AjaxResult;
import com.mhd.common.security.utils.SecurityUtils;
import com.mhd.system.api.domain.SysDictType;
import com.mhd.system.api.model.LoginUser;
import com.mhd.system.domain.vo.SysBankDictInfo;
import com.mhd.system.domain.vo.SysDictDataVO;
import com.mhd.system.mapper.SysDictDataMapper;
import com.mhd.system.service.ISysDictDataService;
import com.mhd.system.service.ISysDictTypeService;
import org.springframework.stereotype.Service;
import com.mhd.common.security.utils.DictUtils;
import com.mhd.system.api.domain.SysDictData;
@@ -33,6 +40,12 @@ public class SysDictDataServiceImpl extends ServiceImpl<SysDictDataMapper, SysDi
@Resource
private SysDictDataMapper dictDataMapper;
@Resource
private ISysDictTypeService dictTypeService;
@Resource
private ProductServiceFeign productServiceFeign;
/**
* 根据条件分页查询字典数据
*
@@ -126,9 +139,20 @@ public class SysDictDataServiceImpl extends ServiceImpl<SysDictDataMapper, SysDi
if (ObjectUtil.isNull(loginUser)) {
throw new DigitalLogisticsException(UserError.TIMEOUT);
}
data.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
data.setOrganizationId(loginUser.getUserPo().getOrganizationId());
data.setOrganizationName(loginUser.getUserPo().getOrganizationName());
applyOrganizationFromDictType(data, null);
fillOrganizationNameFromProductForDictData(data);
if (data.getOrganizationId() == null)
{
data.setOrganizationId(loginUser.getUserPo().getOrganizationId());
}
if (StringUtils.isEmpty(data.getOrganizationName()))
{
data.setOrganizationName(loginUser.getUserPo().getOrganizationName());
}
if (data.getTopOrganizationId() == null)
{
data.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
}
data.setCreateBy(loginUser.getUserPo().getUserName());
int row = dictDataMapper.insertDictData(data);
if (row > 0)
@@ -179,14 +203,29 @@ public class SysDictDataServiceImpl extends ServiceImpl<SysDictDataMapper, SysDi
throw new ServiceException("修改失败:无权修改其他组织的字典数据");
}
}
applyOrganizationFromDictType(data, sysDictData.getDictType());
fillOrganizationNameFromProductForDictData(data);
if (data.getOrganizationId() == null)
{
data.setOrganizationId(loginUser.getUserPo().getOrganizationId());
}
if (StringUtils.isEmpty(data.getOrganizationName()))
{
data.setOrganizationName(loginUser.getUserPo().getOrganizationName());
}
if (data.getTopOrganizationId() == null)
{
data.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
}
data.setUpdateBy(loginUser.getUserPo().getUserName());
int row = dictDataMapper.updateDictData(data);
if (row > 0)
{
String dictTypeForCache = StringUtils.isNotEmpty(data.getDictType()) ? data.getDictType() : sysDictData.getDictType();
SysDictData dictData = new SysDictData();
dictData.setDictType(data.getDictType());
dictData.setDictType(dictTypeForCache);
List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(dictData);
DictUtils.setDictCache(data.getDictType(), dictDatas);
DictUtils.setDictCache(dictTypeForCache, dictDatas);
}
return row;
}
@@ -386,6 +425,69 @@ public class SysDictDataServiceImpl extends ServiceImpl<SysDictDataMapper, SysDi
.list();
}
/**
* 组织信息优先从所属字典类型上带出类型上未配置的字段由调用方用登录用户等补齐
*
* @param dictTypeWhenDataTypeEmpty 修改场景下请求体可能不传 dictType此时用库中原记录的字典类型编码查询类型表
*/
private void applyOrganizationFromDictType(SysDictData data, String dictTypeWhenDataTypeEmpty)
{
if (data == null)
{
return;
}
String dictType = StringUtils.isNotEmpty(data.getDictType()) ? data.getDictType() : dictTypeWhenDataTypeEmpty;
if (StringUtils.isEmpty(dictType))
{
return;
}
SysDictType dictTypeRow = dictTypeService.selectDictTypeByType(dictType);
if (dictTypeRow == null)
{
return;
}
if (dictTypeRow.getOrganizationId() != null)
{
data.setOrganizationId(dictTypeRow.getOrganizationId());
}
if (StringUtils.isNotEmpty(dictTypeRow.getOrganizationName()))
{
data.setOrganizationName(dictTypeRow.getOrganizationName());
}
if (dictTypeRow.getTopOrganizationId() != null)
{
data.setTopOrganizationId(dictTypeRow.getTopOrganizationId());
}
}
private void fillOrganizationNameFromProductForDictData(SysDictData data)
{
if (data == null || data.getOrganizationId() == null || StringUtils.isNotEmpty(data.getOrganizationName()))
{
return;
}
Long oid = data.getOrganizationId();
if (oid == 0L)
{
return;
}
try
{
AjaxResult res = productServiceFeign.getOrganizationInfo(oid);
if (res != null && "200".equals(String.valueOf(res.get("code"))) && res.get("data") != null)
{
OrganizationPo po = JSONObject.parseObject(JSONObject.toJSONString(res.get("data")), OrganizationPo.class);
if (po != null && StringUtils.isNotEmpty(po.getOrganizationName()))
{
data.setOrganizationName(po.getOrganizationName());
}
}
}
catch (Exception ignored)
{
}
}
@Override
public List<SysDictData> selectDictList(SysDictData sysDictData) {
return dictDataMapper.selectDictDataList(sysDictData);
@@ -3,9 +3,14 @@ package com.mhd.system.service.impl;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
import javax.annotation.PostConstruct;
import com.alibaba.fastjson.JSONObject;
import com.mhd.basic.infrastructure.feign.ProductServiceFeign;
import com.mhd.common.core.domain.po.OrganizationPo;
import com.mhd.common.core.web.domain.AjaxResult;
import com.mhd.system.mapper.SysDictDataMapper;
import com.mhd.system.mapper.SysDictTypeMapper;
import com.mhd.system.service.ISysDictTypeService;
@@ -16,8 +21,10 @@ import com.mhd.common.core.constant.UserConstants;
import com.mhd.common.core.exception.ServiceException;
import com.mhd.common.core.utils.StringUtils;
import com.mhd.common.security.utils.DictUtils;
import com.mhd.common.security.utils.SecurityUtils;
import com.mhd.system.api.domain.SysDictData;
import com.mhd.system.api.domain.SysDictType;
import com.mhd.system.api.model.LoginUser;
/**
* 字典 业务层处理
@@ -33,6 +40,9 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
@Autowired
private SysDictDataMapper dictDataMapper;
@Autowired
private ProductServiceFeign productServiceFeign;
/**
* 项目启动时初始化字典到缓存
*/
@@ -177,6 +187,11 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
@Override
public int insertDictType(SysDictType dict)
{
fillOrganizationNameFromProductCenter(dict);
if (dict.getOrganizationId() != null && StringUtils.isEmpty(dict.getOrganizationName()))
{
dict.setOrganizationName("");
}
int row = dictTypeMapper.insertDictType(dict);
if (row > 0)
{
@@ -196,10 +211,16 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
public int updateDictType(SysDictType dict)
{
SysDictType oldDict = dictTypeMapper.selectDictTypeById(dict.getDictId());
mergeDictTypeOrganizationNameForUpdate(dict, oldDict);
dictDataMapper.updateDictDataType(oldDict.getDictType(), dict.getDictType());
int row = dictTypeMapper.updateDictType(dict);
if (row > 0)
{
if (dictDataMapper.countDictDataByType(dict.getDictType()) > 0)
{
dictDataMapper.updateDictDataOrganizationByDictType(dict.getDictType(),
dict.getOrganizationId(), dict.getOrganizationName(), dict.getTopOrganizationId());
}
SysDictData dictData = new SysDictData();
dictData.setDictType(dict.getDictType());
List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(dictData);
@@ -218,11 +239,76 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
public String checkDictTypeUnique(SysDictType dict)
{
Long dictId = StringUtils.isNull(dict.getDictId()) ? -1L : dict.getDictId();
SysDictType dictType = dictTypeMapper.checkDictTypeUnique(dict.getDictType());
SysDictType dictType = dictTypeMapper.checkDictTypeUnique(dict);
if (StringUtils.isNotNull(dictType) && dictType.getDictId().longValue() != dictId.longValue())
{
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
}
/**
* 修改字典类型时请求体常不带 organizationName若与库中或当前登录用户组织一致则补全避免 UPDATE 把名称写成 null
*/
private void mergeDictTypeOrganizationNameForUpdate(SysDictType dict, SysDictType oldDict)
{
if (dict == null || oldDict == null || StringUtils.isNotEmpty(dict.getOrganizationName()))
{
return;
}
if (dict.getOrganizationId() == null)
{
return;
}
if (Objects.equals(dict.getOrganizationId(), oldDict.getOrganizationId())
&& StringUtils.isNotEmpty(oldDict.getOrganizationName()))
{
dict.setOrganizationName(oldDict.getOrganizationName());
return;
}
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null && loginUser.getUserPo() != null
&& Objects.equals(dict.getOrganizationId(), loginUser.getUserPo().getOrganizationId())
&& StringUtils.isNotEmpty(loginUser.getUserPo().getOrganizationName()))
{
dict.setOrganizationName(loginUser.getUserPo().getOrganizationName());
}
fillOrganizationNameFromProductCenter(dict);
if (dict.getOrganizationId() != null && StringUtils.isEmpty(dict.getOrganizationName()))
{
dict.setOrganizationName("");
}
}
/**
* 已存在 organizationId 但名称为空时从产品中心按组织 id 补全名称 BasicAgreement 等模块一致
*/
private void fillOrganizationNameFromProductCenter(SysDictType dict)
{
if (dict == null || dict.getOrganizationId() == null || StringUtils.isNotEmpty(dict.getOrganizationName()))
{
return;
}
Long oid = dict.getOrganizationId();
if (oid == 0L)
{
return;
}
try
{
AjaxResult res = productServiceFeign.getOrganizationInfo(oid);
if (res != null && "200".equals(String.valueOf(res.get("code"))) && res.get("data") != null)
{
OrganizationPo po = JSONObject.parseObject(JSONObject.toJSONString(res.get("data")), OrganizationPo.class);
if (po != null && StringUtils.isNotEmpty(po.getOrganizationName()))
{
dict.setOrganizationName(po.getOrganizationName());
}
}
}
catch (Exception ignored)
{
// 远程不可用时保持后续逻辑如置空字符串以便 UPDATE 写入列
}
}
}
@@ -107,12 +107,12 @@
<select id="selectCostSubject" parameterType="com.mhd.basic.domain.expenseAccount.repository.todo.ExpenseAccountDO"
resultType="com.mhd.basic.domain.expenseAccount.repository.po.ExpenseAccountPO">
select
*
from expense_account
a.*
from expense_account a left join service_items_manage b ON a.service_items_manage_id = b.service_items_manage_id
where
del_flag = 1
and status = 1
and first_subject_flag = 1
a.del_flag = 1
and a.status = 1
and a.first_subject_flag = 1
<include refid="common_where_two"></include>
</select>
<select id="selectAllCostSubject"
@@ -149,11 +149,15 @@
<!-- 如果 organizationId 和 topOrganizationId 都为 null,表示查询所有组织的数据(不添加组织过滤条件) -->
<if test="expenseAccountDO.organizationId != null">
<!-- 如果设置了 organizationId,添加 organization_id 条件 -->
and organization_id = #{expenseAccountDO.organizationId}
and a.organization_id = #{expenseAccountDO.organizationId}
</if>
<if test="expenseAccountDO.topOrganizationId != null and expenseAccountDO.organizationId == null">
<!-- 如果设置了 topOrganizationId 但没有设置 organizationId,添加 top_organization_id 条件 -->
and top_organization_id = #{expenseAccountDO.topOrganizationId}
and a.top_organization_id = #{expenseAccountDO.topOrganizationId}
</if>
<if test="expenseAccountDO.serviceItemsCode != null and expenseAccountDO.serviceItemsCode != ''">
<!-- 如果设置了 topOrganizationId 但没有设置 organizationId,添加 top_organization_id 条件 -->
and b.service_items_code = #{expenseAccountDO.serviceItemsCode}
</if>
</sql>
@@ -48,6 +48,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result column="material_unit" property="materialUnit" jdbcType="VARCHAR"/>
<result column="machine_code" property="machineCode" jdbcType="VARCHAR"/>
<result property="copyCode" column="copy_code"/>
<result property="goodsType" column="goods_type"/>
<result property="grossWeight" column="gross_weight"/>
</resultMap>
@@ -55,7 +57,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select material_base_info_id, organization_id, organization_name, top_organization_id, shipper_id, shipper_name, material_code, material_name, bar_code, material_classify_code,
material_classify_name, material_type, material_type_name, pack_id, pack_code, pack_name, unit_code, unit_name, brand_id, brand_code, brand_name, shelf_life, weight_limit,
volume_limit, material_shape, material_shape_name, material_size, material_length, material_width, material_height, remark, nullify, create_time, create_by, create_by_name,
update_time, update_by, update_by_name, del_flag, common,material_model,material_unit,machine_code,sku_code, unit_price, currency, origin_country, hs_code, declaration_unit, statutory_unit, statutory_second_unit, copy_code
update_time, update_by, update_by_name, del_flag, common,material_model,material_unit,machine_code,sku_code, unit_price, currency, origin_country, hs_code, declaration_unit, statutory_unit, statutory_second_unit, copy_code,
goods_type,gross_weight
from material_base_info
</sql>
@@ -112,6 +112,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update sys_dict_data set dict_type = #{newDictType} where dict_type = #{oldDictType}
</update>
<update id="updateDictDataOrganizationByDictType">
update sys_dict_data
set organization_id = #{organizationId},
organization_name = #{organizationName},
top_organization_id = #{topOrganizationId},
update_time = sysdate()
where dict_type = #{dictType}
</update>
<insert id="insertDictData" parameterType="SysDictData">
insert into sys_dict_data(
<if test="dictSort != null">dict_sort,</if>
@@ -13,10 +13,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="organizationId" column="organization_id" />
<result property="organizationName" column="organization_name" />
<result property="topOrganizationId" column="top_organization_id" />
</resultMap>
<sql id="selectDictTypeVo">
select dict_id, dict_name, dict_type, status, create_by, create_time, remark
select dict_id, dict_name, dict_type, status, create_by, create_time, remark,
organization_id, organization_name, top_organization_id
from sys_dict_type
</sql>
@@ -32,6 +37,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="dictType != null and dictType != ''">
AND dict_type like concat('%', #{dictType}, '%')
</if>
<if test="organizationId != null">
AND organization_id = #{organizationId}
</if>
<if test="topOrganizationId != null">
AND (top_organization_id = #{topOrganizationId} OR IFNULL(organization_id, 0) = 0)
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
</if>
@@ -55,9 +66,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where dict_type = #{dictType}
</select>
<select id="checkDictTypeUnique" parameterType="String" resultMap="SysDictTypeResult">
<select id="checkDictTypeUnique" parameterType="SysDictType" resultMap="SysDictTypeResult">
<include refid="selectDictTypeVo"/>
where dict_type = #{dictType} limit 1
where dict_type = #{dictType}
limit 1
</select>
<delete id="deleteDictTypeById" parameterType="Long">
@@ -78,6 +90,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="dictType != null and dictType != ''">dict_type = #{dictType},</if>
<if test="status != null">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="organizationId != null">organization_id = #{organizationId},</if>
<if test="organizationName != null">organization_name = #{organizationName},</if>
<if test="topOrganizationId != null">top_organization_id = #{topOrganizationId},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
@@ -90,6 +105,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="dictType != null and dictType != ''">dict_type,</if>
<if test="status != null">status,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="organizationId != null">organization_id,</if>
<if test="organizationId != null">organization_name,</if>
<if test="topOrganizationId != null">top_organization_id,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
@@ -97,6 +115,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="dictType != null and dictType != ''">#{dictType},</if>
<if test="status != null">#{status},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="organizationId != null">#{organizationId},</if>
<if test="organizationId != null">#{organizationName},</if>
<if test="topOrganizationId != null">#{topOrganizationId},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
@@ -33,6 +33,7 @@ import com.mhd.common.core.domain.po.RolePO;
import com.mhd.user.domain.userAggregate.entity.UserRoleEntity;
import com.mhd.user.domain.userAggregate.entity.UserShipperEntity;
import com.mhd.user.domain.userAggregate.event.ShipperEventPublisher;
import com.mhd.user.domain.userAggregate.repository.mapper.UserShipperMapper;
import com.mhd.user.domain.userAggregate.repository.po.UserDriverPo;
import com.mhd.user.domain.userAggregate.repository.todo.*;
import com.mhd.user.domain.userAggregate.service.*;
@@ -112,6 +113,9 @@ public class UserShipperApplicationService {
@Resource
private WlhyServiceFeign wlhyServiceFeign;
@Resource
private UserShipperMapper userShipperMapper;
/**
* @Description 查询托运人列表
* @Author Alex
@@ -1209,5 +1213,23 @@ public class UserShipperApplicationService {
}
}
/**
* 推送状态更新
* @param shipperId
* @param pushStatus
* @param pushTime
* @param pushBy
* @return
*/
public int updatePushStatus(Long shipperId, Integer pushStatus, String pushTime, Long pushBy,String pushByName) {
UserShipperEntity userShipper = new UserShipperEntity();
userShipper.setShipperId(shipperId);
userShipper.setPushStatus(pushStatus);
if (pushTime != null && !"".equals(pushTime)) {
userShipper.setPushTime(DateUtil.parse(pushTime));
}
userShipper.setPushBy(pushBy);
userShipper.setPushByName(pushByName);
return userShipperMapper.updatePushStatus(userShipper);
}
}
@@ -263,4 +263,16 @@ public class UserShipperEntity extends BaseVOEntity {
@ApiModelProperty(name = "组织名称")
private String organizationName;
@ApiModelProperty(name = "推送状态 1-未推送 2-推送中 3-推送成功 4-推送失败")
private Integer pushStatus;
@ApiModelProperty(name = "推送时间")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date pushTime;
@ApiModelProperty(name = "推送人")
private Long pushBy;
@ApiModelProperty(name = "推送人姓名")
private String pushByName;
}
@@ -7,6 +7,7 @@ import com.mhd.user.domain.userAggregate.repository.todo.UserShipperDO;
import com.mhd.user.domain.userAggregate.repository.po.UserShipperPo;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
public interface UserShipperMapper extends BaseMapper<UserShipperEntity> {
@@ -28,4 +29,11 @@ public interface UserShipperMapper extends BaseMapper<UserShipperEntity> {
List<UserShipperEntity> selectBySealId(@Param("userShipperEntity") UserShipperEntity userShipperEntity);
public com.mhd.common.core.domain.po.UserShipperPo getShipperSummaryData(Long userId);
/**
*
* @param userShipper
* @return
*/
int updatePushStatus(UserShipperEntity userShipper);
}
@@ -321,4 +321,18 @@ public class UserShipperPo implements Serializable {
@ApiModelProperty(name = "备注")
private String userRemarkShipper;
@ApiModelProperty(value = "推送状态:1-未推送,2-推送中,3-推送成功,4-推送失败")
private Integer pushStatus;
@ApiModelProperty(value = "推送时间")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date pushTime;
@ApiModelProperty(value = "推送人ID")
private Long pushBy;
@ApiModelProperty(value = "推送人姓名")
private String pushByName;
}
@@ -288,4 +288,25 @@ public class UserShipperDO extends UserDO {
@ApiModelProperty(name = "备注")
private String userRemark;
@ApiModelProperty("创建时间起")
private Date createTimeFrom;
@ApiModelProperty("创建时间止")
private Date createTimeTo;
@ApiModelProperty("更新时间起")
private String updateTimeFrom;
@ApiModelProperty("更新时间止")
private String updateTimeTo;
@ApiModelProperty("推送状态")
private Integer pushStatus;
@ApiModelProperty("推送时间起")
private String pushTimeFrom;
@ApiModelProperty("推送时间止")
private String pushTimeTo;
}
@@ -235,4 +235,19 @@ public class UserShipperDTO extends UserDTO {
private String taxNumber;
@ApiModelProperty(value = "更新时间起")
private String updateTimeFrom;
@ApiModelProperty(value = "更新时间止")
private String updateTimeTo;
@ApiModelProperty(value = "推送时间起")
private String pushTimeFrom;
@ApiModelProperty(value = "推送时间止")
private String pushTimeTo;
@ApiModelProperty(value = "推送状态")
private Integer pushStatus;
}
@@ -20,9 +20,11 @@ import com.mhd.user.interfaces.vo.SettlementInfoQueryVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
@Api(tags = "用户中台管理-托运人管理")
@@ -235,4 +237,21 @@ public class UserShipperAPI extends BaseController {
}
}
@ApiOperation("商业合作伙伴-更新推送状态")
@PostMapping("/updatePushStatus")
public AjaxResult updatePushStatus(@RequestParam("shipperId") Long shipperId,
@RequestParam("pushStatus") Integer pushStatus,
@RequestParam(value = "pushTime", required = false) String pushTime,
@RequestParam(value = "pushBy", required = false) Long pushBy,
@RequestParam(value = "pushByName", required = false) String pushByName){
try{
int result = userShipperApplicationService.updatePushStatus(shipperId,pushStatus,pushTime,pushBy,pushByName);
return result > 0 ? AjaxResult.success() : AjaxResult.error("更新失败");
}catch (Exception e){
log.error("更新推送状态异常: shipperId = {} , error = ", e.getMessage());
return AjaxResult.error("更新推送状态异常:" + e.getMessage());
}
}
}
@@ -20,17 +20,17 @@ spring:
discovery:
# server-addr: 127.0.0.1:8848
# 线上测试环境配置 容器名+端口号
# server-addr: 10.33.0.129:6010
server-addr: 10.102.192.5:6848
username: nacos
password: manhuoda@2023
server-addr: 10.33.0.129:6010
# server-addr: 10.102.192.5: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.5:6848
username: nacos
password: manhuoda@2023
server-addr: 10.33.0.129:6010
# server-addr: 10.102.192.5:6848
# username: nacos
# password: manhuoda@2023
group: DEFAULT_GROUP # 默认分组就是DEFAULT_GROUP,如果使用默认分组可以不配置
file-extension: yml #默认properties
# 共享配置
@@ -161,7 +161,11 @@
b.invoice_title,
b.tax_number,
b.user_email,
b.user_remark as userRemarkShipper
b.user_remark as userRemarkShipper,
b.push_status,
b.push_time,
b.push_by,
b.push_by_name
FROM "USER" a
LEFT JOIN user_shipper b ON a.user_id = b.user_id
left join (select user_id, LISTAGG(DISTINCT r.role_name, '&amp;') WITHIN GROUP(ORDER BY r.role_name) AS roleName
@@ -312,6 +316,24 @@
and DATE_FORMAT(a.create_time,'%Y-%m-%d') <![CDATA[<=]]>
DATE_FORMAT(#{createTimeTo},'%Y-%m-%d')
</if>
/*更新时间*/
<if test="updateTimeFrom != null and updateTimeFrom != ''">
and DATE_FORMAT(a.update_time,'%Y-%m-%d') &gt;= #{updateTimeFrom}
</if>
<if test="updateTimeTo != null and updateTimeTo != ''">
and DATE_FORMAT(a.update_time,'%Y-%m-%d') &lt;= #{updateTimeTo}
</if>
/*推送状态*/
<if test="pushStatus != null">
and b.push_status = #{pushStatus}
</if>
/*推送时间*/
<if test="pushTimeFrom != null and pushTimeFrom != ''">
and DATE_FORMAT(b.push_time,'%Y-%m-%d') &gt;= #{pushTimeFrom}
</if>
<if test="pushTimeTo != null and pushTimeTo != ''">
and DATE_FORMAT(b.push_time,'%Y-%m-%d') &lt;= #{pushTimeTo}
</if>
/*审核时间*/
<if test="userAuthTimeFrom!=null and userAuthTimeTo!=null ">
and DATE_FORMAT(b.shipper_fill_time,'%Y-%m-%d') <![CDATA[>=]]>
@@ -401,4 +423,17 @@
and esign_enterprise_status = #{userShipperEntity.esignEnterpriseStatus}
</select>
<update id="updatePushStatus">
UPDATE user_shipper
<set>
<if test="pushStatus != null">push_status = #{pushStatus},</if>
<if test="pushTime != null">push_time = #{pushTime},</if>
<if test="pushBy != null">push_by = #{pushBy},</if>
<if test="pushByName != null">push_by_name = #{pushByName},</if>
</set>
WHERE shipper_id = #{shipperId}
</update>
</mapper>
@@ -92,6 +92,7 @@ public class CostCalculationApplicationService {
//第二步 根据计费策略公式进行替换并根据配置的公式计算结果
BigDecimal computationalCost = computational(billingRulesPO,costCalculationDTO,taskFlowRecordsDO);
result.setComputationalCost(computationalCost);
result.setBillingRulesPO(billingRulesPO);
//第三步 产生计费任务记录
taskFlowRecordsDO.setBillingResults(computationalCost.toString());
@@ -7,11 +7,14 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.mhd.bms.application.server.billingRules.CostCalculationApplicationService;
import com.mhd.bms.application.server.settlementCustomers.SettlementCustomersApplicationService;
import com.mhd.bms.domain.billingRules.repository.po.BillingParamsPO;
import com.mhd.bms.domain.billingRules.repository.po.BillingRulesPO;
import com.mhd.bms.domain.billingStatement.service.BillingStatementDomainService;
import com.mhd.bms.domain.businessDocument.entity.BusinessDocument;
import com.mhd.bms.domain.businessDocument.repository.po.BusinessDocumentPO;
import com.mhd.bms.domain.businessDocument.repository.todo.BusinessDocumentDO;
import com.mhd.bms.domain.businessDocument.service.BusinessDocumentDomainService;
import com.mhd.bms.domain.costCalculation.entity.BillingParamsEntity;
import com.mhd.bms.domain.costCalculation.po.BillingCostPo;
import com.mhd.bms.domain.documentType.entity.DocumentFromEntity;
import com.mhd.bms.domain.documentType.entity.DocumentType;
@@ -173,10 +176,52 @@ public class BusinessDocumentApplicationService {
costCalculationDTO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
BillingCostPo billingCostPo = costCalculationApplicationService.costCalculation(costCalculationDTO);
businessDocumentDO.setEstimatedCost(billingCostPo.getComputationalCost());
BillingRulesPO billingRulesPO = billingCostPo.getBillingRulesPO();
List<BillingParamsPO> billingParamsPOList = billingRulesPO.getBillingParamsPOList();
if (ObjectUtil.isNotNull(billingParamsPOList)&&billingParamsPOList.size()>0) {
BillingParamsPO billingParamsPO = billingParamsPOList.get(0);
String billingParamsJson = billingParamsPO.getBillingParamsJson();
String preSetRules = billingParamsPO.getPreSetRules();
String documentFormJson = businessDocumentDO.getDocumentFormJson();
JSONObject paramObj = JSONObject.parseObject(documentFormJson);
List<BillingParamsEntity> billingParamsEntityList = JSON.parseArray(billingParamsJson, BillingParamsEntity.class);
for (BillingParamsEntity billingParamsEntity : billingParamsEntityList) {
String isFee = billingParamsEntity.getIsFee();
String fields = billingParamsEntity.getFields();
// 安全获取值并转 BigDecimal不会报错
BigDecimal value = getSafeBigDecimal(paramObj, fields);
if ("1".equals(isFee)) {
businessDocumentDO.setBillingUnitPrice(value.setScale(2, BigDecimal.ROUND_HALF_UP));
} else {
businessDocumentDO.setBillingNum(value.setScale(2, BigDecimal.ROUND_HALF_UP));
}
}
}
// businessDocumentDO.setEstimatedCost(new BigDecimal("100"));
return businessDocumentDomainService.insert(businessDocumentDO);
}
/**
* JSONObject 安全获取 BigDecimal支持
* 数字整数字符串小数字符串null空字符串
*/
private BigDecimal getSafeBigDecimal(JSONObject paramObj, String fields) {
Object obj = paramObj.get(fields);
if (obj == null) {
return BigDecimal.ZERO; // 空值默认返回0避免空指针
}
try {
// 统一转字符串再转 BigDecimal最安全
return new BigDecimal(obj.toString().trim());
} catch (Exception e) {
// 无法解析的非法值默认返回0
return BigDecimal.ZERO;
}
}
/**
* 新增业务单据
@@ -390,12 +435,39 @@ public class BusinessDocumentApplicationService {
businessDocumentDO.setFirstSubjectName(expenseAccountPO.getSubjectName());
businessDocumentDO.setFirstSubjectCode(expenseAccountPO.getSubjectCode());
businessDocumentDO.setSecondSubjectCode("");
String billingUnitDefaultCn = expenseAccountPO.getBillingUnitDefaultCn();
String billingUnitDefaultEn = expenseAccountPO.getBillingUnitDefaultEn();
if ("1".equals(billingUnitDefaultCn)) {
businessDocumentDO.setBillingUnit(expenseAccountPO.getBillingUnit());
businessDocumentDO.setBillingUnit2(expenseAccountPO.getBillingUnit2());
} else if ("1".equals(billingUnitDefaultEn)) {
businessDocumentDO.setBillingUnit(expenseAccountPO.getBillingUnitEn());
businessDocumentDO.setBillingUnit2(expenseAccountPO.getBillingUnitEn2());
} else {
businessDocumentDO.setBillingUnit(expenseAccountPO.getBillingUnit());
businessDocumentDO.setBillingUnit2(expenseAccountPO.getBillingUnit2());
}
businessDocumentDO.setNcSubjectCode(expenseAccountPO.getNcSubjectCode());
}else {
//不是一级科目
businessDocumentDO.setFirstSubjectName(expenseAccountPO.getUpperSubject());
businessDocumentDO.setFirstSubjectCode(expenseAccountPO.getUpperSubjectCode());
businessDocumentDO.setSecondSubjectCode(expenseAccountPO.getSubjectCode());
businessDocumentDO.setSecondSubjectName(expenseAccountPO.getSubjectName());
String billingUnitDefaultCn = expenseAccountPO.getBillingUnitDefaultCn();
String billingUnitDefaultEn = expenseAccountPO.getBillingUnitDefaultEn();
if ("1".equals(billingUnitDefaultCn)) {
businessDocumentDO.setBillingUnit(expenseAccountPO.getBillingUnit());
businessDocumentDO.setBillingUnit2(expenseAccountPO.getBillingUnit2());
} else if ("1".equals(billingUnitDefaultEn)) {
businessDocumentDO.setBillingUnit(expenseAccountPO.getBillingUnitEn());
businessDocumentDO.setBillingUnit2(expenseAccountPO.getBillingUnitEn2());
} else {
businessDocumentDO.setBillingUnit(expenseAccountPO.getBillingUnit());
businessDocumentDO.setBillingUnit2(expenseAccountPO.getBillingUnit2());
}
businessDocumentDO.setNcSubjectCode(expenseAccountPO.getNcSubjectCode());
}
//判断如果前端没有传费用类别则此处根据费用科目获取关联费用类别
if(StringUtils.isEmpty(businessDocumentDO.getServiceItemsCode())){
@@ -412,7 +484,7 @@ public class BusinessDocumentApplicationService {
if(businessDocumentDO.getBelongModuleCode().equals(BelongModuleCode.WMS.getCode())){
contractType = 1;
}
AjaxResult ajaxResult = systemServiceFeign.getInfoByCustomer2(businessDocumentDO.getSettlementCustomersCode(),contractType,businessDocumentDO.getTopOrganizationId());
AjaxResult ajaxResult = systemServiceFeign.getInfoByCustomerAndOrganizationId(businessDocumentDO.getSettlementCustomersCode(),contractType,businessDocumentDO.getTopOrganizationId(),businessDocumentDO.getOrganizationId());
if(!"200".equals(String.valueOf(ajaxResult.get("code")))) {
throw new ServiceException("合同信息未找到");
}
@@ -1026,18 +1098,40 @@ public class BusinessDocumentApplicationService {
businessDocumentDO.setOrganizationName(businessDocumentDO.getOrganizationName());
businessDocumentDO.setOriginalBusinessNum(businessDocumentDO.getOriginalBusinessNum());
//调用费用计算计算费用金额进行保存
// CostCalculationDTO costCalculationDTO = new CostCalculationDTO();
// costCalculationDTO.setOriginalBusinessNum(businessDocumentDO.getOriginalBusinessNum());
// costCalculationDTO.setContractNumber(businessDocumentDO.getContractNumber());
// costCalculationDTO.setFormJson(businessDocumentDO.getDocumentFormJson());
// costCalculationDTO.setSubjectCode(StringUtils.isEmpty(businessDocumentDO.getSecondSubjectCode()) ? businessDocumentDO.getFirstSubjectCode():businessDocumentDO.getSecondSubjectCode());
// costCalculationDTO.setDocumentTypeCode(businessDocumentDO.getDocumentTypeCode());
// costCalculationDTO.setTopOrganizationId(businessDocumentDO.getTopOrganizationId());
// costCalculationDTO.setOrganizationId(businessDocumentDO.getOrganizationId());
// costCalculationDTO.setOrganizationName(businessDocumentDO.getOrganizationName());
// BillingCostPo billingCostPo = costCalculationApplicationService.costCalculation(costCalculationDTO);
// businessDocumentDO.setEstimatedCost(billingCostPo.getComputationalCost());
// businessDocumentDO.setBillAmount(billingCostPo.getComputationalCost());//计费金额与计算金额一致
CostCalculationDTO costCalculationDTO = new CostCalculationDTO();
costCalculationDTO.setOriginalBusinessNum(businessDocumentDO.getOriginalBusinessNum());
costCalculationDTO.setContractNumber(businessDocumentDO.getContractNumber());
costCalculationDTO.setFormJson(businessDocumentDO.getDocumentFormJson());
costCalculationDTO.setSubjectCode(StringUtils.isEmpty(businessDocumentDO.getSecondSubjectCode()) ? businessDocumentDO.getFirstSubjectCode():businessDocumentDO.getSecondSubjectCode());
costCalculationDTO.setDocumentTypeCode(businessDocumentDO.getDocumentTypeCode());
costCalculationDTO.setTopOrganizationId(businessDocumentDO.getTopOrganizationId());
costCalculationDTO.setOrganizationId(businessDocumentDO.getOrganizationId());
costCalculationDTO.setOrganizationName(businessDocumentDO.getOrganizationName());
BillingCostPo billingCostPo = costCalculationApplicationService.costCalculation(costCalculationDTO);
BillingRulesPO billingRulesPO = billingCostPo.getBillingRulesPO();
List<BillingParamsPO> billingParamsPOList = billingRulesPO.getBillingParamsPOList();
if (ObjectUtil.isNotNull(billingParamsPOList)&&billingParamsPOList.size()>0) {
BillingParamsPO billingParamsPO = billingParamsPOList.get(0);
String billingParamsJson = billingParamsPO.getBillingParamsJson();
String preSetRules = billingParamsPO.getPreSetRules();
String documentFormJson = businessDocumentDO.getDocumentFormJson();
JSONObject paramObj = JSONObject.parseObject(documentFormJson);
List<BillingParamsEntity> billingParamsEntityList = JSON.parseArray(billingParamsJson, BillingParamsEntity.class);
for (BillingParamsEntity billingParamsEntity : billingParamsEntityList) {
String isFee = billingParamsEntity.getIsFee();
String fields = billingParamsEntity.getFields();
// 安全获取值并转 BigDecimal不会报错
BigDecimal value = getSafeBigDecimal(paramObj, fields);
if ("1".equals(isFee)) {
businessDocumentDO.setBillingUnitPrice(value.setScale(2, BigDecimal.ROUND_HALF_UP));
} else {
businessDocumentDO.setBillingNum(value.setScale(2, BigDecimal.ROUND_HALF_UP));
}
}
}
log.info("定时任务进入BMS业务单据保存--结束");
BusinessDocument businessDocument = businessDocumentDomainService.insertRetrun(businessDocumentDO);
BusinessDocumentDTO businessDocumentDTO = new BusinessDocumentDTO();
@@ -21,6 +21,8 @@ public interface BillManageMapper extends BaseMapper<BillManage>
String getInvoiceItemName(@Param("invoiceItemId") String invoiceItemId);
String getInvoiceItemNcCode(@Param("invoiceItemId") String invoiceItemId);
String getCustomerCodeNc(@Param("actualInvoiceCustomerId") String actualInvoiceCustomerId);
String getDocumentPreparerNcCode(@Param("salesmanId") String salesmanId);
@@ -240,11 +240,14 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
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);
@@ -282,6 +285,9 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
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);
@@ -1,6 +1,7 @@
package com.mhd.bms.domain.billingStatement.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.mhd.common.core.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
@@ -210,4 +211,15 @@ public class BillingStatement extends BaseVOEntity{
private String paymentAccountId;
@ApiModelProperty("收款帐户名称")
private String paymentAccountName;
@ApiModelProperty("计费单位")
private String billingUnit;
@ApiModelProperty("计费单位2")
private String billingUnit2;
@ApiModelProperty("预计费金额")
private BigDecimal billingNum;
@ApiModelProperty("预计费金额")
private BigDecimal billingUnitPrice;
@ApiModelProperty("nc科目编码")
private String ncSubjectCode;
}
@@ -221,4 +221,15 @@ public class BillingStatementPO extends BaseVOEntity{
private String paymentAccountId;
@ApiModelProperty("收款帐户名称")
private String paymentAccountName;
@ApiModelProperty("计费单位")
private String billingUnit;
@ApiModelProperty("计费单位2")
private String billingUnit2;
@ApiModelProperty("预计费金额")
private BigDecimal billingNum;
@ApiModelProperty("预计费金额")
private BigDecimal billingUnitPrice;
@ApiModelProperty("nc科目编码")
private String ncSubjectCode;
}
@@ -239,4 +239,15 @@ public class BillingStatementDO extends BaseVOEntity{
private String paymentAccountId;
@ApiModelProperty("收款帐户名称")
private String paymentAccountName;
@ApiModelProperty("计费单位")
private String billingUnit;
@ApiModelProperty("计费单位2")
private String billingUnit2;
@ApiModelProperty("预计费金额")
private BigDecimal billingNum;
@ApiModelProperty("预计费金额")
private BigDecimal billingUnitPrice;
@ApiModelProperty("nc科目编码")
private String ncSubjectCode;
}
@@ -1,6 +1,7 @@
package com.mhd.bms.domain.businessDocument.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.mhd.common.core.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
@@ -182,4 +183,15 @@ public class BusinessDocument extends BaseVOEntity{
private String paymentAccountId;
@ApiModelProperty("收款帐户名称")
private String paymentAccountName;
@ApiModelProperty("计费单位")
private String billingUnit;
@ApiModelProperty("计费单位2")
private String billingUnit2;
@ApiModelProperty("计费数量")
private BigDecimal billingNum;
@ApiModelProperty("计费单价")
private BigDecimal billingUnitPrice;
@ApiModelProperty("nc科目编码")
private String ncSubjectCode;
}
@@ -187,4 +187,15 @@ public class BusinessDocumentPO extends BaseVOEntity{
private String paymentAccountId;
@ApiModelProperty("收款帐户名称")
private String paymentAccountName;
@ApiModelProperty("计费单位")
private String billingUnit;
@ApiModelProperty("计费单位2")
private String billingUnit2;
@ApiModelProperty("预计费金额")
private BigDecimal billingNum;
@ApiModelProperty("预计费金额")
private BigDecimal billingUnitPrice;
@ApiModelProperty("nc科目编码")
private String ncSubjectCode;
}
@@ -207,4 +207,15 @@ public class BusinessDocumentDO extends BaseVOEntity{
private String paymentAccountId;
@ApiModelProperty("收款帐户名称")
private String paymentAccountName;
@ApiModelProperty("计费单位")
private String billingUnit;
@ApiModelProperty("计费单位2")
private String billingUnit2;
@ApiModelProperty("预计费金额")
private BigDecimal billingNum;
@ApiModelProperty("预计费金额")
private BigDecimal billingUnitPrice;
@ApiModelProperty("nc科目编码")
private String ncSubjectCode;
}
@@ -35,4 +35,10 @@ public class BillingParamsEntity {
@ApiModelProperty("排序")
private Integer sort;
}
private String isPush;
private String isFee;
private String isShow;
}
@@ -1,5 +1,6 @@
package com.mhd.bms.domain.costCalculation.po;
import com.mhd.bms.domain.billingRules.repository.po.BillingRulesPO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -30,5 +31,7 @@ public class BillingCostPo {
@ApiModelProperty("预计金额")
private BigDecimal computationalCost;
private BillingRulesPO billingRulesPO;
}
}
@@ -93,4 +93,7 @@ public class SettlementCustomersPO extends BaseVOEntity{
@ApiModelProperty(name = "nc编码")
private String ncCode;
@ApiModelProperty(name = "结算币种")
private String settlementCurrency;
}
@@ -102,4 +102,41 @@ public class ExpenseAccountPO extends BaseVOEntity{
@ApiModelProperty("服务项税率")
@Excel(name = "服务项税率")
private BigDecimal taxRate;
}
@ApiModelProperty("费率")
private BigDecimal rate;
@ApiModelProperty(name = "创建订单是否固定显示 0-否 1-是")
private Integer fixedOrderDisplay;
@ApiModelProperty(name = "入库单是否固定显示 0-否 1-是")
private Integer inOrderDisplay;
@ApiModelProperty(name = "出库单是否固定显示 0-否 1-是")
private Integer outOrderDisplay;
@ApiModelProperty("计费单位")
private String billingUnit;
@ApiModelProperty("计费单位英文")
private String billingUnitEn;
@ApiModelProperty("计费单位2")
private String billingUnit2;
@ApiModelProperty("计费单位2英文")
private String billingUnitEn2;
@ApiModelProperty("计费单位中文默认")
private String billingUnitDefaultCn;
@ApiModelProperty("计费单位英文默认")
private String billingUnitDefaultEn;
@ApiModelProperty("nc科目编码")
private String ncSubjectCode;
}
@@ -250,4 +250,15 @@ public class BillingStatementDTO extends BaseVOEntity{
private String paymentAccountName;
private List<BillingStatementADDVO> billingStatementList;
@ApiModelProperty("计费单位")
private String billingUnit;
@ApiModelProperty("计费单位2")
private String billingUnit2;
@ApiModelProperty("预计费金额")
private BigDecimal billingNum;
@ApiModelProperty("预计费金额")
private BigDecimal billingUnitPrice;
@ApiModelProperty("nc科目编码")
private String ncSubjectCode;
}
@@ -110,6 +110,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select SUBJECT_NAME from "NGWL_TEST_SYSTEM".EXPENSE_ACCOUNT where status = 1 and SUBJECT_CODE = #{invoiceItemId} limit 1
</select>
<select id="getInvoiceItemNcCode" parameterType="java.lang.String" resultType="java.lang.String">
select NC_SUBJECT_CODE from "NGWL_TEST_SYSTEM".EXPENSE_ACCOUNT where status = 1 and SUBJECT_CODE = #{invoiceItemId} limit 1
</select>
<select id="getCustomerCodeNc" parameterType="java.lang.String" resultType="java.lang.String">
SELECT CUSTOMER_NC_CODE FROM NGWL_TEST_USER."USER_SHIPPER" where del_flag = 1 and SHIPPER_ID = #{actualInvoiceCustomerId} limit 1
</select>
@@ -31,6 +31,7 @@
<result property="updateBy" column="update_by" />
<result property="updateByName" column="update_by_name" />
<result property="delFlag" column="del_flag" />
<result property="settlementCurrency" column="settlement_currency" />
</resultMap>
<sql id="selectSettlementCustomersPo">
@@ -90,9 +91,9 @@
<select id="queryList" parameterType="com.mhd.bms.domain.settlementCustomers.repository.todo.SettlementCustomersDO"
resultMap="SettlementCustomersResult">
select
*
from settlement_customers
where del_flag = 1
a.*,b.SETTLEMENT_CURRENCY
from settlement_customers a left join "NGWL_TEST_USER"."USER_SHIPPER" b on a.settlement_entity_id = b.user_id
where a.del_flag = 1
<include refid="common_where"/>
ORDER BY create_time IS NULL, create_time DESC
</select>
@@ -106,40 +107,40 @@
<sql id="common_where">
<if test="settlementCustomersDO.settlementEntity != null and settlementCustomersDO.settlementEntity != ''">
and settlement_entity like concat('%', #{settlementCustomersDO.settlementEntity}, '%')
and a.settlement_entity like concat('%', #{settlementCustomersDO.settlementEntity}, '%')
</if>
<if test="settlementCustomersDO.settlementCustomersCode != null and settlementCustomersDO.settlementCustomersCode != ''">
and settlement_customers_code like concat('%', #{settlementCustomersDO.settlementCustomersCode}, '%')
and a.settlement_customers_code like concat('%', #{settlementCustomersDO.settlementCustomersCode}, '%')
</if>
<if test="settlementCustomersDO.settlementMethod != null and settlementCustomersDO.settlementMethod != ''">
and settlement_method like concat('%', #{settlementCustomersDO.settlementMethod}, '%')
and a.settlement_method like concat('%', #{settlementCustomersDO.settlementMethod}, '%')
</if>
<if test="settlementCustomersDO.remark != null and settlementCustomersDO.remark != ''">
and remark like concat('%', #{settlementCustomersDO.remark}, '%')
and a.remark like concat('%', #{settlementCustomersDO.remark}, '%')
</if>
<if test="settlementCustomersDO.createTimeStart != null and settlementCustomersDO.createTimeStart != ''">
AND date_format(create_time,'%Y-%m-%d') <![CDATA[>=]]> #{settlementCustomersDO.createTimeStart}
AND date_format(a.create_time,'%Y-%m-%d') <![CDATA[>=]]> #{settlementCustomersDO.createTimeStart}
</if>
<if test="settlementCustomersDO.createTimeEnd != null and settlementCustomersDO.createTimeEnd != ''">
AND date_format(create_time,'%Y-%m-%d') <![CDATA[<=]]> #{settlementCustomersDO.createTimeEnd}
AND date_format(a.create_time,'%Y-%m-%d') <![CDATA[<=]]> #{settlementCustomersDO.createTimeEnd}
</if>
<if test="settlementCustomersDO.createByName != null and settlementCustomersDO.createByName != ''">
and create_by_name like concat('%', #{settlementCustomersDO.createByName}, '%')
and a.create_by_name like concat('%', #{settlementCustomersDO.createByName}, '%')
</if>
<if test="settlementCustomersDO.mainRole != null and settlementCustomersDO.mainRole != ''">
and main_role = #{settlementCustomersDO.mainRole}
and a.main_role = #{settlementCustomersDO.mainRole}
</if>
<if test="settlementCustomersDO.organizationId != null">
and organization_id = #{settlementCustomersDO.organizationId}
and a.organization_id = #{settlementCustomersDO.organizationId}
</if>
<if test="settlementCustomersDO.topOrganizationId != null and settlementCustomersDO.topOrganizationId != ''">
and top_organization_id = #{settlementCustomersDO.topOrganizationId}
and a.top_organization_id = #{settlementCustomersDO.topOrganizationId}
</if>
<if test="settlementCustomersDO.customerType != null and settlementCustomersDO.customerType != ''">
and customer_type = #{settlementCustomersDO.customerType}
and a.customer_type = #{settlementCustomersDO.customerType}
</if>
<if test="settlementCustomersDO.customerTypeCode != null and settlementCustomersDO.customerTypeCode != ''">
and customer_type_code = #{settlementCustomersDO.customerTypeCode}
and a.customer_type_code = #{settlementCustomersDO.customerTypeCode}
</if>
</sql>
</mapper>
</mapper>
@@ -794,6 +794,12 @@ public class ReconciliationImpl extends ServiceImpl<ReconciliationMapper, Reconc
} else {
item.setDef75("T10");
}
String invoiceItem1 = item1.getInvoiceItem();
if (invoiceItem1 != null && !invoiceItem1.isEmpty()) {
String[] split = invoiceItem1.split(",");
item.setDef29(split[0]);
//item.setDef29(invoiceItem1);
}
item.setTaxcodeid("ZL01");
item.setInvoiceno(invoiceNumber);
ysitemList.add(item);
@@ -1071,6 +1077,12 @@ public class ReconciliationImpl extends ServiceImpl<ReconciliationMapper, Reconc
} else {
item.setDef75("T10");
}
String invoiceItem1 = item1.getInvoiceItem();
if (invoiceItem1 != null && !invoiceItem1.isEmpty()) {
String[] split = invoiceItem1.split(",");
item.setDef29(split[0]);
//item.setDef29(invoiceItem1);
}
item.setTaxcodeid("ZL01");
item.setInvoiceno(invoiceNumber);
ysitemList.add(item);
+8 -8
View File
@@ -20,17 +20,17 @@ spring:
discovery:
# server-addr: 127.0.0.1:8848
# 线上测试环境配置 容器名+端口号
server-addr: 10.33.0.129:6010
# server-addr: 10.102.192.5:6848
# username: nacos
# password: manhuoda@2023
# server-addr: 10.33.0.129:6010
server-addr: 10.102.192.5: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.5:6848
# username: nacos
# password: manhuoda@2023
# server-addr: 10.33.0.129:6010
server-addr: 10.102.192.5:6848
username: nacos
password: manhuoda@2023
#线上正式环境
# server-addr: 10.102.192.105:6848
group: DEFAULT_GROUP # 默认分组就是DEFAULT_GROUP,如果使用默认分组可以不配置
@@ -1,21 +1,39 @@
package com.mhd.oms.application.service.businessDocumentOrder;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.mhd.common.core.web.domain.AjaxResult;
import com.mhd.oms.domain.businessDocumentCargoMulti.entity.BusinessDocumentCargoMulti;
import com.mhd.oms.domain.businessDocumentOrder.entity.BusinessDocumentOrder;
import com.mhd.oms.domain.businessDocumentOrder.repository.mapper.BusinessDocumentOrderMapper;
import com.mhd.oms.domain.businessDocumentOrder.repository.po.BusinessDocumentOrderPO;
import com.mhd.oms.domain.businessDocumentOrder.repository.todo.BusinessDocumentOrderDO;
import com.mhd.oms.domain.businessDocumentOrder.service.BusinessDocumentOrderDomainService;
import com.mhd.common.security.utils.SecurityUtils;
import com.mhd.oms.domain.businessOrderAccount.BusinessOrderAccount;
import com.mhd.oms.domain.businessOrderAccount.repository.mapper.BusinessOrderAccountMapper;
import com.mhd.oms.domain.gwLog.entity.GwLog;
import com.mhd.oms.domain.gwLog.repository.mapper.GwLogMapper;
import com.mhd.oms.interfaces.dto.businessDocumentAddressMulti.BusinessAuditDTO;
import com.mhd.oms.interfaces.dto.businessDocumentOrder.BusinessDocumentOrderDTO;
import com.mhd.oms.interfaces.dto.originalImportExportDocument.OrderWithMaterialDTO;
import com.mhd.system.api.model.LoginUser;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.ehcache.shadow.org.terracotta.context.extractor.ObjectContextExtractor;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.io.IOException;
import java.util.*;
/**
* 请填写功能名称ApplicationService
*
@@ -25,6 +43,12 @@ import java.util.List;
@Service
@Slf4j
public class BusinessDocumentOrderApplicationService {
private static final String PUSH_API_URL = "http://10.33.0.100/nagu-erp-api/transfer/pushData";
private static final String API_NAME_I = "saveBill_i";
private static final String API_NAME_E = "saveBill_e";
private static final String VERIFY = "tjPZMT9fwhZRnv+eTXKF75QXmXzCn7phPagmoUQsvsh2ZTWDjuRxHAgcP0GZENHP";
@Autowired
private BusinessDocumentOrderDomainService businessDocumentOrderDomainService;
@@ -32,6 +56,12 @@ public class BusinessDocumentOrderApplicationService {
private BusinessOrderAccountMapper businessOrderAccountMapper;
@Resource
private BusinessDocumentOrderMapper businessDocumentOrderMapper;
@Resource
private GwLogMapper gwLogMapper;
/**
* 分页查询请填写功能名称列表
*/
@@ -102,4 +132,165 @@ public class BusinessDocumentOrderApplicationService {
List<BusinessOrderAccount> businessOrderAccounts = businessOrderAccountMapper.selectList(new LambdaQueryWrapper<BusinessOrderAccount>().eq(BusinessOrderAccount::getOrderId, id).eq(BusinessOrderAccount::getIsDelete, 0));
return businessOrderAccounts;
}
public List<BusinessDocumentOrderPO> queryListAndMaterial(BusinessDocumentOrderDO businessDocumentOrderDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null){
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1){
businessDocumentOrderDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
}
}
return businessDocumentOrderDomainService.queryListAndMaterial(businessDocumentOrderDO);
}
public void reviseApply(BusinessDocumentOrderDTO businessDocumentOrderDTO) {
BusinessDocumentOrder businessDocumentOrder = new BusinessDocumentOrder();
BeanUtils.copyProperties(businessDocumentOrder,businessDocumentOrderDTO);
businessDocumentOrderMapper.updateById(businessDocumentOrder);
}
public AjaxResult batchPushForOriginalImportExportDocument(List<BusinessDocumentOrderDTO> businessDocumentOrderDTOList) {
LoginUser loginUser = SecurityUtils.getLoginUser();
Long pushBy = loginUser != null ? loginUser.getUserid() : null;
String pushByName = loginUser != null ? loginUser.getUsername() : null;
Long organizationId = loginUser != null ? loginUser.getUserPo().getOrganizationId() : null;
Long topOrganizationId = loginUser != null ? loginUser.getUserPo().getTopOrganizationId() : null;
String organizationName = loginUser != null ? loginUser.getUserPo().getOrganizationName() : null;
int successCount = 0;
int failCount = 0;
StringBuilder failMsg = new StringBuilder();
for (BusinessDocumentOrderDTO pushData : businessDocumentOrderDTOList) {
// 1. 构建推送数据
Map<String, Object> body = new HashMap<>();
body.put("erpBillNo", String.valueOf(pushData.getId()));
body.put("billDate", pushData.getDocumentDate());
body.put("goodsType", pushData.getGoodsType());
body.put("ieFlag", pushData.getIeType() != null ? String.valueOf(pushData.getIeType()) : null);
body.put("corpCode", pushData.getAppointShipperId() != null ? pushData.getAppointShipperId().toString() : null);
List<Map<String, Object>> billList = new ArrayList<>();
int gNo = 1;
for(OrderWithMaterialDTO orderWithMaterialDTO : pushData.getOrderWithMaterialDTOList()){
Map<String, Object> billMap = new HashMap<>();
billMap.put("gNo", gNo++);
billMap.put("goodsCode", orderWithMaterialDTO.getMaterialCode() != null ? orderWithMaterialDTO.getMaterialCode().toString() : null);
billMap.put("netWt", orderWithMaterialDTO.getWeightLimit());
billMap.put("grossWt", orderWithMaterialDTO.getGrossWeight());
billMap.put("packNo", orderWithMaterialDTO.getCargoNum());
billMap.put("erpQty", orderWithMaterialDTO.getCargoNum());
billList.add(billMap);
}
body.put("billList",billList);
if (pushData.getId() != null) {
updatePushStatus(pushData.getId(), 2, null, String.valueOf(pushBy), pushByName);
}
// 2. 记录日志
GwLog gwLog = new GwLog();
gwLog.setType("进出口原始单证");
gwLog.setBusinessId(Long.valueOf(pushData.getId()));
gwLog.setRequestBody(JSONObject.toJSONString(body));
gwLog.setResponseBody("");
gwLog.setStatus(1);
gwLog.setSendTime(new Date());
gwLog.setOrganizationId(organizationId);
gwLog.setTopOrganizationId(topOrganizationId);
gwLog.setOrganizationName(organizationName);
gwLog.setCreateBy(pushBy);
gwLog.setCreateTime(new Date());
gwLog.setDelFlag(1);
gwLogMapper.insert(gwLog);
// 3. 调用推送接口
try {
CloseableHttpClient httpClient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(PUSH_API_URL);
StringEntity postingString = new StringEntity(JSONObject.toJSONString(body), "UTF-8");
httpPost.setEntity(postingString);
httpPost.setHeader("Content-type", "application/json");
httpPost.setHeader("verify", VERIFY);
if(pushData.getIeType().equals("I"))
{
httpPost.setHeader("apiName", API_NAME_I);
}
else if (pushData.getIeType().equals("E")) {
httpPost.setHeader("apiName", API_NAME_E);
}else{
AjaxResult.error("进出口方式错误");
}
CloseableHttpResponse response = httpClient.execute(httpPost);
String responseString = EntityUtils.toString(response.getEntity());
gwLog.setResponseBody(responseString);
if (response.getStatusLine().getStatusCode() == 200) {
gwLog.setStatus(2);
if (pushData.getId() != null) {
updatePushStatus(pushData.getId(), 3, new Date(), String.valueOf(pushBy), pushByName);
}
successCount++;
} else {
gwLog.setStatus(3);
gwLog.setErrorMsg(responseString);
if (pushData.getId() != null) {
updatePushStatus(pushData.getId(), 4, new Date(), String.valueOf(pushBy), pushByName);
}
failCount++;
failMsg.append("物料编码:").append(pushData.getMaterialCode()).append("失败:");
}
gwLogMapper.updateById(gwLog);
response.close();
} catch (IOException e) {
gwLog.setStatus(3);
gwLog.setErrorMsg(e.getMessage());
gwLog.setResponseBody("请求异常:" + e.getMessage());
gwLogMapper.updateById(gwLog);
if (pushData.getId() != null) {
updatePushStatus(pushData.getId(), 4, new Date(), String.valueOf(pushBy), pushByName);
}
failCount++;
failMsg.append("物料编码:").append(pushData.getMaterialCode()).append("异常:").append(e.getMessage());
log.error("GW推送异常:materialCode={} error={}", pushData.getMaterialCode(), e.getMessage());
}
}
String resultMsg = "推送完成:成功" + successCount + "条,失败" + failCount + "";
if (failCount > 0) {
resultMsg += "[" + failMsg.toString() + "]";
}
return AjaxResult.success(resultMsg);
}
private void updatePushStatus(Long id, Integer pushStatus, Date pushTime, String pushBy, String pushByName) {
try {
BusinessDocumentOrder update = new BusinessDocumentOrder();
update.setId(id);
update.setPushStatus(pushStatus);
if (pushTime != null) {
update.setPushTime(pushTime);
}
if (pushBy != null) {
update.setPushBy(pushBy);
}
if (pushByName != null) {
update.setPushByName(pushByName);
}
businessDocumentOrderMapper.updateById(update);
} catch (Exception e) {
log.error("更新推送状态失败: id={}, error={}", id, e.getMessage());
}
}
}
@@ -0,0 +1,187 @@
package com.mhd.oms.application.service.businessPartner;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.mhd.common.core.utils.bean.BeanUtils;
import com.mhd.common.core.web.domain.AjaxResult;
import com.mhd.common.core.web.page.TableDataInfo;
import com.mhd.common.security.utils.SecurityUtils;
import com.mhd.oms.domain.gwLog.entity.GwLog;
import com.mhd.oms.domain.gwLog.repository.mapper.GwLogMapper;
import com.mhd.oms.interfaces.dto.businessPartner.BusinessPartnerDTO;
import com.mhd.system.api.UserServiceFeign;
import com.mhd.system.api.domain.UserShipperQueryDTO;
import com.mhd.system.api.model.LoginUser;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.io.IOException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
@Slf4j
public class BusinessPartnerApplicationService {
private static final String PUSH_API_URL = "http://10.33.0.100/nagu-erp-api/transfer/pushData";
private static final String API_NAME = "saveCorporation";
private static final String VERIFY = "tjPZMT9fwhZRnv+eTXKF75QXmXzCn7phPagmoUQsvsh2ZTWDjuRxHAgcP0GZENHP";
@Resource
private UserServiceFeign userServiceFeign;
@Resource
private GwLogMapper gwLogMapper;
public TableDataInfo queryShipperPage(BusinessPartnerDTO businessPartnerDTO) {
UserShipperQueryDTO userShipperQueryDTO = new UserShipperQueryDTO();
BeanUtils.copyProperties(businessPartnerDTO,userShipperQueryDTO);
if(businessPartnerDTO.getOrganizationId()!=null){
userShipperQueryDTO.setOrganizationId(String.valueOf(businessPartnerDTO.getOrganizationId()));
}
try {
TableDataInfo userTableDataInfo = userServiceFeign.userShipperList(userShipperQueryDTO);
TableDataInfo tableDataInfo = new TableDataInfo();
tableDataInfo.setData(userTableDataInfo.getData());
tableDataInfo.setTotal(userTableDataInfo.getTotal());
tableDataInfo.setCode(200);
return tableDataInfo;
} catch (Exception e) {
log.error("查询托运人列表异常: {}", e.getMessage());
TableDataInfo tableDataInfo = new TableDataInfo();
tableDataInfo.setCode(500);
return tableDataInfo;
}
}
public AjaxResult batchPush(List<BusinessPartnerDTO> businessPartnerDTOList) {
if(businessPartnerDTOList == null || businessPartnerDTOList.isEmpty()){
return AjaxResult.error("没有数据需要推送");
}
LoginUser loginUser = SecurityUtils.getLoginUser();
Long pushBy = loginUser != null ? loginUser.getUserid() : null;
String pushByName = loginUser != null ? loginUser.getUsername() : null;
Long organizationId = loginUser != null ? loginUser.getUserPo().getOrganizationId() : null;
Long topOrganizationId = loginUser != null ? loginUser.getUserPo().getTopOrganizationId() : null;
String organizationName = loginUser != null ? loginUser.getUserPo().getOrganizationName() : null;
int successCount = 0;
int failCount = 0;
StringBuilder failMsg = new StringBuilder();
for (BusinessPartnerDTO businessPartnerDTO :businessPartnerDTOList){
Map<String, String> body = new HashMap<>();
body.put("copyCode",businessPartnerDTO.getCorpCode());
body.put("copyName",businessPartnerDTO.getCorpName());
GwLog gwLog = new GwLog();
gwLog.setType("商业合作伙伴");
gwLog.setBusinessId(Long.valueOf(businessPartnerDTO.getShipperId()));
gwLog.setRequestBody(JSONObject.toJSONString(body));
gwLog.setResponseBody("");
gwLog.setStatus(1);
gwLog.setSendTime(new Date());
gwLog.setOrganizationId(organizationId);
gwLog.setTopOrganizationId(topOrganizationId);
gwLog.setOrganizationName(organizationName);
gwLog.setCreateBy(pushBy);
gwLog.setCreateTime(new Date());
gwLog.setDelFlag(1);
gwLogMapper.insert(gwLog);
updatePushStatus(Long.valueOf(businessPartnerDTO.getShipperId()),2,new Date(),pushBy,pushByName);
CloseableHttpClient httpClient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(PUSH_API_URL);
StringEntity postingString = new StringEntity(JSONObject.toJSONString(body),"UTF-8");
httpPost.setEntity(postingString);
httpPost.setHeader("Content-type", "application/json");
httpPost.setHeader("apiName", API_NAME);
httpPost.setHeader("verify", VERIFY);
try{
CloseableHttpResponse response = httpClient.execute(httpPost);
String responseString = EntityUtils.toString(response.getEntity());
gwLog.setResponseBody(responseString);
if(response.getStatusLine().getStatusCode() == 200){
gwLog.setStatus(2);
updatePushStatus(Long.valueOf(businessPartnerDTO.getShipperId()),3, new Date(), pushBy,pushByName);
successCount++;
}else{
gwLog.setStatus(3);
gwLog.setErrorMsg(responseString);
updatePushStatus(Long.valueOf(businessPartnerDTO.getShipperId()),4, new Date(), pushBy,pushByName);
failCount++;
failMsg.append("CorpCode:").append(businessPartnerDTO.getCorpCode()).append("失败:");
}
gwLogMapper.updateById(gwLog);
response.close();
} catch (IOException e) {
gwLog.setStatus(3);
gwLog.setErrorMsg(e.getMessage());
gwLog.setResponseBody("请求异常:" + e.getMessage());
gwLogMapper.updateById(gwLog);
updatePushStatus(Long.valueOf(businessPartnerDTO.getShipperId()),4, new Date(), pushBy,pushByName);
failCount++;
failMsg.append("CorpCode:").append(businessPartnerDTO.getCorpCode()).append("异常:").append(e.getMessage()).append(":");
log.error("GW推送异常:shipperId={} error={}",businessPartnerDTO.getShipperId(),e.getMessage());
} finally {
try{
httpClient.close();
}catch (Exception e){
log.error("关闭httpClient异常:{}" + e.getMessage());
}
}
}
String resultMsg = "推送完成:成功" + successCount + "条,失败" + failCount +"";
if(failCount > 0){
resultMsg += "[" + failMsg.toString() + "]";
}
return AjaxResult.success(resultMsg);
}
private void updatePushStatus(Long shipperId, Integer pushStatus, Date pushTime, Long pushBy,String pushByName) {
try {
// 调用user-center的Feign接口更新货主的推送状态
String pushTimeStr = pushTime != null ? DateUtil.format(pushTime, "yyyy-MM-dd HH:mm:ss") : null;
AjaxResult result = userServiceFeign.updatePushStatus(shipperId, pushStatus, pushTimeStr, pushBy, pushByName);
log.info("更新返回结果:{}",result);
} catch (Exception e) {
// 如果更新失败记录错误日志但不阻断主流程
log.info("更新推送状态失败: shipperId={}, error={}", shipperId, e.getMessage());
}
}
}
@@ -0,0 +1,207 @@
package com.mhd.oms.application.service.erpCountry;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.mhd.common.core.web.domain.AjaxResult;
import com.mhd.common.core.web.page.TableDataInfo;
import com.mhd.common.security.utils.SecurityUtils;
import com.mhd.oms.domain.erpCountry.entity.ErpCountry;
import com.mhd.oms.domain.erpCountry.repository.mapper.ErpCountryMapper;
import com.mhd.oms.domain.erpCountry.repository.po.ErpCountryPO;
import com.mhd.oms.domain.gwLog.entity.GwLog;
import com.mhd.oms.domain.gwLog.repository.mapper.GwLogMapper;
import com.mhd.oms.interfaces.dto.erpCountry.ErpCountryDTO;
import com.mhd.system.api.model.LoginUser;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.io.IOException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
@Slf4j
public class ErpCountryApplicationService{
private static final String PUSH_API_URL = "http://10.33.0.100/nagu-erp-api/transfer/pushData";
private static final String API_NAME = "saveCountry";
private static final String VERIFY = "tjPZMT9fwhZRnv+eTXKF75QXmXzCn7phPagmoUQsvsh2ZTWDjuRxHAgcP0GZENHP";
@Resource
private ErpCountryMapper erpCountryMapper;
@Resource
private GwLogMapper gwLogMapper;
public TableDataInfo queryList(ErpCountryDTO erpCountryDTO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null) {
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1) {
erpCountryDTO.setTopOrganizationId(topOrganizationId);
}
}
PageHelper.startPage(erpCountryDTO.getPageNum(),erpCountryDTO.getPageSize());
List<ErpCountryPO> list = erpCountryMapper.queryList(erpCountryDTO);
Page<ErpCountryPO> page = (Page<ErpCountryPO>) list;
TableDataInfo tableDataInfo = new TableDataInfo();
tableDataInfo.setData(list);
tableDataInfo.setTotal(page.getTotal());
tableDataInfo.setCode(200);
return tableDataInfo;
}
public int insert(ErpCountryDTO erpCountryDTO) {
ErpCountry erpCountry = new ErpCountry();
BeanUtils.copyProperties(erpCountryDTO, erpCountry);
erpCountry.setPushStatus(1);
erpCountry.setDelFlag(1);
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null) {
erpCountry.setCreateBy(loginUser.getUserid());
erpCountry.setOrganizationId(loginUser.getUserPo().getOrganizationId());
erpCountry.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
}
erpCountry.setCreateTime(new Date());
return erpCountryMapper.insert(erpCountry);
}
public int update(ErpCountryDTO erpCountryDTO) {
ErpCountry erpCountry = new ErpCountry();
BeanUtils.copyProperties(erpCountryDTO, erpCountry);
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null) {
erpCountry.setUpdateBy(loginUser.getUserid());
erpCountry.setUpdateTime(new Date());
}
return erpCountryMapper.updateById(erpCountry);
}
public int deleteByIds(List<Long> idList) {
return erpCountryMapper.deleteByIds(idList);
}
public AjaxResult batchPush(List<ErpCountryDTO> dtoList) {
if (dtoList == null || dtoList.isEmpty()) {
return AjaxResult.error("没有数据需要推送");
}
LoginUser loginUser = SecurityUtils.getLoginUser();
Long pushBy = loginUser != null ? loginUser.getUserid() : null;
String pushByName = loginUser != null ? loginUser.getUsername() : null;
Long organizationId = loginUser != null ? loginUser.getUserPo().getOrganizationId() : null;
Long topOrganizationId = loginUser != null ? loginUser.getUserPo().getTopOrganizationId() : null;
String organizationName = loginUser != null ? loginUser.getUserPo().getOrganizationName() : null;
int successCount = 0;
int failCount = 0;
StringBuilder failMsg = new StringBuilder();
for (ErpCountryDTO dto : dtoList) {
Map<String, String> body = new HashMap<>();
body.put("erpCountryCode", dto.getErpCountryCode());
body.put("erpCountryName", dto.getErpCountryName());
GwLog gwLog = new GwLog();
gwLog.setType("企业国别");
gwLog.setBusinessId(dto.getId());
gwLog.setRequestBody(JSONObject.toJSONString(body));
gwLog.setResponseBody("");
gwLog.setStatus(1);
gwLog.setSendTime(new Date());
gwLog.setOrganizationId(organizationId);
gwLog.setTopOrganizationId(topOrganizationId);
gwLog.setOrganizationName(organizationName);
gwLog.setCreateBy(pushBy);
gwLog.setCreateTime(new Date());
gwLog.setDelFlag(1);
gwLogMapper.insert(gwLog);
updatePushStatus(dto.getId(), 2, new Date(), pushBy,pushByName);
CloseableHttpClient httpClient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(PUSH_API_URL);
StringEntity postingString = new StringEntity(JSONObject.toJSONString(body), "UTF-8");
httpPost.setEntity(postingString);
httpPost.setHeader("Content-type", "application/json");
httpPost.setHeader("apiName", API_NAME);
httpPost.setHeader("verify", VERIFY);
try {
CloseableHttpResponse response = httpClient.execute(httpPost);
String responseString = EntityUtils.toString(response.getEntity());
gwLog.setResponseBody(responseString);
if (response.getStatusLine().getStatusCode() == 200) {
gwLog.setStatus(2);
updatePushStatus(dto.getId(), 3, new Date(), pushBy,pushByName);
successCount++;
} else {
gwLog.setStatus(3);
gwLog.setErrorMsg(responseString);
updatePushStatus(dto.getId(), 4, new Date(), pushBy,pushByName);
failCount++;
failMsg.append("erpCountryCode:").append(dto.getErpCountryCode()).append("失败;");
}
gwLogMapper.updateById(gwLog);
response.close();
} catch (IOException e) {
gwLog.setStatus(3);
gwLog.setErrorMsg(e.getMessage());
gwLog.setResponseBody("请求异常:" + e.getMessage());
gwLogMapper.updateById(gwLog);
updatePushStatus(dto.getId(), 4, new Date(), pushBy,pushByName);
failCount++;
failMsg.append("erpCountryCode:").append(dto.getErpCountryCode()).append("异常:").append(e.getMessage()).append(";");
log.error("企业国别推送异常: id={}, error={}", dto.getId(), e.getMessage());
} finally {
try {
httpClient.close();
} catch (Exception e) {
log.error("关闭httpClient异常: {}", e.getMessage());
}
}
}
String resultMsg = "推送完成: 成功" + successCount + "条, 失败" + failCount + "";
if (failCount > 0) {
resultMsg += "[" + failMsg.toString() + "]";
}
return AjaxResult.success(resultMsg);
}
private void updatePushStatus(Long id, Integer pushStatus, Date pushTime, Long pushBy,String pushByName) {
ErpCountry entity = new ErpCountry();
entity.setId(id);
entity.setPushStatus(pushStatus);
if (pushTime != null) {
entity.setPushTime(pushTime);
}
if (pushBy != null) {
entity.setPushBy(pushBy);
}
if (pushByName != null) {
entity.setPushByName(pushByName);
}
erpCountryMapper.updateById(entity);
}
public ErpCountry getById(Long id) {
return erpCountryMapper.selectById(id);
}
}
@@ -0,0 +1,210 @@
package com.mhd.oms.application.service.erpEnterpriseUnit;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.mhd.common.core.utils.bean.BeanUtils;
import com.mhd.common.core.web.domain.AjaxResult;
import com.mhd.common.core.web.page.TableDataInfo;
import com.mhd.common.security.utils.SecurityUtils;
import com.mhd.oms.domain.erpEnterpriseUnit.entity.ErpEnterpriseUnit;
import com.mhd.oms.domain.erpEnterpriseUnit.repository.mapper.ErpEnterpriseUnitMapper;
import com.mhd.oms.domain.erpEnterpriseUnit.repository.po.ErpEnterpriseUnitPO;
import com.mhd.oms.domain.erpEnterpriseUnit.repository.todo.ErpEnterpriseUnitDO;
import com.mhd.oms.domain.gwLog.entity.GwLog;
import com.mhd.oms.domain.gwLog.repository.mapper.GwLogMapper;
import com.mhd.oms.interfaces.dto.erpEnterpriseUnit.ErpEnterpriseUnitDTO;
import com.mhd.system.api.model.LoginUser;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.io.IOException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
@Slf4j
public class ErpEnterpriseUnitApplicationService {
private static final String PUSH_API_URL = "http://10.33.0.100/nagu-erp-api/transfer/pushData";
private static final String API_NAME = "saveUnit";
private static final String VERIFY = "tjPZMT9fwhZRnv+eTXKF75QXmXzCn7phPagmoUQsvsh2ZTWDjuRxHAgcP0GZENHP";
@Resource
private ErpEnterpriseUnitMapper erpEnterpriseUnitMapper;
@Resource
private GwLogMapper gwLogMapper;
public TableDataInfo queryList(ErpEnterpriseUnitDO erpEnterpriseUnitDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null) {
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1) {
erpEnterpriseUnitDO.setTopOrganizationId(topOrganizationId);
}
}
PageHelper.startPage(erpEnterpriseUnitDO.getPageNum(),erpEnterpriseUnitDO.getPageSize());
List<ErpEnterpriseUnitPO> list = erpEnterpriseUnitMapper.queryList(erpEnterpriseUnitDO);
Page<ErpEnterpriseUnitPO> page = (Page<ErpEnterpriseUnitPO>) list;
TableDataInfo tableDataInfo = new TableDataInfo();
tableDataInfo.setData(list);
tableDataInfo.setTotal(page.getTotal());
tableDataInfo.setCode(200);
return tableDataInfo;
}
public int update(ErpEnterpriseUnitDTO erpEnterpriseUnitDTO) {
ErpEnterpriseUnit erpEnterpriseUnit = new ErpEnterpriseUnit();
BeanUtils.copyProperties(erpEnterpriseUnitDTO,erpEnterpriseUnit);
LoginUser loginUser = SecurityUtils.getLoginUser();
if(loginUser != null){
erpEnterpriseUnit.setUpdateBy(loginUser.getUserid());
erpEnterpriseUnit.setUpdateTime(new Date());
}
return erpEnterpriseUnitMapper.updateById(erpEnterpriseUnit);
}
public int insert(ErpEnterpriseUnitDTO erpEnterpriseUnitDTO) {
ErpEnterpriseUnit erpEnterpriseUnit = new ErpEnterpriseUnit();
BeanUtils.copyProperties(erpEnterpriseUnitDTO,erpEnterpriseUnit);
erpEnterpriseUnit.setPushStatus(1);
erpEnterpriseUnit.setDelFlag(1);
LoginUser loginUser = SecurityUtils.getLoginUser();
if(loginUser != null){
erpEnterpriseUnit.setCreateBy(loginUser.getUserid());
//erpEnterpriseUnit.setCreateTime(new Date());
erpEnterpriseUnit.setOrganizationId(loginUser.getUserPo().getOrganizationId());
erpEnterpriseUnit.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
}
erpEnterpriseUnit.setCreateTime(new Date());
return erpEnterpriseUnitMapper.insert(erpEnterpriseUnit);
}
public AjaxResult batchPush(List<ErpEnterpriseUnitDTO> dtoList) {
if (dtoList == null || dtoList.isEmpty()) {
return AjaxResult.error("没有数据需要推送");
}
LoginUser loginUser = SecurityUtils.getLoginUser();
Long pushBy = loginUser != null ? loginUser.getUserid() : null;
String pushByName = loginUser != null ? loginUser.getUsername() : null;
Long organizationId = loginUser != null ? loginUser.getUserPo().getOrganizationId() : null;
Long topOrganizationId = loginUser != null ? loginUser.getUserPo().getTopOrganizationId() : null;
String organizationName = loginUser != null ? loginUser.getUserPo().getOrganizationName() : null;
int successCount = 0;
int failCount = 0;
StringBuilder failMsg = new StringBuilder();
for (ErpEnterpriseUnitDTO dto : dtoList) {
Map<String, String> body = new HashMap<>();
body.put("erpUnitCode", dto.getErpCode());
body.put("erpUnitName", dto.getErpName());
GwLog gwLog = new GwLog();
gwLog.setType("企业单位");
gwLog.setBusinessId(Long.valueOf(dto.getId()));
gwLog.setRequestBody(JSONObject.toJSONString(body));
gwLog.setResponseBody("");
gwLog.setStatus(1);
gwLog.setSendTime(new Date());
gwLog.setOrganizationId(organizationId);
gwLog.setTopOrganizationId(topOrganizationId);
gwLog.setOrganizationName(organizationName);
gwLog.setCreateBy(pushBy);
gwLog.setCreateTime(new Date());
gwLog.setDelFlag(1);
gwLogMapper.insert(gwLog);
updatePushStatus(dto.getId(), 2, new Date(), pushBy,pushByName);
CloseableHttpClient httpClient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(PUSH_API_URL);
StringEntity postingString = new StringEntity(JSONObject.toJSONString(body), "UTF-8");
httpPost.setEntity(postingString);
httpPost.setHeader("Content-type", "application/json");
httpPost.setHeader("apiName", API_NAME);
httpPost.setHeader("verify", VERIFY);
try {
CloseableHttpResponse response = httpClient.execute(httpPost);
String responseString = EntityUtils.toString(response.getEntity());
gwLog.setResponseBody(responseString);
if (response.getStatusLine().getStatusCode() == 200) {
gwLog.setStatus(2);
updatePushStatus(dto.getId(), 3, new Date(), pushBy,pushByName);
successCount++;
} else {
gwLog.setStatus(3);
gwLog.setErrorMsg(responseString);
updatePushStatus(dto.getId(), 4, new Date(), pushBy,pushByName);
failCount++;
failMsg.append("erpUnitCode:").append(dto.getErpCode()).append("失败;");
}
gwLogMapper.updateById(gwLog);
response.close();
} catch (IOException e) {
gwLog.setStatus(3);
gwLog.setErrorMsg(e.getMessage());
gwLog.setResponseBody("请求异常:" + e.getMessage());
gwLogMapper.updateById(gwLog);
updatePushStatus(dto.getId(), 4, new Date(), pushBy,pushByName);
failCount++;
failMsg.append("erpUnitCode:").append(dto.getErpCode()).append("异常:").append(e.getMessage()).append(";");
log.error("企业单位推送异常: id={}, error={}", dto.getId(), e.getMessage());
} finally {
try {
httpClient.close();
} catch (Exception e) {
log.error("关闭httpClient异常: {}", e.getMessage());
}
}
}
String resultMsg = "推送完成: 成功" + successCount + "条, 失败" + failCount + "";
if (failCount > 0) {
resultMsg += "[" + failMsg.toString() + "]";
}
return AjaxResult.success(resultMsg);
}
private void updatePushStatus(Long id, Integer pushStatus, Date pushTime, Long pushBy ,String pushByName) {
ErpEnterpriseUnit entity = new ErpEnterpriseUnit();
entity.setId(id);
entity.setPushStatus(pushStatus);
if (pushTime != null) {
entity.setPushTime(pushTime);
}
if (pushBy != null) {
entity.setPushBy(String.valueOf(pushBy));
}
if (pushByName != null) {
entity.setPushByName((pushByName));
}
erpEnterpriseUnitMapper.updateById(entity);
}
public int deleteByIds(List<Long> idList) {
if(idList == null || idList.isEmpty()){
return 0;
}
return erpEnterpriseUnitMapper.deleteByIds(idList);
}
public ErpEnterpriseUnit getById(Long id) {
return erpEnterpriseUnitMapper.selectById(id);
}
}
@@ -0,0 +1,184 @@
package com.mhd.oms.application.service.exchangeRate;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.mhd.common.core.web.domain.AjaxResult;
import com.mhd.common.core.web.page.TableDataInfo;
import com.mhd.common.security.utils.SecurityUtils;
import com.mhd.oms.domain.gwLog.entity.GwLog;
import com.mhd.oms.domain.gwLog.repository.mapper.GwLogMapper;
import com.mhd.oms.interfaces.dto.exchangeRate.ExchangeRateDTO;
import com.mhd.system.api.WlhyServiceFeign;
import com.mhd.system.api.model.LoginUser;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.io.IOException;
import java.util.*;
@Service
@Slf4j
public class ExchangeRateApplicationService {
private static final String PUSH_API_URL = "http://10.33.0.100/nagu-erp-api/transfer/pushData";
private static final String API_NAME = "saveCurr";
private static final String VERIFY = "tjPZMT9fwhZRnv+eTXKF75QXmXzCn7phPagmoUQsvsh2ZTWDjuRxHAgcP0GZENHP";
@Resource
private WlhyServiceFeign wlhyServiceFeign;
@Resource
private GwLogMapper gwLogMapper;
public TableDataInfo queryExchangeRateList(Integer pageNum, Integer pageSize, String pushStatus, String organizationId) {
try {
log.info("查询汇率列表: pageNum={}, pageSize={}, pushStatus={}, organizationId={}",
pageNum, pageSize, pushStatus, organizationId);
AjaxResult<?> result = wlhyServiceFeign.queryList(pageNum, pageSize, pushStatus, organizationId);
log.info("查询汇率列表结果: code={}, result={}", result.get("code"), result.get("result"));
if (result != null) {
Object wlhyResult = result.get("result");
if (wlhyResult != null) {
Map<?, ?> map = (Map<?, ?>) wlhyResult;
Object records = map.get("records");
Object total = map.get("total");
List<?> list = records instanceof List ? (List<?>) records : new ArrayList<>();
TableDataInfo tableDataInfo = new TableDataInfo();
tableDataInfo.setData(list);
tableDataInfo.setTotal(total instanceof Number ? ((Number) total).longValue() : list.size());
tableDataInfo.setCode(200);
return tableDataInfo;
}
}
} catch (Exception e) {
log.error("查询汇率列表异常: {}", e.getMessage());
e.printStackTrace();
}
return buildTableDataInfo(new ArrayList<>());
}
private TableDataInfo buildTableDataInfo(List<?> list) {
TableDataInfo tableDataInfo = new TableDataInfo();
tableDataInfo.setData(list);
tableDataInfo.setTotal(list.size());
tableDataInfo.setCode(200);
return tableDataInfo;
}
public AjaxResult batchPushExchangeRate(List<ExchangeRateDTO> exchangeRateDTOList) {
if (exchangeRateDTOList == null || exchangeRateDTOList.isEmpty()) {
return AjaxResult.error("没有数据需要推送");
}
LoginUser loginUser = SecurityUtils.getLoginUser();
Long pushBy = loginUser != null ? loginUser.getUserid() : null;
String pushByName = loginUser != null ? loginUser.getUsername() : null;
Long organizationId = loginUser != null ? loginUser.getUserPo().getOrganizationId() : null;
Long topOrganizationId = loginUser != null ? loginUser.getUserPo().getTopOrganizationId() : null;
String organizationName = loginUser != null ? loginUser.getUserPo().getOrganizationName() : null;
int successCount = 0;
int failCount = 0;
StringBuilder failMsg = new StringBuilder();
for (ExchangeRateDTO dto : exchangeRateDTOList) {
Map<String, String> body = new HashMap<>();
body.put("erpCurrCode", dto.getErpCurrCode());
body.put("erpCurrName", dto.getErpCurrName());
GwLog gwLog = new GwLog();
gwLog.setType("汇率管理");
gwLog.setBusinessId(Long.valueOf(dto.getId()));
gwLog.setRequestBody(JSONObject.toJSONString(body));
gwLog.setResponseBody("");
gwLog.setStatus(1);
gwLog.setSendTime(new Date());
gwLog.setOrganizationId(organizationId);
gwLog.setTopOrganizationId(topOrganizationId);
gwLog.setOrganizationName(organizationName);
gwLog.setCreateBy(pushBy);
gwLog.setCreateTime(new Date());
gwLog.setDelFlag(1);
gwLogMapper.insert(gwLog);
// 更新为推送中
updateExchangeRatePushStatus(dto.getId(), 2, new Date(), pushBy, pushByName);
CloseableHttpClient httpClient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(PUSH_API_URL);
StringEntity postingString = new StringEntity(JSONObject.toJSONString(body), "UTF-8");
httpPost.setEntity(postingString);
httpPost.setHeader("Content-type", "application/json");
httpPost.setHeader("apiName", API_NAME);
httpPost.setHeader("verify", VERIFY);
try {
CloseableHttpResponse response = httpClient.execute(httpPost);
String responseString = EntityUtils.toString(response.getEntity());
gwLog.setResponseBody(responseString);
if (response.getStatusLine().getStatusCode() == 200) {
gwLog.setStatus(2);
updateExchangeRatePushStatus(dto.getId(), 3, new Date(), pushBy, pushByName);
successCount++;
} else {
gwLog.setStatus(3);
gwLog.setErrorMsg(responseString);
updateExchangeRatePushStatus(dto.getId(), 4, new Date(), pushBy, pushByName);
failCount++;
failMsg.append("erpCurrCode:").append(dto.getErpCurrCode()).append("失败;");
}
gwLogMapper.updateById(gwLog);
response.close();
} catch (IOException e) {
gwLog.setStatus(3);
gwLog.setErrorMsg(e.getMessage());
gwLog.setResponseBody("请求异常:" + e.getMessage());
gwLogMapper.updateById(gwLog);
updateExchangeRatePushStatus(dto.getId(), 4, new Date(), pushBy, pushByName);
failCount++;
failMsg.append("erpCurrCode:").append(dto.getErpCurrCode()).append("异常:").append(e.getMessage()).append(";");
log.error("汇率推送异常: id={}, error={}", dto.getId(), e.getMessage());
} finally {
try {
httpClient.close();
} catch (Exception e) {
log.error("关闭httpClient异常: {}", e.getMessage());
}
}
}
String resultMsg = "推送完成: 成功" + successCount + "条, 失败" + failCount + "";
if (failCount > 0) {
resultMsg += "[" + failMsg.toString() + "]";
}
return AjaxResult.success(resultMsg);
}
private void updateExchangeRatePushStatus(String id, Integer pushStatus, Date pushTime, Long pushBy, String pushByName) {
try {
String pushTimeStr = pushTime != null ? DateUtil.format(pushTime, "yyyy-MM-dd HH:mm:ss") : null;
wlhyServiceFeign.updateExchangeRatePushStatus(id, pushStatus, pushTimeStr, pushBy, pushByName);
} catch (Exception e) {
log.error("更新汇率推送状态失败: id={}, error={}", id, e.getMessage());
}
}
}
@@ -0,0 +1,59 @@
package com.mhd.oms.application.service.gwLog;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.mhd.common.core.utils.bean.BeanUtils;
import com.mhd.common.core.web.domain.AjaxResult;
import com.mhd.common.core.web.page.TableDataInfo;
import com.mhd.common.security.utils.SecurityUtils;
import com.mhd.oms.domain.gwLog.entity.GwLog;
import com.mhd.oms.domain.gwLog.repository.mapper.GwLogMapper;
import com.mhd.oms.domain.gwLog.repository.po.GwLogPO;
import com.mhd.oms.interfaces.dto.gwLog.GwLogDTO;
import com.mhd.system.api.model.LoginUser;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
@Slf4j
public class GwLogApplicationService {
private final GwLogMapper gwLogMapper;
public GwLogApplicationService(GwLogMapper gwLogMapper) {
this.gwLogMapper = gwLogMapper;
}
public TableDataInfo queryList(GwLogDTO gwLogDTO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null){
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1){
gwLogDTO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
}
}
PageHelper.startPage(gwLogDTO.getPageNum(),gwLogDTO.getPageSize());
List<GwLogPO> list = gwLogMapper.queryList(gwLogDTO);
Page<GwLogPO> page = (Page<GwLogPO>) list;
TableDataInfo tableDataInfo = new TableDataInfo();
tableDataInfo.setData(list);
tableDataInfo.setTotal(page.getTotal());
tableDataInfo.setCode(200);
return tableDataInfo;
}
public GwLogPO selectByTypeAndId(GwLogDTO gwLogDTO) {
GwLog gwLog =new GwLog();
BeanUtils.copyProperties(gwLogDTO,gwLog);
List<GwLogPO> po1 = gwLogMapper.selectByTypeAndId(gwLog);
if(po1.isEmpty()){
return null;
}
GwLogPO po = po1.get(0);
return po;
}
}
@@ -0,0 +1,178 @@
package com.mhd.oms.application.service.materialInfo;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.mhd.common.core.exception.ServiceException;
import com.mhd.common.core.web.domain.AjaxResult;
import com.mhd.common.core.web.page.TableDataInfo;
import com.mhd.common.security.utils.SecurityUtils;
import com.mhd.oms.domain.gwLog.entity.GwLog;
import com.mhd.oms.domain.gwLog.repository.mapper.GwLogMapper;
import com.mhd.system.api.WmsServiceFeign;
import com.mhd.system.api.domain.MaterialInfoDTO;
import com.mhd.system.api.model.LoginUser;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.io.IOException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
@Slf4j
public class MaterialInfoApplicationService {
private static final String PUSH_API_URL = "http://10.33.0.100/nagu-erp-api/transfer/pushData";
private static final String API_NAME = "saveOrgGoods";
private static final String VERIFY = "tjPZMT9fwhZRnv+eTXKF75QXmXzCn7phPagmoUQsvsh2ZTWDjuRxHAgcP0GZENHP";
@Resource
private GwLogMapper gwLogMapper;
private final WmsServiceFeign wmsServiceFeign;
public MaterialInfoApplicationService(WmsServiceFeign wmsServiceFeign) {
this.wmsServiceFeign = wmsServiceFeign;
}
public TableDataInfo queryList(MaterialInfoDTO materialInfoDTO) {
try {
TableDataInfo wmsTableDataInfo = wmsServiceFeign.getMaterialBaseInfoList(materialInfoDTO);
TableDataInfo tableDataInfo = new TableDataInfo();
tableDataInfo.setData(wmsTableDataInfo.getData());
tableDataInfo.setTotal(wmsTableDataInfo.getTotal());
tableDataInfo.setCode(200);
return tableDataInfo;
} catch (Exception e) {
log.error("查询物料列表异常: {}", e.getMessage());
TableDataInfo tableDataInfo = new TableDataInfo();
tableDataInfo.setCode(500);
return tableDataInfo;
}
}
public AjaxResult batchPush(List<MaterialInfoDTO> dtoList) {
if (dtoList == null || dtoList.isEmpty()) {
return AjaxResult.error("没有数据需要推送");
}
LoginUser loginUser = SecurityUtils.getLoginUser();
Long pushBy = loginUser != null ? loginUser.getUserid() : null;
String pushByName = loginUser != null ? loginUser.getUsername() : null;
Long organizationId = loginUser != null ? loginUser.getUserPo().getOrganizationId() : null;
Long topOrganizationId = loginUser != null ? loginUser.getUserPo().getTopOrganizationId() : null;
String organizationName = loginUser != null ? loginUser.getUserPo().getOrganizationName() : null;
int successCount = 0;
int failCount = 0;
StringBuilder failMsg = new StringBuilder();
for (MaterialInfoDTO dto : dtoList) {
Map<String, String> body = new HashMap<>();
body.put("goodsCode", dto.getMaterialCode());
String goodsTypeString;
if(dto.getGoodsType() == 0){
goodsTypeString = "0";
}else if(dto.getGoodsType() == 1){
goodsTypeString = "1";
}else if(dto.getGoodsType() == 2){
goodsTypeString = "2";
}else{
throw new ServiceException("货物类型不存在");
}
body.put("goodsType", goodsTypeString);
body.put("erpName", dto.getMaterialName());
GwLog gwLog = new GwLog();
gwLog.setType("物料管理");
gwLog.setBusinessId(dto.getMaterialBaseInfoId());
gwLog.setRequestBody(JSONObject.toJSONString(body));
gwLog.setResponseBody("");
gwLog.setStatus(1);
gwLog.setSendTime(new Date());
gwLog.setOrganizationId(organizationId);
gwLog.setTopOrganizationId(topOrganizationId);
gwLog.setOrganizationName(organizationName);
gwLog.setCreateBy(pushBy);
gwLog.setCreateTime(new Date());
gwLog.setDelFlag(1);
gwLogMapper.insert(gwLog);
updatePushStatus(dto.getMaterialBaseInfoId(), 2, new Date(), pushBy,pushByName);
CloseableHttpClient httpClient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(PUSH_API_URL);
StringEntity postingString = new StringEntity(JSONObject.toJSONString(body), "UTF-8");
httpPost.setEntity(postingString);
httpPost.setHeader("Content-type", "application/json");
httpPost.setHeader("apiName", API_NAME);
httpPost.setHeader("verify", VERIFY);
try {
CloseableHttpResponse response = httpClient.execute(httpPost);
String responseString = EntityUtils.toString(response.getEntity());
gwLog.setResponseBody(responseString);
if (response.getStatusLine().getStatusCode() == 200) {
gwLog.setStatus(2);
updatePushStatus(dto.getMaterialBaseInfoId(), 3, new Date(), pushBy, pushByName);
successCount++;
} else {
gwLog.setStatus(3);
gwLog.setErrorMsg(responseString);
updatePushStatus(dto.getMaterialBaseInfoId(), 4, new Date(), pushBy, pushByName);
failCount++;
failMsg.append("materialCode:").append(dto.getMaterialCode()).append("失败;");
}
gwLogMapper.updateById(gwLog);
response.close();
} catch (IOException e) {
gwLog.setStatus(3);
gwLog.setErrorMsg(e.getMessage());
gwLog.setResponseBody("请求异常:" + e.getMessage());
gwLogMapper.updateById(gwLog);
updatePushStatus(dto.getMaterialBaseInfoId(), 4, new Date(), pushBy, pushByName);
failCount++;
failMsg.append("materialCode:").append(dto.getMaterialCode()).append("异常:").append(e.getMessage()).append(";");
log.error("物料推送异常: id={}, error={}", dto.getMaterialBaseInfoId(), e.getMessage());
} finally {
try {
httpClient.close();
} catch (Exception e) {
log.error("关闭httpClient异常: {}", e.getMessage());
}
}
}
String resultMsg = "推送完成: 成功" + successCount + "条, 失败" + failCount + "";
if (failCount > 0) {
resultMsg += "[" + failMsg.toString() + "]";
}
return AjaxResult.success(resultMsg);
}
private void updatePushStatus(Long materialBaseInfoId, Integer pushStatus, Date pushTime, Long pushBy, String pushByName) {
try {
String pushTimeStr = pushTime != null ? DateUtil.format(pushTime, "yyyy-MM-dd HH:mm:ss") : null;
wmsServiceFeign.updateMaterialPushStatus(materialBaseInfoId, pushStatus, pushTimeStr, pushBy, pushByName);
log.info("更新返回结果: materialBaseInfoId={}", materialBaseInfoId);
} catch (Exception e) {
log.info("更新推送状态失败: materialBaseInfoId={}, error={}", materialBaseInfoId, e.getMessage());
}
}
}
@@ -96,10 +96,16 @@ public class BusinessDocumentCargoMulti extends BaseVOEntity{
@ApiModelProperty("")
private String materialCode;
@ApiModelProperty("物料id")
private Long materialBaseInfoId;
@ApiModelProperty("$column.columnComment")
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String orderId;
@ApiModelProperty("货物内容")
private String materialContent;
@ApiModelProperty("商品类型/货物类型(0料件,1半成品,2成品)")
private Integer productType;
}
@@ -62,6 +62,10 @@ public class BusinessDocumentCargoMultiPO extends BaseVOEntity{
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private BigDecimal cargoWeight;
@ApiModelProperty("商品类型/货物类型(0料件,1半成品,2成品)")
private Integer productType;
@ApiModelProperty("物料id")
private Long materialBaseInfoId;
}
@@ -67,4 +67,10 @@ public class BusinessDocumentCargoMultiDO extends BaseVOEntity{
@ApiModelProperty(name = "权限菜单ID")
private Long permissionMenuId;
@ApiModelProperty("商品类型/货物类型(0料件,1半成品,2成品)")
private Integer productType;
@ApiModelProperty("物料id")
private Long materialBaseInfoId;
}
@@ -756,4 +756,21 @@ public class BusinessDocumentOrder extends BaseVOEntity{
@ApiModelProperty("仓库负责人电话")
private String directorPhone;
@ApiModelProperty("进出口方式:I-进口,E-出口")
private String ieType;
@ApiModelProperty("推送状态:1-未推送 2-推送中 3-推送成功 4-推送失败")
private Integer pushStatus;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("推送时间")
private Date pushTime;
@ApiModelProperty("推送人")
private String pushBy;
@ApiModelProperty("推送人姓名")
private String pushByName;
}
@@ -52,4 +52,6 @@ public interface IBusinessDocumentOrderService extends IService<BusinessDocument
String selectByMakerCodeNc(String salesmanCodeNc);
String selectByMakerCodeNc1(String salesmanCodeNc);
List<BusinessDocumentOrderPO> queryListAndMaterial(BusinessDocumentOrderDO businessDocumentOrderDO);
}
@@ -23,4 +23,5 @@ public interface BusinessDocumentOrderMapper extends BaseMapper<BusinessDocument
String selectByMakerCodeNc1(@Param("salesmanCodeNc") String salesmanCodeNc);
List<BusinessDocumentOrderPO> queryListAndMaterial(BusinessDocumentOrderDO businessDocumentOrderDO);
}
@@ -449,4 +449,10 @@ public class BusinessDocumentOrderImpl extends ServiceImpl<BusinessDocumentOrder
}
return makerCodeNc;
}
@Override
public List<BusinessDocumentOrderPO> queryListAndMaterial(BusinessDocumentOrderDO businessDocumentOrderDO)
{
return businessDocumentOrderMapper.queryListAndMaterial(businessDocumentOrderDO);
}
}
@@ -765,9 +765,39 @@ public class BusinessDocumentOrderPO extends BaseVOEntity{
@ApiModelProperty("出入库单号")
private String inOrderNumber;
@ApiModelProperty("仓库负责人")
private String directorName;
@ApiModelProperty("仓库负责人电话")
private String directorPhone;
@ApiModelProperty("进出口方式:I-进口,E-出口")
private String ieType;
@ApiModelProperty("推送状态:1-未推送 2-推送中 3-推送成功 4-推送失败")
private Integer pushStatus;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("推送时间")
private Date pushTime;
@ApiModelProperty("推送人")
private String pushBy;
@ApiModelProperty("推送人姓名")
private String pushByName;
@ApiModelProperty("执行单")
private List<ExecuteOrder> executeOrderList;
@ApiModelProperty("货物信息")
private List<BusinessDocumentCargoMulti> businessDocumentCargoMultiList;
@ApiModelProperty("物料编码")
private String materialCode;
@ApiModelProperty("商品类型")
private Integer productType;
}
@@ -775,7 +775,7 @@ public class BusinessDocumentOrderDO extends BaseVOEntity{
@ApiModelProperty(value = "审核意见")
private String reviewOpinion;
@ApiModelProperty("订单来源")
@ApiModelProperty("订单来源 0.运输,1.仓储")
private String orderSource;
@ApiModelProperty(value = "出入库单号")
@@ -790,6 +790,23 @@ public class BusinessDocumentOrderDO extends BaseVOEntity{
@ApiModelProperty("仓库负责人电话")
private String directorPhone;
@ApiModelProperty("进出口方式:I-进口,E-出口")
private String ieType;
@ApiModelProperty("推送状态:1-未推送 2-推送中 3-推送成功 4-推送失败")
private Integer pushStatus;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("推送时间")
private Date pushTime;
@ApiModelProperty("推送人")
private String pushBy;
@ApiModelProperty("推送人姓名")
private String pushByName;
@ApiModelProperty("费用科目明细")
private List<BusinessOrderAccount> businessOrderAccountList;
@@ -806,4 +823,24 @@ public class BusinessDocumentOrderDO extends BaseVOEntity{
private List<BusinessDocumentAddressMultiDTO> loadingAddressList;
@ApiModelProperty(value = "卸货地址集合")
private List<BusinessDocumentAddressMultiDTO> unloadAddressList;
@ApiModelProperty(value = "单证日期起")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date documentDateStart;
@ApiModelProperty(value = "单证日期止")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date documentDateEnd;
@ApiModelProperty(value = "推送时间起")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date pushTimeStart;
@ApiModelProperty(value = "推送时间止")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date pushTimeEnd;
}
@@ -19,6 +19,8 @@ import com.mhd.oms.domain.businessDocumentOrder.repository.po.BusinessDocumentOr
import com.mhd.oms.domain.businessDocumentOrder.repository.todo.BusinessDocumentOrderDO;
import com.mhd.oms.domain.businessOrderAccount.BusinessOrderAccount;
import com.mhd.oms.domain.businessOrderAccount.repository.mapper.BusinessOrderAccountMapper;
import com.mhd.oms.domain.reservationOrder.entity.ReservationOrder;
import com.mhd.oms.domain.reservationOrder.repository.mapper.ReservationOrderMapper;
import com.mhd.oms.interfaces.dto.businessDocumentAddressMulti.BusinessAuditDTO;
import com.mhd.oms.interfaces.dto.businessDocumentAddressMulti.BusinessDocumentAddressMultiDTO;
import com.mhd.oms.interfaces.dto.businessDocumentCargoMulti.BusinessDocumentCargoMultiDTO;
@@ -64,6 +66,9 @@ public class BusinessDocumentOrderDomainService {
@Resource
private BusinessOrderAccountMapper businessOrderAccountMapper;
@Resource
private ReservationOrderMapper reservationOrderMapper;
/**
* 分页查询请填写功能名称列表
*/
@@ -564,7 +569,19 @@ public class BusinessDocumentOrderDomainService {
tmsOrder.setTopOrganizationId(businessDocumentOrderDO.getTopOrganizationId());
}
// boolean istrue=businessDocumentOrderService.update(businessDocumentOrderDO);
int i = businessDocumentOrderMapper.updateById(tmsOrder);
if (deliveryFreight != null && deliveryFreight.compareTo(BigDecimal.ZERO) > 0){
List<ReservationOrder> reservationOrderList = reservationOrderMapper.selectList(new LambdaQueryWrapper<ReservationOrder>().eq(ReservationOrder::getGoodsNumber, businessDocumentOrderDO.getGoodsNumber()));
if (ObjectUtil.isNotEmpty(reservationOrderList) && reservationOrderList.size() > 0) {
for (ReservationOrder reservationOrder : reservationOrderList){
reservationOrder.setDeliveryFreight(deliveryFreight);
reservationOrderMapper.updateById(reservationOrder);
}
}
}
//保存货物信息及地址信息
saveAddress2CargoInfo(tmsOrder.getId(), allCargoList, loadingAddressList, unloadAddressList);
@@ -623,6 +640,7 @@ public class BusinessDocumentOrderDomainService {
tmsCargoInfo.setCargoWeight(tmsCargoInfoDTO.getWeight()==null ? BigDecimal.ZERO: tmsCargoInfoDTO.getWeight());
tmsCargoInfo.setCargoNum(tmsCargoInfoDTO.getCargoNum()==null ? BigDecimal.ZERO: tmsCargoInfoDTO.getCargoNum());
tmsCargoInfo.setMaterialVolume(tmsCargoInfoDTO.getMaterialVolume()==null ? BigDecimal.ZERO: tmsCargoInfoDTO.getMaterialVolume());
tmsCargoInfo.setMaterialBaseInfoId(tmsCargoInfoDTO.getMaterialBaseInfoId());
businessDocumentCargoMultiMapper.insert(tmsCargoInfo);
}
@@ -787,4 +805,11 @@ public class BusinessDocumentOrderDomainService {
}
return null;
}
public List<BusinessDocumentOrderPO> queryListAndMaterial(BusinessDocumentOrderDO businessDocumentOrderDO) {
return businessDocumentOrderService.queryListAndMaterial(businessDocumentOrderDO);
}
}
@@ -0,0 +1,73 @@
package com.mhd.oms.domain.erpCountry.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
@Data
@TableName("erp_country")
@ApiModel(description = "企业国别实体")
public class ErpCountry implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.AUTO)
@ApiModelProperty("主键ID")
private Long id;
@ApiModelProperty("ERP国别编码")
private String erpCountryCode;
@ApiModelProperty("ERP国别名称")
private String erpCountryName;
@ApiModelProperty("推送状态:1-未推送,2-推送中,3-推送成功,4-推送失败")
private Integer pushStatus;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("推送时间")
private Date pushTime;
@ApiModelProperty("推送人")
private Long pushBy;
@ApiModelProperty("推送人姓名")
private String pushByName;
@ApiModelProperty("所属组织ID")
private Long organizationId;
@ApiModelProperty("一级组织ID")
private Long topOrganizationId;
@ApiModelProperty("所属组织名称")
private String organizationName;
@ApiModelProperty("创建人")
private Long createBy;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("创建时间")
private Date createTime;
@ApiModelProperty("更新人")
private Long updateBy;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("更新时间")
private Date updateTime;
@ApiModelProperty("删除标记:1-正常,0-删除")
private Integer delFlag;
}
@@ -0,0 +1,24 @@
package com.mhd.oms.domain.erpCountry.repository.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mhd.oms.domain.erpCountry.entity.ErpCountry;
import com.mhd.oms.domain.erpCountry.repository.po.ErpCountryPO;
import com.mhd.oms.interfaces.dto.erpCountry.ErpCountryDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface ErpCountryMapper extends BaseMapper<ErpCountry> {
/**
*
* @param erpCountryDTO
* @return
*/
List<ErpCountryPO> queryList(@Param("erpCountryDTO") ErpCountryDTO erpCountryDTO);
int deleteByIds(@Param("idList") List<Long> idList);
}
@@ -0,0 +1,67 @@
package com.mhd.oms.domain.erpCountry.repository.po;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@Data
public class ErpCountryPO {
@ApiModelProperty("主键ID")
private Long id;
@ApiModelProperty("ERP国别编码")
private String erpCountryCode;
@ApiModelProperty("ERP国别名称")
private String erpCountryName;
@ApiModelProperty("推送状态:1-未推送,2-推送中,3-推送成功,4-推送失败")
private Integer pushStatus;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("推送时间")
private Date pushTime;
@ApiModelProperty("推送人")
private Long pushBy;
@ApiModelProperty("推送人")
private String pushByName;
@ApiModelProperty("所属组织ID")
private Long organizationId;
@ApiModelProperty("一级组织ID")
private Long topOrganizationId;
@ApiModelProperty("所属组织名称")
private String organizationName;
@ApiModelProperty("创建人")
private Long createBy;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("创建时间")
private Date createTime;
@ApiModelProperty("更新人")
private Long updateBy;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("更新时间")
private Date updateTime;
@ApiModelProperty("删除标记:1-正常,0-删除")
private Integer delFlag;
}
@@ -0,0 +1,72 @@
package com.mhd.oms.domain.erpEnterpriseUnit.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@Data
@ApiModel(description = "企业单位")
public class ErpEnterpriseUnit {
@ApiModelProperty(value = "主键ID")
@TableId(type = IdType.AUTO)
private Long id;
@ApiModelProperty(value = "ERP单位编码")
private String erpCode;
@ApiModelProperty(value = "ERP单位名称")
private String erpName;
@ApiModelProperty(value = "推送状态:1-未推送,2-推送中,3-推送成功,4-推送失败")
private Integer pushStatus;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "推送时间")
private Date pushTime;
@ApiModelProperty(value = "推送人")
private String pushBy;
@ApiModelProperty(value = "推送人姓名")
private String pushByName;
@ApiModelProperty(value = "所属组织ID")
private Long organizationId;
@ApiModelProperty(value = "一级组织ID")
private Long topOrganizationId;
@ApiModelProperty(value = "所属组织名称")
private String organizationName;
@ApiModelProperty(value = "创建人")
private Long createBy;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "更新人")
private Long updateBy;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新时间")
private Date updateTime;
@ApiModelProperty(value = "删除标记:1-正常,0-删除")
private Integer delFlag;
}
@@ -0,0 +1,30 @@
package com.mhd.oms.domain.erpEnterpriseUnit.repository.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mhd.oms.domain.erpEnterpriseUnit.entity.ErpEnterpriseUnit;
import com.mhd.oms.domain.erpEnterpriseUnit.repository.po.ErpEnterpriseUnitPO;
import com.mhd.oms.domain.erpEnterpriseUnit.repository.todo.ErpEnterpriseUnitDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface ErpEnterpriseUnitMapper extends BaseMapper<ErpEnterpriseUnit> {
/**
*
* @param erpEnterpriseUnitDO
* @return
*/
List<ErpEnterpriseUnitPO> queryList(@Param("erpEnterpriseUnitDO")ErpEnterpriseUnitDO erpEnterpriseUnitDO);
/**
*
* @param idList
* @return
*/
int deleteByIds(@Param("idList") List<Long> idList);
}
@@ -0,0 +1,71 @@
package com.mhd.oms.domain.erpEnterpriseUnit.repository.po;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mhd.common.core.web.domain.BaseVOEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@Data
@ApiModel(description = "企业单位PO")
public class ErpEnterpriseUnitPO extends BaseVOEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键ID")
private Long id;
@ApiModelProperty(value = "ERP单位编码")
private String erpCode;
@ApiModelProperty(value = "ERP单位名称")
private String erpName;
@ApiModelProperty(value = "推送状态:1-未推送,2-推送中,3-推送成功,4-推送失败")
private Integer pushStatus;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "推送时间")
private Date pushTime;
@ApiModelProperty(value = "推送人")
private Long pushBy;
@ApiModelProperty(value = "推送人")
private String pushByName;
@ApiModelProperty(value = "所属组织ID")
private Long organizationId;
@ApiModelProperty(value = "一级组织ID")
private Long topOrganizationId;
@ApiModelProperty(value = "所属组织名称")
private String organizationName;
@ApiModelProperty(value = "创建人")
private Long createBy;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "更新人")
private Long updateBy;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新时间")
private Date updateTime;
@ApiModelProperty(value = "删除标记:1-正常,0-删除")
private Integer delFlag;
}
@@ -0,0 +1,57 @@
package com.mhd.oms.domain.erpEnterpriseUnit.repository.todo;
import com.mhd.common.core.web.domain.BaseVOEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class ErpEnterpriseUnitDO extends BaseVOEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键ID")
private Long id;
@ApiModelProperty(value = "ERP单位编码")
private String erpCode;
@ApiModelProperty(value = "ERP单位名称")
private String erpName;
@ApiModelProperty(value = "推送状态:1-未推送,2-推送中,3-推送成功,4-推送失败")
private Integer pushStatus;
@ApiModelProperty(value = "推送时间")
private String pushTime;
@ApiModelProperty(value = "推送时间起")
private String pushTimeFrom;
@ApiModelProperty(value = "推送时间止")
private String pushTimeTo;
@ApiModelProperty(value = "推送人")
private String pushBy;
@ApiModelProperty(value = "所属组织ID")
private Long organizationId;
@ApiModelProperty(value = "所属组织名称")
private String organizationName;
@ApiModelProperty(value = "创建时间起")
private String createTimeFrom;
@ApiModelProperty(value = "创建时间止")
private String createTimeTo;
@ApiModelProperty(value = "页码")
private Integer pageNum = 1;
@ApiModelProperty(value = "每页数量")
private Integer pageSize = 10;
@ApiModelProperty(value = "每页数量")
private Long TopOrganizationId;
}

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