Commit 50664c26 authored by 谢希宇's avatar 谢希宇

Aidea product update by Strive Date 2020-10-14

parent 1ac2b19d
...@@ -3,27 +3,27 @@ ...@@ -3,27 +3,27 @@
<mapper namespace="com.cftech.orderdetail.dao.OrderDetailsMapper"> <mapper namespace="com.cftech.orderdetail.dao.OrderDetailsMapper">
<resultMap id="resultMap" type="com.cftech.orderdetail.model.OrderDetails"> <resultMap id="resultMap" type="com.cftech.orderdetail.model.OrderDetails">
<id column="id" property="id"/> <id column="id" property="id"/>
<result column="order_id" property="orderId"/> <result column="order_id" property="orderId"/>
<result column="order_code" property="orderCode"/> <result column="order_code" property="orderCode"/>
<result column="drugs_id" property="drugsId"/> <result column="drugs_id" property="drugsId"/>
<result column="drugs_num" property="drugsNum"/> <result column="drugs_num" property="drugsNum"/>
<result column="openid" property="openid"/> <result column="openid" property="openid"/>
<result column="price" property="price"/> <result column="price" property="price"/>
<result column="amount" property="amount"/> <result column="amount" property="amount"/>
<result column="drugs_code" property="drugsCode"/> <result column="drugs_code" property="drugsCode"/>
<result column="drugs_sku" property="drugsSku"/> <result column="drugs_sku" property="drugsSku"/>
<result column="drugs_materiel" property="drugsMateriel"/> <result column="drugs_materiel" property="drugsMateriel"/>
<result column="accounts_id" property="accountsId"/> <result column="accounts_id" property="accountsId"/>
<result column="del_flag" property="delFlag"/> <result column="del_flag" property="delFlag"/>
<result column="status" property="status"/> <result column="status" property="status"/>
<result column="create_time" property="createTime"/> <result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/> <result column="update_time" property="updateTime"/>
<result column="description" property="description"/> <result column="description" property="description"/>
<result column="create_by" property="createBy"/> <result column="create_by" property="createBy"/>
<result column="update_by" property="updateBy"/> <result column="update_by" property="updateBy"/>
<result column="product_name" property="productName"/> <result column="drugs_name" property="drugsName"/>
</resultMap> </resultMap>
<sql id="sqlWhere"> <sql id="sqlWhere">
<if test="conds!=null"> <if test="conds!=null">
...@@ -72,10 +72,10 @@ ...@@ -72,10 +72,10 @@
d.description, d.description,
d.create_by, d.create_by,
d.update_by, d.update_by,
p.product_name p.drugs_name
</sql> </sql>
<insert id="save" parameterType="com.cftech.orderdetail.model.OrderDetails" useGeneratedKeys="true" <insert id="save" parameterType="com.cftech.orderdetail.model.OrderDetails" useGeneratedKeys="true"
keyProperty="id"> keyProperty="id">
insert into t_order insert into t_order
...@@ -84,111 +84,115 @@ ...@@ -84,111 +84,115 @@
) )
values values
( (
#{id, jdbcType=BIGINT}, #{id, jdbcType=BIGINT},
#{orderId, jdbcType=BIGINT}, #{orderId, jdbcType=BIGINT},
#{orderCode, jdbcType=VARCHAR}, #{orderCode, jdbcType=VARCHAR},
#{drugsId, jdbcType=BIGINT}, #{drugsId, jdbcType=BIGINT},
#{drugsNum, jdbcType=BIGINT}, #{drugsNum, jdbcType=BIGINT},
#{openid, jdbcType=VARCHAR}, #{openid, jdbcType=VARCHAR},
#{price, jdbcType=CHAR}, #{price, jdbcType=CHAR},
#{amount, jdbcType=CHAR}, #{amount, jdbcType=CHAR},
#{drugsCode, jdbcType=CHAR}, #{drugsCode, jdbcType=CHAR},
#{drugsSku, jdbcType=VARCHAR}, #{drugsSku, jdbcType=VARCHAR},
#{drugsMateriel, jdbcType=VARCHAR}, #{drugsMateriel, jdbcType=VARCHAR},
#{accountsId, jdbcType=BIGINT}, #{accountsId, jdbcType=BIGINT},
#{delFlag, jdbcType=TINYINT}, #{delFlag, jdbcType=TINYINT},
#{status, jdbcType=VARCHAR}, #{status, jdbcType=VARCHAR},
now(), now(),
now(), now(),
#{description, jdbcType=VARCHAR}, #{description, jdbcType=VARCHAR},
#{createBy, jdbcType=BIGINT}, #{createBy, jdbcType=BIGINT},
#{updateBy, jdbcType=BIGINT} #{updateBy, jdbcType=BIGINT},
) #{drugsName, jdbcType=VARCHAR}
)
</insert> </insert>
<select id="fetchById" parameterType="java.lang.Long" resultMap="resultMap"> <select id="fetchById" parameterType="java.lang.Long" resultMap="resultMap">
SELECT SELECT
<include refid="sqlColumns"/> <include refid="sqlColumns"/>
FROM t_order_details d FROM t_order_details d
LEFT JOIN t_aidea_product p ON p.id = d.drugs_id LEFT JOIN t_aidea_product p ON p.id = d.drugs_id
WHERE d.id=#{id} WHERE d.id=#{id}
</select> </select>
<select id="count" parameterType="java.util.Map" resultType="java.lang.Integer"> <select id="count" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT COUNT(1) FROM t_order_details d SELECT COUNT(1) FROM t_order_details d
LEFT JOIN t_aidea_product p ON p.id = d.drugs_id LEFT JOIN t_aidea_product p ON p.id = d.drugs_id
<include refid="sqlWhere"/> <include refid="sqlWhere"/>
</select> </select>
<select id="fetchSearchByPage" parameterType="java.util.Map" resultMap="resultMap"> <select id="fetchSearchByPage" parameterType="java.util.Map" resultMap="resultMap">
SELECT SELECT
<include refid="sqlColumns"/> <include refid="sqlColumns"/>
FROM t_order_details d FROM t_order_details d
LEFT JOIN t_aidea_product p ON p.id = d.drugs_id LEFT JOIN t_aidea_product p ON p.id = d.drugs_id
<include refid="sqlWhere"/> <include refid="sqlWhere"/>
<if test="sort!=null">ORDER BY ${sort.param} ${sort.type}</if> <if test="sort!=null">ORDER BY ${sort.param} ${sort.type}</if>
<if test="limit>0">limit #{offset},#{limit}</if> <if test="limit>0">limit #{offset},#{limit}</if>
</select> </select>
<update id="update" parameterType="com.cftech.orderdetail.model.OrderDetails"> <update id="update" parameterType="com.cftech.orderdetail.model.OrderDetails">
update t_order update t_order
<set> <set>
<if test="id != null"> <if test="id != null">
id = #{id, jdbcType=BIGINT}, id = #{id, jdbcType=BIGINT},
</if> </if>
<if test="orderId != null"> <if test="orderId != null">
order_id = #{orderId, jdbcType=BIGINT}, order_id = #{orderId, jdbcType=BIGINT},
</if> </if>
<if test="orderCode != null"> <if test="orderCode != null">
order_code = #{orderCode, jdbcType=VARCHAR}, order_code = #{orderCode, jdbcType=VARCHAR},
</if> </if>
<if test="drugsId != null"> <if test="drugsId != null">
drugs_id = #{drugsId, jdbcType=BIGINT}, drugs_id = #{drugsId, jdbcType=BIGINT},
</if> </if>
<if test="drugsNum != null"> <if test="drugsNum != null">
drugs_num = #{drugsNum, jdbcType=BIGINT}, drugs_num = #{drugsNum, jdbcType=BIGINT},
</if> </if>
<if test="openid != null"> <if test="openid != null">
openid = #{openid, jdbcType=VARCHAR}, openid = #{openid, jdbcType=VARCHAR},
</if> </if>
<if test="price != null"> <if test="price != null">
price = #{price, jdbcType=CHAR}, price = #{price, jdbcType=CHAR},
</if> </if>
<if test="amount != null"> <if test="amount != null">
amount = #{amount, jdbcType=CHAR}, amount = #{amount, jdbcType=CHAR},
</if> </if>
<if test="drugsCode != null"> <if test="drugsCode != null">
drugs_code = #{drugsCode, jdbcType=CHAR}, drugs_code = #{drugsCode, jdbcType=CHAR},
</if> </if>
<if test="drugsSku != null"> <if test="drugsSku != null">
drugs_sku = #{drugsSku, jdbcType=VARCHAR}, drugs_sku = #{drugsSku, jdbcType=VARCHAR},
</if> </if>
<if test="drugsMateriel != null"> <if test="drugsMateriel != null">
drugs_materiel = #{drugsMateriel, jdbcType=VARCHAR}, drugs_materiel = #{drugsMateriel, jdbcType=VARCHAR},
</if> </if>
<if test="accountsId != null"> <if test="accountsId != null">
accounts_id = #{accountsId, jdbcType=BIGINT}, accounts_id = #{accountsId, jdbcType=BIGINT},
</if> </if>
<if test="delFlag != null"> <if test="delFlag != null">
del_flag = #{delFlag, jdbcType=TINYINT}, del_flag = #{delFlag, jdbcType=TINYINT},
</if> </if>
<if test="status != null"> <if test="status != null">
status = #{status, jdbcType=VARCHAR}, status = #{status, jdbcType=VARCHAR},
</if> </if>
<if test="createTime != null"> <if test="createTime != null">
create_time = #{createTime, jdbcType=TIMESTAMP}, create_time = #{createTime, jdbcType=TIMESTAMP},
</if> </if>
<if test="description != null"> <if test="description != null">
description = #{description, jdbcType=VARCHAR}, description = #{description, jdbcType=VARCHAR},
</if> </if>
<if test="createBy != null"> <if test="createBy != null">
create_by = #{createBy, jdbcType=BIGINT}, create_by = #{createBy, jdbcType=BIGINT},
</if> </if>
<if test="updateBy != null"> <if test="updateBy != null">
update_by = #{updateBy, jdbcType=BIGINT}, update_by = #{updateBy, jdbcType=BIGINT},
</if> </if>
</set> <if test="drugsName != null">
drugs_name = #{drugsName, jdbcType=VARCHAR},
</if>
</set>
where id=#{id,jdbcType=BIGINT} where id=#{id,jdbcType=BIGINT}
</update> </update>
......
...@@ -8,69 +8,70 @@ import java.io.Serializable; ...@@ -8,69 +8,70 @@ import java.io.Serializable;
import java.util.Date; import java.util.Date;
/** /**
* 订单管理 * 订单管理
* *
* @author Licc * @author Licc
* @date: 2020-10-16 11:26 * @date: 2020-10-16 11:26
*/ */
@Data @Data
public class OrderDetails implements Serializable { public class OrderDetails implements Serializable {
/* 主键id */ /* 主键id */
private Long id; private Long id;
/* 订单id */ /* 订单id */
@ExportConfig(value = "订单id", width = 100, showLevel = 1) @ExportConfig(value = "订单id", width = 100, showLevel = 1)
private Long orderId; private Long orderId;
/* 订单编码 */ /* 订单编码 */
@ExportConfig(value = "订单编码", width = 100, showLevel = 1) @ExportConfig(value = "订单编码", width = 100, showLevel = 1)
private String orderCode; private String orderCode;
/* 商品id */ /* 商品id */
@ExportConfig(value = "商品id", width = 100, showLevel = 1) @ExportConfig(value = "商品id", width = 100, showLevel = 1)
private Long drugsId; private Long drugsId;
/* 商品数量 */ /* 商品名称 */
@ExportConfig(value = "商品数量", width = 100, showLevel = 1) @ExportConfig(value = "商品名称", width = 100, showLevel = 1)
private String drugsName;
/* 商品数量 */
@ExportConfig(value = "商品数量", width = 100, showLevel = 1)
private Long drugsNum; private Long drugsNum;
/* 用户所属公众号id */ /* 用户所属公众号id */
@ExportConfig(value = "用户所属公众号id", width = 100, showLevel = 1) @ExportConfig(value = "用户所属公众号id", width = 100, showLevel = 1)
private String openid; private String openid;
/* 商品价格 */ /* 商品价格 */
@ExportConfig(value = "商品价格", width = 100, showLevel = 1) @ExportConfig(value = "商品价格", width = 100, showLevel = 1)
private Double price; private Double price;
/* 商品总价 */ /* 商品总价 */
@ExportConfig(value = "商品总价", width = 100, showLevel = 1) @ExportConfig(value = "商品总价", width = 100, showLevel = 1)
private Double amount; private Double amount;
/* 商品编码 */ /* 商品编码 */
@ExportConfig(value = "商品编码", width = 100, showLevel = 1) @ExportConfig(value = "商品编码", width = 100, showLevel = 1)
private String drugsCode; private String drugsCode;
/* 商品sku(规格) */ /* 商品sku(规格) */
@ExportConfig(value = "商品sku(规格)", width = 100, showLevel = 1) @ExportConfig(value = "商品sku(规格)", width = 100, showLevel = 1)
private String drugsSku; private String drugsSku;
/* 对应erp物料号 */ /* 对应erp物料号 */
@ExportConfig(value = "对应erp物料号", width = 100, showLevel = 1) @ExportConfig(value = "对应erp物料号", width = 100, showLevel = 1)
private String drugsMateriel; private String drugsMateriel;
/* 所属的账号 */ /* 所属的账号 */
private Long accountsId; private Long accountsId;
/* 删除标识 */ /* 删除标识 */
private boolean delFlag; private boolean delFlag;
/* 状态 */ /* 状态 */
private String status; private String status;
/* 创建时间 */ /* 创建时间 */
@JSONField(format="yyyy-MM-dd HH:mm:ss") @JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date createTime; private Date createTime;
/* 更新时间 */ /* 更新时间 */
private Date updateTime; private Date updateTime;
/* 备注 */ /* 备注 */
private String description; private String description;
/* 创建人 */ /* 创建人 */
private Long createBy; private Long createBy;
/* 更新人 */ /* 更新人 */
private Long updateBy; private Long updateBy;
private String productName; public OrderDetails() {
this.delFlag = false;
public OrderDetails() { this.status = "0";
this.delFlag = false;
this.status = "0";
} }
} }
\ No newline at end of file
...@@ -11,5 +11,11 @@ ...@@ -11,5 +11,11 @@
<artifactId>order-module</artifactId> <artifactId>order-module</artifactId>
<dependencies>
<dependency>
<groupId>com.cftech</groupId>
<artifactId>order-detail-module</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project> </project>
\ No newline at end of file
...@@ -11,82 +11,82 @@ import java.util.List; ...@@ -11,82 +11,82 @@ import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
* 订单管理 * 订单管理
* *
* @author Licc * @author Licc
* @date: 2020-10-10 14:20 * @date: 2020-10-10 14:20
*/ */
public class Order extends OrderDetail implements Serializable { public class Order extends OrderDetail implements Serializable {
/* 主键id */ /* 主键id */
private Long id; private Long id;
/* 订单编码 */ /* 订单编码 */
@ExportConfig(value = "订单编码", width = 100, showLevel = 1) @ExportConfig(value = "订单编码", width = 100, showLevel = 1)
private String orderCode; private String orderCode;
/* 咨询单id */ /* 咨询单id */
@ExportConfig(value = "咨询单id", width = 100, showLevel = 1) @ExportConfig(value = "咨询单id", width = 100, showLevel = 1)
private Long consultId; private Long consultId;
/* 咨询单编码 */ /* 咨询单编码 */
@ExportConfig(value = "咨询单编码", width = 100, showLevel = 1) @ExportConfig(value = "咨询单编码", width = 100, showLevel = 1)
private String number; private String number;
/* 所属会员id */ /* 所属会员id */
@ExportConfig(value = "所属会员id", width = 100, showLevel = 1) @ExportConfig(value = "所属会员id", width = 100, showLevel = 1)
private Long memberId; private Long memberId;
/* 客服id */ /* 客服id */
@ExportConfig(value = "客服id", width = 100, showLevel = 1) @ExportConfig(value = "客服id", width = 100, showLevel = 1)
private Long serviceId; private Long serviceId;
/* 医生id */ /* 医生id */
@ExportConfig(value = "医生id", width = 100, showLevel = 1) @ExportConfig(value = "医生id", width = 100, showLevel = 1)
private Long doctorId; private Long doctorId;
/* 用户所属公众号id */ /* 用户所属公众号id */
@ExportConfig(value = "用户所属公众号id", width = 100, showLevel = 1) @ExportConfig(value = "用户所属公众号id", width = 100, showLevel = 1)
private String openid; private String openid;
/* 付款状态 0未付款 1已付款 */ /* 付款状态 0未付款 1已付款 */
@ExportConfig(value = "付款状态 0未付款 1已付款", width = 100, showLevel = 1) @ExportConfig(value = "付款状态 0未付款 1已付款", width = 100, showLevel = 1)
private Long payStatus; private Long payStatus;
/* 付款金额 */ /* 付款金额 */
@ExportConfig(value = "付款金额", width = 100, showLevel = 1) @ExportConfig(value = "付款金额", width = 100, showLevel = 1)
private Double payAmount; private Double payAmount;
/* 订单金额 */ /* 订单金额 */
@ExportConfig(value = "订单金额", width = 100, showLevel = 1) @ExportConfig(value = "订单金额", width = 100, showLevel = 1)
private Double orderAmount; private Double orderAmount;
/* 商品最终金额 */ /* 商品最终金额 */
@ExportConfig(value = "商品最终金额", width = 100, showLevel = 1) @ExportConfig(value = "商品最终金额", width = 100, showLevel = 1)
private Double totalAmount; private Double totalAmount;
/* 付款时间 */ /* 付款时间 */
@ExportConfig(value = "付款时间", width = 100, showLevel = 1) @ExportConfig(value = "付款时间", width = 100, showLevel = 1)
private Date payTime; private Date payTime;
/* 交易号 支付宝/第三方平台 返回订单号 */ /* 交易号 支付宝/第三方平台 返回订单号 */
@ExportConfig(value = "交易号 支付宝/第三方平台 返回订单号", width = 100, showLevel = 1) @ExportConfig(value = "交易号 支付宝/第三方平台 返回订单号", width = 100, showLevel = 1)
private String tradeNo; private String tradeNo;
/* 卖家备注 */ /* 卖家备注 */
@ExportConfig(value = "卖家备注", width = 100, showLevel = 1) @ExportConfig(value = "卖家备注", width = 100, showLevel = 1)
private String remarks; private String remarks;
/* 订单取消原因 */ /* 订单取消原因 */
@ExportConfig(value = "订单取消原因", width = 100, showLevel = 1) @ExportConfig(value = "订单取消原因", width = 100, showLevel = 1)
private String orderCancel; private String orderCancel;
/* 所属的账号 */ /* 所属的账号 */
private Long accountsId; private Long accountsId;
/* 删除标识 */ /* 删除标识 */
private boolean delFlag; private boolean delFlag;
/* 状态 */ /* 状态 */
private String status; private String status;
/* 创建时间 */ /* 创建时间 */
@JSONField(format="yyyy-MM-dd HH:mm:ss") @JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date createTime; private Date createTime;
/* 更新时间 */ /* 更新时间 */
private Date updateTime; private Date updateTime;
/* 备注 */ /* 备注 */
private String description; private String description;
/* 创建人 */ /* 创建人 */
private Long createBy; private Long createBy;
/* 更新人 */ /* 更新人 */
private Long updateBy; private Long updateBy;
private Long confirm; private Long confirm;
private String courierNumber; private String courierNumber;
/* 产品编码 */ /* 产品编码 */
private String productNumber; private String productNumber;
...@@ -98,9 +98,10 @@ private String courierNumber; ...@@ -98,9 +98,10 @@ private String courierNumber;
private Long productId; private Long productId;
private List<ProductVO> list; private List<ProductVO> list;
public Order() {
this.delFlag = false; public Order() {
this.status = "0"; this.delFlag = false;
this.status = "0";
} }
@Override @Override
...@@ -342,11 +343,11 @@ public Order() { ...@@ -342,11 +343,11 @@ public Order() {
} }
public String getProductName() { public String getProductName() {
if (list==null) { if (list == null) {
return null; return null;
} }
List<String> collect = this.list.stream().map(x -> x.getProductName()).collect(Collectors.toList()); List<String> collect = this.list.stream().map(x -> x.getProductName()).collect(Collectors.toList());
return StringUtils.join(collect,";"); return StringUtils.join(collect, ";");
} }
public void setProductName(String productName) { public void setProductName(String productName) {
......
...@@ -7,66 +7,69 @@ import java.io.Serializable; ...@@ -7,66 +7,69 @@ import java.io.Serializable;
import java.util.Date; import java.util.Date;
/** /**
* 订单管理 * 订单管理
* *
* @author Licc * @author Licc
* @date: 2020-10-10 15:37 * @date: 2020-10-10 15:37
*/ */
@Data @Data
public class OrderDetail implements Serializable { public class OrderDetail implements Serializable {
/* 主键id */ /* 主键id */
private Long id; private Long id;
/* 订单id */ /* 订单id */
@ExportConfig(value = "订单id", width = 100, showLevel = 1) @ExportConfig(value = "订单id", width = 100, showLevel = 1)
private Long orderId; private Long orderId;
/* 订单编码 */ /* 订单编码 */
@ExportConfig(value = "订单编码", width = 100, showLevel = 1) @ExportConfig(value = "订单编码", width = 100, showLevel = 1)
private String orderCode; private String orderCode;
/* 商品id */ /* 商品id */
@ExportConfig(value = "商品id", width = 100, showLevel = 1) @ExportConfig(value = "商品id", width = 100, showLevel = 1)
private Long drugsId; private Long drugsId;
/* 商品数量 */ /* 商品数量 */
@ExportConfig(value = "商品数量", width = 100, showLevel = 1) @ExportConfig(value = "商品名称", width = 100, showLevel = 1)
private String drugsName;
/* 商品数量 */
@ExportConfig(value = "商品数量", width = 100, showLevel = 1)
private Long drugsNum; private Long drugsNum;
/* 用户所属公众号id */ /* 用户所属公众号id */
@ExportConfig(value = "用户所属公众号id", width = 100, showLevel = 1) @ExportConfig(value = "用户所属公众号id", width = 100, showLevel = 1)
private String openid; private String openid;
/* 商品价格 */ /* 商品价格 */
@ExportConfig(value = "商品价格", width = 100, showLevel = 1) @ExportConfig(value = "商品价格", width = 100, showLevel = 1)
private Double price; private Double price;
/* 商品总价 */ /* 商品总价 */
@ExportConfig(value = "商品总价", width = 100, showLevel = 1) @ExportConfig(value = "商品实际价格", width = 100, showLevel = 1)
private Double amount; private Double amount;
/* 商品编码 */ /* 商品编码 */
@ExportConfig(value = "商品编码", width = 100, showLevel = 1) @ExportConfig(value = "商品编码", width = 100, showLevel = 1)
private String drugsCode; private String drugsCode;
/* 商品sku(规格) */ /* 商品sku(规格) */
@ExportConfig(value = "商品sku(规格)", width = 100, showLevel = 1) @ExportConfig(value = "商品sku(规格)", width = 100, showLevel = 1)
private String drugsSku; private String drugsSku;
/* 对应erp物料号 */ /* 对应erp物料号 */
@ExportConfig(value = "对应erp物料号", width = 100, showLevel = 1) @ExportConfig(value = "对应erp物料号", width = 100, showLevel = 1)
private String drugsMateriel; private String drugsMateriel;
/* 所属的账号 */ /* 所属的账号 */
private Long accountsId; private Long accountsId;
/* 删除标识 */ /* 删除标识 */
private boolean delFlag; private boolean delFlag;
/* 状态 */ /* 状态 */
private String status; private String status;
/* 创建时间 */ /* 创建时间 */
private Date createTime; private Date createTime;
/* 更新时间 */ /* 更新时间 */
private Date updateTime; private Date updateTime;
/* 备注 */ /* 备注 */
private String description; private String description;
/* 创建人 */ /* 创建人 */
private Long createBy; private Long createBy;
/* 更新人 */ /* 更新人 */
private Long updateBy; private Long updateBy;
public OrderDetail() { public OrderDetail() {
this.delFlag = false; this.delFlag = false;
this.status = "0"; this.status = "0";
} }
} }
\ No newline at end of file
...@@ -54,7 +54,7 @@ public class OrderController { ...@@ -54,7 +54,7 @@ public class OrderController {
public static final String ORDER_VIEW = "qy:order:view"; public static final String ORDER_VIEW = "qy:order:view";
public static final String ORDER_EDIT = "qy:order:edit"; public static final String ORDER_EDIT = "qy:order:edit";
public static final DoubleJSONFilter DOUBLE_JSON_FILTER = new DoubleJSONFilter(); public static final DoubleJSONFilter DOUBLE_JSON_FILTER = new DoubleJSONFilter();
@Autowired @Autowired
private OrderService orderService; private OrderService orderService;
......
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
<module>order-detail-module-web</module> <module>order-detail-module-web</module>
<module>reportform-module</module> <module>reportform-module</module>
<module>reportform-module-web</module> <module>reportform-module-web</module>
<module>waybill-module</module>
<module>waybill-module-web</module>
</modules> </modules>
......
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>aidea-modules</artifactId>
<groupId>com.cftech</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.cftech</groupId>
<name>waybill-module-web</name>
<artifactId>waybill-module-web</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>com.cftech</groupId>
<artifactId>waybill-module</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<finalName>waybill-module-web</finalName>
</build>
</project>
<!DOCTYPE html>
<!--[if IE 8]>
<html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]>
<html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html>
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
<base href="#springUrl('/assets/adminlte/')"/>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>工作台</title>
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<!-- Bootstrap 3.3.5 -->
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
<!-- Font Awesome -->
<link rel="stylesheet" href="plugins/font-awesome/css/font-awesome.min.css">
<!-- Ionicons -->
<link rel="stylesheet" href="plugins/ionicons/css/ionicons.min.css">
<!-- DataTables -->
<link rel="stylesheet" href="plugins/datatables/dataTables.bootstrap.css">
<!-- Theme style -->
<link rel="stylesheet" href="dist/css/AdminLTE.min.css">
<!-- AdminLTE Skins. Choose a skin from the css/skins
folder instead of downloading all of them to reduce the load. -->
<link rel="stylesheet" href="dist/css/skins/_all-skins.min.css">
<!-- iCheck -->
<link rel="stylesheet" href="plugins/iCheck/flat/blue.css">
<!-- Date Picker -->
<link rel="stylesheet" href="plugins/datepicker/datepicker3.css">
<!-- Daterange picker -->
<link rel="stylesheet" href="plugins/daterangepicker/daterangepicker-bs3.css">
<!-- bootstrap wysihtml5 - text editor -->
<link rel="stylesheet" href="plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css">
<!--validate css-->
<link rel="stylesheet" href="plugins/jquery-validation/css/validate.css">
<!--fileinput css-->
<link rel="stylesheet" href="plugins/bootstrap-fileinput/bootstrap-fileinput.css">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<!-- END HEAD -->
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
<div class="content-wrapper" style="margin-left:0;">
<section class="content-header">
<h1>
顺丰物流运单管理
<small>顺丰物流运单</small>
</h1>
<ol class="breadcrumb">
<li><a href="#"><i class="fa fa-dashboard"></i>首页</a></li>
<li><a class="active">顺丰物流运单</a></li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-xs-12">
<!-- general form elements disabled -->
<div class="box box-primary">
<form role="form" id="myForm">
<input name="id" value="$!{data.id}" hidden="true"/>
<div class="box-body">
</div>
<div class="box-footer">
#if($shiro.hasPermission("qy:waybill:edit"))
<input class="btn btn-primary" id="save" value="保存" type="submit">
#end
<a href="#springUrl('/a/waybill/list')" class="btn btn-default">取消</a>
</div>
</form>
<!-- /.box-body -->
</div><!-- /.box -->
</div><!-- /.col -->
</div><!-- /.row -->
</section><!-- /.content -->
</div><!-- /.content-wrapper -->
<!-- Add the sidebar's background. This div must be placed
immediately after the control sidebar -->
<div class="control-sidebar-bg"></div>
</div><!-- ./wrapper -->
<script src="plugins/jQuery/jQuery-2.1.4.min.js"></script>
<!-- Bootstrap 3.3.5 -->
<script src="bootstrap/js/bootstrap.min.js"></script>
<!-- DataTables -->
<script src="plugins/datatables/jquery.dataTables.min.js"></script>
<script src="plugins/datatables/extensions/i18n/lanauage_ch.js"></script>
<script src="plugins/datatables/dataTables.bootstrap.min.js"></script>
<!-- SlimScroll -->
<script src="plugins/slimScroll/jquery.slimscroll.min.js"></script>
<!-- FastClick -->
<script src="plugins/fastclick/fastclick.min.js"></script>
<!--fileinput js-->
<script src="plugins/bootstrap-fileinput/bootstrap-fileinput.js"></script>
<!-- AdminLTE App -->
<script src="dist/js/app.min.js"></script>
<script src="plugins/bootstrap-maxlength/bootstrap-maxlength.min.js" type="text/javascript"></script>
<script src="plugins/security/sha256.js" type="text/javascript"></script>
<script src="plugins/jquery-validation/js/jquery.validate.min.js"></script>
<script src="js/jquery.form.min.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/ueditor.all.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/lang/zh-cn/zh-cn.js"></script>
<script src="common/js/cfapp.js"></script>
<!-- END PAGE LEVEL PLUGINS -->
<script>
$().ready(function () {
Cfapp.init();
recdTypeAdd.init();
});
var recdTypeAdd = function () {
var initForm = function () {
var initFormCtrl = function () {
bindEvent();
};
var bindEvent = function () {
$("#myForm").validate({
rules: {},
messages: {},
submitHandler: function (form) {
$("#save").attr("disabled", true);
$.getJSON("#springUrl('/a/waybill/formData')", $("#myForm").serialize(), function (returnobj) {
$("#save").attr("disabled", false);
if (returnobj.errorNo == 2) { //保存成功
Cfapp.confirm({
message: "添加成功",
btnoktext: "继续添加",
btncanceltext: "关闭",
success: function () {
location.href = "#springUrl('/a/waybill/form')";
},
cancel: function () {
location.href = "#springUrl('/a/waybill/list')";
}
});
} else if (returnobj.errorNo == 0) { //修改成功
Cfapp.alert({
message: "更新成功",
btntext: "确定",
success: function () {
location.href = "#springUrl('/a/waybill/list')";
}
});
} else {
Cfapp.alert({
message: "创建失败",
btntext: "确定",
success: function () {
location.href = "#springUrl('/a/waybill/list')";
}
});
}
});
}
})
}
initFormCtrl();
}
return {
//main function to initiate the module
init: function () {
initForm();
}
};
}();
</script>
</body>
<!-- END BODY -->
</html>
\ No newline at end of file
<!DOCTYPE html>
<!--[if IE 8]>
<html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]>
<html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html>
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
<base href="#springUrl('/assets/adminlte/')"/>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>工作台</title>
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<!-- Bootstrap 3.3.5 -->
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
<!-- Font Awesome -->
<link rel="stylesheet" href="plugins/font-awesome/css/font-awesome.min.css">
<!-- Ionicons -->
<link rel="stylesheet" href="plugins/ionicons/css/ionicons.min.css">
<!-- DataTables -->
<link rel="stylesheet" href="plugins/datatables/dataTables.bootstrap.css">
<!-- Theme style -->
<link rel="stylesheet" href="dist/css/AdminLTE.min.css">
<!-- AdminLTE Skins. Choose a skin from the css/skins
folder instead of downloading all of them to reduce the load. -->
<link rel="stylesheet" href="dist/css/skins/_all-skins.min.css">
<!-- iCheck -->
<link rel="stylesheet" href="plugins/iCheck/flat/blue.css">
<!-- Morris chart -->
<link rel="stylesheet" href="plugins/morris/morris.css">
<!-- jvectormap -->
<link rel="stylesheet" href="plugins/jvectormap/jquery-jvectormap-1.2.2.css">
<!-- Date Picker -->
<link rel="stylesheet" href="plugins/datepicker/datepicker3.css">
<!-- Daterange picker -->
<link rel="stylesheet" href="plugins/daterangepicker/daterangepicker-bs3.css">
<link rel="stylesheet"
href="plugins\bootstrap-fileinput\fileinput.min.css">
<!-- bootstrap wysihtml5 - text editor -->
<link rel="stylesheet" href="plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
<div class="content-wrapper" style="margin-left:0;">
<div id="importExcelDiv"></div>
<section class="content-header">
<h1>
顺丰物流运单管理
<small>顺丰物流运单</small>
</h1>
<ol class="breadcrumb">
<li><a><i class="fa fa-dashboard"></i>首页</a></li>
<li><a class="active">顺丰物流运单管理列表</a></li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<form id="seachTableForm" action="#springUrl('/a/waybill/list')" method="get">
<div class="col-xs-5">
<button type="button" class="search btn btn-primary">搜索</button>
#if($shiro.hasPermission("qy:waybill:edit"))
<a href="#springUrl('/a/waybill/form')" class="btn btn-primary">新增</a>
<a href="#springUrl('/a/waybill/exportExcel')" class="btn btn-primary">导出</a>
<a onclick="importExcel();" class="btn btn-primary">导入</a>
#end
</div>
</form>
</div><!-- /.box-header -->
<div class="box-body">
<table id="table" class="table table-bordered table-striped">
<thead>
<tr>
<td hidden="true">Id</td><th>创建时间</th>
<th>操作</th>
</tr>
</thead>
<tbody id="tablebody">
</tbody>
</table>
</div><!-- /.box-body -->
</div><!-- /.box -->
</div><!-- /.col -->
</div><!-- /.row -->
</section><!-- /.content -->
</div><!-- /.content-wrapper -->
<!-- Add the sidebar's background. This div must be placed
immediately after the control sidebar -->
<div class="control-sidebar-bg"></div>
</div><!-- ./wrapper -->
<!-- jQuery 2.1.4 -->
<script src="plugins/jQuery/jQuery-2.1.4.min.js"></script>
<!-- Bootstrap 3.3.5 -->
<script src="bootstrap/js/bootstrap.min.js"></script>
<!-- DataTables -->
<script src="plugins/datatables/jquery.dataTables.min.js"></script>
<script src="plugins/datatables/extensions/i18n/lanauage_ch.js"></script>
<script src="plugins/datatables/dataTables.bootstrap.min.js"></script>
<!-- SlimScroll -->
<script src="plugins/slimScroll/jquery.slimscroll.min.js"></script>
<script src="plugins/datepicker/bootstrap-datepicker.js"></script>
<script src="plugins/datepicker/locales/bootstrap-datepicker.zh-CN.js"></script>
<!-- FastClick -->
<script src="plugins/fastclick/fastclick.min.js"></script>
<!--fileinput js-->
<script src="plugins\bootstrap-fileinput\fileinput.js"></script>
<script src="plugins/bootstrap-fileinput/zh.js"></script>
<script src="plugins/bootstrap-fileinput/zh2.js"></script>
<!-- AdminLTE App -->
<script src="dist/js/app.min.js"></script>
<script type="text/javascript"
src="plugins/jquery-validation/js/jquery.validate.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="common/js/cfapp.js"></script>
<script>
function formatDates(now) {
var now = new Date(now);
var year = now.getFullYear();
var month = now.getMonth() + 1;
var date = now.getDate();
var hour = now.getHours();
var minute = now.getMinutes();
var second = now.getSeconds();
return year + "-" + month + "-" + date + " " + hour + ":"
+ minute + ":" + second;
}
function seachTable() {
var sSource = "#springUrl('/a/waybill/listData')";
var aoData = {
iDisplayStart: 1,
iDosplayLength: 10
}
var retrieveData = function (sSource, aoData, fnCallback) {
$("#seachTableForm input").each(function () {
var params = {
name: $(this).attr("name"),
value: $(this).val()
};
aoData.push(params);
})
$.ajax({
"type": "GET",
"url": sSource,
"dataType": "json",
"data": aoData, //以json格式传递
"success": fnCallback
});
};
$('#table').DataTable({
"lengthChange": false,
"searching": false,
"ordering": false,
"bFiltered": false,
"bStateSave": true, // save datatable state(pagination, sort, etc) in cookie.
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": sSource,
"fnServerData": retrieveData,
"pagingType": "full_numbers",
"aoColumns": [
{
"mData": "id"
},
{
"mData": "createTime"
},
{
"mData": "id"
}],
"aoColumnDefs": [
{ // set default column settings
'visible': false,
'targets': [0]
},
{
"aTargets": [1],
"mData": "createTime",
"mRender": function (a, b, c, d) {
return '<a href="#springUrl("/a/waybill/form?id=' + c.id + '")" data-id="' + c.id + '" data-action="view">' + formatDates(a, "yyyy-MM-dd HH:mm:ss");
+'</a>';
}
},
]
});
}
jQuery(document).ready(function () {
seachTable();
$('.datepicker').datepicker({
show: true,
format: 'yyyy-mm-dd',
autoclose: true,
language: 'zh-CN',
todayBtn: 'linked',
clearBtn: 'linked'
});
$('.search').click(function () {
$("#table").dataTable().fnClearTable();
});
});
Cfapp.init();
function removeData(data) {
Cfapp.confirm({
message: "确定要删除吗",
btnoktext: "确定",
btncanceltext: "取消",
success: function () {
$.ajax({
type: "POST",
url: "#springUrl('/a/waybill/delete')",
data: {id: data},
dataType: "json",
success: function (data) {
if (data.errorNo == 0) {
Cfapp.alert({
message: "删除成功",
btntext: "确定",
success: function () {
location.href = "#springUrl('/a/waybill/list')";
}
});
}
},
error: function () {
}
})
},
cancel: function () {
$(".modal-backdrop").fadeOut();
}
});
}
function importExcel() {
var templateExcelUrl = "#springUrl('/a/waybill/templateExcel')";
var importExcelUrl = "#springUrl('/a/waybill/importExcel')";
Cfapp.importExcel({
title: '顺丰物流运单导入',
importurl: importExcelUrl,
templateurl: templateExcelUrl,
cancel: function () {
},
success: function () {
}
});
}
</script>
</body>
</html>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>aidea-modules</artifactId>
<groupId>com.cftech</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>waybill-module</artifactId>
<dependencies>
<dependency>
<groupId>com.cftech</groupId>
<artifactId>member-module</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.cftech</groupId>
<artifactId>order-module</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.cftech</groupId>
<artifactId>order-detail-module</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.cftech</groupId>
<artifactId>shipping-address-module</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
package com.cftech.waybill.dao;
import com.cftech.waybill.model.Waybill;
import com.cftech.core.generic.GenericDao;
/**
* 顺丰物流运单Mapper
*
* @author Strive
* @date: 2020-10-21 15:04
*/
public interface WaybillMapper extends GenericDao<Waybill> {
}
\ No newline at end of file
<?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.cftech.waybill.dao.WaybillMapper">
<resultMap id="resultMap" type="com.cftech.waybill.model.Waybill">
<id column="id" property="id"/>
<result column="consult_id" property="consultId"/>
<result column="order_id" property="orderId"/>
<result column="numbetr" property="numbetr"/>
<result column="member_id" property="memberId"/>
<result column="open_id" property="openId"/>
<result column="storage_manage" property="storageManage"/>
<result column="waybill_no" property="waybillNo"/>
<result column="language" property="language"/>
<result column="monthly_card" property="monthlyCard"/>
<result column="express_type_id" property="expressTypeId"/>
<result column="temperature_range" property="temperatureRange"/>
<result column="contact" property="contact"/>
<result column="mobile" property="mobile"/>
<result column="province" property="province"/>
<result column="city" property="city"/>
<result column="county" property="county"/>
<result column="address" property="address"/>
<result column="address_id" property="addressId"/>
<result column="send_express_date" property="sendExpressDate"/>
<result column="accept_express_date" property="acceptExpressDate"/>
<result column="waybill_remark" property="waybillRemark"/>
<result column="accounts_id" property="accountsId"/>
<result column="del_flag" property="delFlag"/>
<result column="status" property="status"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="description" property="description"/>
<result column="create_by" property="createBy"/>
<result column="update_by" property="updateBy"/>
</resultMap>
<sql id="sqlWhere">
<if test="conds!=null">
<trim prefix="WHERE" prefixOverrides="AND|OR">
<foreach collection="conds.conds" index="index" item="cond">
${cond.linkType}
<if test="cond.condType == 'EQUAL'">${cond.param} = #{cond.value}</if>
<if test="cond.condType == 'NOTEQUAL'">${cond.param} &lt;&gt; #{cond.value}</if>
<if test="cond.condType == 'GREATEQUAL'">${cond.param} &gt;= #{cond.value}</if>
<if test="cond.condType == 'GREATTHAN'">${cond.param} &gt; #{cond.value}</if>
<if test="cond.condType == 'LESSEQUAL'">${cond.param} &lt;= #{cond.value}</if>
<if test="cond.condType == 'LESSTHAN'">${cond.param} &lt; #{cond.value}</if>
<if test="cond.condType == 'BETWEEN'">${cond.param} BETWEEN #{cond.startValue} AND
#{cond.endValue}
</if>
<if test="cond.condType == 'ISNULL'">${cond.param} IS NULL</if>
<if test="cond.condType == 'NOTNULL'">${cond.param} IS NOT NULL</if>
<if test="cond.condType == 'LIKE'">${cond.param} LIKE #{cond.value}</if>
<if test="cond.condType == 'IN'">${cond.param} IN
<foreach item="item" index="index" collection="cond.value" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</foreach>
</trim>
</if>
</sql>
<sql id="sqlColumns">
id,
consult_id,
order_id,
numbetr,
member_id,
open_id,
storage_manage,
waybill_no,
language,
monthly_card,
express_type_id,
temperature_range,
contact,
mobile,
province,
city,
AES_DECRYPT(county, 'aideakey'),
address,
address_id,
send_express_date,
accept_express_date,
waybill_remark,
accounts_id,
del_flag,
status,
create_time,
update_time,
description,
create_by,
update_by
</sql>
<insert id="save" parameterType="com.cftech.waybill.model.Waybill" useGeneratedKeys="true"
keyProperty="id">
insert into t_mp_waybill
(
<include refid="sqlColumns"/>
)
values
(
#{id, jdbcType=BIGINT},
#{consultId, jdbcType=BIGINT},
#{orderId, jdbcType=BIGINT},
#{numbetr, jdbcType=VARCHAR},
#{memberId, jdbcType=VARCHAR},
#{openId, jdbcType=VARCHAR},
#{storageManage, jdbcType=VARCHAR},
#{waybillNo, jdbcType=VARCHAR},
#{language, jdbcType=VARCHAR},
#{monthlyCard, jdbcType=VARCHAR},
#{expressTypeId, jdbcType=VARCHAR},
#{temperatureRange, jdbcType=VARCHAR},
#{contact, jdbcType=VARCHAR},
#{mobile, jdbcType=VARCHAR},
#{province, jdbcType=VARCHAR},
#{city, jdbcType=VARCHAR},
#{county, jdbcType=VARCHAR},
AES_ENCRYPT(#{county, jdbcType=BINARY}, 'aideakey') ,
#{addressId, jdbcType=VARCHAR},
now(),
now(),
#{waybillRemark, jdbcType=VARCHAR},
#{accountsId, jdbcType=BIGINT},
#{delFlag, jdbcType=TINYINT},
#{status, jdbcType=VARCHAR},
now(),
now(),
#{description, jdbcType=VARCHAR},
#{createBy, jdbcType=BIGINT},
#{updateBy, jdbcType=BIGINT}
)
</insert>
<select id="fetchById" parameterType="java.lang.Long" resultMap="resultMap">
SELECT
<include refid="sqlColumns"/>
FROM t_mp_waybill t
WHERE t.id=#{id}
</select>
<select id="count" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT COUNT(1) FROM t_mp_waybill
<include refid="sqlWhere"/>
</select>
<select id="fetchSearchByPage" parameterType="java.util.Map" resultMap="resultMap">
SELECT
<include refid="sqlColumns"/>
FROM t_mp_waybill
<include refid="sqlWhere"/>
<if test="sort!=null">ORDER BY ${sort.param} ${sort.type}</if>
<if test="limit>0">limit #{offset},#{limit}</if>
</select>
<update id="update" parameterType="com.cftech.waybill.model.Waybill">
update t_mp_waybill
<set>
<if test="id != null">
id = #{id, jdbcType=BIGINT},
</if>
<if test="consultId != null">
consult_id = #{consultId, jdbcType=BIGINT},
</if>
<if test="orderId != null">
order_id = #{orderId, jdbcType=BIGINT},
</if>
<if test="numbetr != null">
numbetr = #{numbetr, jdbcType=VARCHAR},
</if>
<if test="memberId != null">
member_id = #{memberId, jdbcType=VARCHAR},
</if>
<if test="openId != null">
open_id = #{openId, jdbcType=VARCHAR},
</if>
<if test="storageManage != null">
storage_manage = #{storageManage, jdbcType=VARCHAR},
</if>
<if test="waybillNo != null">
waybill_no = #{waybillNo, jdbcType=VARCHAR},
</if>
<if test="language != null">
language = #{language, jdbcType=VARCHAR},
</if>
<if test="monthlyCard != null">
monthly_card = #{monthlyCard, jdbcType=VARCHAR},
</if>
<if test="expressTypeId != null">
express_type_id = #{expressTypeId, jdbcType=VARCHAR},
</if>
<if test="temperatureRange != null">
temperature_range = #{temperatureRange, jdbcType=VARCHAR},
</if>
<if test="contact != null">
contact = #{contact, jdbcType=VARCHAR},
</if>
<if test="mobile != null">
mobile = #{mobile, jdbcType=VARCHAR},
</if>
<if test="province != null">
province = #{province, jdbcType=VARCHAR},
</if>
<if test="city != null">
city = #{city, jdbcType=VARCHAR},
</if>
<if test="county != null">
county = #{county, jdbcType=VARCHAR},
</if>
<if test="address != null">
address = #{address, jdbcType=VARCHAR},
</if>
<if test="addressId != null">
address_id = #{addressId, jdbcType=VARCHAR},
</if>
<if test="sendExpressDate != null">
send_express_date = #{sendExpressDate, jdbcType=TIMESTAMP},
</if>
<if test="acceptExpressDate != null">
accept_express_date = #{acceptExpressDate, jdbcType=TIMESTAMP},
</if>
<if test="waybillRemark != null">
waybill_remark = #{waybillRemark, jdbcType=VARCHAR},
</if>
<if test="accountsId != null">
accounts_id = #{accountsId, jdbcType=BIGINT},
</if>
<if test="delFlag != null">
del_flag = #{delFlag, jdbcType=TINYINT},
</if>
<if test="status != null">
status = #{status, jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime, jdbcType=TIMESTAMP},
</if>
<if test="description != null">
description = #{description, jdbcType=VARCHAR},
</if>
<if test="createBy != null">
create_by = #{createBy, jdbcType=BIGINT},
</if>
<if test="updateBy != null">
update_by = #{updateBy, jdbcType=BIGINT},
</if>
</set>
where id=#{id,jdbcType=BIGINT}
</update>
<update id="delete" parameterType="java.lang.Long">
update t_mp_waybill set del_flag=1 where id=#{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
package com.cftech.waybill.model;
import com.cftech.core.poi.ExportConfig;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 顺丰物流运单
*
* @author Strive
* @date: 2020-10-21 15:04
*/
@Data
public class Waybill implements Serializable {
/* 主键id */
private Long id;
/* 咨询单Id */
@ExportConfig(value = "咨询单Id", width = 100, showLevel = 1)
private Long consultId;
/* 订单Id */
@ExportConfig(value = "订单Id", width = 100, showLevel = 1)
private Long orderId;
/* 物流单编码 */
@ExportConfig(value = "物流单编码", width = 100, showLevel = 1)
private String numbetr;
/* 会员Id */
@ExportConfig(value = "会员Id", width = 100, showLevel = 1)
private String memberId;
/* 粉丝Id */
@ExportConfig(value = "粉丝Id", width = 100, showLevel = 1)
private String openId;
/* 仓管员Id */
@ExportConfig(value = "仓管员Id", width = 100, showLevel = 1)
private String storageManage;
/* 顺丰运单号 */
@ExportConfig(value = "顺丰运单号", width = 100, showLevel = 1)
private String waybillNo;
/* 语言 */
@ExportConfig(value = "语言", width = 100, showLevel = 1)
private String language;
/* 顺丰月结卡号 */
@ExportConfig(value = "顺丰月结卡号", width = 100, showLevel = 1)
private String monthlyCard;
/* 快件产品类型 */
@ExportConfig(value = "快件产品类型", width = 100, showLevel = 1)
private String expressTypeId;
/* 温度范围控制 1:冷藏 3:冷冻 */
@ExportConfig(value = "温度范围控制 1:冷藏 3:冷冻", width = 100, showLevel = 1)
private String temperatureRange;
/* 联系人 */
@ExportConfig(value = "联系人", width = 100, showLevel = 1)
private String contact;
/* 联系电话 */
@ExportConfig(value = "联系电话", width = 100, showLevel = 1)
private String mobile;
/* 省份 */
@ExportConfig(value = "省份", width = 100, showLevel = 1)
private String province;
/* 城市 */
@ExportConfig(value = "城市", width = 100, showLevel = 1)
private String city;
/* 县/区级行政区名称 */
@ExportConfig(value = "县/区级行政区名称", width = 100, showLevel = 1)
private String county;
/* 地址Id */
@ExportConfig(value = "地址Id", width = 100, showLevel = 1)
private String addressId;
/* 详细地址 */
@ExportConfig(value = "详细地址", width = 100, showLevel = 1)
private String address;
/* 发件时间 */
@ExportConfig(value = "发件时间", width = 100, showLevel = 1)
private Date sendExpressDate;
/* 收件时间 */
@ExportConfig(value = "收件时间", width = 100, showLevel = 1)
private Date acceptExpressDate;
/* 运单描述 */
@ExportConfig(value = "运单描述", width = 100, showLevel = 1)
private String waybillRemark;
/* 所属的账号 */
private Long accountsId;
/* 删除标识 */
private boolean delFlag;
/* 状态 */
private String status;
/* 创建时间 */
private Date createTime;
/* 更新时间 */
private Date updateTime;
/* 备注 */
private String description;
/* 创建人 */
private Long createBy;
/* 更新人 */
private Long updateBy;
public Waybill() {
this.delFlag = false;
this.status = "0";
}
}
\ No newline at end of file
package com.cftech.waybill.service;
import com.cftech.waybill.model.Waybill;
import com.cftech.core.generic.GenericService;
/**
* 顺丰物流运单Service
*
* @author Strive
* @date: 2020-10-21 15:04
*/
public interface WaybillService extends GenericService<Waybill> {
}
package com.cftech.waybill.service.impl;
import com.cftech.waybill.model.Waybill;
import com.cftech.waybill.dao.WaybillMapper;
import com.cftech.waybill.service.WaybillService;
import com.cftech.core.generic.GenericDao;
import com.cftech.core.generic.GenericServiceImpl;
import com.cftech.core.sql.Conds;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
/**
* 顺丰物流运单ServiceImpl
*
* @author Strive
* @date: 2020-10-21 15:04
*/
@Service("waybillService")
public class WaybillServiceImpl extends GenericServiceImpl<Waybill> implements WaybillService {
@Autowired
@Qualifier("waybillMapper")
private WaybillMapper waybillMapper;
@Override
public GenericDao<Waybill> getGenericMapper() {
return waybillMapper;
}
}
\ No newline at end of file
package com.cftech.waybill.utils;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
/**
* Created by 16444 on 2020/10/21.
*/
@Data
public class CloseableHttpEntity {
private int code;
private JSONObject retObj;
public CloseableHttpEntity(int code, JSONObject retObj) {
this.code = code;
this.retObj = retObj;
}
}
package com.cftech.waybill.utils;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.cftech.core.util.StringUtils;
import com.cftech.order.model.Order;
import com.cftech.orderdetail.model.OrderDetails;
import com.cftech.waybill.model.Waybill;
import lombok.extern.slf4j.Slf4j;
import sun.misc.BASE64Encoder;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.List;
/**
* Created by 16444 on 2020/10/21.
*/
@Slf4j
public class ExpressOrderInfoUtils {
private static final String language = "zh-CN";
private static final String countryCode = "CN";
private static final String currencyCode = "HKD";
/**
* 下订单接口参数封装
* @param order
* @param orderDetails
* @param waybillObj
* @return
*/
public static JSONObject generateWaybillOrder(Order order, List<OrderDetails> orderDetails, Waybill waybillObj) {
//订单
JSONObject waybill = new JSONObject();
try {
waybill.put("language", language);
waybill.put("orderId", order.getNumber());//快递单号
waybill.put("cargoDesc", "医疗药品");//托寄物描述
waybill.put("monthlyCard", "");//顺丰月结卡号
waybill.put("orderSource", "WECHAT_STORE");//平台编码 微信咨询平台
waybill.put("remark", waybillObj.getWaybillRemark());//订单备注
//业务需要增加
waybill.put("isReturnQRCode", "1");//是否返回用来推送业务的二维码 1:返回 0:不返回
waybill.put("specialDeliveryTypeCode", "1");//特殊派送类型代码 1:身份验证
waybill.put("specialDeliveryValue", "12345678");//特殊派件具体表述 证件类型:证件后8位如:1:09296231(1 表示身份证,暂不支持其他证件)
waybill.put("isReturnSignBackRoutelabel", "1");//是否返回签回单路由标签: 默认0, 1:返回路由标签,0:不返回
waybill.put("isReturnRoutelabel", "1");//是否返回路由标签: 默认0, 1:返回路由标签, 0:不返回
waybill.put("podModelAddress", "url");//签单返回范本地址
//特殊需求药品,需冷冻、冷藏
if (StringUtils.isNoneBlank(waybillObj.getExpressTypeId())) {
waybill.put("expressTypeId", waybillObj.getExpressTypeId());//快件产品类别Id 12医药类 冷冻 冷藏
waybill.put("temperatureRange", waybillObj.getTemperatureRange());//1:冷藏 3:冷冻
}
//托寄物信息List
JSONArray cargoDetails = new JSONArray();
for (OrderDetails orderd: orderDetails) {
JSONObject cargo = new JSONObject();
cargo.put("name", orderd.getDrugsName());//商品名称
cargo.put("count", 1);//商品数量
cargo.put("unit", "盒");//商品单位
cargo.put("amount", orderd.getPrice());//商品价格
cargo.put("currency", currencyCode);//币种编码
}
waybill.put("cargoDetails", cargoDetails);
//收寄双方信息List
JSONArray contactInfoList = new JSONArray();
//寄件方信息
JSONObject sender = new JSONObject();
sender.put("contactType", "1");
sender.put("company", "康诺");
sender.put("contact", "小谢");
sender.put("tel", "15800815547");
sender.put("mobile", "15800815547");
sender.put("country", countryCode);
sender.put("province", "上海市");
sender.put("city", "上海市");
sender.put("county", "闵行区");
sender.put("address", "江玮路100号");
contactInfoList.add(sender);
//收件方信息
JSONObject recipient = new JSONObject();
recipient.put("contactType", "2");
//recipient.put("company", "");
recipient.put("contact", waybillObj.getContact());
recipient.put("tel", waybillObj.getMobile());
recipient.put("mobile", waybillObj.getMobile());
recipient.put("country", countryCode);
recipient.put("province", waybillObj.getProvince());
recipient.put("city", waybillObj.getCity());
recipient.put("county", waybillObj.getCounty());
recipient.put("address", waybillObj.getAddress());
contactInfoList.add(recipient);
waybill.put("contactInfoList", contactInfoList);
} catch (Exception e) {
e.printStackTrace();
log.error("丰桥API {下订单接口} Request Params Error = " + e.getMessage());
return null;
}
return waybill;
}
/**
* 订单查询接口封装
* @param searchType 查询类型:1.正向单查询,传入的orderId为正向订单号,2.退货单查询,传入的orderId为退货原始订单号
* @return
*/
public static JSONObject generateOrderSel(Order order, String searchType) {
JSONObject retObj = new JSONObject();
try {
retObj.put("orderId", order.getNumber());
retObj.put("searchType", searchType);
retObj.put("language", language);
} catch (Exception e) {
e.printStackTrace();
log.error("丰桥API 订单查询接口 Request Params Error = " + e.getMessage());
return null;
}
return retObj;
}
/**
* 订单确认/取消接口
* @param order
* @param type
* @return
*/
public JSONObject generateOrderCancel(Order order, Waybill waybillObj, String type) {
JSONObject retObj = new JSONObject();
try {
retObj.put("orderId", order.getNumber());
retObj.put("dealType", type);
JSONArray waybillNoInfoList = new JSONArray();
JSONObject waybill = new JSONObject();
waybill.put("waybillType", 1);//母单
waybill.put("waybillNo", waybillObj.getWaybillNo());
waybillNoInfoList.add(waybill);
} catch (Exception e) {
e.printStackTrace();
log.error("丰桥API {订单查询、取消} Request Params Error = " + e.getMessage());
return null;
}
return retObj;
}
/**
* 路由查询
* @param waybillObj
* @return
*/
public static JSONObject generateRouteData(Waybill waybillObj) {
JSONObject retObj = new JSONObject();
try {
retObj.put("language", 0);//中文
retObj.put("trackingType", 1);//1:根据顺丰运单号查询
JSONArray waybills = new JSONArray();
waybills.add(waybillObj.getWaybillNo());
retObj.put("trackingNumber", waybills);//顺丰运单号
retObj.put("methodType", 1);//标准路由查询
} catch (Exception e) {
e.printStackTrace();
log.error("丰桥API 订单查询接口 Request Params Error = " + e.getMessage());
}
return retObj;
}
/**
* 生成顺丰签名
* @return
*/
public static String generateSfDigest(String msgData, Long timestamp, String checkWord) {
String msgDigest = null;
try {
StringBuffer verifyText = new StringBuffer();
verifyText.append(msgData);
verifyText.append(timestamp);
verifyText.append(checkWord);
//因业务报文中可能包含加号、空格等特殊字符,需要urlEnCode处理
String text = URLEncoder.encode(verifyText.toString(), "UTF-8");
//进行Md5加密
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(text.getBytes("UTF-8"));
byte[] md = md5.digest();
//通过BASE64生成数字签名
msgDigest = new String(new BASE64Encoder().encode(md));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
log.error("丰桥API 生成接口签名 md5 base64 error = " + e.getMessage());
return null;
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
log.error("丰桥API 生成接口签名 无算法异常 md5 base64 error = " + e.getMessage());
return null;
}
return msgDigest;
}
}
package com.cftech.waybill.utils;
/**
* Created by 16444 on 2020/10/22.
*/
public class FqConstants {
/**
* 丰桥API:下订单接口URL
* url: 请求地址
* code: 接口服务代码
*/
public static final String SF_ORDER_SEND_URL = "https://sfapi-sbox.sf-express.com/std/service";
public static final String SF_ORDER_SEND_CODE = "EXP_RECE_CREATE_ORDER";
/**
* 丰桥API:订单查询接口URL
* code: 接口服务代码
*/
public static final String SF_ORDER_SEARCH_URL = "https://sfapi-sbox.sf-express.com/std/service";
public static final String SF_ORDER_SEARCH_CODE = "EXP_RECE_SEARCH_ORDER_RESP";
/**
* 丰桥API:订单确认/取消接口URL
* code: 接口服务代码
*/
public static final String SF_ORDER_CANCEL_URL = "https://sfapi-sbox.sf-express.com/std/service";
public static final String SF_ORDER_CANCEL_CODE = "EXP_RECE_UPDATE_ORDER";
/**
* 丰桥API:订单路由接口URL
* code: 接口服务代码
*/
public static final String SF_ORDER_ROUTE_URL = "https://sfapi-sbox.sf-express.com/std/service";
public static final String SF_ORDER_ROUTE_CODE = "EXP_RECE_SEARCH_ROUTES";
}
package com.cftech.waybill.utils;
import com.alibaba.fastjson.JSONObject;
import com.cftech.core.util.SystemConfig;
import com.cftech.order.model.Order;
import com.cftech.order.model.OrderDetail;
import com.cftech.orderdetail.model.OrderDetails;
import com.cftech.waybill.model.Waybill;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpEntity;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
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.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* Created by 16444 on 2020/10/21.
*/
@Slf4j
public class FqHttpUtils {
private static final String CHARACTER_CODE_UTF8 = "UTF-8";
private static final int TIME_OUT_SECOND = 60000;
private static RequestConfig requestConfig = null;
/**
* 顺丰合作伙伴Id
*/
private static final String partnerId = SystemConfig.p.getProperty("sf.partnerID");
private static Map<String, String> headers = new HashMap<>();
static {
requestConfig = RequestConfig.custom()
.setSocketTimeout(TIME_OUT_SECOND)//连接时间
.setConnectTimeout(TIME_OUT_SECOND)//超时时间
.setConnectionRequestTimeout(TIME_OUT_SECOND)
.build();
//headers.put("Accept", "application/x-www-form-urlencoded;charset=UTF-8");
headers.put("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
}
/**
* 服务端发送http get请求
* @param url
* @return
*/
public static CloseableHttpEntity sendHttpGet(String url) {
String dateStr = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
CloseableHttpClient httpClient = null;
CloseableHttpResponse httpResponse = null;
try {
httpClient = HttpClients.createDefault();
HttpGet httpGet = new HttpGet(url);
httpGet.setConfig(requestConfig);
for (Map.Entry<String, String> entry : headers.entrySet()) {
httpGet.setHeader(entry.getKey(), entry.getValue());
}
httpGet.setHeader("X-Caller-Timestamp", dateStr);
//取出url后参数
if (url.contains("?")) {
url = url.split("\\?")[0];
}
httpResponse = httpClient.execute(httpGet);
InputStream inputStream = httpResponse.getEntity().getContent();
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"));
StringBuilder strber = new StringBuilder();
String line = null;
while ((line = reader.readLine()) != null) {
strber.append(line);
}
reader.close();
inputStream.close();
log.info(strber.toString());
return new CloseableHttpEntity(httpResponse.getStatusLine().getStatusCode(), strber == null? null:JSONObject.parseObject(strber.toString()));
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (httpClient != null) {
try {
httpClient.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (httpResponse != null) {
try {
httpResponse.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return null;
}
public static CloseableHttpEntity sendHttpPost(String url, JSONObject jsonObj) {
String dateStr = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
//构建HttpClient实例
CloseableHttpClient httpclient = null;
CloseableHttpResponse httpResponse = null;
try {
httpclient = HttpClients.createDefault();
//指定POST请求
HttpPost httpPost = new HttpPost(url);
httpPost.setConfig(requestConfig);
//设置请求头
for (Map.Entry<String, String> entry : headers.entrySet()) {
httpPost.setHeader(entry.getKey(), entry.getValue());
}
httpPost.setHeader("X-Caller-Timestamp", dateStr);
//发送请求 BODY JSON 请求
StringEntity stringEntity = new StringEntity(jsonObj.toString(), "application/json", CHARACTER_CODE_UTF8);
httpPost.setEntity(stringEntity);
httpResponse = httpclient.execute(httpPost);
//读取响应
HttpEntity entity = httpResponse.getEntity();
if (entity != null) {
String result = EntityUtils.toString(entity, CHARACTER_CODE_UTF8);
log.info(result);
return new CloseableHttpEntity(httpResponse.getStatusLine().getStatusCode(), result == null? null:JSONObject.parseObject(result));
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (httpclient != null) {
try {
httpclient.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (httpResponse != null) {
try {
httpResponse.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return null;
}
public static CloseableHttpEntity sendHttpPost(String url, List<BasicNameValuePair> content) {
if (!url.contains("/")) {
return null;
}
String dateStr = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
//构建HttpClient实例
CloseableHttpClient httpclient = null;
CloseableHttpResponse httpResponse = null;
try {
httpclient =HttpClients.createDefault();
//指定POST请求
HttpPost httpPost = new HttpPost(url);
httpPost.setConfig(requestConfig);
//设置请求头
for (Map.Entry<String, String> entry : headers.entrySet()) {
httpPost.setHeader(entry.getKey(), entry.getValue());
}
//包装请求体
List<NameValuePair> params = new ArrayList<>();
params.add(new BasicNameValuePair("partnerID", partnerId));
params.addAll(content);
HttpEntity request = new UrlEncodedFormEntity(params, CHARACTER_CODE_UTF8);
//发送请求
httpPost.setEntity(request);
httpResponse = httpclient.execute(httpPost);
//读取响应
HttpEntity entity = httpResponse.getEntity();
if (entity != null) {
String result = EntityUtils.toString(entity, CHARACTER_CODE_UTF8);
log.info(result);
return new CloseableHttpEntity(httpResponse.getStatusLine().getStatusCode(), result == null? null:JSONObject.parseObject(result));
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (httpclient != null) {
try {
httpclient.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (httpResponse != null) {
try {
httpResponse.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return null;
}
public static String generateUUID() {
return UUID.randomUUID().toString().replaceAll("-","");
}
public static void main(String[] args) {
Order order = new Order();
order.setNumber("ORD20201022001");
List<OrderDetails> orders = new ArrayList<>();
OrderDetails orderDetail = new OrderDetails();
orderDetail.setDrugsName("药品");
orderDetail.setPrice(123.4);
Waybill waybill = new Waybill();
waybill.setExpressTypeId("12");
waybill.setTemperatureRange("1");
waybill.setWaybillRemark("加速送快递");
waybill.setContact("小明");
waybill.setMobile("13410934014");
waybill.setProvince("上海市");
waybill.setCity("上海市");
waybill.setCounty("徐汇区");
waybill.setAddress("虹口足球场");
JSONObject msgDataObj = ExpressOrderInfoUtils.generateWaybillOrder(order, orders, waybill);
String msgData = msgDataObj.toString();
Long timestamp = System.currentTimeMillis();
String code = FqConstants.SF_ORDER_SEND_CODE;
String msgDigest = ExpressOrderInfoUtils.generateSfDigest(msgData, timestamp, code);
List<BasicNameValuePair> content = new ArrayList<>();
content.add(new BasicNameValuePair("requestID", generateUUID()));
content.add(new BasicNameValuePair("serviceCode", generateUUID()));
content.add(new BasicNameValuePair("timestamp", String.valueOf(timestamp)));
content.add(new BasicNameValuePair("msgDigest", msgDigest));
content.add(new BasicNameValuePair("msgData", msgData));
sendHttpPost(FqConstants.SF_ORDER_SEND_URL, content);
}
}
package com.cftech.waybill.web;
import com.alibaba.fastjson.JSONObject;
import com.cftech.waybill.model.Waybill;
import com.cftech.waybill.service.WaybillService;
import com.cftech.core.poi.ExcelKit;
import com.cftech.core.scope.OrderType;
import com.cftech.core.sql.Conds;
import com.cftech.core.sql.Sort;
import com.cftech.core.util.Constants;
import com.cftech.sys.security.PermissionSign;
import com.cftech.sys.security.UserUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.util.List;
/**
* 顺丰物流运单Controller
* <p>
* 权限字符串说明:
* 查看:public static final String WAYBILL_VIEW = "qy:waybill:view"
* 查看:public static final String WAYBILL_EDIT = "qy:waybill:edit"
*
* @author Strive
* @date: 2020-10-21 15:04
*/
@Slf4j
@Controller
@RequestMapping("/a/waybill")
public class WaybillController {
public static final String WAYBILL_VIEW = "qy:waybill:view";
public static final String WAYBILL_EDIT = "qy:waybill:edit";
@Autowired
private WaybillService waybillService;
//列表页面
@RequiresPermissions(value = WAYBILL_VIEW)
@RequestMapping("/list")
public String list(HttpServletRequest request, Model model) {
Long accountId = UserUtils.getmpaccounts(request);
model.addAttribute("accountId", accountId);
return "waybill/waybilllist";
}
//编辑页面(新增、修改)
@RequiresPermissions(value = WAYBILL_VIEW)
@RequestMapping("/form")
public String form(HttpServletRequest request, String id, Model model) {
if (!StringUtils.isEmpty(id)) {
Waybill waybill = waybillService.fetchById(id);
model.addAttribute("data", waybill);
}
return "waybill/waybillform";
}
//提交数据(新增、修改)
@RequiresPermissions(value = WAYBILL_EDIT)
@RequestMapping("/formData")
@ResponseBody
public JSONObject formData(Waybill waybill, Model model, HttpServletRequest request) {
Long accountsId = UserUtils.getmpaccounts(request);
JSONObject rtnJson = new JSONObject();
try {
if (waybill != null && waybill.getId() != null) {
waybill.setUpdateBy(UserUtils.getUser().getId());
waybillService.update(waybill);
rtnJson.put("errorNo", 0);
} else {
waybill.setAccountsId(accountsId);
waybill.setDelFlag(false);
waybill.setAccountsId(UserUtils.getmpaccounts(request));
waybill.setCreateBy(UserUtils.getUser().getId());
waybill.setUpdateBy(UserUtils.getUser().getId());
waybillService.save(waybill);
rtnJson.put("errorNo", 2);
}
} catch (Exception e) {
rtnJson.put("errorNo", 1);
}
return rtnJson;
}
//获取列表数据
@RequiresPermissions(value = WAYBILL_VIEW)
@RequestMapping(value = "/listData")
@ResponseBody
public JSONObject listData(int iDisplayStart, int iDisplayLength, Waybill waybill, HttpServletRequest request) {
Long accountsId = UserUtils.getmpaccounts(request);
Conds conds = new Conds();
conds.equal("del_flag", Constants.DEL_FLAG_0);
conds.equal("accounts_id", accountsId);
Sort sort = new Sort("create_time", OrderType.DESC);
List<Waybill> list = waybillService.fetchSearchByPage(conds, sort, iDisplayStart, iDisplayLength);
Integer counts = waybillService.count(conds);
JSONObject rtnJson = new JSONObject();
rtnJson.put("iTotalRecords", counts);
rtnJson.put("iTotalDisplayRecords", counts);
rtnJson.put("aaData", list);
return rtnJson;
}
//删除数据
@RequiresPermissions(value = WAYBILL_EDIT)
@RequestMapping("/delete")
@ResponseBody
public JSONObject delete(String id) {
JSONObject rtnJosn = new JSONObject();
try {
waybillService.delete(id);
rtnJosn.put("errorNo", 0);
} catch (Exception e) {
rtnJosn.put("errorNo", 1);
}
return rtnJosn;
}
@RequestMapping("/exportExcel")
@RequiresPermissions(value = WAYBILL_VIEW)
public void exportExcel(HttpServletRequest request, HttpServletResponse response) {
Long accountId = UserUtils.getmpaccounts(request);
Sort sort = new Sort("create_time", OrderType.ASC);
Conds conds = new Conds();
conds.equal("del_flag", 0);
conds.equal("accounts_id", accountId);
List<Waybill> list = waybillService.fetchSearchByPage(conds, sort, 0, 0);
ExcelKit.$Export(Waybill.class, response).toExcel(list, "顺丰物流运单信息");
}
@RequestMapping("/templateExcel")
@RequiresPermissions(value = WAYBILL_VIEW)
public void templateExcel(HttpServletRequest request, HttpServletResponse response) {
ExcelKit.$Export(Waybill.class, response).toExcel(null, "顺丰物流运单信息");
}
@RequestMapping("/importExcel")
@RequiresPermissions(value = WAYBILL_EDIT)
public String importExcel(HttpServletRequest request, MultipartFile file, Model model) {
Long accountId = UserUtils.getmpaccounts(request);
if (file == null) {
return list(request, model);
}
// 构造临时路径来存储上传的文件
String uploadPath = System.getProperty("java.io.tmpdir");
File uploadDir = new File(uploadPath);
if (!uploadDir.exists()) {
uploadDir.mkdir();
}
String fileName = file.getOriginalFilename();
String filePath = uploadPath + File.separator + fileName;
File storeFile = new File(filePath);
try {
file.transferTo(storeFile);
ExcelKit.$Import().setEmptyCellValue("").readExcel(storeFile, rowData -> {
if (!StringUtils.isEmpty(rowData.get(0))) {
Waybill waybill = new Waybill();
waybill.setAccountsId(accountId);
waybillService.save(waybill);
}
});
} catch (IOException e) {
log.error(e.getMessage());
}
return list(request, model);
}
}
...@@ -42,7 +42,11 @@ security.secure=false ...@@ -42,7 +42,11 @@ security.secure=false
#\uFFFD\u01F7\uFFFD\uFFFD\u01FC\uFFFD\u023A\uFFFD\uFFFD\u02B1\uFFFD\uFFFD\uFFFD\uFFFDMaster\uFFFD\uFFFD\uFFFD\u06B5\uFFFD\u04BB\uFFFD\uFFFD\uFFFD\uFFFD\u03AAtrue\uFFFD\uFFFD\uFFFD\uFFFD #\uFFFD\u01F7\uFFFD\uFFFD\u01FC\uFFFD\u023A\uFFFD\uFFFD\u02B1\uFFFD\uFFFD\uFFFD\uFFFDMaster\uFFFD\uFFFD\uFFFD\u06B5\uFFFD\u04BB\uFFFD\uFFFD\uFFFD\uFFFD\u03AAtrue\uFFFD\uFFFD\uFFFD\uFFFD
quartz.isCluster=false quartz.isCluster=false
#\u987A\u4E30API\u914D\u7F6E\u53C2\u6570
#\u987A\u4E30\u5BA2\u6237\u7F16\u7801
sf.partnerID=XXYZ
#\u987A\u4E30\u5BA2\u6237\u6821\u9A8C\u7801
sf.checkWord=5Nhuavqk0JG7zTYLtPKq7JpnceuekRcH
......
...@@ -292,6 +292,12 @@ ...@@ -292,6 +292,12 @@
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<type>war</type> <type>war</type>
</dependency> </dependency>
<dependency>
<groupId>com.cftech</groupId>
<artifactId>waybill-module-web</artifactId>
<version>1.0-SNAPSHOT</version>
<type>war</type>
</dependency>
</dependencies> </dependencies>
<build> <build>
<finalName>portal-web</finalName> <finalName>portal-web</finalName>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment