收银台-订单相关
This commit is contained in:
parent
0469990593
commit
540d1b3f5c
@ -7,6 +7,7 @@ import com.fuint.business.integral.entity.IntegralOrders;
|
||||
import com.fuint.business.integral.service.IntegralOrdersService;
|
||||
import com.fuint.business.integral.vo.IntegralOrdersRequest;
|
||||
import com.fuint.business.integral.vo.IntegralOrdersVO;
|
||||
import com.fuint.business.order.vo.HangBillVo;
|
||||
import com.fuint.framework.web.BaseController;
|
||||
import com.fuint.framework.web.ResponseObject;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@ -15,6 +16,7 @@ import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -47,6 +49,17 @@ public class IntegralOrdersController extends BaseController {
|
||||
IPage<IntegralOrdersVO> integralOrdersIPage = this.integralOrdersService.queryByPage(pages, integralOrders);
|
||||
return getSuccessResult(integralOrdersIPage);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出积分商城订单
|
||||
* @param response
|
||||
*/
|
||||
@PostMapping("/exportExcel")
|
||||
public void exportExcel(HttpServletResponse response, @RequestBody IntegralOrdersDTO integralOrders) {
|
||||
this.integralOrdersService.export(response, integralOrders);
|
||||
}
|
||||
|
||||
@GetMapping("queryByPageFenxiByZtDz")
|
||||
public ResponseObject queryByPageFenxiByZtDz(@RequestParam(value = "page",defaultValue = "1") Integer page,
|
||||
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
|
||||
|
@ -7,6 +7,7 @@ import com.fuint.business.integral.entity.IntegralDetail;
|
||||
import com.fuint.business.integral.entity.IntegralGift;
|
||||
import com.fuint.business.integral.entity.IntegralOrders;
|
||||
import com.fuint.business.integral.vo.IntegralGiftVO;
|
||||
import com.fuint.business.integral.vo.IntegralOrdersExcel;
|
||||
import com.fuint.business.integral.vo.IntegralOrdersVO;
|
||||
import io.swagger.models.auth.In;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@ -40,6 +41,9 @@ public interface IntegralOrdersMapper {
|
||||
* @return 对象列表
|
||||
*/
|
||||
IPage<IntegralOrdersVO> queryAllByLimit(@Param("page") Page page, @Param("integralOrders") IntegralOrdersDTO integralOrders);
|
||||
|
||||
List<IntegralOrdersExcel> queryAllExcel(@Param("integralOrders") IntegralOrdersDTO integralOrders);
|
||||
|
||||
IPage<IntegralOrdersVO> queryAllByLimitByZtDz(@Param("page") Page page, @Param("integralOrders") IntegralOrdersDTO integralOrders);
|
||||
|
||||
|
||||
|
@ -29,16 +29,16 @@
|
||||
<result property="staffId" column="staff_id" jdbcType="INTEGER"/>
|
||||
<result property="paymentType" column="payment_type" jdbcType="VARCHAR"/>
|
||||
|
||||
<!-- outher-->
|
||||
<!-- outher-->
|
||||
<result property="mobile" column="mobile" jdbcType="VARCHAR"/>
|
||||
<result property="userNo" column="user_no" jdbcType="VARCHAR"/>
|
||||
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||
<result property="giftName" column="gift_name" jdbcType="VARCHAR"/>
|
||||
<result property="coverImage" column="cover_image" jdbcType="VARCHAR"/>
|
||||
|
||||
<!-- add-->
|
||||
<!-- <result property="addrName" column="addrName" jdbcType="VARCHAR"/>-->
|
||||
<!-- <result property="addrMobile" column="addrMobile" jdbcType="VARCHAR"/>-->
|
||||
<!-- add-->
|
||||
<!-- <result property="addrName" column="addrName" jdbcType="VARCHAR"/>-->
|
||||
<!-- <result property="addrMobile" column="addrMobile" jdbcType="VARCHAR"/>-->
|
||||
<result property="address" column="address" jdbcType="VARCHAR"/>
|
||||
<result property="actualPayment" column="actual_payment" jdbcType="VARCHAR"/>
|
||||
<result property="makeChange" column="make_change" jdbcType="VARCHAR"/>
|
||||
@ -47,8 +47,26 @@
|
||||
|
||||
<!--查询单个-->
|
||||
<select id="queryById" resultMap="IntegralOrdersMap">
|
||||
select
|
||||
id, user_id, order_number, gift_id, shipping_type, paid_info, amount, integral, come_on, exchange_quantity, order_status, status, order_type, processing_result, notes, store_id, create_time, update_time, create_by, update_by
|
||||
select id,
|
||||
user_id,
|
||||
order_number,
|
||||
gift_id,
|
||||
shipping_type,
|
||||
paid_info,
|
||||
amount,
|
||||
integral,
|
||||
come_on,
|
||||
exchange_quantity,
|
||||
order_status,
|
||||
status,
|
||||
order_type,
|
||||
processing_result,
|
||||
notes,
|
||||
store_id,
|
||||
create_time,
|
||||
update_time,
|
||||
create_by,
|
||||
update_by
|
||||
from integral_orders
|
||||
where id = #{id}
|
||||
</select>
|
||||
@ -56,42 +74,42 @@
|
||||
<!--查询指定行数据-->
|
||||
<select id="queryAllByLimit" resultMap="IntegralOrdersMap">
|
||||
select
|
||||
io.id,
|
||||
io.user_id,
|
||||
io.order_number,
|
||||
io.gift_id,
|
||||
io.shipping_type,
|
||||
io.amount,
|
||||
io.integral,
|
||||
io.come_on,
|
||||
io.exchange_quantity,
|
||||
io.order_status,
|
||||
io.status,
|
||||
io.order_type,
|
||||
io.processing_result,
|
||||
io.notes,
|
||||
io.store_id,
|
||||
io.create_time,
|
||||
io.update_time,
|
||||
io.courier_companies,
|
||||
io.the_tracking_number,
|
||||
io.actual_payment,
|
||||
io.make_change,
|
||||
io.payment_type,
|
||||
mu.mobile,
|
||||
mu.user_no,
|
||||
mu.name,
|
||||
ig.gift_name,
|
||||
ig.cover_image,
|
||||
ea.name addrName,
|
||||
ea.mobile addrMobile,
|
||||
ea.address
|
||||
io.id,
|
||||
io.user_id,
|
||||
io.order_number,
|
||||
io.gift_id,
|
||||
io.shipping_type,
|
||||
io.amount,
|
||||
io.integral,
|
||||
io.come_on,
|
||||
io.exchange_quantity,
|
||||
io.order_status,
|
||||
io.status,
|
||||
io.order_type,
|
||||
io.processing_result,
|
||||
io.notes,
|
||||
io.store_id,
|
||||
io.create_time,
|
||||
io.update_time,
|
||||
io.courier_companies,
|
||||
io.the_tracking_number,
|
||||
io.actual_payment,
|
||||
io.make_change,
|
||||
io.payment_type,
|
||||
mu.mobile,
|
||||
mu.user_no,
|
||||
mu.name,
|
||||
ig.gift_name,
|
||||
ig.cover_image,
|
||||
ea.name addrName,
|
||||
ea.mobile addrMobile,
|
||||
ea.address
|
||||
from integral_orders io
|
||||
left join mt_user mu ON io.user_id = mu.id
|
||||
left join integral_gift ig ON io.gift_id = ig.id
|
||||
left join mt_user_express_address ea ON io.address_id = ea.id
|
||||
<where>
|
||||
io.store_id = #{integralOrders.storeId}
|
||||
io.store_id = #{integralOrders.storeId}
|
||||
|
||||
<if test="integralOrders.giftName != null">
|
||||
and ig.gift_name like CONCAT ('%',#{integralOrders.giftName},'%')
|
||||
@ -156,36 +174,36 @@
|
||||
<!--查询指定行数据-->
|
||||
<select id="queryAllByLimitByZtDz" resultMap="IntegralOrdersMap">
|
||||
select
|
||||
io.id,
|
||||
io.user_id,
|
||||
io.order_number,
|
||||
io.gift_id,
|
||||
io.shipping_type,
|
||||
io.amount,
|
||||
io.integral,
|
||||
io.come_on,
|
||||
io.exchange_quantity,
|
||||
io.order_status,
|
||||
io.status,
|
||||
io.order_type,
|
||||
io.processing_result,
|
||||
io.notes,
|
||||
io.store_id,
|
||||
io.create_time,
|
||||
io.update_time,
|
||||
io.courier_companies,
|
||||
io.the_tracking_number,
|
||||
io.actual_payment,
|
||||
io.make_change,
|
||||
io.payment_type,
|
||||
mu.mobile,
|
||||
mu.user_no,
|
||||
mu.name,
|
||||
ig.gift_name,
|
||||
ig.cover_image,
|
||||
ea.name addrName,
|
||||
ea.mobile addrMobile,
|
||||
ea.address
|
||||
io.id,
|
||||
io.user_id,
|
||||
io.order_number,
|
||||
io.gift_id,
|
||||
io.shipping_type,
|
||||
io.amount,
|
||||
io.integral,
|
||||
io.come_on,
|
||||
io.exchange_quantity,
|
||||
io.order_status,
|
||||
io.status,
|
||||
io.order_type,
|
||||
io.processing_result,
|
||||
io.notes,
|
||||
io.store_id,
|
||||
io.create_time,
|
||||
io.update_time,
|
||||
io.courier_companies,
|
||||
io.the_tracking_number,
|
||||
io.actual_payment,
|
||||
io.make_change,
|
||||
io.payment_type,
|
||||
mu.mobile,
|
||||
mu.user_no,
|
||||
mu.name,
|
||||
ig.gift_name,
|
||||
ig.cover_image,
|
||||
ea.name addrName,
|
||||
ea.mobile addrMobile,
|
||||
ea.address
|
||||
from integral_orders io
|
||||
left join mt_user mu ON io.user_id = mu.id
|
||||
left join integral_gift ig ON io.gift_id = ig.id
|
||||
@ -295,7 +313,7 @@
|
||||
left join integral_gift ig ON io.gift_id = ig.id
|
||||
left join mt_user_express_address ea ON io.address_id = ea.id
|
||||
<where>
|
||||
io.chain_store_id = #{integralOrders.chainStoreId}
|
||||
io.chain_store_id = #{integralOrders.chainStoreId}
|
||||
<if test="integralOrders.giftName != null">
|
||||
and ig.gift_name like CONCAT ('%',#{integralOrders.giftName},'%')
|
||||
</if>
|
||||
@ -307,10 +325,11 @@
|
||||
</if>
|
||||
<if test="integralOrders.params.endTime != null and integralOrders.params.endTime != ''">
|
||||
and date_format(io.create_time,'%y%m%d') <= date_format(#{integralOrders.params.endTime},'%y%m%d')
|
||||
</if>
|
||||
</if>
|
||||
<if test="integralOrders.orderStatus != null and integralOrders.orderStatus != '' and integralOrders.orderStatus != 0 ">
|
||||
and (
|
||||
(#{integralOrders.orderStatus} = 1 and (io.order_status = '待处理' or io.order_status = '待发货' or io.order_status = '已发货')) or
|
||||
(#{integralOrders.orderStatus} = 1 and (io.order_status = '待处理' or io.order_status = '待发货' or
|
||||
io.order_status = '已发货')) or
|
||||
(#{integralOrders.orderStatus} = 2 and (io.order_status = '已完成' )) or
|
||||
(#{integralOrders.orderStatus} = 3 and (io.order_status = '已退款' or io.order_status = '已拒绝')) or
|
||||
(#{integralOrders.orderStatus} = 4 and io.order_status = '未支付')
|
||||
@ -336,7 +355,7 @@
|
||||
order by io.create_time desc
|
||||
|
||||
</select>
|
||||
<!-- io.store_id = #{integralOrders.storeId}-->
|
||||
<!-- io.store_id = #{integralOrders.storeId}-->
|
||||
|
||||
<!--统计总行数-->
|
||||
<select id="count" resultType="java.lang.Long">
|
||||
@ -407,13 +426,13 @@
|
||||
</select>
|
||||
<select id="statistics" resultType="java.util.Map">
|
||||
select count(0) num,
|
||||
sum(io.exchange_quantity) exchangeQuantity,
|
||||
sum(io.integral) integral,
|
||||
sum(io.amount) amount,
|
||||
SUM(CASE WHEN io.order_status IN ('待处理', '待发货') THEN 1 ELSE 0 END) AS await,
|
||||
SUM(CASE WHEN io.order_status IN ('已完成', '已发货') THEN 1 ELSE 0 END) AS dispose,
|
||||
SUM(CASE WHEN io.order_status IN ('已拒绝', '已退款') THEN 1 ELSE 0 END) AS refuse
|
||||
from integral_orders io
|
||||
sum(io.exchange_quantity) exchangeQuantity,
|
||||
sum(io.integral) integral,
|
||||
sum(io.amount) amount,
|
||||
SUM(CASE WHEN io.order_status IN ('待处理', '待发货') THEN 1 ELSE 0 END) AS await,
|
||||
SUM(CASE WHEN io.order_status IN ('已完成', '已发货') THEN 1 ELSE 0 END) AS dispose,
|
||||
SUM(CASE WHEN io.order_status IN ('已拒绝', '已退款') THEN 1 ELSE 0 END) AS refuse
|
||||
from integral_orders io
|
||||
left join mt_user mu ON io.user_id = mu.id
|
||||
left join integral_gift ig ON io.gift_id = ig.id
|
||||
left join mt_user_express_address ea ON io.address_id = ea.id
|
||||
@ -474,23 +493,39 @@
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into integral_orders(user_id, order_number, gift_id, shipping_type, paid_info, amount, integral, come_on, exchange_quantity, order_status, status, order_type, processing_result, notes, store_id, create_time, update_time, create_by, update_by,staff_id)
|
||||
values (#{userId}, #{orderNumber}, #{giftId}, #{shippingType}, #{paidInfo}, #{amount}, #{integral}, #{comeOn}, #{exchangeQuantity}, #{orderStatus}, #{status}, #{orderType}, #{processingResult}, #{notes}, #{storeId}, #{createTime}, #{updateTime}, #{createBy}, #{updateBy},#{staffId})
|
||||
insert into integral_orders(user_id, order_number, gift_id, shipping_type, paid_info, amount, integral, come_on,
|
||||
exchange_quantity, order_status, status, order_type, processing_result, notes,
|
||||
store_id, create_time, update_time, create_by, update_by, staff_id)
|
||||
values (#{userId}, #{orderNumber}, #{giftId}, #{shippingType}, #{paidInfo}, #{amount}, #{integral}, #{comeOn},
|
||||
#{exchangeQuantity}, #{orderStatus}, #{status}, #{orderType}, #{processingResult}, #{notes}, #{storeId},
|
||||
#{createTime}, #{updateTime}, #{createBy}, #{updateBy}, #{staffId})
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into integral_orders(user_id, order_number, gift_id, shipping_type, paid_info, amount, integral, come_on, exchange_quantity, order_status, status, order_type, processing_result, notes, store_id, create_time, update_time, create_by, update_by,staff_id,payment_type,chain_store_id,actual_payment,make_change)
|
||||
insert into integral_orders(user_id, order_number, gift_id, shipping_type, paid_info, amount, integral, come_on,
|
||||
exchange_quantity, order_status, status, order_type, processing_result, notes, store_id, create_time,
|
||||
update_time, create_by, update_by,staff_id,payment_type,chain_store_id,actual_payment,make_change)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.userId}, #{entity.orderNumber}, #{entity.giftId}, #{entity.shippingType}, #{entity.paidInfo}, #{entity.amount}, #{entity.integral}, #{entity.comeOn}, #{entity.exchangeQuantity}, #{entity.orderStatus}, #{entity.status}, #{entity.orderType}, #{entity.processingResult}, #{entity.notes}, #{entity.storeId}, NOW(), NOW(), #{entity.createBy}, #{entity.updateBy},#{entity.staffId},#{entity.paymentType},#{entity.chainStoreId} ,#{entity.actualPayment},#{entity.makeChange})
|
||||
(#{entity.userId}, #{entity.orderNumber}, #{entity.giftId}, #{entity.shippingType}, #{entity.paidInfo},
|
||||
#{entity.amount}, #{entity.integral}, #{entity.comeOn}, #{entity.exchangeQuantity}, #{entity.orderStatus},
|
||||
#{entity.status}, #{entity.orderType}, #{entity.processingResult}, #{entity.notes}, #{entity.storeId},
|
||||
NOW(), NOW(), #{entity.createBy},
|
||||
#{entity.updateBy},#{entity.staffId},#{entity.paymentType},#{entity.chainStoreId}
|
||||
,#{entity.actualPayment},#{entity.makeChange})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into integral_orders(user_id, order_number, gift_id, shipping_type, paid_info, amount, integral, come_on, exchange_quantity, order_status, status, order_type, processing_result, notes, store_id, create_time, update_time, create_by, update_by)
|
||||
insert into integral_orders(user_id, order_number, gift_id, shipping_type, paid_info, amount, integral, come_on,
|
||||
exchange_quantity, order_status, status, order_type, processing_result, notes, store_id, create_time,
|
||||
update_time, create_by, update_by)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.userId}, #{entity.orderNumber}, #{entity.giftId}, #{entity.shippingType}, #{entity.paidInfo}, #{entity.amount}, #{entity.integral}, #{entity.comeOn}, #{entity.exchangeQuantity}, #{entity.orderStatus}, #{entity.status}, #{entity.orderType}, #{entity.processingResult}, #{entity.notes}, #{entity.storeId}, #{entity.createTime}, #{entity.updateTime}, #{entity.createBy}, #{entity.updateBy})
|
||||
(#{entity.userId}, #{entity.orderNumber}, #{entity.giftId}, #{entity.shippingType}, #{entity.paidInfo},
|
||||
#{entity.amount}, #{entity.integral}, #{entity.comeOn}, #{entity.exchangeQuantity}, #{entity.orderStatus},
|
||||
#{entity.status}, #{entity.orderType}, #{entity.processingResult}, #{entity.notes}, #{entity.storeId},
|
||||
#{entity.createTime}, #{entity.updateTime}, #{entity.createBy}, #{entity.updateBy})
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
user_id = values(user_id),
|
||||
@ -584,19 +619,29 @@
|
||||
|
||||
<!--通过主键删除-->
|
||||
<delete id="deleteById">
|
||||
delete from integral_orders where id = #{id}
|
||||
delete
|
||||
from integral_orders
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<select id="getListByOrderNo" resultType="com.fuint.business.integral.entity.IntegralOrders">
|
||||
select * from integral_orders where order_number = #{orderNumber} and store_id = #{storeId}
|
||||
select *
|
||||
from integral_orders
|
||||
where order_number = #{orderNumber}
|
||||
and store_id = #{storeId}
|
||||
</select>
|
||||
|
||||
<select id="getListByOrderNo2" resultType="com.fuint.business.integral.entity.IntegralOrders">
|
||||
select * from integral_orders where order_number = #{orderNumber}
|
||||
select *
|
||||
from integral_orders
|
||||
where order_number = #{orderNumber}
|
||||
</select>
|
||||
|
||||
<select id="enquiryForCollection" resultType="com.fuint.business.integral.entity.IntegralOrders">
|
||||
select * from integral_orders where gift_id = #{giftId} and user_id = #{userId}
|
||||
select *
|
||||
from integral_orders
|
||||
where gift_id = #{giftId}
|
||||
and user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<update id="editPayStatus">
|
||||
@ -607,7 +652,9 @@
|
||||
|
||||
</update>
|
||||
<update id="updatePaymentType">
|
||||
update integral_orders set processing_status = '1' where order_number = #{orderNumber}
|
||||
update integral_orders
|
||||
set processing_status = '1'
|
||||
where order_number = #{orderNumber}
|
||||
</update>
|
||||
|
||||
<select id="queryIntegralOrdersByOrderNo">
|
||||
@ -633,11 +680,11 @@
|
||||
</select>
|
||||
<select id="queryByPageFenxiByZtDz" resultType="com.fuint.business.integral.vo.IntegralOrdersVO">
|
||||
select
|
||||
store_id storeId,
|
||||
sum(paid_info) paidInfo,
|
||||
count(*) count,
|
||||
sum(exchange_quantity) exchangeQuantity,
|
||||
sum(integral) integral
|
||||
store_id storeId,
|
||||
sum(paid_info) paidInfo,
|
||||
count(*) count,
|
||||
sum(exchange_quantity) exchangeQuantity,
|
||||
sum(integral) integral
|
||||
from integral_orders
|
||||
<where>
|
||||
<if test="order.storeIds != null">
|
||||
@ -654,29 +701,27 @@
|
||||
</if>
|
||||
</where>
|
||||
group by
|
||||
store_id
|
||||
store_id
|
||||
|
||||
</select>
|
||||
<select id="getInfoByStoreId" resultType="com.fuint.business.integral.vo.IntegralOrdersVO">
|
||||
select
|
||||
ig.gift_name giftName,
|
||||
sum(io.exchange_quantity) exchangeQuantityBy,
|
||||
sum(io.paid_info) paidInfoBy,
|
||||
sum(io.integral) integralBy
|
||||
select ig.gift_name giftName,
|
||||
sum(io.exchange_quantity) exchangeQuantityBy,
|
||||
sum(io.paid_info) paidInfoBy,
|
||||
sum(io.integral) integralBy
|
||||
from integral_orders io
|
||||
left join integral_gift ig on io.gift_id = ig.id
|
||||
left join integral_gift ig on io.gift_id = ig.id
|
||||
|
||||
group by io.gift_id
|
||||
limit 1
|
||||
group by io.gift_id limit 1
|
||||
</select>
|
||||
<!-- where-->
|
||||
<!-- io.store_id = #{integralOrders.storeId}-->
|
||||
<!-- where-->
|
||||
<!-- io.store_id = #{integralOrders.storeId}-->
|
||||
<select id="getIntFenxiDataByZtDz" resultType="java.util.Map">
|
||||
select
|
||||
sum(paid_info) paidInfo,
|
||||
count(*) count,
|
||||
sum(exchange_quantity) exchangeQuantity,
|
||||
sum(integral) integrals
|
||||
sum(paid_info) paidInfo,
|
||||
count(*) count,
|
||||
sum(exchange_quantity) exchangeQuantity,
|
||||
sum(integral) integrals
|
||||
from integral_orders
|
||||
|
||||
<where>
|
||||
@ -704,10 +749,10 @@ limit 1
|
||||
sum(io.amount) amount,
|
||||
gift_name giftName
|
||||
from integral_orders io
|
||||
left join integral_gift ig on io.gift_id = ig.id
|
||||
left join integral_gift ig on io.gift_id = ig.id
|
||||
|
||||
<where>
|
||||
io.store_id = #{integralOrders.storeId}
|
||||
io.store_id = #{integralOrders.storeId}
|
||||
<if test="integralOrders.params.beginTime != null and integralOrders.params.beginTime != ''"><!-- 开始时间检索 -->
|
||||
and date_format(io.create_time,'%y%m%d') >= date_format(#{integralOrders.params.beginTime},'%y%m%d')
|
||||
</if>
|
||||
@ -725,11 +770,11 @@ limit 1
|
||||
sum(io.integral) integrals
|
||||
|
||||
from integral_orders io
|
||||
left join integral_gift ig on io.gift_id = ig.id
|
||||
left join integral_gift ig on io.gift_id = ig.id
|
||||
|
||||
<where>
|
||||
|
||||
io.store_id = #{integralOrders.storeId}
|
||||
io.store_id = #{integralOrders.storeId}
|
||||
<if test="integralOrders.params.beginTime != null and integralOrders.params.beginTime != ''"><!-- 开始时间检索 -->
|
||||
and date_format(io.create_time,'%y%m%d') >= date_format(#{integralOrders.params.beginTime},'%y%m%d')
|
||||
</if>
|
||||
@ -738,6 +783,105 @@ limit 1
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="queryAllExcel" resultType="com.fuint.business.integral.vo.IntegralOrdersExcel">
|
||||
select
|
||||
io.id,
|
||||
io.user_id,
|
||||
io.order_number,
|
||||
io.gift_id,
|
||||
io.shipping_type,
|
||||
io.amount,
|
||||
io.integral,
|
||||
io.come_on,
|
||||
io.exchange_quantity,
|
||||
io.order_status,
|
||||
io.status,
|
||||
io.order_type,
|
||||
io.processing_result,
|
||||
io.notes,
|
||||
io.store_id,
|
||||
io.create_time,
|
||||
io.update_time,
|
||||
io.courier_companies,
|
||||
io.the_tracking_number,
|
||||
io.actual_payment,
|
||||
io.make_change,
|
||||
io.payment_type,
|
||||
mu.mobile,
|
||||
mu.user_no,
|
||||
mu.name,
|
||||
ig.gift_name,
|
||||
ig.cover_image,
|
||||
ea.name addrName,
|
||||
ea.mobile addrMobile,
|
||||
ea.address
|
||||
from integral_orders io
|
||||
left join mt_user mu ON io.user_id = mu.id
|
||||
left join integral_gift ig ON io.gift_id = ig.id
|
||||
left join mt_user_express_address ea ON io.address_id = ea.id
|
||||
<where>
|
||||
io.store_id = #{integralOrders.storeId}
|
||||
|
||||
<if test="integralOrders.giftName != null">
|
||||
and ig.gift_name like CONCAT ('%',#{integralOrders.giftName},'%')
|
||||
</if>
|
||||
<if test="integralOrders.mobile != null">
|
||||
and mu.mobile like CONCAT ('%',#{integralOrders.mobile},'%')
|
||||
</if>
|
||||
<if test="integralOrders.params.beginTime != null and integralOrders.params.beginTime != ''">
|
||||
and date_format(io.create_time,'%y%m%d') >= date_format(#{integralOrders.params.beginTime},'%y%m%d')
|
||||
</if>
|
||||
<if test="integralOrders.params.endTime != null and integralOrders.params.endTime != ''">
|
||||
and date_format(io.create_time,'%y%m%d') <= date_format(#{integralOrders.params.endTime},'%y%m%d')
|
||||
</if>
|
||||
<if test="integralOrders.orderNumber != null and integralOrders.orderNumber != ''">
|
||||
and io.order_number like CONCAT ('%',#{integralOrders.orderNumber},'%')
|
||||
</if>
|
||||
<if test="integralOrders.shippingType != null and integralOrders.shippingType != ''">
|
||||
and io.shipping_type = #{integralOrders.shippingType}
|
||||
</if>
|
||||
|
||||
<if test="integralOrders.orderStatus != null and integralOrders.orderStatus != '' and integralOrders.orderStatus != 0 ">
|
||||
and (
|
||||
(#{integralOrders.orderStatus} = 1 and (io.order_status = '待处理' or io.order_status = '待发货')) or
|
||||
(#{integralOrders.orderStatus} = 2 and (io.order_status = '已完成' or io.order_status = '已发货')) or
|
||||
(#{integralOrders.orderStatus} = 3 and (io.order_status = '已退款' or io.order_status = '已拒绝')) or
|
||||
(#{integralOrders.orderStatus} = 4 and io.order_status = '未支付')
|
||||
)
|
||||
</if>
|
||||
<if test="integralOrders.id != null">
|
||||
and io.id = #{integralOrders.id}
|
||||
</if>
|
||||
<if test="integralOrders.userId != null">
|
||||
and io.user_id = #{integralOrders.userId}
|
||||
</if>
|
||||
<if test="integralOrders.giftId != null">
|
||||
and io.gift_id = #{integralOrders.giftId}
|
||||
</if>
|
||||
<if test="integralOrders.exchangeQuantity != null">
|
||||
and io.exchange_quantity = #{integralOrders.exchangeQuantity}
|
||||
</if>
|
||||
|
||||
<if test="integralOrders.status != null and integralOrders.status != ''">
|
||||
and io.status = #{integralOrders.status}
|
||||
</if>
|
||||
<if test="integralOrders.orderType != null">
|
||||
and io.order_type = #{integralOrders.orderType}
|
||||
</if>
|
||||
<if test="integralOrders.processingResult != null and integralOrders.processingResult != ''">
|
||||
and io.processing_result = #{integralOrders.processingResult}
|
||||
</if>
|
||||
<if test="integralOrders.createTime != null">
|
||||
and io.create_time = #{integralOrders.createTime}
|
||||
</if>
|
||||
<if test="integralOrders.updateTime != null">
|
||||
and io.update_time = #{integralOrders.updateTime}
|
||||
</if>
|
||||
</where>
|
||||
order by io.create_time desc
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
@ -7,9 +7,11 @@ import com.fuint.business.integral.entity.IntegralDetail;
|
||||
import com.fuint.business.integral.entity.IntegralOrders;
|
||||
import com.fuint.business.integral.vo.IntegralOrdersRequest;
|
||||
import com.fuint.business.integral.vo.IntegralOrdersVO;
|
||||
import com.fuint.business.order.vo.HangBillVo;
|
||||
import io.swagger.models.auth.In;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -43,6 +45,8 @@ public interface IntegralOrdersService {
|
||||
Map<String, String> getIntFenxiDataByZtDz(IntegralOrdersDTO integralOrders);
|
||||
|
||||
|
||||
void export(HttpServletResponse response, IntegralOrdersDTO integralOrders);
|
||||
|
||||
IPage<IntegralOrdersVO> queryByPageUni(@Param("page") Page page, @Param("integralGift") IntegralOrdersDTO integralOrders);
|
||||
|
||||
|
||||
|
@ -2,6 +2,7 @@ package com.fuint.business.integral.service.impl;
|
||||
|
||||
import cn.hutool.core.util.HashUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.fuint.api.fuyou.entity.MerchantConfig;
|
||||
import com.fuint.api.fuyou.entity.ReceiveParameter;
|
||||
@ -21,6 +22,7 @@ import com.fuint.business.integral.service.IntegralOrdersService;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
import com.fuint.business.integral.vo.IntegralGiftVO;
|
||||
import com.fuint.business.integral.vo.IntegralOrdersExcel;
|
||||
import com.fuint.business.integral.vo.IntegralOrdersRequest;
|
||||
import com.fuint.business.integral.vo.IntegralOrdersVO;
|
||||
import com.fuint.business.marketingActivity.cardExchange.entity.CardExchangeRecord;
|
||||
@ -33,6 +35,7 @@ import com.fuint.business.member.entity.LJStaff;
|
||||
import com.fuint.business.member.mapper.LJStaffMapper;
|
||||
import com.fuint.business.order.entity.AllOrderInfo;
|
||||
import com.fuint.business.order.service.AllOrderInfoService;
|
||||
import com.fuint.business.order.vo.Excel.HangBillExcel;
|
||||
import com.fuint.business.store.entity.MtStore;
|
||||
import com.fuint.business.store.mapper.MtStoreMapper;
|
||||
import com.fuint.business.userManager.entity.UserBalance;
|
||||
@ -43,6 +46,9 @@ import com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.util.RedisLock;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import com.fuint.system.dept.mapper.SysDeptMapper;
|
||||
import com.fuint.system.dict.entity.SysDictData;
|
||||
import com.fuint.system.dict.entity.SysDictType;
|
||||
import com.fuint.system.dict.service.ISysDictTypeService;
|
||||
import io.swagger.models.auth.In;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -52,6 +58,7 @@ import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
@ -79,6 +86,9 @@ public class IntegralOrdersServiceImpl implements IntegralOrdersService {
|
||||
IntegralDetailService integralDetailService;
|
||||
@Resource
|
||||
IntegralGiftService integralGiftService;
|
||||
@Autowired
|
||||
private ISysDictTypeService iSysDictTypeService;
|
||||
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
@ -177,12 +187,48 @@ public class IntegralOrdersServiceImpl implements IntegralOrdersService {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void export(HttpServletResponse response, IntegralOrdersDTO integralOrders) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
Integer storeId = nowAccountInfo.getStoreId();
|
||||
integralOrders.setStoreId(storeId);
|
||||
|
||||
List<IntegralOrdersExcel> integralOrdersExcels = integralOrdersDao.queryAllExcel(integralOrders);
|
||||
List<SysDictData> payStatus = iSysDictTypeService.selectDictDataByType("pay_status");
|
||||
|
||||
for (IntegralOrdersExcel i : integralOrdersExcels) {
|
||||
for (SysDictData p : payStatus) {
|
||||
if (p.getDictValue().equals(i.getStatus())) {
|
||||
i.setStatus(p.getDictLabel());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 设置文件名字
|
||||
String fileName = "积分" + System.currentTimeMillis() + ".xlsx";
|
||||
// 设置响应头信息
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
response.setHeader("Content-disposition", "attachment;filename=demo.xlsx");
|
||||
|
||||
try {
|
||||
// 写入文件数据
|
||||
EasyExcel.write(response.getOutputStream(), IntegralOrdersExcel.class).sheet("download").doWrite(integralOrdersExcels);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IPage<IntegralOrdersVO> queryByPageUni(@Param("page") Page page, @Param("integralOrders") IntegralOrdersDTO integralOrders) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
integralOrders.setUserId(nowAccountInfo.getId());
|
||||
return integralOrdersDao.queryByPageUni(page, integralOrders);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<IntegralOrdersVO> queryByBuy(@Param("page") Page page, @Param("integralOrders") IntegralOrdersDTO integralOrders) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
@ -244,6 +290,7 @@ public class IntegralOrdersServiceImpl implements IntegralOrdersService {
|
||||
|
||||
@Resource
|
||||
AllOrderInfoService allOrderInfoService;
|
||||
|
||||
/**
|
||||
* 插入订单状态 并进行支付
|
||||
*
|
||||
@ -298,11 +345,11 @@ public class IntegralOrdersServiceImpl implements IntegralOrdersService {
|
||||
integralOrdersDao.insertBatch(integralOrdersList.getIntegralOrdersList());
|
||||
|
||||
if ("CASH".equals(integralOrdersList.getPaymentType()) && integralOrdersList.getAllAmout().compareTo(0.0) > 0) {
|
||||
try{
|
||||
AllOrderInfo allOrderInfo = getAllOrderInfo(integralOrdersList,orderNo);
|
||||
try {
|
||||
AllOrderInfo allOrderInfo = getAllOrderInfo(integralOrdersList, orderNo);
|
||||
allOrderInfo.setPaymentChannel("现金支付");
|
||||
allOrderInfoService.insertAllOrderInfo(allOrderInfo);
|
||||
}catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@ -319,7 +366,7 @@ public class IntegralOrdersServiceImpl implements IntegralOrdersService {
|
||||
// Integer allAmount = (int) (integralOrdersList.getAllAmout()*100);
|
||||
System.out.println("金额" + (int) (integralOrdersList.getAllAmout() * 100));
|
||||
Integer allAmount = (int) (0.01 * 100);
|
||||
MerchantConfig merchantConfig = merchantConfigService.selectMeChByIdIsUse(nowAccountInfo.getStoreId(),"3",null);
|
||||
MerchantConfig merchantConfig = merchantConfigService.selectMeChByIdIsUse(nowAccountInfo.getStoreId(), "3", null);
|
||||
// 处理支付需要的数据
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("authCode", integralOrdersList.getAuthCode());
|
||||
@ -344,8 +391,7 @@ public class IntegralOrdersServiceImpl implements IntegralOrdersService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static AllOrderInfo getAllOrderInfo(IntegralOrdersRequest integralOrdersRequest,String orderNo) {
|
||||
private static AllOrderInfo getAllOrderInfo(IntegralOrdersRequest integralOrdersRequest, String orderNo) {
|
||||
List<IntegralOrders> integralOrdersList = integralOrdersRequest.getIntegralOrdersList();
|
||||
AllOrderInfo allOrderInfo = new AllOrderInfo();
|
||||
|
||||
@ -387,6 +433,7 @@ public class IntegralOrdersServiceImpl implements IntegralOrdersService {
|
||||
LJGoodsService ljGoodsService;
|
||||
@Autowired
|
||||
private RedisLock redisLock;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public IntegralOrders checkTheStatusOfYourPaymentByIntegral(String orderNo) throws Exception {
|
||||
@ -397,9 +444,9 @@ public class IntegralOrdersServiceImpl implements IntegralOrdersService {
|
||||
List<IntegralOrders> listByOrderNo = integralOrdersDao.getListByOrderNo2(orderNo);
|
||||
|
||||
// 加锁 processing_status
|
||||
String lockKey = "IntegralOrders"+orderNo;
|
||||
String lockKey = "IntegralOrders" + orderNo;
|
||||
Boolean isLock = redisLock.tryLock(lockKey, 5000, TimeUnit.MILLISECONDS);
|
||||
if (isLock && "paid".equals(listByOrderNo.get(0).getStatus()) && "0".equals(listByOrderNo.get(0).getProcessingStatus()) ) {
|
||||
if (isLock && "paid".equals(listByOrderNo.get(0).getStatus()) && "0".equals(listByOrderNo.get(0).getProcessingStatus())) {
|
||||
// 查询用户信息
|
||||
LJUserVo ljUserVos = ljUserMapper.selectAllInfoById2(listByOrderNo.get(0).getUserId(), listByOrderNo.get(0).getChainStoreId());
|
||||
// 查询用户信息
|
||||
@ -431,7 +478,7 @@ public class IntegralOrdersServiceImpl implements IntegralOrdersService {
|
||||
cardExchangeRecord.setStatus("0");
|
||||
cardExchangeRecord.setExchangeFrom("积分兑换");
|
||||
cardExchangeRecordService.addCardExchangeRecord(cardExchangeRecord);
|
||||
}else if (integralGift.getGiftType().equals("优惠券")) {
|
||||
} else if (integralGift.getGiftType().equals("优惠券")) {
|
||||
// 优惠卷处理
|
||||
CardFavorableRecord cardFavorableRecord = new CardFavorableRecord();
|
||||
cardFavorableRecord.setCardFavorableId(integralGift.getCouponId());
|
||||
@ -442,7 +489,7 @@ public class IntegralOrdersServiceImpl implements IntegralOrdersService {
|
||||
cardFavorableRecord.setStatus("0");
|
||||
cardFavorableRecord.setExchangeFrom("积分兑换");
|
||||
cardFavorableRecordService.addCardFavorableRecord(cardFavorableRecord);
|
||||
}else if(integralGift.getGiftType().equals("实物商品")) {
|
||||
} else if (integralGift.getGiftType().equals("实物商品")) {
|
||||
// 修改商品库存并增加记录
|
||||
// LJGoodsDto goods = new LJGoodsDto();
|
||||
// goods.setId(integralGift.getGoodsId());
|
||||
@ -453,7 +500,7 @@ public class IntegralOrdersServiceImpl implements IntegralOrdersService {
|
||||
}
|
||||
|
||||
// 处理积分库存
|
||||
integralGiftService.updateInventoryByLock(integralOrders.getGiftId(),integralOrders.getExchangeQuantity());
|
||||
integralGiftService.updateInventoryByLock(integralOrders.getGiftId(), integralOrders.getExchangeQuantity());
|
||||
|
||||
}
|
||||
|
||||
@ -476,7 +523,7 @@ public class IntegralOrdersServiceImpl implements IntegralOrdersService {
|
||||
|
||||
redisLock.unlock(lockKey);
|
||||
|
||||
}else {
|
||||
} else {
|
||||
redisLock.unlock(lockKey);
|
||||
|
||||
}
|
||||
@ -528,7 +575,7 @@ public class IntegralOrdersServiceImpl implements IntegralOrdersService {
|
||||
|
||||
// 首先判断是否足够积分
|
||||
LJUserVo ljUserVos = ljUserMapper.selectAllInfoById2(nowAccountInfo.getId(), integralOrdersList.getChainStoreId());
|
||||
if (Double.valueOf(ljUserVos.getPoints()).compareTo(integralOrdersList.getAllPoints()) <0 ) {
|
||||
if (Double.valueOf(ljUserVos.getPoints()).compareTo(integralOrdersList.getAllPoints()) < 0) {
|
||||
integralOrdersList.getIntegralOrdersList().get(0).setStatus("un");
|
||||
applet.put("code", "error");
|
||||
applet.put("msg", "积分不足");
|
||||
@ -657,8 +704,8 @@ public class IntegralOrdersServiceImpl implements IntegralOrdersService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IntegralOrders queryIntegralOrdersByOrderNo(String orderNo,Integer storeId) {
|
||||
return integralOrdersDao.queryIntegralOrdersByOrderNo(orderNo,storeId);
|
||||
public IntegralOrders queryIntegralOrdersByOrderNo(String orderNo, Integer storeId) {
|
||||
return integralOrdersDao.queryIntegralOrdersByOrderNo(orderNo, storeId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -0,0 +1,47 @@
|
||||
package com.fuint.business.integral.vo;
|
||||
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
// 积分商城订单 导出Excel
|
||||
@Data
|
||||
public class IntegralOrdersExcel {
|
||||
|
||||
@ExcelProperty("员工姓名")
|
||||
@ColumnWidth(15)
|
||||
private String mobile;
|
||||
|
||||
@ExcelProperty("订单号")
|
||||
@ColumnWidth(15)
|
||||
private String orderNumber;
|
||||
|
||||
@ExcelProperty("商品名称")
|
||||
@ColumnWidth(15)
|
||||
private String giftName;
|
||||
|
||||
@ExcelProperty("数量")
|
||||
@ColumnWidth(15)
|
||||
private Integer exchangeQuantity;
|
||||
|
||||
@ExcelProperty("积分")
|
||||
@ColumnWidth(15)
|
||||
private Double integral;
|
||||
|
||||
@ExcelProperty("支付金额")
|
||||
@ColumnWidth(15)
|
||||
private Double amount;
|
||||
|
||||
@ExcelProperty("支付状态")
|
||||
@ColumnWidth(15)
|
||||
private String status;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
|
||||
@ExcelProperty("创建时间")
|
||||
@ColumnWidth(15)
|
||||
private Date createTime;
|
||||
}
|
@ -111,7 +111,7 @@
|
||||
ORDER BY combined_result.createTime desc
|
||||
</select>
|
||||
<select id="selectListExport"
|
||||
resultType="com.fuint.business.marketingActivity.cardValue.vo.Excel.CardValueRecordExcel">
|
||||
resultType="com.fuint.business.marketingActivity.cardValue.vo.Excel.CardValueRecordExcel" parameterType="com.fuint.business.marketingActivity.cardValue.entity.CardValueRecord">
|
||||
select
|
||||
name name,
|
||||
mobile mobile,
|
||||
@ -154,7 +154,12 @@
|
||||
<if test="cardValueRecord.paymentType != null">
|
||||
and payment_type = #{cardValueRecord.paymentType}
|
||||
</if>
|
||||
|
||||
<if test="cardValueRecord.params.beginTime != null and cardValueRecord.params.beginTime != ''"><!-- 开始时间检索 -->
|
||||
and date_format(create_time,'%y%m%d') >= date_format(#{cardValueRecord.params.beginTime},'%y%m%d')
|
||||
</if>
|
||||
<if test="cardValueRecord.params.endTime != null and cardValueRecord.params.endTime != ''"><!-- 结束时间检索 -->
|
||||
and date_format(create_time,'%y%m%d') <= date_format(#{cardValueRecord.params.endTime},'%y%m%d')
|
||||
</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user