Kaynağa Gözat

Merge remote-tracking branch 'origin/master'

lfx 1 ay önce
ebeveyn
işleme
826260bf31

+ 10 - 0
mjava-lanyun/src/main/java/com/malk/lanyun/controller/TimerController.java

@@ -231,6 +231,16 @@ public class TimerController {
         log.info("开始修改单个各项目点月度经营分析");
         timerService.updateAnalysis(data);
     }
+    /**
+     * 单个修改各项目点月度经营分析
+     * @param
+     * @return
+     */
+    @PostMapping("deleteAnalysis")
+    public void deleteAnalysis(@RequestBody Map<String,Object> data){
+        log.info("开始修改单个各项目点月度经营分析");
+        timerService.deleteAnalysis(data);
+    }
 
     @PostMapping("checkoutStatus")
     McR checkoutStatus(@RequestBody Map<String,Object> data){

+ 2 - 0
mjava-lanyun/src/main/java/com/malk/lanyun/service/TimerService.java

@@ -145,4 +145,6 @@ public interface TimerService {
     void satisfactionSurvey(String formInstanceId);
 
     void exportBusinessAnalysisTest(Map data, HttpServletResponse response, HttpServletRequest request);
+
+    void deleteAnalysis(Map<String, Object> data);
 }

+ 21 - 1
mjava-lanyun/src/main/java/com/malk/lanyun/service/impl/TimerServiceImpl.java

@@ -645,7 +645,8 @@ public class TimerServiceImpl implements TimerService {
                         "`status`, `predict_income`, `open`, `income`, `person`, `person_cost`, `material`, `other_cost`, " +
                         "`cost_sum`, `taxes`, `gross_profit`, `gross_margin`, `overhead`, `corporate_income_tax`, `net_profit`, " +
                         "`net_margin`, `format`, `customer_system`, `profit_loss`, `approach_date`, `level`, `notes`," +
-                        "`actual_work_hours`, `out_work_hours`, `out_person_cost`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);";
+                        "`actual_work_hours`, `out_work_hours`, `out_person_cost`, `formInstanceId`) " +
+                        "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);";
 
                 ps = connection.prepareStatement(sql);
                 DecimalFormat df = new DecimalFormat("#.0000");
@@ -697,6 +698,7 @@ public class TimerServiceImpl implements TimerService {
                     ps.setObject(26,dataList.get(i).get("numberField_midxu53t"));
                     ps.setObject(27,dataList.get(i).get("numberField_midxu53v"));
                     ps.setObject(28,dataList.get(i).get("numberField_midxu53w"));
+                    ps.setObject(29,dataList.get(i).get("formInstanceId"));
                     ps.addBatch();
                     if (i%500==0){
                         ps.executeBatch();
@@ -2305,6 +2307,24 @@ public class TimerServiceImpl implements TimerService {
         UtilExcel.exportMapAndListByTemplate(response, null, analysisList, ProjectAnalysis.class, fileName, "NC.xlsx");
     }
 
+    @Override
+    public void deleteAnalysis(Map<String, Object> data) {
+        try {
+            Class.forName(driver);
+            Connection connection = DriverManager.getConnection(url, username, password);
+            String updateSql = "DELETE \n" +
+                    "FROM\n" +
+                    "\tlanyun_project_analysis \n" +
+                    "WHERE\n" +
+                    "\t1 = 1 \n" +
+                    "\tAND formInstanceId = '"+ UtilMap.getString(data,"formInstanceId")+"' ";
+            PreparedStatement ps = connection.prepareStatement(updateSql);
+            ps.executeUpdate();
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
     //    获取本年所有月时间戳
     public List<Long> getAllTimestamp(){
         LocalDate now = LocalDate.now();