From 590cbe1f464ef5b5c79fede1c6dc4984b5980c93 Mon Sep 17 00:00:00 2001 From: = <=> Date: Sat, 15 May 2021 13:57:06 +0800 Subject: [PATCH] =?UTF-8?q?'=E4=BF=AE=E5=A4=8D=E5=B7=B2=E7=9F=A5=E9=97=AE?= =?UTF-8?q?=E9=A2=98'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bweb/controller/SecUserController.java | 2 +- .../cweb/controller/CmsContentController.java | 66 +++++++++++++++++++ .../java/com/hai/dao/SecUserMapperExt.java | 8 +-- .../impl/HighCouponCodeServiceImpl.java | 22 +++++-- 4 files changed, 86 insertions(+), 12 deletions(-) create mode 100644 hai-cweb/src/main/java/com/cweb/controller/CmsContentController.java diff --git a/hai-bweb/src/main/java/com/bweb/controller/SecUserController.java b/hai-bweb/src/main/java/com/bweb/controller/SecUserController.java index 4a02ac7a..1d551ce9 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/SecUserController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/SecUserController.java @@ -77,7 +77,7 @@ public class SecUserController { } if(!secUser.getPassword().equals(MD5Util.encode(oldPassword.getBytes()))) { log.error("BaseMemberController --> sendUserPass() error!","旧密码不一致"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.UN_MEMBER_ERROR, "旧密码不一致"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "旧密码不一致"); } secUser.setPassword(MD5Util.encode(password.getBytes())); //修改 diff --git a/hai-cweb/src/main/java/com/cweb/controller/CmsContentController.java b/hai-cweb/src/main/java/com/cweb/controller/CmsContentController.java new file mode 100644 index 00000000..bea99e72 --- /dev/null +++ b/hai-cweb/src/main/java/com/cweb/controller/CmsContentController.java @@ -0,0 +1,66 @@ +package com.cweb.controller; + +import com.hai.common.utils.ResponseMsgUtil; +import com.hai.entity.BsCompany; +import com.hai.entity.CmsContent; +import com.hai.entity.CmsPatch; +import com.hai.entity.SecRegion; +import com.hai.model.CmsContentModel; +import com.hai.model.ResponseData; +import com.hai.model.UserInfoModel; +import com.hai.service.BsCompanyService; +import com.hai.service.CmsContentService; +import com.hai.service.CmsPatchService; +import com.hai.service.CommonService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.util.*; + +@Controller +@Api(value = "内容管理 内容发布") +@RequestMapping(value = "/cmsContent") +public class CmsContentController { + + private static Logger log = LoggerFactory.getLogger(CmsContentController.class); + + @Resource + private CommonService commonService; + + @Resource + private CmsContentService cmsContentService; + + @Resource + private BsCompanyService bsCompanyService; + + @RequestMapping(value = "/getCorporateAdvertising", method = RequestMethod.GET) + @ApiOperation(value = "查询首页轮播图") + @ResponseBody + public ResponseData getCorporateAdvertising(@RequestParam(name = "regionId", required = true) String regionId) { + try { + + SecRegion region = commonService.getParentByRegion(Long.parseLong(regionId)); + if (region != null) { + BsCompany bsCompany = bsCompanyService.selectCompanyByRegion(region.getRegionId().toString()); + if (bsCompany != null) { + Map map = new HashMap<>(); + map.put("companyId", bsCompany.getId().toString()); + map.put("status", "2"); + map.put("categoryCode", "HOME_IMG"); + return ResponseMsgUtil.success(cmsContentService.getListContent(map)); + } + } + return ResponseMsgUtil.success(new ArrayList<>()); + } catch (Exception e) { + log.error("CmsContentController --> getCorporateAdvertising() error!", e); + return ResponseMsgUtil.exception(e); + } + } +} diff --git a/hai-service/src/main/java/com/hai/dao/SecUserMapperExt.java b/hai-service/src/main/java/com/hai/dao/SecUserMapperExt.java index 65896104..173e8137 100644 --- a/hai-service/src/main/java/com/hai/dao/SecUserMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/SecUserMapperExt.java @@ -60,11 +60,11 @@ public interface SecUserMapperExt { " * " + " FROM" + " sec_user su " + - " WHERE" + - " STATUS = 1 " + + " WHERE " + + " (su.login_name = #{loginName} " + + " OR su.telephone = #{loginName}) " + " AND su.`password` = #{password}" + - " AND su.login_name = #{loginName} " + - " OR su.telephone = #{loginName} " + + " AND STATUS = 1 " + "" }) @Results({ diff --git a/hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java index f8c7749a..1a7d896a 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java @@ -6,6 +6,7 @@ import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.utils.DateUtil; import com.hai.common.utils.IDGenerator; +import com.hai.dao.HighChildOrderMapper; import com.hai.dao.HighCouponCodeMapper; import com.hai.dao.HighCouponCodeMapperExt; import com.hai.entity.*; @@ -49,6 +50,9 @@ public class HighCouponCodeServiceImpl implements HighCouponCodeService { @Resource private HighCouponAgentService highCouponAgentService; + @Resource + private HighChildOrderMapper highChildOrderMapper; + @Override public void insertCouponCode(HighCouponCode highCouponCode) { highCouponCodeMapper.insert(highCouponCode); @@ -157,15 +161,19 @@ public class HighCouponCodeServiceImpl implements HighCouponCodeService { List list = highUserCouponService.getUserCouponList(map); if (list.size() > 0) { for (HighUserCoupon userCoupon : list) { - HighChildOrder order = highOrderService.getChildOrderByUserGoods(userCoupon.getUserId(), 1, userCoupon.getCouponId()); + HighChildOrderExample example = new HighChildOrderExample(); + example.createCriteria().andMemIdEqualTo(userCoupon.getUserId()).andGoodsTypeEqualTo(1).andGoodsIdEqualTo(userCoupon.getCouponId()).andChildOrdeStatusEqualTo(2); + List childOrderList = highChildOrderMapper.selectByExample(example); + if (childOrderList.size() > 0) { + userCoupon.setConsumeTime(useTime); + userCoupon.setStatus(2); // 状态 0:已过期 1:未使用 2:已使用 + highUserCouponService.updateUserCoupon(userCoupon); + highOrderService.childOrderComplete(childOrderList.get(0).getId()); + } + /*HighChildOrder order = highOrderService.getChildOrderByUserGoods(userCoupon.getUserId(), 1, userCoupon.getCouponId()); if (order == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到订单"); - } - userCoupon.setConsumeTime(useTime); - userCoupon.setStatus(2); // 状态 0:已过期 1:未使用 2:已使用 - highUserCouponService.updateUserCoupon(userCoupon); - - highOrderService.childOrderComplete(order.getId()); + }*/ } } }