提交 c42918cc authored 作者: zhengfg's avatar zhengfg

1、更新

上级 560aea49
......@@ -38,6 +38,9 @@ public class TokenVerification {
"&&!execution(* com.diaoyun.zion.chinafrica.controller.LoginController.*(..))" +
"&&!execution(* com.diaoyun.zion.chinafrica.controller.TbCfProblemController.*(..))" +
"&&!execution(* com.diaoyun.zion.chinafrica.controller.TbCfContactController.*(..))" +
"&&!execution(* com.diaoyun.zion.chinafrica.controller.TbCfStoreController.*(..))" +
"&&!execution(* com.diaoyun.zion.chinafrica.controller.TbCfUserInfoController.resetPassWord(..))" +
"&&!execution(* com.diaoyun.zion.chinafrica.controller.TbCfFeedbackController.getFeedbackList(..))" +
"&&!execution(* com.diaoyun.zion.chinafrica.controller.TbCfUserInfoController.getUserIdentifyCode(..))")
public void controllerAspect() {
......
......@@ -56,7 +56,6 @@ public class TbCfAddressController {
@ApiOperation("删除用户地址信息")
@DeleteMapping(value="/{addressId}")
public Result deleteUserInfo(@ApiParam("地址id") @PathVariable("addressId")String addressId) {
int res=tbCfAddressService.delete(addressId);
if(res>0) {
......@@ -69,7 +68,6 @@ public class TbCfAddressController {
@ApiOperation("设置为默认地址")
@PutMapping(value="/default/{addressId}")
public Result configDefaultAddress(@ApiParam("地址id") @PathVariable("addressId")String addressId) {
int res=tbCfAddressService.configDefaultAddress(addressId);
if(res>0) {
......@@ -78,4 +76,17 @@ public class TbCfAddressController {
return new Result<>().setCode(ResultCodeEnum.ERROR.getCode()).setMessage(ResultCodeEnum.ERROR.getDesc());
}
}
@ApiOperation("获取用户默认地址")
@GetMapping(value="/default")
public Result getDefaultAddress() {
return tbCfAddressService.getDefaultAddress();
}
@ApiOperation("根据地址id获取详细地址")
@GetMapping(value="/{addressId}")
public Result getAddressDetailById(@ApiParam("地址id") @PathVariable("addressId")String addressId) {
return tbCfAddressService.getAddressDetailById(addressId);
}
}
package com.diaoyun.zion.chinafrica.controller;
import com.diaoyun.zion.chinafrica.entity.TbCfFeedbackEntity;
import com.diaoyun.zion.chinafrica.entity.TbCfFeedbackRecordEntity;
import com.diaoyun.zion.chinafrica.service.TbCfFeedbackRecordService;
import com.diaoyun.zion.chinafrica.service.TbCfFeedbackService;
import com.diaoyun.zion.master.base.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.*;
/**
* 反馈情况Controller
......@@ -20,14 +19,24 @@ import org.springframework.web.bind.annotation.RequestMapping;
*/
@Api(tags = "反馈情况")
@RestController
@RequestMapping("feedback")
@RequestMapping("/feedback")
public class TbCfFeedbackController {
@Autowired
private TbCfFeedbackService tbCfFeedbackService;
@Autowired
private TbCfFeedbackRecordService tbCfFeedbackRecordService;
@ApiOperation("提交反馈")
@PostMapping
public Result saveFeedback(@ApiParam("反馈情况") @RequestBody TbCfFeedbackEntity tbCfFeedbackEntity) {
return tbCfFeedbackService.saveFeedback(tbCfFeedbackEntity);
public Result<TbCfFeedbackRecordEntity> saveFeedback(@ApiParam("反馈情况") @RequestBody TbCfFeedbackRecordEntity tbCfFeedbackRecordEntity) {
return tbCfFeedbackRecordService.saveFeedback(tbCfFeedbackRecordEntity);
}
@ApiOperation("获取反馈问题")
@GetMapping
public Result getFeedbackList() {
return tbCfFeedbackService.getFeedbackList();
}
}
......@@ -19,7 +19,7 @@ import java.util.Map;
*/
@Api(tags = "启动页")
@RestController
@RequestMapping("startPage")
@RequestMapping("/startPage")
public class TbCfHomePageController {
@Autowired
private TbCfHomePageService tbCfHomePageService;
......
package com.diaoyun.zion.chinafrica.controller;
import com.diaoyun.zion.chinafrica.service.TbCfStoreService;
import com.diaoyun.zion.master.base.Result;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -12,9 +17,22 @@ import org.springframework.web.bind.annotation.RequestMapping;
* @date 2019-09-05 16:51:07
*/
@RestController
@RequestMapping("tbcfstore")
@RequestMapping("/store")
public class TbCfStoreController {
@Autowired
private TbCfStoreService tbCfStoreService;
@ApiOperation("获取店铺独立站")
@GetMapping
public Result getStoreStationList(@ApiParam(value = "页数 默认1") @RequestParam(required = false) Integer pageNum,
@ApiParam(value ="每页大小 默认10") @RequestParam(required = false) Integer pageSize) {
if (pageNum == null) {
pageNum = 1;
}
if (pageSize == null) {
pageSize = 10;
}
return tbCfStoreService.getStoreStationList(pageNum,pageSize);
}
}
......@@ -69,6 +69,7 @@ public class TbCfUserInfoController extends BaseController {
}
*/
@ApiOperation("修改用户信息")
@PutMapping
public Result updateUserInfo(@ApiParam ("用户信息")@RequestBody TbCfUserInfoVo tbCfUserInfoVo) {
......@@ -80,9 +81,16 @@ public class TbCfUserInfoController extends BaseController {
@PutMapping(value="/password/{newPassword}/{oldPassword}")
public Result updatePassWord(@ApiParam("新密码") @PathVariable @ValidateParam({Validator.NOT_BLANK}) String newPassword
,@ApiParam("旧密码") @PathVariable @ValidateParam({Validator.NOT_BLANK}) String oldPassword) {
return tbCfUserInfoService.updatePassWord(passwordEncoder.encode(newPassword),passwordEncoder.encode(oldPassword));
return tbCfUserInfoService.updatePassWord(newPassword,oldPassword);
}
@ApiOperation("重置用户密码 不要带token,否则会验证")
@PutMapping(value="/password/reset/{account}/{newPassword}/{captcha}")
public Result resetPassWord(@ApiParam("账号") @PathVariable String account,
@ApiParam("新密码") @PathVariable String newPassword,
@ApiParam("验证码") @PathVariable Integer captcha) {
return tbCfUserInfoService.resetPassWord(account,newPassword,captcha);
}
}
......@@ -21,7 +21,18 @@ public interface TbCfAddressDao extends BaseDao<TbCfAddressEntity> {
*/
List<TbCfAddressEntity> queryListByUserId(String userId);
/*重置用户全部地址的默认地址Flag*/
/**
* 重置用户全部地址的默认地址Flag
* @param userId
* @return
*/
int resetDefaulFlag(String userId);
/**
* 获取用户默认地址
* @param userId
* @return
*/
TbCfAddressEntity getDefaultAddress(String userId);
}
......@@ -3,6 +3,8 @@ package com.diaoyun.zion.chinafrica.dao;
import com.diaoyun.zion.chinafrica.entity.TbCfFeedbackEntity;
import com.diaoyun.zion.master.dao.BaseDao;
import java.util.List;
/**
* 反馈情况Dao
*
......@@ -11,4 +13,9 @@ import com.diaoyun.zion.master.dao.BaseDao;
*/
public interface TbCfFeedbackDao extends BaseDao<TbCfFeedbackEntity> {
/**
* 获取有效的反馈问题
* @return
*/
List<TbCfFeedbackEntity> getFeedbackList();
}
package com.diaoyun.zion.chinafrica.dao;
import com.diaoyun.zion.chinafrica.entity.TbCfFeedbackRecordEntity;
import com.diaoyun.zion.master.dao.BaseDao;
/**
* 用户反馈记录表Dao
*
* @author lipengjun
* @date 2019-09-21 15:15:23
*/
public interface TbCfFeedbackRecordDao extends BaseDao<TbCfFeedbackRecordEntity> {
}
package com.diaoyun.zion.chinafrica.dao;
import com.diaoyun.zion.chinafrica.entity.TbCfPlatformEntity;
import com.diaoyun.zion.chinafrica.entity.TbCfStoreEntity;
import com.diaoyun.zion.master.dao.BaseDao;
import java.util.List;
/**
* 店铺管理Dao
*
......@@ -11,4 +14,9 @@ import com.diaoyun.zion.master.dao.BaseDao;
*/
public interface TbCfStoreDao extends BaseDao<TbCfStoreEntity> {
/**
* 获取店铺独立站
* @return
*/
List<TbCfPlatformEntity> getStoreStationList();
}
......@@ -30,8 +30,7 @@ public interface TbCfUserInfoDao extends BaseDao<TbCfUserInfoEntity> {
* 更改用户密码
* @param userId
* @param newPassword
* @param oldPassword
* @return
*/
int updatePassWord(String userId, String newPassword, String oldPassword);
int updatePassWord(String userId, String newPassword);
}
......@@ -4,17 +4,17 @@ import java.io.Serializable;
import java.util.Date;
/**
* 反馈情况实体
* 反馈问题列表实体
* 表名 tb_cf_feedback
*
* @author lipengjun
* @date 2019-09-05 16:51:07
* @date 2019-09-21 15:15:23
*/
public class TbCfFeedbackEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 反馈id
* 反馈问题id
*/
private String feedbackId;
/**
......@@ -22,11 +22,7 @@ public class TbCfFeedbackEntity implements Serializable {
*/
private String question;
/**
* 答案
*/
private String answer;
/**
* 是否展示
* 是否展示,1展示,0不展示
*/
private Integer enableFlag;
/**
......@@ -34,19 +30,23 @@ public class TbCfFeedbackEntity implements Serializable {
*/
private Date createTime;
/**
* 用户id
* 反馈问题类型,1为填写类型
*/
private Integer questionType;
/**
* 排序,数字,倒序
*/
private String userId;
private Integer sort;
/**
* 设置:反馈id
* 设置:反馈问题id
*/
public void setFeedbackId(String feedbackId) {
this.feedbackId = feedbackId;
}
/**
* 获取:反馈id
* 获取:反馈问题id
*/
public String getFeedbackId() {
return feedbackId;
......@@ -65,27 +65,14 @@ public class TbCfFeedbackEntity implements Serializable {
return question;
}
/**
* 设置:答案
*/
public void setAnswer(String answer) {
this.answer = answer;
}
/**
* 获取:答案
*/
public String getAnswer() {
return answer;
}
/**
* 设置:是否展示
* 设置:是否展示,1展示,0不展示
*/
public void setEnableFlag(Integer enableFlag) {
this.enableFlag = enableFlag;
}
/**
* 获取:是否展示
* 获取:是否展示,1展示,0不展示
*/
public Integer getEnableFlag() {
return enableFlag;
......@@ -103,12 +90,30 @@ public class TbCfFeedbackEntity implements Serializable {
public Date getCreateTime() {
return createTime;
}
/**
* 设置:反馈问题类型,1为填写类型
*/
public void setQuestionType(Integer questionType) {
this.questionType = questionType;
}
public String getUserId() {
return userId;
/**
* 获取:反馈问题类型,1为填写类型
*/
public Integer getQuestionType() {
return questionType;
}
/**
* 设置:排序,数字,倒序
*/
public void setSort(Integer sort) {
this.sort = sort;
}
public void setUserId(String userId) {
this.userId = userId;
/**
* 获取:排序,数字,倒序
*/
public Integer getSort() {
return sort;
}
}
package com.diaoyun.zion.chinafrica.entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
/**
* 用户反馈记录表实体
* 表名 tb_cf_feedback_record
*
* @author lipengjun
* @date 2019-09-21 15:15:23
*/
@ApiModel
public class TbCfFeedbackRecordEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 反馈记录id
*/
private String recordId;
/**
* 反馈用户id
*/
private String userId;
/**
* 反馈问题id
*/
@ApiModelProperty(value="反馈问题id",name="feedbackId",required = true)
private String feedbackId;
/**
* 反馈填写内容
*/
@ApiModelProperty(value="反馈填写内容",name="answer",required = true)
private String answer;
/**
* 创建时间
*/
private Date createTime;
/**
* 设置:反馈记录id
*/
public void setRecordId(String recordId) {
this.recordId = recordId;
}
/**
* 获取:反馈记录id
*/
public String getRecordId() {
return recordId;
}
/**
* 设置:反馈用户id
*/
public void setUserId(String userId) {
this.userId = userId;
}
/**
* 获取:反馈用户id
*/
public String getUserId() {
return userId;
}
/**
* 设置:反馈问题id
*/
public void setFeedbackId(String feedbackId) {
this.feedbackId = feedbackId;
}
/**
* 获取:反馈问题id
*/
public String getFeedbackId() {
return feedbackId;
}
/**
* 设置:反馈填写内容
*/
public void setAnswer(String answer) {
this.answer = answer;
}
/**
* 获取:反馈填写内容
*/
public String getAnswer() {
return answer;
}
/**
* 设置:创建时间
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* 获取:创建时间
*/
public Date getCreateTime() {
return createTime;
}
}
......@@ -54,6 +54,16 @@ public class TbCfStoreEntity implements Serializable {
*/
private Date createTime;
/**
* 主营商品图片1
*/
private String itemImg1;
/**
* 主营商品图片2
*/
private String itemImg2;
/**
* 设置:店铺id
*/
......@@ -184,4 +194,20 @@ public class TbCfStoreEntity implements Serializable {
public Date getCreateTime() {
return createTime;
}
public String getItemImg1() {
return itemImg1;
}
public void setItemImg1(String itemImg1) {
this.itemImg1 = itemImg1;
}
public String getItemImg2() {
return itemImg2;
}
public void setItemImg2(String itemImg2) {
this.itemImg2 = itemImg2;
}
}
......@@ -2,6 +2,7 @@ package com.diaoyun.zion.chinafrica.service;
import com.diaoyun.zion.chinafrica.entity.TbCfAddressEntity;
import com.diaoyun.zion.chinafrica.vo.TbCfAddressVo;
import com.diaoyun.zion.master.base.Result;
import java.util.List;
import java.util.Map;
......@@ -97,4 +98,17 @@ public interface TbCfAddressService {
* @return
*/
int configDefaultAddress(String addressId);
/**
* 获取用户默认地址
* @return
*/
Result getDefaultAddress();
/**
* 根据地址id获取详细地址
* @param addressId
* @return
*/
Result getAddressDetailById(String addressId);
}
package com.diaoyun.zion.chinafrica.service;
import com.diaoyun.zion.chinafrica.entity.TbCfFeedbackRecordEntity;
import com.diaoyun.zion.master.base.Result;
import java.util.List;
import java.util.Map;
/**
* 用户反馈记录表Service接口
*
* @author lipengjun
* @date 2019-09-21 15:15:23
*/
public interface TbCfFeedbackRecordService {
/**
* 根据主键查询实体
*
* @param recordId 主键
* @return 实体
*/
TbCfFeedbackRecordEntity queryObject(String recordId);
/**
* 分页查询
*
* @param map 参数
* @return list
*/
List<TbCfFeedbackRecordEntity> queryList(Map<String, Object> map);
/**
* 分页统计总数
*
* @param map 参数
* @return 总数
*/
int queryTotal(Map<String, Object> map);
/**
* 保存实体
*
* @param tbCfFeedbackRecord 实体
* @return 保存条数
*/
int save(TbCfFeedbackRecordEntity tbCfFeedbackRecord);
/**
* 根据主键更新实体
*
* @param tbCfFeedbackRecord 实体
* @return 更新条数
*/
int update(TbCfFeedbackRecordEntity tbCfFeedbackRecord);
/**
* 根据主键删除
*
* @param recordId
* @return 删除条数
*/
int delete(String recordId);
/**
* 根据主键批量删除
*
* @param recordIds
* @return 删除条数
*/
int deleteBatch(String[] recordIds);
/**
* 保存客户反馈
* @param tbCfFeedbackRecordEntity
* @return
*/
Result saveFeedback(TbCfFeedbackRecordEntity tbCfFeedbackRecordEntity);
}
......@@ -71,9 +71,8 @@ public interface TbCfFeedbackService {
int deleteBatch(String[] feedbackIds);
/**
* 提交反馈
* @param tbCfFeedbackEntity
* 获取反馈问题
* @return
*/
Result saveFeedback(TbCfFeedbackEntity tbCfFeedbackEntity);
Result getFeedbackList();
}
......@@ -17,7 +17,7 @@ public interface TbCfHomePageService {
/**
* 根据主键查询实体
*
* @param id 主键
* @param pageId 主键
* @return 实体
*/
TbCfHomePageEntity queryObject(String pageId);
......
package com.diaoyun.zion.chinafrica.service;
import com.diaoyun.zion.chinafrica.entity.TbCfStoreEntity;
import com.diaoyun.zion.master.base.Result;
import java.util.List;
import java.util.Map;
......@@ -68,4 +69,12 @@ public interface TbCfStoreService {
* @return 删除条数
*/
int deleteBatch(String[] storeIds);
/**
* 获取店铺独立站
* @param pageNum
* @param pageSize
* @return
*/
Result getStoreStationList(Integer pageNum, Integer pageSize);
}
......@@ -143,4 +143,13 @@ public interface TbCfUserInfoService {
* @return
*/
Result loginByToken(String ipAddr);
/**
* 重置密码
* @param account
* @param newPassword
* @param captcha
* @return
*/
Result resetPassWord(String account,String newPassword, Integer captcha);
}
......@@ -8,6 +8,7 @@ import com.diaoyun.zion.chinafrica.entity.TbCfUserInfoEntity;
import com.diaoyun.zion.chinafrica.service.TbCfAddressService;
import com.diaoyun.zion.chinafrica.vo.TbCfAddressVo;
import com.diaoyun.zion.chinafrica.vo.TbCfUserInfoVo;
import com.diaoyun.zion.master.base.Result;
import com.diaoyun.zion.master.base.StateConstant;
import com.diaoyun.zion.master.common.TokenManager;
import com.diaoyun.zion.master.security.JwtTokenProvider;
......@@ -137,6 +138,9 @@ public class TbCfAddressServiceImpl implements TbCfAddressService {
user.setUserId(userId);
user.setDefaultAddressId(addressId);
int userCount=tbCfUserInfoDao.update(user);
//更新缓存
tbCfUserInfoVo.setDefaultAddressId(addressId);
tokenManager.addToken(token, tbCfUserInfoVo);
//重置用户地址
tbCfAddressDao.resetDefaulFlag(userId);//int resetCount=
//更新地址默认标志
......@@ -147,6 +151,29 @@ public class TbCfAddressServiceImpl implements TbCfAddressService {
return userCount*addressCount;
}
@Override
public Result getDefaultAddress() {
String token = jwtTokenProvider.resolveToken(request);
TbCfUserInfoVo tbCfUserInfoVo = tokenManager.validate(token);
String userId=tbCfUserInfoVo.getUserId();
TbCfAddressEntity tbCfAddressEntity=tbCfAddressDao.getDefaultAddress(userId);
TbCfAddressVo tbCfAddressVo = new TbCfAddressVo();
if(tbCfAddressEntity!=null) {
BeanUtils.copyProperties(tbCfAddressEntity,tbCfAddressVo);
}
return new Result<>(tbCfAddressVo);
}
@Override
public Result getAddressDetailById(String addressId) {
TbCfAddressEntity tbCfAddressEntity=tbCfAddressDao.queryObject(addressId);
TbCfAddressVo tbCfAddressVo = new TbCfAddressVo();
if(tbCfAddressEntity!=null) {
BeanUtils.copyProperties(tbCfAddressEntity,tbCfAddressVo);
}
return new Result<>(tbCfAddressVo);
}
/**
* 新增地址必要信息
*/
......
package com.diaoyun.zion.chinafrica.service.impl;
import com.diaoyun.zion.chinafrica.dao.TbCfFeedbackRecordDao;
import com.diaoyun.zion.chinafrica.entity.TbCfFeedbackRecordEntity;
import com.diaoyun.zion.chinafrica.service.TbCfFeedbackRecordService;
import com.diaoyun.zion.chinafrica.vo.TbCfUserInfoVo;
import com.diaoyun.zion.master.base.Result;
import com.diaoyun.zion.master.base.StateConstant;
import com.diaoyun.zion.master.common.TokenManager;
import com.diaoyun.zion.master.enums.ResultCodeEnum;
import com.diaoyun.zion.master.security.JwtTokenProvider;
import com.diaoyun.zion.master.util.IdUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 用户反馈记录表Service实现类
*
* @author lipengjun
* @date 2019-09-21 15:15:23
*/
@Service("tbCfFeedbackRecordService")
public class TbCfFeedbackRecordServiceImpl implements TbCfFeedbackRecordService {
@Autowired
private TbCfFeedbackRecordDao tbCfFeedbackRecordDao;
@Autowired
@Qualifier("redisTokenManager")
private TokenManager tokenManager;
@Autowired
private JwtTokenProvider jwtTokenProvider;
@Autowired
private HttpServletRequest request; //自动注入request
@Override
public TbCfFeedbackRecordEntity queryObject(String recordId) {
return tbCfFeedbackRecordDao.queryObject(recordId);
}
@Override
public List<TbCfFeedbackRecordEntity> queryList(Map<String, Object> map) {
return tbCfFeedbackRecordDao.queryList(map);
}
@Override
public int queryTotal(Map<String, Object> map) {
return tbCfFeedbackRecordDao.queryTotal(map);
}
@Override
public int save(TbCfFeedbackRecordEntity tbCfFeedbackRecord) {
tbCfFeedbackRecord.setRecordId(IdUtil.createIdbyUUID());
return tbCfFeedbackRecordDao.save(tbCfFeedbackRecord);
}
@Override
public int update(TbCfFeedbackRecordEntity tbCfFeedbackRecord) {
return tbCfFeedbackRecordDao.update(tbCfFeedbackRecord);
}
@Override
public int delete(String recordId) {
return tbCfFeedbackRecordDao.delete(recordId);
}
@Override
public int deleteBatch(String[] recordIds) {
return tbCfFeedbackRecordDao.deleteBatch(recordIds);
}
@Override
public Result saveFeedback(TbCfFeedbackRecordEntity tbCfFeedbackRecordEntity) {
Result result=new Result();
//获取用户
String token = jwtTokenProvider.resolveToken(request);
TbCfUserInfoVo tbCfUserInfoVo = tokenManager.validate(token);
tbCfFeedbackRecordEntity.setRecordId(IdUtil.createIdbyUUID());
tbCfFeedbackRecordEntity.setUserId(tbCfUserInfoVo.getUserId());
tbCfFeedbackRecordEntity.setCreateTime(new Date());
int res=tbCfFeedbackRecordDao.save(tbCfFeedbackRecordEntity);
if(res>0) {
result.setMessage(ResultCodeEnum.SUCCESS.getDesc());
} else {
result.setCode(ResultCodeEnum.DAO_ERROR.getCode()).setMessage(ResultCodeEnum.DAO_ERROR.getDesc());
}
return result;
}
}
......@@ -75,22 +75,10 @@ public class TbCfFeedbackServiceImpl implements TbCfFeedbackService {
return tbCfFeedbackDao.deleteBatch(feedbackIds);
}
@Override
public Result saveFeedback(TbCfFeedbackEntity tbCfFeedbackEntity) {
Result result=new Result();
//获取用户
String token = jwtTokenProvider.resolveToken(request);
TbCfUserInfoVo tbCfUserInfoVo = tokenManager.validate(token);
tbCfFeedbackEntity.setFeedbackId(IdUtil.createIdbyUUID());
tbCfFeedbackEntity.setUserId(tbCfUserInfoVo.getUserId());
tbCfFeedbackEntity.setEnableFlag(StateConstant.VALID);
tbCfFeedbackEntity.setCreateTime(new Date());
int res=tbCfFeedbackDao.save(tbCfFeedbackEntity);
if(res>0) {
result.setMessage(ResultCodeEnum.SUCCESS.getDesc());
} else {
result.setCode(ResultCodeEnum.DAO_ERROR.getCode()).setMessage(ResultCodeEnum.DAO_ERROR.getDesc());
}
return result;
public Result getFeedbackList() {
List<TbCfFeedbackEntity> feedbackList=tbCfFeedbackDao.getFeedbackList();
return new Result<>(feedbackList);
}
}
package com.diaoyun.zion.chinafrica.service.impl;
import com.diaoyun.zion.chinafrica.dao.TbCfStoreDao;
import com.diaoyun.zion.chinafrica.entity.TbCfPlatformEntity;
import com.diaoyun.zion.chinafrica.entity.TbCfStoreEntity;
import com.diaoyun.zion.chinafrica.service.TbCfStoreService;
import com.diaoyun.zion.master.base.Result;
import com.diaoyun.zion.master.util.IdUtil;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import static com.github.pagehelper.page.PageMethod.startPage;
/**
* 店铺管理Service实现类
*
......@@ -55,4 +60,14 @@ public class TbCfStoreServiceImpl implements TbCfStoreService {
public int deleteBatch(String[] storeIds) {
return tbCfStoreDao.deleteBatch(storeIds);
}
@Override
public Result getStoreStationList(Integer pageNum, Integer pageSize) {
Result<PageInfo> result = new Result<>();
startPage(pageNum,pageSize);
List<TbCfPlatformEntity> tbCfPlatformList=tbCfStoreDao.getStoreStationList();
PageInfo<TbCfPlatformEntity> pageInfo = new PageInfo<>(tbCfPlatformList);
result.setData(pageInfo);
return result;
}
}
......@@ -142,7 +142,7 @@ public class TbCfUserInfoServiceImpl implements TbCfUserInfoService {
result.setMessage("Verification code error");
} else {
//验证邮箱有没有被注册
TbCfUserInfoEntity existUser = findByAccount(tbCfUserInfoVo.getEmail());
TbCfUserInfoEntity existUser = findByAccount(tbCfUserInfoVo.getAccount());
if (existUser == null) {
TbCfUserInfoEntity tbCfUserInfoEntity = new TbCfUserInfoEntity();
......@@ -179,12 +179,12 @@ public class TbCfUserInfoServiceImpl implements TbCfUserInfoService {
@Override
public Result login(String ip, String account, String password) {
try {
authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(account, password));
String token = jwtTokenProvider.createToken(account);
//password = passwordEncoder.encode(password);
return loginOfficial(ip, account, token);
authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(account, password));
String token = jwtTokenProvider.createToken(account);
//password = passwordEncoder.encode(password);
return loginOfficial(ip, account, token);
} catch (AuthenticationException e) {
throw new ApplicationException(ResultCodeEnum.NEED_LOGIN.getCode(),"Invalid username/password supplied or account is disable");
throw new ApplicationException(ResultCodeEnum.NEED_LOGIN.getCode(), "Invalid username/password supplied or account is disable");
}
}
......@@ -210,7 +210,7 @@ public class TbCfUserInfoServiceImpl implements TbCfUserInfoService {
tokenManager.addToken(token, loginUser);
result.setData(loginUser).setMessage(ResultCodeEnum.SUCCESS.getDesc());
return result;
}
}
@Override
public TbCfUserInfoEntity findByAccount(String account) {
......@@ -220,24 +220,26 @@ public class TbCfUserInfoServiceImpl implements TbCfUserInfoService {
@Override
public Result updatePassWord(String newPassword, String oldPassword) {
Result result = new Result();
//获取用户
String token=jwtTokenProvider.resolveToken(request);
String token = jwtTokenProvider.resolveToken(request);
TbCfUserInfoVo loginUser = tokenManager.validate(token);
String userId = loginUser.getUserId();
Result result = new Result();
int res = tbCfUserInfoDao.updatePassWord(userId, newPassword, oldPassword);
authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(loginUser.getAccount(), oldPassword));
newPassword = passwordEncoder.encode(newPassword);
int res = tbCfUserInfoDao.updatePassWord(loginUser.getUserId(), newPassword);
if (res > 0) {
logout();
result.setMessage(ResultCodeEnum.SUCCESS.getDesc());
} else {
result.setCode(ResultCodeEnum.ERROR.getCode()).setMessage("The original password is wrong");
result.setCode(ResultCodeEnum.ERROR.getCode()).setMessage("update wrong");
}
return result;
}
@Override
public Result logout() {
String token=jwtTokenProvider.resolveToken(request);
String token = jwtTokenProvider.resolveToken(request);
if (StringUtils.isNotBlank(token)) {
tokenManager.remove(token);
}
......@@ -247,13 +249,18 @@ public class TbCfUserInfoServiceImpl implements TbCfUserInfoService {
@Override
public int updateUserInfo(TbCfUserInfoVo tbCfUserInfoVo) {
//获取用户
String token=jwtTokenProvider.resolveToken(request);
String token = jwtTokenProvider.resolveToken(request);
TbCfUserInfoVo loginUser = tokenManager.validate(token);
String userId = loginUser.getUserId();
tbCfUserInfoVo.setUserId(userId);
TbCfUserInfoEntity tbCfUserInfoEntity = new TbCfUserInfoEntity();
BeanUtils.copyProperties(tbCfUserInfoEntity, tbCfUserInfoVo);
BeanUtils.copyProperties(tbCfUserInfoVo, tbCfUserInfoEntity);
int res = this.update(tbCfUserInfoEntity);
//更新缓存
TbCfUserInfoEntity newUser = tbCfUserInfoDao.queryObject(userId);
BeanUtils.copyProperties(newUser, loginUser);
loginUser.setToken(token);
tokenManager.addToken(token, loginUser);
return res;
}
......@@ -294,8 +301,8 @@ public class TbCfUserInfoServiceImpl implements TbCfUserInfoService {
tbCfUserInfoVo.setLastLoginIp(ip);
TbCfUserInfoEntity tbCfUserInfoEntity = new TbCfUserInfoEntity();
*//**
* 填充必要信息
*//*
* 填充必要信息
*//*
fillUserNecessayInfo(tbCfUserInfoVo);
BeanUtils.copyProperties(tbCfUserInfoVo, tbCfUserInfoEntity);
......@@ -324,9 +331,33 @@ public class TbCfUserInfoServiceImpl implements TbCfUserInfoService {
@Override
public Result loginByToken(String ip) {
String token=jwtTokenProvider.resolveToken(request);
String account=jwtTokenProvider.getUsername(token);
return loginOfficial(ip,account,token);
String token = jwtTokenProvider.resolveToken(request);
String account = jwtTokenProvider.getUsername(token);
return loginOfficial(ip, account, token);
}
@Override
public Result resetPassWord(String account,String newPassword, Integer captcha) {
Result result = new Result();
Integer identifyCode = (Integer) captchaRedisCache.get(KeyConstant.CAPTCHA + account);
if (identifyCode == null || identifyCode.intValue() != captcha) {
result.setCode(ResultCodeEnum.VALIDATE_ERROR.getCode());
result.setMessage("Verification code error");
} else {
//authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(loginUser.getAccount(), oldPassword));
TbCfUserInfoEntity existUser = findByAccount(account);
String userId = existUser.getUserId();
newPassword = passwordEncoder.encode(newPassword);
int res = tbCfUserInfoDao.updatePassWord(userId, newPassword);
if (res > 0) {
logout();
result.setMessage(ResultCodeEnum.SUCCESS.getDesc());
} else {
result.setCode(ResultCodeEnum.ERROR.getCode()).setMessage("update wrong");
}
}
return result;
}
......@@ -401,8 +432,6 @@ public class TbCfUserInfoServiceImpl implements TbCfUserInfoService {
result.setCode(ResultCodeEnum.NEED_LOGIN.getCode()).setMessage("please login again");
}
}*/
private void fillUserNecessayInfo(TbCfUserInfoVo tbCfUserInfoVo) {
tbCfUserInfoVo.setUserId(IdUtil.createIdbyUUID());
tbCfUserInfoVo.setUserNo(IdUtil.createIdByDate());
......
......@@ -34,9 +34,9 @@ public class TbCfCartItemDetailVo implements Serializable {
@ApiModelProperty("商品表记录id")
private String itemId;
/**
* 商品id,源平台的id,不一定有
* 商品链接
*/
@ApiModelProperty("源平台的商品id,不一定有")
@ApiModelProperty("商品链接")
private String sourceItemId;
/**
* 来源站点id
......
......@@ -106,9 +106,9 @@ public class TbCfOrderVo implements Serializable {
@ApiModelProperty("实际付款")
private BigDecimal realityPay;
/**
* 发货标志
* 发货标志、代购标志
*/
@ApiModelProperty("发货标志")
@ApiModelProperty("发货标志、代购标志")
private Integer deliveryFlag;
/**
* 发货时间
......
......@@ -46,6 +46,7 @@ public class WebMvcConfig implements WebMvcConfigurer {
GsonBuilder builder = new GsonBuilder();
builder.registerTypeAdapterFactory(DateTypeAdapter.FACTORY);
builder.registerTypeAdapter(Json.class, new SpringfoxJsonToGsonAdapter());
builder.serializeNulls();
return builder.create();
}
......@@ -67,17 +68,18 @@ public class WebMvcConfig implements WebMvcConfigurer {
}
/**
* 跨域访问
* 跨域访问 还需要 WebSecurityConfig 相关配置
* @param registry
*/
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
//.allowedOrigins("http://localhost:8095", "http://localhost:8080")
.allowedMethods("GET","POST","PUT","DELETE","HEAD","OPTIONS","PATCH")
.allowedHeaders("Content-Type")
.allowCredentials(true)
.maxAge(60000);
.allowedOrigins("*")
.allowedMethods("GET","POST","PUT","DELETE","HEAD","PATCH")//"OPTIONS",
//.allowedHeaders("Content-Type")
//.allowCredentials(false)
//.maxAge(60000)
;
}
......
package com.diaoyun.zion.master.exception;
import java.util.Date;
/**
* 返回错误实体
*/
public class ErrorDetails {
private Date timestamp;
private String message;
private String details;
private int status;
private int code;
public ErrorDetails(Date timestamp, String message, String details, int status, int code) {
this.timestamp = timestamp;
this.message = message;
this.details = details;
this.status = status;
this.code = code;
}
public Date getTimestamp() {
return timestamp;
}
public void setTimestamp(Date timestamp) {
this.timestamp = timestamp;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getDetails() {
return details;
}
public void setDetails(String details) {
this.details = details;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
}
......@@ -28,11 +28,11 @@ public class JwtTokenProvider {
* THIS IS NOT A SECURE PRACTICE! For simplicity, we are storing a static key here. Ideally, in a
* microservices environment, this key would be kept on a config-server.
*/
@Value("${security.jwt.token.secret-key:secret-key}")
@Value("${security.jwt.token.secret-key}")
private String secretKey;
@Value("${security.jwt.token.expire-length:3600000}")
private long validityInMilliseconds = 3600000; // 1h
@Value("${security.jwt.token.expire-length}")
private long validityInMilliseconds; // 1h
@Autowired
private MyUserDetails myUserDetails;
......
package com.diaoyun.zion.master.security;
import com.google.common.collect.ImmutableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
......@@ -12,6 +13,9 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.CorsConfigurationSource;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
@Configuration
@EnableWebSecurity
......@@ -33,7 +37,8 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
// Disable CSRF (cross site request forgery)
http.csrf().disable();
//跨域访问
http.cors();
// No session will be created or used by spring security
http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS);
......@@ -81,6 +86,23 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
.antMatchers("/h2-console/**/**");;
}
@Bean
//跨域访问
public CorsConfigurationSource corsConfigurationSource() {
final CorsConfiguration configuration = new CorsConfiguration();
configuration.setAllowedOrigins(ImmutableList.of("*"));
configuration.setAllowedMethods(ImmutableList.of("HEAD","GET", "POST", "PUT", "DELETE", "PATCH"));
// setAllowCredentials(true) is important, otherwise:
// The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'.
configuration.setAllowCredentials(true);
// setAllowedHeaders is important! Without it, OPTIONS preflight request
// will fail with 403 Invalid CORS request
configuration.setAllowedHeaders(ImmutableList.of("Authorization", "Cache-Control", "Content-Type"));
final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
source.registerCorsConfiguration("/**", configuration);
return source;
}
@Bean
public PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder(12);
......
......@@ -32,7 +32,7 @@ public class IdUtil {
// 精确到毫秒
SimpleDateFormat fmt = new SimpleDateFormat("yyyyMMddHHmmssSSS");
String suffix = fmt.format(new Date());
suffix = suffix+ Math.round((Math.random() * 100));
suffix = suffix+ (Math.random() * 100);
return Long.valueOf(suffix);
}
......
server:
servlet:
context-path: /zion
port: 8080
port: 8083
tomcat:
uri-encoding: utf-8
spring:
......@@ -16,6 +16,7 @@ spring:
preferred-json-mappe
gson:
date-format: yyyy-MM-dd HH:mm:ss
serialize-nulls: true
redis:
#Redis数据库分片索引(默认为0)
database: 0
......
......@@ -208,6 +208,8 @@
<appender-ref ref="WARN_FILE" />
<appender-ref ref="ERROR_FILE" />
</root>
<!--swagger打印 不打印warning-->
<logger name="io.swagger.models.parameters.AbstractSerializableParameter" level="ERROR" />
<!--
<logger name="com.diaoyun.floatpartymember.dao" level="info" additivity="false">
<appender-ref ref="SQL_FILE" />
......
......@@ -180,4 +180,9 @@
update tb_cf_address set default_flag=0 where user_id=#{userId}
</update>
<!--获取用户默认地址-->
<select id="getDefaultAddress" resultType="com.diaoyun.zion.chinafrica.entity.TbCfAddressEntity">
select t1.* from tb_cf_address t1,tb_cf_user_info t2 where t2.user_id=#{userId} and t2.default_address_id=t1.address_id
</select>
</mapper>
\ No newline at end of file
......@@ -6,20 +6,20 @@
<resultMap type="com.diaoyun.zion.chinafrica.entity.TbCfFeedbackEntity" id="tbCfFeedbackMap">
<result property="feedbackId" column="feedback_id"/>
<result property="question" column="question"/>
<result property="answer" column="answer"/>
<result property="enableFlag" column="enable_flag"/>
<result property="createTime" column="create_time"/>
<result property="userId" column="user_id"/>
<result property="questionType" column="question_type"/>
<result property="sort" column="sort"/>
</resultMap>
<select id="queryObject" resultType="com.diaoyun.zion.chinafrica.entity.TbCfFeedbackEntity">
select
`feedback_id`,
`question`,
`answer`,
`enable_flag`,
`create_time`,
`user_id`
`question_type`,
`sort`
from tb_cf_feedback
where feedback_id = #{id}
</select>
......@@ -28,10 +28,10 @@
select
`feedback_id`,
`question`,
`answer`,
`enable_flag`,
`create_time`,
`user_id`
`question_type`,
`sort`
from tb_cf_feedback
WHERE 1=1
<if test="name != null and name.trim() != ''">
......@@ -62,27 +62,27 @@
insert into tb_cf_feedback(
`feedback_id`,
`question`,
`answer`,
`enable_flag`,
`create_time`,
`user_id`)
`question_type`,
`sort`)
values(
#{feedbackId},
#{question},
#{answer},
#{enableFlag},
#{createTime},
#{userId}
)
#{questionType},
#{sort})
</insert>
<update id="update" parameterType="com.diaoyun.zion.chinafrica.entity.TbCfFeedbackEntity">
update tb_cf_feedback
<set>
<if test="question != null">`question` = #{question}, </if>
<if test="answer != null">`answer` = #{answer}, </if>
<if test="enableFlag != null">`enable_flag` = #{enableFlag}, </if>
<if test="createTime != null">`create_time` = #{createTime}</if>
<if test="createTime != null">`create_time` = #{createTime}, </if>
<if test="questionType != null">`question_type` = #{questionType}, </if>
<if test="sort != null">`sort` = #{sort}</if>
</set>
where feedback_id = #{feedbackId}
</update>
......@@ -98,4 +98,17 @@
</foreach>
</delete>
<!--获取有效的反馈问题-->
<select id="getFeedbackList" resultType="com.diaoyun.zion.chinafrica.entity.TbCfFeedbackEntity">
select
`feedback_id`,
`question`,
`enable_flag`,
`create_time`,
`question_type`,
`sort`
from tb_cf_feedback
WHERE enable_flag=1 order by sort desc
</select>
</mapper>
\ No newline at end of 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.diaoyun.zion.chinafrica.dao.TbCfFeedbackRecordDao">
<resultMap type="com.diaoyun.zion.chinafrica.entity.TbCfFeedbackRecordEntity" id="tbCfFeedbackRecordMap">
<result property="recordId" column="record_id"/>
<result property="userId" column="user_id"/>
<result property="feedbackId" column="feedback_id"/>
<result property="answer" column="answer"/>
<result property="createTime" column="create_time"/>
</resultMap>
<select id="queryObject" resultType="com.diaoyun.zion.chinafrica.entity.TbCfFeedbackRecordEntity">
select
`record_id`,
`user_id`,
`feedback_id`,
`answer`,
`create_time`
from tb_cf_feedback_record
where record_id = #{id}
</select>
<select id="queryList" resultType="com.diaoyun.zion.chinafrica.entity.TbCfFeedbackRecordEntity">
select
`record_id`,
`user_id`,
`feedback_id`,
`answer`,
`create_time`
from tb_cf_feedback_record
WHERE 1=1
<if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%')
</if>
<choose>
<when test="sidx != null and sidx.trim() != ''">
order by ${sidx} ${order}
</when>
<otherwise>
order by record_id desc
</otherwise>
</choose>
<if test="offset != null and limit != null">
limit #{offset}, #{limit}
</if>
</select>
<select id="queryTotal" resultType="int">
select count(*) from tb_cf_feedback_record
WHERE 1=1
<if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%')
</if>
</select>
<insert id="save" parameterType="com.diaoyun.zion.chinafrica.entity.TbCfFeedbackRecordEntity">
insert into tb_cf_feedback_record(
`record_id`,
`user_id`,
`feedback_id`,
`answer`,
`create_time`)
values(
#{recordId},
#{userId},
#{feedbackId},
#{answer},
#{createTime})
</insert>
<update id="update" parameterType="com.diaoyun.zion.chinafrica.entity.TbCfFeedbackRecordEntity">
update tb_cf_feedback_record
<set>
<if test="userId != null">`user_id` = #{userId}, </if>
<if test="feedbackId != null">`feedback_id` = #{feedbackId}, </if>
<if test="answer != null">`answer` = #{answer}, </if>
<if test="createTime != null">`create_time` = #{createTime}</if>
</set>
where record_id = #{recordId}
</update>
<delete id="delete">
delete from tb_cf_feedback_record where record_id = #{value}
</delete>
<delete id="deleteBatch">
delete from tb_cf_feedback_record where record_id in
<foreach item="recordId" collection="array" open="(" separator="," close=")">
#{recordId}
</foreach>
</delete>
</mapper>
\ No newline at end of file
......@@ -151,13 +151,13 @@
select t1.cart_record_id,t1.check_flag,t2.* from tb_cf_cart_record_r t1,tb_cf_item_detail t2 where t1.item_id=t2.item_id
and t1.user_id=#{userId}
<if test="checkFlag != null"> and t1.check_flag = #{checkFlag}</if>
and t1.enable_flag=1
and t1.enable_flag=1 order by t2.create_time desc
</select>
<!--改变购物车的商品勾选状态-->
<select id="changeItemState">
<update id="changeItemState">
update tb_cf_cart_record_r set check_flag=#{checkFlag} where cart_record_id=#{cartRecordId}
</select>
</update>
</mapper>
\ No newline at end of file
......@@ -16,7 +16,7 @@
<result property="createTime" column="create_time"/>
</resultMap>
<select id="queryObject" resultType="com.diaoyun.zion.chinafrica.entity.TbCfStoreEntity">
<select id="queryObject" resultType="com.diaoyun.zion.chinafrica.entity.TbCfStoreEntity">
select
`store_id`,
`store_code`,
......@@ -27,50 +27,54 @@
`platform_code`,
`platform_name`,
`enable_flag`,
`create_time`
`create_time`,
`item_img_1`,
`item_img_2`
from tb_cf_store
where store_id = #{id}
</select>
<select id="queryList" resultType="com.diaoyun.zion.chinafrica.entity.TbCfStoreEntity">
select
`store_id`,
`store_code`,
`store_name`,
`store_brief`,
`store_url`,
`store_img`,
`platform_code`,
`platform_name`,
`enable_flag`,
`create_time`
from tb_cf_store
WHERE 1=1
<if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%')
</if>
<select id="queryList" resultType="com.diaoyun.zion.chinafrica.entity.TbCfStoreEntity">
select
`store_id`,
`store_code`,
`store_name`,
`store_brief`,
`store_url`,
`store_img`,
`platform_code`,
`platform_name`,
`enable_flag`,
`create_time`,
`item_img_1`,
`item_img_2`
from tb_cf_store
WHERE 1=1
<if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%')
</if>
<choose>
<when test="sidx != null and sidx.trim() != ''">
order by ${sidx} ${order}
</when>
<otherwise>
<otherwise>
order by store_id desc
</otherwise>
</otherwise>
</choose>
<if test="offset != null and limit != null">
limit #{offset}, #{limit}
</if>
</select>
<select id="queryTotal" resultType="int">
select count(*) from tb_cf_store
WHERE 1=1
<if test="offset != null and limit != null">
limit #{offset}, #{limit}
</if>
</select>
<select id="queryTotal" resultType="int">
select count(*) from tb_cf_store
WHERE 1=1
<if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%')
</if>
</select>
<insert id="save" parameterType="com.diaoyun.zion.chinafrica.entity.TbCfStoreEntity">
</select>
<insert id="save" parameterType="com.diaoyun.zion.chinafrica.entity.TbCfStoreEntity">
insert into tb_cf_store(
`store_id`,
`store_code`,
......@@ -81,7 +85,9 @@
`platform_code`,
`platform_name`,
`enable_flag`,
`create_time`)
`create_time`,
`item_img_1`,
`item_img_2`)
values(
#{storeId},
#{storeCode},
......@@ -92,34 +98,42 @@
#{platformCode},
#{platformName},
#{enableFlag},
#{createTime})
#{createTime},
#{itemImg1},
#{itemImg2})
</insert>
<update id="update" parameterType="com.diaoyun.zion.chinafrica.entity.TbCfStoreEntity">
update tb_cf_store
<set>
<if test="storeCode != null">`store_code` = #{storeCode}, </if>
<if test="storeName != null">`store_name` = #{storeName}, </if>
<if test="storeBrief != null">`store_brief` = #{storeBrief}, </if>
<if test="storeUrl != null">`store_url` = #{storeUrl}, </if>
<if test="storeImg != null">`store_img` = #{storeImg}, </if>
<if test="platformCode != null">`platform_code` = #{platformCode}, </if>
<if test="platformName != null">`platform_name` = #{platformName}, </if>
<if test="enableFlag != null">`enable_flag` = #{enableFlag}, </if>
<if test="createTime != null">`create_time` = #{createTime}</if>
</set>
where store_id = #{storeId}
</update>
<delete id="delete">
<update id="update" parameterType="com.diaoyun.zion.chinafrica.entity.TbCfStoreEntity">
update tb_cf_store
<set>
<if test="storeCode != null">`store_code` = #{storeCode},</if>
<if test="storeName != null">`store_name` = #{storeName},</if>
<if test="storeBrief != null">`store_brief` = #{storeBrief},</if>
<if test="storeUrl != null">`store_url` = #{storeUrl},</if>
<if test="storeImg != null">`store_img` = #{storeImg},</if>
<if test="platformCode != null">`platform_code` = #{platformCode},</if>
<if test="platformName != null">`platform_name` = #{platformName},</if>
<if test="enableFlag != null">`enable_flag` = #{enableFlag},</if>
<if test="createTime != null">`create_time` = #{createTime}</if>
<if test="itemImg1 != null">`item_img_1` = #{itemImg1}</if>
<if test="itemImg2 != null">`item_img_2` = #{itemImg2}</if>
</set>
where store_id = #{storeId}
</update>
<delete id="delete">
delete from tb_cf_store where store_id = #{value}
</delete>
<delete id="deleteBatch">
delete from tb_cf_store where store_id in
<foreach item="storeId" collection="array" open="(" separator="," close=")">
#{storeId}
</foreach>
</delete>
<delete id="deleteBatch">
delete from tb_cf_store where store_id in
<foreach item="storeId" collection="array" open="(" separator="," close=")">
#{storeId}
</foreach>
</delete>
<!--获取店铺独立站-->
<select id="getStoreStationList" resultType="com.diaoyun.zion.chinafrica.entity.TbCfStoreEntity">
select * from tb_cf_store where enable_flag=1 order by create_time desc
</select>
</mapper>
\ No newline at end of file
......@@ -24,6 +24,7 @@
<result property="invitedUserId" column="invited_user_id"/>
<result property="invitedCount" column="invited_count"/>
<result property="enableFlag" column="enable_flag"/>
<result property="emailFlag" column="email_flag"/>
</resultMap>
<select id="queryObject" resultType="com.diaoyun.zion.chinafrica.entity.TbCfUserInfoEntity">
......@@ -47,7 +48,8 @@
`default_address_id`,
`invited_user_id`,
`invited_count`,
`enable_flag`
`enable_flag`,
`email_flag`
from tb_cf_user_info
where user_id = #{id}
</select>
......@@ -73,7 +75,8 @@
`default_address_id`,
`invited_user_id`,
`invited_count`,
`enable_flag`
`enable_flag`,
`email_flag`
from tb_cf_user_info
WHERE 1=1
<if test="name != null and name.trim() != ''">
......@@ -121,7 +124,8 @@
`default_address_id`,
`invited_user_id`,
`invited_count`,
`enable_flag`)
`enable_flag`,
`email_flag`)
values(
#{userId},
#{userNo},
......@@ -142,7 +146,9 @@
#{defaultAddressId},
#{invitedUserId},
#{invitedCount},
#{enableFlag})
#{enableFlag},
#{emailFlag}
)
</insert>
<update id="update" parameterType="com.diaoyun.zion.chinafrica.entity.TbCfUserInfoEntity">
......@@ -190,13 +196,13 @@
<!--根据userId 账号 email nick 查找用户-->
<select id="findByAccount" resultType="com.diaoyun.zion.chinafrica.entity.TbCfUserInfoEntity">
select * from tb_cf_user_info where enable_flag=1 and user_id=#{userId} or account=#{account}
or email =#{account} or nick =#{account};
select * from tb_cf_user_info where enable_flag=1 and (user_id=#{userId} or account=#{account}
or email =#{account} or nick =#{account});
</select>
<!--修改密码-->
<update id="updatePassWord" >
update tb_cf_user_info set password=#{newPassword} where user_id=#{userId} and password=#{oldPassword}
update tb_cf_user_info set password=#{newPassword} where user_id=#{userId}
</update>
</mapper>
\ No newline at end of file
......@@ -119,15 +119,43 @@ loginApp.controller('loginController', function ($scope, $q, $http) {
}
})*/
var xhr = new XMLHttpRequest();
var url = 'https://africa.gzdazt.com/zion/user/register/identifyCode/1262837396@qq.com/123456';
/*var xhr = new XMLHttpRequest();
var url = 'https://africa.gzdazt.com/zion/user/register/identifyCode/960696163@qq.com/xixi';
xhr.open('PUT', url, true);
xhr.open('GET', url, true);
xhr.withCredentials = true;
xhr.onreadystatechange = handler;
xhr.send();
xhr.send();*/
var dataParam ={
itemImg: '111',
itemnum: '111',
itemprice: '111',
itemSku: '111',
itemTitle: '111',
shopid: '111',
shopname: '111',
shopurl: '111'
};
$.ajax({
url: "https://africa.gzdazt.com/zion/item/cart",
type: "post",
dataType: "json",
data: JSON.stringify(dataParam),
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI5NjA2OTYxNjNAcXEuY29tIiwiaWF0IjoxNTY4OTYxOTAyLCJleHAiOjE1Njk1NjY3MDJ9.iY4CspfTbRTuapIkKDX1gdXvlEE7Ld7VKy28avoQC4U'
},
success: function (res) {
console.log(res)
},
error:function(res) {
console.log(res)
}
})
/*$http({
method: "POST",
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论