use of com.itrus.portal.db.CustomerServiceExample in project portal by ixinportal.
the class OnlineServiceController method createService.
/**
* 创建(修改)天威默认客服
*
* @param phoneName1
* @param phone1
* @param downloadUrl1
* @param messageContent1
* @param uiModel
* @return
*/
@RequestMapping(value = "/createService", produces = "text/html")
public // 客服电话名称
String createService(// 客服电话名称
@RequestParam(value = "phoneName1", required = false) String phoneName1, // 客服电话号码
@RequestParam(value = "phone1", required = false) String phone1, // 企业QQ账号
@RequestParam(value = "downloadUrl1", required = false) String downloadUrl1, // 企业QQ链接
@RequestParam(value = "messageContent1", required = false) String messageContent1, Model uiModel) {
// 查询默认客服的数据
EnterpriseQqExample enterpriseE = new EnterpriseQqExample();
EnterpriseQqExample.Criteria qqEx = enterpriseE.createCriteria();
qqEx.andEnterpriseQqStateEqualTo(0L);
EnterpriseQq enterpriseqq = onlineService.selectQq(enterpriseE);
// 查询默认客服的数据
CustomerServiceExample customerE = new CustomerServiceExample();
CustomerServiceExample.Criteria serviceE = customerE.createCriteria();
serviceE.andServiceStateEqualTo(0);
CustomerService customerService = onlineService.selectService(customerE);
if (enterpriseqq != null) {
enterpriseqq.setEnterpriseQq(downloadUrl1);
enterpriseqq.setEnterpriseQqLinks(messageContent1);
enterpriseqq.setEnterpriseQqState(0L);
enterpriseqq.setModifyTime(new Date());
onlineService.updateenterprise(enterpriseqq);
/*Project project = projectService.selectByPrimaryKey(enterpriseqq.getProjectId());
LogUtil.adminlog(sqlSession, "修改天威默认客服", project.getName() + "修改的文件是:" + enterpriseqq.getEnterpriseQq());*/
// 修改默认qq
EnterpriseQqExample enterpriseEX = new EnterpriseQqExample();
EnterpriseQqExample.Criteria qqE = enterpriseEX.createCriteria();
qqE.andQqStateEqualTo(0L);
List<EnterpriseQq> enterpriseq = onlineService.selectQqList(enterpriseEX);
if (enterpriseq.size() != 0) {
for (EnterpriseQq e : enterpriseq) {
e.setEnterpriseQq(downloadUrl1);
e.setEnterpriseQqLinks(messageContent1);
e.setModifyTime(new Date());
onlineService.updateenterprise(e);
}
}
} else {
EnterpriseQq enterprise = new EnterpriseQq();
enterprise.setEnterpriseQq(downloadUrl1);
enterprise.setEnterpriseQqLinks(messageContent1);
enterprise.setEnterpriseQqState(0L);
enterprise.setCreateTime(new Date());
onlineService.insertenterprise(enterprise);
LogUtil.adminlog(sqlSession, "修改天威默认客服", "修改的文件是:" + messageContent1);
}
if (customerService != null) {
customerService.setServicePhone(phone1);
customerService.setPhoneName(phoneName1);
customerService.setServiceState(0);
customerService.setModifyTime(new Date());
onlineService.updatecustomer(customerService);
// 修改默认客服电话
EnterpriseQqExample enterpriseEX = new EnterpriseQqExample();
EnterpriseQqExample.Criteria qqE = enterpriseEX.createCriteria();
qqE.andCustermServiceStateEqualTo(0L);
List<EnterpriseQq> enterpriseq = onlineService.selectQqList(enterpriseEX);
if (enterpriseq.size() != 0) {
for (EnterpriseQq e : enterpriseq) {
CustomerServiceExample customerEX = new CustomerServiceExample();
CustomerServiceExample.Criteria serviceEX = customerEX.createCriteria();
int cid = Integer.parseInt(e.getId().toString());
serviceEX.andEnterpriseIdEqualTo(cid);
CustomerService customers = onlineService.selectService(customerEX);
if (customers != null) {
customers.setServicePhone(phone1);
customers.setPhoneName(phoneName1);
customers.setCreateTime(new Date());
onlineService.updatecustomer(customers);
}
}
}
} else {
CustomerService customer = new CustomerService();
customer.setServicePhone(phone1);
customer.setPhoneName(phoneName1);
customer.setServiceState(0);
customer.setCreateTime(new Date());
onlineService.insertcustomer(customer);
LogUtil.adminlog(sqlSession, "修改天威默认客服", "修改的文件是:" + phoneName1);
}
return "redirect:/onlineserviceconfig";
}
use of com.itrus.portal.db.CustomerServiceExample in project portal by ixinportal.
the class OnlineServiceController method update.
/**
* 修改处理
*
* @param id
* @param customerJson
* @param keys
* @param uiModel
* @return
*/
@RequestMapping(value = "/update/{id}", produces = "text/html")
public String update(@PathVariable("id") Long id, @RequestParam(value = "jsonObj", required = false) String customerJson, @RequestParam(value = "keys", required = false) String keys, @RequestParam(value = "delKeys", required = false) String delKeys, @RequestParam(value = "projectId", required = false) Long projectId, @RequestParam(value = "entQq", required = false) String entQq, @RequestParam(value = "entQqLinks", required = false) String entQqLinks, @RequestParam(value = "isDefaultQq", required = false) String isDefaultQq, @RequestParam(value = "isDefaultPhone", required = false) String isDefaultPhone, Model uiModel) {
// List<CustomerService> customer = (List<CustomerService>)
// JSON.parseObject(customerJson, CustomerService.class);//Weibo类在下边定义
String[] keyArr = keys.split(",");
if (StringUtils.isNotEmpty(delKeys)) {
String[] delKeyArr = delKeys.split(",");
for (String d : delKeyArr) {
if (!d.contains("new")) {
List<CustomerService> customerServices = onlineService.selectlistcustomer(Long.parseLong(d));
if (customerServices != null) {
customerServices.get(0);
onlineService.delete(Long.parseLong(d));
}
}
}
}
EnterpriseQq enterprise = onlineService.selectEnterprise(id);
if (StringUtils.isNotEmpty(isDefaultQq) && isDefaultQq.equals("1")) {
EnterpriseQq enterpriseQqDefault = onlineService.selectByDefaultEnterpriseQq();
enterprise.setEnterpriseQq(enterpriseQqDefault.getEnterpriseQq());
enterprise.setEnterpriseQqLinks(enterpriseQqDefault.getEnterpriseQqLinks());
enterprise.setQqState(0L);
} else {
enterprise.setEnterpriseQq(entQq);
enterprise.setEnterpriseQqLinks(entQqLinks);
enterprise.setQqState(1L);
}
enterprise.setEnterpriseQqState(1L);
enterprise.setProjectId(projectId);
enterprise.setModifier(getAdmin().getId());
enterprise.setModifyTime(new Date());
onlineService.updateenterprise(enterprise);
// Map<Long, List<CustomerService>> listmain = new HashMap<Long,
// List<CustomerService>>();
CustomerServiceExample customerE = new CustomerServiceExample();
CustomerServiceExample.Criteria serviceE = customerE.createCriteria();
int cid = Integer.parseInt(enterprise.getId().toString());
serviceE.andEnterpriseIdEqualTo(cid);
List<CustomerService> listcustomer = onlineService.selectServiceList(customerE);
if (StringUtils.isNotEmpty(isDefaultPhone) && isDefaultPhone.equals("1")) {
for (CustomerService c : listcustomer) {
onlineService.delete(c.getId());
}
CustomerService customerService = new CustomerService();
CustomerService customerServiceDefault = onlineService.selectByDefaultCustomerService();
customerService.setServicePhone(customerServiceDefault.getServicePhone());
customerService.setPhoneName(customerServiceDefault.getPhoneName());
customerService.setExplanatoryTime(customerServiceDefault.getExplanatoryTime());
customerService.setServiceState(1);
customerService.setCreator(getAdmin().getId());
customerService.setCreateTime(new Date());
customerService.setEnterpriseId(enterprise.getId());
enterprise.setCustermServiceState(0L);
onlineService.updateenterprise(enterprise);
onlineService.insert(customerService);
} else {
enterprise.setCustermServiceState(1L);
onlineService.updateenterprise(enterprise);
JSONObject jsonObj = JSONObject.parseObject(customerJson);
for (String s : keyArr) {
JSONObject jsonc = jsonObj.getJSONObject(s);
int i = 0;
for (CustomerService c : listcustomer) {
if (c.getId().toString().equals(s)) {
i++;
// 修改 c
c.setPhoneName(jsonc.getString("phoneName"));
c.setServicePhone(jsonc.getString("servicePhone"));
c.setExplanatoryTime(jsonc.getString("explanatoryTime"));
c.setModifyTime(new Date());
c.setModifier(getAdmin().getId());
c.setServiceState(1);
onlineService.updatecustomer(c);
}
}
if (i == 0 && s.contains("new")) {
// 增加
CustomerService custom = new CustomerService();
custom.setPhoneName(jsonc.getString("phoneName"));
custom.setServicePhone(jsonc.getString("servicePhone"));
custom.setExplanatoryTime(jsonc.getString("explanatoryTime"));
custom.setCreateTime(new Date());
custom.setServiceState(1);
custom.setEnterpriseId(enterprise.getId());
onlineService.insertcustomer(custom);
}
if (i == 0 && !s.contains("new")) {
// 删除 c
Long sid = Long.parseLong(s.toString());
onlineService.delete(sid);
}
}
}
return "redirect:/onlineserviceconfig";
}
use of com.itrus.portal.db.CustomerServiceExample in project portal by ixinportal.
the class OnlineServiceImpl method selectByDefaultCustomerService.
/**
* 得到默认企业qq
* @return
*/
public CustomerService selectByDefaultCustomerService() {
CustomerServiceExample customerServiceExample = new CustomerServiceExample();
CustomerServiceExample.Criteria sec = customerServiceExample.createCriteria();
sec.andServiceStateEqualTo(0);
List<CustomerService> customerServices = selectCustomerServiceList(customerServiceExample);
if (customerServices.isEmpty()) {
return null;
}
return customerServices.get(0);
}
Aggregations