|
@@ -0,0 +1,158 @@
|
|
|
+package com.platform.rest.controller.operate;
|
|
|
+
|
|
|
+import com.platform.common.util.R;
|
|
|
+import com.platform.dao.dto.operate.CustomerInfoDTO;
|
|
|
+import com.platform.dao.dto.repair.RepairApplicationFormDTO;
|
|
|
+import com.platform.dao.entity.operate.CustomerInfo;
|
|
|
+import com.platform.dao.enums.RepairApplicationFormTypeEnum;
|
|
|
+import com.platform.service.operate.CustomerInfoService;
|
|
|
+import com.platform.dao.util.ExcelUtil;
|
|
|
+import com.platform.dao.vo.export.operate.ExportCustomerInfoVO;
|
|
|
+import com.platform.dao.vo.query.operate.CustomerInfoVO;
|
|
|
+import com.platform.common.util.BeanConverterUtil;
|
|
|
+import com.platform.common.validation.group.AddGroup;
|
|
|
+import com.platform.common.validation.group.UpdateGroup;
|
|
|
+import com.platform.service.repair.strategy.RepairStrategyFactory;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
+import com.platform.common.bean.AbstractPageResultBean;
|
|
|
+import com.platform.rest.log.annotation.SysLog;
|
|
|
+import java.util.List;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Description 客户提交信息表 控制器
|
|
|
+ * @Author lsq
|
|
|
+ * @Date 2023-02-15 16:22:31
|
|
|
+ * @Version Copyright (c) 2020,北京乾元坤和科技有限公司 All rights reserved.
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@AllArgsConstructor
|
|
|
+@RequestMapping("/operate/customers")
|
|
|
+public class CustomerInfoController {
|
|
|
+
|
|
|
+ private final CustomerInfoService customerInfoService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通过id查询单条记录
|
|
|
+ *
|
|
|
+ * @param id 主键
|
|
|
+ * @return R
|
|
|
+ */
|
|
|
+ @GetMapping("/{id}")
|
|
|
+ public R<CustomerInfo> getById(@PathVariable("id") String id){
|
|
|
+ return new R<>(customerInfoService.getModelById(id));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增记录
|
|
|
+ *
|
|
|
+ * @param customerInfoDTO 客户提交信息表DTO
|
|
|
+ * @return R
|
|
|
+ */
|
|
|
+ @SysLog("新增客户提交信息表")
|
|
|
+ @PostMapping
|
|
|
+ public R save(@Validated({AddGroup.class}) @RequestBody CustomerInfoDTO customerInfoDTO) {
|
|
|
+ return new R<>(customerInfoService.saveModelByDTO(customerInfoDTO));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改记录
|
|
|
+ *
|
|
|
+ * @param customerInfoDTO 客户提交信息表DTO
|
|
|
+ * @return R
|
|
|
+ */
|
|
|
+ @SysLog("修改客户提交信息表")
|
|
|
+ @PutMapping("/{id}")
|
|
|
+ @PreAuthorize("@pms.hasPermission('operate-customers-edit')")
|
|
|
+ public R update(@PathVariable("id") String id, @Validated({UpdateGroup.class}) @RequestBody CustomerInfoDTO customerInfoDTO) {
|
|
|
+ customerInfoService.modModelByDTO(customerInfoDTO);
|
|
|
+ return new R<>();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通过id删除一条记录
|
|
|
+ *
|
|
|
+ * @param id 主键
|
|
|
+ * @return R
|
|
|
+ */
|
|
|
+ @SysLog("删除客户提交信息表")
|
|
|
+ @DeleteMapping("/{id}")
|
|
|
+ @PreAuthorize("@pms.hasPermission('operate-customers-del')")
|
|
|
+ public R removeById(@PathVariable String id){
|
|
|
+ customerInfoService.deleteByPrimaryKey(id);
|
|
|
+ return new R<>();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量记录
|
|
|
+ *
|
|
|
+ * @param ids 主键
|
|
|
+ * @return R
|
|
|
+ */
|
|
|
+ @SysLog("批量删除客户提交信息表")
|
|
|
+ @DeleteMapping("")
|
|
|
+ @PreAuthorize("@pms.hasPermission('operate-customers-del')")
|
|
|
+ public R removeIds(@RequestBody List<String> ids){
|
|
|
+ customerInfoService.batchDelete(ids);
|
|
|
+ return new R<>();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取分页
|
|
|
+ *
|
|
|
+ * @param pageNum 当前页码
|
|
|
+ * @param pageSize 每页条数
|
|
|
+ * @param customerInfoDTO 客户提交信息表DTO
|
|
|
+ * @return R
|
|
|
+ */
|
|
|
+ @GetMapping("/page")
|
|
|
+ public R<AbstractPageResultBean<CustomerInfoVO>> query(CustomerInfoDTO customerInfoDTO, @RequestParam(defaultValue = "1") int pageNum, @RequestParam(defaultValue = "20") int pageSize) {
|
|
|
+ return new R<>(customerInfoService.selectPageList(customerInfoDTO, pageNum, pageSize));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取列表
|
|
|
+ *
|
|
|
+ * @param customerInfoDTO 客户提交信息表DTO
|
|
|
+ * @return R
|
|
|
+ */
|
|
|
+ @GetMapping("")
|
|
|
+ public R query(CustomerInfoDTO customerInfoDTO) {
|
|
|
+ return new R<>(customerInfoService.getModelListByDTO(customerInfoDTO));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 客户提交信息表导出
|
|
|
+ *
|
|
|
+ * @param customerInfoDTO 客户提交信息表DTO
|
|
|
+ * @return R
|
|
|
+ */
|
|
|
+ @GetMapping("/export")
|
|
|
+ @SysLog("客户提交信息表导出")
|
|
|
+ @PreAuthorize("@pms.hasPermission('operate-customers-export')")
|
|
|
+ public void export(HttpServletResponse response, CustomerInfoDTO customerInfoDTO) {
|
|
|
+ List<CustomerInfo> list = customerInfoService.getModelListByDTO(customerInfoDTO);
|
|
|
+ ExcelUtil.exportResponseDict(response, ExportCustomerInfoVO.class, BeanConverterUtil.copyListProperties(list, ExportCustomerInfoVO.class), "客户提交信息表");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 处理客户信息
|
|
|
+ *
|
|
|
+ * @param customerInfoDTO 处理客户
|
|
|
+ * @return R
|
|
|
+ */
|
|
|
+ @SysLog("处理客户信息")
|
|
|
+ @PutMapping("/{id}")
|
|
|
+ @PreAuthorize("@pms.hasPermission('operate-customers-edit')")
|
|
|
+ public R handle(@PathVariable("id") String id, @Validated({UpdateGroup.class}) @RequestBody CustomerInfoDTO customerInfoDTO) {
|
|
|
+ customerInfoDTO.setId(id);
|
|
|
+ customerInfoService.handleInfo(customerInfoDTO);
|
|
|
+ return new R<>();
|
|
|
+ }
|
|
|
+
|
|
|
+}
|