This commit is contained in:
cun-nan 2024-01-20 11:48:52 +08:00
parent 3cc44f8272
commit fcb8ddb9ca
10 changed files with 153 additions and 86 deletions

View File

@ -49,12 +49,15 @@ import com.fuint.business.petrolStationManagement.entity.OilName;
import com.fuint.business.petrolStationManagement.mapper.OilNameMapper;
import com.fuint.business.petrolStationManagement.mapper.OilNumberMapper;
import com.fuint.business.petrolStationManagement.service.OilNameService;
import com.fuint.business.storeInformation.entity.LJStore;
import com.fuint.business.storeInformation.service.ILJStoreService;
import com.fuint.business.userManager.entity.ChainStoreConfig;
import com.fuint.business.userManager.entity.LJUser;
import com.fuint.business.userManager.entity.LJUserGrade;
import com.fuint.business.userManager.entity.UserBalance;
import com.fuint.business.userManager.mapper.LJUserGradeMapper;
import com.fuint.business.userManager.mapper.LJUserMapper;
import com.fuint.business.userManager.service.ChainStoreConfigService;
import com.fuint.business.userManager.service.LJUserGradeService;
import com.fuint.business.userManager.service.LJUserService;
import com.fuint.business.userManager.service.UserBalanceService;
@ -65,6 +68,7 @@ import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -116,6 +120,9 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
private OilNameMapper oilNameMapper;
@Resource
private OilNumberMapper oilNumberMapper;
@Autowired
@Lazy
private ChainStoreConfigService chainStoreConfigService;
/**
* 分页查询所有
* @param
@ -645,6 +652,11 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
String gradeId = paymentActiveDTO.getMtUserLevel().toString();
if (StringUtils.isNotEmpty(gradeId)) {
LJStore store = iljStoreService.selectStoreByStoreId(storeId);
ChainStoreConfig chainStoreConfig = chainStoreConfigService.selectChainStoreById(store.getChainStoreId());
String isEnableLevel = chainStoreConfig.getIsEnableLevel();
if (isEnableLevel.equals("yes")) {
LJUserGrade ljUserGrade = ljUserGradeMapper.selectAllByGradeId(gradeId);
if (ObjectUtils.isNotEmpty(ljUserGrade)) {
if (oilTypebyId.equals("汽油")) {
@ -734,6 +746,7 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
}
}
}
}
return paymentActiveVO;
}

View File

@ -253,4 +253,15 @@ public class OilOrderController extends BaseController {
public ResponseObject getAllAmount(@PathVariable Integer userId){
return getSuccessResult(orderService.sumOilOrderAmountByUserIdAndStoreId(userId));
}
/**
* 根据订单号查询油品订单信息小程序
* @param map
* @return
*/
@PostMapping("oilOrderNo")
public ResponseObject getOilOrder(@RequestBody Map<String,String> map){
String orderNo = map.get("orderNo");
return getSuccessResult(orderService.selectOilOrderDescByOrderNo(orderNo));
}
}

View File

@ -113,4 +113,5 @@ public interface OilOrderMapper extends BaseMapper<OilOrder> {
Map<String, String> orderStatistics( @Param("order") OilOrder order);
OilOrderVo selectOilOrderDescByOrderNo(@Param("orderNo") String orderNo);
}

View File

@ -518,4 +518,15 @@
user_id = #{userId} and store_id = #{storeId} and order_status = 'paid'
</where>
</select>
<select id="selectOilOrderDescByOrderNo" resultType="com.fuint.business.order.vo.OilOrderVo"
parameterType="java.lang.String">
select od.*,ona.oil_name,og.gun_name,sta.real_name,sto.name storeName,sto.description from oil_order od
left join oil_name ona on od.oils = ona.id
left join oil_gun og on od.oil_gun_num = og.id
left join mt_staff sta on od.staff_id = sta.id
left join mt_store sto on od.store_id = sto.id
<where>
od.order_no = #{orderNo}
</where>
</select>
</mapper>

View File

@ -8,6 +8,7 @@ import com.fuint.business.order.entity.CashierOrder;
import com.fuint.business.order.entity.OilOrder;
import com.fuint.business.order.vo.OilOrderVo;
import com.fuint.framework.web.ResponseObject;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.GetMapping;
import javax.servlet.http.HttpServletResponse;
@ -144,5 +145,5 @@ public interface OilOrderService extends IService<OilOrder> {
Map<String, String> orderStatistics(OilOrder order);
OilOrderVo selectOilOrderDescByOrderNo(String orderNo);
}

View File

@ -993,17 +993,17 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
applet = fyPayService.applet(receiveParameter);
String resultMsg = (String) applet.get("resultMsg");
// 判断商户订单号是否重复 重复则重新生成订单号
if (StringUtils.isNotEmpty(resultMsg)){
// 根据日期生成订单信息
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
String timestamp = dateFormat.format(new Date());
String randomString = UUID.randomUUID().toString().replace("-","").substring(0,6);
String orderNo1 = "2345"+timestamp+randomString;
oilOrder.setOrderNo(orderNo1);
this.updateOilOrder(oilOrder);
receiveParameter.setOrderNo(orderNo1);
applet = fyPayService.applet(receiveParameter);
}
// if (StringUtils.isNotEmpty(resultMsg)){
// // 根据日期生成订单信息
// SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
// String timestamp = dateFormat.format(new Date());
// String randomString = UUID.randomUUID().toString().replace("-","").substring(0,6);
// String orderNo1 = "2345"+timestamp+randomString;
// oilOrder.setOrderNo(orderNo1);
// this.updateOilOrder(oilOrder);
// receiveParameter.setOrderNo(orderNo1);
// applet = fyPayService.applet(receiveParameter);
// }
applet.put("orderNo",orderNo);
} catch (Exception e) {
e.printStackTrace();
@ -1531,4 +1531,9 @@ return stringDoubleMap;
return oilOrderMapper.orderStatistics(order);
}
@Override
public OilOrderVo selectOilOrderDescByOrderNo(String orderNo) {
return baseMapper.selectOilOrderDescByOrderNo(orderNo);
}
}

View File

@ -9,5 +9,8 @@ public class OilOrderVo extends OilOrder {
private Double oilPrice;
//
private String storeName;
private String description;
private String oilName;
private String gunName;
private String realName;
}

View File

@ -133,6 +133,7 @@
import tabbar from "../../components/tabbar/tabbar.vue"
import config from '@/config'
import request from '../../utils/request'
import { callWithErrorHandling } from "vue"
export default {
data() {
return {
@ -326,22 +327,21 @@
getUserAuthority() {
let _this = this;
// this.getAddress();
uni.getSetting({
success(res) {
console.log(res, 111)
// console.log(res, 111,"dingw")
if (!res.authSetting['scope.userLocation']) {
uni.authorize({
scope: 'scope.userLocation',
success() {
//
// _this.isExistStoreId()
// uni.authorize({
// scope: 'scope.userLocation',
// success() {
// //
// // _this.isExistStoreId()
// },
// fail() {
// //
// }
// })
_this.getAddress(uni.getStorageSync("storeId"));
},
fail() {
//
}
})
} else {
//
// _this.isExistStoreId()

View File

@ -339,7 +339,7 @@
this.oilOrder.orderAmount = this.value
this.oilOrder.storeId = this.storeId
this.oilOrder.staffId = id
this.oilOrder.oilNum = Math.ceil((this.value/this.oilPrice)*100)/100
this.oilOrder.oilNum = (this.value/this.oilPrice).toFixed(2)
this.oilOrder.tankId = uni.getStorageSync("tankId")
let _this = this;
//

View File

@ -13,11 +13,12 @@
</view>
<view class="desc">
<view>油站名称</view>
<view>{{store.name}}{{store.description ? "("+store.description+")" : ""}}</view>
<!-- <view>{{store.name}}{{store.description ? "("+store.description+")" : ""}}</view> -->
<view>{{oilOrder.storeName}}{{oilOrder.description ? "("+oilOrder.description+")" : ""}}</view>
</view>
<view class="desc">
<view>油号油枪</view>
<view>{{oilName}}/{{oilOrder.oilGunNum}}</view>
<view>{{oilOrder.oilName}}/{{oilOrder.gunName}}</view>
</view>
<view class="desc">
<view>加油金额</view>
@ -33,7 +34,7 @@
</view>
<view class="desc">
<view>加油员工</view>
<view>{{staff.realName}}</view>
<view>{{oilOrder.realName}}</view>
</view>
</view>
@ -110,7 +111,7 @@
</view>
<!-- <view class="desc" v-if="!isFullPreferential && !isGradePreferential && !isOilStorageCard && !isStoreValueCard">无优惠</view> -->
<view style="margin: 10px 20px 0;color: red;font-size: 12px;">已为您计算出最大优惠</view>
<view style="margin: 10px 20px 0;color: red;font-size: 12px;" v-if="fullRedece>0 || gradeRedece>0 || couponRedece>0">已为您计算出最大优惠</view>
<view style="margin: 10px 20px 0;color: red;font-size: 12px;">囤油卡不参与任何优惠活动</view>
</view>
@ -249,7 +250,7 @@
},
onLoad(e) {
this.orderNo = e.orderNo
// this.orderNo = "234520240119103259511c58"
// this.orderNo = "23452024012011401299130f"
},
onShow() {
this.getOilOrder();
@ -263,8 +264,21 @@
this.checkOilCard = val
if (val){
this.chooseRefuelMoney()
this.fullRedece = 0;
this.gradeRedece = 0;
this.couponRedece = 0;
this.preferentialData = {
activeFavorableAmount: "",
activeId: "",
activeInfo: "",
cardFavorableAmount: "",
cardFavorableId: "",
cardFavorableInfo: "",
memberFavorableAmount: "",
type: "",
};
}else{
this.payAmount = this.payAmount + (this.oilCardRedece * this.oilPrice)
this.chooseCardBalance(0)
this.oilCardRedece = 0
this.getPaymentPreferential(this.user.gradeId)
}
@ -431,13 +445,16 @@
},
// 使
chooseCardBalance(val){
if (this.oilCardRedece==0){
this.getPaymentPreferential(this.user.gradeId)
}
console.log("balance");
if (this.user.cardBalance>0) {
this.isStoreValueCard = true;
if (val == 0) {
// 使
if (this.user.cardBalance >= (this.oilOrder.orderAmount - this.couponRedece)){
this.balanceRedece = this.oilOrder.orderAmount - this.couponRedece
if (this.user.cardBalance >= this.oilOrder.orderAmount){
this.balanceRedece = this.oilOrder.orderAmount
} else {
this.balanceRedece = this.user.cardBalance
this.deductAmount = (this.oilOrder.orderAmount*100-this.balanceRedece*100)/100
@ -461,6 +478,7 @@
}
}else{
this.deductAmount = this.oilOrder.orderAmount
this.payAmount = this.oilOrder.orderAmount
}
},
// 使
@ -800,7 +818,7 @@
//
countPayMent(){
this.payAmount = this.deductAmount;
console.log("111",this.deductAmount, this.gradeRedece, this.fullRedece, this.couponRedece);
// console.log("111",this.deductAmount, this.gradeRedece, this.fullRedece, this.couponRedece);
},
// id
@ -865,22 +883,26 @@
this.fullRedece = res.data.activeFavorableAmount
}
console.log(this.gradeRedece,this.couponRedece,this.fullRedece,res.data.memberFavorableAmount,"2231");
this.payAmount = (this.payAmount - this.fullRedece - this.couponRedece - this.gradeRedece).toFixed(2)
})
},
//
getOilOrder() {
let _this = this;
request({
url: "business/oilOrder/orderNo",
// url: "business/oilOrder/orderNo",
url: "business/oilOrder/oilOrderNo",
method: 'post',
data: {
orderNo: _this.orderNo
},
}).then((res) => {
if(res.data!=null){
if(res.data){
// console.log(res);
_this.oilOrder = res.data
_this.getStaffList(res.data.staffId)
_this.getStore(res.data.storeId)
// _this.getStaffList(res.data.staffId)
// _this.getStore(res.data.storeId)
_this.getOilNumber(res.data.storeId)
// _this.chooseCoupons()
_this.getUser(res.data.userId)