plf 3 лет назад
Родитель
Сommit
2d967da960
51 измененных файлов с 3968 добавлено и 4881 удалено
  1. 457 464
      src/main/java/com/caimei/modules/brand/web/CmBrandController.java
  2. 0 23
      src/main/java/com/caimei/modules/coupon/dao/CmCouponClubDao.java
  3. 26 10
      src/main/java/com/caimei/modules/coupon/dao/CmCouponDao.java
  4. 0 18
      src/main/java/com/caimei/modules/coupon/dao/CmCouponOrderRecordDao.java
  5. 0 15
      src/main/java/com/caimei/modules/coupon/dao/CmCouponRecordDao.java
  6. 0 19
      src/main/java/com/caimei/modules/coupon/dao/CmCouponRecordScanDao.java
  7. 223 197
      src/main/java/com/caimei/modules/coupon/entity/CmCoupon.java
  8. 121 0
      src/main/java/com/caimei/modules/coupon/entity/CmCouponAssociate.java
  9. 79 115
      src/main/java/com/caimei/modules/coupon/entity/CmCouponClub.java
  10. 0 227
      src/main/java/com/caimei/modules/coupon/entity/CmCouponOrderRecord.java
  11. 0 199
      src/main/java/com/caimei/modules/coupon/entity/CmCouponRecord.java
  12. 0 188
      src/main/java/com/caimei/modules/coupon/entity/CmCouponRecordScan.java
  13. 0 218
      src/main/java/com/caimei/modules/coupon/entity/ReadExcel.java
  14. 0 69
      src/main/java/com/caimei/modules/coupon/service/CmCouponClubService.java
  15. 0 52
      src/main/java/com/caimei/modules/coupon/service/CmCouponOrderRecordService.java
  16. 0 54
      src/main/java/com/caimei/modules/coupon/service/CmCouponRecordScanService.java
  17. 0 44
      src/main/java/com/caimei/modules/coupon/service/CmCouponRecordService.java
  18. 196 63
      src/main/java/com/caimei/modules/coupon/service/CmCouponService.java
  19. 0 217
      src/main/java/com/caimei/modules/coupon/web/CmCouponClubController.java
  20. 139 94
      src/main/java/com/caimei/modules/coupon/web/CmCouponController.java
  21. 0 173
      src/main/java/com/caimei/modules/coupon/web/CmCouponOrderRecordController.java
  22. 0 139
      src/main/java/com/caimei/modules/coupon/web/CmCouponRecordController.java
  23. 0 153
      src/main/java/com/caimei/modules/coupon/web/CmCouponRecordScanController.java
  24. 46 44
      src/main/java/com/caimei/modules/product/service/CmIkDictService.java
  25. 9 0
      src/main/java/com/caimei/modules/user/entity/CmUser.java
  26. 10 1
      src/main/java/com/caimei/modules/user/entity/NewCmShop.java
  27. 0 191
      src/main/resources/mappings/modules/coupon/CmCouponClubMapper.xml
  28. 256 142
      src/main/resources/mappings/modules/coupon/CmCouponMapper.xml
  29. 0 167
      src/main/resources/mappings/modules/coupon/CmCouponOrderRecordMapper.xml
  30. 0 170
      src/main/resources/mappings/modules/coupon/CmCouponRecordMapper.xml
  31. 0 195
      src/main/resources/mappings/modules/coupon/CmCouponRecordScanMapper.xml
  32. 1 1
      src/main/resources/mappings/modules/product/ProductMapper.xml
  33. 0 105
      src/main/webapp/WEB-INF/views/modules/coupon/cmClubListBox.jsp
  34. 0 273
      src/main/webapp/WEB-INF/views/modules/coupon/cmCouponClubList.jsp
  35. 542 0
      src/main/webapp/WEB-INF/views/modules/coupon/cmCouponForm.jsp
  36. 123 0
      src/main/webapp/WEB-INF/views/modules/coupon/cmCouponList.jsp
  37. 0 116
      src/main/webapp/WEB-INF/views/modules/coupon/cmCouponListBox.jsp
  38. 0 101
      src/main/webapp/WEB-INF/views/modules/coupon/cmCouponOrderRecordList.jsp
  39. 0 295
      src/main/webapp/WEB-INF/views/modules/coupon/cmCouponRecordList.jsp
  40. 0 329
      src/main/webapp/WEB-INF/views/modules/coupon/cmCouponRecordScanList.jsp
  41. 144 0
      src/main/webapp/WEB-INF/views/modules/coupon/couponCategoryForm.jsp
  42. 125 0
      src/main/webapp/WEB-INF/views/modules/coupon/couponCategoryList.jsp
  43. 131 0
      src/main/webapp/WEB-INF/views/modules/coupon/couponNewUserForm.jsp
  44. 117 0
      src/main/webapp/WEB-INF/views/modules/coupon/couponNewUserList.jsp
  45. 271 0
      src/main/webapp/WEB-INF/views/modules/coupon/couponShopForm.jsp
  46. 131 0
      src/main/webapp/WEB-INF/views/modules/coupon/couponShopList.jsp
  47. 247 0
      src/main/webapp/WEB-INF/views/modules/coupon/couponUserExclusiveForm.jsp
  48. 186 0
      src/main/webapp/WEB-INF/views/modules/coupon/couponUserExclusiveList.jsp
  49. 122 0
      src/main/webapp/WEB-INF/views/modules/coupon/toAddClub.jsp
  50. 133 0
      src/main/webapp/WEB-INF/views/modules/coupon/toAddProduct.jsp
  51. 133 0
      src/main/webapp/WEB-INF/views/modules/coupon/toAddShop.jsp

+ 457 - 464
src/main/java/com/caimei/modules/brand/web/CmBrandController.java

@@ -1,15 +1,15 @@
 package com.caimei.modules.brand.web;
 
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
 import com.caimei.modules.brand.entity.BrandAndProductType;
-import com.caimei.modules.coupon.entity.CmCoupon;
-import com.caimei.modules.coupon.entity.ReadExcel;
-import com.caimei.modules.miniprogram.utils.UploadPicUtils;
+import com.caimei.modules.brand.entity.CmBrand;
+import com.caimei.modules.brand.service.CmBrandService;
 import com.caimei.modules.product.dao.ProductDao;
 import com.caimei.modules.product.entity.Product;
 import com.caimei.modules.sys.utils.SMSUtils;
+import com.thinkgem.jeesite.common.config.Global;
+import com.thinkgem.jeesite.common.persistence.Page;
+import com.thinkgem.jeesite.common.utils.StringUtils;
+import com.thinkgem.jeesite.common.web.BaseController;
 import com.thinkgem.jeesite.modules.sys.utils.UserUtils;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.collections.map.HashedMap;
@@ -30,15 +30,8 @@ import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.servlet.mvc.support.RedirectAttributes;
 
-import com.thinkgem.jeesite.common.config.Global;
-import com.thinkgem.jeesite.common.persistence.Page;
-import com.thinkgem.jeesite.common.web.BaseController;
-import com.thinkgem.jeesite.common.utils.StringUtils;
-import com.caimei.modules.brand.entity.CmBrand;
-import com.caimei.modules.brand.service.CmBrandService;
-
-import java.math.BigDecimal;
-import java.text.SimpleDateFormat;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -46,6 +39,7 @@ import java.util.Map;
 
 /**
  * 采美品牌Controller
+ *
  * @author Lijun
  * @version 2019-04-19
  */
@@ -53,460 +47,459 @@ import java.util.Map;
 @RequestMapping(value = "${adminPath}/brand/cmBrand")
 public class CmBrandController extends BaseController {
 
-	//总行数
-	private int totalRows = 0;
-	//总条数
-	private int totalCells = 0;
-	//错误信息接收器
-	private String errorMsg;
-
-
-	@Autowired
-	private CmBrandService cmBrandService;
-	@Autowired
-	private ProductDao productDao;
-	
-	@ModelAttribute
-	public CmBrand get(@RequestParam(required=false) String id) {
-		CmBrand entity = null;
-		if (StringUtils.isNotBlank(id)){
-			entity = cmBrandService.get(id);
-		}
-		if (entity == null){
-			entity = new CmBrand();
-		}
-		return entity;
-	}
-	
-	@RequiresPermissions("brand:cmBrand:view")
-	@RequestMapping(value = {"list", ""})
-	public String list(CmBrand cmBrand, HttpServletRequest request, HttpServletResponse response, Model model) {
-		Page<CmBrand> page = cmBrandService.findPage(new Page<CmBrand>(request, response), cmBrand); 
-		model.addAttribute("page", page);
-		return "modules/brand/cmBrandList";
-	}
-
-	@RequiresPermissions("brand:cmBrand:view")
-	@RequestMapping(value = "form")
-	public String form(CmBrand cmBrand, Model model) {
-		model.addAttribute("cmBrand", cmBrand);
-		String auditNote = cmBrand.getAuditNote();
-		if(StringUtils.isNotEmpty(auditNote)){
-			if(StringUtils.equals("填写错误",auditNote)){
-				cmBrand.setAuditStatus("1");
-			}else{
-				cmBrand.setAuditStatus("2");
-			}
-		}else{
-			cmBrand.setAuditStatus("0");
-		}
-		return "modules/brand/cmBrandForm";
-	}
-
-	@RequiresPermissions("brand:cmBrand:edit")
-	@RequestMapping(value = "save")
-	public String save(CmBrand cmBrand, Model model, RedirectAttributes redirectAttributes,HttpServletRequest request) {
-		if (!beanValidator(model, cmBrand)){
-			return form(cmBrand, model);
-		}
-		//判断输入的名字是否已存在
-		CmBrand cmBrandByName = cmBrandService.findBradByName(cmBrand);
+    //总行数
+    private int totalRows = 0;
+    //总条数
+    private int totalCells = 0;
+    //错误信息接收器
+    private String errorMsg;
+
+
+    @Autowired
+    private CmBrandService cmBrandService;
+    @Autowired
+    private ProductDao productDao;
+
+    @ModelAttribute
+    public CmBrand get(@RequestParam(required = false) String id) {
+        CmBrand entity = null;
+        if (StringUtils.isNotBlank(id)) {
+            entity = cmBrandService.get(id);
+        }
+        if (entity == null) {
+            entity = new CmBrand();
+        }
+        return entity;
+    }
+
+    @RequiresPermissions("brand:cmBrand:view")
+    @RequestMapping(value = {"list", ""})
+    public String list(CmBrand cmBrand, HttpServletRequest request, HttpServletResponse response, Model model) {
+        Page<CmBrand> page = cmBrandService.findPage(new Page<CmBrand>(request, response), cmBrand);
+        model.addAttribute("page", page);
+        return "modules/brand/cmBrandList";
+    }
+
+    @RequiresPermissions("brand:cmBrand:view")
+    @RequestMapping(value = "form")
+    public String form(CmBrand cmBrand, Model model) {
+        model.addAttribute("cmBrand", cmBrand);
+        String auditNote = cmBrand.getAuditNote();
+        if (StringUtils.isNotEmpty(auditNote)) {
+            if (StringUtils.equals("填写错误", auditNote)) {
+                cmBrand.setAuditStatus("1");
+            } else {
+                cmBrand.setAuditStatus("2");
+            }
+        } else {
+            cmBrand.setAuditStatus("0");
+        }
+        return "modules/brand/cmBrandForm";
+    }
+
+    @RequiresPermissions("brand:cmBrand:edit")
+    @RequestMapping(value = "save")
+    public String save(CmBrand cmBrand, Model model, RedirectAttributes redirectAttributes, HttpServletRequest request) {
+        if (!beanValidator(model, cmBrand)) {
+            return form(cmBrand, model);
+        }
+        //判断输入的名字是否已存在
+        CmBrand cmBrandByName = cmBrandService.findBradByName(cmBrand);
 //		if (StringUtils.isNotBlank(cmBrand.getLogo())) {
 //			String img = UploadPicUtils.saveImageToServer(cmBrand.getLogo(), request);
 //			cmBrand.setLogo(img);
 //		}
-		if(null != cmBrandByName){
-			addMessage(redirectAttributes, "该品牌已存在");
-		}else{
-			//判断是新增加还是修改
-			if(StringUtils.isEmpty(cmBrand.getId())){//新增
-				cmBrand.setCreateDate(new Date());
-				cmBrand.setStatus("1");//采美添加默认通过--品牌状态 0:待审核,1:审核通过,2:审核失败
-				cmBrand.setSource("0");//添加来源 0:后台添加 ,1:供应商添加
-				cmBrand.setSort("0");
-				cmBrand.setUserID(UserUtils.getUser()+"");
-			}else{//修改
-				String status = cmBrand.getStatus();
-				CmBrand oldBrand = cmBrandService.get(cmBrand.getId());//获取修改前的品牌信息
-				String oldStatus = oldBrand.getStatus();//老的状态
-				if(!StringUtils.equals(status,oldStatus)){//重新修改状态才发送短信提示(防止重复编辑重复发送短信)
-					if(StringUtils.equals("1",status)){
-						String mobile = cmBrand.getShopMobile();
-						if (StringUtils.isNotEmpty(mobile)) {
-							SMSUtils.sendSms(mobile, "您提交的["+cmBrand.getName()+"]品牌申请,已审核成功");
-						}
-					}
-					if(StringUtils.equals("2",status)){
-						String auditNote = cmBrand.getAuditNote();
-						if(StringUtils.isEmpty(auditNote)){
-							addMessage(model, "请输入失败原因!!");
-							return form(cmBrand, model);
-						}
-						String mobile = cmBrand.getShopMobile();
-						if (StringUtils.isNotEmpty(mobile)) {
-							SMSUtils.sendSms(mobile, "抱歉,您提交的["+cmBrand.getName()+"]品牌申请,由于"+cmBrand.getAuditNote()+"审核失败,请重新修改提交!");
-						}
-					}
-				}else{
-					if(StringUtils.equals("2",status)){
-						String auditNote = cmBrand.getAuditNote();
-						if(StringUtils.isEmpty(auditNote)){
-							addMessage(model, "请输入失败原因!!");
-							return form(cmBrand, model);
-						}
-					}
-				}
-
-			}
-
-
-			cmBrand.setUpdateDate(new Date());
-			cmBrandService.save(cmBrand);
-			addMessage(redirectAttributes, "保存品牌成功");
-		}
-		return "redirect:"+Global.getAdminPath()+"/brand/cmBrand/";
-	}
-	
-	@RequiresPermissions("brand:cmBrand:delete")
-	@RequestMapping(value = "delete")
-	public String delete(CmBrand cmBrand, RedirectAttributes redirectAttributes) {
-		Date date = new Date();
-		cmBrand.setUpdateDate(date);
-		cmBrand.setDelFlag(date.getTime()+"");
-		//删除品牌表格内容
-		cmBrandService.delete(cmBrand);
-		//清理对应品牌商品信息(标记品牌为null)
-		productDao.updateProductByBrandId(Integer.parseInt(cmBrand.getId()));
-		addMessage(redirectAttributes, "删除品牌成功");
-		return "redirect:"+Global.getAdminPath()+"/brand/cmBrand/?repage";
-	}
-
-	@RequiresPermissions("brand:cmBrand:view")
-	@RequestMapping(value = {"uploadList"})
-	public String uploadList() {
-		return "modules/brand/brandUpload";
-	}
-
-	@ResponseBody
-	@RequestMapping(value = "import")
-	public Map<String,Object> cibeShopImport(@RequestParam(value="file",required = false) MultipartFile file, HttpServletRequest request, HttpServletResponse response, Model model){
-		Map<String,Object> map = new HashedMap();
-		try{
-			try {
-				//xls  2003版本
-				Workbook wb = new HSSFWorkbook(file.getInputStream());
-				// 得到第一个shell
-				Sheet sheet = wb.getSheetAt(0);
-				// 得到Excel的行数
-				this.totalRows = sheet.getPhysicalNumberOfRows();
-				// 得到Excel的列数(前提是有行数)
-				if (totalRows > 1 && sheet.getRow(0) != null) {
-					this.totalCells = sheet.getRow(0).getPhysicalNumberOfCells();
-				}
-				List<BrandAndProductType> brandAndProductType = new ArrayList<>();
-				// 循环Excel行数
-				for (int r = 1; r < totalRows; r++) {
-					Row row = sheet.getRow(r);
-					if (row == null){
-						continue;
-					}
-					BrandAndProductType brandAndProduct = new BrandAndProductType();
-					// 循环Excel的列
-					for (int c = 0; c < this.totalCells; c++) {
-						Cell cell = row.getCell(c);
-						if (null != cell) {
-							String value = getFieldValue(cell);
-							switch (c){
-								case 0:
-									brandAndProduct.setBrandName(value); //品牌名字
-									break;
-								case 1:
-									break;
-								case 2:
-									break;
-								case 3:
-									break;
-								case 4:
-									break;
-								case 5:
-									break;
-								case 6:
-									break;
-								default:
-									break;
-							}
-						}
-					}
-					// 添加到list
-					brandAndProductType.add(brandAndProduct);
-				}
-
-				//将转化对象插入品牌库
-				if(CollectionUtils.isNotEmpty(brandAndProductType)){
-					for(BrandAndProductType b:brandAndProductType){
-						String brandName = b.getBrandName();
-						CmBrand cmBrand  = new CmBrand();
-						cmBrand.setName(brandName);
-						cmBrand.setSource("0");
-						cmBrand.setUserID("1");
-						cmBrand.setStatus("1");
-						cmBrand.setSort("0");
-						cmBrand.setDelFlag("0");
-						cmBrand.setCreateDate(new Date());
-						cmBrand.setUpdateDate(new Date());
-						cmBrandService.save(cmBrand);
-					}
-				}
-
-			} catch (Exception e) {
-				e.printStackTrace();
-			}
-			map.put("success",true);
-			map.put("msg", "上传成功");
-		}catch (Exception e){
-			e.printStackTrace();
-			logger.error(e.getMessage());
-			map.put("success",false);
-			map.put("msg", "上传失败");
-		}
-		return map;
-	}
-
-	@ResponseBody
-	@RequestMapping(value = "import1")
-	public Map<String,Object> import1(@RequestParam(value="file",required = false) MultipartFile file, HttpServletRequest request, HttpServletResponse response, Model model){
-		Map<String,Object> map = new HashedMap();
-		try{
-			try {
-				Workbook wb = new HSSFWorkbook(file.getInputStream());
-				// 得到第一个shell
-				Sheet sheet = wb.getSheetAt(0);
-				// 得到Excel的行数
-				this.totalRows = sheet.getPhysicalNumberOfRows();
-				// 得到Excel的列数(前提是有行数)
-				if (totalRows > 1 && sheet.getRow(0) != null) {
-					this.totalCells = sheet.getRow(0).getPhysicalNumberOfCells();
-				}
-				List<BrandAndProductType> brandAndProductType = new ArrayList<>();
-				// 循环Excel行数
-				for (int r = 1; r < totalRows; r++) {
-					Row row = sheet.getRow(r);
-					if (row == null){
-						continue;
-					}
-					BrandAndProductType brandAndProduct = new BrandAndProductType();
-					// 循环Excel的列
-					for (int c = 0; c < this.totalCells; c++) {
-						Cell cell = row.getCell(c);
-						if (null != cell) {
-							String value = getFieldValue(cell);
-							switch (c){
-								case 0:
-									brandAndProduct.setProductId((int)Double.parseDouble(value));
-									break;
-								case 1:
-									break;
-								case 2:
-									break;
-								case 3:
-									brandAndProduct.setBrandName(value);
-									break;
-								case 4:
-									break;
-								case 5:
-									break;
-								case 6:
-									break;
-								default:
-									break;
-							}
-						}
-					}
-					// 添加到list
-					brandAndProductType.add(brandAndProduct);
-				}
-
-				//将转化对象更新到商品表
-				if(CollectionUtils.isNotEmpty(brandAndProductType)){
-					for(BrandAndProductType b:brandAndProductType){
-						//通过名字查询品牌
-						String brandName = b.getBrandName();
-						CmBrand cmBrand = new CmBrand();
-						cmBrand.setName(brandName);
-						CmBrand bradByName = cmBrandService.findBradByName(cmBrand);
-						if(null != bradByName){
-							String id = bradByName.getId();
-							Integer productId = b.getProductId();
-							Product product = new Product();
-							product.setBrandID(Integer.parseInt(id));
-							product.setProductID(productId);
-							productDao.updateBrnadId(product);
-						}else{
-							logger.info("---------------------商品不存在该品牌productId"+b.getProductId());
-						}
-					}
-				}
-
-			} catch (Exception e) {
-				logger.info(">>>>>>>>>>>>>>>>>>>>>>>>上次异常");
-				e.printStackTrace();
-			}
-			map.put("success",true);
-			map.put("msg", "上传成功");
-		}catch (Exception e){
-			e.printStackTrace();
-			logger.error(e.getMessage());
-			map.put("success",false);
-			map.put("msg", "上传失败");
-		}
-		return map;
-	}
-
-
-	@ResponseBody
-	@RequestMapping(value = "import2")
-	public Map<String,Object> import2(@RequestParam(value="file",required = false) MultipartFile file, HttpServletRequest request, HttpServletResponse response, Model model){
-		Map<String,Object> map = new HashedMap();
-		try{
-			try {
-				Workbook wb = new HSSFWorkbook(file.getInputStream());
-				// 得到第一个shell
-				Sheet sheet = wb.getSheetAt(0);
-				// 得到Excel的行数
-				this.totalRows = sheet.getPhysicalNumberOfRows();
-				// 得到Excel的列数(前提是有行数)
-				if (totalRows > 1 && sheet.getRow(0) != null) {
-					this.totalCells = sheet.getRow(0).getPhysicalNumberOfCells();
-				}
-				List<BrandAndProductType> brandAndProductType = new ArrayList<>();
-				// 循环Excel行数
-				for (int r = 1; r < totalRows; r++) {
-					Row row = sheet.getRow(r);
-					if (row == null){
-						continue;
-					}
-					BrandAndProductType brandAndProduct = new BrandAndProductType();
-					// 循环Excel的列
-					for (int c = 0; c < this.totalCells; c++) {
-						Cell cell = row.getCell(c);
-						if (null != cell) {
-							String value = getFieldValue(cell);
-							switch (c){
-								case 0:
-									brandAndProduct.setProductId((int)Double.parseDouble(value)); //商品ID
-									logger.info("__________________________product"+value);
-									break;
-								case 1:
-									break;
-								case 2:
-									break;
-								case 3:
-									break;
-								case 4:
+        if (null != cmBrandByName) {
+            addMessage(redirectAttributes, "该品牌已存在");
+        } else {
+            //判断是新增加还是修改
+            if (StringUtils.isEmpty(cmBrand.getId())) {//新增
+                cmBrand.setCreateDate(new Date());
+                cmBrand.setStatus("1");//采美添加默认通过--品牌状态 0:待审核,1:审核通过,2:审核失败
+                cmBrand.setSource("0");//添加来源 0:后台添加 ,1:供应商添加
+                cmBrand.setSort("0");
+                cmBrand.setUserID(UserUtils.getUser() + "");
+            } else {//修改
+                String status = cmBrand.getStatus();
+                CmBrand oldBrand = cmBrandService.get(cmBrand.getId());//获取修改前的品牌信息
+                String oldStatus = oldBrand.getStatus();//老的状态
+                if (!StringUtils.equals(status, oldStatus)) {//重新修改状态才发送短信提示(防止重复编辑重复发送短信)
+                    if (StringUtils.equals("1", status)) {
+                        String mobile = cmBrand.getShopMobile();
+                        if (StringUtils.isNotEmpty(mobile)) {
+                            SMSUtils.sendSms(mobile, "您提交的[" + cmBrand.getName() + "]品牌申请,已审核成功");
+                        }
+                    }
+                    if (StringUtils.equals("2", status)) {
+                        String auditNote = cmBrand.getAuditNote();
+                        if (StringUtils.isEmpty(auditNote)) {
+                            addMessage(model, "请输入失败原因!!");
+                            return form(cmBrand, model);
+                        }
+                        String mobile = cmBrand.getShopMobile();
+                        if (StringUtils.isNotEmpty(mobile)) {
+                            SMSUtils.sendSms(mobile, "抱歉,您提交的[" + cmBrand.getName() + "]品牌申请,由于" + cmBrand.getAuditNote() + "审核失败,请重新修改提交!");
+                        }
+                    }
+                } else {
+                    if (StringUtils.equals("2", status)) {
+                        String auditNote = cmBrand.getAuditNote();
+                        if (StringUtils.isEmpty(auditNote)) {
+                            addMessage(model, "请输入失败原因!!");
+                            return form(cmBrand, model);
+                        }
+                    }
+                }
+
+            }
+
+
+            cmBrand.setUpdateDate(new Date());
+            cmBrandService.save(cmBrand);
+            addMessage(redirectAttributes, "保存品牌成功");
+        }
+        return "redirect:" + Global.getAdminPath() + "/brand/cmBrand/";
+    }
+
+    @RequiresPermissions("brand:cmBrand:delete")
+    @RequestMapping(value = "delete")
+    public String delete(CmBrand cmBrand, RedirectAttributes redirectAttributes) {
+        Date date = new Date();
+        cmBrand.setUpdateDate(date);
+        cmBrand.setDelFlag(date.getTime() + "");
+        //删除品牌表格内容
+        cmBrandService.delete(cmBrand);
+        //清理对应品牌商品信息(标记品牌为null)
+        productDao.updateProductByBrandId(Integer.parseInt(cmBrand.getId()));
+        addMessage(redirectAttributes, "删除品牌成功");
+        return "redirect:" + Global.getAdminPath() + "/brand/cmBrand/?repage";
+    }
+
+    @RequiresPermissions("brand:cmBrand:view")
+    @RequestMapping(value = {"uploadList"})
+    public String uploadList() {
+        return "modules/brand/brandUpload";
+    }
+
+    @ResponseBody
+    @RequestMapping(value = "import")
+    public Map<String, Object> cibeShopImport(@RequestParam(value = "file", required = false) MultipartFile file, HttpServletRequest request, HttpServletResponse response, Model model) {
+        Map<String, Object> map = new HashedMap();
+        try {
+            try {
+                //xls  2003版本
+                Workbook wb = new HSSFWorkbook(file.getInputStream());
+                // 得到第一个shell
+                Sheet sheet = wb.getSheetAt(0);
+                // 得到Excel的行数
+                this.totalRows = sheet.getPhysicalNumberOfRows();
+                // 得到Excel的列数(前提是有行数)
+                if (totalRows > 1 && sheet.getRow(0) != null) {
+                    this.totalCells = sheet.getRow(0).getPhysicalNumberOfCells();
+                }
+                List<BrandAndProductType> brandAndProductType = new ArrayList<>();
+                // 循环Excel行数
+                for (int r = 1; r < totalRows; r++) {
+                    Row row = sheet.getRow(r);
+                    if (row == null) {
+                        continue;
+                    }
+                    BrandAndProductType brandAndProduct = new BrandAndProductType();
+                    // 循环Excel的列
+                    for (int c = 0; c < this.totalCells; c++) {
+                        Cell cell = row.getCell(c);
+                        if (null != cell) {
+                            String value = getFieldValue(cell);
+                            switch (c) {
+                                case 0:
+                                    brandAndProduct.setBrandName(value); //品牌名字
+                                    break;
+                                case 1:
+                                    break;
+                                case 2:
+                                    break;
+                                case 3:
+                                    break;
+                                case 4:
+                                    break;
+                                case 5:
+                                    break;
+                                case 6:
+                                    break;
+                                default:
+                                    break;
+                            }
+                        }
+                    }
+                    // 添加到list
+                    brandAndProductType.add(brandAndProduct);
+                }
+
+                //将转化对象插入品牌库
+                if (CollectionUtils.isNotEmpty(brandAndProductType)) {
+                    for (BrandAndProductType b : brandAndProductType) {
+                        String brandName = b.getBrandName();
+                        CmBrand cmBrand = new CmBrand();
+                        cmBrand.setName(brandName);
+                        cmBrand.setSource("0");
+                        cmBrand.setUserID("1");
+                        cmBrand.setStatus("1");
+                        cmBrand.setSort("0");
+                        cmBrand.setDelFlag("0");
+                        cmBrand.setCreateDate(new Date());
+                        cmBrand.setUpdateDate(new Date());
+                        cmBrandService.save(cmBrand);
+                    }
+                }
+
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+            map.put("success", true);
+            map.put("msg", "上传成功");
+        } catch (Exception e) {
+            e.printStackTrace();
+            logger.error(e.getMessage());
+            map.put("success", false);
+            map.put("msg", "上传失败");
+        }
+        return map;
+    }
+
+    @ResponseBody
+    @RequestMapping(value = "import1")
+    public Map<String, Object> import1(@RequestParam(value = "file", required = false) MultipartFile file, HttpServletRequest request, HttpServletResponse response, Model model) {
+        Map<String, Object> map = new HashedMap();
+        try {
+            try {
+                Workbook wb = new HSSFWorkbook(file.getInputStream());
+                // 得到第一个shell
+                Sheet sheet = wb.getSheetAt(0);
+                // 得到Excel的行数
+                this.totalRows = sheet.getPhysicalNumberOfRows();
+                // 得到Excel的列数(前提是有行数)
+                if (totalRows > 1 && sheet.getRow(0) != null) {
+                    this.totalCells = sheet.getRow(0).getPhysicalNumberOfCells();
+                }
+                List<BrandAndProductType> brandAndProductType = new ArrayList<>();
+                // 循环Excel行数
+                for (int r = 1; r < totalRows; r++) {
+                    Row row = sheet.getRow(r);
+                    if (row == null) {
+                        continue;
+                    }
+                    BrandAndProductType brandAndProduct = new BrandAndProductType();
+                    // 循环Excel的列
+                    for (int c = 0; c < this.totalCells; c++) {
+                        Cell cell = row.getCell(c);
+                        if (null != cell) {
+                            String value = getFieldValue(cell);
+                            switch (c) {
+                                case 0:
+                                    brandAndProduct.setProductId((int) Double.parseDouble(value));
+                                    break;
+                                case 1:
+                                    break;
+                                case 2:
+                                    break;
+                                case 3:
+                                    brandAndProduct.setBrandName(value);
+                                    break;
+                                case 4:
+                                    break;
+                                case 5:
+                                    break;
+                                case 6:
+                                    break;
+                                default:
+                                    break;
+                            }
+                        }
+                    }
+                    // 添加到list
+                    brandAndProductType.add(brandAndProduct);
+                }
+
+                //将转化对象更新到商品表
+                if (CollectionUtils.isNotEmpty(brandAndProductType)) {
+                    for (BrandAndProductType b : brandAndProductType) {
+                        //通过名字查询品牌
+                        String brandName = b.getBrandName();
+                        CmBrand cmBrand = new CmBrand();
+                        cmBrand.setName(brandName);
+                        CmBrand bradByName = cmBrandService.findBradByName(cmBrand);
+                        if (null != bradByName) {
+                            String id = bradByName.getId();
+                            Integer productId = b.getProductId();
+                            Product product = new Product();
+                            product.setBrandID(Integer.parseInt(id));
+                            product.setProductID(productId);
+                            productDao.updateBrnadId(product);
+                        } else {
+                            logger.info("---------------------商品不存在该品牌productId" + b.getProductId());
+                        }
+                    }
+                }
+
+            } catch (Exception e) {
+                logger.info(">>>>>>>>>>>>>>>>>>>>>>>>上次异常");
+                e.printStackTrace();
+            }
+            map.put("success", true);
+            map.put("msg", "上传成功");
+        } catch (Exception e) {
+            e.printStackTrace();
+            logger.error(e.getMessage());
+            map.put("success", false);
+            map.put("msg", "上传失败");
+        }
+        return map;
+    }
+
+
+    @ResponseBody
+    @RequestMapping(value = "import2")
+    public Map<String, Object> import2(@RequestParam(value = "file", required = false) MultipartFile file, HttpServletRequest request, HttpServletResponse response, Model model) {
+        Map<String, Object> map = new HashedMap();
+        try {
+            try {
+                Workbook wb = new HSSFWorkbook(file.getInputStream());
+                // 得到第一个shell
+                Sheet sheet = wb.getSheetAt(0);
+                // 得到Excel的行数
+                this.totalRows = sheet.getPhysicalNumberOfRows();
+                // 得到Excel的列数(前提是有行数)
+                if (totalRows > 1 && sheet.getRow(0) != null) {
+                    this.totalCells = sheet.getRow(0).getPhysicalNumberOfCells();
+                }
+                List<BrandAndProductType> brandAndProductType = new ArrayList<>();
+                // 循环Excel行数
+                for (int r = 1; r < totalRows; r++) {
+                    Row row = sheet.getRow(r);
+                    if (row == null) {
+                        continue;
+                    }
+                    BrandAndProductType brandAndProduct = new BrandAndProductType();
+                    // 循环Excel的列
+                    for (int c = 0; c < this.totalCells; c++) {
+                        Cell cell = row.getCell(c);
+                        if (null != cell) {
+                            String value = getFieldValue(cell);
+                            switch (c) {
+                                case 0:
+                                    brandAndProduct.setProductId((int) Double.parseDouble(value)); //商品ID
+                                    logger.info("__________________________product" + value);
+                                    break;
+                                case 1:
+                                    break;
+                                case 2:
+                                    break;
+                                case 3:
+                                    break;
+                                case 4:
 //									会所常用品(HSCY)-美容工具(MRGJ)-小工具(XGJ)
 
-									//去掉value中的括号以及括号里内容
-									String[] split = value.split("-");
-									int length = split.length;
-									if(length == 3){
-										String s = split[0];
-										String s1 = split[1];
-										String s2 = split[2];
-										int i = s.indexOf("(");
-										String substring = s.substring(0, i);
-
-										int i1 = s1.indexOf("(");
-										String substring1 = s1.substring(0, i1);
-
-										int i2 = s2.indexOf("(");
-										String substring2 = s2.substring(0, i2);
-
-										brandAndProduct.setBigTypeName(substring);//大分类
-										brandAndProduct.setSmallTypeName(substring1);//二级分类
-										brandAndProduct.setTinyTypeName(substring2);//小分类名字
-									}
-									break;
-								case 5:
-									break;
-								case 6:
-									break;
-								default:
-									break;
-							}
-						}
-					}
-					// 添加到list
-					brandAndProductType.add(brandAndProduct);
-				}
-
-				//将转化对象插入品牌库
-				if(CollectionUtils.isNotEmpty(brandAndProductType)){
-					for(BrandAndProductType b:brandAndProductType){
-						String bigTypeName = b.getBigTypeName();
-						String smallTypeName = b.getSmallTypeName();
-						String tinyTypeName = b.getTinyTypeName();
-
-						List<BrandAndProductType> productByTypeName = productDao.getProductByTypeName(bigTypeName, smallTypeName, tinyTypeName);
-						if(CollectionUtils.isNotEmpty(productByTypeName) && productByTypeName.size() == 1){
-							BrandAndProductType brandAndProductType1 = productByTypeName.get(0);
-							Integer tinyTypeID = brandAndProductType1.getTinyTypeID();
-							Product product = new Product();
-							product.setProductID(b.getProductId());
-							product.setTinyTypeID(tinyTypeID);
-							productDao.updateTinyType(product);
-						}
-						else{
-							logger.info("----------------------商品分类异常ProductId"+b.getProductId());
-						}
-					}
-				}
-			} catch (Exception e) {
-				logger.info(">>>>>>>>>>>>>>>>>>>>>>>>上次异常");
-				e.printStackTrace();
-			}
-			map.put("success",true);
-			map.put("msg", "上传成功");
-		}catch (Exception e){
-			e.printStackTrace();
-			logger.error(e.getMessage());
-			map.put("success",false);
-			map.put("msg", "上传失败");
-		}
-		return map;
-	}
-
-	public String getFieldValue(Cell cell){
-		String value = null;
-		if(cell.getCellType() == HSSFCell.CELL_TYPE_NUMERIC){
-			value = String.valueOf(cell.getNumericCellValue());
-		}else {
-			value = cell.getStringCellValue();
-		}
-		return value;
-	}
-
-	public int getTotalRows() {
-		return totalRows;
-	}
-
-	public void setTotalRows(int totalRows) {
-		this.totalRows = totalRows;
-	}
-
-	public int getTotalCells() {
-		return totalCells;
-	}
-
-	public void setTotalCells(int totalCells) {
-		this.totalCells = totalCells;
-	}
-
-	public String getErrorMsg() {
-		return errorMsg;
-	}
-
-	public void setErrorMsg(String errorMsg) {
-		this.errorMsg = errorMsg;
-	}
+                                    //去掉value中的括号以及括号里内容
+                                    String[] split = value.split("-");
+                                    int length = split.length;
+                                    if (length == 3) {
+                                        String s = split[0];
+                                        String s1 = split[1];
+                                        String s2 = split[2];
+                                        int i = s.indexOf("(");
+                                        String substring = s.substring(0, i);
+
+                                        int i1 = s1.indexOf("(");
+                                        String substring1 = s1.substring(0, i1);
+
+                                        int i2 = s2.indexOf("(");
+                                        String substring2 = s2.substring(0, i2);
+
+                                        brandAndProduct.setBigTypeName(substring);//大分类
+                                        brandAndProduct.setSmallTypeName(substring1);//二级分类
+                                        brandAndProduct.setTinyTypeName(substring2);//小分类名字
+                                    }
+                                    break;
+                                case 5:
+                                    break;
+                                case 6:
+                                    break;
+                                default:
+                                    break;
+                            }
+                        }
+                    }
+                    // 添加到list
+                    brandAndProductType.add(brandAndProduct);
+                }
+
+                //将转化对象插入品牌库
+                if (CollectionUtils.isNotEmpty(brandAndProductType)) {
+                    for (BrandAndProductType b : brandAndProductType) {
+                        String bigTypeName = b.getBigTypeName();
+                        String smallTypeName = b.getSmallTypeName();
+                        String tinyTypeName = b.getTinyTypeName();
+
+                        List<BrandAndProductType> productByTypeName = productDao.getProductByTypeName(bigTypeName, smallTypeName, tinyTypeName);
+                        if (CollectionUtils.isNotEmpty(productByTypeName) && productByTypeName.size() == 1) {
+                            BrandAndProductType brandAndProductType1 = productByTypeName.get(0);
+                            Integer tinyTypeID = brandAndProductType1.getTinyTypeID();
+                            Product product = new Product();
+                            product.setProductID(b.getProductId());
+                            product.setTinyTypeID(tinyTypeID);
+                            productDao.updateTinyType(product);
+                        } else {
+                            logger.info("----------------------商品分类异常ProductId" + b.getProductId());
+                        }
+                    }
+                }
+            } catch (Exception e) {
+                logger.info(">>>>>>>>>>>>>>>>>>>>>>>>上次异常");
+                e.printStackTrace();
+            }
+            map.put("success", true);
+            map.put("msg", "上传成功");
+        } catch (Exception e) {
+            e.printStackTrace();
+            logger.error(e.getMessage());
+            map.put("success", false);
+            map.put("msg", "上传失败");
+        }
+        return map;
+    }
+
+    public String getFieldValue(Cell cell) {
+        String value = null;
+        if (cell.getCellType() == HSSFCell.CELL_TYPE_NUMERIC) {
+            value = String.valueOf(cell.getNumericCellValue());
+        } else {
+            value = cell.getStringCellValue();
+        }
+        return value;
+    }
+
+    public int getTotalRows() {
+        return totalRows;
+    }
+
+    public void setTotalRows(int totalRows) {
+        this.totalRows = totalRows;
+    }
+
+    public int getTotalCells() {
+        return totalCells;
+    }
+
+    public void setTotalCells(int totalCells) {
+        this.totalCells = totalCells;
+    }
+
+    public String getErrorMsg() {
+        return errorMsg;
+    }
+
+    public void setErrorMsg(String errorMsg) {
+        this.errorMsg = errorMsg;
+    }
 
 }

+ 0 - 23
src/main/java/com/caimei/modules/coupon/dao/CmCouponClubDao.java

@@ -1,23 +0,0 @@
-package com.caimei.modules.coupon.dao;
-
-import com.caimei.modules.user.entity.NewCmClub;
-import com.thinkgem.jeesite.common.persistence.CrudDao;
-import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
-import com.caimei.modules.coupon.entity.CmCouponClub;
-
-import java.util.List;
-
-/**
- * 采美优惠券活动签约会所DAO接口
- * @author lwt
- * @version 2018-09-29
- */
-@MyBatisDao
-public interface CmCouponClubDao extends CrudDao<CmCouponClub> {
-
-    void deleteCmCouponClub(CmCouponClub cmCouponClub);
-
-    List<Integer> getAllClubID();
-
-    List<NewCmClub> getClubList(NewCmClub cmClub);
-}

+ 26 - 10
src/main/java/com/caimei/modules/coupon/dao/CmCouponDao.java

@@ -1,27 +1,43 @@
 package com.caimei.modules.coupon.dao;
 
+import com.caimei.modules.coupon.entity.CmCoupon;
+import com.caimei.modules.coupon.entity.CmCouponAssociate;
+import com.caimei.modules.coupon.entity.CmCouponClub;
+import com.caimei.modules.user.entity.CmUser;
+import com.caimei.modules.user.entity.NewCmShop;
 import com.thinkgem.jeesite.common.persistence.CrudDao;
 import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
-import com.caimei.modules.coupon.entity.CmCoupon;
-import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
 /**
- * 采美优惠券表(优惠券基本信息来自华熙提供)DAO接口
- * @author lwt
- * @version 2018-09-30
+ * 优惠券管理DAO接口
+ *
+ * @author plf
+ * @version 2021-08-02
  */
 @MyBatisDao
 public interface CmCouponDao extends CrudDao<CmCoupon> {
 
-    List<CmCoupon> statisticsCoupon();
+    List<CmCouponAssociate> findByProductType(String couponId);
+
+    void insertCouponAssociate(CmCouponAssociate associate);
+
+    List<Integer> findByCouponId(String couponId);
+
+    void updateCouponAssociate(CmCouponAssociate a);
+
+    void logicDeleteCouponAssociate(Integer id);
+
+    void updateByDelFlag(String couponId);
+
+    void updateAssociateByDelFlag(String couponId);
 
-    List<CmCoupon> findByCouponCode(@Param("couponCode") String couponCode);
+    CmCouponClub findCouponClub(String couponId);
 
-    List<CmCoupon> getSendCoupon (CmCoupon cmCoupon);
+    List<CmUser> findUserList(CmUser cmUser);
 
-    List<CmCoupon> findCouponList(CmCoupon cmCoupon);
+    List<NewCmShop> findShopList(NewCmShop newCmShop);
 
-    void updateStatus(CmCoupon cmCoupon);
+    List<NewCmShop> findCouponShop(String couponId);
 }

+ 0 - 18
src/main/java/com/caimei/modules/coupon/dao/CmCouponOrderRecordDao.java

@@ -1,18 +0,0 @@
-package com.caimei.modules.coupon.dao;
-
-import com.thinkgem.jeesite.common.persistence.CrudDao;
-import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
-import com.caimei.modules.coupon.entity.CmCouponOrderRecord;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-/**
- * 采美优惠券订单DAO接口
- * @author Lijun
- * @version 2018-10-10
- */
-@MyBatisDao
-public interface CmCouponOrderRecordDao extends CrudDao<CmCouponOrderRecord> {
-    List<CmCouponOrderRecord> findListBuyAgain(@Param("customerMobile") String customerMobile);
-}

+ 0 - 15
src/main/java/com/caimei/modules/coupon/dao/CmCouponRecordDao.java

@@ -1,15 +0,0 @@
-package com.caimei.modules.coupon.dao;
-
-import com.thinkgem.jeesite.common.persistence.CrudDao;
-import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
-import com.caimei.modules.coupon.entity.CmCouponRecord;
-
-/**
- * 采美优惠券使用记录表DAO接口
- * @author lwt
- * @version 2018-09-29
- */
-@MyBatisDao
-public interface CmCouponRecordDao extends CrudDao<CmCouponRecord> {
-
-}

+ 0 - 19
src/main/java/com/caimei/modules/coupon/dao/CmCouponRecordScanDao.java

@@ -1,19 +0,0 @@
-package com.caimei.modules.coupon.dao;
-
-import com.thinkgem.jeesite.common.persistence.CrudDao;
-import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
-import com.caimei.modules.coupon.entity.CmCouponRecordScan;
-import org.apache.ibatis.annotations.Param;
-
-/**
- * 扫码推送优惠券DAO接口
- * @author LiJun
- * @version 2018-11-22
- */
-@MyBatisDao
-public interface CmCouponRecordScanDao extends CrudDao<CmCouponRecordScan> {
-    void updateEnabledStatus(@Param("enabledStatus") String enabledStatus);
-
-    CmCouponRecordScan getEnabledStatus();
-
-}

+ 223 - 197
src/main/java/com/caimei/modules/coupon/entity/CmCoupon.java

@@ -1,207 +1,233 @@
 package com.caimei.modules.coupon.entity;
 
+import com.caimei.modules.user.entity.NewCmShop;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.thinkgem.jeesite.common.persistence.DataEntity;
 import org.hibernate.validator.constraints.Length;
 
-import java.beans.Transient;
 import java.util.Date;
-import com.fasterxml.jackson.annotation.JsonFormat;
-
-import com.thinkgem.jeesite.common.persistence.DataEntity;
+import java.util.List;
 
 /**
- * 采美优惠券表(优惠券基本信息来自华熙提供)Entity
- * @author lwt
- * @version 2018-09-30
+ * 优惠券管理Entity
+ *
+ * @author plf
+ * @version 2021-08-02
  */
 public class CmCoupon extends DataEntity<CmCoupon> {
-	
-	private static final long serialVersionUID = 1L;
-	private String couponCode;		// 优惠券码
-	private String couponAmount;		// 优惠券金额(面值)
-	private String discount;		//优惠券折扣率
-	private Date useStartDate;		// 使用开始时间(有效期)
-	private Date useEndDate;		// 使用结束时间(有效期)
-	private String status;		// 0未派发(可分发给会所) 1已发放 2已分享 3已使用
-	private String couponType;		// 劵类型 0满减劵 1折扣劵
-	private String threshold;		// 使用门槛(满多少使用等)
-	private String useDescription;		// 使用说明(通用还是指定商品可用)
-	private String couponlimit;//优惠券限制(每个用户限制兑换次数)
-
-	//  --------   虚拟字段   -----------------
-	private Integer lastAmount;                  //剩余数量
-	private Integer shareAmount;                  //已分享数量
-	private Integer usedAmount;                  //已使用数量
-	private Integer timeOutAmount;                  //已过期数量
-	private Integer laveNum;                  //统计分类剩余数量
-	private Integer unReceiveNum;				//未领取数量(目前仅适用于公众号扫码输入手机号码领取)
-	private Integer num;//优惠卷数量
-	private Integer userID;//用户ID
-
-	public String getCouponlimit() {
-		return couponlimit;
-	}
-
-	public void setCouponlimit(String couponlimit) {
-		this.couponlimit = couponlimit;
-	}
-
-	public Integer getUserID() {
-		return userID;
-	}
-
-	public void setUserID(Integer userID) {
-		this.userID = userID;
-	}
-
-	public Integer getUnReceiveNum() {
-		return unReceiveNum;
-	}
-
-	public void setUnReceiveNum(Integer unReceiveNum) {
-		this.unReceiveNum = unReceiveNum;
-	}
-
-	public CmCoupon() {
-		super();
-	}
-
-	public CmCoupon(String id){
-		super(id);
-	}
-
-	public Integer getLaveNum() {
-		return laveNum;
-	}
-
-	public void setLaveNum(Integer laveNum) {
-		this.laveNum = laveNum;
-	}
-
-	@Length(min=0, max=64, message="优惠券码长度必须介于 0 和 64 之间")
-	public String getCouponCode() {
-		return couponCode;
-	}
-
-	public void setCouponCode(String couponCode) {
-		this.couponCode = couponCode;
-	}
-	
-	public String getCouponAmount() {
-		return couponAmount;
-	}
-
-	public void setCouponAmount(String couponAmount) {
-		this.couponAmount = couponAmount;
-	}
-	
-	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-	public Date getUseStartDate() {
-		return useStartDate;
-	}
-
-	public void setUseStartDate(Date useStartDate) {
-		this.useStartDate = useStartDate;
-	}
-	
-	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-	public Date getUseEndDate() {
-		return useEndDate;
-	}
-
-	public void setUseEndDate(Date useEndDate) {
-		this.useEndDate = useEndDate;
-	}
-	
-	@Length(min=0, max=10, message="状态 0未派发(可分发给会所) 1已发放未领取 2已领取 3已使用长度必须介于 0 和 10 之间")
-	public String getStatus() {
-		return status;
-	}
-
-	public void setStatus(String status) {
-		this.status = status;
-	}
-	
-	@Length(min=0, max=11, message="劵类型 0满减劵 1折扣劵长度必须介于 0 和 11 之间")
-	public String getCouponType() {
-		return couponType;
-	}
-
-	public void setCouponType(String couponType) {
-		this.couponType = couponType;
-	}
-	
-	@Length(min=0, max=255, message="使用门槛(满多少使用等)长度必须介于 0 和 255 之间")
-	public String getThreshold() {
-		return threshold;
-	}
-
-	public void setThreshold(String threshold) {
-		this.threshold = threshold;
-	}
-	
-	@Length(min=0, max=255, message="使用说明(通用还是指定商品可用)长度必须介于 0 和 255 之间")
-	public String getUseDescription() {
-		return useDescription;
-	}
-
-	public void setUseDescription(String useDescription) {
-		this.useDescription = useDescription;
-	}
-
-
-	public static long getSerialVersionUID() {
-		return serialVersionUID;
-	}
-
-	@Transient
-	public Integer getLastAmount() {
-		return lastAmount;
-	}
-
-	public void setLastAmount(Integer lastAmount) {
-		this.lastAmount = lastAmount;
-	}
-
-	@Transient
-	public Integer getShareAmount() {
-		return shareAmount;
-	}
-
-	public void setShareAmount(Integer shareAmount) {
-		this.shareAmount = shareAmount;
-	}
-
-	@Transient
-	public Integer getUsedAmount() {
-		return usedAmount;
-	}
-
-	public void setUsedAmount(Integer usedAmount) {
-		this.usedAmount = usedAmount;
-	}
-	@Transient
-	public Integer getTimeOutAmount() {
-		return timeOutAmount;
-	}
-
-	public void setTimeOutAmount(Integer timeOutAmount) {
-		this.timeOutAmount = timeOutAmount;
-	}
-
-	@Transient
-	public Integer getNum() {
-		return num;
-	}
-
-	public void setNum(Integer num) {
-		this.num = num;
-	}
-
-	public String getDiscount() {
-		return discount;
-	}
-
-	public void setDiscount(String discount) {
-		this.discount = discount;
-	}
+
+    private static final long serialVersionUID = 1L;
+    private String name;        // 活动主题
+    private String couponAmount;        // 优惠券金额(面值)
+    private String touchPrice;        // 优惠满减条件金额
+    private Date startDate;        // 使用开始时间(有效期)
+    private Date endDate;        // 使用结束时间(有效期)
+    private String status;        // 状态 0未生效 1已生效 2已关闭
+    private Integer couponType;        // 劵类型 0活动券 1品类券 2用户专享券 3店铺券 4新用户券
+    private Integer userId;     //机构用户id(用户专享券有效)
+    private String productType;        // 优惠商品:1全商城商品 2指定商品(活动券有效)
+    private String pcBanner;        //网站活动页banner
+    private String appletsBanner;       //小程序活动页banner
+    private String categoryType;        // 优惠品类:1产品 2仪器(品类券有效)
+    private String couponsMode;        // 领券方式:0正常 1使用兑换码
+    private String productInfo;        //商品json数据
+    private String clubName;           //机构名称
+    private String claimStatus;         //领取状态:1未领取 2已领取
+    private String useStatus;       //使用状态 1未使用 2已使用
+    private String source;      //领取渠道:1小程序 2网站 3订单退回
+    private String shopInfo;     //供应商ids
+    private String shopName;        //供应商名称
+    private CmCouponClub couponClub;
+    private List<NewCmShop> shopList;
+
+    public CmCoupon() {
+        super();
+    }
+
+    public CmCoupon(String id) {
+        super(id);
+    }
+
+    @Length(min = 0, max = 50, message = "活动主题长度必须介于 0 和 50 之间")
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getCouponAmount() {
+        return couponAmount;
+    }
+
+    public void setCouponAmount(String couponAmount) {
+        this.couponAmount = couponAmount;
+    }
+
+    public String getTouchPrice() {
+        return touchPrice;
+    }
+
+    public void setTouchPrice(String touchPrice) {
+        this.touchPrice = touchPrice;
+    }
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    public Date getStartDate() {
+        return startDate;
+    }
+
+    public void setStartDate(Date startDate) {
+        this.startDate = startDate;
+    }
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    public Date getEndDate() {
+        return endDate;
+    }
+
+    public void setEndDate(Date endDate) {
+        this.endDate = endDate;
+    }
+
+    @Length(min = 0, max = 2, message = "状态 0未生效 1已生效 2已关闭长度必须介于 0 和 2 之间")
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    public Integer getCouponType() {
+        return couponType;
+    }
+
+    public void setCouponType(Integer couponType) {
+        this.couponType = couponType;
+    }
+
+    @Length(min = 0, max = 2, message = "优惠商品:1全商城商品 2指定商品(活动券有效)长度必须介于 0 和 2 之间")
+    public String getProductType() {
+        return productType;
+    }
+
+    public void setProductType(String productType) {
+        this.productType = productType;
+    }
+
+    public String getPcBanner() {
+        return pcBanner;
+    }
+
+    public void setPcBanner(String pcBanner) {
+        this.pcBanner = pcBanner;
+    }
+
+    public String getAppletsBanner() {
+        return appletsBanner;
+    }
+
+    public void setAppletsBanner(String appletsBanner) {
+        this.appletsBanner = appletsBanner;
+    }
+
+    @Length(min = 0, max = 2, message = "优惠品类:1产品 2仪器(品类券有效)长度必须介于 0 和 2 之间")
+    public String getCategoryType() {
+        return categoryType;
+    }
+
+    public void setCategoryType(String categoryType) {
+        this.categoryType = categoryType;
+    }
+
+    @Length(min = 0, max = 2, message = "领券方式:0正常 1使用兑换码长度必须介于 0 和 2 之间")
+    public String getCouponsMode() {
+        return couponsMode;
+    }
+
+    public void setCouponsMode(String couponsMode) {
+        this.couponsMode = couponsMode;
+    }
+
+    public String getProductInfo() {
+        return productInfo;
+    }
+
+    public void setProductInfo(String productInfo) {
+        this.productInfo = productInfo;
+    }
+
+    public String getClubName() {
+        return clubName;
+    }
+
+    public void setClubName(String clubName) {
+        this.clubName = clubName;
+    }
+
+    public String getClaimStatus() {
+        return claimStatus;
+    }
+
+    public void setClaimStatus(String claimStatus) {
+        this.claimStatus = claimStatus;
+    }
+
+    public String getUseStatus() {
+        return useStatus;
+    }
+
+    public void setUseStatus(String useStatus) {
+        this.useStatus = useStatus;
+    }
+
+    public String getSource() {
+        return source;
+    }
+
+    public void setSource(String source) {
+        this.source = source;
+    }
+
+    public CmCouponClub getCouponClub() {
+        return couponClub;
+    }
+
+    public void setCouponClub(CmCouponClub couponClub) {
+        this.couponClub = couponClub;
+    }
+
+    public Integer getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Integer userId) {
+        this.userId = userId;
+    }
+
+    public String getShopInfo() {
+        return shopInfo;
+    }
+
+    public void setShopInfo(String shopInfo) {
+        this.shopInfo = shopInfo;
+    }
+
+    public List<NewCmShop> getShopList() {
+        return shopList;
+    }
+
+    public void setShopList(List<NewCmShop> shopList) {
+        this.shopList = shopList;
+    }
+
+    public String getShopName() {
+        return shopName;
+    }
+
+    public void setShopName(String shopName) {
+        this.shopName = shopName;
+    }
 }

+ 121 - 0
src/main/java/com/caimei/modules/coupon/entity/CmCouponAssociate.java

@@ -0,0 +1,121 @@
+package com.caimei.modules.coupon.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * Description
+ *
+ * @author : plf
+ * @date : 2021/8/4
+ */
+public class CmCouponAssociate implements Serializable {
+    private Integer id;
+    private Integer couponId;       //优惠券id
+    private Integer productId;      //商品id(对应活动券)
+    private String pcStatus;        //pc状态 0停用 1启用
+    private String appletsStatus;       //小程序状态 0停用 1启用
+    private Integer shopId;     //供应商id(对应店铺券)
+    private Integer sort;       //排序值
+    private Date addTime;       //添加时间
+    private String delFlag;     //删除标记 0否 其余是
+    private String productName;     //商品名称
+    private String image;       //商品图片
+    private String shopName;        //供应商名称
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getCouponId() {
+        return couponId;
+    }
+
+    public void setCouponId(Integer couponId) {
+        this.couponId = couponId;
+    }
+
+    public Integer getProductId() {
+        return productId;
+    }
+
+    public void setProductId(Integer productId) {
+        this.productId = productId;
+    }
+
+    public String getPcStatus() {
+        return pcStatus;
+    }
+
+    public void setPcStatus(String pcStatus) {
+        this.pcStatus = pcStatus;
+    }
+
+    public String getAppletsStatus() {
+        return appletsStatus;
+    }
+
+    public void setAppletsStatus(String appletsStatus) {
+        this.appletsStatus = appletsStatus;
+    }
+
+    public Integer getShopId() {
+        return shopId;
+    }
+
+    public void setShopId(Integer shopId) {
+        this.shopId = shopId;
+    }
+
+    public Integer getSort() {
+        return sort;
+    }
+
+    public void setSort(Integer sort) {
+        this.sort = sort;
+    }
+
+    public Date getAddTime() {
+        return addTime;
+    }
+
+    public void setAddTime(Date addTime) {
+        this.addTime = addTime;
+    }
+
+    public String getDelFlag() {
+        return delFlag;
+    }
+
+    public void setDelFlag(String delFlag) {
+        this.delFlag = delFlag;
+    }
+
+    public String getProductName() {
+        return productName;
+    }
+
+    public void setProductName(String productName) {
+        this.productName = productName;
+    }
+
+    public String getImage() {
+        return image;
+    }
+
+    public void setImage(String image) {
+        this.image = image;
+    }
+
+    public String getShopName() {
+        return shopName;
+    }
+
+    public void setShopName(String shopName) {
+        this.shopName = shopName;
+    }
+}

+ 79 - 115
src/main/java/com/caimei/modules/coupon/entity/CmCouponClub.java

@@ -1,121 +1,85 @@
 package com.caimei.modules.coupon.entity;
 
-import org.hibernate.validator.constraints.Length;
+import java.io.Serializable;
 import java.util.Date;
-import com.fasterxml.jackson.annotation.JsonFormat;
-
-import com.thinkgem.jeesite.common.persistence.DataEntity;
 
 /**
- * 采美优惠券活动签约会所Entity
- * @author lwt
- * @version 2018-09-29
+ * Description
+ *
+ * @author : plf
+ * @date : 2021/8/5
  */
-public class CmCouponClub extends DataEntity<CmCouponClub> {
-	
-	private static final long serialVersionUID = 1L;
-	private Long clubId;		// 会所ID
-	private Integer userID;		//用户ID
-	private String name;		// 会所名称
-	private String sname;		// 会所简称
-	private String linkMan;		// 联系人
-	private String contractMobile;		// 联系手机
-	private Date signDate;		// 签约时间
-	private String status;		// 签约状态 1已签约 2未签约
-	private String startTime;     //注册时间开始 查询条件
-	private String endTime;		//注册时间结束  查询条件
-	
-	public CmCouponClub() {
-		super();
-	}
-
-	public CmCouponClub(String id){
-		super(id);
-	}
-
-	public Integer getUserID() {
-		return userID;
-	}
-
-	public void setUserID(Integer userID) {
-		this.userID = userID;
-	}
-
-	public Long getClubId() {
-		return clubId;
-	}
-
-	public void setClubId(Long clubId) {
-		this.clubId = clubId;
-	}
-	
-	@Length(min=0, max=20, message="会所名称长度必须介于 0 和 20 之间")
-	public String getName() {
-		return name;
-	}
-
-	public void setName(String name) {
-		this.name = name;
-	}
-	
-	@Length(min=0, max=20, message="会所简称长度必须介于 0 和 20 之间")
-	public String getSname() {
-		return sname;
-	}
-
-	public void setSname(String sname) {
-		this.sname = sname;
-	}
-	
-	@Length(min=0, max=50, message="联系人长度必须介于 0 和 50 之间")
-	public String getLinkMan() {
-		return linkMan;
-	}
-
-	public void setLinkMan(String linkMan) {
-		this.linkMan = linkMan;
-	}
-	
-	@Length(min=0, max=20, message="联系手机长度必须介于 0 和 20 之间")
-	public String getContractMobile() {
-		return contractMobile;
-	}
-
-	public void setContractMobile(String contractMobile) {
-		this.contractMobile = contractMobile;
-	}
-	
-	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-	public Date getSignDate() {
-		return signDate;
-	}
-
-	public void setSignDate(Date signDate) {
-		this.signDate = signDate;
-	}
-	
-	@Length(min=0, max=10, message="签约状态 1已签约 2未签约长度必须介于 0 和 10 之间")
-	public String getStatus() {
-		return status;
-	}
-
-	public void setStatus(String status) {
-		this.status = status;
-	}
-
-	public String getStartTime() {
-		return startTime;
-	}
-
-	public void setStartTime(String startTime) {
-		this.startTime = startTime;
-	}
-
-	public String getEndTime() {
-		return endTime;
-	}
-
-	public void setEndTime(String endTime) {
-		this.endTime = endTime;
-	}
-}
+public class CmCouponClub implements Serializable {
+    private Integer id;
+    private Integer userId;     //机构用户Id
+    private Integer couponId;           //优惠券id
+    private String source;          //领取渠道:1小程序 2网站 3订单退回
+    private String status;         //使用状态 1未使用 2已使用
+    private Date createDate;        //领取时间
+    private Date useDate;           //使用时间
+    private String delFlag;     //删除标记 0否 其余是
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Integer userId) {
+        this.userId = userId;
+    }
+
+    public Integer getCouponId() {
+        return couponId;
+    }
+
+    public void setCouponId(Integer couponId) {
+        this.couponId = couponId;
+    }
+
+    public String getSource() {
+        return source;
+    }
+
+    public void setSource(String source) {
+        this.source = source;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    public Date getCreateDate() {
+        return createDate;
+    }
+
+    public void setCreateDate(Date createDate) {
+        this.createDate = createDate;
+    }
+
+    public Date getUseDate() {
+        return useDate;
+    }
+
+    public void setUseDate(Date useDate) {
+        this.useDate = useDate;
+    }
+
+    public String getDelFlag() {
+        return delFlag;
+    }
+
+    public void setDelFlag(String delFlag) {
+        this.delFlag = delFlag;
+    }
+}

+ 0 - 227
src/main/java/com/caimei/modules/coupon/entity/CmCouponOrderRecord.java

@@ -1,227 +0,0 @@
-package com.caimei.modules.coupon.entity;
-
-import org.hibernate.validator.constraints.Length;
-import java.util.Date;
-import com.fasterxml.jackson.annotation.JsonFormat;
-
-import com.thinkgem.jeesite.common.persistence.DataEntity;
-
-/**
- * 采美优惠券订单Entity
- * @author Lijun
- * @version 2018-10-10
- */
-public class CmCouponOrderRecord extends DataEntity<CmCouponOrderRecord> {
-	
-	private static final long serialVersionUID = 1L;
-	private String orderCode;		// 订单编号
-	private Double totalAmount;		// 订单金额(实付金额)
-	private Double refundAmount;		// 退款金额
-	private Date paymentTime;		// 订单支付时间
-	private Date refundTime;		// 订单退款时间
-	private String couponCode;		// 优惠券码
-	private Double discountAmount;		// 优惠金额
-	private String status;		// 订单状态 1等待付款、2付款成功、3已发货、4已收货、5退款中、6退款成功、7交易完成、8交易关闭--华熙提供的只有6和2
-	private String customerCode;//客户code
-	private String customerName;		// 客户名称
-	private String customerMobile;		// 客户手机号
-	private String refundFlag;		// 是否退款单:0正常单NO、1退款单YES
-	private Date createTime;		// 创建时间
-	private Date updateTime;		// 更新时间
-
-	private String clubName;//会所名字
-	private String companyName;//企业名字
-	private String couponMobile;//领劵人手机号(适用于扫码领优惠券)
-	private String rebateName;//返利人名字,谁分享的就是谁的名字
-	private String startTime;     //时间开始 查询条件
-	private String endTime;		//时间结束  查询条件
-	private String searchflag;//0搜索,1导出
-
-
-	public String getCompanyName() {
-		return companyName;
-	}
-
-	public void setCompanyName(String companyName) {
-		this.companyName = companyName;
-	}
-
-	public String getRebateName() {
-		return rebateName;
-	}
-
-	public void setRebateName(String rebateName) {
-		this.rebateName = rebateName;
-	}
-
-	public String getCouponMobile() {
-		return couponMobile;
-	}
-
-	public void setCouponMobile(String couponMobile) {
-		this.couponMobile = couponMobile;
-	}
-
-	public String getSearchflag() {
-		return searchflag;
-	}
-
-	public void setSearchflag(String searchflag) {
-		this.searchflag = searchflag;
-	}
-
-	public String getStartTime() {
-		return startTime;
-	}
-
-	public void setStartTime(String startTime) {
-		this.startTime = startTime;
-	}
-
-	public String getEndTime() {
-		return endTime;
-	}
-
-	public void setEndTime(String endTime) {
-		this.endTime = endTime;
-	}
-
-	public String getClubName() {
-		return clubName;
-	}
-
-	public void setClubName(String clubName) {
-		this.clubName = clubName;
-	}
-
-	public CmCouponOrderRecord() {
-		super();
-	}
-
-	public CmCouponOrderRecord(String id){
-		super(id);
-	}
-
-	public String getCustomerCode() {
-		return customerCode;
-	}
-
-	public void setCustomerCode(String customerCode) {
-		this.customerCode = customerCode;
-	}
-
-	@Length(min=0, max=64, message="订单编号长度必须介于 0 和 64 之间")
-	public String getOrderCode() {
-		return orderCode;
-	}
-
-	public void setOrderCode(String orderCode) {
-		this.orderCode = orderCode;
-	}
-	
-	public Double getTotalAmount() {
-		return totalAmount;
-	}
-
-	public void setTotalAmount(Double totalAmount) {
-		this.totalAmount = totalAmount;
-	}
-	
-	public Double getRefundAmount() {
-		return refundAmount;
-	}
-
-	public void setRefundAmount(Double refundAmount) {
-		this.refundAmount = refundAmount;
-	}
-	
-	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-	public Date getPaymentTime() {
-		return paymentTime;
-	}
-
-	public void setPaymentTime(Date paymentTime) {
-		this.paymentTime = paymentTime;
-	}
-	
-	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-	public Date getRefundTime() {
-		return refundTime;
-	}
-
-	public void setRefundTime(Date refundTime) {
-		this.refundTime = refundTime;
-	}
-	
-	@Length(min=0, max=64, message="优惠券码长度必须介于 0 和 64 之间")
-	public String getCouponCode() {
-		return couponCode;
-	}
-
-	public void setCouponCode(String couponCode) {
-		this.couponCode = couponCode;
-	}
-	
-	public Double getDiscountAmount() {
-		return discountAmount;
-	}
-
-	public void setDiscountAmount(Double discountAmount) {
-		this.discountAmount = discountAmount;
-	}
-	
-	@Length(min=0, max=10, message="订单状态 1等待付款、2付款成功、3已发货、4已收货、5退款中、6退款成功、7交易完成、8交易关闭长度必须介于 0 和 10 之间")
-	public String getStatus() {
-		return status;
-	}
-
-	public void setStatus(String status) {
-		this.status = status;
-	}
-	
-	@Length(min=0, max=50, message="客户名称长度必须介于 0 和 50 之间")
-	public String getCustomerName() {
-		return customerName;
-	}
-
-	public void setCustomerName(String customerName) {
-		this.customerName = customerName;
-	}
-	
-	@Length(min=0, max=20, message="客户手机号长度必须介于 0 和 20 之间")
-	public String getCustomerMobile() {
-		return customerMobile;
-	}
-
-	public void setCustomerMobile(String customerMobile) {
-		this.customerMobile = customerMobile;
-	}
-	
-	@Length(min=0, max=255, message="是否退款单:0正常单NO、1退款单YES长度必须介于 0 和 255 之间")
-	public String getRefundFlag() {
-		return refundFlag;
-	}
-
-	public void setRefundFlag(String refundFlag) {
-		this.refundFlag = refundFlag;
-	}
-	
-	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-	public Date getCreateTime() {
-		return createTime;
-	}
-
-	public void setCreateTime(Date createTime) {
-		this.createTime = createTime;
-	}
-	
-	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-	public Date getUpdateTime() {
-		return updateTime;
-	}
-
-	public void setUpdateTime(Date updateTime) {
-		this.updateTime = updateTime;
-	}
-	
-}

+ 0 - 199
src/main/java/com/caimei/modules/coupon/entity/CmCouponRecord.java

@@ -1,199 +0,0 @@
-package com.caimei.modules.coupon.entity;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.thinkgem.jeesite.common.persistence.DataEntity;
-import org.hibernate.validator.constraints.Length;
-import java.util.Date;
-
-/**
- * 采美优惠券使用记录表Entity
- * @author lwt
- * @version 2018-09-29
- */
-public class CmCouponRecord extends DataEntity<CmCouponRecord> {
-	
-	private static final long serialVersionUID = 1L;
-	private String couponCode;		// 优惠券码
-	private String couponAmount;		// 优惠券金额
-	private Date useStartDate;		// 使用开始时间(有效期)
-	private Date useEndDate;		// 使用结束时间(有效期)
-	private String status;		// 状态 1已发放 2已分享 3已使用 【第一版扫码获劵的2是已领取】
-	private String couponType;		// 劵类型 0满减劵 1折扣劵
-	private String threshold;		// 使用门槛(满多少使用等)
-	private String useDescription;		// 使用说明(通用还是指定商品可用)
-	private String relatedOrderCode;		// 在华熙下单的订单ID
-	private Integer userId;//ID系统发放接受卷的用户ID
-	private Integer sharerUserId;//分享者用户ID(可能是接受卷的用户,也可能是其子用户)
-	private String openid;//分享者的openid
-	private String companyName;		// 企业会所名称
-	private String staffName;		// 会所员工姓名(分享劵的人,如果是企业自己分享这里直接是企业名字)
-	private Date receiveDate;		// 领取时间
-	private Date useDate;		// 使用时间
-
-	private String couponOrderCode;//优惠券订单编号
-	private String clubName;//会所名字(优惠券的接收者)
-
-	public String getClubName() {
-		return clubName;
-	}
-
-	public void setClubName(String clubName) {
-		this.clubName = clubName;
-	}
-
-	public String getCouponOrderCode() {
-		return couponOrderCode;
-	}
-
-	public void setCouponOrderCode(String couponOrderCode) {
-		this.couponOrderCode = couponOrderCode;
-	}
-
-	public CmCouponRecord() {
-		super();
-	}
-
-	public CmCouponRecord(String id){
-		super(id);
-	}
-
-	@Length(min=0, max=64, message="优惠券码长度必须介于 0 和 64 之间")
-	public String getCouponCode() {
-		return couponCode;
-	}
-
-	public void setCouponCode(String couponCode) {
-		this.couponCode = couponCode;
-	}
-	
-	public String getCouponAmount() {
-		return couponAmount;
-	}
-
-	public void setCouponAmount(String couponAmount) {
-		this.couponAmount = couponAmount;
-	}
-	
-	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-	public Date getUseStartDate() {
-		return useStartDate;
-	}
-
-	public void setUseStartDate(Date useStartDate) {
-		this.useStartDate = useStartDate;
-	}
-	
-	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-	public Date getUseEndDate() {
-		return useEndDate;
-	}
-
-	public void setUseEndDate(Date useEndDate) {
-		this.useEndDate = useEndDate;
-	}
-	
-	@Length(min=0, max=10, message="状态 1已发放未领取 2已领取 3已使用长度必须介于 0 和 10 之间")
-	public String getStatus() {
-		return status;
-	}
-
-	public void setStatus(String status) {
-		this.status = status;
-	}
-	
-	@Length(min=0, max=11, message="劵类型 0满减劵 1折扣劵长度必须介于 0 和 11 之间")
-	public String getCouponType() {
-		return couponType;
-	}
-
-	public void setCouponType(String couponType) {
-		this.couponType = couponType;
-	}
-	
-	@Length(min=0, max=255, message="使用门槛(满多少使用等)长度必须介于 0 和 255 之间")
-	public String getThreshold() {
-		return threshold;
-	}
-
-	public void setThreshold(String threshold) {
-		this.threshold = threshold;
-	}
-	
-	@Length(min=0, max=255, message="使用说明(通用还是指定商品可用)长度必须介于 0 和 255 之间")
-	public String getUseDescription() {
-		return useDescription;
-	}
-
-	public void setUseDescription(String useDescription) {
-		this.useDescription = useDescription;
-	}
-
-	public String getRelatedOrderCode() {
-		return relatedOrderCode;
-	}
-
-	public void setRelatedOrderCode(String relatedOrderCode) {
-		this.relatedOrderCode = relatedOrderCode;
-	}
-
-	@Length(min=0, max=20, message="企业会所名称长度必须介于 0 和 20 之间")
-	public String getCompanyName() {
-		return companyName;
-	}
-
-	public void setCompanyName(String companyName) {
-		this.companyName = companyName;
-	}
-
-	public Integer getUserId() {
-		return userId;
-	}
-
-	public void setUserId(Integer userId) {
-		this.userId = userId;
-	}
-
-	public Integer getSharerUserId() {
-		return sharerUserId;
-	}
-
-	public void setSharerUserId(Integer sharerUserId) {
-		this.sharerUserId = sharerUserId;
-	}
-
-	public String getOpenid() {
-		return openid;
-	}
-
-	public void setOpenid(String openid) {
-		this.openid = openid;
-	}
-
-	@Length(min=0, max=20, message="会所员工姓名(分享劵的人,如果是企业自己分享这里直接是企业名字)长度必须介于 0 和 20 之间")
-	public String getStaffName() {
-		return staffName;
-	}
-
-	public void setStaffName(String staffName) {
-		this.staffName = staffName;
-	}
-	
-	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-	public Date getReceiveDate() {
-		return receiveDate;
-	}
-
-	public void setReceiveDate(Date receiveDate) {
-		this.receiveDate = receiveDate;
-	}
-	
-	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-	public Date getUseDate() {
-		return useDate;
-	}
-
-	public void setUseDate(Date useDate) {
-		this.useDate = useDate;
-	}
-	
-}

+ 0 - 188
src/main/java/com/caimei/modules/coupon/entity/CmCouponRecordScan.java

@@ -1,188 +0,0 @@
-package com.caimei.modules.coupon.entity;
-
-import java.util.Date;
-import com.thinkgem.jeesite.common.persistence.DataEntity;
-
-/**
- * 扫码推送优惠券Entity
- * @author LiJun
- * @version 2018-11-22
- */
-public class CmCouponRecordScan extends DataEntity<CmCouponRecordScan> {
-	
-	private static final long serialVersionUID = 1L;
-	private String couponCode;		// 优惠券码
-	private String couponAmount;		// 优惠券金额
-	private String discount;		// 优惠券折扣85,示例8.5
-	private Date useStartDate;		// 使用开始时间(有效期)
-	private Date useEndDate;		// 使用结束时间(有效期)
-	private String status;		// 状态 1未领取(已推送) 2已领取(输入手机号) 3已分享(可多次分享 ) 4已使用
-	private String couponType;		// 劵类型 0满减劵 1折扣劵
-	private String threshold;		// 使用门槛(满多少使用等)
-	private String useDescription;		// 使用说明(通用还是指定商品可用)
-	private String relatedOrderCode;		// 在华熙下单的订单ID
-	private Long sharerUserId;		// 分享者用户ID(采美公众号推送用户,可能只有openid不存在用户ID)
-	private String openid;		// 保存分享着的openid(采美公众号推送用户,新关注用户只能通过这个唯一确认)
-	private String mobile;		// 领劵人手机号码(分享者)
-	private Date receiveDate;		// 已分享时间
-	private Date useDate;		// 使用时间
-	private String syncFlag;		// 同步给华熙异常存档标记 0未同步 1已同步
-	private String enabledStatus;//开关状态:0:启动,1:关闭
-
-	private String couponOrderCode;//优惠券订单编号
-
-	@Override
-	public String getEnabledStatus() {
-		return enabledStatus;
-	}
-
-	@Override
-	public void setEnabledStatus(String enabledStatus) {
-		this.enabledStatus = enabledStatus;
-	}
-
-	public CmCouponRecordScan() {
-		super();
-	}
-
-	public CmCouponRecordScan(String id){
-		super(id);
-	}
-
-	public String getCouponCode() {
-		return couponCode;
-	}
-
-	public void setCouponCode(String couponCode) {
-		this.couponCode = couponCode;
-	}
-
-	public String getCouponAmount() {
-		return couponAmount;
-	}
-
-	public void setCouponAmount(String couponAmount) {
-		this.couponAmount = couponAmount;
-	}
-
-	public String getDiscount() {
-		return discount;
-	}
-
-	public void setDiscount(String discount) {
-		this.discount = discount;
-	}
-
-	public Date getUseStartDate() {
-		return useStartDate;
-	}
-
-	public void setUseStartDate(Date useStartDate) {
-		this.useStartDate = useStartDate;
-	}
-
-	public Date getUseEndDate() {
-		return useEndDate;
-	}
-
-	public void setUseEndDate(Date useEndDate) {
-		this.useEndDate = useEndDate;
-	}
-
-	public String getStatus() {
-		return status;
-	}
-
-	public void setStatus(String status) {
-		this.status = status;
-	}
-
-	public String getCouponType() {
-		return couponType;
-	}
-
-	public void setCouponType(String couponType) {
-		this.couponType = couponType;
-	}
-
-	public String getThreshold() {
-		return threshold;
-	}
-
-	public void setThreshold(String threshold) {
-		this.threshold = threshold;
-	}
-
-	public String getUseDescription() {
-		return useDescription;
-	}
-
-	public void setUseDescription(String useDescription) {
-		this.useDescription = useDescription;
-	}
-
-	public String getRelatedOrderCode() {
-		return relatedOrderCode;
-	}
-
-	public void setRelatedOrderCode(String relatedOrderCode) {
-		this.relatedOrderCode = relatedOrderCode;
-	}
-
-	public Long getSharerUserId() {
-		return sharerUserId;
-	}
-
-	public void setSharerUserId(Long sharerUserId) {
-		this.sharerUserId = sharerUserId;
-	}
-
-	public String getOpenid() {
-		return openid;
-	}
-
-	public void setOpenid(String openid) {
-		this.openid = openid;
-	}
-
-	public String getMobile() {
-		return mobile;
-	}
-
-	public void setMobile(String mobile) {
-		this.mobile = mobile;
-	}
-
-	public Date getReceiveDate() {
-		return receiveDate;
-	}
-
-	public void setReceiveDate(Date receiveDate) {
-		this.receiveDate = receiveDate;
-	}
-
-	public Date getUseDate() {
-		return useDate;
-	}
-
-	public void setUseDate(Date useDate) {
-		this.useDate = useDate;
-	}
-
-	public String getSyncFlag() {
-		return syncFlag;
-	}
-
-	public void setSyncFlag(String syncFlag) {
-		this.syncFlag = syncFlag;
-	}
-
-	public String getCouponOrderCode() {
-		return couponOrderCode;
-	}
-
-	public void setCouponOrderCode(String couponOrderCode) {
-		this.couponOrderCode = couponOrderCode;
-	}
-
-}

+ 0 - 218
src/main/java/com/caimei/modules/coupon/entity/ReadExcel.java

@@ -1,218 +0,0 @@
-package com.caimei.modules.coupon.entity;
-
-import com.caimei.modules.cibe.entity.CibeShop;
-import org.apache.poi.hssf.usermodel.HSSFCell;
-import org.apache.poi.hssf.usermodel.HSSFWorkbook;
-import org.apache.poi.ss.usermodel.Cell;
-import org.apache.poi.ss.usermodel.Row;
-import org.apache.poi.ss.usermodel.Sheet;
-import org.apache.poi.ss.usermodel.Workbook;
-import org.apache.poi.xssf.usermodel.XSSFWorkbook;
-import org.springframework.web.multipart.MultipartFile;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.math.BigDecimal;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-/**
- * @author zcp
- * @description
- * @date 2018/1/23
- * @time 15:56
- **/
-public class ReadExcel {
-    //总行数
-    private int totalRows = 0;
-    //总条数
-    private int totalCells = 0;
-    //错误信息接收器
-    private String errorMsg;
-    //构造方法
-    public ReadExcel(){}
-    //获取总行数
-    public int getTotalRows()  { return totalRows;}
-    //获取总列数
-    public int getTotalCells() {  return totalCells;}
-    //获取错误信息
-    public String getErrorInfo() { return errorMsg; }
-
-    /**
-     * 读EXCEL文件,获取信息集合
-     * @param mFile
-     * @return
-     */
-    public List<CmCoupon> getExcelInfo(MultipartFile mFile) {
-        String fileName = mFile.getOriginalFilename();//获取文件名
-        List<CmCoupon> cmCoupons = new ArrayList<>();
-        try {
-            if (!validateExcel(fileName)) {// 验证文件名是否合格
-                return null;
-            }
-            boolean isExcel2003 = true;// 根据文件名判断文件是2003版本还是2007版本
-            if (isExcel2007(fileName)) {
-                isExcel2003 = false;
-            }
-            cmCoupons = createExcel(mFile.getInputStream(), isExcel2003);
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        return cmCoupons;
-    }
-
-    /**
-     * 根据excel里面的内容读取客户信息
-     * @param is 输入流
-     * @param isExcel2003 excel是2003还是2007版本
-     * @return
-     * @throws IOException
-     */
-    public List<CmCoupon> createExcel(InputStream is, boolean isExcel2003) throws ParseException {
-        List<CmCoupon> cmCoupons = new ArrayList<>();
-        try{
-            Workbook wb = null;
-            if (isExcel2003) {// 当excel是2003时,创建excel2003
-                wb = new HSSFWorkbook(is);
-            } else {// 当excel是2007时,创建excel2007
-                wb = new XSSFWorkbook(is);
-            }
-            cmCoupons = readExcelValue(wb);// 读取Excel里面客户的信息
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-        return cmCoupons;
-    }
-
-    /**
-     * 读取Excel里面客户的信息
-     * @param wb
-     * @return
-     */
-    private List<CmCoupon> readExcelValue(Workbook wb) throws ParseException {
-        // 得到第一个shell
-        Sheet sheet = wb.getSheetAt(0);
-        // 得到Excel的行数
-        this.totalRows = sheet.getPhysicalNumberOfRows();
-        // 得到Excel的列数(前提是有行数)
-        if (totalRows > 1 && sheet.getRow(0) != null) {
-            this.totalCells = sheet.getRow(0).getPhysicalNumberOfCells();
-        }
-        List<CmCoupon> cmCoupons = new ArrayList<>();
-        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-        // 循环Excel行数
-        for (int r = 1; r < totalRows; r++) {
-            Row row = sheet.getRow(r);
-            if (row == null){
-                continue;
-            }
-            CmCoupon cmCoupon = new CmCoupon();
-            // 循环Excel的列
-            for (int c = 0; c < this.totalCells; c++) {
-                Cell cell = row.getCell(c);
-                if (null != cell) {
-                    String value = getFieldValue(cell);
-                    switch (c){
-                        case 0:
-                            //如果是纯数字,比如你写的是25,cell.getNumericCellValue()获得是25.0,通过截取字符串去掉.0获得25
-                            //如果是科学计数法转化为整数
-                            if(null != value && value.indexOf("E") > 0){
-                                BigDecimal bd = new BigDecimal(value);
-                                value = bd.toPlainString();
-                            }
-                            cmCoupon.setCouponCode(value); //优惠券码
-                            break;
-                        case 1:
-                            //优惠券名称(由于后期新增,本系统也未使用暂不做处理)
-                            break;
-                        case 2:
-                            if ("代金劵".equals(value.trim()) || "代金券".equals(value.trim()))  //劵和券不是同一个字,容易混淆
-                                cmCoupon.setCouponType("0");//劵类型
-                            if ("折扣劵".equals(value.trim()) || "折扣券".equals(value.trim()))
-                                cmCoupon.setCouponType("1");//劵类型
-                            if(!"折扣劵".equals(value.trim()) && !"代金劵".equals(value.trim()))
-                                cmCoupon.setCouponType("0");//默认代金劵
-                            break;
-                        case 3:
-                            if(null != value){
-                                boolean isContains = value.contains("元");
-                                if(isContains){
-                                    value = value.replace("元","");
-                                }
-                            }
-                            cmCoupon.setCouponAmount(value); //满减金额(面值格式50元)
-                            break;
-                        case 4:
-                            cmCoupon.setUseStartDate(sdf.parse(value));//有效起始时间
-                            break;
-                        case 5:
-                            cmCoupon.setUseEndDate(sdf.parse(value));//有效结束时间
-                            break;
-                        case 6:
-                            cmCoupon.setThreshold(value);//使用门槛
-                            break;
-                        case 7:
-                            cmCoupon.setCouponlimit(value);//优惠券限制(每个用户限制兑换次数)每人限领张数
-                            break;
-                        case 8:
-                            cmCoupon.setUseDescription(value);//使用说明
-                            break;
-                        default:
-                            break;
-                    }
-                }
-            }
-            cmCoupon.setDelFlag("0");
-            cmCoupon.setCreateDate(new Date());
-            cmCoupon.setUpdateDate(new Date());
-            cmCoupon.setStatus("0"); //默认未派发
-            // 添加到list
-            cmCoupons.add(cmCoupon);
-        }
-        return cmCoupons;
-    }
-
-    /**
-     * 获取
-     * @param cell
-     * @return
-     */
-    public String getFieldValue(Cell cell){
-        String value = null;
-        if(cell.getCellType() == HSSFCell.CELL_TYPE_NUMERIC){
-//            String str = String.valueOf(cell.getNumericCellValue());
-//            value = str.substring(0, str.length()-2>0?str.length()-2:1);
-            value = String.valueOf(cell.getNumericCellValue());
-        }else {
-            value = cell.getStringCellValue();
-        }
-        return value;
-    }
-
-    /**
-     * 验证EXCEL文件
-     *
-     * @param filePath
-     * @return
-     */
-    public boolean validateExcel(String filePath) {
-        if (filePath == null || !(isExcel2003(filePath) || isExcel2007(filePath))) {
-            errorMsg = "文件名不是excel格式";
-            return false;
-        }
-        return true;
-    }
-
-    // @描述:是否是2003的excel,返回true是2003
-    public static boolean isExcel2003(String filePath)  {
-        return filePath.matches("^.+\\.(?i)(xls)$");
-    }
-
-    //@描述:是否是2007的excel,返回true是2007
-    public static boolean isExcel2007(String filePath)  {
-        return filePath.matches("^.+\\.(?i)(xlsx)$");
-    }
-}

+ 0 - 69
src/main/java/com/caimei/modules/coupon/service/CmCouponClubService.java

@@ -1,69 +0,0 @@
-package com.caimei.modules.coupon.service;
-
-import java.util.List;
-
-import com.caimei.modules.user.entity.NewCmClub;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import com.thinkgem.jeesite.common.persistence.Page;
-import com.thinkgem.jeesite.common.service.CrudService;
-import com.caimei.modules.coupon.entity.CmCouponClub;
-import com.caimei.modules.coupon.dao.CmCouponClubDao;
-
-import javax.annotation.Resource;
-
-/**
- * 采美优惠券活动签约会所Service
- * @author lwt
- * @version 2018-09-29
- */
-@Service
-@Transactional(readOnly = true)
-public class CmCouponClubService extends CrudService<CmCouponClubDao, CmCouponClub> {
-
-	@Resource
-	private CmCouponClubDao cmCouponClubDao;
-
-	public CmCouponClub get(String id) {
-		return super.get(id);
-	}
-	
-	public List<CmCouponClub> findList(CmCouponClub cmCouponClub) {
-		return super.findList(cmCouponClub);
-	}
-	
-	public Page<CmCouponClub> findPage(Page<CmCouponClub> page, CmCouponClub cmCouponClub) {
-		return super.findPage(page, cmCouponClub);
-	}
-	
-	@Transactional(readOnly = false)
-	public void save(CmCouponClub cmCouponClub) {
-		super.save(cmCouponClub);
-	}
-	
-	@Transactional(readOnly = false)
-	public void delete(CmCouponClub cmCouponClub) {
-		super.delete(cmCouponClub);
-	}
-
-	@Transactional(readOnly = false)
-	public void update(CmCouponClub cmCouponClub) {
-		cmCouponClubDao.update(cmCouponClub);
-	}
-
-	@Transactional(readOnly = false)
-	public void deleteCmCouponClub(CmCouponClub cmCouponClub) {
-		cmCouponClubDao.deleteCmCouponClub(cmCouponClub);
-	}
-
-	public List<Integer> getAllClubID(){
-		return cmCouponClubDao.getAllClubID();
-	}
-
-	public Page<NewCmClub> getClubList(Page<NewCmClub> page, NewCmClub cmClub) {
-		cmClub.setPage(page);
-		page.setList(cmCouponClubDao.getClubList(cmClub));
-		return page;
-	}
-}

+ 0 - 52
src/main/java/com/caimei/modules/coupon/service/CmCouponOrderRecordService.java

@@ -1,52 +0,0 @@
-package com.caimei.modules.coupon.service;
-
-import java.util.List;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import com.thinkgem.jeesite.common.persistence.Page;
-import com.thinkgem.jeesite.common.service.CrudService;
-import com.caimei.modules.coupon.entity.CmCouponOrderRecord;
-import com.caimei.modules.coupon.dao.CmCouponOrderRecordDao;
-
-/**
- * 采美优惠券订单Service
- * @author Lijun
- * @version 2018-10-10
- */
-@Service
-@Transactional(readOnly = true)
-public class CmCouponOrderRecordService extends CrudService<CmCouponOrderRecordDao, CmCouponOrderRecord> {
-
-	@Autowired
-	CmCouponOrderRecordDao cmCouponOrderRecordDao;
-
-	public CmCouponOrderRecord get(String id) {
-		return super.get(id);
-	}
-	
-	public List<CmCouponOrderRecord> findList(CmCouponOrderRecord cmCouponOrderRecord) {
-		return super.findList(cmCouponOrderRecord);
-	}
-
-	public List<CmCouponOrderRecord> findListBuyAgain(String customerMobile) {
-		return cmCouponOrderRecordDao.findListBuyAgain(customerMobile);
-	}
-
-	public Page<CmCouponOrderRecord> findPage(Page<CmCouponOrderRecord> page, CmCouponOrderRecord cmCouponOrderRecord) {
-		return super.findPage(page, cmCouponOrderRecord);
-	}
-	
-	@Transactional(readOnly = false)
-	public void save(CmCouponOrderRecord cmCouponOrderRecord) {
-		super.save(cmCouponOrderRecord);
-	}
-	
-	@Transactional(readOnly = false)
-	public void delete(CmCouponOrderRecord cmCouponOrderRecord) {
-		super.delete(cmCouponOrderRecord);
-	}
-	
-}

+ 0 - 54
src/main/java/com/caimei/modules/coupon/service/CmCouponRecordScanService.java

@@ -1,54 +0,0 @@
-package com.caimei.modules.coupon.service;
-
-import java.util.List;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import com.thinkgem.jeesite.common.persistence.Page;
-import com.thinkgem.jeesite.common.service.CrudService;
-import com.caimei.modules.coupon.entity.CmCouponRecordScan;
-import com.caimei.modules.coupon.dao.CmCouponRecordScanDao;
-
-/**
- * 扫码推送优惠券Service
- * @author LiJun
- * @version 2018-11-22
- */
-@Service
-@Transactional(readOnly = false)
-public class CmCouponRecordScanService extends CrudService<CmCouponRecordScanDao, CmCouponRecordScan> {
-	@Autowired
-	CmCouponRecordScanDao cmCouponRecordScanDao;
-
-	public CmCouponRecordScan get(String id) {
-		return super.get(id);
-	}
-	
-	public List<CmCouponRecordScan> findList(CmCouponRecordScan cmCouponRecordScan) {
-		return super.findList(cmCouponRecordScan);
-	}
-	
-	public Page<CmCouponRecordScan> findPage(Page<CmCouponRecordScan> page, CmCouponRecordScan cmCouponRecordScan) {
-		return super.findPage(page, cmCouponRecordScan);
-	}
-	
-	@Transactional(readOnly = false)
-	public void save(CmCouponRecordScan cmCouponRecordScan) {
-		super.save(cmCouponRecordScan);
-	}
-	
-	@Transactional(readOnly = false)
-	public void delete(CmCouponRecordScan cmCouponRecordScan) {
-		super.delete(cmCouponRecordScan);
-	}
-
-	public void updateEnabledStatus(String enabledStatus){
-		cmCouponRecordScanDao.updateEnabledStatus(enabledStatus);
-	}
-
-	public CmCouponRecordScan getEnabledStatus(){
-		return  cmCouponRecordScanDao.getEnabledStatus();
-	}
-}

+ 0 - 44
src/main/java/com/caimei/modules/coupon/service/CmCouponRecordService.java

@@ -1,44 +0,0 @@
-package com.caimei.modules.coupon.service;
-
-import java.util.List;
-
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import com.thinkgem.jeesite.common.persistence.Page;
-import com.thinkgem.jeesite.common.service.CrudService;
-import com.caimei.modules.coupon.entity.CmCouponRecord;
-import com.caimei.modules.coupon.dao.CmCouponRecordDao;
-
-/**
- * 采美优惠券使用记录表Service
- * @author lwt
- * @version 2018-09-29
- */
-@Service
-@Transactional(readOnly = true)
-public class CmCouponRecordService extends CrudService<CmCouponRecordDao, CmCouponRecord> {
-
-	public CmCouponRecord get(String id) {
-		return super.get(id);
-	}
-	
-	public List<CmCouponRecord> findList(CmCouponRecord cmCouponRecord) {
-		return super.findList(cmCouponRecord);
-	}
-	
-	public Page<CmCouponRecord> findPage(Page<CmCouponRecord> page, CmCouponRecord cmCouponRecord) {
-		return super.findPage(page, cmCouponRecord);
-	}
-	
-	@Transactional(readOnly = false)
-	public void save(CmCouponRecord cmCouponRecord) {
-		super.save(cmCouponRecord);
-	}
-	
-	@Transactional(readOnly = false)
-	public void delete(CmCouponRecord cmCouponRecord) {
-		super.delete(cmCouponRecord);
-	}
-	
-}

+ 196 - 63
src/main/java/com/caimei/modules/coupon/service/CmCouponService.java

@@ -1,74 +1,207 @@
 package com.caimei.modules.coupon.service;
 
-import java.util.List;
-
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
+import com.alibaba.fastjson.JSON;
+import com.caimei.modules.coupon.dao.CmCouponDao;
+import com.caimei.modules.coupon.entity.CmCoupon;
+import com.caimei.modules.coupon.entity.CmCouponAssociate;
+import com.caimei.modules.coupon.entity.CmCouponClub;
+import com.caimei.modules.miniprogram.utils.UploadPicUtils;
+import com.caimei.modules.product.dao.ProductDao;
+import com.caimei.modules.product.entity.Product;
+import com.caimei.modules.user.entity.CmUser;
+import com.caimei.modules.user.entity.NewCmShop;
+import com.caimei.utils.AppUtils;
 import com.thinkgem.jeesite.common.persistence.Page;
 import com.thinkgem.jeesite.common.service.CrudService;
-import com.caimei.modules.coupon.entity.CmCoupon;
-import com.caimei.modules.coupon.dao.CmCouponDao;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
-import javax.annotation.Resource;
+import java.util.Date;
+import java.util.List;
 
 /**
- * 采美优惠券表(优惠券基本信息来自华熙提供)Service
- * @author lwt
- * @version 2018-09-30
+ * 优惠券管理Service
+ *
+ * @author plf
+ * @version 2021-08-02
  */
 @Service
-@Transactional(readOnly = false)
+@Transactional(readOnly = true)
 public class CmCouponService extends CrudService<CmCouponDao, CmCoupon> {
-
-	@Resource
-	private CmCouponDao cmCouponDao;
-
-	public CmCoupon get(String id) {
-		return super.get(id);
-	}
-	
-	public List<CmCoupon> findList(CmCoupon cmCoupon) {
-		return super.findList(cmCoupon);
-	}
-
-	public List<CmCoupon> findCouponList(CmCoupon cmCoupon) {
-		return cmCouponDao.findCouponList(cmCoupon);
-	}
-
-	public Page<CmCoupon> findPage(Page<CmCoupon> page, CmCoupon cmCoupon) {
-		return super.findPage(page, cmCoupon);
-	}
-	
-	@Transactional(readOnly = false)
-	public void save(CmCoupon cmCoupon) {
-		super.save(cmCoupon);
-	}
-
-	@Transactional(readOnly = false)
-	public void update(CmCoupon cmCoupon) {
-		cmCouponDao.update(cmCoupon);
-	}
-
-	public void updateStatus(CmCoupon cmCoupon) {
-		cmCouponDao.updateStatus(cmCoupon);
-	}
-
-
-	@Transactional(readOnly = false)
-	public void delete(CmCoupon cmCoupon) {
-		super.delete(cmCoupon);
-	}
-
-	public List<CmCoupon> statisticsCoupon(){
-		return cmCouponDao.statisticsCoupon();
-	}
-
-	public List<CmCoupon> findByCouponCode(String couponCode){
-		return cmCouponDao.findByCouponCode(couponCode);
-	}
-
-	public List<CmCoupon> getSendCoupon (CmCoupon cmCoupon) {
-		return cmCouponDao.getSendCoupon(cmCoupon);
-	}
+    @Autowired
+    private CmCouponDao cmCouponDao;
+    @Autowired
+    private ProductDao productDao;
+
+    public CmCoupon get(String id) {
+        CmCoupon coupon = super.get(id);
+        setCouponStatus(coupon, new Date());
+        if (coupon.getCouponType() == 3) {
+            //店铺券
+            List<NewCmShop> shopList = cmCouponDao.findCouponShop(coupon.getId());
+            coupon.setShopList(shopList);
+        }
+        return coupon;
+    }
+
+    public List<CmCoupon> findList(CmCoupon cmCoupon) {
+        return super.findList(cmCoupon);
+    }
+
+    public Page<CmCoupon> findPage(Page<CmCoupon> page, CmCoupon cmCoupon) {
+        Page<CmCoupon> couponPage = super.findPage(page, cmCoupon);
+        List<CmCoupon> couponList = couponPage.getList();
+        Date date = new Date();
+        couponList.forEach(coupon -> {
+            setCouponStatus(coupon, date);
+            if (2 == cmCoupon.getCouponType()) {
+                //用户专享劵
+                CmCouponClub couponClub = cmCouponDao.findCouponClub(coupon.getId());
+                if (couponClub == null) {
+                    coupon.setClaimStatus("1");
+                } else {
+                    coupon.setClaimStatus("2");
+                }
+                coupon.setCouponClub(couponClub);
+            } else if (3 == cmCoupon.getCouponType()) {
+                //店铺券
+                List<NewCmShop> shopList = cmCouponDao.findCouponShop(coupon.getId());
+                coupon.setShopList(shopList);
+            }
+        });
+        return couponPage;
+    }
+
+    private void setCouponStatus(CmCoupon cmCoupon, Date date) {
+        if (cmCoupon != null) {
+            if (!cmCoupon.getStatus().contains("2")) {
+                if (date.compareTo(cmCoupon.getStartDate()) < 0) {
+                    cmCoupon.setStatus("0");
+                } else if (date.compareTo(cmCoupon.getEndDate()) > 0) {
+                    cmCoupon.setStatus("3");
+                } else {
+                    cmCoupon.setStatus("1");
+                }
+            } else {
+                cmCoupon.setStatus("2");
+            }
+        }
+    }
+
+    @Transactional(readOnly = false)
+    public void save(CmCoupon cmCoupon) {
+        if (StringUtils.isNotBlank(cmCoupon.getPcBanner())) {
+            String image = UploadPicUtils.saveImageToServer(cmCoupon.getPcBanner());
+            cmCoupon.setPcBanner(image);
+        }
+        if (StringUtils.isNotBlank(cmCoupon.getAppletsBanner())) {
+            String image = UploadPicUtils.saveImageToServer(cmCoupon.getAppletsBanner());
+            cmCoupon.setAppletsBanner(image);
+        }
+        Date date = new Date();
+        cmCoupon.setCreateDate(date);
+        setCouponStatus(cmCoupon, date);
+        super.save(cmCoupon);
+        List<Integer> associateIds = cmCouponDao.findByCouponId(cmCoupon.getId());
+        if (0 == cmCoupon.getCouponType()) {
+            //活动券
+            if (StringUtils.isNotBlank(cmCoupon.getProductInfo())) {
+                List<CmCouponAssociate> associateList = JSON.parseArray(cmCoupon.getProductInfo(), CmCouponAssociate.class);
+                associateList.forEach(a -> {
+                    if (a.getId() == null) {
+                        a.setDelFlag("0");
+                        a.setCouponId(Integer.valueOf(cmCoupon.getId()));
+                        a.setAddTime(date);
+                        cmCouponDao.insertCouponAssociate(a);
+                    } else {
+                        associateIds.removeIf(id -> id.equals(a.getId()));
+                        cmCouponDao.updateCouponAssociate(a);
+                    }
+                });
+            }
+        } else if (3 == cmCoupon.getCouponType()) {
+            //店铺券
+            if (StringUtils.isNotBlank(cmCoupon.getShopInfo())) {
+                List<CmCouponAssociate> associateList = JSON.parseArray(cmCoupon.getShopInfo(), CmCouponAssociate.class);
+                associateList.forEach(a -> {
+                    if (a.getId() == null) {
+                        a.setDelFlag("0");
+                        a.setCouponId(Integer.valueOf(cmCoupon.getId()));
+                        a.setAddTime(date);
+                        cmCouponDao.insertCouponAssociate(a);
+                    } else {
+                        associateIds.removeIf(id -> id.equals(a.getId()));
+                    }
+                });
+            }
+        }
+        if (associateIds != null && associateIds.size() > 0) {
+            associateIds.forEach(id -> {
+                cmCouponDao.logicDeleteCouponAssociate(id);
+            });
+        }
+    }
+
+    @Transactional(readOnly = false)
+    public void delete(CmCoupon cmCoupon) {
+        cmCouponDao.updateByDelFlag(cmCoupon.getId());
+        cmCouponDao.updateAssociateByDelFlag(cmCoupon.getId());
+    }
+
+    public Page<Product> findProductList(Page<Product> productPage, Product product) {
+        product.setPage(productPage);
+        product.setValidFlag("2");
+        product.setProductCategory("1");
+        List<Product> productList = productDao.findProductImage(product);
+        if (productList != null && productList.size() > 0) {
+            productList.forEach(item -> {
+                item.setMainImage(AppUtils.getImageURL("product", item.getMainImage(), 0, "https://www.caimei365.com/"));
+                item.setProductIds(product.getProductIds());
+                if (StringUtils.isNotBlank(product.getProductIds()) && product.getProductIds().contains(item.getProductID().toString())) {
+                    item.setStoreStatus(true);
+                }
+            });
+        }
+        productPage.setList(productList);
+        return productPage;
+    }
+
+    public List<CmCouponAssociate> findByProductType(CmCoupon cmCoupon) {
+        List<CmCouponAssociate> associateList = cmCouponDao.findByProductType(cmCoupon.getId());
+        if (associateList != null && associateList.size() > 0) {
+            associateList.forEach(item -> {
+                item.setImage(AppUtils.getImageURL("product", item.getImage(), 0, "https://www.caimei365.com/"));
+            });
+        }
+        return associateList;
+    }
+
+    @Transactional(readOnly = false)
+    public void close(CmCoupon cmCoupon) {
+        cmCoupon.setStatus("2");
+        cmCouponDao.update(cmCoupon);
+    }
+
+    public Page<CmUser> findUserList(Page<CmUser> userPage, CmUser cmUser) {
+        cmUser.setPage(userPage);
+        List<CmUser> userList = cmCouponDao.findUserList(cmUser);
+        userPage.setList(userList);
+        return userPage;
+    }
+
+    public Page<NewCmShop> findShopList(Page<NewCmShop> newCmShopPage, NewCmShop newCmShop, String shopIds) {
+        newCmShop.setPage(newCmShopPage);
+        List<NewCmShop> shopList = cmCouponDao.findShopList(newCmShop);
+        if (StringUtils.isNotBlank(shopIds)) {
+            shopList.forEach(s -> {
+                if (shopIds.contains(s.getShopID().toString())) {
+                    s.setChoose(true);
+                }
+            });
+        }
+        newCmShopPage.setList(shopList);
+        return newCmShopPage;
+    }
 }

+ 0 - 217
src/main/java/com/caimei/modules/coupon/web/CmCouponClubController.java

@@ -1,217 +0,0 @@
-package com.caimei.modules.coupon.web;
-
-import javax.annotation.Resource;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import com.caimei.modules.coupon.entity.CmCoupon;
-import com.caimei.modules.coupon.entity.CmCouponRecord;
-import com.caimei.modules.coupon.service.CmCouponRecordService;
-import com.caimei.modules.coupon.service.CmCouponService;
-import com.caimei.modules.sys.utils.SMSUtils;
-import com.caimei.modules.user.entity.NewCmClub;
-import com.caimei.modules.user.service.NewCmClubService;
-import com.yeepay.shade.org.apache.commons.collections4.CollectionUtils;
-import org.apache.shiro.authz.annotation.RequiresPermissions;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
-import org.springframework.ui.Model;
-import org.springframework.web.bind.annotation.ModelAttribute;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.servlet.mvc.support.RedirectAttributes;
-import com.thinkgem.jeesite.common.config.Global;
-import com.thinkgem.jeesite.common.persistence.Page;
-import com.thinkgem.jeesite.common.web.BaseController;
-import com.thinkgem.jeesite.common.utils.StringUtils;
-import com.caimei.modules.coupon.entity.CmCouponClub;
-import com.caimei.modules.coupon.service.CmCouponClubService;
-import java.util.Date;
-import java.util.List;
-
-/**
- * 采美优惠券活动签约会所Controller
- * @author lwt
- * @version 2018-09-29
- */
-@Controller
-@RequestMapping(value = "${adminPath}/coupon/cmCouponClub")
-public class CmCouponClubController extends BaseController {
-
-	@Autowired
-	private CmCouponClubService cmCouponClubService;
-	@Autowired
-	private CmCouponRecordService cmCouponRecordService;
-	@Resource
-	private NewCmClubService newCmClubService;
-	@Autowired
-	private CmCouponService cmCouponService;
-	
-	@ModelAttribute
-	public CmCouponClub get(@RequestParam(required=false) String id) {
-		CmCouponClub entity = null;
-		if (StringUtils.isNotBlank(id)){
-			entity = cmCouponClubService.get(id);
-		}
-		if (entity == null){
-			entity = new CmCouponClub();
-		}
-		return entity;
-	}
-	
-	@RequiresPermissions("coupon:cmCouponClub:view")
-	@RequestMapping(value = {"list", ""})
-	public String list(CmCouponClub cmCouponClub, HttpServletRequest request, HttpServletResponse response, Model model) {
-		if (null != cmCouponClub.getStartTime() && !"".equals(cmCouponClub.getStartTime()) && !cmCouponClub.getStartTime().endsWith("00:00:00")) {
-			model.addAttribute("startTime", cmCouponClub.getStartTime());
-			cmCouponClub.setStartTime(cmCouponClub.getStartTime() + " 00:00:00");
-		}
-		if (null != cmCouponClub.getEndTime() && !"".equals(cmCouponClub.getEndTime()) && !cmCouponClub.getEndTime().endsWith("23:59:59")) {
-			model.addAttribute("endTime", cmCouponClub.getEndTime());
-			cmCouponClub.setEndTime(cmCouponClub.getEndTime() + " 23:59:59");
-		}
-		Page<CmCouponClub> page = cmCouponClubService.findPage(new Page<CmCouponClub>(request, response), cmCouponClub); 
-		model.addAttribute("page", page);
-		return "modules/coupon/cmCouponClubList";
-	}
-
-	@RequiresPermissions("coupon:cmCouponClub:view")
-	@RequestMapping(value = "form")
-	public String form(CmCouponClub cmCouponClub, Model model) {
-		model.addAttribute("cmCouponClub", cmCouponClub);
-		return "modules/coupon/cmCouponClubForm";
-	}
-
-	@RequiresPermissions("coupon:cmCouponClub:edit")
-	@RequestMapping(value = "save")
-	public String save(CmCouponClub cmCouponClub, Model model, RedirectAttributes redirectAttributes) {
-		if (!beanValidator(model, cmCouponClub)){
-			return form(cmCouponClub, model);
-		}
-		cmCouponClubService.save(cmCouponClub);
-		addMessage(redirectAttributes, "保存采美优惠券活动签约会所成功");
-		return "redirect:"+Global.getAdminPath()+"/coupon/cmCouponClub/?repage";
-	}
-	
-	@RequiresPermissions("coupon:cmCouponClub:delete")
-	@RequestMapping(value = "delete")
-	public String delete(CmCouponClub cmCouponClub, RedirectAttributes redirectAttributes) {
-		cmCouponClubService.deleteCmCouponClub(cmCouponClub);
-		addMessage(redirectAttributes, "删除采美优惠券活动签约会所成功");
-		return "redirect:"+Global.getAdminPath()+"/coupon/cmCouponClub/?repage";
-	}
-
-	@RequestMapping("showClubList")
-	public String showClubList(NewCmClub cmClub, HttpServletRequest request, HttpServletResponse response, Model model) {
-		Page<NewCmClub> page = cmCouponClubService.getClubList(new Page<>(request, response), cmClub);
-		model.addAttribute("page", page);
-		return "modules/coupon/cmClubListBox";
-	}
-
-	/**
-	 * 显示发送优惠券
-	 * @param request
-	 * @param response
-	 * @param model
-	 * @return
-	 */
-	@RequestMapping("showCouponList")
-	public String showCouponList(Integer userID,Integer pageSize,Integer pageNo,CmCoupon cmCoupon,HttpServletRequest request, HttpServletResponse response, Model model) {
-		Page<CmCoupon> page = cmCoupon.getPage();
-		if(null==pageNo)pageNo=1;
-		if(null==pageSize)pageSize=10;
-		if(null != page){
-			page.setPageSize(pageSize);
-			page.setPageNo(pageNo);
-		}else{
-			page = new Page<CmCoupon>();
-			page.setPageSize(pageSize);
-			page.setPageNo(pageNo);
-		}
-		cmCoupon.setPage(page);
-		List<CmCoupon> cmCouponList = cmCouponService.findCouponList(cmCoupon);
-		if(CollectionUtils.isNotEmpty(cmCouponList)){
-			for(CmCoupon c:cmCouponList){
-				c.setUserID(userID);
-			}
-		}
-		page.setList(cmCouponList);
-		model.addAttribute("userID", userID);
-		model.addAttribute("page", page);
-		return "modules/coupon/cmCouponListBox";
-	}
-
-	@RequestMapping("addClub")
-	public String addClub(Integer clubID, CmCouponClub couponClub){
-		NewCmClub club = newCmClubService.findClubById(clubID);
-		couponClub.setClubId(club.getClubID().longValue());
-		couponClub.setUserID(club.getUserID());
-		couponClub.setName(club.getName());
-		couponClub.setSname(club.getSname());
-		couponClub.setLinkMan(club.getLinkMan());
-		couponClub.setContractMobile(club.getContractMobile());
-		couponClub.setStatus("2");
-		cmCouponClubService.save(couponClub);
-		return "redirect:"+Global.getAdminPath()+"/coupon/cmCouponClub/?repage";
-	}
-
-
-	@RequestMapping("addCoupon")
-	public String addCoupon(CmCoupon cmCoupon){
-		Integer userID = cmCoupon.getUserID();//派送给哪个会所
-		NewCmClub newCmClub = newCmClubService.getclubByUserId(userID);
-		//获取同类型的优惠卷
-		List<CmCoupon> sendCoupon = cmCouponService.getSendCoupon(cmCoupon);
-		if(CollectionUtils.isNotEmpty(sendCoupon)){
-			for(CmCoupon c:sendCoupon){
-				CmCouponRecord cmCouponRecord  = new CmCouponRecord();
-				cmCouponRecord.setCouponCode(c.getCouponCode());
-				cmCouponRecord.setCouponAmount(c.getCouponAmount());
-				cmCouponRecord.setUseStartDate(c.getUseStartDate());
-				cmCouponRecord.setUseEndDate(c.getUseEndDate());
-				cmCouponRecord.setStatus("1");//已派送给会所
-				cmCouponRecord.setCouponType(c.getCouponType());
-				cmCouponRecord.setThreshold(c.getThreshold());
-				cmCouponRecord.setUseDescription(c.getUseDescription());
-				cmCouponRecord.setUserId(userID);
-				cmCouponRecordService.save(cmCouponRecord);
-
-				//更新劵为已使用
-				CmCoupon coupon = new CmCoupon();
-				coupon.setCouponCode(c.getCouponCode());
-				coupon.setStatus("1");//已发送
-				coupon.setUpdateDate(new Date());
-				cmCouponService.updateStatus(coupon);
-			}
-		}
-		//发送短信通知
-		if(null != newCmClub){
-			String contractMobile = newCmClub.getContractMobile();
-			if(StringUtils.isNotEmpty(contractMobile)){
-				String content = "活动优惠券已放置您的账户,快分享给用户赚取返利吧,优惠券入口:进入微信商城>>点击我的优惠券,如有问题请致电采美0755-22907771";
-				SMSUtils.sendSms(contractMobile,content);
-			}
-		}
-		return "redirect:"+Global.getAdminPath()+"/coupon/cmCouponClub/?repage";
-	}
-
-	@RequestMapping("dismissal")
-	public String dismissal(CmCouponClub couponClub){
-		if (couponClub != null) {
-			couponClub.setStatus("2");//解除签约
-			couponClub.setSignDate(null);
-			cmCouponClubService.update(couponClub);
-		}
-		return "redirect:"+Global.getAdminPath()+"/coupon/cmCouponClub/?repage";
-	}
-
-	@RequestMapping("signing")
-	public String signing(CmCouponClub couponClub){
-		if (couponClub != null) {
-			couponClub.setStatus("1");//签约
-			couponClub.setSignDate(new Date());
-			cmCouponClubService.update(couponClub);
-		}
-		return "redirect:"+Global.getAdminPath()+"/coupon/cmCouponClub/?repage";
-	}
-
-}

+ 139 - 94
src/main/java/com/caimei/modules/coupon/web/CmCouponController.java

@@ -1,11 +1,18 @@
 package com.caimei.modules.coupon.web;
 
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import com.caimei.modules.coupon.entity.ReadExcel;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.collections.map.HashedMap;
+import com.caimei.modules.coupon.entity.CmCoupon;
+import com.caimei.modules.coupon.entity.CmCouponAssociate;
+import com.caimei.modules.coupon.service.CmCouponService;
+import com.caimei.modules.product.entity.Product;
+import com.caimei.modules.user.dao.CmUserDao;
+import com.caimei.modules.user.dao.NewCmClubDao;
+import com.caimei.modules.user.entity.CmUser;
+import com.caimei.modules.user.entity.NewCmClub;
+import com.caimei.modules.user.entity.NewCmShop;
+import com.thinkgem.jeesite.common.config.Global;
+import com.thinkgem.jeesite.common.persistence.Page;
+import com.thinkgem.jeesite.common.utils.StringUtils;
+import com.thinkgem.jeesite.common.web.BaseController;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
@@ -13,107 +20,145 @@ import org.springframework.ui.Model;
 import org.springframework.web.bind.annotation.ModelAttribute;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.ResponseBody;
-import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.servlet.mvc.support.RedirectAttributes;
 
-import com.thinkgem.jeesite.common.config.Global;
-import com.thinkgem.jeesite.common.persistence.Page;
-import com.thinkgem.jeesite.common.web.BaseController;
-import com.thinkgem.jeesite.common.utils.StringUtils;
-import com.caimei.modules.coupon.entity.CmCoupon;
-import com.caimei.modules.coupon.service.CmCouponService;
-
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.ArrayList;
 import java.util.List;
-import java.util.Map;
 
 /**
- * 采美优惠券表(优惠券基本信息来自华熙提供)Controller
- * @author lwt
- * @version 2018-09-30
+ * 优惠券管理Controller
+ *
+ * @author plf
+ * @version 2021-08-02
  */
 @Controller
 @RequestMapping(value = "${adminPath}/coupon/cmCoupon")
 public class CmCouponController extends BaseController {
 
-	@Autowired
-	private CmCouponService cmCouponService;
-	
-	@ModelAttribute
-	public CmCoupon get(@RequestParam(required=false) String id) {
-		CmCoupon entity = null;
-		if (StringUtils.isNotBlank(id)){
-			entity = cmCouponService.get(id);
-		}
-		if (entity == null){
-			entity = new CmCoupon();
-		}
-		return entity;
-	}
-	
-	@RequiresPermissions("coupon:cmCoupon:view")
-	@RequestMapping(value = {"list", ""})
-	public String list(CmCoupon cmCoupon, HttpServletRequest request, HttpServletResponse response, Model model) {
-		Page<CmCoupon> page = cmCouponService.findPage(new Page<CmCoupon>(request, response), cmCoupon); 
-		model.addAttribute("page", page);
-		return "modules/coupon/cmCouponList";
-	}
+    @Autowired
+    private CmCouponService cmCouponService;
+    @Autowired
+    private CmUserDao cmUserDao;
+    @Autowired
+    private NewCmClubDao newCmClubDao;
+
+    @ModelAttribute
+    public CmCoupon get(@RequestParam(required = false) String id) {
+        CmCoupon entity = null;
+        if (StringUtils.isNotBlank(id)) {
+            entity = cmCouponService.get(id);
+        }
+        if (entity == null) {
+            entity = new CmCoupon();
+        }
+        return entity;
+    }
+
+    @RequiresPermissions("coupon:cmCoupon:view")
+    @RequestMapping(value = {"list", ""})
+    public String list(CmCoupon cmCoupon, HttpServletRequest request, HttpServletResponse response, Model model) {
+        Page<CmCoupon> page = cmCouponService.findPage(new Page<CmCoupon>(request, response), cmCoupon);
+        model.addAttribute("page", page);
+        if (0 == cmCoupon.getCouponType()) {
+            return "modules/coupon/cmCouponList";
+        } else if (1 == cmCoupon.getCouponType()) {
+            return "modules/coupon/couponCategoryList";
+        } else if (2 == cmCoupon.getCouponType()) {
+            return "modules/coupon/couponUserExclusiveList";
+        } else if (3 == cmCoupon.getCouponType()) {
+            return "modules/coupon/couponShopList";
+        } else {
+            return "modules/coupon/couponNewUserList";
+        }
+    }
+
+    @RequiresPermissions("coupon:cmCoupon:view")
+    @RequestMapping(value = "form")
+    public String form(CmCoupon cmCoupon, Model model) {
+        model.addAttribute("cmCoupon", cmCoupon);
+        if (0 == cmCoupon.getCouponType()) {
+            List<CmCouponAssociate> associateList = new ArrayList<>();
+            if (StringUtils.isNotBlank(cmCoupon.getId()) && "2".equals(cmCoupon.getProductType())) {
+                associateList = cmCouponService.findByProductType(cmCoupon);
+            }
+            model.addAttribute("associateList", associateList);
+            return "modules/coupon/cmCouponForm";
+        } else if (1 == cmCoupon.getCouponType()) {
+            return "modules/coupon/couponCategoryForm";
+        } else if (2 == cmCoupon.getCouponType()) {
+            CmUser cmUser = null;
+            if (cmCoupon.getUserId() != null) {
+                cmUser = cmUserDao.get(cmCoupon.getUserId().toString());
+                NewCmClub club = newCmClubDao.getclubByUserId(cmCoupon.getUserId());
+                cmUser.setShortName(club.getSname());
+            }
+            model.addAttribute("cmUser", cmUser);
+            return "modules/coupon/couponUserExclusiveForm";
+        } else if (3 == cmCoupon.getCouponType()) {
+            return "modules/coupon/couponShopForm";
+        } else {
+            return "modules/coupon/couponNewUserForm";
+        }
+    }
+
+    @RequestMapping(value = "save")
+    public String save(CmCoupon cmCoupon, Model model, RedirectAttributes redirectAttributes) {
+        if (!beanValidator(model, cmCoupon)) {
+            return form(cmCoupon, model);
+        }
+        cmCouponService.save(cmCoupon);
+        addMessage(redirectAttributes, "保存优惠券成功");
+        return "redirect:" + Global.getAdminPath() + "/coupon/cmCoupon/list?couponType=" + cmCoupon.getCouponType();
+    }
 
-	@RequiresPermissions("coupon:cmCoupon:view")
-	@RequestMapping(value = "form")
-	public String form(CmCoupon cmCoupon, Model model) {
-		model.addAttribute("cmCoupon", cmCoupon);
-		return "modules/coupon/cmCouponForm";
-	}
+    @RequestMapping(value = "delete")
+    public String delete(CmCoupon cmCoupon, RedirectAttributes redirectAttributes) {
+        cmCouponService.delete(cmCoupon);
+        addMessage(redirectAttributes, "删除优惠券成功");
+        return "redirect:" + Global.getAdminPath() + "/coupon/cmCoupon/list?couponType=" + cmCoupon.getCouponType();
+    }
 
-	@RequiresPermissions("coupon:cmCoupon:edit")
-	@RequestMapping(value = "save")
-	public String save(CmCoupon cmCoupon, Model model, RedirectAttributes redirectAttributes) {
-		if (!beanValidator(model, cmCoupon)){
-			return form(cmCoupon, model);
-		}
-		cmCouponService.save(cmCoupon);
-		addMessage(redirectAttributes, "保存成功");
-		return "redirect:"+Global.getAdminPath()+"/coupon/cmCoupon/?repage";
-	}
-	
-	@RequiresPermissions("coupon:cmCoupon:delete")
-	@RequestMapping(value = "delete")
-	public String delete(CmCoupon cmCoupon, RedirectAttributes redirectAttributes) {
-		cmCouponService.delete(cmCoupon);
-		addMessage(redirectAttributes, "删除成功");
-		return "redirect:"+Global.getAdminPath()+"/coupon/cmCoupon/?repage";
-	}
+    /**
+     * 选择商品页面
+     */
+    @RequestMapping(value = "toAddProduct")
+    public String toAddProduct(Product product, Model model, HttpServletRequest request, HttpServletResponse response) {
+        Page<Product> page = cmCouponService.findProductList(new Page<Product>(request, response), product);
+        model.addAttribute("page", page);
+        model.addAttribute("productIds", product.getProductIds());
+        return "/modules/coupon/toAddProduct";
+    }
 
+    /**
+     * 关闭优惠券
+     */
+    @RequestMapping("close")
+    public String close(CmCoupon cmCoupon, RedirectAttributes redirectAttributes) {
+        cmCouponService.close(cmCoupon);
+        addMessage(redirectAttributes, "关闭优惠券成功");
+        return "redirect:" + Global.getAdminPath() + "/coupon/cmCoupon/list?couponType=" + cmCoupon.getCouponType();
+    }
 
-	@ResponseBody
-	@RequestMapping(value = "import")
-	public Map<String,Object> cibeShopImport(@RequestParam(value="file",required = false) MultipartFile file, HttpServletRequest request, HttpServletResponse response, Model model){
-		Map<String,Object> map = new HashedMap();
-		try{
-			//创建处理EXCEL的类
-			ReadExcel readExcel = new ReadExcel();
-			List<CmCoupon> cmCoupons = readExcel.getExcelInfo(file);
-			for (CmCoupon cmCoupon : cmCoupons){
-				List<CmCoupon> cs = cmCouponService.findByCouponCode(cmCoupon.getCouponCode());
-				if(CollectionUtils.isEmpty(cs)) {
-					//优惠码在数据库中不存在,  直接插入优惠券信息
-					cmCouponService.save(cmCoupon);
-				} else {
-					//优惠码在数据库中存在,  更新优惠券信息
-					cmCoupon.setId(cs.get(0).getId());
-					cmCouponService.update(cmCoupon);
-				}
-			}
-			map.put("success",true);
-			map.put("msg", "上传成功");
-		}catch (Exception e){
-			e.printStackTrace();
-			logger.error(e.getMessage());
-			map.put("success",false);
-			map.put("msg", "上传失败");
-		}
-		return map;
-	}
+    /**
+     * 选择机构页面
+     */
+    @RequestMapping("toAddClub")
+    public String toAddClub(CmUser cmUser, Model model, HttpServletRequest request, HttpServletResponse response) {
+        Page<CmUser> page = cmCouponService.findUserList(new Page<CmUser>(request, response), cmUser);
+        model.addAttribute("page", page);
+        return "/modules/coupon/toAddClub";
+    }
 
+    /**
+     * 选择供应商页面
+     */
+    @RequestMapping("toAddShop")
+    public String toAddShop(NewCmShop newCmShop, String shopIds, Model model, HttpServletRequest request, HttpServletResponse response) {
+        Page<NewCmShop> page = cmCouponService.findShopList(new Page<NewCmShop>(request, response), newCmShop, shopIds);
+        model.addAttribute("shopIds", shopIds);
+        model.addAttribute("page", page);
+        return "/modules/coupon/toAddShop";
+    }
 }

+ 0 - 173
src/main/java/com/caimei/modules/coupon/web/CmCouponOrderRecordController.java

@@ -1,173 +0,0 @@
-package com.caimei.modules.coupon.web;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import com.caimei.modules.common.utils.ExcelUtil;
-import com.caimei.modules.coupon.entity.CmCouponOrderRecord;
-import com.caimei.modules.coupon.service.CmCouponOrderRecordService;
-import com.caimei.modules.order.entity.NewReceiptList;
-import com.thinkgem.jeesite.common.persistence.Page;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.shiro.authz.annotation.RequiresPermissions;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
-import org.springframework.ui.Model;
-import org.springframework.web.bind.annotation.ModelAttribute;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.servlet.mvc.support.RedirectAttributes;
-import com.thinkgem.jeesite.common.config.Global;
-import com.thinkgem.jeesite.common.web.BaseController;
-import com.thinkgem.jeesite.common.utils.StringUtils;
-
-import java.util.Date;
-import java.util.List;
-
-/**
- * 采美优惠券订单Controller
- * @author Lijun
- * @version 2018-10-09
- */
-@Controller
-@RequestMapping(value = "${adminPath}/coupon/cmCouponOrderRecord")
-public class CmCouponOrderRecordController extends BaseController {
-
-	@Autowired
-	private CmCouponOrderRecordService cmCouponOrderRecordService;
-	
-	@ModelAttribute
-	public CmCouponOrderRecord get(@RequestParam(required=false) String id) {
-		CmCouponOrderRecord entity = null;
-		if (StringUtils.isNotBlank(id)){
-			entity = cmCouponOrderRecordService.get(id);
-		}
-		if (entity == null){
-			entity = new CmCouponOrderRecord();
-		}
-		return entity;
-	}
-	
-	@RequiresPermissions("coupon:cmCouponOrderRecord:view")
-	@RequestMapping(value = {"list", ""})
-	public String list(CmCouponOrderRecord cmCouponOrderRecord,RedirectAttributes redirectAttributes, HttpServletRequest request, HttpServletResponse response, Model model) {
-		if (null != cmCouponOrderRecord.getStartTime() && !"".equals(cmCouponOrderRecord.getStartTime()) && !cmCouponOrderRecord.getStartTime().endsWith("00:00:00")) {
-			model.addAttribute("startTime", cmCouponOrderRecord.getStartTime());
-			cmCouponOrderRecord.setStartTime(cmCouponOrderRecord.getStartTime() + " 00:00:00");
-		}
-		if (null != cmCouponOrderRecord.getEndTime() && !"".equals(cmCouponOrderRecord.getEndTime()) && !cmCouponOrderRecord.getEndTime().endsWith("23:59:59")) {
-			model.addAttribute("endTime", cmCouponOrderRecord.getEndTime());
-			cmCouponOrderRecord.setEndTime(cmCouponOrderRecord.getEndTime() + " 23:59:59");
-		}
-
-		String searchflag = cmCouponOrderRecord.getSearchflag();
-		if(StringUtils.isNotEmpty(searchflag) && searchflag.length() != 2){//导出操作
-			cmCouponOrderRecord.setPage(null);
-			List<CmCouponOrderRecord> list = cmCouponOrderRecordService.findList(cmCouponOrderRecord);
-			if(CollectionUtils.isNotEmpty(list)){
-				for(CmCouponOrderRecord c:list){
-					c = setName(c);
-					String status = c.getStatus();
-					Date refundTime = c.getRefundTime();
-					if(StringUtils.equals("2",status)){
-						c.setStatus("付款成功");
-					}else if(StringUtils.equals("6",status)){
-						c.setStatus("退款成功");
-					}else{
-						c.setStatus("____");
-					}
-				}
-			}
-			//获取订单数据
-			StringBuffer sb = new StringBuffer();
-			sb.append("优惠券订单列表.xls");
-			String fileName = sb.toString();
-			String template = Global.getConfig("export.template");
-			String templateFileName = template+"/couponOrderList_template.xls";
-			// 导出订单列表
-			cmCouponOrderRecord.setStartTime(cmCouponOrderRecord.getStartTime() + " 00:00:00");
-			cmCouponOrderRecord.setEndTime(cmCouponOrderRecord.getEndTime() + " 23:59:59");
-			try {
-				new ExcelUtil().createExcel(templateFileName, list, fileName, response);
-			} catch (Exception e) {
-				addMessage(redirectAttributes, "优惠券订单导出异常!" + e.getMessage());
-				e.printStackTrace();
-			}
-		}
-		Page<CmCouponOrderRecord> page = cmCouponOrderRecordService.findPage(new Page<CmCouponOrderRecord>(request, response), cmCouponOrderRecord);
-		List<CmCouponOrderRecord> list = page.getList();
-		if(CollectionUtils.isNotEmpty(list) && list.size() > 0){
-			for(CmCouponOrderRecord cor : list){
-				setName(cor);
-			}
-		}
-
-		model.addAttribute("page", page);
-		return "modules/coupon/cmCouponOrderRecordList";
-	}
-
-	/**
-	 * 设置分享着名字(返利者)
-	 * @param c
-	 * @return
-	 */
-	public CmCouponOrderRecord setName(CmCouponOrderRecord c){
-		String clubName = c.getClubName();//分享劵人名字
-		String couponMobile = c.getCouponMobile();//分享劵人手机
-		//设置分享者名字
-		if(StringUtils.isEmpty(clubName)){
-			if(StringUtils.isEmpty(couponMobile)){//老用户自己不使用优惠券自己直接购买
-				//通过本次购买的订单客户的手机号,查找这个手机号之前使用本系统优惠券下单过的分享者
-				String customerMobile = c.getCustomerMobile();
-				List<CmCouponOrderRecord> listBuyAgain = cmCouponOrderRecordService.findListBuyAgain(customerMobile);
-				if(CollectionUtils.isNotEmpty(listBuyAgain)){//如果不存在则提示用户不存在
-					String name = "";
-					for(CmCouponOrderRecord cc:listBuyAgain){
-						String companyName = cc.getCompanyName();
-						if(StringUtils.isEmpty(companyName)){
-							name = cc.getCouponMobile();
-						}else{
-							name = companyName;
-							break;//优先使用名字其次号码
-						}
-					}
-					c.setRebateName(name);
-				}else{
-					c.setRebateName("无名氏");
-				}
-			}else{//扫码领取劵分享购买订单
-				c.setRebateName(couponMobile);
-			}
-		}else{//后台推送劵分享购买订单
-			c.setRebateName(clubName);
-		}
-		return c;
-	}
-
-	@RequiresPermissions("coupon:cmCouponOrderRecord:view")
-	@RequestMapping(value = "form")
-	public String form(CmCouponOrderRecord cmCouponOrderRecord, Model model) {
-		model.addAttribute("cmCouponOrderRecord", cmCouponOrderRecord);
-		return "modules/coupon/cmCouponOrderRecordForm";
-	}
-
-	@RequiresPermissions("coupon:cmCouponOrderRecord:edit")
-	@RequestMapping(value = "save")
-	public String save(CmCouponOrderRecord cmCouponOrderRecord, Model model, RedirectAttributes redirectAttributes) {
-		if (!beanValidator(model, cmCouponOrderRecord)){
-			return form(cmCouponOrderRecord, model);
-		}
-		cmCouponOrderRecordService.save(cmCouponOrderRecord);
-		addMessage(redirectAttributes, "保存采美优惠券订单成功");
-		return "redirect:"+Global.getAdminPath()+"/coupon/cmCouponOrderRecord/?repage";
-	}
-	
-	@RequiresPermissions("coupon:cmCouponOrderRecord:delete")
-	@RequestMapping(value = "delete")
-	public String delete(CmCouponOrderRecord cmCouponOrderRecord, RedirectAttributes redirectAttributes) {
-		cmCouponOrderRecordService.delete(cmCouponOrderRecord);
-		addMessage(redirectAttributes, "删除采美优惠券订单成功");
-		return "redirect:"+Global.getAdminPath()+"/coupon/cmCouponOrderRecord/?repage";
-	}
-
-}

+ 0 - 139
src/main/java/com/caimei/modules/coupon/web/CmCouponRecordController.java

@@ -1,139 +0,0 @@
-package com.caimei.modules.coupon.web;
-
-import javax.annotation.Resource;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
-
-import com.caimei.modules.coupon.entity.CmCoupon;
-import com.caimei.modules.coupon.service.CmCouponService;
-import com.caimei.modules.user.dao.CmUserDao;
-import com.caimei.modules.user.entity.CmUser;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.shiro.authz.annotation.RequiresPermissions;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
-import org.springframework.ui.Model;
-import org.springframework.web.bind.annotation.ModelAttribute;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.servlet.mvc.support.RedirectAttributes;
-
-import com.thinkgem.jeesite.common.config.Global;
-import com.thinkgem.jeesite.common.persistence.Page;
-import com.thinkgem.jeesite.common.web.BaseController;
-import com.thinkgem.jeesite.common.utils.StringUtils;
-import com.caimei.modules.coupon.entity.CmCouponRecord;
-import com.caimei.modules.coupon.service.CmCouponRecordService;
-
-import java.util.Date;
-import java.util.List;
-
-/**
- * 采美优惠券使用记录表Controller
- * @author lwt
- * @version 2018-09-29
- */
-@Controller
-@RequestMapping(value = "${adminPath}/coupon/cmCouponRecord")
-public class CmCouponRecordController extends BaseController {
-
-	@Autowired
-	private CmCouponRecordService cmCouponRecordService;
-
-	@Resource
-	private CmCouponService cmCouponService;
-	@Autowired
-	private CmUserDao cmUserDao;
-	
-	@ModelAttribute
-	public CmCouponRecord get(@RequestParam(required=false) String id) {
-		CmCouponRecord entity = null;
-		if (StringUtils.isNotBlank(id)){
-			entity = cmCouponRecordService.get(id);
-		}
-		if (entity == null){
-			entity = new CmCouponRecord();
-		}
-		return entity;
-	}
-	
-	@RequiresPermissions("coupon:cmCouponRecord:view")
-	@RequestMapping(value = {"list", ""})
-	public String list(CmCouponRecord cmCouponRecord, HttpServletRequest request, HttpServletResponse response, Model model) {
-		Page<CmCouponRecord> page = cmCouponRecordService.findPage(new Page<CmCouponRecord>(request, response), cmCouponRecord);
-		List<CmCouponRecord> list = page.getList();
-		if(CollectionUtils.isNotEmpty(list) && list.size() > 0){
-			for(CmCouponRecord c:list){
-				//获取分享者名字
-				Integer userId = c.getUserId();
-				CmUser user = cmUserDao.get(String.valueOf(userId));
-				if(null != user){
-					c.setClubName(user.getUserName());
-				}
-
-				Integer sharerUserId = c.getSharerUserId();
-				if(null != sharerUserId){//该优惠券已被分享
-					CmUser cmUser = cmUserDao.get(String.valueOf(sharerUserId));
-					if(null != cmUser){
-						//企业和员工只存在一个人分享,二选一
-						String registerUserTypeID = cmUser.getRegisterUserTypeID();//注册用户类型3会所企业,23会所经理,33会所员工
-						if("3".equals(registerUserTypeID)){//3会所企业
-							c.setCompanyName(cmUser.getUserName());
-						}else{//员工(如果是员工则设置员工名字和企业名字)
-							String nick = cmUser.getNick();
-							if(StringUtils.isEmpty(nick)){
-								nick = cmUser.getUserName();
-								if(StringUtils.isEmpty(nick)){
-									nick = cmUser.getName();
-								}
-							}
-							c.setStaffName(nick);
-						}
-					}
-				}
-
-				//判断除已使用状态外是否存在过期优惠券(状态 1已发放 2已分享 3已使用)
-				String status = c.getStatus();
-				if(!StringUtils.equals("3",status)){
-					Date useEndDate = c.getUseEndDate();
-					int res = useEndDate.compareTo(new Date());//相等则返回0,useEndDate大返回1,否则返回-1;
-					if(res < 0){
-						c.setStatus("4");//显示状态4已过期
-					}
-				}
-			}
-		}
-		List<CmCoupon> cmCoupons = cmCouponService.statisticsCoupon();
-		model.addAttribute("page", page);
-		model.addAttribute("cmCoupons", cmCoupons);
-		return "modules/coupon/cmCouponRecordList";
-	}
-
-	@RequiresPermissions("coupon:cmCouponRecord:view")
-	@RequestMapping(value = "form")
-	public String form(CmCouponRecord cmCouponRecord, Model model) {
-		model.addAttribute("cmCouponRecord", cmCouponRecord);
-		return "modules/coupon/cmCouponRecordForm";
-	}
-
-	@RequiresPermissions("coupon:cmCouponRecord:edit")
-	@RequestMapping(value = "save")
-	public String save(CmCouponRecord cmCouponRecord, Model model, RedirectAttributes redirectAttributes) {
-		if (!beanValidator(model, cmCouponRecord)){
-			return form(cmCouponRecord, model);
-		}
-		cmCouponRecordService.save(cmCouponRecord);
-		addMessage(redirectAttributes, "保存采美优惠券使用记录表成功");
-		return "redirect:"+Global.getAdminPath()+"/coupon/cmCouponRecord/?repage";
-	}
-	
-	@RequiresPermissions("coupon:cmCouponRecord:delete")
-	@RequestMapping(value = "delete")
-	public String delete(CmCouponRecord cmCouponRecord, RedirectAttributes redirectAttributes) {
-		cmCouponRecordService.delete(cmCouponRecord);
-		addMessage(redirectAttributes, "删除采美优惠券使用记录表成功");
-		return "redirect:"+Global.getAdminPath()+"/coupon/cmCouponRecord/?repage";
-	}
-
-}

+ 0 - 153
src/main/java/com/caimei/modules/coupon/web/CmCouponRecordScanController.java

@@ -1,153 +0,0 @@
-package com.caimei.modules.coupon.web;
-
-import javax.annotation.Resource;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import com.caimei.modules.coupon.entity.CmCoupon;
-import com.caimei.modules.coupon.service.CmCouponService;
-import com.caimei.modules.user.dao.CmUserDao;
-import com.google.common.collect.Maps;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.shiro.authz.annotation.RequiresPermissions;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
-import org.springframework.ui.Model;
-import org.springframework.web.bind.annotation.ModelAttribute;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.ResponseBody;
-import org.springframework.web.servlet.mvc.support.RedirectAttributes;
-import com.thinkgem.jeesite.common.config.Global;
-import com.thinkgem.jeesite.common.persistence.Page;
-import com.thinkgem.jeesite.common.web.BaseController;
-import com.thinkgem.jeesite.common.utils.StringUtils;
-import com.caimei.modules.coupon.entity.CmCouponRecordScan;
-import com.caimei.modules.coupon.service.CmCouponRecordScanService;
-
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-
-/**
- * 扫码推送优惠券Controller
- * @author LiJun
- * @version 2018-11-22
- */
-@Controller
-@RequestMapping(value = "${adminPath}/coupon/cmCouponRecordScan")
-public class CmCouponRecordScanController extends BaseController {
-
-	@Autowired
-	private CmCouponRecordScanService cmCouponRecordScanService;
-	@Autowired
-	private CmUserDao cmUserDao;
-	@Resource
-	private CmCouponService cmCouponService;
-	
-	@ModelAttribute
-	public CmCouponRecordScan get(@RequestParam(required=false) String id) {
-		CmCouponRecordScan entity = null;
-		if (StringUtils.isNotBlank(id)){
-			entity = cmCouponRecordScanService.get(id);
-		}
-		if (entity == null){
-			entity = new CmCouponRecordScan();
-		}
-		return entity;
-	}
-	
-	@RequiresPermissions("coupon:cmCouponRecordScan:view")
-	@RequestMapping(value = {"list", ""})
-	public String list(CmCouponRecordScan cmCouponRecordScan, HttpServletRequest request, HttpServletResponse response, Model model) {
-		Page<CmCouponRecordScan> page = cmCouponRecordScanService.findPage(new Page<CmCouponRecordScan>(request, response), cmCouponRecordScan); 
-		model.addAttribute("page", page);
-		return "modules/coupon/cmCouponRecordScanList";
-	}
-
-	/**
-	 * 公众号扫码优惠券列表
-	 * @param cmCouponRecordScan
-	 * @param request
-	 * @param response
-	 * @param model
-	 * @return
-	 */
-	@RequiresPermissions("coupon:cmCouponRecordScan:view")
-	@RequestMapping(value = {"scanCouponRecordList"})
-	public String scanCouponRecordList(CmCouponRecordScan cmCouponRecordScan, HttpServletRequest request, HttpServletResponse response, Model model) {
-		Page<CmCouponRecordScan> page = cmCouponRecordScanService.findPage(new Page<CmCouponRecordScan>(request, response), cmCouponRecordScan);
-		List<CmCouponRecordScan> list = page.getList();
-		if(CollectionUtils.isNotEmpty(list) && list.size() > 0){
-			for(CmCouponRecordScan c:list){
-				//判断除已使用状态外是否存在过期优惠券(状态 1未领取(已推送) 2已领取(输入手机号) 3已分享(可多次分享 ) 4已使用)
-				String status = c.getStatus();
-				if(!StringUtils.equals("4",status)){
-					Date useEndDate = c.getUseEndDate();
-					int res = useEndDate.compareTo(new Date());//相等则返回0,useEndDate大返回1,否则返回-1;
-					if(res < 0){
-						c.setStatus("5");//显示状态5已过期
-					}
-				}
-			}
-		}
-		List<CmCoupon> cmCoupons = cmCouponService.statisticsCoupon();
-		CmCouponRecordScan enabled = cmCouponRecordScanService.getEnabledStatus();
-
-		model.addAttribute("page", page);
-		model.addAttribute("cmCoupons", cmCoupons);
-		model.addAttribute("enabled", enabled);
-		return "modules/coupon/cmCouponRecordScanList";
-	}
-
-
-	@RequiresPermissions("coupon:cmCouponRecordScan:view")
-	@RequestMapping(value = "form")
-	public String form(CmCouponRecordScan cmCouponRecordScan, Model model) {
-		model.addAttribute("cmCouponRecordScan", cmCouponRecordScan);
-		return "modules/coupon/cmCouponRecordScanForm";
-	}
-
-	@RequiresPermissions("coupon:cmCouponRecordScan:edit")
-	@RequestMapping(value = "save")
-	public String save(CmCouponRecordScan cmCouponRecordScan, Model model, RedirectAttributes redirectAttributes) {
-		if (!beanValidator(model, cmCouponRecordScan)){
-			return form(cmCouponRecordScan, model);
-		}
-		cmCouponRecordScanService.save(cmCouponRecordScan);
-		addMessage(redirectAttributes, "保存成功");
-		return "redirect:"+Global.getAdminPath()+"/coupon/cmCouponRecordScan/?repage";
-	}
-	
-	@RequiresPermissions("coupon:cmCouponRecordScan:delete")
-	@RequestMapping(value = "delete")
-	public String delete(CmCouponRecordScan cmCouponRecordScan, RedirectAttributes redirectAttributes) {
-		cmCouponRecordScanService.delete(cmCouponRecordScan);
-		addMessage(redirectAttributes, "删除成功");
-		return "redirect:"+Global.getAdminPath()+"/coupon/cmCouponRecordScan/?repage";
-	}
-
-	/**
-	 * 批量修改启用、停用状态
-	 * @param enabledStatus
-	 * @param request
-	 * @param response
-	 * @return
-	 */
-	@RequiresPermissions("coupon:cmCouponRecordScan:edit")
-	@ResponseBody
-	@RequestMapping(value="updateEnabledStatus")
-	public Map<String, Object> updateEnabledStatus(String enabledStatus, HttpServletRequest request, HttpServletResponse response){
-		Map<String, Object> map = Maps.newLinkedHashMap();
-		try {
-			cmCouponRecordScanService.updateEnabledStatus(enabledStatus);//开关状态:0:启动,1:关闭
-			map.put("success",true);
-			map.put("msg", "修改成功");
-		} catch (Exception e) {
-			logger.debug(e.toString(),e);
-			map.put("success",false);
-			map.put("msg", "修改失败");
-		}
-		return map;
-	}
-
-}

+ 46 - 44
src/main/java/com/caimei/modules/product/service/CmIkDictService.java

@@ -1,20 +1,19 @@
 package com.caimei.modules.product.service;
 
-import java.util.Date;
-import java.util.List;
-
-import com.caimei.modules.coupon.entity.CmCouponRecordScan;
+import com.caimei.modules.product.dao.CmIkDictDao;
+import com.caimei.modules.product.entity.CmIkDict;
+import com.thinkgem.jeesite.common.persistence.Page;
+import com.thinkgem.jeesite.common.service.CrudService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import com.thinkgem.jeesite.common.persistence.Page;
-import com.thinkgem.jeesite.common.service.CrudService;
-import com.caimei.modules.product.entity.CmIkDict;
-import com.caimei.modules.product.dao.CmIkDictDao;
+import java.util.Date;
+import java.util.List;
 
 /**
  * IK扩展字典信息Service
+ *
  * @author zcp
  * @version 2017-11-22
  */
@@ -22,43 +21,46 @@ import com.caimei.modules.product.dao.CmIkDictDao;
 @Transactional(readOnly = false)
 public class CmIkDictService extends CrudService<CmIkDictDao, CmIkDict> {
 
-	@Autowired
-	CmIkDictDao cmIkDictDao;
-	public CmIkDict get(String id) {
-		return super.get(id);
-	}
-	
-	public List<CmIkDict> findList(CmIkDict cmIkDict) {
-		return super.findList(cmIkDict);
-	}
-	
-	public Page<CmIkDict> findPage(Page<CmIkDict> page, CmIkDict cmIkDict) {
-		return super.findPage(page, cmIkDict);
-	}
-	
-	@Transactional(readOnly = false)
-	public void save(CmIkDict cmIkDict) {
-		super.save(cmIkDict);
-	}
-	@Transactional(readOnly = false)
-	public void update(CmIkDict cmIkDict) {
-		cmIkDictDao.update(cmIkDict);
-	}
-	@Transactional(readOnly = false)
-	public void delete(CmIkDict cmIkDict) {
-		super.delete(cmIkDict);
-	}
+    @Autowired
+    CmIkDictDao cmIkDictDao;
+
+    public CmIkDict get(String id) {
+        return super.get(id);
+    }
+
+    public List<CmIkDict> findList(CmIkDict cmIkDict) {
+        return super.findList(cmIkDict);
+    }
+
+    public Page<CmIkDict> findPage(Page<CmIkDict> page, CmIkDict cmIkDict) {
+        return super.findPage(page, cmIkDict);
+    }
+
+    @Transactional(readOnly = false)
+    public void save(CmIkDict cmIkDict) {
+        super.save(cmIkDict);
+    }
+
+    @Transactional(readOnly = false)
+    public void update(CmIkDict cmIkDict) {
+        cmIkDictDao.update(cmIkDict);
+    }
+
+    @Transactional(readOnly = false)
+    public void delete(CmIkDict cmIkDict) {
+        super.delete(cmIkDict);
+    }
+
+    public void updateEnabledStatus(String enabledStatus) {
+        cmIkDictDao.updateEnabledStatus(enabledStatus);
+    }
 
-	public void updateEnabledStatus(String enabledStatus){
-		cmIkDictDao.updateEnabledStatus(enabledStatus);
-	}
+    public Integer getEnabledStatus() {
+        return cmIkDictDao.getEnabledStatus();
+    }
 
-	public Integer getEnabledStatus(){
-		return  cmIkDictDao.getEnabledStatus();
-	}
+    public Date getEnabledTime() {
+        return cmIkDictDao.getEnabledTime();
+    }
 
-	public Date getEnabledTime(){
-		return  cmIkDictDao.getEnabledTime();
-	}
-	
 }

+ 9 - 0
src/main/java/com/caimei/modules/user/entity/CmUser.java

@@ -107,6 +107,7 @@ public class CmUser extends DataEntity<CmUser> {
     private String province; //省
     private String address;        // 详细地址
     private boolean pending = false; //是否有待审核提现
+    private String shortName;   //机构简称
 
     public CmUser() {
         super();
@@ -834,4 +835,12 @@ public class CmUser extends DataEntity<CmUser> {
     public void setPending(boolean pending) {
         this.pending = pending;
     }
+
+    public String getShortName() {
+        return shortName;
+    }
+
+    public void setShortName(String shortName) {
+        this.shortName = shortName;
+    }
 }

+ 10 - 1
src/main/java/com/caimei/modules/user/entity/NewCmShop.java

@@ -112,7 +112,7 @@ public class NewCmShop extends DataEntity<NewCmShop> {
     private String productionLicense;//生产许可
     private String sanitationPermit;//卫生许可
     private String taxPermit;//税务许可
-	private String commercialCode; //分账方,子商户商编
+    private String commercialCode; //分账方,子商户商编
     private String socialCreditCode; //统一社会信用代码
 
     /**
@@ -127,6 +127,7 @@ public class NewCmShop extends DataEntity<NewCmShop> {
     private String endTime;        //注册时间结束  查询条件
     private String editStatus;//1编辑,2审核
     private String source; //注册来源: 0网站 1小程序
+    private boolean choose = false; //选择框是否置灰
 
 
     public NewCmShop() {
@@ -1047,4 +1048,12 @@ public class NewCmShop extends DataEntity<NewCmShop> {
     public void setWxApplets(String wxApplets) {
         this.wxApplets = wxApplets;
     }
+
+    public boolean isChoose() {
+        return choose;
+    }
+
+    public void setChoose(boolean choose) {
+        this.choose = choose;
+    }
 }

+ 0 - 191
src/main/resources/mappings/modules/coupon/CmCouponClubMapper.xml

@@ -1,191 +0,0 @@
-<?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.caimei.modules.coupon.dao.CmCouponClubDao">
-    
-	<sql id="cmCouponClubColumns">
-		a.id AS "id",
-		a.clubId AS "clubId",
-		a.name AS "name",
-		a.sname AS "sname",
-		a.linkMan AS "linkMan",
-		a.contractMobile AS "contractMobile",
-		a.signDate AS "signDate",
-		a.status AS "status",
-		a.createBy AS "createBy.id",
-		a.createDate AS "createDate",
-		a.updateBy AS "updateBy.id",
-		a.updateDate AS "updateDate",
-		a.delFlag AS "delFlag"
-	</sql>
-	
-	<sql id="cmCouponClubJoins">
-	</sql>
-    
-	<select id="get" resultType="CmCouponClub">
-		SELECT 
-			<include refid="cmCouponClubColumns"/>
-		FROM cm_coupon_club a
-		<include refid="cmCouponClubJoins"/>
-		WHERE a.id = #{id}
-	</select>
-	
-	<select id="findList" resultType="CmCouponClub">
-		SELECT
-			<include refid="cmCouponClubColumns"/>
-		,u.userID AS "userID"
-		FROM cm_coupon_club a
-		LEFT JOIN user u ON u.userID = a.userID
-		<include refid="cmCouponClubJoins"/>
-		<where>
-			<if test="status != null and status != ''">
-				AND a.status = #{status}
-			</if>
-			<if test="name != null and name != ''">
-				AND a.name LIKE 
-					<if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
-					<if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
-					<if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
-			</if>
-			<if test="startTime != null and startTime != ''">
-				AND (a.signDate &gt; #{startTime} OR a.signDate = #{startTime})
-			</if>
-			<if test="endTime != null and endTime != ''">
-				AND (a.signDate &lt; #{endTime} OR  a.signDate = #{endTime})
-			</if>
-			AND a.delFlag = 0
-		</where>
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-				ORDER BY a.createDate DESC
-			</otherwise>
-		</choose>
-	</select>
-	
-	<select id="findAllList" resultType="CmCouponClub">
-		SELECT 
-			<include refid="cmCouponClubColumns"/>
-		FROM cm_coupon_club a
-		<include refid="cmCouponClubJoins"/>
-		<where>
-			
-		</where>		
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-			</otherwise>
-		</choose>
-	</select>
-	
-	<insert id="insert" parameterType="CmCouponClub"  keyProperty="id" useGeneratedKeys="true">
-		INSERT INTO cm_coupon_club(
-			id,
-			clubId,
-			userID,
-			name,
-			sname,
-			linkMan,
-			contractMobile,
-			signDate,
-			status,
-			createBy,
-			createDate,
-			updateBy,
-			updateDate,
-			delFlag
-		) VALUES (
-			#{id},
-			#{clubId},
-			#{userID},
-			#{name},
-			#{sname},
-			#{linkMan},
-			#{contractMobile},
-			#{signDate},
-			#{status},
-			#{createBy.id},
-			#{createDate},
-			#{updateBy.id},
-			#{updateDate},
-			#{delFlag}
-		)
-	</insert>
-	
-	<update id="update">
-		UPDATE cm_coupon_club SET 	
-			clubId = #{clubId},
-		<if test="userID != null and userID != ''">
-			userID = #{userID},
-		</if>
-		<if test="name != null and name != ''">
-			name = #{name},
-		</if>
-		<if test="sname != null and sname != ''">
-			sname = #{sname},
-		</if>
-		<if test="linkMan != null and linkMan != ''">
-			linkMan = #{linkMan},
-		</if>
-		<if test="contractMobile != null and contractMobile != ''">
-			contractMobile = #{contractMobile},
-		</if>
-		<if test="signDate != null and signDate != ''">
-			signDate = #{signDate},
-		</if>
-		<if test="status != null and status != ''">
-			status = #{status},
-		</if>
-        <if test="delFlag != null and delFlag != ''">
-            delFlag = #{delFlag},
-        </if>
-			createBy = #{createBy.id},
-			createDate = #{createDate},
-			updateBy = #{updateBy.id},
-		updateDate = #{updateDate}
-		WHERE id = #{id}
-	</update>
-	
-	<delete id="delete">
-		DELETE FROM cm_coupon_club
-		WHERE id = #{id}
-	</delete>
-
-	<update id="deleteCmCouponClub">
-		UPDATE cm_coupon_club SET
-			delFlag = 1
-		WHERE id = #{id}
-	</update>
-
-	<select id="getAllClubID" resultType="int">
-		select clubId from cm_coupon_club where delFlag = 0
-	</select>
-
-	<!--只查询企业会所-->
-	<select id="getClubList" resultType="NewCmClub">
-		SELECT c.clubID, c.name, c.sname, c.linkMan, c.contractMobile
-		From user u  LEFT JOIN club c ON c.clubID = u.clubID
-		<where>
-			<if test="clubID != null and clubID != ''">
-				AND c.clubID = #{clubID}
-			</if>
-			<if test="name != null and name != ''">
-				AND c.name LIKE concat('%',#{name},'%')
-			</if>
-			AND not exists(select cc.clubId from cm_coupon_club cc where cc.delFlag = 0 and cc.clubId = c.clubID)
-			AND c.status = 90
-			AND u.registerUserTypeID=3
-		</where>
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-				ORDER BY c.clubID DESC
-			</otherwise>
-		</choose>
-	</select>
-</mapper>

+ 256 - 142
src/main/resources/mappings/modules/coupon/CmCouponMapper.xml

@@ -4,20 +4,20 @@
     
 	<sql id="cmCouponColumns">
 		a.id AS "id",
-		a.couponCode AS "couponCode",
+		a.name AS "name",
 		a.couponAmount AS "couponAmount",
-		a.useStartDate AS "useStartDate",
-		a.useEndDate AS "useEndDate",
+		a.touchPrice AS "touchPrice",
+		a.startDate AS "startDate",
+		a.endDate AS "endDate",
 		a.status AS "status",
-		a.discount AS "discount",
 		a.couponType AS "couponType",
-		a.couponlimit AS "couponlimit",
-		a.threshold AS "threshold",
-		a.useDescription AS "useDescription",
-		a.createBy AS "createBy.id",
+		a.userId AS "userId",
+		a.productType AS "productType",
+		a.pcBanner AS "pcBanner",
+		a.appletsBanner AS "appletsBanner",
+		a.categoryType AS "categoryType",
+		a.couponsMode AS "couponsMode",
 		a.createDate AS "createDate",
-		a.updateBy AS "updateBy.id",
-		a.updateDate AS "updateDate",
 		a.delFlag AS "delFlag"
 	</sql>
 	
@@ -34,60 +34,75 @@
 	
 	<select id="findList" resultType="CmCoupon">
 		SELECT 
-			<include refid="cmCouponColumns"/>
-		FROM cm_coupon a
-		<include refid="cmCouponJoins"/>
-		<where>
-			
-		</where>
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-			</otherwise>
-		</choose>
-	</select>
-
-
-	<select id="findCouponList" resultType="CmCoupon">
-		SELECT
-		<include refid="cmCouponColumns"/>
-		,count(*) AS "laveNum"
+			<include refid="cmCouponColumns"/>,u.name AS clubName
 		FROM cm_coupon a
+		LEFT JOIN cm_coupon_associate cca ON cca.couponId = a.id
+		LEFT JOIN cm_coupon_club ccc ON ccc.couponId = a.id
+		LEFT JOIN USER u ON u.userID = a.userId
+		LEFT JOIN shop s ON s.shopID = cca.shopId
 		<include refid="cmCouponJoins"/>
 		<where>
-			AND status = 0
-			AND a.useEndDate <![CDATA[  >  ]]> NOW()
-			GROUP BY couponAmount,threshold,couponType
+			AND a.delFlag = 0
+			<if test="couponType != null">
+				AND a.couponType = #{couponType}
+			</if>
+			<if test="name != null and name != ''">
+				AND a.name LIKE 
+					<if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
+					<if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
+					<if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
+			</if>
+			<if test="startDate != null and startDate != ''">
+				AND a.startDate <![CDATA[ >= ]]> #{startDate}
+			</if>
+			<if test="endDate != null and endDate != ''">
+				AND a.endDate <![CDATA[ <= ]]> #{endDate}
+			</if>
+			<if test='status == "0"'>
+				AND a.startDate <![CDATA[ > ]]> NOW()
+			</if>
+			<if test='status == "1"'>
+				AND a.startDate <![CDATA[ <= ]]> NOW()
+				AND a.endDate <![CDATA[ >= ]]> NOW()
+			</if>
+			<if test='status == "2"'>
+				AND a.status = '2'
+			</if>
+			<if test='status == "3"'>
+				AND a.endDate <![CDATA[ < ]]> NOW()
+			</if>
+			<if test="clubName != null and clubName != ''">
+				AND u.name LIKE concat('%',#{clubName},'%')
+			</if>
+			<if test='claimStatus == "1"'>
+				AND ccc.id IS NULL
+			</if>
+			<if test='claimStatus == "2"'>
+				AND ccc.id IS NOT NULL
+			</if>
+			<if test='useStatus == "1"'>
+				AND (ccc.status IS NULL OR ccc.status = #{useStatus})
+			</if>
+			<if test='useStatus == "2"'>
+				AND ccc.status = #{useStatus}
+			</if>
+			<if test="source != null and source != ''">
+				AND ccc.source = #{source}
+			</if>
+			<if test="shopName != null and shopName != ''">
+				AND s.name LIKE concat('%',#{shopName},'%')
+			</if>
 		</where>
+			GROUP BY a.id
 		<choose>
 			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
 				ORDER BY ${page.orderBy}
 			</when>
 			<otherwise>
+				ORDER BY createDate DESC
 			</otherwise>
 		</choose>
 	</select>
-
-
-	<select id="getSendCoupon" resultType="CmCoupon">
-		SELECT
-		<include refid="cmCouponColumns"/>
-		FROM cm_coupon a
-		<include refid="cmCouponJoins"/>
-		<where>
-			AND status = 0
-			AND a.useEndDate <![CDATA[  >  ]]> NOW()
-			AND a.couponAmount = #{couponAmount}
-			AND a.couponType = #{couponType}
-			<if test="threshold != null and threshold != ''">
-				AND a.threshold = #{threshold}
-			</if>
-			LIMIT #{num}
-		</where>
-	</select>
-
 	
 	<select id="findAllList" resultType="CmCoupon">
 		SELECT 
@@ -108,126 +123,225 @@
 	
 	<insert id="insert" parameterType="CmCoupon"  keyProperty="id" useGeneratedKeys="true">
 		INSERT INTO cm_coupon(
-			id,
-			couponCode,
+			name,
 			couponAmount,
-			useStartDate,
-			useEndDate,
+			touchPrice,
+			startDate,
+			endDate,
 			status,
-			discount,
 			couponType,
-			couponlimit,
-			threshold,
-			useDescription,
-			createBy,
+			userId,
+			productType,
+			pcBanner,
+			appletsBanner,
+			categoryType,
+			couponsMode,
 			createDate,
-			updateBy,
-			updateDate,
 			delFlag
 		) VALUES (
-			#{id},
-			#{couponCode},
+			#{name},
 			#{couponAmount},
-			#{useStartDate},
-			#{useEndDate},
+			#{touchPrice},
+			#{startDate},
+			#{endDate},
 			#{status},
-			#{discount},
 			#{couponType},
-			#{couponlimit},
-			#{threshold},
-			#{useDescription},
-			#{createBy.id},
+			#{userId},
+			#{productType},
+			#{pcBanner},
+			#{appletsBanner},
+			#{categoryType},
+			#{couponsMode},
 			#{createDate},
-			#{updateBy.id},
-			#{updateDate},
 			#{delFlag}
 		)
 	</insert>
 	
 	<update id="update">
-		UPDATE cm_coupon SET
-		<if test="couponCode != null and couponCode != ''">
-			couponCode = #{couponCode},
-		</if>
-		<if test="couponAmount != null and couponAmount != ''">
+		UPDATE cm_coupon SET 	
+			name = #{name},
 			couponAmount = #{couponAmount},
-		</if>
-		<if test="useStartDate != null and useStartDate != ''">
-			useStartDate = #{useStartDate},
-		</if>
-		<if test="useEndDate != null and useEndDate != ''">
-			useEndDate = #{useEndDate},
-		</if>
-		<if test="status != null and status != ''">
+			touchPrice = #{touchPrice},
+			startDate = #{startDate},
+			endDate = #{endDate},
 			status = #{status},
-		</if>
-		<if test="discount != null and discount != ''">
-			discount = #{discount},
-		</if>
-		<if test="couponType != null and couponType != ''">
 			couponType = #{couponType},
-		</if>
-		<if test="couponlimit != null and couponlimit != ''">
-			couponlimit = #{couponlimit},
-		</if>
-		<if test="threshold != null and threshold != ''">
-			threshold = #{threshold},
-		</if>
-		<if test="useDescription != null and useDescription != ''">
-			useDescription = #{useDescription},
-		</if>
-		<if test="createBy != null and createBy != ''">
-			createBy = #{createBy.id},
-		</if>
-		<if test="createDate != null and createDate != ''">
-			createDate = #{createDate},
-		</if>
-		<if test="updateBy != null and updateBy != ''">
-			updateBy = #{updateBy.id},
-		</if>
-		<if test="updateDate != null and updateDate != ''">
-			updateDate = #{updateDate},
-		</if>
-		<if test="delFlag != null and delFlag != ''">
-			delFlag = #{delFlag}
-		</if>
+			userId = #{userId},
+			productType = #{productType},
+			pcBanner = #{pcBanner},
+			appletsBanner = #{appletsBanner},
+			categoryType = #{categoryType},
+			couponsMode = #{couponsMode}
 		WHERE id = #{id}
 	</update>
-
-	<update id="updateStatus">
-		UPDATE cm_coupon SET
-		status = #{status},
-		updateDate = #{updateDate}
-		WHERE couponCode = #{couponCode}
-	</update>
 	
 	<delete id="delete">
 		DELETE FROM cm_coupon
 		WHERE id = #{id}
 	</delete>
 
-	<!--状态: 0未派发 1已发放 2已分享 3已使用 4已领取[0/1/2/3状态公众号推送劵,后台派发劵两种方式共用 4公众号推送使用-->
-	<!--1.过期值存在于已分享或者已发放状态,已使用不能计算过期、2.剩余优惠券数量只能是有效的-->
-	<select id="statisticsCoupon" resultType="CmCoupon">
+	<select id="findByProductType" resultType="com.caimei.modules.coupon.entity.CmCouponAssociate">
 		SELECT
-		c.couponType AS couponType,
-		c.couponAmount AS couponAmount,
-		sum((CASE WHEN c.status = '0' AND (c.useEndDate <![CDATA[  >  ]]> NOW()) then 1 else 0 END)) AS lastAmount,
-		sum((CASE WHEN c.status = '2' then 1 else 0 END)) AS shareAmount,
-		sum((CASE WHEN c.status = '3' then 1 else 0 END)) AS usedAmount,
-		sum(if(c.status != 3,(CASE WHEN c.useEndDate <![CDATA[  <  ]]> NOW() then 1 else 0 END ),0)) AS timeOutAmount,
-		sum((CASE WHEN ccrs.status = '1' then 1 else 0 END)) AS unReceiveNum
+		  cca.id,
+		  cca.couponId,
+		  cca.productId,
+		  cca.pcStatus,
+		  cca.appletsStatus,
+		  cca.shopId,
+		  cca.sort,
+		  cca.addTime,
+		  cca.delFlag,
+		  s.name AS shopName,
+		  p.name AS productName,
+		  p.mainImage AS image
 		FROM
-		cm_coupon c
-		LEFT JOIN cm_coupon_record_scan ccrs ON ccrs.couponCode = c.couponCode
-		GROUP BY
-		c.couponType,
-		c.couponAmount;
+		  cm_coupon_associate cca
+		  LEFT JOIN product p ON cca.productId = p.productID
+		  LEFT JOIN shop s ON p.shopID = s.shopID
+		WHERE
+		  cca.couponId = #{couponId}
+		  AND delFlag = 0
+		ORDER BY
+		  - sort DESC
+	</select>
+
+	<insert id="insertCouponAssociate">
+		INSERT INTO `cm_coupon_associate` (
+		  `couponId`, `productId`, `pcStatus`,
+		  `appletsStatus`, `shopId`,
+		  `sort`, `addTime`, `delFlag`
+		)
+		VALUES
+		  (
+			#{couponId}, #{productId}, #{pcStatus},
+			#{appletsStatus}, #{shopId},
+			#{sort}, #{addTime}, #{delFlag}
+		  )
+	</insert>
+
+	<select id="findByCouponId" resultType="integer">
+		SELECT id FROM cm_coupon_associate WHERE couponId = #{couponId} AND delFlag = 0
 	</select>
 
-	<select id="findByCouponCode" resultType="CmCoupon">
-		select <include refid="cmCouponColumns"/>
-		from cm_coupon a where a.couponCode = #{couponCode}
+	<update id="updateCouponAssociate">
+		UPDATE
+		  `cm_coupon_associate`
+		<set>
+		  <if test="pcStatus != null and pcStatus != ''">
+				`pcStatus` = #{pcStatus},
+		  </if>
+		  <if test="appletsStatus != null and appletsStatus != ''">
+			  `appletsStatus` = #{appletsStatus},
+		  </if>
+		  <if test="sort != null">
+			  `sort` = #{sort},
+		  </if>
+		</set>
+		WHERE
+		  `id` = #{id}
+	</update>
+
+	<update id="logicDeleteCouponAssociate">
+		UPDATE cm_coupon_associate SET delFlag = 1 WHERE id = #{id}
+	</update>
+
+	<update id="updateByDelFlag">
+		UPDATE cm_coupon SET delFlag = 1 WHERE id = #{couponId}
+	</update>
+
+	<update id="updateAssociateByDelFlag">
+		UPDATE cm_coupon_associate SET delFlag = 1 WHERE couponId = #{couponId}
+	</update>
+
+	<select id="findCouponClub" resultType="com.caimei.modules.coupon.entity.CmCouponClub">
+		SELECT
+		  `userId`,
+		  `couponId`,
+		  `source`,
+		  `status`,
+		  `createDate`,
+		  `useDate`,
+		  `delFlag`
+		FROM
+		  `cm_coupon_club`
+		WHERE
+		  couponId = #{couponId}
+		  AND delFlag = 0
+		LIMIT
+		  1
+	</select>
+
+	<select id="findUserList" resultType="com.caimei.modules.user.entity.CmUser">
+		SELECT
+			u.clubID,
+			u.userID,
+			u.userName,
+			u.bindMobile,
+			u.name,
+			u.userIdentity,
+			c.sname AS shortName
+		FROM
+			club c
+		LEFT JOIN USER u ON c.userID = u.userID
+		WHERE
+		  c.status IN (1, 90)
+		  <if test="userID != null">
+			  AND u.userID = #{userID}
+		  </if>
+		  <if test="name != null and name != ''">
+			  AND u.name LIKE CONCAT('%',#{name},'%')
+		  </if>
+		  <if test="shortName != null and shortName != ''">
+			AND c.sname LIKE CONCAT('%',#{shortName},'%')
+		  </if>
+		ORDER BY
+		  userID ASC
+	</select>
+
+	<select id="findShopList" resultType="com.caimei.modules.user.entity.NewCmShop">
+		SELECT
+		  s.shopID,
+		  s.userID,
+		  IFNULL(s.name, u.name) AS name,
+		  IFNULL(s.sname, u.realName) AS sname,
+		  IFNULL(s.contractMobile, u.bindMobile) AS contractMobile,
+		  IFNULL(s.linkMan, u.userName) AS linkMan
+		FROM
+		  shop s
+		  LEFT JOIN USER u ON u.`shopID` = s.`shopID`
+		WHERE
+		  s.status = 90
+		  <if test="shopID != null">
+			AND s.shopID = #{shopID}
+		  </if>
+		  <if test="name != null and name != ''">
+			AND (s.name LIKE CONCAT('%',#{name},'%') OR	u.name LIKE CONCAT('%',#{name},'%'))
+		  </if>
+		  <if test="sname != null and sname != ''">
+			AND (s.sname LIKE CONCAT('%',#{sname},'%') OR u.realName LIKE CONCAT('%',#{sname},'%'))
+		  </if>
+		ORDER BY
+		  s.shopID
+	</select>
+
+	<select id="findCouponShop" resultType="com.caimei.modules.user.entity.NewCmShop">
+		SELECT
+		  cca.id,
+		  s.shopID,
+		  s.userID,
+		  IFNULL(s.name, u.name) AS NAME,
+		  IFNULL(s.sname, u.realName) AS sname,
+		  IFNULL(s.contractMobile, u.bindMobile) AS contractMobile,
+		  IFNULL(s.linkMan, u.userName) AS linkMan
+		FROM
+		  cm_coupon_associate cca
+		  LEFT JOIN shop s ON s.shopID = cca.shopId
+		  LEFT JOIN USER u ON u.shopID = s.shopID
+		WHERE
+		  cca.delFlag = 0
+		  AND couponId = #{couponId}
+		ORDER BY
+		  cca.addTime DESC
 	</select>
 	
 </mapper>

+ 0 - 167
src/main/resources/mappings/modules/coupon/CmCouponOrderRecordMapper.xml

@@ -1,167 +0,0 @@
-<?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.caimei.modules.coupon.dao.CmCouponOrderRecordDao">
-    
-	<sql id="cmCouponOrderRecordColumns">
-		a.id AS "id",
-		a.orderCode AS "orderCode",
-		a.totalAmount AS "totalAmount",
-		a.refundAmount AS "refundAmount",
-		a.paymentTime AS "paymentTime",
-		a.refundTime AS "refundTime",
-		a.couponCode AS "couponCode",
-		a.discountAmount AS "discountAmount",
-		a.status AS "status",
-		a.customerCode AS "customerCode",
-		a.customerName AS "customerName",
-		a.customerMobile AS "customerMobile",
-		a.refundFlag AS "refundFlag",
-		a.createTime AS "createTime",
-		a.updateTime AS "updateTime",
-		a.delFlag AS "delFlag",
-		u.userName AS "clubName",
-		ccrs.mobile AS "couponMobile"
-	</sql>
-	
-	<sql id="cmCouponOrderRecordJoins">
-		LEFT JOIN cm_coupon_record ccr ON ccr.couponCode = a.couponCode
-		LEFT JOIN cm_coupon_record_scan ccrs ON ccrs.couponCode = a.couponCode
-		LEFT JOIN user u ON u.userID = ccr.userID
-		LEFT JOIN club c on c.userID = u.companyUserID
-	</sql>
-    
-	<select id="get" resultType="CmCouponOrderRecord">
-		SELECT 
-			<include refid="cmCouponOrderRecordColumns"/>
-		FROM cm_coupon_order_record a
-		<include refid="cmCouponOrderRecordJoins"/>
-		WHERE a.id = #{id}
-	</select>
-	
-	<select id="findList" resultType="CmCouponOrderRecord">
-		SELECT 
-			<include refid="cmCouponOrderRecordColumns"/>
-		FROM cm_coupon_order_record a
-		<include refid="cmCouponOrderRecordJoins"/>
-		<where>
-			
-			<if test="orderCode != null and orderCode != ''">
-				AND a.orderCode = #{orderCode}
-			</if>
-			<if test="clubName != null and clubName != ''">
-				AND (u.userName LIKE concat('%',#{clubName},'%') OR ccrs.mobile = #{clubName} OR  c.name LIKE concat('%',#{clubName},'%'))
-			</if>
-			<if test="startTime != null and startTime != ''">
-				AND a.paymentTime <![CDATA[  >=  ]]> #{startTime}
-			</if>
-			<if test="endTime != null and endTime != ''">
-				AND a.paymentTime <![CDATA[   <=  ]]> #{endTime}
-			</if>
-		</where>
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-				ORDER BY a.paymentTime DESC
-			</otherwise>
-		</choose>
-	</select>
-
-	<select id="findListBuyAgain" resultType="CmCouponOrderRecord">
-		SELECT
-		a.*,
-		u.username AS "clubName",
-		c.name AS "companyName",
-		ccrs.mobile AS "couponMobile"
-		FROM cm_coupon_order_record a
-		LEFT JOIN cm_coupon_record ccr ON ccr.couponCode = a.couponCode
-		LEFT JOIN cm_coupon_record_scan ccrs ON ccrs.couponCode = a.couponCode
-		LEFT JOIN user u ON u.userID = ccr.sharerUserId
-		LEFT JOIN club c on c.userID = u.companyUserID
-		WHERE
-		a.customerMobile = #{customerMobile}
-		AND ( c.name is NOT NULL OR  ccrs.mobile is NOT NULL )
-	</select>
-	
-	<select id="findAllList" resultType="CmCouponOrderRecord">
-		SELECT 
-			<include refid="cmCouponOrderRecordColumns"/>
-		FROM cm_coupon_order_record a
-		<include refid="cmCouponOrderRecordJoins"/>
-		<where>
-			
-		</where>		
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-			</otherwise>
-		</choose>
-	</select>
-	
-	<insert id="insert" parameterType="CmCouponOrderRecord"  keyProperty="id" useGeneratedKeys="true">
-		INSERT INTO cm_coupon_order_record(
-			id,
-			orderCode,
-			totalAmount,
-			refundAmount,
-			paymentTime,
-			refundTime,
-			couponCode,
-			discountAmount,
-			status,
-			customerCode,
-			customerName,
-			customerMobile,
-			refundFlag,
-			createTime,
-			updateTime,
-			delFlag
-		) VALUES (
-			#{id},
-			#{orderCode},
-			#{totalAmount},
-			#{refundAmount},
-			#{paymentTime},
-			#{refundTime},
-			#{couponCode},
-			#{discountAmount},
-			#{status},
-			#{customerCode},
-			#{customerName},
-			#{customerMobile},
-			#{refundFlag},
-			#{createTime},
-			#{updateTime},
-			#{delFlag}
-		)
-	</insert>
-	
-	<update id="update">
-		UPDATE cm_coupon_order_record SET 	
-			orderCode = #{orderCode},
-			totalAmount = #{totalAmount},
-			refundAmount = #{refundAmount},
-			paymentTime = #{paymentTime},
-			refundTime = #{refundTime},
-			couponCode = #{couponCode},
-			discountAmount = #{discountAmount},
-			status = #{status},
-			customerCode = #{customerCode},
-			customerName = #{customerName},
-			customerMobile = #{customerMobile},
-			refundFlag = #{refundFlag},
-			createTime = #{createTime},
-			updateTime = #{updateTime},
-			delFlag = #{delFlag}
-		WHERE id = #{id}
-	</update>
-	
-	<delete id="delete">
-		DELETE FROM cm_coupon_order_record
-		WHERE id = #{id}
-	</delete>
-	
-</mapper>

+ 0 - 170
src/main/resources/mappings/modules/coupon/CmCouponRecordMapper.xml

@@ -1,170 +0,0 @@
-<?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.caimei.modules.coupon.dao.CmCouponRecordDao">
-    
-	<sql id="cmCouponRecordColumns">
-		a.id AS "id",
-		a.couponCode AS "couponCode",
-		a.couponAmount AS "couponAmount",
-		a.useStartDate AS "useStartDate",
-		a.useEndDate AS "useEndDate",
-		a.status AS "status",
-		a.couponType AS "couponType",
-		a.threshold AS "threshold",
-		a.useDescription AS "useDescription",
-		a.relatedOrderCode AS "relatedOrderCode",
-		a.userId AS "userId",
-		a.sharerUserId AS "sharerUserId",
-		a.openid AS "openid",
-		a.receiveDate AS "receiveDate",
-		a.useDate AS "useDate",
-		a.createBy AS "createBy.id",
-		a.createDate AS "createDate",
-		a.updateBy AS "updateBy.id",
-		a.updateDate AS "updateDate",
-		a.delFlag AS "delFlag"
-	</sql>
-	
-	<sql id="cmCouponRecordJoins">
-	</sql>
-    
-	<select id="get" resultType="CmCouponRecord">
-		SELECT 
-			<include refid="cmCouponRecordColumns"/>
-		FROM cm_coupon_record a
-		<include refid="cmCouponRecordJoins"/>
-		WHERE a.id = #{id}
-	</select>
-
-	
-<!--存在处理显示已过期的状态4-->
-	<select id="findList" resultType="CmCouponRecord">
-		SELECT 
-			<include refid="cmCouponRecordColumns"/>
-		,ccro.orderCode AS "couponOrderCode"
-		FROM cm_coupon_record a
-		LEFT JOIN user u ON u.userID = a.userId
-		LEFT JOIN cm_coupon_order_record ccro ON ccro.couponCode = a.couponCode
-		<include refid="cmCouponRecordJoins"/>
-		<where>
-			<if test="status != null and status != ''">
-				<if test="status != 4 and status != 3">
-					AND a.status = #{status}
-					AND a.useEndDate <![CDATA[  >  ]]> NOW()
-				</if>
-				<if test="status == 3">
-					AND a.status = #{status}
-				</if>
-				<if test="status == 4">
-					AND a.status != 3
-					AND a.useEndDate <![CDATA[  <  ]]> NOW()
-				</if>
-			</if>
-			<if test="couponCode != null and couponCode != ''">
-				AND a.couponCode = #{couponCode}
-			</if>
-			<if test="id != null and id != ''">
-				AND a.id = #{id}
-			</if>
-			<if test="companyName != null and companyName != ''">
-				AND u.userName LIKE concat('%',#{companyName},'%')
-			</if>
-		</where>
-		GROUP BY a.couponCode
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-				ORDER BY a.createDate DESC
-			</otherwise>
-		</choose>
-	</select>
-	
-	<select id="findAllList" resultType="CmCouponRecord">
-		SELECT 
-			<include refid="cmCouponRecordColumns"/>
-		FROM cm_coupon_record a
-		<include refid="cmCouponRecordJoins"/>
-		<where>
-			
-		</where>		
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-			</otherwise>
-		</choose>
-	</select>
-	
-	<insert id="insert" parameterType="CmCouponRecord"  keyProperty="id" useGeneratedKeys="true">
-		INSERT INTO cm_coupon_record(
-			id,
-			couponCode,
-			couponAmount,
-			useStartDate,
-			useEndDate,
-			status,
-			couponType,
-			threshold,
-			useDescription,
-			relatedOrderCode,
-			userId,
-			receiveDate,
-			useDate,
-			createBy,
-			createDate,
-			updateBy,
-			updateDate,
-			delFlag
-		) VALUES (
-			#{id},
-			#{couponCode},
-			#{couponAmount},
-			#{useStartDate},
-			#{useEndDate},
-			#{status},
-			#{couponType},
-			#{threshold},
-			#{useDescription},
-			#{relatedOrderCode},
-			#{userId},
-			#{receiveDate},
-			#{useDate},
-			#{createBy.id},
-			#{createDate},
-			#{updateBy.id},
-			#{updateDate},
-			#{delFlag}
-		)
-	</insert>
-	
-	<update id="update">
-		UPDATE cm_coupon_record SET 	
-			couponCode = #{couponCode},
-			couponAmount = #{couponAmount},
-			useStartDate = #{useStartDate},
-			useEndDate = #{useEndDate},
-			status = #{status},
-			couponType = #{couponType},
-			threshold = #{threshold},
-			useDescription = #{useDescription},
-			relatedOrderCode = #{relatedOrderCode},
-			userId = #{userId},
-			receiveDate = #{receiveDate},
-			useDate = #{useDate},
-			createBy = #{createBy.id},
-			createDate = #{createDate},
-			updateBy = #{updateBy.id},
-			updateDate = #{updateDate},
-			delFlag = #{delFlag}
-		WHERE id = #{id}
-	</update>
-	
-	<delete id="delete">
-		DELETE FROM cm_coupon_record
-		WHERE id = #{id}
-	</delete>
-	
-</mapper>

+ 0 - 195
src/main/resources/mappings/modules/coupon/CmCouponRecordScanMapper.xml

@@ -1,195 +0,0 @@
-<?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.caimei.modules.coupon.dao.CmCouponRecordScanDao">
-    
-	<sql id="cmCouponRecordScanColumns">
-		a.id AS "id",
-		a.couponCode AS "couponCode",
-		a.couponAmount AS "couponAmount",
-		a.discount AS "discount",
-		a.useStartDate AS "useStartDate",
-		a.useEndDate AS "useEndDate",
-		a.status AS "status",
-		a.couponType AS "couponType",
-		a.threshold AS "threshold",
-		a.useDescription AS "useDescription",
-		a.relatedOrderCode AS "relatedOrderCode",
-		a.sharerUserId AS "sharerUserId",
-		a.openid AS "openid",
-		a.mobile AS "mobile",
-		a.receiveDate AS "receiveDate",
-		a.useDate AS "useDate",
-		a.createBy AS "createBy.id",
-		a.createDate AS "createDate",
-		a.updateBy AS "updateBy.id",
-		a.updateDate AS "updateDate",
-		a.delFlag AS "delFlag",
-		a.syncFlag AS "syncFlag"
-	</sql>
-	
-	<sql id="cmCouponRecordScanJoins">
-	</sql>
-    
-	<select id="get" resultType="CmCouponRecordScan">
-		SELECT 
-			<include refid="cmCouponRecordScanColumns"/>
-		FROM cm_coupon_record_scan a
-		<include refid="cmCouponRecordScanJoins"/>
-		WHERE a.id = #{id}
-	</select>
-
-	<!--存在处理显示已过期的状态5-->
-	<select id="findList" resultType="CmCouponRecordScan">
-		SELECT 
-			<include refid="cmCouponRecordScanColumns"/>
-		,ccro.orderCode AS "couponOrderCode"
-		FROM cm_coupon_record_scan a
-		LEFT JOIN cm_coupon_order_record ccro ON ccro.couponCode = a.couponCode
-		<include refid="cmCouponRecordScanJoins"/>
-		<where>
-			<if test="status != null and status != ''">
-				<if test="status != 5 and status != 4">
-					AND a.status = #{status}
-					AND a.useEndDate <![CDATA[  >  ]]> NOW()
-				</if>
-				<if test="status == 4">
-					AND a.status = #{status}
-				</if>
-				<if test="status == 5">
-					AND a.status != 4
-					AND a.useEndDate <![CDATA[  <  ]]> NOW()
-				</if>
-			</if>
-
-			<if test="couponCode != null and couponCode != ''">
-				AND a.couponCode = #{couponCode}
-			</if>
-			<if test="mobile != null and mobile != ''">
-				AND a.mobile = #{mobile}
-			</if>
-			<if test="id != null and id != ''">
-				AND a.id = #{id}
-			</if>
-		</where>
-		GROUP BY a.couponCode
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-				ORDER BY a.createDate DESC
-			</otherwise>
-		</choose>
-	</select>
-	
-	<select id="findAllList" resultType="CmCouponRecordScan">
-		SELECT 
-			<include refid="cmCouponRecordScanColumns"/>
-		FROM cm_coupon_record_scan a
-		<include refid="cmCouponRecordScanJoins"/>
-		<where>
-			
-		</where>		
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-			</otherwise>
-		</choose>
-	</select>
-	
-	<insert id="insert" parameterType="CmCouponRecordScan"  keyProperty="id" useGeneratedKeys="true">
-		INSERT INTO cm_coupon_record_scan(
-			id,
-			couponCode,
-			couponAmount,
-			discount,
-			useStartDate,
-			useEndDate,
-			status,
-			couponType,
-			threshold,
-			useDescription,
-			relatedOrderCode,
-			sharerUserId,
-			openid,
-			mobile,
-			receiveDate,
-			useDate,
-			createBy,
-			createDate,
-			updateBy,
-			updateDate,
-			delFlag,
-			syncFlag
-		) VALUES (
-			#{id},
-			#{couponCode},
-			#{couponAmount},
-			#{discount},
-			#{useStartDate},
-			#{useEndDate},
-			#{status},
-			#{couponType},
-			#{threshold},
-			#{useDescription},
-			#{relatedOrderCode},
-			#{sharerUserId},
-			#{openid},
-			#{mobile},
-			#{receiveDate},
-			#{useDate},
-			#{createBy.id},
-			#{createDate},
-			#{updateBy.id},
-			#{updateDate},
-			#{delFlag},
-			#{syncFlag}
-		)
-	</insert>
-	
-	<update id="update">
-		UPDATE cm_coupon_record_scan SET 	
-			couponCode = #{couponCode},
-			couponAmount = #{couponAmount},
-			discount = #{discount},
-			useStartDate = #{useStartDate},
-			useEndDate = #{useEndDate},
-			status = #{status},
-			couponType = #{couponType},
-			threshold = #{threshold},
-			useDescription = #{useDescription},
-			relatedOrderCode = #{relatedOrderCode},
-			sharerUserId = #{sharerUserId},
-			openid = #{openid},
-			mobile = #{mobile},
-			receiveDate = #{receiveDate},
-			useDate = #{useDate},
-			createBy = #{createBy.id},
-			createDate = #{createDate},
-			updateBy = #{updateBy.id},
-			updateDate = #{updateDate},
-			delFlag = #{delFlag},
-			syncFlag = #{syncFlag}
-		WHERE id = #{id}
-	</update>
-	
-	<delete id="delete">
-		DELETE FROM cm_coupon_record_scan
-		WHERE id = #{id}
-	</delete>
-
-	<update id="updateEnabledStatus">
-		UPDATE cm_coupon_scan_switch SET
-		status = #{enabledStatus}
-	</update>
-
-	<select id="getEnabledStatus" resultType="CmCouponRecordScan">
-		SELECT
-		*
-		FROM cm_coupon_scan_switch
-		WHERE id = 1
-	</select>
-
-</mapper>

+ 1 - 1
src/main/resources/mappings/modules/product/ProductMapper.xml

@@ -2362,7 +2362,7 @@
 			<if test="productCategory !=null and productCategory !=''">
 				AND a.productCategory=#{productCategory}
 			</if>
-			<if test="ids.size() > 0">
+			<if test="ids != null and ids.size() > 0">
 				AND a.productID NOT IN
 				<foreach collection="ids" close=")" separator="," open="(" item="id">
 					#{id}

+ 0 - 105
src/main/webapp/WEB-INF/views/modules/coupon/cmClubListBox.jsp

@@ -1,105 +0,0 @@
-<%@ page contentType="text/html;charset=UTF-8" %>
-<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
-<html>
-<head>
-	<title>会所信息管理</title>
-	<meta name="decorator" content="default"/>
-	<style type="text/css">
-		.table th{text-align: center;}
-		.table td{text-align: center;}
-	</style>
-	<script type="text/javascript">
-		$(document).ready(function() {
-			
-		});
-		function page(n,s){
-			$("#pageNo").val(n);
-			$("#pageSize").val(s);
-			$("#searchForm").submit();
-        	return false;
-        }
-
-        function checkNum() {
-            var clubID = $("#clubID").val();
-		    if(isNaN(clubID)){//如果不是数字则清空
-                $("#clubID").val("");
-			}
-        }
-
-        function allCkbfun(ckb){
-            var isChecked = ckb.checked;
-            $(".check-item").attr('checked', isChecked);
-        }
-        function getCheckedItems(){
-            var items = new Array();
-            var $items = $('.check-item:checked');
-            $items.each(function(){
-                items.push($(this).val());
-            });
-            return items;
-        }
-	</script>
-</head>
-<body>
-
-	<form:form id="searchForm" modelAttribute="newCmClub" action="${ctx}/coupon/cmCouponClub/showClubList" method="post" class="breadcrumb form-search">
-		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
-		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
-		<div class="ul-form">
-			 <label>会所ID:</label>
-			<form:input path="clubID" id="clubID" htmlEscape="false" maxlength="8" class="input-mini" onchange="checkNum()"/>
-			 <label>会所名称:</label>
-				<form:input path="name" htmlEscape="false" maxlength="50" class="input-medium"/>
-			&nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
-			<div class="clearfix"></div>
-		</div>
-	</form:form>
-	<sys:message content="${message}"/>
-	<table id="contentTable" class="table table-striped table-bordered table-condensed">
-		<thead>
-			<tr>
-				<th style="width:20px;"></th>
-				<th>会所ID</th>
-				<th>会所名称</th>
-				<th>会所简称</th>
-				<th>联系人</th>
-				<th>手机号</th>
-			</tr>
-		</thead>
-		<tbody>
-		<c:forEach items="${page.list}" var="cmClub">
-			<tr id="${cmClub.clubID}">
-				<th><input class="check-item" type="radio" name="cmClub"
-							   value='${fns:toJson(cmClub)}'/></th>
-				<td>
-					${cmClub.clubID}
-				</td>
-				<td>
-					${cmClub.name}
-				</td>
-				<td>
-					<c:if test="${empty cmClub.sname}">
-						------
-					</c:if>
-					<c:if test="${not empty cmClub.sname}">
-					${cmClub.sname}
-					</c:if>
-				</td>
-				<td>
-					<c:if test="${empty cmClub.linkMan}">
-						------
-					</c:if>
-					<c:if test="${not empty cmClub.linkMan}">
-					${cmClub.linkMan}
-					</c:if>
-				</td>
-				<td>
-					${cmClub.contractMobile}
-				</td>
-			</tr>
-		</c:forEach>
-		</tbody>
-	</table>
-	<div class="pagination">${page}</div>
-</body>
-</html>

+ 0 - 273
src/main/webapp/WEB-INF/views/modules/coupon/cmCouponClubList.jsp

@@ -1,273 +0,0 @@
-<%@ page contentType="text/html;charset=UTF-8" %>
-<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
-<html>
-<head>
-	<title>采美优惠券活动签约会所管理</title>
-	<meta name="decorator" content="default"/>
-	<style type="text/css">
-		.table th{text-align: center;}
-		.table td{text-align: center;}
-	</style>
-	<script type="text/javascript">
-		$(document).ready(function() {
-			
-		});
-		function page(n,s){
-			$("#pageNo").val(n);
-			$("#pageSize").val(s);
-			$("#searchForm").submit();
-        	return false;
-        }
-        /**
-         * 展示会所选择框
-         * @param iframe
-         */
-        function addClub(iframe) {
-            top.$.jBox(iframe, {
-                iframeScrolling: 'yes',
-                width: $(top.document).width() - 400,
-                height: $(top.document).height() - 160,
-                persistent: true,
-                showScrolling: false,
-                title: "选择会所",
-                bottomText: '请从可供选择的项目中选择一个',
-                buttons: {"确定": '1', "关闭": '-1'},
-                submit: function (v, h, f) {
-                    //确定
-                    var $jboxFrame = top.$('#jbox-iframe');
-                    var $mainFrame = top.$('#mainFrame');
-                    if ('1' == v && 1 == $jboxFrame.size() && 1 == $mainFrame.size()) {
-                        var items = $jboxFrame[0].contentWindow.getCheckedItems();
-                        if (items.length > 0) {
-                            var id = JSON.parse(items[0]).clubID;
-                            window.location.href ="${ctx}/coupon/cmCouponClub/addClub?clubID=" + id;
-                            return true;
-                        } else {
-                            top.$.jBox.tip("请选择...");
-                            return false;
-                        }
-                    }
-                    return true;
-                }
-            });
-        }
-
-        /**
-		 * 发送优惠券
-         * @param iframe
-         */
-        function sendCoupon(iframe) {
-            top.$.jBox(iframe, {
-                iframeScrolling: 'yes',
-                width: $(top.document).width() - 800,
-                height: $(top.document).height() - 200 ,
-                persistent: true,
-                showScrolling: false,
-                title: "选择优惠券",
-                bottomText: '请选择一类优惠券并填写数量',
-                buttons: {"确定": '1', "关闭": '-1'},
-                submit: function (v, h, f) {
-                    //确定
-                    var $jboxFrame = top.$('#jbox-iframe');
-                    var $mainFrame = top.$('#mainFrame');
-                    if ('1' == v && 1 == $jboxFrame.size() && 1 == $mainFrame.size()) {
-                        var items = $jboxFrame[0].contentWindow.getCheckedItems();
-                        if (items.length > 0) {
-                            var couponCode = JSON.parse(items[0]).couponCode;
-                            var laveNum = JSON.parse(items[0]).laveNum;
-                            var num = JSON.parse(items[0]).num;
-                            if (!(/(^[1-9]\d*$)/.test(num))) {
-                                top.$.jBox.tip("输入的不是正整数");
-                                return false;
-                            }
-                            if(null == num || "" == num){
-                                top.$.jBox.tip("请输入该劵的派送数量");
-                                return false;
-							}
-                            if(num >laveNum){
-                                top.$.jBox.tip("派送数量不能超过剩余数量");
-                                return false;
-							}
-                            var couponAmount = JSON.parse(items[0]).couponAmount;
-                            var threshold = JSON.parse(items[0]).threshold;
-                            var couponType = JSON.parse(items[0]).couponType;
-                            var userID = JSON.parse(items[0]).userID;
-                            window.location.href ="${ctx}/coupon/cmCouponClub/addCoupon?couponCode="+couponCode+"&num="+num+"&couponAmount="+couponAmount+"&threshold="+threshold+"&couponType="+couponType+"&userID="+userID;
-                            return true;
-                        } else {
-                            top.$.jBox.tip("请选择...");
-                            return false;
-                        }
-                    }
-                    return true;
-                }
-            });
-        }
-
-
-        // 解除签约
-        function modifyWin(id){
-            var html = "<div style='font-size:20px;text-align: center;padding-top: 20px'>确认解除签约?</div>";
-            top.$.jBox(html, {
-                title:"解除签约",
-                top:150,
-                width: 300,
-                height: 150,
-                persistent: true,
-                buttons:{"解除签约":'1',"取消":'-1'},
-                submit:function(v, h, f){
-                    //修改
-                    if('1'==v){
-                        $.post("${ctx}/coupon/cmCouponClub/dismissal",{'id':id}, function(data) {
-                            if(true==data.success){
-                                refresh();
-                                $.jBox.tip(data.msg, 'info');
-                            } else {
-                                $.jBox.tip(data.msg,'error');
-                            }
-                        },"JSON");//这里返回的类型有:json,html,xml,text
-                        refresh();
-                    }
-                    return true;
-                }
-            });
-
-        }
-
-
-        // 解除签约
-        function signing(id){
-            var html = "<div style='font-size:20px;text-align: center;padding-top: 20px'>确认置为已签约?</div>";
-            top.$.jBox(html, {
-                title:"置为已签约",
-                top:150,
-                width: 300,
-                height: 150,
-                persistent: true,
-                buttons:{"置为已签约":'1',"取消":'-1'},
-                submit:function(v, h, f){
-                    //修改
-                    if('1'==v){
-                        $.post("${ctx}/coupon/cmCouponClub/signing",{'id':id}, function(data) {
-                            if(true==data.success){
-                                refresh();
-                                $.jBox.tip(data.msg, 'info');
-                            } else {
-                                $.jBox.tip(data.msg,'error');
-                            }
-                        },"JSON");//这里返回的类型有:json,html,xml,text
-                        refresh();
-                    }
-                    return true;
-                }
-            });
-
-        }
-        function refresh(){
-            window.location.href="${ctx}/coupon/cmCouponClub/";
-        }
-	</script>
-</head>
-<body>
-	<ul class="nav nav-tabs">
-		<li class="active"><a href="${ctx}/coupon/cmCouponClub/">会所列表</a></li>
-	</ul>
-	<form:form id="searchForm" modelAttribute="cmCouponClub" action="${ctx}/coupon/cmCouponClub/" method="post" class="breadcrumb form-search">
-		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
-		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
-		<div class="ul-form">
-			<label>会所名称:</label>
-				<form:input path="name" htmlEscape="false" maxlength="15" class="input-mini"/>
-			<label>会所状态:</label>
-			<form:select path="status" class="input-small">
-				<form:option value="" label="请选择"/>
-				<form:options items="${fns:getDictList('cm_coupon_club_status')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
-			</form:select>
-			<label>签约时间:</label>
-			<form:input path="startTime" type="text" maxlength="20" class="input-mini Wdate" value="${startTime}"
-						onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
-			-
-			<form:input path="endTime" type="text" maxlength="20" class="input-mini Wdate" value="${endTime}"
-						onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
-			&nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="筛选会所"/>
-			<div class="clearfix"></div>
-		</div>
-	</form:form>
-	<sys:message content="${message}"/>
-	<div class="breadcrumb">数据列表 &nbsp;&nbsp<input id="CmclubSelected" class="btn btn-primary" type="button" value="添加会所" onclick="addClub('iframe:${ctx}/coupon/cmCouponClub/showClubList')"/></div>
-	<div style="padding-left: 30px;">
-		<img src="/static/images/warning.png" style="display: inline-block;vertical-align: top;width: 18px;height: 18px;">
-		<div style="display: inline-block;">
-			<p style="padding-bottom: 1px;margin-bottom: 0;color:#a9a9a9 ">1、本次添加会所均为会所企业账号,会所员工/经理不存在此列表</p>
-		</div>
-	</div>
-
-	<table id="contentTable" class="table table-striped table-bordered table-condensed">
-		<thead>
-			<tr>
-				<th>
-					会所ID
-				</th>
-				<th>会所名称</th>
-				<th>会所简称</th>
-				<th>联系人</th>
-				<th>手机号</th>
-				<th>签约时间</th>
-				<th>会所状态</th>
-				<th>累计返现</th>
-				<shiro:hasPermission name="coupon:cmCouponClub:edit"><th>操作</th></shiro:hasPermission>
-			</tr>
-		</thead>
-		<tbody>
-		<c:forEach items="${page.list}" var="cmCouponClub">
-			<tr>
-				<td>${cmCouponClub.clubId}</td>
-				<td>${cmCouponClub.name}</td>
-				<td>
-					<c:if test="${empty cmCouponClub.sname}">
-						------
-					</c:if>
-					<c:if test="${not empty cmCouponClub.sname}">
-						${cmCouponClub.sname}
-					</c:if>
-				</td>
-				<td>
-					<c:if test="${empty cmCouponClub.linkMan}">
-						------
-					</c:if>
-					<c:if test="${not empty cmCouponClub.linkMan}">
-						${cmCouponClub.linkMan}
-					</c:if>
-				</td>
-				<td>${cmCouponClub.contractMobile}</td>
-				<td>
-					<c:if test="${empty cmCouponClub.signDate}">
-						------
-					</c:if>
-					<c:if test="${not empty cmCouponClub.signDate}">
-						<fmt:formatDate value="${cmCouponClub.signDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
-					</c:if>
-				</td>
-				<td>${fns:getDictLabel(cmCouponClub.status,"cm_coupon_club_status","" )}</td>
-				<td>------</td>
-				<shiro:hasPermission name="coupon:cmCouponClub:edit"><td>
-					<c:if test="${cmCouponClub.status == 1}">
-						<a href="javascript:void(0);" onclick="modifyWin(${cmCouponClub.id})">解除签约</a>
-						<%--发送优惠券--%>
-						<a href="javascript:void(0);" onclick="sendCoupon('iframe:${ctx}/coupon/cmCouponClub/showCouponList?userID='+${cmCouponClub.userID})"/>发送优惠券</a>
-					</c:if>
-					<c:if test="${cmCouponClub.status == 2}">
-						<a href="javascript:void(0);" onclick="signing(${cmCouponClub.id})">置为已签约</a>
-						<%--<a href="${ctx}/coupon/cmCouponClub/signing?id=${cmCouponClub.id}" >置为已签约</a>--%>
-					</c:if>
-						<shiro:hasPermission name="coupon:cmCouponClub:delete">
-						<a href="${ctx}/coupon/cmCouponClub/delete?id=${cmCouponClub.id}" onclick="return confirmx('确认要删除吗?', this.href)">删除</a>
-						</shiro:hasPermission>
-				</td></shiro:hasPermission>
-			</tr>
-		</c:forEach>
-		</tbody>
-	</table>
-	<div class="pagination">${page}</div>
-</body>
-</html>

+ 542 - 0
src/main/webapp/WEB-INF/views/modules/coupon/cmCouponForm.jsp

@@ -0,0 +1,542 @@
+<%@ page import="java.util.Date" %>
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
+<html>
+<head>
+	<title>优惠券管理</title>
+	<meta name="decorator" content="default"/>
+	<script type="text/javascript">
+		$(document).ready(function() {
+			//$("#name").focus();
+			$("#inputForm").validate({
+				submitHandler: function(form){
+					if (imageList.length > 0) {
+						var productInfo = JSON.stringify(imageList);
+						$('#productInfo').val(productInfo);
+					}
+					var couponAmount = $("#couponAmount").val();
+					var touchPrice = $("#touchPrice").val();
+					if (couponAmount >= touchPrice) {
+						alertx("优惠券金额必须小于优惠条件金额");
+						return false;
+					}
+					var startDate = $("#startDate").val();
+					var endDate = $("#endDate").val();
+					if (startDate >= endDate) {
+						alertx("结束时间不能早于开始时间");
+						return false;
+					}
+					loading('正在提交,请稍等...');
+					form.submit();
+				},
+				errorContainer: "#messageBox",
+				errorPlacement: function(error, element) {
+					$("#messageBox").text("输入有误,请先更正。");
+					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
+						error.appendTo(element.parent().parent());
+					} else {
+						error.insertAfter(element);
+					}
+				}
+			});
+		});
+	</script>
+
+	<style>
+		.iconBox {
+			font-size: 0;
+		}
+		.conList .btn:nth-of-type(1){
+			margin-left: 25px;
+		}
+		.upload-content-image {
+			margin-top: -70px;
+		}
+
+		.upload-content-image .conList .btn:nth-of-type(1) {
+			width: 90px;
+			height: 100px;
+			border: 2px solid #eee;
+			background: #fff;
+			position: relative;
+		}
+
+		.upload-content-image .conList .btn:nth-of-type(1) > div {
+			position: absolute;
+			top: 50%;
+			left: 50%;
+			transform: translate(-50%, -50%);
+			color: #666;
+		}
+
+		.upload-content-image .conList .btn:nth-of-type(1) span {
+			font-size: 35px;
+		}
+
+		.upload-content-image .conList .btn:nth-of-type(1) h5 {
+			color: #666;
+		}
+		.upload-content-image .conList ol li {
+			width: 114px;
+			min-height: 80px;
+			text-align: center;
+			background: #fff;
+			position: relative;
+			top: 120px;
+			margin-left: 2px;
+		}
+		.cancel-upload-image {
+			background: transparent;
+			border: none;
+			box-shadow: none;
+			position: relative;
+			top: -38px;
+			left: -25px;
+			cursor: pointer;
+			z-index: 100;
+		}
+		.hide-pic-image {
+			display: none !important;
+		}
+	</style>
+</head>
+<body>
+	<ul class="nav nav-tabs">
+		<li><a href="${ctx}/coupon/cmCoupon/list?couponType=0">活动券</a></li>
+		<li class="active"><a href="${ctx}/coupon/cmCoupon/form?couponType=0&id=${cmCoupon.id}">${not empty cmCoupon.id?'编辑':'添加'}</a></li>
+	</ul><br/>
+	<font style="color: red;margin-left: 20px">活动券适合在某些节日或者主题活动时创建,并且适用于全部客户以及商城全部商品或指定商品(不包括二手商品)。</font><br><br>
+	<form:form id="inputForm" modelAttribute="cmCoupon" action="${ctx}/coupon/cmCoupon/save" method="post" class="form-horizontal">
+		<form:hidden path="id"/>
+		<form:hidden path="productInfo" id="productInfo"/>
+		<input type="hidden" name="couponType" value="0"/>
+		<sys:message content="${message}"/>
+		<div class="control-group">
+			<label class="control-label"><font color="red">*</font>活动主题:</label>
+			<div class="controls">
+				<form:input path="name" htmlEscape="false" maxlength="30" placeholder="30个汉字以内" class="input-xlarge required"/>
+			</div>
+		</div>
+		<div class="control-group">
+			<label class="control-label"><font color="red">*</font>优惠券金额:</label>
+			<div class="controls">
+				<input type="number" id="couponAmount" name="couponAmount" value="${cmCoupon.couponAmount}" min="0" required>
+			</div>
+		</div>
+		<div class="control-group">
+			<label class="control-label"><font color="red">*</font>优惠条件:</label>
+			<div class="controls">
+				订单商品总额满&nbsp;&nbsp;&nbsp;&nbsp;<input type="number" name="touchPrice" id="touchPrice" value="${cmCoupon.touchPrice}" min="0" required>
+			</div>
+		</div>
+		<div class="control-group">
+			<label class="control-label"><font color="red">*</font>开始时间:</label>
+			<div class="controls">
+				<input name="startDate" id="startDate" type="text" required readonly="readonly" maxlength="20" class="input-medium Wdate "
+					value="<fmt:formatDate value="${cmCoupon.startDate}" pattern="yyyy-MM-dd HH:mm:ss"/>"
+					onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
+			</div>
+		</div>
+		<div class="control-group">
+			<label class="control-label"><font color="red">*</font>结束时间:</label>
+			<div class="controls">
+				<input name="endDate" id="endDate" type="text" required readonly="readonly" maxlength="20" class="input-medium Wdate "
+					value="<fmt:formatDate value="${cmCoupon.endDate}" pattern="yyyy-MM-dd HH:mm:ss"/>"
+					onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
+			</div>
+		</div>
+		<div class="control-group">
+			<label class="control-label"><font color="red">*</font>优惠状态:</label>
+			<div class="controls">
+				<label id="initializeShow">
+					<c:if test="${empty cmCoupon.status || cmCoupon.status eq 0}">
+						<font color="#800080">未生效</font>
+					</c:if>
+					<c:if test="${cmCoupon.status eq 1}">
+						<font color="#00CC66">已生效</font>
+					</c:if>
+					<c:if test="${cmCoupon.status eq 2}">
+						<font color="red">已关闭</font>
+					</c:if>
+					<c:if test="${cmCoupon.status eq 3}">
+						<font color="#FF6600">已失效</font>
+					</c:if>
+				</label>
+				<label id="closeShow" style="display: none">
+					<font color="red">已关闭</font>
+				</label>
+				<input type="hidden" id="hiddenStatus" name="status" value="">
+				<input type="checkbox" id="status" name="status" value="2" ${cmCoupon.status eq "2" ? "checked" : ""} onclick="statusShow()" />关闭
+			</div>
+		</div>
+		<div class="control-group">
+			<label class="control-label"><font color="red">*</font>优惠商品:</label>
+			<div class="controls">
+				<form:radiobutton path="productType" value="1" label="全商城商品" onclick="productShow()" checked ="${empty cmCoupon.productType ? true:false}"/>
+				<form:radiobutton path="productType" value="2" label="指定商品" onclick="productShow()"/>
+			</div>
+		</div>
+		<div class="productData" hidden="hidden">
+			<div class="control-group">
+				<label class="control-label"><font color="red">*</font>网站活动页banner:</label>
+				<div class="controls upload-content-image iconBox">
+					<div class="conList">
+						<form:hidden id="pcBanner" path="pcBanner" htmlEscape="false" maxlength="255" class="input-xlarge"/>
+						<sys:ckfinder input="pcBanner" type="images" uploadPath="/photo" selectMultiple="false" maxWidth="100" maxHeight="100"/>
+						<br>
+					</div>
+				</div>
+			</div>
+			<div class="control-group">
+				<label class="control-label"><font color="red">*</font>小程序活动页banner:</label>
+				<div class="controls upload-content-image iconBox">
+					<div class="conList">
+						<form:hidden id="appletsBanner" path="appletsBanner" htmlEscape="false" maxlength="255" class="input-xlarge"/>
+						<sys:ckfinder input="appletsBanner" type="images" uploadPath="/photo" selectMultiple="false" maxWidth="100" maxHeight="100"/>
+						<br>
+					</div>
+				</div>
+			</div>
+			<div class="control-group">
+				<input class="btn" id="del" style="width: 50px" onclick="batchDeletion()" value="删除"/>&nbsp;&nbsp;&nbsp;&nbsp;
+				<input class="btn btn-primary" style="width: 70px" onclick="batchSaveSort()" value="一键排序"/>&nbsp;&nbsp;&nbsp;&nbsp;
+				<input class="btn btn-primary" style="width: 50px" onclick="showSelect()" value="添加"/>
+				<br><br>
+				<table id="contentTable" class="table table-striped table-bordered table-condensed" hidden="hidden">
+					<thead>
+					<tr>
+						<th style="width:20px;"><input class="check-all" type="checkbox" onclick="clickAllSelect(this)"/> 全选
+						</th>
+						<th>商品图片</th>
+						<th>商品名称</th>
+						<th>供应商</th>
+						<th>网站状态</th>
+						<th>小程序状态</th>
+						<th>排序</th>
+						<th>添加时间</th>
+						<th>操作</th>
+					</tr>
+					</thead>
+					<tbody id="hotSearch"></tbody>
+				</table>
+			</div>
+		</div>
+		<div class="form-actions">
+			<input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;
+			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
+		</div>
+	</form:form>
+<script>
+	//图片初始化
+	$(function () {
+		$('.upload-content-image .conList .btn:nth-of-type(1)').html('<div><span>+</span><h5>选择图片</h5></div>');
+		$('.upload-content-image .conList .btn:nth-of-type(2)').after('<img class="cancel-upload-image" src="/static/images/close-btn1.png">').remove();
+		$('.upload-content-image .conList').find('.cancel-upload-image').hide();
+		var observeEleImage = document.getElementsByClassName('upload-content-image')[0];
+		var observeEleImage1 = document.getElementsByClassName('upload-content-image')[1];
+		var MutationObserverImage = window.MutationObserver || window.WebKitMutationObserver;
+		var MutationObserverConfigImage = {
+			childList: true,
+			subtree: true,
+			characterData: true
+		};
+		var observerImage = new MutationObserverImage(function (mutations) {
+			$.each(mutations, function (index, item) {
+				if (item.type === 'childList') {
+					// 在创建新的 element 时调用
+					var target = $(item.target),
+							thisWrapper = target.closest('.conList'),
+							nextEle = thisWrapper.next();
+					thisWrapper.find('li').css('z-index', 99);
+					thisWrapper.find('.cancel-upload-image').show();
+					if (nextEle.hasClass('hide-pic-image')) {
+						nextEle.removeClass('hide-pic-image');
+					}
+				}
+			})
+		});
+		observerImage.observe(observeEleImage, MutationObserverConfigImage);
+		observerImage.observe(observeEleImage1, MutationObserverConfigImage);
+
+		$('body').on('click', '.upload-content-image li', function () {
+			var index = $(this).closest('.conList').index() + 1,
+					str = 'remarkImage' + index + 'FinderOpen';
+			eval(str + '()');
+		});
+		$('body').on('click', '.cancel-upload-image', function () {
+			var wrapper = $(this).closest('.conList');
+			wrapper.find('li').css('z-index', '-1');
+			wrapper.find('input').val('');
+			$(this).hide();
+			wrapper.removeClass("hide-pic-image");
+			wrapper.parent().append(wrapper.clone());
+			wrapper.remove();
+			$(".conList").each(function (i, ele) {
+				if ($(ele).find("input.input-xlarge").val()) {
+					$(ele).next().removeClass("hide-pic-image")
+				}
+			})
+		});
+		$(window).on("load", function () {
+			setTimeout(function () {
+				var input = $("#pcBanner");
+				if (input.val()) {
+					input.next().find("li").css("z-index", "99");
+					input.parents(".conList").find(".cancel-upload-image").show();
+					input.parents(".conList").next().removeClass("hide-pic-image")
+				}
+				input = $("#appletsBanner");
+				if (input.val()) {
+					input.next().find("li").css("z-index", "99");
+					input.parents(".conList").find(".cancel-upload-image").show();
+					input.parents(".conList").next().removeClass("hide-pic-image")
+				}
+			}, 500);
+		});
+		productShow()
+	});
+
+	var productIds = '';
+	var imageList = [];
+
+	$(function () {
+		<c:forEach items="${associateList}" var="associate" varStatus="index">
+		imageList.push({
+			id: "${associate.id}",
+			productId: "${empty associate.productId ? "":associate.productId}",
+			image: "${associate.image}",
+			productName: "${associate.productName}",
+			shopName: "${associate.shopName}",
+			sort: "${associate.sort}",
+			pcStatus: "${associate.pcStatus}",
+			appletsStatus: "${associate.appletsStatus}",
+			addTime: "<fmt:formatDate value="${associate.addTime}" pattern="yyyy-MM-dd HH:mm:ss"/>"
+		});
+		</c:forEach>
+
+		if (imageList.length > 0) {
+			$('#contentTable').show();
+			batchSaveSort();
+		}
+	});
+
+	//点击添加
+	function showSelect() {
+		var url = "${ctx}/coupon/cmCoupon/toAddProduct?productIds=" + productIds;
+		var title = '';
+		title = "选择商品";
+		top.$.jBox("iframe:" + url, {
+			iframeScrolling: 'yes',
+			width: $(top.document).width() - 400,
+			height: $(top.document).height() - 160,
+			persistent: true,
+			title: title,
+			buttons: {"确定": '1', "取消": '-1'},
+			submit: function (v, h, f) {
+				//确定
+				var $jboxFrame = top.$('#jbox-iframe');
+				var $mainFrame = top.$('#mainFrame');
+				if ('1' == v && 1 == $jboxFrame.size() && 1 == $mainFrame.size()) {
+					var items = $jboxFrame[0].contentWindow.getCheckedItems();
+					console.log(items);
+					console.log(items[0]);
+					for (var i = 0; i < items.length; i++) {
+						console.log(items[i]);
+						imageList.push(items[i]);
+						$('#contentTable').show();
+						$("#del").removeAttr("disabled");
+						batchSaveSort();
+					};
+				}
+				return true;
+			}
+		});
+	}
+
+	/**
+	 * 一键排序
+	 */
+	function batchSaveSort() {
+		imageList.sort(sort);
+		insertHtml(imageList);
+	}
+
+	//根据sort值 从小到大排序
+	function sort(a, b) {
+		return a.sort - b.sort;
+	}
+
+	//相关图片列表数据
+	function appendShopOrderHead(data, index) {
+		var html = '<tr id ="ai' + index + '">' +
+				'<td>' +
+				'<input class="check-item" type="checkbox" name="info" value="' + index + '"/>' + (index + 1) +
+				'</td>' +
+				'<td>' +
+				'<img src="' + data.image + '" width="60px" border="none" title="启用">' +
+				'</td>' +
+				'<td>' +
+				data.productName +
+				'</td>' +
+				'<td>' +
+				data.shopName +
+				'</td>' +
+				'<td>' +
+				(data.pcStatus == 1 ? (
+						'<font color="green">已启用</font>&nbsp;&nbsp;&nbsp;' +
+						'<a href="javascript:void(0);" onclick="updatePcStatus(0,' + index + ');" >' +
+						'停用</a>'
+				) : (
+						'<font color="red">已停用</font>&nbsp;&nbsp;&nbsp;' +
+						'<a href="javascript:void(0)" onclick="updatePcStatus(1,' + index + ');">' +
+						'启用</a>'
+				)) +
+				'</td>' +
+				'<td>' +
+				(data.appletsStatus == 1 ? (
+						'<font color="green">已启用</font>&nbsp;&nbsp;&nbsp;' +
+						'<a href="javascript:void(0);" onclick="updateAppletsStatus(0,' + index + ');" >' +
+						'停用</a>'
+				) : (
+						'<font color="red">已停用</font>&nbsp;&nbsp;&nbsp;' +
+						'<a href="javascript:void(0)" onclick="updateAppletsStatus(1,' + index + ');">' +
+						'启用</a>'
+				)) +
+				'</td>' +
+				'<td>' +
+				'<input name="sort" style="width:50px;" value="' + data.sort + '"  onkeyup="onlynum(this)"  onchange="changeSort(' + index + ',this)"></td>' +
+				'</td>' +
+				'<td>' +
+				(data.addTime == '' ? (
+						'<fmt:formatDate value="<%=new Date()%>" pattern="yyyy-MM-dd HH:mm:ss"/>'
+				) : (
+						data.addTime
+				)) +
+				'</td>' +
+				'<td>' +
+				'<a href="javascript:;" onclick="delect(' + index + ')">删除</a>' +
+				'</td>' +
+				'</tr>';
+		return html;
+	}
+
+	function insertHtml(list) {
+		var html = '';
+		productIds = '';
+		list.forEach(function (item, index) {
+			html += appendShopOrderHead(item, index);
+			productIds += "," + item.productId;
+		});
+		$("#hotSearch").html(html);
+	}
+
+	function changeSort(index, sortThis) {
+		var sort = sortThis.value;
+		if (sort <= 0) {
+
+		}
+		var image = imageList[index];
+		image.sort = sort;
+	}
+
+	function updatePcStatus(status, index) {
+		var image = imageList[index];
+		confirmx(status == 0 ? '确定停用吗?' : '确定启用吗?', function () {
+			image.pcStatus = status;
+			batchSaveSort();
+		})
+	}
+
+	function updateAppletsStatus(status, index) {
+		var image = imageList[index];
+		confirmx(status == 0 ? '确定停用吗?' : '确定启用吗?', function () {
+			image.appletsStatus = status;
+			batchSaveSort();
+		})
+	}
+
+	function clickAllSelect(ckb) {
+		var isChecked = ckb.checked;
+		$(".check-item").attr('checked', isChecked);
+	}
+
+	/**
+	 * 删除操作
+	 */
+	function delect(index) {
+		return confirmx("确定删除吗?", function () {
+			var image = imageList[index];
+			if (image.productId != '') {
+				productIds = productIds.replace(image.productId,"");
+			}
+			imageList.splice(index, 1);
+			insertHtml(imageList);
+			if (imageList.length == 0) {
+				$('#contentTable').hide();
+				$("#del").attr("disabled", "disabled");
+			}
+		});
+	}
+
+
+	/**
+	 * 批量删除
+	 */
+	function batchDeletion() {
+		var index = -1;
+		var i = 1;
+		return confirmx("确定删除吗?", function () {
+			$('input[name="info"]:checked').each(function () {
+				var thisIndex = $(this).val();
+				if (index >= 0 && index < thisIndex) {
+					thisIndex = thisIndex - i;
+					i++;
+				} else {
+					index = thisIndex;
+				}
+				var image = imageList[thisIndex];
+				if (image.productId != '') {
+					productIds = productIds.replace(image.productId, "");
+				}
+				imageList.splice(thisIndex, 1);
+				insertHtml(imageList);
+				if (imageList.length == 0) {
+					$('#contentTable').hide();
+					$("#del").attr("disabled", "disabled");
+				}
+			});
+		});
+	}
+
+	function productShow() {
+		var  productType = $("input[name='productType']:checked").val();
+		if (productType == 2){
+			$(".productData").show();
+		}else {
+			$(".productData").hide();
+		}
+	}
+
+	function statusShow() {
+		var status = $("input[name='status']:checked").val();
+		if (status == 2) {
+			$("#initializeShow").hide();
+			$("#closeShow").show();
+		} else {
+			$("#initializeShow").show();
+			$("#closeShow").hide();
+			$("#hiddenStatus").val(0);
+		}
+	}
+
+
+	/**
+	 * @param obj
+	 * jquery控制input只能输入数字
+	 */
+	function onlynum(obj) {
+		obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
+	}
+</script>
+</body>
+</html>

+ 123 - 0
src/main/webapp/WEB-INF/views/modules/coupon/cmCouponList.jsp

@@ -0,0 +1,123 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
+<html>
+<head>
+	<title>优惠券管理列表</title>
+	<meta name="decorator" content="default"/>
+	<style type="text/css">
+		.table th{text-align: center;}
+		.table td{text-align: center;}
+	</style>
+	<script type="text/javascript">
+		$(document).ready(function() {
+			
+		});
+		function page(n,s){
+			$("#pageNo").val(n);
+			$("#pageSize").val(s);
+			$("#searchForm").submit();
+        	return false;
+        }
+	</script>
+</head>
+<body>
+	<ul class="nav nav-tabs">
+		<li class="active"><a href="${ctx}/coupon/cmCoupon/list?couponType=0">活动券</a></li>
+		<li><a href="${ctx}/coupon/cmCoupon/list?couponType=1">品类券</a></li>
+		<li><a href="${ctx}/coupon/cmCoupon/list?couponType=2">用户专享券</a></li>
+		<li><a href="${ctx}/coupon/cmCoupon/list?couponType=3">店铺券</a></li>
+		<li><a href="${ctx}/coupon/cmCoupon/list?couponType=4">新用户券</a></li>
+	</ul>
+	<form:form id="searchForm" modelAttribute="cmCoupon" action="${ctx}/coupon/cmCoupon/" method="post" class="breadcrumb form-search">
+		<input type="hidden" name="couponType" value="0"/>
+		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
+		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+		<div class="ul-form">
+			 <label>活动主题:</label>
+				<form:input path="name" htmlEscape="false" maxlength="50" class="input-medium"/>
+			<label>优惠状态:</label>
+			<form:select path="status" class="input-medium required">
+				<form:option value="" label="所有"/>
+				<form:option value="0" label="未生效"/>
+				<form:option value="1" label="已生效"/>
+				<form:option value="2" label="已关闭"/>
+				<form:option value="3" label="已失效"/>
+			</form:select>
+			 <label>优惠时间:</label>
+				<input name="startDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
+					value="<fmt:formatDate value="${cmCoupon.startDate}" pattern="yyyy-MM-dd HH:mm:ss"/>"
+					onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/> -
+				<input name="endDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
+					value="<fmt:formatDate value="${cmCoupon.endDate}" pattern="yyyy-MM-dd HH:mm:ss"/>"
+					onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
+			&nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
+			<input class="btn btn-primary" style="width: 80px" onclick="window.location='${ctx}/coupon/cmCoupon/form?couponType=0'" value="添加活动券"/>
+			<div class="clearfix"></div>
+		</div>
+	</form:form>
+	<sys:message content="${message}"/>
+	<table id="contentTable" class="table table-striped table-bordered table-condensed">
+		<thead>
+			<tr>
+				<th>ID</th>
+				<th>活动主题</th>
+				<th>优惠券金额</th>
+				<th>优惠条件</th>
+				<th>优惠状态</th>
+				<th>开始时间</th>
+				<th>结束时间</th>
+				<th>添加时间</th>
+				<th>操作</th>
+			</tr>
+		</thead>
+		<tbody>
+		<c:forEach items="${page.list}" var="cmCoupon">
+			<tr>
+				<td>
+					${cmCoupon.id}
+				</td>
+				<td>
+					${cmCoupon.name}
+				</td>
+				<td>
+					${cmCoupon.couponAmount}
+				</td>
+				<td>
+					满${cmCoupon.touchPrice}
+				</td>
+				<td>
+					<c:if test="${cmCoupon.status eq 0}">
+						<font color="#800080">未生效</font>
+					</c:if>
+					<c:if test="${cmCoupon.status eq 1}">
+						<font color="#00CC66">已生效</font>
+					</c:if>
+					<c:if test="${cmCoupon.status eq 2}">
+						<font color="red">已关闭</font>
+					</c:if>
+					<c:if test="${cmCoupon.status eq 3}">
+						<font color="#FF6600">已失效</font>
+					</c:if>
+				</td>
+				<td>
+					<fmt:formatDate value="${cmCoupon.startDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
+				</td>
+				<td>
+					<fmt:formatDate value="${cmCoupon.endDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
+				</td>
+				<td>
+					<fmt:formatDate value="${cmCoupon.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
+				</td>
+				<td>
+    				<a href="${ctx}/coupon/cmCoupon/form?id=${cmCoupon.id}">编辑</a>
+					<a href="${ctx}/coupon/cmCoupon/close?id=${cmCoupon.id}" onclick="return confirmx('确定关闭该优惠券吗?', this.href)">关闭</a>
+					<a href="${ctx}/coupon/cmCoupon/delete?id=${cmCoupon.id}" onclick="return confirmx('确定删除该优惠券吗?', this.href)">删除</a>
+					<a href="">领取门户</a>
+				</td>
+			</tr>
+		</c:forEach>
+		</tbody>
+	</table>
+	<div class="pagination">${page}</div>
+</body>
+</html>

+ 0 - 116
src/main/webapp/WEB-INF/views/modules/coupon/cmCouponListBox.jsp

@@ -1,116 +0,0 @@
-<%@ page contentType="text/html;charset=UTF-8" %>
-<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
-<html>
-<head>
-	<title>优惠券管理</title>
-	<meta name="decorator" content="default"/>
-	<style type="text/css">
-		.table th{text-align: center;}
-		.table td{text-align: center;}
-	</style>
-	<script type="text/javascript">
-		$(document).ready(function() {
-			
-		});
-		function page(n,s){
-			$("#pageNo").val(n);
-			$("#pageSize").val(s);
-			$("#searchForm").submit();
-        	return false;
-        }
-
-        function allCkbfun(ckb){
-            var isChecked = ckb.checked;
-            $(".check-item").attr('checked', isChecked);
-        }
-
-        function checkNum(index) {
-			var $id = "num" + index;
-            var $laveNumID = "laveNum" + index;
-			var $num = document.getElementById($id);
-            var $laveNum = document.getElementById($laveNumID);
-            var num = $($num).val();
-            var laveNum = $($laveNum).val();
-            if(!isNaN(num)){
-                if (num <= 0) {
-                    $($num).val("");
-                    alertx("请输入正确的数量");
-                }
-                if (parseInt(num)>parseInt(laveNum)) {
-                    $($num).val("");
-                    alertx("输入数字超过剩余数量");
-                }
-            }else{
-                $($num).val("");
-                alertx("请输入正确的数量");
-            }
-
-
-//            obj["num"] = count;
-        }
-
-        function getCheckedItems(){
-            var items = new Array();
-            var $items = $('.check-item:checked');
-            $items.each(function(){
-               var num = $(this).parent().parent().find('td').last().find('input').val();
-				var va = JSON.parse($(this).val());
-				va.num = num;
-                items.push(JSON.stringify(va));
-            });
-            return items;
-        }
-	</script>
-</head>
-<body>
-	<form:form id="searchForm" modelAttribute="cmCoupon" action="${ctx}/coupon/cmCouponClub/showCouponList" method="post" class="breadcrumb form-search">
-		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
-		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
-		<input id="userID" name="userID" type="hidden" value="${userID}"/>
-	</form:form>
-	<sys:message content="${message}"/>
-	<table id="contentTable" class="table table-striped table-bordered table-condensed">
-		<thead>
-			<tr>
-				<th style="width:20px;"></th>
-				<th>券类型</th>
-				<th>优惠金额</th>
-				<th>使用门槛</th>
-				<th>剩余数量</th>
-				<th>发送数量</th>
-			</tr>
-		</thead>
-		<tbody>
-		<c:forEach items="${page.list}" var="cmCoupon" varStatus="state" >
-			<tr id="${cmCoupon.couponType}">
-				<th><input class="check-item" type="radio" name="cmCoupon" value='${fns:toJson(cmCoupon)}'/></th>
-				<td>
-					<%--类型 0满减劵 1折扣劵--%>
-					<c:if test="${cmCoupon.couponType eq 0}">
-						满减劵
-					</c:if>
-					<c:if test="${cmCoupon.couponType eq 1}">
-						折扣劵
-					</c:if>
-				</td>
-				<td>
-					${cmCoupon.couponAmount}
-				</td>
-				<td>
-					${cmCoupon.threshold}
-				</td>
-				<td>
-					${cmCoupon.laveNum}
-				</td>
-				<td>
-				<input type="text" name="num${state.index}" id="num${state.index}" value= ""  placeholder="请输入" onchange="checkNum(${state.index})" style="width: 50px">
-				</td>
-                <input type="hidden" name="userID" id="userID" value="${cmCoupon.userID}">
-				<input type="hidden" name="laveNum${state.index}" id="laveNum${state.index}" value="${cmCoupon.laveNum}">
-			</tr>
-		</c:forEach>
-		</tbody>
-	</table>
-	<div class="pagination">${page}</div>
-</body>
-</html>

+ 0 - 101
src/main/webapp/WEB-INF/views/modules/coupon/cmCouponOrderRecordList.jsp

@@ -1,101 +0,0 @@
-<%@ page contentType="text/html;charset=UTF-8" %>
-<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
-<html>
-<head>
-	<title>优惠券订单</title>
-	<meta name="decorator" content="default"/>
-	<style type="text/css">
-		.table th{text-align: center;}
-		.table td{text-align: center;}
-	</style>
-	<script type="text/javascript">
-		$(document).ready(function() {
-			
-		});
-		function page(n,s){
-			$("#pageNo").val(n);
-			$("#pageSize").val(s);
-			$("#searchForm").submit();
-        	return false;
-        }
-	</script>
-</head>
-<body>
-	<ul class="nav nav-tabs">
-		<li class="active"><a href="${ctx}/coupon/cmCouponOrderRecord/">优惠券订单</a></li>
-	</ul>
-	<form:form id="searchForm" modelAttribute="cmCouponOrderRecord" action="${ctx}/coupon/cmCouponOrderRecord/" method="post" class="breadcrumb form-search">
-		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
-		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
-		<div class="ul-form">
-			<label>订单编号:</label>
-			<form:input path="orderCode" htmlEscape="false" maxlength="35" class="input-mini"/>
-			<label>会所名称:</label>
-			<form:input path="clubName" htmlEscape="false" maxlength="15" class="input-medium"/>
-			<label>下单时间:</label>
-			<form:input path="startTime" type="text" maxlength="20" class="input-mini Wdate" value="${startTime}"
-						onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
-			-
-			<form:input path="endTime" type="text" maxlength="20" class="input-mini Wdate" value="${endTime}"
-						onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
-			<%--&nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="筛选查询"/>--%>
-			&nbsp;&nbsp;<form:input id="btnSubmit" class="btn btn-primary" type="submit"  path="searchflag" value="搜索"></form:input>
-			&nbsp;&nbsp;<form:input id="btnSubmit" class="btn btn-primary" type="submit"  path="searchflag" value="导出筛选结果"></form:input>
-			<div class="clearfix"></div>
-		</div>
-	</form:form>
-	<div class="breadcrumb">数据列表</div>
-	<div style="padding-left: 30px;">
-		<img src="/static/images/warning.png" style="display: inline-block;vertical-align: top;width: 18px;height: 18px;">
-		<div style="display: inline-block;">
-			<p style="padding-bottom: 1px;margin-bottom: 0;color:#a9a9a9 ">1、一个订单可能存在多条记录(付款成功、退款成功等)</p>
-		</div>
-	</div>
-	<sys:message content="${message}"/>
-	<table id="contentTable" class="table table-striped table-bordered table-condensed">
-		<thead>
-			<tr>
-				<th>订单编号</th>
-				<th>下单时间</th>
-				<th>退款时间</th>
-				<th>订单金额</th>
-				<th>退款金额</th>
-				<th>优惠券码</th>
-				<th>优惠金额</th>
-				<th>订单状态</th>
-				<th>客户名称</th>
-				<th>客户手机号</th>
-				<th>会所名称</th>
-			</tr>
-		</thead>
-		<tbody>
-		<c:forEach items="${page.list}" var="cmCouponOrderRecord">
-			<tr>
-				<td>${cmCouponOrderRecord.orderCode}</td>
-				<td><fmt:formatDate value="${cmCouponOrderRecord.paymentTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
-				<td><fmt:formatDate value="${cmCouponOrderRecord.refundTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
-				<td>${cmCouponOrderRecord.totalAmount}</td>
-				<td>${cmCouponOrderRecord.refundAmount}</td>
-				<td>${cmCouponOrderRecord.couponCode}</td>
-				<td>${cmCouponOrderRecord.discountAmount}</td>
-				<td>
-					<%--2付款成功 6退款成功--%>
-					<c:if test="${cmCouponOrderRecord.status eq 2}">
-						付款成功
-					</c:if>
-					<c:if test="${cmCouponOrderRecord.status eq 6}">
-						退款成功
-					</c:if>
-				</td>
-				<td>${cmCouponOrderRecord.customerName}</td>
-				<td>${cmCouponOrderRecord.customerMobile}</td>
-				<td>
-					${cmCouponOrderRecord.rebateName}
-				</td>
-			</tr>
-		</c:forEach>
-		</tbody>
-	</table>
-	<div class="pagination">${page}</div>
-</body>
-</html>

+ 0 - 295
src/main/webapp/WEB-INF/views/modules/coupon/cmCouponRecordList.jsp

@@ -1,295 +0,0 @@
-<%@ page contentType="text/html;charset=UTF-8" %>
-<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
-<html>
-<head>
-	<title>采美优惠券使用记录表管理</title>
-	<meta name="decorator" content="default"/>
-	<style type="text/css">
-		.table th{text-align: center;}
-		.table td{text-align: center;}
-		.main{margin: 20px 30px;}
-		.h3{margin-bottom: 10px;}
-		.mar-h3{margin: 20px 0;}
-		.p_messg{margin: 10px 0; color: #317eac}
-		.p_messg span{display: inline-block;width: 15px;height: 15px;border: 1px solid #317eac;border-radius: 50px;
-		text-align: center;line-height: 15px;margin-right: 5px; color: #317eac}
-		.search{width: 100%;height: 35px;line-height: 35px; background-color: #999; color: #fff;padding-left: 20px;box-sizing: border-box}
-		.table-div{margin-top: 30px;}
-	</style>
-	<script type="text/javascript">
-		$(document).ready(function() {
-			
-		});
-		function page(n,s){
-			$("#pageNo").val(n);
-			$("#pageSize").val(s);
-			$("#searchForm").submit();
-        	return false;
-        }
-	</script>
-</head>
-<body>
-<form enctype="multipart/form-data" id="batchUpload" action="${ctx}" method="post"
-	  class="form-horizontal">
-    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp<button class="btn btn-success btn-xs" id="uploadEventBtn" style="height:32px;" type="button">选择优惠券Excel文件</button>
-	<input type="file" name="file" style="width:0px;height:0px;" id="uploadEventFile">
-	<input id="uploadEventPath" disabled="disabled" type="text" placeholder="请选择excel表"
-		   style="border: 1px solid #e6e6e6; height: 32px;width: auto;">
-	<button type="button" class="btn btn-success btn-sm" onclick="user.uploadBtn()">上传提交</button>
-</form>
-<div class="main">
-	<div class="breadcrumb">基本数据</div>
-    <div style="padding-left: 30px;">
-        <img src="/static/images/warning.png" style="display: inline-block;vertical-align: top;width: 18px;height: 18px;">
-        <div style="display: inline-block;">
-            <p style="padding-bottom: 1px;margin-bottom: 0;color:#a9a9a9 ">1、剩余数量:还没派送给会所的有效期内优惠券数量</p>
-            <p style="padding-bottom: 1px;margin-bottom: 0;color:#a9a9a9 ">2、已分享数量:会所分享出去的优惠券数量</p>
-            <p style="padding-bottom: 1px;margin-bottom: 0;color:#a9a9a9 ">3、已过期数量:分享出去但是客户未使用过期的或者是还未派发给会所就过期的优惠券数量</p>
-			<p style="padding-bottom: 1px;margin-bottom: 0;color:#a9a9a9 ">4、导入Excel表格要求:1.时间格式:2018-10-10 12:59:59、2.门槛.去掉订单字眼显示:满50元可用</p>
-        </div>
-    </div>
-	<div>
-		<table class="table table-striped table-bordered table-condensed">
-			<thead>
-			<th>优惠券类型</th>
-			<th>优惠券金额</th>
-			<th>剩余数量</th>
-				<th>已分享数量</th>
-			<th>已使用数量</th>
-			<th>已过期数量</th>
-			</thead>
-                <c:if test="${not empty cmCoupons}">
-			<tbody>
-				<c:forEach items="${cmCoupons}" var="coupon">
-					<tr>
-						<td>
-                                <c:if test="${coupon.couponType == 0}">
-                                    满减劵
-                                </c:if>
-                                <c:if test="${coupon.couponType == 1}">
-                                    折扣劵
-                                </c:if>
-                        </td>
-						<td>${coupon.couponAmount}</td>
-						<td>${coupon.lastAmount}</td>
-						<td>${coupon.shareAmount}</td>
-						<td>${coupon.usedAmount}</td>
-						<td>${coupon.timeOutAmount}</td>
-					</tr>
-				</c:forEach>
-			</tbody>
-                </c:if>
-		</table>
-            <c:if test="${empty cmCoupons}">
-                <text style="color:dodgerblue;display:block;text-align:center">暂无信息</text>
-            </c:if>
-		</div>
-
-	<div class="breadcrumb">优惠券使用记录</div>
-	<div style="padding-left: 30px;">
-		<img src="/static/images/warning.png" style="display: inline-block;vertical-align: top;width: 18px;height: 18px;">
-		<div style="display: inline-block;">
-			<p style="padding-bottom: 1px;margin-bottom: 0;color:#a9a9a9 ">1、数据来源已发送给会所的优惠券</p>
-			<p style="padding-bottom: 1px;margin-bottom: 0;color:#a9a9a9 ">2、会所名称:表示优惠券派送给了哪个企业 </p>
-			<p style="padding-bottom: 1px;margin-bottom: 0;color:#a9a9a9 ">3、员工/企业名称:如果是会所员工分享的显示员工名称,会所分享则显示对应的企业名称</p>
-		</div>
-	</div>
-	<form:form id="searchForm" modelAttribute="cmCouponRecord" action="${ctx}/coupon/cmCouponRecord/" method="post" class="breadcrumb form-search">
-		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
-		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
-		<div class="ul-form">
-			<label>
-			ID:</label>
-			<form:input path="id" htmlEscape="false" maxlength="12" class="input-mini"/>
-            优惠码:</label>
-            <form:input path="couponCode" htmlEscape="false" maxlength="15" class="input-mini"/>
-			<label>
-			优惠码状态:</label>
-			<form:select path="status" class="input-mini">
-				<form:option value="" label="请选择"/>
-				<form:options items="${fns:getDictList('cm_coupon_record_status')}" itemLabel="label" itemValue="value"
-							  htmlEscape="false"/>
-			</form:select>
-			<label>
-			会所名称:</label>
-			<form:input path="companyName" htmlEscape="false" maxlength="20" class="input-medium"/>
-			&nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="筛选查询"/>
-			<div class="clearfix"></div>
-		</div>
-	</form:form>
-	<sys:message content="${message}"/>
-	<div class="table-div">
-	<table id="contentTable" class="table table-striped table-bordered table-condensed">
-		<thead>
-			<th>
-				ID
-			</th>
-			<th>
-				优惠码
-			</th>
-			<th>
-				优惠金额
-			</th>
-			<th>
-				相关订单ID
-			</th>
-			<th>
-				会所名称
-			</th>
-			<th>
-				员工/企业名称
-			</th>
-			<th>
-				分享时间
-			</th>
-			<th>
-				使用时间
-			</th>
-			<th>
-				过期时间
-			</th>
-			<th>
-				状态
-			</th>
-		</thead>
-		<tbody>
-		<c:forEach items="${page.list}" var="cmCouponRecord">
-			<tr>
-				<td>${cmCouponRecord.id}</td>
-				<td>${cmCouponRecord.couponCode}</td>
-				<td>${cmCouponRecord.couponAmount}</td>
-				<td>
-					<c:if test="${not empty cmCouponRecord.couponOrderCode}">
-						${cmCouponRecord.couponOrderCode}
-					</c:if>
-					<c:if test="${empty cmCouponRecord.couponOrderCode}">
-						暂无关联订单
-					</c:if>
-				</td>
-				<td>
-					<%--会所名字(优惠券的接收者)--%>
-					<c:if test="${not empty cmCouponRecord.clubName}">
-						${cmCouponRecord.clubName}
-					</c:if>
-					<c:if test="${empty cmCouponRecord.clubName}">
-						------
-					</c:if>
-				</td>
-				<td>
-				<%--企业和员工只存在一个人分享,二选一--%>
-					<%--1.员工--%>
-					<c:if test="${not empty cmCouponRecord.staffName}">
-						${cmCouponRecord.staffName}(员工)
-					</c:if>
-					<%--2.企业--%>
-					<c:if test="${not empty cmCouponRecord.companyName}">
-						${cmCouponRecord.companyName}(企业)
-					</c:if>
-					<c:if test="${empty cmCouponRecord.companyName && empty cmCouponRecord.staffName}">
-						------
-					</c:if>
-				</td>
-				<td>
-					<c:if test="${not empty cmCouponRecord.receiveDate}">
-						<fmt:formatDate value="${cmCouponRecord.receiveDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
-					</c:if>
-					<c:if test="${empty cmCouponRecord.receiveDate}">
-						暂未分享
-					</c:if>
-				</td>
-				<td>
-					<c:if test="${not empty cmCouponRecord.useDate}">
-						<fmt:formatDate value="${cmCouponRecord.useDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
-					</c:if>
-					<c:if test="${empty cmCouponRecord.useDate}">
-						暂未使用
-					</c:if>
-				</td>
-				<td>
-					<c:if test="${not empty cmCouponRecord.useEndDate}">
-						<fmt:formatDate value="${cmCouponRecord.useEndDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
-					</c:if>
-					<c:if test="${empty cmCouponRecord.useEndDate}">
-						--------
-					</c:if>
-				</td>
-				<td>
-					<%--状态 1已发放 2已分享 3已使用--%>
-					<c:if test="${cmCouponRecord.status eq 1}">
-						未分享
-					</c:if>
-					<c:if test="${cmCouponRecord.status eq 2}">
-						已分享
-					</c:if>
-					<c:if test="${cmCouponRecord.status eq 3}">
-						已使用
-					</c:if>
-					<c:if test="${cmCouponRecord.status eq 4}">
-						已过期
-					</c:if>
-				</td>
-			</tr>
-		</c:forEach>
-		</tbody>
-	</table>
-	</div>
-	<div class="pagination">${page}</div>
-</div>
-<script>
-    var User = function () {
-        this.init = function () {
-            //模拟上传excel
-            $("#uploadEventBtn").unbind("click").bind("click", function () {
-                $("#uploadEventFile").click();
-            });
-            $("#uploadEventFile").bind("change", function () {
-                $("#uploadEventPath").attr("value", $("#uploadEventFile").val());
-            });
-        };
-        //点击上传按钮
-        this.uploadBtn = function () {
-            var uploadEventFile = $("#uploadEventFile").val();
-            if (uploadEventFile == '') {
-                alert("请选择excel,再上传");
-            } else if (uploadEventFile.lastIndexOf(".xls") < 0) {//可判断以.xls和.xlsx结尾的excel
-                alert("只能上传Excel文件");
-            } else {
-                var url = '${ctx}/coupon/cmCoupon/import/';
-                var formData = new FormData($('form')[0]);
-                user.sendAjaxRequest(url, 'POST', formData);
-                window.location.reload();
-            }
-        };
-
-        this.sendAjaxRequest = function (url, type, data) {
-            $.ajax({
-                url: url,
-                type: type,
-                data: data,
-                dataType: "JSON",
-                success: function (res) {
-                    console.log(res)
-                    if (res.success) {
-                        window.location.reload();
-                    } else {
-                        alertx(res.msg);
-                    }
-                },
-                error: function (res) {
-                    console.log(res);
-                },
-                cache: false,
-                contentType: false,
-                processData: false
-            });
-        }
-    }
-
-    var user;
-    $(function () {
-        user = new User();
-        user.init();
-    });
-</script>
-</body>
-</html>

+ 0 - 329
src/main/webapp/WEB-INF/views/modules/coupon/cmCouponRecordScanList.jsp

@@ -1,329 +0,0 @@
-<%@ page contentType="text/html;charset=UTF-8" %>
-<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
-<html>
-<head>
-	<title>采美优惠券使用记录表管理</title>
-	<meta name="decorator" content="default"/>
-	<style type="text/css">
-		.table th{text-align: center;}
-		.table td{text-align: center;}
-		.main{margin: 20px 30px;}
-		.h3{margin-bottom: 10px;}
-		.mar-h3{margin: 20px 0;}
-		.p_messg{margin: 10px 0; color: #317eac}
-		.p_messg span{display: inline-block;width: 15px;height: 15px;border: 1px solid #317eac;border-radius: 50px;
-		text-align: center;line-height: 15px;margin-right: 5px; color: #317eac}
-		.search{width: 100%;height: 35px;line-height: 35px; background-color: #999; color: #fff;padding-left: 20px;box-sizing: border-box}
-		.table-div{margin-top: 30px;}
-	</style>
-	<script type="text/javascript">
-		$(document).ready(function() {
-			
-		});
-		function page(n,s){
-			$("#pageNo").val(n);
-			$("#pageSize").val(s);
-			$("#searchForm").submit();
-        	return false;
-        }
-
-        //状态修改
-        function updateEnabledStatus(status){
-            var msg='确定开启?';
-            if('1'==status){
-                msg='确定停用?';
-            }
-            top.$.jBox.confirm(msg,'系统提示',function(v,h,f){
-                if(v=='ok'){
-                    $.post("${ctx}/coupon/cmCouponRecordScan/updateEnabledStatus",{'enabledStatus':status}, function(data) {
-                        if(true==data.success){
-                            $.jBox.tip(data.msg, 'info');
-                        } else {
-                            $.jBox.tip(data.msg,'error');
-                        }
-                        $("#searchForm").submit();
-                    },"JSON");//这里返回的类型有:json,html,xml,text
-                }
-                return;
-            },{buttonsFocus:1,persistent: true});
-        }
-	</script>
-</head>
-<body>
-<%--<form enctype="multipart/form-data" id="batchUpload" action="${ctx}" method="post"
-	  class="form-horizontal">
-    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp<button class="btn btn-success btn-xs" id="uploadEventBtn" style="height:32px;" type="button">上传优惠券Excel文件</button>
-	<input type="file" name="file" style="width:0px;height:0px;" id="uploadEventFile">
-	<input id="uploadEventPath" disabled="disabled" type="text" placeholder="请选择excel表"
-		   style="border: 1px solid #e6e6e6; height: 32px;width: auto;">
-	<button type="button" class="btn btn-success btn-sm" onclick="user.uploadBtn()">提交</button>
-</form>--%>
-<div class="main">
-	<div class="breadcrumb">基本数据</div>
-    <div style="padding-left: 30px;">
-        <img src="/static/images/warning.png" style="display: inline-block;vertical-align: top;width: 18px;height: 18px;">
-        <div style="display: inline-block;">
-            <p style="padding-bottom: 1px;margin-bottom: 0;color:#a9a9a9 ">1、剩余数量:还没派送给会所的有效期内优惠券数量</p>
-            <p style="padding-bottom: 1px;margin-bottom: 0;color:#a9a9a9 ">2、已分享数量:会所分享出去的优惠券数量</p>
-			<p style="padding-bottom: 1px;margin-bottom: 0;color:#a9a9a9 ">3、未领取数量:扫码推送给用户但未填手机号领取的优惠券数量</p>
-            <p style="padding-bottom: 1px;margin-bottom: 0;color:#a9a9a9 ">4、已过期数量:分享出去但是客户未使用过期的或者是还未派发给会所就过期的优惠券数量</p>
-        </div>
-    </div>
-	<div>
-		<table class="table table-striped table-bordered table-condensed">
-			<thead>
-			<th>扫码推劵功能开关</th>
-			</thead>
-				<tbody>
-					<tr>
-						<td>
-							<shiro:hasPermission name="coupon:cmCouponRecordScan:edit">
-								<c:if test="${enabled.status eq 0 }">
-									<a href="javascript:void(0);" onclick="updateEnabledStatus('1');" >
-										<img alt="启用" src="/static/images/yes.gif" width="15px" border="none" title="启用">
-									</a>
-								</c:if>
-								<c:if test="${enabled.status ne 0 }">
-									<a href="javascript:void(0)" onclick="updateEnabledStatus('0');">
-										<img alt="停用" src="/static/images/no.gif" width="15px" border="none" title="停用">
-									</a>
-								</c:if>
-							</shiro:hasPermission>
-						</td>
-					</tr>
-				</tbody>
-		</table>
-	</div>
-		<div>
-			<table class="table table-striped table-bordered table-condensed">
-				<thead>
-				<th>优惠券类型</th>
-				<th>优惠券金额</th>
-				<th>剩余数量</th>
-				<th>未领取数量</th>
-				<th>已分享数量</th>
-				<th>已使用数量</th>
-				<th>已过期数量</th>
-				</thead>
-                <c:if test="${not empty cmCoupons}">
-				<tbody>
-				<c:forEach items="${cmCoupons}" var="coupon">
-					<tr>
-						<td>
-                                <c:if test="${coupon.couponType == 0}">
-                                    满减劵
-                                </c:if>
-                                <c:if test="${coupon.couponType == 1}">
-                                    折扣劵
-                                </c:if>
-                        </td>
-						<td>${coupon.couponAmount}</td>
-						<td>${coupon.lastAmount}</td>
-						<td>${coupon.unReceiveNum}</td>
-						<td>${coupon.shareAmount}</td>
-						<td>${coupon.usedAmount}</td>
-						<td>${coupon.timeOutAmount}</td>
-					</tr>
-				</c:forEach>
-				</tbody>
-                </c:if>
-			</table>
-            <c:if test="${empty cmCoupons}">
-                <text style="color:dodgerblue;display:block;text-align:center">暂无信息</text>
-            </c:if>
-		</div>
-
-	<div class="breadcrumb">优惠券使用记录</div>
-	<div style="padding-left: 30px;">
-		<img src="/static/images/warning.png" style="display: inline-block;vertical-align: top;width: 18px;height: 18px;">
-		<div style="display: inline-block;">
-			<p style="padding-bottom: 1px;margin-bottom: 0;color:#a9a9a9 ">1、数据来源公众号扫码已推送用户的优惠券</p>
-		</div>
-	</div>
-	<form:form id="searchForm" modelAttribute="cmCouponRecordScan" action="${ctx}/coupon/cmCouponRecordScan/scanCouponRecordList" method="post" class="breadcrumb form-search">
-		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
-		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
-		<div class="ul-form">
-			<label>
-			ID:</label>
-			<form:input path="id" htmlEscape="false" maxlength="12" class="input-mini"/>
-			<label>
-            优惠码:</label>
-            <form:input path="couponCode" htmlEscape="false" maxlength="15" class="input-mini"/>
-			<label>
-			优惠码状态:</label>
-			<form:select path="status" class="input-mini">
-				<form:option value="" label="请选择"/>
-				<form:options items="${fns:getDictList('cm_coupon_record_scan_status')}" itemLabel="label" itemValue="value"
-							  htmlEscape="false"/>
-			</form:select>
-			<label>
-			发劵人手机号:</label>
-			<form:input path="mobile" htmlEscape="false" maxlength="11" class="input-medium"/>
-			&nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="筛选查询"/>
-			<div class="clearfix"></div>
-		</div>
-	</form:form>
-	<sys:message content="${message}"/>
-	<div class="table-div">
-	<table id="contentTable" class="table table-striped table-bordered table-condensed">
-		<thead>
-			<th>
-				ID
-			</th>
-			<th>
-				优惠码
-			</th>
-			<th>
-				优惠金额
-			</th>
-			<th>
-				相关订单ID
-			</th>
-			<th>
-				发劵人手机
-			</th>
-			<th>
-				领取时间
-			</th>
-			<th>
-				使用时间
-			</th>
-			<th>
-				过期时间
-			</th>
-			<th>
-				状态
-			</th>
-		</thead>
-		<tbody>
-		<c:forEach items="${page.list}" var="cmCouponRecord">
-			<tr>
-				<td>${cmCouponRecord.id}</td>
-				<td>${cmCouponRecord.couponCode}</td>
-				<td>${cmCouponRecord.couponAmount}</td>
-				<td>
-					<c:if test="${not empty cmCouponRecord.couponOrderCode}">
-						${cmCouponRecord.couponOrderCode}
-					</c:if>
-					<c:if test="${empty cmCouponRecord.couponOrderCode}">
-						暂无关联订单
-					</c:if>
-				</td>
-				<td>
-					<%--发劵人手机号(优惠券的领取者)--%>
-					<c:if test="${not empty cmCouponRecord.mobile}">
-						${cmCouponRecord.mobile}
-					</c:if>
-					<c:if test="${empty cmCouponRecord.mobile}">
-						------
-					</c:if>
-				</td>
-				<td>
-					<c:if test="${not empty cmCouponRecord.receiveDate}">
-						<fmt:formatDate value="${cmCouponRecord.receiveDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
-					</c:if>
-					<c:if test="${empty cmCouponRecord.receiveDate}">
-						暂未领取
-					</c:if>
-				</td>
-				<td>
-					<c:if test="${not empty cmCouponRecord.useDate}">
-						<fmt:formatDate value="${cmCouponRecord.useDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
-					</c:if>
-					<c:if test="${empty cmCouponRecord.useDate}">
-						暂未使用
-					</c:if>
-				</td>
-				<td>
-					<c:if test="${not empty cmCouponRecord.useEndDate}">
-						<fmt:formatDate value="${cmCouponRecord.useEndDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
-					</c:if>
-					<c:if test="${empty cmCouponRecord.useEndDate}">
-						--------
-					</c:if>
-				</td>
-				<td>
-					<%--状态 1未领取(已推送) 2已领取(输入手机号) 3已分享(可多次分享 ) 4已使用--%>
-					<c:if test="${cmCouponRecord.status eq 1}">
-						未领取
-					</c:if>
-					<c:if test="${cmCouponRecord.status eq 2}">
-						已领取
-					</c:if>
-					<c:if test="${cmCouponRecord.status eq 3}">
-						已分享
-					</c:if>
-					<c:if test="${cmCouponRecord.status eq 4}">
-						已使用
-					</c:if>
-						<%--实际无该状态,过滤数据--%>
-					<c:if test="${cmCouponRecord.status eq 5}">
-						已过期
-					</c:if>
-				</td>
-			</tr>
-		</c:forEach>
-		</tbody>
-	</table>
-	</div>
-	<div class="pagination">${page}</div>
-</div>
-<script>
-    var User = function () {
-        this.init = function () {
-            //模拟上传excel
-            $("#uploadEventBtn").unbind("click").bind("click", function () {
-                $("#uploadEventFile").click();
-            });
-            $("#uploadEventFile").bind("change", function () {
-                $("#uploadEventPath").attr("value", $("#uploadEventFile").val());
-            });
-        };
-        //点击上传按钮
-        this.uploadBtn = function () {
-            var uploadEventFile = $("#uploadEventFile").val();
-            if (uploadEventFile == '') {
-                alert("请选择excel,再上传");
-            } else if (uploadEventFile.lastIndexOf(".xls") < 0) {//可判断以.xls和.xlsx结尾的excel
-                alert("只能上传Excel文件");
-            } else {
-                var url = '${ctx}/coupon/cmCoupon/import/';
-                var formData = new FormData($('form')[0]);
-                user.sendAjaxRequest(url, 'POST', formData);
-                window.location.reload();
-            }
-        };
-
-        this.sendAjaxRequest = function (url, type, data) {
-            $.ajax({
-                url: url,
-                type: type,
-                data: data,
-                dataType: "JSON",
-                success: function (res) {
-                    console.log(res)
-                    if (res.success) {
-                        window.location.reload();
-                    } else {
-                        alertx(res.msg);
-                    }
-                },
-                error: function (res) {
-                    console.log(res);
-                },
-                cache: false,
-                contentType: false,
-                processData: false
-            });
-        }
-    }
-
-    var user;
-    $(function () {
-        user = new User();
-        user.init();
-    });
-</script>
-</body>
-</html>

+ 144 - 0
src/main/webapp/WEB-INF/views/modules/coupon/couponCategoryForm.jsp

@@ -0,0 +1,144 @@
+<%@ page import="java.util.Date" %>
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
+<html>
+<head>
+    <title>优惠券管理</title>
+    <meta name="decorator" content="default"/>
+    <script type="text/javascript">
+        $(document).ready(function() {
+            //$("#name").focus();
+            $("#inputForm").validate({
+                submitHandler: function(form){
+                    var couponAmount = $("#couponAmount").val();
+                    var touchPrice = $("#touchPrice").val();
+                    if (couponAmount >= touchPrice) {
+                        alertx("优惠券金额必须小于优惠条件金额");
+                        return false;
+                    }
+                    var startDate = $("#startDate").val();
+                    var endDate = $("#endDate").val();
+                    if (startDate >= endDate) {
+                        alertx("结束时间不能早于开始时间");
+                        return false;
+                    }
+                    loading('正在提交,请稍等...');
+                    form.submit();
+                },
+                errorContainer: "#messageBox",
+                errorPlacement: function(error, element) {
+                    $("#messageBox").text("输入有误,请先更正。");
+                    if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
+                        error.appendTo(element.parent().parent());
+                    } else {
+                        error.insertAfter(element);
+                    }
+                }
+            });
+        });
+    </script>
+</head>
+<body>
+<ul class="nav nav-tabs">
+    <li><a href="${ctx}/coupon/cmCoupon/list?couponType=1">品类券</a></li>
+    <li class="active"><a href="${ctx}/coupon/cmCoupon/form?couponType=1&id=${cmCoupon.id}">${not empty cmCoupon.id?'编辑':'添加'}</a></li>
+</ul><br/>
+<font style="color: red;margin-left: 20px">品类券只适合在某种品类需要优惠时创建,适用于该品类商品和全部客户。</font><br><br>
+<form:form id="inputForm" modelAttribute="cmCoupon" action="${ctx}/coupon/cmCoupon/save" method="post" class="form-horizontal">
+    <form:hidden path="id"/>
+    <form:hidden path="productInfo" id="productInfo"/>
+    <input type="hidden" name="couponType" value="1"/>
+    <sys:message content="${message}"/>
+    <div class="control-group">
+        <label class="control-label"><font color="red">*</font>活动主题:</label>
+        <div class="controls">
+            <form:input path="name" htmlEscape="false" maxlength="30" placeholder="30个汉字以内" class="input-xlarge required"/>
+        </div>
+    </div>
+    <div class="control-group">
+        <label class="control-label"><font color="red">*</font>优惠券金额:</label>
+        <div class="controls">
+            <input type="number" id="couponAmount" name="couponAmount" value="${cmCoupon.couponAmount}" min="0" required>
+        </div>
+    </div>
+    <div class="control-group">
+        <label class="control-label"><font color="red">*</font>优惠条件:</label>
+        <div class="controls">
+            订单商品总额满&nbsp;&nbsp;&nbsp;&nbsp;<input type="number" name="touchPrice" id="touchPrice" value="${cmCoupon.touchPrice}" min="0" required>
+        </div>
+    </div>
+    <div class="control-group">
+        <label class="control-label"><font color="red">*</font>优惠品类:</label>
+        <div class="controls">
+            <form:radiobutton path="categoryType" value="1" label="产品" checked ="${empty cmCoupon.categoryType ? true:false}"/>
+            <form:radiobutton path="categoryType" value="2" label="仪器"/>
+        </div>
+    </div>
+    <div class="control-group">
+        <label class="control-label"><font color="red">*</font>开始时间:</label>
+        <div class="controls">
+            <input name="startDate" id="startDate" type="text" required readonly="readonly" maxlength="20" class="input-medium Wdate "
+                   value="<fmt:formatDate value="${cmCoupon.startDate}" pattern="yyyy-MM-dd HH:mm:ss"/>"
+                   onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
+        </div>
+    </div>
+    <div class="control-group">
+        <label class="control-label"><font color="red">*</font>结束时间:</label>
+        <div class="controls">
+            <input name="endDate" id="endDate" type="text" required readonly="readonly" maxlength="20" class="input-medium Wdate "
+                   value="<fmt:formatDate value="${cmCoupon.endDate}" pattern="yyyy-MM-dd HH:mm:ss"/>"
+                   onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
+        </div>
+    </div>
+    <div class="control-group">
+        <label class="control-label"><font color="red">*</font>优惠状态:</label>
+        <div class="controls">
+            <label id="initializeShow">
+                <c:if test="${empty cmCoupon.status || cmCoupon.status eq 0}">
+                    <font color="#800080">未生效</font>
+                </c:if>
+                <c:if test="${cmCoupon.status eq 1}">
+                    <font color="#00CC66">已生效</font>
+                </c:if>
+                <c:if test="${cmCoupon.status eq 2}">
+                    <font color="red">已关闭</font>
+                </c:if>
+                <c:if test="${cmCoupon.status eq 3}">
+                    <font color="#FF6600">已失效</font>
+                </c:if>
+            </label>
+            <label id="closeShow" style="display: none">
+                <font color="red">已关闭</font>
+            </label>
+            <input type="hidden" id="hiddenStatus" name="status" value="">
+            <input type="checkbox" id="status" name="status" value="2" ${cmCoupon.status eq "2" ? "checked" : ""} onclick="statusShow()" />关闭
+        </div>
+    </div>
+    <div class="form-actions">
+        <input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;
+        <input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
+    </div>
+</form:form>
+<script>
+    function statusShow() {
+        var status = $("input[name='status']:checked").val();
+        if (status == 2) {
+            $("#initializeShow").hide();
+            $("#closeShow").show();
+        } else {
+            $("#initializeShow").show();
+            $("#closeShow").hide();
+            $("#hiddenStatus").val(0);
+        }
+    }
+
+    /**
+     * @param obj
+     * jquery控制input只能输入数字
+     */
+    function onlynum(obj) {
+        obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
+    }
+</script>
+</body>
+</html>

+ 125 - 0
src/main/webapp/WEB-INF/views/modules/coupon/couponCategoryList.jsp

@@ -0,0 +1,125 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
+<html>
+<head>
+    <title>优惠券管理列表</title>
+    <meta name="decorator" content="default"/>
+    <style type="text/css">
+        .table th{text-align: center;}
+        .table td{text-align: center;}
+    </style>
+    <script type="text/javascript">
+        $(document).ready(function() {
+
+        });
+        function page(n,s){
+            $("#pageNo").val(n);
+            $("#pageSize").val(s);
+            $("#searchForm").submit();
+            return false;
+        }
+    </script>
+</head>
+<body>
+<ul class="nav nav-tabs">
+    <li><a href="${ctx}/coupon/cmCoupon/list?couponType=0">活动券</a></li>
+    <li class="active"><a href="${ctx}/coupon/cmCoupon/list?couponType=1">品类券</a></li>
+    <li><a href="${ctx}/coupon/cmCoupon/list?couponType=2">用户专享券</a></li>
+    <li><a href="${ctx}/coupon/cmCoupon/list?couponType=3">店铺券</a></li>
+    <li><a href="${ctx}/coupon/cmCoupon/list?couponType=4">新用户券</a></li>
+</ul>
+<form:form id="searchForm" modelAttribute="cmCoupon" action="${ctx}/coupon/cmCoupon/" method="post" class="breadcrumb form-search">
+    <input type="hidden" name="couponType" value="1"/>
+    <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
+    <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+    <div class="ul-form">
+        <label>活动主题:</label>
+        <form:input path="name" htmlEscape="false" maxlength="50" class="input-medium"/>
+        <label>优惠状态:</label>
+        <form:select path="status" class="input-medium required">
+            <form:option value="" label="所有"/>
+            <form:option value="0" label="未生效"/>
+            <form:option value="1" label="已生效"/>
+            <form:option value="2" label="已关闭"/>
+            <form:option value="3" label="已失效"/>
+        </form:select>
+        <label>优惠时间:</label>
+        <input name="startDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
+               value="<fmt:formatDate value="${cmCoupon.startDate}" pattern="yyyy-MM-dd HH:mm:ss"/>"
+               onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/> -
+        <input name="endDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
+               value="<fmt:formatDate value="${cmCoupon.endDate}" pattern="yyyy-MM-dd HH:mm:ss"/>"
+               onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
+        &nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
+        <input class="btn btn-primary" style="width: 80px" onclick="window.location='${ctx}/coupon/cmCoupon/form?couponType=1'" value="添加品类券"/>
+        <div class="clearfix"></div>
+    </div>
+</form:form>
+<sys:message content="${message}"/>
+<table id="contentTable" class="table table-striped table-bordered table-condensed">
+    <thead>
+    <tr>
+        <th>ID</th>
+        <th>活动主题</th>
+        <th>优惠券金额</th>
+        <th>优惠条件</th>
+        <th>优惠状态</th>
+        <th>优惠品类</th>
+        <th>开始时间</th>
+        <th>结束时间</th>
+        <th>添加时间</th>
+        <th>操作</th>
+    </tr>
+    </thead>
+    <tbody>
+    <c:forEach items="${page.list}" var="cmCoupon">
+        <tr>
+            <td>
+                    ${cmCoupon.id}
+            </td>
+            <td>
+                    ${cmCoupon.name}
+            </td>
+            <td>
+                    ${cmCoupon.couponAmount}
+            </td>
+            <td>
+                满${cmCoupon.touchPrice}
+            </td>
+            <td>
+                <c:if test="${cmCoupon.status eq 0}">
+                    <font color="#800080">未生效</font>
+                </c:if>
+                <c:if test="${cmCoupon.status eq 1}">
+                    <font color="#00CC66">已生效</font>
+                </c:if>
+                <c:if test="${cmCoupon.status eq 2}">
+                    <font color="red">已关闭</font>
+                </c:if>
+                <c:if test="${cmCoupon.status eq 3}">
+                    <font color="#FF6600">已失效</font>
+                </c:if>
+            </td>
+            <td>${cmCoupon.categoryType eq 1 ? "产品":"仪器"}</td>
+            <td>
+                <fmt:formatDate value="${cmCoupon.startDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
+            </td>
+            <td>
+                <fmt:formatDate value="${cmCoupon.endDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
+            </td>
+            <td>
+                <fmt:formatDate value="${cmCoupon.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
+            </td>
+            <td>
+                <a href="${ctx}/coupon/cmCoupon/form?id=${cmCoupon.id}">编辑</a>
+                <a href="${ctx}/coupon/cmCoupon/close?id=${cmCoupon.id}" onclick="return confirmx('确定关闭该优惠券吗?', this.href)">关闭</a>
+                <a href="${ctx}/coupon/cmCoupon/delete?id=${cmCoupon.id}" onclick="return confirmx('确定删除该优惠券吗?', this.href)">删除</a>
+                <a href="">领取门户</a>
+            </td>
+        </tr>
+    </c:forEach>
+    </tbody>
+</table>
+<div class="pagination">${page}</div>
+</body>
+</html>

+ 131 - 0
src/main/webapp/WEB-INF/views/modules/coupon/couponNewUserForm.jsp

@@ -0,0 +1,131 @@
+<%@ page import="java.util.Date" %>
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
+<html>
+<head>
+    <title>优惠券管理</title>
+    <meta name="decorator" content="default"/>
+    <script type="text/javascript">
+        $(document).ready(function() {
+            //$("#name").focus();
+            $("#inputForm").validate({
+                submitHandler: function(form){
+                    var couponAmount = $("#couponAmount").val();
+                    var touchPrice = $("#touchPrice").val();
+                    if (couponAmount >= touchPrice) {
+                        alertx("优惠券金额必须小于优惠条件金额");
+                        return false;
+                    }
+                    var startDate = $("#startDate").val();
+                    var endDate = $("#endDate").val();
+                    if (startDate >= endDate) {
+                        alertx("结束时间不能早于开始时间");
+                        return false;
+                    }
+                    loading('正在提交,请稍等...');
+                    form.submit();
+                },
+                errorContainer: "#messageBox",
+                errorPlacement: function(error, element) {
+                    $("#messageBox").text("输入有误,请先更正。");
+                    if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
+                        error.appendTo(element.parent().parent());
+                    } else {
+                        error.insertAfter(element);
+                    }
+                }
+            });
+        });
+    </script>
+</head>
+<body>
+<ul class="nav nav-tabs">
+    <li><a href="${ctx}/coupon/cmCoupon/list?couponType=4">新用户券</a></li>
+    <li class="active"><a href="${ctx}/coupon/cmCoupon/form?couponType=4&id=${cmCoupon.id}">${not empty cmCoupon.id?'编辑':'添加'}</a></li>
+</ul><br/>
+<font style="color: red;margin-left: 20px">新用户券适合新注册的机构,并且适用于商城全部商品(不包括二手商品)。</font><br><br>
+<form:form id="inputForm" modelAttribute="cmCoupon" action="${ctx}/coupon/cmCoupon/save" method="post" class="form-horizontal">
+    <form:hidden path="id"/>
+    <form:hidden path="productInfo" id="productInfo"/>
+    <input type="hidden" name="couponType" value="4"/>
+    <sys:message content="${message}"/>
+    <div class="control-group">
+        <label class="control-label"><font color="red">*</font>优惠券金额:</label>
+        <div class="controls">
+            <input type="number" id="couponAmount" name="couponAmount" value="${cmCoupon.couponAmount}" min="0" required>
+        </div>
+    </div>
+    <div class="control-group">
+        <label class="control-label"><font color="red">*</font>优惠条件:</label>
+        <div class="controls">
+            订单商品总额满&nbsp;&nbsp;&nbsp;&nbsp;<input type="number" name="touchPrice" id="touchPrice" value="${cmCoupon.touchPrice}" min="0" required>
+        </div>
+    </div>
+    <div class="control-group">
+        <label class="control-label"><font color="red">*</font>开始时间:</label>
+        <div class="controls">
+            <input name="startDate" id="startDate" type="text" required readonly="readonly" maxlength="20" class="input-medium Wdate "
+                   value="<fmt:formatDate value="${cmCoupon.startDate}" pattern="yyyy-MM-dd HH:mm:ss"/>"
+                   onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
+        </div>
+    </div>
+    <div class="control-group">
+        <label class="control-label"><font color="red">*</font>结束时间:</label>
+        <div class="controls">
+            <input name="endDate" id="endDate" type="text" required readonly="readonly" maxlength="20" class="input-medium Wdate "
+                   value="<fmt:formatDate value="${cmCoupon.endDate}" pattern="yyyy-MM-dd HH:mm:ss"/>"
+                   onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
+        </div>
+    </div>
+    <div class="control-group">
+        <label class="control-label"><font color="red">*</font>优惠状态:</label>
+        <div class="controls">
+            <label id="initializeShow">
+                <c:if test="${empty cmCoupon.status || cmCoupon.status eq 0}">
+                    <font color="#800080">未生效</font>
+                </c:if>
+                <c:if test="${cmCoupon.status eq 1}">
+                    <font color="#00CC66">已生效</font>
+                </c:if>
+                <c:if test="${cmCoupon.status eq 2}">
+                    <font color="red">已关闭</font>
+                </c:if>
+                <c:if test="${cmCoupon.status eq 3}">
+                    <font color="#FF6600">已失效</font>
+                </c:if>
+            </label>
+            <label id="closeShow" style="display: none">
+                <font color="red">已关闭</font>
+            </label>
+            <input type="hidden" id="hiddenStatus" name="status" value="">
+            <input type="checkbox" id="status" name="status" value="2" ${cmCoupon.status eq "2" ? "checked" : ""} onclick="statusShow()" />关闭
+        </div>
+    </div>
+    <div class="form-actions">
+        <input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;
+        <input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
+    </div>
+</form:form>
+<script>
+    function statusShow() {
+        var status = $("input[name='status']:checked").val();
+        if (status == 2) {
+            $("#initializeShow").hide();
+            $("#closeShow").show();
+        } else {
+            $("#initializeShow").show();
+            $("#closeShow").hide();
+            $("#hiddenStatus").val(0);
+        }
+    }
+
+    /**
+     * @param obj
+     * jquery控制input只能输入数字
+     */
+    function onlynum(obj) {
+        obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
+    }
+</script>
+</body>
+</html>

+ 117 - 0
src/main/webapp/WEB-INF/views/modules/coupon/couponNewUserList.jsp

@@ -0,0 +1,117 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
+<html>
+<head>
+    <title>优惠券管理列表</title>
+    <meta name="decorator" content="default"/>
+    <style type="text/css">
+        .table th{text-align: center;}
+        .table td{text-align: center;}
+    </style>
+    <script type="text/javascript">
+        $(document).ready(function() {
+
+        });
+        function page(n,s){
+            $("#pageNo").val(n);
+            $("#pageSize").val(s);
+            $("#searchForm").submit();
+            return false;
+        }
+    </script>
+</head>
+<body>
+<ul class="nav nav-tabs">
+    <li><a href="${ctx}/coupon/cmCoupon/list?couponType=0">活动券</a></li>
+    <li><a href="${ctx}/coupon/cmCoupon/list?couponType=1">品类券</a></li>
+    <li><a href="${ctx}/coupon/cmCoupon/list?couponType=2">用户专享券</a></li>
+    <li><a href="${ctx}/coupon/cmCoupon/list?couponType=3">店铺券</a></li>
+    <li class="active"><a href="${ctx}/coupon/cmCoupon/list?couponType=4">新用户券</a></li>
+</ul>
+<form:form id="searchForm" modelAttribute="cmCoupon" action="${ctx}/coupon/cmCoupon/" method="post" class="breadcrumb form-search">
+    <input type="hidden" name="couponType" value="4"/>
+    <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
+    <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+    <div class="ul-form">
+        <label>优惠状态:</label>
+        <form:select path="status" class="input-medium required">
+            <form:option value="" label="所有"/>
+            <form:option value="0" label="未生效"/>
+            <form:option value="1" label="已生效"/>
+            <form:option value="2" label="已关闭"/>
+            <form:option value="3" label="已失效"/>
+        </form:select>
+        <label>优惠时间:</label>
+        <input name="startDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
+               value="<fmt:formatDate value="${cmCoupon.startDate}" pattern="yyyy-MM-dd HH:mm:ss"/>"
+               onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/> -
+        <input name="endDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
+               value="<fmt:formatDate value="${cmCoupon.endDate}" pattern="yyyy-MM-dd HH:mm:ss"/>"
+               onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
+        &nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
+        <input class="btn btn-primary" style="width: 90px" onclick="window.location='${ctx}/coupon/cmCoupon/form?couponType=4'" value="添加新用户券"/>
+        <div class="clearfix"></div>
+    </div>
+</form:form>
+<sys:message content="${message}"/>
+<table id="contentTable" class="table table-striped table-bordered table-condensed">
+    <thead>
+    <tr>
+        <th>ID</th>
+        <th>优惠券金额</th>
+        <th>优惠条件</th>
+        <th>优惠状态</th>
+        <th>开始时间</th>
+        <th>结束时间</th>
+        <th>添加时间</th>
+        <th>操作</th>
+    </tr>
+    </thead>
+    <tbody>
+    <c:forEach items="${page.list}" var="cmCoupon">
+        <tr>
+            <td>
+                    ${cmCoupon.id}
+            </td>
+            <td>
+                    ${cmCoupon.couponAmount}
+            </td>
+            <td>
+                满${cmCoupon.touchPrice}
+            </td>
+            <td>
+                <c:if test="${cmCoupon.status eq 0}">
+                    <font color="#800080">未生效</font>
+                </c:if>
+                <c:if test="${cmCoupon.status eq 1}">
+                    <font color="#00CC66">已生效</font>
+                </c:if>
+                <c:if test="${cmCoupon.status eq 2}">
+                    <font color="red">已关闭</font>
+                </c:if>
+                <c:if test="${cmCoupon.status eq 3}">
+                    <font color="#FF6600">已失效</font>
+                </c:if>
+            </td>
+            <td>
+                <fmt:formatDate value="${cmCoupon.startDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
+            </td>
+            <td>
+                <fmt:formatDate value="${cmCoupon.endDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
+            </td>
+            <td>
+                <fmt:formatDate value="${cmCoupon.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
+            </td>
+            <td>
+                <a href="${ctx}/coupon/cmCoupon/form?id=${cmCoupon.id}">编辑</a>
+                <a href="${ctx}/coupon/cmCoupon/close?id=${cmCoupon.id}" onclick="return confirmx('确定关闭该优惠券吗?', this.href)">关闭</a>
+                <a href="${ctx}/coupon/cmCoupon/delete?id=${cmCoupon.id}" onclick="return confirmx('确定删除该优惠券吗?', this.href)">删除</a>
+                <a href="">领取门户</a>
+            </td>
+        </tr>
+    </c:forEach>
+    </tbody>
+</table>
+<div class="pagination">${page}</div>
+</body>
+</html>

+ 271 - 0
src/main/webapp/WEB-INF/views/modules/coupon/couponShopForm.jsp

@@ -0,0 +1,271 @@
+<%@ page import="java.util.Date" %>
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
+<html>
+<head>
+    <title>优惠券管理</title>
+    <meta name="decorator" content="default"/>
+    <script type="text/javascript">
+        $(document).ready(function () {
+            $("#inputForm").validate({
+                submitHandler: function (form) {
+                    if (imageList.length > 0) {
+                        var shopInfo = JSON.stringify(imageList);
+                        $('#shopInfo').val(shopInfo);
+                    } else {
+                        alertx("请选择供应商");
+                        return false;
+                    }
+                    var couponAmount = $("#couponAmount").val();
+                    var touchPrice = $("#touchPrice").val();
+                    if (couponAmount >= touchPrice) {
+                        alertx("优惠券金额必须小于优惠条件金额");
+                        return false;
+                    }
+                    var startDate = $("#startDate").val();
+                    var endDate = $("#endDate").val();
+                    if (startDate >= endDate) {
+                        alertx("结束时间不能早于开始时间");
+                        return false;
+                    }
+                    loading('正在提交,请稍等...');
+                    form.submit();
+                },
+                errorContainer: "#messageBox",
+                errorPlacement: function (error, element) {
+                    $("#messageBox").text("输入有误,请先更正。");
+                    if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
+                        error.appendTo(element.parent().parent());
+                    } else {
+                        error.insertAfter(element);
+                    }
+                }
+            });
+        });
+    </script>
+</head>
+<body>
+<ul class="nav nav-tabs">
+    <li><a href="${ctx}/coupon/cmCoupon/list?couponType=3">店铺券</a></li>
+    <li class="active"><a
+            href="${ctx}/coupon/cmCoupon/form?couponType=3&id=${cmCoupon.id}">${not empty cmCoupon.id?'编辑':'添加'}</a>
+    </li>
+</ul>
+<br/>
+<font style="color: red;margin-left: 20px">店铺券适合给特定的供应商做活动时创建,并且适用于供应商的全部商品。</font><br><br>
+<form:form id="inputForm" modelAttribute="cmCoupon" action="${ctx}/coupon/cmCoupon/save" method="post" class="form-horizontal">
+    <form:hidden path="id"/>
+    <form:hidden path="shopInfo" id="shopInfo"/>
+    <input type="hidden" name="couponType" value="3"/>
+    <sys:message content="${message}"/>
+    <div class="control-group">
+        <label class="control-label"><font color="red">*</font>活动主题:</label>
+        <div class="controls">
+            <form:input path="name" htmlEscape="false" maxlength="30" placeholder="30个汉字以内" class="input-xlarge required"/>
+        </div>
+    </div>
+    <div class="control-group">
+        <label class="control-label"><font color="red">*</font>供应商:</label>
+        <div class="controls">
+            <a href="javascript:void(0);" onclick="showSelect()" id="chooseClub">请选择供应商</a>
+            <table id="contentTable" class="table table-striped table-bordered table-condensed" hidden="hidden">
+                <thead>
+                <tr>
+                    <th>机构名称</th>
+                    <th>机构简称</th>
+                    <th>联系人</th>
+                    <th>手机号</th>
+                    <th>操作</th>
+                </tr>
+                </thead>
+                <tbody id="hotSearch"></tbody>
+            </table>
+        </div>
+    </div>
+    <div class="control-group">
+        <label class="control-label"><font color="red">*</font>优惠券金额:</label>
+        <div class="controls">
+            <input type="number" id="couponAmount" name="couponAmount" value="${cmCoupon.couponAmount}" min="0"
+                   required>
+        </div>
+    </div>
+    <div class="control-group">
+        <label class="control-label"><font color="red">*</font>优惠条件:</label>
+        <div class="controls">
+            订单商品总额满&nbsp;&nbsp;&nbsp;&nbsp;<input type="number" name="touchPrice" id="touchPrice"
+                                                  value="${cmCoupon.touchPrice}" min="0" required>
+        </div>
+    </div>
+    <div class="control-group">
+        <label class="control-label"><font color="red">*</font>开始时间:</label>
+        <div class="controls">
+            <input name="startDate" id="startDate" type="text" required readonly="readonly" maxlength="20"
+                   class="input-medium Wdate "
+                   value="<fmt:formatDate value="${cmCoupon.startDate}" pattern="yyyy-MM-dd HH:mm:ss"/>"
+                   onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
+        </div>
+    </div>
+    <div class="control-group">
+        <label class="control-label"><font color="red">*</font>结束时间:</label>
+        <div class="controls">
+            <input name="endDate" id="endDate" type="text" required readonly="readonly" maxlength="20"
+                   class="input-medium Wdate "
+                   value="<fmt:formatDate value="${cmCoupon.endDate}" pattern="yyyy-MM-dd HH:mm:ss"/>"
+                   onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
+        </div>
+    </div>
+    <div class="control-group">
+        <label class="control-label"><font color="red">*</font>优惠状态:</label>
+        <div class="controls">
+            <label id="initializeShow">
+                <c:if test="${empty cmCoupon.status || cmCoupon.status eq 0}">
+                    <font color="#800080">未生效</font>
+                </c:if>
+                <c:if test="${cmCoupon.status eq 1}">
+                    <font color="#00CC66">已生效</font>
+                </c:if>
+                <c:if test="${cmCoupon.status eq 2}">
+                    <font color="red">已关闭</font>
+                </c:if>
+                <c:if test="${cmCoupon.status eq 3}">
+                    <font color="#FF6600">已失效</font>
+                </c:if>
+            </label>
+            <label id="closeShow" style="display: none">
+                <font color="red">已关闭</font>
+            </label>
+            <input type="hidden" id="hiddenStatus" name="status" value="">
+            <input type="checkbox" id="status" name="status" value="2" ${cmCoupon.status eq "2" ? "checked" : ""}
+                   onclick="statusShow()"/>关闭
+        </div>
+    </div>
+    <div class="form-actions">
+        <input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;
+        <input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
+    </div>
+</form:form>
+<script>
+    var shopIds = '';
+    var imageList = [];
+
+    $(function () {
+        <c:forEach items="${cmCoupon.shopList}" var="shop" varStatus="index">
+            imageList.push({
+                "id": "${shop.id}",
+                "shopId": "${shop.shopID}",
+                "name": "${shop.name}",
+                "sname": "${shop.sname}",
+                "linkMan": "${shop.linkMan}",
+                "contractMobile": "${shop.contractMobile}"
+            });
+        </c:forEach>
+        if (imageList.length > 0) {
+            $('#contentTable').show();
+            insertHtml(imageList);
+        }
+    });
+
+
+    function appendShopOrderHead(data, index) {
+        var html = '<tr id ="ai' + index + '">' +
+            '<td>' +
+            data.name +
+            '</td>' +
+            '<td>' +
+            data.sname +
+            '</td>' +
+            '<td>' +
+            data.linkMan +
+            '</td>' +
+            '<td>' +
+            data.contractMobile +
+            '</td>' +
+            '<td>' +
+            '<a href="javascript:;" onclick="delect(' + index + ')">删除</a>' +
+            '</td>' +
+            '</tr>';
+        return html;
+    }
+
+    function insertHtml(list) {
+        var html = '';
+        shopIds = '';
+        list.forEach(function (item, index) {
+            html += appendShopOrderHead(item, index);
+            shopIds += "," + item.shopId;
+        });
+        $("#hotSearch").html(html);
+    }
+
+
+    function statusShow() {
+        var status = $("input[name='status']:checked").val();
+        if (status == 2) {
+            $("#initializeShow").hide();
+            $("#closeShow").show();
+        } else {
+            $("#initializeShow").show();
+            $("#closeShow").hide();
+            $("#hiddenStatus").val(0);
+        }
+    }
+
+    //点击添加
+    function showSelect() {
+        var url = "${ctx}/coupon/cmCoupon/toAddShop?shopIds=" + shopIds;
+        var title = '';
+        title = "选择供应商";
+        top.$.jBox("iframe:" + url, {
+            iframeScrolling: 'yes',
+            width: $(top.document).width() - 400,
+            height: $(top.document).height() - 160,
+            persistent: true,
+            title: title,
+            buttons: {"确定": '1', "取消": '-1'},
+            submit: function (v, h, f) {
+                //确定
+                var $jboxFrame = top.$('#jbox-iframe');
+                var $mainFrame = top.$('#mainFrame');
+                if ('1' == v && 1 == $jboxFrame.size() && 1 == $mainFrame.size()) {
+                    var items = $jboxFrame[0].contentWindow.getCheckedItems();
+                    console.log(items);
+                    console.log(items[0]);
+                    for (var i = 0; i < items.length; i++) {
+                        console.log(items[i]);
+                        imageList.push(items[i]);
+                        $('#contentTable').show();
+                    }
+                    insertHtml(imageList);
+                }
+                return true;
+            }
+        });
+    }
+
+    /**
+     * 删除操作
+     */
+    function delect(index) {
+        return confirmx("确定删除吗?", function () {
+            var image = imageList[index];
+            if (image.shopId != '') {
+                shopIds = shopIds.replace(image.shopId,"");
+            }
+            imageList.splice(index, 1);
+            insertHtml(imageList);
+            if (imageList.length == 0) {
+                $('#contentTable').hide();
+            }
+        });
+    }
+
+    /**
+     * @param obj
+     * jquery控制input只能输入数字
+     */
+    function onlynum(obj) {
+        obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
+    }
+</script>
+</body>
+</html>

+ 131 - 0
src/main/webapp/WEB-INF/views/modules/coupon/couponShopList.jsp

@@ -0,0 +1,131 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
+<html>
+<head>
+    <title>优惠券管理列表</title>
+    <meta name="decorator" content="default"/>
+    <style type="text/css">
+        .table th{text-align: center;}
+        .table td{text-align: center;}
+    </style>
+    <script type="text/javascript">
+        $(document).ready(function() {
+
+        });
+        function page(n,s){
+            $("#pageNo").val(n);
+            $("#pageSize").val(s);
+            $("#searchForm").submit();
+            return false;
+        }
+    </script>
+</head>
+<body>
+<ul class="nav nav-tabs">
+    <li><a href="${ctx}/coupon/cmCoupon/list?couponType=0">活动券</a></li>
+    <li><a href="${ctx}/coupon/cmCoupon/list?couponType=1">品类券</a></li>
+    <li><a href="${ctx}/coupon/cmCoupon/list?couponType=2">用户专享券</a></li>
+    <li class="active"><a href="${ctx}/coupon/cmCoupon/list?couponType=3">店铺券</a></li>
+    <li><a href="${ctx}/coupon/cmCoupon/list?couponType=4">新用户券</a></li>
+</ul>
+<form:form id="searchForm" modelAttribute="cmCoupon" action="${ctx}/coupon/cmCoupon/" method="post" class="breadcrumb form-search">
+    <input type="hidden" name="couponType" value="3"/>
+    <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
+    <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+    <div class="ul-form">
+        <label>活动主题:</label>
+        <form:input path="name" htmlEscape="false" maxlength="50" class="input-medium"/>
+        <label>供应商名称:</label>
+        <form:input path="shopName" htmlEscape="false" maxlength="50" class="input-medium"/>
+        <label>优惠状态:</label>
+        <form:select path="status" class="input-medium required">
+            <form:option value="" label="所有"/>
+            <form:option value="0" label="未生效"/>
+            <form:option value="1" label="已生效"/>
+            <form:option value="2" label="已关闭"/>
+            <form:option value="3" label="已失效"/>
+        </form:select><br><br>
+        <label>优惠时间:</label>
+        <input name="startDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
+               value="<fmt:formatDate value="${cmCoupon.startDate}" pattern="yyyy-MM-dd HH:mm:ss"/>"
+               onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/> -
+        <input name="endDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
+               value="<fmt:formatDate value="${cmCoupon.endDate}" pattern="yyyy-MM-dd HH:mm:ss"/>"
+               onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
+        &nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
+        <input class="btn btn-primary" style="width: 80px" onclick="window.location='${ctx}/coupon/cmCoupon/form?couponType=3'" value="添加店铺券"/>
+        <div class="clearfix"></div>
+    </div>
+</form:form>
+<sys:message content="${message}"/>
+<table id="contentTable" class="table table-striped table-bordered table-condensed">
+    <thead>
+    <tr>
+        <th>ID</th>
+        <th>活动主题</th>
+        <th>供应商</th>
+        <th>优惠券金额</th>
+        <th>优惠条件</th>
+        <th>优惠状态</th>
+        <th>开始时间</th>
+        <th>结束时间</th>
+        <th>添加时间</th>
+        <th>操作</th>
+    </tr>
+    </thead>
+    <tbody>
+    <c:forEach items="${page.list}" var="cmCoupon">
+        <tr>
+            <td>
+                    ${cmCoupon.id}
+            </td>
+            <td>
+                    ${cmCoupon.name}
+            </td>
+            <td>
+                <c:forEach items="${cmCoupon.shopList}" var="shop">
+                    ${shop.name}<br>
+                </c:forEach>
+            </td>
+            <td>
+                    ${cmCoupon.couponAmount}
+            </td>
+            <td>
+                满${cmCoupon.touchPrice}
+            </td>
+            <td>
+                <c:if test="${cmCoupon.status eq 0}">
+                    <font color="#800080">未生效</font>
+                </c:if>
+                <c:if test="${cmCoupon.status eq 1}">
+                    <font color="#00CC66">已生效</font>
+                </c:if>
+                <c:if test="${cmCoupon.status eq 2}">
+                    <font color="red">已关闭</font>
+                </c:if>
+                <c:if test="${cmCoupon.status eq 3}">
+                    <font color="#FF6600">已失效</font>
+                </c:if>
+            </td>
+            <td>
+                <fmt:formatDate value="${cmCoupon.startDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
+            </td>
+            <td>
+                <fmt:formatDate value="${cmCoupon.endDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
+            </td>
+            <td>
+                <fmt:formatDate value="${cmCoupon.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
+            </td>
+            <td>
+                <a href="${ctx}/coupon/cmCoupon/form?id=${cmCoupon.id}">编辑</a>
+                <a href="${ctx}/coupon/cmCoupon/close?id=${cmCoupon.id}" onclick="return confirmx('确定关闭该优惠券吗?', this.href)">关闭</a>
+                <a href="${ctx}/coupon/cmCoupon/delete?id=${cmCoupon.id}" onclick="return confirmx('确定删除该优惠券吗?', this.href)">删除</a>
+                <a href="">领取门户</a>
+            </td>
+        </tr>
+    </c:forEach>
+    </tbody>
+</table>
+<div class="pagination">${page}</div>
+</body>
+</html>

+ 247 - 0
src/main/webapp/WEB-INF/views/modules/coupon/couponUserExclusiveForm.jsp

@@ -0,0 +1,247 @@
+<%@ page import="java.util.Date" %>
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
+<html>
+<head>
+    <title>优惠券管理</title>
+    <meta name="decorator" content="default"/>
+    <script type="text/javascript">
+        $(document).ready(function () {
+            //$("#name").focus();
+            $("#inputForm").validate({
+                submitHandler: function (form) {
+                    var couponAmount = $("#couponAmount").val();
+                    var touchPrice = $("#touchPrice").val();
+                    if (couponAmount >= touchPrice) {
+                        alertx("优惠券金额必须小于优惠条件金额");
+                        return false;
+                    }
+                    var startDate = $("#startDate").val();
+                    var endDate = $("#endDate").val();
+                    if (startDate >= endDate) {
+                        alertx("结束时间不能早于开始时间");
+                        return false;
+                    }
+                    var userId = $("#userId").val();
+                    if (userId == null || userId == "") {
+                        alertx("请选择机构");
+                        return false;
+                    }
+                    loading('正在提交,请稍等...');
+                    form.submit();
+                },
+                errorContainer: "#messageBox",
+                errorPlacement: function (error, element) {
+                    $("#messageBox").text("输入有误,请先更正。");
+                    if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
+                        error.appendTo(element.parent().parent());
+                    } else {
+                        error.insertAfter(element);
+                    }
+                }
+            });
+        });
+    </script>
+</head>
+<body>
+<ul class="nav nav-tabs">
+    <li><a href="${ctx}/coupon/cmCoupon/list?couponType=2">用户专享券</a></li>
+    <li class="active"><a
+            href="${ctx}/coupon/cmCoupon/form?couponType=2&id=${cmCoupon.id}">${not empty cmCoupon.id?'编辑':'添加'}</a>
+    </li>
+</ul>
+<br/>
+<font style="color: red;margin-left: 20px">用户专享券适合在需要给特定客户返利时创建,并且适用于商城全部商品(不包括二手商品)。</font><br><br>
+<form:form id="inputForm" modelAttribute="cmCoupon" action="${ctx}/coupon/cmCoupon/save" method="post" class="form-horizontal">
+    <form:hidden path="id"/>
+    <form:hidden path="productInfo" id="productInfo"/>
+    <input type="hidden" name="couponType" value="2"/>
+    <sys:message content="${message}"/>
+    <div class="control-group">
+        <label class="control-label"><font color="red">*</font>机构:</label>
+        <div class="controls">
+            <a href="javascript:void(0);" onclick="showSelect()" id="chooseClub">请选择机构</a>
+            <input type="hidden" name="userId" id="userId" value="${cmCoupon.userId}">
+            <table id="contentTable" class="table table-striped table-bordered table-condensed" hidden="hidden">
+                <thead>
+                <tr>
+                    <th>机构名称</th>
+                    <th>机构简称</th>
+                    <th>联系人</th>
+                    <th>手机号</th>
+                    <th>操作</th>
+                </tr>
+                </thead>
+                <tbody id="hotSearch"></tbody>
+            </table>
+        </div>
+    </div>
+    <div class="control-group">
+        <label class="control-label"><font color="red">*</font>优惠券金额:</label>
+        <div class="controls">
+            <input type="number" id="couponAmount" name="couponAmount" value="${cmCoupon.couponAmount}" min="0"
+                   required>
+        </div>
+    </div>
+    <div class="control-group">
+        <label class="control-label"><font color="red">*</font>优惠条件:</label>
+        <div class="controls">
+            订单商品总额满&nbsp;&nbsp;&nbsp;&nbsp;<input type="number" name="touchPrice" id="touchPrice"
+                                                  value="${cmCoupon.touchPrice}" min="0" required>
+        </div>
+    </div>
+    <div class="control-group">
+        <label class="control-label"><font color="red">*</font>开始时间:</label>
+        <div class="controls">
+            <input name="startDate" id="startDate" type="text" required readonly="readonly" maxlength="20"
+                   class="input-medium Wdate "
+                   value="<fmt:formatDate value="${cmCoupon.startDate}" pattern="yyyy-MM-dd HH:mm:ss"/>"
+                   onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
+        </div>
+    </div>
+    <div class="control-group">
+        <label class="control-label"><font color="red">*</font>结束时间:</label>
+        <div class="controls">
+            <input name="endDate" id="endDate" type="text" required readonly="readonly" maxlength="20"
+                   class="input-medium Wdate "
+                   value="<fmt:formatDate value="${cmCoupon.endDate}" pattern="yyyy-MM-dd HH:mm:ss"/>"
+                   onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
+        </div>
+    </div>
+    <div class="control-group">
+        <label class="control-label"><font color="red">*</font>优惠状态:</label>
+        <div class="controls">
+            <label id="initializeShow">
+                <c:if test="${empty cmCoupon.status || cmCoupon.status eq 0}">
+                    <font color="#800080">未生效</font>
+                </c:if>
+                <c:if test="${cmCoupon.status eq 1}">
+                    <font color="#00CC66">已生效</font>
+                </c:if>
+                <c:if test="${cmCoupon.status eq 2}">
+                    <font color="red">已关闭</font>
+                </c:if>
+                <c:if test="${cmCoupon.status eq 3}">
+                    <font color="#FF6600">已失效</font>
+                </c:if>
+            </label>
+            <label id="closeShow" style="display: none">
+                <font color="red">已关闭</font>
+            </label>
+            <input type="hidden" id="hiddenStatus" name="status" value="">
+            <input type="checkbox" id="status" name="status" value="2" ${cmCoupon.status eq "2" ? "checked" : ""}
+                   onclick="statusShow()"/>关闭
+        </div>
+    </div>
+    <c:if test="${not empty cmCoupon.id}">
+        <div class="control-group">
+            <label class="control-label">领取状态:</label>
+            <div class="controls">
+
+            </div>
+        </div>
+        <div class="control-group">
+            <label class="control-label">使用状态:</label>
+            <div class="controls">
+
+            </div>
+        </div>
+    </c:if>
+    <div class="form-actions">
+        <input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;
+        <input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
+    </div>
+</form:form>
+<script>
+    $(function () {
+        if (${not empty cmUser}){
+            var items = {
+                "userID": "${cmUser.userID}",
+                "name": "${cmUser.name}",
+                "shortName": "${cmUser.shortName}",
+                "linkMan": "${empty cmUser.userName ? '':cmUser.userName}",
+                "contractMobile": "${empty cmUser.bindMobile ? '':cmUser.bindMobile}"
+            };
+            insertHtml(items);
+        }
+    });
+
+    function insertHtml(data) {
+        var html = '<tr>' +
+            '<td>' +
+            data.name +
+            '</td>' +
+            '<td>' +
+            data.shortName +
+            '</td>' +
+            '<td>' +
+            data.linkMan +
+            '</td>' +
+            '<td>' +
+            data.contractMobile +
+            '</td>' +
+            '<td>' +
+            '<a href="javascript:;" onclick="deleteClub()">删除</a>' +
+            '</td>' +
+            '</tr>';
+        $("#contentTable").show();
+        $("#chooseClub").hide();
+        $("#hotSearch").html(html);
+        $("#userId").val(data.userID);
+    }
+
+    function deleteClub() {
+        $("#hotSearch").html("");
+        $("#contentTable").hide();
+        $("#chooseClub").show();
+        $("#userId").val("");
+    }
+
+    function statusShow() {
+        var status = $("input[name='status']:checked").val();
+        if (status == 2) {
+            $("#initializeShow").hide();
+            $("#closeShow").show();
+        } else {
+            $("#initializeShow").show();
+            $("#closeShow").hide();
+            $("#hiddenStatus").val(0);
+        }
+    }
+
+    //点击添加
+    function showSelect() {
+        var url = "${ctx}/coupon/cmCoupon/toAddClub";
+        var title = '';
+        title = "选择机构";
+        top.$.jBox("iframe:" + url, {
+            iframeScrolling: 'yes',
+            width: $(top.document).width() - 400,
+            height: $(top.document).height() - 160,
+            persistent: true,
+            title: title,
+            buttons: {"确定": '1', "取消": '-1'},
+            submit: function (v, h, f) {
+                //确定
+                var $jboxFrame = top.$('#jbox-iframe');
+                var $mainFrame = top.$('#mainFrame');
+                if ('1' == v && 1 == $jboxFrame.size() && 1 == $mainFrame.size()) {
+                    var items = $jboxFrame[0].contentWindow.getCheckedItems();
+                    console.log(items);
+                    insertHtml(items);
+                }
+                return true;
+            }
+        });
+    }
+
+    /**
+     * @param obj
+     * jquery控制input只能输入数字
+     */
+    function onlynum(obj) {
+        obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
+    }
+</script>
+</body>
+</html>

+ 186 - 0
src/main/webapp/WEB-INF/views/modules/coupon/couponUserExclusiveList.jsp

@@ -0,0 +1,186 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
+<html>
+<head>
+    <title>优惠券管理列表</title>
+    <meta name="decorator" content="default"/>
+    <style type="text/css">
+        .table th{text-align: center;}
+        .table td{text-align: center;}
+    </style>
+    <script type="text/javascript">
+        $(document).ready(function() {
+
+        });
+        function page(n,s){
+            $("#pageNo").val(n);
+            $("#pageSize").val(s);
+            $("#searchForm").submit();
+            return false;
+        }
+    </script>
+</head>
+<body>
+<ul class="nav nav-tabs">
+    <li><a href="${ctx}/coupon/cmCoupon/list?couponType=0">活动券</a></li>
+    <li><a href="${ctx}/coupon/cmCoupon/list?couponType=1">品类券</a></li>
+    <li class="active"><a href="${ctx}/coupon/cmCoupon/list?couponType=2">用户专享券</a></li>
+    <li><a href="${ctx}/coupon/cmCoupon/list?couponType=3">店铺券</a></li>
+    <li><a href="${ctx}/coupon/cmCoupon/list?couponType=4">新用户券</a></li>
+</ul>
+<form:form id="searchForm" modelAttribute="cmCoupon" action="${ctx}/coupon/cmCoupon/" method="post" class="breadcrumb form-search">
+    <input type="hidden" name="couponType" value="2"/>
+    <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
+    <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+    <div class="ul-form">
+        <label>机构名称:</label>
+        <form:input path="clubName" htmlEscape="false" maxlength="100" class="input-medium"/>
+        <label>优惠状态:</label>
+        <form:select path="status" class="input-medium required">
+            <form:option value="" label="全部"/>
+            <form:option value="0" label="未生效"/>
+            <form:option value="1" label="已生效"/>
+            <form:option value="2" label="已关闭"/>
+            <form:option value="3" label="已失效"/>
+        </form:select>
+        <label>领取状态:</label>
+        <form:select path="claimStatus" class="input-medium required">
+            <form:option value="" label="全部"/>
+            <form:option value="1" label="未领取"/>
+            <form:option value="2" label="已领取"/>
+        </form:select>
+        <label>使用状态:</label>
+        <form:select path="useStatus" class="input-medium required">
+            <form:option value="" label="全部"/>
+            <form:option value="1" label="未使用"/>
+            <form:option value="2" label="已使用"/>
+        </form:select>
+        <label>领取渠道:</label>
+        <form:select path="source" class="input-medium required">
+            <form:option value="" label="全部"/>
+            <form:option value="1" label="小程序"/>
+            <form:option value="2" label="网站"/>
+            <form:option value="3" label="订单退回"/>
+        </form:select><br><br>
+        <label>优惠时间:</label>
+        <input name="startDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
+               value="<fmt:formatDate value="${cmCoupon.startDate}" pattern="yyyy-MM-dd HH:mm:ss"/>"
+               onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/> -
+        <input name="endDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
+               value="<fmt:formatDate value="${cmCoupon.endDate}" pattern="yyyy-MM-dd HH:mm:ss"/>"
+               onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
+        &nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
+        <input class="btn btn-primary" style="width: 100px" onclick="window.location='${ctx}/coupon/cmCoupon/form?couponType=2'" value="添加用户专享券"/>
+        <div class="clearfix"></div>
+    </div>
+</form:form>
+<sys:message content="${message}"/>
+<table id="contentTable" class="table table-striped table-bordered table-condensed">
+    <thead>
+    <tr>
+        <th>ID</th>
+        <th>机构名称</th>
+        <th>优惠券金额</th>
+        <th>优惠条件</th>
+        <th>优惠状态</th>
+        <th>领取状态</th>
+        <th>领取渠道</th>
+        <th>使用状态</th>
+        <th>领取时间</th>
+        <th>使用时间</th>
+        <th>开始时间</th>
+        <th>结束时间</th>
+        <th>添加时间</th>
+        <th>操作</th>
+    </tr>
+    </thead>
+    <tbody>
+    <c:forEach items="${page.list}" var="cmCoupon">
+        <tr>
+            <td>
+                    ${cmCoupon.id}
+            </td>
+            <td>
+                    ${cmCoupon.clubName}
+            </td>
+            <td>
+                    ${cmCoupon.couponAmount}
+            </td>
+            <td>
+                满${cmCoupon.touchPrice}
+            </td>
+            <td>
+                <c:if test="${cmCoupon.status eq 0}">
+                    <font color="#800080">未生效</font>
+                </c:if>
+                <c:if test="${cmCoupon.status eq 1}">
+                    <font color="#00CC66">已生效</font>
+                </c:if>
+                <c:if test="${cmCoupon.status eq 2}">
+                    <font color="red">已关闭</font>
+                </c:if>
+                <c:if test="${cmCoupon.status eq 3}">
+                    <font color="#FF6600">已失效</font>
+                </c:if>
+            </td>
+            <td>
+                <c:if test="${cmCoupon.claimStatus eq 1}">
+                    <font color="red">未领取</font>
+                </c:if>
+                <c:if test="${cmCoupon.claimStatus eq 2}">
+                    <font color="#FF6600">已领取</font>
+                </c:if>
+            </td>
+            <td>
+                <c:if test="${cmCoupon.claimStatus eq 1}">
+                    ----
+                </c:if>
+                <c:if test="${cmCoupon.claimStatus eq 2}">
+                    ${cmCoupon.couponClub.source eq 1 ? "小程序":cmCoupon.couponClub.source eq 2 ? "网站":"订单退回"}
+                </c:if>
+            </td>
+            <td>
+                <c:if test="${cmCoupon.claimStatus eq 1 ||cmCoupon.couponClub.status eq 1}">
+                    <font color="red">未使用</font>
+                </c:if>
+                <c:if test="${cmCoupon.claimStatus eq 2 && cmCoupon.couponClub.status eq 2}">
+                    <font color="#FF6600">已使用</font>
+                </c:if>
+            </td>
+            <td>
+                <c:if test="${cmCoupon.claimStatus eq 1}">
+                    ----
+                </c:if>
+                <c:if test="${cmCoupon.claimStatus eq 2}">
+                    <fmt:formatDate value="${cmCoupon.couponClub.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
+                </c:if>
+            </td>
+            <td>
+                <c:if test="${cmCoupon.claimStatus eq 1}">
+                    ----
+                </c:if>
+                <c:if test="${cmCoupon.claimStatus eq 2}">
+                    <fmt:formatDate value="${cmCoupon.couponClub.useDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
+                </c:if>
+            </td>
+            <td>
+                <fmt:formatDate value="${cmCoupon.startDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
+            </td>
+            <td>
+                <fmt:formatDate value="${cmCoupon.endDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
+            </td>
+            <td>
+                <fmt:formatDate value="${cmCoupon.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
+            </td>
+            <td>
+                <a href="${ctx}/coupon/cmCoupon/form?id=${cmCoupon.id}">编辑</a>
+                <a href="${ctx}/coupon/cmCoupon/close?id=${cmCoupon.id}" onclick="return confirmx('确定关闭该优惠券吗?', this.href)">关闭</a>
+                <a href="${ctx}/coupon/cmCoupon/delete?id=${cmCoupon.id}" onclick="return confirmx('确定删除该优惠券吗?', this.href)">删除</a>
+            </td>
+        </tr>
+    </c:forEach>
+    </tbody>
+</table>
+<div class="pagination">${page}</div>
+</body>
+</html>

+ 122 - 0
src/main/webapp/WEB-INF/views/modules/coupon/toAddClub.jsp

@@ -0,0 +1,122 @@
+<%--
+  Created by IntelliJ IDEA.
+  User: Administrator
+  Date: 2020/4/9
+  Time: 19:54
+  To change this template use File | Settings | File Templates.
+--%>
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
+<html>
+<head>
+    <title>选择机构</title>
+    <meta name="decorator" content="default"/>
+    <style type="text/css">
+        .table td i {
+            margin: 0 2px;
+        }
+    </style>
+
+    <script type="text/javascript">
+        $(document).ready(function () {
+            $("#searchForm").validate({
+                submitHandler: function (form) {
+                    form.submit();
+                }
+            })
+        });
+    </script>
+</head>
+<body>
+<ul class="nav nav-tabs">
+    <li class="active"><a href="${ctx}/coupon/cmCoupon/toAddClub">添加商品</a></li>
+</ul>
+<br/>
+<form:form id="searchForm" modelAttribute="cmUser" action="${ctx}/coupon/cmCoupon/toAddClub" method="post" class="breadcrumb form-search">
+    <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
+    <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+    <div class="ul-form">
+        <label>机构ID:</label>
+        <form:input path="userID" id="userID" htmlEscape="false" maxlength="8" class="input-mini" onkeyup="onlynum(this)"/>
+        <label>机构名称:</label>
+        <form:input path="name" htmlEscape="false" class="input-medium" maxlength="20"/>
+        <label>机构简称:</label>
+        <form:input path="shortName" htmlEscape="false" class="input-medium" maxlength="20"/>
+        &nbsp;&nbsp; <input id="btnSubmit" class="btn btn-primary" type="submit" value="搜索"/>
+        <div class="clearfix"></div>
+    </div>
+</form:form>
+<sys:message content="${message}"/>
+<table class="table table-striped table-bordered table-condensed table-hover">
+    <tr>
+        <th style="width:20px;"></th>
+        <th>机构ID</th>
+        <th>机构名称</th>
+        <th>机构简称</th>
+        <th>联系人</th>
+        <th>手机号</th>
+    </tr>
+    <tbody>
+    <c:if test="${not empty page.list}">
+        <c:forEach items="${page.list}" var="item">
+            <tr id="${item.userID}" class="itemtr">
+                <th>
+                    <input class="check-item" type="radio" name="info" value='${fns:toJson(item)}'/>
+                </th>
+                <td>${item.userID}</td>
+                <td>${item.name}</td>
+                <td>${item.shortName}</td>
+                <td>${item.userName}</td>
+                <td>${item.bindMobile}</td>
+            </tr>
+        </c:forEach>
+    </c:if>
+    </tbody>
+</table>
+<c:if test="${empty  page.list}">
+    <p style="text-align: center;"><font color="#1e90ff">暂无数据……</font></p>
+</c:if>
+<div class="pagination">${page}</div>
+<script type="text/javascript">
+    $(document).ready(function () {
+        //弹出框去滚动条
+        top.$('#jbox-content').css("overflow-y", "hidden");
+        show_title(30);
+    });
+
+    function page(n, s) {
+        $("#pageNo").val(n);
+        $("#pageSize").val(s);
+        $("#searchForm").submit();
+        return false;
+    }
+
+    function getCheckedItems() {
+        var item = $('.check-item:checked').val();
+        var club = JSON.parse(item);
+        var items = {
+            "userID": club.userID,
+            "name": club.name,
+            "shortName": club.shortName,
+            "linkMan": club.userName,
+            "contractMobile": club.bindMobile
+        };
+        return items;
+    }
+
+    function clickAllSelect(ckb) {
+        var isChecked = ckb.checked;
+        $(".check-item").attr('checked', isChecked);
+    }
+
+    /**
+     * @param obj
+     * jquery控制input只能输入数字
+     */
+    function onlynum(obj) {
+        obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
+    }
+</script>
+</body>
+</html>
+

+ 133 - 0
src/main/webapp/WEB-INF/views/modules/coupon/toAddProduct.jsp

@@ -0,0 +1,133 @@
+<%@ page import="java.util.Date" %>
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
+<html>
+<head>
+    <title>选择商品</title>
+    <meta name="decorator" content="default"/>
+    <style type="text/css">
+        .table td i{margin:0 2px;}
+    </style>
+    <script type="text/javascript">
+        $(document).ready(function() {
+            //弹出框去滚动条
+            top.$('#jbox-content').css("overflow-y","hidden");
+            show_title(30);
+
+//			反选
+            $('body').on('click','input[name="info"]',function() {
+                var allInputLength = $('input[name="info"]').length - $('input[name="info"]:disabled').length,
+                    allInputCheckedLength = $('input[name="info"]:checked').length,
+                    checkAllEle= $('.check-all');
+//			    判断选中长度和总长度,如果相等就是全选否则取消全选
+                if(allInputLength === allInputCheckedLength) {
+                    checkAllEle.attr('checked', true);
+                } else {
+                    checkAllEle.attr('checked', false);
+                }
+            })
+        });
+        function page(n,s){
+            $("#pageNo").val(n);
+            $("#pageSize").val(s);
+            $("#searchForm").submit();
+            return false;
+        }
+
+        function getCheckedItems(){
+            var items = [];
+            var $items = $('.check-item:checked');
+            $items.each(function(){
+                var product = JSON.parse($(this).val());
+                items.push({
+                    "id": "",
+                    "productId": product.productID,
+                    "image": product.mainImage,
+                    "productName": product.name,
+                    "shopName": product.shopName,
+                    "sort": 1,
+                    "pcStatus": "1",
+                    "appletsStatus": "1",
+                    "addTime": ""
+                })
+            });
+            return items;
+        }
+
+        function allCkbfun(ckb){
+            var isChecked = ckb.checked;
+            $(".check-item").attr('checked', isChecked);
+        }
+
+        /**
+         * @param obj
+         * jquery控制input只能输入数字
+         */
+        function onlynum(obj) {
+            obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
+        }
+
+        /**
+         * @param obj
+         * jquery控制input只能输入数字和两位小数(金额)
+         */
+        function num(obj) {
+            obj.value = obj.value.replace(/[^\d.]/g, ""); //清除"数字"和"."以外的字符
+            obj.value = obj.value.replace(/^\./g, ""); //验证第一个字符是数字
+            obj.value = obj.value.replace(/\.{2,}/g, "."); //只保留第一个, 清除多余的
+            obj.value = obj.value.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
+            obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3'); //只能输入两个小数
+        }
+
+    </script>
+</head>
+<body>
+<ul class="nav nav-tabs">
+    <li class="active"><a href="${ctx}/coupon/cmCoupon/toAddProduct?productIds=${productIds}">商品列表</a></li>
+</ul>
+<form:form id="searchForm" modelAttribute="product" action="${ctx}/coupon/cmCoupon/toAddProduct?productIds=${productIds}" method="post" class="breadcrumb form-search">
+    <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
+    <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+    <div class="ul-form">
+        <label>商品ID:</label>
+        <form:input path="productID" htmlEscape="false"  maxlength="10" class="input-mini" onchange="onlynum(this)"/>
+        <label>商品名称:</label>
+        <form:input path="name" htmlEscape="false" class="input-medium" maxlength="20"/>
+        <label>供应商:</label>
+        <form:input path="shopName" htmlEscape="false" class="input-medium" maxlength="20"/>
+        &nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="搜索"/>
+        <div class="clearfix"></div>
+    </div>
+</form:form>
+<sys:message content="${message}"/>
+<table class="table table-striped table-bordered table-condensed table-hover">
+    <tr>
+        <th style="width:20px;"><input class="check-all" type="checkbox" onclick="allCkbfun(this);"/></th>
+        <th>商品ID</th>
+        <th>商品图片</th>
+        <th>商品名称</th>
+        <th>供应商</th>
+    </tr>
+    <tbody>
+    <c:if test="${not empty page.list}">
+        <c:forEach items="${page.list}" var="item">
+            <tr id="${item.productID}" class="itemtr">
+                    <%--已过滤添加过的商品和未上架的商品--%>
+                <th>
+                    <input class="check-item" ${item.storeStatus ? "disabled" : ""}  type="checkbox" name="info" value='${fns:toJson(item)}'/>
+                </th>
+                <td>${item.productID}</td>
+                <td><img src="${item.mainImage}" width="50px" height="50px"></td>
+                <td>${item.name}</td>
+                <td>${item.shopName}</td>
+            </tr>
+        </c:forEach>
+    </c:if>
+    </tbody>
+</table>
+<c:if test="${empty page.list}">
+    <p style="text-align: center;"><font  color="#1e90ff">暂无数据……</font></p>
+</c:if>
+<div class="pagination">${page}</div>
+</body>
+</html>

+ 133 - 0
src/main/webapp/WEB-INF/views/modules/coupon/toAddShop.jsp

@@ -0,0 +1,133 @@
+<%@ page import="java.util.Date" %>
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
+<html>
+<head>
+    <title>选择供应商</title>
+    <meta name="decorator" content="default"/>
+    <style type="text/css">
+        .table td i{margin:0 2px;}
+    </style>
+    <script type="text/javascript">
+        $(document).ready(function() {
+            //弹出框去滚动条
+            top.$('#jbox-content').css("overflow-y","hidden");
+            show_title(30);
+
+//			反选
+            $('body').on('click','input[name="info"]',function() {
+                var allInputLength = $('input[name="info"]').length - $('input[name="info"]:disabled').length,
+                    allInputCheckedLength = $('input[name="info"]:checked').length,
+                    checkAllEle= $('.check-all');
+//			    判断选中长度和总长度,如果相等就是全选否则取消全选
+                if(allInputLength === allInputCheckedLength) {
+                    checkAllEle.attr('checked', true);
+                } else {
+                    checkAllEle.attr('checked', false);
+                }
+            })
+        });
+        function page(n,s){
+            $("#pageNo").val(n);
+            $("#pageSize").val(s);
+            $("#searchForm").submit();
+            return false;
+        }
+
+        function getCheckedItems(){
+            var items = [];
+            var $items = $('.check-item:checked');
+            $items.each(function(){
+                var shop = JSON.parse($(this).val());
+                items.push({
+                    "id": "",
+                    "shopId": shop.shopID,
+                    "name": shop.name,
+                    "sname": shop.sname,
+                    "linkMan": shop.linkMan,
+                    "contractMobile": shop.contractMobile
+                })
+            });
+            return items;
+        }
+
+        function allCkbfun(ckb){
+            var isChecked = ckb.checked;
+            $(".check-item").attr('checked', isChecked);
+        }
+
+        /**
+         * @param obj
+         * jquery控制input只能输入数字
+         */
+        function onlynum(obj) {
+            obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
+        }
+
+        /**
+         * @param obj
+         * jquery控制input只能输入数字和两位小数(金额)
+         */
+        function num(obj) {
+            obj.value = obj.value.replace(/[^\d.]/g, ""); //清除"数字"和"."以外的字符
+            obj.value = obj.value.replace(/^\./g, ""); //验证第一个字符是数字
+            obj.value = obj.value.replace(/\.{2,}/g, "."); //只保留第一个, 清除多余的
+            obj.value = obj.value.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
+            obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3'); //只能输入两个小数
+        }
+
+    </script>
+</head>
+<body>
+<ul class="nav nav-tabs">
+    <li class="active"><a href="${ctx}/coupon/cmCoupon/toAddShop?shopIds=${shopIds}">供应商列表</a></li>
+</ul>
+<form:form id="searchForm" modelAttribute="newCmShop" action="${ctx}/coupon/cmCoupon/toAddShop" method="post" class="breadcrumb form-search">
+    <input type="hidden" name="shopIds" value="${shopIds}">
+    <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
+    <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+    <div class="ul-form">
+        <label>供应商ID:</label>
+        <form:input path="shopID" htmlEscape="false"  maxlength="10" class="input-mini" onchange="onlynum(this)"/>
+        <label>供应商名称:</label>
+        <form:input path="name" htmlEscape="false" class="input-medium" maxlength="20"/>
+        <label>供应商简称:</label>
+        <form:input path="sname" htmlEscape="false" class="input-medium" maxlength="20"/>
+        &nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="搜索"/>
+        <div class="clearfix"></div>
+    </div>
+</form:form>
+<sys:message content="${message}"/>
+<table class="table table-striped table-bordered table-condensed table-hover">
+    <tr>
+        <th style="width:20px;"><input class="check-all" type="checkbox" onclick="allCkbfun(this);"/></th>
+        <th>供应商ID</th>
+        <th>供应商名称</th>
+        <th>供应商简称</th>
+        <th>联系人</th>
+        <th>手机号</th>
+    </tr>
+    <tbody>
+    <c:if test="${not empty page.list}">
+        <c:forEach items="${page.list}" var="item">
+            <tr id="${item.shopID}" class="itemtr">
+                    <%--已过滤添加过的商品和未上架的商品--%>
+                <th>
+                    <input class="check-item" type="checkbox" ${item.choose ? "disabled":""}  name="info" value='${fns:toJson(item)}'/>
+                </th>
+                <td>${item.shopID}</td>
+                <td>${item.name}</td>
+                <td>${item.sname}</td>
+                <td>${item.linkMan}</td>
+                <td>${item.contractMobile}</td>
+            </tr>
+        </c:forEach>
+    </c:if>
+    </tbody>
+</table>
+<c:if test="${empty page.list}">
+    <p style="text-align: center;"><font  color="#1e90ff">暂无数据……</font></p>
+</c:if>
+<div class="pagination">${page}</div>
+</body>
+</html>