|
|
@@ -0,0 +1,183 @@
|
|
|
+package openapi.restcontroller.hyworkorder.webapp.hyconfirmationorder;
|
|
|
+
|
|
|
+import hyconfirmationorder.hyconfirmationorder;
|
|
|
+import net.sf.json.JSONObject;
|
|
|
+import openapi.base.Controller;
|
|
|
+import openapi.base.SQLFactory;
|
|
|
+import openapi.base.data.Row;
|
|
|
+import openapi.base.data.Rows;
|
|
|
+import openapi.base.data.db.DBConnect;
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
+import p2.pao.PaoRemote;
|
|
|
+import p2.pao.PaoSetRemote;
|
|
|
+import p2.util.P2Exception;
|
|
|
+
|
|
|
+public class MyHyconfirmationorder extends Controller {
|
|
|
+
|
|
|
+
|
|
|
+ public MyHyconfirmationorder(JSONObject content) {
|
|
|
+ super(content);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**创建售后服务确认单**/
|
|
|
+ public String create(){
|
|
|
+ JSONObject where = content.getJSONObject("where");
|
|
|
+ String s[] = {"fworknum"};
|
|
|
+ for (String s1 : s) {
|
|
|
+ if (!where.containsKey(s1) && !StringUtils.isBlank(where.getString(s1)))
|
|
|
+ return getReturnObject_err("缺少" + s1 + "参数").toString();
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ PaoSetRemote hyWorkorderset = getpaoset("hyWorkorder");
|
|
|
+ hyWorkorderset.setInsertSite(siteid);
|
|
|
+ hyWorkorderset.setWhere("fworknum='"+where.getString("fworknum")+"'");
|
|
|
+ hyWorkorderset.reset();
|
|
|
+ if(hyWorkorderset.isEmpty())return getReturnObject_err("没有此工单").toString();
|
|
|
+ PaoRemote pao = hyWorkorderset.getPao(0);
|
|
|
+ PaoSetRemote hyconfirmationorder = pao.getPaoSet("hyconfirmationorder");
|
|
|
+ hyconfirmationorder.setWhere("fstatus='新建'");
|
|
|
+ hyconfirmationorder.reset();
|
|
|
+ if(!hyconfirmationorder.isEmpty())return getReturnObject_err("已存在新建的确认单").toString();
|
|
|
+ PaoRemote remote = hyconfirmationorder.addAtEnd();
|
|
|
+ remote.setValue("createby",hrid,11l);
|
|
|
+ hyconfirmationorder.save();
|
|
|
+ Row row=new Row();
|
|
|
+ row.put("fbillnum",remote.getString("fbillnum"));
|
|
|
+ return getReturnObject_suc(row,false).toString();
|
|
|
+ } catch (P2Exception e) {
|
|
|
+ return getReturnObject_err(e.getMessage()).toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**售后服务确认单详情**/
|
|
|
+ public String detail(){
|
|
|
+ JSONObject where = content.getJSONObject("where");
|
|
|
+ String s[] = {"fbillnum"};
|
|
|
+ for (String s1 : s) {
|
|
|
+ if (!where.containsKey(s1) && !StringUtils.isBlank(where.getString(s1)))
|
|
|
+ return getReturnObject_err("缺少" + s1 + "参数").toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ DBConnect dbConnect=new DBConnect();
|
|
|
+ SQLFactory factory_detail = new SQLFactory(this, "售后服务确认单详情");
|
|
|
+ factory_detail.addParameter("fbillnum",where.getString("fbillnum"));
|
|
|
+ Rows rows = dbConnect.runSqlQuery(factory_detail.getSQL());
|
|
|
+ if(rows.isEmpty())return getReturnObject_err("没有该单号").toString();
|
|
|
+ Row result=new Row();
|
|
|
+ Row detail = rows.get(0);
|
|
|
+
|
|
|
+ SQLFactory factory_titems = new SQLFactory(this, "售后商品查询");
|
|
|
+ factory_titems.addParameter("fparentid",detail.getInteger("afterserviceordeid"));
|
|
|
+ Rows titems = dbConnect.runSqlQuery(factory_titems.getSQL());
|
|
|
+
|
|
|
+
|
|
|
+ SQLFactory factory_url = new SQLFactory(this, "售后服务确认单附件查询");
|
|
|
+ factory_url.addParameter("ownerid",detail.getInteger("ownerid"));
|
|
|
+ Rows urls = dbConnect.runSqlQuery(factory_url.getSQL());
|
|
|
+
|
|
|
+
|
|
|
+ result.put("detail",detail);
|
|
|
+ result.put("titems",titems);
|
|
|
+ result.put("url",urls);
|
|
|
+
|
|
|
+ return getReturnObject_suc(result,false).toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**售后服务确认单列表**/
|
|
|
+ public String list(){
|
|
|
+ JSONObject where = content.getJSONObject("where");
|
|
|
+ String s[] = {"fworknum"};
|
|
|
+ for (String s1 : s) {
|
|
|
+ if (!where.containsKey(s1) && !StringUtils.isBlank(where.getString(s1)))
|
|
|
+ return getReturnObject_err("缺少" + s1 + "参数").toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ DBConnect dbConnect=new DBConnect();
|
|
|
+ SQLFactory sqlFactory_list = new SQLFactory(this, "售后服务确认单列表");
|
|
|
+ sqlFactory_list.addParameter("fworknum",where.getString("fworknum"));
|
|
|
+ Rows rows = dbConnect.runSqlQuery(sqlFactory_list.getSQL());
|
|
|
+ return getReturnObject_suc(rows,false).toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**售后服务确认单更新**/
|
|
|
+ public String update() {
|
|
|
+ JSONObject where = content.getJSONObject("where");
|
|
|
+ String s[] = {"fbillnum"};
|
|
|
+ for (String s1 : s) {
|
|
|
+ if (!where.containsKey(s1) && !StringUtils.isBlank(where.getString(s1)))
|
|
|
+ return getReturnObject_err("缺少" + s1 + "参数").toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ try {
|
|
|
+ PaoSetRemote hyconfirmationorder = getpaoset("hyconfirmationorder");
|
|
|
+ hyconfirmationorder.setInsertSite(siteid);
|
|
|
+ hyconfirmationorder.setWhere("fbillnum='"+where.getString("fbillnum")+"'");
|
|
|
+ hyconfirmationorder.reset();
|
|
|
+ if(hyconfirmationorder.isEmpty())return getReturnObject_err("没有该单号").toString();
|
|
|
+ PaoRemote pao = hyconfirmationorder.getPao(0);
|
|
|
+ if(where.containsKey("problemmsg")){
|
|
|
+ pao.setValue("Problemmsg",where.getString("problemmsg"),11l);
|
|
|
+ }
|
|
|
+ if(where.containsKey("treatmentmeasures")){
|
|
|
+ pao.setValue("Treatmentmeasures",where.getString("treatmentmeasures"),11l);
|
|
|
+ }
|
|
|
+ if(where.containsKey("nexthandledate")){
|
|
|
+ pao.setValue("nexthandledate",where.getString("nexthandledate"),11l);
|
|
|
+ }
|
|
|
+ if(where.containsKey("itemdescription")){
|
|
|
+ pao.setValue("Itemdescription",where.getString("itemdescription"),11l);
|
|
|
+ }
|
|
|
+ if(where.containsKey("result")){
|
|
|
+ pao.setValue("result",where.getString("result"),11l);
|
|
|
+ }
|
|
|
+ if(where.containsKey("result_msg")){
|
|
|
+ pao.setValue("result_msg",where.getString("result_msg"),11l);
|
|
|
+ }
|
|
|
+ if(where.containsKey("cooperativeattitude")){
|
|
|
+ pao.setValue("Cooperativeattitude",where.getDouble("cooperativeattitude"),11l);
|
|
|
+ }
|
|
|
+ if(where.containsKey("reactionrate")){
|
|
|
+ pao.setValue("reactionrate",where.getDouble("reactionrate"),11l);
|
|
|
+ }
|
|
|
+ //nextreturndate
|
|
|
+ if(where.containsKey("nextreturndate")){
|
|
|
+ pao.setValue("nextreturndate",where.getString("nextreturndate"),11l);
|
|
|
+ }
|
|
|
+
|
|
|
+ hyconfirmationorder.save();
|
|
|
+ return getReturnObject_suc().toString();
|
|
|
+ } catch (P2Exception e) {
|
|
|
+ return getReturnObject_err(e.getMessage()).toString();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**提交服务确认单**/
|
|
|
+ public String submit(){
|
|
|
+ JSONObject where = content.getJSONObject("where");
|
|
|
+ String s[] = {"fbillnum"};
|
|
|
+ for (String s1 : s) {
|
|
|
+ if (!where.containsKey(s1) && !StringUtils.isBlank(where.getString(s1)))
|
|
|
+ return getReturnObject_err("缺少" + s1 + "参数").toString();
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ PaoSetRemote hyconfirmationorderset = getpaoset("hyconfirmationorder");
|
|
|
+ hyconfirmationorderset.setInsertSite(siteid);
|
|
|
+ hyconfirmationorderset.setWhere("fbillnum='"+where.getString("fbillnum")+"'");
|
|
|
+ hyconfirmationorderset.reset();
|
|
|
+ if(hyconfirmationorderset.isEmpty())return getReturnObject_err("没有该单号").toString();
|
|
|
+// System.out.println(hyconfirmationorderset.getPao(0).getClass().toString());
|
|
|
+ hyconfirmationorder pao = (hyconfirmationorder)hyconfirmationorderset.getPao(0);
|
|
|
+ pao.submit(true,hrid);
|
|
|
+ hyconfirmationorderset.save();
|
|
|
+ return getReturnObject_suc().toString();
|
|
|
+ } catch (P2Exception e) {
|
|
|
+ return getReturnObject_err(e.getMessage()).toString();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|