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

View File

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

View File

@ -28,7 +28,7 @@ public class MerchantConfigRecordController extends BaseController {
* @return
*/
@GetMapping("/list")
public ResponseObject list(@Param("staff") MerchantConfigRecord merchantConfigRecord,
public ResponseObject list(MerchantConfigRecord merchantConfigRecord,
@RequestParam(value = "page",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer 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.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -48,20 +49,26 @@ public class OilConfigController extends BaseController {
public ResponseObject isOpen(@Validated @RequestBody Map<String,String> map){
String isOpen = map.get("isOpen");
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 代表不启用规则
int result = 2;
// isOpen=1开启规则
if (isOpen.equals("1")){
result = oilConfigService.judgmentProportion();
if (result==1){
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
oilConfigService.oilRule(nowAccountInfo.getStoreId());
oilConfigService.oilRule(storeId);
// 开启定时关闭规则
oilConfigService.ruleCycle(ruleCycle);
oilConfigService.ruleCycle(ruleCycle,storeId);
}
}else {
// 不开启规则
merchantConfigService.updateMerchIsOpen("0");
merchantConfigService.updateMerchIsOpen("0",storeId);
}
return getSuccessResult(result);
}

View File

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

View File

@ -76,7 +76,7 @@ public interface MerchantConfigService extends IService<MerchantConfig> {
* @param isOpenRule
* @return
*/
public int updateMerchIsOpen(String isOpenRule);
public int updateMerchIsOpen(String isOpenRule,Integer storeId);
/**
* 根据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
public int updateMerchIsOpen(String isOpenRule) {
public int updateMerchIsOpen(String isOpenRule,Integer storeId) {
if (storeId==null){
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
storeId = nowAccountInfo.getStoreId();
}
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("store_id",nowAccountInfo.getStoreId());
queryWrapper.eq("store_id",storeId);
List<MerchantConfig> list = baseMapper.selectList(queryWrapper);
int row = 0;
for (MerchantConfig merchantConfig : list) {

View File

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