This commit is contained in:
linfso 2024-05-29 04:14:31 +08:00
parent f5c9476262
commit f2f6880d67
10 changed files with 222 additions and 71 deletions

View File

@ -38,22 +38,24 @@ public class EmisQuotePrice extends BaseEntity
/* 序号 */
private Long quoteId;
/* 报价名称 */
private String quoteName;
/* 报价编码 */
private String quoteCode;
/* 报价名称 */
private String quoteName;
/* 报价类型 1-干线费 2-特殊费 3-大客户运输费 4-大客户特殊费 */
private String quoteType;
/* 大客户编号 */
private String customerCode;
/* 客户月结编号 */
private String custNo;
/* 使用站点代码 */
private String useSiteCode;
/* 使用站点名称 */
private String useSite;
/* 所属线路代码 */
private String transLineCode;
/* 费用类型 运输费 */
private String feeType;
/* 产品类型代码 */
private String prodCode;
/* 录入收费项 */
private String recPayType;
/* 计费类型 1-重量计费 2-体积计费 */
@ -111,6 +113,9 @@ public class EmisQuotePrice extends BaseEntity
/* 产品类型名称 */
private String prodName;
/* 大客户编号 */
private String customerName;
private List<EmisQuoteExpression> exprList;
}

View File

@ -10,8 +10,9 @@ public enum EmisBizErrorType {
CALC_WEIGHT_ERROR("E003", "重量计算错误"),
CALC_QUOTE_ERROR("E004", "报价未配置"),
BILL_LOCK("E901", "已锁账,不允许修改"),
NOT_EXISTS("E902","运单不存在"),
BILL_LOCK("E901", "已锁账"),
NOT_EXISTS("E902","不存在"),
EXISTS("E903","已存在"),
PARSE_ADDRESS_ERROR("E980","地址解析错误"),

View File

@ -0,0 +1,23 @@
package com.xdadan.erp.emis.domain.enumtype;
/**
* 付款状态
*/
public enum PaymentStatus {
INIT("0","未付款"),
PAID("1","已付款"),
PAID_SOME("2","部分付款"),
REFUSE("3","拒付"),
FREE("4","免单"),
OTHER("9","其他");
public String statusCode;
public String statusName;
PaymentStatus(String statusCode, String statusName) {
this.statusCode = statusCode;
this.statusName = statusName;
}
}

View File

@ -67,4 +67,14 @@ public interface EmisQuotePriceMapper extends BaseMapper<EmisQuotePrice>
* @return 结果
*/
public int deleteEmisQuotePriceByQuoteIds(Long[] quoteIds);
/**
* 检查是否重复
*
* @param emisQuotePrice
* @return 数量
*/
public List<EmisQuotePrice> checkUnique(EmisQuotePrice emisQuotePrice);
}

View File

@ -20,6 +20,7 @@ package com.xdadan.erp.emis.service;
import com.xdadan.erp.common.utils.SecurityUtils;
import com.xdadan.erp.emis.domain.*;
import com.xdadan.erp.emis.domain.enumtype.EmisBizErrorType;
import com.xdadan.erp.emis.domain.enumtype.PaymentStatus;
import com.xdadan.erp.emis.domain.enumtype.ScanType;
import com.xdadan.erp.emis.domain.exception.EmisBizError;
import com.xdadan.erp.emis.domain.vo.WaybillOrder;
@ -832,7 +833,16 @@ public class EmisBaseService {
* @param billType
* @return
*/
public List<EmisQuotePrice> getValidQuotePriceList(String lineCode,String prodCode,String sendSiteCode,String destSiteCode,String billType) {
public List<EmisQuotePrice> getValidQuotePriceList(
String lineCode,
String prodCode,
String sendSiteCode,
String destSiteCode,
String billType,
String customerCode,
String custNo
) {
EmisQuotePrice queryEmisQuotePrice = new EmisQuotePrice();
queryEmisQuotePrice.setTransLineCode(lineCode);
queryEmisQuotePrice.setProdCode(prodCode);
@ -844,29 +854,72 @@ public class EmisBaseService {
queryEmisQuotePrice.setSendAreaSiteCode(sendSiteCode);
queryEmisQuotePrice.setDispAreaSiteCode(destSiteCode);
// 客户
queryEmisQuotePrice.setCustomerCode(customerCode);
queryEmisQuotePrice.setCustNo(custNo);
Map existsMap = new HashMap();
// 客户优先级最高
List<EmisQuotePrice> listQuoteVip = emisQuotePriceMapper.selectEmisQuotePriceList(queryEmisQuotePrice);
for (EmisQuotePrice item:listQuoteVip) {
existsMap.put(item.getFeeType(),"1");
}
// 取通用数据排重
List<EmisQuotePrice> listQuote = emisQuotePriceMapper.selectEmisQuotePriceList(queryEmisQuotePrice);
for (EmisQuotePrice item:listQuote) {
if(existsMap.containsKey(item.getFeeType())){
continue;
}
}
return listQuote;
}
/**
* 超时锁账时间
* @param data
* 判断是否锁账
* @param emisWaybill
* @return
*/
public static boolean isOutTime(Date data) {
//24小时
long house=60*60*24;
//系统当前时间,
long currentTime = System.currentTimeMillis()/1000;
//业务时间
long endTime=data.getTime()/1000;
if((endTime + house) < currentTime ){
public boolean isWaybillLock(EmisWaybill emisWaybill) {
// 判断运单状态,如果已锁账,则不允许修改
// 下单超过 24小时
// (1)当天开单的,次日9点前允许修改面单;
//(2)当天开单次日上午9点后未锁帐,总部/财务中心修改;
//(3)若运单已签收、已确认账单、已收款、已锁帐,登记申请审批后进行修改;
if("1".equals(emisWaybill.getBlBill())
|| ScanType.SIGNED.opCode.equals(emisWaybill.getWaybillStatus())
|| PaymentStatus.PAID.statusCode.equals(emisWaybill.getPaymentStatus())
|| PaymentStatus.PAID_SOME.statusCode.equals(emisWaybill.getPaymentStatus())
){
return true;
}else{
return false;
}
// 判断系统是否已锁账
// 创建时间<服务器0点 次日9点锁账
Date createTime = emisWaybill.getCreateTime();
Date now = new Date();
Calendar calendar = Calendar.getInstance();
int todayHour = calendar.get(Calendar.HOUR_OF_DAY);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MILLISECOND, 0);
long todayZero = calendar.getTimeInMillis();
if(createTime.getTime()<todayZero && todayHour>9 ){
return true;
}
return false;
}
/**

View File

@ -12,6 +12,7 @@ package com.xdadan.erp.emis.service;
import java.util.List;
import com.xdadan.erp.emis.domain.EmisQuotePrice;
import com.xdadan.erp.emis.domain.EmisWaybillFeeitem;
import com.xdadan.erp.emis.domain.exception.EmisBizError;
/**
* @ClassName EmisQuotePriceService
@ -44,7 +45,7 @@ public interface IEmisQuotePriceService
* @param emisQuotePrice 费用报价
* @return 结果
*/
public int insertEmisQuotePrice(EmisQuotePrice emisQuotePrice);
public int insertEmisQuotePrice(EmisQuotePrice emisQuotePrice) throws EmisBizError;
/**
* 修改费用报价
@ -52,7 +53,7 @@ public interface IEmisQuotePriceService
* @param emisQuotePrice 费用报价
* @return 结果
*/
public int updateEmisQuotePrice(EmisQuotePrice emisQuotePrice);
public int updateEmisQuotePrice(EmisQuotePrice emisQuotePrice) throws EmisBizError;
/**
* 批量删除费用报价

View File

@ -70,7 +70,11 @@ public class EmisElectronicPagApplyServiceImpl extends EmisBaseService implement
emisElectronicPagApply.setApplySiteCode(getCurrentUser().getOwnerSiteCode());
emisElectronicPagApply.setApplyManCode(getCurrentUser().getEmpCode());
emisElectronicPagApply.preInsert();
return emisElectronicPagApplyMapper.insertEmisElectronicPagApply(emisElectronicPagApply);
int ret=emisElectronicPagApplyMapper.insertEmisElectronicPagApply(emisElectronicPagApply);
// 自动发放
return 1;
}
/**

View File

@ -14,6 +14,8 @@ import java.util.List;
import cn.hutool.core.collection.CollectionUtil;
import com.xdadan.erp.emis.domain.EmisQuoteExpression;
import com.xdadan.erp.emis.domain.enumtype.EmisBizErrorType;
import com.xdadan.erp.emis.domain.exception.EmisBizError;
import com.xdadan.erp.emis.mapper.EmisQuoteExpressionMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -71,8 +73,19 @@ public class EmisQuotePriceServiceImpl implements IEmisQuotePriceService
*/
@Override
@Transactional
public int insertEmisQuotePrice(EmisQuotePrice emisQuotePrice)
{
public int insertEmisQuotePrice(EmisQuotePrice emisQuotePrice) throws EmisBizError {
// 检查是否重复
List<EmisQuotePrice> listOld=emisQuotePriceMapper.checkUnique(emisQuotePrice);
if(!CollectionUtil.isEmpty(listOld)){
String estNameStr="";
for (EmisQuotePrice item:listOld) {
estNameStr=estNameStr+item.getQuoteName()+",";
}
throw new EmisBizError(EmisBizErrorType.EXISTS,"报价重复["+estNameStr+"]");
}
// 插入主表
emisQuotePriceMapper.insertEmisQuotePrice(emisQuotePrice);
@ -98,8 +111,18 @@ public class EmisQuotePriceServiceImpl implements IEmisQuotePriceService
*/
@Override
@Transactional
public int updateEmisQuotePrice(EmisQuotePrice emisQuotePrice)
{
public int updateEmisQuotePrice(EmisQuotePrice emisQuotePrice) throws EmisBizError {
// 检查是否重复
List<EmisQuotePrice> listOld=emisQuotePriceMapper.checkUnique(emisQuotePrice);
if(!CollectionUtil.isEmpty(listOld)){
String estNameStr="";
for (EmisQuotePrice item:listOld) {
estNameStr=estNameStr+item.getQuoteName()+",";
}
throw new EmisBizError(EmisBizErrorType.EXISTS,"报价重复["+estNameStr+"]");
}
// 更新主表
int ret=emisQuotePriceMapper.updateEmisQuotePrice(emisQuotePrice);
return ret;

View File

@ -269,12 +269,7 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
// return LocalTime.now().isAfter(localTime);
if(emisWaybillOld!=null ) {
if (
"1".equals(emisWaybillOld.getBlBill())
|| ScanType.SIGNED.opCode.equals(emisWaybillOld.getWaybillStatus())
|| isOutTime(emisWaybillOld.getCreateTime())
) {
if (isWaybillLock(emisWaybillOld)) {
throw new EmisBizError(EmisBizErrorType.BILL_LOCK, "已锁账,不允许修改");
}
}

View File

@ -6,10 +6,12 @@
<resultMap type="EmisQuotePrice" id="EmisQuotePriceResult">
<result property="quoteId" column="quote_id" />
<result property="quoteName" column="quote_name" />
<result property="quoteCode" column="quote_code" />
<result property="quoteName" column="quote_name" />
<result property="quoteType" column="quote_type" />
<result property="customerCode" column="customer_code" />
<result property="custNo" column="cust_no" />
<result property="useSiteCode" column="use_site_code" />
<result property="useSite" column="use_site" />
<result property="transLineCode" column="trans_line_code" />
<result property="feeType" column="fee_type" />
<result property="prodCode" column="prod_code" />
@ -19,7 +21,16 @@
<result property="otherType2" column="other_type2" />
<result property="carryType" column="carry_type" />
<result property="status" column="status" />
<result property="dispAreaId" column="disp_area_id" />
<result property="dispAreaName" column="disp_area_name" />
<result property="dispAreaSite" column="disp_area_site" />
<result property="dispAreaSiteCode" column="disp_area_site_code" />
<result property="dispAreaSiteId" column="disp_area_site_id" />
<result property="sendAreaId" column="send_area_id" />
<result property="sendAreaName" column="send_area_name" />
<result property="sendAreaSite" column="send_area_site" />
<result property="sendAreaSiteCode" column="send_area_site_code" />
<result property="sendAreaSiteId" column="send_area_site_id" />
<result property="carriesNumber" column="carries_number" />
<result property="discardsNumber" column="discards_number" />
<result property="leastPrice" column="least_price" />
@ -37,23 +48,10 @@
<result property="createSite" column="create_site" />
<result property="updateSite" column="update_site" />
<result property="prodName" column="prod_name" />
<result property="dispAreaId" column="disp_area_id" />
<result property="dispAreaName" column="disp_area_name" />
<result property="dispAreaSite" column="disp_area_site" />
<result property="dispAreaSiteCode" column="disp_area_site_code" />
<result property="dispAreaSiteId" column="disp_area_site_id" />
<result property="sendAreaId" column="send_area_id" />
<result property="sendAreaName" column="send_area_name" />
<result property="sendAreaSite" column="send_area_site" />
<result property="sendAreaSiteCode" column="send_area_site_code" />
<result property="sendAreaSiteId" column="send_area_site_id" />
<association property="prodName" column="prod_code" select="selectProdNameByCode"/>
<association property="transLine" column="trans_line_code" select="selectLineNameByCode"/>
<association property="useSiteName" column="use_site_code" select="selectSiteNameByCode"/>
<association property="customerName" column="customer_code" select="selectCustomerNameByCode"/>
<association property="exprList" column="quote_id" select="selectExprListByQuoteId"/>
@ -77,12 +75,6 @@
</resultMap>
<sql id="selectEmisQuotePriceVo">
select quote_id, quote_name, quote_code, use_site_code, use_site, trans_line_code, trans_line, fee_type, prod_code, prod_name, rec_pay_type, bill_type, other_type1, other_type2, carry_type, status, disp_area_id, disp_area_name, disp_area_site, disp_area_site_code, disp_area_site_id, send_area_id, send_area_name, send_area_site, send_area_site_code, send_area_site_id, carries_number, discards_number, least_price, price_type, start_date, end_date, priority_level, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_quote_price
</sql>
<select id="selectProdNameByCode" parameterType="String" resultType="string">
select group_concat(a.prod_name) from emis_trans_product a where FIND_IN_SET(a.prod_code, #{code}) limit 1
</select>
@ -95,12 +87,20 @@
select a.site_name from emis_site a where a.site_code = #{code} limit 1
</select>
<select id="selectCustomerNameByCode" parameterType="String" resultType="string">
select a.customer_name from emis_customer_user a where a.customer_code = #{code} limit 1
</select>
<select id="selectExprListByQuoteId" parameterType="integer" resultMap="EmisQuoteExpressionResult">
select id, quote_id, quote_sequence, start_weight, end_weight, initial_weight, additional_weight, condition_expression, calculate_expression, status, remark
from emis_quote_expression a
where a.quote_id = #{quoteId} and a.del_flag!='1'
</select>
<sql id="selectEmisQuotePriceVo">
select quote_id, quote_code, quote_name, quote_type, customer_code, cust_no, use_site_code, trans_line_code, fee_type, prod_code, rec_pay_type, bill_type, other_type1, other_type2, carry_type, status, disp_area_id, disp_area_name, disp_area_site, disp_area_site_code, disp_area_site_id, send_area_id, send_area_name, send_area_site, send_area_site_code, send_area_site_id, carries_number, discards_number, least_price, price_type, start_date, end_date, priority_level, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_quote_price
</sql>
<select id="selectEmisQuotePriceList" parameterType="EmisQuotePrice" resultMap="EmisQuotePriceResult">
<include refid="selectEmisQuotePriceVo"/>
@ -112,10 +112,13 @@
<if test="quoteCode != null and quoteCode != ''"> and quote_code=#{quoteCode}</if>
<if test="useSite != null and useSite != ''"> and use_site=#{useSite}</if>
<if test="transLineCode != null and transLineCode != ''"> and trans_line_code=#{transLineCode}</if>
<if test="transLine != null and transLine != ''"> and trans_line like concat('%', #{transLine}, '%')</if>
<if test="customerCode != null and customerCode != ''"> and customer_code=#{customerCode}</if>
<if test="custNo != null and custNo != ''"> and cust_no=#{custNo}</if>
<if test="feeType != null and feeType != ''"> and fee_type=#{feeType}</if>
<if test="prodCode != null and prodCode != ''"> and FIND_IN_SET(#{prodCode}, prod_code)</if>
<if test="prodName != null and prodName != ''"> and prod_name like concat('%', #{prodName}, '%')</if>
<if test="recPayType != null and recPayType != ''"> and rec_pay_type=#{recPayType}</if>
<if test="billType != null and billType != ''"> and bill_type= #{billType}</if>
<if test="otherType1 != null and otherType1 != ''"> and other_type1=#{otherType1}</if>
@ -202,18 +205,50 @@
where a.quote_id = #{quoteId}
</select>
<select id="checkUnique" parameterType="EmisQuotePrice" resultMap="EmisQuotePriceResult">
<include refid="selectEmisQuotePriceVo"/>
where del_flag='0'
and quote_type = #{quoteType}
<if test="quoteId != null "> and quote_id != #{quoteId}</if>
<if test="customerCode != null and customerCode != ''"> and customer_code=#{customerCode}</if>
<if test="custNo != null and custNo != ''"> and cust_no=#{custNo}</if>
and use_site_code = #{useSiteCode}
and trans_line_code = #{transLineCode}
and prod_code = #{prodCode}
and fee_type = #{feeType}
and rec_pay_type = #{recPayType}
and bill_type = #{billType}
and ( find_in_set(#{dispAreaSiteCode},disp_area_site_code) or disp_area_site_code='-1' )
and ( find_in_set(#{sendAreaSiteCode},send_area_site_code) or send_area_site_code='-1')
and (
( start_date <![CDATA[< ]]> #{startDate} and #{startDate} <![CDATA[<= ]]> end_date ) or ( start_date <![CDATA[< ]]> #{endDate} and #{endDate} <![CDATA[<= ]]> end_date )
)
</select>
<select id="selectEmisQuotePriceByQuoteId" parameterType="Long" resultMap="EmisQuotePriceResult">
select quote_id, quote_code, quote_name, quote_type, customer_code, cust_no, use_site_code, trans_line_code, fee_type, prod_code, rec_pay_type, bill_type, other_type1, other_type2, carry_type, status, disp_area_id, disp_area_name, disp_area_site, disp_area_site_code, disp_area_site_id, send_area_id, send_area_name, send_area_site, send_area_site_code, send_area_site_id, carries_number, discards_number, least_price, price_type, start_date, end_date, priority_level, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
from emis_quote_price a
where a.quote_id = #{quoteId}
</select>
<insert id="insertEmisQuotePrice" parameterType="EmisQuotePrice" useGeneratedKeys="true" keyProperty="quoteId">
insert into emis_quote_price
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="quoteName != null and quoteName != ''">quote_name,</if>
<if test="quoteId != null">quote_id,</if>
<if test="quoteCode != null and quoteCode != ''">quote_code,</if>
<if test="quoteName != null and quoteName != ''">quote_name,</if>
<if test="quoteType != null and quoteType != ''">quote_type,</if>
<if test="customerCode != null and customerCode != ''">customer_code,</if>
<if test="custNo != null and custNo != ''">cust_no,</if>
<if test="useSiteCode != null and useSiteCode != ''">use_site_code,</if>
<if test="useSite != null and useSite != ''">use_site,</if>
<if test="transLineCode != null and transLineCode != ''">trans_line_code,</if>
<if test="transLine != null and transLine != ''">trans_line,</if>
<if test="feeType != null and feeType != ''">fee_type,</if>
<if test="prodCode != null and prodCode != ''">prod_code,</if>
<if test="prodName != null and prodName != ''">prod_name,</if>
<if test="recPayType != null and recPayType != ''">rec_pay_type,</if>
<if test="billType != null and billType != ''">bill_type,</if>
<if test="otherType1 != null and otherType1 != ''">other_type1,</if>
@ -248,15 +283,16 @@
<if test="updateSite != null and updateSite != ''">update_site,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="quoteName != null and quoteName != ''">#{quoteName},</if>
<if test="quoteId != null">#{quoteId},</if>
<if test="quoteCode != null and quoteCode != ''">#{quoteCode},</if>
<if test="quoteName != null and quoteName != ''">#{quoteName},</if>
<if test="quoteType != null and quoteType != ''">#{quoteType},</if>
<if test="customerCode != null and customerCode != ''">#{customerCode},</if>
<if test="custNo != null and custNo != ''">#{custNo},</if>
<if test="useSiteCode != null and useSiteCode != ''">#{useSiteCode},</if>
<if test="useSite != null and useSite != ''">#{useSite},</if>
<if test="transLineCode != null and transLineCode != ''">#{transLineCode},</if>
<if test="transLine != null and transLine != ''">#{transLine},</if>
<if test="feeType != null and feeType != ''">#{feeType},</if>
<if test="prodCode != null and prodCode != ''">#{prodCode},</if>
<if test="prodName != null and prodName != ''">#{prodName},</if>
<if test="recPayType != null and recPayType != ''">#{recPayType},</if>
<if test="billType != null and billType != ''">#{billType},</if>
<if test="otherType1 != null and otherType1 != ''">#{otherType1},</if>
@ -295,15 +331,15 @@
<update id="updateEmisQuotePrice" parameterType="EmisQuotePrice">
update emis_quote_price
<trim prefix="SET" suffixOverrides=",">
<if test="quoteName != null and quoteName != ''">quote_name = #{quoteName},</if>
<if test="quoteCode != null and quoteCode != ''">quote_code = #{quoteCode},</if>
<if test="quoteName != null and quoteName != ''">quote_name = #{quoteName},</if>
<if test="quoteType != null and quoteType != ''">quote_type = #{quoteType},</if>
<if test="customerCode != null and customerCode != ''">customer_code = #{customerCode},</if>
<if test="custNo != null and custNo != ''">cust_no = #{custNo},</if>
<if test="useSiteCode != null and useSiteCode != ''">use_site_code = #{useSiteCode},</if>
<if test="useSite != null and useSite != ''">use_site = #{useSite},</if>
<if test="transLineCode != null and transLineCode != ''">trans_line_code = #{transLineCode},</if>
<if test="transLine != null and transLine != ''">trans_line = #{transLine},</if>
<if test="feeType != null and feeType != ''">fee_type = #{feeType},</if>
<if test="prodCode != null and prodCode != ''">prod_code = #{prodCode},</if>
<if test="prodName != null and prodName != ''">prod_name = #{prodName},</if>
<if test="recPayType != null and recPayType != ''">rec_pay_type = #{recPayType},</if>
<if test="billType != null and billType != ''">bill_type = #{billType},</if>
<if test="otherType1 != null and otherType1 != ''">other_type1 = #{otherType1},</if>