2 İşlemeler b3023c4f82 ... 0c7d4c51b9

Yazar SHA1 Mesaj Tarih
  shenjingwei 0c7d4c51b9 Merge remote-tracking branch 'origin/develop' into develop 3 gün önce
  shenjingwei 9084f88ad8 企业年度目标编辑优化 3 gün önce

+ 1 - 1
pom.xml

@@ -92,7 +92,7 @@
         <dependency>
             <groupId>com.yunlian.yos</groupId>
             <artifactId>yos-core</artifactId>
-            <version>3.2.30</version>
+            <version>3.2.31</version>
         </dependency>
         <dependency>
             <groupId>com.microsoft.sqlserver</groupId>

+ 166 - 188
src/custom/restcontroller/webmanage/sale/salestarget/enterprisetarget.java

@@ -35,13 +35,12 @@ public class enterprisetarget extends Controller {
 
     @API(title = "新建企业年度", apiversion = R.ID20221229104202.v1.class)
     @CACHEING_CLEAN(cms = {@cm(clazz = personnel.class, method = {"queryList", "queryDetailList"}), @cm(clazz = personnelstatistics.class, method = {"queryList"})})
-    public String insert() throws YosException {
+    public String createSalesTargetBill() throws YosException {
         Long year = content.getLong("year");
         Long sa_salestargetbillid = content.getLong("sa_salestargetbillid");
-        JSONArray agentsArray = content.getJSONArray("agents");
-        String assessmentindicators=content.getString("assessmentindicators");
-        String statisticaldimension=content.getStringValue("statisticaldimension");
-        String sa_accountclassids=content.getStringValue("sa_accountclassids");
+        String assessmentindicators = content.getString("assessmentindicators");
+        String statisticaldimension = content.getStringValue("statisticaldimension");
+        String sa_accountclassids = content.getStringValue("sa_accountclassids");
         ArrayList<String> sqlList = new ArrayList<>();
         if (sa_salestargetbillid <= 0) {
             //查询创建年度是否存在
@@ -66,7 +65,7 @@ public class enterprisetarget extends Controller {
 
                 sqlList.add(sqlFactory.getSQL());
             }
-        }else{
+        } else {
             SQLFactory sqlFactory = new SQLFactory(this, "更新新年度");
             sqlFactory.addParameter("siteid", siteid);
             sqlFactory.addParameter("sa_salestargetbillid", sa_salestargetbillid);
@@ -78,55 +77,6 @@ public class enterprisetarget extends Controller {
             sqlList.add(sqlFactory.getSQL());
         }
 
-
-        String[] types = {"年", "季", "月"};
-
-        for (Object obj : agentsArray) {
-            JSONObject saleObj = (JSONObject) obj;
-            System.out.println(saleObj.toString());
-            SQLFactory saleFactory = new SQLFactory(this, "企业范围新增");
-            saleFactory.addParameter("siteid", siteid);
-            saleFactory.addParameter("sa_salestargethrid", createTableID("sa_salestargethr"));
-            saleFactory.addParameter("sys_enterpriseid", saleObj.getLong("sys_enterpriseid"));
-            saleFactory.addParameter("sa_salestargetbillid", sa_salestargetbillid);
-            sqlList.add(saleFactory.getSQL());
-
-
-            for (String type : types) {
-                int point;
-                if (type.equals("年")) {
-                    point = 1;
-                } else if (type.equals("季")) {
-                    point = 4;
-                } else if (type.equals("月")) {
-                    point = 12;
-                } else {
-                    point = 0;
-                }
-
-                for (int i = 0; i < point; i++) {
-                    SQLFactory targetFactory = new SQLFactory(this, "企业-目标明细新增");
-                    targetFactory.addParameter("siteid", siteid);
-                    targetFactory.addParameter("sa_salestargetid", createTableID("sa_salestarget"));
-                    targetFactory.addParameter("type", type);
-                    targetFactory.addParameter("point", i + 1);
-                    targetFactory.addParameter("targettype", "企业目标");
-                    targetFactory.addParameter("sys_enterpriseid", saleObj.getLong("sys_enterpriseid"));
-                    targetFactory.addParameter("sa_salestargetbillid", sa_salestargetbillid);
-                    targetFactory.addParameter("year", year);
-                    targetFactory.addParameter("sa_contractid", 0);
-                    targetFactory.addParameter("createby", username);
-                    targetFactory.addParameter("target_l", 0);
-                    targetFactory.addParameter("target_h", 0);
-                    targetFactory.addParameter("tradefield", "");
-                    sqlList.add(targetFactory.getSQL());
-                }
-            }
-
-            sqlList.add(DataContrlLog.createLog(this, "sys_enterprise", sys_enterpriseid, "添加业绩目标", "添加业绩目标" + year + "年目标").getSQL());
-        }
-
-
         dbConnect.runSqlUpdate(sqlList);
         return getSucReturnObject().toString();
     }
@@ -134,50 +84,80 @@ public class enterprisetarget extends Controller {
     @API(title = "目标编辑", apiversion = R.ID20221229111502.v1.class)
     @CACHEING_CLEAN(cms = {@cm(clazz = personnel.class, method = {"queryList", "queryDetailList"}), @cm(clazz = personnelstatistics.class, method = {"queryList"})})
     public String edit() throws YosException {
-        Long sa_salestargetbillid = content.getLong("sa_salestargetbillid");
-        if(sa_salestargetbillid<=0){
-            Rows rows =dbConnect.runSqlQuery("SELECT sa_salestargetbillid FROM sa_salestargetbill WHERE `year` = " + content.getLong("year") + " AND targettype ='企业目标' AND siteid = '" + siteid + "'");
-            if(rows.isNotEmpty()){
-                sa_salestargetbillid=rows.get(0).getLong("sa_salestargetbillid");
-            }
-        }
-        Long sys_enterpriseid = content.getLong("sys_enterpriseid");
-        if (sa_salestargetbillid <= 0) {
-            return getErrReturnObject().setErrMsg("年度目标不存在").toString();
-        }
+        long sa_salestargetbillid = content.getLong("sa_salestargetbillid");
+        long sys_enterpriseid = content.getLong("sys_enterpriseid");
 
-        ArrayList<String> sqlList = new ArrayList<>();
-        String key_l = "y1l";
-        String key_h = "y1h";
-        if (content.containsKey(key_l) && content.containsKey(key_h)) {
-            sqlList.add(getSql(content.getString(key_l), content.getString(key_h), sa_salestargetbillid, sys_enterpriseid, "年", 1));
-        }
-        for (int i = 1; i < 5; i++) {
-            key_l = "s" + i + "l";
-            key_h = "s" + i + "h";
-            if (content.containsKey(key_l) && content.containsKey(key_h)) {
-                sqlList.add(getSql(content.getString(key_l), content.getString(key_h), sa_salestargetbillid, sys_enterpriseid, "季", i));
-            }
+        Rows salestargetbillRows = dbConnect.runSqlQuery("select * from sa_salestargetbill where sa_salestargetbillid=" + sa_salestargetbillid);
+        if (salestargetbillRows.isEmpty()) {
+            return getErrReturnObject().setErrMsg("目标不存在").toString();
         }
+        int year = salestargetbillRows.getRow(0).getInteger("year");
 
-        for (int i = 1; i < 13; i++) {
-            key_l = "m" + i + "l";
-            key_h = "m" + i + "h";
-            if (content.containsKey(key_l) && content.containsKey(key_h)) {
-                sqlList.add(getSql(content.getString(key_l), content.getString(key_h), sa_salestargetbillid, sys_enterpriseid, "月", i));
-            }
-        }
+        SQLDump sqlDump = new SQLDump();
+        Rows salestargetRows = dbConnect.runSqlQuery("select * from sa_salestarget where sa_salestargetbillid=" + sa_salestargetbillid + " and sys_enterpriseid=" + sys_enterpriseid);
+        if (salestargetRows.isEmpty()) {
+            SQLFactory saleFactory = new SQLFactory(this, "企业范围新增");
+            saleFactory.addParameter("siteid", siteid);
+            saleFactory.addParameter("sa_salestargethrid", createTableID("sa_salestargethr"));
+            saleFactory.addParameter("sys_enterpriseid", sys_enterpriseid);
+            saleFactory.addParameter("sa_salestargetbillid", sa_salestargetbillid);
+            sqlDump.add(saleFactory.getSQL());
 
-        //操作记录
-        Long year = 0L;
-        Rows rows = dbConnect.runSqlQuery("SELECT year from sa_salestargetbill  WHERE sa_salestargetbillid =" + sa_salestargetbillid + " and siteid='" + siteid + "'");
-        if (rows.isNotEmpty()) {
-            year = rows.get(0).getLong("year");
+            sqlDump.add(DataContrlLog.createLog(this, "sa_salestargetbill", sa_salestargetbillid, "添加业绩目标", "添加业绩目标" + year + "年目标"));
+        } else {
+            sqlDump.add(DataContrlLog.createLog(this, "sa_salestargetbill", sa_salestargetbillid, "编辑业绩目标", "编辑业绩目标" + year + "年目标"));
         }
 
-        sqlList.add(DataContrlLog.createLog(this, "sa_salestargetbill", sa_salestargetbillid, "编辑业绩目标", "编辑业绩目标" + year + "年目标").getSQL());
-
-        dbConnect.runSqlUpdate(sqlList);
+        String[] types = {"年", "季", "月"};
+        for (String type : types) {
+            int point;
+            String t;
+            if (type.equals("年")) {
+                point = 1;
+                t = "y";
+            } else if (type.equals("季")) {
+                point = 4;
+                t = "s";
+            } else if (type.equals("月")) {
+                t = "m";
+                point = 12;
+            } else {
+                t = "";
+                point = 0;
+            }
+            for (int i = 1; i <= point; i++) {
+                String key_l = t + i + "l";
+                if (content.containsKey(key_l)) {
+                    double target_l = content.getDouble(key_l);
+                    if (salestargetRows.isEmpty()) {
+                        SQLFactory targetFactory = new SQLFactory(this, "企业-目标明细新增");
+                        targetFactory.addParameter("siteid", siteid);
+                        targetFactory.addParameter("sa_salestargetid", createTableID("sa_salestarget"));
+                        targetFactory.addParameter("targettype", "企业目标");
+                        targetFactory.addParameter("sa_salestargetbillid", sa_salestargetbillid);
+                        targetFactory.addParameter("sys_enterpriseid", sys_enterpriseid);
+                        targetFactory.addParameter("type", type);
+                        targetFactory.addParameter("year", year);
+                        targetFactory.addParameter("point", i);
+                        targetFactory.addParameter("sa_contractid", 0);
+                        targetFactory.addParameter("createby", username);
+                        targetFactory.addParameter("target_l", target_l);
+                        targetFactory.addParameter("target_h", 0);
+                        targetFactory.addParameter("tradefield", "");
+                        sqlDump.add(targetFactory.getSQL());
+                    } else {
+                        UpdateSQL updateSalesTarget = SQLFactory.createUpdateSQL(this, "sa_salestarget");
+                        updateSalesTarget.setValue("target_l", target_l);
+                        updateSalesTarget.setWhere("sa_salestargetbillid", sa_salestargetbillid);
+                        updateSalesTarget.setWhere("sys_enterpriseid", sys_enterpriseid);
+                        updateSalesTarget.setWhere("type", type);
+                        updateSalesTarget.setWhere("point", i);
+                        sqlDump.add(updateSalesTarget);
+                    }
+                }
+            }
+        }
+        sqlDump.commit(this);
         return getSucReturnObject().toString();
     }
 
@@ -219,7 +199,7 @@ public class enterprisetarget extends Controller {
          */
         Calendar calendar = Calendar.getInstance();
         int curryear = calendar.get(Calendar.YEAR);
-        StringBuffer where = new StringBuffer(" 1=1 and year="+curryear);
+        StringBuffer where = new StringBuffer(" 1=1 and year=" + curryear);
 
         SQLFactory areasqlFactory = new SQLFactory(new promotion(content), "区域经理查询下属营销区域");
         areasqlFactory.addParameter("siteid", siteid);
@@ -227,27 +207,26 @@ public class enterprisetarget extends Controller {
         Rows arearows = dbConnect.runSqlQuery(areasqlFactory);
 
 
-        if(arearows.isNotEmpty() && arearows.size()>1){
-            ArrayList<Long> arrayList =arearows.toArrayList("sa_saleareaid", new ArrayList<Long>());
+        if (arearows.isNotEmpty() && arearows.size() > 1) {
+            ArrayList<Long> arrayList = arearows.toArrayList("sa_saleareaid", new ArrayList<Long>());
             arrayList.addAll(SaleArea.getSubSaleAreaIds(this, arrayList));
-            String sql = " and sys_enterpriseid in (select sys_enterpriseid from sys_enterprise_tradefield where sa_saleareaid in "+arrayList+") ";
+            String sql = " and sys_enterpriseid in (select sys_enterpriseid from sys_enterprise_tradefield where sa_saleareaid in " + arrayList + ") ";
             sql = sql.replace("[", "(").replace("]", ")");
-            where=where.append(sql);
+            where = where.append(sql);
         }
 
 
-
         //考核指标类型
-        String assessmentindicators="";
+        String assessmentindicators = "";
         //统计维度
-        String statisticaldimension="";
-        String  sa_accountclassids="";
-        if(curryear!=0){
-            Rows rows =dbConnect.runSqlQuery("SELECT assessmentindicators,statisticaldimension,sa_accountclassids FROM sa_salestargetbill WHERE `year` = " + curryear + " AND targettype ='企业目标' AND siteid = '" + siteid + "'");
-            if(rows.isNotEmpty()){
-                assessmentindicators=rows.get(0).getString("assessmentindicators");
-                statisticaldimension=rows.get(0).getString("statisticaldimension");
-                sa_accountclassids=rows.get(0).getString("sa_accountclassids");
+        String statisticaldimension = "";
+        String sa_accountclassids = "";
+        if (curryear != 0) {
+            Rows rows = dbConnect.runSqlQuery("SELECT assessmentindicators,statisticaldimension,sa_accountclassids FROM sa_salestargetbill WHERE `year` = " + curryear + " AND targettype ='企业目标' AND siteid = '" + siteid + "'");
+            if (rows.isNotEmpty()) {
+                assessmentindicators = rows.get(0).getString("assessmentindicators");
+                statisticaldimension = rows.get(0).getString("statisticaldimension");
+                sa_accountclassids = rows.get(0).getString("sa_accountclassids");
             }
         }
 
@@ -261,85 +240,85 @@ public class enterprisetarget extends Controller {
         Rows actualRows = new Rows();
         //开票
         if (assessmentindicators.equals("开票")) {
-            String where1=" 1=1 ";
+            String where1 = " 1=1 ";
             sqlFactory = new SQLFactory(new enterprise(new JSONObject()), "企业-开票");
-            if(content.getLongValue("num")==0){
-                sqlFactory.addParameter("num",2);
-            }else{
-                sqlFactory.addParameter("num",content.getLongValue("num"));
-            }
-            if(statisticaldimension.equals("订单审核")){
-                where1=where1+" and t2.status='审核' ";
-            }else{
-                where1=where1+" and t2.status='提交' ";
-            }
-            if(StringUtils.isNotBlank(sa_accountclassids)){
-                if(isJSONArray(sa_accountclassids)){
+            if (content.getLongValue("num") == 0) {
+                sqlFactory.addParameter("num", 2);
+            } else {
+                sqlFactory.addParameter("num", content.getLongValue("num"));
+            }
+            if (statisticaldimension.equals("订单审核")) {
+                where1 = where1 + " and t2.status='审核' ";
+            } else {
+                where1 = where1 + " and t2.status='提交' ";
+            }
+            if (StringUtils.isNotBlank(sa_accountclassids)) {
+                if (isJSONArray(sa_accountclassids)) {
                     JSONArray jsonArrayResult = JSONArray.parseArray(sa_accountclassids);
-                    if(!jsonArrayResult.isEmpty()){
-                        where1=where1+ " and t2.sa_accountclassid in"+jsonArrayResult;
+                    if (!jsonArrayResult.isEmpty()) {
+                        where1 = where1 + " and t2.sa_accountclassid in" + jsonArrayResult;
                         where1 = where1.replace("[", "(").replace("]", ")");
                     }
 
                 }
             }
-            sqlFactory.addParameter_SQL("where1",where1);
-            sqlFactory.addParameter_in("sys_enterpriseid", rows.toArrayList("sys_enterpriseid",new ArrayList<Long>()));
+            sqlFactory.addParameter_SQL("where1", where1);
+            sqlFactory.addParameter_in("sys_enterpriseid", rows.toArrayList("sys_enterpriseid", new ArrayList<Long>()));
             sqlFactory.addParameter("siteid", siteid);
             sqlFactory.addParameter("year", curryear);
             actualRows = dbConnect.runSqlQuery(sqlFactory);
         }
         //订单
         if (assessmentindicators.equals("订单")) {
-            String where1=" 1=1 ";
+            String where1 = " 1=1 ";
             sqlFactory = new SQLFactory(new enterprise(new JSONObject()), "企业-订单");
-            if(content.getLongValue("num")==0){
-                sqlFactory.addParameter("num",2);
-            }else{
-                sqlFactory.addParameter("num",content.getLongValue("num"));
-            }
-            if(statisticaldimension.equals("订单审核")){
-                where1=where1+" and t2.status='审核' ";
-            }else{
-                where1=where1+" and t2.status='提交' ";
-            }
-            if(StringUtils.isNotBlank(sa_accountclassids)){
-                if(isJSONArray(sa_accountclassids)){
+            if (content.getLongValue("num") == 0) {
+                sqlFactory.addParameter("num", 2);
+            } else {
+                sqlFactory.addParameter("num", content.getLongValue("num"));
+            }
+            if (statisticaldimension.equals("订单审核")) {
+                where1 = where1 + " and t2.status='审核' ";
+            } else {
+                where1 = where1 + " and t2.status='提交' ";
+            }
+            if (StringUtils.isNotBlank(sa_accountclassids)) {
+                if (isJSONArray(sa_accountclassids)) {
                     JSONArray jsonArrayResult = JSONArray.parseArray(sa_accountclassids);
-                    if(!jsonArrayResult.isEmpty()){
-                        where1=where1+ " and t2.sa_accountclassid in"+jsonArrayResult;
+                    if (!jsonArrayResult.isEmpty()) {
+                        where1 = where1 + " and t2.sa_accountclassid in" + jsonArrayResult;
                         where1 = where1.replace("[", "(").replace("]", ")");
                     }
 
                 }
             }
-            sqlFactory.addParameter_SQL("where1",where1);
-            sqlFactory.addParameter_in("sys_enterpriseid", rows.toArrayList("sys_enterpriseid",new ArrayList<Long>()));
+            sqlFactory.addParameter_SQL("where1", where1);
+            sqlFactory.addParameter_in("sys_enterpriseid", rows.toArrayList("sys_enterpriseid", new ArrayList<Long>()));
             sqlFactory.addParameter("siteid", siteid);
             sqlFactory.addParameter("year", curryear);
             actualRows = dbConnect.runSqlQuery(sqlFactory);
         }
         //出货
         if (assessmentindicators.equals("出货")) {
-            String where1=" 1=1 ";
+            String where1 = " 1=1 ";
             sqlFactory = new SQLFactory(new enterprise(new JSONObject()), "企业-出货");
-            if(content.getLongValue("num")==0){
-                sqlFactory.addParameter("num",2);
-            }else{
-                sqlFactory.addParameter("num",content.getLongValue("num"));
+            if (content.getLongValue("num") == 0) {
+                sqlFactory.addParameter("num", 2);
+            } else {
+                sqlFactory.addParameter("num", content.getLongValue("num"));
             }
-            if(StringUtils.isNotBlank(sa_accountclassids)){
-                if(isJSONArray(sa_accountclassids)){
+            if (StringUtils.isNotBlank(sa_accountclassids)) {
+                if (isJSONArray(sa_accountclassids)) {
                     JSONArray jsonArrayResult = JSONArray.parseArray(sa_accountclassids);
-                    if(!jsonArrayResult.isEmpty()){
-                        where1=where1+ " and t2.sa_accountclassid in"+jsonArrayResult;
+                    if (!jsonArrayResult.isEmpty()) {
+                        where1 = where1 + " and t2.sa_accountclassid in" + jsonArrayResult;
                         where1 = where1.replace("[", "(").replace("]", ")");
                     }
 
                 }
             }
-            sqlFactory.addParameter_SQL("where1",where1);
-            sqlFactory.addParameter_in("sys_enterpriseid", rows.toArrayList("sys_enterpriseid",new ArrayList<Long>()));
+            sqlFactory.addParameter_SQL("where1", where1);
+            sqlFactory.addParameter_in("sys_enterpriseid", rows.toArrayList("sys_enterpriseid", new ArrayList<Long>()));
             sqlFactory.addParameter("siteid", siteid);
             sqlFactory.addParameter("year", curryear);
             actualRows = dbConnect.runSqlQuery(sqlFactory);
@@ -347,44 +326,44 @@ public class enterprisetarget extends Controller {
         //收款
         if (assessmentindicators.equals("收款")) {
             sqlFactory = new SQLFactory(new enterprise(new JSONObject()), "企业-收款");
-            if(content.getLongValue("num")==0){
-                sqlFactory.addParameter("num",2);
-            }else{
-                sqlFactory.addParameter("num",content.getLongValue("num"));
-            }
-            String where1=" 1=1 ";
-            if(StringUtils.isNotBlank(statisticaldimension)){
-                if(isJSONObject(statisticaldimension)){
+            if (content.getLongValue("num") == 0) {
+                sqlFactory.addParameter("num", 2);
+            } else {
+                sqlFactory.addParameter("num", content.getLongValue("num"));
+            }
+            String where1 = " 1=1 ";
+            if (StringUtils.isNotBlank(statisticaldimension)) {
+                if (isJSONObject(statisticaldimension)) {
                     JSONObject jsonObjectResult = JSONObject.parseObject(statisticaldimension);
-                    if(!jsonObjectResult.isEmpty()){
-                        StringBuffer stringBuffer= new StringBuffer();
-                        if(!((JSONArray)jsonObjectResult.get("type")).isEmpty()){
-                            stringBuffer.append(" or class in"+ jsonObjectResult.get("type"));
+                    if (!jsonObjectResult.isEmpty()) {
+                        StringBuffer stringBuffer = new StringBuffer();
+                        if (!((JSONArray) jsonObjectResult.get("type")).isEmpty()) {
+                            stringBuffer.append(" or class in" + jsonObjectResult.get("type"));
                         }
-                        if(!((JSONArray)jsonObjectResult.get("mx")).isEmpty()){
-                            stringBuffer.append(" or subclass in"+ jsonObjectResult.get("mx"));
+                        if (!((JSONArray) jsonObjectResult.get("mx")).isEmpty()) {
+                            stringBuffer.append(" or subclass in" + jsonObjectResult.get("mx"));
                         }
-                        if(((JSONArray)jsonObjectResult.get("mx")).isEmpty() && ((JSONArray)jsonObjectResult.get("type")).isEmpty()){
+                        if (((JSONArray) jsonObjectResult.get("mx")).isEmpty() && ((JSONArray) jsonObjectResult.get("type")).isEmpty()) {
                             stringBuffer.append(" 1=1 ");
                         }
-                        where1= where1+ " and ("+(stringBuffer.toString()).replaceFirst("or", "")+")";
+                        where1 = where1 + " and (" + (stringBuffer.toString()).replaceFirst("or", "") + ")";
                         where1 = where1.replace("[", "(").replace("]", ")");
                     }
 
                 }
             }
-            if(StringUtils.isNotBlank(sa_accountclassids)){
-                if(isJSONArray(sa_accountclassids)){
+            if (StringUtils.isNotBlank(sa_accountclassids)) {
+                if (isJSONArray(sa_accountclassids)) {
                     JSONArray jsonArrayResult = JSONArray.parseArray(sa_accountclassids);
-                    if(!jsonArrayResult.isEmpty()){
-                        where1=where1+ " and sa_accountclassid in"+jsonArrayResult;
+                    if (!jsonArrayResult.isEmpty()) {
+                        where1 = where1 + " and sa_accountclassid in" + jsonArrayResult;
                         where1 = where1.replace("[", "(").replace("]", ")");
                     }
 
                 }
             }
-            sqlFactory.addParameter_SQL("where1",where1);
-            sqlFactory.addParameter_in("sys_enterpriseid", rows.toArrayList("sys_enterpriseid",new ArrayList<Long>()));
+            sqlFactory.addParameter_SQL("where1", where1);
+            sqlFactory.addParameter_in("sys_enterpriseid", rows.toArrayList("sys_enterpriseid", new ArrayList<Long>()));
             sqlFactory.addParameter("siteid", siteid);
             sqlFactory.addParameter("year", curryear);
             actualRows = dbConnect.runSqlQuery(sqlFactory);
@@ -396,7 +375,7 @@ public class enterprisetarget extends Controller {
             Long sys_enterpriseid = row.getLong("sys_enterpriseid");
             Row actualRow = new Row();
             for (Row tempActualRow : actualRows) {
-                if (tempActualRow.getLong("year") == year && tempActualRow.getLong("sys_enterpriseid")==sys_enterpriseid) {
+                if (tempActualRow.getLong("year") == year && tempActualRow.getLong("sys_enterpriseid") == sys_enterpriseid) {
                     actualRow.putAll(tempActualRow);
                 }
             }
@@ -420,9 +399,8 @@ public class enterprisetarget extends Controller {
         return getSucReturnObject().setData(rows).toString();
     }
 
-    public String getSql(String target_l, String target_h, Long id, Long sys_enterpriseid, String type, int point) {
-
-        return " UPDATE sa_salestarget SET target_l=" + target_l + ",target_h = " + target_h + "   WHERE sa_salestargetbillid =" + id + " and sys_enterpriseid =" + sys_enterpriseid + " and type ='" + type + "' AND point = " + point;
+    public String getSql(String target_l, Long id, Long sys_enterpriseid, String type, int point) {
+        return " UPDATE sa_salestarget SET target_l=" + target_l + "  WHERE sa_salestargetbillid =" + id + " and sys_enterpriseid =" + sys_enterpriseid + " and type ='" + type + "' AND point = " + point;
     }
 
 //    @API(title = "删除", apiversion = R.ID20221229141102.v1.class)
@@ -482,7 +460,7 @@ public class enterprisetarget extends Controller {
     }
 
     @API(title = "企业目标导入", apiversion = R.ID20231020111303.v1.class)
-    @CACHEING_CLEAN(apiClass = {enterprisetarget.class,restcontroller.sale.salestarget.enterprise.class})
+    @CACHEING_CLEAN(apiClass = {enterprisetarget.class, restcontroller.sale.salestarget.enterprise.class})
     public String enterpriseTargetImport() throws YosException {
 
         Long sa_salestargetbillid = content.getLong("sa_salestargetbillid");
@@ -514,7 +492,7 @@ public class enterprisetarget extends Controller {
             }
 
             cellMap.put("name", CellType.STRING);
-            Rows rows = e.getSheetRows(0, keys,cellMap, 2);
+            Rows rows = e.getSheetRows(0, keys, cellMap, 2);
             ArrayList<String> agentnumList = new ArrayList<>();
             for (Row row : rows) {
                 agentnumList.add(row.getString("name"));
@@ -525,7 +503,7 @@ public class enterprisetarget extends Controller {
             sqlFactory.addParameter_in("agentnum", agentnumList);
             sqlFactory.addParameter("sa_salestargetbillid", sa_salestargetbillid);
             String sql = sqlFactory.getSQL();
-             System.out.println(sql);
+            System.out.println(sql);
             RowsMap agentRowsMap = dbConnect.runSqlQuery(sql).toRowsMap("agentnum");
             String[] types = {"年", "季"};
             boolean iserr = false;
@@ -555,7 +533,7 @@ public class enterprisetarget extends Controller {
                                 double target_l = 0L;
                                 double target_h = 0L;
                                 if (type.equals("年")) {
-                                    if(!isNumeric(row.getString("y1l"))){
+                                    if (!isNumeric(row.getString("y1l"))) {
                                         System.out.println("y1l");
                                         iserr = true;
                                         row.put("msg", "年度目标不为数字格式,请检查");
@@ -564,17 +542,17 @@ public class enterprisetarget extends Controller {
                                     }
                                 }
                                 if (type.equals("季")) {
-                                    if(!isNumeric(row.getString("s" + (i + 1) + "l"))){
+                                    if (!isNumeric(row.getString("s" + (i + 1) + "l"))) {
                                         System.out.println("季");
                                         iserr = true;
-                                        row.put("msg", "第"+(i + 1)+"季度目标不为数字格式,请检查");
+                                        row.put("msg", "第" + (i + 1) + "季度目标不为数字格式,请检查");
                                         rowserr.add(row);
                                         break;
                                     }
                                 }
                             }
                         }
-                        if(StringUtils.isBlank(row.getString("msg"))){
+                        if (StringUtils.isBlank(row.getString("msg"))) {
                             row.putAll(userRows.get(0));
                             rowssuc.add(row);
                         }
@@ -625,7 +603,6 @@ public class enterprisetarget extends Controller {
                             }
 
 
-
                             SQLFactory targetFactory = new SQLFactory(this, "企业-目标明细新增");
                             targetFactory.addParameter("siteid", siteid);
                             targetFactory.addParameter("sa_salestargetid", ids[index - 1]);
@@ -650,7 +627,7 @@ public class enterprisetarget extends Controller {
 
                 }
             }
-            for (String s:sqllist) {
+            for (String s : sqllist) {
                 System.out.println(s);
             }
             if (sqllist != null && !sqllist.isEmpty()) {
@@ -743,6 +720,7 @@ public class enterprisetarget extends Controller {
         }
         return sheet;
     }
+
     //添加实际数据
     public Row addActualRow(Row targetRow) {
         String key = "y1a";