Browse Source

[shop的Enum整理][新增]:用enum代替shop的status

release_toaliyun_real
Stormeye.Wu 7 years ago
parent
commit
9cd1f2dd13
4 changed files with 46 additions and 7 deletions
  1. +36
    -0
      mallinkService/src/main/java/com/iformall/enums/EnumShopStatus.java
  2. +3
    -2
      mallinkService/src/main/java/com/iformall/service/impl/DataTowerServiceImpl.java
  3. +5
    -4
      mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java
  4. +2
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxShopServiceImpl.java

+ 36
- 0
mallinkService/src/main/java/com/iformall/enums/EnumShopStatus.java View File

@@ -0,0 +1,36 @@
package com.iformall.enums;

/**
* Created by Stormeye on 2018/08/09.
*/
public enum EnumShopStatus {

NOT_RENT(0, "未出租"),
RENT(1, "已出租"),
;

public static EnumShopStatus getEnum(Integer code) {
for (EnumShopStatus value : values()) {
if (value.getCode().equals(code)) {
return value;
}
}
return null;
}

private Integer code;
private String message;

EnumShopStatus(Integer code, String message) {
this.code = code;
this.message = message;
}

public Integer getCode() {
return code;
}

public String getMessage() {
return message;
}
}

+ 3
- 2
mallinkService/src/main/java/com/iformall/service/impl/DataTowerServiceImpl.java View File

@@ -6,6 +6,7 @@ import com.iformall.domain.po.WxMerchant;
import com.iformall.domain.po.WxMerchantTradeDaily;
import com.iformall.domain.po.WxShop;
import com.iformall.enums.EnumCarCmd;
import com.iformall.enums.EnumShopStatus;
import com.iformall.mapper.*;
import com.iformall.service.DataTowerService;
import com.iformall.utils.DateUtils;
@@ -53,9 +54,9 @@ public class DataTowerServiceImpl implements DataTowerService {
public Map<String, Object> queryRunning(String tenantId) {
WxShop wxShop = new WxShop();
wxShop.setTenantId(tenantId);
wxShop.setStatus(1);
wxShop.setStatus(EnumShopStatus.RENT.getCode());
List<WxShop> yczlist = wxShopMapper.findList(wxShop);
wxShop.setStatus(0);
wxShop.setStatus(EnumShopStatus.NOT_RENT.getCode());
List<WxShop> wczlist = wxShopMapper.findList(wxShop);

//出租与未出租


+ 5
- 4
mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java View File

@@ -6,6 +6,7 @@ import com.iformall.common.IdWorker;
import com.iformall.domain.po.*;
import com.iformall.enums.EnumAppType;
import com.iformall.enums.EnumCarVendor;
import com.iformall.enums.EnumShopStatus;
import com.iformall.mapper.*;
import com.iformall.service.WxMerchantService;
import com.iformall.service.WxProfitSharingReceiverService;
@@ -130,7 +131,7 @@ public class WxMerchantServiceImpl implements WxMerchantService {
//更新商铺状态
WxShop wxShop = new WxShop();
wxShop.setId(merchantShop.getShopId());
wxShop.setStatus(0);//未出租
wxShop.setStatus(EnumShopStatus.NOT_RENT.getCode());//未出租
WxShopMapper.updateByPrimaryKeySelective(wxShop);
}
}
@@ -192,7 +193,7 @@ public class WxMerchantServiceImpl implements WxMerchantService {
//更新商铺状态
WxShop wxShop = new WxShop();
wxShop.setId(shopid);
wxShop.setStatus(1);//已出租
wxShop.setStatus(EnumShopStatus.RENT.getCode());//已出租
WxShopMapper.updateByPrimaryKeySelective(wxShop);
}

@@ -254,7 +255,7 @@ public class WxMerchantServiceImpl implements WxMerchantService {
//更新商铺状态
WxShop wxShop = new WxShop();
wxShop.setId(merchantShop.getShopId());
wxShop.setStatus(0);//未出租
wxShop.setStatus(EnumShopStatus.NOT_RENT.getCode());//未出租
WxShopMapper.updateByPrimaryKeySelective(wxShop);
}

@@ -277,7 +278,7 @@ public class WxMerchantServiceImpl implements WxMerchantService {
//更新商铺状态
WxShop wxShop = new WxShop();
wxShop.setId(shopid);
wxShop.setStatus(1);//已出租
wxShop.setStatus(EnumShopStatus.RENT.getCode());//已出租
WxShopMapper.updateByPrimaryKeySelective(wxShop);
}



+ 2
- 1
mallinkService/src/main/java/com/iformall/service/impl/WxShopServiceImpl.java View File

@@ -7,6 +7,7 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.iformall.common.ResultData;
import com.iformall.domain.po.WxShop;
import com.iformall.enums.EnumShopStatus;
import com.iformall.mapper.WxShopMapper;
import com.iformall.service.WxShopService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -45,7 +46,7 @@ public class WxShopServiceImpl implements WxShopService {
if (record.getId() == null) {
final IdWorker idWorker = IdWorker.get();
record.setId(idWorker.nextId());
record.setStatus(0);
record.setStatus(EnumShopStatus.NOT_RENT.getCode());
Date date = new Date();
record.setUpdateDate(date);
record.setCreateDate(date);


Loading…
Cancel
Save