| | |
| | | import org.springframework.stereotype.Component;
|
| | | import org.springframework.web.context.request.RequestContextHolder;
|
| | | import org.springframework.web.context.request.ServletRequestAttributes;
|
| | | import org.springframework.web.multipart.MultipartFile;
|
| | | import org.springframework.web.multipart.MultipartHttpServletRequest;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | |
| | | for (Object obj : args) {
|
| | | if (obj instanceof AcceptData) {
|
| | | acceptData = (AcceptData) obj;
|
| | | } else if (obj instanceof HttpServletRequest) {
|
| | | request = (HttpServletRequest) obj;
|
| | | }
|
| | | }
|
| | | boolean isRight = true;
|
| | |
| | |
|
| | | if ((acceptData.getPlatform() != null && acceptData.getPlatform().equalsIgnoreCase("android")
|
| | | && acceptData.getVersion() != null && Integer.parseInt(acceptData.getVersion()) > 21)
|
| | | || (acceptData.getPlatform()!=null&&acceptData.getPlatform().equalsIgnoreCase("ios") && acceptData.getVersion() != null
|
| | | && Integer.parseInt(acceptData.getVersion()) > 24)) {
|
| | | || (acceptData.getPlatform() != null && acceptData.getPlatform().equalsIgnoreCase("ios")
|
| | | && acceptData.getVersion() != null && Integer.parseInt(acceptData.getVersion()) > 24)) {
|
| | | isRight = signIsRight(request);
|
| | | } else if (acceptData.getPackages().startsWith("com.haicaojie")) {
|
| | | isRight = signIsRight(request);
|
| | |
| | | // out.close();
|
| | | // return null;
|
| | | // }
|
| | | //uid
|
| | | // uid
|
| | |
|
| | | Object obj = null;
|
| | | try {
|
| | |
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | @RequestMapping(value = "testhtml")
|
| | | public void testhtml(PrintWriter out) {
|
| | | out.print("<script>yestv.finishPage();</script>");
|
| | | out.close();
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | import java.io.IOException;
|
| | | import java.io.PrintWriter;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RequestMethod;
|
| | | import org.springframework.web.bind.annotation.RequestParam;
|
| | | import org.springframework.web.multipart.MultipartFile;
|
| | | import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | |
| | |
|
| | | @Resource
|
| | | private CustomerServiceHistoryService customerServiceHistoryService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private UserComplaintService userComplaintService;
|
| | | |
| | |
|
| | | /**
|
| | | * 预设标题的关键字列表
|
| | |
| | | out.print(JsonUtil.loadTrueResult(JsonUtil.getApiCommonGson().toJson(answer)));
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 用户吐槽记录添加
|
| | | * 用户吐槽记录添加
|
| | | * |
| | | * @param fileList
|
| | | * @param uid
|
| | | * @param content
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "complaint")
|
| | | public void complaint(AcceptData acceptData, MultipartFile[] fileList, String content, Long uid, PrintWriter out) {
|
| | | // try {
|
| | | // userComplaintService.addUserComplaint(fileList, uid, content);
|
| | | // out.print(JsonUtil.loadTrueResult("保存成功"));
|
| | | // } catch (UserComplaintException e) {
|
| | | // out.print(JsonUtil.loadFalseResult(e.getMsg()));
|
| | | // e.printStackTrace();
|
| | | // } catch (IOException e) {
|
| | | // out.print(JsonUtil.loadFalseResult("图片上传失败失败"));
|
| | | // e.printStackTrace();
|
| | | // } catch (Exception e) {
|
| | | // out.print(JsonUtil.loadFalseResult("保存失败"));
|
| | | // e.printStackTrace();
|
| | | // }
|
| | | System.out.println(content);
|
| | | public void complaint(AcceptData acceptData, MultipartFile[] fileList, String content, Long uid,
|
| | | HttpServletRequest request, PrintWriter out) {
|
| | | try {
|
| | | List<MultipartFile> files = new ArrayList<>();
|
| | | if (fileList != null)
|
| | | for (MultipartFile mf : fileList) {
|
| | | files.add(mf);
|
| | | }
|
| | | userComplaintService.addUserComplaint(files, uid, content);
|
| | | out.print(JsonUtil.loadTrueResult("保存成功"));
|
| | | } catch (UserComplaintException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getMsg()));
|
| | | e.printStackTrace();
|
| | | } catch (IOException e) {
|
| | | out.print(JsonUtil.loadFalseResult("图片上传失败失败"));
|
| | | e.printStackTrace();
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadFalseResult("保存失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.common; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.common.JumpDetail; |
| | | |
| | | public interface JumpDetailMapper extends BaseMapper<JumpDetail> { |
| | | |
| | | /** |
| | | * 根据名字搜索 |
| | | * |
| | | * @param name |
| | | * @return |
| | | */ |
| | | List<JumpDetail> listSearchByName(@Param("name") String name, @Param("start") long start, |
| | | @Param("count") int count); |
| | | |
| | | /** |
| | | * 根据名字的搜索结果获取数量 |
| | | * |
| | | * @param name |
| | | * @return |
| | | */ |
| | | long countSearchByName(@Param("name") String name); |
| | | |
| | | } |
| | |
| | | @GeneratedValue(strategy = GenerationType.AUTO)
|
| | | @Column(name = "id")
|
| | | private long id;
|
| | | @ManyToOne(fetch = FetchType.EAGER)
|
| | | @JoinColumn(name = "jumpid")
|
| | | // @ManyToOne(fetch = FetchType.EAGER)
|
| | | // @JoinColumn(name = "jumpid")
|
| | | private JumpDetail jumpDetail;// 跳转详情
|
| | | @Column(length = 256)
|
| | | private String params;// 跳转参数
|
| | |
| | |
|
| | | import javax.persistence.Column;
|
| | | import javax.persistence.Entity;
|
| | | import javax.persistence.FetchType;
|
| | | import javax.persistence.GeneratedValue;
|
| | | import javax.persistence.GenerationType;
|
| | | import javax.persistence.Id;
|
| | | import javax.persistence.JoinColumn;
|
| | | import javax.persistence.ManyToOne;
|
| | | import javax.persistence.Table;
|
| | |
|
| | | import com.yeshi.fanli.entity.common.JumpDetail;
|
| | |
| | | @Column(name = "`tag`", length = 50)
|
| | | private String tag;
|
| | | private int orderby;
|
| | | @ManyToOne(fetch = FetchType.EAGER)
|
| | | @JoinColumn(name = "jumpid")
|
| | | // @ManyToOne(fetch = FetchType.EAGER)
|
| | | // @JoinColumn(name = "jumpid")
|
| | | private JumpDetail jumpDetail;// 跳转详情
|
| | | @Column(name = "`params`", length = 128)
|
| | | private String params;
|
| | |
| | |
|
| | | import java.io.Serializable;
|
| | |
|
| | | import javax.persistence.Column;
|
| | | import javax.persistence.Entity;
|
| | | import javax.persistence.GeneratedValue;
|
| | | import javax.persistence.GenerationType;
|
| | | import javax.persistence.Id;
|
| | | import javax.persistence.Table;
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | /**
|
| | | * 前端跳转详情
|
| | |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Entity
|
| | | @Table(name = "`yeshi_ec_action_jumpdetail`")
|
| | | public class JumpDetail implements Serializable{
|
| | | |
| | | @Table("`yeshi_ec_action_jumpdetail`")
|
| | | public class JumpDetail implements Serializable {
|
| | |
|
| | | /**
|
| | | *
|
| | | */
|
| | | private static final long serialVersionUID = 1L;
|
| | | |
| | | @Id
|
| | | @GeneratedValue(strategy = GenerationType.AUTO)
|
| | |
|
| | | @Column(name = "id")
|
| | | private long id;
|
| | | private Long id;
|
| | | @Column(name = "name")
|
| | | private String name;
|
| | | @Column(name = "activity")
|
| | | private String activity;
|
| | | @Column(name = "controller")
|
| | | private String controller;
|
| | |
|
| | | public JumpDetail() {
|
| | | // TODO Auto-generated constructor stub
|
| | | }
|
| | | |
| | |
|
| | | public JumpDetail(long id) {
|
| | | super();
|
| | | this.id = id;
|
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | |
| | | <mapper namespace="com.yeshi.fanli.dao.mybatis.common.JumpDetailMapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.common.JumpDetail"> |
| | | <id column="id" property="id" jdbcType="BIGINT" /> |
| | | <result column="name" property="name" jdbcType="VARCHAR" /> |
| | | <result column="activity" property="activity" jdbcType="VARCHAR" /> |
| | | <result column="controller" property="controller" jdbcType="VARCHAR" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">id,name,activity,controller</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from `yeshi_ec_action_jumpdetail` where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | |
| | | |
| | | <select id="listSearchByName" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from `yeshi_ec_action_jumpdetail` where `name` like '%${name}%' limit |
| | | #{start},#{count} |
| | | </select> |
| | | |
| | | |
| | | <select id="countSearchByName" resultType="java.lang.Long" |
| | | parameterType="java.lang.String"> |
| | | select |
| | | count(id) |
| | | from `yeshi_ec_action_jumpdetail` where |
| | | `name` like '%${name}%' |
| | | </select> |
| | | |
| | | |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | `yeshi_ec_action_jumpdetail` where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.common.JumpDetail" |
| | | useGeneratedKeys="true" keyProperty="id">insert into |
| | | `yeshi_ec_action_jumpdetail` (id,name,activity,controller) values |
| | | (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{activity,jdbcType=VARCHAR},#{controller,jdbcType=VARCHAR}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.common.JumpDetail" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into `yeshi_ec_action_jumpdetail` |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">id,</if> |
| | | <if test="name != null">name,</if> |
| | | <if test="activity != null">activity,</if> |
| | | <if test="controller != null">controller,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="name != null">#{name,jdbcType=VARCHAR},</if> |
| | | <if test="activity != null">#{activity,jdbcType=VARCHAR},</if> |
| | | <if test="controller != null">#{controller,jdbcType=VARCHAR},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.common.JumpDetail">update |
| | | `yeshi_ec_action_jumpdetail` set name = |
| | | #{name,jdbcType=VARCHAR},activity = |
| | | #{activity,jdbcType=VARCHAR},controller = |
| | | #{controller,jdbcType=VARCHAR} where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.common.JumpDetail"> |
| | | update `yeshi_ec_action_jumpdetail` |
| | | <set> |
| | | <if test="name != null">name=#{name,jdbcType=VARCHAR},</if> |
| | | <if test="activity != null">activity=#{activity,jdbcType=VARCHAR},</if> |
| | | <if test="controller != null">controller=#{controller,jdbcType=VARCHAR},</if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
| | |
| | | package com.yeshi.fanli.service.impl.config;
|
| | |
|
| | | import java.io.Serializable;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
| | | import org.springframework.cache.annotation.Cacheable;
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.config.JumpDetailDao;
|
| | | import com.yeshi.fanli.dao.mybatis.common.JumpDetailMapper;
|
| | | import com.yeshi.fanli.entity.common.JumpDetail;
|
| | | import com.yeshi.fanli.exception.NotExistObjectException;
|
| | | import com.yeshi.fanli.service.inter.config.JumpDetailService;
|
| | |
| | | public class JumpDetailServiceImpl implements JumpDetailService {
|
| | |
|
| | | @Resource
|
| | | private JumpDetailDao jumpDetailDao;
|
| | | private JumpDetailMapper jumpDetailMapper;
|
| | |
|
| | | @Resource
|
| | | private RecommendBannerService recommendBannerService;
|
| | |
| | |
|
| | | int start = index * Constant.PAGE_SIZE;
|
| | |
|
| | | return jumpDetailDao.list("from JumpDetail j where j.name like ? ", start, Constant.PAGE_SIZE,
|
| | | new Serializable[] { "%" + key + "%" });
|
| | | return jumpDetailMapper.listSearchByName(key, start, Constant.PAGE_SIZE);
|
| | | }
|
| | |
|
| | | public int getCount(String key) {
|
| | | Long lcount = jumpDetailDao.getCount("select count(j.id) from JumpDetail j where j.name like ? ",
|
| | | new Serializable[] { "%" + key + "%" });
|
| | | Long lcount = jumpDetailMapper.countSearchByName(key);
|
| | | return lcount.intValue();
|
| | | }
|
| | |
|
| | | public void addJumpDetail(JumpDetail jd) {
|
| | | jumpDetailDao.create(jd);
|
| | | jumpDetailMapper.insertSelective(jd);
|
| | | }
|
| | |
|
| | | public void updateJumpDetail(JumpDetail jd) throws NotExistObjectException {
|
| | | JumpDetail find = jumpDetailDao.find(JumpDetail.class, jd.getId());
|
| | | if (find == null) {
|
| | | throw new NotExistObjectException("不存在该对象");
|
| | | }
|
| | | jumpDetailDao.update(jd);
|
| | | jumpDetailMapper.updateByPrimaryKeySelective(jd);
|
| | | }
|
| | |
|
| | | public JumpDetail getJumpDetail(long id) {
|
| | | return jumpDetailDao.find(JumpDetail.class, id);
|
| | | return jumpDetailMapper.selectByPrimaryKey(id);
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | public void deleteJumpDetail(long id) {
|
| | | recommendBannerService.updateBannerJumpDetail(id);
|
| | | recommendSpecialService.updateSpecialJumpDetail(id);
|
| | | jumpDetailDao.delete(new JumpDetail(id));
|
| | | jumpDetailMapper.deleteByPrimaryKey(id);
|
| | | }
|
| | |
|
| | | public List<JumpDetail> getJumpDetailAllList() {
|
| | | return jumpDetailDao.list("from JumpDetail");
|
| | | return jumpDetailMapper.listSearchByName("", 0, 500);
|
| | | }
|
| | |
|
| | | public JumpDetail getlastJumpDetail() {
|
| | |
|
| | | List<JumpDetail> list = jumpDetailDao.list("from JumpDetail jp order by jp.id desc ", 0, 1, null);
|
| | | List<JumpDetail> list = getJumpDetailAllList();
|
| | | if (list.size() > 0) {
|
| | | return list.get(0);
|
| | | return list.get(list.size() - 1);
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
| | | import org.springframework.web.multipart.MultipartFile;
|
| | | import org.yeshi.utils.tencentcloud.COSManager;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.user.UserComplaintMapper;
|
| | |
| | | private UserComplaintMapper userComplaintMapper;
|
| | |
|
| | | @Override
|
| | | public void addUserComplaint(List<CommonsMultipartFile> fileList, Long uid, String content) |
| | | public void addUserComplaint(List<MultipartFile> fileList, Long uid, String content) |
| | | throws UserComplaintException, IOException, Exception {
|
| | |
|
| | | if (content == null || content.trim().length() == 0) {
|
| | |
| | |
|
| | | JSONArray array = new JSONArray();
|
| | | // 文件上传
|
| | | for (CommonsMultipartFile file: fileList) {
|
| | | for (MultipartFile file: fileList) {
|
| | |
|
| | | InputStream inputStream = file.getInputStream();
|
| | | String contentType = file.getContentType();
|
| | |
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import org.springframework.cache.annotation.Cacheable;
|
| | |
|
| | | import com.yeshi.fanli.entity.common.JumpDetail;
|
| | | import com.yeshi.fanli.exception.NotExistObjectException;
|
| | |
|
| | |
| | |
|
| | | public JumpDetail getlastJumpDetail();
|
| | |
|
| | | |
| | | public JumpDetail getlastJumpDetailCache();
|
| | |
|
| | | }
|
| | |
| | | import java.io.IOException;
|
| | | import java.util.List;
|
| | |
|
| | | import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
| | | import org.springframework.web.multipart.MultipartFile;
|
| | |
|
| | | import com.yeshi.fanli.exception.user.UserComplaintException;
|
| | |
|
| | |
| | | * @param content 内容
|
| | | * @throws UserComplaintException
|
| | | */
|
| | | public void addUserComplaint(List<CommonsMultipartFile> fileList, Long uid, String content)
|
| | | public void addUserComplaint(List<MultipartFile> fileList, Long uid, String content)
|
| | | throws UserComplaintException, IOException, Exception;
|
| | |
|
| | |
|