|
|
@@ -1,6 +1,7 @@
|
|
|
package com.lc.ibps.sysdata.services.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.lc.ibps.api.base.constants.StateEnum;
|
|
|
import com.lc.ibps.base.bo.exception.BoBaseException;
|
|
|
@@ -78,6 +79,45 @@ public class UpdateDataTableImpl extends GenericProvider implements UpdateDataTa
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public APIResult<Void> updateEquipmentInfo(String data) {
|
|
|
+ APIResult<Void> result = new APIResult<>();
|
|
|
+ String sql = "";
|
|
|
+ String sql2 = "";
|
|
|
+ try{
|
|
|
+ JSONObject dataObj = JSONObject.parseObject(data);
|
|
|
+ JSONArray ids = dataObj.getJSONArray("ids");
|
|
|
+ StringBuffer idStr = new StringBuffer();
|
|
|
+ for (Object id : ids){
|
|
|
+ idStr.append("'").append(id).append("',");
|
|
|
+ }
|
|
|
+ idStr.deleteCharAt(idStr.length() - 1);
|
|
|
+ sql = "update t_mjsbwhjhb set update_time_=now(),geng_xin_zhuang_t ='有更新项' where id_ in(%s)";
|
|
|
+ sql = String.format(sql, idStr);
|
|
|
+ commonDao.execute(sql);
|
|
|
+
|
|
|
+ JSONArray depts = dataObj.getJSONArray("depts");
|
|
|
+ StringBuffer deptStr = new StringBuffer();
|
|
|
+ for (Object dept : depts){
|
|
|
+ deptStr.append("'").append(dept).append("',");
|
|
|
+ }
|
|
|
+ deptStr.deleteCharAt(deptStr.length() - 1);
|
|
|
+ sql2 = "update t_mjsbwhjhb set update_time_=now(),geng_xin_zhuang_t ='' where id_ not in(%s) and bian_zhi_bu_men_ in(%s) and zhi_xing_zhuang_t='正常' and shi_fou_guo_shen_='已完成'";
|
|
|
+ sql2 = String.format(sql2,idStr,deptStr);
|
|
|
+ commonDao.execute(sql2);
|
|
|
+ result.setMessage("修改成功");
|
|
|
+ result.setState(SUCCESS.getCode());
|
|
|
+ }catch (Exception e){
|
|
|
+ result.setMessage(e.getMessage());
|
|
|
+ result.setState(ERROR.getCode());
|
|
|
+ throw e;
|
|
|
+ }
|
|
|
+ result.addVariable("sql",sql);
|
|
|
+ result.addVariable("sql2",sql2);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public APIResult updateUserById(String data) {
|
|
|
APIResult<Void> result = new APIResult<>();
|