| @@ -0,0 +1,48 @@ | |||||
| package com.iformall.service.tt; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.domain.po.tt.TtCoupon; | |||||
| import com.iformall.domain.po.tt.TtUpSettlein; | |||||
| import org.springframework.scheduling.annotation.Async; | |||||
| import java.util.List; | |||||
| public interface TtUpSettleinService { | |||||
| /** | |||||
| * 根据实体查询分页列表 | |||||
| * | |||||
| * @param record | |||||
| * @param pageIndex | |||||
| * @param pageSize | |||||
| * @return | |||||
| */ | |||||
| PageInfo<TtUpSettlein> listAsPage(TtUpSettlein record, Integer pageIndex, Integer pageSize); | |||||
| List<TtUpSettlein> findList(TtUpSettlein record); | |||||
| /** | |||||
| * 根据Id获得实体 | |||||
| * | |||||
| * @param id | |||||
| * @return | |||||
| */ | |||||
| TtUpSettlein getById(Long id); | |||||
| /** | |||||
| * 保存或更新实体 | |||||
| * | |||||
| * @param record | |||||
| */ | |||||
| ResultData saveOrUpdate(TtUpSettlein record); | |||||
| /** | |||||
| * 根据Id删除实体 | |||||
| * | |||||
| * @param id | |||||
| */ | |||||
| void deleteById(Long id); | |||||
| } | |||||
| @@ -0,0 +1,67 @@ | |||||
| package com.iformall.service.tt.impl; | |||||
| import com.github.pagehelper.PageHelper; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.IdWorker; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.tt.TtUpSettlein; | |||||
| import com.iformall.mapper.*; | |||||
| import com.iformall.service.tt.TtUpSettleinService; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Service; | |||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| @Service | |||||
| public class TtUpSettleinServiceImpl implements TtUpSettleinService { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| TtUpSettleinMapper ttUpSettleinMapper; | |||||
| @Override | |||||
| public PageInfo<TtUpSettlein> listAsPage(TtUpSettlein record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> ttUpSettleinMapper.findList(record)); | |||||
| } | |||||
| @Override | |||||
| public List<TtUpSettlein> findList(TtUpSettlein record) { | |||||
| return ttUpSettleinMapper.findList(record); | |||||
| } | |||||
| @Override | |||||
| public TtUpSettlein getById(Long id) { | |||||
| return ttUpSettleinMapper.selectById(id); | |||||
| } | |||||
| @Override | |||||
| public ResultData saveOrUpdate(TtUpSettlein record) { | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| if (record.getId() == null) { | |||||
| record.setId(idWorker.nextId()); | |||||
| record.setCreateDate(new Date()); | |||||
| record.setUpdateDate(new Date()); | |||||
| ttUpSettleinMapper.insert(record); | |||||
| } else { | |||||
| record.setUpdateDate(new Date()); | |||||
| ttUpSettleinMapper.updateById(record); | |||||
| } | |||||
| return new ResultData(); | |||||
| } | |||||
| @Override | |||||
| public void deleteById(Long id) { | |||||
| ttUpSettleinMapper.deleteById(id); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,84 @@ | |||||
| package com.iformall.controller.tt; | |||||
| import com.iformall.annotation.SystemControllerLog; | |||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.controller.base.BaseController; | |||||
| import com.iformall.domain.po.WxMerchant; | |||||
| import com.iformall.domain.po.base.BaseEntity; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.domain.po.tt.TtCoupon; | |||||
| import com.iformall.domain.po.tt.TtUpSettlein; | |||||
| import com.iformall.enums.EnumDelFlag; | |||||
| import com.iformall.enums.EnumMerchantStatus; | |||||
| import com.iformall.exception.MallinkException; | |||||
| import com.iformall.service.tt.TtUpSettleinService; | |||||
| import io.swagger.annotations.Api; | |||||
| import io.swagger.annotations.ApiImplicitParam; | |||||
| import io.swagger.annotations.ApiImplicitParams; | |||||
| import io.swagger.annotations.ApiOperation; | |||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.web.bind.annotation.*; | |||||
| import java.util.List; | |||||
| @RestController | |||||
| @RequestMapping("upSettlein") | |||||
| @Api(description = "业态查询接口") | |||||
| public class TtUpSettleinController extends BaseController { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| private TtUpSettleinService ttUpSettleinService; | |||||
| @ApiOperation("分页列表接口") | |||||
| @GetMapping("list") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||||
| @SystemControllerLog(description = "-列表") | |||||
| public ResultData list(@ModelAttribute TtUpSettlein record, Integer pageNum, Integer pageSize, Integer dataType) { | |||||
| logger.debug("[" + getIpAddr() + "] TtCouponController::list"); | |||||
| if (record == null) record = new TtUpSettlein(); | |||||
| record.updateTenantInfo(getTenantInfo()); | |||||
| if(StringUtils.isBlank(record.getSortColumn())){ | |||||
| record.setSortColumns(BaseEntity.SortField.CreateDate_DESC); | |||||
| } | |||||
| return new ResultData(ttUpSettleinService.listAsPage(record, pageNum, pageSize)); | |||||
| } | |||||
| @ApiOperation("根据id更新接口") | |||||
| @PostMapping("update") | |||||
| @SystemControllerLog(description = "更新") | |||||
| public ResultData update(@RequestBody TtUpSettlein record) { | |||||
| logger.debug("[" + getIpAddr() + "] TtUpSettleinController::update"); | |||||
| if (record.getId() == null) { | |||||
| return new ResultData(ResultData.ERROR, "缺少id"); | |||||
| } | |||||
| record.updateTenantInfo(ifParentUpdateTenantInfo()); | |||||
| TtUpSettlein ups = ttUpSettleinService.getById(record.getId()); | |||||
| if (null == ups || EnumDelFlag.YES.getCode().equals(record.getIsDel())) { | |||||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR,"找不到数据,或数据已删除"); | |||||
| } | |||||
| return ttUpSettleinService.saveOrUpdate(record); | |||||
| } | |||||
| @ApiOperation("根据id查询接口") | |||||
| @GetMapping("/findById") | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
| @SystemControllerLog(description = "") | |||||
| public ResultData findById(@RequestParam Long id) { | |||||
| logger.debug("[" + getIpAddr() + "] TtCouponController::findById"); | |||||
| if (id == null) { | |||||
| return new ResultData(ResultData.ERROR, "缺少id"); | |||||
| } | |||||
| return new ResultData(ttUpSettleinService.getById(id)); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,50 @@ | |||||
| package com.iformall.controller; | |||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.tt.TtUpSettlein; | |||||
| import com.iformall.service.tt.TtUpSettleinService; | |||||
| import io.swagger.annotations.Api; | |||||
| import io.swagger.annotations.ApiImplicitParam; | |||||
| import io.swagger.annotations.ApiImplicitParams; | |||||
| import io.swagger.annotations.ApiOperation; | |||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.web.bind.annotation.*; | |||||
| @RestController | |||||
| @RequestMapping("/api/upSettlein") | |||||
| @Api(description = "业态查询接口") | |||||
| public class TtUpSettleinController extends BaseController { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| private TtUpSettleinService ttUpSettleinService; | |||||
| @ApiOperation("新增接口") | |||||
| @PostMapping("add") | |||||
| public ResultData add(@RequestBody TtUpSettlein record) { | |||||
| logger.debug("[" + getIpAddr() + "] TtUpSettleinController::add"); | |||||
| if(record == null){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | |||||
| } | |||||
| record.updateTenantInfo(getTenantInfo()); | |||||
| return ttUpSettleinService.saveOrUpdate(record); | |||||
| } | |||||
| @ApiOperation("发送手机验证码") | |||||
| @GetMapping("sendLoginPhoneCode") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "phone", value = "手机号", dataType = "String", paramType = "query", required = true)}) | |||||
| public ResultData sendLoginPhoneCode(String phone) { | |||||
| logger.debug("[" + getIpAddr() + "] HomeController::sendlogincode"); | |||||
| if(StringUtils.isNotBlank(phone)){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||||
| } | |||||
| return null; | |||||
| } | |||||
| } | |||||