CustomerGradeSettingController.java 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. package com.yijia.customer.controller;
  2. import java.util.HashMap;
  3. import java.util.List;
  4. import java.util.Map;
  5. import com.alibaba.fastjson.JSONObject;
  6. import org.springframework.security.access.prepost.PreAuthorize;
  7. import org.springframework.beans.factory.annotation.Autowired;
  8. import org.springframework.web.bind.annotation.*;
  9. import com.yijia.common.annotation.Log;
  10. import com.yijia.common.core.controller.BaseController;
  11. import com.yijia.common.core.domain.AjaxResult;
  12. import com.yijia.common.enums.BusinessType;
  13. import com.yijia.customer.domain.CustomerGradeSetting;
  14. import com.yijia.customer.service.ICustomerGradeSettingService;
  15. import com.yijia.common.utils.poi.ExcelUtil;
  16. import com.yijia.common.core.page.TableDataInfo;
  17. /**
  18. * 客户优惠等级设置Controller
  19. *
  20. * @author yijia
  21. * @date 2020-12-21
  22. */
  23. @RestController
  24. @RequestMapping("/customer/setting")
  25. public class CustomerGradeSettingController extends BaseController
  26. {
  27. @Autowired
  28. private ICustomerGradeSettingService customerGradeSettingService;
  29. /*
  30. * 查询成长规则列表
  31. */
  32. @RequestMapping("/getGrouthRuleList")
  33. public TableDataInfo getGrouthRuleList(){
  34. //分页
  35. startPage();
  36. List<Map<String, Object>> grouthRuleList = customerGradeSettingService.getGrouthRuleList();
  37. return getDataTable(grouthRuleList);
  38. }
  39. /*
  40. * 新增成长规则
  41. * @param jsonObject
  42. */
  43. @RequestMapping("/addGrouthRule")
  44. @Log(title = "客户等级成长规则新增", businessType = BusinessType.INSERT)
  45. public AjaxResult addGrouthRule(@RequestBody JSONObject jsonObject){
  46. Map<String, Object> params = new HashMap();
  47. params.put("grouthValueName", jsonObject.get("grouthValueName"));
  48. params.put("grouthValueConsume", jsonObject.get("grouthValueConsume"));
  49. params.put("grouthValue", jsonObject.get("grouthValue"));
  50. return toAjax(customerGradeSettingService.insertGrouthRule(params));
  51. }
  52. /*
  53. * 编辑成长规则
  54. * @param jsonObject
  55. */
  56. @RequestMapping("/editGrouthRule")
  57. @Log(title = "客户等级成长编辑", businessType = BusinessType.UPDATE)
  58. public AjaxResult editGrouthRule(@RequestBody JSONObject jsonObject){
  59. Map<String, Object> params = new HashMap();
  60. params.put("id", jsonObject.get("id"));
  61. params.put("grouthValueName", jsonObject.get("grouthValueName"));
  62. params.put("grouthValueConsume", jsonObject.get("grouthValueConsume"));
  63. params.put("grouthValue", jsonObject.get("grouthValue"));
  64. return toAjax(customerGradeSettingService.updateGrouthRule(params));
  65. }
  66. /*
  67. * 删除成长规则
  68. * @param id
  69. */
  70. @Log(title = "客户等级成长规则删除", businessType = BusinessType.DELETE)
  71. @RequestMapping(value = "/delGrouthRule",method = RequestMethod.DELETE)
  72. public AjaxResult delGrouthRule(Long[] id){
  73. return toAjax(customerGradeSettingService.deleteGrouthRuleByIds(id));
  74. }
  75. /**
  76. * 查询客户优惠等级设置列表
  77. */
  78. @PreAuthorize("@ss.hasPermi('customer:setting:list')")
  79. @GetMapping("/list")
  80. public TableDataInfo list(CustomerGradeSetting customerGradeSetting)
  81. {
  82. startPage();
  83. List<CustomerGradeSetting> list = customerGradeSettingService.selectCustomerGradeSettingList(customerGradeSetting);
  84. return getDataTable(list);
  85. }
  86. /**
  87. * 导出客户优惠等级设置列表
  88. */
  89. @PreAuthorize("@ss.hasPermi('customer:setting:export')")
  90. @Log(title = "客户优惠等级设置", businessType = BusinessType.EXPORT)
  91. @GetMapping("/export")
  92. public AjaxResult export(CustomerGradeSetting customerGradeSetting)
  93. {
  94. List<CustomerGradeSetting> list = customerGradeSettingService.selectCustomerGradeSettingList(customerGradeSetting);
  95. ExcelUtil<CustomerGradeSetting> util = new ExcelUtil<CustomerGradeSetting>(CustomerGradeSetting.class);
  96. return util.exportExcel(list, "setting");
  97. }
  98. /**
  99. * 获取客户优惠等级设置详细信息
  100. */
  101. @PreAuthorize("@ss.hasPermi('customer:setting:query')")
  102. @GetMapping(value = "/{id}")
  103. public AjaxResult getInfo(@PathVariable("id") Long id)
  104. {
  105. return AjaxResult.success(customerGradeSettingService.selectCustomerGradeSettingById(id));
  106. }
  107. /**
  108. * 新增客户优惠等级设置
  109. */
  110. @PreAuthorize("@ss.hasPermi('customer:setting:add')")
  111. @Log(title = "客户优惠等级设置", businessType = BusinessType.INSERT)
  112. @PostMapping
  113. public AjaxResult add(@RequestBody CustomerGradeSetting customerGradeSetting)
  114. {
  115. return toAjax(customerGradeSettingService.insertCustomerGradeSetting(customerGradeSetting));
  116. }
  117. /**
  118. * 修改客户优惠等级设置
  119. */
  120. @PreAuthorize("@ss.hasPermi('customer:setting:edit')")
  121. @Log(title = "客户优惠等级设置", businessType = BusinessType.UPDATE)
  122. @PutMapping
  123. public AjaxResult edit(@RequestBody CustomerGradeSetting customerGradeSetting)
  124. {
  125. return toAjax(customerGradeSettingService.updateCustomerGradeSetting(customerGradeSetting));
  126. }
  127. /**
  128. * 删除客户优惠等级设置
  129. */
  130. @PreAuthorize("@ss.hasPermi('customer:setting:remove')")
  131. @Log(title = "客户优惠等级设置", businessType = BusinessType.DELETE)
  132. @DeleteMapping("/{ids}")
  133. public AjaxResult remove(@PathVariable Long[] ids)
  134. {
  135. return toAjax(customerGradeSettingService.deleteCustomerGradeSettingByIds(ids));
  136. }
  137. }