信用明细查询
This commit is contained in:
+58
@@ -0,0 +1,58 @@
|
|||||||
|
package com.mhd.user.application.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.mhd.user.domain.userAggregate.entity.AgreementDetails;
|
||||||
|
import com.mhd.user.domain.userAggregate.repository.mapper.AgreementDetailsMapper;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 协议详情业务层
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class AgreementDetailsApplicationService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AgreementDetailsMapper agreementDetailsMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据货主ID查询所有协议明细
|
||||||
|
*
|
||||||
|
* @param shipperId 货主ID
|
||||||
|
* @return 协议明细列表
|
||||||
|
*/
|
||||||
|
public List<AgreementDetails> listByShipperId(Long shipperId) {
|
||||||
|
return agreementDetailsMapper.selectList(
|
||||||
|
new LambdaQueryWrapper<AgreementDetails>()
|
||||||
|
.eq(AgreementDetails::getShipperId, shipperId)
|
||||||
|
.orderByDesc(AgreementDetails::getCreateTime)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据主键查询单条协议明细
|
||||||
|
*
|
||||||
|
* @param id 主键ID
|
||||||
|
* @return 协议明细
|
||||||
|
*/
|
||||||
|
public AgreementDetails getInfo(Long id) {
|
||||||
|
return agreementDetailsMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据货主ID删除所有协议明细
|
||||||
|
*
|
||||||
|
* @param shipperId 货主ID
|
||||||
|
* @return 影响行数
|
||||||
|
*/
|
||||||
|
public int deleteByShipperId(Long shipperId) {
|
||||||
|
return agreementDetailsMapper.delete(
|
||||||
|
new LambdaQueryWrapper<AgreementDetails>()
|
||||||
|
.eq(AgreementDetails::getShipperId, shipperId)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
+26
@@ -35,8 +35,10 @@ import com.mhd.user.domain.roleAggregate.repository.todo.RoleDo;
|
|||||||
import com.mhd.user.domain.roleAggregate.service.RoleDomainService;
|
import com.mhd.user.domain.roleAggregate.service.RoleDomainService;
|
||||||
import com.mhd.common.core.domain.po.RolePO;
|
import com.mhd.common.core.domain.po.RolePO;
|
||||||
import com.mhd.user.domain.userAggregate.entity.UserRoleEntity;
|
import com.mhd.user.domain.userAggregate.entity.UserRoleEntity;
|
||||||
|
import com.mhd.user.domain.userAggregate.entity.AgreementDetails;
|
||||||
import com.mhd.user.domain.userAggregate.entity.UserShipperEntity;
|
import com.mhd.user.domain.userAggregate.entity.UserShipperEntity;
|
||||||
import com.mhd.user.domain.userAggregate.event.ShipperEventPublisher;
|
import com.mhd.user.domain.userAggregate.event.ShipperEventPublisher;
|
||||||
|
import com.mhd.user.domain.userAggregate.repository.mapper.AgreementDetailsMapper;
|
||||||
import com.mhd.user.domain.userAggregate.repository.mapper.UserShipperMapper;
|
import com.mhd.user.domain.userAggregate.repository.mapper.UserShipperMapper;
|
||||||
import com.mhd.user.domain.userAggregate.repository.po.UserDriverPo;
|
import com.mhd.user.domain.userAggregate.repository.po.UserDriverPo;
|
||||||
import com.mhd.user.domain.userAggregate.repository.todo.*;
|
import com.mhd.user.domain.userAggregate.repository.todo.*;
|
||||||
@@ -125,6 +127,9 @@ public class UserShipperApplicationService {
|
|||||||
@Resource
|
@Resource
|
||||||
private BusinessPartnerPushLogMapper businessPartnerPushLogMapper;
|
private BusinessPartnerPushLogMapper businessPartnerPushLogMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AgreementDetailsMapper agreementDetailsMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description 查询托运人列表
|
* @Description 查询托运人列表
|
||||||
* @Author Alex
|
* @Author Alex
|
||||||
@@ -1608,6 +1613,27 @@ public class UserShipperApplicationService {
|
|||||||
userShipperEntity1.setSettlementCurrency(limitData.getString("currencycode"));
|
userShipperEntity1.setSettlementCurrency(limitData.getString("currencycode"));
|
||||||
userShipperEntity1.setCreditAmount(limitData.getBigDecimal("nbalancemny"));
|
userShipperEntity1.setCreditAmount(limitData.getBigDecimal("nbalancemny"));
|
||||||
userShipperMapper.updateById(userShipperEntity1);
|
userShipperMapper.updateById(userShipperEntity1);
|
||||||
|
//关联明细表:同步agreedaydatas到agreement_details
|
||||||
|
com.alibaba.fastjson.JSONArray agreedaydatas = dataJson.getJSONArray("agreedaydatas");
|
||||||
|
if (agreedaydatas != null && !agreedaydatas.isEmpty()) {
|
||||||
|
// 先删除该货主已有的协议明细,避免重复
|
||||||
|
agreementDetailsMapper.delete(new LambdaQueryWrapper<AgreementDetails>()
|
||||||
|
.eq(AgreementDetails::getShipperId, userShipperEntity1.getShipperId()));
|
||||||
|
for (int i = 0; i < agreedaydatas.size(); i++) {
|
||||||
|
com.alibaba.fastjson.JSONObject agreeItem = agreedaydatas.getJSONObject(i);
|
||||||
|
AgreementDetails agreementDetails = new AgreementDetails();
|
||||||
|
agreementDetails.setShipperId(userShipperEntity1.getShipperId());
|
||||||
|
agreementDetails.setOrgcode(agreeItem.getString("orgcode"));
|
||||||
|
agreementDetails.setCode(agreeItem.getString("code"));
|
||||||
|
agreementDetails.setPday(agreeItem.getString("pday"));
|
||||||
|
agreementDetails.setPname(agreeItem.getString("pname"));
|
||||||
|
agreementDetails.setPtypename(agreeItem.getString("ptypename"));
|
||||||
|
agreementDetails.setPcode(agreeItem.getString("pcode"));
|
||||||
|
agreementDetails.setPtype(agreeItem.getString("ptype"));
|
||||||
|
agreementDetailsMapper.insert(agreementDetails);
|
||||||
|
}
|
||||||
|
log.info("同步协议明细成功,custcode={},shipperId={},共{}条", userShipperEntity1.getCustomerNcCode(), userShipperEntity1.getShipperId(), agreedaydatas.size());
|
||||||
|
}
|
||||||
log.info("更新货主额度同步成功,custcode={},shipperId={}", userShipperEntity1.getCustomerNcCode(), userShipperEntity1.getShipperId());
|
log.info("更新货主额度同步成功,custcode={},shipperId={}", userShipperEntity1.getCustomerNcCode(), userShipperEntity1.getShipperId());
|
||||||
} else {
|
} else {
|
||||||
log.info("赊销额度查询无limitdatas返回,跳过更新,custcode={}", userShipperEntity1.getCustomerNcCode());
|
log.info("赊销额度查询无limitdatas返回,跳过更新,custcode={}", userShipperEntity1.getCustomerNcCode());
|
||||||
|
|||||||
+48
@@ -0,0 +1,48 @@
|
|||||||
|
package com.mhd.user.domain.userAggregate.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: brb
|
||||||
|
* @description: 协议详情表
|
||||||
|
* @create: 2026-06-16 18:25
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("agreement_details")
|
||||||
|
public class AgreementDetails extends BaseVOEntity {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
@ApiModelProperty("主键ID")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@ApiModelProperty("货主表ID")
|
||||||
|
private Long shipperId;
|
||||||
|
|
||||||
|
@ApiModelProperty("协议组织编码")
|
||||||
|
private String orgcode;
|
||||||
|
|
||||||
|
@ApiModelProperty("客户编码")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
@ApiModelProperty("协议天数")
|
||||||
|
private String pday;
|
||||||
|
|
||||||
|
@ApiModelProperty("协议天数名称")
|
||||||
|
private String pname;
|
||||||
|
|
||||||
|
@ApiModelProperty("协议类型名称")
|
||||||
|
private String ptypename;
|
||||||
|
|
||||||
|
@ApiModelProperty("财务系统协议编码")
|
||||||
|
private String pcode;
|
||||||
|
|
||||||
|
@ApiModelProperty("协议类型")
|
||||||
|
private String ptype;
|
||||||
|
}
|
||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
package com.mhd.user.domain.userAggregate.repository.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.mhd.user.domain.userAggregate.entity.AgreementDetails;
|
||||||
|
|
||||||
|
public interface AgreementDetailsMapper extends BaseMapper<AgreementDetails> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
package com.mhd.user.interfaces.facade;
|
||||||
|
|
||||||
|
import com.mhd.common.core.web.controller.BaseController;
|
||||||
|
import com.mhd.common.core.web.domain.AjaxResult;
|
||||||
|
import com.mhd.user.application.service.AgreementDetailsApplicationService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 协议详情控制层
|
||||||
|
*/
|
||||||
|
@Api(tags = "用户中台管理-协议详情")
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/agreementDetailsApi")
|
||||||
|
@CrossOrigin
|
||||||
|
public class AgreementDetailsApi extends BaseController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AgreementDetailsApplicationService agreementDetailsApplicationService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据货主ID查询所有协议明细
|
||||||
|
*/
|
||||||
|
@ApiOperation("根据货主ID查询协议明细列表")
|
||||||
|
@GetMapping("/listByShipperId/{shipperId}")
|
||||||
|
public AjaxResult listByShipperId(@PathVariable("shipperId") Long shipperId) {
|
||||||
|
return AjaxResult.success(agreementDetailsApplicationService.listByShipperId(shipperId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据主键查询单条协议明细
|
||||||
|
*/
|
||||||
|
@ApiOperation("获取协议详情")
|
||||||
|
@GetMapping("/getInfo/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||||
|
return AjaxResult.success(agreementDetailsApplicationService.getInfo(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据货主ID删除所有协议明细
|
||||||
|
*/
|
||||||
|
@ApiOperation("根据货主ID删除协议明细")
|
||||||
|
@DeleteMapping("/deleteByShipperId/{shipperId}")
|
||||||
|
public AjaxResult deleteByShipperId(@PathVariable("shipperId") Long shipperId) {
|
||||||
|
return toAjax(agreementDetailsApplicationService.deleteByShipperId(shipperId));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.mhd.user.domain.userAggregate.repository.mapper.AgreementDetailsMapper">
|
||||||
|
|
||||||
|
<sql id="selectAgreementDetailsVo">
|
||||||
|
SELECT id,
|
||||||
|
shipper_id,
|
||||||
|
orgcode,
|
||||||
|
code,
|
||||||
|
pday,
|
||||||
|
pname,
|
||||||
|
ptypename,
|
||||||
|
pcode,
|
||||||
|
ptype,
|
||||||
|
create_time,
|
||||||
|
create_by,
|
||||||
|
create_by_name,
|
||||||
|
update_time,
|
||||||
|
update_by,
|
||||||
|
update_by_name,
|
||||||
|
del_flag
|
||||||
|
FROM agreement_details
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<!--通用的查询条件-->
|
||||||
|
<sql id="common_where">
|
||||||
|
<if test="null != id">
|
||||||
|
AND id = #{id}
|
||||||
|
</if>
|
||||||
|
<if test="null != shipperId">
|
||||||
|
AND shipper_id = #{shipperId}
|
||||||
|
</if>
|
||||||
|
<if test="null != orgcode and '' != orgcode">
|
||||||
|
AND orgcode = #{orgcode}
|
||||||
|
</if>
|
||||||
|
<if test="null != code and '' != code">
|
||||||
|
AND code = #{code}
|
||||||
|
</if>
|
||||||
|
<if test="null != pday and '' != pday">
|
||||||
|
AND pday = #{pday}
|
||||||
|
</if>
|
||||||
|
<if test="null != pname and '' != pname">
|
||||||
|
AND pname = #{pname}
|
||||||
|
</if>
|
||||||
|
<if test="null != ptypename and '' != ptypename">
|
||||||
|
AND ptypename = #{ptypename}
|
||||||
|
</if>
|
||||||
|
<if test="null != pcode and '' != pcode">
|
||||||
|
AND pcode = #{pcode}
|
||||||
|
</if>
|
||||||
|
<if test="null != ptype and '' != ptype">
|
||||||
|
AND ptype = #{ptype}
|
||||||
|
</if>
|
||||||
|
<if test="null != delFlag">
|
||||||
|
AND del_flag = #{delFlag}
|
||||||
|
</if>
|
||||||
|
ORDER BY create_time DESC
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Reference in New Issue
Block a user