|
@ -9,10 +9,12 @@ import com.yihu.wlyy.repository.synergy.ManageSynergyWorkOrderDao;
|
|
import com.yihu.wlyy.repository.synergy.ManageSynergyWorkorderExecutorDao;
|
|
import com.yihu.wlyy.repository.synergy.ManageSynergyWorkorderExecutorDao;
|
|
import com.yihu.wlyy.repository.synergy.ManageSynergyWorkorderServicerDao;
|
|
import com.yihu.wlyy.repository.synergy.ManageSynergyWorkorderServicerDao;
|
|
import com.yihu.wlyy.util.DateUtil;
|
|
import com.yihu.wlyy.util.DateUtil;
|
|
|
|
import com.yihu.wlyy.util.HttpClientUtil;
|
|
import com.yihu.wlyy.util.query.BaseJpaService;
|
|
import com.yihu.wlyy.util.query.BaseJpaService;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.json.JSONObject;
|
|
import org.json.JSONObject;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@ -27,6 +29,10 @@ import java.util.*;
|
|
@Transactional
|
|
@Transactional
|
|
public class SynergyManageService extends BaseJpaService {
|
|
public class SynergyManageService extends BaseJpaService {
|
|
|
|
|
|
|
|
@Value("${wlyy.url}")
|
|
|
|
private String wlyyUrl;
|
|
|
|
@Autowired
|
|
|
|
private HttpClientUtil httpClientUtil;
|
|
@Autowired
|
|
@Autowired
|
|
JdbcTemplate jdbcTemplate;
|
|
JdbcTemplate jdbcTemplate;
|
|
@Autowired
|
|
@Autowired
|
|
@ -363,6 +369,7 @@ public class SynergyManageService extends BaseJpaService {
|
|
JSONObject jsonObject = new JSONObject(jsonData);
|
|
JSONObject jsonObject = new JSONObject(jsonData);
|
|
if(status == 4){
|
|
if(status == 4){
|
|
workorderDO.setReturnedRemark(jsonObject.getString("returnedRemark"));
|
|
workorderDO.setReturnedRemark(jsonObject.getString("returnedRemark"));
|
|
|
|
this.sendMessage(workorderDO, null, 26);
|
|
}else if(status == 2){
|
|
}else if(status == 2){
|
|
//创建负责人信息
|
|
//创建负责人信息
|
|
List<ManageSynergyWorkorderExecutorDO> list = new ArrayList<>();
|
|
List<ManageSynergyWorkorderExecutorDO> list = new ArrayList<>();
|
|
@ -370,14 +377,15 @@ public class SynergyManageService extends BaseJpaService {
|
|
String[] managers = manager.split(",");
|
|
String[] managers = manager.split(",");
|
|
for(String m : managers){
|
|
for(String m : managers){
|
|
ManageSynergyWorkorderExecutorDO executorDO = new ManageSynergyWorkorderExecutorDO();
|
|
ManageSynergyWorkorderExecutorDO executorDO = new ManageSynergyWorkorderExecutorDO();
|
|
User u = userDao.findByCode(m);
|
|
|
|
|
|
User managerUser = userDao.findByCode(m);
|
|
executorDO.setCode(getCode());
|
|
executorDO.setCode(getCode());
|
|
executorDO.setWorkorderCode(code);
|
|
executorDO.setWorkorderCode(code);
|
|
executorDO.setExecutorType(1);
|
|
executorDO.setExecutorType(1);
|
|
executorDO.setExecutorCode(m);
|
|
executorDO.setExecutorCode(m);
|
|
executorDO.setExecutorName(u.getName());
|
|
|
|
|
|
executorDO.setExecutorName(managerUser.getName());
|
|
executorDO.setDel(1);
|
|
executorDO.setDel(1);
|
|
list.add(executorDO);
|
|
list.add(executorDO);
|
|
|
|
this.sendMessage(workorderDO, managerUser, 25);
|
|
}
|
|
}
|
|
|
|
|
|
//保存协作者信息
|
|
//保存协作者信息
|
|
@ -398,4 +406,31 @@ public class SynergyManageService extends BaseJpaService {
|
|
}
|
|
}
|
|
workOrderDao.save(workorderDO);
|
|
workOrderDao.save(workorderDO);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public void sendMessage(ManageSynergyWorkorderDO workorderDO, User user, Integer type){
|
|
|
|
String url = wlyyUrl + "doctor/message/sendMessage";
|
|
|
|
//组装message内容
|
|
|
|
JSONObject message = new JSONObject();
|
|
|
|
message.put("sender", workorderDO.getReceiverCode());
|
|
|
|
message.put("receiver", workorderDO.getCreateUser());
|
|
|
|
message.put("type", type);
|
|
|
|
message.put("relationCode", workorderDO.getCode());
|
|
|
|
//组装jsonObject内容
|
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
|
jsonObject.put("type", workorderDO.getType());
|
|
|
|
if(type == 26){
|
|
|
|
jsonObject.put("returnedRemark", workorderDO.getReturnedRemark());
|
|
|
|
}else if(type == 25){
|
|
|
|
jsonObject.put("customerName", user.getName());
|
|
|
|
jsonObject.put("phone", user.getMobile());
|
|
|
|
}
|
|
|
|
Map<String, Object> params = new HashMap<>();
|
|
|
|
params.put("message", message.toString());
|
|
|
|
params.put("jsonObject", jsonObject.toString());
|
|
|
|
try {
|
|
|
|
String response = httpClientUtil.post(url, params);
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|