bug
This commit is contained in:
parent
19990ea7a0
commit
3328609a09
61
fuintAdmin_zt/src/api/payConfig/ruleConfig.js
Normal file
61
fuintAdmin_zt/src/api/payConfig/ruleConfig.js
Normal file
@ -0,0 +1,61 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询支付配置规则列表
|
||||
export function listRuleConfig(query) {
|
||||
return request({
|
||||
url: '/api/ruleConfig',
|
||||
method: 'get',
|
||||
params: query,
|
||||
})
|
||||
}
|
||||
|
||||
// 查询支付配置规则列表
|
||||
export function getRuleConfig(id) {
|
||||
return request({
|
||||
url: '/api/ruleConfig/'+id,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
// 查询支付配置规则列表
|
||||
export function addRuleConfig(query) {
|
||||
return request({
|
||||
url: '/api/ruleConfig',
|
||||
method: 'post',
|
||||
data: query,
|
||||
})
|
||||
}
|
||||
|
||||
// 查询支付配置规则列表
|
||||
export function editRuleConfig(query) {
|
||||
return request({
|
||||
url: '/api/ruleConfig',
|
||||
method: 'put',
|
||||
data: query,
|
||||
})
|
||||
}
|
||||
// 查询支付配置规则列表
|
||||
export function enableRuleConfig(query) {
|
||||
return request({
|
||||
url: '/api/ruleConfig/enableRule',
|
||||
method: 'post',
|
||||
data: query,
|
||||
})
|
||||
}
|
||||
|
||||
// 查询支付配置规则列表
|
||||
export function deleteRuleConfig(id) {
|
||||
return request({
|
||||
url: '/api/ruleConfig/'+id,
|
||||
method: 'delete',
|
||||
})
|
||||
}
|
||||
|
||||
// 查询支付配置规则列表
|
||||
export function getOilGunList(query) {
|
||||
return request({
|
||||
url: '/business/petrolStationManagement/oilGun/queryByPage',
|
||||
method: 'get',
|
||||
params: query,
|
||||
})
|
||||
}
|
@ -9,10 +9,11 @@
|
||||
</div>
|
||||
</div>
|
||||
<jcindex :id="id" v-if="tabindex == 0"></jcindex>
|
||||
<payment :id="id" v-if="tabindex == 1" ></payment>
|
||||
<payment :id="id" :deptId="deptId" v-if="tabindex == 1" ></payment>
|
||||
<way :id="id" v-if="tabindex == 2" ></way>
|
||||
<staff :id="id" v-if="tabindex == 3" ></staff>
|
||||
<allOrder :id="id" v-if="tabindex == 4"></allOrder>
|
||||
|
||||
<!-- <el-card >-->
|
||||
<!-- <div class="top-box">-->
|
||||
<!-- <el-tabs v-model="activeName" @tab-click="handleClick">-->
|
||||
@ -49,6 +50,7 @@
|
||||
data() {
|
||||
return {
|
||||
id:'',
|
||||
deptId:'',
|
||||
activeName: 'first',
|
||||
tabindex:0,
|
||||
tabList:[
|
||||
@ -88,6 +90,7 @@
|
||||
},
|
||||
created() {
|
||||
this.id = this.$route.query.id
|
||||
this.deptId = this.$route.query.deptId
|
||||
},
|
||||
mounted() {
|
||||
console.log(this.id)
|
||||
|
@ -148,7 +148,7 @@
|
||||
</div>
|
||||
<div class="box-wrap">
|
||||
<div class="zong-box" v-for="(items,index) in item.storeList" :key="index" >
|
||||
<div class="pur-box" @click="godetails(items.id)">
|
||||
<div class="pur-box" @click="godetails(items.id,items.contractDeptId)">
|
||||
<el-tag type="success" v-if="items.status=='qy'">启用</el-tag>
|
||||
<el-tag type="danger" v-else>禁用</el-tag>
|
||||
<div class="disper-box">
|
||||
@ -284,11 +284,12 @@ export default {
|
||||
|
||||
this.getlist()
|
||||
},
|
||||
godetails(id){
|
||||
godetails(id,deptId){
|
||||
this.$router.push({
|
||||
path:'/Service/details',
|
||||
query:{
|
||||
id:id
|
||||
id:id,
|
||||
deptId:deptId
|
||||
}
|
||||
})
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -32,8 +32,7 @@ public class MerchantConfigController extends BaseController {
|
||||
|
||||
@GetMapping("/list2")
|
||||
public ResponseObject list(Integer storeId){
|
||||
List<MerchantConfig> list = merchantConfigService.selectMerchList(storeId);
|
||||
return getSuccessResult(list);
|
||||
return getSuccessResult(merchantConfigService.selectMerchList(storeId));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -13,7 +13,7 @@ public class PaymentRuleConfigController extends BaseController {
|
||||
@Autowired
|
||||
private PaymentRuleConfigService paymentRuleConfigService;
|
||||
|
||||
@GetMapping()
|
||||
@GetMapping
|
||||
public ResponseObject getList(PaymentRuleConfig paymentRuleConfig){
|
||||
return getSuccessResult(paymentRuleConfigService.selectList(paymentRuleConfig));
|
||||
}
|
||||
@ -23,23 +23,23 @@ public class PaymentRuleConfigController extends BaseController {
|
||||
return getSuccessResult(paymentRuleConfigService.selectRuleById(id));
|
||||
}
|
||||
|
||||
@PostMapping()
|
||||
public ResponseObject add(PaymentRuleConfig paymentRuleConfig){
|
||||
@PostMapping
|
||||
public ResponseObject add(@RequestBody PaymentRuleConfig paymentRuleConfig){
|
||||
return getSuccessResult(paymentRuleConfigService.addPaymentRuleConfig(paymentRuleConfig));
|
||||
}
|
||||
|
||||
@PutMapping()
|
||||
public ResponseObject edit(PaymentRuleConfig paymentRuleConfig){
|
||||
@PutMapping
|
||||
public ResponseObject edit(@RequestBody PaymentRuleConfig paymentRuleConfig){
|
||||
return getSuccessResult(paymentRuleConfigService.updatePaymentRuleConfig(paymentRuleConfig));
|
||||
}
|
||||
|
||||
@DeleteMapping()
|
||||
public ResponseObject delete(PaymentRuleConfig paymentRuleConfig){
|
||||
return getSuccessResult(paymentRuleConfigService.deletePaymentRuleConfig(paymentRuleConfig));
|
||||
@DeleteMapping("{id}")
|
||||
public ResponseObject delete(@PathVariable Integer id){
|
||||
return getSuccessResult(paymentRuleConfigService.deletePaymentRuleConfig(id));
|
||||
}
|
||||
|
||||
@PostMapping("enableRule")
|
||||
public ResponseObject enablePaymentRuleConfig(PaymentRuleConfig paymentRuleConfig){
|
||||
public ResponseObject enablePaymentRuleConfig(@RequestBody PaymentRuleConfig paymentRuleConfig){
|
||||
return getSuccessResult(paymentRuleConfigService.enablePaymentRuleConfig(paymentRuleConfig));
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ public class OilConfig extends BaseEntity implements Serializable {
|
||||
/**
|
||||
* 交易类型:1、会员充值;2、便利店;3、积分商城;4、油品
|
||||
*/
|
||||
private String transaction_type;
|
||||
private String transactionType;
|
||||
/**
|
||||
* 交易占比
|
||||
*/
|
||||
|
@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fuint.api.fuyou.vo.OilConfigVo;
|
||||
import com.fuint.framework.entity.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@ -58,6 +60,7 @@ public class PaymentRuleConfig extends BaseEntity implements Serializable {
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
|
||||
private Date startTime;
|
||||
/**
|
||||
* 创建时间
|
||||
@ -77,6 +80,6 @@ public class PaymentRuleConfig extends BaseEntity implements Serializable {
|
||||
private String updateBy;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<OilConfig> ruleList;
|
||||
private List<OilConfigVo> ruleList;
|
||||
}
|
||||
|
||||
|
@ -2,9 +2,14 @@ package com.fuint.api.fuyou.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.fuint.api.fuyou.entity.MerchantConfig;
|
||||
import com.fuint.api.fuyou.vo.MerchantConfigVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface MerchantConfigMapper extends BaseMapper<MerchantConfig> {
|
||||
MerchantConfig getConfig(@Param("storeId") Integer storeId, @Param("mchntCd") String mchntCd);
|
||||
int subtractAmount(@Param("id") Integer id,@Param("changeTheAmount") Double changeTheAmount);
|
||||
|
||||
List<MerchantConfigVo> selectList(@Param("merchantConfig") MerchantConfigVo merchantConfig);
|
||||
}
|
||||
|
@ -23,4 +23,6 @@ public interface OilConfigMapper extends BaseMapper<OilConfig> {
|
||||
* @return
|
||||
*/
|
||||
public OilConfigVo selectOilConfigById(@Param("id") int id);
|
||||
|
||||
List<OilConfigVo> selectOilConfigListByRuleId(@Param("ruleId") Integer ruleId);
|
||||
}
|
||||
|
@ -2,6 +2,22 @@ package com.fuint.api.fuyou.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.fuint.api.fuyou.entity.PaymentRuleConfig;
|
||||
import com.fuint.api.fuyou.vo.PaymentRuleConfigVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface PaymentRuleConfigMapper extends BaseMapper<PaymentRuleConfig> {
|
||||
/**
|
||||
* 查询列表信息
|
||||
* @param paymentRuleConfig
|
||||
* @return
|
||||
*/
|
||||
List<PaymentRuleConfigVo> selectListByStoreId(@Param("entity") PaymentRuleConfig paymentRuleConfig);
|
||||
|
||||
/**
|
||||
* 查询店铺id列表
|
||||
* @return
|
||||
*/
|
||||
List<Integer> selectStoreIdList();
|
||||
}
|
||||
|
@ -14,4 +14,13 @@
|
||||
mchnt_cd = #{mchntCd}
|
||||
limit 1
|
||||
</select>
|
||||
<select id="selectList" resultType="com.fuint.api.fuyou.vo.MerchantConfigVo"
|
||||
parameterType="com.fuint.api.fuyou.vo.MerchantConfigVo">
|
||||
SELECT mc.*,sd.dept_name,ta.real_name FROM `merchant_config` mc
|
||||
LEFT JOIN sys_dept sd ON mc.dept_id = sd.dept_id
|
||||
LEFT JOIN t_account ta ON mc.create_by = ta.acct_id
|
||||
<where>
|
||||
mc.store_id = #{merchantConfig.storeId}
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
@ -16,4 +16,11 @@
|
||||
oc.id = #{id}
|
||||
</where>
|
||||
</select>
|
||||
<select id="selectOilConfigListByRuleId" resultType="com.fuint.api.fuyou.vo.OilConfigVo"
|
||||
parameterType="java.lang.Integer">
|
||||
<include refid="selectOilConfig"></include>
|
||||
<where>
|
||||
oc.rule_config_id = #{ruleId}
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,16 @@
|
||||
<?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.fuint.api.fuyou.mapper.PaymentRuleConfigMapper">
|
||||
|
||||
<select id="selectListByStoreId" resultType="com.fuint.api.fuyou.vo.PaymentRuleConfigVo"
|
||||
parameterType="com.fuint.api.fuyou.entity.PaymentRuleConfig">
|
||||
SELECT prc.*,ta.real_name FROM `payment_rule_config` prc
|
||||
LEFT JOIN t_account ta ON prc.create_by = ta.acct_id
|
||||
<where>
|
||||
prc.store_id = #{entity.storeId}
|
||||
</where>
|
||||
</select>
|
||||
<select id="selectStoreIdList" resultType="java.lang.Integer">
|
||||
SELECT store_id FROM payment_rule_config GROUP BY store_id
|
||||
</select>
|
||||
</mapper>
|
@ -2,6 +2,7 @@ package com.fuint.api.fuyou.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.fuint.api.fuyou.entity.MerchantConfig;
|
||||
import com.fuint.api.fuyou.vo.MerchantConfigVo;
|
||||
import io.swagger.models.auth.In;
|
||||
|
||||
import java.util.List;
|
||||
@ -43,7 +44,7 @@ public interface MerchantConfigService extends IService<MerchantConfig> {
|
||||
*/
|
||||
public List<MerchantConfig> selectMerchList();
|
||||
|
||||
public List<MerchantConfig> selectMerchList(Integer storeId);
|
||||
public List<MerchantConfigVo> selectMerchList(Integer storeId);
|
||||
|
||||
/**
|
||||
* 根据id查询商户信息
|
||||
|
@ -21,6 +21,12 @@ public interface OilConfigService extends IService<OilConfig> {
|
||||
*/
|
||||
public int judgmentProportion(Integer storeId);
|
||||
|
||||
/**
|
||||
* 判断占比相加是否为100% 是返回1 不是返回0
|
||||
* @return
|
||||
*/
|
||||
public int judgmentProportion1(Integer storeId,Integer ruleConfigId);
|
||||
|
||||
/**
|
||||
* 规则周期是否为当日
|
||||
*/
|
||||
@ -66,7 +72,7 @@ public interface OilConfigService extends IService<OilConfig> {
|
||||
* @param ruleId
|
||||
* @return
|
||||
*/
|
||||
List<OilConfig> selectListByRuleConfigId(Integer ruleId);
|
||||
List<OilConfigVo> selectListByRuleConfigId(Integer ruleId);
|
||||
|
||||
void deleteOilConfigByRuleId(Integer ruleId);
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.fuint.api.fuyou.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.fuint.api.fuyou.entity.PaymentRuleConfig;
|
||||
import com.fuint.api.fuyou.vo.PaymentRuleConfigVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -11,7 +12,7 @@ public interface PaymentRuleConfigService extends IService<PaymentRuleConfig> {
|
||||
* @param paymentRuleConfig
|
||||
* @return
|
||||
*/
|
||||
List<PaymentRuleConfig> selectList(PaymentRuleConfig paymentRuleConfig);
|
||||
List<PaymentRuleConfigVo> selectList(PaymentRuleConfig paymentRuleConfig);
|
||||
|
||||
/**
|
||||
* 根据id查询详情信息
|
||||
@ -43,10 +44,10 @@ public interface PaymentRuleConfigService extends IService<PaymentRuleConfig> {
|
||||
|
||||
/**
|
||||
* 删除支付配置规则信息
|
||||
* @param ruleConfig
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
int deletePaymentRuleConfig(PaymentRuleConfig ruleConfig);
|
||||
int deletePaymentRuleConfig(Integer id);
|
||||
|
||||
/**
|
||||
* 启用支付配置规则
|
||||
@ -54,4 +55,9 @@ public interface PaymentRuleConfigService extends IService<PaymentRuleConfig> {
|
||||
* @return
|
||||
*/
|
||||
int enablePaymentRuleConfig(PaymentRuleConfig ruleConfig);
|
||||
|
||||
/**
|
||||
* 判断规则是否到启用时间
|
||||
*/
|
||||
void ifEnablePaymentRuleConfig();
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import com.fuint.api.fuyou.entity.MerchantConfig;
|
||||
import com.fuint.api.fuyou.mapper.MerchantConfigMapper;
|
||||
import com.fuint.api.fuyou.service.MerchantConfigService;
|
||||
import com.fuint.api.fuyou.service.OilConfigService;
|
||||
import com.fuint.api.fuyou.vo.MerchantConfigVo;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.util.RedisLock;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
@ -82,11 +83,10 @@ public class MerchantConfigServiceImpl extends ServiceImpl<MerchantConfigMapper,
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MerchantConfig> selectMerchList(Integer storeId) {
|
||||
QueryWrapper queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("store_id",storeId);
|
||||
List list = baseMapper.selectList(queryWrapper);
|
||||
return list;
|
||||
public List<MerchantConfigVo> selectMerchList(Integer storeId) {
|
||||
MerchantConfigVo merchantConfigVo = new MerchantConfigVo();
|
||||
merchantConfigVo.setStoreId(storeId);
|
||||
return baseMapper.selectList(merchantConfigVo);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -88,6 +88,22 @@ public class OilConfigServiceImpl extends ServiceImpl<OilConfigMapper, OilConfig
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@Override
|
||||
public int judgmentProportion1(Integer storeId,Integer ruleConfigId) {
|
||||
int result = 0;
|
||||
int percentage = 0;
|
||||
QueryWrapper queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("store_id",storeId);
|
||||
queryWrapper.eq("rule_config_id",ruleConfigId);
|
||||
List<OilConfig> list = baseMapper.selectList(queryWrapper);
|
||||
for (OilConfig config : list) {
|
||||
percentage += config.getProportion();
|
||||
}
|
||||
if (percentage==100){
|
||||
result = 1;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ruleCycle(String ruleCycle,Integer storeId) {
|
||||
@ -136,18 +152,22 @@ public class OilConfigServiceImpl extends ServiceImpl<OilConfigMapper, OilConfig
|
||||
storeId = oilConfig.getStoreId();
|
||||
}
|
||||
OilConfig config = new OilConfig();
|
||||
config.setRuleConfigId(oilConfig.getRuleConfigId());
|
||||
config.setOilGunId(oilConfig.getOilGunId());
|
||||
config.setTransactionType(oilConfig.getTransactionType());
|
||||
config.setMerchConfigId(oilConfig.getMerchConfigId());
|
||||
config.setStoreId(storeId);
|
||||
config.setProportion(oilConfig.getProportion());
|
||||
config.setKeyStr(oilConfig.getKeyStr());
|
||||
config.setValueStr(oilConfig.getValueStr());
|
||||
config.setMerchConfigId(oilConfig.getMerchConfigId());
|
||||
QueryWrapper queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("merch_config_id",oilConfig.getMerchConfigId());
|
||||
OilConfig oilConfig1 = baseMapper.selectOne(queryWrapper);
|
||||
if (!ObjectUtil.isEmpty(oilConfig1)){
|
||||
return 0;
|
||||
}
|
||||
// QueryWrapper queryWrapper = new QueryWrapper<>();
|
||||
// queryWrapper.eq("merch_config_id",oilConfig.getMerchConfigId());
|
||||
// queryWrapper.eq("store_id",storeId);
|
||||
// OilConfig oilConfig1 = baseMapper.selectOne(queryWrapper);
|
||||
// if (!ObjectUtil.isEmpty(oilConfig1)){
|
||||
// return 0;
|
||||
// }
|
||||
int row = baseMapper.insert(config);
|
||||
return row;
|
||||
}
|
||||
@ -164,10 +184,8 @@ public class OilConfigServiceImpl extends ServiceImpl<OilConfigMapper, OilConfig
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OilConfig> selectListByRuleConfigId(Integer ruleId) {
|
||||
QueryWrapper<OilConfig> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("rule_config_id",ruleId);
|
||||
List<OilConfig> oilConfigs = baseMapper.selectList(queryWrapper);
|
||||
public List<OilConfigVo> selectListByRuleConfigId(Integer ruleId) {
|
||||
List<OilConfigVo> oilConfigs = baseMapper.selectOilConfigListByRuleId(ruleId);
|
||||
for (OilConfig oilConfig : oilConfigs) {
|
||||
if (ObjectUtil.isNotEmpty(oilConfig.getOilGunId())) {
|
||||
String[] split = oilConfig.getOilGunId().split(",");
|
||||
|
@ -9,10 +9,13 @@ import com.fuint.api.fuyou.mapper.PaymentRuleConfigMapper;
|
||||
import com.fuint.api.fuyou.service.OilConfigService;
|
||||
import com.fuint.api.fuyou.service.PaymentRuleConfigService;
|
||||
import com.fuint.api.fuyou.vo.OilConfigVo;
|
||||
import com.fuint.api.fuyou.vo.PaymentRuleConfigVo;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@ -23,12 +26,10 @@ public class PaymentRuleConfigServiceImpl extends ServiceImpl<PaymentRuleConfigM
|
||||
private OilConfigService oilConfigService;
|
||||
|
||||
@Override
|
||||
public List<PaymentRuleConfig> selectList(PaymentRuleConfig paymentRuleConfig) {
|
||||
QueryWrapper<PaymentRuleConfig> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("store_id",paymentRuleConfig.getStoreId());
|
||||
List<PaymentRuleConfig> list = baseMapper.selectList(queryWrapper);
|
||||
public List<PaymentRuleConfigVo> selectList(PaymentRuleConfig paymentRuleConfig) {
|
||||
List<PaymentRuleConfigVo> list = baseMapper.selectListByStoreId(paymentRuleConfig);
|
||||
for (PaymentRuleConfig ruleConfig : list) {
|
||||
List<OilConfig> oilConfigs = oilConfigService.selectListByRuleConfigId(ruleConfig.getId());
|
||||
List<OilConfigVo> oilConfigs = oilConfigService.selectListByRuleConfigId(ruleConfig.getId());
|
||||
ruleConfig.setRuleList(oilConfigs);
|
||||
}
|
||||
return list;
|
||||
@ -38,7 +39,7 @@ public class PaymentRuleConfigServiceImpl extends ServiceImpl<PaymentRuleConfigM
|
||||
public PaymentRuleConfig selectRuleById(Integer id) {
|
||||
PaymentRuleConfig paymentRuleConfig = baseMapper.selectById(id);
|
||||
if (ObjectUtil.isNotEmpty(paymentRuleConfig)){
|
||||
List<OilConfig> oilConfigs = oilConfigService.selectListByRuleConfigId(id);
|
||||
List<OilConfigVo> oilConfigs = oilConfigService.selectListByRuleConfigId(id);
|
||||
paymentRuleConfig.setRuleList(oilConfigs);
|
||||
}
|
||||
return paymentRuleConfig;
|
||||
@ -59,11 +60,11 @@ public class PaymentRuleConfigServiceImpl extends ServiceImpl<PaymentRuleConfigM
|
||||
return 0;
|
||||
}
|
||||
int row = baseMapper.insert(ruleConfig);
|
||||
paymentRuleConfig = selectRuleByRuleName(ruleConfig.getRuleName(), ruleConfig.getStoreId());
|
||||
if (ObjectUtil.isNotEmpty(ruleConfig.getRuleList())){
|
||||
for (OilConfig oilConfig : ruleConfig.getRuleList()) {
|
||||
OilConfigVo oilConfigVo = new OilConfigVo();
|
||||
BeanUtils.copyProperties(oilConfigVo,oilConfig);
|
||||
oilConfigService.insertOilConfig(oilConfigVo);
|
||||
for (OilConfigVo oilConfig : ruleConfig.getRuleList()) {
|
||||
oilConfig.setRuleConfigId(paymentRuleConfig.getId());
|
||||
oilConfigService.insertOilConfig(oilConfig);
|
||||
}
|
||||
}
|
||||
return row;
|
||||
@ -78,32 +79,76 @@ public class PaymentRuleConfigServiceImpl extends ServiceImpl<PaymentRuleConfigM
|
||||
int row = baseMapper.updateById(ruleConfig);
|
||||
oilConfigService.deleteOilConfigByRuleId(ruleConfig.getId());
|
||||
if (ObjectUtil.isNotEmpty(ruleConfig.getRuleList())){
|
||||
for (OilConfig oilConfig : ruleConfig.getRuleList()) {
|
||||
OilConfigVo oilConfigVo = new OilConfigVo();
|
||||
BeanUtils.copyProperties(oilConfigVo,oilConfig);
|
||||
oilConfigService.insertOilConfig(oilConfigVo);
|
||||
for (OilConfigVo oilConfig : ruleConfig.getRuleList()) {
|
||||
oilConfig.setRuleConfigId(ruleConfig.getId());
|
||||
oilConfigService.insertOilConfig(oilConfig);
|
||||
}
|
||||
}
|
||||
return row;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deletePaymentRuleConfig(PaymentRuleConfig ruleConfig) {
|
||||
int row = baseMapper.deleteById(ruleConfig);
|
||||
oilConfigService.deleteOilConfigByRuleId(ruleConfig.getId());
|
||||
public int deletePaymentRuleConfig(Integer id) {
|
||||
int row = baseMapper.deleteById(id);
|
||||
oilConfigService.deleteOilConfigByRuleId(id);
|
||||
return row;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int enablePaymentRuleConfig(PaymentRuleConfig ruleConfig) {
|
||||
if (ruleConfig.getStartTime().before(new Date())) {
|
||||
QueryWrapper<PaymentRuleConfig> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("store_id",ruleConfig.getStoreId());
|
||||
queryWrapper.eq("store_id", ruleConfig.getStoreId());
|
||||
List<PaymentRuleConfig> list = baseMapper.selectList(queryWrapper);
|
||||
for (PaymentRuleConfig paymentRuleConfig : list) {
|
||||
paymentRuleConfig.setStatus("jy");
|
||||
baseMapper.updateById(paymentRuleConfig);
|
||||
}
|
||||
int row = baseMapper.updateById(ruleConfig);
|
||||
return row;
|
||||
int i = 1;
|
||||
if (ruleConfig.getStatus().equals("qy") && ruleConfig.getRuleType().equals("1")){
|
||||
i = oilConfigService.judgmentProportion1(ruleConfig.getStoreId(), ruleConfig.getId());
|
||||
}
|
||||
if (i==0){
|
||||
return 0;
|
||||
}
|
||||
return baseMapper.updateById(ruleConfig);
|
||||
}else {
|
||||
if (ruleConfig.getStatus().equals("qy")){
|
||||
ruleConfig.setStatus("jy");
|
||||
}
|
||||
return baseMapper.updateById(ruleConfig);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断规则是否到启用时间
|
||||
*/
|
||||
@Scheduled(cron = "0 */1 * * * ?")
|
||||
public void ifEnablePaymentRuleConfig(){
|
||||
List<Integer> ids = baseMapper.selectStoreIdList();
|
||||
for (Integer storeId : ids) {
|
||||
QueryWrapper<PaymentRuleConfig> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("store_id",storeId);
|
||||
queryWrapper.orderByAsc("start_time");
|
||||
List<PaymentRuleConfig> list = baseMapper.selectList(queryWrapper);
|
||||
for (PaymentRuleConfig paymentRuleConfig : list) {
|
||||
if (ObjectUtil.isNotEmpty(paymentRuleConfig.getStartTime()) && paymentRuleConfig.getStartTime().before(new Date())) {
|
||||
int i = 1;
|
||||
if (paymentRuleConfig.getRuleType().equals("1")){
|
||||
i = oilConfigService.judgmentProportion1(paymentRuleConfig.getStoreId(), paymentRuleConfig.getId());
|
||||
}
|
||||
if (i==0){
|
||||
return;
|
||||
}
|
||||
|
||||
for (PaymentRuleConfig ruleConfig : list) {
|
||||
ruleConfig.setStatus("jy");
|
||||
baseMapper.updateById(ruleConfig);
|
||||
}
|
||||
paymentRuleConfig.setStatus("qy");
|
||||
baseMapper.updateById(paymentRuleConfig);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,16 @@
|
||||
package com.fuint.api.fuyou.vo;
|
||||
|
||||
import com.fuint.api.fuyou.entity.MerchantConfig;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MerchantConfigVo extends MerchantConfig {
|
||||
/**
|
||||
* 机构名称
|
||||
*/
|
||||
private String deptName;
|
||||
/**
|
||||
* 创建人名称
|
||||
*/
|
||||
private String realName;
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.fuint.api.fuyou.vo;
|
||||
|
||||
import com.fuint.api.fuyou.entity.PaymentRuleConfig;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PaymentRuleConfigVo extends PaymentRuleConfig {
|
||||
private String realName;
|
||||
}
|
@ -53,8 +53,10 @@ public class OilGunServiceImpl implements OilGunService {
|
||||
*/
|
||||
@Override
|
||||
public IPage<OilGun> queryByPage(@Param("page") Page page, @Param("oilGun") OilGun oilGun) {
|
||||
if (ObjectUtil.isEmpty(oilGun.getStoreId())) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
oilGun.setStoreId(nowAccountInfo.getStoreId());
|
||||
}
|
||||
return oilGunDao.queryAllByLimit(page, oilGun);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user