Browse Source

Merge branch 'master' of http://47.100.37.243:10080/wutt/manHourHousekeeper

Lijy 2 years ago
parent
commit
4125aa57e1

+ 9 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/FinanceController.java

@@ -5,8 +5,10 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.management.platform.entity.Company;
 import com.management.platform.entity.FinanceFixedcolname;
 import com.management.platform.entity.FinanceTblcuscol;
+import com.management.platform.entity.TimeType;
 import com.management.platform.mapper.CompanyMapper;
 import com.management.platform.mapper.FinanceTblcuscolMapper;
+import com.management.platform.mapper.TimeTypeMapper;
 import com.management.platform.service.FinanceFixedcolnameService;
 import com.management.platform.service.FinanceService;
 import com.management.platform.util.ExcelUtil;
@@ -46,6 +48,8 @@ public class FinanceController {
     private CompanyMapper companyMapper;
     @Resource
     private FinanceFixedcolnameService financeFixedcolnameService;
+    @Resource
+    private TimeTypeMapper timeTypeMapper;
 
     @Value(value = "${upload.path}")
     private String path;
@@ -122,6 +126,11 @@ public class FinanceController {
 
         List<String> heads = new ArrayList<>();
         Company company = companyMapper.selectById(companyId);
+        //判断是否启用了工号模式
+        TimeType timeType = timeTypeMapper.selectById(companyId);
+        if (timeType.getFinanceJobnumEnabled() == 1) {
+            heads.add("工号");
+        }
         heads.add("姓名");
         heads.add(item.getMonthCost());//heads.add("工资");
         heads.add(item.getBonus());//heads.add("奖金");
@@ -131,7 +140,6 @@ public class FinanceController {
         heads.add(item.getInsuranceLosejob());//heads.add("失业保险");
         heads.add(item.getInsuranceInjury());//heads.add("工伤保险");
         heads.add(item.getHouseFund());//heads.add("住房公积金");
-//            heads.add("其他");
         if (list.size() > 0) {
             List<String> collect = list.stream().map(FinanceTblcuscol::getFieldName).collect(Collectors.toList());
             heads.addAll(collect);

+ 5 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/TaskGroupController.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.management.platform.entity.*;
 import com.management.platform.mapper.GroupParticipatorMapper;
 import com.management.platform.mapper.ProjectMapper;
+import com.management.platform.mapper.TimeTypeMapper;
 import com.management.platform.mapper.UserMapper;
 import com.management.platform.service.GroupTmpstagesService;
 import com.management.platform.service.StagesService;
@@ -50,6 +51,8 @@ public class TaskGroupController {
     private ProjectMapper projectMapper;
     @Resource
     private UserMapper userMapper;
+    @Resource
+    private TimeTypeMapper timeTypeMapper;
     /**
      * 保存任务分组
      */
@@ -129,7 +132,8 @@ public class TaskGroupController {
         Project project = projectMapper.selectById(projectId);
         QueryWrapper<TaskGroup> queryWrapper = new QueryWrapper<TaskGroup>();
         queryWrapper.eq("project_id", projectId);
-        if (project.getTaskGpIncharge() == 0) {
+        TimeType timeType = timeTypeMapper.selectById(project.getCompanyId());
+        if (timeType.getReportAuditType() == 0) {
             msg.data = taskGroupService.list(queryWrapper);
         } else {
             List<GroupParticipator> groupParticipatorList = groupParticipatorMapper.selectList(new QueryWrapper<GroupParticipator>().eq("user_id", token));

+ 8 - 3
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/Finance.java

@@ -16,7 +16,7 @@ import lombok.experimental.Accessors;
  * </p>
  *
  * @author Seyason
- * @since 2021-12-30
+ * @since 2022-08-12
  */
 @Data
 @EqualsAndHashCode(callSuper = false)
@@ -37,6 +37,12 @@ public class Finance extends Model<Finance> {
     @TableField("user_id")
     private String userId;
 
+    /**
+     * 工号
+     */
+    @TableField("job_number")
+    private String jobNumber;
+
     /**
      * 用户姓名
      */
@@ -139,13 +145,13 @@ public class Finance extends Model<Finance> {
     @TableField("custom_field3")
     private BigDecimal customField3;
 
-
     @TableField(exist = false)
     private BigDecimal hourCost;
 
     @TableField(exist = false)
     private Integer hasReport;
 
+
     @Override
     protected Serializable pkVal() {
         return this.id;
@@ -182,5 +188,4 @@ public class Finance extends Model<Finance> {
 
         return target;
     }
-
 }

+ 14 - 8
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/TimeType.java

@@ -1,23 +1,23 @@
 package com.management.platform.entity;
 
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
+import java.math.BigDecimal;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import java.util.List;
+
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.util.List;
-
 /**
  * <p>
  * 
  * </p>
  *
  * @author Seyason
- * @since 2022-08-11
+ * @since 2022-08-12
  */
 @Data
 @EqualsAndHashCode(callSuper = false)
@@ -332,9 +332,15 @@ public class TimeType extends Model<TimeType> {
     @TableField("project_with_dept")
     private Integer projectWithDept;
 
+    /**
+     * 财务核算成本导入是否含工号:0-不含,1-含
+     */
+    @TableField("finance_jobnum_enabled")
+    private Integer financeJobnumEnabled;
+
     @TableField(exist = false)
     private List<User> userList;
-    
+
     @Override
     protected Serializable pkVal() {
         return this.companyId;

+ 1 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/FinanceImportServiceImpl.java

@@ -323,6 +323,7 @@ public class FinanceImportServiceImpl extends ServiceImpl<FinanceImportMapper, F
                         continue;
                     }
                     //姓名	工资	奖金	津贴	养老保险	医疗保险	失业保险	(新增工伤保险) 住房公积金	其他; 可能有自定义的项
+                    //TODO: 如果后期导入审核的方式下也要支持工号,这里得修改代码
                     Cell nameCell = row.getCell(0);
                     Cell salaryCell = row.getCell(1);
                     Cell bonusCell = row.getCell(2);

+ 37 - 34
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/FinanceServiceImpl.java

@@ -191,15 +191,25 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
                 if (ExcelUtil.isRowEmpty(row)) {
                     continue;
                 }
-                //姓名	工资	奖金	津贴	养老保险	医疗保险	失业保险	(新增工伤保险) 住房公积金	其他; 可能有自定义的项
-                Cell nameCell = row.getCell(0);
-                Cell salaryCell = row.getCell(1);
-                Cell bonusCell = row.getCell(2);
-                Cell allowanceCell = row.getCell(3);
-                Cell inOldCell = row.getCell(4);
-                Cell inMedicalCell = row.getCell(5);
-                Cell inJobCell = row.getCell(6);
-                Cell injuryCell = row.getCell(7);
+                //(工号-可配置)	姓名 工资	奖金	津贴	养老保险	医疗保险	失业保险	(新增工伤保险) 住房公积金	其他; 可能有自定义的项
+
+                Cell jobNumberCell = null;
+                int nameStartIndex = 0;
+                //是否配置了工号模式的模板
+                boolean includeJobNumber = (timeType.getFinanceJobnumEnabled() == 1);
+                if (includeJobNumber) {
+                    jobNumberCell = row.getCell(0);
+                    jobNumberCell.setCellType(CellType.STRING);
+                    nameStartIndex = 1;
+                }
+                Cell nameCell = row.getCell(nameStartIndex + 0);
+                Cell salaryCell = row.getCell(nameStartIndex + 1);
+                Cell bonusCell = row.getCell(nameStartIndex + 2);
+                Cell allowanceCell = row.getCell(nameStartIndex + 3);
+                Cell inOldCell = row.getCell(nameStartIndex + 4);
+                Cell inMedicalCell = row.getCell(nameStartIndex + 5);
+                Cell inJobCell = row.getCell(nameStartIndex + 6);
+                Cell injuryCell = row.getCell(nameStartIndex + 7);
 
                 nameCell.setCellType(CellType.STRING);
 
@@ -208,10 +218,10 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
                 if (name.equals("姓名") && rowIndex == 0) {
                     continue;
                 }
-                Cell houseFundCell = row.getCell(8);
-                Cell field1 = cusColList.size() > 0?row.getCell(9):null;
-                Cell field2 = cusColList.size() > 1?row.getCell(10):null;
-                Cell field3 = cusColList.size() > 2?row.getCell(11):null;
+                Cell houseFundCell = row.getCell(nameStartIndex + 8);
+                Cell field1 = cusColList.size() > 0?row.getCell(nameStartIndex + 9):null;
+                Cell field2 = cusColList.size() > 1?row.getCell(nameStartIndex + 10):null;
+                Cell field3 = cusColList.size() > 2?row.getCell(nameStartIndex + 11):null;
 
                 if (field1 != null)field1.setCellType(CellType.STRING);
                 if (field2 != null)field2.setCellType(CellType.STRING);
@@ -219,8 +229,13 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
 
                 finance.setCompanyId(companyId);
                 finance.setName(name);
+                if (includeJobNumber) {
+                    finance.setJobNumber(jobNumberCell.getStringCellValue());
+                }
 
-                Optional<User> first = userList.stream().filter(u -> u.getName().equals(name)).findFirst();
+                Optional<User> first = userList.stream().filter(u -> includeJobNumber?
+                        u.getJobNumber() != null && u.getJobNumber().equals(finance.getJobNumber())
+                                                    :u.getName().equals(name)).findFirst();
                 if (first.isPresent()) {
                     finance.setUserId(first.get().getId());
                     BigDecimal total = new BigDecimal(0);
@@ -232,8 +247,8 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
                         if (financeConfig.getMonthCostCalculate()==1) total = total.add(value);
                     }
 
-                    //按姓名做匹配
-                    Optional<Finance> matchItem = oldFinanceList.stream().filter(o -> o.getName().equals(finance.getName())).findFirst();
+                    //按UserId做匹配
+                    Optional<Finance> matchItem = oldFinanceList.stream().filter(o -> o.getUserId().equals(finance.getUserId())).findFirst();
                     if (matchItem.isPresent()) {
                         finance.setId(matchItem.get().getId());
                     }
@@ -329,7 +344,11 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
                         updateUserList.add(localUser);
                     }
                 } else {
-                    msg.setError("用户["+name+"]不存在,请在组织结构中添加该成员");
+                    if (includeJobNumber) {
+                        msg.setError("用户["+name+","+finance.getJobNumber()+"]不存在,请在组织结构中添加该成员");
+                    } else {
+                        msg.setError("用户["+name+"]不存在,请在组织结构中添加该成员");
+                    }
                     return msg;
                 }
                 finance.setYmonth(yearMonth);
@@ -351,25 +370,11 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
                     User user1 = new User();
                     user1.setId(upU.getId());
                     user1.setMonthCost(upU.getMonthCost());
-                    user1.setCost(upU.getMonthCost().divide(db,2, BigDecimal.ROUND_HALF_UP));
+                    user1.setCost(upU.getMonthCost().divide(db,4, BigDecimal.ROUND_HALF_UP));
                     dbUpUserList.add(user1);
                 }
                 userService.updateBatchById(dbUpUserList);
             }
-            //修改成每次上传都新增更新,不删除。 前端界面增加删除功能。
-//            List<Integer> readyForDelete = new ArrayList<>();
-//            oldFinanceList.forEach(old->{
-//                boolean exists = false;
-//                if (financeList.stream().filter(f->f.getName().equals(old.getName())).findAny().isPresent()) {
-//                    exists = true;
-//                }
-//                if (!exists) {
-//                    readyForDelete.add(old.getId());
-//                }
-//            });
-//            if (readyForDelete.size() > 0) {
-//                financeService.removeByIds(readyForDelete);
-//            }
             //如果有必要,更新该月份的日报相关的成本
             if (syncHistoryReport) {
                 List<Report> reportList = reportMapper.selectSimpleTime(companyId, startStr, endStr);
@@ -394,7 +399,6 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
 
             //保存导入记录
             String originName = fileName;
-            System.out.println("fileName=="+originName);
             String[] names = originName.split("\\.");
             String destFileName = names[0] + "_"+System.currentTimeMillis()+"."+names[1];
             String financeFolder = "finance";
@@ -431,7 +435,6 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
             } catch (IOException e) {
                 e.printStackTrace();
             }
-//            file.deleteOnExit();//程序退出时删除临时文件
             System.out.println(file.delete());
         }
         return msg;

+ 2 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/FinanceMapper.xml

@@ -6,6 +6,7 @@
     <resultMap id="BaseResultMap" type="com.management.platform.entity.Finance">
         <id column="id" property="id" />
         <result column="user_id" property="userId" />
+        <result column="job_number" property="jobNumber" />
         <result column="name" property="name" />
         <result column="company_id" property="companyId" />
         <result column="dept_name" property="deptName" />
@@ -27,7 +28,7 @@
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        id, user_id, name, company_id, dept_name, month_cost, bonus, allowance, insurance_old, insurance_medical, insurance_losejob, insurance_injury, house_fund, others, total_cost, ymonth, custom_field1, custom_field2, custom_field3
+        id, user_id, job_number, name, company_id, dept_name, month_cost, bonus, allowance, insurance_old, insurance_medical, insurance_losejob, insurance_injury, house_fund, others, total_cost, ymonth, custom_field1, custom_field2, custom_field3
     </sql>
 
 </mapper>

File diff suppressed because it is too large
+ 2 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/TimeTypeMapper.xml


+ 1 - 1
fhKeeper/formulahousekeeper/timesheet/src/views/corpreport/list.vue

@@ -377,7 +377,7 @@
                   <el-table-column prop="groupName" label="分组名称" min-width="100"></el-table-column>
                   <el-table-column prop="workingTime" label="工时(h)" min-width="50" align="right" header-align="center">
                     <template slot-scope="scope">
-                      <span style="margin-right:20px">{{scope.row.workingTime ? scope.row.workingTime.toFixed(1) + '(h)' : ''}}</span>
+                      <span style="margin-right:20px">{{scope.row.workingTime ? scope.row.workingTime.toFixed(1) : ''}}</span>
                     </template>
                   </el-table-column>
                 </el-table-column>

+ 2 - 1
fhKeeper/formulahousekeeper/timesheet/src/views/project/finance.vue

@@ -164,7 +164,8 @@
         ref="table"
         @selection-change="deleteSel"
         :height="300" style="width: 100%;">
-        <el-table-column type="selection" width="80" fixed="left"></el-table-column>
+            <el-table-column type="selection" width="80" fixed="left"></el-table-column>
+            <el-table-column prop="jobNumber" v-if="user.timeType.financeJobnumEnabled==1" label="工号" sortable width="100" fixed="left"></el-table-column>
             <el-table-column prop="name" label="姓名" sortable width="150" fixed="left"></el-table-column>
             <template v-if="user.timeType.isSecretSalary==0">
                 <el-table-column :prop="headerCols[index]" :label="item" sortable show-overflow-tooltip v-for="(item, index) in tblCols" :key="index" width="130px" align="right">

+ 93 - 2
fhKeeper/formulahousekeeper/timesheet_h5/src/views/review/index.vue

@@ -3,6 +3,19 @@
         <van-nav-bar title="审核日报" left-text="返回" @click-left="back" fixed left-arrow/>
         
         <div class="login_form">
+            <van-sticky offset-top="1.22667rem" style="margin-bottom:10px">
+                <van-cell title="选择日期" :value="selectDateValue" @click="selectShow = true" />
+                <van-calendar v-model="selectShow" :min-date="minDate" type="range" @confirm="selectConfirm" />
+                <van-cell title="选择人员" :value="userNameValue" @click="selectUserShow = true" value-class="userNameValue" />
+                <van-popup v-model="selectUserShow" position="bottom">
+                    <van-search v-model="searchInputValue" placeholder="输入员工姓名搜索" @search="userListSearch"></van-search>
+                    <div style="minHeight:300px;">
+                        <van-checkbox class="userCheckbox" v-for="(item) in showUserList" :key="item.id" v-model="item.isChecked" >{{item.name}}</van-checkbox>
+                        <van-button style="width:100%;position: -webkit-sticky;position: sticky;bottom: 0;" @click="selectUserConfirm();selectUserShow=false">确定</van-button>
+                    </div>
+                </van-popup>
+            </van-sticky>
+
             <div class="formBatch">
                 <van-checkbox v-model="isAllChecked" :disabled="report.length == 0" @click="allChecked" shape="square" style="padding-left:3vw"></van-checkbox>
                 <div style="padding:1vh 2vw">
@@ -142,12 +155,73 @@
                 isCanAgree: false,
                 approveinData: null,
                 approveinDialog: false,
-                isbatch: false
+                isbatch: false,
+
+                selectDate: [],
+                selectDateValue: '',
+                selectShow: false,
+                userList: [],
+                showUserList: [],
+                userIdList: [],
+                userNameValue: '',
+                searchInputValue: '',
+                selectUserShow: false
             };
         },
         created() {
         },
         methods: {
+
+            selectConfirm(date){
+                const [start, end] = date;
+                this.selectShow = false;
+                this.selectDate = [this.getSelectDateStr(start),this.getSelectDateStr(end)]
+                this.selectDateValue = `${this.selectDate[0]} 至 ${this.selectDate[1]}`;
+                this.getReport()
+            },
+            getSelectDateStr(date){
+                return `${date.getFullYear()}-${(date.getMonth() + 1) < 10 ? '0' + (date.getMonth() + 1) : (date.getMonth() + 1)}-${date.getDate() < 10 ? '0' + date.getDate() : date.getDate()}`;
+            },
+            userListSearch(val) {
+                console.log(val);
+                this.showUserList = [];
+                this.userList.forEach(u=>{if (u.name.startsWith(val)) {
+                    this.showUserList.push(u);
+                }})
+            },
+            selectUserConfirm(){
+                this.userNameValue = '';
+                var that = this;
+                that.userIdList = '';
+                this.userList.filter(u=>u.isChecked).forEach(u=>{
+                    that.userNameValue += (u.name+',');
+                    that.userIdList += u.id + ','
+                });
+                if (this.userNameValue.length > 0) {
+                    this.userNameValue = this.userNameValue.substring(0, this.userNameValue.length-1);
+                    this.userIdList = this.userIdList.substring(0, this.userIdList.length-1);
+                }
+                this.getReport()
+            },
+
+            getUsers() {
+                this.$axios.post("/user/getEmployeeList", {
+                    departmentId: -1,
+                    pageIndex: 1,
+                    // pageSize: 99999
+                    pageSize: -1
+                })
+                .then(res => {
+                    if(res.code == "ok") {
+                        this.userList = res.data.records;
+                        this.showUserList = res.data.records
+                    } else {
+                        this.$toast.fail('获取失败');
+                    }
+                }).catch(err=> {this.$toast.clear();});
+            },
+
+
             // 批量操作
             allChecked(){
                 if(this.isAllChecked){
@@ -289,7 +363,17 @@
                     forbidClick: true,
                     duration: 0
                 });
-                this.$axios.post("/report/listByState", {state: 0})
+                let parameter = {
+                    state: 0
+                }
+                if(this.selectDate.length != 0){
+                    parameter.startDate = this.selectDate[0]
+                    parameter.endDate = this.selectDate[1]
+                }
+                if(this.userIdList){
+                    parameter.userId = this.userIdList
+                }
+                this.$axios.post("/report/listByState", parameter)
                 .then(res => {
                     if(res.code == "ok") {
                         this.$toast.clear();
@@ -397,6 +481,7 @@
 
         mounted() {
             this.getReport();
+            this.getUsers()
             var list = this.user.functionList
             for(var i in list) {
                 if(list[i].name == '审核全员日报') {
@@ -408,6 +493,12 @@
 </script>
 
 <style lang="less" scoped>
+.userCheckbox {
+        padding: 10px;;
+    }
+    .userNameValue{
+        white-space: nowrap;
+    }
     .formBatch{
         position: fixed;
         bottom: 0;