use of com.itrus.portal.db.Courier in project portal by ixinportal.
the class PsCourierController method sendMoreSmsFhtz.
/**
* 发送属于快递配送的短信
*/
private Map<String, Object> sendMoreSmsFhtz(Long pcId) {
Map<String, Object> retMap = new HashMap<String, Object>();
// 0标识失败,1标识成功
retMap.put("retCode", 0);
try {
CourierInfo ci = sqlSession.selectOne("com.itrus.portal.db.CourierInfoMapper.selectByPrimaryKey", pcId);
if (null == ci) {
retMap.put("retMsg", "发送短信失败,未找到对应的快递配送记录");
return retMap;
}
Bill bill = sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByPrimaryKey", ci.getBill());
CourierExample courierex = new CourierExample();
Map<Long, Courier> couriermap = sqlSession.selectMap("com.itrus.portal.db.CourierMapper.selectByExample", courierex, "id");
// 查找对应项目的消息模版:FHTZ
MessageTemplate messageTemplate = messageTemplateService.getMsgTemp(bill.getProject(), "FHTZ");
if (null == messageTemplate) {
retMap.put("retMsg", "发送短信失败,未找到对应的快递配送消息模版");
return retMap;
}
String content = messageTemplate.getMessageContent();
if (StringUtils.isBlank(content) || content.indexOf("cItems") == -1 || content.indexOf("cId") == -1 || content.indexOf("cName") == -1) {
retMap.put("retMsg", "发送短信失败,快递配送消息模版配置错误");
return retMap;
}
String str = null;
if (ci.getCourierItems() == 1) {
str = "电子钥匙";
}
if (ci.getCourierItems() == 2) {
str = "发票";
}
if (ci.getCourierItems() == 3) {
str = "电子钥匙和发票";
}
content = content.replaceAll("cItems", str);
content = content.replaceAll("cId", ci.getCourierId());
content = content.replaceAll("cName", couriermap.get(ci.getCourier()).getCompanyName());
Delivery delivery = sqlSession.selectOne("com.itrus.portal.db.DeliveryMapper.selectByPrimaryKey", bill.getDelivery());
if (smsSendService.sendSms(delivery.getRvPhone(), content, "发货通知", bill.getProject(), bill.getUniqueId(), bill.getBillId())) {
ci.setMessageSms(1);
sqlSession.update("com.itrus.portal.db.CourierInfoMapper.updateByPrimaryKeySelective", ci);
retMap.put("retCode", 1);
retMap.put("retMsg", "发送短信成功");
}
} catch (Exception e) {
e.printStackTrace();
retMap.put("retMsg", "发送短信失败,errmsg:" + e.getMessage());
return retMap;
}
return retMap;
}
use of com.itrus.portal.db.Courier in project portal by ixinportal.
the class CourierController method delete.
// 删除
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE, produces = "text/html")
@ResponseBody
public String delete(@PathVariable("id") Long id, HttpServletRequest request, Model uiModel) {
Courier courier = sqlSession.selectOne("com.itrus.portal.db.CourierMapper.selectByPrimaryKey", id);
if (courier == null) {
// uiModel.addAttribute("message", "未找到要删除快递");
return "未找到要删除配送服务";
} else {
try {
sqlSession.delete("com.itrus.portal.db.CourierMapper.deleteByPrimaryKey", id);
String oper = "删除配送服务";
String info = "配送服务名称: " + courier.getCourierName();
LogUtil.adminlog(sqlSession, oper, info);
} catch (Exception e) {
// + "】存在关联,无法删除");
return "要删除配送服务【" + courier.getCourierName() + "】存在关联,无法删除";
}
}
return null;
}
use of com.itrus.portal.db.Courier in project portal by ixinportal.
the class CourierController method update.
// 修改处理
@RequestMapping(method = RequestMethod.PUT, produces = "text/html")
public String update(@Valid Courier courier, BindingResult bindingResult, Model uiModel, HttpServletRequest httpServletRequest) {
if (bindingResult.hasErrors()) {
uiModel.addAttribute("courier", courier);
return "courier/update";
}
Courier courier0 = sqlSession.selectOne("com.itrus.portal.db.CourierMapper.selectByPrimaryKey", courier.getId());
courier.setCreator(courier0.getCreator());
courier.setCreateTime(courier0.getCreateTime());
courier.setModifyTime(new Date());
courier.setModifier(getAdmin().getId());
sqlSession.update("com.itrus.portal.db.CourierMapper.updateByPrimaryKey", courier);
String oper = "修改配送服务";
String info = "配送服务名称: " + courier.getCourierName();
LogUtil.adminlog(sqlSession, oper, info);
return "redirect:/courier/" + courier.getId();
}
use of com.itrus.portal.db.Courier in project portal by ixinportal.
the class CourierController method updateForm.
// 返回修改页面
@RequestMapping(value = "/{id}", params = "form", produces = "text/html")
public String updateForm(@PathVariable("id") Long id, Model uiModel) {
Courier courier = sqlSession.selectOne("com.itrus.portal.db.CourierMapper.selectByPrimaryKey", id);
uiModel.addAttribute("courier", courier);
return "courier/update";
}
use of com.itrus.portal.db.Courier in project portal by ixinportal.
the class CourierController method show.
// 显示详情
@RequestMapping(value = "/{id}", produces = "text/html")
public String show(@PathVariable("id") Long id, Model uiModel) {
Courier courier = sqlSession.selectOne("com.itrus.portal.db.CourierMapper.selectByPrimaryKey", id);
uiModel.addAttribute("courier", courier);
return "courier/show";
}
Aggregations