| | |
| | | import java.lang.reflect.InvocationTargetException;
|
| | | import java.lang.reflect.Type;
|
| | | import java.math.BigDecimal;
|
| | | import java.text.SimpleDateFormat;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Arrays;
|
| | | import java.util.Date;
|
| | |
| | | import javax.annotation.Resource;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | import org.apache.commons.beanutils.PropertyUtils;
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RequestMethod;
|
| | | import org.yeshi.utils.BigDecimalUtil;
|
| | | import org.yeshi.utils.HttpUtil;
|
| | | import org.yeshi.utils.IPUtil;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
| | | import com.yeshi.fanli.entity.bus.user.OrderItem;
|
| | | import com.yeshi.fanli.entity.bus.user.PassWordErrorRecord;
|
| | | import com.yeshi.fanli.entity.bus.user.SMSHistory;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSaleExtraInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserActiveLog;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.WeiXinUser;
|
| | |
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoMessageService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.ThreeSaleExtraInfoSerivce;
|
| | | import com.yeshi.fanli.service.inter.hongbao.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.order.LostOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderItemServcie;
|
| | |
| | | import com.yeshi.fanli.util.account.UserUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.wx.WXLoginUtil;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | @Controller
|
| | | @RequestMapping("api/v1/customer")
|
| | |
| | |
|
| | | @Resource
|
| | | private ThreeSaleSerivce threeSaleSerivce;
|
| | | |
| | | @Resource
|
| | | private ThreeSaleExtraInfoSerivce threeSaleExtraInfoSerivce;
|
| | |
|
| | | @Resource
|
| | | private LostOrderService lostOrderService;
|
| | |
| | | .loadTrueResult(String.format("%s?id=" + id, Constant.systemCommonConfig.getAppShareInfoUrl())));
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 用户队员列表查询 1.4.1
|
| | | * @param acceptData
|
| | | * @param id
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getMyTeam", method = RequestMethod.POST)
|
| | | public void getMyTeam(AcceptData acceptData, long page, long uid, long type, PrintWriter out) {
|
| | | |
| | | int pageSize = Constant.PAGE_SIZE;
|
| | | |
| | | JSONObject resultData = new JSONObject();
|
| | | if (type == 1) {
|
| | | resultData = threeSaleSerivce.getMyFirstTeam((page - 1) * pageSize, pageSize, uid);
|
| | | } else if (type == 2) {
|
| | | resultData = threeSaleSerivce.getMySecondTeam((page - 1) * pageSize, pageSize, uid);
|
| | | } |
| | | |
| | | out.print(JsonUtil.loadTrueResult(resultData));
|
| | | }
|
| | | |
| | | /**
|
| | | * 用户队员统计 1.4.1
|
| | | * @param acceptData
|
| | | * @param id
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "countMyTeam", method = RequestMethod.POST)
|
| | | public void countMyTeam(AcceptData acceptData, long uid, PrintWriter out) {
|
| | | |
| | | long firstTeam = threeSaleSerivce.countFirstTeam(uid, 1);
|
| | | long firstTeamTotal = threeSaleSerivce.countFirstTeam(uid, null);
|
| | | |
| | | long secondTeam = threeSaleSerivce.countSecondTeam(uid, 1);
|
| | | long secondTeamTotal = threeSaleSerivce.countSecondTeam(uid, null);
|
| | | |
| | | JSONObject bossData = new JSONObject();
|
| | | ThreeSale threeSale = threeSaleSerivce.getMyBoss(uid);
|
| | | if (threeSale != null) {
|
| | | |
| | | UserInfo boss = threeSale.getBoss();
|
| | | if (boss != null) {
|
| | | bossData.put("nickName", boss.getNickName());
|
| | | bossData.put("portrait", boss.getPortrait());
|
| | | }
|
| | | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
|
| | | Long createTime = threeSale.getCreateTime();
|
| | | Date inviteTime = new Date(createTime);
|
| | | bossData.put("inviteTime", "邀请时间: " + sdf.format(inviteTime));
|
| | | }
|
| | | |
| | | |
| | | JSONObject resultData = new JSONObject();
|
| | | |
| | | resultData.put("firstTeam", firstTeam);
|
| | | resultData.put("firstTeamTotal", firstTeamTotal);
|
| | | resultData.put("secondTeam", secondTeam);
|
| | | resultData.put("secondTeamTotal", secondTeamTotal);
|
| | | resultData.put("boss", bossData);
|
| | | |
| | | out.print(JsonUtil.loadTrueResult(resultData));
|
| | | }
|
| | | |
| | | /**
|
| | | * 用户队员信息保存 1.4.1
|
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param inviteId 邀请id
|
| | | * @param nickname
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "setextrainfo", method = RequestMethod.POST)
|
| | | public void setExtraInfo(AcceptData acceptData, long uid, long inviteId, String nickname, PrintWriter out) {
|
| | | |
| | | List<ThreeSale> listThreeSale = threeSaleSerivce.listbyIdAndBossId(inviteId, uid, null);
|
| | | if (listThreeSale == null || listThreeSale.size() == 0) {
|
| | | out.print(JsonUtil.loadFalseResult("该记录不存在"));
|
| | | return;
|
| | | }
|
| | | |
| | | UserInfo worker = listThreeSale.get(0).getWorker();
|
| | | if (worker == null) {
|
| | | out.print(JsonUtil.loadFalseResult("该记录不存在"));
|
| | | return;
|
| | | }
|
| | | |
| | | List<ThreeSaleExtraInfo> list = threeSaleExtraInfoSerivce.listbyBossIdAndWorkerId(uid, worker.getId());
|
| | | if (list == null || list.size() == 0) {
|
| | | |
| | | ThreeSaleExtraInfo extraInfo = new ThreeSaleExtraInfo();
|
| | | extraInfo.setWorker(worker);
|
| | | extraInfo.setNickname(nickname);
|
| | | extraInfo.setCreateTime(new Date());
|
| | | extraInfo.setUpdateTime(new Date());
|
| | | |
| | | UserInfo boss = new UserInfo(uid);
|
| | | extraInfo.setBoss(boss);
|
| | | |
| | | threeSaleExtraInfoSerivce.insert(extraInfo);
|
| | | |
| | | } else {
|
| | | ThreeSaleExtraInfo extraInfo = list.get(0);
|
| | | extraInfo.setNickname(nickname);
|
| | | extraInfo.setUpdateTime(new Date());
|
| | | threeSaleExtraInfoSerivce.updateByPrimaryKey(extraInfo);
|
| | | }
|
| | | |
| | | out.print(JsonUtil.loadTrueResult("修改成功"));
|
| | | }
|
| | | |
| | | /**
|
| | | * 删除队员关系
|
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param inviteId 邀请id
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "removethreesale", method = RequestMethod.POST)
|
| | | public void removethreesale(AcceptData acceptData, long uid, long inviteId, PrintWriter out) {
|
| | | |
| | | List<ThreeSale> listThreeSale = threeSaleSerivce.listbyIdAndBossId(inviteId, uid, 1);
|
| | | if (listThreeSale == null || listThreeSale.size() == 0) {
|
| | | out.print(JsonUtil.loadFalseResult("操作数据无效"));
|
| | | return;
|
| | | }
|
| | | |
| | | UserInfo worker = listThreeSale.get(0).getWorker();
|
| | | if (worker == null) {
|
| | | out.print(JsonUtil.loadFalseResult("操作数据无效"));
|
| | | return;
|
| | | }
|
| | | |
| | | // 删除关系
|
| | | threeSaleSerivce.deleteByPrimaryKey(inviteId);
|
| | | // 删除备注
|
| | | threeSaleExtraInfoSerivce.deleteByBossIdAndWorkerId(uid, worker.getId());
|
| | | |
| | | out.print(JsonUtil.loadTrueResult("操作成功"));
|
| | | }
|
| | | |
| | | }
|