use of com.ikoori.vip.common.persistence.model.Picture in project vip by guangdada.
the class UserMgrController method upload.
/**
* 上传图片(上传到项目的webapp/static/img)
*/
@RequestMapping(method = RequestMethod.POST, path = "/upload")
@ResponseBody
public JSONObject upload(@RequestPart("file") MultipartFile picture) {
JSONObject obj = new JSONObject();
String pictureName = UUID.randomUUID().toString() + ".jpg";
try {
String fileSavePath = gunsProperties.getFileUploadPath();
picture.transferTo(new File(fileSavePath + pictureName));
Picture pic = new Picture();
pic.setPictypeId(PicType.LOGO.getCode());
pic.setRealName(picture.getOriginalFilename());
pic.setUrl(fileSavePath + pictureName);
pic.setName(pictureName);
Integer picId = pictureMapper.insert(pic);
obj.put("pictureName", pictureName);
obj.put("pictureId", picId);
} catch (Exception e) {
throw new BussinessException(BizExceptionEnum.UPLOAD_ERROR);
}
return obj;
}
use of com.ikoori.vip.common.persistence.model.Picture in project vip by guangdada.
the class PictureController method pictureUpdate.
/**
* 跳转到修改图片
*/
@Permission
@RequestMapping("/picture_update/{pictureId}")
public String pictureUpdate(@PathVariable Long pictureId, Model model) {
Picture picture = pictureService.selectById(pictureId);
model.addAttribute(picture);
return PREFIX + "picture_edit.html";
}
use of com.ikoori.vip.common.persistence.model.Picture in project vip by guangdada.
the class PictureController method list.
/**
* 获取图片列表
*/
@Permission
@RequestMapping(value = "/list")
@ResponseBody
public Object list(String condition) {
Page<Picture> page = new PageFactory<Picture>().defaultPage();
Long userId = Long.valueOf(ShiroKit.getUser().getId());
Merchant merchant = merchantService.getMerchantUserId(userId);
List<Map<String, Object>> result = pictureService.getPictureList(page, condition, page.getOrderByField(), page.isAsc(), merchant.getId());
page.setRecords((List<Picture>) new PictureWarpper(result).warp());
return super.packForBT(page);
}
use of com.ikoori.vip.common.persistence.model.Picture in project vip by guangdada.
the class StoreApiImpl method getStoreDetail.
/**
* <p>Title: getStoreDetail</p>
* <p>Description: 会员门店详情</p>
* @param storeId 门店id
* @return
* @see com.ikoori.vip.api.service.StoreApi#getStoreDetail(java.lang.Long)
*/
@Override
public JSONObject getStoreDetail(Long storeId) {
log.info("进入getStoreDetail>>storeId=" + storeId);
Store store = storeDao.getStoreDetail(storeId);
JSONObject obj = new JSONObject();
List<Picture> pictures = storePhotoDao.selectStorePhoto(storeId);
obj.put("id", store.getId());
obj.put("name", store.getName());
obj.put("address", store.getAddress());
obj.put("latitude", store.getLatitude());
obj.put("longitude", store.getLongitude());
obj.put("servicePhone", store.getServicePhone());
obj.put("openTime", store.getOpenTime());
obj.put("closeTime", store.getCloseTime());
obj.put("pictures", pictures);
log.info("结束getStoreDetail");
return obj;
}
use of com.ikoori.vip.common.persistence.model.Picture in project vip by guangdada.
the class UploadController method upload.
private JSONObject upload(MultipartFile picture, PicType picType) {
JSONObject obj = new JSONObject();
String pictureName = UUID.randomUUID().toString() + ".jpg";
try {
Long userId = Long.valueOf(ShiroKit.getUser().getId());
String fileSavePath = gunsProperties.getFileUploadPath() + pictureName;
picture.transferTo(new File(fileSavePath));
Picture pic = new Picture();
if (ShiroKit.hasRole(Const.MERCHANT_NAME)) {
Merchant merchant = merchantService.getMerchantUserId(userId);
pic.setMerchantId(merchant.getId());
}
pic.setPictypeId(picType.getCode());
pic.setRealName(picture.getOriginalFilename());
pic.setAbsUrl(gunsProperties.getImageUrl() + "/" + pictureName);
pic.setName(pictureName);
pictureMapper.insert(pic);
obj.put("pictureName", pic.getAbsUrl());
obj.put("pictureId", pic.getId());
} catch (Exception e) {
throw new BussinessException(BizExceptionEnum.UPLOAD_ERROR);
}
return obj;
}
Aggregations