forked from rongchao/epmet-cloud-rizhao
25 changed files with 1229 additions and 7 deletions
@ -0,0 +1,63 @@ |
|||
package com.epmet.dto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
|
|||
/** |
|||
* 日照:投诉建议 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2023-08-25 |
|||
*/ |
|||
@Data |
|||
public class IcComplaintsDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -3506231337265221127L; |
|||
|
|||
/** |
|||
* 主键ID |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 客户ID |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 投诉人ID |
|||
*/ |
|||
private String resiUserId; |
|||
|
|||
/** |
|||
* 投诉人姓名 |
|||
*/ |
|||
private String userName; |
|||
|
|||
/** |
|||
* 投诉人电话 |
|||
*/ |
|||
private String mobile; |
|||
|
|||
/** |
|||
* 投诉内容 |
|||
*/ |
|||
private String content; |
|||
|
|||
/** |
|||
* 处理状态 0、待处理 1、处理中 2、已完成 |
|||
*/ |
|||
private Integer state; |
|||
|
|||
/** |
|||
* 投诉类型 |
|||
*/ |
|||
private Integer type; |
|||
|
|||
/** |
|||
* 照片附件 |
|||
*/ |
|||
private String[] imgs; |
|||
} |
@ -0,0 +1,54 @@ |
|||
package com.epmet.dto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
|
|||
/** |
|||
* 日照:投诉建议处理表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2023-08-25 |
|||
*/ |
|||
@Data |
|||
public class IcComplaintsReplyDTO implements Serializable { |
|||
|
|||
|
|||
private static final long serialVersionUID = 5978243906188087190L; |
|||
/** |
|||
* 主键ID |
|||
*/ |
|||
private Integer id; |
|||
|
|||
/** |
|||
* 客户ID |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 投诉建议主键ID |
|||
*/ |
|||
private String complantsId; |
|||
|
|||
/** |
|||
* 处理状态 0、待处理 1、处理中 2、已完成 |
|||
*/ |
|||
private Integer state; |
|||
|
|||
/** |
|||
* 处理情况 |
|||
*/ |
|||
private String content; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
} |
@ -0,0 +1,112 @@ |
|||
package com.epmet.controller; |
|||
|
|||
import com.epmet.commons.tools.annotation.LoginUser; |
|||
import com.epmet.commons.tools.aop.NoRepeatSubmit; |
|||
import com.epmet.commons.tools.exception.EpmetException; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.security.dto.TokenDto; |
|||
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.dto.IcComplaintsDTO; |
|||
import com.epmet.service.IcComplaintsService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
|
|||
/** |
|||
* 日照:投诉建议 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2023-08-25 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("icComplaints") |
|||
public class IcComplaintsController { |
|||
|
|||
@Autowired |
|||
private IcComplaintsService icComplaintsService; |
|||
|
|||
@RequestMapping("page") |
|||
public Result<PageData<IcComplaintsDTO>> page(@RequestParam Map<String, Object> params) { |
|||
PageData<IcComplaintsDTO> page = icComplaintsService.page(params); |
|||
return new Result<PageData<IcComplaintsDTO>>().ok(page); |
|||
} |
|||
|
|||
@RequestMapping(value = "{id}", method = {RequestMethod.POST, RequestMethod.GET}) |
|||
public Result<IcComplaintsDTO> get(@PathVariable("id") String id) { |
|||
IcComplaintsDTO data = icComplaintsService.get(id); |
|||
return new Result<IcComplaintsDTO>().ok(data); |
|||
} |
|||
|
|||
@NoRepeatSubmit |
|||
@PostMapping("save") |
|||
public Result save(@RequestBody IcComplaintsDTO dto) { |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
icComplaintsService.save(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@NoRepeatSubmit |
|||
@PostMapping("update") |
|||
public Result update(@RequestBody IcComplaintsDTO dto) { |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
icComplaintsService.update(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PostMapping("delete") |
|||
public Result delete(@RequestBody String[] ids) { |
|||
//效验数据
|
|||
AssertUtils.isArrayEmpty(ids, "id"); |
|||
icComplaintsService.delete(ids); |
|||
return new Result(); |
|||
} |
|||
|
|||
/** |
|||
* 小程序居民端上报投诉 |
|||
*/ |
|||
@NoRepeatSubmit |
|||
@PostMapping("addComplaints") |
|||
public Result addComplaints(@LoginUser TokenDto tokenDto, @RequestBody IcComplaintsDTO dto) { |
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
dto.setCustomerId(tokenDto.getCustomerId()); |
|||
dto.setResiUserId(tokenDto.getUserId()); |
|||
icComplaintsService.addComplaints(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
/** |
|||
* 投诉详情 |
|||
*/ |
|||
@NoRepeatSubmit |
|||
@PostMapping("getComplaintsById") |
|||
public Result<IcComplaintsDTO> getComplaintsById(@LoginUser TokenDto tokenDto, @RequestParam Map<String, String> params) { |
|||
if (null != tokenDto) { |
|||
return new Result<IcComplaintsDTO>().ok(icComplaintsService.get(params.get("id"))); |
|||
} else { |
|||
throw new EpmetException("请登陆后查询!"); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 居民投诉列表 |
|||
* |
|||
* @param tokenDto |
|||
* @return |
|||
*/ |
|||
@NoRepeatSubmit |
|||
@PostMapping("myComplanintsList") |
|||
public Result<List<IcComplaintsDTO>> myComplanintsList(@LoginUser TokenDto tokenDto, @RequestParam Map<String, Object> params) { |
|||
List<IcComplaintsDTO> result = icComplaintsService.myComplanintsList(tokenDto.getUserId(), params); |
|||
return new Result<List<IcComplaintsDTO>>().ok(result); |
|||
} |
|||
} |
@ -0,0 +1,72 @@ |
|||
package com.epmet.controller; |
|||
|
|||
import com.epmet.commons.tools.aop.NoRepeatSubmit; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
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.dto.IcComplaintsReplyDTO; |
|||
import com.epmet.service.IcComplaintsReplyService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.Map; |
|||
|
|||
|
|||
/** |
|||
* 日照:投诉建议处理 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2023-08-25 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("icComplaintsReply") |
|||
public class IcComplaintsReplyController { |
|||
|
|||
@Autowired |
|||
private IcComplaintsReplyService icComplaintsReplyService; |
|||
|
|||
@RequestMapping("page") |
|||
public Result<PageData<IcComplaintsReplyDTO>> page(@RequestParam Map<String, Object> params){ |
|||
PageData<IcComplaintsReplyDTO> page = icComplaintsReplyService.page(params); |
|||
return new Result<PageData<IcComplaintsReplyDTO>>().ok(page); |
|||
} |
|||
|
|||
@RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET}) |
|||
public Result<IcComplaintsReplyDTO> get(@PathVariable("id") String id){ |
|||
IcComplaintsReplyDTO data = icComplaintsReplyService.get(id); |
|||
return new Result<IcComplaintsReplyDTO>().ok(data); |
|||
} |
|||
|
|||
@NoRepeatSubmit |
|||
@PostMapping("save") |
|||
public Result save(@RequestBody IcComplaintsReplyDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
icComplaintsReplyService.save(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@NoRepeatSubmit |
|||
@PostMapping("update") |
|||
public Result update(@RequestBody IcComplaintsReplyDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
icComplaintsReplyService.update(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PostMapping("delete") |
|||
public Result delete(@RequestBody String[] ids){ |
|||
//效验数据
|
|||
AssertUtils.isArrayEmpty(ids, "id"); |
|||
icComplaintsReplyService.delete(ids); |
|||
return new Result(); |
|||
} |
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,16 @@ |
|||
package com.epmet.dao; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.entity.IcComplaintsEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
/** |
|||
* 日照:投诉建议 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2023-08-25 |
|||
*/ |
|||
@Mapper |
|||
public interface IcComplaintsDao extends BaseDao<IcComplaintsEntity> { |
|||
|
|||
} |
@ -0,0 +1,16 @@ |
|||
package com.epmet.dao; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.entity.IcComplaintsReplyEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
/** |
|||
* 日照:投诉建议处理表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2023-08-25 |
|||
*/ |
|||
@Mapper |
|||
public interface IcComplaintsReplyDao extends BaseDao<IcComplaintsReplyEntity> { |
|||
|
|||
} |
@ -0,0 +1,61 @@ |
|||
package com.epmet.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
/** |
|||
* 日照:投诉建议 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2023-08-25 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = false) |
|||
@TableName("ic_complaints") |
|||
public class IcComplaintsEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = -3726190218061182367L; |
|||
|
|||
/** |
|||
* 客户ID |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 投诉人ID |
|||
*/ |
|||
private String resiUserId; |
|||
|
|||
/** |
|||
* 投诉人姓名 |
|||
*/ |
|||
private String userName; |
|||
|
|||
/** |
|||
* 投诉人电话 |
|||
*/ |
|||
private String mobile; |
|||
|
|||
/** |
|||
* 投诉内容 |
|||
*/ |
|||
private String content; |
|||
|
|||
/** |
|||
* 处理状态 0、待处理 1、处理中 2、已完成 |
|||
*/ |
|||
private Integer state; |
|||
|
|||
/** |
|||
* 投诉类型 |
|||
*/ |
|||
private Integer type; |
|||
|
|||
/** |
|||
* 投诉附件 |
|||
*/ |
|||
private String imgs; |
|||
|
|||
} |
@ -0,0 +1,41 @@ |
|||
package com.epmet.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
/** |
|||
* 日照:投诉建议处理表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2023-08-25 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("ic_complaints_reply") |
|||
public class IcComplaintsReplyEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 3939092291283125627L; |
|||
|
|||
/** |
|||
* 客户ID |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 投诉建议主键ID |
|||
*/ |
|||
private String complantsId; |
|||
|
|||
/** |
|||
* 处理状态 0、待处理 1、处理中 2、已完成 |
|||
*/ |
|||
private Integer state; |
|||
|
|||
/** |
|||
* 处理情况 |
|||
*/ |
|||
private String content; |
|||
|
|||
} |
@ -0,0 +1,54 @@ |
|||
package com.epmet.excel; |
|||
|
|||
import cn.afterturn.easypoi.excel.annotation.Excel; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 日照:投诉建议 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2023-08-25 |
|||
*/ |
|||
@Data |
|||
public class IcComplaintsExcel { |
|||
|
|||
@Excel(name = "主键ID") |
|||
private String id; |
|||
|
|||
@Excel(name = "客户ID") |
|||
private String customerId; |
|||
|
|||
@Excel(name = "投诉人ID") |
|||
private String resiUserId; |
|||
|
|||
@Excel(name = "投诉内容") |
|||
private String content; |
|||
|
|||
@Excel(name = "处理状态 0、待处理 1、处理中 2、已完成") |
|||
private Integer state; |
|||
|
|||
@Excel(name = "投诉类型") |
|||
private Integer type; |
|||
|
|||
@Excel(name = "删除标识 0未删除、1已删除") |
|||
private String 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,51 @@ |
|||
package com.epmet.excel; |
|||
|
|||
import cn.afterturn.easypoi.excel.annotation.Excel; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 日照:投诉建议处理表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2023-08-25 |
|||
*/ |
|||
@Data |
|||
public class IcComplaintsReplyExcel { |
|||
|
|||
@Excel(name = "主键ID") |
|||
private Integer id; |
|||
|
|||
@Excel(name = "客户ID") |
|||
private String customerId; |
|||
|
|||
@Excel(name = "投诉建议主键ID") |
|||
private String complantsId; |
|||
|
|||
@Excel(name = "处理状态 0、待处理 1、处理中 2、已完成") |
|||
private Integer state; |
|||
|
|||
@Excel(name = "处理情况") |
|||
private String content; |
|||
|
|||
@Excel(name = "删除标识 0未删除、1已删除") |
|||
private String 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,78 @@ |
|||
package com.epmet.service; |
|||
|
|||
import com.epmet.commons.mybatis.service.BaseService; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.dto.IcComplaintsReplyDTO; |
|||
import com.epmet.entity.IcComplaintsReplyEntity; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 日照:投诉建议处理表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2023-08-25 |
|||
*/ |
|||
public interface IcComplaintsReplyService extends BaseService<IcComplaintsReplyEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<IcComplaintsReplyDTO> |
|||
* @author generator |
|||
* @date 2023-08-25 |
|||
*/ |
|||
PageData<IcComplaintsReplyDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<IcComplaintsReplyDTO> |
|||
* @author generator |
|||
* @date 2023-08-25 |
|||
*/ |
|||
List<IcComplaintsReplyDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return IcComplaintsReplyDTO |
|||
* @author generator |
|||
* @date 2023-08-25 |
|||
*/ |
|||
IcComplaintsReplyDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2023-08-25 |
|||
*/ |
|||
void save(IcComplaintsReplyDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2023-08-25 |
|||
*/ |
|||
void update(IcComplaintsReplyDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2023-08-25 |
|||
*/ |
|||
void delete(String[] ids); |
|||
} |
@ -0,0 +1,92 @@ |
|||
package com.epmet.service; |
|||
|
|||
import com.epmet.commons.mybatis.service.BaseService; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.dto.IcComplaintsDTO; |
|||
import com.epmet.entity.IcComplaintsEntity; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 日照:投诉建议 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2023-08-25 |
|||
*/ |
|||
public interface IcComplaintsService extends BaseService<IcComplaintsEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<IcComplaintsDTO> |
|||
* @author generator |
|||
* @date 2023-08-25 |
|||
*/ |
|||
PageData<IcComplaintsDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<IcComplaintsDTO> |
|||
* @author generator |
|||
* @date 2023-08-25 |
|||
*/ |
|||
List<IcComplaintsDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return IcComplaintsDTO |
|||
* @author generator |
|||
* @date 2023-08-25 |
|||
*/ |
|||
IcComplaintsDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2023-08-25 |
|||
*/ |
|||
void save(IcComplaintsDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2023-08-25 |
|||
*/ |
|||
void update(IcComplaintsDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2023-08-25 |
|||
*/ |
|||
void delete(String[] ids); |
|||
|
|||
/** |
|||
* 居民端上报投诉 |
|||
*/ |
|||
void addComplaints(IcComplaintsDTO dto); |
|||
|
|||
/** |
|||
* 居民投诉列表 |
|||
* |
|||
* @param userId |
|||
* @return |
|||
*/ |
|||
List<IcComplaintsDTO> myComplanintsList(String userId,Map<String,Object> params); |
|||
|
|||
} |
@ -0,0 +1,82 @@ |
|||
package com.epmet.service.impl; |
|||
|
|||
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.page.PageData; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.dao.IcComplaintsReplyDao; |
|||
import com.epmet.dto.IcComplaintsReplyDTO; |
|||
import com.epmet.entity.IcComplaintsReplyEntity; |
|||
import com.epmet.service.IcComplaintsReplyService; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 日照:投诉建议处理表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2023-08-25 |
|||
*/ |
|||
@Service |
|||
public class IcComplaintsReplyServiceImpl extends BaseServiceImpl<IcComplaintsReplyDao, IcComplaintsReplyEntity> implements IcComplaintsReplyService { |
|||
|
|||
@Override |
|||
public PageData<IcComplaintsReplyDTO> page(Map<String, Object> params) { |
|||
IPage<IcComplaintsReplyEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, IcComplaintsReplyDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<IcComplaintsReplyDTO> list(Map<String, Object> params) { |
|||
List<IcComplaintsReplyEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, IcComplaintsReplyDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<IcComplaintsReplyEntity> getWrapper(Map<String, Object> params){ |
|||
String id = (String)params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<IcComplaintsReplyEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public IcComplaintsReplyDTO get(String id) { |
|||
IcComplaintsReplyEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, IcComplaintsReplyDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(IcComplaintsReplyDTO dto) { |
|||
IcComplaintsReplyEntity entity = ConvertUtils.sourceToTarget(dto, IcComplaintsReplyEntity.class); |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(IcComplaintsReplyDTO dto) { |
|||
IcComplaintsReplyEntity entity = ConvertUtils.sourceToTarget(dto, IcComplaintsReplyEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,213 @@ |
|||
package com.epmet.service.impl; |
|||
|
|||
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.EpmetErrorCode; |
|||
import com.epmet.commons.tools.exception.EpmetException; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.scan.param.TextScanParamDTO; |
|||
import com.epmet.commons.tools.scan.param.TextTaskDTO; |
|||
import com.epmet.commons.tools.scan.result.SyncScanResult; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.utils.ScanContentUtils; |
|||
import com.epmet.dao.IcComplaintsDao; |
|||
import com.epmet.dto.IcComplaintsDTO; |
|||
import com.epmet.dto.form.CommonUserIdFormDTO; |
|||
import com.epmet.dto.result.ExtUserInfoResultDTO; |
|||
import com.epmet.dto.result.LoginUserDetailsResultDTO; |
|||
import com.epmet.entity.IcComplaintsEntity; |
|||
import com.epmet.feign.EpmetUserOpenFeignClient; |
|||
import com.epmet.remote.EpmetUserRemoteService; |
|||
import com.epmet.service.IcComplaintsService; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Value; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
import org.springframework.util.CollectionUtils; |
|||
|
|||
import javax.annotation.Resource; |
|||
import java.util.*; |
|||
|
|||
/** |
|||
* 日照:投诉建议 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2023-08-25 |
|||
*/ |
|||
@Service |
|||
public class IcComplaintsServiceImpl extends BaseServiceImpl<IcComplaintsDao, IcComplaintsEntity> implements IcComplaintsService { |
|||
|
|||
@Value("${openapi.scan.server.url}") |
|||
private String scanApiUrl; |
|||
|
|||
@Value("${openapi.scan.method.textSyncScan}") |
|||
private String textSyncScanMethod; |
|||
|
|||
@Resource |
|||
private EpmetUserRemoteService remoteService; |
|||
|
|||
@Resource |
|||
private EpmetUserOpenFeignClient openFeignClient; |
|||
|
|||
@Resource |
|||
private EpmetUserOpenFeignClient userOpenFeignClient; |
|||
|
|||
@Override |
|||
public PageData<IcComplaintsDTO> page(Map<String, Object> params) { |
|||
IPage<IcComplaintsEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, IcComplaintsDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<IcComplaintsDTO> list(Map<String, Object> params) { |
|||
List<IcComplaintsEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
return ConvertUtils.sourceToTarget(entityList, IcComplaintsDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<IcComplaintsEntity> getWrapper(Map<String, Object> params) { |
|||
String id = (String) params.get(FieldConstant.ID_HUMP); |
|||
String userName = (String) params.get("userName"); |
|||
String state = (String) params.get("state"); |
|||
String type = (String) params.get("type"); |
|||
String content = (String) params.get("content"); |
|||
String startTime = (String) params.get("startTime"); |
|||
String endTime = (String) params.get("endTime"); |
|||
QueryWrapper<IcComplaintsEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
wrapper.like(StringUtils.isNotEmpty(userName), "USER_NAME", userName); |
|||
wrapper.eq(StringUtils.isNotEmpty(state), FieldConstant.STATE_HUMP, state); |
|||
wrapper.eq(StringUtils.isNotEmpty(type), "TYPE", type); |
|||
wrapper.like(StringUtils.isNotEmpty(content), "CONTENT", content); |
|||
wrapper.between(StringUtils.isNotEmpty(startTime), "CREATED_TIME", startTime, endTime); |
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public IcComplaintsDTO get(String id) { |
|||
IcComplaintsEntity entity = baseDao.selectById(id); |
|||
IcComplaintsDTO result = ConvertUtils.sourceToTarget(entity, IcComplaintsDTO.class); |
|||
if (StringUtils.isNotEmpty(entity.getImgs())) { |
|||
result.setImgs(entity.getImgs().split(",")); |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(IcComplaintsDTO dto) { |
|||
IcComplaintsEntity entity = ConvertUtils.sourceToTarget(dto, IcComplaintsEntity.class); |
|||
if (StringUtils.isNotEmpty(dto.getResiUserId())) { |
|||
CommonUserIdFormDTO param = new CommonUserIdFormDTO(); |
|||
param.setUserId(dto.getResiUserId()); |
|||
ExtUserInfoResultDTO userInfo = openFeignClient.extUserInfo(param).getData(); |
|||
if (null != userInfo) { |
|||
dto.setUserName(userInfo.getRealName()); |
|||
dto.setMobile(userInfo.getMobile()); |
|||
} else { |
|||
throw new EpmetException("未查询到当前用户信息,请联系管理员!"); |
|||
} |
|||
} else { |
|||
throw new EpmetException("未能获取到当前用户,请联系管理员!"); |
|||
} |
|||
LoginUserDetailsResultDTO userDetails = remoteService.getLoginUserDetails(); |
|||
entity.setCustomerId(userDetails.getCustomerId()); |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(IcComplaintsDTO dto) { |
|||
IcComplaintsEntity entity = ConvertUtils.sourceToTarget(dto, IcComplaintsEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
@Override |
|||
public void addComplaints(IcComplaintsDTO dto) { |
|||
// 判断是否注册居民
|
|||
Result<Boolean> isResiFlag = userOpenFeignClient.getIsResiFlag(dto.getResiUserId()); |
|||
if (!isResiFlag.success()) { |
|||
throw new EpmetException("查询是否注册居民失败..."); |
|||
} |
|||
if (!isResiFlag.getData()) { |
|||
throw new EpmetException(EpmetErrorCode.NOT_REGEIST_RESI.getCode()); |
|||
} |
|||
//审查用户提交内容
|
|||
scanContent(dto.getContent()); |
|||
IcComplaintsEntity entity = ConvertUtils.sourceToTarget(dto, IcComplaintsEntity.class); |
|||
if (StringUtils.isNotEmpty(dto.getResiUserId())) { |
|||
CommonUserIdFormDTO param = new CommonUserIdFormDTO(); |
|||
param.setUserId(dto.getResiUserId()); |
|||
ExtUserInfoResultDTO userInfo = openFeignClient.extUserInfo(param).getData(); |
|||
if (null != userInfo) { |
|||
entity.setUserName(userInfo.getRealName()); |
|||
entity.setMobile(userInfo.getMobile()); |
|||
entity.setState(0); |
|||
} else { |
|||
throw new EpmetException("查询用户信息失败" + dto.getResiUserId()); |
|||
} |
|||
} |
|||
if (!CollectionUtils.isEmpty(Arrays.asList(dto.getImgs()))) { |
|||
entity.setImgs(StringUtils.join(dto.getImgs(), ",")); |
|||
} |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
public List<IcComplaintsDTO> myComplanintsList(String userId, Map<String, Object> params) { |
|||
QueryWrapper<IcComplaintsEntity> wrapper = new QueryWrapper<>(); |
|||
String state = (String) params.get("state"); |
|||
wrapper.eq(StringUtils.isNotBlank(userId), "RESI_USER_ID", userId); |
|||
wrapper.eq(StringUtils.isNotBlank(state), "STATE", state); |
|||
List<IcComplaintsEntity> entityList = baseDao.selectList(wrapper); |
|||
List<IcComplaintsDTO> result; |
|||
if (!CollectionUtils.isEmpty(entityList)) { |
|||
result = ConvertUtils.sourceToTarget(entityList, IcComplaintsDTO.class); |
|||
entityList.forEach(entity -> { |
|||
result.forEach(dto -> { |
|||
if (entity.getId().equals(dto.getId())) { |
|||
dto.setImgs(entity.getImgs().split(",")); |
|||
} |
|||
}); |
|||
}); |
|||
return result; |
|||
} |
|||
return new ArrayList<>(); |
|||
} |
|||
|
|||
/** |
|||
* 检查上报内容是否合规 |
|||
* |
|||
* @param eventContent |
|||
*/ |
|||
private void scanContent(String eventContent) { |
|||
//事件内容
|
|||
if (StringUtils.isNotBlank(eventContent)) { |
|||
TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); |
|||
TextTaskDTO taskDTO = new TextTaskDTO(); |
|||
taskDTO.setContent(eventContent); |
|||
taskDTO.setDataId(UUID.randomUUID().toString().replace("-", "")); |
|||
textScanParamDTO.getTasks().add(taskDTO); |
|||
Result<SyncScanResult> textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); |
|||
if (!textSyncScanResult.success()) { |
|||
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode()); |
|||
} else { |
|||
if (!textSyncScanResult.getData().isAllPass()) { |
|||
throw new EpmetException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode(), EpmetErrorCode.TEXT_SCAN_FAILED.getMsg()); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,22 @@ |
|||
<?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.dao.IcComplaintsDao"> |
|||
|
|||
<resultMap type="com.epmet.entity.IcComplaintsEntity" id="icComplaintsMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="customerId" column="CUSTOMER_ID"/> |
|||
<result property="resiUserId" column="RESI_USER_ID"/> |
|||
<result property="content" column="CONTENT"/> |
|||
<result property="state" column="STATE"/> |
|||
<result property="type" column="TYPE"/> |
|||
<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> |
@ -0,0 +1,21 @@ |
|||
<?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.dao.IcComplaintsReplyDao"> |
|||
|
|||
<resultMap type="com.epmet.entity.IcComplaintsReplyEntity" id="icComplaintsReplyMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="customerId" column="CUSTOMER_ID"/> |
|||
<result property="complantsId" column="COMPLANTS_ID"/> |
|||
<result property="state" column="STATE"/> |
|||
<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