baolei пре 3 недеља
родитељ
комит
f1205243f4

+ 1 - 1
src/main/java/com/hzy/project/business/income/domain/Income.java

@@ -37,7 +37,7 @@ public class Income extends BaseEntity
     private Date incomeDate;
 
     /** 收入类目 */
-    @Excel(name = "收入类目")
+    @Excel(name = "收入类目", readConverterExp = "customer=客户支付,other=其他")
     private String incomeType;
 
     /** 收入总金额 */

+ 4 - 0
src/main/java/com/hzy/project/business/salary/domain/Salary.java

@@ -39,6 +39,10 @@ public class Salary extends BaseEntity
     @Excel(name = "工资总金额")
     private BigDecimal sumAmount;
 
+    /** 薪水分类 */
+    @Excel(name = "薪水分类", readConverterExp = "salary=工资,bonus=奖金")
+    private String salaryType;
+
     /** 删除标志 */
     private String delFlag;
 

+ 18 - 0
src/main/java/com/hzy/project/business/subject/controller/SalarySubjectController.java

@@ -62,6 +62,24 @@ public class SalarySubjectController extends BaseController
     }
 
     /**
+     * 查询工资科目列表
+     */
+    @RequiresPermissions("business:subject:list")
+    @GetMapping("/getlist/{subjectType}")
+    @ResponseBody
+    public List<SalarySubject> getlist(@PathVariable("subjectType") String subjectType)
+    {
+        SalarySubject salarySubject = new SalarySubject();
+        salarySubject.setSubjectType(subjectType);
+        salarySubject.setDelFlag(EDelFlag.NO.getVal());
+        List<SalarySubject> list = salarySubjectService.selectSalarySubjectList(salarySubject);
+        list.forEach(e->{
+            e.setPercent(RMBUtil.fenToYuan(e.getPercent()));
+        });
+        return list;
+    }
+
+    /**
      * 导出工资科目列表
      */
     @RequiresPermissions("business:subject:export")

+ 22 - 2
src/main/resources/mybatis/business/IncomeMapper.xml

@@ -56,17 +56,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectIncomeList" parameterType="Income" resultMap="IncomeResult">
         <include refid="selectIncomeVo"/>
-        <where>  
+        <where>
             <if test="customerId != null "> and customerId = #{customerId}</if>
+            <if test="userId != null "> and userId = #{userId}</if>
             <if test="params.beginIncomeDate != null and params.beginIncomeDate != '' and params.endIncomeDate != null and params.endIncomeDate != ''"> and incomeDate between #{params.beginIncomeDate} and #{params.endIncomeDate}</if>
             <if test="incomeType != null  and incomeType != ''"> and incomeType = #{incomeType}</if>
             <if test="grossAmount != null "> and grossAmount = #{grossAmount}</if>
             <if test="netAmount != null "> and netAmount = #{netAmount}</if>
             <if test="taxAmount != null "> and taxAmount = #{taxAmount}</if>
             <if test="rate != null "> and rate = #{rate}</if>
+            <if test="delFlag != null "> and delFlag = #{delFlag}</if>
         </where>
     </select>
-    
+
+    <select id="selectIncomeVoList" parameterType="Income" resultMap="IncomeVoResult">
+        <include refid="selectIncomeExtVo"/>
+        <where>
+            <if test="customerId != null "> and ti.customerId = #{customerId}</if>
+            <if test="userId != null "> and ti.userId = #{userId}</if>
+            <if test="params.beginIncomeDate != null and params.beginIncomeDate != '' and params.endIncomeDate != null and params.endIncomeDate != ''"> and ti.incomeDate between #{params.beginIncomeDate} and #{params.endIncomeDate}</if>
+            <if test="incomeType != null  and incomeType != ''"> and ti.incomeType = #{incomeType}</if>
+            <if test="grossAmount != null "> and ti.grossAmount = #{grossAmount}</if>
+            <if test="netAmount != null "> and ti.netAmount = #{netAmount}</if>
+            <if test="taxAmount != null "> and ti.taxAmount = #{taxAmount}</if>
+            <if test="rate != null "> and ti.rate = #{rate}</if>
+            <if test="delFlag != null "> and ti.delFlag = #{delFlag}</if>
+        </where>
+    </select>
+
     <select id="selectIncomeByIncomeId" parameterType="Long" resultMap="IncomeResult">
         <include refid="selectIncomeVo"/>
         where incomeId = #{incomeId}
@@ -76,6 +93,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         insert into t_income
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="customerId != null">customerId,</if>
+            <if test="userId != null">userId,</if>
             <if test="incomeDate != null">incomeDate,</if>
             <if test="incomeType != null">incomeType,</if>
             <if test="grossAmount != null">grossAmount,</if>
@@ -91,6 +109,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="customerId != null">#{customerId},</if>
+            <if test="userId != null">#{userId},</if>
             <if test="incomeDate != null">#{incomeDate},</if>
             <if test="incomeType != null">#{incomeType},</if>
             <if test="grossAmount != null">#{grossAmount},</if>
@@ -110,6 +129,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         update t_income
         <trim prefix="SET" suffixOverrides=",">
             <if test="customerId != null">customerId = #{customerId},</if>
+            <if test="userId != null">userId = #{userId},</if>
             <if test="incomeDate != null">incomeDate = #{incomeDate},</if>
             <if test="incomeType != null">incomeType = #{incomeType},</if>
             <if test="grossAmount != null">grossAmount = #{grossAmount},</if>

+ 6 - 2
src/main/resources/mybatis/business/SalaryMapper.xml

@@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <resultMap type="Salary" id="SalaryResult">
         <result property="salaryId"    column="salaryId"    />
         <result property="userId"    column="user_id"    />
+        <result property="salaryType"    column="salaryType"    />
         <result property="salaryDate"    column="salaryDate"    />
         <result property="sumAmount"    column="sumAmount"    />
         <result property="delFlag"    column="delFlag"    />
@@ -35,7 +36,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectSalaryVo">
-        select salaryId, user_id, salaryDate, sumAmount, delFlag, remark, create_by, create_time, update_by, update_time from t_salary
+        select salaryId, user_id, salaryType, salaryDate, sumAmount, delFlag, remark, create_by, create_time, update_by, update_time from t_salary
     </sql>
 
     <select id="selectSalaryList" parameterType="Salary" resultMap="SalaryResult">
@@ -47,7 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
     
     <select id="selectSalaryBySalaryId" parameterType="Long" resultMap="SalarySalaryDetailResult">
-        select salaryId, user_id, salaryDate, sumAmount, delFlag, remark, create_by, create_time, update_by, update_time
+        select salaryId, user_id, salaryType, salaryDate, sumAmount, delFlag, remark, create_by, create_time, update_by, update_time
         from t_salary
         where salaryId = #{salaryId}
     </select>
@@ -62,6 +63,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         insert into t_salary
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="userId != null">user_id,</if>
+            <if test="salaryType != null">salaryType,</if>
             <if test="salaryDate != null">salaryDate,</if>
             <if test="sumAmount != null">sumAmount,</if>
             <if test="delFlag != null">delFlag,</if>
@@ -73,6 +75,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="userId != null">#{userId},</if>
+            <if test="salaryType != null">#{salaryType},</if>
             <if test="salaryDate != null">#{salaryDate},</if>
             <if test="sumAmount != null">#{sumAmount},</if>
             <if test="delFlag != null">#{delFlag},</if>
@@ -88,6 +91,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         update t_salary
         <trim prefix="SET" suffixOverrides=",">
             <if test="userId != null">user_id = #{userId},</if>
+            <if test="salaryType != null">salaryType = #{salaryType},</if>
             <if test="salaryDate != null">salaryDate = #{salaryDate},</if>
             <if test="sumAmount != null">sumAmount = #{sumAmount},</if>
             <if test="delFlag != null">delFlag = #{delFlag},</if>

+ 6 - 2
src/main/resources/templates/business/balance/add.html

@@ -8,9 +8,13 @@
         <form class="form-horizontal m" id="form-balance-add">
             <div class="col-xs-12">
                 <div class="form-group">
-                    <label class="col-sm-3 control-label">用户ID:</label>
+                    <label class="col-sm-3 control-label">用户:</label>
                     <div class="col-sm-8">
-                        <input name="userId" class="form-control" type="text">
+<!--                        <input name="userId" class="form-control" type="text">-->
+                        <select class="form-control" name="userId" th:with="users=${@user.getUserList()}">
+                            <option value="">请选择</option>
+                            <option th:each="user : ${users}" th:text="${user.customerName}" th:value="${user.customerId}"></option>
+                        </select>
                     </div>
                 </div>
             </div>

+ 7 - 2
src/main/resources/templates/business/balance/edit.html

@@ -9,9 +9,14 @@
             <input name="balanceId" th:field="*{balanceId}" type="hidden">
             <div class="col-xs-12">
                 <div class="form-group">
-                    <label class="col-sm-3 control-label">用户ID:</label>
+                    <label class="col-sm-3 control-label">用户:</label>
                     <div class="col-sm-8">
-                        <input name="userId" th:field="*{userId}" class="form-control" type="text">
+<!--                        <input name="userId" th:field="*{userId}" class="form-control" type="text">-->
+                        <select class="form-control" name="userId" th:with="users=${@user.getUserList()}">
+                            <option value="">请选择</option>
+                            <option th:each="user : ${users}" th:text="${user.customerName}" th:value="${user.customerId}" th:field="*{userId}"></option>
+                        </select>
+
                     </div>
                 </div>
             </div>

+ 6 - 5
src/main/resources/templates/business/income/add.html

@@ -12,19 +12,19 @@
                     <label class="col-sm-3 control-label">客户:</label>
                     <div class="col-sm-8">
                         <select class="form-control" name="customerId" th:with="commons=${@common.getCustomerList()}">
-                            <option value="">所有</option>
-                            <option th:each="common : ${commons}" th:text="${common.userName}" th:value="${common.userId}"></option>
+                            <option value="">请选择</option>
+                            <option th:each="common : ${commons}" th:text="${common.customerName}" th:value="${common.customerId}"></option>
                         </select>
                     </div>
                 </div>
             </div>
             <div class="col-xs-12">
                 <div class="form-group">
-                    <label class="col-sm-3 control-label">户:</label>
+                    <label class="col-sm-3 control-label">户:</label>
                     <div class="col-sm-8">
                         <select class="form-control" name="userId" th:with="users=${@user.getUserList()}">
-                            <option value="">所有</option>
-                            <option th:each="user : ${users}" th:text="${user.customerName}" th:value="${user.customerId}"></option>
+                            <option value="">请选择</option>
+                            <option th:each="user : ${users}" th:text="${user.userName}" th:value="${user.userId}"></option>
                         </select>
                     </div>
                 </div>
@@ -45,6 +45,7 @@
                     <label class="col-sm-3 control-label">收入类目:</label>
                     <div class="col-sm-8">
                         <select name="incomeType" class="form-control" th:with="type=${@dict.getType('income_type')}">
+                            <option value="">请选择</option>
                             <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                         </select>
                     </div>

+ 4 - 3
src/main/resources/templates/business/income/edit.html

@@ -13,7 +13,7 @@
                     <label class="col-sm-3 control-label">客户:</label>
                     <div class="col-sm-8">
                         <select class="form-control" name="customerId" th:with="commons=${@common.getCustomerList()}">
-                            <option value="">所有</option>
+                            <option value="">请选择</option>
                             <option th:each="common : ${commons}" th:text="${common.customerName}" th:value="${common.customerId}" th:field="*{customerId}" ></option>
                         </select>
 
@@ -22,10 +22,10 @@
             </div>
             <div class="col-xs-12">
                 <div class="form-group">
-                    <label class="col-sm-3 control-label">户:</label>
+                    <label class="col-sm-3 control-label">户:</label>
                     <div class="col-sm-8">
                         <select class="form-control" name="userId" th:with="users=${@user.getUserList()}">
-                            <option value="">所有</option>
+                            <option value="">请选择</option>
                             <option th:each="user : ${users}" th:text="${user.userName}" th:value="${user.userId}" th:field="*{userId}" ></option>
                         </select>
 
@@ -48,6 +48,7 @@
                     <label class="col-sm-3 control-label">收入类目:</label>
                     <div class="col-sm-8">
                         <select name="incomeType" class="form-control" th:with="type=${@dict.getType('income_type')}">
+                            <option value="">请选择</option>
                             <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{incomeType}"></option>
                         </select>
                     </div>

+ 61 - 53
src/main/resources/templates/business/salary/add.html

@@ -12,7 +12,21 @@
                 <div class="form-group">
                     <label class="col-sm-3 control-label">用户:</label>
                     <div class="col-sm-8">
-                        <input name="userId" class="form-control" type="text">
+                        <select class="form-control" name="userId" th:with="users=${@user.getUserList()}">
+                            <option value="">请选择</option>
+                            <option th:each="user : ${users}" th:text="${user.userName}" th:value="${user.userId}"></option>
+                        </select>
+                    </div>
+                </div>
+            </div>
+            <div class="col-xs-12">
+                <div class="form-group">
+                    <label class="col-sm-3 control-label">薪水分类:</label>
+                    <div class="col-sm-8">
+                        <select name="subjectType" id="subjectType" class="form-control" th:with="type=${@dict.getType('subject_type')}">
+                            <option value="">请选择</option>
+                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
+                        </select>
                     </div>
                 </div>
             </div>
@@ -38,8 +52,8 @@
             <h4 class="form-header h4">工资明细信息</h4>
             <div class="row">
                 <div class="col-xs-12">
-                    <button type="button" class="btn btn-white btn-sm" onclick="addRow()"><i class="fa fa-plus"> 增加</i></button>
-                    <button type="button" class="btn btn-white btn-sm" onclick="sub.delRow()"><i class="fa fa-minus"> 删除</i></button>
+<!--                    <button type="button" class="btn btn-white btn-sm" onclick="addRow()"><i class="fa fa-plus"> 增加</i></button>-->
+<!--                    <button type="button" class="btn btn-white btn-sm" onclick="sub.delRow()"><i class="fa fa-minus"> 删除</i></button>-->
                     <div class="col-sm-12 select-table table-striped">
                         <table id="bootstrap-table"></table>
                     </div>
@@ -115,51 +129,6 @@
                     }
                 },
                 {
-                    field: 'delFlag',
-                    align: 'center',
-                    title: '删除标志',
-                    formatter: function(value, row, index) {
-                        var html = $.common.sprintf("<input class='form-control' type='text' name='salaryDetailList[%s].delFlag' value='%s'>", index, value);
-                        return html;
-                    }
-                },
-                {
-                    field: 'createBy',
-                    align: 'center',
-                    title: '创建者',
-                    formatter: function(value, row, index) {
-                        var html = $.common.sprintf("<input class='form-control' type='text' name='salaryDetailList[%s].createBy' value='%s'>", index, value);
-                        return html;
-                    }
-                },
-                {
-                    field: 'createTime',
-                    align: 'center',
-                    title: '创建时间',
-                    formatter: function(value, row, index) {
-                        var html = $.common.sprintf("<input class='form-control' type='text' name='salaryDetailList[%s].createTime' value='%s'>", index, value);
-                        return html;
-                    }
-                },
-                {
-                    field: 'updateBy',
-                    align: 'center',
-                    title: '更新者',
-                    formatter: function(value, row, index) {
-                        var html = $.common.sprintf("<input class='form-control' type='text' name='salaryDetailList[%s].updateBy' value='%s'>", index, value);
-                        return html;
-                    }
-                },
-                {
-                    field: 'updateTime',
-                    align: 'center',
-                    title: '更新时间',
-                    formatter: function(value, row, index) {
-                        var html = $.common.sprintf("<input class='form-control' type='text' name='salaryDetailList[%s].updateTime' value='%s'>", index, value);
-                        return html;
-                    }
-                },
-                {
                     title: '操作',
                     align: 'center',
                     formatter: function(value, row, index) {
@@ -178,14 +147,53 @@
                 salarySubjectId: "",
                 subjectName: "",
                 amount: "",
-                delFlag: "",
-                createBy: "",
-                createTime: "",
-                updateBy: "",
-                updateTime: "",
             }
             sub.addRow(row);
         }
+
+        $("#subjectType").blur(function(){
+
+            $("#" + table.options.id).bootstrapTable('removeAll');
+
+            $.ajax({
+                url: ctx + "business/subject/getlist/" + $("input[name='subjectType']:checked").val(),
+                type: "get",
+                processData: false,
+                contentType: false,
+                beforeSend: function () {
+                    $.modal.loading("正在处理中,请稍后...");
+                    $.modal.disable();
+                },
+                success: function (result) {
+                    if (result.code === web_status.SUCCESS) {
+                        if (result.data.length > 0) {
+                            for (var i = 0; i < result.data.length; i++) {
+                                var count = $("#" + table.options.id).bootstrapTable('getData').length;
+
+                                time += i + 1 +"、" + result.data[i] + "<br/>"
+                                var row = {
+                                    index: $.table.serialNumber(count),
+                                    salarySubjectId: "",
+                                    subjectName: result.data[i].subjectName,
+                                    amount: "0",
+                                }
+                                sub.addRow(row);
+                            }
+                        }
+
+                        $.modal.alertSuccess(result.msg)
+                    } else if (result.code === web_status.WARNING) {
+                        $.modal.alertWarning(result.msg)
+                    } else {
+                        $.modal.alertError(result.msg);
+                    }
+                    $.modal.closeLoading();
+                    $.modal.enable();
+                }
+            })
+
+        });
+
     </script>
 </body>
 </html>

+ 18 - 3
src/main/resources/templates/business/salary/edit.html

@@ -13,7 +13,22 @@
                 <div class="form-group">
                     <label class="col-sm-3 control-label">用户:</label>
                     <div class="col-sm-8">
-                        <input name="userId" th:field="*{userId}" class="form-control" type="text">
+                        <select class="form-control" name="userId" th:with="users=${@user.getUserList()}" readonly="readonly">
+                            <option value="">请选择</option>
+                            <option th:each="user : ${users}" th:text="${user.userName}" th:value="${user.userId}" th:field="*{userId}"></option>
+                        </select>
+
+                    </div>
+                </div>
+            </div>
+            <div class="col-xs-12">
+                <div class="form-group">
+                    <label class="col-sm-3 control-label">薪水分类:</label>
+                    <div class="col-sm-8">
+                        <select name="subjectType" class="form-control" th:with="type=${@dict.getType('subject_type')}" readonly="readonly">
+                            <option value="">请选择</option>
+                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{subjectType}"></option>
+                        </select>
                     </div>
                 </div>
             </div>
@@ -39,8 +54,8 @@
             <h4 class="form-header h4">工资明细信息</h4>
             <div class="row">
                 <div class="col-sm-12">
-                    <button type="button" class="btn btn-white btn-sm" onclick="addRow()"><i class="fa fa-plus"> 增加</i></button>
-                    <button type="button" class="btn btn-white btn-sm" onclick="sub.delRow()"><i class="fa fa-minus"> 删除</i></button>
+<!--                    <button type="button" class="btn btn-white btn-sm" onclick="addRow()"><i class="fa fa-plus"> 增加</i></button>-->
+<!--                    <button type="button" class="btn btn-white btn-sm" onclick="sub.delRow()"><i class="fa fa-minus"> 删除</i></button>-->
                     <div class="col-sm-12 select-table table-striped">
                         <table id="bootstrap-table"></table>
                     </div>

+ 22 - 2
src/main/resources/templates/business/salary/salary.html

@@ -12,7 +12,18 @@
                         <ul>
                             <li>
                                 <label>用户:</label>
-                                <input type="text" name="userId"/>
+<!--                                <input type="text" name="userId"/>-->
+                                <select name="userId" th:with="users=${@user.getUserList()}">
+                                    <option value="">所有</option>
+                                    <option th:each="user : ${users}" th:text="${user.userName}" th:value="${user.userId}"></option>
+                                </select>
+                            </li>
+                            <li>
+                                <label>科目种类:</label>
+                                <select name="subjectType" th:with="type=${@dict.getType('subject_type')}">
+                                    <option value="">所有</option>
+                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
+                                </select>
                             </li>
                             <li class="select-time">
                                 <label>工资日期:</label>
@@ -52,6 +63,7 @@
     <script th:inline="javascript">
         var editFlag = [[${@permission.hasPermi('business:salary:edit')}]];
         var removeFlag = [[${@permission.hasPermi('business:salary:remove')}]];
+        var subjectTypeDatas = [[${@dict.getType('subject_type')}]];
         var prefix = ctx + "business/salary";
 
         $(function() {
@@ -72,13 +84,21 @@
                 },
                 {
                     field: 'userId',
-                    title: '用户'
+                    title: '用户',
+                    visible: false
                 },
                 {
                     field: 'userName',
                     title: '用户名称'
                 },
                 {
+                    field: 'subjectType',
+                    title: '薪水分类',
+                    formatter: function(value, row, index) {
+                        return $.table.selectDictLabel(subjectTypeDatas, value);
+                    }
+                },
+                {
                     field: 'salaryDate',
                     title: '日期'
                 },