From e492ea590dec89db8908b82d1f4a27162241cdd5 Mon Sep 17 00:00:00 2001 From: 199901012 Date: Tue, 9 Mar 2021 19:17:44 +0800 Subject: [PATCH] =?UTF-8?q?'=E5=AE=8C=E6=88=90=E5=95=86=E6=88=B7=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/HighMerchantController.java | 132 ++++++++++++++++++ .../com/hai/common/exception/ErrorCode.java | 3 +- .../com/hai/common/security/UserCenter.java | 33 ++--- .../dao/HighMemberPayPasswordMapperExt.java | 7 - ...er.java => HighUserPayPasswordMapper.java} | 48 +++---- .../hai/dao/HighUserPayPasswordMapperExt.java | 7 + ...va => HighUserPayPasswordSqlProvider.java} | 42 +++--- ...Password.java => HighUserPayPassword.java} | 6 +- ...e.java => HighUserPayPasswordExample.java} | 4 +- .../com/hai/service/HighMerchantService.java | 32 +++++ .../com/hai/service/HighStoreService.java | 4 + .../service/impl/HighMerchantServiceImpl.java | 59 ++++++++ .../service/impl/HighStoreServiceImpl.java | 5 + 13 files changed, 305 insertions(+), 77 deletions(-) create mode 100644 hai-bweb/src/main/java/com/bweb/controller/HighMerchantController.java delete mode 100644 hai-service/src/main/java/com/hai/dao/HighMemberPayPasswordMapperExt.java rename hai-service/src/main/java/com/hai/dao/{HighMemberPayPasswordMapper.java => HighUserPayPasswordMapper.java} (66%) create mode 100644 hai-service/src/main/java/com/hai/dao/HighUserPayPasswordMapperExt.java rename hai-service/src/main/java/com/hai/dao/{HighMemberPayPasswordSqlProvider.java => HighUserPayPasswordSqlProvider.java} (87%) rename hai-service/src/main/java/com/hai/entity/{HighMemberPayPassword.java => HighUserPayPassword.java} (96%) rename hai-service/src/main/java/com/hai/entity/{HighMemberPayPasswordExample.java => HighUserPayPasswordExample.java} (99%) create mode 100644 hai-service/src/main/java/com/hai/service/HighMerchantService.java create mode 100644 hai-service/src/main/java/com/hai/service/HighStoreService.java create mode 100644 hai-service/src/main/java/com/hai/service/impl/HighMerchantServiceImpl.java create mode 100644 hai-service/src/main/java/com/hai/service/impl/HighStoreServiceImpl.java diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighMerchantController.java b/hai-bweb/src/main/java/com/bweb/controller/HighMerchantController.java new file mode 100644 index 00000000..9bd63c36 --- /dev/null +++ b/hai-bweb/src/main/java/com/bweb/controller/HighMerchantController.java @@ -0,0 +1,132 @@ +package com.bweb.controller; + +import com.alibaba.fastjson.JSONObject; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.hai.common.exception.ErrorCode; +import com.hai.common.exception.ErrorHelp; +import com.hai.common.exception.SysCode; +import com.hai.common.security.AESEncodeUtil; +import com.hai.common.security.SessionObject; +import com.hai.common.security.UserCenter; +import com.hai.common.utils.MD5Util; +import com.hai.common.utils.ResponseMsgUtil; +import com.hai.entity.*; +import com.hai.model.MenuTreeModel; +import com.hai.model.ResponseData; +import com.hai.model.UserInfoModel; +import com.hai.service.HighMerchantService; +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.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @Auther: 胡锐 + * @Description: + * @Date: 2021/3/8 21:55 + */ +@Controller +@RequestMapping(value = "/highMerchant") +@Api(value = "商户接口") +public class HighMerchantController { + + private static Logger log = LoggerFactory.getLogger(HighMerchantController.class); + + @Autowired + private UserCenter userCenter; + + @Resource + private HighMerchantService highMerchantService; + + @RequestMapping(value="/editMerchant",method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "编辑商户") + public ResponseData editMerchant(@RequestBody HighMerchant highMerchant, HttpServletRequest request) { + try { + //发布人员 + SessionObject sessionObject = userCenter.getSessionObject(request); + UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); + if (highMerchant.getCompanyId() == null + || StringUtils.isBlank(highMerchant.getMerchantKey()) + || StringUtils.isBlank(highMerchant.getMerchantName()) + || StringUtils.isBlank(highMerchant.getTelephone()) + || StringUtils.isBlank(highMerchant.getAddress()) + ) { + log.error("HighMerchantController -> editMerchant() error!","参数错误"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + + if (highMerchant.getId() != null) { + if (highMerchantService.getMerchantById(highMerchant.getId()) == null) { + log.error("HighMerchantController -> editMerchant() error!","未找到商户"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOF_FOUND, ""); + } + highMerchant.setUpdateTime(new Date()); + + } else { + highMerchant.setCreateTime(new Date()); + highMerchant.setUpdateTime(new Date()); + } + highMerchant.setStatus(1); // 状态:0:不可用,1:可用 + highMerchant.setOperatorId(userInfoModel.getSecUser().getId()); + highMerchant.setOperatorName(userInfoModel.getSecUser().getUserName()); + highMerchantService.editMerchant(highMerchant); + + return ResponseMsgUtil.success(highMerchant); + } catch (Exception e) { + log.error("HighMerchantController -> editMerchant() error!",e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/getMerchantById",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "根据id查询商户") + public ResponseData getMerchantById(@RequestParam(name = "id", required = true) Long id) { + try { + + return ResponseMsgUtil.success(highMerchantService.getMerchantById(id)); + } catch (Exception e) { + log.error("HighMerchantController -> getMerchantById() error!",e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/getMerchantList",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询商户列表") + public ResponseData getMerchantList(@RequestParam(name = "companyId", required = true) Long companyId, + @RequestParam(name = "merchantKey", required = true) String merchantKey, + @RequestParam(name = "merchantName", required = true) String merchantName, + @RequestParam(name = "telephone", required = true) String telephone, + @RequestParam(name = "pageNum", required = true) Integer pageNum, + @RequestParam(name = "pageSize", required = true) Integer pageSize) { + try { + Map map = new HashMap<>(); + map.put("companyId", companyId); + map.put("merchantKey", merchantKey); + map.put("merchantName", merchantName); + map.put("telephone", telephone); + + PageHelper.startPage(pageNum, pageSize); + return ResponseMsgUtil.success(new PageInfo<>(highMerchantService.getMerchantList(map))); + + } catch (Exception e) { + log.error("HighMerchantController -> getMerchantList() error!",e); + return ResponseMsgUtil.exception(e); + } + } +} diff --git a/hai-service/src/main/java/com/hai/common/exception/ErrorCode.java b/hai-service/src/main/java/com/hai/common/exception/ErrorCode.java index 519c29f0..ae6faf1e 100644 --- a/hai-service/src/main/java/com/hai/common/exception/ErrorCode.java +++ b/hai-service/src/main/java/com/hai/common/exception/ErrorCode.java @@ -74,6 +74,7 @@ public enum ErrorCode { PASSWORD_ERROR("2102","密码错误"), SMS_CODE_ERROR("2103","验证码错误"), ID_CARD_NUM_IS_ERROR("2104","身份证号码错误"), + MERCHANT_NOF_FOUND("2105","未找到商户"), STATUS_ERROR("3000","状态错误"), ADD_DATA_ERROR("3001","增加数据失败"), @@ -81,7 +82,7 @@ public enum ErrorCode { DELETE_DATA_ERROR("3003","删除数据失败"), MSG_EVENT_NULL("2999","消息类型为空"), - USE_VISIT_ILLEGAL("4001","请登录"), + USE_VISIT_ILLEGAL("4001","用户身份错误"), RC_VISIT_ERROR("2998",""), UNKNOW_ERROR("999999","未知异常"), EXCEL_ERROR("80000","Excel处理异常"), diff --git a/hai-service/src/main/java/com/hai/common/security/UserCenter.java b/hai-service/src/main/java/com/hai/common/security/UserCenter.java index d3d6c78b..fb117a76 100644 --- a/hai-service/src/main/java/com/hai/common/security/UserCenter.java +++ b/hai-service/src/main/java/com/hai/common/security/UserCenter.java @@ -1,6 +1,9 @@ package com.hai.common.security; import com.fasterxml.jackson.core.JsonParseException; +import com.hai.common.exception.ErrorCode; +import com.hai.common.exception.ErrorHelp; +import com.hai.common.exception.SysCode; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -94,27 +97,19 @@ public class UserCenter { } } - public static SessionObject getSessionObject(HttpServletRequest request) throws Exception{ + public static SessionObject getSessionObject(HttpServletRequest request) throws Exception { String token = request.getHeader("Authorization"); - if(StringUtils.isNotBlank(token)){ + if (StringUtils.isBlank(token)) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.USE_VISIT_ILLEGAL, ""); + } + if (LoginCache.getData(token) != null) { return LoginCache.getData(token); - //通过token方式登录 - /*String value = AESEncodeUtil.aesDecrypt(token); - if(!StringUtils.isEmpty(value)){ - return LoginCache.getData(token); - }*/ - }else{ - String jo = read(request); - if(StringUtils.isNotBlank(jo)){ - try { - return LoginCache.getData(jo); - } catch (Exception e) { - log.error("get SessionObject from usercenter failed"); - return null; - } - } - } - return null; + } + + if (read(request) != null) { + return LoginCache.getData(token); + } + return LoginCache.getData(token); } /** * @param request diff --git a/hai-service/src/main/java/com/hai/dao/HighMemberPayPasswordMapperExt.java b/hai-service/src/main/java/com/hai/dao/HighMemberPayPasswordMapperExt.java deleted file mode 100644 index 57868710..00000000 --- a/hai-service/src/main/java/com/hai/dao/HighMemberPayPasswordMapperExt.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.hai.dao; - -/** - * mapper扩展类 - */ -public interface HighMemberPayPasswordMapperExt { -} \ No newline at end of file diff --git a/hai-service/src/main/java/com/hai/dao/HighMemberPayPasswordMapper.java b/hai-service/src/main/java/com/hai/dao/HighUserPayPasswordMapper.java similarity index 66% rename from hai-service/src/main/java/com/hai/dao/HighMemberPayPasswordMapper.java rename to hai-service/src/main/java/com/hai/dao/HighUserPayPasswordMapper.java index e4fe9e88..2500864e 100644 --- a/hai-service/src/main/java/com/hai/dao/HighMemberPayPasswordMapper.java +++ b/hai-service/src/main/java/com/hai/dao/HighUserPayPasswordMapper.java @@ -1,7 +1,7 @@ package com.hai.dao; -import com.hai.entity.HighMemberPayPassword; -import com.hai.entity.HighMemberPayPasswordExample; +import com.hai.entity.HighUserPayPassword; +import com.hai.entity.HighUserPayPasswordExample; import java.util.List; import org.apache.ibatis.annotations.Delete; import org.apache.ibatis.annotations.DeleteProvider; @@ -25,21 +25,21 @@ import org.springframework.stereotype.Repository; * **/ @Repository -public interface HighMemberPayPasswordMapper extends HighMemberPayPasswordMapperExt { - @SelectProvider(type=HighMemberPayPasswordSqlProvider.class, method="countByExample") - long countByExample(HighMemberPayPasswordExample example); +public interface HighUserPayPasswordMapper extends HighUserPayPasswordMapperExt { + @SelectProvider(type=HighUserPayPasswordSqlProvider.class, method="countByExample") + long countByExample(HighUserPayPasswordExample example); - @DeleteProvider(type=HighMemberPayPasswordSqlProvider.class, method="deleteByExample") - int deleteByExample(HighMemberPayPasswordExample example); + @DeleteProvider(type=HighUserPayPasswordSqlProvider.class, method="deleteByExample") + int deleteByExample(HighUserPayPasswordExample example); @Delete({ - "delete from high_member_pay_password", + "delete from high_user_pay_password", "where id = #{id,jdbcType=BIGINT}" }) int deleteByPrimaryKey(Long id); @Insert({ - "insert into high_member_pay_password (user_id, user_phone, ", + "insert into high_user_pay_password (user_id, user_phone, ", "`password`, create_time, ", "update_time, ext_1, ", "ext_2, ext_3)", @@ -49,13 +49,13 @@ public interface HighMemberPayPasswordMapper extends HighMemberPayPasswordMapper "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" }) @Options(useGeneratedKeys=true,keyProperty="id") - int insert(HighMemberPayPassword record); + int insert(HighUserPayPassword record); - @InsertProvider(type=HighMemberPayPasswordSqlProvider.class, method="insertSelective") + @InsertProvider(type=HighUserPayPasswordSqlProvider.class, method="insertSelective") @Options(useGeneratedKeys=true,keyProperty="id") - int insertSelective(HighMemberPayPassword record); + int insertSelective(HighUserPayPassword record); - @SelectProvider(type=HighMemberPayPasswordSqlProvider.class, method="selectByExample") + @SelectProvider(type=HighUserPayPasswordSqlProvider.class, method="selectByExample") @Results({ @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT), @@ -67,13 +67,13 @@ public interface HighMemberPayPasswordMapper extends HighMemberPayPasswordMapper @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) }) - List selectByExample(HighMemberPayPasswordExample example); + List selectByExample(HighUserPayPasswordExample example); @Select({ "select", "id, user_id, user_phone, `password`, create_time, update_time, ext_1, ext_2, ", "ext_3", - "from high_member_pay_password", + "from high_user_pay_password", "where id = #{id,jdbcType=BIGINT}" }) @Results({ @@ -87,19 +87,19 @@ public interface HighMemberPayPasswordMapper extends HighMemberPayPasswordMapper @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) }) - HighMemberPayPassword selectByPrimaryKey(Long id); + HighUserPayPassword selectByPrimaryKey(Long id); - @UpdateProvider(type=HighMemberPayPasswordSqlProvider.class, method="updateByExampleSelective") - int updateByExampleSelective(@Param("record") HighMemberPayPassword record, @Param("example") HighMemberPayPasswordExample example); + @UpdateProvider(type=HighUserPayPasswordSqlProvider.class, method="updateByExampleSelective") + int updateByExampleSelective(@Param("record") HighUserPayPassword record, @Param("example") HighUserPayPasswordExample example); - @UpdateProvider(type=HighMemberPayPasswordSqlProvider.class, method="updateByExample") - int updateByExample(@Param("record") HighMemberPayPassword record, @Param("example") HighMemberPayPasswordExample example); + @UpdateProvider(type=HighUserPayPasswordSqlProvider.class, method="updateByExample") + int updateByExample(@Param("record") HighUserPayPassword record, @Param("example") HighUserPayPasswordExample example); - @UpdateProvider(type=HighMemberPayPasswordSqlProvider.class, method="updateByPrimaryKeySelective") - int updateByPrimaryKeySelective(HighMemberPayPassword record); + @UpdateProvider(type=HighUserPayPasswordSqlProvider.class, method="updateByPrimaryKeySelective") + int updateByPrimaryKeySelective(HighUserPayPassword record); @Update({ - "update high_member_pay_password", + "update high_user_pay_password", "set user_id = #{userId,jdbcType=BIGINT},", "user_phone = #{userPhone,jdbcType=BIGINT},", "`password` = #{password,jdbcType=VARCHAR},", @@ -110,5 +110,5 @@ public interface HighMemberPayPasswordMapper extends HighMemberPayPasswordMapper "ext_3 = #{ext3,jdbcType=VARCHAR}", "where id = #{id,jdbcType=BIGINT}" }) - int updateByPrimaryKey(HighMemberPayPassword record); + int updateByPrimaryKey(HighUserPayPassword record); } \ No newline at end of file diff --git a/hai-service/src/main/java/com/hai/dao/HighUserPayPasswordMapperExt.java b/hai-service/src/main/java/com/hai/dao/HighUserPayPasswordMapperExt.java new file mode 100644 index 00000000..f4a6a7ac --- /dev/null +++ b/hai-service/src/main/java/com/hai/dao/HighUserPayPasswordMapperExt.java @@ -0,0 +1,7 @@ +package com.hai.dao; + +/** + * mapper扩展类 + */ +public interface HighUserPayPasswordMapperExt { +} \ No newline at end of file diff --git a/hai-service/src/main/java/com/hai/dao/HighMemberPayPasswordSqlProvider.java b/hai-service/src/main/java/com/hai/dao/HighUserPayPasswordSqlProvider.java similarity index 87% rename from hai-service/src/main/java/com/hai/dao/HighMemberPayPasswordSqlProvider.java rename to hai-service/src/main/java/com/hai/dao/HighUserPayPasswordSqlProvider.java index 033f6561..8d3c0c9b 100644 --- a/hai-service/src/main/java/com/hai/dao/HighMemberPayPasswordSqlProvider.java +++ b/hai-service/src/main/java/com/hai/dao/HighUserPayPasswordSqlProvider.java @@ -1,32 +1,32 @@ package com.hai.dao; -import com.hai.entity.HighMemberPayPassword; -import com.hai.entity.HighMemberPayPasswordExample.Criteria; -import com.hai.entity.HighMemberPayPasswordExample.Criterion; -import com.hai.entity.HighMemberPayPasswordExample; +import com.hai.entity.HighUserPayPassword; +import com.hai.entity.HighUserPayPasswordExample.Criteria; +import com.hai.entity.HighUserPayPasswordExample.Criterion; +import com.hai.entity.HighUserPayPasswordExample; import java.util.List; import java.util.Map; import org.apache.ibatis.jdbc.SQL; -public class HighMemberPayPasswordSqlProvider { +public class HighUserPayPasswordSqlProvider { - public String countByExample(HighMemberPayPasswordExample example) { + public String countByExample(HighUserPayPasswordExample example) { SQL sql = new SQL(); - sql.SELECT("count(*)").FROM("high_member_pay_password"); + sql.SELECT("count(*)").FROM("high_user_pay_password"); applyWhere(sql, example, false); return sql.toString(); } - public String deleteByExample(HighMemberPayPasswordExample example) { + public String deleteByExample(HighUserPayPasswordExample example) { SQL sql = new SQL(); - sql.DELETE_FROM("high_member_pay_password"); + sql.DELETE_FROM("high_user_pay_password"); applyWhere(sql, example, false); return sql.toString(); } - public String insertSelective(HighMemberPayPassword record) { + public String insertSelective(HighUserPayPassword record) { SQL sql = new SQL(); - sql.INSERT_INTO("high_member_pay_password"); + sql.INSERT_INTO("high_user_pay_password"); if (record.getUserId() != null) { sql.VALUES("user_id", "#{userId,jdbcType=BIGINT}"); @@ -63,7 +63,7 @@ public class HighMemberPayPasswordSqlProvider { return sql.toString(); } - public String selectByExample(HighMemberPayPasswordExample example) { + public String selectByExample(HighUserPayPasswordExample example) { SQL sql = new SQL(); if (example != null && example.isDistinct()) { sql.SELECT_DISTINCT("id"); @@ -78,7 +78,7 @@ public class HighMemberPayPasswordSqlProvider { sql.SELECT("ext_1"); sql.SELECT("ext_2"); sql.SELECT("ext_3"); - sql.FROM("high_member_pay_password"); + sql.FROM("high_user_pay_password"); applyWhere(sql, example, false); if (example != null && example.getOrderByClause() != null) { @@ -89,11 +89,11 @@ public class HighMemberPayPasswordSqlProvider { } public String updateByExampleSelective(Map parameter) { - HighMemberPayPassword record = (HighMemberPayPassword) parameter.get("record"); - HighMemberPayPasswordExample example = (HighMemberPayPasswordExample) parameter.get("example"); + HighUserPayPassword record = (HighUserPayPassword) parameter.get("record"); + HighUserPayPasswordExample example = (HighUserPayPasswordExample) parameter.get("example"); SQL sql = new SQL(); - sql.UPDATE("high_member_pay_password"); + sql.UPDATE("high_user_pay_password"); if (record.getId() != null) { sql.SET("id = #{record.id,jdbcType=BIGINT}"); @@ -137,7 +137,7 @@ public class HighMemberPayPasswordSqlProvider { public String updateByExample(Map parameter) { SQL sql = new SQL(); - sql.UPDATE("high_member_pay_password"); + sql.UPDATE("high_user_pay_password"); sql.SET("id = #{record.id,jdbcType=BIGINT}"); sql.SET("user_id = #{record.userId,jdbcType=BIGINT}"); @@ -149,14 +149,14 @@ public class HighMemberPayPasswordSqlProvider { sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); - HighMemberPayPasswordExample example = (HighMemberPayPasswordExample) parameter.get("example"); + HighUserPayPasswordExample example = (HighUserPayPasswordExample) parameter.get("example"); applyWhere(sql, example, true); return sql.toString(); } - public String updateByPrimaryKeySelective(HighMemberPayPassword record) { + public String updateByPrimaryKeySelective(HighUserPayPassword record) { SQL sql = new SQL(); - sql.UPDATE("high_member_pay_password"); + sql.UPDATE("high_user_pay_password"); if (record.getUserId() != null) { sql.SET("user_id = #{userId,jdbcType=BIGINT}"); @@ -195,7 +195,7 @@ public class HighMemberPayPasswordSqlProvider { return sql.toString(); } - protected void applyWhere(SQL sql, HighMemberPayPasswordExample example, boolean includeExamplePhrase) { + protected void applyWhere(SQL sql, HighUserPayPasswordExample example, boolean includeExamplePhrase) { if (example == null) { return; } diff --git a/hai-service/src/main/java/com/hai/entity/HighMemberPayPassword.java b/hai-service/src/main/java/com/hai/entity/HighUserPayPassword.java similarity index 96% rename from hai-service/src/main/java/com/hai/entity/HighMemberPayPassword.java rename to hai-service/src/main/java/com/hai/entity/HighUserPayPassword.java index 9085f3ac..5c62d8cf 100644 --- a/hai-service/src/main/java/com/hai/entity/HighMemberPayPassword.java +++ b/hai-service/src/main/java/com/hai/entity/HighUserPayPassword.java @@ -4,7 +4,7 @@ import java.io.Serializable; import java.util.Date; /** - * high_member_pay_password + * high_user_pay_password * @author */ /** @@ -12,7 +12,7 @@ import java.util.Date; * 代码由工具生成 * **/ -public class HighMemberPayPassword implements Serializable { +public class HighUserPayPassword implements Serializable { /** * 支付密码编号 */ @@ -134,7 +134,7 @@ public class HighMemberPayPassword implements Serializable { if (getClass() != that.getClass()) { return false; } - HighMemberPayPassword other = (HighMemberPayPassword) that; + HighUserPayPassword other = (HighUserPayPassword) that; return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId())) && (this.getUserPhone() == null ? other.getUserPhone() == null : this.getUserPhone().equals(other.getUserPhone())) diff --git a/hai-service/src/main/java/com/hai/entity/HighMemberPayPasswordExample.java b/hai-service/src/main/java/com/hai/entity/HighUserPayPasswordExample.java similarity index 99% rename from hai-service/src/main/java/com/hai/entity/HighMemberPayPasswordExample.java rename to hai-service/src/main/java/com/hai/entity/HighUserPayPasswordExample.java index 9a63da0f..461b293a 100644 --- a/hai-service/src/main/java/com/hai/entity/HighMemberPayPasswordExample.java +++ b/hai-service/src/main/java/com/hai/entity/HighUserPayPasswordExample.java @@ -4,7 +4,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; -public class HighMemberPayPasswordExample { +public class HighUserPayPasswordExample { protected String orderByClause; protected boolean distinct; @@ -15,7 +15,7 @@ public class HighMemberPayPasswordExample { private Long offset; - public HighMemberPayPasswordExample() { + public HighUserPayPasswordExample() { oredCriteria = new ArrayList(); } diff --git a/hai-service/src/main/java/com/hai/service/HighMerchantService.java b/hai-service/src/main/java/com/hai/service/HighMerchantService.java new file mode 100644 index 00000000..955494a1 --- /dev/null +++ b/hai-service/src/main/java/com/hai/service/HighMerchantService.java @@ -0,0 +1,32 @@ +package com.hai.service; + +import com.hai.entity.HighMerchant; + +import java.util.List; +import java.util.Map; + +/** + * 商户业务 + */ +public interface HighMerchantService { + + /** + * 编辑 + */ + void editMerchant(HighMerchant highMerchant); + + /** + * 根据id查询 + * @param id + * @return + */ + HighMerchant getMerchantById(Long id); + + /** + * 查询列表 + * @param map + * @return + */ + List getMerchantList(Map map); + +} diff --git a/hai-service/src/main/java/com/hai/service/HighStoreService.java b/hai-service/src/main/java/com/hai/service/HighStoreService.java new file mode 100644 index 00000000..2edd8d0b --- /dev/null +++ b/hai-service/src/main/java/com/hai/service/HighStoreService.java @@ -0,0 +1,4 @@ +package com.hai.service; + +public interface HighStoreService { +} diff --git a/hai-service/src/main/java/com/hai/service/impl/HighMerchantServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighMerchantServiceImpl.java new file mode 100644 index 00000000..00793907 --- /dev/null +++ b/hai-service/src/main/java/com/hai/service/impl/HighMerchantServiceImpl.java @@ -0,0 +1,59 @@ +package com.hai.service.impl; + +import com.hai.dao.HighMerchantMapper; +import com.hai.entity.HighMerchant; +import com.hai.entity.HighMerchantExample; +import com.hai.service.HighMerchantService; +import org.apache.commons.collections4.MapUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Map; + +@Service("highMerchantService") +public class HighMerchantServiceImpl implements HighMerchantService { + + @Resource + private HighMerchantMapper highMerchantMapper; + + @Override + public void editMerchant(HighMerchant highMerchant) { + if (highMerchant.getId() == null) { + highMerchantMapper.insert(highMerchant); + } else { + highMerchantMapper.updateByPrimaryKey(highMerchant); + } + } + + @Override + public HighMerchant getMerchantById(Long id) { + return highMerchantMapper.selectByPrimaryKey(id); + } + + @Override + public List getMerchantList(Map map) { + HighMerchantExample example = new HighMerchantExample(); + HighMerchantExample.Criteria criteria = example.createCriteria(); + + if (map.get("companyId") != null) { + criteria.andCompanyIdEqualTo(MapUtils.getLongValue(map, "companyId")); + } + + if (map.get("merchantKey") != null) { + criteria.andMerchantKeyEqualTo(MapUtils.getString(map, "merchantKey")); + } + + if (StringUtils.isNotBlank(MapUtils.getString(map, "merchantName"))) { + criteria.andMerchantNameLike("%" + MapUtils.getString(map, "merchantName") + "%"); + } + + if (StringUtils.isNotBlank(MapUtils.getString(map, "telephone"))) { + criteria.andTelephoneEqualTo(MapUtils.getString(map, "telephone")); + } + + example.setOrderByClause("create_time desc"); + return highMerchantMapper.selectByExample(example); + } +} diff --git a/hai-service/src/main/java/com/hai/service/impl/HighStoreServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighStoreServiceImpl.java new file mode 100644 index 00000000..a2b6ceb6 --- /dev/null +++ b/hai-service/src/main/java/com/hai/service/impl/HighStoreServiceImpl.java @@ -0,0 +1,5 @@ +package com.hai.service.impl; + + +public class HighStoreServiceImpl { +}