11 changed files with 716 additions and 0 deletions
@ -0,0 +1,86 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.resi.partymember.dto; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* |
||||
|
* @author elink elink@elink-cn.com |
||||
|
* @since v1.0.0 2024-09-11 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class IcWeatherDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 唯一标识 |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 客户Id (customer.id) |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
*/ |
||||
|
private Date saveTime; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
*/ |
||||
|
private String content; |
||||
|
|
||||
|
/** |
||||
|
* 删除标识:0.未删除 1.已删除 |
||||
|
*/ |
||||
|
private Integer delFlag; |
||||
|
|
||||
|
/** |
||||
|
* 乐观锁 |
||||
|
*/ |
||||
|
private Integer revision; |
||||
|
|
||||
|
/** |
||||
|
* 创建人 |
||||
|
*/ |
||||
|
private String createdBy; |
||||
|
|
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
private Date createdTime; |
||||
|
|
||||
|
/** |
||||
|
* 更新人 |
||||
|
*/ |
||||
|
private String updatedBy; |
||||
|
|
||||
|
/** |
||||
|
* 更新时间 |
||||
|
*/ |
||||
|
private Date updatedTime; |
||||
|
|
||||
|
} |
@ -0,0 +1,45 @@ |
|||||
|
package com.epmet.resi.partymember.dto.partymember.form; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @Description |
||||
|
* @Author zhaoqifeng |
||||
|
* @Date 2021/11/19 9:49 |
||||
|
*/ |
||||
|
@NoArgsConstructor |
||||
|
@Data |
||||
|
public class WeatherSaveThirdFormDTO implements Serializable { |
||||
|
private static final long serialVersionUID = 4743261460276449408L; |
||||
|
|
||||
|
public interface WeatherSaveThirdGroup {} |
||||
|
/* @NotBlank(message = "username不能为空",groups = WeatherSaveThirdGroup.class) |
||||
|
private String username; |
||||
|
@NotBlank(message = "password不能为空",groups = WeatherSaveThirdGroup.class) |
||||
|
private String password; |
||||
|
@NotBlank(message = "content不能为空",groups = WeatherSaveThirdGroup.class) |
||||
|
private String content;*/ |
||||
|
// 雨量
|
||||
|
private String rainfall; |
||||
|
|
||||
|
// 温度
|
||||
|
private String ambientTemperature; |
||||
|
|
||||
|
// 湿度
|
||||
|
private String ambientHumidity; |
||||
|
|
||||
|
// 光照
|
||||
|
private String lightIntensity; |
||||
|
|
||||
|
// 土壤湿度
|
||||
|
private String soilHumi; |
||||
|
|
||||
|
// 土壤温度
|
||||
|
private String soilTemp; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,95 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.modules.partymember.controller; |
||||
|
|
||||
|
|
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.commons.tools.utils.ExcelUtils; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.commons.tools.validator.AssertUtils; |
||||
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
||||
|
import com.epmet.commons.tools.validator.group.AddGroup; |
||||
|
import com.epmet.commons.tools.validator.group.DefaultGroup; |
||||
|
import com.epmet.commons.tools.validator.group.UpdateGroup; |
||||
|
import com.epmet.modules.partymember.excel.IcWeatherExcel; |
||||
|
import com.epmet.modules.partymember.service.IcWeatherService; |
||||
|
import com.epmet.resi.partymember.dto.IcWeatherDTO; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletResponse; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* |
||||
|
* @author elink elink@elink-cn.com |
||||
|
* @since v1.0.0 2024-09-11 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("icweather") |
||||
|
public class IcWeatherController { |
||||
|
|
||||
|
@Autowired |
||||
|
private IcWeatherService icWeatherService; |
||||
|
|
||||
|
@GetMapping("page") |
||||
|
public Result<PageData<IcWeatherDTO>> page(@RequestParam Map<String, Object> params){ |
||||
|
PageData<IcWeatherDTO> page = icWeatherService.page(params); |
||||
|
return new Result<PageData<IcWeatherDTO>>().ok(page); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("{id}") |
||||
|
public Result<IcWeatherDTO> get(@PathVariable("id") String id){ |
||||
|
IcWeatherDTO data = icWeatherService.get(id); |
||||
|
return new Result<IcWeatherDTO>().ok(data); |
||||
|
} |
||||
|
|
||||
|
@PostMapping |
||||
|
public Result save(@RequestBody IcWeatherDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
||||
|
icWeatherService.save(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@PutMapping |
||||
|
public Result update(@RequestBody IcWeatherDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
||||
|
icWeatherService.update(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@DeleteMapping |
||||
|
public Result delete(@RequestBody String[] ids){ |
||||
|
//效验数据
|
||||
|
AssertUtils.isArrayEmpty(ids, "id"); |
||||
|
icWeatherService.delete(ids); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("export") |
||||
|
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
||||
|
List<IcWeatherDTO> list = icWeatherService.list(params); |
||||
|
ExcelUtils.exportExcelToTarget(response, null, list, IcWeatherExcel.class); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,33 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.modules.partymember.dao; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.dao.BaseDao; |
||||
|
import com.epmet.modules.partymember.entity.IcWeatherEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* |
||||
|
* @author elink elink@elink-cn.com |
||||
|
* @since v1.0.0 2024-09-11 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface IcWeatherDao extends BaseDao<IcWeatherEntity> { |
||||
|
|
||||
|
} |
@ -0,0 +1,74 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.modules.partymember.entity; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* |
||||
|
* @author elink elink@elink-cn.com |
||||
|
* @since v1.0.0 2024-09-11 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper=false) |
||||
|
@TableName("ic_weather") |
||||
|
public class IcWeatherEntity extends BaseEpmetEntity { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 客户Id (customer.id) |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
*/ |
||||
|
private Date saveTime; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
*/ |
||||
|
private String content; |
||||
|
|
||||
|
// 雨量
|
||||
|
private String rainfall; |
||||
|
|
||||
|
// 温度
|
||||
|
private String ambientTemperature; |
||||
|
|
||||
|
// 湿度
|
||||
|
private String ambientHumidity; |
||||
|
|
||||
|
// 光照
|
||||
|
private String lightIntensity; |
||||
|
|
||||
|
// 土壤湿度
|
||||
|
private String soilHumi; |
||||
|
|
||||
|
// 土壤温度
|
||||
|
private String soilTemp; |
||||
|
|
||||
|
} |
@ -0,0 +1,65 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.modules.partymember.excel; |
||||
|
|
||||
|
import cn.afterturn.easypoi.excel.annotation.Excel; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* |
||||
|
* @author elink elink@elink-cn.com |
||||
|
* @since v1.0.0 2024-09-11 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class IcWeatherExcel { |
||||
|
|
||||
|
@Excel(name = "唯一标识") |
||||
|
private String id; |
||||
|
|
||||
|
@Excel(name = "客户Id (customer.id)") |
||||
|
private String customerId; |
||||
|
|
||||
|
@Excel(name = "") |
||||
|
private Date saveTime; |
||||
|
|
||||
|
@Excel(name = "") |
||||
|
private String content; |
||||
|
|
||||
|
@Excel(name = "删除标识:0.未删除 1.已删除") |
||||
|
private Integer delFlag; |
||||
|
|
||||
|
@Excel(name = "乐观锁") |
||||
|
private Integer revision; |
||||
|
|
||||
|
@Excel(name = "创建人") |
||||
|
private String createdBy; |
||||
|
|
||||
|
@Excel(name = "创建时间") |
||||
|
private Date createdTime; |
||||
|
|
||||
|
@Excel(name = "更新人") |
||||
|
private String updatedBy; |
||||
|
|
||||
|
@Excel(name = "更新时间") |
||||
|
private Date updatedTime; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,44 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.modules.partymember.redis; |
||||
|
|
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* |
||||
|
* @author elink elink@elink-cn.com |
||||
|
* @since v1.0.0 2024-09-11 |
||||
|
*/ |
||||
|
@Component |
||||
|
public class IcWeatherRedis { |
||||
|
|
||||
|
public void delete(Object[] ids) { |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public void set(){ |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public String get(String id){ |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,102 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.modules.partymember.service; |
||||
|
|
||||
|
|
||||
|
|
||||
|
import com.epmet.commons.mybatis.service.BaseService; |
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.modules.partymember.entity.IcWeatherEntity; |
||||
|
import com.epmet.resi.partymember.dto.IcWeatherDTO; |
||||
|
import com.epmet.resi.partymember.dto.partymember.form.WeatherSaveThirdFormDTO; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* |
||||
|
* @author elink elink@elink-cn.com |
||||
|
* @since v1.0.0 2024-09-11 |
||||
|
*/ |
||||
|
public interface IcWeatherService extends BaseService<IcWeatherEntity> { |
||||
|
|
||||
|
/** |
||||
|
* 默认分页 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return PageData<IcWeatherDTO> |
||||
|
* @author generator |
||||
|
* @date 2024-09-11 |
||||
|
*/ |
||||
|
PageData<IcWeatherDTO> page(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 默认查询 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return java.util.List<IcWeatherDTO> |
||||
|
* @author generator |
||||
|
* @date 2024-09-11 |
||||
|
*/ |
||||
|
List<IcWeatherDTO> list(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 单条查询 |
||||
|
* |
||||
|
* @param id |
||||
|
* @return IcWeatherDTO |
||||
|
* @author generator |
||||
|
* @date 2024-09-11 |
||||
|
*/ |
||||
|
IcWeatherDTO get(String id); |
||||
|
|
||||
|
/** |
||||
|
* 默认保存 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2024-09-11 |
||||
|
*/ |
||||
|
void save(IcWeatherDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 默认更新 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2024-09-11 |
||||
|
*/ |
||||
|
void update(IcWeatherDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除 |
||||
|
* |
||||
|
* @param ids |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2024-09-11 |
||||
|
*/ |
||||
|
void delete(String[] ids); |
||||
|
|
||||
|
Boolean weatherSaveThird(WeatherSaveThirdFormDTO formDTO); |
||||
|
|
||||
|
IcWeatherEntity getWeather(); |
||||
|
} |
@ -0,0 +1,134 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.modules.partymember.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
||||
|
import com.epmet.commons.tools.constant.FieldConstant; |
||||
|
import com.epmet.commons.tools.exception.ErrorCode; |
||||
|
import com.epmet.commons.tools.exception.RenException; |
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.commons.tools.utils.ConvertUtils; |
||||
|
import com.epmet.commons.tools.utils.DateUtils; |
||||
|
import com.epmet.modules.partymember.dao.IcWeatherDao; |
||||
|
import com.epmet.modules.partymember.entity.IcWeatherEntity; |
||||
|
import com.epmet.modules.partymember.redis.IcWeatherRedis; |
||||
|
import com.epmet.modules.partymember.service.IcWeatherService; |
||||
|
import com.epmet.resi.partymember.dto.IcWeatherDTO; |
||||
|
import com.epmet.resi.partymember.dto.partymember.form.WeatherSaveThirdFormDTO; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.apache.poi.ss.formula.functions.Now; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import java.util.Arrays; |
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* |
||||
|
* @author elink elink@elink-cn.com |
||||
|
* @since v1.0.0 2024-09-11 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class IcWeatherServiceImpl extends BaseServiceImpl<IcWeatherDao, IcWeatherEntity> implements IcWeatherService { |
||||
|
|
||||
|
@Autowired |
||||
|
private IcWeatherRedis icWeatherRedis; |
||||
|
|
||||
|
@Override |
||||
|
public PageData<IcWeatherDTO> page(Map<String, Object> params) { |
||||
|
IPage<IcWeatherEntity> page = baseDao.selectPage( |
||||
|
getPage(params, FieldConstant.CREATED_TIME, false), |
||||
|
getWrapper(params) |
||||
|
); |
||||
|
return getPageData(page, IcWeatherDTO.class); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<IcWeatherDTO> list(Map<String, Object> params) { |
||||
|
List<IcWeatherEntity> entityList = baseDao.selectList(getWrapper(params)); |
||||
|
|
||||
|
return ConvertUtils.sourceToTarget(entityList, IcWeatherDTO.class); |
||||
|
} |
||||
|
|
||||
|
private QueryWrapper<IcWeatherEntity> getWrapper(Map<String, Object> params){ |
||||
|
String id = (String)params.get(FieldConstant.ID_HUMP); |
||||
|
|
||||
|
QueryWrapper<IcWeatherEntity> wrapper = new QueryWrapper<>(); |
||||
|
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
||||
|
|
||||
|
return wrapper; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public IcWeatherDTO get(String id) { |
||||
|
IcWeatherEntity entity = baseDao.selectById(id); |
||||
|
return ConvertUtils.sourceToTarget(entity, IcWeatherDTO.class); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void save(IcWeatherDTO dto) { |
||||
|
IcWeatherEntity entity = ConvertUtils.sourceToTarget(dto, IcWeatherEntity.class); |
||||
|
insert(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void update(IcWeatherDTO dto) { |
||||
|
IcWeatherEntity entity = ConvertUtils.sourceToTarget(dto, IcWeatherEntity.class); |
||||
|
updateById(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void delete(String[] ids) { |
||||
|
// 逻辑删除(@TableLogic 注解)
|
||||
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Boolean weatherSaveThird(WeatherSaveThirdFormDTO formDTO) { |
||||
|
|
||||
|
/* if (!formDTO.getUsername().equals("yifeng") || !formDTO.getPassword().equals("yifeng_elink")){ |
||||
|
throw new RenException(ErrorCode.ACCOUNT_PASSWORD_ERROR,"账号密码错误"); |
||||
|
}*/ |
||||
|
IcWeatherEntity weatherEntity = ConvertUtils.sourceToTarget(formDTO,IcWeatherEntity.class); |
||||
|
/*weatherEntity.setContent(formDTO.getContent());*/ |
||||
|
weatherEntity.setSaveTime(new Date()); |
||||
|
baseDao.insert(weatherEntity); |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public IcWeatherEntity getWeather() { |
||||
|
|
||||
|
LambdaQueryWrapper<IcWeatherEntity> queryWrapper = new LambdaQueryWrapper<IcWeatherEntity>(); |
||||
|
queryWrapper.orderByDesc(IcWeatherEntity::getCreatedTime); |
||||
|
queryWrapper.last("limit 1"); |
||||
|
IcWeatherEntity entity = baseDao.selectOne(queryWrapper); |
||||
|
return entity; |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,20 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
|
||||
|
<mapper namespace="com.epmet.modules.partymember.dao.IcWeatherDao"> |
||||
|
|
||||
|
<resultMap type="com.epmet.modules.partymember.entity.IcWeatherEntity" id="icWeatherMap"> |
||||
|
<result property="id" column="ID"/> |
||||
|
<result property="customerId" column="CUSTOMER_ID"/> |
||||
|
<result property="saveTime" column="SAVE_TIME"/> |
||||
|
<result property="content" column="CONTENT"/> |
||||
|
<result property="delFlag" column="DEL_FLAG"/> |
||||
|
<result property="revision" column="REVISION"/> |
||||
|
<result property="createdBy" column="CREATED_BY"/> |
||||
|
<result property="createdTime" column="CREATED_TIME"/> |
||||
|
<result property="updatedBy" column="UPDATED_BY"/> |
||||
|
<result property="updatedTime" column="UPDATED_TIME"/> |
||||
|
</resultMap> |
||||
|
|
||||
|
|
||||
|
</mapper> |
Loading…
Reference in new issue