diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponSendConfigController.java b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponSendConfigController.java index 001d88799..fd0b16605 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponSendConfigController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponSendConfigController.java @@ -7,6 +7,7 @@ import com.iformall.common.ResultData; import com.iformall.controller.base.BaseController; import com.iformall.domain.po.WxCouponSendConfig; import com.iformall.enums.EnumCouponSendSendType; +import com.iformall.enums.EnumValidStatus; import com.iformall.service.WxCouponSendConfigService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -38,8 +39,13 @@ public class WxCouponSendConfigController extends BaseController { PageInfo page = wxCouponSendConfigService.listAsPage(wxCouponSendConfig, 1, 1); if (page.getSize() > 0) { return new ResultData(page.getList().get(0)); + } else { + //配置不存在,添加默认配置(停用) + wxCouponSendConfig.setRemark(EnumCouponSendSendType.getEnum(wxCouponSendConfig.getSendType()).getMessage() + "开关"); + wxCouponSendConfig.setValue(1); + wxCouponSendConfigService.saveOrUpdate(wxCouponSendConfig); + return new ResultData(wxCouponSendConfig); } - return new ResultData(); } diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxCouponSend.java b/mallinkService/src/main/java/com/iformall/domain/po/WxCouponSend.java index 90654a8f3..a05388604 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxCouponSend.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxCouponSend.java @@ -41,6 +41,7 @@ public class WxCouponSend extends BaseEntity { /** * 商户购券数 */ + @Transient protected Integer merchantLnventory; /**发卷所属商户名**/ diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponSendConfigServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponSendConfigServiceImpl.java index ba434c8c1..0df169311 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponSendConfigServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponSendConfigServiceImpl.java @@ -11,6 +11,8 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.Date; + @Service public class WxCouponSendConfigServiceImpl implements WxCouponSendConfigService { @@ -36,8 +38,10 @@ public class WxCouponSendConfigServiceImpl implements WxCouponSendConfigService //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); final IdWorker idWorker = IdWorker.get(); record.setId(idWorker.nextId()); + record.setCreateTime(new Date()); wxCouponSendConfigMapper.insertSelective(record); } else { + record.setUpdateTime(new Date()); wxCouponSendConfigMapper.updateByPrimaryKeySelective(record); } }