This commit is contained in:
cun-nan 2024-01-29 09:50:28 +08:00
parent d51d2d3bb3
commit 60ccc78c46
9 changed files with 34 additions and 20 deletions

View File

@ -228,7 +228,7 @@
:total="total" :total="total"
:page.sync="queryParams.page" :page.sync="queryParams.page"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@pagination="getList" @pagination="getMerchantList(merchantId)"
/> />
</div> </div>
</el-dialog> </el-dialog>
@ -305,6 +305,7 @@ export default {
merchantRecordList:[], merchantRecordList:[],
total:0, total:0,
loading:false, loading:false,
merchantId:"",
} }
}, },
created() { created() {
@ -314,7 +315,10 @@ export default {
getMerchantList(id){ getMerchantList(id){
this.dialogVisibleList = true this.dialogVisibleList = true
this.loading = true; this.loading = true;
this.queryParams.merchantId = id if (id){
this.merchantId = id
}
this.queryParams.merchantId = this.merchantId
listMerchantConfigRecord(this.queryParams).then(res => { listMerchantConfigRecord(this.queryParams).then(res => {
this.merchantRecordList = res.data.records; this.merchantRecordList = res.data.records;
this.total = res.data.total; this.total = res.data.total;

View File

@ -93,7 +93,7 @@
</div> </div>
<div class="hangbox" v-for="(item,index) in oilConfigList" :key="item.id"> <div class="hangbox" v-for="(item,index) in oilConfigList" :key="item.id">
<div>{{index + 1}}.通道</div> <div>{{index + 1}}.通道</div>
<div class="jiaong">{{ item.merchantName }}</div> <div class="jiaong">{{ item.merchantName }}({{ item.remark }})</div>
<div> 商户号 </div> <div> 商户号 </div>
<div class="jiaong">{{ item.mchntCd }}</div> <div class="jiaong">{{ item.mchntCd }}</div>
<!-- <div> 交易满 </div>--> <!-- <div> 交易满 </div>-->
@ -440,7 +440,7 @@ export default {
// //
changeStatus(){ changeStatus(){
if (this.value){ if (this.value){
isOpenOilConfig({isOpen:1,ruleCycle:this.ruleCycle}).then( response => { isOpenOilConfig({isOpen:1,ruleCycle:this.ruleCycle,storeId:this.id}).then( response => {
if (response.data!=1){ if (response.data!=1){
this.$message({ this.$message({
type: 'error', type: 'error',
@ -457,18 +457,18 @@ export default {
} }
}) })
}else { }else {
isOpenOilConfig({isOpen:0,ruleCycle:this.ruleCycle}).then( response => { isOpenOilConfig({isOpen:0,ruleCycle:this.ruleCycle,storeId:this.id}).then( response => {
this.value1 = true; this.value1 = true;
}) })
} }
}, },
changeStatus1(){ changeStatus1(){
if (this.value1){ if (this.value1){
isOpenOilConfig({isOpen:0,ruleCycle:this.ruleCycle}).then( response => { isOpenOilConfig({isOpen:0,ruleCycle:this.ruleCycle,storeId:this.id}).then( response => {
this.value = false; this.value = false;
}) })
}else { }else {
isOpenOilConfig({isOpen:1,ruleCycle:this.ruleCycle}).then( response => { isOpenOilConfig({isOpen:1,ruleCycle:this.ruleCycle,storeId:this.id}).then( response => {
if (response.data!=1){ if (response.data!=1){
this.$message({ this.$message({
type: 'error', type: 'error',

View File

@ -28,7 +28,7 @@ public class MerchantConfigRecordController extends BaseController {
* @return * @return
*/ */
@GetMapping("/list") @GetMapping("/list")
public ResponseObject list(@Param("staff") MerchantConfigRecord merchantConfigRecord, public ResponseObject list(MerchantConfigRecord merchantConfigRecord,
@RequestParam(value = "page",defaultValue = "1") Integer pageNo, @RequestParam(value = "page",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize){ @RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize){
Page page =new Page(pageNo,pageSize); Page page =new Page(pageNo,pageSize);

View File

@ -8,6 +8,7 @@ import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil; import com.fuint.common.util.TokenUtil;
import com.fuint.framework.web.BaseController; import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject; import com.fuint.framework.web.ResponseObject;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -48,20 +49,26 @@ public class OilConfigController extends BaseController {
public ResponseObject isOpen(@Validated @RequestBody Map<String,String> map){ public ResponseObject isOpen(@Validated @RequestBody Map<String,String> map){
String isOpen = map.get("isOpen"); String isOpen = map.get("isOpen");
String ruleCycle = map.get("ruleCycle"); String ruleCycle = map.get("ruleCycle");
Integer storeId = null;
if (StringUtils.isNotEmpty(map.get("storeId"))){
storeId = Integer.valueOf(map.get("storeId"));
}else {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
storeId = nowAccountInfo.getStoreId();
}
// 2 代表不启用规则 // 2 代表不启用规则
int result = 2; int result = 2;
// isOpen=1开启规则 // isOpen=1开启规则
if (isOpen.equals("1")){ if (isOpen.equals("1")){
result = oilConfigService.judgmentProportion(); result = oilConfigService.judgmentProportion();
if (result==1){ if (result==1){
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); oilConfigService.oilRule(storeId);
oilConfigService.oilRule(nowAccountInfo.getStoreId());
// 开启定时关闭规则 // 开启定时关闭规则
oilConfigService.ruleCycle(ruleCycle); oilConfigService.ruleCycle(ruleCycle,storeId);
} }
}else { }else {
// 不开启规则 // 不开启规则
merchantConfigService.updateMerchIsOpen("0"); merchantConfigService.updateMerchIsOpen("0",storeId);
} }
return getSuccessResult(result); return getSuccessResult(result);
} }

View File

@ -7,7 +7,7 @@
<where> <where>
store_id = #{merchantConfigRecord.storeId} store_id = #{merchantConfigRecord.storeId}
<if test="merchantConfigRecord.merchantId != null and merchantConfigRecord.merchantId != ''"> <if test="merchantConfigRecord.merchantId != null and merchantConfigRecord.merchantId != ''">
and merchant_id like concat('%', #{merchantConfigRecord.merchantId}, '%') and merchant_id = #{merchantConfigRecord.merchantId}
</if> </if>
</where> </where>
</select> </select>

View File

@ -76,7 +76,7 @@ public interface MerchantConfigService extends IService<MerchantConfig> {
* @param isOpenRule * @param isOpenRule
* @return * @return
*/ */
public int updateMerchIsOpen(String isOpenRule); public int updateMerchIsOpen(String isOpenRule,Integer storeId);
/** /**
* 根据id修改用户备注信息 * 根据id修改用户备注信息

View File

@ -24,7 +24,7 @@ public interface OilConfigService extends IService<OilConfig> {
/** /**
* 规则周期是否为当日 * 规则周期是否为当日
*/ */
public void ruleCycle(String ruleCycle); public void ruleCycle(String ruleCycle,Integer storeId);
/** /**
* 查询油品配置信息 * 查询油品配置信息

View File

@ -127,10 +127,13 @@ public class MerchantConfigServiceImpl extends ServiceImpl<MerchantConfigMapper,
} }
@Override @Override
public int updateMerchIsOpen(String isOpenRule) { public int updateMerchIsOpen(String isOpenRule,Integer storeId) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); if (storeId==null){
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
storeId = nowAccountInfo.getStoreId();
}
QueryWrapper queryWrapper = new QueryWrapper(); QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("store_id",nowAccountInfo.getStoreId()); queryWrapper.eq("store_id",storeId);
List<MerchantConfig> list = baseMapper.selectList(queryWrapper); List<MerchantConfig> list = baseMapper.selectList(queryWrapper);
int row = 0; int row = 0;
for (MerchantConfig merchantConfig : list) { for (MerchantConfig merchantConfig : list) {

View File

@ -81,7 +81,7 @@ public class OilConfigServiceImpl extends ServiceImpl<OilConfigMapper, OilConfig
} }
@Override @Override
public void ruleCycle(String ruleCycle) { public void ruleCycle(String ruleCycle,Integer storeId) {
// 如果是单日的话则开启定时任务 // 如果是单日的话则开启定时任务
if (ruleCycle.equals("singleDay")){ if (ruleCycle.equals("singleDay")){
Timer timer = new Timer(); Timer timer = new Timer();
@ -89,7 +89,7 @@ public class OilConfigServiceImpl extends ServiceImpl<OilConfigMapper, OilConfig
@Override @Override
public void run() { public void run() {
// 在这里编写需要执行的方法 // 在这里编写需要执行的方法
merchantConfigService.updateMerchIsOpen("0"); merchantConfigService.updateMerchIsOpen("0",storeId);
} }
}; };