package com.stylefeng.guns.modular.system.controller.general;
|
|
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
import com.baomidou.mybatisplus.mapper.Wrapper;
|
import com.baomidou.mybatisplus.plugins.Page;
|
import com.stylefeng.guns.core.base.controller.BaseController;
|
import com.stylefeng.guns.core.common.constant.factory.PageFactory;
|
import com.stylefeng.guns.core.util.ToolUtil;
|
import com.stylefeng.guns.modular.system.model.TMerchant;
|
import com.stylefeng.guns.modular.system.model.TMerchantActivity;
|
import com.stylefeng.guns.modular.system.service.ITMerchantActivityService;
|
import com.stylefeng.guns.modular.system.service.ITMerchantService;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Controller;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
import java.util.List;
|
import java.util.Map;
|
|
@Controller
|
@RequestMapping("/tMerchant")
|
public class TMerchantController extends BaseController {
|
|
private String PREFIX = "/system/tMerchant/";
|
|
@Autowired
|
private ITMerchantService merchantService;
|
|
@Autowired
|
private ITMerchantActivityService merchantActivityService;
|
|
/// 跳转商家审核
|
@RequestMapping("")
|
public String index(){
|
return PREFIX + "tMerchantAudit.html";
|
}
|
|
/// 跳转商家列表
|
@RequestMapping("/tMerchantIndex")
|
public String tMerchantIndex(){
|
return PREFIX + "tMerchantIndex.html";
|
}
|
|
|
/// 获取商家审核列表
|
@RequestMapping("/tMerchantAuditList")
|
@ResponseBody
|
public Object tMerchantAuditList(String startTime, String endTime, String name, Integer auditStatus){
|
Page<Map<String,Object>> page = new PageFactory<Map<String,Object>>().defaultPage();
|
Wrapper wrapper = new EntityWrapper<TMerchant>().orderBy("id",false);
|
if (ToolUtil.isNotEmpty(startTime) && ToolUtil.isNotEmpty(endTime)){
|
wrapper.between("createTime",startTime + " 00:00:00",endTime + " 23:59:59");
|
}
|
if (ToolUtil.isNotEmpty(name)){
|
wrapper.like("name",name);
|
}
|
if (ToolUtil.isNotEmpty(auditStatus)){
|
wrapper.eq("auditStatus",auditStatus);
|
}
|
|
page.setRecords(merchantService.selectMapsPage(page,wrapper).getRecords());
|
return super.packForBT(page);
|
}
|
|
/// 获取商家列表
|
@RequestMapping("/tMerchantList")
|
@ResponseBody
|
public Object tMerchantList(String startTime, String endTime, String name){
|
Page<Map<String,Object>> page = new PageFactory<Map<String,Object>>().defaultPage();
|
Wrapper wrapper = new EntityWrapper<TMerchant>().orderBy("id",false).eq("auditStatus",2);
|
if (ToolUtil.isNotEmpty(startTime) && ToolUtil.isNotEmpty(endTime)){
|
wrapper.between("createTime",startTime + " 00:00:00",endTime + " 23:59:59");
|
}
|
if (ToolUtil.isNotEmpty(name)){
|
wrapper.like("name",name);
|
}
|
|
List<Map<String,Object>> list = merchantService.selectMapsPage(page,wrapper).getRecords();
|
for (Map<String, Object> map : list) {
|
List<TMerchantActivity> list1 = merchantActivityService.selectList(new EntityWrapper<TMerchantActivity>().eq("merchantId",map.get("id")));
|
map.put("activityNum",list1.size());
|
}
|
page.setRecords(list);
|
return super.packForBT(page);
|
}
|
|
/// 商家审核
|
@RequestMapping("/AuditSubmit")
|
@ResponseBody
|
public Object AuditSubmit(TMerchant tMerchant){
|
merchantService.updateById(tMerchant);
|
return SUCCESS_TIP;
|
}
|
|
|
/// 冻结和解冻
|
@RequestMapping("/updateState")
|
@ResponseBody
|
public Object updateState(TMerchant tMerchant){
|
merchantService.updateById(tMerchant);
|
return SUCCESS_TIP;
|
}
|
}
|