Merge branch 'master' into dev1
Conflicts:
fanli/src/main/java/com/yeshi/fanli/controller/admin/UploadController.java
| | |
| | | import java.io.IOException;
|
| | | import java.io.InputStream;
|
| | | import java.io.PrintWriter;
|
| | | import java.util.Iterator;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | | import java.util.UUID;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | | import javax.servlet.http.HttpServletResponse;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | import org.springframework.core.task.TaskExecutor;
|
| | | import org.springframework.stereotype.Controller;
|
| | |
| | |
|
| | | import com.yeshi.fanli.entity.common.AdminUser;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.AdminUserService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderProcessService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoOrderService;
|
| | | import com.yeshi.fanli.util.CMQManager;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.annotation.RequestNoLogin;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoOrderUtil;
|
| | |
|
| | | import freemarker.core.ArithmeticEngine.ConservativeEngine;
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | @Controller
|
| | | @RequestMapping("admin/new/api/v1/upload")
|
| | |
| | |
|
| | | @Resource
|
| | | private OrderProcessService orderProcessService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private AdminUserService adminUserService;
|
| | | |
| | |
|
| | | @Resource(name = "taskExecutor")
|
| | | private TaskExecutor executor;
|
| | | |
| | | |
| | |
|
| | | @Resource
|
| | | private TaoBaoOrderService taoBaoOrderService;
|
| | |
|
| | | @Resource
|
| | | private RedisManager redisManager;
|
| | |
|
| | | // private static final String PAYSUCCESS = "支付成功";
|
| | | // private static final String ORDERCLOSE="订单关闭";
|
| | |
| | | InputStream inputStream = file.getInputStream();
|
| | | String contentType = file.getContentType();
|
| | | String type = contentType.substring(contentType.indexOf("/") + 1);
|
| | | String uploadFilePath = COSManager.getInstance().uploadFile(inputStream,
|
| | | UUID.randomUUID().toString().replace("-", "") + "." + type).getUrl();
|
| | | String uploadFilePath = COSManager.getInstance()
|
| | | .uploadFile(inputStream, UUID.randomUUID().toString().replace("-", "") + "." + type).getUrl();
|
| | | out.print(JsonUtil.loadTrueResult(uploadFilePath));
|
| | | } catch (IOException e) {
|
| | | e.printStackTrace();
|
| | |
| | | InputStream inputStream = file.getInputStream();
|
| | | String contentType = file.getContentType();
|
| | | String type = contentType.substring(contentType.indexOf("/") + 1);
|
| | | String uploadFilePath = COSManager.getInstance().uploadFile(inputStream,
|
| | | UUID.randomUUID().toString().replace("-", "") + "." + type + ".apk").getUrl();
|
| | | String uploadFilePath = COSManager.getInstance()
|
| | | .uploadFile(inputStream, UUID.randomUUID().toString().replace("-", "") + "." + type + ".apk")
|
| | | .getUrl();
|
| | | out.print(JsonUtil.loadTrueResult(uploadFilePath));
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | |
| | | String date = TimeUtil.getyyyyMMdd(timeMillis);
|
| | | String contentType = file.getContentType();
|
| | | String type = contentType.substring(contentType.indexOf("/") + 1);
|
| | | String uploadFilePath = COSManager.getInstance().uploadFile(inputStream,
|
| | | "section/" + date + "/" + timeMillis + "." + type).getUrl();
|
| | | String uploadFilePath = COSManager.getInstance()
|
| | | .uploadFile(inputStream, "section/" + date + "/" + timeMillis + "." + type).getUrl();
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("original", file.getOriginalFilename());
|
| | | data.put("name", file.getOriginalFilename());
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | private void addOrder(List<TaoBaoOrder> orderList) {
|
| | | try {
|
| | | taoBaoOrderService.addTaoBaoOrderList(orderList);
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | try {
|
| | | Map<String, List<TaoBaoOrder>> map = TaoBaoOrderUtil.classifyTaoBaoOrderByOrderId(orderList);
|
| | | if (map != null) {
|
| | | Iterator<String> its = map.keySet().iterator();
|
| | | while (its.hasNext()) {
|
| | | String key = its.next();
|
| | | List<TaoBaoOrder> orders = map.get(key);
|
| | | String redisKey = "addorderqueue-" + key;
|
| | | // redis做频率限制
|
| | | if (Constant.IS_OUTNET) {
|
| | | try {
|
| | | if (!StringUtil.isNullOrEmpty(redisManager.getCommonString(redisKey))) {
|
| | | continue;
|
| | | }
|
| | |
|
| | | } catch (Exception e) {
|
| | |
|
| | | }
|
| | | }
|
| | |
|
| | | CMQManager.getInstance().addTaoBaoOrderMsg(key, orders);
|
| | | try {
|
| | | // 6小时内不再处理
|
| | | if (Constant.IS_OUTNET) {
|
| | | redisManager.cacheCommonString(redisKey, "1", 60 * 60 * 6);
|
| | | }
|
| | | } catch (Exception e) {
|
| | |
|
| | | }
|
| | | }
|
| | | }
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "uploadOrder", method = RequestMethod.POST)
|
| | | public void uploadOrder(@RequestParam("file") CommonsMultipartFile file, PrintWriter out) {
|
| | |
|
| | | if (file != null) {
|
| | | try {
|
| | | List<TaoBaoOrder> orderList = TaoBaoOrderUtil.parseOrder(file.getInputStream());
|
| | | orderProcessService.processOrder(TaoBaoOrderUtil.classifyTaoBaoOrderByOrderId(orderList));
|
| | | // for(int i=0;i<orderList.size();i++)
|
| | | // {
|
| | | // if(!orderList.get(i).getOrderId().equalsIgnoreCase("229978886132510070")&&!orderList.get(i).getOrderId().equalsIgnoreCase("246314979024510070"))
|
| | | // {
|
| | | // orderList.remove(i--);
|
| | | // continue;
|
| | | // }
|
| | | //
|
| | | // }
|
| | | // orderProcessService.processOrder(TaoBaoOrderUtil.classifyTaoBaoOrderByOrderId(orderList));
|
| | | addOrder(orderList);
|
| | | } catch (IOException e) {
|
| | | e.printStackTrace();
|
| | | out.print(JsonUtil.loadFalseResult(e.getMessage()));
|
| | |
| | |
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 新后台端 上传订单文件
|
| | | * @param file excel文件
|
| | | * @param uid 当前用户id
|
| | | * |
| | | * @param file
|
| | | * excel文件
|
| | | * @param uid
|
| | | * 当前用户id
|
| | | * @param request
|
| | | * @param response
|
| | | * @param out
|
| | | */
|
| | | @RequestNoLogin()
|
| | | @RequestMapping(value = "uploadOrderFile")
|
| | | public void uploadOrderFile(@RequestParam("file") CommonsMultipartFile file, Long uid,
|
| | | HttpServletRequest request, HttpServletResponse response, PrintWriter out) {
|
| | | |
| | | public void uploadOrderFile(@RequestParam("file") CommonsMultipartFile file, Long uid, HttpServletRequest request,
|
| | | HttpServletResponse response, PrintWriter out) {
|
| | |
|
| | | response.setHeader("Access-Control-Allow-Origin", "*");
|
| | | response.setHeader("Access-Control-Allow-Methods", "*");
|
| | | |
| | |
|
| | | AdminUser admin = adminUserService.selectByPrimaryKey(uid);
|
| | | if (admin == null) {
|
| | | out.print(JsonUtil.loadFalseResult("用户验证未通过"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | if (file == null) {
|
| | | out.print(JsonUtil.loadFalseResult("上传文件不能为空"));
|
| | | return;
|
| | | }
|
| | | |
| | | List<TaoBaoOrder> orderList = null ;
|
| | |
|
| | | List<TaoBaoOrder> orderList = null;
|
| | | try {
|
| | | orderList = TaoBaoOrderUtil.parseOrder(file.getInputStream());
|
| | | out.print(JsonUtil.loadTrueResult("上传成功,系统正在处理中..."));
|
| | |
| | | out.print(JsonUtil.loadFalseResult("上传文件失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | |
| | |
|
| | | final List<TaoBaoOrder> list = orderList;
|
| | | |
| | |
|
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | | try {
|
| | | |
| | |
|
| | | orderProcessService.processOrder(TaoBaoOrderUtil.classifyTaoBaoOrderByOrderId(list));
|
| | | |
| | |
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | | });
|
| | | |
| | |
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 上传图片jsonp
|
| | | * @param file |
| | | * @param out |
| | | * |
| | | * @param file
|
| | | * @param out
|
| | | */
|
| | | @RequestNoLogin()
|
| | | @RequestMapping(value = "uploadPicture")
|
| | | public void uploadPicture(@RequestParam("file") CommonsMultipartFile file, Long uid, |
| | | HttpServletResponse response, PrintWriter out) {
|
| | | |
| | | public void uploadPicture(@RequestParam("file") CommonsMultipartFile file, Long uid, HttpServletResponse response,
|
| | | PrintWriter out) {
|
| | |
|
| | | response.setHeader("Access-Control-Allow-Origin", "*");
|
| | | response.setHeader("Access-Control-Allow-Methods", "*");
|
| | |
|
| | |
| | | out.print(JsonUtil.loadFalseResult("当前账户验证失败"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | if (file == null) {
|
| | | out.print(JsonUtil.loadFalseResult("上传文件为空"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | try {
|
| | | InputStream inputStream = file.getInputStream();
|
| | | String contentType = file.getContentType();
|
| | |
| | | data.put("state", "SUCCESS");
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | |
|
| | | out.print(JsonUtil.loadTrueResult(uploadPath));
|
| | |
|
| | | } catch (IOException e) {
|
| | | out.print(JsonUtil.loadFalseResult("上传图片失败"));
|
| | | e.printStackTrace();
|
| | |
| | | String type = contentType.substring(contentType.indexOf("/") + 1);
|
| | |
|
| | | // 上传文件相对位置
|
| | | String fileUrl="/img/admin/" + UUID.randomUUID().toString().replace("-", "") + "." + type + ".apk";
|
| | | String fileUrl="/apk/admin" + UUID.randomUUID().toString().replace("-", "") + "." + type + ".apk";
|
| | |
|
| | | String uploadFilePath = COSManager.getInstance().uploadFile(inputStream, fileUrl).getUrl();
|
| | |
|
| | |
| | | import org.springframework.web.bind.annotation.RequestMethod;
|
| | | import org.yeshi.utils.IPUtil;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | | import org.yeshi.utils.NumberUtil; |
| | | import org.yeshi.utils.NumberUtil;
|
| | | import org.yeshi.utils.taobao.TbImgUtil;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | |
| | |
|
| | | @Resource
|
| | | private ShamUserService shamUserService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private SpecialService specialService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private SwiperPictureService swiperPictureService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private MonitorService monitorService;
|
| | |
| | | out.print(JsonUtil.loadFalseResult(1, "系统不存在"));
|
| | | return;
|
| | | }
|
| | | // TaoBaoGoodsBrief alimama = TaoBaoUtil.isAlimama(id);
|
| | | // 获取淘客参数
|
| | | ClientTBPid clientTBPid = null;
|
| | | // 用户已经登录
|
| | | if (!StringUtil.isNullOrEmpty(uid) && Long.parseLong(uid) > 0) {
|
| | | TBPid tbPid = null;
|
| | | if (acceptData.getPlatform().equalsIgnoreCase("android")) {
|
| | | tbPid = tbPidService.getTBPid(Long.parseLong(uid), PidUser.TYPE_FANLI_ANDROID);
|
| | | if (tbPid != null) {
|
| | | String siteId = tbPid.getPid().split("_")[2];
|
| | | String adzoneId = tbPid.getPid().split("_")[3];
|
| | | TaoBaoUnionConfig config = taoBaoUnionConfigService.getConfigByAppIdCache(siteId);
|
| | | clientTBPid = new ClientTBPid(config.getAppKey(), tbPid.getPid(), siteId, adzoneId);
|
| | | } else {
|
| | | clientTBPid = tbPidService.getAndroidDefault();
|
| | | }
|
| | |
|
| | | } else {
|
| | | tbPid = tbPidService.getTBPid(Long.parseLong(uid), PidUser.TYPE_FANLI_IOS);
|
| | | if (tbPid != null) {
|
| | | String siteId = tbPid.getPid().split("_")[2];
|
| | | String adzoneId = tbPid.getPid().split("_")[3];
|
| | | TaoBaoUnionConfig config = taoBaoUnionConfigService.getConfigByAppIdCache(siteId);
|
| | | clientTBPid = new ClientTBPid(config.getAppKey(), tbPid.getPid(), siteId, adzoneId);
|
| | | } else {
|
| | | clientTBPid = tbPidService.getIOSDefault();
|
| | | }
|
| | | }
|
| | | } else {
|
| | | if (acceptData.getPlatform().equalsIgnoreCase("android"))
|
| | | clientTBPid = tbPidService.getAndroidDefault();
|
| | | else
|
| | | clientTBPid = tbPidService.getIOSDefault();
|
| | | }
|
| | |
|
| | | TaoBaoGoodsBrief tb = null;
|
| | | try {
|
| | | tb = redisManager.getTaoBaoGoodsBrief(Long.parseLong(id));
|
| | | TaoKeAppInfo app = new TaoKeAppInfo();
|
| | | TaoBaoUnionConfig config = taoBaoUnionConfigService.getConfigByAppIdCache(clientTBPid.getSiteId());
|
| | | app.setAdzoneId(clientTBPid.getAdZoneId());
|
| | | app.setAppKey(clientTBPid.getAppKey());
|
| | | app.setAppSecret(config.getAppSecret());
|
| | | app.setPid(clientTBPid.getPid());
|
| | | tb = TaoKeApiUtil.searchGoodsDetail(Long.parseLong(id), app);
|
| | | } catch (NumberFormatException e1) {
|
| | | e1.printStackTrace();
|
| | | } catch (TaobaoGoodsDownException e1) {
|
| | | e1.printStackTrace();
|
| | | out.print(JsonUtil.loadFalseResult(2, "商品已下架"));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (tb != null) {
|
| | | tb.setAuctionUrl(null);
|
| | | // tb.setAuctionUrl(null);
|
| | | tb.setId(null);
|
| | | int type = 0;
|
| | | if ("android".equalsIgnoreCase(acceptData.getPlatform()))
|
| | |
| | | Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
|
| | | JSONObject data = new JSONObject();
|
| | | TaoBaoGoodsBriefExtra taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(tb, configList.get(0));
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(tb.getCouponLink()) && taoBaoGoodsBriefExtra.getTaoBaoQuanInfo() != null)
|
| | | taoBaoGoodsBriefExtra.getTaoBaoQuanInfo().setCouponLink(tb.getCouponLink());
|
| | | taoBaoGoodsBriefExtra.setAuctionUrl(tb.getAuctionUrl());
|
| | | if (uid != null && !"".equals(uid.trim())) {
|
| | | CollectionGoods collectionGoods = collectionGoodsService.findByUidAndAuctionId(Long.parseLong(uid),
|
| | | Long.parseLong(id));
|
| | | data.put("collection", collectionGoods != null ? true : false);
|
| | | }
|
| | |
|
| | | // 获取淘客参数
|
| | | ClientTBPid clientTBPid = null;
|
| | | // 用户已经登录
|
| | | if (!StringUtil.isNullOrEmpty(uid) && Long.parseLong(uid) > 0) {
|
| | | TBPid tbPid = null;
|
| | | if (acceptData.getPlatform().equalsIgnoreCase("android")) {
|
| | | tbPid = tbPidService.getTBPid(Long.parseLong(uid), PidUser.TYPE_FANLI_ANDROID);
|
| | | if (tbPid != null) {
|
| | | String siteId = tbPid.getPid().split("_")[2];
|
| | | String adzoneId = tbPid.getPid().split("_")[3];
|
| | | TaoBaoUnionConfig config = taoBaoUnionConfigService.getConfigByAppIdCache(siteId);
|
| | | clientTBPid = new ClientTBPid(config.getAppKey(), tbPid.getPid(), siteId, adzoneId);
|
| | | } else {
|
| | | clientTBPid = tbPidService.getAndroidDefault();
|
| | | }
|
| | |
|
| | | } else {
|
| | | tbPid = tbPidService.getTBPid(Long.parseLong(uid), PidUser.TYPE_FANLI_IOS);
|
| | | if (tbPid != null) {
|
| | |
|
| | | String siteId = tbPid.getPid().split("_")[2];
|
| | | String adzoneId = tbPid.getPid().split("_")[3];
|
| | | TaoBaoUnionConfig config = taoBaoUnionConfigService.getConfigByAppIdCache(siteId);
|
| | | clientTBPid = new ClientTBPid(config.getAppKey(), tbPid.getPid(), siteId, adzoneId);
|
| | | } else {
|
| | | clientTBPid = tbPidService.getIOSDefault();
|
| | | }
|
| | | }
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(tb.getCouponLink()) && taoBaoGoodsBriefExtra.getTaoBaoQuanInfo() != null)
|
| | | taoBaoGoodsBriefExtra.getTaoBaoQuanInfo().setCouponLink(TaoBaoCouponUtil
|
| | | .getCoupleUrl(tb.getCouponActivityId(), tbPid.getPid(), tb.getAuctionId() + ""));
|
| | |
|
| | | } else {
|
| | | if (acceptData.getPlatform().equalsIgnoreCase("android"))
|
| | | clientTBPid = tbPidService.getAndroidDefault();
|
| | | else
|
| | | clientTBPid = tbPidService.getIOSDefault();
|
| | | }
|
| | |
|
| | | data.put("tbPidInfo", clientTBPid);
|
| | |
|
| | | taoBaoGoodsBriefExtra.setAuctionUrl(null);
|
| | | // taoBaoGoodsBriefExtra.setAuctionUrl(null);
|
| | | data.put("taobao", gson.toJson(taoBaoGoodsBriefExtra));
|
| | | String info = configService.get("detail_prompt");
|
| | | data.put("info", info);
|
| | |
| | | */
|
| | | @RequestMapping(value = "getRecommendInfo")
|
| | | public void getRecommendHomeInfo(AcceptData acceptData, PrintWriter out) {
|
| | | |
| | |
|
| | | System system = systemService.getSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "系统不存在"));
|
| | |
| | | out.print(JsonUtil.loadTrueResult(root));
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 新版推荐专题管理(1.4.0)
|
| | | *
|
| | |
| | | out.print(JsonUtil.loadFalseResult(1, "系统不存在"));
|
| | | return;
|
| | | }
|
| | | |
| | | List<SwiperPicture> listswiper = null;
|
| | |
|
| | | List<SwiperPicture> listswiper = null;
|
| | | if (!StringUtil.isNullOrEmpty(specialCard)) {
|
| | | try {
|
| | | |
| | |
|
| | | listswiper = swiperPictureService.getByBannerCard(swiperCard);
|
| | | |
| | |
|
| | | if (listswiper != null && listswiper.size() > 0) {
|
| | | for (SwiperPicture swiperPicture: listswiper) {
|
| | | for (SwiperPicture swiperPicture : listswiper) {
|
| | | swiperPicture.setBannerId(null);
|
| | | swiperPicture.setCreatetime(null);
|
| | | swiperPicture.setUpdatetime(null);
|
| | |
| | | swiperPicture.setRemark(null);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | Special miaoShaSpecial = null;
|
| | | List<Special> honestList = new ArrayList<Special>();
|
| | | List<Special> honestList = new ArrayList<Special>();
|
| | | List<Special> specialList = new ArrayList<Special>();
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(specialCard)) {
|
| | | try {
|
| | | List<Special> listSpecial = specialService.listBySystemAndCard(specialCard, system.getId());
|
| | | |
| | |
|
| | | if (listSpecial != null && listSpecial.size() > 0) {
|
| | | for (Special special: listSpecial) {
|
| | | for (Special special : listSpecial) {
|
| | | special.setCreatetime(null);
|
| | | special.setUpdatetime(null);
|
| | | special.setState(null);
|
| | | special.setRemark(null);
|
| | | special.setCard(null);
|
| | | special.setCardId(null);
|
| | | |
| | |
|
| | | if ("限时秒杀".equals(special.getName())) {
|
| | | miaoShaSpecial = special;
|
| | | continue;
|
| | | }
|
| | | |
| | |
|
| | | if ("arc".equals(special.getShowType())) {
|
| | | // 同一行专题
|
| | | honestList.add(special);
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | |
| | |
|
| | | }
|
| | |
|
| | | /* 限时秒杀 - 时间处理 */
|
| | |
| | | break;
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | if (hour < 0)
|
| | | hour = 24;
|
| | | long time = TimeUtil.convertToTimeTemp(TimeUtil.getGernalTime(calendar.getTimeInMillis(), "yyyy-MM-dd"),
|
| | |
| | | root.put("miaoSha", msJSON);
|
| | |
|
| | | out.print(JsonUtil.loadTrueResult(root));
|
| | | |
| | |
|
| | | }
|
| | | |
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 商品基本详情 (1.4.0)
|
| | | *
|
| | |
| | | @Expose
|
| | | private String tbToken;
|
| | | @Expose
|
| | | private int collected; // 0-没有收藏 1-已收藏 |
| | |
|
| | | private int collected; // 0-没有收藏 1-已收藏
|
| | |
|
| | | public String getTbToken() {
|
| | | return tbToken;
|
| | |
| | | this.collected = collected;
|
| | | }
|
| | |
|
| | | |
| | | }
|
| | |
| | | if (activity.getType() != RecommendActivity.TYPE_SHARE_GOODS)
|
| | | throw new ActivityException(3, "不属于分享商品动态");
|
| | | ActivityShareResult result = new ActivityShareResult();
|
| | | result.setTitle(activity.getTitle().replace("<br>", "/n").replace("<p>", "").replace("</p>", ""));
|
| | | String title = activity.getTitle().replace("<br>", "/n").replace("<p>", "").replace("</p>", "");
|
| | | if (title != null && title.trim().endsWith("/n"))
|
| | | title = title.trim().substring(0, title.trim().length() - 2);
|
| | | result.setTitle(title);
|
| | | List<FileUploadResult> imgList = new ArrayList<>();
|
| | | if (activity.getGoodsList() != null) {
|
| | | // 提前分配好PID
|
| | |
| | |
|
| | | import com.yeshi.fanli.dao.goods.CollectionGoodsDao;
|
| | | import com.yeshi.fanli.entity.bus.user.CollectionGoods;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.service.inter.goods.CollectionGoodsService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
|
| | |
| | | return null;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void updateCollectionGoods(TaoBaoGoodsBrief goods) {
|
| | | if (goods != null && goods.getAuctionId() != null) {
|
| | | long count = dao.getCount("select count(*) from CollectionGoods cg where cg.auctionId=?",
|
| | | new Serializable[] { goods.getAuctionId() });
|
| | | if (count > 0) {
|
| | | int pageSize = 50;
|
| | | int page = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | | for (int i = 0; i < page; i++) {
|
| | | List<CollectionGoods> list = dao.list("from CollectionGoods cg where cg.auctionId=?", i * pageSize,
|
| | | pageSize, new Serializable[] { goods.getAuctionId() });
|
| | | if (list != null)
|
| | | for (CollectionGoods cg : list) {
|
| | | cg = getCollectionGoods(cg, goods);
|
| | | if (cg != null)
|
| | | dao.update(cg);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | private static CollectionGoods getCollectionGoods(CollectionGoods collectionGoods, TaoBaoGoodsBrief goods) {
|
| | | if (collectionGoods == null || goods == null)
|
| | | return null;
|
| | | // 更新商品信息(标题,销量,图片,佣金比例,价格,券信息)
|
| | | collectionGoods.setBiz30day(goods.getBiz30day());
|
| | | collectionGoods.setTitle(goods.getTitle());
|
| | | collectionGoods.setCouponAmount(goods.getCouponAmount());
|
| | | collectionGoods.setCouponEffectiveEndTime(goods.getCouponEffectiveEndTime());
|
| | | collectionGoods.setCouponLeftCount(goods.getCouponLeftCount());
|
| | | collectionGoods.setCouponEffectiveStartTime(goods.getCouponEffectiveStartTime());
|
| | | collectionGoods.setCouponStartFee(goods.getCouponStartFee());
|
| | | collectionGoods.setCouponTotalCount(goods.getCouponTotalCount());
|
| | | collectionGoods.setTkRate(goods.getTkRate());
|
| | | collectionGoods.setPictUrl(goods.getPictUrl());
|
| | | collectionGoods.setZkPrice(goods.getZkPrice());
|
| | | collectionGoods.setReservePrice(goods.getReservePrice());
|
| | | return collectionGoods;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | });
|
| | | }
|
| | | } else if ("订单结算".equals(taoBaoOrder.getOrderState())) {// 更新预估获取时间
|
| | | BigDecimal money = MoneyBigDecimalUtil.mul(taoBaoOrder.getEstimate(), rate);
|
| | | BigDecimal money = MoneyBigDecimalUtil.mul(taoBaoOrder.geteIncome(), rate);
|
| | | // 设置预计领取时间
|
| | | long settlementTime = TimeUtil.convertDateToTemp2(taoBaoOrder.getSettlementTime().trim());
|
| | | // 预计领取时间
|
| | |
| | | hongBaoMapper.updateByPrimaryKeySelective(updateChildHongBao);
|
| | | });
|
| | |
|
| | | BigDecimal estimate = taoBaoOrder.getEstimate();
|
| | | BigDecimal estimate = taoBaoOrder.geteIncome();
|
| | | updateHongBao.setPayMoney(taoBaoOrder.getSettlement());
|
| | | updateHongBao.setMoney(MoneyBigDecimalUtil.mul(estimate, rate));
|
| | | }
|
| | |
|
| | |
| | |
|
| | | // 创建红包
|
| | | JSONObject data = new JSONObject();
|
| | | HongBao hongBao = HongBaoFactory.createHongBao(MoneyBigDecimalUtil.mul(baseRate, taoBaoOrder.getEstimate()),
|
| | | data.toString(), order.getId(), null, order.getUserInfo(), 1, taoBaoOrder.getPayment(),
|
| | | taoBaoOrder.getAuctionId());
|
| | | HongBao hongBao = null;
|
| | | if (taoBaoOrder.getOrderState().equalsIgnoreCase("订单结算"))
|
| | | // 订单结算应该取结算金额与预估收入
|
| | | hongBao = HongBaoFactory.createHongBao(MoneyBigDecimalUtil.mul(baseRate, taoBaoOrder.geteIncome()),
|
| | | data.toString(), order.getId(), null, order.getUserInfo(), 1, taoBaoOrder.getSettlement(),
|
| | | taoBaoOrder.getAuctionId());
|
| | | else
|
| | | hongBao = HongBaoFactory.createHongBao(MoneyBigDecimalUtil.mul(baseRate, taoBaoOrder.getEstimate()),
|
| | | data.toString(), order.getId(), null, order.getUserInfo(), 1, taoBaoOrder.getPayment(),
|
| | | taoBaoOrder.getAuctionId());
|
| | |
|
| | | hongBao.setOrderId(taoBaoOrder.getOrderId());
|
| | | hongBao.setOrderItemId(orderItem.getId());
|
| | | hongBao.setPreGettime(0L);
|
| | |
| | | else
|
| | | rate = new BigDecimal(hbm.getValue()).divide(new BigDecimal(100));
|
| | | if (rate.compareTo(new BigDecimal(0)) > 0) {
|
| | | HongBao hongBao2 = HongBaoFactory.createHongBao(
|
| | | HongBao hongBao2 = null;
|
| | | if (taoBaoOrder.getOrderState().equalsIgnoreCase("订单结算")) {
|
| | | // 订单结算应该取结算金额与预估收入
|
| | | hongBao2 = HongBaoFactory.createHongBao(
|
| | | MoneyBigDecimalUtil.mul(rate, MoneyBigDecimalUtil.mul(taoBaoOrder.geteIncome(), baseRate)),
|
| | | null, hongBao, boss, Constant.ONESALE);
|
| | | } else {
|
| | | hongBao2 = HongBaoFactory.createHongBao(
|
| | | MoneyBigDecimalUtil.mul(rate, MoneyBigDecimalUtil.mul(taoBaoOrder.getEstimate(), baseRate)),
|
| | | null, hongBao, boss, Constant.ONESALE);
|
| | | }
|
| | |
|
| | | HongBaoFactory.createHongBao(
|
| | | MoneyBigDecimalUtil.mul(rate, MoneyBigDecimalUtil.mul(taoBaoOrder.getEstimate(), baseRate)),
|
| | | null, hongBao, boss, Constant.ONESALE);
|
| | | // 设置订单号
|
| | |
| | | else
|
| | | rate = new BigDecimal(hbm.getValue()).divide(new BigDecimal(100));
|
| | | if (rate.compareTo(new BigDecimal(0)) > 0) {
|
| | |
|
| | | HongBao hongBao3 = HongBaoFactory.createHongBao(
|
| | | MoneyBigDecimalUtil.mul(rate, MoneyBigDecimalUtil.mul(taoBaoOrder.getEstimate(), baseRate)),
|
| | | null, hongBao, boss2, Constant.TWOSALE);
|
| | | // 订单结算应该取结算金额与预估收入
|
| | | HongBao hongBao3 = null;
|
| | | if (taoBaoOrder.getOrderState().equalsIgnoreCase("订单结算"))
|
| | | hongBao3 = HongBaoFactory.createHongBao(
|
| | | MoneyBigDecimalUtil.mul(rate,
|
| | | MoneyBigDecimalUtil.mul(taoBaoOrder.geteIncome(), baseRate)),
|
| | | null, hongBao, boss2, Constant.TWOSALE);
|
| | | else
|
| | | hongBao3 = HongBaoFactory.createHongBao(
|
| | | MoneyBigDecimalUtil.mul(rate,
|
| | | MoneyBigDecimalUtil.mul(taoBaoOrder.getEstimate(), baseRate)),
|
| | | null, hongBao, boss2, Constant.TWOSALE);
|
| | | // 设置返利订单号
|
| | | hongBao3.setOrderId(taoBaoOrder.getOrderId());
|
| | | hongBaoMapper.insertSelective(hongBao3);
|
| | |
| | | updateOrderItem.setSettlementTime(newOrderItem.getSettlementTime());
|
| | | updateOrderItem.setState(newOrderItem.getState());
|
| | | updateOrderItem.setPrePayMoney(taoBaoOrder.getPrice().multiply(new BigDecimal(taoBaoOrder.getCount())));
|
| | | updateOrderItem.setPayMoney(newOrderItem.getPayMoney());
|
| | | updateOrderItem.setFanMoney(newOrderItem.getFanMoney());
|
| | | orderItemMapper.updateByPrimaryKeySelective(updateOrderItem);
|
| | | } else if (newOrderItem.getState() == OrderItem.STATE_JIESUAN) {
|
| | | OrderItem updateOrderItem = new OrderItem();
|
| | | // 处理正常状态
|
| | | updateOrderItem.setId(oldOrderItem.getId());
|
| | | updateOrderItem.setSettlementTime(newOrderItem.getSettlementTime());
|
| | | updateOrderItem.setState(newOrderItem.getState());
|
| | | updateOrderItem.setPrePayMoney(taoBaoOrder.getPrice().multiply(new BigDecimal(taoBaoOrder.getCount())));
|
| | | updateOrderItem.setPayMoney(newOrderItem.getPayMoney());
|
| | | updateOrderItem.setFanMoney(newOrderItem.getFanMoney());
|
| | | orderItemMapper.updateByPrimaryKeySelective(updateOrderItem);
|
| | | }
|
| | |
|
| | |
| | | } else// 计算订单的总金额
|
| | | {
|
| | | BigDecimal money = new BigDecimal(0);
|
| | | for (TaoBaoOrder o : orderList)
|
| | | money = money.add(o.getPayment());
|
| | | for (TaoBaoOrder o : orderList) {
|
| | | if (o.getOrderState().equalsIgnoreCase("订单结算"))
|
| | | money = money.add(o.getSettlement());
|
| | | else {
|
| | | money = money.add(o.getPayment());
|
| | | }
|
| | | }
|
| | | updateOrder.setMoney(money);
|
| | | String thirdState = null;
|
| | | for (TaoBaoOrder o : orderList)
|
| | |
| | | HongBao.TYPE_SHARE_GOODS, HongBao.STATE_BUKELINGQU, new Date().getTime(),
|
| | | new Date().getTime(), 0, "192.168.1.1", "系统添加");
|
| | | hongBao.setOrderId(order.getOrderId());
|
| | | hongBao.setPayMoney(order.getPayMoney());
|
| | | if ("订单结算".equalsIgnoreCase(order.getState()))
|
| | | hongBao.setPayMoney(order.getFinalMoney());
|
| | | else
|
| | | hongBao.setPayMoney(order.getPayMoney());
|
| | | if (order.getBalanceTime() != null)
|
| | | hongBao.setBalanceTime(order.getBalanceTime());
|
| | |
|
| | |
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
|
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsUpdateException;
|
| | | import com.yeshi.fanli.service.inter.activity.ActivityService;
|
| | | import com.yeshi.fanli.service.inter.goods.CollectionGoodsService;
|
| | | import com.yeshi.fanli.service.inter.goods.RecommendSectionGoodsService;
|
| | | import com.yeshi.fanli.service.inter.lable.QualityFactoryService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
|
| | |
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsBriefMapper taoBaoGoodsBriefMapper;
|
| | |
|
| | | @Resource
|
| | | private CollectionGoodsService collectionGoodsService;
|
| | |
|
| | | @Override
|
| | | public void startUpdate() {
|
| | |
| | | TaoBaoGoodsBrief updateGoods = getUpdateTaoBaoGoodsBrief(goods);
|
| | | System.out.println("更细信息:" + new Gson().toJson(updateGoods));
|
| | | taoBaoGoodsBriefMapper.updateByPrimaryKeySelective(updateGoods);
|
| | | // 更新收藏信息
|
| | | collectionGoodsService.updateCollectionGoods(goods);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | import com.yeshi.fanli.entity.admin.ReslutOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoOrderService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoOrderUtil;
|
| | |
| | | String key = "addorder-" + orderId;
|
| | | // redis做频率限制
|
| | | try {
|
| | | if (!StringUtil.isNullOrEmpty(redisManager.getCommonString(key))) {
|
| | | continue;
|
| | | if (Constant.IS_OUTNET) {
|
| | | if (!StringUtil.isNullOrEmpty(redisManager.getCommonString(key))) {
|
| | | continue;
|
| | | }
|
| | | }
|
| | |
|
| | | } catch (Exception e) {
|
| | |
| | | addTaoBaoOrder(orderId, map.get(orderId));
|
| | | try {
|
| | | // 6小时内不再处理
|
| | | redisManager.cacheCommonString(key, "1", 60 * 60 * 6);
|
| | | if (Constant.IS_OUTNET)
|
| | | redisManager.cacheCommonString(key, "1", 60 * 60 * 6);
|
| | | } catch (Exception e) {
|
| | |
|
| | | }
|
| | |
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.CollectionGoods;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | |
|
| | | public interface CollectionGoodsService {
|
| | | /**
|
| | |
| | | void delete(long auctionId, long uid);
|
| | |
|
| | | void clear(long uid);
|
| | | |
| | | /**
|
| | | * 更新收藏的商品信息
|
| | | * @param goods
|
| | | */
|
| | | void updateCollectionGoods(TaoBaoGoodsBrief goods);
|
| | |
|
| | | }
|
| | |
| | | TaoBaoOrder taoBaoOrder = validTaoBaoOrderList.get(i);
|
| | | for (int n = 0; n < hongBaoList.size(); n++) {
|
| | | HongBao hongBao = hongBaoList.get(n);
|
| | | if (taoBaoOrder.getAuctionId().longValue() == hongBao.getAuctionId()
|
| | | && taoBaoOrder.getPayment().compareTo(hongBao.getPayMoney()) == 0) {
|
| | | validHongBaoList.add(hongBao);
|
| | | hongBaoList.remove(n);
|
| | | break;
|
| | |
|
| | | if (taoBaoOrder.getOrderState().equalsIgnoreCase("订单结算")) {
|
| | | if (taoBaoOrder.getAuctionId().longValue() == hongBao.getAuctionId()
|
| | | &&( taoBaoOrder.getSettlement().compareTo(hongBao.getPayMoney()) == 0||taoBaoOrder.getPayment().compareTo(hongBao.getPayMoney()) == 0)) {
|
| | | validHongBaoList.add(hongBao);
|
| | | hongBaoList.remove(n);
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | else {
|
| | |
|
| | | if (taoBaoOrder.getAuctionId().longValue() == hongBao.getAuctionId()
|
| | | && taoBaoOrder.getPayment().compareTo(hongBao.getPayMoney()) == 0) {
|
| | | validHongBaoList.add(hongBao);
|
| | | hongBaoList.remove(n);
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | font = font.deriveFont(50.0f);
|
| | | g2d.setFont(font);
|
| | | g2d.setColor(new Color(229, 0, 93));
|
| | | g2d.drawString("返利券提醒您", 312, 1118 + 40);
|
| | | // g2d.drawString("返利券提醒您", 312, 1118 + 40);
|
| | |
|
| | | g2d.setColor(new Color(102, 102, 102));
|
| | | g2d.drawString("长按识别二维码领取优惠券", 312, 1118 + 105);
|
| | | g2d.drawString("长按识别二维码领取优惠券", 312, 1118 + 77);
|
| | |
|
| | | g2d.dispose();
|
| | |
|
| | |
| | | orderItem.setSettlementTime(0L);
|
| | | String createTime = tbo.getCreateTime();
|
| | | orderItem.setCreateTime(TimeUtil.convertDateToTemp2(createTime));
|
| | | orderItem.setFanMoney(MoneyBigDecimalUtil.mul(rate.divide(BigDecimal.valueOf(100)), tbo.getEstimate()));
|
| | | orderItem.setPayMoney(tbo.getPayment());
|
| | | if ("订单结算".equalsIgnoreCase(tbo.getOrderState()))
|
| | | orderItem.setFanMoney(MoneyBigDecimalUtil.mul(rate.divide(BigDecimal.valueOf(100)), tbo.geteIncome()));
|
| | | else
|
| | | orderItem.setFanMoney(MoneyBigDecimalUtil.mul(rate.divide(BigDecimal.valueOf(100)), tbo.getEstimate()));
|
| | | if ("订单结算".equalsIgnoreCase(tbo.getOrderState()))
|
| | | orderItem.setPayMoney(tbo.getSettlement());
|
| | | else
|
| | | orderItem.setPayMoney(tbo.getPayment());
|
| | |
|
| | | orderItem.setOrder(order);
|
| | | orderItem.setOrderId(tbo.getOrderId());
|
| | |
|
| | |
| | | pidOrder.setOrderType(taoBaoOrder.getOrderType());
|
| | | pidOrder.setRate(taoBaoOrder.getiRatio());
|
| | | pidOrder.setPayMoney(taoBaoOrder.getPayment());
|
| | | pidOrder.setPreMoney(taoBaoOrder.getEstimate());
|
| | | if ("订单结算".equalsIgnoreCase(taoBaoOrder.getOrderState()))
|
| | | pidOrder.setPreMoney(taoBaoOrder.geteIncome());
|
| | | else
|
| | | pidOrder.setPreMoney(taoBaoOrder.getEstimate());
|
| | | pidOrder.setFinalMoney(taoBaoOrder.getSettlement());
|
| | | if (!StringUtil.isNullOrEmpty(taoBaoOrder.getSettlementTime()))
|
| | | pidOrder.setBalanceTime(new Date(TimeUtil.convertDateToTemp2(taoBaoOrder.getSettlementTime())));
|