seyason 4 rokov pred
rodič
commit
a0c39776fd
26 zmenil súbory, kde vykonal 1069 pridanie a 90 odobranie
  1. 54 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/FinanceController.java
  2. 8 1
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ReportController.java
  3. 4 3
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/UserController.java
  4. 127 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/Finance.java
  5. 18 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/ProjectSumItem.java
  6. 8 1
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/Report.java
  7. 8 1
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/TimeType.java
  8. 18 15
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/User.java
  9. 19 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/UserWorkTime.java
  10. 16 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/FinanceMapper.java
  11. 4 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/ReportMapper.java
  12. 27 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/FinanceService.java
  13. 1 1
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/UserService.java
  14. 583 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/FinanceServiceImpl.java
  15. 12 32
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java
  16. 4 1
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/UserServiceImpl.java
  17. 29 0
      fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/FinanceMapper.xml
  18. 24 5
      fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ReportMapper.xml
  19. 2 1
      fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/TimeTypeMapper.xml
  20. 18 15
      fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/UserMapper.xml
  21. BIN
      fhKeeper/formulahousekeeper/management-platform/财务人员成本模板.xlsx
  22. 13 0
      fhKeeper/formulahousekeeper/timesheet/src/routes.js
  23. 9 4
      fhKeeper/formulahousekeeper/timesheet/src/views/settings/timetype.vue
  24. 52 5
      fhKeeper/formulahousekeeper/timesheet/src/views/team/index.vue
  25. 7 5
      fhKeeper/formulahousekeeper/timesheet/src/views/workReport/daily.vue
  26. 4 0
      fhKeeper/formulahousekeeper/timesheet/src/views/workReport/list.vue

+ 54 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/FinanceController.java

@@ -0,0 +1,54 @@
+package com.management.platform.controller;
+
+
+import com.management.platform.service.FinanceService;
+import com.management.platform.util.HttpRespMsg;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author Seyason
+ * @since 2021-02-18
+ */
+@RestController
+@RequestMapping("/finance")
+public class FinanceController {
+
+    @Resource
+    private FinanceService financeService;
+
+    @RequestMapping("/getByMonth")
+    public HttpRespMsg getByMonth(Integer companyId, String yearMonth) {
+        return financeService.getByMonth(companyId, yearMonth);
+    }
+
+    @RequestMapping("/importData")
+    public HttpRespMsg importData(Integer companyId, String yearMonth, MultipartFile file, HttpServletRequest request) {
+        return financeService.importData(companyId, yearMonth, file, request);
+    }
+
+    @RequestMapping("/exportData")
+    public HttpRespMsg exportData(@RequestParam String date, HttpServletRequest request) {
+        return financeService.exportData(date, request);
+    }
+
+    //按照项目分配财务成本
+    @RequestMapping("/getTimeCost")
+    public HttpRespMsg getTimeCost(String yearMonth, HttpServletRequest request) {
+        return financeService.getTimeCost(yearMonth, request);
+    }
+
+
+
+}
+

+ 8 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ReportController.java

@@ -3,6 +3,7 @@ package com.management.platform.controller;
 
 import com.management.platform.entity.Report;
 import com.management.platform.service.ReportService;
+import com.management.platform.service.UserService;
 import com.management.platform.util.HttpRespMsg;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -11,6 +12,7 @@ import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
+import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
 import java.time.LocalDate;
 import java.time.format.DateTimeFormatter;
@@ -33,6 +35,8 @@ public class ReportController {
     private ReportService reportService;
     @Resource
     private HttpServletRequest request;
+    @Resource
+    private UserService userService;
 
     /**
      * 根据时间 按照人分类 获取报告信息
@@ -75,17 +79,20 @@ public class ReportController {
                                   Integer[] timeType,
                                   String[] createDate) {
         List<Report> reportList = new ArrayList<>();
+        String token = request.getHeader("Token");
+        BigDecimal hourCost = userService.getById(token).getCost();
         try {
             for (int i = 0; i < id.length; i++) {
                 reportList.add(new Report()
                         .setId(id[i] == -1 ? null : id[i])
                         .setProjectId(projectId[i])
                         .setWorkingTime(workingTime[i])
+                        .setCost(hourCost.multiply(new BigDecimal(workingTime[i])))
                         .setTimeType(timeType[i])
                         .setContent(content[i])
                         .setState(0)
                         .setCreateDate(LocalDate.parse(createDate[i], DateTimeFormatter.ofPattern("yyyy-MM-dd")))
-                        .setCreatorId(request.getHeader("Token")));
+                        .setCreatorId(token));
                 /*后续需要加入状态*/
                 if (createDate[i] == null || projectId[i] == null) {
                     HttpRespMsg httpRespMsg = new HttpRespMsg();

+ 4 - 3
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/UserController.java

@@ -9,6 +9,7 @@ import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 
 /**
@@ -25,7 +26,7 @@ public class UserController {
     @Autowired
     private UserService userService;
 
-    @Autowired
+    @Resource
     private HttpServletRequest request;
 
     /**
@@ -112,8 +113,8 @@ public class UserController {
      */
     @RequestMapping("/insertUser")
     public HttpRespMsg insertUser(String id, @RequestParam String name, @RequestParam String phone,
-                                  @RequestParam Integer role, Double cost, Integer departmentId) {
-        return userService.insertUser(id, name, phone, role, cost, departmentId, request);
+                                  @RequestParam Integer role, Double monthCost, Double cost, Integer departmentId) {
+        return userService.insertUser(id, name, phone, role, monthCost, cost, departmentId, request);
     }
 
     /**

+ 127 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/Finance.java

@@ -0,0 +1,127 @@
+package com.management.platform.entity;
+
+import java.math.BigDecimal;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author Seyason
+ * @since 2021-02-18
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class Finance extends Model<Finance> {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 用户id
+     */
+    @TableField("user_id")
+    private String userId;
+
+    /**
+     * 用户姓名
+     */
+    @TableField("name")
+    private String name;
+
+    /**
+     * 公司id
+     */
+    @TableField("company_id")
+    private Integer companyId;
+
+    /**
+     * 部门名称
+     */
+    @TableField("dept_name")
+    private String deptName;
+
+    /**
+     * 月成本
+     */
+    @TableField("month_cost")
+    private BigDecimal monthCost;
+
+    /**
+     * 奖金
+     */
+    @TableField("bonus")
+    private BigDecimal bonus;
+
+    /**
+     * 津贴
+     */
+    @TableField("allowance")
+    private BigDecimal allowance;
+
+    /**
+     * 养老保险
+     */
+    @TableField("insurance_old")
+    private BigDecimal insuranceOld;
+
+    /**
+     * 医疗保险
+     */
+    @TableField("insurance_medical")
+    private BigDecimal insuranceMedical;
+
+    /**
+     * 失业保险
+     */
+    @TableField("insurance_losejob")
+    private BigDecimal insuranceLosejob;
+
+    /**
+     * 住房公积金
+     */
+    @TableField("house_fund")
+    private BigDecimal houseFund;
+
+    /**
+     * 其他
+     */
+    @TableField("others")
+    private BigDecimal others;
+
+    /**
+     * 总成本
+     */
+    @TableField("total_cost")
+    private BigDecimal totalCost;
+
+    /**
+     * 年月
+     */
+    @TableField("ymonth")
+    private String ymonth;
+
+
+    //时薪
+    @TableField(exist = false)
+    private BigDecimal hourCost;
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+}

+ 18 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/ProjectSumItem.java

@@ -0,0 +1,18 @@
+package com.management.platform.entity;
+
+import java.math.BigDecimal;
+
+public class ProjectSumItem {
+    public String project;
+    public double workingTime;
+    public BigDecimal cost;
+    //工资
+    public BigDecimal salary;
+    public BigDecimal bonus;
+    public BigDecimal allowance;
+    public BigDecimal old;
+    public BigDecimal medical;
+    public BigDecimal loseJob;
+    public BigDecimal house;
+    public BigDecimal other;
+}

+ 8 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/Report.java

@@ -1,5 +1,6 @@
 package com.management.platform.entity;
 
+import java.math.BigDecimal;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
 import java.time.LocalDate;
@@ -17,7 +18,7 @@ import lombok.experimental.Accessors;
  * </p>
  *
  * @author Seyason
- * @since 2021-02-07
+ * @since 2021-02-18
  */
 @Data
 @EqualsAndHashCode(callSuper = false)
@@ -80,6 +81,12 @@ public class Report extends Model<Report> {
     @TableField("time_type")
     private Integer timeType;
 
+    /**
+     * 成本
+     */
+    @TableField("cost")
+    private BigDecimal cost;
+
 
     @Override
     protected Serializable pkVal() {

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

@@ -1,5 +1,6 @@
 package com.management.platform.entity;
 
+import java.math.BigDecimal;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableField;
@@ -14,7 +15,7 @@ import lombok.experimental.Accessors;
  * </p>
  *
  * @author Seyason
- * @since 2021-02-07
+ * @since 2021-02-13
  */
 @Data
 @EqualsAndHashCode(callSuper = false)
@@ -47,6 +48,12 @@ public class TimeType extends Model<TimeType> {
     @TableField("pm")
     private Integer pm;
 
+    /**
+     * 每月工作天数
+     */
+    @TableField("month_days")
+    private BigDecimal monthDays;
+
 
     @Override
     protected Serializable pkVal() {

+ 18 - 15
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/User.java

@@ -1,31 +1,29 @@
 package com.management.platform.entity;
 
-import com.baomidou.mybatisplus.annotation.FieldStrategy;
-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 java.time.LocalDateTime;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.time.LocalDateTime;
-
 /**
  * <p>
- *
+ * 
  * </p>
  *
- * @author 吴涛涛
- * @since 2020-02-12
+ * @author Seyason
+ * @since 2021-02-13
  */
 @Data
 @EqualsAndHashCode(callSuper = false)
 @Accessors(chain = true)
 public class User extends Model<User> {
 
-    private static final long serialVersionUID = 1L;
+    private static final long serialVersionUID=1L;
 
     /**
      * 主键 雪花算法生成
@@ -90,16 +88,21 @@ public class User extends Model<User> {
     /**
      * 时薪
      */
-    @TableField(value = "cost", updateStrategy = FieldStrategy.IGNORED)
+    @TableField("cost")
     private BigDecimal cost;
 
+    /**
+     * 月薪
+     */
+    @TableField("month_cost")
+    private BigDecimal monthCost;
+
+    @TableField(exist = false)
+    private String departmentName;
 
     @Override
     protected Serializable pkVal() {
         return this.id;
     }
 
-    @TableField(exist = false)
-    private String departmentName;
-
 }

+ 19 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/UserWorkTime.java

@@ -0,0 +1,19 @@
+package com.management.platform.entity;
+
+import java.math.BigDecimal;
+
+public class UserWorkTime {
+    public String id;
+    public String name;
+    public BigDecimal workingTime;
+    public BigDecimal cost;
+    //工资
+    public BigDecimal salary;
+    public BigDecimal bonus;
+    public BigDecimal allowance;
+    public BigDecimal old;
+    public BigDecimal medical;
+    public BigDecimal loseJob;
+    public BigDecimal house;
+    public BigDecimal other;
+}

+ 16 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/FinanceMapper.java

@@ -0,0 +1,16 @@
+package com.management.platform.mapper;
+
+import com.management.platform.entity.Finance;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author Seyason
+ * @since 2021-02-18
+ */
+public interface FinanceMapper extends BaseMapper<Finance> {
+
+}

+ 4 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/ReportMapper.java

@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.management.platform.entity.Report;
 import org.apache.ibatis.annotations.Param;
 
+import java.time.LocalDate;
+import java.time.LocalDateTime;
 import java.util.List;
 import java.util.Map;
 
@@ -28,4 +30,6 @@ public interface ReportMapper extends BaseMapper<Report> {
 
     List<Map<String, Object>> getDetailByState(@Param("state") Integer state,
                                                @Param("companyId") Integer companyId);
+
+    List<Map<String, Object>> getRealProjectTime(@Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate, Integer companyId);
 }

+ 27 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/FinanceService.java

@@ -0,0 +1,27 @@
+package com.management.platform.service;
+
+import com.management.platform.entity.Finance;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.management.platform.util.HttpRespMsg;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author Seyason
+ * @since 2021-02-18
+ */
+public interface FinanceService extends IService<Finance> {
+
+    HttpRespMsg getByMonth(Integer companyId, String yearMonth);
+
+    HttpRespMsg importData(Integer companyId, String yearMonth, MultipartFile multipartFile, HttpServletRequest request);
+
+    HttpRespMsg exportData(String date, HttpServletRequest request);
+
+    HttpRespMsg getTimeCost(String yearMonth, HttpServletRequest request);
+}

+ 1 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/UserService.java

@@ -30,7 +30,7 @@ public interface UserService extends IService<User> {
 
     HttpRespMsg insertCompany(String companyName, String name, String phone);
 
-    HttpRespMsg insertUser(String id, String name, String phone, Integer role, Double cost, Integer departmentId,
+    HttpRespMsg insertUser(String id, String name, String phone, Integer role, Double monthCost, Double cost, Integer departmentId,
                            HttpServletRequest request);
 
     HttpRespMsg importUser(Integer departmentId, MultipartFile multipartFile, HttpServletRequest request);

+ 583 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/FinanceServiceImpl.java

@@ -0,0 +1,583 @@
+package com.management.platform.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.management.platform.entity.*;
+import com.management.platform.mapper.*;
+import com.management.platform.service.FinanceService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.management.platform.util.ExcelUtil;
+import com.management.platform.util.HttpRespMsg;
+import com.management.platform.util.MD5Util;
+import com.management.platform.util.SnowFlake;
+import lombok.extern.log4j.Log4j;
+import org.apache.log4j.LogManager;
+import org.apache.log4j.Logger;
+import org.apache.poi.hssf.usermodel.*;
+import org.apache.poi.ss.usermodel.CellType;
+import org.apache.poi.xssf.usermodel.XSSFCell;
+import org.apache.poi.xssf.usermodel.XSSFRow;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import java.io.*;
+import java.math.BigDecimal;
+import java.sql.Timestamp;
+import java.text.SimpleDateFormat;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.*;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author Seyason
+ * @since 2021-02-18
+ */
+@Service
+public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> implements FinanceService {
+    Logger logger = LogManager.getLogger(org.apache.logging.log4j.LogManager.ROOT_LOGGER_NAME);
+    @Resource
+    private FinanceMapper financeMapper;
+    @Resource
+    private ReportMapper reportMapper;
+    @Resource
+    private UserMapper userMapper;
+    @Resource
+    private DepartmentMapper departmentMapper;
+    @Resource
+    private FinanceService financeService;
+    @Resource
+    private ProjectMapper projectMapper;
+    @Value(value = "${upload.path}")
+    private String path;
+
+    @Override
+    public HttpRespMsg getByMonth(Integer companyId, String yearMonth) {
+        HttpRespMsg msg = new HttpRespMsg();
+        List<Finance> financeList = financeMapper.selectList(new QueryWrapper<Finance>().eq("company_id", companyId).eq("ymonth", yearMonth));
+        msg.data = financeList;
+        return msg;
+    }
+
+    @Override
+    public HttpRespMsg importData(Integer companyId, String yearMonth, MultipartFile multipartFile, HttpServletRequest request) {
+        HttpRespMsg msg = new HttpRespMsg();
+
+        //然后处理文件
+        String fileName = multipartFile.getOriginalFilename();
+        File file = new File(fileName == null ? "file" : fileName);
+        InputStream inputStream = null;
+        OutputStream outputStream = null;
+        try {
+            inputStream = multipartFile.getInputStream();
+            outputStream = new FileOutputStream(file);
+            byte[] buffer = new byte[4096];
+            int temp = 0;
+            while ((temp = inputStream.read(buffer, 0, 4096)) != -1) {
+                outputStream.write(buffer, 0, temp);
+            }
+            inputStream.close();
+            outputStream.close();
+            //然后解析表格
+            XSSFWorkbook workbook = new XSSFWorkbook(file);
+            //我们只需要第一个sheet
+            XSSFSheet sheet = workbook.getSheetAt(0);
+            //要插入的账号列表
+            List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId));
+            List<Department> departmentList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId));
+            List<Finance> financeList = new ArrayList<Finance>();
+            List<Finance> oldFinanceList = financeMapper.selectList(new QueryWrapper<Finance>().eq("company_id", companyId).eq("ymonth", yearMonth));
+            //获取月成本列表
+            DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+            String dateStr = yearMonth+"-01 00:00:00";
+            LocalDateTime startDate = LocalDateTime.parse(dateStr,df);
+            LocalDateTime endDate = LocalDateTime.parse(dateStr,df);
+            endDate = endDate.plusMonths(1);
+
+
+            //由于第一行需要指明列对应的标题
+            for (int rowIndex = 0; rowIndex <= sheet.getLastRowNum(); rowIndex++) {
+                XSSFRow row = sheet.getRow(rowIndex);
+                if (row == null) {
+                    continue;
+                }
+                //姓名	工资	奖金	津贴	养老保险	医疗保险	失业保险	住房公积金	其他
+                XSSFCell nameCell = row.getCell(0);
+                XSSFCell salaryCell = row.getCell(1);
+                XSSFCell bonusCell = row.getCell(2);
+                XSSFCell allowanceCell = row.getCell(3);
+                XSSFCell inOldCell = row.getCell(4);
+                XSSFCell inMedicalCell = row.getCell(5);
+                XSSFCell inJobCell = row.getCell(6);
+                XSSFCell houseFundCell = row.getCell(7);
+                XSSFCell otherCell = row.getCell(8);
+
+
+                nameCell.setCellType(CellType.STRING);
+                salaryCell.setCellType(CellType.STRING);
+                bonusCell.setCellType(CellType.STRING);
+                allowanceCell.setCellType(CellType.STRING);
+                inOldCell.setCellType(CellType.STRING);
+                inMedicalCell.setCellType(CellType.STRING);
+                inJobCell.setCellType(CellType.STRING);
+                houseFundCell.setCellType(CellType.STRING);
+                otherCell.setCellType(CellType.STRING);
+
+                String name = nameCell.getStringCellValue();
+                Finance finance = new Finance();
+                if (name.equals("姓名") && rowIndex == 0) {
+                    //跳过第一行标题
+                    continue;
+                }
+                finance.setCompanyId(companyId);
+                finance.setName(name);
+                Integer deptId = null;
+
+                Optional<User> first = first = userList.stream().filter(u -> u.getName().equals(name)).findFirst();
+                if (first.isPresent()) {
+                    finance.setUserId(first.get().getId());
+                    BigDecimal total = new BigDecimal(0);
+                    if (salaryCell != null) {
+                        salaryCell.setCellType(CellType.STRING);
+                        String item = salaryCell.getStringCellValue();
+                        BigDecimal value = item != null ? new BigDecimal(item) : BigDecimal.valueOf(0);
+                        finance.setMonthCost(value);
+                        total = total.add(value);
+                    }
+
+                    //按姓名做匹配
+                    Optional<Finance> matchItem = oldFinanceList.stream().filter(o -> o.getName().equals(finance.getName())).findFirst();
+                    if (matchItem.isPresent()) {
+                        finance.setId(matchItem.get().getId());
+                    }
+
+                    if (bonusCell != null) {
+                        bonusCell.setCellType(CellType.STRING);
+                        String bonusString = bonusCell.getStringCellValue();
+                        BigDecimal bonus = bonusString != null ? new BigDecimal(bonusString) : BigDecimal.valueOf(0);
+                        finance.setBonus(bonus);
+                        total = total.add(bonus);
+                    }
+                    if (allowanceCell != null) {
+                        allowanceCell.setCellType(CellType.STRING);
+                        String item = allowanceCell.getStringCellValue();
+                        BigDecimal value = item != null ? new BigDecimal(item) : BigDecimal.valueOf(0);
+                        finance.setAllowance(value);
+                        total = total.add(value);
+                    }
+                    if (inJobCell != null) {
+                        inJobCell.setCellType(CellType.STRING);
+                        String item = inJobCell.getStringCellValue();
+                        BigDecimal value = item != null ? new BigDecimal(item) : BigDecimal.valueOf(0);
+                        finance.setInsuranceLosejob(value);
+                        total = total.add(value);
+                    }
+                    if (inMedicalCell != null) {
+                        inMedicalCell.setCellType(CellType.STRING);
+                        String item = inMedicalCell.getStringCellValue();
+                        BigDecimal value = item != null ? new BigDecimal(item) : BigDecimal.valueOf(0);
+                        finance.setInsuranceMedical(value);
+                        total = total.add(value);
+                    }
+                    if (inOldCell != null) {
+                        inOldCell.setCellType(CellType.STRING);
+                        String item = inOldCell.getStringCellValue();
+                        BigDecimal value = item != null ? new BigDecimal(item) : BigDecimal.valueOf(0);
+                        finance.setInsuranceOld(value);
+                        total = total.add(value);
+                    }
+                    if (houseFundCell != null) {
+                        houseFundCell.setCellType(CellType.STRING);
+                        String item = houseFundCell.getStringCellValue();
+                        BigDecimal value = item != null ? new BigDecimal(item) : BigDecimal.valueOf(0);
+                        finance.setHouseFund(value);
+                        total = total.add(value);
+                    }
+                    if (otherCell != null) {
+                        otherCell.setCellType(CellType.STRING);
+                        String item = otherCell.getStringCellValue();
+                        BigDecimal value = item != null ? new BigDecimal(item) : BigDecimal.valueOf(0);
+                        finance.setOthers(value);
+                        total = total.add(value);
+                    }
+                    finance.setTotalCost(total);
+                } else {
+                    msg.setError("用户["+name+"]不存在,请在组织结构中添加该成员");
+                    return msg;
+                }
+                finance.setYmonth(yearMonth);
+                financeList.add(finance);
+
+            }
+            //最后删掉这个文件
+//            if (!file.delete()) {
+//                System.out.println("临时文件" + file.getName() + "删除失败");
+//            }
+            System.out.println("size=="+financeList.size());
+            //批量插入
+            financeService.saveOrUpdateBatch(financeList);
+        } catch (IOException e) {
+            e.printStackTrace();
+            msg.setError("文件处理出错");
+            return msg;
+        } catch (NullPointerException e) {
+            e.printStackTrace();
+            msg.setError("数据格式有误或存在空数据 导入失败");
+            return msg;
+        } catch (Exception e) {
+            e.printStackTrace();
+            msg.setError("发生其他错误");
+            return msg;
+        } finally {
+            //关闭流
+            try {
+                if (outputStream != null && inputStream != null) {
+                    outputStream.close();
+                    inputStream.close();
+                    System.out.println("流已关闭");
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+//            file.deleteOnExit();//程序退出时删除临时文件
+            System.out.println(file.delete());
+        }
+        return msg;
+    }
+
+    @Override
+    public HttpRespMsg exportData(String yearMonth, HttpServletRequest request) {
+        HttpRespMsg httpRespMsg = new HttpRespMsg();
+        try {
+            Integer companyId = userMapper.selectById(request.getHeader("Token")).getCompanyId();
+            Map<String, Object> resultMap = new HashMap<>();
+            double totalCostTime = 0;
+            BigDecimal totalMoneyCost = BigDecimal.valueOf(0);
+            BigDecimal totalSalary = BigDecimal.valueOf(0);
+            BigDecimal totalBonus = BigDecimal.valueOf(0);
+            BigDecimal totalAllowance = BigDecimal.valueOf(0);
+            BigDecimal totalOld = BigDecimal.valueOf(0);
+            BigDecimal totalMedical = BigDecimal.valueOf(0);
+            BigDecimal totalLoseJob = BigDecimal.valueOf(0);
+            BigDecimal totalHouse = BigDecimal.valueOf(0);
+            BigDecimal totalOther = BigDecimal.valueOf(0);
+
+            List<String> headList = new ArrayList<String>();
+            headList.add("项目");
+            headList.add("人员");
+            headList.add("时间(h)");
+            headList.add("工资(元)");
+            headList.add("奖金(元)");
+            headList.add("津贴(元)");
+            headList.add("养老保险(元)");
+            headList.add("医疗保险(元)");
+            headList.add("失业保险(元)");
+            headList.add("住房公积金(元)");
+            headList.add("其他(元)");
+            headList.add("总成本(元)");
+            List<List<String>> allList = new ArrayList<List<String>>();
+            allList.add(headList);
+
+
+            //获取月成本列表
+            DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+            String dateStr = yearMonth+"-01 00:00:00";
+            LocalDateTime startDate = LocalDateTime.parse(dateStr,df);
+            LocalDateTime endDate = LocalDateTime.parse(dateStr,df);
+            endDate = endDate.plusMonths(1);
+
+            List<Map<String, Object>> projectTimeList = reportMapper.getRealProjectTime(startDate, endDate, companyId);
+
+            //计算每个项目的时间和成本
+            ProjectSumItem item = new ProjectSumItem();
+            List<ProjectSumItem> pList = new ArrayList<ProjectSumItem>();
+
+            //计算每个人的实际时薪(包含工资,奖金等)
+            HashMap<String, UserWorkTime> userTime = new HashMap<String, UserWorkTime>();
+            for (Map<String, Object> map : projectTimeList) {
+                String creatorId = (String) map.get("creatorId");
+                totalCostTime += (Double)map.get("workingTime");
+                if (userTime.get(creatorId) == null) {
+                    UserWorkTime user = new UserWorkTime();
+                    user.workingTime = new BigDecimal((Double)map.get("workingTime"));
+                    userTime.put(creatorId, user);
+                } else {
+                    //时间累加
+                    userTime.get(creatorId).workingTime = userTime.get(creatorId).workingTime.add(new BigDecimal((Double)map.get("workingTime")));
+                }
+            }
+
+            List<Finance> finances = financeMapper.selectList(new QueryWrapper<Finance>().eq("company_id", companyId).eq("ymonth", yearMonth));
+            List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId));
+
+            for (Map<String, Object> map : projectTimeList) {
+                String curProject = (String) map.get("project");
+                String creatorId = (String) map.get("creatorId");
+                Optional<Finance> first = finances.stream().filter(f -> f.getUserId().equals(creatorId)).findFirst();
+                Double workingTime = (Double)map.get("workingTime");
+                BigDecimal cost = new BigDecimal(0);
+                BigDecimal salary = new BigDecimal(0);
+                BigDecimal bonus = new BigDecimal(0);
+                BigDecimal allowance = new BigDecimal(0);
+                BigDecimal old = new BigDecimal(0);
+                BigDecimal medical = new BigDecimal(0);
+                BigDecimal loseJob = new BigDecimal(0);
+                BigDecimal house = new BigDecimal(0);
+                BigDecimal other = new BigDecimal(0);
+                if (first.isPresent()) {
+                    Finance userFinance = first.get();
+                    cost = userFinance.getTotalCost().multiply(new BigDecimal(workingTime)).divide(userTime.get(creatorId).workingTime, 4, BigDecimal.ROUND_HALF_UP);
+                    salary = userFinance.getMonthCost().multiply(new BigDecimal(workingTime)).divide(userTime.get(creatorId).workingTime, 4, BigDecimal.ROUND_HALF_UP);
+                    bonus = userFinance.getBonus().multiply(new BigDecimal(workingTime)).divide(userTime.get(creatorId).workingTime, 4, BigDecimal.ROUND_HALF_UP);
+                    allowance = userFinance.getAllowance().multiply(new BigDecimal(workingTime)).divide(userTime.get(creatorId).workingTime, 4, BigDecimal.ROUND_HALF_UP);
+                    old = userFinance.getInsuranceOld().multiply(new BigDecimal(workingTime)).divide(userTime.get(creatorId).workingTime, 4, BigDecimal.ROUND_HALF_UP);
+                    medical = userFinance.getInsuranceMedical().multiply(new BigDecimal(workingTime)).divide(userTime.get(creatorId).workingTime, 4, BigDecimal.ROUND_HALF_UP);
+                    loseJob = userFinance.getInsuranceLosejob().multiply(new BigDecimal(workingTime)).divide(userTime.get(creatorId).workingTime, 4, BigDecimal.ROUND_HALF_UP);
+                    house = userFinance.getHouseFund().multiply(new BigDecimal(workingTime)).divide(userTime.get(creatorId).workingTime, 4, BigDecimal.ROUND_HALF_UP);
+                    other = userFinance.getOthers().multiply(new BigDecimal(workingTime)).divide(userTime.get(creatorId).workingTime, 4, BigDecimal.ROUND_HALF_UP);
+                } else {
+                    System.out.println("财务数据中未找到用户:"+creatorId);
+
+                }
+
+                if (curProject.equals(item.project)) {
+                    item.workingTime += workingTime;
+                    item.cost = item.cost.add(cost);
+                    item.salary = item.salary.add(salary);
+                    item.bonus = item.bonus.add(bonus);
+                    item.allowance = item.allowance.add(allowance);
+                    item.old = item.old.add(old);
+                    item.medical = item.medical.add(medical);
+                    item.loseJob = item.loseJob.add(loseJob);
+                    item.house = item.house.add(house);
+                    item.other = item.other.add(other);
+                } else {
+                    item = new ProjectSumItem();
+                    pList.add(item);
+                    item.project = curProject;
+                    item.workingTime = workingTime;
+                    item.cost = cost;
+                    item.salary = salary;
+                    item.bonus = bonus;
+                    item.allowance = allowance;
+                    item.old = old;
+                    item.medical = medical;
+                    item.loseJob = loseJob;
+                    item.house = house;
+                    item.other = other;
+                }
+                totalMoneyCost = totalMoneyCost.add(cost);
+                totalSalary = totalSalary.add(salary);
+                totalBonus = totalBonus.add(bonus);
+                totalAllowance = totalAllowance.add(allowance);
+                totalOld = totalOld.add(old);
+                totalMedical = totalMedical.add(medical);
+                totalLoseJob = totalLoseJob.add(loseJob);
+                totalHouse = totalHouse.add(house);
+                totalOther = totalOther.add(other);
+            }
+            //整体四舍五入处理
+            totalMoneyCost = totalMoneyCost.setScale(2, BigDecimal.ROUND_HALF_UP);
+            totalSalary = totalSalary.setScale(2, BigDecimal.ROUND_HALF_UP);
+            totalBonus = totalBonus.setScale(2, BigDecimal.ROUND_HALF_UP);
+            totalAllowance = totalAllowance.setScale(2, BigDecimal.ROUND_HALF_UP);
+            totalOld = totalOld.setScale(2, BigDecimal.ROUND_HALF_UP);
+            totalMedical = totalMedical.setScale(2, BigDecimal.ROUND_HALF_UP);
+            totalLoseJob = totalLoseJob.setScale(2, BigDecimal.ROUND_HALF_UP);
+            totalHouse = totalHouse.setScale(2, BigDecimal.ROUND_HALF_UP);
+            totalOther = totalOther.setScale(2, BigDecimal.ROUND_HALF_UP);
+
+            pList.forEach(p->{
+                p.cost = p.cost.setScale(2, BigDecimal.ROUND_HALF_UP);
+                p.salary = p.salary.setScale(2, BigDecimal.ROUND_HALF_UP);
+                p.bonus = p.bonus.setScale(2, BigDecimal.ROUND_HALF_UP);
+                p.allowance = p.allowance.setScale(2, BigDecimal.ROUND_HALF_UP);
+                p.old = p.old.setScale(2, BigDecimal.ROUND_HALF_UP);
+                p.medical = p.medical.setScale(2, BigDecimal.ROUND_HALF_UP);
+                p.loseJob = p.loseJob.setScale(2, BigDecimal.ROUND_HALF_UP);
+                p.house = p.house.setScale(2, BigDecimal.ROUND_HALF_UP);
+                p.other = p.other.setScale(2, BigDecimal.ROUND_HALF_UP);
+
+                //组装写入excel文件的数据,从项目开始,项目下面挂成员
+                List<String> rowData = new ArrayList<String>();
+                rowData.add(p.project);
+                rowData.add("");
+                rowData.add(p.workingTime+"");
+                rowData.add(p.salary.toPlainString());
+                rowData.add(p.bonus.toPlainString());
+                rowData.add(p.allowance.toPlainString());
+                rowData.add(p.old.toPlainString());
+                rowData.add(p.medical.toPlainString());
+                rowData.add(p.loseJob.toPlainString());
+                rowData.add(p.house.toPlainString());
+                rowData.add(p.other.toPlainString());
+                rowData.add(p.cost.toPlainString());
+                allList.add(rowData);
+
+                //获取成员
+                for (Map<String, Object> membMap : projectTimeList) {
+                    if (membMap.get("project").equals(p.project)) {
+                        //匹配到项目了
+                        List<String> membRowData = new ArrayList<String>();
+                        membRowData.add("");
+                        Double workingTime = (Double) membMap.get("workingTime");
+                        String creatorId = (String) membMap.get("creatorId");
+                        User us = userList.stream().filter(u->u.getId().equals(creatorId)).findFirst().get();
+                        Optional<Finance> first = finances.stream().filter(f -> f.getUserId().equals(creatorId)).findFirst();
+                        if (!first.isPresent()) {
+                            logger.info("用户["+us.getName()+"]在财务报表中不存在,请重新导入");
+                            continue;
+                        }
+                        Finance userFinance = first.get();
+
+                        BigDecimal cost = userFinance.getTotalCost().multiply(new BigDecimal(workingTime)).divide(userTime.get(creatorId).workingTime, 4, BigDecimal.ROUND_HALF_UP);
+                        BigDecimal salary = userFinance.getMonthCost().multiply(new BigDecimal(workingTime)).divide(userTime.get(creatorId).workingTime, 4, BigDecimal.ROUND_HALF_UP);
+                        BigDecimal bonus = userFinance.getBonus().multiply(new BigDecimal(workingTime)).divide(userTime.get(creatorId).workingTime, 4, BigDecimal.ROUND_HALF_UP);
+                        BigDecimal allowance = userFinance.getAllowance().multiply(new BigDecimal(workingTime)).divide(userTime.get(creatorId).workingTime, 4, BigDecimal.ROUND_HALF_UP);
+                        BigDecimal old = userFinance.getInsuranceOld().multiply(new BigDecimal(workingTime)).divide(userTime.get(creatorId).workingTime, 4, BigDecimal.ROUND_HALF_UP);
+                        BigDecimal medical = userFinance.getInsuranceMedical().multiply(new BigDecimal(workingTime)).divide(userTime.get(creatorId).workingTime, 4, BigDecimal.ROUND_HALF_UP);
+                        BigDecimal loseJob = userFinance.getInsuranceLosejob().multiply(new BigDecimal(workingTime)).divide(userTime.get(creatorId).workingTime, 4, BigDecimal.ROUND_HALF_UP);
+                        BigDecimal house = userFinance.getHouseFund().multiply(new BigDecimal(workingTime)).divide(userTime.get(creatorId).workingTime, 4, BigDecimal.ROUND_HALF_UP);
+                        BigDecimal other = userFinance.getOthers().multiply(new BigDecimal(workingTime)).divide(userTime.get(creatorId).workingTime, 4, BigDecimal.ROUND_HALF_UP);
+
+                        membRowData.add(us.getName());
+                        membRowData.add(workingTime+"");
+                        membRowData.add(salary.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString());
+                        membRowData.add(bonus.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString());
+                        membRowData.add(allowance.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString());
+                        membRowData.add(old.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString());
+                        membRowData.add(medical.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString());
+                        membRowData.add(loseJob.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString());
+                        membRowData.add(house.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString());
+                        membRowData.add(other.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString());
+                        membRowData.add(cost.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString());
+                        allList.add(membRowData);
+                    }
+                }
+            });
+
+            String total = totalMoneyCost.toString();
+            //合计
+            List<String> sumRow = new ArrayList<String>();
+            sumRow.add("合计");
+            sumRow.add("");
+            sumRow.add(""+totalCostTime);
+            sumRow.add(totalSalary.toString());
+            sumRow.add(totalBonus.toString());
+            sumRow.add(totalAllowance.toString());
+            sumRow.add(totalOld.toString());
+            sumRow.add(totalMedical.toString());
+            sumRow.add(totalLoseJob.toString());
+            sumRow.add(totalHouse.toString());
+            sumRow.add(totalOther.toString());
+            sumRow.add(totalMoneyCost.toString());
+
+            allList.add(sumRow);
+            //生成excel文件导出
+            String fileName = "财务人员成本_"+System.currentTimeMillis();
+            String resp = ExcelUtil.exportGeneralExcelByTitleAndList(fileName , allList, path);
+
+            httpRespMsg.data = resp;
+        } catch (NullPointerException e) {
+            httpRespMsg.setError("验证失败");
+            return httpRespMsg;
+        }
+        return httpRespMsg;
+    }
+
+    @Override
+    public HttpRespMsg getTimeCost(String yearMonth, HttpServletRequest request) {
+        HttpRespMsg httpRespMsg = new HttpRespMsg();
+        try {
+            Integer companyId = userMapper.selectById(request.getHeader("Token")).getCompanyId();
+            Map<String, Object> resultMap = new HashMap<>();
+            //获取月成本列表
+            DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+            String dateStr = yearMonth+"-01 00:00:00";
+            LocalDateTime startDate = LocalDateTime.parse(dateStr,df);
+            LocalDateTime endDate = LocalDateTime.parse(dateStr,df);
+            endDate = endDate.plusMonths(1);
+
+            List<Map<String, Object>> projectTimeList = reportMapper.getRealProjectTime(startDate, endDate, companyId);
+
+            BigDecimal totalMoneyCost = BigDecimal.valueOf(0);
+            //计算每个项目的时间和成本
+            ProjectSumItem item = new ProjectSumItem();
+            List<ProjectSumItem> pList = new ArrayList<ProjectSumItem>();
+
+            //计算每个人的实际时薪(包含工资,奖金等)
+            HashMap<String, BigDecimal> userTime = new HashMap<String, BigDecimal>();
+            for (Map<String, Object> map : projectTimeList) {
+                String creatorId = (String) map.get("creatorId");
+                if (userTime.get(creatorId) == null) {
+                    userTime.put(creatorId, new BigDecimal((Double)map.get("workingTime")));
+                } else {
+                    //时间累加
+                    BigDecimal d = userTime.get(creatorId).add(new BigDecimal((Double)map.get("workingTime")));
+                    userTime.put(creatorId, d);
+                }
+            }
+            Set<String> strings = userTime.keySet();
+            Iterator<String> iterator = strings.iterator();
+            while (iterator.hasNext()) {
+                String next = iterator.next();
+                System.out.println(next+": "+userTime.get(next));
+            }
+            List<Finance> finances = financeMapper.selectList(new QueryWrapper<Finance>().eq("company_id", companyId).eq("ymonth", yearMonth));
+            List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId));
+            finances.forEach(f->{
+                String uid = f.getUserId();
+                BigDecimal b = userTime.get(uid);
+                BigDecimal avgHourCost = f.getTotalCost().divide(b,4, BigDecimal.ROUND_HALF_UP);
+                f.setHourCost(avgHourCost);
+            });
+
+            for (Map<String, Object> map : projectTimeList) {
+                String curProject = (String) map.get("project");
+                String creatorId = (String) map.get("creatorId");
+                Optional<Finance> first = finances.stream().filter(f -> f.getUserId().equals(creatorId)).findFirst();
+                Double workingTime = (Double)map.get("workingTime");
+                BigDecimal cost = new BigDecimal(0);
+                if (first.isPresent()) {
+                    cost = first.get().getHourCost().multiply(new BigDecimal(workingTime));
+                } else {
+                    System.out.println("财务数据中未找到用户:"+creatorId);
+                }
+
+                if (curProject.equals(item.project)) {
+                    item.workingTime += workingTime;
+                    item.cost = item.cost.add(cost);
+                } else {
+                    item = new ProjectSumItem();
+                    pList.add(item);
+                    item.project = curProject;
+                    item.workingTime = workingTime;
+                    item.cost = cost;
+                }
+                totalMoneyCost = totalMoneyCost.add(cost);
+            }
+            //整体四舍五入处理
+            totalMoneyCost = totalMoneyCost.setScale(2, BigDecimal.ROUND_HALF_UP);
+            pList.forEach(p->{
+                p.cost = p.cost.setScale(2, BigDecimal.ROUND_HALF_UP);
+            });
+            resultMap.put("costList", pList);
+            resultMap.put("totalMoneyCost", totalMoneyCost);
+            httpRespMsg.data = resultMap;
+        } catch (NullPointerException e) {
+            e.printStackTrace();
+            httpRespMsg.setError("验证失败");
+            return httpRespMsg;
+        }
+        return httpRespMsg;
+    }
+}

+ 12 - 32
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java

@@ -17,6 +17,7 @@ import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import java.io.FileOutputStream;
 import java.io.IOException;
+import java.math.BigDecimal;
 import java.sql.Timestamp;
 import java.text.DecimalFormat;
 import java.text.SimpleDateFormat;
@@ -75,28 +76,15 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                     nameList.add(map);
                     map.put("data", list);
                     double reportTime = 0;
+                    BigDecimal total = new BigDecimal(0);
                     for (Map<String, Object> m : list) {
                         double t = (double) m.get("time");
                         reportTime += t;
+                        total = total.add((BigDecimal)m.get("cost"));
                     }
                     DecimalFormat df = new DecimalFormat("0.00");
                     map.put("reportTime", df.format(reportTime));
-                    //顺便再获取一下可分配时间
-//                    Integer calculateTime = 0;
-//                    //以下区间被认为是工作时间
-//                    Integer[] workType = {-1, 0, 1, 2, 3, 4, 5};
-//                    //工作时间筛选
-//                    List<TimeCalculation> timeCalculations = timeCalculationMapper.selectList(new QueryWrapper<TimeCalculation>()
-//                            .eq("date", LocalDate.parse(date, DateTimeFormatter.ofPattern("yyyy-MM-dd")))
-//                            .eq("user_id", userId)
-//                            .in("action_type", workType));
-//                    if (timeCalculations != null) {
-//                        for (TimeCalculation timeCalculation : timeCalculations) {
-//                            calculateTime += timeCalculation.getDuration();
-//                        }
-//                    }
-//                    //把总秒数转为double后换算为小时并保留两位小数
-//                    map.put("calculateTime", df.format((double) calculateTime / 3600));
+                    map.put("cost", total);
                     map.put("state", list.get(0).get("state"));
                 }
             } else {
@@ -126,12 +114,15 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                     for (Map<String, Object> map : nameList) {
                         //再根据人分别获取当天的报告
                         List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
+                        BigDecimal total = new BigDecimal(0);
                         for (Map<String, Object> report : reportList) {
                             if (((String)report.get("creatorId")).equals((String)map.get("id"))) {
                                 list.add(report);
+                                total = total.add((BigDecimal) report.get("cost"));
                             }
                         }
                         map.put("data", list);
+                        map.put("cost", total);
                         double reportTime = 0;
                         if (list.size() > 0) {
                             for (Map<String, Object> m : list) {
@@ -142,22 +133,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                         }
                         DecimalFormat df = new DecimalFormat("0.00");
                         map.put("reportTime", df.format(reportTime));
-                        //顺便再获取一下可分配时间
-                        //                    Integer calculateTime = 0;
-                        //                    //以下区间被认为是工作时间
-                        //                    Integer[] workType = {-1, 0, 1, 2, 3, 4, 5};
-                        //                    //工作时间筛选
-                        //                    List<TimeCalculation> timeCalculations = timeCalculationMapper.selectList(new QueryWrapper<TimeCalculation>()
-                        //                            .eq("date", LocalDate.parse(date, DateTimeFormatter.ofPattern("yyyy-MM-dd")))
-                        //                            .eq("user_id", map.get("id"))
-                        //                            .in("action_type", workType));
-                        //                    if (timeCalculations != null) {
-                        //                        for (TimeCalculation timeCalculation : timeCalculations) {
-                        //                            calculateTime += timeCalculation.getDuration();
-                        //                        }
-                        //                    }
-                        //                    //把总秒数转为double后换算为小时并保留两位小数
-                        //                    map.put("calculateTime", df.format((double) calculateTime / 3600));
+
                     }
                 }
             }
@@ -273,6 +249,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
         try {
             Integer companyId = userMapper.selectById(request.getHeader("Token")).getCompanyId();
             List<Map<String, Object>> nameList = reportMapper.getDetailByState(state, companyId);
+            List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId));
             for (Map<String, Object> map : nameList) {
                 //再根据人分别获取当天的报告
                 List<Map<String, Object>> list = reportMapper.getReportByDate(
@@ -289,6 +266,9 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                 }
                 DecimalFormat df = new DecimalFormat("0.00");
                 map.put("reportTime", df.format(reportTime));
+                //计算成本
+                BigDecimal multiply = userList.stream().filter(u -> u.getId().equals((String) map.get("id"))).findFirst().get().getCost().multiply(new BigDecimal(reportTime));
+                map.put("cost", multiply);
                 //顺便再获取一下可分配时间
                 Integer calculateTime = 0;
                 //以下区间被认为是工作时间

+ 4 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/UserServiceImpl.java

@@ -305,13 +305,14 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
 
     //新增或修改用户
     @Override
-    public HttpRespMsg insertUser(String targetId, String name, String phone, Integer role, Double cost,
+    public HttpRespMsg insertUser(String targetId, String name, String phone, Integer role, Double monthCost, Double cost,
                                   Integer departmentId, HttpServletRequest request) {
         HttpRespMsg httpRespMsg = new HttpRespMsg();
         try {
             User creator = userMapper.selectById(request.getHeader("Token"));
             //处理时薪
             BigDecimal costValue = cost == null ? BigDecimal.valueOf(0) : BigDecimal.valueOf(cost);
+            BigDecimal monthCostValue = cost == null ? BigDecimal.valueOf(0) : BigDecimal.valueOf(monthCost);
             if (targetId == null) {
                 //新增
                 if (creator.getRole() == 2 && role != 0) {
@@ -336,6 +337,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
                                     .setPhone(phone)
                                     .setRole(role)
                                     .setCompanyId(creator.getCompanyId())
+                                    .setMonthCost(monthCostValue)
                                     .setCost(costValue)
                                     .setDepartmentId(departmentId == null ? 0 : departmentId)
                                     .setDepartmentCascade(departmentId == null ?
@@ -353,6 +355,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
                         .setName(name)
                         .setPhone(phone)
                         .setRole(role)
+                        .setMonthCost(monthCostValue)
                         .setCost(costValue)
                         .setDepartmentId(departmentId == null ? 0 : departmentId)
                         .setDepartmentCascade(departmentId == null ?

+ 29 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/FinanceMapper.xml

@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.management.platform.mapper.FinanceMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.management.platform.entity.Finance">
+        <id column="id" property="id" />
+        <result column="user_id" property="userId" />
+        <result column="name" property="name" />
+        <result column="company_id" property="companyId" />
+        <result column="dept_name" property="deptName" />
+        <result column="month_cost" property="monthCost" />
+        <result column="bonus" property="bonus" />
+        <result column="allowance" property="allowance" />
+        <result column="insurance_old" property="insuranceOld" />
+        <result column="insurance_medical" property="insuranceMedical" />
+        <result column="insurance_losejob" property="insuranceLosejob" />
+        <result column="house_fund" property="houseFund" />
+        <result column="others" property="others" />
+        <result column="total_cost" property="totalCost" />
+        <result column="ymonth" property="ymonth" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id, user_id, name, company_id, dept_name, month_cost, bonus, allowance, insurance_old, insurance_medical, insurance_losejob, house_fund, others, total_cost, ymonth
+    </sql>
+
+</mapper>

+ 24 - 5
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ReportMapper.xml

@@ -13,16 +13,18 @@
         <result column="state" property="state" />
         <result column="create_time" property="createTime" />
         <result column="time_type" property="timeType" />
+        <result column="cost" property="cost" />
     </resultMap>
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        id, creator_id, project_id, create_date, working_time, content, state, create_time, time_type
+        id, creator_id, project_id, create_date, working_time, content, state, create_time, time_type, cost
     </sql>
 
     <!--根据日期获取全部报告信息-->
     <select id="getAllReportByDate" resultType="java.util.Map">
-        SELECT c.name, b.project_name AS project, a.working_time AS duration, a.content, a.create_time AS time, a.state, a.time_type as timeType
+        SELECT c.name, b.project_name AS project, a.working_time AS duration, a.content, a.create_time AS time,
+        a.state, a.time_type as timeType, a.cost
         FROM report AS a
         JOIN project AS b ON a.project_id=b.id
         LEFT JOIN user AS c ON a.creator_id=c.id
@@ -41,7 +43,7 @@
 
     <!--根据日期获取报告信息-->
     <select id="getReportByDate" resultType="java.util.Map">
-        SELECT b.project_name AS project, a.working_time AS time, a.content, a.state, a.time_type as timeType
+        SELECT b.project_name AS project, a.working_time AS time, a.content, a.state, a.time_type as timeType, a.cost
         FROM report AS a
         JOIN project AS b ON a.project_id=b.id
         WHERE 1=1
@@ -53,7 +55,7 @@
     </select>
     <!-- 批量获取员工某天的报告 -->
     <select id="getUserReportByDate" resultType="java.util.Map">
-        SELECT b.project_name AS project, a.working_time AS time, a.content, a.state, a.time_type as timeType, a.creator_id as creatorId
+        SELECT b.project_name AS project, a.working_time AS time, a.content, a.state, a.time_type as timeType, a.creator_id as creatorId, a.cost
         FROM report AS a
         JOIN project AS b ON a.project_id=b.id
         WHERE 1=1
@@ -69,7 +71,7 @@
 
     <!--根据日期获取报告上传人-->
     <select id="getReportNameByDate" resultType="java.util.Map">
-        SELECT DISTINCT b.id, b.name, a.state
+        SELECT DISTINCT b.id, b.name, a.state, a.cost
         FROM report AS a
         JOIN user AS b ON a.creator_id=b.id
         WHERE 1=1
@@ -109,4 +111,21 @@
         WHERE a.state = #{state} AND b.company_id=#{companyId}
         ORDER BY a.create_date DESC
     </select>
+    <select id="getRealProjectTime" resultType="java.util.Map">
+        SELECT project.project_name as project,creator_id AS creatorId,sum(working_time) as workingTime, SUM(cost) as cost
+         FROM report
+        left join project on project.id = report.project_id
+        WHERE creator_id IN
+        (select id from user where company_id = #{companyId})
+        and state = 1
+        <if test="startDate != null">
+            AND create_time &gt; #{startDate}
+        </if>
+        <if test="endDate != null">
+            AND create_time &lt; #{endDate}
+        </if>
+        GROUP BY project_id, creator_id;
+    </select>
+
+
 </mapper>

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

@@ -8,11 +8,12 @@
         <result column="allday" property="allday" />
         <result column="am" property="am" />
         <result column="pm" property="pm" />
+        <result column="month_days" property="monthDays" />
     </resultMap>
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        company_id, allday, am, pm
+        company_id, allday, am, pm, month_days
     </sql>
 
 </mapper>

+ 18 - 15
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/UserMapper.xml

@@ -4,28 +4,31 @@
 
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMap" type="com.management.platform.entity.User">
-        <id column="id" property="id"/>
-        <result column="name" property="name"/>
-        <result column="phone" property="phone"/>
-        <result column="password" property="password"/>
-        <result column="portrait_url" property="portraitUrl"/>
-        <result column="create_time" property="createTime"/>
-        <result column="role" property="role"/>
-        <result column="company_id" property="companyId"/>
-        <result column="department_id" property="departmentId"/>
-        <result column="department_cascade" property="departmentCascade"/>
-        <result column="cost" property="cost"/>
+        <id column="id" property="id" />
+        <result column="name" property="name" />
+        <result column="phone" property="phone" />
+        <result column="password" property="password" />
+        <result column="portrait_url" property="portraitUrl" />
+        <result column="create_time" property="createTime" />
+        <result column="role" property="role" />
+        <result column="company_id" property="companyId" />
+        <result column="department_id" property="departmentId" />
+        <result column="department_cascade" property="departmentCascade" />
+        <result column="cost" property="cost" />
+        <result column="month_cost" property="monthCost" />
     </resultMap>
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        id, name, phone, password, portrait_url, create_time, role, company_id, department_id, department_cascade, cost
+        id, name, phone, password, portrait_url, create_time, role, company_id, department_id, department_cascade, cost, month_cost
     </sql>
 
+
     <!--单独分页获取人员-->
     <select id="getUserByDepartment" resultType="java.util.Map">
         SELECT a.id, a.name, a.phone, a.portrait_url AS portraitUrl, a.role, a.company_id AS companyId, a.cost,
-        a.department_id AS departmentId, b.department_name AS departmentName, a.department_cascade AS departmentCascade
+        a.department_id AS departmentId, b.department_name AS departmentName, a.department_cascade AS departmentCascade,
+        a.month_cost as monthCost
         FROM user AS a
         LEFT JOIN department AS b ON a.department_id = b.department_id
         WHERE a.company_id = #{companyId}
@@ -47,7 +50,8 @@
     <!--范围分页获取人员-->
     <select id="getUserByDepartmentList" resultType="java.util.Map">
         SELECT a.id, a.name, a.phone, a.portrait_url AS portraitUrl, a.role, a.company_id AS companyId, a.cost,
-        a.department_id AS departmentId, b.department_name AS departmentName, a.department_cascade AS departmentCascade
+        a.department_id AS departmentId, b.department_name AS departmentName, a.department_cascade AS departmentCascade,
+        a.month_cost as monthCost
         FROM user AS a
         LEFT JOIN department AS b ON a.department_id = b.department_id
         WHERE a.company_id = #{companyId} AND a.department_id IN
@@ -65,5 +69,4 @@
             #{departmentId}
         </foreach>
     </select>
-
 </mapper>

BIN
fhKeeper/formulahousekeeper/management-platform/财务人员成本模板.xlsx


+ 13 - 0
fhKeeper/formulahousekeeper/timesheet/src/routes.js

@@ -29,6 +29,8 @@ import team from './views/team/index.vue'
 // 系统设置
 import timetype from './views/settings/timetype.vue';
 
+import finance from './views/project/finance';
+
 Vue.use(Router)
 
 export const fixedRouter = [
@@ -83,6 +85,17 @@ export const manageRouter = [
             { path: '/costDep/:id/:name', component: depDetail, name: '成本详情', hidden: true },
         ]
     },
+    //每月财务成本
+    {
+        path: '/',
+        component: Home,
+        name: '财务核算成本',
+        iconCls: 'fa fa-sticky-note',
+        leaf: true,
+        children: [
+            { path: '/finance', component: finance, name: '财务核算成本' },
+        ]
+    },
     //项目管理
     {
         path: '/',

+ 9 - 4
fhKeeper/formulahousekeeper/timesheet/src/views/settings/timetype.vue

@@ -2,21 +2,25 @@
     <section>
         <h4 style="width:450px;margin:0 auto;">工作时长设置</h4>
         <!--设置内容-->
-        <el-form style="width:500px;margin:0 auto;padding:10px;" ref="form1" :model="timeType" :rules="rules" label-width="100px">
+        <el-form style="width:550px;margin:0 auto;padding:10px;" ref="form1" :model="timeType" :rules="rules" label-width="120px">
+        <el-form-item label="平均每月工作" prop="allday">
+            <el-input v-model="timeType.monthDays"  type="number" style="width:150px;"></el-input>
+            天
+        </el-form-item>    
         <el-form-item label="全天时长" prop="allday">
-            <el-select v-model="timeType.allday" placeholder="请选择工作时长" style="width:120px;" @change="timeChange">
+            <el-select v-model="timeType.allday" placeholder="请选择工作时长" style="width:150px;" @change="timeChange">
                 <el-option v-for="item in times" :key="item" :label="item" :value="item"></el-option>
             </el-select>
             小时
         </el-form-item>
         <el-form-item label="上午时长" prop="am" >
-             <el-select v-model="timeType.am" placeholder="请选择工作时长" style="width:120px;" @change="timeChange">
+             <el-select v-model="timeType.am" placeholder="请选择工作时长" style="width:150px;" @change="timeChange">
                 <el-option v-for="item in halfTime" :key="item" :label="item" :value="item"></el-option>
             </el-select>
             小时
         </el-form-item>
         <el-form-item label="下午时长" prop="pm" >
-            <el-select v-model="timeType.pm" disabled placeholder="请选择工作时长" style="width:120px;" >
+            <el-select v-model="timeType.pm" disabled placeholder="请选择工作时长" style="width:150px;" >
                 <el-option v-for="item in halfTime" :key="item" :label="item" :value="item"></el-option>
             </el-select>
             小时
@@ -39,6 +43,7 @@
                 user: JSON.parse(sessionStorage.getItem("user")),
                 timeType:{},
                 rules: {
+                    monthDays: [{ required: true, message: "请输入平均每月工作天数", trigger: "blur" }],
                     allday: [{ required: true, message: "请选择全天工作时长", trigger: "blur" }],
                     am: [{ required: true, message: "请输入上午工作时长", trigger: "blur" }],
                     pm: [{ required: true, message: "请输入下午工作时长", trigger: "blur" }],

+ 52 - 5
fhKeeper/formulahousekeeper/timesheet/src/views/team/index.vue

@@ -110,8 +110,13 @@
                 <el-form-item label="电话" prop="phone">
                     <el-input v-model="insertForm.phone" placeholder="请输入电话号码" clearable></el-input>
                 </el-form-item>
-                <el-form-item label="成本" prop="cost">
-                    <el-input v-model.number="insertForm.cost" placeholder="请输入成本 单位:元/小时" clearable></el-input>
+                <el-form-item label="月薪" prop="monthCost">
+                    <el-input v-model.number="insertForm.monthCost" @input="oninput" placeholder="请输入月薪,单位:元" clearable></el-input>
+                    <span style="color:orange;font-size:12px;">按照每个月工作{{timeType.monthDays}}天,每天{{timeType.allday}}小时核算</span>
+                    <el-link :underline="false" style="color:blue;font-size:12px;margin-left:7px;" href="#/timetype">修改工作时长</el-link>
+                </el-form-item>
+                <el-form-item label="时薪" prop="cost">
+                    <el-input v-model.number="insertForm.cost" disabled placeholder="请输入成本 单位:元/小时" clearable></el-input>
                 </el-form-item>
                 <el-form-item label="部门" prop="departmentId">
                     <el-cascader v-model="insertForm.departmentId" placeholder="请选择部门" style="width: 100%"
@@ -132,8 +137,13 @@
 
         <el-dialog title="修改成本" :visible.sync="dialogVisible1" width="400px">
             <el-form ref="form1" :model="insertForm" :rules="rules" label-width="60px">
-                <el-form-item label="成本" prop="cost">
-                    <el-input v-model.number="insertForm.cost" placeholder="请输入成本 单位:元/小时" clearable></el-input>
+                <el-form-item label="月薪" prop="monthCost">
+                    <el-input v-model.number="insertForm.monthCost" @input="oninput" placeholder="请输入月薪,单位:元" clearable></el-input>
+                    <span style="color:orange;font-size:12px;">按照每个月工作{{timeType.monthDays}}天,每天{{timeType.allday}}小时核算</span>
+                    <el-link :underline="false" style="color:blue;font-size:12px;margin-left:7px;" href="#/timetype">修改工作时长</el-link>
+                </el-form-item>
+                <el-form-item label="时薪" prop="cost">
+                    <el-input v-model.number="insertForm.cost" disabled placeholder="请输入成本 单位:元/小时" clearable></el-input>
                 </el-form-item>
                 <el-form-item label="部门" prop="departmentId">
                     <el-cascader v-model="insertForm.departmentId" placeholder="请选择部门" style="width: 100%"
@@ -188,6 +198,7 @@
                     name: null,
                     phone: null,
                     role: null,
+                    monthCost:null,
                     cost: null,
                     departmentId: null,
                 },
@@ -195,6 +206,7 @@
                     name: [{ required: true, message: "请输入姓名", trigger: "blur" }],
                     phone: [{ required: true, message: "请输入电话", trigger: "blur" }],
                     role: [{ required: true, message: "请选择角色", trigger: "blur" }],
+                    monthCost: [{ required: true, message: "请输入月薪,单位:元", trigger: "blur" }],
                     cost: [{ required: true, message: "请输入成本", trigger: "blur" }]
                 },
 
@@ -210,10 +222,39 @@
                 depRules: {
                     name: [{ required: true, message: "请输入部门名称", trigger: "blur" }],
                 },
-
+                timeType:{},
             };
         },
         methods: {
+            //月薪输入变化
+            oninput(e) {
+                this.insertForm.cost = (this.insertForm.monthCost/this.timeType.monthDays/this.timeType.allday).toFixed(2);
+            },
+            // 获取本公司的工作时间设置
+            getCompanyTimeSetting() {
+                this.http.post('/time-type/getCompanyTimeSetting',{ 
+                        companyId: this.user.companyId 
+                    },
+                    res => {
+                        if (res.code == "ok") {
+                            this.timeType = res.data;
+                        } else {
+                            this.$message({
+                                message: res.msg,
+                                type: "error"
+                            });
+                        }
+                    },
+                    error => {
+                        this.listLoading = false;
+                        this.$message({
+                            message: error,
+                            type: "error"
+                        });
+                        }
+                    );
+            },
+
             // 批量导入人员
             importUser(item) {
                 //首先判断文件类型
@@ -318,6 +359,7 @@
                         name: list.name,
                         phone: list.phone,
                         role: list.role,
+                        monthCost:list.monthCost,
                         cost: list.cost,
                         departmentId: array.reverse(),
                     };
@@ -328,6 +370,7 @@
                         name: null,
                         phone: null,
                         role: null,
+                        monthCost:null,
                         cost: null,
                         departmentId: null,
                     };
@@ -344,6 +387,7 @@
                             name: this.insertForm.name,
                             phone: this.insertForm.phone,
                             role: this.insertForm.role,
+                            monthCost: this.insertForm.monthCost,
                             cost: this.insertForm.cost
                         };
                         if (this.insertForm.id != null) {
@@ -465,6 +509,7 @@
                     name: list1.name,
                     phone: list1.phone,
                     role: list1.role,
+                    monthCost:list1.monthCost,
                     cost: list1.cost,
                     departmentId: array1.reverse(),
                 };
@@ -480,6 +525,7 @@
                             name: this.insertForm.name,
                             phone: this.insertForm.phone,
                             role: this.insertForm.role,
+                            monthCost: this.insertForm.monthCost,
                             cost: this.insertForm.cost
                         };
                         if (this.insertForm.departmentId != null) {
@@ -688,6 +734,7 @@
         mounted() {
             this.getDepartment();
             this.getUser();
+            this.getCompanyTimeSetting();
         }
     };
 </script>

+ 7 - 5
fhKeeper/formulahousekeeper/timesheet/src/views/workReport/daily.vue

@@ -13,7 +13,7 @@
         <div>
             <el-card class="box-card daily" shadow="never" >
                 <div slot="header" class="clearfix">
-                    <el-date-picker v-model="date" :editable="false" format="yyyy-MM" value-format="yyyy-MM" @change="changeMonthOut" :clearable="false" type="month" placeholder="选择月份"></el-date-picker>
+                    <el-date-picker size="small" v-model="date" :editable="false" format="yyyy-MM" value-format="yyyy-MM" @change="changeMonthOut" :clearable="false" type="month" placeholder="选择月份"></el-date-picker>
                     <span >
                     <span>日期:</span>
                     <span v-for="(item,index) in allDate" :id="'day'+index" :class="index==choseDay?'chooseDate date_item':'date_item'" 
@@ -72,7 +72,9 @@
                                     <!-- <i v-if="parseFloat(item1.reportTime)>parseFloat(item1.calculateTime)+0.5" style="color:red;margin-right:8px;" class="fa fa-exclamation-triangle"></i> -->
                                     工作总时长:
                                     <!-- <span :style="parseFloat(item1.reportTime)>parseFloat(item1.calculateTime)+0.5?'color:red':''">{{item1.reportTime}}h</span> -->
-                                    <span style="color:red;">{{item1.reportTime}}h</span>
+                                    <span >{{item1.reportTime}}</span>h
+                                    <span style="margin-left:10px;">成本:</span>
+                                    <span >{{item1.cost}}</span>元
                                 </span>
                                 <!-- <el-link v-if="user.role != 0" type="primary" :underline="false" @click="junpToDeskTop(item1.id)">系统智能统计:{{item1.calculateTime}}h</el-link>
                                 <span v-else>系统智能统计:{{item1.calculateTime}}h</span> -->
@@ -735,11 +737,11 @@
             fillInReport(i) {
                 if(i == -1) {
                     this.isDisable = false;
-                    this.workForm.createDate = util.formatDate.format(new Date(new Date()), "yyyy-MM-dd");
-                } else {
-                    this.isDisable = true;
                     let day = this.choseDay > 9 ? "-" + (this.choseDay + 1) : "-0" + (this.choseDay + 1);
                     this.workForm.createDate = this.date + day;
+                } else {
+                    this.isDisable = true;
+                    
                 }
                 this.getReport(i);
                 this.dialogVisible = true;

+ 4 - 0
fhKeeper/formulahousekeeper/timesheet/src/views/workReport/list.vue

@@ -27,6 +27,7 @@
                             <el-card shadow="never">
                                 <p>项目:<b>{{item.project}}</b></p>
                                 <p>时长:{{item.time}}h</p>
+                                <p>成本:{{item.cost}}元</p>
                                 <p>事项:<span v-html="item.content"></span></p>
                             </el-card>
                         </el-timeline-item>
@@ -40,6 +41,9 @@
                     <span v-if="search.value == -1">{{search.date}}</span>
                     <span v-else>{{scope.row.date}}</span>
                 </template>
+            </el-table-column>
+            <el-table-column prop="reportTime" label="工作时长(h)" >
+
             </el-table-column>
             <el-table-column prop="state" label="状态" sortable>
                 <template slot-scope="scope">