Ver código fonte

[营销系统][疲劳度设置]

release_toaliyun_real
gongbiao 7 anos atrás
pai
commit
822b9d9327
4 arquivos alterados com 53 adições e 23 exclusões
  1. +10
    -1
      mallinkAdmin/src/main/java/com/iformall/controller/PushLimitController.java
  2. +4
    -9
      mallinkService/src/main/java/com/iformall/service/PushLimitService.java
  3. +38
    -12
      mallinkService/src/main/java/com/iformall/service/impl/PushLimitServiceImpl.java
  4. +1
    -1
      mallinkService/src/main/resources/mapper/PushLimitMapper.xml

+ 10
- 1
mallinkAdmin/src/main/java/com/iformall/controller/PushLimitController.java Ver arquivo

@@ -35,7 +35,7 @@ public class PushLimitController extends BaseController {
@ApiOperation("根据id更新接口") @ApiOperation("根据id更新接口")
@PostMapping("update") @PostMapping("update")
public ResultData update(@RequestBody PushLimit pushLimit) { public ResultData update(@RequestBody PushLimit pushLimit) {
pushLimit.setMsgAmount(null);
pushLimit.setTenantId(getTenantId());
pushLimitService.saveOrUpdate(pushLimit); pushLimitService.saveOrUpdate(pushLimit);
return new ResultData(); return new ResultData();
} }
@@ -56,4 +56,13 @@ public class PushLimitController extends BaseController {
} }




@ApiOperation("默认数据接口")
@GetMapping("/getDefaultData")
public ResultData getDefaultData() {

PushLimit pushLimit=pushLimitService.getDefaultData(getTenantId());
return new ResultData(pushLimit);
}


} }

+ 4
- 9
mallinkService/src/main/java/com/iformall/service/PushLimitService.java Ver arquivo

@@ -26,8 +26,8 @@ public interface PushLimitService {
/** /**
* 保存或更新实体 * 保存或更新实体
* *
* @param record
*/
* @param record
*/
void saveOrUpdate(PushLimit record); void saveOrUpdate(PushLimit record);


/** /**
@@ -36,12 +36,7 @@ public interface PushLimitService {
* @param id * @param id
*/ */
void deleteById(Long id); void deleteById(Long id);



PushLimit getDefaultData(String tenantId);
} }

+ 38
- 12
mallinkService/src/main/java/com/iformall/service/impl/PushLimitServiceImpl.java Ver arquivo

@@ -9,6 +9,8 @@ import com.iformall.service.PushLimitService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;


import java.util.List;

@Service @Service
public class PushLimitServiceImpl implements PushLimitService { public class PushLimitServiceImpl implements PushLimitService {
@@ -28,26 +30,50 @@ public class PushLimitServiceImpl implements PushLimitService {


@Override @Override
public void saveOrUpdate(PushLimit record) { public void saveOrUpdate(PushLimit record) {
if (record.getId() == null) {
//record.setId(UUID.randomUUID().toString().replaceAll("-", ""));
PushLimit params=new PushLimit();
params.setTenantId(record.getTenantId());
List<PushLimit> list = pushLimitMapper.findList(params);
if(list.size()>0){
pushLimitMapper.updateByPrimaryKeySelective(record);
}else{
final IdWorker idWorker = IdWorker.get(); final IdWorker idWorker = IdWorker.get();
record.setId(idWorker.nextId()); record.setId(idWorker.nextId());
pushLimitMapper.insertSelective(record); pushLimitMapper.insertSelective(record);
} else {
pushLimitMapper.updateByPrimaryKeySelective(record);
} }
// if (record.getId() == null) {
// //record.setId(UUID.randomUUID().toString().replaceAll("-", ""));
// final IdWorker idWorker = IdWorker.get();
// record.setId(idWorker.nextId());
// pushLimitMapper.insertSelective(record);
// return record.getId();
// } else {
// pushLimitMapper.updateByPrimaryKeySelective(record);
// return record.getId();
// }
} }


@Override @Override
public void deleteById(Long id) { public void deleteById(Long id) {
pushLimitMapper.deleteByPrimaryKey(id); pushLimitMapper.deleteByPrimaryKey(id);
} }

@Override
public PushLimit getDefaultData(String tenantId) {
PushLimit record =new PushLimit();
record.setTenantId(tenantId);
List<PushLimit> list = pushLimitMapper.findList(record);
if(list.size()>0){
record=list.get(0);
}else{
record=new PushLimit();
record.setMsgAmount(3);
record.setRefuseTimeStart("00:00");
record.setRefuseTimeEnd("23:45");
record.setCouponDay(10);
record.setCouponAmount(10);
}
return record;
}


} }

+ 1
- 1
mallinkService/src/main/resources/mapper/PushLimitMapper.xml Ver arquivo

@@ -26,7 +26,7 @@
</if> </if>


<if test=" null != tenantId "> <if test=" null != tenantId ">
and `tenant_id` like concat('%', #{tenantId},'%')
and `tenant_id` = #{tenantId}


</if> </if>




Carregando…
Cancelar
Salvar