Forráskód Böngészése

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

QuYueTing 1 hónapja
szülő
commit
b4f4f0a1b8

+ 6 - 0
fhKeeper/formulahousekeeper/collectdata/pom.xml

@@ -20,6 +20,12 @@
         <java.version>1.8</java.version>
     </properties>
     <dependencies>
+
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+            <version>1.2.7</version>
+        </dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-web</artifactId>

+ 36 - 0
fhKeeper/formulahousekeeper/collectdata/src/main/java/com/management/collectdata/controller/DataCollectController.java

@@ -5,6 +5,7 @@ import com.management.collectdata.entity.bo.PageBO;
 import com.zaxxer.hikari.HikariConfig;
 import com.zaxxer.hikari.HikariDataSource;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
@@ -66,6 +67,41 @@ public class DataCollectController {
 //    @Autowired
 //    private ErpOrderInfoMapper erpOrderInfoMapper;
 
+    @RequestMapping("/insertCisData")
+    public String insertCisData(@RequestBody List<TisTimeVO> tisList) {
+//        List<TisTimeVO> tisTimeVOS = JSONArray.parseArray(jsonarray, TisTimeVO.class);
+        if(!CollectionUtils.isEmpty(tisList)){
+            for (TisTimeVO tisTimeVO : tisList) {
+                String sqlQuery = "select top 1 iRealCOID from ca_batchmap where cMOCode = ? and iMOSubSN = ? ";
+                try (Connection connection = sqlServerDataSource.getConnection()) {
+                    PreparedStatement queryStmt = connection.prepareStatement(sqlQuery);
+                    queryStmt.setString(1,tisTimeVO.getOrderId());
+                    queryStmt.setInt(2,tisTimeVO.getLine());
+                    ResultSet queryRs = queryStmt.executeQuery();
+                    if (queryRs.next()) {
+                        tisTimeVO.setCoId(queryRs.getString("iRealCOID"));
+                    }
+                    String sqlInsert = "insert into CA_DayTiS(cPPID,iRealWkt,dDate) values(?,?,?)";
+                    PreparedStatement insertStmt = connection.prepareStatement(sqlInsert);
+                    insertStmt.setString(1,tisTimeVO.getCoId());
+                    insertStmt.setBigDecimal(2,tisTimeVO.getWorkTime());
+                    insertStmt.setString(3,tisTimeVO.getDateStr());
+                    int i = insertStmt.executeUpdate();
+                    if(i>0){
+//                        System.out.println("执行成功");
+                    }else{
+                        System.out.println(tisTimeVO.getCoId()+"执行失败");
+                    }
+                } catch (SQLException e) {
+                    System.err.println("数据库操作错误: " + e.getMessage());
+                }
+            }
+
+        }
+        return "ok";
+    }
+
+
     @RequestMapping("/getSqlServerProjectTypeDataSum")
     public String getSqlServerProjectTypeDataSum() {
         String sqlCount = "select count(distinct citemccode) from fitemss97  where bclose = 0";

+ 14 - 0
fhKeeper/formulahousekeeper/collectdata/src/main/java/com/management/collectdata/entity/TisTimeVO.java

@@ -0,0 +1,14 @@
+package com.management.collectdata.entity;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class TisTimeVO {
+    private String coId;
+    private String orderId;
+    private Integer line;
+    private BigDecimal workTime;
+    private String dateStr;
+}

+ 7 - 5
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/BustripProject.java

@@ -1,18 +1,18 @@
 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 com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 import org.springframework.format.annotation.DateTimeFormat;
 
+import java.io.Serializable;
+import java.time.LocalDate;
+
 /**
  * <p>
  * 
@@ -73,6 +73,8 @@ public class BustripProject extends Model<BustripProject> {
     @TableField(exist = false)
     private String projectName;
 
+    @TableField(exist = false)
+    private String projectCode;
 
     @Override
     protected Serializable pkVal() {

+ 2 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/vo/TisTimeVO.java

@@ -6,7 +6,9 @@ import java.math.BigDecimal;
 
 @Data
 public class TisTimeVO {
+    private String coId;
     private String orderId;
     private Integer line;
     private BigDecimal workTime;
+    private String dateStr;
 }

+ 67 - 40
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/task/DataCollectTask.java

@@ -4,8 +4,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.management.platform.entity.*;
 import com.management.platform.entity.vo.TisTimeVO;
 import com.management.platform.mapper.*;
-import com.zaxxer.hikari.HikariConfig;
-import com.zaxxer.hikari.HikariDataSource;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.core.ParameterizedTypeReference;
 import org.springframework.http.*;
@@ -17,10 +15,6 @@ import org.springframework.util.CollectionUtils;
 import org.springframework.web.client.RestTemplate;
 
 import javax.annotation.Resource;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -61,50 +55,83 @@ public class DataCollectTask {
     private FmwDetailMapper fmwDetailMapper;
 
 
-    private static HikariDataSource sqlServerDataSource;
-
-    static {
-        HikariConfig sqlServerConfig = new HikariConfig();
-        sqlServerConfig.setJdbcUrl("jdbc:sqlserver://172.168.10.84:1433;databaseName=UFDATA_001_2023;encrypt=true;trustServerCertificate=true");
-        sqlServerConfig.setUsername("zhangyuhua");
-        sqlServerConfig.setPassword("ZC12zyh18");
-        sqlServerConfig.setMaximumPoolSize(5);
-        sqlServerDataSource = new HikariDataSource(sqlServerConfig);
-    }
+//    private static HikariDataSource sqlServerDataSource;
+//
+//    static {
+//        HikariConfig sqlServerConfig = new HikariConfig();
+//        sqlServerConfig.setJdbcUrl("jdbc:sqlserver://172.168.10.84:1433;databaseName=UFDATA_001_2023;encrypt=true;trustServerCertificate=true");
+//        sqlServerConfig.setUsername("zhangyuhua");
+//        sqlServerConfig.setPassword("ZC12zyh18");
+//        sqlServerConfig.setMaximumPoolSize(5);
+//        sqlServerDataSource = new HikariDataSource(sqlServerConfig);
+//    }
 
 
     public void caDayTisTask(){
+        RestTemplate restTemplate = new RestTemplate();
+        String insertUrl = PREFIX_URL+"/dataCollect/insertCisData";
         SimpleDateFormat sdfYmd = new SimpleDateFormat("yyyy-MM-dd");
         Date date = new Date();
         String dateStr = sdfYmd.format(date);
-        //TODO fmwDetail修改,不从report里取
 //        List<TisTimeVO> timeVOList = fmwDetailMapper.getTisTimeByDate(specialCompanyId,dateStr);
         List<TisTimeVO> timeVOList =  reportMapper.getTisTimeByDate(specialCompanyId,dateStr);
-        for (TisTimeVO tisTimeVO : timeVOList) {
-            String sqlQuery = "select top 1 iRealCOID from ca_batchmap where cMOCode = ? and iMOSubSN = ? ";
-            try (Connection connection = sqlServerDataSource.getConnection()) {
-                PreparedStatement queryStmt = connection.prepareStatement(sqlQuery);
-                queryStmt.setString(1,tisTimeVO.getOrderId());
-                queryStmt.setInt(2,tisTimeVO.getLine());
-                ResultSet queryRs = queryStmt.executeQuery();
-                if (queryRs.next()) {
-                    String iRealCOID = queryRs.getString("iRealCOID");
-                    String sqlInsert = "insert into CA_DayTiS(cPPID,iRealWkt,dDate) values(?,?,?)";
-                    PreparedStatement insertStmt = connection.prepareStatement(sqlInsert);
-                    insertStmt.setString(1,iRealCOID);
-                    insertStmt.setBigDecimal(2,tisTimeVO.getWorkTime());
-                    insertStmt.setString(3,dateStr);
-                    int i = insertStmt.executeUpdate();
-                    if(i>0){
-                        System.out.println("执行成功");
-                    }else{
-                        System.out.println(iRealCOID+"执行失败");
-                    }
-                }
-            } catch (SQLException e) {
-                System.err.println("数据库操作错误: " + e.getMessage());
+
+//        for (TisTimeVO tisTimeVO : timeVOList) {
+//            String sqlQuery = "select top 1 iRealCOID from ca_batchmap where cMOCode = ? and iMOSubSN = ? ";
+//            try (Connection connection = sqlServerDataSource.getConnection()) {
+//                PreparedStatement queryStmt = connection.prepareStatement(sqlQuery);
+//                queryStmt.setString(1,tisTimeVO.getOrderId());
+//                queryStmt.setInt(2,tisTimeVO.getLine());
+//                ResultSet queryRs = queryStmt.executeQuery();
+//                if (queryRs.next()) {
+//                    tisTimeVO.setCoId(queryRs.getString("iRealCOID"));
+//
+//                }
+//            } catch (SQLException e) {
+//                System.err.println("数据库操作错误: " + e.getMessage());
+//            }
+//        }
+        if(!CollectionUtils.isEmpty(timeVOList)){
+            timeVOList.forEach(t->t.setDateStr(dateStr));
+            HttpHeaders headers = new HttpHeaders();
+            headers.setContentType(MediaType.APPLICATION_JSON);
+            Map<String, Object> requestBody = new HashMap<>();
+            requestBody.put("tisList", timeVOList);
+            HttpEntity<Object> requestEntity = new HttpEntity<>(requestBody, headers);
+
+            ResponseEntity<String> tisResponse = restTemplate.exchange(insertUrl, HttpMethod.POST, requestEntity, String.class);
+            if (tisResponse.getStatusCode() == HttpStatus.OK) {
+                System.out.println("插入成功");
+            }else{
+                System.out.println(dateStr + "插入失败");
             }
         }
+
+//        for (TisTimeVO tisTimeVO : timeVOList) {
+//            String sqlQuery = "select top 1 iRealCOID from ca_batchmap where cMOCode = ? and iMOSubSN = ? ";
+//            try (Connection connection = sqlServerDataSource.getConnection()) {
+//                PreparedStatement queryStmt = connection.prepareStatement(sqlQuery);
+//                queryStmt.setString(1,tisTimeVO.getOrderId());
+//                queryStmt.setInt(2,tisTimeVO.getLine());
+//                ResultSet queryRs = queryStmt.executeQuery();
+//                if (queryRs.next()) {
+//                    String iRealCOID = queryRs.getString("iRealCOID");
+//                    String sqlInsert = "insert into CA_DayTiS(cPPID,iRealWkt,dDate) values(?,?,?)";
+//                    PreparedStatement insertStmt = connection.prepareStatement(sqlInsert);
+//                    insertStmt.setString(1,iRealCOID);
+//                    insertStmt.setBigDecimal(2,tisTimeVO.getWorkTime());
+//                    insertStmt.setString(3,dateStr);
+//                    int i = insertStmt.executeUpdate();
+//                    if(i>0){
+//                        System.out.println("执行成功");
+//                    }else{
+//                        System.out.println(iRealCOID+"执行失败");
+//                    }
+//                }
+//            } catch (SQLException e) {
+//                System.err.println("数据库操作错误: " + e.getMessage());
+//            }
+//        }
     }
 
 

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

@@ -18,9 +18,10 @@
         id, bustrip_id, project_id, start_date, end_date, degree_id, degree_name
     </sql>
     <select id="getByDate" resultType="com.management.platform.entity.BustripProject">
-        select bp.*
+        select bp.*,p.project_name,p.project_code
         from bustrip_project bp
         left join business_trip bt on bp.bustrip_id = bt.id
+        left join project p on bp.project_id = p.id
         where bt.owner_id = #{userId}
         and bp.start_date &lt;= str_to_date(#{date},'%Y-%m-%d')
         and bp.end_date &gt;= str_to_date(#{date},'%Y-%m-%d')

+ 30 - 1
fhKeeper/formulahousekeeper/timesheet/src/views/workReport/daily.vue

@@ -6545,6 +6545,32 @@
                                 time: this.report.time,
                                 showRefresh: list.showRefresh
                             }
+                            // businessTrips 有数据的情况下
+                            const businessTrips = res.data.businessTrips || []
+                            if(businessTrips.length > 0) {
+                                this.workForm.domains = businessTrips.map((item, index) => {
+                                    return {
+                                        id: null,
+                                        projectId: item.projectId,
+                                        workingTime: this.reportTimeType.type==2?"":(this.reportTimeType.allday).toFixed(1),
+                                        content: "",
+                                        progress:100,
+                                        state: 2,
+                                        timeType:0,
+                                        multiWorktime: this.reportTimeType.multiWorktime,
+                                        worktimeList:[{}],
+                                        canEdit: true,
+                                        auditorFirst: '',
+                                        auditorSec: '',
+                                        auditorThird: '',
+                                        ccUserid: ''
+                                    }
+                                })
+
+                                for(let domainsIndex in this.workForm.domains) {
+                                    this.selectProject(this.workForm.domains[domainsIndex], domainsIndex)
+                                }
+                            }
                             if(this.isWeekend && this.user.timeType.lockWorktime != 1){
                                 this.$set(this.workForm.domains[0],'isOvertime',true)
                                 if(this.reportTimeType.type != 2){
@@ -6858,7 +6884,9 @@
                     }
 
                     if(this.user.timeType.reportExtraField4Name || this.user.timeType.reportExtraField5Name) {
-                        this.weekGetInfoByProjectId(sss)
+                        setTimeout(() => {
+                            this.weekGetInfoByProjectId(sss)
+                        }, 1000)
                     }
                 }
             },
@@ -6874,6 +6902,7 @@
                     if (res.code == "ok") {
                         this.zhoBao.reportExtraField4List = res.data.orderIds || []
                         this.zhoBao.reportExtraField5List = res.data.lines || []
+                        console.log(this.zhoBao, '<===== this.zhoBao')
                         this.$forceUpdate();
                     } 
                 },

+ 36 - 0
fhKeeper/formulahousekeeper/timesheet_h5/src/views/edit/index.vue

@@ -1956,6 +1956,42 @@ export default {
                                 auditorThird: { name: '', id: '' },
                                 ccUserid: { name: '', id: '' }
                             }]
+                             // businessTrips 有数据的情况下
+                             const businessTrips = res.data.businessTrips || []
+                            if(businessTrips.length > 0) {
+                                this.form.domains = businessTrips.map((item, index) => {
+                                    const projectItens = this.projectss.find(pro => pro.id == item.projectId) || {}
+                                    return {
+                                        id: null,
+                                        projectId: projectItens.id,
+                                        projectName: projectItens.projectName,
+                                        // workingTime: t.type==3?(t.allday).toFixed(1):"8.0",
+                                        workingTime: t.type == 3 ? (t.allday).toFixed(1) : shuzhi.indexOf('.') == '-1' ? shuzhi + '.0' : shuzhi,
+                                        content: "",
+                                        state: 2,
+                                        progress: 100,
+                                        isOvertime: false,
+                                        professionProgress: [],
+                                        multiWorktime: t.multiWorktime,
+                                        worktimeList: [{}],
+                                        canEdit: true,
+
+                                        auditorFirst: { name: '', id: '' },
+                                        auditorSec: { name: '', id: '' },
+                                        auditorThird: { name: '', id: '' },
+                                        ccUserid: { name: '', id: '' }
+                                    }
+                                })
+                                const { reportExtraField4Name, reportExtraField5Name } = this.user.timeType
+                                for(let domainsIndex in this.form.domains) {
+                                    const projectItens = this.projectss.find(pro => pro.id == this.form.domains[domainsIndex].projectId) || {}
+                                    this.fZr(projectItens, domainsIndex, true)
+                                    if(reportExtraField4Name || reportExtraField5Name) {
+                                        this.getInfoByProjectId(projectItens.projectCode, domainsIndex, false)
+                                    }
+                                }
+                            }
+                            console.log(this.form.domains, '<===== this.form.domains')
                             if (this.isWeekend && this.user.timeType.lockWorktime != 1) {
                                 this.$set(this.form.domains[0], 'isOvertime', true)
                                 if (t.type != 2 && t.type != 0) {