|
@@ -0,0 +1,127 @@
|
|
|
|
+package com.yijia.customer.controller;
|
|
|
|
+
|
|
|
|
+import java.util.List;
|
|
|
|
+
|
|
|
|
+import com.yijia.common.core.domain.entity.SysDept;
|
|
|
|
+import com.yijia.common.core.domain.model.LoginUser;
|
|
|
|
+import com.yijia.common.utils.SecurityUtils;
|
|
|
|
+import com.yijia.system.service.ISysDeptService;
|
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.PutMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.PathVariable;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
|
+import com.yijia.common.annotation.Log;
|
|
|
|
+import com.yijia.common.core.controller.BaseController;
|
|
|
|
+import com.yijia.common.core.domain.AjaxResult;
|
|
|
|
+import com.yijia.common.enums.BusinessType;
|
|
|
|
+import com.yijia.customer.domain.CustomerCardUseRecord;
|
|
|
|
+import com.yijia.customer.service.ICustomerCardUseRecordService;
|
|
|
|
+import com.yijia.common.utils.poi.ExcelUtil;
|
|
|
|
+import com.yijia.common.core.page.TableDataInfo;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * 客户电子会员卡充值消费记录Controller
|
|
|
|
+ *
|
|
|
|
+ * @author yijia
|
|
|
|
+ * @date 2021-05-18
|
|
|
|
+ */
|
|
|
|
+@RestController
|
|
|
|
+@RequestMapping("/customer/record")
|
|
|
|
+public class CustomerCardUseRecordController extends BaseController
|
|
|
|
+{
|
|
|
|
+ @Autowired
|
|
|
|
+ private ICustomerCardUseRecordService customerCardUseRecordService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private ISysDeptService sysDeptService;
|
|
|
|
+ /**
|
|
|
|
+ * 查询客户电子会员卡充值消费记录列表
|
|
|
|
+ */
|
|
|
|
+ @PreAuthorize("@ss.hasPermi('customer:record:list')")
|
|
|
|
+ @GetMapping("/list")
|
|
|
|
+ public TableDataInfo list(CustomerCardUseRecord customerCardUseRecord)
|
|
|
|
+ {
|
|
|
|
+ LoginUser currentUser = SecurityUtils.getLoginUser();
|
|
|
|
+ System.out.println("等级:"+currentUser.getUser().getDept().getJiBie());
|
|
|
|
+ SysDept dept =new SysDept();
|
|
|
|
+ dept.setDeptId(currentUser.getUser().getDeptId());
|
|
|
|
+ List<String> list = sysDeptService.selectDeptId(dept);
|
|
|
|
+ if(list!=null && list.size()>0){
|
|
|
|
+ customerCardUseRecord.setStationIdList(list);
|
|
|
|
+ customerCardUseRecord.setStationId(null);
|
|
|
|
+ }
|
|
|
|
+ startPage();
|
|
|
|
+ List<CustomerCardUseRecord> recordList = customerCardUseRecordService.selectCustomerCardUseRecordList(customerCardUseRecord);
|
|
|
|
+ return getDataTable(recordList);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 导出客户电子会员卡充值消费记录列表
|
|
|
|
+ */
|
|
|
|
+ @PreAuthorize("@ss.hasPermi('customer:record:export')")
|
|
|
|
+ @Log(title = "客户电子会员卡充值消费记录", businessType = BusinessType.EXPORT)
|
|
|
|
+ @GetMapping("/export")
|
|
|
|
+ public AjaxResult export(CustomerCardUseRecord customerCardUseRecord)
|
|
|
|
+ {
|
|
|
|
+ LoginUser currentUser = SecurityUtils.getLoginUser();
|
|
|
|
+ SysDept dept =new SysDept();
|
|
|
|
+ dept.setDeptId(currentUser.getUser().getDeptId());
|
|
|
|
+ List<String> list = sysDeptService.selectDeptId(dept);
|
|
|
|
+ if(list!=null && list.size()>0){
|
|
|
|
+ customerCardUseRecord.setStationIdList(list);
|
|
|
|
+ customerCardUseRecord.setStationId(null);
|
|
|
|
+ }
|
|
|
|
+ List<CustomerCardUseRecord> recordList = customerCardUseRecordService.selectCustomerCardUseRecordList(customerCardUseRecord);
|
|
|
|
+ ExcelUtil<CustomerCardUseRecord> util = new ExcelUtil<CustomerCardUseRecord>(CustomerCardUseRecord.class);
|
|
|
|
+ return util.exportExcel(recordList, "record");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取客户电子会员卡充值消费记录详细信息
|
|
|
|
+ */
|
|
|
|
+ @PreAuthorize("@ss.hasPermi('customer:record:query')")
|
|
|
|
+ @GetMapping(value = "/{id}")
|
|
|
|
+ public AjaxResult getInfo(@PathVariable("id") Long id)
|
|
|
|
+ {
|
|
|
|
+ return AjaxResult.success(customerCardUseRecordService.selectCustomerCardUseRecordById(id));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 新增客户电子会员卡充值消费记录
|
|
|
|
+ */
|
|
|
|
+ @PreAuthorize("@ss.hasPermi('customer:record:add')")
|
|
|
|
+ @Log(title = "客户电子会员卡充值消费记录", businessType = BusinessType.INSERT)
|
|
|
|
+ @PostMapping
|
|
|
|
+ public AjaxResult add(@RequestBody CustomerCardUseRecord customerCardUseRecord)
|
|
|
|
+ {
|
|
|
|
+ return toAjax(customerCardUseRecordService.insertCustomerCardUseRecord(customerCardUseRecord));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 修改客户电子会员卡充值消费记录
|
|
|
|
+ */
|
|
|
|
+ @PreAuthorize("@ss.hasPermi('customer:record:edit')")
|
|
|
|
+ @Log(title = "客户电子会员卡充值消费记录", businessType = BusinessType.UPDATE)
|
|
|
|
+ @PutMapping
|
|
|
|
+ public AjaxResult edit(@RequestBody CustomerCardUseRecord customerCardUseRecord)
|
|
|
|
+ {
|
|
|
|
+ return toAjax(customerCardUseRecordService.updateCustomerCardUseRecord(customerCardUseRecord));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 删除客户电子会员卡充值消费记录
|
|
|
|
+ */
|
|
|
|
+ @PreAuthorize("@ss.hasPermi('customer:record:remove')")
|
|
|
|
+ @Log(title = "客户电子会员卡充值消费记录", businessType = BusinessType.DELETE)
|
|
|
|
+ @DeleteMapping("/{ids}")
|
|
|
|
+ public AjaxResult remove(@PathVariable Long[] ids)
|
|
|
|
+ {
|
|
|
|
+ return toAjax(customerCardUseRecordService.deleteCustomerCardUseRecordByIds(ids));
|
|
|
|
+ }
|
|
|
|
+}
|