|
@@ -304,6 +304,19 @@ public class TimerServiceImpl implements TimerService {
|
|
|
dataList.get(i).put("row",i+1);
|
|
|
String person = dataList.get(i).get("textField_lu2gzzab").toString();
|
|
|
String phone = dataList.get(i).get("textField_lu2gzzac").toString();
|
|
|
+ final String[] address = {""};
|
|
|
+ if (ObjectUtil.isNotNull(dataList.get(i).get("addressField_m1mxnnno"))){
|
|
|
+ Object parse = JSON.parse(dataList.get(i).get("addressField_m1mxnnno").toString());
|
|
|
+ JSONObject jsonObject = (JSONObject) parse;
|
|
|
+ JSONArray jsonArray = JSON.parseArray(jsonObject.get("regionText").toString());
|
|
|
+ jsonArray.forEach(e->{
|
|
|
+ JSONObject object = (JSONObject) e;
|
|
|
+ String zhCn = object.get("zh_CN").toString();
|
|
|
+ address[0] = address[0] + zhCn + "/";
|
|
|
+ });
|
|
|
+ String substring = address[0].substring(0, address[0].length() - 1);
|
|
|
+ dataList.get(i).put("addressField_m1mxnnno",substring);
|
|
|
+ }
|
|
|
String information = person + " " + phone;
|
|
|
dataList.get(i).put("information",information);
|
|
|
}
|
|
@@ -572,84 +585,95 @@ public class TimerServiceImpl implements TimerService {
|
|
|
.searchFieldJson(JSON.toJSONString(UtilMap.map("radioField_m0dkcxod", "否")))
|
|
|
.build());
|
|
|
|
|
|
- Connection connection = null;
|
|
|
- PreparedStatement ps = null;
|
|
|
- try {
|
|
|
- Class.forName(driver);
|
|
|
- connection = DriverManager.getConnection(url, username, password);
|
|
|
- String sql = "INSERT INTO `lanyun_project_analysis`(`project_name`, `belong_project`, `month`, " +
|
|
|
- "`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`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);";
|
|
|
-
|
|
|
- ps = connection.prepareStatement(sql);
|
|
|
- DecimalFormat df = new DecimalFormat("#.0000");
|
|
|
- for (int i = 0; i < dataList.size(); i++) {
|
|
|
- ps.setObject(1,dataList.get(i).get("textField_dliiyul"));
|
|
|
- ps.setObject(2,dataList.get(i).get("textField_bheotm5"));
|
|
|
- ps.setObject(3,dataList.get(i).get("dateField_lcwv382"));
|
|
|
- ps.setObject(4,dataList.get(i).get("textField_pa6o780"));
|
|
|
- ps.setObject(5,dataList.get(i).get("numberField_5wyyb42"));
|
|
|
- ps.setObject(6,dataList.get(i).get("numberField_c4acnrg"));
|
|
|
- ps.setObject(7,dataList.get(i).get("numberField_zjdki9k"));
|
|
|
- ps.setObject(8,dataList.get(i).get("numberField_hg6jznm"));
|
|
|
- ps.setObject(9,dataList.get(i).get("numberField_7ga9c5w"));
|
|
|
- ps.setObject(10,dataList.get(i).get("numberField_c3cqsfv"));
|
|
|
- ps.setObject(11,dataList.get(i).get("numberField_avaexyf"));
|
|
|
- ps.setObject(12,dataList.get(i).get("numberField_gub2ul5"));
|
|
|
- ps.setObject(13,dataList.get(i).get("numberField_hqiac12"));
|
|
|
- ps.setObject(14,dataList.get(i).get("numberField_lz6mt3xq"));
|
|
|
- double grossProfit = Double.parseDouble(dataList.get(i).get("numberField_lz6mt3xq").toString());
|
|
|
- double income = Double.parseDouble(dataList.get(i).get("numberField_zjdki9k").toString());
|
|
|
- grossProfit = grossProfit/income;
|
|
|
- if (income == 0f){
|
|
|
- grossProfit = 0f;
|
|
|
- }
|
|
|
- ps.setObject(15,df.format(grossProfit));
|
|
|
- ps.setObject(16,dataList.get(i).get("numberField_ln701sy"));
|
|
|
- ps.setObject(17,dataList.get(i).get("numberField_fmhzxdr"));
|
|
|
- ps.setObject(18,dataList.get(i).get("numberField_lz6mt3xr"));
|
|
|
- double net = Double.parseDouble(dataList.get(i).get("numberField_lz6mt3xr").toString());
|
|
|
- double net_margin = net/income;
|
|
|
- if (income == 0f){
|
|
|
- net_margin = 0f;
|
|
|
- }
|
|
|
- ps.setObject(19,df.format(net_margin));
|
|
|
- ps.setObject(20,dataList.get(i).get("textField_tpb3m2f"));
|
|
|
- ps.setObject(21,dataList.get(i).get("textField_2adicsn"));
|
|
|
- String profit_loss = "";
|
|
|
- if (net_margin < 0){
|
|
|
- profit_loss = "亏损";
|
|
|
- }else if (net_margin >=0 && net_margin <=0.05){
|
|
|
- profit_loss = "净利较低";
|
|
|
- }else if(net_margin > 0.05){
|
|
|
- profit_loss = "盈利";
|
|
|
- }
|
|
|
- ps.setObject(22,dataList.get(i).get("textField_1yw4mx4") == null ? null : profit_loss);
|
|
|
- ps.setObject(23,dataList.get(i).get("dateField_ji5yfvf"));
|
|
|
- ps.setObject(24,dataList.get(i).get("textField_h2qx5nz"));
|
|
|
- ps.setObject(25,dataList.get(i).get("textField_35paoph"));
|
|
|
- ps.addBatch();
|
|
|
- if (i%500==0){
|
|
|
+ if (ObjectUtil.isNotNull(dataList)&&dataList.size()>0){
|
|
|
+ List<Map> monthList = new ArrayList<>();
|
|
|
+ monthList = dataList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() ->
|
|
|
+ new TreeSet<>(Comparator.comparing(o-> o.get("dateField_lcwv382").toString()))), ArrayList::new));
|
|
|
+ Connection connection = null;
|
|
|
+ PreparedStatement ps = null;
|
|
|
+ try {
|
|
|
+ Class.forName(driver);
|
|
|
+ connection = DriverManager.getConnection(url, username, password);
|
|
|
+ String deleteSql = "DELETE FROM `lanyun_project_analysis`WHERE CAST(`month` AS CHAR) = ?";
|
|
|
+ ps = connection.prepareStatement(deleteSql);
|
|
|
+ for (int i = 0; i < monthList.size(); i++) {
|
|
|
+ ps.setObject(1,monthList.get(i).get("dateField_lcwv382"));
|
|
|
ps.executeBatch();
|
|
|
- ps.clearBatch();
|
|
|
}
|
|
|
+ String sql = "INSERT INTO `lanyun_project_analysis`(`project_name`, `belong_project`, `month`, " +
|
|
|
+ "`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`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);";
|
|
|
+
|
|
|
+ ps = connection.prepareStatement(sql);
|
|
|
+ DecimalFormat df = new DecimalFormat("#.0000");
|
|
|
+ for (int i = 0; i < dataList.size(); i++) {
|
|
|
+ ps.setObject(1,dataList.get(i).get("textField_dliiyul"));
|
|
|
+ ps.setObject(2,dataList.get(i).get("textField_bheotm5"));
|
|
|
+ ps.setObject(3,dataList.get(i).get("dateField_lcwv382"));
|
|
|
+ ps.setObject(4,dataList.get(i).get("textField_pa6o780"));
|
|
|
+ ps.setObject(5,dataList.get(i).get("numberField_5wyyb42"));
|
|
|
+ ps.setObject(6,dataList.get(i).get("numberField_c4acnrg"));
|
|
|
+ ps.setObject(7,dataList.get(i).get("numberField_zjdki9k"));
|
|
|
+ ps.setObject(8,dataList.get(i).get("numberField_hg6jznm"));
|
|
|
+ ps.setObject(9,dataList.get(i).get("numberField_7ga9c5w"));
|
|
|
+ ps.setObject(10,dataList.get(i).get("numberField_c3cqsfv"));
|
|
|
+ ps.setObject(11,dataList.get(i).get("numberField_avaexyf"));
|
|
|
+ ps.setObject(12,dataList.get(i).get("numberField_gub2ul5"));
|
|
|
+ ps.setObject(13,dataList.get(i).get("numberField_hqiac12"));
|
|
|
+ ps.setObject(14,dataList.get(i).get("numberField_lz6mt3xq"));
|
|
|
+ double grossProfit = dataList.get(i).get("numberField_lz6mt3xq")==null?0f:Double.parseDouble(dataList.get(i).get("numberField_lz6mt3xq").toString());
|
|
|
+ double income = dataList.get(i).get("numberField_zjdki9k")==null?0f:Double.parseDouble(dataList.get(i).get("numberField_zjdki9k").toString());
|
|
|
+ grossProfit = grossProfit/income;
|
|
|
+ if (income == 0f){
|
|
|
+ grossProfit = 0f;
|
|
|
+ }
|
|
|
+ ps.setObject(15,df.format(grossProfit));
|
|
|
+ ps.setObject(16,dataList.get(i).get("numberField_ln701sy"));
|
|
|
+ ps.setObject(17,dataList.get(i).get("numberField_fmhzxdr"));
|
|
|
+ ps.setObject(18,dataList.get(i).get("numberField_lz6mt3xr"));
|
|
|
+ double net = Double.parseDouble(dataList.get(i).get("numberField_lz6mt3xr").toString());
|
|
|
+ double net_margin = net/income;
|
|
|
+ if (income == 0f){
|
|
|
+ net_margin = 0f;
|
|
|
+ }
|
|
|
+ ps.setObject(19,df.format(net_margin));
|
|
|
+ ps.setObject(20,dataList.get(i).get("textField_tpb3m2f"));
|
|
|
+ ps.setObject(21,dataList.get(i).get("textField_2adicsn"));
|
|
|
+ String profit_loss = "";
|
|
|
+ if (net_margin < 0){
|
|
|
+ profit_loss = "亏损";
|
|
|
+ }else if (net_margin >=0 && net_margin <=0.05){
|
|
|
+ profit_loss = "净利较低";
|
|
|
+ }else if(net_margin > 0.05){
|
|
|
+ profit_loss = "盈利";
|
|
|
+ }
|
|
|
+ ps.setObject(22,dataList.get(i).get("textField_1yw4mx4") == null ? null : profit_loss);
|
|
|
+ ps.setObject(23,dataList.get(i).get("dateField_ji5yfvf"));
|
|
|
+ ps.setObject(24,dataList.get(i).get("textField_h2qx5nz"));
|
|
|
+ ps.setObject(25,dataList.get(i).get("textField_35paoph"));
|
|
|
+ ps.addBatch();
|
|
|
+ if (i%500==0){
|
|
|
+ ps.executeBatch();
|
|
|
+ ps.clearBatch();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ps.executeBatch();
|
|
|
+ connection.close();
|
|
|
+ } catch (Exception exception) {
|
|
|
+ throw new RuntimeException(exception);
|
|
|
}
|
|
|
- ps.executeBatch();
|
|
|
- connection.close();
|
|
|
- } catch (Exception exception) {
|
|
|
- throw new RuntimeException(exception);
|
|
|
- }
|
|
|
- dataList.forEach(e->{
|
|
|
- ydClient.operateData(YDParam.builder()
|
|
|
- .appType("APP_ERBDTFS82HOVBPL3NFH0")
|
|
|
- .systemToken("RRB66F91T97H1WN89QZYC47PKLZO2ZQOUMOQLP")
|
|
|
- .formInstanceId(UtilMap.getString(e, "formInstanceId"))
|
|
|
+ dataList.forEach(e->{
|
|
|
+ ydClient.operateData(YDParam.builder()
|
|
|
+ .appType("APP_ERBDTFS82HOVBPL3NFH0")
|
|
|
+ .systemToken("RRB66F91T97H1WN89QZYC47PKLZO2ZQOUMOQLP")
|
|
|
+ .formInstanceId(UtilMap.getString(e, "formInstanceId"))
|
|
|
// .useLatestVersion(true)
|
|
|
// .updateFormDataJson(JSONObject.toJSONString(new HashMap<>()))
|
|
|
- .updateFormDataJson(JSON.toJSONString(UtilMap.map("radioField_m0dkcxod", "是")))
|
|
|
- .build(), YDConf.FORM_OPERATION.update);
|
|
|
- });
|
|
|
+ .updateFormDataJson(JSON.toJSONString(UtilMap.map("radioField_m0dkcxod", "是")))
|
|
|
+ .build(), YDConf.FORM_OPERATION.update);
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
/**
|
|
|
* 日常物耗申请单中采购专员审批后更新字段初始物耗费用总计
|