1408 lines
63 KiB
Plaintext
1408 lines
63 KiB
Plaintext
package com.nationalelectric.greenH5;
|
||
|
||
import java.text.SimpleDateFormat;
|
||
import java.util.ArrayList;
|
||
import java.util.Date;
|
||
import java.util.HashMap;
|
||
import java.util.Iterator;
|
||
import java.util.List;
|
||
import java.util.Map;
|
||
import java.util.UUID;
|
||
|
||
import javax.annotation.Resource;
|
||
|
||
import org.apache.commons.lang.StringUtils;
|
||
import org.codehaus.jackson.map.ObjectMapper;
|
||
import org.codehaus.jackson.type.TypeReference;
|
||
import org.springframework.beans.factory.annotation.Autowired;
|
||
import org.springframework.stereotype.Controller;
|
||
import org.springframework.transaction.annotation.Transactional;
|
||
import org.springframework.web.bind.annotation.RequestBody;
|
||
import org.springframework.web.bind.annotation.RequestMapping;
|
||
import org.springframework.web.bind.annotation.RequestMethod;
|
||
import org.springframework.web.bind.annotation.ResponseBody;
|
||
|
||
import com.jysoft.unipush.AliasManage;
|
||
import com.jysoft.weChat.service.WechatService;
|
||
import com.jysoft.weChat.vo.ContentVo;
|
||
import com.nationalelectirc.Constant.ApplyRoleConstant;
|
||
import com.nationalelectirc.Constant.Constant;
|
||
import com.nationalelectirc.utils.RestResult;
|
||
import com.nationalelectric.greenH5.DTO.GreenMealTicketApplyDTO;
|
||
import com.nationalelectric.greenH5.bizc.BaseServiceImpl;
|
||
import com.nationalelectric.greenH5.bizc.IGreenApplyBizc;
|
||
import com.nationalelectric.greenH5.bizc.IGreenApplyListBizc;
|
||
import com.nationalelectric.greenH5.bizc.IGreenFaultRepairInfoBizc;
|
||
import com.nationalelectric.greenH5.bizc.IGreenOperateLogBizc;
|
||
import com.nationalelectric.greenH5.po.GreenApply;
|
||
import com.nationalelectric.greenH5.po.GreenApplyList;
|
||
import com.nationalelectric.greenH5.po.GreenFaultRepairInfo;
|
||
import com.nationalelectric.greenH5.po.GreenFaultReply;
|
||
import com.nationalelectric.greenH5.po.GreenSeekmedicalRecord;
|
||
import com.nationalelectric.greenH5.po.GreenUserInfo;
|
||
import com.nationalelectric.greenH5.po.Result;
|
||
import com.nationalelectric.greenH5.utils.DateUtil;
|
||
import com.sgcc.uap.persistence.IHibernateDao;
|
||
import com.sgcc.uap.service.validator.ServiceValidatorBaseException;
|
||
import com.sgcc.uap.service.validator.ServiceValidatorUtil;
|
||
|
||
import Decoder.BASE64Encoder;
|
||
|
||
|
||
|
||
|
||
/**
|
||
* <b>概述</b>:<br>
|
||
* <p>
|
||
* <b>功能</b>:<br>
|
||
*
|
||
* @author dell
|
||
*/
|
||
@Controller
|
||
@RequestMapping("/greenFaultRepairInfo")
|
||
public class GreenFaultRepairInfoController extends GreenBaseController {
|
||
/**
|
||
* 故障报修service
|
||
*/
|
||
@Resource
|
||
private IGreenFaultRepairInfoBizc greenfaultrepairinfoBizc;
|
||
/**
|
||
* 我的申请service
|
||
*/
|
||
@Resource
|
||
private IGreenApplyListBizc greenApplyListBizc;
|
||
/**
|
||
* 用户controller
|
||
*/
|
||
@Resource
|
||
private GreenUserInfoController greenUserInfoController;
|
||
/**
|
||
* 保存图片controller
|
||
*/
|
||
@Resource
|
||
private GreenImageInfoController greenImageInfoController;
|
||
|
||
@Resource
|
||
private AliasManageController aliasManageController;
|
||
|
||
/**
|
||
* HibernateDao逻辑构件
|
||
*/
|
||
@Autowired
|
||
IHibernateDao hibernateDao;
|
||
@Autowired
|
||
private BaseServiceImpl baseService;
|
||
|
||
@Resource
|
||
private IGreenOperateLogBizc greenOperateLogBizc;
|
||
|
||
@Autowired
|
||
private IGreenApplyBizc greenApplyBizc;
|
||
|
||
@Resource
|
||
private WechatService wService;
|
||
/**
|
||
* 获取故障报修选项数据
|
||
* @return
|
||
*/
|
||
@SuppressWarnings("unchecked")
|
||
@RequestMapping(value = "/getBasicInfo", method = RequestMethod.POST)
|
||
public @ResponseBody RestResult getBasicInfo() {
|
||
try {
|
||
String[] arr = null;
|
||
//查询故障报修选项数据
|
||
String sql = " SELECT di.data_code as \"data_code\",di.data_value as \"data_value\" FROM GREEN_DICTIONARY_INFO di WHERE di.data_type = 'repairOption' AND di.is_deleted = 'N'";
|
||
//执行sql
|
||
List<Map<String, Object>> list = hibernateDao.queryForListWithSql(sql);
|
||
for(Map<String, Object> map:list){
|
||
arr = map.get("data_value").toString().split("(");
|
||
if(arr.length>1){
|
||
map.put("data_value", arr[0]);
|
||
map.put("more", "("+arr[1]);
|
||
}else{
|
||
map.put("more", "");
|
||
}
|
||
}
|
||
//返回结果
|
||
return new RestResult(Constant.SUCCESS,"",list);
|
||
} catch (Exception e) {
|
||
e.printStackTrace();
|
||
return new RestResult(Constant.FAILED,"操作失败,请联系管理员!");
|
||
}
|
||
}
|
||
|
||
/**
|
||
* 保存故障报修申请信息
|
||
* @param greenTempParkInfo
|
||
* @return
|
||
*/
|
||
@SuppressWarnings("unchecked")
|
||
@Transactional(rollbackFor=Exception.class)
|
||
@RequestMapping(value = "/saveFaultRepairInfo", method = RequestMethod.POST)
|
||
public @ResponseBody RestResult saveFaultRepairInfo(@RequestBody Object requestBody){
|
||
GreenFaultRepairInfo greenFaultRepairInfo = new ObjectMapper().convertValue(requestBody, new TypeReference<GreenFaultRepairInfo>() {});
|
||
try {
|
||
String userId = greenFaultRepairInfo.getUserId();
|
||
GreenUserInfo info = getUserInfo(userId);
|
||
if(info==null){
|
||
return new RestResult(Constant.FAILED, "非法用户");
|
||
}
|
||
//校验
|
||
//ServiceValidatorUtil.validatorJavaBean(greenFaultRepairInfo);
|
||
GreenUserInfo greenUserInfo = greenUserInfoController.queryInfoById(greenFaultRepairInfo.getUserId());
|
||
//根据故障报修选项code查询故障报修值
|
||
String sql = "select * from green_repair_items where code = ? and is_deleted='N'";
|
||
//执行sql
|
||
List<Map<String, Object>> repairOptionList = hibernateDao.queryForListWithSql(sql, new Object[]{greenFaultRepairInfo.getRepairOption()});
|
||
if(repairOptionList.size()<=0){
|
||
return new RestResult(Constant.FAILED, "报修选项有误,请联系管理员");
|
||
}
|
||
//报修部门id
|
||
// greenFaultRepairInfo.setRepairDeptId(greenUserInfo.getDepartmentId());
|
||
// //报修部门名称
|
||
// greenFaultRepairInfo.setRepairDeptName(greenUserInfo.getDepartmentName());
|
||
//报修人id
|
||
greenFaultRepairInfo.setRepairPersonId(greenFaultRepairInfo.getUserId());
|
||
//报修人姓名
|
||
greenFaultRepairInfo.setRepairPersonName(greenUserInfo.getRealName());
|
||
//故障图片1
|
||
greenFaultRepairInfo.setFaultPic1(greenFaultRepairInfo.getFaultPic1());
|
||
//增加处理人
|
||
greenFaultRepairInfo.setPersonId(greenFaultRepairInfo.getPersonId());
|
||
greenFaultRepairInfo.setRepairStatus(0);
|
||
greenFaultRepairInfo.setEndRemind(0);
|
||
greenFaultRepairInfo.setIsEvaluate(0);
|
||
//greenFaultRepairInfo.setUrgent(0);
|
||
if(greenFaultRepairInfo.getUrgent()==1||repairOptionList.get(0).get("out_pack").toString().equals("1")){
|
||
greenFaultRepairInfo.setRepairStatus(1);
|
||
greenFaultRepairInfo.setAcceptDate(new Date());
|
||
}
|
||
boolean flag1=true;
|
||
boolean flag2=true;
|
||
boolean flag3=true;
|
||
String uuid = "";
|
||
// if(greenFaultRepairInfo.getFaultPic1()!=null&&!"".equals(greenFaultRepairInfo.getFaultPic1())){
|
||
// SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
||
// String date = sdf.format(new Date()) + "/";
|
||
//
|
||
//// uuid = date + UUID.randomUUID().toString().replaceAll("-","");
|
||
// uuid=greenImageInfoController.saveImage(greenFaultRepairInfo.getFaultPic1(), userId);
|
||
// flag1=baseService.saveImgToIO(uuid+Constant.IMG_SUFFIX, greenFaultRepairInfo.getFaultPic1());
|
||
// greenFaultRepairInfo.setFaultPic1(uuid+Constant.IMG_SUFFIX);
|
||
// greenFaultRepairInfo.setFaultPic1Data(uuid);
|
||
// }
|
||
// //故障图片2
|
||
// greenFaultRepairInfo.setFaultPic2(greenFaultRepairInfo.getFaultPic2());
|
||
// if(greenFaultRepairInfo.getFaultPic2()!=null&&!"".equals(greenFaultRepairInfo.getFaultPic2())){
|
||
//
|
||
// SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
||
// String date = sdf.format(new Date()) + "/";
|
||
//
|
||
//// uuid = date + UUID.randomUUID().toString().replaceAll("-","");
|
||
//
|
||
//// uuid = UUID.randomUUID().toString().replaceAll("-","");
|
||
// uuid=greenImageInfoController.saveImage(greenFaultRepairInfo.getFaultPic2(), userId);
|
||
// flag2=baseService.saveImgToIO(uuid+Constant.IMG_SUFFIX, greenFaultRepairInfo.getFaultPic2());
|
||
// greenFaultRepairInfo.setFaultPic2(uuid+Constant.IMG_SUFFIX);
|
||
// greenFaultRepairInfo.setFaultPic2Data(uuid);
|
||
// }
|
||
// //故障图片3
|
||
// greenFaultRepairInfo.setFaultPic3(greenFaultRepairInfo.getFaultPic3());
|
||
// if(greenFaultRepairInfo.getFaultPic3()!=null&&!"".equals(greenFaultRepairInfo.getFaultPic3())){
|
||
//
|
||
// SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
||
// String date = sdf.format(new Date()) + "/";
|
||
//
|
||
//// uuid = date + UUID.randomUUID().toString().replaceAll("-","");
|
||
////
|
||
//// uuid = UUID.randomUUID().toString().replaceAll("-","");
|
||
// uuid=greenImageInfoController.saveImage(greenFaultRepairInfo.getFaultPic3(), userId);
|
||
// flag3=baseService.saveImgToIO(uuid+Constant.IMG_SUFFIX, greenFaultRepairInfo.getFaultPic3());
|
||
// greenFaultRepairInfo.setFaultPic3(uuid+Constant.IMG_SUFFIX);
|
||
// greenFaultRepairInfo.setFaultPic3Data(uuid);
|
||
// }
|
||
// if(greenFaultRepairInfo.getFaultPic4()!=null&&!"".equals(greenFaultRepairInfo.getFaultPic4())){
|
||
//
|
||
// SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
||
// String date = sdf.format(new Date()) + "/";
|
||
//
|
||
//// uuid = date + UUID.randomUUID().toString().replaceAll("-","");
|
||
////
|
||
//// uuid = UUID.randomUUID().toString().replaceAll("-","");
|
||
// uuid=greenImageInfoController.saveImage(greenFaultRepairInfo.getFaultPic4(), userId);
|
||
// flag3=baseService.saveImgToIO(uuid+Constant.IMG_SUFFIX, greenFaultRepairInfo.getFaultPic4());
|
||
// greenFaultRepairInfo.setFaultPic4(uuid+Constant.IMG_SUFFIX);
|
||
// greenFaultRepairInfo.setFaultPic4Data(uuid);
|
||
// }
|
||
// if(greenFaultRepairInfo.getFaultPic5()!=null&&!"".equals(greenFaultRepairInfo.getFaultPic5())){
|
||
//
|
||
// SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
||
// String date = sdf.format(new Date()) + "/";
|
||
//
|
||
//// uuid = date + UUID.randomUUID().toString().replaceAll("-","");
|
||
////
|
||
//// uuid = UUID.randomUUID().toString().replaceAll("-","");
|
||
// uuid=greenImageInfoController.saveImage(greenFaultRepairInfo.getFaultPic5(), userId);
|
||
// flag3=baseService.saveImgToIO(uuid+Constant.IMG_SUFFIX, greenFaultRepairInfo.getFaultPic5());
|
||
// greenFaultRepairInfo.setFaultPic5(uuid+Constant.IMG_SUFFIX);
|
||
// greenFaultRepairInfo.setFaultPic5Data(uuid);
|
||
// }
|
||
// if(greenFaultRepairInfo.getFaultPic6()!=null&&!"".equals(greenFaultRepairInfo.getFaultPic6())){
|
||
//
|
||
// SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
||
// String date = sdf.format(new Date()) + "/";
|
||
//
|
||
//// uuid = date + UUID.randomUUID().toString().replaceAll("-","");
|
||
////
|
||
//// uuid = UUID.randomUUID().toString().replaceAll("-","");
|
||
// uuid=greenImageInfoController.saveImage(greenFaultRepairInfo.getFaultPic6(), userId);
|
||
// flag3=baseService.saveImgToIO(uuid+Constant.IMG_SUFFIX, greenFaultRepairInfo.getFaultPic6());
|
||
// greenFaultRepairInfo.setFaultPic6(uuid+Constant.IMG_SUFFIX);
|
||
// greenFaultRepairInfo.setFaultPic6Data(uuid);
|
||
// }
|
||
//三个都成功则为1 否则为0靠定时重新保存
|
||
greenFaultRepairInfo.setImgStatus((flag1&&flag2&&flag3)?1:0);
|
||
greenFaultRepairInfo.setRepairTime(new SimpleDateFormat(DateUtil.Y_M_DH_MI_S).format(new Date()));
|
||
greenFaultRepairInfo.setCreator(greenFaultRepairInfo.getUserId().toString());
|
||
greenFaultRepairInfo.setModifier(greenFaultRepairInfo.getUserId().toString());
|
||
greenFaultRepairInfo.setGmtCreated(new Date());
|
||
greenFaultRepairInfo.setGmtModified(new Date());
|
||
greenFaultRepairInfo.setIsDeleted("N");
|
||
//添加故障报修信息到故障报修信息表
|
||
greenfaultrepairinfoBizc.add(greenFaultRepairInfo);
|
||
|
||
GreenApply apply = new GreenApply();
|
||
apply.setUserId(greenFaultRepairInfo.getUserId());
|
||
apply.setDetailId(greenFaultRepairInfo.getId());
|
||
apply.setApplyTime(new Date());
|
||
apply.setApplyType(Constant.FAULT_REPAIR_APPLY);
|
||
apply.setApplyTypeName("故障报修");
|
||
apply.setInfo1(repairOptionList.get(0).get("name").toString());
|
||
apply.setInfo2(greenFaultRepairInfo.getRepairAddr());
|
||
apply.setDelFlag("0");
|
||
apply.setCurVerifyLevel("0");
|
||
apply.setNeedVerifyLevel("0");
|
||
apply.setRefuseLevel("0");
|
||
apply.setStatus(Constant.ACCEPT_DOING);
|
||
apply.setUpdTime(new Date());
|
||
// GreenApply gApply = greenApplyBizc.add(apply);
|
||
hibernateDao.saveObject(apply);
|
||
|
||
String title="报修服务";
|
||
String text = "您好,您的报修服务已成功提交,请点击查看。";
|
||
String url = "/pages/malfunc-repair/malfunc-repair?currentTabIndex=1";
|
||
Integer faultType = greenFaultRepairInfo.getFaultType();
|
||
Integer isInspection = greenFaultRepairInfo.getIsInspection();
|
||
if(isInspection==1){
|
||
title = "外包考核";
|
||
text = "您好,您的外包考核已成功提交,请点击查看。";
|
||
url = "/pages/malfunc-check/malfunc-check?currentTabIndex=1";
|
||
aliasManageController.pushToSingle(userId, title, text, url);
|
||
|
||
String role = "16002";//报修受理权限
|
||
String getUserSql = "SELECT u.id,u.ISC_ID FROM green_user_info u "
|
||
+ " LEFT JOIN green_user_role_rel r ON u.id = r.user_id "
|
||
+ " LEFT JOIN green_role_permission p ON p.role_id = r.role_id "
|
||
+ " WHERE p.permission_id = ? ";
|
||
List<Map<String,Object>> userList2 = hibernateDao.queryForListWithSql(getUserSql, new Object[]{role});
|
||
title = "报修受理";
|
||
text = "您好,您有新的外包考核需要受理,请点击查看。";
|
||
url = "/pages/malfunc-repair/repair-record";
|
||
aliasManageController.pushToSingleBatch(userList2, title, text, url);
|
||
}else if(isInspection==0){
|
||
if(faultType==1){
|
||
title = "报事服务";
|
||
text = "您好,您的报事服务已成功提交,请点击查看。";
|
||
url = "/pages/malfunc-repair/malfunc-repair?faultType=1¤tTabIndex=1";
|
||
aliasManageController.pushToSingle(userId, title, text, url);
|
||
String role = "16005";//报修受理权限
|
||
String getUserSql = "SELECT u.id,u.ISC_ID FROM green_user_info u "
|
||
+ " LEFT JOIN green_user_role_rel r ON u.id = r.user_id "
|
||
+ " LEFT JOIN green_role_permission p ON p.role_id = r.role_id "
|
||
+ " WHERE p.permission_id = ? ";
|
||
List<Map<String,Object>> userList2 = hibernateDao.queryForListWithSql(getUserSql, new Object[]{role});
|
||
title = "报事受理";
|
||
text = "您好,您有新的报事需要受理,请点击查看。";
|
||
url = "/pages/malfunc-repair/repair-record?faultType=1";
|
||
aliasManageController.pushToSingleBatch(userList2, title, text, url);
|
||
}else{
|
||
aliasManageController.pushToSingle(userId, title, text, url);
|
||
|
||
String role = "16002";//报修受理权限
|
||
String getUserSql = "SELECT u.id,u.ISC_ID FROM green_user_info u "
|
||
+ " LEFT JOIN green_user_role_rel r ON u.id = r.user_id "
|
||
+ " LEFT JOIN green_role_permission p ON p.role_id = r.role_id "
|
||
+ " WHERE p.permission_id = ? ";
|
||
List<Map<String,Object>> userList2 = hibernateDao.queryForListWithSql(getUserSql, new Object[]{role});
|
||
title = "报修受理";
|
||
text = "您好,您有新的报修需要受理,请点击查看。";
|
||
url = "/pages/malfunc-repair/repair-record";
|
||
aliasManageController.pushToSingleBatch(userList2, title, text, url);
|
||
}
|
||
}
|
||
|
||
|
||
|
||
|
||
return new RestResult(Constant.SUCCESS, "提交成功");
|
||
//添加故障报修信息到申请信息list表
|
||
// GreenApplyList list = new GreenApplyList();
|
||
//申请人id
|
||
// list.setUserId(greenFaultRepairInfo.getUserId());
|
||
//申请事项详情ID
|
||
// list.setDetailId(greenFaultRepairInfo.getId());
|
||
//申请类型
|
||
// list.setApplyType("05");
|
||
//申请类型名称
|
||
// list.setApplyTypeName("故障报修");
|
||
//申请详情1(报修选项)
|
||
// list.setApplyInfo1(repairOptionList.get(0).get("data_value").toString());
|
||
//申请详情2(故障位置)
|
||
// list.setApplyInfo2(greenFaultRepairInfo.getRepairAddr());
|
||
//一级审批部门
|
||
// if("1".equals(greenFaultRepairInfo.getRepairOption())||
|
||
// "2".equals(greenFaultRepairInfo.getRepairOption())||
|
||
// "3".equals(greenFaultRepairInfo.getRepairOption())||
|
||
// "7".equals(greenFaultRepairInfo.getRepairOption())){
|
||
// list.setFirstApproval(ApplyRoleConstant.FAULT_REPAIR_APPROVE_PROJECT);
|
||
// }else if("4".equals(greenFaultRepairInfo.getRepairOption())){
|
||
// list.setFirstApproval(ApplyRoleConstant.FAULT_REPAIR_APPROVE_CSD);
|
||
// }else if("5".equals(greenFaultRepairInfo.getRepairOption())||
|
||
// "6".equals(greenFaultRepairInfo.getRepairOption())){
|
||
// list.setFirstApproval(ApplyRoleConstant.FAULT_REPAIR_APPROVE_SECURITY);
|
||
// }else if("8".equals(greenFaultRepairInfo.getRepairOption())){
|
||
// list.setFirstApproval(ApplyRoleConstant.FAULT_REPAIR_APPROVE_PROPERTY);
|
||
// }
|
||
//一级审批状态
|
||
// list.setFirstStatus(Constant.ACCEPT_DOING);
|
||
//申请时间
|
||
// list.setApplyTime(greenFaultRepairInfo.getRepairTime());
|
||
//创建者
|
||
// list.setCreator(greenFaultRepairInfo.getUserId().toString());
|
||
//修改者
|
||
// list.setModifier(greenFaultRepairInfo.getUserId().toString());
|
||
//创建时间
|
||
// list.setGmtCreated(new Date());
|
||
//修改时间
|
||
// list.setGmtModified(new Date());
|
||
//删除标识
|
||
// list.setIsDeleted("N");
|
||
//添加申请到申请list表
|
||
// greenApplyListBizc.add(list);
|
||
|
||
} catch (ServiceValidatorBaseException e) {
|
||
e.printStackTrace();
|
||
return new RestResult(Constant.FAILED,e.getMessage());
|
||
} catch (Exception e) {
|
||
e.printStackTrace();
|
||
return new RestResult(Constant.FAILED, "上报失败,请重试");
|
||
}
|
||
}
|
||
|
||
/**
|
||
* 根据id查询故障报修申请详情
|
||
* @param id
|
||
* @param applyType
|
||
* @return
|
||
*/
|
||
@SuppressWarnings("unchecked")
|
||
public List<Object> getFaultRepairInfo(String id,String applyType) {
|
||
// String applyInfoByIdSql = " SELECT fri.*,al.detail_id,al.apply_type,al.apply_type_name,al.first_approval,al.first_status,al.first_approve_time,di.data_value,"
|
||
// + " gii1.image_content AS pic1,gii2.image_content AS pic2,gii3.image_content AS pic3,"
|
||
// + " CASE first_status WHEN '10' THEN '待接受' WHEN '11' THEN '已接受' END AS first_status_value"
|
||
// + " FROM GREEN_FAULT_REPAIR_INFO fri INNER JOIN GREEN_APPLY_LIST al ON fri.id = al.detail_id"
|
||
// + " INNER JOIN GREEN_DICTIONARY_INFO di ON fri.repair_option = di.data_code AND di.data_type = 'repairOption'"
|
||
// + " LEFT JOIN GREEN_IMAGE_INFO gii1 ON fri.fault_pic1 = gii1.id"
|
||
// + " LEFT JOIN GREEN_IMAGE_INFO gii2 ON fri.fault_pic2 = gii2.id"
|
||
// + " LEFT JOIN GREEN_IMAGE_INFO gii3 ON fri.fault_pic3 = gii3.id"
|
||
// + " WHERE fri.id = ? AND al.apply_type = ?";
|
||
String applyInfoByIdSql = " SELECT fri.*,al.detail_id,al.apply_type,al.apply_type_name,al.first_approval,al.first_status,al.first_approve_time,di.data_value,"
|
||
+ " fri.fault_pic1 AS pic1,fri.fault_pic2 AS pic2,fri.fault_pic3 AS pic3,"
|
||
+ " fri.fault_pic4 AS pic4,fri.fault_pic5 AS pic5,fri.fault_pic6 AS pic6,"
|
||
+ " CASE first_status WHEN '10' THEN '待接受' WHEN '11' THEN '已接受' END AS first_status_value"
|
||
+ " FROM GREEN_FAULT_REPAIR_INFO fri INNER JOIN GREEN_APPLY_LIST al ON fri.id = al.detail_id"
|
||
+ " INNER JOIN GREEN_DICTIONARY_INFO di ON fri.repair_option = di.data_code AND di.data_type = 'repairOption'"
|
||
// + " LEFT JOIN GREEN_IMAGE_INFO gii1 ON fri.fault_pic1 = gii1.id"
|
||
// + " LEFT JOIN GREEN_IMAGE_INFO gii2 ON fri.fault_pic2 = gii2.id"
|
||
// + " LEFT JOIN GREEN_IMAGE_INFO gii3 ON fri.fault_pic3 = gii3.id"
|
||
+ " WHERE fri.id = ? AND al.apply_type = ?";
|
||
List<Object> list=hibernateDao.queryForListWithSql(applyInfoByIdSql,new Object[]{id,applyType});
|
||
for (Object object : list) {
|
||
Map map=(Map)object;
|
||
String pic1= baseService.getImageBase64(String.valueOf(map.get("pic1")));
|
||
String pic2= baseService.getImageBase64(String.valueOf(map.get("pic2")));
|
||
String pic3= baseService.getImageBase64(String.valueOf(map.get("pic3")));
|
||
String pic4= baseService.getImageBase64(String.valueOf(map.get("pic4")));
|
||
String pic5= baseService.getImageBase64(String.valueOf(map.get("pic5")));
|
||
String pic6= baseService.getImageBase64(String.valueOf(map.get("pic6")));
|
||
map.put("pic1", pic1);
|
||
map.put("pic2", pic2);
|
||
map.put("pic3", pic3);
|
||
map.put("pic4", pic4);
|
||
map.put("pic5", pic5);
|
||
map.put("pic6", pic6);
|
||
|
||
}
|
||
return list;
|
||
}
|
||
/**
|
||
* 查询处理人
|
||
* @param requestBody
|
||
* @return
|
||
*/
|
||
@RequestMapping(value = "/queryPerson", method = RequestMethod.POST)
|
||
@ResponseBody
|
||
public RestResult queryPerson(@RequestBody Object requestBody) {
|
||
|
||
try {
|
||
Map<String, Object> map = new ObjectMapper().convertValue(requestBody, new TypeReference<Map<String, Object>>(){});
|
||
String userId = map.get("userId") == null || "".equals(map.get("userId")) ? null : map.get("userId").toString();
|
||
//String data_type = map.get("data_type") == null || "".equals(map.get("data_type")) ? "repairRoleIn" : map.get("data_type").toString();
|
||
GreenUserInfo info = getUserInfo(userId);
|
||
if (info == null) {
|
||
return new RestResult(Constant.FAILED, "非法用户");
|
||
}
|
||
StringBuffer sql = new StringBuffer();
|
||
sql.append("SELECT u.id, concat( SUBSTRING( u.real_name, 1, (LENGTH(u.real_name) / 3) - 1 ), '*' ) name FROM green_user_info u LEFT JOIN green_user_role_rel rel ON u.id = rel.user_id "
|
||
+ " LEFT JOIN green_dictionary_info d ON d.data_code = rel.role_id WHERE d.data_type = 'repairRoleIn' AND u.id NOT IN ( SELECT DISTINCT person_id FROM green_fault_repair_info WHERE repair_status = 1 AND person_id IS NOT NULL )" );
|
||
List<Map<String,Object>> list = hibernateDao.queryForListWithSql(sql.toString());
|
||
return new RestResult(Constant.SUCCESS,"成功",list);
|
||
} catch (Exception e) {
|
||
return new RestResult(Constant.FAILED, "查询失败");
|
||
}
|
||
|
||
}
|
||
|
||
/**用户订单列表*/
|
||
@RequestMapping(value="/getMyFaultRepairList", method = RequestMethod.POST)
|
||
@ResponseBody
|
||
public RestResult getMyFaultRepairList(@RequestBody GreenFaultRepairInfo greenFaultRepairInfo){
|
||
|
||
try {
|
||
String userId = greenFaultRepairInfo.getUserId();
|
||
GreenUserInfo info = getUserInfo(userId);
|
||
if(info==null){
|
||
return new RestResult(Constant.FAILED, "非法用户");
|
||
}
|
||
StringBuffer sb = new StringBuffer();
|
||
Integer faultType = greenFaultRepairInfo.getFaultType();
|
||
|
||
Integer isInspection = greenFaultRepairInfo.getIsInspection();
|
||
|
||
String repairOption = greenFaultRepairInfo.getRepairOption();
|
||
String repairOptionSub = greenFaultRepairInfo.getRepairOptionSub();
|
||
String startDate = greenFaultRepairInfo.getStartDate();
|
||
String endDate = greenFaultRepairInfo.getEndDate();
|
||
List<Object> plist = new ArrayList<Object>();
|
||
//分页信息
|
||
int pageSize = greenFaultRepairInfo.getPageSize();
|
||
int pageNum = greenFaultRepairInfo.getPageNum();
|
||
//page = (page-1) * pageSize;
|
||
int limit = ((pageNum > 0 ? pageNum : 1) - 1) * pageSize;
|
||
pageSize = pageSize*pageNum;
|
||
//查询订单
|
||
sb.append("select * from (select rn.*, rownum rw from ("
|
||
+ "Select r.id as \"id\", r.repair_dept_id as \"repair_dept_id\", r.repair_dept_name as \"repair_dept_name\", "
|
||
+ "r.repair_person_id as \"repair_person_id\", r.repair_person_name as \"repair_person_name\","
|
||
+ "r.repair_person_phone as \"repair_person_phone\",r.person_id as \"person_id\",r.repair_option as \"repair_option\","
|
||
+ "r.repair_addr as \"repair_addr\",r.fault_detail as \"fault_detail\",r.fault_pic1 as \"fault_pic1\","
|
||
+ "r.fault_pic2 as \"fault_pic2\",r.fault_pic3 as \"fault_pic3\",r.repair_time as \"repair_time\","
|
||
+ "r.user_id as \"user_id\",r.creator as \"creator\",r.modifier as \"modifier\",r.gmt_created as \"gmt_created\","
|
||
+ "r.gmt_modified as \"gmt_modified\",r.is_deleted as \"is_deleted\",r.fault_pic1_data as \"fault_pic1_data\","
|
||
+ "r.fault_pic2_data as \"fault_pic2_data\",r.fault_pic3_data as \"fault_pic3_data\",r.img_status as \"img_status\","
|
||
+ "r.repair_status as \"repair_status\",r.repair_place as \"repair_place\",r.urgent as \"urgent\","
|
||
+ "r.endremind as \"endremind\",r.is_evaluate as \"is_evaluate\",r.is_inspection as \"is_inspection\","
|
||
+ "r.repair_floor as \"repair_floor\",r.repair_room_no as \"repair_room_no\",r.repair_option_sub as \"repair_option_sub\","
|
||
+ "r.accept_date as \"accept_date\",r.finish_date as \"finish_date\",r.fault_type as \"fault_type\","
|
||
+ "r.reply_pic1 as \"reply_pic1\",r.reply_pic2 as \"reply_pic2\",r.reply_pic1_data as \"reply_pic1_data\","
|
||
+ "r.reply_pic2_data as \"reply_pic2_data\",r.reply_content as \"reply_content\",r.reply_date as \"reply_date\","
|
||
+ "r.reply_flag as \"reply_flag\",r.check_fraction as \"check_fraction\",r.fault_proposal as \"fault_proposal\","
|
||
+ "r.fault_evaluate as \"fault_evaluate\",r.wb_types as \"wb_types\",r.elevator_no as \"elevator_no\","
|
||
+ "r.fault_pic4 as \"fault_pic4\",r.fault_pic5 as \"fault_pic5\",r.fault_pic6 as \"fault_pic6\","
|
||
+ "r.fault_pic4_data as \"fault_pic4_data\",r.fault_pic5_data as \"fault_pic5_data\","
|
||
+ "r.fault_pic6_data as \"fault_pic6_data\",r.upload_file_ids as \"upload_file_ids\","
|
||
+ "r.replace_parts as \"replace_parts\",r.device_name as \"device_name\",r.arrival_time as \"arrival_time\", "
|
||
+ "u.real_name as \"person_name\",u.mobile as \"person_mobile\",i1.name as \"repair_option_name\","
|
||
+ "i2.name as \"repair_option_sub_name\" "
|
||
+ "from green_fault_repair_info r "
|
||
+ "left join green_user_Info u on r.person_id = u.id "
|
||
+ " left join green_repair_items i1 on r.repair_option = i1.code "
|
||
+ " left join green_repair_items i2 on r.repair_option_sub = i2.code "
|
||
+ " where r.is_deleted='N' and r.fault_type=? ");
|
||
plist.add(faultType);
|
||
if(isInspection==1){
|
||
sb.append(" and is_inspection=1 and r.user_id = ? ");
|
||
plist.add(userId);
|
||
}
|
||
if(isInspection==0){
|
||
sb.append(" and is_inspection=0 and r.user_id = ? ");
|
||
plist.add(userId);
|
||
}
|
||
if(isInspection==2){
|
||
sb.append(" and( is_inspection=2 or is_inspection=3) and r.user_id = ? ");
|
||
plist.add(userId);
|
||
}else{
|
||
|
||
}
|
||
if(!StringUtils.isEmpty(repairOption)){
|
||
sb.append(" and REPAIR_OPTION=? ");
|
||
plist.add(repairOption);
|
||
}
|
||
if(!StringUtils.isEmpty(repairOptionSub)&&!"-1".equals(repairOptionSub)){
|
||
sb.append(" and repair_option_sub=? ");
|
||
plist.add(repairOptionSub);
|
||
}
|
||
if(!StringUtils.isEmpty(startDate)){
|
||
startDate = startDate+" 00:00:00";
|
||
sb.append(" and r.repair_time>=? ");
|
||
plist.add(startDate);
|
||
}
|
||
if(!StringUtils.isEmpty(endDate)){
|
||
endDate = endDate+" 23:59:59";
|
||
sb.append(" and r.repair_time<=? ");
|
||
plist.add(endDate);
|
||
}
|
||
|
||
sb.append( " order by r.gmt_created desc ) rn) where rw > ? and rw<=? ");
|
||
plist.add(limit);
|
||
plist.add(pageSize);
|
||
List<Map<String,Object>> applyList = hibernateDao.queryForListWithSql(sb.toString()
|
||
,plist.toArray());
|
||
for (Map<String, Object> mapiMap : applyList) {
|
||
List<String> list = new ArrayList<String>();
|
||
String pic1 = baseService.getImageBase64((String) mapiMap.get("fault_pic1"));
|
||
if (pic1 != null && !"".equals(pic1)) {
|
||
list.add(pic1);
|
||
}
|
||
String pic2 = baseService.getImageBase64((String) mapiMap.get("fault_pic2"));
|
||
if (pic2 != null && !"".equals(pic2)) {
|
||
list.add(pic2);
|
||
}
|
||
String pic3 = baseService.getImageBase64((String) mapiMap.get("fault_pic3"));
|
||
if (pic3 != null && !"".equals(pic3)) {
|
||
list.add(pic3);
|
||
}
|
||
String pic4 = baseService.getImageBase64((String) mapiMap.get("fault_pic4"));
|
||
if (pic4 != null && !"".equals(pic4)) {
|
||
list.add(pic4);
|
||
}
|
||
String pic5 = baseService.getImageBase64((String) mapiMap.get("fault_pic5"));
|
||
if (pic5 != null && !"".equals(pic5)) {
|
||
list.add(pic5);
|
||
}
|
||
String pic6 = baseService.getImageBase64((String) mapiMap.get("fault_pic6"));
|
||
if (pic6 != null && !"".equals(pic6)) {
|
||
list.add(pic6);
|
||
}
|
||
|
||
mapiMap.put("pictures", list);
|
||
}
|
||
|
||
return new RestResult(Constant.SUCCESS,"成功",applyList);
|
||
}catch (ServiceValidatorBaseException e) {
|
||
throw e;
|
||
}catch (Exception e) {
|
||
e.printStackTrace();
|
||
return new RestResult(Constant.FAILED,"返回异常");
|
||
}
|
||
}
|
||
|
||
/**用户订单列表*/
|
||
@RequestMapping(value="/getSlFaultRepairList", method = RequestMethod.POST)
|
||
@ResponseBody
|
||
public RestResult getSlFaultRepairList(@RequestBody GreenFaultRepairInfo greenFaultRepairInfo){
|
||
|
||
try {
|
||
String userId = greenFaultRepairInfo.getUserId();
|
||
Integer repairStatus = greenFaultRepairInfo.getRepairStatus();
|
||
GreenUserInfo info = getUserInfo(userId);
|
||
if(info==null){
|
||
return new RestResult(Constant.FAILED, "非法用户");
|
||
}
|
||
StringBuffer sb = new StringBuffer();
|
||
//分页信息
|
||
Integer faultType = greenFaultRepairInfo.getFaultType();
|
||
int pageSize = greenFaultRepairInfo.getPageSize();
|
||
int page = greenFaultRepairInfo.getPageNum();
|
||
page = (page-1) * pageSize;
|
||
//查询订单
|
||
sb.append(" Select r.*,u.real_name as person_name,u.mobile as person_mobile, i1.name as repair_option_name,i2.name as repair_option_sub_name from green_fault_repair_info r "
|
||
+ "left join green_user_Info u on r.person_id = u.id "
|
||
+ " left join green_repair_items i1 on r.repair_option = i1.code "
|
||
+ " left join green_repair_items i2 on r.repair_option_sub = i2.code "
|
||
+ " where r.is_deleted='N' and r.repair_status=? and r.fault_Type=? order by r.urgent desc, r.gmt_created desc limit ?,? ");
|
||
List<Map<String,Object>> applyList = hibernateDao.queryForListWithSql(sb.toString()
|
||
,new Object[]{ repairStatus, faultType,page, pageSize});
|
||
for (Map<String, Object> mapiMap : applyList) {
|
||
List<String> list = new ArrayList<String>();
|
||
String pic1 = baseService.getImageBase64((String) mapiMap.get("fault_pic1"));
|
||
if (pic1 != null && !"".equals(pic1)) {
|
||
list.add(pic1);
|
||
}
|
||
String pic2 = baseService.getImageBase64((String) mapiMap.get("fault_pic2"));
|
||
if (pic2 != null && !"".equals(pic2)) {
|
||
list.add(pic2);
|
||
}
|
||
String pic3 = baseService.getImageBase64((String) mapiMap.get("fault_pic3"));
|
||
if (pic3 != null && !"".equals(pic3)) {
|
||
list.add(pic3);
|
||
}
|
||
String pic4 = baseService.getImageBase64((String) mapiMap.get("fault_pic4"));
|
||
if (pic4 != null && !"".equals(pic4)) {
|
||
list.add(pic4);
|
||
}
|
||
String pic5 = baseService.getImageBase64((String) mapiMap.get("fault_pic5"));
|
||
if (pic5 != null && !"".equals(pic5)) {
|
||
list.add(pic5);
|
||
}
|
||
String pic6 = baseService.getImageBase64((String) mapiMap.get("fault_pic6"));
|
||
if (pic6 != null && !"".equals(pic6)) {
|
||
list.add(pic6);
|
||
}
|
||
mapiMap.put("pictures", list);
|
||
}
|
||
|
||
return new RestResult(Constant.SUCCESS,"成功",applyList);
|
||
}catch (ServiceValidatorBaseException e) {
|
||
throw e;
|
||
}catch (Exception e) {
|
||
e.printStackTrace();
|
||
return new RestResult(Constant.FAILED,"返回异常");
|
||
}
|
||
}
|
||
|
||
/**用户订单列表*/
|
||
@RequestMapping(value="/chooseClPreson", method = RequestMethod.POST)
|
||
@ResponseBody
|
||
public RestResult chooseClPreson(@RequestBody GreenFaultRepairInfo greenFaultRepairInfo){
|
||
|
||
try {
|
||
String userId = greenFaultRepairInfo.getUserId();
|
||
String personId = greenFaultRepairInfo.getPersonId();
|
||
Long id = greenFaultRepairInfo.getId();
|
||
GreenUserInfo info = getUserInfo(userId);
|
||
|
||
if(info==null){
|
||
return new RestResult(Constant.FAILED, "非法用户");
|
||
}
|
||
GreenFaultRepairInfo greenFaultRepairInfo1 = greenfaultrepairinfoBizc.get(id);
|
||
greenFaultRepairInfo1.setPersonId(personId);
|
||
greenFaultRepairInfo1.setRepairStatus(1);//维修中
|
||
greenFaultRepairInfo1.setGmtModified(new Date());
|
||
greenFaultRepairInfo1.setModifier(userId);
|
||
greenFaultRepairInfo1.setAcceptDate(new Date());
|
||
greenfaultrepairinfoBizc.update(greenFaultRepairInfo1, id);
|
||
|
||
return new RestResult(Constant.SUCCESS,"成功选择处理人");
|
||
}catch (ServiceValidatorBaseException e) {
|
||
throw e;
|
||
}catch (Exception e) {
|
||
e.printStackTrace();
|
||
return new RestResult(Constant.FAILED,"选择处理人失败");
|
||
}
|
||
}
|
||
/**用户订单列表*/
|
||
@RequestMapping(value="/getClFaultRepairList", method = RequestMethod.POST)
|
||
@ResponseBody
|
||
public RestResult getClFaultRepairList(@RequestBody GreenFaultRepairInfo greenFaultRepairInfo){
|
||
|
||
try {
|
||
String userId = greenFaultRepairInfo.getUserId();
|
||
Integer repairStatus = greenFaultRepairInfo.getRepairStatus();
|
||
// GreenUserInfo info = getUserInfo(userId);
|
||
// if(info==null){
|
||
// return new RestResult(Constant.FAILED, "非法用户");
|
||
// }
|
||
String dicSql = "select data_type,data_code from green_dictionary_info where data_type='repairRoleIn' or data_type='repairRoleOut'";
|
||
List<Map<String,Object>> dicList = hibernateDao.queryForListWithSql(dicSql);
|
||
String roleSql = "select role_id from green_user_role_rel where user_id='"+userId+"'";
|
||
List<Map<String,Object>> roleList = hibernateDao.queryForListWithSql(roleSql);
|
||
String data_type="";
|
||
for(int i=0;i<roleList.size();i++){
|
||
String role_id = roleList.get(i).get("role_id").toString();
|
||
for(int j=0;j<dicList.size();j++){
|
||
String data_code = dicList.get(j).get("data_code").toString();
|
||
if(role_id.equals(data_code)){
|
||
data_type = dicList.get(j).get("data_type").toString();
|
||
break;
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
StringBuffer sb = new StringBuffer();
|
||
//分页信息
|
||
Integer faultType = greenFaultRepairInfo.getFaultType();
|
||
int pageSize = greenFaultRepairInfo.getPageSize();
|
||
int page = greenFaultRepairInfo.getPageNum();
|
||
page = (page-1) * pageSize;
|
||
//查询订单
|
||
sb.append(" Select r.*,i1.name as repair_option_name,i2.name as repair_option_sub_name ,u.real_name as person_name,u.mobile as person_mobile from green_fault_repair_info r "
|
||
+ " left join green_user_Info u on r.person_id = u.id "
|
||
+ " left join green_repair_items i1 on r.repair_option = i1.code "
|
||
+ " left join green_repair_items i2 on r.repair_option_sub = i2.code "
|
||
+ " where r.is_deleted='N' ");
|
||
if(repairStatus==2){
|
||
sb.append(" and r.person_id=? " );
|
||
}else if(repairStatus==1){
|
||
sb.append(" and (r.person_id=? or ( r.urgent=1 and r.person_id is null )) " );
|
||
}
|
||
if("repairRoleIn".equals(data_type)){
|
||
sb.append(" and i1.out_pack=0 " );
|
||
}else if("repairRoleOut".equals(data_type)){
|
||
sb.append(" and i1.out_pack=1 " );
|
||
}
|
||
|
||
|
||
sb.append( " and r.repair_status=? and r.fault_Type = ? order by r.urgent desc, r.gmt_created desc limit ?,? ");
|
||
@SuppressWarnings("unchecked")
|
||
List<Map<String,Object>> applyList = hibernateDao.queryForListWithSql(sb.toString(),new Object[]{userId, repairStatus,faultType, page, pageSize});
|
||
for (Map<String, Object> mapiMap : applyList) {
|
||
List<String> list = new ArrayList<String>();
|
||
String pic1 = baseService.getImageBase64((String) mapiMap.get("fault_pic1"));
|
||
if (pic1 != null && !"".equals(pic1)) {
|
||
list.add(pic1);
|
||
}
|
||
String pic2 = baseService.getImageBase64((String) mapiMap.get("fault_pic2"));
|
||
if (pic2 != null && !"".equals(pic2)) {
|
||
list.add(pic2);
|
||
}
|
||
String pic3 = baseService.getImageBase64((String) mapiMap.get("fault_pic3"));
|
||
if (pic3 != null && !"".equals(pic3)) {
|
||
list.add(pic3);
|
||
}
|
||
String pic4 = baseService.getImageBase64((String) mapiMap.get("fault_pic4"));
|
||
if (pic4 != null && !"".equals(pic4)) {
|
||
list.add(pic4);
|
||
}
|
||
String pic5 = baseService.getImageBase64((String) mapiMap.get("fault_pic5"));
|
||
if (pic5 != null && !"".equals(pic5)) {
|
||
list.add(pic5);
|
||
}
|
||
String pic6 = baseService.getImageBase64((String) mapiMap.get("fault_pic6"));
|
||
if (pic6 != null && !"".equals(pic6)) {
|
||
list.add(pic6);
|
||
}
|
||
mapiMap.put("pictures", list);
|
||
}
|
||
|
||
return new RestResult(Constant.SUCCESS,"成功",applyList);
|
||
}catch (ServiceValidatorBaseException e) {
|
||
throw e;
|
||
}catch (Exception e) {
|
||
e.printStackTrace();
|
||
return new RestResult(Constant.FAILED,"返回异常");
|
||
}
|
||
}
|
||
/**用户订单列表*/
|
||
@RequestMapping(value="/submitFinish", method = RequestMethod.POST)
|
||
@ResponseBody
|
||
public RestResult submitFinish(@RequestBody GreenFaultRepairInfo greenFaultRepairInfo){
|
||
|
||
try {
|
||
String userId = greenFaultRepairInfo.getUserId();
|
||
Long id = greenFaultRepairInfo.getId();
|
||
GreenUserInfo info = getUserInfo(userId);
|
||
|
||
if(info==null){
|
||
return new RestResult(Constant.FAILED, "非法用户");
|
||
}
|
||
GreenFaultRepairInfo greenFaultRepairInfo1 = greenfaultrepairinfoBizc.get(id);
|
||
greenFaultRepairInfo1.setRepairStatus(2);//已维修
|
||
greenFaultRepairInfo1.setEndRemind(1);
|
||
greenFaultRepairInfo1.setPersonId(userId);
|
||
greenFaultRepairInfo1.setFinishDate(new Date());
|
||
greenfaultrepairinfoBizc.update(greenFaultRepairInfo1, id);
|
||
String remindUserId = greenFaultRepairInfo1.getRepairPersonId();
|
||
GreenUserInfo userInfo = getUserInfo(remindUserId);
|
||
GreenUserInfo serviceUser = getUserInfo(userId);
|
||
|
||
//根据故障报修选项code查询故障报修值
|
||
String sql = "select * from green_repair_items where code=?";
|
||
//执行sql
|
||
List<Map<String, Object>> repairOptionList = hibernateDao.queryForListWithSql(sql, new Object[]{greenFaultRepairInfo1.getRepairOption()});
|
||
String serviceName="其他";
|
||
if(repairOptionList.size()>0){
|
||
serviceName = repairOptionList.get(0).get("name").toString();
|
||
}
|
||
|
||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
||
String openIdString = userInfo.getWxOpenId();//"ovRg7w6EjCMt-awFx7TLKz9lAj4U";//
|
||
Map<String, ContentVo> dataMap = new HashMap<String, ContentVo>();
|
||
dataMap.put("first", new ContentVo("您好!您的服务报修已维修,诚邀您参与此次维修的评价!", "#173177"));
|
||
dataMap.put("keyword1", new ContentVo(serviceUser.getRealName(), "#black"));
|
||
dataMap.put("keyword2", new ContentVo(serviceName, "#black"));
|
||
dataMap.put("remark", new ContentVo("感谢您的参于与支持", "#173177"));
|
||
wService.publishMsg(dataMap, openIdString,6);
|
||
|
||
return new RestResult(Constant.SUCCESS,"维修完成");
|
||
}catch (ServiceValidatorBaseException e) {
|
||
throw e;
|
||
}catch (Exception e) {
|
||
e.printStackTrace();
|
||
return new RestResult(Constant.FAILED,"返回异常");
|
||
}
|
||
}
|
||
|
||
/**用户订单列表*/
|
||
@RequestMapping(value="/submitUrgent", method = RequestMethod.POST)
|
||
@ResponseBody
|
||
public RestResult submitUrgent(@RequestBody GreenFaultRepairInfo greenFaultRepairInfo){
|
||
|
||
try {
|
||
String userId = greenFaultRepairInfo.getUserId();
|
||
Long id = greenFaultRepairInfo.getId();
|
||
GreenUserInfo info = getUserInfo(userId);
|
||
|
||
if(info==null){
|
||
return new RestResult(Constant.FAILED, "非法用户");
|
||
}
|
||
GreenFaultRepairInfo greenFaultRepairInfo1 = greenfaultrepairinfoBizc.get(id);
|
||
greenFaultRepairInfo1.setUrgent(1);
|
||
greenFaultRepairInfo1.setRepairStatus(1);//已维修
|
||
greenfaultrepairinfoBizc.update(greenFaultRepairInfo1, id);
|
||
|
||
return new RestResult(Constant.SUCCESS,"已加急");
|
||
}catch (ServiceValidatorBaseException e) {
|
||
throw e;
|
||
}catch (Exception e) {
|
||
e.printStackTrace();
|
||
return new RestResult(Constant.FAILED,"返回异常");
|
||
}
|
||
}
|
||
/**用户订单列表*/
|
||
@RequestMapping(value="/getFaultRepairByParentCode", method = RequestMethod.POST)
|
||
@ResponseBody
|
||
public RestResult getFaultRepairByParentCode(@RequestBody Result result){
|
||
|
||
try {
|
||
String parentCode = result.getParentCode();
|
||
Integer itemType = result.getItemType();
|
||
String sql = "select id as \"id\", code as \"code\", parent_code as \"parent_code\", name as \"name\", sub_name as \"sub_name\", data_sort as \"data_sort\", is_deleted as \"is_deleted\", out_pack as \"out_pack\", item_type as \"item_type\", company as \"company\", payment_method as \"payment_method\" "
|
||
+ "from green_repair_items where parent_code=? and is_deleted='N' and item_type=? order by data_sort ";
|
||
List<Map<String,Object>> list = hibernateDao.queryForListWithSql(sql,new Object[]{parentCode,itemType});
|
||
return new RestResult(Constant.SUCCESS,"成功",list);
|
||
}catch (ServiceValidatorBaseException e) {
|
||
throw e;
|
||
}catch (Exception e) {
|
||
e.printStackTrace();
|
||
return new RestResult(Constant.FAILED,"返回异常");
|
||
}
|
||
}
|
||
|
||
/**用户订单列表*/
|
||
@RequestMapping(value="/getFaultRepairAll", method = RequestMethod.POST)
|
||
@ResponseBody
|
||
public RestResult getFaultRepairAll(@RequestBody Result result){
|
||
|
||
try {
|
||
Integer itemType = result.getItemType();
|
||
String sql = "select name as \"name\",code as \"code\" from green_repair_items where parent_code=0 and is_deleted='N' and item_type=? order by data_sort ";
|
||
List<Map<String,Object>> list = hibernateDao.queryForListWithSql(sql,new Object[]{itemType});
|
||
for(int i=0;i<list.size();i++){
|
||
Map<String,Object> mObj = list.get(i);
|
||
String code = mObj.get("code").toString();
|
||
String childSql = "select name as \"name\",code as \"code\" from green_repair_items where parent_code=? and is_deleted='N' order by data_sort ";
|
||
List<Map<String,Object>> childList = hibernateDao.queryForListWithSql(childSql,new Object[]{code});
|
||
Map<String,Object> index0 = new HashMap<String,Object>();
|
||
index0.put("name", "全部");
|
||
index0.put("code", "-1");
|
||
|
||
childList.add(0,index0);
|
||
mObj.put("child", childList);
|
||
}
|
||
|
||
return new RestResult(Constant.SUCCESS,"成功",list);
|
||
}catch (ServiceValidatorBaseException e) {
|
||
throw e;
|
||
}catch (Exception e) {
|
||
e.printStackTrace();
|
||
return new RestResult(Constant.FAILED,"返回异常");
|
||
}
|
||
}
|
||
|
||
@RequestMapping(value="/getFaultListByReply", method = RequestMethod.POST)
|
||
@ResponseBody
|
||
public RestResult getFaultListByReply(@RequestBody GreenFaultRepairInfo greenFaultRepairInfo){
|
||
|
||
try {
|
||
String userId = greenFaultRepairInfo.getUserId();
|
||
Integer faultType = greenFaultRepairInfo.getFaultType();
|
||
Integer isInspection = greenFaultRepairInfo.getIsInspection();
|
||
String startDate = greenFaultRepairInfo.getStartDate();
|
||
String endDate = greenFaultRepairInfo.getEndDate();
|
||
|
||
GreenUserInfo info = getUserInfo(userId);
|
||
if(info==null){
|
||
return new RestResult(Constant.FAILED, "非法用户");
|
||
}
|
||
StringBuffer sb = new StringBuffer();
|
||
//分页信息
|
||
String replyFlag = greenFaultRepairInfo.getReplyFlag();
|
||
int pageSize = greenFaultRepairInfo.getPageSize();
|
||
// int page = greenFaultRepairInfo.getPageNum();
|
||
// page = (page-1) * pageSize;
|
||
int pageNum = greenFaultRepairInfo.getPageNum();
|
||
int limit = ((pageNum > 0 ? pageNum : 1) - 1) * pageSize;
|
||
pageSize = pageSize*pageNum;
|
||
List<Object> params = new ArrayList<Object>();
|
||
|
||
//查询订单
|
||
sb.append("select * from (select rn.*, rownum rw from ("
|
||
+ "Select r.id as \"id\", r.repair_dept_id as \"repair_dept_id\", r.repair_dept_name as \"repair_dept_name\", "
|
||
+ "r.repair_person_id as \"repair_person_id\", r.repair_person_name as \"repair_person_name\","
|
||
+ "r.repair_person_phone as \"repair_person_phone\",r.person_id as \"person_id\",r.repair_option as \"repair_option\","
|
||
+ "r.repair_addr as \"repair_addr\",r.fault_detail as \"fault_detail\",r.fault_pic1 as \"fault_pic1\","
|
||
+ "r.fault_pic2 as \"fault_pic2\",r.fault_pic3 as \"fault_pic3\",r.repair_time as \"repair_time\","
|
||
+ "r.user_id as \"user_id\",r.creator as \"creator\",r.modifier as \"modifier\",r.gmt_created as \"gmt_created\","
|
||
+ "r.gmt_modified as \"gmt_modified\",r.is_deleted as \"is_deleted\",r.fault_pic1_data as \"fault_pic1_data\","
|
||
+ "r.fault_pic2_data as \"fault_pic2_data\",r.fault_pic3_data as \"fault_pic3_data\",r.img_status as \"img_status\","
|
||
+ "r.repair_status as \"repair_status\",r.repair_place as \"repair_place\",r.urgent as \"urgent\","
|
||
+ "r.endremind as \"endremind\",r.is_evaluate as \"is_evaluate\",r.is_inspection as \"is_inspection\","
|
||
+ "r.repair_floor as \"repair_floor\",r.repair_room_no as \"repair_room_no\",r.repair_option_sub as \"repair_option_sub\","
|
||
+ "r.accept_date as \"accept_date\",r.finish_date as \"finish_date\",r.fault_type as \"fault_type\","
|
||
+ "r.reply_pic1 as \"reply_pic1\",r.reply_pic2 as \"reply_pic2\",r.reply_pic1_data as \"reply_pic1_data\","
|
||
+ "r.reply_pic2_data as \"reply_pic2_data\",r.reply_content as \"reply_content\",r.reply_date as \"reply_date\","
|
||
+ "r.reply_flag as \"reply_flag\",r.check_fraction as \"check_fraction\",r.fault_proposal as \"fault_proposal\","
|
||
+ "r.fault_evaluate as \"fault_evaluate\",r.wb_types as \"wb_types\",r.elevator_no as \"elevator_no\","
|
||
+ "r.fault_pic4 as \"fault_pic4\",r.fault_pic5 as \"fault_pic5\",r.fault_pic6 as \"fault_pic6\","
|
||
+ "r.fault_pic4_data as \"fault_pic4_data\",r.fault_pic5_data as \"fault_pic5_data\","
|
||
+ "r.fault_pic6_data as \"fault_pic6_data\",r.upload_file_ids as \"upload_file_ids\","
|
||
+ "r.replace_parts as \"replace_parts\",r.device_name as \"device_name\",r.arrival_time as \"arrival_time\","
|
||
+ " i1.name as \"repair_option_name\", i2.name as \"repair_option_sub_name\""
|
||
+ " from green_fault_repair_info r "
|
||
//+ "left join green_user_Info u on r.person_id = u.id ",u.real_name as person_name,u.mobile as person_mobile
|
||
+ " left join green_repair_items i1 on r.repair_option = i1.code "
|
||
+ " left join green_repair_items i2 on r.repair_option_sub = i2.code "
|
||
+ " where r.is_deleted='N'");
|
||
|
||
if(isInspection==2){
|
||
sb.append(" and r.is_inspection in(2,3) and r.reply_flag=? ");
|
||
params.add(replyFlag);
|
||
}else{
|
||
sb.append(" and r.is_inspection in(0,1) and r.reply_flag=? and r.fault_Type=? ");
|
||
params.add(replyFlag);
|
||
params.add(faultType);
|
||
}
|
||
if(!StringUtils.isEmpty(startDate)){
|
||
startDate = startDate+" 00:00:00";
|
||
sb.append(" and r.repair_time >=? ");
|
||
params.add(startDate);
|
||
}
|
||
if(!StringUtils.isEmpty(endDate)){
|
||
endDate = endDate+" 23:59:59";
|
||
sb.append(" and r.repair_time <=? ");
|
||
params.add(endDate);
|
||
}
|
||
|
||
sb.append(" order by r.urgent desc, r.gmt_created desc ) rn) where rw > ? and rw <=? ");
|
||
params.add(limit);
|
||
params.add(pageSize);
|
||
List<Map<String,Object>> applyList = hibernateDao.queryForListWithSql(sb.toString()
|
||
,params.toArray());
|
||
// for (Map<String, Object> mapiMap : applyList) {
|
||
// List<String> list = new ArrayList<String>();
|
||
// String pic1 = baseService.getImageBase64((String) mapiMap.get("fault_pic1"));
|
||
// if (pic1 != null && !"".equals(pic1)) {
|
||
// list.add(pic1);
|
||
// }
|
||
// String pic2 = baseService.getImageBase64((String) mapiMap.get("fault_pic2"));
|
||
// if (pic2 != null && !"".equals(pic2)) {
|
||
// list.add(pic2);
|
||
// }
|
||
// String pic3 = baseService.getImageBase64((String) mapiMap.get("fault_pic3"));
|
||
// if (pic3 != null && !"".equals(pic3)) {
|
||
// list.add(pic3);
|
||
// }
|
||
// String pic3 = baseService.getImageBase64((String) mapiMap.get("fault_pic3"));
|
||
// if (pic3 != null && !"".equals(pic3)) {
|
||
// list.add(pic3);
|
||
// }
|
||
// mapiMap.put("pictures", list);
|
||
// }
|
||
|
||
return new RestResult(Constant.SUCCESS,"成功",applyList);
|
||
}catch (ServiceValidatorBaseException e) {
|
||
throw e;
|
||
}catch (Exception e) {
|
||
e.printStackTrace();
|
||
return new RestResult(Constant.FAILED,"返回异常");
|
||
}
|
||
}
|
||
@RequestMapping(value="/getFaultCountByReply", method = RequestMethod.POST)
|
||
@ResponseBody
|
||
public RestResult getFaultCountByReply(@RequestBody GreenFaultRepairInfo greenFaultRepairInfo){
|
||
|
||
try {
|
||
String userId = greenFaultRepairInfo.getUserId();
|
||
Integer faultType = greenFaultRepairInfo.getFaultType();
|
||
Integer isInspection = greenFaultRepairInfo.getIsInspection();
|
||
String startDate = greenFaultRepairInfo.getStartDate();
|
||
String endDate = greenFaultRepairInfo.getEndDate();
|
||
|
||
GreenUserInfo info = getUserInfo(userId);
|
||
if(info==null){
|
||
return new RestResult(Constant.FAILED, "非法用户");
|
||
}
|
||
StringBuffer sb = new StringBuffer();
|
||
//分页信息
|
||
String replyFlag = greenFaultRepairInfo.getReplyFlag();
|
||
int pageSize = greenFaultRepairInfo.getPageSize();
|
||
int page = greenFaultRepairInfo.getPageNum();
|
||
page = (page-1) * pageSize;
|
||
List<Object> params = new ArrayList<Object>();
|
||
|
||
//查询订单
|
||
sb.append(" Select count(*) from green_fault_repair_info r "
|
||
//+ "left join green_user_Info u on r.person_id = u.id ",u.real_name as person_name,u.mobile as person_mobile
|
||
+ " where r.is_deleted='N'");
|
||
|
||
if(isInspection==2){
|
||
sb.append(" and r.is_inspection in(2,3) and r.reply_flag=? ");
|
||
params.add(replyFlag);
|
||
}else{
|
||
sb.append(" and r.is_inspection in(0,1) and r.reply_flag=? and r.fault_Type=? ");
|
||
params.add(replyFlag);
|
||
params.add(faultType);
|
||
}
|
||
if(!StringUtils.isEmpty(startDate)){
|
||
startDate = startDate+" 00:00:00";
|
||
sb.append(" and r.repair_time >=? ");
|
||
params.add(startDate);
|
||
}
|
||
if(!StringUtils.isEmpty(endDate)){
|
||
endDate = endDate+" 23:59:59";
|
||
sb.append(" and r.repair_time <=? ");
|
||
params.add(endDate);
|
||
}
|
||
|
||
Integer count = hibernateDao.queryForIntWithSql(sb.toString()
|
||
,params.toArray());
|
||
|
||
return new RestResult(Constant.SUCCESS,"成功",count);
|
||
}catch (ServiceValidatorBaseException e) {
|
||
throw e;
|
||
}catch (Exception e) {
|
||
e.printStackTrace();
|
||
return new RestResult(Constant.FAILED,"返回异常");
|
||
}
|
||
}
|
||
|
||
@RequestMapping(value="/getFaultRepairInfoById", method = RequestMethod.POST)
|
||
@ResponseBody
|
||
public RestResult getFaultRepairInfoById(@RequestBody GreenFaultRepairInfo greenFaultRepairInfo){
|
||
|
||
try {
|
||
String userId = greenFaultRepairInfo.getUserId();
|
||
Long id = greenFaultRepairInfo.getId();
|
||
GreenUserInfo info = getUserInfo(userId);
|
||
if(info==null){
|
||
return new RestResult(Constant.FAILED, "非法用户");
|
||
}
|
||
StringBuffer sb = new StringBuffer();
|
||
//分页信息
|
||
//查询订单
|
||
sb.append(" Select r.id as \"id\", r.repair_dept_id as \"repair_dept_id\", r.repair_dept_name as \"repair_dept_name\", "
|
||
+ "r.repair_person_id as \"repair_person_id\", r.repair_person_name as \"repair_person_name\","
|
||
+ "r.repair_person_phone as \"repair_person_phone\",r.person_id as \"person_id\",r.repair_option as \"repair_option\","
|
||
+ "r.repair_addr as \"repair_addr\",r.fault_detail as \"fault_detail\",r.fault_pic1 as \"fault_pic1\","
|
||
+ "r.fault_pic2 as \"fault_pic2\",r.fault_pic3 as \"fault_pic3\",r.repair_time as \"repair_time\","
|
||
+ "r.user_id as \"user_id\",r.creator as \"creator\",r.modifier as \"modifier\",r.gmt_created as \"gmt_created\","
|
||
+ "r.gmt_modified as \"gmt_modified\",r.is_deleted as \"is_deleted\",r.fault_pic1_data as \"fault_pic1_data\","
|
||
+ "r.fault_pic2_data as \"fault_pic2_data\",r.fault_pic3_data as \"fault_pic3_data\",r.img_status as \"img_status\","
|
||
+ "r.repair_status as \"repair_status\",r.repair_place as \"repair_place\",r.urgent as \"urgent\","
|
||
+ "r.endremind as \"endremind\",r.is_evaluate as \"is_evaluate\",r.is_inspection as \"is_inspection\","
|
||
+ "r.repair_floor as \"repair_floor\",r.repair_room_no as \"repair_room_no\",r.repair_option_sub as \"repair_option_sub\","
|
||
+ "r.accept_date as \"accept_date\",r.finish_date as \"finish_date\",r.fault_type as \"fault_type\","
|
||
+ "r.reply_pic1 as \"reply_pic1\",r.reply_pic2 as \"reply_pic2\",r.reply_pic1_data as \"reply_pic1_data\","
|
||
+ "r.reply_pic2_data as \"reply_pic2_data\",r.reply_content as \"reply_content\",r.reply_date as \"reply_date\","
|
||
+ "r.reply_flag as \"reply_flag\",r.check_fraction as \"check_fraction\",r.fault_proposal as \"fault_proposal\","
|
||
+ "r.fault_evaluate as \"fault_evaluate\",r.wb_types as \"wb_types\",r.elevator_no as \"elevator_no\","
|
||
+ "r.fault_pic4 as \"fault_pic4\",r.fault_pic5 as \"fault_pic5\",r.fault_pic6 as \"fault_pic6\","
|
||
+ "r.fault_pic4_data as \"fault_pic4_data\",r.fault_pic5_data as \"fault_pic5_data\","
|
||
+ "r.fault_pic6_data as \"fault_pic6_data\",r.upload_file_ids as \"upload_file_ids\","
|
||
+ "r.replace_parts as \"replace_parts\",r.device_name as \"device_name\",r.arrival_time as \"arrival_time\""
|
||
+ ", i1.name as \"repair_option_name\", i2.name as \"repair_option_sub_name\" "
|
||
+ "from green_fault_repair_info r "
|
||
//+ "left join green_user_Info u on r.person_id = u.id ",u.real_name as person_name,u.mobile as person_mobile
|
||
+ " left join green_repair_items i1 on r.repair_option = i1.code "
|
||
+ " left join green_repair_items i2 on r.repair_option_sub = i2.code "
|
||
+ " where r.id=? ");
|
||
List<Map<String,Object>> applyList = hibernateDao.queryForListWithSql(sb.toString()
|
||
,new Object[]{ id});
|
||
if(applyList.size()>0){
|
||
Map<String,Object> objMap = applyList.get(0);
|
||
List<String> list = new ArrayList<String>();
|
||
|
||
String pic1 = baseService.getImageBase64((String) objMap.get("fault_pic1"));
|
||
if (pic1 != null && !"".equals(pic1)) {
|
||
list.add(pic1);
|
||
}
|
||
String pic2 = baseService.getImageBase64((String) objMap.get("fault_pic2"));
|
||
if (pic2 != null && !"".equals(pic2)) {
|
||
list.add(pic2);
|
||
}
|
||
String pic3 = baseService.getImageBase64((String) objMap.get("fault_pic3"));
|
||
if (pic3 != null && !"".equals(pic3)) {
|
||
list.add(pic3);
|
||
}
|
||
String pic4 = baseService.getImageBase64((String) objMap.get("fault_pic4"));
|
||
if (pic4 != null && !"".equals(pic4)) {
|
||
list.add(pic4);
|
||
}
|
||
String pic5 = baseService.getImageBase64((String) objMap.get("fault_pic5"));
|
||
if (pic5 != null && !"".equals(pic5)) {
|
||
list.add(pic5);
|
||
}
|
||
String pic6 = baseService.getImageBase64((String) objMap.get("fault_pic6"));
|
||
if (pic6 != null && !"".equals(pic6)) {
|
||
list.add(pic6);
|
||
}
|
||
objMap.put("pictures", list);
|
||
List<Map<String,Object>> replyList = new ArrayList<Map<String,Object>>();
|
||
if(!"0".equals(objMap.get("reply_flag"))){
|
||
String replySql = "select p.id as \"id\",p.reply_content as \"reply_content\", p.reply_date as \"reply_date\", "
|
||
+ "p.create_by as \"create_by\",p.fault_id as \"fault_id\", p.reply_pic1 as \"reply_pic1\","
|
||
+ "p.reply_pic1_data as \"reply_pic1_data\",p.reply_pic2 as \"reply_pic2\",p.reply_pic2_data as \"reply_pic2_data\","
|
||
+ "u.real_name as \"real_name\" from green_fault_reply p left join green_user_info u on p.create_by = u.id where p.fault_id = ?";
|
||
List<Map<String,Object>> replyList2 = hibernateDao.queryForListWithSql(replySql,new Object[]{ objMap.get("id")});
|
||
for(int i=0;i<replyList2.size();i++){
|
||
Map<String,Object> replyObj = replyList2.get(i);
|
||
List<String> replyPicList = new ArrayList<String>();
|
||
String replyPic1 = baseService.getImageBase64((String) replyObj.get("reply_pic1"));
|
||
if (replyPic1 != null && !"".equals(replyPic1)) {
|
||
replyPicList.add(replyPic1);
|
||
}
|
||
String replyPic2 = baseService.getImageBase64((String) replyObj.get("reply_pic2"));
|
||
if (replyPic2 != null && !"".equals(replyPic2)) {
|
||
replyPicList.add(replyPic2);
|
||
}
|
||
replyObj.put("replyPictures", replyPicList);
|
||
replyList.add(replyObj);
|
||
}
|
||
objMap.put("replyList", replyList);
|
||
}
|
||
List<Map<String,Object>> ufList = new ArrayList<Map<String,Object>>();
|
||
if(!StringUtils.isEmpty(objMap.get("upload_file_ids")==null?"":objMap.get("upload_file_ids").toString())){
|
||
String uploadFileIds = objMap.get("upload_file_ids").toString().replaceAll(",", "','");
|
||
String ufSql = "select * from upload_file where id in ('"+uploadFileIds+"')";
|
||
ufList = hibernateDao.queryForListWithSql(ufSql);
|
||
|
||
}
|
||
objMap.put("ufList", ufList);
|
||
return new RestResult(Constant.SUCCESS,"成功",objMap);
|
||
}else{
|
||
return new RestResult(Constant.FAILED,"查无该数据");
|
||
}
|
||
}catch (ServiceValidatorBaseException e) {
|
||
throw e;
|
||
}catch (Exception e) {
|
||
e.printStackTrace();
|
||
return new RestResult(Constant.FAILED,"返回异常");
|
||
}
|
||
}
|
||
|
||
|
||
@RequestMapping(value="/finishFault", method = RequestMethod.POST)
|
||
@ResponseBody
|
||
public RestResult finishFault(@RequestBody GreenFaultRepairInfo greenFaultRepairInfo){
|
||
|
||
try {
|
||
String userId = greenFaultRepairInfo.getUserId();
|
||
Long id = greenFaultRepairInfo.getId();
|
||
GreenUserInfo info = getUserInfo(userId);
|
||
if(info==null){
|
||
return new RestResult(Constant.FAILED, "非法用户");
|
||
}
|
||
String updateSql = "update green_fault_repair_info set reply_flag = '2' where id = ?";
|
||
|
||
hibernateDao.executeSqlUpdate(updateSql,new Object[]{ id});
|
||
GreenFaultReply greenFaultReply = new GreenFaultReply();
|
||
greenFaultReply.setCreateBy(userId);
|
||
greenFaultReply.setFaultId(id);
|
||
greenFaultReply.setReplyDate(new Date());
|
||
hibernateDao.saveObject(greenFaultReply);
|
||
greenFaultRepairInfo = greenfaultrepairinfoBizc.get(id);
|
||
Integer isInspection = greenFaultRepairInfo.getIsInspection();
|
||
Integer faultType = greenFaultRepairInfo.getFaultType();
|
||
String title = "";
|
||
String text = "";
|
||
String url = "";
|
||
if(isInspection==1){
|
||
title = "外包考核";
|
||
text = "您好,您的外包考核已办结,请点击查看。";
|
||
url = "/pages/malfunc-check/malfunc-check?currentTabIndex=1";
|
||
aliasManageController.pushToSingle(greenFaultRepairInfo.getUserId(), title, text, url);
|
||
}else if(isInspection==2){
|
||
title = "维保管理";
|
||
text = "您好,您的维保填报已办结,请点击查看。";
|
||
url = "/pages/malfunc-check/malfunc-check-wb?currentTabIndex=1";
|
||
aliasManageController.pushToSingle(greenFaultRepairInfo.getUserId(), title, text, url);
|
||
}
|
||
else{
|
||
if(faultType==1){
|
||
title = "报事服务";
|
||
text = "您好,您的报事服务已办结,请点击查看。";
|
||
url = "/pages/malfunc-repair/malfunc-repair?faultType=1¤tTabIndex=1";
|
||
aliasManageController.pushToSingle(greenFaultRepairInfo.getUserId(), title, text, url);
|
||
}else{
|
||
title = "报修服务";
|
||
text = "您好,您的报修服务已办结,请点击查看。";
|
||
url = "/pages/malfunc-repair/malfunc-repair?currentTabIndex=1";
|
||
aliasManageController.pushToSingle(greenFaultRepairInfo.getUserId(), title, text, url);
|
||
}
|
||
}
|
||
return new RestResult(Constant.SUCCESS,"办结成功");
|
||
}catch (ServiceValidatorBaseException e) {
|
||
throw e;
|
||
}catch (Exception e) {
|
||
e.printStackTrace();
|
||
return new RestResult(Constant.FAILED,"办结失败,请重新办结");
|
||
}
|
||
}
|
||
/**
|
||
* 保存故障报修申请信息
|
||
* @param greenTempParkInfo
|
||
* @return
|
||
*/
|
||
@SuppressWarnings("unchecked")
|
||
@Transactional(rollbackFor=Exception.class)
|
||
@RequestMapping(value = "/replyFaultRepairInfo", method = RequestMethod.POST)
|
||
public @ResponseBody RestResult replyFaultRepairInfo(@RequestBody GreenFaultRepairInfo greenFaultRepairInfo){
|
||
try {
|
||
String userId = greenFaultRepairInfo.getUserId();
|
||
GreenUserInfo info = getUserInfo(userId);
|
||
if(info==null){
|
||
return new RestResult(Constant.FAILED, "非法用户");
|
||
}
|
||
Long id = greenFaultRepairInfo.getId();
|
||
GreenFaultRepairInfo greenFaultRepairInfo2 = greenfaultrepairinfoBizc.get(id);
|
||
GreenFaultReply greenFaultReply = new GreenFaultReply();
|
||
|
||
boolean flag1=true;
|
||
boolean flag2=true;
|
||
boolean flag3=true;
|
||
String uuid="";
|
||
//回复图片
|
||
if(greenFaultRepairInfo.getReplyPic1()!=null&&!"".equals(greenFaultRepairInfo.getReplyPic1())){
|
||
|
||
// SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
||
// String date = sdf.format(new Date()) + "/";
|
||
//// uuid = date + UUID.randomUUID().toString().replaceAll("-","");
|
||
// uuid = greenImageInfoController.saveImage(greenFaultRepairInfo.getReplyPic1(), userId);
|
||
// flag1=baseService.saveImgToIO(uuid+Constant.IMG_SUFFIX, greenFaultRepairInfo.getReplyPic1());
|
||
// greenFaultRepairInfo2.setReplyPic1(uuid+Constant.IMG_SUFFIX);
|
||
// greenFaultRepairInfo2.setReplyPic1Data(uuid);
|
||
greenFaultReply.setReplyPic1(greenFaultRepairInfo.getReplyPic1());
|
||
greenFaultReply.setReplyPic1Data(greenFaultRepairInfo.getReplyPic1());
|
||
|
||
}
|
||
//回复图片2
|
||
if(greenFaultRepairInfo.getReplyPic2()!=null&&!"".equals(greenFaultRepairInfo.getReplyPic2())){
|
||
// SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
||
// String date = sdf.format(new Date()) + "/";
|
||
//// uuid = date + UUID.randomUUID().toString().replaceAll("-","");
|
||
// uuid = greenImageInfoController.saveImage(greenFaultRepairInfo.getReplyPic2(), userId);
|
||
// flag2=baseService.saveImgToIO(uuid+Constant.IMG_SUFFIX, greenFaultRepairInfo.getReplyPic2());
|
||
// greenFaultRepairInfo2.setReplyPic2(uuid+Constant.IMG_SUFFIX);
|
||
// greenFaultRepairInfo2.setReplyPic2Data(uuid);
|
||
greenFaultReply.setReplyPic2(greenFaultRepairInfo.getReplyPic2());
|
||
greenFaultReply.setReplyPic2Data(greenFaultRepairInfo.getReplyPic2());
|
||
}
|
||
|
||
greenFaultRepairInfo2.setReplyDate(new Date());
|
||
greenFaultRepairInfo2.setReplyContent(greenFaultRepairInfo.getReplyContent());
|
||
greenFaultRepairInfo2.setReplyFlag("1");
|
||
|
||
greenfaultrepairinfoBizc.add(greenFaultRepairInfo2);
|
||
|
||
greenFaultReply.setReplyContent(greenFaultRepairInfo2.getReplyContent());
|
||
greenFaultReply.setCreateBy(userId);
|
||
greenFaultReply.setFaultId(id);
|
||
greenFaultReply.setReplyDate(new Date());
|
||
hibernateDao.saveObject(greenFaultReply);
|
||
Integer isInspection = greenFaultRepairInfo2.getIsInspection();
|
||
Integer faultType = greenFaultRepairInfo2.getFaultType();
|
||
String title = "";
|
||
String text = "";
|
||
String url = "";
|
||
if(isInspection==1){
|
||
title = "巡检考核";
|
||
text = "您好,您的巡检考核有新回复,请点击查看。";
|
||
url = "/pages/malfunc-check/malfunc-check?currentTabIndex=1";
|
||
aliasManageController.pushToSingle(greenFaultRepairInfo2.getUserId(), title, text, url);
|
||
}else if(isInspection==2){
|
||
title = "维保管理";
|
||
text = "您好,您的维保填报有新回复,请点击查看。";
|
||
url = "/pages/malfunc-check/malfunc-check-wb?currentTabIndex=1";
|
||
aliasManageController.pushToSingle(greenFaultRepairInfo.getUserId(), title, text, url);
|
||
}else{
|
||
if(faultType==1){
|
||
title = "报事服务";
|
||
text = "您好,您的报事服务有新回复,请点击查看。";
|
||
url = "/pages/malfunc-repair/malfunc-repair?faultType=1¤tTabIndex=1";
|
||
aliasManageController.pushToSingle(greenFaultRepairInfo2.getUserId(), title, text, url);
|
||
}else{
|
||
title = "报修服务";
|
||
text = "您好,您的报修服务有新回复,请点击查看。";
|
||
url = "/pages/malfunc-repair/malfunc-repair?currentTabIndex=1";
|
||
aliasManageController.pushToSingle(greenFaultRepairInfo2.getUserId(), title, text, url);
|
||
}
|
||
}
|
||
return new RestResult(Constant.SUCCESS, "回复成功");
|
||
|
||
} catch (ServiceValidatorBaseException e) {
|
||
e.printStackTrace();
|
||
return new RestResult(Constant.FAILED,e.getMessage());
|
||
} catch (Exception e) {
|
||
e.printStackTrace();
|
||
return new RestResult(Constant.FAILED, "回复失败");
|
||
}
|
||
}
|
||
|
||
/**设备列表*/
|
||
@RequestMapping(value="/getDeviceList", method = RequestMethod.POST)
|
||
@ResponseBody
|
||
public RestResult getDeviceList(@RequestBody Map<String, Object> map){
|
||
|
||
try {
|
||
String repairItemsId = map.get("repairItemsId").toString();
|
||
String deviceRegion = map.get("deviceRegion")==null?"":map.get("deviceRegion").toString();
|
||
String sql ="select device_no as \"device_no\",device_name as \"device_name\",device_addr as \"device_addr\" from green_repair_device where repair_item_id = ?";
|
||
List<Object> params = new ArrayList<Object>();
|
||
params.add(repairItemsId);
|
||
if(StringUtils.isNotEmpty(deviceRegion)){
|
||
sql+=" and device_region = ? ";
|
||
params.add(deviceRegion);
|
||
}
|
||
sql+= " and is_deleted='N'";
|
||
List<Map<String,Object>> list = hibernateDao.queryForListWithSql(sql,params.toArray());
|
||
|
||
return new RestResult(Constant.SUCCESS,"成功",list);
|
||
}catch (ServiceValidatorBaseException e) {
|
||
throw e;
|
||
}catch (Exception e) {
|
||
e.printStackTrace();
|
||
return new RestResult(Constant.FAILED,"失败");
|
||
}
|
||
}
|
||
/**设备列表*/
|
||
@RequestMapping(value="/cancleRepair", method = RequestMethod.POST)
|
||
@ResponseBody
|
||
public RestResult cancleRepair(@RequestBody Map<String, Object> map){
|
||
|
||
try {
|
||
String id = map.get("id").toString();
|
||
String reply_flag = map.get("reply_flag").toString();
|
||
String updateSql ="update green_fault_repair_info set reply_flag = ? where id = ?";
|
||
hibernateDao.executeSqlUpdate(updateSql,new Object[]{reply_flag, id});
|
||
return new RestResult(Constant.SUCCESS,"取消成功");
|
||
}catch (ServiceValidatorBaseException e) {
|
||
throw e;
|
||
}catch (Exception e) {
|
||
e.printStackTrace();
|
||
return new RestResult(Constant.FAILED,"取消失败");
|
||
}
|
||
}
|
||
}
|