diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml index 5d215da05..2fb3e6223 100644 --- a/ruoyi-admin/pom.xml +++ b/ruoyi-admin/pom.xml @@ -119,6 +119,23 @@ provided + + + com.itextpdf + kernel + 7.1.12 + + + com.itextpdf + layout + 7.1.12 + + + org.slf4j + slf4j-log4j12 + 1.7.30 + + diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java index 4e6dbd393..0295cba77 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java @@ -98,17 +98,5 @@ public class CommonController { FileUtils.writeBytes(downloadPath, response.getOutputStream()); } - /** - * 合同签单 - */ - @PostMapping("/common/contract") - public AjaxResult signContract(@RequestBody Contract contract) throws Exception { - try { - AjaxResult ajax = AjaxResult.success(); - ajax.put("result", "hi"); - return ajax; - } catch (Exception e) { - return AjaxResult.error(e.getMessage()); - } - } + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/custom/SysContractController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/custom/SysContractController.java new file mode 100644 index 000000000..71312315a --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/custom/SysContractController.java @@ -0,0 +1,112 @@ +package com.ruoyi.web.controller.custom; + +import java.util.List; + +import com.ruoyi.common.core.domain.model.Contract; +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.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.custom.domain.SysContract; +import com.ruoyi.custom.service.ISysContractService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 合同Controller + * + * @author wonder + * @date 2020-10-23 + */ +@RestController +@RequestMapping("/custom/contract") +public class SysContractController extends BaseController { + @Autowired + private ISysContractService sysContractService; + + /** + * 查询合同列表 + */ + @PreAuthorize("@ss.hasPermi('custom:contract:list')") + @GetMapping("/list") + public TableDataInfo list(SysContract sysContract) { + startPage(); + List list = sysContractService.selectSysContractList(sysContract); + return getDataTable(list); + } + + /** + * 导出合同列表 + */ + @PreAuthorize("@ss.hasPermi('custom:contract:export')") + @Log(title = "合同", businessType = BusinessType.EXPORT) + @GetMapping("/export") + public AjaxResult export(SysContract sysContract) { + List list = sysContractService.selectSysContractList(sysContract); + ExcelUtil util = new ExcelUtil(SysContract.class); + return util.exportExcel(list, "contract"); + } + + /** + * 获取合同详细信息 + */ + @PreAuthorize("@ss.hasPermi('custom:contract:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) { + return AjaxResult.success(sysContractService.selectSysContractById(id)); + } + + /** + * 新增合同 + */ + @PreAuthorize("@ss.hasPermi('custom:contract:add')") + @Log(title = "合同", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody SysContract sysContract) { + return toAjax(sysContractService.insertSysContract(sysContract)); + } + + /** + * 修改合同 + */ + @PreAuthorize("@ss.hasPermi('custom:contract:edit')") + @Log(title = "合同", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody SysContract sysContract) { + return toAjax(sysContractService.updateSysContract(sysContract)); + } + + /** + * 删除合同 + */ + @PreAuthorize("@ss.hasPermi('custom:contract:remove')") + @Log(title = "合同", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) { + return toAjax(sysContractService.deleteSysContractByIds(ids)); + } + + /** + * 合同签单 + */ + @PostMapping("/sign") + public AjaxResult signContract(@RequestBody Contract contract) throws Exception { + try { + AjaxResult ajax = AjaxResult.success(); + ajax.put("result", "hi"); + return ajax; + } catch (Exception e) { + return AjaxResult.error(e.getMessage()); + } + } +} diff --git a/ruoyi-custom/src/main/java/com/ruoyi/custom/domain/SysContract.java b/ruoyi-custom/src/main/java/com/ruoyi/custom/domain/SysContract.java new file mode 100644 index 000000000..feffe6f99 --- /dev/null +++ b/ruoyi-custom/src/main/java/com/ruoyi/custom/domain/SysContract.java @@ -0,0 +1,114 @@ +package com.ruoyi.custom.domain; + +import java.math.BigDecimal; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 合同对象 sys_contract + * + * @author wonder + * @date 2020-10-23 + */ +public class SysContract extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 合同编号 */ + @Excel(name = "合同编号") + private Long id; + + /** 客户姓名 */ + @Excel(name = "客户姓名") + private String name; + + /** 电话 */ + @Excel(name = "电话") + private String phone; + + /** 服务时间 */ + @Excel(name = "服务时间") + private Integer serveTime; + + /** 金额 */ + @Excel(name = "金额") + private BigDecimal amount; + + /** 文件路径 */ + @Excel(name = "文件路径") + private String path; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setName(String name) + { + this.name = name; + } + + public String getName() + { + return name; + } + public void setPhone(String phone) + { + this.phone = phone; + } + + public String getPhone() + { + return phone; + } + public void setServeTime(Integer serveTime) + { + this.serveTime = serveTime; + } + + public Integer getServeTime() + { + return serveTime; + } + public void setAmount(BigDecimal amount) + { + this.amount = amount; + } + + public BigDecimal getAmount() + { + return amount; + } + public void setPath(String path) + { + this.path = path; + } + + public String getPath() + { + return path; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("name", getName()) + .append("phone", getPhone()) + .append("serveTime", getServeTime()) + .append("amount", getAmount()) + .append("path", getPath()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .toString(); + } +} diff --git a/ruoyi-custom/src/main/java/com/ruoyi/custom/mapper/SysContractMapper.java b/ruoyi-custom/src/main/java/com/ruoyi/custom/mapper/SysContractMapper.java new file mode 100644 index 000000000..7755acd5a --- /dev/null +++ b/ruoyi-custom/src/main/java/com/ruoyi/custom/mapper/SysContractMapper.java @@ -0,0 +1,61 @@ +package com.ruoyi.custom.mapper; + +import java.util.List; +import com.ruoyi.custom.domain.SysContract; + +/** + * 合同Mapper接口 + * + * @author wonder + * @date 2020-10-23 + */ +public interface SysContractMapper +{ + /** + * 查询合同 + * + * @param id 合同ID + * @return 合同 + */ + public SysContract selectSysContractById(Long id); + + /** + * 查询合同列表 + * + * @param sysContract 合同 + * @return 合同集合 + */ + public List selectSysContractList(SysContract sysContract); + + /** + * 新增合同 + * + * @param sysContract 合同 + * @return 结果 + */ + public int insertSysContract(SysContract sysContract); + + /** + * 修改合同 + * + * @param sysContract 合同 + * @return 结果 + */ + public int updateSysContract(SysContract sysContract); + + /** + * 删除合同 + * + * @param id 合同ID + * @return 结果 + */ + public int deleteSysContractById(Long id); + + /** + * 批量删除合同 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + public int deleteSysContractByIds(Long[] ids); +} diff --git a/ruoyi-custom/src/main/java/com/ruoyi/custom/service/ISysContractService.java b/ruoyi-custom/src/main/java/com/ruoyi/custom/service/ISysContractService.java new file mode 100644 index 000000000..40bf5d920 --- /dev/null +++ b/ruoyi-custom/src/main/java/com/ruoyi/custom/service/ISysContractService.java @@ -0,0 +1,61 @@ +package com.ruoyi.custom.service; + +import java.util.List; +import com.ruoyi.custom.domain.SysContract; + +/** + * 合同Service接口 + * + * @author wonder + * @date 2020-10-23 + */ +public interface ISysContractService +{ + /** + * 查询合同 + * + * @param id 合同ID + * @return 合同 + */ + public SysContract selectSysContractById(Long id); + + /** + * 查询合同列表 + * + * @param sysContract 合同 + * @return 合同集合 + */ + public List selectSysContractList(SysContract sysContract); + + /** + * 新增合同 + * + * @param sysContract 合同 + * @return 结果 + */ + public int insertSysContract(SysContract sysContract); + + /** + * 修改合同 + * + * @param sysContract 合同 + * @return 结果 + */ + public int updateSysContract(SysContract sysContract); + + /** + * 批量删除合同 + * + * @param ids 需要删除的合同ID + * @return 结果 + */ + public int deleteSysContractByIds(Long[] ids); + + /** + * 删除合同信息 + * + * @param id 合同ID + * @return 结果 + */ + public int deleteSysContractById(Long id); +} diff --git a/ruoyi-custom/src/main/java/com/ruoyi/custom/service/impl/SysContractServiceImpl.java b/ruoyi-custom/src/main/java/com/ruoyi/custom/service/impl/SysContractServiceImpl.java new file mode 100644 index 000000000..9fbbea799 --- /dev/null +++ b/ruoyi-custom/src/main/java/com/ruoyi/custom/service/impl/SysContractServiceImpl.java @@ -0,0 +1,96 @@ +package com.ruoyi.custom.service.impl; + +import java.util.List; +import com.ruoyi.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.custom.mapper.SysContractMapper; +import com.ruoyi.custom.domain.SysContract; +import com.ruoyi.custom.service.ISysContractService; + +/** + * 合同Service业务层处理 + * + * @author wonder + * @date 2020-10-23 + */ +@Service +public class SysContractServiceImpl implements ISysContractService +{ + @Autowired + private SysContractMapper sysContractMapper; + + /** + * 查询合同 + * + * @param id 合同ID + * @return 合同 + */ + @Override + public SysContract selectSysContractById(Long id) + { + return sysContractMapper.selectSysContractById(id); + } + + /** + * 查询合同列表 + * + * @param sysContract 合同 + * @return 合同 + */ + @Override + public List selectSysContractList(SysContract sysContract) + { + return sysContractMapper.selectSysContractList(sysContract); + } + + /** + * 新增合同 + * + * @param sysContract 合同 + * @return 结果 + */ + @Override + public int insertSysContract(SysContract sysContract) + { + sysContract.setCreateTime(DateUtils.getNowDate()); + return sysContractMapper.insertSysContract(sysContract); + } + + /** + * 修改合同 + * + * @param sysContract 合同 + * @return 结果 + */ + @Override + public int updateSysContract(SysContract sysContract) + { + sysContract.setUpdateTime(DateUtils.getNowDate()); + return sysContractMapper.updateSysContract(sysContract); + } + + /** + * 批量删除合同 + * + * @param ids 需要删除的合同ID + * @return 结果 + */ + @Override + public int deleteSysContractByIds(Long[] ids) + { + return sysContractMapper.deleteSysContractByIds(ids); + } + + /** + * 删除合同信息 + * + * @param id 合同ID + * @return 结果 + */ + @Override + public int deleteSysContractById(Long id) + { + return sysContractMapper.deleteSysContractById(id); + } +} diff --git a/ruoyi-custom/src/main/resources/mapper/custom/SysContractMapper.xml b/ruoyi-custom/src/main/resources/mapper/custom/SysContractMapper.xml new file mode 100644 index 000000000..c4912fee3 --- /dev/null +++ b/ruoyi-custom/src/main/resources/mapper/custom/SysContractMapper.xml @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + select id, name, phone, serve_time, amount, path, create_by, create_time, update_by, update_time, remark from sys_contract + + + + + + + + insert into sys_contract + + name, + phone, + serve_time, + amount, + path, + create_by, + create_time, + update_by, + update_time, + remark, + + + #{name}, + #{phone}, + #{serveTime}, + #{amount}, + #{path}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{remark}, + + + + + update sys_contract + + name = #{name}, + phone = #{phone}, + serve_time = #{serveTime}, + amount = #{amount}, + path = #{path}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + remark = #{remark}, + + where id = #{id} + + + + delete from sys_contract where id = #{id} + + + + delete from sys_contract where id in + + #{id} + + + + \ No newline at end of file diff --git a/ruoyi-ui/src/api/custom/contract.js b/ruoyi-ui/src/api/custom/contract.js new file mode 100644 index 000000000..80fa8bec4 --- /dev/null +++ b/ruoyi-ui/src/api/custom/contract.js @@ -0,0 +1,53 @@ +import request from '@/utils/request' + +// 查询合同列表 +export function listContract(query) { + return request({ + url: '/custom/contract/list', + method: 'get', + params: query + }) +} + +// 查询合同详细 +export function getContract(id) { + return request({ + url: '/custom/contract/' + id, + method: 'get' + }) +} + +// 新增合同 +export function addContract(data) { + return request({ + url: '/custom/contract', + method: 'post', + data: data + }) +} + +// 修改合同 +export function updateContract(data) { + return request({ + url: '/custom/contract', + method: 'put', + data: data + }) +} + +// 删除合同 +export function delContract(id) { + return request({ + url: '/custom/contract/' + id, + method: 'delete' + }) +} + +// 导出合同 +export function exportContract(query) { + return request({ + url: '/custom/contract/export', + method: 'get', + params: query + }) +} \ No newline at end of file diff --git a/ruoyi-ui/src/permission.js b/ruoyi-ui/src/permission.js index bdec77067..5b7d18cd1 100644 --- a/ruoyi-ui/src/permission.js +++ b/ruoyi-ui/src/permission.js @@ -7,7 +7,7 @@ import { getToken } from '@/utils/auth' NProgress.configure({ showSpinner: false }) -const whiteList = ['/login', '/auth-redirect', '/bind', '/register', '/contract'] +const whiteList = ['/login', '/auth-redirect', '/bind', '/register', '/sign'] router.beforeEach((to, from, next) => { NProgress.start() diff --git a/ruoyi-ui/src/router/index.js b/ruoyi-ui/src/router/index.js index 1dfaeeeca..59e6ce592 100644 --- a/ruoyi-ui/src/router/index.js +++ b/ruoyi-ui/src/router/index.js @@ -125,9 +125,9 @@ export const constantRoutes = [ ] }, { - path: '/contract', + path: '/sign', hidden: true, - component: (resolve) => require(['@/views/custom/contract'], resolve), + component: (resolve) => require(['@/views/custom/signContract'], resolve), } ] diff --git a/ruoyi-ui/src/views/custom/contract/index.vue b/ruoyi-ui/src/views/custom/contract/index.vue index 3574e181b..2964dbcd1 100644 --- a/ruoyi-ui/src/views/custom/contract/index.vue +++ b/ruoyi-ui/src/views/custom/contract/index.vue @@ -1,107 +1,325 @@ - - diff --git a/ruoyi-ui/src/views/custom/signContract/index.vue b/ruoyi-ui/src/views/custom/signContract/index.vue new file mode 100644 index 000000000..0b4f0409d --- /dev/null +++ b/ruoyi-ui/src/views/custom/signContract/index.vue @@ -0,0 +1,106 @@ + + + + + diff --git a/sql/ry_20200920.sql b/sql/ry_20200920.sql index 57c1958a8..44e721bee 100644 --- a/sql/ry_20200920.sql +++ b/sql/ry_20200920.sql @@ -739,6 +739,24 @@ CREATE VIEW view_user_post AS ( SELECT up.user_id, u.nick_name AS user_name, p.post_id, p.post_name FROM sys_post p, sys_user u, sys_user_post up WHERE p.post_id = up.post_id AND u.user_id = up.user_id - ) + ); +-- ---------------------------- +-- 21、订单业务表字段 +-- ---------------------------- +drop table if exists sys_contract; +create table sys_order ( + id bigint(20) not null auto_increment comment '合同编号', + name varchar(30) not null comment '客户姓名', + phone varchar(30) comment '电话', + serve_time tinyint comment '服务时间', + amount decimal(10,2) comment '金额', + path varchar(255) comment '文件路径', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + remark varchar(500) default null comment '备注', + primary key (id) +) engine=innodb auto_increment=1 comment = '合同表';