This commit is contained in:
linfso 2024-05-11 18:57:59 +08:00
parent 6d93e14b5e
commit c53ef17ae6
5 changed files with 87 additions and 31 deletions

View File

@ -1,10 +1,10 @@
/**
/**
* @Project: emis
* @Title: EmisBrand.java
* @author linfso
* @date 2023-12-14 13:02:47
* @date 2024-05-11 10:57:00
* @Copyright: ShangHai Duta 2022 All rights reserved.
* @version v1.0
* @version v1.0
* @Description: <p> 品牌 实体类 </p>
*/
@ -17,6 +17,7 @@ import com.xdadan.erp.common.annotation.Excel;
import com.xdadan.erp.common.core.domain.BaseEntity;
import com.xdadan.erp.common.core.domain.TreeEntity;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import lombok.Data;
@ -25,9 +26,9 @@ import lombok.Data;
* @ClassName EmisBrand
* @Description 品牌
* @author linfso
* @date 2023-12-14 13:02:47
* @date 2024-05-11 10:57:00
*/
@Data
@Data
public class EmisBrand extends BaseEntity
{
private static final long serialVersionUID = 1L;
@ -44,11 +45,11 @@ public class EmisBrand extends BaseEntity
private String logo;
/* url */
private String url;
/* 排序 */
private Integer sortOrder;
/* 0-未开放 1-开放 */
private Integer status;
/* 品牌图片(多图;号隔开) */
private String brandImg;
/* order_num */
private Integer orderNum;
}

View File

@ -0,0 +1,19 @@
package com.xdadan.erp.emis.domain.enumtype;
public enum TransType {
EXPRESS_TRANS("1","快递"),
AIR_TRANS("2","空运"),
LAND_TRANS("3","陆运"),
SEA_TRANS("4","海运"),
TRAIN_TRANS("5","铁路");
public String typeCode;
public String typeName;
TransType(String typeCode, String typeName) {
this.typeCode = typeCode;
this.typeName = typeName;
}
}

View File

@ -24,6 +24,7 @@ import com.googlecode.aviator.AviatorEvaluator;
import com.xdadan.erp.common.utils.DateUtils;
import com.xdadan.erp.common.utils.DictUtils;
import com.xdadan.erp.emis.domain.*;
import com.xdadan.erp.emis.domain.enumtype.TransType;
import com.xdadan.erp.emis.domain.exception.EmisBizError;
import com.xdadan.erp.emis.domain.enumtype.EmisBizErrorType;
import com.xdadan.erp.emis.domain.vo.*;
@ -629,9 +630,20 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
double volumeWeight=0.0D;
if(!StringUtils.isEmpty(emisTransLine.getMeterRate())) {
volumeWeight=totalVolume * (1000000 / Double.valueOf(emisTransLine.getMeterRate()));
DecimalFormat df = new DecimalFormat("#.#####");
volumeWeight= Double.parseDouble(df.format(volumeWeight));
// 特殊计泡处理
// 6000 167
// 3333 300
if("6000".equals(emisTransLine.getMeterRate())){
volumeWeight=167.0f*totalVolume;
}else if("3333".equals(emisTransLine.getMeterRate())){
volumeWeight=300.0f*totalVolume;
}else{
volumeWeight=totalVolume * (1000000 / Double.valueOf(emisTransLine.getMeterRate()));
DecimalFormat df = new DecimalFormat("#.#####");
volumeWeight= Double.parseDouble(df.format(volumeWeight));
}
}
emisWaybill.setVolumeWeight(BigDecimal.valueOf(volumeWeight));
emisWaybill.setMeterType(emisTransLine.getMeterRate());

View File

@ -79,7 +79,12 @@ public class WaybillHelper {
// 1 小数进1 ,抹零+1
else if("3".equals(carryType)){
setteldWeight=Math.ceil(weight);
}else{
}
// 抹零 取整
else if("4".equals(carryType)){
setteldWeight=Math.floor(weight);
}
else{
setteldWeight=weight;
}
@ -184,19 +189,27 @@ public class WaybillHelper {
// System.out.println(d);
try {
//
// long startAll = System.currentTimeMillis();
//
// for(int i=0;i<100;i++) {
// long start = System.currentTimeMillis();
// JSONObject rst = WaybillHelper.parseChinaAddress("13818415183 孙丹 广西壮族自治区南宁市西乡塘区衡阳街道广西省南宁市衡阳西路34号大院"+i);
// System.out.println(rst);
// long end4 = System.currentTimeMillis();
// System.out.println("escape time single:" + (end4 - start) + "ms");
// }
// long endAll = System.currentTimeMillis();
long startAll = System.currentTimeMillis();
// System.out.println("All escape time:" + (endAll - startAll) + "ms");
for(int i=0;i<100;i++) {
long start = System.currentTimeMillis();
JSONObject rst = WaybillHelper.parseChinaAddress("13818415183 孙丹 广西壮族自治区南宁市西乡塘区衡阳街道广西省南宁市衡阳西路34号大院"+i);
System.out.println(rst);
long end4 = System.currentTimeMillis();
System.out.println("escape time single:" + (end4 - start) + "ms");
}
long endAll = System.currentTimeMillis();
// 6000 167
// 3333 300
// 5000 0.1
float volumeWeight=166.667f;
System.out.println(WaybillHelper.calcSettledWeight(volumeWeight,"3"));
System.out.println(WaybillHelper.calcSettledWeight(volumeWeight,"4"));
System.out.println("All escape time:" + (endAll - startAll) + "ms");
} catch (Exception e) {
e.printStackTrace();

View File

@ -4,6 +4,7 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xdadan.erp.emis.mapper.EmisBrandMapper">
<resultMap type="EmisBrand" id="EmisBrandResult">
<result property="id" column="id" />
<result property="code" column="code" />
@ -11,9 +12,9 @@
<result property="nameEn" column="name_en" />
<result property="logo" column="logo" />
<result property="url" column="url" />
<result property="sortOrder" column="sort_order" />
<result property="status" column="status" />
<result property="brandImg" column="brand_img" />
<result property="orderNum" column="order_num" />
<result property="remark" column="remark" />
<result property="tenantId" column="tenant_id" />
<result property="delFlag" column="del_flag" />
@ -21,24 +22,26 @@
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="createSite" column="create_site" />
<result property="updateSite" column="update_site" />
</resultMap>
<sql id="selectEmisBrandVo">
select id, code, name, name_en, logo, url, sort_order, status, brand_img, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time from emis_brand
select id, code, name, name_en, logo, url, status, brand_img, order_num, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_brand
</sql>
<select id="selectEmisBrandList" parameterType="EmisBrand" resultMap="EmisBrandResult">
<include refid="selectEmisBrandVo"/>
<where>
<if test="id != null "> and id = #{id}</if>
<if test="code != null and code != ''"> and code=#{code}</if>
<if test="code != null and code != ''"> and code like concat('%', #{code}, '%')</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="nameEn != null and nameEn != ''"> and name_en like concat('%', #{nameEn}, '%')</if>
<if test="logo != null and logo != ''"> and logo like concat('%', #{logo}, '%')</if>
<if test="url != null and url != ''"> and url like concat('%', #{url}, '%')</if>
<if test="sortOrder != null "> and sort_order = #{sortOrder}</if>
<if test="status != null "> and status = #{status}</if>
<if test="brandImg != null and brandImg != ''"> and brand_img like concat('%', #{brandImg}, '%')</if>
<if test="orderNum != null "> and order_num = #{orderNum}</if>
<if test="remark != null and remark != ''"> and remark like concat('%', #{remark}, '%')</if>
<if test="tenantId != null and tenantId != ''"> and tenant_id like concat('%', #{tenantId}, '%')</if>
<if test="delFlag != null and delFlag != ''"> and del_flag like concat('%', #{delFlag}, '%')</if>
@ -46,12 +49,14 @@
<if test="createTime != null "> and create_time = #{createTime}</if>
<if test="updateBy != null and updateBy != ''"> and update_by like concat('%', #{updateBy}, '%')</if>
<if test="updateTime != null "> and update_time = #{updateTime}</if>
<if test="createSite != null and createSite != ''"> and create_site like concat('%', #{createSite}, '%')</if>
<if test="updateSite != null and updateSite != ''"> and update_site like concat('%', #{updateSite}, '%')</if>
</where>
order by create_time desc
</select>
<select id="selectEmisBrandById" parameterType="Long" resultMap="EmisBrandResult">
select id, code, name, name_en, logo, url, sort_order, status, brand_img, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time
select id, code, name, name_en, logo, url, status, brand_img, order_num, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
from emis_brand a
where a.id = #{id}
</select>
@ -65,9 +70,9 @@
<if test="nameEn != null and nameEn != ''">name_en,</if>
<if test="logo != null and logo != ''">logo,</if>
<if test="url != null and url != ''">url,</if>
<if test="sortOrder != null">sort_order,</if>
<if test="status != null">status,</if>
<if test="brandImg != null and brandImg != ''">brand_img,</if>
<if test="orderNum != null">order_num,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="tenantId != null and tenantId != ''">tenant_id,</if>
<if test="delFlag != null and delFlag != ''">del_flag,</if>
@ -75,6 +80,8 @@
<if test="createTime != null">create_time,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="createSite != null and createSite != ''">create_site,</if>
<if test="updateSite != null and updateSite != ''">update_site,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
@ -83,9 +90,9 @@
<if test="nameEn != null and nameEn != ''">#{nameEn},</if>
<if test="logo != null and logo != ''">#{logo},</if>
<if test="url != null and url != ''">#{url},</if>
<if test="sortOrder != null">#{sortOrder},</if>
<if test="status != null">#{status},</if>
<if test="brandImg != null and brandImg != ''">#{brandImg},</if>
<if test="orderNum != null">#{orderNum},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="tenantId != null and tenantId != ''">#{tenantId},</if>
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
@ -93,6 +100,8 @@
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="createSite != null and createSite != ''">#{createSite},</if>
<if test="updateSite != null and updateSite != ''">#{updateSite},</if>
</trim>
</insert>
@ -104,9 +113,9 @@
<if test="nameEn != null and nameEn != ''">name_en = #{nameEn},</if>
<if test="logo != null and logo != ''">logo = #{logo},</if>
<if test="url != null and url != ''">url = #{url},</if>
<if test="sortOrder != null">sort_order = #{sortOrder},</if>
<if test="status != null">status = #{status},</if>
<if test="brandImg != null and brandImg != ''">brand_img = #{brandImg},</if>
<if test="orderNum != null">order_num = #{orderNum},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="tenantId != null and tenantId != ''">tenant_id = #{tenantId},</if>
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
@ -114,16 +123,18 @@
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="createSite != null and createSite != ''">create_site = #{createSite},</if>
<if test="updateSite != null and updateSite != ''">update_site = #{updateSite},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteEmisBrandById" parameterType="Long">
delete from emis_brand where id = #{id}
update emis_brand set del_flag='1' where id = #{id}
</delete>
<delete id="deleteEmisBrandByIds" parameterType="String">
delete from emis_brand where id in
update emis_brand set del_flag='1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>