lsw 1 year ago
parent
commit
804d2357c7

+ 2 - 2
admin-ui/src/views/work/project/index.vue

@@ -29,7 +29,7 @@
     </el-row>
     <el-table :data="response.rows" border @selection-change="selects" height="calc(100vh - 270px)">
       <el-table-column type="selection" width="55" align="center" />
-      <el-table-column label="项目名称" align="center" prop="projectName" width="230" />
+      <el-table-column label="项目名称" align="left" prop="projectName" width="230" />
       <el-table-column label="项目编号" align="center" prop="num" />
       <el-table-column label="项目周期" align="center" width="200">
         <template slot-scope="scope">
@@ -126,7 +126,7 @@ export default {
       }
       const id = row.id || this.ids[0];
       if (tag == 'packages') {
-        this.iframe({ obj: packages, param: { projectId: row.id }, title: '接包明细', width: '60%', height: '75%' });
+        this.iframe({ obj: packages, param: { projectId: row.id }, title: '接包明细', width: '70%', height: '75%' });
       }
       if (tag == 'detail') {
         this.iframe({ obj: edit, param: { id: id, detail: true }, title: '项目详情', width: '55%', height: '55%' });

+ 17 - 3
admin-ui/src/views/work/project/packages/index.vue

@@ -14,7 +14,7 @@
         <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
         <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
       </el-form-item>
-      <el-button type="primary" icon="el-icon-download" @click="handleQuery" style="float: right">导出</el-button>
+      <el-button type="primary" icon="el-icon-download" @click="handleExport" style="float: right">导出</el-button>
     </el-form>
     <el-table :data="response.rows" border>
       <el-table-column type="index" label="序号" align="center" width="80" />
@@ -22,8 +22,12 @@
       <el-table-column label="身份证" align="center" prop="idCard" />
       <el-table-column label="手机号" align="center" prop="phone" />
       <el-table-column label="支付宝账号" align="center" prop="alipay" />
+      <el-table-column label="接包日期" align="center" prop="createTime" />
       <el-table-column label="操作" align="center">
-        <el-button size="mini" type="text" icon="el-icon-view" @click="op('detail', scope.row)">详情</el-button>
+        <template slot-scope="scope">
+          <el-button size="mini" type="text" icon="el-icon-document" @click="op('contract', scope.row)">查看合同</el-button>
+          <el-button size="mini" type="text" icon="el-icon-view" @click="op('detail', scope.row)">详情</el-button>
+        </template>
       </el-table-column>
       <template slot="empty">
         <el-empty></el-empty>
@@ -34,6 +38,8 @@
 </template>
 
 <script>
+import contract from '@/views/work/user/contract';
+import info from '@/views/work/user/edit';
 export default {
   name: 'Packages',
   data() {
@@ -80,9 +86,17 @@ export default {
       this.resetForm('queryForm');
       this.handleQuery();
     },
+    op(tag, row) {
+      if (tag == 'detail') {
+        this.iframe({ obj: info, param: { id: row.userId, detail: true }, title: '查看详情', width: '55%', height: '60%' });
+      }
+      if (tag == 'contract') {
+        this.iframe({ obj: contract, param: { id: row.userId }, title: '查看合同', width: '55%', height: '85%' });
+      }
+    },
     /** 导出按钮操作 */
     handleExport() {
-      this.download('/work/packages/export', { ...this.queryParams }, `caseinfo_${new Date().getTime()}.xlsx`);
+      this.download('/work/packages/export', { ...this.queryParams }, '接包用户明细.xlsx');
     }
   }
 };

+ 20 - 7
admin-ui/src/views/work/relate/index.vue

@@ -2,21 +2,21 @@
   <div class="app-container">
     <el-form :model="queryParams" ref="queryForm" :inline="true" @submit.native.prevent v-show="showSearch">
       <el-form-item label="姓名" prop="name">
-        <el-input v-model="queryParams.name" placeholder="请输入姓名" @keyup.enter.native="handleQuery" clearable />
+        <el-input v-model="queryParams.name" placeholder="请输入姓名" @keyup.enter.native="handleQuery" class="inp" clearable />
       </el-form-item>
       <el-form-item label="手机号" prop="phone">
-        <el-input v-model="queryParams.phone" placeholder="请输入手机号" @keyup.enter.native="handleQuery" clearable />
+        <el-input v-model="queryParams.phone" placeholder="请输入手机号" @keyup.enter.native="handleQuery" class="inp" clearable />
+      </el-form-item>
+      <el-form-item label="身份证号" prop="idCard">
+        <el-input v-model="queryParams.idCard" placeholder="请输入身份证号" @keyup.enter.native="handleQuery" clearable />
       </el-form-item>
       <el-form-item>
         <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
         <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
       </el-form-item>
+      <el-button type="primary" icon="el-icon-download" @click="handleExport" v-hasPermi="['work:relate:export']" style="float: right">导出</el-button>
     </el-form>
-    <el-row :gutter="10" class="mb8">
-      <el-button type="primary" icon="el-icon-download" @click="handleExport" v-hasPermi="['work:relate:export']">导出</el-button>
-      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
-    </el-row>
-    <el-table :data="response.rows" border height="calc(100vh - 270px)">
+    <el-table :data="response.rows" border height="calc(100vh - 230px)">
       <el-table-column type="index" label="序号" align="center" width="80" />
       <el-table-column label="姓名" align="center" prop="name" />
       <el-table-column label="身份证" align="center" prop="idCard" />
@@ -25,6 +25,8 @@
       <el-table-column label="关联时间" align="center" prop="createTime" />
       <el-table-column label="操作" align="center">
         <template slot-scope="scope">
+          <el-button size="mini" type="text" icon="el-icon-document" @click="op('contract', scope.row)" v-if="scope.row.isContract == 1">查看合同</el-button>
+          <el-button size="mini" type="text" icon="el-icon-view" @click="op('detail', scope.row)">详情</el-button>
           <el-button size="mini" type="text" icon="el-icon-delete" @click="del(scope.row)" v-hasPermi="['work:relate:remove']">解除</el-button>
         </template>
       </el-table-column>
@@ -37,6 +39,8 @@
 </template>
 
 <script>
+import contract from '@/views/work/user/contract';
+import info from '@/views/work/user/edit';
 export default {
   name: 'Relate',
   data() {
@@ -48,6 +52,7 @@ export default {
         pageSize: 10,
         name: null,
         phone: null,
+        idCard: null,
         orderByColumn: 'r.id',
         isAsc: 'desc'
       }
@@ -70,6 +75,14 @@ export default {
       this.resetForm('queryForm');
       this.handleQuery();
     },
+    op(tag, row) {
+      if (tag == 'detail') {
+        this.iframe({ obj: info, param: { id: row.userId, detail: true }, title: '查看详情', width: '55%', height: '60%' });
+      }
+      if (tag == 'contract') {
+        this.iframe({ obj: contract, param: { id: row.userId }, title: '查看合同', width: '55%', height: '85%' });
+      }
+    },
     del(row) {
       this.$confirm('是否确认解除选中关联用户?', '警告', { type: 'warning' }).then(() => {
         this.ajax({ method: 'post', url: '/work/relate/remove', data: { userId: row.userId } }).then((response) => {

+ 0 - 8
admin-ui/src/views/work/user/index.vue

@@ -71,14 +71,6 @@ export default {
   name: 'Users',
   data() {
     return {
-      //设置文档网络地址,可以是相对地址
-      isShowDocx: false,
-      docx: 'https://501351981.github.io/vue-office/examples/dist/static/test-files/test.docx',
-      editorOptions: {
-        toolbar: true,
-        width: '800px',
-        height: '600px'
-      },
       ids: [],
       showSearch: true,
       response: {},

+ 1 - 1
app/pages/packages/index.vue

@@ -76,7 +76,7 @@ export default {
 					if (res.confirm) {
 						this.http.request({
 							url: '/app/packages/add',
-							data: { projectId: item.id },
+							data: { projectId: item.id, companyId: item.companyId },
 							method: 'POST',
 							success: (res) => {
 								uni.showModal({

+ 2 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/work/api/Api_PackagesController.java

@@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
+import java.rmi.ServerException;
 import java.util.List;
 
 /**
@@ -32,7 +33,7 @@ public class Api_PackagesController extends BaseController {
     }
 
     @PostMapping("/add")
-    public AjaxResult add(@Validated @RequestBody Packages packages) {
+    public AjaxResult add(@Validated @RequestBody Packages packages) throws ServerException {
         return packagesService.add(packages);
     }
 }

+ 19 - 29
ruoyi-admin/src/main/java/com/ruoyi/web/work/controller/PackagesController.java

@@ -2,20 +2,25 @@ package com.ruoyi.web.work.controller;
 
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.controller.BaseController;
-import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.PageUtils;
+import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.web.work.domain.Packages;
 import com.ruoyi.web.work.service.IPackagesService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
-import java.util.Arrays;
+import javax.servlet.http.HttpServletResponse;
 import java.util.List;
 
 /**
  * 接包管理
+ *
  * @author lsw
  * @date 2024-04-19
  */
@@ -27,36 +32,21 @@ public class PackagesController extends BaseController {
 
     @PreAuthorize("@ss.hasPermi('work:packages:list')")
     @GetMapping("/list")
-    public TableDataInfo list(Packages packages){
+    public TableDataInfo list(Packages packages) {
+        packages.setCompanyId(getLoginUser().getUser().getCompanyId());
         startPage();
         List<Packages> list = packagesService.selectList(packages);
         return getDataTable(list);
     }
 
-    @PreAuthorize("@ss.hasPermi('work:packages:query')")
-    @GetMapping(value = "/detail/{id}")
-    public AjaxResult detail(@PathVariable("id") Long id){
-        return AjaxResult.success(packagesService.getById(id));
-    }
-
-    @PreAuthorize("@ss.hasPermi('work:packages:add')")
-    @Log(title = "接包管理", businessType = BusinessType.INSERT)
-    @PostMapping("/add")
-    public AjaxResult add(@RequestBody Packages packages){
-        return toAjax(packagesService.save(packages));
-    }
-
-    @PreAuthorize("@ss.hasPermi('work:packages:edit')")
-    @Log(title = "接包管理", businessType = BusinessType.UPDATE)
-    @PostMapping("/edit")
-    public AjaxResult edit(@RequestBody Packages packages){
-        return toAjax(packagesService.updateById(packages));
-    }
-
-    @PreAuthorize("@ss.hasPermi('work:packages:remove')")
-    @Log(title = "接包管理", businessType = BusinessType.DELETE)
-    @GetMapping("/remove/{ids}")
-    public AjaxResult remove(@PathVariable Long[] ids){
-        return toAjax(packagesService.removeByIds(Arrays.asList(ids)));
+    @Log(title = "导出接包用户信息", businessType = BusinessType.EXPORT)
+    @PreAuthorize("@ss.hasPermi('work:packages:list')")
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, Packages packages) {
+        packages.setCompanyId(getLoginUser().getUser().getCompanyId());
+        PageUtils.orderBy("p.id desc");
+        List<Packages> list = packagesService.selectList(packages);
+        ExcelUtil<Packages> util = new ExcelUtil<Packages>(Packages.class);
+        util.exportExcel(response, list, "用户信息");
     }
 }

+ 0 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/work/controller/UserController.java

@@ -39,7 +39,6 @@ public class UserController extends BaseController {
         return getDataTable(list);
     }
 
-    @PreAuthorize("@ss.hasPermi('work:user:query')")
     @GetMapping(value = "/detail/{id}")
     public AjaxResult detail(@PathVariable("id") Long id){
         return AjaxResult.success(userService.getById(id));

+ 18 - 6
ruoyi-admin/src/main/java/com/ruoyi/web/work/domain/Packages.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.FieldFill;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.common.annotation.Excel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.experimental.Accessors;
@@ -30,16 +31,20 @@ public class Packages {
     @ApiModelProperty(value = "关联项目")
     private Long projectId;
 
+    @TableField(exist = false)
+    @Excel(name = "服务项目", width = 30)
+    private String projectName;
+
+    @NotNull(message = "参数错误")
+    @ApiModelProperty(value = "关联企业")
+    private Long companyId;
+
     @ApiModelProperty(value = "状态:0=已接包,1=已完成")
     private Integer state;
 
     @TableField(fill = FieldFill.INSERT)
     private String createBy;
 
-    @TableField(fill = FieldFill.INSERT)
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    private Date createTime;
-
     @TableField(fill = FieldFill.UPDATE)
     private String updateBy;
 
@@ -49,14 +54,17 @@ public class Packages {
 
     @TableField(exist = false)
     @ApiModelProperty(value = "姓名")
+    @Excel(name = "姓名")
     private String name;
 
     @TableField(exist = false)
     @ApiModelProperty(value = "手机号")
-    private Long phone;
+    @Excel(name = "手机号")
+    private String phone;
 
     @TableField(exist = false)
     @ApiModelProperty(value = "身份证")
+    @Excel(name = "身份证", width = 30)
     private String idCard;
 
     @TableField(exist = false)
@@ -69,7 +77,11 @@ public class Packages {
 
     @TableField(exist = false)
     @ApiModelProperty(value = "支付宝")
+    @Excel(name = "支付宝")
     private String alipay;
 
-
+    @TableField(fill = FieldFill.INSERT)
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "接包时间", dateFormat = "yyyy-MM-dd HH:mm:ss", width = 30)
+    private Date createTime;
 }

+ 2 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/work/service/IPackagesService.java

@@ -5,6 +5,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.web.work.domain.Packages;
 import com.ruoyi.web.work.domain.vo.PackagesListVo;
 
+import java.rmi.ServerException;
 import java.util.List;
 
 /**
@@ -16,5 +17,5 @@ public interface IPackagesService extends IService<Packages>{
 
     List<PackagesListVo> selectPackagesList(Packages packages);
 
-    AjaxResult add(Packages packages);
+    AjaxResult add(Packages packages) throws ServerException;
 }

+ 6 - 4
ruoyi-admin/src/main/java/com/ruoyi/web/work/service/impl/PackagesServiceImpl.java

@@ -13,8 +13,8 @@ import com.ruoyi.web.work.service.IProjectService;
 import com.ruoyi.web.work.service.IUserService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
 
+import java.rmi.ServerException;
 import java.util.List;
 
 /**
@@ -43,9 +43,8 @@ public class PackagesServiceImpl extends ServiceImpl<PackagesMapper, Packages> i
         return packagesMapper.selectPackagesList(packages);
     }
 
-    @Transactional
     @Override
-    public AjaxResult add(Packages packages) {
+    public AjaxResult add(Packages packages) throws ServerException {
         User user = userService.getById(AppUtil.getUser().getId());
         if (user.getIsContract() == 0) {
             return AjaxResult.error("请先签约");
@@ -54,12 +53,15 @@ public class PackagesServiceImpl extends ServiceImpl<PackagesMapper, Packages> i
         if (project == null || project.getState() == 1) {
             return AjaxResult.error("项目不存在或被停用");
         }
+        packages.setState(0);
         packages.setUserId(AppUtil.getUser().getId());
         Packages check = packagesMapper.check(packages);
         if (check != null) {
             return AjaxResult.error("请勿重复接包");
         }
-        save(packages);
+        if (!save(packages)) {
+            throw new ServerException("接包失败,请联系平台");
+        }
         return AjaxResult.success();
     }
 }

+ 5 - 1
ruoyi-admin/src/main/resources/mapper/work/PackagesMapper.xml

@@ -9,21 +9,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         p.id,
         p.create_time,
         p.project_id,
+        p.user_id,
         u.NAME,
         u.id_card,
         u.alipay,
         u.phone,
         u.bank_account,
-        u.bank_name
+        u.bank_name,
+        t.project_name
         FROM
         tb_packages p
         LEFT JOIN tb_user u ON u.id = p.user_id
+        LEFT JOIN tb_project t ON t.id=p.project_id
         <where>  
             <if test="userId != null "> and p.user_id = #{userId}</if>
             <if test="name != null  and name != ''"> and u.name like concat('%', #{name}, '%')</if>
             <if test="idCard != null  and idCard != ''"> and u.id_card like concat('%', #{idCard}, '%')</if>
             <if test="phone != null  and phone != ''"> and u.phone like concat('%', #{phone}, '%')</if>
             <if test="projectId != null "> and p.project_id = #{projectId}</if>
+            <if test="companyId != null "> and p.company_id = #{companyId}</if>
             <if test="state != null "> and p.state = #{state}</if>
         </where>
     </select>

+ 1 - 0
ruoyi-admin/src/main/resources/mapper/work/RelateMapper.xml

@@ -14,6 +14,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="companyId != null "> and r.company_id = #{companyId}</if>
             <if test="name != null  and name != ''"> and c.name like concat('%', #{name}, '%')</if>
             <if test="phone != null  and phone != ''"> and c.phone like concat('%', #{phone}, '%')</if>
+            <if test="idCard != null  and idCard != ''"> and c.id_card like concat('%', #{idCard}, '%')</if>
         </where>
     </select>