| | |
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.HashSet;
|
| | | import java.util.List;
|
| | | import java.util.Set;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import javax.servlet.http.HttpServletResponse;
|
| | |
| | | import com.yeshi.fanli.entity.bus.user.cloud.UserCloudGroup;
|
| | | import com.yeshi.fanli.entity.bus.user.cloud.UserCloudManage;
|
| | | import com.yeshi.fanli.entity.bus.user.cloud.UserCloudOrder;
|
| | | import com.yeshi.fanli.entity.dynamic.GoodsEvaluate;
|
| | | import com.yeshi.fanli.entity.goods.CommonGoods;
|
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.exception.taobao.TaoKeApiException;
|
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
|
| | | import com.yeshi.fanli.exception.user.cloud.UserCloudException;
|
| | | import com.yeshi.fanli.exception.user.cloud.UserCloudGoodsException;
|
| | | import com.yeshi.fanli.exception.user.cloud.UserCloudGroupException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.dynamic.GoodsEvaluateService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderHongBaoMoneyComputeService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.cloud.UserCloudGoodsService;
|
| | |
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.aitaoker.AitaokerApiUtil;
|
| | | import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory;
|
| | | import com.yeshi.fanli.util.suning.SuningUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | | import com.yeshi.fanli.vo.goods.GoodsDetailVO;
|
| | | import com.yeshi.fanli.vo.user.cloud.UserCloudInfoVO;
|
| | |
| | |
|
| | | @Resource
|
| | | private UserCloudAlipayManager userCloudAlipayManager;
|
| | | |
| | | @Resource
|
| | | private GoodsEvaluateService goodsEvaluateService;
|
| | | |
| | | @Resource
|
| | | private ConfigService configService;
|
| | |
|
| | | /**
|
| | | * 查询开通记录
|
| | |
| | | JSONObject data = new JSONObject();
|
| | | QrcodeLoginDTO dto = AitaokerApiUtil.getQrcodeMacloginCheck(robotId, wId);
|
| | | if (dto != null) {
|
| | | LogHelper.cloudInfo("方法macloginCheck: [uid=" + uid + "][wxID=" + dto.getWcId() + "][ NickName=" + dto.getNickName() + "]" );
|
| | | try {
|
| | | // 更新微信信息
|
| | | userCloudService.updateWXInfo(uid, dto.getWcId(), dto.getNickName(), dto.getHeadUrl());
|
| | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | /**
|
| | | * 添加、取消发单库
|
| | | * 删除云发单备选库
|
| | | *
|
| | | * @param callback
|
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param goodsId
|
| | | * @param goodsType
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "accordGoods")
|
| | | public void accordGoods(String callback, AcceptData acceptData, Long uid, Long goodsId, Integer goodsType,
|
| | | PrintWriter out) {
|
| | | if (uid == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("用户未登录"));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (goodsType == null || goodsId == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(1, "参数不完整"));
|
| | | return;
|
| | | }
|
| | |
|
| | | try {
|
| | | boolean state = false;
|
| | | UserCloudGoods cloudGoods = userCloudGoodsService.getByUidAndGoods(uid, goodsId, goodsType);
|
| | | if (cloudGoods != null) { // 取消加入选品库
|
| | | userCloudGoodsService.deleteByPrimaryKeyAndUid(cloudGoods.getId(), uid);
|
| | | } else { // 加入选品库
|
| | | Set<Long> set = new HashSet<Long>();
|
| | | set.add(goodsId);
|
| | | userCloudGoodsService.addGoods(uid, set, goodsType);
|
| | | state = true;
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("state", state);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | } catch (UserCloudGoodsException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getMsg()));
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadFalseResult("操作失败"));
|
| | | LogHelper.errorDetailInfo(e);
|
| | | ;
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 添加、取消发单库
|
| | | * |
| | | * @param callback
|
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param goodsId
|
| | | * @param goodsType
|
| | | * @param id
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "deleteGoods")
|
| | |
| | | userCloudService.sendByDynamic(uid, id);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("一键发单成功"));
|
| | | } catch (UserCloudException e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getCode(),e.getMsg()));
|
| | | if (e.getCode() > 1000 && e.getCode() < 1100) {
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("link", configService.get(ConfigKeyEnum.robotCloudLink.getKey()));
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrue(e.getCode(), data, e.getMsg()).toString());
|
| | | } else {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getCode(),e.getMsg()));
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "sendGoods")
|
| | | public void sendCircle(String callback, AcceptData acceptData, Long uid, Long goodsId, Integer goodsType, PrintWriter out) {
|
| | | public void sendGoods(String callback, AcceptData acceptData, Long uid, String goodsId, Integer goodsType, PrintWriter out) {
|
| | | if (uid == null || goodsId == null || goodsType == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("参数不能为空"));
|
| | | return;
|
| | | }
|
| | |
|
| | | try {
|
| | | userCloudService.sendCustomGoods(uid, goodsId, goodsType);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("一键发单成功"));
|
| | | GoodsEvaluate evaluate = goodsEvaluateService.queryExistSingle(goodsId, goodsType);
|
| | | if (evaluate != null) {
|
| | | userCloudService.sendByDynamic(uid, evaluate.getId());
|
| | | } else {
|
| | | |
| | | Long gid = null;
|
| | | Long sellerId = null;
|
| | | if (goodsType == Constant.SOURCE_TYPE_SUNING) { // 苏宁
|
| | | String[] ids = SuningUtil.getGoodsIdDetail(goodsId);
|
| | | gid = Long.parseLong(ids[1]);
|
| | | sellerId = Long.parseLong(ids[0]);
|
| | | } else {
|
| | | gid = Long.parseLong(goodsId);
|
| | | }
|
| | | userCloudService.sendCustomGoods(uid, gid, goodsType, sellerId);
|
| | | }
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("加入发单库成功"));
|
| | | } catch (UserCloudException e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getCode(),e.getMsg()));
|
| | | if (e.getCode() > 1000 && e.getCode() < 1100) {
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("link", configService.get(ConfigKeyEnum.robotCloudLink.getKey()));
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrue(e.getCode(), data, e.getMsg()).toString());
|
| | | } else {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getCode(),e.getMsg()));
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|