Authored by mali

Merge branch 'test6.9.1' of http://git.yoho.cn/ufo/ufo-platform into test6.9.1

... ... @@ -16,4 +16,6 @@ public interface SecondhandInfoMapper {
List<SecondhandInfo> selectByCondition(@Param("secondhandReq") SecondhandReq req);
List<SecondhandInfo> selectBySkups(@Param("skupList")List<Integer> skupList);
int updateAuditInfoBySkup(SecondhandInfo secondhandInfo);
}
\ No newline at end of file
... ...
... ... @@ -21,7 +21,9 @@ public class SecondhandReq extends PageRequestBO{
*/
private static final long serialVersionUID = 1620427808531296022L;
private Integer id;
private Integer skup;
private Integer status;
private String rejectReason;
}
... ...
... ... @@ -22,7 +22,7 @@ public class SecondhandRsp {
private String skupTypeStr;
private List<String> imageList;
private List<SecondhandImages> imageList;
private String describeInfo;
... ... @@ -46,4 +46,10 @@ public class SecondhandRsp {
private String auditName;
private String productName;
private String productImage;
private String rejectReason;
}
... ...
... ... @@ -57,4 +57,11 @@
#{item}
</foreach>
</select>
<update id="updateAuditInfoBySkup" parameterType="com.yoho.product.model.SecondhandInfo">
update secondhand_info
set status=#{status}, reject_reason=#{rejectReason},
audit_uid=#{auditUid}, audit_name=#{auditName}, audit_time=#{auditTime}
where skup=#{skup}
</update>
</mapper>
\ No newline at end of file
... ...
... ... @@ -35,5 +35,17 @@ public class SecondhandProductController {
PageResponseBO<SecondhandRsp> result = secondhandProductService.querySecondhandSkupList(req);
return new ApiResponse.ApiResponseBuilder().code(200).message("查询成功").data(result).build();
}
@RequestMapping(value = "/updateAuditInfo")
public ApiResponse updateAuditInfo(SecondhandReq req) {
LOGGER.info("updateAuditInfo in. req is {}", req);
int result = secondhandProductService.updateStatus(req);
if(result >0) {
return new ApiResponse.ApiResponseBuilder().code(200).message("查询成功").data(result).build();
}else {
return new ApiResponse.ApiResponseBuilder().code(500).message("查询失败").build();
}
}
}
... ...
... ... @@ -13,4 +13,6 @@ public interface ISecondhandProductService {
PageResponseBO<SecondhandRsp> querySecondhandSkupList(SecondhandReq req);
int updateStatus(SecondhandReq req);
}
... ...
... ... @@ -18,7 +18,9 @@ import com.yoho.product.model.SecondhandImages;
import com.yoho.product.model.SecondhandInfo;
import com.yoho.product.model.SecondhandReq;
import com.yoho.product.model.SecondhandRsp;
import com.yoho.ufo.dal.ProductMapper;
import com.yoho.ufo.dal.StoragePriceMapper;
import com.yoho.ufo.dal.model.Product;
import com.yoho.ufo.dal.model.StoragePrice;
import com.yoho.ufo.service.ISecondhandProductService;
import com.yoho.ufo.service.model.PageResponseBO;
... ... @@ -41,6 +43,9 @@ public class SecondhandProductService implements ISecondhandProductService{
@Autowired
private SellerOrderGoodsMapper sellerOrderGoodsMapper;
@Autowired
private ProductMapper productMapper;
private static final Integer STATUS_NEW = 0;
private static final Integer STATUS_WAIT_TO_BE_AUDITED = 10;
... ... @@ -92,7 +97,13 @@ public class SecondhandProductService implements ISecondhandProductService{
List<SellerOrderGoods> sellerGoodsList = sellerOrderGoodsMapper.selectByIds(skupList);
Map<Integer, SellerOrderGoods> sellerGoodsMap = sellerGoodsList.stream().collect(Collectors.toMap(SellerOrderGoods::getId, s->s));
List<SecondhandRsp> respList = convertToResp(infoList, skupImageMap, storagePriceMap, sellerGoodsMap);
//查询product
List<Integer> productIdList = storagePriceList.stream().map(StoragePrice::getProductId).collect(Collectors.toList());
List<Product> productList = productMapper.selectProductListByIds(productIdList);
Map<Integer, String> productIdNameMap = productList.stream().collect(Collectors.toMap(Product::getId, Product::getProductName));
//组装
List<SecondhandRsp> respList = convertToResp(infoList, skupImageMap, storagePriceMap, sellerGoodsMap, productIdNameMap);
PageResponseBO<SecondhandRsp> result=new PageResponseBO<>();
result.setList(respList);
... ... @@ -102,9 +113,23 @@ public class SecondhandProductService implements ISecondhandProductService{
return result;
}
@Override
public int updateStatus(SecondhandReq req) {
SecondhandInfo auditInfo = new SecondhandInfo();
UserHelper userInfo = new UserHelper();
auditInfo.setSkup(req.getSkup());
auditInfo.setStatus(req.getStatus());
auditInfo.setRejectReason(req.getRejectReason());
auditInfo.setAuditName(userInfo.getUserName());
auditInfo.setAuditUid(userInfo.getUserId());
auditInfo.setAuditTime(DateUtil.getCurrentTimeSeconds());
return secondhandInfoMapper.updateAuditInfoBySkup(auditInfo);
}
private List<SecondhandRsp> convertToResp(List<SecondhandInfo> infoList, Map<Integer, List<SecondhandImages>> skupImageMap,
Map<Integer, StoragePrice> storagePriceMap, Map<Integer, SellerOrderGoods> sellerGoodsMap){
Map<Integer, StoragePrice> storagePriceMap, Map<Integer, SellerOrderGoods> sellerGoodsMap,
Map<Integer, String> productIdNameMap){
List<SecondhandRsp> respList = Lists.newArrayList();
for(SecondhandInfo item : infoList) {
SecondhandRsp rsp = new SecondhandRsp();
... ... @@ -114,8 +139,8 @@ public class SecondhandProductService implements ISecondhandProductService{
rsp.setSkupType(storagePrice.getPreSaleFlag());
rsp.setSkupTypeStr(StorageTypeEnum.getTypeName(storagePrice.getPreSaleFlag()));
List<SecondhandImages> secondhandImagesList = skupImageMap.get(skup);
List<String> imageUrlList = secondhandImagesList.stream().map(SecondhandImages::getImageUrl).collect(Collectors.toList());
rsp.setImageList(imageUrlList);
rsp.setImageList(secondhandImagesList);
rsp.setProductImage(getProductImage(secondhandImagesList));
rsp.setDescribeInfo(item.getDescribeInfo());
rsp.setSku(storagePrice.getStorageId());
SellerOrderGoods sellerGoods = sellerGoodsMap.get(skup);
... ... @@ -127,12 +152,27 @@ public class SecondhandProductService implements ISecondhandProductService{
rsp.setStatusStr(ProductSkupStatusEnum.getTypeName(item.getStatus()));
rsp.setCreateTimeStr(DateUtil.getDateFormatFromInt(item.getCreateTime(), "yyyy-MM-dd HH:mm:ss"));
rsp.setAuditTimeStr(null == item.getAuditTime() ? "" : DateUtil.getDateFormatFromInt(item.getAuditTime(), "yyyy-MM-dd HH:mm:ss"));
rsp.setAuditName(item.getAuditName());
rsp.setAuditName(null == item.getAuditName() ? "" : item.getAuditName());
rsp.setProductName(productIdNameMap.get(storagePrice.getProductId()));
rsp.setRejectReason(item.getRejectReason());
respList.add(rsp);
}
return respList;
}
private String getProductImage(List<SecondhandImages> imageList) {
String imageUrl = "";
if(CollectionUtils.isNotEmpty(imageList)) {
for(SecondhandImages item : imageList) {
if(item.getIsDefault().equals("Y")) {
imageUrl = item.getImageUrl();
break;
}
}
}
return imageUrl;
}
}
... ...
... ... @@ -32,9 +32,9 @@
</div>
</div>
<script>
const tab_status_to_be_audited="10";
const tab_status_audit_pass="1";
const tab_status_audit_reject="11";
const tab_status_to_be_audited=10;
const tab_status_audit_pass=1;
const tab_status_audit_reject=11;
$(function() {
//获取状态对应的记录数
getCountByStatus();
... ... @@ -45,6 +45,13 @@ $(function() {
tabsSelected(index);
}
});
//放大图片预览
$(".pimg1").on('click', function(){
alert("+++++++++****");
var _this = $(this);//将当前的pimg元素作为_this传入函数
download(_this.attr("src"));
});
function tabsSelected(index) {
if(index == 0){
... ... @@ -58,12 +65,6 @@ $(function() {
}
}
//放大图片预览
$(".pimg").on('click', function(){
var _this = $(this);//将当前的pimg元素作为_this传入函数
download(_this.attr("src"));
});
});
function getAllList() {
... ... @@ -100,7 +101,6 @@ function getSkupList(status){
temp.rows = temp.list;
return temp;
},
columns: table_columns,
cache: false,
pagination: true,
... ... @@ -112,7 +112,7 @@ function getSkupList(status){
$(this).datagrid("getPanel").find("a[role='auditPass']").linkbutton({
onClick: function () {
var skup = $(this).attr("dataId");
confirmReceive(id);
auditPass(skup);
}
});
... ... @@ -120,60 +120,146 @@ function getSkupList(status){
$(this).datagrid("getPanel").find("a[role='auditReject']").linkbutton({
onClick: function () {
var skup = $(this).attr("dataId");
confirmReceive(id);
addRejectPage(skup);
}
});
}
});
}
//审核通过
function auditPass(skup) {
$.messager.confirm("审核通过提醒", "是否审核通过?", function(flag) {
if (flag) {
$.post(contextPath + "/secondhand/updateAuditInfo", {
skup : skup,
status : tab_status_audit_pass
}, function(data) {
if (data.code == 200) {
reloadTableAndFreshCount();
window.self.$.messager.show({
title : "提示",
msg : "审核通过成功!"
});
}else {
window.self.$.messager.alert("失败", "失败!", "error");
}
});
}
});
}
function addRejectPage(skup) {
var div = $("<div id='rejectDiv'>").appendTo($(document.body));
var url = contextPath + "/html/secondhand/reject.html?time_version=" + new Date().getTime();
$(div).myDialog({
width: "50%",
height: "50%",
title: "审核不通过",
href: url,
modal: true,
collapsible: true,
cache: false,
buttons: [{
text: "取消",
iconCls: "icon-cancel",
handler: function () {
$(div).dialog("close");
}
},{
text: "确定",
id: "rejectBtn",
iconCls: "icon-save",
onClick: function () {
$('#rejectBtn').linkbutton('disable');
auditReject(skup, div);
}
}]
});
}
//审核不通过
function auditReject(skup, div) {
$.post(contextPath + "/secondhand/updateAuditInfo", {
skup : skup,
status : tab_status_audit_reject,
rejectReason: $("#rejectReason").textbox("getValue")
}, function(data) {
if (data.code == 200) {
reloadTableAndFreshCount();
$(div).dialog("close");
window.self.$.messager.show({
title : "提示",
msg : "审核不通过成功!"
});
}else {
window.self.$.messager.alert("失败", "失败!", "error");
}
});
}
function reloadTableAndFreshCount(){
//获取鉴定状态对应的记录数
getCountByStatus();
$("#skupListTable").datagrid("reload");
}
function getTableColumn() {
return [{
title: "SKUP",
field: "skup",
field: "skupAndSkupTypeStr",
width: 20,
align: "center",
formatter: function (value, rowData, rowIndex) {
return rowData.skup + "</br>" + "<font color='green' >("+ rowData.skupTypeStr + ")</font>";
}
}, {
title: "SKU",
field: "sku",
width: 30,
align: "center"
}, {
title: "商品图片",
field: "productImage",
width: 30,
align: "center",
formatter: function (value, rowData, rowIndex) {
return "<img height='100px;' width='80px;' src='"+value+"'/>";
}
}, {
title: "商品信息",
field: "productInfo",
width: 30,
align: "center",
formatter: function (value, rowData, rowIndex) {
return "<p align='left'>商品名称:" + rowData.productName + "</br>" +
"颜色:" + rowData.colorName + "</br>" +
"尺码:" + rowData.sizeName + "</p>";
}
},{
title: "SKUP类型",
field: "skupTypeStr",
width: 25,
align: "center"
}, {
title: "图片",
title: "卖家上传图片",
field: "imageList",
width: 80,
align: "center",
formatter: function (value, rowData, rowIndex) {
var imageStr = "<table><tbody><tr>";
for (var i = 0 ;i < value.length; i++){
imageStr += "<td><img height='70px;' width='50px;' class='pimg' src='"+value[i]+"'/></td>";
imageStr += "<td><img height='70px;' width='50px;' src='"+value[i].imageUrl+"'/></td>";
if((i+1) % 4 == 0 && 0 != i && i != (value.length - 1)) {
imageStr += "</tr><tr>";
}
}
return imageStr + "</tr></tbody></table>";
imageStr = imageStr + "</tr></tbody></table>";
return imageStr;
}
}, {
title: "描述",
title: "卖家描述",
field: "describeInfo",
width: 40,
align: "center"
}, {
title: "SKU",
field: "sku",
width: 30,
align: "center"
}, {
title: "颜色",
field: "colorName",
width: 20,
align: "center"
}, {
title: "尺码",
field: "sizeName",
width: 20,
align: "center"
},{
title: "卖家UID",
field: "sellerUid",
... ... @@ -188,22 +274,27 @@ function getTableColumn() {
title: "状态",
field: "statusStr",
width: 20,
align: "center"
align: "center",
formatter: function (value, rowData, rowIndex) {
var auditInfo = rowData.statusStr;
if(rowData.status==11){//审核不通过
auditInfo += "(<font color='red' >原因:"+ rowData.rejectReason + "</font>)"
}
return auditInfo;
}
},{
title: "创建时间",
field: "createTimeStr",
width: 30,
align: "center"
},{
title: "操作时间",
field: "auditTimeStr",
title: "操作信息",
field: "auditInfo",
width: 30,
align: "center"
},{
title: "操作人",
field: "auditName",
width: 20,
align: "center"
align: "center",
formatter: function (value, rowData, rowIndex) {
return rowData.auditName + "</br>" + rowData.auditTimeStr;
}
},{
title: "操作",
field: "asdf",
... ... @@ -212,13 +303,14 @@ function getTableColumn() {
formatter: function (value, rowData, rowIndex) {
if (rowData.status == 10) {//待审核
return "<a role='auditPass' dataId='"+ rowData.skup +"' style='margin-left:10px;background-color: #5cb85c !important;'>审核通过</a>"
+ "<a role='auditReject' dataId='"+ rowData.skup +"' style='margin-left:10px;background-color: #5cb85c !important;'>审核不通过</a>";
+ "<a role='auditReject' dataId='"+ rowData.skup +"' style='margin-left:10px;background-color: #d9534f !important;'>审核不通过</a>";
}
}
}]
}
function download(url) {
alert("++++++*********");
$('#dlg').dialog({
title: '预览',
width: 800,
... ... @@ -231,12 +323,6 @@ function download(url) {
$("#simg").attr("src", url);
}
function reloadTableAndFreshCount(){
//获取鉴定状态对应的记录数
getCountByJudgeStatus();
$("#orderListTable").datagrid("reload");
}
function getCountByStatus(){
//发送请求
$.ajax({
... ...
<!DOCTYPE html>
<html lang="en">
<head>
<title>main</title>
<script src="/ufoPlatform/js/include.js"></script>
</head>
<body class="easyui-layout" fit="true">
<div id="rejectDiv" region="center">
<h2> &nbsp;&nbsp;&nbsp;&nbsp;确认审核不通过?</h2>
<h2> &nbsp;&nbsp;&nbsp;&nbsp;请填写原因: <input type="text" class="easyui-textbox" id="rejectReason" style="width:300px;height:100px"/></h2>
</div>
</body>
</html>
\ No newline at end of file
... ...