New file |
| | |
| | | package com.panzhihua.applets.api; |
| | | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.panzhihua.applets.model.dtos.IDTO; |
| | | import com.panzhihua.common.constants.Constants; |
| | | import com.panzhihua.common.controller.BaseController; |
| | | import com.panzhihua.common.model.dtos.property.CommonPage; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.property.ComPropertyRepairVO; |
| | | import com.panzhihua.common.service.property.PropertyService; |
| | | import com.panzhihua.common.utlis.RSAUtils; |
| | | import com.panzhihua.common.utlis.StringUtils; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("propertyRepair") |
| | | @Api(tags = "物业报修api") |
| | | public class ComPropertyRepairApi extends BaseController { |
| | | @Resource |
| | | private PropertyService propertyService; |
| | | |
| | | /** |
| | | * 分页查询所有数据 |
| | | * @return 所有数据 |
| | | */ |
| | | @ApiOperation("小程序列表接口") |
| | | @PostMapping("/queryAll") |
| | | public R selectAll(@RequestBody CommonPage commonPage) { |
| | | commonPage.setUserId(this.getUserId()); |
| | | return this.propertyService.comPropertyRepairSelectAll(commonPage); |
| | | } |
| | | |
| | | /** |
| | | * 分页查询所有数据 |
| | | * @return 所有数据 |
| | | */ |
| | | @ApiOperation("小程序列表接口-脱敏") |
| | | @PostMapping("/desensitize/queryAll") |
| | | public R selectAllDesensitize(@RequestBody CommonPage commonPage) { |
| | | commonPage.setUserId(this.getUserId()); |
| | | return this.propertyService.comPropertyRepairSelectAllDesensitize(commonPage); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 小程序添加报修 |
| | | * @param comPropertyRepairVO |
| | | * @return |
| | | */ |
| | | @ApiOperation("小程序添加报修") |
| | | @PostMapping |
| | | public R insert(@RequestBody ComPropertyRepairVO comPropertyRepairVO) { |
| | | comPropertyRepairVO.setCreateTime(DateUtil.date()); |
| | | comPropertyRepairVO.setCreateBy(this.getUserId()); |
| | | comPropertyRepairVO.setRepairStatus(ComPropertyRepairVO.status.dcl); |
| | | return this.propertyService.comPropertyRepairInsert(comPropertyRepairVO); |
| | | } |
| | | |
| | | /** |
| | | * 小程序添加报修 脱敏 |
| | | * @param comPropertyRepairVO |
| | | * @return |
| | | */ |
| | | @ApiOperation("小程序添加报修-脱敏") |
| | | @PostMapping("desensitizeInsert") |
| | | public R desensitizeInsert(@RequestBody ComPropertyRepairVO comPropertyRepairVO) { |
| | | comPropertyRepairVO.setCreateTime(DateUtil.date()); |
| | | comPropertyRepairVO.setCreateBy(this.getUserId()); |
| | | comPropertyRepairVO.setRepairStatus(ComPropertyRepairVO.status.dcl); |
| | | try { |
| | | comPropertyRepairVO.setRepairName(RSAUtils.decrypt(comPropertyRepairVO.getRepairName(), Constants.PRIVATE_KEY)); |
| | | comPropertyRepairVO.setRepairPhone(RSAUtils.decrypt(comPropertyRepairVO.getRepairPhone(), Constants.PRIVATE_KEY)); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return this.propertyService.comPropertyRepairInsert(comPropertyRepairVO); |
| | | } |
| | | |
| | | /** |
| | | * 修改数据 |
| | | * |
| | | * @param comPropertyRepairVO 实体对象 |
| | | * @return 修改结果 |
| | | */ |
| | | @ApiOperation("小程序修改报修") |
| | | @PostMapping("/update") |
| | | public R update(@RequestBody ComPropertyRepairVO comPropertyRepairVO) { |
| | | if(comPropertyRepairVO!=null&& StringUtils.isNotEmpty(comPropertyRepairVO.getFeedbackContent())){ |
| | | comPropertyRepairVO.setFeedbackBy(this.getUserId()); |
| | | comPropertyRepairVO.setFeedbackTime(DateUtil.date()); |
| | | comPropertyRepairVO.setRepairStatus(ComPropertyRepairVO.status.dpj); |
| | | } |
| | | if(comPropertyRepairVO!=null&&StringUtils.isNotEmpty(comPropertyRepairVO.getReplyContent())){ |
| | | comPropertyRepairVO.setReplyTime(DateUtil.date()); |
| | | comPropertyRepairVO.setRepairStatus(ComPropertyRepairVO.status.yjs); |
| | | } |
| | | return this.propertyService.comPropertyRepairUpdate(comPropertyRepairVO); |
| | | } |
| | | |
| | | /** |
| | | * 通过主键查询单条数据 |
| | | * |
| | | * @param id 主键 |
| | | * @return 单条数据 |
| | | */ |
| | | @ApiOperation("详情接口") |
| | | @PostMapping("/detail") |
| | | public R selectDetail(@RequestBody IDTO idto) { |
| | | return this.propertyService.comPropertyRepairSelectOne(idto.getId()); |
| | | } |
| | | |
| | | /** |
| | | * 通过主键查询单条数据 |
| | | * |
| | | * @param id 主键 |
| | | * @return 单条数据 |
| | | */ |
| | | @ApiOperation("详情接口") |
| | | @GetMapping("/{id}") |
| | | public R selectOne(@PathVariable("id") Long id) { |
| | | return this.propertyService.comPropertyRepairSelectOne(id); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 通过主键查询单条数据 |
| | | * |
| | | * @param id 主键 |
| | | * @return 单条数据 |
| | | */ |
| | | @ApiOperation("详情接口") |
| | | @PostMapping("desensitize") |
| | | public R selectOneDesensitize(Long id) { |
| | | return this.propertyService.comPropertyRepairSelectOneDesensitize(id); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 删除数据 |
| | | * |
| | | * @param id 主键结合 |
| | | * @return 删除结果 |
| | | */ |
| | | @ApiOperation("删除接口") |
| | | @GetMapping("del") |
| | | public R delete(@RequestParam("id") Long id) { |
| | | return this.propertyService.comPropertyRepairDelete(id); |
| | | } |
| | | |
| | | } |