Commit f4c16911 authored by hezhen's avatar hezhen

Merge branch 'dev' of http://113.105.137.151:22280/youjj/cloud-platform into dev

parents 4b3f817c 602b0cd5
...@@ -372,26 +372,31 @@ public class TourGoodBiz extends BaseBiz<TourGoodMapper, TourGood> { ...@@ -372,26 +372,31 @@ public class TourGoodBiz extends BaseBiz<TourGoodMapper, TourGood> {
if (CollectionUtils.isEmpty(query.getTagIds())) { if (CollectionUtils.isEmpty(query.getTagIds())) {
setQueryTagIds(query); setQueryTagIds(query);
} }
List<GoodDataVO> list = mapper.getList(query);
List<TourGood> list = mapper.getList(query);
return handleResultList(list, query); return handleResultList(list, query);
} }
private List handleResultList(List<TourGood> list, WebsiteQuery query) { private List handleResultList(List<GoodDataVO> list, WebsiteQuery query) {
int size=0; int size=0;
if (list != null) { if (list != null) {
size = list.size(); size = list.size();
} }
if (size!= query.getLimit()) { if (size!= query.getLimit()) {
List<Integer> ids = list.parallelStream().map(TourGood::getId).collect(Collectors.toList()); List<Integer> ids = list.parallelStream().map(GoodDataVO::getId).collect(Collectors.toList());
Example example =new Example(TourGood.class); Example example =new Example(TourGood.class);
example.createCriteria().andNotIn("id",ids).andEqualTo("status",1).andEqualTo("isDel",0); example.createCriteria().andNotIn("id",ids).andEqualTo("status",1).andEqualTo("isDel",0);
example.orderBy("rank").asc().orderBy("crtTime").desc(); example.orderBy("rank").asc().orderBy("crtTime").desc();
PageHelper.startPage(1,query.getLimit()-size); PageHelper.startPage(1,query.getLimit()-size);
List<TourGood> tourGoods = mapper.selectByExample(example); List<TourGood> tourGoods = mapper.selectByExample(example);
list.addAll(tourGoods); for (TourGood tourGood : tourGoods) {
GoodDataVO goodDataVO = new GoodDataVO();
goodDataVO.setId(tourGood.getId());
goodDataVO.setName(tourGood.getName());
goodDataVO.setImgUrl(tourGood.getCover());
goodDataVO.setPrice(tourGood.getPrice().toString());
list.add(goodDataVO);
}
} }
return list; return list;
} }
......
...@@ -38,7 +38,7 @@ public interface TourGoodMapper extends Mapper<TourGood> { ...@@ -38,7 +38,7 @@ public interface TourGoodMapper extends Mapper<TourGood> {
*/ */
List<GoodDataVO> findAllByHome(@Param("start") Integer start, @Param("size") Integer size); List<GoodDataVO> findAllByHome(@Param("start") Integer start, @Param("size") Integer size);
List<TourGood> getList(WebsiteQuery query); List<GoodDataVO> getList(WebsiteQuery query);
List newTour(Integer limit); List newTour(Integer limit);
} }
...@@ -123,7 +123,7 @@ ...@@ -123,7 +123,7 @@
ORDER BY g.rank DESC ,g.id DESC ORDER BY g.rank DESC ,g.id DESC
</select> </select>
<select id="getList" resultType="com.xxfc.platform.tour.entity.TourGood"> <select id="getList" resultType="com.github.wxiaoqi.security.common.vo.GoodDataVO">
SELECT SELECT
g.id AS `id`, g.id AS `id`,
g. NAME AS `name`, g. NAME AS `name`,
......
package com.xxfc.platform.universal.service; package com.xxfc.platform.universal.service;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.map.MapUtil; import cn.hutool.core.map.MapUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.admin.feign.UserFeign; import com.github.wxiaoqi.security.admin.feign.UserFeign;
...@@ -31,6 +32,7 @@ import org.springframework.stereotype.Service; ...@@ -31,6 +32,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport; import org.springframework.transaction.interceptor.TransactionAspectSupport;
import tk.mybatis.mapper.entity.Example; import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.weekend.WeekendSqls;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
...@@ -62,7 +64,8 @@ public class CertificationService { ...@@ -62,7 +64,8 @@ public class CertificationService {
private UserPictureParsing userPictureParsing; private UserPictureParsing userPictureParsing;
/** /**
* 一、身份证图片进行实名认证 * 一、身份证图片进行实名认证
*
* @param idInformation * @param idInformation
* @return * @return
*/ */
...@@ -103,6 +106,15 @@ public class CertificationService { ...@@ -103,6 +106,15 @@ public class CertificationService {
if (idInformation.getIdNumber().equals(number)) { if (idInformation.getIdNumber().equals(number)) {
ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE, "证件号不一致"); ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE, "证件号不一致");
} }
Example exa = new Example(IdInformation.class);
Example.Criteria criteria = exa.createCriteria();
criteria.andEqualTo("idNumber", idInformation.getIdNumber());
List<IdInformation> idInformatics = idInformationMapper.selectByExample(exa);
if (CollectionUtil.isNotEmpty(idInformatics)) {
log.error("该身份证已存在,不要重复认证");
log.info("图片已解析,未认证");
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE, "该身份证已存在,不要重复认证");
}
//3.验证 //3.验证
boolean result = authentication.certificate(new UserMessage() {{ boolean result = authentication.certificate(new UserMessage() {{
setIdNumber(number); setIdNumber(number);
...@@ -159,28 +171,18 @@ public class CertificationService { ...@@ -159,28 +171,18 @@ public class CertificationService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ObjectRestResponse<Integer> addIdInformation(IdInformation idInformation) { public ObjectRestResponse<Integer> addIdInformation(IdInformation idInformation) {
log.info("----idInformation=========" + idInformation); log.info("----idInformation=========" + idInformation);
//保存认证信息 //保存认证信息
try { try {
Example exa = new Example(IdInformation.class); idInformation.setCrtTime(new Date());
Example.Criteria criteria = exa.createCriteria(); idInformationMapper.insertSelective(idInformation);
criteria.andEqualTo("idNumber", idInformation.getIdNumber());
List<IdInformation> idInformatics = idInformationMapper.selectByExample(exa);
if (CollectionUtils.isEmpty(idInformatics)) {
idInformation.setCrtTime(new Date());
idInformationMapper.insertSelective(idInformation);
} else {
log.error("该身份证已存在,不要重复认证");
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE, "该身份证已存在,不要重复认证");
}
log.info("----addIdInformation---userid===" + idInformation.getUserLoginId() + "----name====" + idInformation.getName() + "---IdNumber===" + idInformation.getIdNumber()); log.info("----addIdInformation---userid===" + idInformation.getUserLoginId() + "----name====" + idInformation.getName() + "---IdNumber===" + idInformation.getIdNumber());
//认证成功后修改用户,用户认证状态 //认证成功后修改用户,用户认证状态
ObjectRestResponse authentication = userFeign.authentication(idInformation.getUserLoginId(), idInformation.getName(), idInformation.getIdNumber(), 1); userFeign.authentication(idInformation.getUserLoginId(), idInformation.getName(), idInformation.getIdNumber(), 1);
return ObjectRestResponse.succ(idInformation.getId()); return ObjectRestResponse.succ(idInformation.getId());
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
TransactionAspectSupport.currentTransactionStatus(); TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return ObjectRestResponse.createFailedResult(ResultCode.INCOMPLETE_DATA, "无法识别,请重新上传"); return ObjectRestResponse.createFailedResult(ResultCode.INCOMPLETE_DATA, "认证失败,请重新认证");
} }
} }
...@@ -188,6 +190,31 @@ public class CertificationService { ...@@ -188,6 +190,31 @@ public class CertificationService {
return idInformationMapper.selectByUserId(userId); return idInformationMapper.selectByUserId(userId);
} }
@Transactional(rollbackFor = Exception.class)
public Boolean delete(Integer userId) {
try {
int i = idInformationMapper.deleteByExample(Example
.builder(IdInformation.class)
.where(WeekendSqls.<IdInformation>custom()
.andEqualTo(IdInformation::getUserLoginId, userId)).build());
if (i==1){
return true;
}else {
log.info("删除行数= {}",i);
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return false;
}
} catch (Exception e) {
e.printStackTrace();
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
log.info("删除报错");
return false;
}
}
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment