Prechádzať zdrojové kódy

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

Lijy 2 rokov pred
rodič
commit
95f79e8716

+ 21 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/UserFvTimeController.java

@@ -0,0 +1,21 @@
+package com.management.platform.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author Seyason
+ * @since 2022-09-13
+ */
+@RestController
+@RequestMapping("/user-fv-time")
+public class UserFvTimeController {
+
+}
+

+ 55 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/UserFvTime.java

@@ -0,0 +1,55 @@
+package com.management.platform.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import java.time.LocalDate;
+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 2022-09-13
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class UserFvTime extends Model<UserFvTime> {
+
+    private static final long serialVersionUID=1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    @TableField("work_date")
+    private LocalDate workDate;
+
+    @TableField("user_id")
+    private String userId;
+
+    @TableField("company_id")
+    private Integer companyId;
+
+    @TableField("start_time")
+    private String startTime;
+
+    @TableField("end_time")
+    private String endTime;
+
+    @TableField("work_hours")
+    private Float workHours;
+
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+}

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

@@ -0,0 +1,16 @@
+package com.management.platform.mapper;
+
+import com.management.platform.entity.UserFvTime;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author Seyason
+ * @since 2022-09-13
+ */
+public interface UserFvTimeMapper extends BaseMapper<UserFvTime> {
+
+}

+ 16 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/UserFvTimeService.java

@@ -0,0 +1,16 @@
+package com.management.platform.service;
+
+import com.management.platform.entity.UserFvTime;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author Seyason
+ * @since 2022-09-13
+ */
+public interface UserFvTimeService extends IService<UserFvTime> {
+
+}

+ 11 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java

@@ -3249,6 +3249,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                 titles.add("填写时间");
                 titles.add("审核人");
                 titles.add("审核时间");
+                titles.add("审核流程");
             }
             titles.add("工作事项");
             if(stateKey==1){
@@ -3465,6 +3466,16 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                     } else {
                         row.createCell(index).setCellValue(sdf.format((Date)map.get("projectAuditTime")));
                     }
+                    index++;
+                    //审核流程显示
+                    List<ReportLog> auditLogs = reportLogMapper.selectList(new QueryWrapper<ReportLog>().eq("report_ids", (int)map.get("id")));
+
+                    if (auditLogs.size() == 0) {
+                        row.createCell(index).setCellValue("");
+                    } else {
+                        String auditFlow = auditLogs.stream().map(ReportLog::getMsg).collect(Collectors.joining("->"));
+                        row.createCell(index).setCellValue(auditFlow);
+                    }
 
                     index++;
                 }

+ 20 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/UserFvTimeServiceImpl.java

@@ -0,0 +1,20 @@
+package com.management.platform.service.impl;
+
+import com.management.platform.entity.UserFvTime;
+import com.management.platform.mapper.UserFvTimeMapper;
+import com.management.platform.service.UserFvTimeService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author Seyason
+ * @since 2022-09-13
+ */
+@Service
+public class UserFvTimeServiceImpl extends ServiceImpl<UserFvTimeMapper, UserFvTime> implements UserFvTimeService {
+
+}

+ 197 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/util/DockWithMLD.java

@@ -0,0 +1,197 @@
+package com.management.platform.util;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.MapperFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+import com.management.platform.mapper.CompanyReportMapper;
+import org.apache.http.HttpEntity;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.message.BasicNameValuePair;
+import org.apache.http.util.EntityUtils;
+import org.apache.poi.ss.formula.functions.T;
+
+import javax.annotation.Resource;
+import java.io.InputStream;
+import java.math.BigInteger;
+import java.security.Key;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.sql.Timestamp;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.*;
+
+public class DockWithMLD {
+    static String port="10.1.10.41:20170";
+
+    public static void main(String[] args) {
+        DockWithMLD dockWithMLD=new DockWithMLD();
+        JSONObject jsonObject=new JSONObject();
+        LocalDateTime startDate=LocalDateTime.parse("2022-08-01 00:00:00",DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
+        LocalDateTime endDate=LocalDateTime.parse("2022-08-31 00:00:00",DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
+        jsonObject.put("startDate",startDate);
+        jsonObject.put("endDate",endDate);
+        String jsonString = jsonObject.toJSONString();
+        dockWithMLD.getResult("http://"+port+"/api/cube/restful/interface/getModeDataPageList/getTravelRecord",jsonString);
+    }
+
+    public static HttpRespMsg  getResult(String url,String screenString){
+        HttpRespMsg httpRespMsg=new HttpRespMsg();
+        ObjectMapper objectMapper = new ObjectMapper();
+        objectMapper.configure(MapperFeature.AUTO_DETECT_CREATORS, true);
+        objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+        objectMapper.registerModule(new JavaTimeModule());
+        objectMapper.configure(com.fasterxml.jackson.databind.SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
+        Map<String,Object> map = null;
+        CloseableHttpResponse response;// 响应类
+        CloseableHttpClient httpClient = HttpClients.createDefault();
+        //restful 接口 url
+        HttpPost httpPost = new HttpPost(url);//ex:"http://ip:port/api/cube/restful/interface/getModeDataPageList/rpakeywordList"
+        //当前日期
+        String currentDate = getCurrentDate();
+        //当前时间
+        String currentTime = getCurrentTime();
+        //获取时间戳
+        String currentTimeTamp = getTimestamp();
+        Map params = new HashMap<>();
+        Map paramDatajson = new HashMap<>();
+        //header
+        Map header = new HashMap<>();
+        //系统标识
+        String systemid = "worktime";
+        //密码
+        String d_password = "BF4CDEF5ED4941CE93F19D234D366241";
+        //封装 header 里的参数
+        header.put("systemid",systemid);
+        header.put("currentDateTime",currentTimeTamp);
+        String md5Source = systemid+d_password+currentTimeTamp;
+        String md5OfStr = getMD5Str(md5Source).toLowerCase();
+        //Md5 是:系统标识+密码+时间戳 并且 md5 加密的结果
+        header.put("Md5",md5OfStr);
+        paramDatajson.put("header",header);
+        //分页参数 处理全部数据 不需要进行分页
+        /*JSONObject pageInfo = new JSONObject();
+        pageInfo.put("pageNo", -1);
+        pageInfo.put("pageSize", -1);
+        paramDatajson.put("pageInfo",pageInfo);*/
+        //封装 mainTable 参数
+        JSONObject mainTable  = JSON.parseObject(screenString);
+        paramDatajson.put("mainTable",mainTable);
+        //封装 operationinfo 参数
+        JSONObject operationinfo = new JSONObject();
+        operationinfo.put("operator", "MD10520");
+        paramDatajson.put("operationinfo",operationinfo);
+        System.out.println("===请求参数 datajson==="+paramDatajson);
+        params.put("datajson",paramDatajson);
+        //装填参数
+        List nvps = new ArrayList();
+        if(params!=null){
+            params.forEach((key, value) -> nvps.add(new BasicNameValuePair((String) key, JSONObject.toJSONString(value))));
+        }
+        try{
+            httpPost.addHeader("Content-Type","application/x-www-form-urlencoded;charset=utf-8");
+            httpPost.setEntity(new UrlEncodedFormEntity(nvps, "UTF-8"));
+            response = httpClient.execute(httpPost);
+            if (response != null && response.getEntity() != null) {
+                //返回信息
+                String resulString = EntityUtils.toString(response.getEntity(),"UTF-8");
+                //todo 反序列化 报文数值到Map
+                map= objectMapper.readValue(resulString,Map.class);
+                List<Map> list = JSON.parseArray(String.valueOf(map.get("result")), Map.class);
+                List<Map> resultList=new ArrayList<>();
+                for (Map item : list) {
+                    Map resultMap = (Map) item.get("mainTable");
+                    resultList.add(resultMap);
+                }
+                httpRespMsg.data=resultList;
+                //todo 这里处理返回信息
+                System.out.println("成功"+ resulString);
+            }else{
+                System.out.println("获取数据失败,请查看日志"+currentDate+" "+currentTime);
+            }
+        }catch (Exception e){
+            e.printStackTrace();
+            System.out.println("请求失败"+currentDate+" "+currentTime+"====error msg:"+e.getMessage());
+        }
+        return httpRespMsg;
+    }
+
+    public static String getMD5Str(String plainText) {
+        //定义一个字节数组
+        byte[] secretBytes = null;
+        try {
+        // 生成一个 MD5 加密计算摘要
+            MessageDigest md = MessageDigest.getInstance("MD5");
+        //对字符串进行加密
+            md.update(plainText.getBytes());
+        //获得加密后的数据
+            secretBytes = md.digest();
+        } catch (NoSuchAlgorithmException e) {
+            throw new RuntimeException("没有 md5 这个算法!");
+        }
+        //将加密后的数据转换为 16 进制数字
+        String md5code = new BigInteger(1, secretBytes).toString(16);
+        // 如果生成数字未满 32 位,需要前面补 0
+        // 不能把变量放到循环条件,值改变之后会导致条件变化。如果生成 30 位 只能生成 31位 md5
+        int tempIndex = 32 - md5code.length();
+        for (int i = 0; i < tempIndex; i++) {
+            md5code = "0" + md5code;
+
+        }
+        return md5code;
+    }
+
+    public static String getCurrentTime() {
+        Date newdate = new Date();
+        long datetime = newdate.getTime();
+        Timestamp timestamp = new Timestamp(datetime);
+        String currenttime = (timestamp.toString()).substring(11, 13) + ":" +
+                (timestamp.toString()).substring(14, 16) + ":"
+                + (timestamp.toString()).substring(17, 19);
+        return currenttime;
+    }
+    public static String getCurrentDate() {
+        Date newdate = new Date();
+        long datetime = newdate.getTime();
+        Timestamp timestamp = new Timestamp(datetime);
+        String currentdate = (timestamp.toString()).substring(0, 4) + "-" +
+                (timestamp.toString()).substring(5, 7) + "-"
+                + (timestamp.toString()).substring(8, 10);
+        return currentdate;
+    }
+    /**
+     * 获取当前日期时间。 YYYY-MM-DD HH:MM:SS
+     * @return 当前日期时间
+     */
+    public static String getCurDateTime() {
+        Date newdate = new Date();
+        long datetime = newdate.getTime();
+        Timestamp timestamp = new Timestamp(datetime);
+        return (timestamp.toString()).substring(0, 19);
+    }
+    /**
+     * 获取时间戳 格式如:1999010123595
+     * @return
+     */
+    public static String getTimestamp(){
+        return getCurDateTime().replace("-", "").replace(":", "").replace(" ",
+                "");
+    }
+    public static int getIntValue(String v, int def) {
+        try {
+            return Integer.parseInt(v);
+        } catch (Exception ex) {
+            return def;
+        }
+    }
+    public static String null2String(Object s) {
+        return s == null ? "" : s.toString();
+    }
+}

+ 21 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/UserFvTimeMapper.xml

@@ -0,0 +1,21 @@
+<?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.UserFvTimeMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.management.platform.entity.UserFvTime">
+        <id column="id" property="id" />
+        <result column="work_date" property="workDate" />
+        <result column="user_id" property="userId" />
+        <result column="company_id" property="companyId" />
+        <result column="start_time" property="startTime" />
+        <result column="end_time" property="endTime" />
+        <result column="work_hours" property="workHours" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id, work_date, user_id, company_id, start_time, end_time, work_hours
+    </sql>
+
+</mapper>