gongdecai 3 лет назад
Родитель
Сommit
00ae35dd49

+ 1 - 0
unimall-admin-api/src/main/java/com/iotechn/unimall/admin/api/sys/CustomerBillingServiceImpl.java

@@ -70,6 +70,7 @@ public class CustomerBillingServiceImpl implements CustomerBillingService {
                     CustomerBillingDetailDTO customerBillingDetailDTO = customerBillingDetailDTOS.get(i);
                     CustomerBillingDetailDO customerBillingDetailDO = new CustomerBillingDetailDO();
                     BeanUtils.copyProperties(customerBillingDetailDTO, customerBillingDetailDO);
+                    customerBillingDetailDO.setInfoId(insertDO.getId());
                     customerBillingDetailDO.setGmtUpdate(now);
                     customerBillingDetailDO.setGmtCreate(now);
                     customerBillingDetailMapper.insert(customerBillingDetailDO);

+ 42 - 0
unimall-admin-api/src/main/java/com/iotechn/unimall/admin/api/sys/CustomerInfoService.java

@@ -0,0 +1,42 @@
+package com.iotechn.unimall.admin.api.sys;
+
+import com.iotechn.unimall.core.annotation.HttpMethod;
+import com.iotechn.unimall.core.annotation.HttpOpenApi;
+import com.iotechn.unimall.core.annotation.HttpParam;
+import com.iotechn.unimall.core.annotation.HttpParamType;
+import com.iotechn.unimall.core.annotation.param.NotNull;
+import com.iotechn.unimall.core.exception.ServiceException;
+import com.iotechn.unimall.data.model.Page;
+import com.iotechn.unimall.data.domain.CustomerInfoDO;
+import com.iotechn.unimall.data.dto.CustomerInfoDTO;
+
+/**
+ * Generate Code By Unimall
+ */
+@HttpOpenApi(group = "admin.customerinfo", description = "unimall_customer_infoService")
+public interface CustomerInfoService {
+
+    @HttpMethod(description = "删除", permission = "customerInfo:customerinfo:delete", permissionParentName = "其他", permissionName = "CustomerInfo")
+    public boolean delete(
+            @NotNull @HttpParam(name = "id", type = HttpParamType.COMMON, description = "id") Long id,
+            @NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员ID") Long adminId) throws ServiceException;
+
+
+    @HttpMethod(description = "查询", permission = "customerInfo:customerinfo:list", permissionParentName = "其他", permissionName = "CustomerInfo")
+    public Page<CustomerInfoDO> list(
+            @HttpParam(name = "CustomerInfoDTO", type = HttpParamType.COMMON, description = "CustomerInfoDTO") CustomerInfoDTO selectDTO,
+            @HttpParam(name = "page", type = HttpParamType.COMMON, description = "页码", valueDef = "1") Integer page,
+            @HttpParam(name = "limit", type = HttpParamType.COMMON, description = "页码长度", valueDef = "20") Integer limit,
+            @NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员ID") Long adminId) throws ServiceException;
+
+    @HttpMethod(description = "添加", permission = "customerInfo:customerinfo:create", permissionParentName = "其他", permissionName = "CustomerInfo")
+    public CustomerInfoDO create(
+            @HttpParam(name = "CustomerInfoDTO", type = HttpParamType.COMMON, description = "CustomerInfoDTO") CustomerInfoDTO insertDTO,
+            @NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员ID") Long adminId) throws ServiceException;
+
+    @HttpMethod(description = "编辑", permission = "customerInfo:customerinfo:edit", permissionParentName = "其他", permissionName = "CustomerInfo")
+    public String edit(
+            @HttpParam(name = "CustomerInfoDTO", type = HttpParamType.COMMON, description = "CustomerInfoDTO") CustomerInfoDTO editDTO,
+            @NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员ID") Long adminId) throws ServiceException;
+
+    }

+ 70 - 0
unimall-admin-api/src/main/java/com/iotechn/unimall/admin/api/sys/CustomerInfoServiceImpl.java

@@ -0,0 +1,70 @@
+package com.iotechn.unimall.admin.api.sys;
+
+
+import com.iotechn.unimall.core.exception.AdminServiceException;
+import com.iotechn.unimall.core.exception.ExceptionDefinition;
+import com.iotechn.unimall.core.exception.ServiceException;
+import com.iotechn.unimall.data.model.Page;
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.baomidou.mybatisplus.mapper.Wrapper;
+import com.iotechn.unimall.data.domain.CustomerInfoDO;
+import com.iotechn.unimall.data.dto.CustomerInfoDTO;
+import com.iotechn.unimall.data.mapper.CustomerInfoMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.apache.ibatis.session.RowBounds;
+import org.springframework.beans.BeanUtils;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Generate Code By Unimall
+ */
+@Service
+public class CustomerInfoServiceImpl implements CustomerInfoService {
+
+    @Autowired
+    private CustomerInfoMapper customerInfoMapper;
+
+    @Override
+    public boolean delete(Long id,  Long adminId) throws ServiceException {
+        return customerInfoMapper.deleteById(id) > 0;
+    }
+
+    @Override
+    public Page<CustomerInfoDO> list(CustomerInfoDTO selectDTO, Integer page, Integer limit, Long adminId) throws ServiceException {
+        Wrapper<CustomerInfoDO> wrapper = new EntityWrapper<CustomerInfoDO>();
+        List<CustomerInfoDO> list = customerInfoMapper.selectPage(new RowBounds((page - 1) * limit, limit), wrapper);
+        Integer count = customerInfoMapper.selectCount(wrapper);
+        return new Page<CustomerInfoDO>(list, page, limit, count);
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public CustomerInfoDO create(CustomerInfoDTO insertDTO, Long adminId) throws ServiceException {
+         Date now = new Date();
+         CustomerInfoDO insertDO = new CustomerInfoDO();
+         BeanUtils.copyProperties(insertDTO, insertDO);
+         insertDO.setGmtUpdate(now);
+         insertDO.setGmtCreate(now);
+         if (customerInfoMapper.insert(insertDO) > 0) {
+             return insertDO;
+         }
+         throw new AdminServiceException(ExceptionDefinition.ADMIN_UNKNOWN_EXCEPTION);
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public String edit(CustomerInfoDTO editDTO,Long adminId) throws ServiceException {
+         Date now = new Date();
+         CustomerInfoDO updateDO = new CustomerInfoDO();
+         BeanUtils.copyProperties(editDTO, updateDO);
+         updateDO.setGmtUpdate(now);
+         if (customerInfoMapper.updateById(updateDO) > 0) {
+             return "ok";
+         }
+         throw new AdminServiceException(ExceptionDefinition.ADMIN_UNKNOWN_EXCEPTION);
+    }
+
+}

+ 48 - 0
unimall-admin/src/api/customerInfo.js

@@ -0,0 +1,48 @@
+import request from '@/utils/request'
+import Qs from 'qs'
+
+export function listCustomerInfo(query) {
+  return request({
+    method: 'post',
+    params:{
+      _gp: 'admin.customerinfo',
+      _mt: 'list',
+      page: query.page,
+      limit: query.limit,
+      ...query
+    }
+  })
+}
+
+export function createCustomerInfo(data) {
+  return request({
+    method: 'post',
+    data: Qs.stringify({
+      _gp: 'admin.customerinfo',
+      _mt: 'create',
+      CustomerInfoDTO: JSON.stringify(data)
+    })
+  })
+}
+
+export function updateCustomerInfo(data) {
+  return request({
+    method: 'post',
+    data: Qs.stringify({
+      _gp: 'admin.customerinfo',
+      _mt: 'edit',
+      CustomerInfoDTO: JSON.stringify(data)
+    })
+  })
+}
+
+export function deleteCustomerInfo(id) {
+  return request({
+    method: 'post',
+    params: {
+      _gp: 'admin.customerinfo',
+      _mt: 'delete',
+      id: id
+    }
+  })
+}

+ 237 - 0
unimall-admin/src/views/customerInfo/customerInfo.vue

@@ -0,0 +1,237 @@
+<template>
+    <div class="app-container">
+        <!-- 查询和其他操作 -->
+        <div class="filter-container">
+                        <el-input
+                    v-model="listQuery.customer"
+                    clearable
+                    class="filter-item"
+                    size="small"
+                    style="width: 200px;"
+                    placeholder="请输入客户"
+            />
+            <el-button v-permission="['customerInfo:customerinfo:list']" class="filter-item" type="primary" size="mini" icon="el-icon-search" @click="handleFilter">查找</el-button>
+            <el-button v-permission="['customerInfo:customerinfo:create']" class="filter-item" type="primary" size="mini" icon="el-icon-edit" @click="handleCreate">添加</el-button>
+        </div>
+
+        <!-- 查询结果 -->
+        <el-table
+                v-loading="listLoading"
+                :data="list"
+                size="small"
+                element-loading-text="正在查询中。。。"
+                border
+                fit
+                highlight-current-row
+        >
+            <el-table-column align="center" label="客户" prop="customer" />
+            <el-table-column align="center" label="账户余额" prop="unpaid amount" />
+            <el-table-column align="center" label="备注" prop="remarks" />
+            <el-table-column align="center" label="状态" prop="status" />
+            <el-table-column align="center" label="操作" class-name="small-padding fixed-width">
+                <template slot-scope="scope">
+                    <el-button v-permission="['customerInfo:customerinfo:edit']" type="primary" size="mini" @click="handleUpdate(scope.row)">编辑</el-button>
+                    <el-button v-permission="['customerInfo:customerinfo:delete']" type="danger" size="mini" @click="handleDelete(scope.row)">删除</el-button>
+                </template>
+            </el-table-column>
+        </el-table>
+
+        <pagination
+                v-show="total>0"
+                :total="total"
+                :page.sync="listQuery.page"
+                :limit.sync="listQuery.limit"
+                @pagination="getList"
+        />
+
+        <!-- 添加或修改对话框 -->
+        <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible">
+            <el-form
+                    ref="dataForm"
+                    :rules="rules"
+                    :model="dataForm"
+                    status-icon
+                    label-position="left"
+                    label-width="100px"
+                    style="width: 400px; margin-left:50px;"
+            >
+                <el-form-item label="id" prop="id" hidden>
+                    <el-input v-model="dataForm.id" />
+                </el-form-item>
+                <el-form-item label="客户" prop="customer">
+                    <el-input v-model="dataForm.customer" />
+                </el-form-item>
+                <el-form-item label="账户余额" prop="unpaid amount">
+                    <el-input v-model="dataForm.unpaid amount" />
+                </el-form-item>
+                <el-form-item label="备注" prop="remarks">
+                    <el-input v-model="dataForm.remarks" />
+                </el-form-item>
+                <el-form-item label="状态" prop="status">
+                    <el-input v-model="dataForm.status" />
+                </el-form-item>
+            </el-form>
+            <div slot="footer" class="dialog-footer">
+                <el-button @click="dialogFormVisible = false">取消</el-button>
+                <el-button v-if="dialogStatus=='create'" :loading="submiting" type="primary" @click="createData">确定</el-button>
+                <el-button v-else type="primary" :loading="submiting" @click="updateData">确定</el-button>
+            </div>
+        </el-dialog>
+    </div>
+</template>
+
+<script>
+    import {
+        listCustomerInfo,
+        createCustomerInfo,
+        updateCustomerInfo,
+        deleteCustomerInfo
+    } from '@/api/customerInfo'
+    import Pagination from '@/components/Pagination'
+    export default {
+        name: 'CustomerInfo',
+        components: { Pagination },
+        data() {
+            return {
+                list: null,
+                total: 0,
+                listLoading: true,
+                listQuery: {
+                    page: 1,
+                    limit: 20
+                },
+                dataForm: {
+                    id: undefined
+                },
+                dialogFormVisible: false,
+                submiting: false,
+                dialogStatus: '',
+                textMap: {
+                    update: '编辑',
+                    create: '创建'
+                },
+                rules: {
+                }
+            }
+        },
+        created() {
+            this.getList()
+        },
+        methods: {
+            getList() {
+                this.listLoading = true
+                listCustomerInfo(this.listQuery).then(response => {
+                    this.list = response.data.data.items
+                    this.total = response.data.data.total
+                    this.listLoading = false
+                })
+                .catch(() => {
+                    this.list = []
+                    this.total = 0
+                    this.listLoading = false
+                })
+            },
+            handleFilter() {
+                this.listQuery.page = 1
+                this.getList()
+            },
+            resetForm() {
+                this.dataForm = {
+                    id: undefined
+                }
+            },
+            handleCreate() {
+                this.resetForm()
+                this.dialogStatus = 'create'
+                this.dialogFormVisible = true
+                this.$nextTick(() => {
+                    this.$refs['dataForm'].clearValidate()
+                })
+            },
+            createData() {
+                this.$refs['dataForm'].validate(valid => {
+                    if (valid) {
+                        this.submiting = true
+                        createCustomerInfo(this.dataForm).then(response => {
+                            this.list.unshift(response.data.data)
+                            this.dialogFormVisible = false
+                            this.$notify.success({
+                                title: '成功',
+                                message: '添加成功'
+                            })
+                            this.submiting = false
+                        })
+                        .catch(response => {
+                            this.$notify.error({
+                                title: '失败',
+                                message: response.data.errmsg
+                            })
+                            this.submiting = false
+                        })
+                    }
+                })
+            },
+            handleUpdate(row) {
+                this.dataForm = Object.assign({}, row)
+                this.dialogStatus = 'update'
+                this.dialogFormVisible = true
+                this.$nextTick(() => {
+                    this.$refs['dataForm'].clearValidate()
+                })
+            },
+            updateData() {
+                this.$refs['dataForm'].validate(valid => {
+                    if (valid) {
+                        this.submiting = true
+                        updateCustomerInfo(this.dataForm).then(() => {
+                            for (const v of this.list) {
+                                if (v.id === this.dataForm.id) {
+                                    const index = this.list.indexOf(v)
+                                    this.list.splice(index, 1, this.dataForm)
+                                    break
+                                }
+                            }
+                            this.dialogFormVisible = false
+                            this.submiting = false
+                            this.$notify.success({
+                                title: '成功',
+                                message: '更新成功'
+                            })
+                        })
+                        .catch(response => {
+                            this.$notify.error({
+                                title: '失败',
+                                message: response.data.errmsg
+                            })
+                            this.submiting = false
+                        })
+                    }
+                })
+            },
+            handleDelete(row) {
+                this.$confirm('此操作将永久删除该记录---' + row.id + '---, 是否继续?', '提示', {
+                    confirmButtonText: '确定',
+                    cancelButtonText: '取消',
+                    type: 'warning'
+                }).then(() => {
+                    deleteCustomerInfo(row.id).then(response => {
+                        this.$notify.success({
+                            title: '成功',
+                            message: '删除成功'
+                        })
+                        const index = this.list.indexOf(row)
+                        this.list.splice(index, 1)
+                    })
+                    .catch(response => {
+                        this.$notify.error({
+                            title: '失败',
+                            message: response.data.errmsg
+                        })
+                    })
+                }).catch(() => {
+                    return false
+                })
+            }
+        }
+    }
+</script>

+ 49 - 0
unimall-data/src/main/java/com/iotechn/unimall/data/domain/CustomerInfoDO.java

@@ -0,0 +1,49 @@
+package com.iotechn.unimall.data.domain;
+
+import com.baomidou.mybatisplus.annotations.TableField;
+import com.baomidou.mybatisplus.annotations.TableName;
+import java.util.Date;
+import lombok.Data;
+
+/**
+ * Generate Code By Unimall
+ */
+@Data
+@TableName("unimall_customer_info")
+public class CustomerInfoDO extends SuperDO {
+
+     /* id */
+    @TableField("id")
+    private Long id;
+     /* 客户 */
+    @TableField("customer")
+    private String customer;
+     /* 账户余额 */
+    @TableField("unpaid amount")
+    private Double unpaid amount;
+     /* 备注 */
+    @TableField("remarks")
+    private String remarks;
+     /* 状态 */
+    @TableField("status")
+    private Integer status;
+     /* gmtCreate */
+    @TableField("gmt_create")
+    private Date gmtCreate;
+     /* gmtUpdate */
+    @TableField("gmt_update")
+    private Date gmtUpdate;
+     /* userId */
+    @TableField("user_id")
+    private Long userId;
+     /* adminId */
+    @TableField("admin_id")
+    private Long adminId;
+     /* companyId */
+    @TableField("company_id")
+    private Long companyId;
+     /* updatePeople */
+    @TableField("update_people")
+    private String updatePeople;
+
+}

+ 37 - 0
unimall-data/src/main/java/com/iotechn/unimall/data/dto/CustomerInfoDTO.java

@@ -0,0 +1,37 @@
+package com.iotechn.unimall.data.dto;
+
+import com.baomidou.mybatisplus.annotations.TableName;
+import java.util.Date;
+import lombok.Data;
+
+/**
+ * Generate Code By Unimall
+ */
+@Data
+@TableName("unimall_customer_info")
+public class CustomerInfoDTO extends SuperDTO {
+
+     /* id */
+    private Long id;
+     /* 客户 */
+    private String customer;
+     /* 账户余额 */
+    private Double unpaid amount;
+     /* 备注 */
+    private String remarks;
+     /* 状态 */
+    private Integer status;
+     /* gmtCreate */
+    private Date gmtCreate;
+     /* gmtUpdate */
+    private Date gmtUpdate;
+     /* userId */
+    private Long userId;
+     /* adminId */
+    private Long adminId;
+     /* companyId */
+    private Long companyId;
+     /* updatePeople */
+    private String updatePeople;
+
+}

+ 11 - 0
unimall-data/src/main/java/com/iotechn/unimall/data/mapper/CustomerInfoMapper.java

@@ -0,0 +1,11 @@
+package com.iotechn.unimall.data.mapper;
+
+import com.baomidou.mybatisplus.mapper.BaseMapper;
+import com.iotechn.unimall.data.domain.CustomerInfoDO;
+
+/**
+ * Generate Code By Unimall
+ */
+public interface CustomerInfoMapper extends BaseMapper<CustomerInfoDO> {
+
+}