New file |
| | |
| | | package cn.huge.module.pauser.controller.web; |
| | | |
| | | import cn.huge.base.common.utils.ReturnFailUtils; |
| | | import cn.huge.base.common.utils.ReturnSucUtils; |
| | | import cn.huge.module.pauser.domain.po.PaUser; |
| | | import cn.huge.module.pauser.service.PaUserService; |
| | | import com.google.common.collect.Maps; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.PageRequest; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | | |
| | | /** |
| | | * @title: 公众用户表接口api-web端 |
| | | * @description: 公众用户表接口api-web端 |
| | | * @company: hugeinfo |
| | | * @author: liyj |
| | | * @time: 2024-08-19 20:04:19 |
| | | * @version: 1.0.0 |
| | | */ |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("/api/web/paUser") |
| | | public class PaUserWebController { |
| | | |
| | | @Autowired(required = false) |
| | | private HttpServletRequest request; |
| | | |
| | | @Autowired |
| | | private PaUserService service; |
| | | |
| | | /** |
| | | * 获取请求URL参数 |
| | | * @return Map<String, Object> |
| | | */ |
| | | private Map<String, Object> getParameter(){ |
| | | Map<String, Object> terms = Maps.newHashMap(); |
| | | // 当事人编号 |
| | | String id = request.getParameter("id"); |
| | | if (StringUtils.isNotBlank(id)){ |
| | | terms.put("id", id); |
| | | } |
| | | // 姓名 |
| | | String trueName = request.getParameter("trueName"); |
| | | if (StringUtils.isNotBlank(trueName)){ |
| | | terms.put("trueName", trueName); |
| | | } |
| | | // 性别 |
| | | String sex = request.getParameter("sex"); |
| | | if (StringUtils.isNotBlank(sex)){ |
| | | terms.put("sex", sex); |
| | | } |
| | | // 性别名称 |
| | | String sexName = request.getParameter("sexName"); |
| | | if (StringUtils.isNotBlank(sexName)){ |
| | | terms.put("sexName", sexName); |
| | | } |
| | | // 手机号码 |
| | | String mobile = request.getParameter("mobile"); |
| | | if (StringUtils.isNotBlank(mobile)){ |
| | | terms.put("mobile", mobile); |
| | | } |
| | | // 身份证号码 |
| | | String idcard = request.getParameter("idcard"); |
| | | if (StringUtils.isNotBlank(idcard)){ |
| | | terms.put("idcard", idcard); |
| | | } |
| | | // 电子邮箱 |
| | | String email = request.getParameter("email"); |
| | | if (StringUtils.isNotBlank(email)){ |
| | | terms.put("email", email); |
| | | } |
| | | // 微信号 |
| | | String wechat = request.getParameter("wechat"); |
| | | if (StringUtils.isNotBlank(wechat)){ |
| | | terms.put("wechat", wechat); |
| | | } |
| | | // QQ号 |
| | | String qq = request.getParameter("qq"); |
| | | if (StringUtils.isNotBlank(qq)){ |
| | | terms.put("qq", qq); |
| | | } |
| | | // 现居地省 |
| | | String prov = request.getParameter("prov"); |
| | | if (StringUtils.isNotBlank(prov)){ |
| | | terms.put("prov", prov); |
| | | } |
| | | // 现居地省名称 |
| | | String provName = request.getParameter("provName"); |
| | | if (StringUtils.isNotBlank(provName)){ |
| | | terms.put("provName", provName); |
| | | } |
| | | // 现居地市 |
| | | String city = request.getParameter("city"); |
| | | if (StringUtils.isNotBlank(city)){ |
| | | terms.put("city", city); |
| | | } |
| | | // 现居地市名称 |
| | | String cityName = request.getParameter("cityName"); |
| | | if (StringUtils.isNotBlank(cityName)){ |
| | | terms.put("cityName", cityName); |
| | | } |
| | | // 现居地区 |
| | | String area = request.getParameter("area"); |
| | | if (StringUtils.isNotBlank(area)){ |
| | | terms.put("area", area); |
| | | } |
| | | // 现居地区名称 |
| | | String areaName = request.getParameter("areaName"); |
| | | if (StringUtils.isNotBlank(areaName)){ |
| | | terms.put("areaName", areaName); |
| | | } |
| | | // 现居地街道 |
| | | String road = request.getParameter("road"); |
| | | if (StringUtils.isNotBlank(road)){ |
| | | terms.put("road", road); |
| | | } |
| | | // 现居地街道名称 |
| | | String roadName = request.getParameter("roadName"); |
| | | if (StringUtils.isNotBlank(roadName)){ |
| | | terms.put("roadName", roadName); |
| | | } |
| | | // 现居地社区 |
| | | String village = request.getParameter("village"); |
| | | if (StringUtils.isNotBlank(village)){ |
| | | terms.put("village", village); |
| | | } |
| | | // 现居地社区名称 |
| | | String villageName = request.getParameter("villageName"); |
| | | if (StringUtils.isNotBlank(villageName)){ |
| | | terms.put("villageName", villageName); |
| | | } |
| | | // 现居地详细地址 |
| | | String addr = request.getParameter("addr"); |
| | | if (StringUtils.isNotBlank(addr)){ |
| | | terms.put("addr", addr); |
| | | } |
| | | // 头像 |
| | | String avatar = request.getParameter("avatar"); |
| | | if (StringUtils.isNotBlank(avatar)){ |
| | | terms.put("avatar", avatar); |
| | | } |
| | | // 实名认证状态,0:未认证,1:已认证 |
| | | String realStatus = request.getParameter("realStatus"); |
| | | if (StringUtils.isNotBlank(realStatus)){ |
| | | terms.put("realStatus", realStatus); |
| | | } |
| | | // 用户状态,0:停用,1:启用 |
| | | String status = request.getParameter("status"); |
| | | if (StringUtils.isNotBlank(status)){ |
| | | terms.put("status", status); |
| | | } |
| | | // 关注纠纷类型,多个用,隔开 |
| | | String followCaseType = request.getParameter("followCaseType"); |
| | | if (StringUtils.isNotBlank(followCaseType)){ |
| | | terms.put("followCaseType", followCaseType); |
| | | } |
| | | // 删除状态,0:未删除,1:已删除 |
| | | String deleteStatus = request.getParameter("deleteStatus"); |
| | | if (StringUtils.isNotBlank(deleteStatus)){ |
| | | terms.put("deleteStatus", deleteStatus); |
| | | } |
| | | // 客户编号 |
| | | String custId = request.getParameter("custId"); |
| | | if (StringUtils.isNotBlank(custId)){ |
| | | terms.put("custId", custId); |
| | | } |
| | | // 创建时间区间 |
| | | String createStart = request.getParameter("createStart"); |
| | | String createEnd = request.getParameter("createEnd"); |
| | | if(StringUtils.isNotBlank(createStart) && StringUtils.isNotBlank(createEnd)) { |
| | | terms.put("createStart", createStart); |
| | | terms.put("createEnd", createEnd); |
| | | } |
| | | // 更新时间区间 |
| | | String updateStart = request.getParameter("updateStart"); |
| | | String updateEnd = request.getParameter("updateEnd"); |
| | | if(StringUtils.isNotBlank(updateStart) && StringUtils.isNotBlank(updateEnd)) { |
| | | terms.put("updateStart", updateStart); |
| | | terms.put("updateEnd", updateEnd); |
| | | } |
| | | return terms; |
| | | } |
| | | |
| | | /** |
| | | * 条件查询多个 |
| | | * @url {ctx}/api/web/paUser/listQuery |
| | | * @return Object |
| | | */ |
| | | @GetMapping("/listQuery") |
| | | public Object listQuery() { |
| | | try { |
| | | Map<String, Object> terms = getParameter(); |
| | | return ReturnSucUtils.getRepInfo(service.listTerms(terms)); |
| | | } catch (Exception e) { |
| | | return ReturnFailUtils.getRepInfo(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 条件分页查询 |
| | | * @url {ctx}/api/web/paUser/pageQuery |
| | | * @param page 页码 |
| | | * @param size 每页数量 |
| | | * @return Object |
| | | */ |
| | | @GetMapping("/pageQuery") |
| | | public Object pageQuery(@RequestParam(value = "page") int page, @RequestParam(value = "size") int size) { |
| | | try { |
| | | Map<String, Object> terms = getParameter(); |
| | | Sort sort = Sort.by(Sort.Direction.DESC, "create_time"); |
| | | PageRequest pageRequest = PageRequest.of(page-1, size, sort); |
| | | Page<PaUser> paUserPage = service.pageQuery(pageRequest, terms); |
| | | return ReturnSucUtils.getRepInfo( "处理成功", paUserPage); |
| | | } catch (Exception e) { |
| | | return ReturnFailUtils.getRepInfo(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据编号查询单个 |
| | | * @url {ctx}/api/web/paUser/getById |
| | | * @param id 主键编号 |
| | | * @return Object |
| | | */ |
| | | @GetMapping("/getById") |
| | | public Object getById(@RequestParam(value = "id") String id) { |
| | | try { |
| | | return ReturnSucUtils.getRepInfo(service.getById(id)); |
| | | } catch (Exception e) { |
| | | return ReturnFailUtils.getRepInfo(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据主键单个 |
| | | * @url {ctx}/api/web/paUser/deleteById |
| | | * @param id 主键编号 |
| | | * @return Object |
| | | */ |
| | | @GetMapping("/deleteById") |
| | | public Object deleteById(@RequestParam(value = "id") String id) { |
| | | try { |
| | | service.removeById(id); |
| | | return ReturnSucUtils.getRepInfo(); |
| | | } catch (Exception e) { |
| | | return ReturnFailUtils.getRepInfo(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 新增或更新对象 |
| | | * @url {ctx}/api/web/paUser/savePaUser |
| | | * @param paUser 实体对象 |
| | | * @return Object |
| | | */ |
| | | @PostMapping("/savePaUser") |
| | | public Object savePaUser(@RequestBody PaUser paUser) { |
| | | try { |
| | | service.savePaUser(paUser); |
| | | return ReturnSucUtils.getRepInfo(); |
| | | } catch (Exception e) { |
| | | return ReturnFailUtils.getRepInfo(); |
| | | } |
| | | } |
| | | |
| | | } |