use of com.itrus.portal.db.CourierExample 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.CourierExample in project portal by ixinportal.
the class CourierController method list.
// 列表所有信息
@RequestMapping(produces = "text/html")
public String list(@RequestParam(value = "message", required = false) Integer message, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, Model uiModel) throws Exception {
// page,size
if (page == null || page < 1)
page = 1;
if (size == null || size < 1)
size = 10;
// count,pages
Integer count = sqlSession.selectOne("com.itrus.portal.db.CourierMapper.countByExample", null);
uiModel.addAttribute("count", count);
uiModel.addAttribute("pages", (count + size - 1) / size);
// page, size
if (page > 1 && size * (page - 1) >= count) {
page = (count + size - 1) / size;
}
uiModel.addAttribute("page", page);
uiModel.addAttribute("size", size);
// query data
Integer offset = size * (page - 1);
CourierExample courierex = new CourierExample();
// projectex.or().andIdIsNotNull();
courierex.setOffset(offset);
courierex.setLimit(size);
List courierexall = sqlSession.selectList("com.itrus.portal.db.CourierMapper.selectByExample", courierex);
uiModel.addAttribute("couriers", courierexall);
// itemcount
uiModel.addAttribute("itemcount", courierexall.size());
uiModel.addAttribute("message", message == null ? "" : "要删除的快递配置存在关联,无法删除");
return "courier/list";
}
use of com.itrus.portal.db.CourierExample in project portal by ixinportal.
the class CourierServiceImpl method getCourierMap.
/**
* 根据配送服务id集合,查询所有配送服务Map
*
* @param courierIds
* @return
*/
public Map<Long, Courier> getCourierMap(Long[] courierIds) {
Map<Long, Courier> courierMap = new HashMap<Long, Courier>();
if (null != courierIds) {
CourierExample example = new CourierExample();
CourierExample.Criteria criteria = example.or();
criteria.andIdIn(Arrays.asList(courierIds));
courierMap = sqlSession.selectMap("com.itrus.portal.db.CourierMapper.selectByExample", example, "id");
}
return courierMap;
}
Aggregations