parent
eb6567bb39
commit
6b6a54e8f3
@ -0,0 +1,133 @@ |
||||
package com.bweb.controller; |
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
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.UserCenter; |
||||
import com.hai.common.utils.ResponseMsgUtil; |
||||
import com.hai.entity.HighCompanyTwoPwd; |
||||
import com.hai.model.ResponseData; |
||||
import com.hai.model.UserInfoModel; |
||||
import com.hai.service.HighCompanyTwoPwdService; |
||||
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.dao.DeadlockLoserDataAccessException; |
||||
import org.springframework.stereotype.Controller; |
||||
import org.springframework.web.bind.annotation.RequestBody; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RequestMethod; |
||||
import org.springframework.web.bind.annotation.ResponseBody; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.math.BigDecimal; |
||||
|
||||
@Controller |
||||
@RequestMapping(value = "/companyTwoPwd") |
||||
@Api(value = "代理商接口") |
||||
public class HighCompanyTwoPwdController { |
||||
|
||||
private static Logger log = LoggerFactory.getLogger(HighCompanyTwoPwdController.class); |
||||
|
||||
@Resource |
||||
private HighCompanyTwoPwdService companyTwoPwdService; |
||||
|
||||
@Resource |
||||
private UserCenter userCenter; |
||||
|
||||
@RequestMapping(value = "/setTwoPwd", method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "设置二级密码") |
||||
public ResponseData setTwoPwd(@RequestBody JSONObject body) { |
||||
try { |
||||
|
||||
if (StringUtils.isBlank(body.getString("password"))) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
|
||||
UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class); |
||||
if (userInfoModel.getBsOrganization() == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); |
||||
} |
||||
|
||||
if (companyTwoPwdService.getTwoPwdByOrg(userInfoModel.getBsOrganization().getId()) != null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "二级密码已设置,请勿重复设置"); |
||||
} |
||||
|
||||
HighCompanyTwoPwd twoPwd = new HighCompanyTwoPwd(); |
||||
twoPwd.setCompanyId(userInfoModel.getBsCompany().getId()); |
||||
twoPwd.setOrgId(userInfoModel.getBsOrganization().getId()); |
||||
twoPwd.setPassword(AESEncodeUtil.aesEncrypt(body.getString("password"))); |
||||
companyTwoPwdService.editData(twoPwd); |
||||
|
||||
return ResponseMsgUtil.success("操作成功"); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("HighCompanyTwoPwdController --> setTwoPwd() error!", e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value = "/updateTwoPwd", method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "修改二级密码") |
||||
public ResponseData updateTwoPwd(@RequestBody JSONObject body) { |
||||
try { |
||||
|
||||
if (StringUtils.isBlank(body.getString("oldPassword")) |
||||
|| StringUtils.isBlank(body.getString("newPassword"))) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
|
||||
UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class); |
||||
if (userInfoModel.getBsOrganization() == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); |
||||
} |
||||
|
||||
// 二级密码
|
||||
HighCompanyTwoPwd twoPwd = companyTwoPwdService.getTwoPwdByOrg(userInfoModel.getBsOrganization().getId()); |
||||
if (twoPwd == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "修改密码失败,未设置二级密码"); |
||||
} |
||||
if (!AESEncodeUtil.aesEncrypt(body.getString("oldPassword")).equals(twoPwd.getPassword())) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "旧密码错误"); |
||||
} |
||||
|
||||
twoPwd.setPassword(AESEncodeUtil.aesEncrypt(body.getString("newPassword"))); |
||||
companyTwoPwdService.editData(twoPwd); |
||||
|
||||
return ResponseMsgUtil.success("操作成功"); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("HighCompanyTwoPwdController --> updateTwoPwd() error!", e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value = "/isSetTwoPwd", method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "是否设置二级码") |
||||
public ResponseData isSetTwoPwd() { |
||||
try { |
||||
UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class); |
||||
if (userInfoModel.getBsOrganization() == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); |
||||
} |
||||
|
||||
HighCompanyTwoPwd twoPwd = companyTwoPwdService.getTwoPwdByOrg(userInfoModel.getBsOrganization().getId()); |
||||
if (twoPwd == null) { |
||||
return ResponseMsgUtil.success(false); |
||||
} |
||||
return ResponseMsgUtil.success(true); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("HighCompanyTwoPwdController --> isSetTwoPwd() error!", e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,211 @@ |
||||
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.UserCenter; |
||||
import com.hai.common.utils.ResponseMsgUtil; |
||||
import com.hai.entity.HighCompanyTwoPwd; |
||||
import com.hai.model.ResponseData; |
||||
import com.hai.model.UserInfoModel; |
||||
import com.hai.service.HighCompanyTwoPwdService; |
||||
import com.hai.service.HighOilCardService; |
||||
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 java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
@Controller |
||||
@RequestMapping(value = "/oilCard") |
||||
@Api(value = "油卡") |
||||
public class HighOilCardController { |
||||
|
||||
private static Logger log = LoggerFactory.getLogger(HighOilCardController.class); |
||||
|
||||
@Resource |
||||
private UserCenter userCenter; |
||||
|
||||
@Resource |
||||
private HighOilCardService oilCardService; |
||||
|
||||
@Resource |
||||
private HighCompanyTwoPwdService companyTwoPwdService; |
||||
|
||||
@RequestMapping(value = "/recharge", method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "油卡充值") |
||||
public ResponseData recharge(@RequestBody JSONObject body) { |
||||
try { |
||||
if (StringUtils.isBlank(body.getString("cardNo")) || |
||||
body.getBigDecimal("price") == null || |
||||
StringUtils.isBlank(body.getString("twoPwd"))) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
UserInfoModel userModel = userCenter.getSessionModel(UserInfoModel.class); |
||||
if (userModel.getBsOrganization() == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "权限不足"); |
||||
} |
||||
|
||||
// 查询二级密码
|
||||
HighCompanyTwoPwd pwdByOrg = companyTwoPwdService.getTwoPwdByOrg(userModel.getBsOrganization().getId()); |
||||
if (pwdByOrg == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_TOW_PWD, ""); |
||||
} |
||||
if (!AESEncodeUtil.aesEncrypt(body.getString("twoPwd")).equals(pwdByOrg.getPassword())) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "二级密码错误"); |
||||
} |
||||
// 充值
|
||||
oilCardService.recharge(body.getString("cardNo"), body.getBigDecimal("price"), userModel.getBsOrganization().getId()); |
||||
|
||||
return ResponseMsgUtil.success("操作成功"); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("HighOilCardController --> recharge() error!", e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value = "/generateCard", method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "生成油卡") |
||||
public ResponseData generateCard(@RequestBody JSONObject body) { |
||||
try { |
||||
if (body.getInteger("generateNum") == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
|
||||
UserInfoModel userModel = userCenter.getSessionModel(UserInfoModel.class); |
||||
if (userModel.getBsOrganization() == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "权限不足"); |
||||
} |
||||
|
||||
oilCardService.generateCard(userModel.getBsOrganization().getId(), body.getInteger("generateNum")); |
||||
|
||||
return ResponseMsgUtil.success("操作成功"); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("HighOilCardController --> generateCard() error!", e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value = "/setContact", method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "设置联系人") |
||||
public ResponseData setContact(@RequestBody JSONObject body) { |
||||
try { |
||||
if (StringUtils.isBlank(body.getString("cardNo")) |
||||
|| StringUtils.isBlank(body.getString("contactName")) |
||||
|| StringUtils.isBlank(body.getString("contactPhone"))) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
|
||||
UserInfoModel userModel = userCenter.getSessionModel(UserInfoModel.class); |
||||
if (userModel.getBsOrganization() == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "权限不足"); |
||||
} |
||||
oilCardService.setContact(body.getString("cardNo"),body.getString("contactName"),body.getString("contactPhone")); |
||||
|
||||
return ResponseMsgUtil.success("操作成功"); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("HighOilCardController --> setContact() error!", e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value = "/disabled", method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "禁用") |
||||
public ResponseData disabled(@RequestBody JSONObject body) { |
||||
try { |
||||
if (StringUtils.isBlank(body.getString("cardNo"))) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
|
||||
oilCardService.disabled(body.getString("cardNo")); |
||||
|
||||
return ResponseMsgUtil.success("操作成功"); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("HighOilCardController --> disabled() error!", e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value = "/enable", method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "启用") |
||||
public ResponseData enable(@RequestBody JSONObject body) { |
||||
try { |
||||
if (StringUtils.isBlank(body.getString("cardNo"))) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
|
||||
oilCardService.enable(body.getString("cardNo")); |
||||
|
||||
return ResponseMsgUtil.success("操作成功"); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("HighOilCardController --> enable() error!", e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value = "/getCardList", method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询油卡列表") |
||||
public ResponseData getCardList(@RequestParam(name = "orgId", required = false) Long orgId, |
||||
@RequestParam(name = "cardNo", required = false) String cardNo, |
||||
@RequestParam(name = "contactName", required = false) String contactName, |
||||
@RequestParam(name = "contactPhone", required = false) String contactPhone, |
||||
@RequestParam(name = "createTimeS", required = false) Long createTimeS, |
||||
@RequestParam(name = "createTimeE", required = false) Long createTimeE, |
||||
@RequestParam(name = "bindTimeS", required = false) Long bindTimeS, |
||||
@RequestParam(name = "bindTimeE", required = false) Long bindTimeE, |
||||
@RequestParam(name = "isConfigContact", required = false) Boolean isConfigContact, |
||||
@RequestParam(name = "status", required = false) Integer status, |
||||
@RequestParam(name = "bindStatus", required = false) Integer bindStatus, |
||||
@RequestParam(name = "pageNum", required = true) Integer pageNum, |
||||
@RequestParam(name = "pageSize", required = true) Integer pageSize) { |
||||
try { |
||||
|
||||
UserInfoModel userModel = userCenter.getSessionModel(UserInfoModel.class); |
||||
|
||||
Map<String, Object> param = new HashMap<>(); |
||||
param.put("companyId", userModel.getBsCompany().getId()); |
||||
|
||||
if (userModel.getSecUser().getAdminFlag() != 1) { |
||||
param.put("orgId", userModel.getBsOrganization().getId()); |
||||
} |
||||
param.put("cardNo", cardNo); |
||||
param.put("contactName", contactName); |
||||
param.put("contactPhone", contactPhone); |
||||
param.put("createTimeS", createTimeS); |
||||
param.put("createTimeE", createTimeE); |
||||
param.put("bindTimeS", bindTimeS); |
||||
param.put("bindTimeE", bindTimeE); |
||||
param.put("isConfigContact", isConfigContact); |
||||
param.put("status", status); |
||||
param.put("bindStatus", bindStatus); |
||||
|
||||
PageHelper.startPage(pageNum, pageSize); |
||||
return ResponseMsgUtil.success(new PageInfo<>(oilCardService.getOilCardList(param))); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("HighOilCardController --> getCardList() error!", e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,119 @@ |
||||
package com.hai.common.utils; |
||||
|
||||
import com.hai.common.exception.AppException; |
||||
import org.apache.commons.lang3.StringUtils; |
||||
|
||||
public class BankNumberUtil { |
||||
private static int i = 0; |
||||
|
||||
/** |
||||
* 需要传入一个前缀:6、8、9中的一个。 |
||||
* 其中:6:类型1,8:类型2,9:类型3 【根据自己的业务定义】 |
||||
* 其他则会返回异常 |
||||
* @param prefix |
||||
* @return |
||||
*/ |
||||
public synchronized static String getBrankNumber(String prefix) { |
||||
if(StringUtils.isNotBlank(prefix)){ |
||||
if("6".indexOf(prefix)>=0&&prefix.length()==1){ |
||||
String st = "610"+prefix+getUnixTime(); |
||||
return st+getBankCardCheckCode(st); |
||||
} else if("8".indexOf(prefix)>=0&&prefix.length()==1){ |
||||
String st = "810"+prefix+getUnixTime(); |
||||
return st+getBankCardCheckCode(st); |
||||
}else{ |
||||
System.out.println("银行卡号前缀有误"); |
||||
} |
||||
} else { |
||||
System.out.println("银行卡号去前缀不能是空"); |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
/*** |
||||
* 获取当前系统时间戳 并截取 |
||||
* @return |
||||
*/ |
||||
private synchronized static String getUnixTime(){ |
||||
try { |
||||
Thread.sleep(10);//线程同步执行,休眠10毫秒 防止卡号重复
|
||||
|
||||
} catch (InterruptedException e) { |
||||
e.printStackTrace(); |
||||
} |
||||
|
||||
i++;i=i>100?i%10:i; |
||||
|
||||
return ((System.currentTimeMillis()/100)+"").substring(1)+(i%10); |
||||
|
||||
} |
||||
|
||||
/** |
||||
|
||||
* 校验银行卡卡号 |
||||
|
||||
* @param cardId |
||||
|
||||
* @return |
||||
|
||||
*/ |
||||
|
||||
public static boolean checkBankCard(String cardId) { |
||||
char bit = getBankCardCheckCode(cardId.substring(0, cardId.length() - 1)); |
||||
if(bit == 'N'){ |
||||
return false; |
||||
} |
||||
return cardId.charAt(cardId.length() - 1) == bit; |
||||
} |
||||
|
||||
/** |
||||
|
||||
* 从不含校验位的银行卡卡号采用 Luhm 校验算法获得校验位 |
||||
|
||||
* @param nonCheckCodeCardId |
||||
|
||||
* @return |
||||
|
||||
*/ |
||||
|
||||
public static char getBankCardCheckCode(String nonCheckCodeCardId){ |
||||
if(nonCheckCodeCardId == null || nonCheckCodeCardId.trim().length() == 0 |
||||
|
||||
|| !nonCheckCodeCardId.matches("\\d+")) { |
||||
//如果传的不是数据返回N
|
||||
return 'N'; |
||||
} |
||||
|
||||
char[] chs = nonCheckCodeCardId.trim().toCharArray(); |
||||
|
||||
int luhmSum = 0; |
||||
|
||||
for(int i = chs.length - 1, j = 0; i >= 0; i--, j++) { |
||||
int k = chs[i] - '0'; |
||||
|
||||
if(j % 2 == 0) { |
||||
k *= 2; |
||||
|
||||
k = k / 10 + k % 10; |
||||
|
||||
} |
||||
|
||||
luhmSum += k; |
||||
|
||||
} |
||||
|
||||
return (luhmSum % 10 == 0) ? '0' : (char)((10 - luhmSum % 10) + '0'); |
||||
|
||||
} |
||||
|
||||
public static void main(String[] args) { |
||||
try { |
||||
for (int i = 0; i <= 1;i++) { |
||||
System.out.println(getBrankNumber("6")); |
||||
} |
||||
} catch (AppException e) { |
||||
e.printStackTrace(); |
||||
} |
||||
|
||||
} |
||||
} |
@ -0,0 +1,117 @@ |
||||
package com.hai.dao; |
||||
|
||||
import com.hai.entity.HighOilCardContactRecord; |
||||
import com.hai.entity.HighOilCardContactRecordExample; |
||||
import java.util.List; |
||||
import org.apache.ibatis.annotations.Delete; |
||||
import org.apache.ibatis.annotations.DeleteProvider; |
||||
import org.apache.ibatis.annotations.Insert; |
||||
import org.apache.ibatis.annotations.InsertProvider; |
||||
import org.apache.ibatis.annotations.Options; |
||||
import org.apache.ibatis.annotations.Param; |
||||
import org.apache.ibatis.annotations.Result; |
||||
import org.apache.ibatis.annotations.Results; |
||||
import org.apache.ibatis.annotations.Select; |
||||
import org.apache.ibatis.annotations.SelectProvider; |
||||
import org.apache.ibatis.annotations.Update; |
||||
import org.apache.ibatis.annotations.UpdateProvider; |
||||
import org.apache.ibatis.type.JdbcType; |
||||
import org.springframework.stereotype.Repository; |
||||
|
||||
/** |
||||
* |
||||
* 代码由工具生成,请勿修改!!! |
||||
* 如果需要扩展请在其父类进行扩展 |
||||
* |
||||
**/ |
||||
@Repository |
||||
public interface HighOilCardContactRecordMapper extends HighOilCardContactRecordMapperExt { |
||||
@SelectProvider(type=HighOilCardContactRecordSqlProvider.class, method="countByExample") |
||||
long countByExample(HighOilCardContactRecordExample example); |
||||
|
||||
@DeleteProvider(type=HighOilCardContactRecordSqlProvider.class, method="deleteByExample") |
||||
int deleteByExample(HighOilCardContactRecordExample example); |
||||
|
||||
@Delete({ |
||||
"delete from high_oil_card_contact_record", |
||||
"where id = #{id,jdbcType=BIGINT}" |
||||
}) |
||||
int deleteByPrimaryKey(Long id); |
||||
|
||||
@Insert({ |
||||
"insert into high_oil_card_contact_record (oil_card_id, content, ", |
||||
"`status`, create_time, ", |
||||
"op_user_id, op_user_name, ", |
||||
"ext_1, ext_2, ext_3)", |
||||
"values (#{oilCardId,jdbcType=BIGINT}, #{content,jdbcType=VARCHAR}, ", |
||||
"#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ", |
||||
"#{opUserId,jdbcType=BIGINT}, #{opUserName,jdbcType=VARCHAR}, ", |
||||
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" |
||||
}) |
||||
@Options(useGeneratedKeys=true,keyProperty="id") |
||||
int insert(HighOilCardContactRecord record); |
||||
|
||||
@InsertProvider(type=HighOilCardContactRecordSqlProvider.class, method="insertSelective") |
||||
@Options(useGeneratedKeys=true,keyProperty="id") |
||||
int insertSelective(HighOilCardContactRecord record); |
||||
|
||||
@SelectProvider(type=HighOilCardContactRecordSqlProvider.class, method="selectByExample") |
||||
@Results({ |
||||
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), |
||||
@Result(column="oil_card_id", property="oilCardId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="content", property="content", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="op_user_id", property="opUserId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="op_user_name", property="opUserName", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) |
||||
}) |
||||
List<HighOilCardContactRecord> selectByExample(HighOilCardContactRecordExample example); |
||||
|
||||
@Select({ |
||||
"select", |
||||
"id, oil_card_id, content, `status`, create_time, op_user_id, op_user_name, ext_1, ", |
||||
"ext_2, ext_3", |
||||
"from high_oil_card_contact_record", |
||||
"where id = #{id,jdbcType=BIGINT}" |
||||
}) |
||||
@Results({ |
||||
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), |
||||
@Result(column="oil_card_id", property="oilCardId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="content", property="content", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="op_user_id", property="opUserId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="op_user_name", property="opUserName", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) |
||||
}) |
||||
HighOilCardContactRecord selectByPrimaryKey(Long id); |
||||
|
||||
@UpdateProvider(type=HighOilCardContactRecordSqlProvider.class, method="updateByExampleSelective") |
||||
int updateByExampleSelective(@Param("record") HighOilCardContactRecord record, @Param("example") HighOilCardContactRecordExample example); |
||||
|
||||
@UpdateProvider(type=HighOilCardContactRecordSqlProvider.class, method="updateByExample") |
||||
int updateByExample(@Param("record") HighOilCardContactRecord record, @Param("example") HighOilCardContactRecordExample example); |
||||
|
||||
@UpdateProvider(type=HighOilCardContactRecordSqlProvider.class, method="updateByPrimaryKeySelective") |
||||
int updateByPrimaryKeySelective(HighOilCardContactRecord record); |
||||
|
||||
@Update({ |
||||
"update high_oil_card_contact_record", |
||||
"set oil_card_id = #{oilCardId,jdbcType=BIGINT},", |
||||
"content = #{content,jdbcType=VARCHAR},", |
||||
"`status` = #{status,jdbcType=INTEGER},", |
||||
"create_time = #{createTime,jdbcType=TIMESTAMP},", |
||||
"op_user_id = #{opUserId,jdbcType=BIGINT},", |
||||
"op_user_name = #{opUserName,jdbcType=VARCHAR},", |
||||
"ext_1 = #{ext1,jdbcType=VARCHAR},", |
||||
"ext_2 = #{ext2,jdbcType=VARCHAR},", |
||||
"ext_3 = #{ext3,jdbcType=VARCHAR}", |
||||
"where id = #{id,jdbcType=BIGINT}" |
||||
}) |
||||
int updateByPrimaryKey(HighOilCardContactRecord record); |
||||
} |
@ -0,0 +1,7 @@ |
||||
package com.hai.dao; |
||||
|
||||
/** |
||||
* mapper扩展类 |
||||
*/ |
||||
public interface HighOilCardContactRecordMapperExt { |
||||
} |
@ -0,0 +1,304 @@ |
||||
package com.hai.dao; |
||||
|
||||
import com.hai.entity.HighOilCardContactRecord; |
||||
import com.hai.entity.HighOilCardContactRecordExample.Criteria; |
||||
import com.hai.entity.HighOilCardContactRecordExample.Criterion; |
||||
import com.hai.entity.HighOilCardContactRecordExample; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
import org.apache.ibatis.jdbc.SQL; |
||||
|
||||
public class HighOilCardContactRecordSqlProvider { |
||||
|
||||
public String countByExample(HighOilCardContactRecordExample example) { |
||||
SQL sql = new SQL(); |
||||
sql.SELECT("count(*)").FROM("high_oil_card_contact_record"); |
||||
applyWhere(sql, example, false); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String deleteByExample(HighOilCardContactRecordExample example) { |
||||
SQL sql = new SQL(); |
||||
sql.DELETE_FROM("high_oil_card_contact_record"); |
||||
applyWhere(sql, example, false); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String insertSelective(HighOilCardContactRecord record) { |
||||
SQL sql = new SQL(); |
||||
sql.INSERT_INTO("high_oil_card_contact_record"); |
||||
|
||||
if (record.getOilCardId() != null) { |
||||
sql.VALUES("oil_card_id", "#{oilCardId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getContent() != null) { |
||||
sql.VALUES("content", "#{content,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getStatus() != null) { |
||||
sql.VALUES("`status`", "#{status,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getCreateTime() != null) { |
||||
sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getOpUserId() != null) { |
||||
sql.VALUES("op_user_id", "#{opUserId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getOpUserName() != null) { |
||||
sql.VALUES("op_user_name", "#{opUserName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt1() != null) { |
||||
sql.VALUES("ext_1", "#{ext1,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt2() != null) { |
||||
sql.VALUES("ext_2", "#{ext2,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt3() != null) { |
||||
sql.VALUES("ext_3", "#{ext3,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String selectByExample(HighOilCardContactRecordExample example) { |
||||
SQL sql = new SQL(); |
||||
if (example != null && example.isDistinct()) { |
||||
sql.SELECT_DISTINCT("id"); |
||||
} else { |
||||
sql.SELECT("id"); |
||||
} |
||||
sql.SELECT("oil_card_id"); |
||||
sql.SELECT("content"); |
||||
sql.SELECT("`status`"); |
||||
sql.SELECT("create_time"); |
||||
sql.SELECT("op_user_id"); |
||||
sql.SELECT("op_user_name"); |
||||
sql.SELECT("ext_1"); |
||||
sql.SELECT("ext_2"); |
||||
sql.SELECT("ext_3"); |
||||
sql.FROM("high_oil_card_contact_record"); |
||||
applyWhere(sql, example, false); |
||||
|
||||
if (example != null && example.getOrderByClause() != null) { |
||||
sql.ORDER_BY(example.getOrderByClause()); |
||||
} |
||||
|
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String updateByExampleSelective(Map<String, Object> parameter) { |
||||
HighOilCardContactRecord record = (HighOilCardContactRecord) parameter.get("record"); |
||||
HighOilCardContactRecordExample example = (HighOilCardContactRecordExample) parameter.get("example"); |
||||
|
||||
SQL sql = new SQL(); |
||||
sql.UPDATE("high_oil_card_contact_record"); |
||||
|
||||
if (record.getId() != null) { |
||||
sql.SET("id = #{record.id,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getOilCardId() != null) { |
||||
sql.SET("oil_card_id = #{record.oilCardId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getContent() != null) { |
||||
sql.SET("content = #{record.content,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getStatus() != null) { |
||||
sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getCreateTime() != null) { |
||||
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getOpUserId() != null) { |
||||
sql.SET("op_user_id = #{record.opUserId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getOpUserName() != null) { |
||||
sql.SET("op_user_name = #{record.opUserName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt1() != null) { |
||||
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt2() != null) { |
||||
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt3() != null) { |
||||
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
applyWhere(sql, example, true); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String updateByExample(Map<String, Object> parameter) { |
||||
SQL sql = new SQL(); |
||||
sql.UPDATE("high_oil_card_contact_record"); |
||||
|
||||
sql.SET("id = #{record.id,jdbcType=BIGINT}"); |
||||
sql.SET("oil_card_id = #{record.oilCardId,jdbcType=BIGINT}"); |
||||
sql.SET("content = #{record.content,jdbcType=VARCHAR}"); |
||||
sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); |
||||
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); |
||||
sql.SET("op_user_id = #{record.opUserId,jdbcType=BIGINT}"); |
||||
sql.SET("op_user_name = #{record.opUserName,jdbcType=VARCHAR}"); |
||||
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); |
||||
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); |
||||
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); |
||||
|
||||
HighOilCardContactRecordExample example = (HighOilCardContactRecordExample) parameter.get("example"); |
||||
applyWhere(sql, example, true); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String updateByPrimaryKeySelective(HighOilCardContactRecord record) { |
||||
SQL sql = new SQL(); |
||||
sql.UPDATE("high_oil_card_contact_record"); |
||||
|
||||
if (record.getOilCardId() != null) { |
||||
sql.SET("oil_card_id = #{oilCardId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getContent() != null) { |
||||
sql.SET("content = #{content,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getStatus() != null) { |
||||
sql.SET("`status` = #{status,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getCreateTime() != null) { |
||||
sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getOpUserId() != null) { |
||||
sql.SET("op_user_id = #{opUserId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getOpUserName() != null) { |
||||
sql.SET("op_user_name = #{opUserName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt1() != null) { |
||||
sql.SET("ext_1 = #{ext1,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt2() != null) { |
||||
sql.SET("ext_2 = #{ext2,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt3() != null) { |
||||
sql.SET("ext_3 = #{ext3,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
sql.WHERE("id = #{id,jdbcType=BIGINT}"); |
||||
|
||||
return sql.toString(); |
||||
} |
||||
|
||||
protected void applyWhere(SQL sql, HighOilCardContactRecordExample example, boolean includeExamplePhrase) { |
||||
if (example == null) { |
||||
return; |
||||
} |
||||
|
||||
String parmPhrase1; |
||||
String parmPhrase1_th; |
||||
String parmPhrase2; |
||||
String parmPhrase2_th; |
||||
String parmPhrase3; |
||||
String parmPhrase3_th; |
||||
if (includeExamplePhrase) { |
||||
parmPhrase1 = "%s #{example.oredCriteria[%d].allCriteria[%d].value}"; |
||||
parmPhrase1_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}"; |
||||
parmPhrase2 = "%s #{example.oredCriteria[%d].allCriteria[%d].value} and #{example.oredCriteria[%d].criteria[%d].secondValue}"; |
||||
parmPhrase2_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{example.oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}"; |
||||
parmPhrase3 = "#{example.oredCriteria[%d].allCriteria[%d].value[%d]}"; |
||||
parmPhrase3_th = "#{example.oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}"; |
||||
} else { |
||||
parmPhrase1 = "%s #{oredCriteria[%d].allCriteria[%d].value}"; |
||||
parmPhrase1_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}"; |
||||
parmPhrase2 = "%s #{oredCriteria[%d].allCriteria[%d].value} and #{oredCriteria[%d].criteria[%d].secondValue}"; |
||||
parmPhrase2_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}"; |
||||
parmPhrase3 = "#{oredCriteria[%d].allCriteria[%d].value[%d]}"; |
||||
parmPhrase3_th = "#{oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}"; |
||||
} |
||||
|
||||
StringBuilder sb = new StringBuilder(); |
||||
List<Criteria> oredCriteria = example.getOredCriteria(); |
||||
boolean firstCriteria = true; |
||||
for (int i = 0; i < oredCriteria.size(); i++) { |
||||
Criteria criteria = oredCriteria.get(i); |
||||
if (criteria.isValid()) { |
||||
if (firstCriteria) { |
||||
firstCriteria = false; |
||||
} else { |
||||
sb.append(" or "); |
||||
} |
||||
|
||||
sb.append('('); |
||||
List<Criterion> criterions = criteria.getAllCriteria(); |
||||
boolean firstCriterion = true; |
||||
for (int j = 0; j < criterions.size(); j++) { |
||||
Criterion criterion = criterions.get(j); |
||||
if (firstCriterion) { |
||||
firstCriterion = false; |
||||
} else { |
||||
sb.append(" and "); |
||||
} |
||||
|
||||
if (criterion.isNoValue()) { |
||||
sb.append(criterion.getCondition()); |
||||
} else if (criterion.isSingleValue()) { |
||||
if (criterion.getTypeHandler() == null) { |
||||
sb.append(String.format(parmPhrase1, criterion.getCondition(), i, j)); |
||||
} else { |
||||
sb.append(String.format(parmPhrase1_th, criterion.getCondition(), i, j,criterion.getTypeHandler())); |
||||
} |
||||
} else if (criterion.isBetweenValue()) { |
||||
if (criterion.getTypeHandler() == null) { |
||||
sb.append(String.format(parmPhrase2, criterion.getCondition(), i, j, i, j)); |
||||
} else { |
||||
sb.append(String.format(parmPhrase2_th, criterion.getCondition(), i, j, criterion.getTypeHandler(), i, j, criterion.getTypeHandler())); |
||||
} |
||||
} else if (criterion.isListValue()) { |
||||
sb.append(criterion.getCondition()); |
||||
sb.append(" ("); |
||||
List<?> listItems = (List<?>) criterion.getValue(); |
||||
boolean comma = false; |
||||
for (int k = 0; k < listItems.size(); k++) { |
||||
if (comma) { |
||||
sb.append(", "); |
||||
} else { |
||||
comma = true; |
||||
} |
||||
if (criterion.getTypeHandler() == null) { |
||||
sb.append(String.format(parmPhrase3, i, j, k)); |
||||
} else { |
||||
sb.append(String.format(parmPhrase3_th, i, j, k, criterion.getTypeHandler())); |
||||
} |
||||
} |
||||
sb.append(')'); |
||||
} |
||||
} |
||||
sb.append(')'); |
||||
} |
||||
} |
||||
|
||||
if (sb.length() > 0) { |
||||
sql.WHERE(sb.toString()); |
||||
} |
||||
} |
||||
} |
@ -1,7 +1,58 @@ |
||||
package com.hai.dao; |
||||
|
||||
import com.hai.entity.HighOilCard; |
||||
import org.apache.ibatis.annotations.Insert; |
||||
import org.apache.ibatis.annotations.Param; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* mapper扩展类 |
||||
*/ |
||||
public interface HighOilCardMapperExt { |
||||
|
||||
@Insert({ |
||||
"<script>" + |
||||
"insert into high_oil_card (" + |
||||
"company_id, " + |
||||
"company_name, " + |
||||
"org_id," + |
||||
"org_name, " + |
||||
"card_no, " + |
||||
"amount," + |
||||
"contact_name, " + |
||||
"contact_phone," + |
||||
"status," + |
||||
"bind_status, " + |
||||
"create_time," + |
||||
"update_time, " + |
||||
"op_user_id, " + |
||||
"op_user_name, " + |
||||
"ext_1, " + |
||||
"ext_2, " + |
||||
"ext_3) " + |
||||
"values " + |
||||
"<foreach collection='list' item='item' index='index' separator=','>", |
||||
"(#{item.companyId,jdbcType=BIGINT}, " + |
||||
" #{item.companyName,jdbcType=VARCHAR}, " + |
||||
" #{item.orgId,jdbcType=BIGINT}, " + |
||||
" #{item.orgName,jdbcType=VARCHAR}," + |
||||
" #{item.cardNo,jdbcType=VARCHAR}," + |
||||
" #{item.amount,jdbcType=DECIMAL}, " + |
||||
" #{item.contactName,jdbcType=VARCHAR}," + |
||||
" #{item.contactPhone,jdbcType=VARCHAR}, " + |
||||
" #{item.status,jdbcType=INTEGER}," + |
||||
" #{item.bindStatus,jdbcType=INTEGER}," + |
||||
" #{item.createTime,jdbcType=TIMESTAMP}," + |
||||
" #{item.updateTime,jdbcType=TIMESTAMP}, " + |
||||
" #{item.opUserId,jdbcType=BIGINT}," + |
||||
" #{item.opUserName,jdbcType=VARCHAR}, " + |
||||
" #{item.ext1,jdbcType=VARCHAR}," + |
||||
" #{item.ext2,jdbcType=VARCHAR}, " + |
||||
" #{item.ext3,jdbcType=VARCHAR})", |
||||
"</foreach>", |
||||
"</script>" |
||||
}) |
||||
void insertList(@Param(value = "list") List<HighOilCard> oilCardList); |
||||
|
||||
} |
@ -0,0 +1,197 @@ |
||||
package com.hai.entity; |
||||
|
||||
import java.io.Serializable; |
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* high_oil_card_contact_record |
||||
* @author |
||||
*/ |
||||
/** |
||||
* |
||||
* 代码由工具生成 |
||||
* |
||||
**/ |
||||
public class HighOilCardContactRecord implements Serializable { |
||||
private Long id; |
||||
|
||||
/** |
||||
* 油卡id |
||||
*/ |
||||
private Long oilCardId; |
||||
|
||||
/** |
||||
* 内容 |
||||
*/ |
||||
private String content; |
||||
|
||||
/** |
||||
* 状态 0:删除 1:正常 |
||||
*/ |
||||
private Integer status; |
||||
|
||||
/** |
||||
* 创建时间 |
||||
*/ |
||||
private Date createTime; |
||||
|
||||
/** |
||||
* 操作人id |
||||
*/ |
||||
private Long opUserId; |
||||
|
||||
/** |
||||
* 操作人名称 |
||||
*/ |
||||
private String opUserName; |
||||
|
||||
private String ext1; |
||||
|
||||
private String ext2; |
||||
|
||||
private String ext3; |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
public Long getId() { |
||||
return id; |
||||
} |
||||
|
||||
public void setId(Long id) { |
||||
this.id = id; |
||||
} |
||||
|
||||
public Long getOilCardId() { |
||||
return oilCardId; |
||||
} |
||||
|
||||
public void setOilCardId(Long oilCardId) { |
||||
this.oilCardId = oilCardId; |
||||
} |
||||
|
||||
public String getContent() { |
||||
return content; |
||||
} |
||||
|
||||
public void setContent(String content) { |
||||
this.content = content; |
||||
} |
||||
|
||||
public Integer getStatus() { |
||||
return status; |
||||
} |
||||
|
||||
public void setStatus(Integer status) { |
||||
this.status = status; |
||||
} |
||||
|
||||
public Date getCreateTime() { |
||||
return createTime; |
||||
} |
||||
|
||||
public void setCreateTime(Date createTime) { |
||||
this.createTime = createTime; |
||||
} |
||||
|
||||
public Long getOpUserId() { |
||||
return opUserId; |
||||
} |
||||
|
||||
public void setOpUserId(Long opUserId) { |
||||
this.opUserId = opUserId; |
||||
} |
||||
|
||||
public String getOpUserName() { |
||||
return opUserName; |
||||
} |
||||
|
||||
public void setOpUserName(String opUserName) { |
||||
this.opUserName = opUserName; |
||||
} |
||||
|
||||
public String getExt1() { |
||||
return ext1; |
||||
} |
||||
|
||||
public void setExt1(String ext1) { |
||||
this.ext1 = ext1; |
||||
} |
||||
|
||||
public String getExt2() { |
||||
return ext2; |
||||
} |
||||
|
||||
public void setExt2(String ext2) { |
||||
this.ext2 = ext2; |
||||
} |
||||
|
||||
public String getExt3() { |
||||
return ext3; |
||||
} |
||||
|
||||
public void setExt3(String ext3) { |
||||
this.ext3 = ext3; |
||||
} |
||||
|
||||
@Override |
||||
public boolean equals(Object that) { |
||||
if (this == that) { |
||||
return true; |
||||
} |
||||
if (that == null) { |
||||
return false; |
||||
} |
||||
if (getClass() != that.getClass()) { |
||||
return false; |
||||
} |
||||
HighOilCardContactRecord other = (HighOilCardContactRecord) that; |
||||
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) |
||||
&& (this.getOilCardId() == null ? other.getOilCardId() == null : this.getOilCardId().equals(other.getOilCardId())) |
||||
&& (this.getContent() == null ? other.getContent() == null : this.getContent().equals(other.getContent())) |
||||
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) |
||||
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) |
||||
&& (this.getOpUserId() == null ? other.getOpUserId() == null : this.getOpUserId().equals(other.getOpUserId())) |
||||
&& (this.getOpUserName() == null ? other.getOpUserName() == null : this.getOpUserName().equals(other.getOpUserName())) |
||||
&& (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1())) |
||||
&& (this.getExt2() == null ? other.getExt2() == null : this.getExt2().equals(other.getExt2())) |
||||
&& (this.getExt3() == null ? other.getExt3() == null : this.getExt3().equals(other.getExt3())); |
||||
} |
||||
|
||||
@Override |
||||
public int hashCode() { |
||||
final int prime = 31; |
||||
int result = 1; |
||||
result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); |
||||
result = prime * result + ((getOilCardId() == null) ? 0 : getOilCardId().hashCode()); |
||||
result = prime * result + ((getContent() == null) ? 0 : getContent().hashCode()); |
||||
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); |
||||
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); |
||||
result = prime * result + ((getOpUserId() == null) ? 0 : getOpUserId().hashCode()); |
||||
result = prime * result + ((getOpUserName() == null) ? 0 : getOpUserName().hashCode()); |
||||
result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode()); |
||||
result = prime * result + ((getExt2() == null) ? 0 : getExt2().hashCode()); |
||||
result = prime * result + ((getExt3() == null) ? 0 : getExt3().hashCode()); |
||||
return result; |
||||
} |
||||
|
||||
@Override |
||||
public String toString() { |
||||
StringBuilder sb = new StringBuilder(); |
||||
sb.append(getClass().getSimpleName()); |
||||
sb.append(" ["); |
||||
sb.append("Hash = ").append(hashCode()); |
||||
sb.append(", id=").append(id); |
||||
sb.append(", oilCardId=").append(oilCardId); |
||||
sb.append(", content=").append(content); |
||||
sb.append(", status=").append(status); |
||||
sb.append(", createTime=").append(createTime); |
||||
sb.append(", opUserId=").append(opUserId); |
||||
sb.append(", opUserName=").append(opUserName); |
||||
sb.append(", ext1=").append(ext1); |
||||
sb.append(", ext2=").append(ext2); |
||||
sb.append(", ext3=").append(ext3); |
||||
sb.append(", serialVersionUID=").append(serialVersionUID); |
||||
sb.append("]"); |
||||
return sb.toString(); |
||||
} |
||||
} |
@ -0,0 +1,873 @@ |
||||
package com.hai.entity; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
|
||||
public class HighOilCardContactRecordExample { |
||||
protected String orderByClause; |
||||
|
||||
protected boolean distinct; |
||||
|
||||
protected List<Criteria> oredCriteria; |
||||
|
||||
private Integer limit; |
||||
|
||||
private Long offset; |
||||
|
||||
public HighOilCardContactRecordExample() { |
||||
oredCriteria = new ArrayList<Criteria>(); |
||||
} |
||||
|
||||
public void setOrderByClause(String orderByClause) { |
||||
this.orderByClause = orderByClause; |
||||
} |
||||
|
||||
public String getOrderByClause() { |
||||
return orderByClause; |
||||
} |
||||
|
||||
public void setDistinct(boolean distinct) { |
||||
this.distinct = distinct; |
||||
} |
||||
|
||||
public boolean isDistinct() { |
||||
return distinct; |
||||
} |
||||
|
||||
public List<Criteria> getOredCriteria() { |
||||
return oredCriteria; |
||||
} |
||||
|
||||
public void or(Criteria criteria) { |
||||
oredCriteria.add(criteria); |
||||
} |
||||
|
||||
public Criteria or() { |
||||
Criteria criteria = createCriteriaInternal(); |
||||
oredCriteria.add(criteria); |
||||
return criteria; |
||||
} |
||||
|
||||
public Criteria createCriteria() { |
||||
Criteria criteria = createCriteriaInternal(); |
||||
if (oredCriteria.size() == 0) { |
||||
oredCriteria.add(criteria); |
||||
} |
||||
return criteria; |
||||
} |
||||
|
||||
protected Criteria createCriteriaInternal() { |
||||
Criteria criteria = new Criteria(); |
||||
return criteria; |
||||
} |
||||
|
||||
public void clear() { |
||||
oredCriteria.clear(); |
||||
orderByClause = null; |
||||
distinct = false; |
||||
} |
||||
|
||||
public void setLimit(Integer limit) { |
||||
this.limit = limit; |
||||
} |
||||
|
||||
public Integer getLimit() { |
||||
return limit; |
||||
} |
||||
|
||||
public void setOffset(Long offset) { |
||||
this.offset = offset; |
||||
} |
||||
|
||||
public Long getOffset() { |
||||
return offset; |
||||
} |
||||
|
||||
protected abstract static class GeneratedCriteria { |
||||
protected List<Criterion> criteria; |
||||
|
||||
protected GeneratedCriteria() { |
||||
super(); |
||||
criteria = new ArrayList<Criterion>(); |
||||
} |
||||
|
||||
public boolean isValid() { |
||||
return criteria.size() > 0; |
||||
} |
||||
|
||||
public List<Criterion> getAllCriteria() { |
||||
return criteria; |
||||
} |
||||
|
||||
public List<Criterion> getCriteria() { |
||||
return criteria; |
||||
} |
||||
|
||||
protected void addCriterion(String condition) { |
||||
if (condition == null) { |
||||
throw new RuntimeException("Value for condition cannot be null"); |
||||
} |
||||
criteria.add(new Criterion(condition)); |
||||
} |
||||
|
||||
protected void addCriterion(String condition, Object value, String property) { |
||||
if (value == null) { |
||||
throw new RuntimeException("Value for " + property + " cannot be null"); |
||||
} |
||||
criteria.add(new Criterion(condition, value)); |
||||
} |
||||
|
||||
protected void addCriterion(String condition, Object value1, Object value2, String property) { |
||||
if (value1 == null || value2 == null) { |
||||
throw new RuntimeException("Between values for " + property + " cannot be null"); |
||||
} |
||||
criteria.add(new Criterion(condition, value1, value2)); |
||||
} |
||||
|
||||
public Criteria andIdIsNull() { |
||||
addCriterion("id is null"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andIdIsNotNull() { |
||||
addCriterion("id is not null"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andIdEqualTo(Long value) { |
||||
addCriterion("id =", value, "id"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andIdNotEqualTo(Long value) { |
||||
addCriterion("id <>", value, "id"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andIdGreaterThan(Long value) { |
||||
addCriterion("id >", value, "id"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andIdGreaterThanOrEqualTo(Long value) { |
||||
addCriterion("id >=", value, "id"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andIdLessThan(Long value) { |
||||
addCriterion("id <", value, "id"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andIdLessThanOrEqualTo(Long value) { |
||||
addCriterion("id <=", value, "id"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andIdIn(List<Long> values) { |
||||
addCriterion("id in", values, "id"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andIdNotIn(List<Long> values) { |
||||
addCriterion("id not in", values, "id"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andIdBetween(Long value1, Long value2) { |
||||
addCriterion("id between", value1, value2, "id"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andIdNotBetween(Long value1, Long value2) { |
||||
addCriterion("id not between", value1, value2, "id"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andOilCardIdIsNull() { |
||||
addCriterion("oil_card_id is null"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andOilCardIdIsNotNull() { |
||||
addCriterion("oil_card_id is not null"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andOilCardIdEqualTo(Long value) { |
||||
addCriterion("oil_card_id =", value, "oilCardId"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andOilCardIdNotEqualTo(Long value) { |
||||
addCriterion("oil_card_id <>", value, "oilCardId"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andOilCardIdGreaterThan(Long value) { |
||||
addCriterion("oil_card_id >", value, "oilCardId"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andOilCardIdGreaterThanOrEqualTo(Long value) { |
||||
addCriterion("oil_card_id >=", value, "oilCardId"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andOilCardIdLessThan(Long value) { |
||||
addCriterion("oil_card_id <", value, "oilCardId"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andOilCardIdLessThanOrEqualTo(Long value) { |
||||
addCriterion("oil_card_id <=", value, "oilCardId"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andOilCardIdIn(List<Long> values) { |
||||
addCriterion("oil_card_id in", values, "oilCardId"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andOilCardIdNotIn(List<Long> values) { |
||||
addCriterion("oil_card_id not in", values, "oilCardId"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andOilCardIdBetween(Long value1, Long value2) { |
||||
addCriterion("oil_card_id between", value1, value2, "oilCardId"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andOilCardIdNotBetween(Long value1, Long value2) { |
||||
addCriterion("oil_card_id not between", value1, value2, "oilCardId"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andContentIsNull() { |
||||
addCriterion("content is null"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andContentIsNotNull() { |
||||
addCriterion("content is not null"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andContentEqualTo(String value) { |
||||
addCriterion("content =", value, "content"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andContentNotEqualTo(String value) { |
||||
addCriterion("content <>", value, "content"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andContentGreaterThan(String value) { |
||||
addCriterion("content >", value, "content"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andContentGreaterThanOrEqualTo(String value) { |
||||
addCriterion("content >=", value, "content"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andContentLessThan(String value) { |
||||
addCriterion("content <", value, "content"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andContentLessThanOrEqualTo(String value) { |
||||
addCriterion("content <=", value, "content"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andContentLike(String value) { |
||||
addCriterion("content like", value, "content"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andContentNotLike(String value) { |
||||
addCriterion("content not like", value, "content"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andContentIn(List<String> values) { |
||||
addCriterion("content in", values, "content"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andContentNotIn(List<String> values) { |
||||
addCriterion("content not in", values, "content"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andContentBetween(String value1, String value2) { |
||||
addCriterion("content between", value1, value2, "content"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andContentNotBetween(String value1, String value2) { |
||||
addCriterion("content not between", value1, value2, "content"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andStatusIsNull() { |
||||
addCriterion("`status` is null"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andStatusIsNotNull() { |
||||
addCriterion("`status` is not null"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andStatusEqualTo(Integer value) { |
||||
addCriterion("`status` =", value, "status"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andStatusNotEqualTo(Integer value) { |
||||
addCriterion("`status` <>", value, "status"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andStatusGreaterThan(Integer value) { |
||||
addCriterion("`status` >", value, "status"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andStatusGreaterThanOrEqualTo(Integer value) { |
||||
addCriterion("`status` >=", value, "status"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andStatusLessThan(Integer value) { |
||||
addCriterion("`status` <", value, "status"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andStatusLessThanOrEqualTo(Integer value) { |
||||
addCriterion("`status` <=", value, "status"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andStatusIn(List<Integer> values) { |
||||
addCriterion("`status` in", values, "status"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andStatusNotIn(List<Integer> values) { |
||||
addCriterion("`status` not in", values, "status"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andStatusBetween(Integer value1, Integer value2) { |
||||
addCriterion("`status` between", value1, value2, "status"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andStatusNotBetween(Integer value1, Integer value2) { |
||||
addCriterion("`status` not between", value1, value2, "status"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andCreateTimeIsNull() { |
||||
addCriterion("create_time is null"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andCreateTimeIsNotNull() { |
||||
addCriterion("create_time is not null"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andCreateTimeEqualTo(Date value) { |
||||
addCriterion("create_time =", value, "createTime"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andCreateTimeNotEqualTo(Date value) { |
||||
addCriterion("create_time <>", value, "createTime"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andCreateTimeGreaterThan(Date value) { |
||||
addCriterion("create_time >", value, "createTime"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) { |
||||
addCriterion("create_time >=", value, "createTime"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andCreateTimeLessThan(Date value) { |
||||
addCriterion("create_time <", value, "createTime"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andCreateTimeLessThanOrEqualTo(Date value) { |
||||
addCriterion("create_time <=", value, "createTime"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andCreateTimeIn(List<Date> values) { |
||||
addCriterion("create_time in", values, "createTime"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andCreateTimeNotIn(List<Date> values) { |
||||
addCriterion("create_time not in", values, "createTime"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andCreateTimeBetween(Date value1, Date value2) { |
||||
addCriterion("create_time between", value1, value2, "createTime"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andCreateTimeNotBetween(Date value1, Date value2) { |
||||
addCriterion("create_time not between", value1, value2, "createTime"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andOpUserIdIsNull() { |
||||
addCriterion("op_user_id is null"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andOpUserIdIsNotNull() { |
||||
addCriterion("op_user_id is not null"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andOpUserIdEqualTo(Long value) { |
||||
addCriterion("op_user_id =", value, "opUserId"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andOpUserIdNotEqualTo(Long value) { |
||||
addCriterion("op_user_id <>", value, "opUserId"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andOpUserIdGreaterThan(Long value) { |
||||
addCriterion("op_user_id >", value, "opUserId"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andOpUserIdGreaterThanOrEqualTo(Long value) { |
||||
addCriterion("op_user_id >=", value, "opUserId"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andOpUserIdLessThan(Long value) { |
||||
addCriterion("op_user_id <", value, "opUserId"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andOpUserIdLessThanOrEqualTo(Long value) { |
||||
addCriterion("op_user_id <=", value, "opUserId"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andOpUserIdIn(List<Long> values) { |
||||
addCriterion("op_user_id in", values, "opUserId"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andOpUserIdNotIn(List<Long> values) { |
||||
addCriterion("op_user_id not in", values, "opUserId"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andOpUserIdBetween(Long value1, Long value2) { |
||||
addCriterion("op_user_id between", value1, value2, "opUserId"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andOpUserIdNotBetween(Long value1, Long value2) { |
||||
addCriterion("op_user_id not between", value1, value2, "opUserId"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andOpUserNameIsNull() { |
||||
addCriterion("op_user_name is null"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andOpUserNameIsNotNull() { |
||||
addCriterion("op_user_name is not null"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andOpUserNameEqualTo(String value) { |
||||
addCriterion("op_user_name =", value, "opUserName"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andOpUserNameNotEqualTo(String value) { |
||||
addCriterion("op_user_name <>", value, "opUserName"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andOpUserNameGreaterThan(String value) { |
||||
addCriterion("op_user_name >", value, "opUserName"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andOpUserNameGreaterThanOrEqualTo(String value) { |
||||
addCriterion("op_user_name >=", value, "opUserName"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andOpUserNameLessThan(String value) { |
||||
addCriterion("op_user_name <", value, "opUserName"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andOpUserNameLessThanOrEqualTo(String value) { |
||||
addCriterion("op_user_name <=", value, "opUserName"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andOpUserNameLike(String value) { |
||||
addCriterion("op_user_name like", value, "opUserName"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andOpUserNameNotLike(String value) { |
||||
addCriterion("op_user_name not like", value, "opUserName"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andOpUserNameIn(List<String> values) { |
||||
addCriterion("op_user_name in", values, "opUserName"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andOpUserNameNotIn(List<String> values) { |
||||
addCriterion("op_user_name not in", values, "opUserName"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andOpUserNameBetween(String value1, String value2) { |
||||
addCriterion("op_user_name between", value1, value2, "opUserName"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andOpUserNameNotBetween(String value1, String value2) { |
||||
addCriterion("op_user_name not between", value1, value2, "opUserName"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt1IsNull() { |
||||
addCriterion("ext_1 is null"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt1IsNotNull() { |
||||
addCriterion("ext_1 is not null"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt1EqualTo(String value) { |
||||
addCriterion("ext_1 =", value, "ext1"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt1NotEqualTo(String value) { |
||||
addCriterion("ext_1 <>", value, "ext1"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt1GreaterThan(String value) { |
||||
addCriterion("ext_1 >", value, "ext1"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt1GreaterThanOrEqualTo(String value) { |
||||
addCriterion("ext_1 >=", value, "ext1"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt1LessThan(String value) { |
||||
addCriterion("ext_1 <", value, "ext1"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt1LessThanOrEqualTo(String value) { |
||||
addCriterion("ext_1 <=", value, "ext1"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt1Like(String value) { |
||||
addCriterion("ext_1 like", value, "ext1"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt1NotLike(String value) { |
||||
addCriterion("ext_1 not like", value, "ext1"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt1In(List<String> values) { |
||||
addCriterion("ext_1 in", values, "ext1"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt1NotIn(List<String> values) { |
||||
addCriterion("ext_1 not in", values, "ext1"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt1Between(String value1, String value2) { |
||||
addCriterion("ext_1 between", value1, value2, "ext1"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt1NotBetween(String value1, String value2) { |
||||
addCriterion("ext_1 not between", value1, value2, "ext1"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt2IsNull() { |
||||
addCriterion("ext_2 is null"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt2IsNotNull() { |
||||
addCriterion("ext_2 is not null"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt2EqualTo(String value) { |
||||
addCriterion("ext_2 =", value, "ext2"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt2NotEqualTo(String value) { |
||||
addCriterion("ext_2 <>", value, "ext2"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt2GreaterThan(String value) { |
||||
addCriterion("ext_2 >", value, "ext2"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt2GreaterThanOrEqualTo(String value) { |
||||
addCriterion("ext_2 >=", value, "ext2"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt2LessThan(String value) { |
||||
addCriterion("ext_2 <", value, "ext2"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt2LessThanOrEqualTo(String value) { |
||||
addCriterion("ext_2 <=", value, "ext2"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt2Like(String value) { |
||||
addCriterion("ext_2 like", value, "ext2"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt2NotLike(String value) { |
||||
addCriterion("ext_2 not like", value, "ext2"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt2In(List<String> values) { |
||||
addCriterion("ext_2 in", values, "ext2"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt2NotIn(List<String> values) { |
||||
addCriterion("ext_2 not in", values, "ext2"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt2Between(String value1, String value2) { |
||||
addCriterion("ext_2 between", value1, value2, "ext2"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt2NotBetween(String value1, String value2) { |
||||
addCriterion("ext_2 not between", value1, value2, "ext2"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt3IsNull() { |
||||
addCriterion("ext_3 is null"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt3IsNotNull() { |
||||
addCriterion("ext_3 is not null"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt3EqualTo(String value) { |
||||
addCriterion("ext_3 =", value, "ext3"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt3NotEqualTo(String value) { |
||||
addCriterion("ext_3 <>", value, "ext3"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt3GreaterThan(String value) { |
||||
addCriterion("ext_3 >", value, "ext3"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt3GreaterThanOrEqualTo(String value) { |
||||
addCriterion("ext_3 >=", value, "ext3"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt3LessThan(String value) { |
||||
addCriterion("ext_3 <", value, "ext3"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt3LessThanOrEqualTo(String value) { |
||||
addCriterion("ext_3 <=", value, "ext3"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt3Like(String value) { |
||||
addCriterion("ext_3 like", value, "ext3"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt3NotLike(String value) { |
||||
addCriterion("ext_3 not like", value, "ext3"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt3In(List<String> values) { |
||||
addCriterion("ext_3 in", values, "ext3"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt3NotIn(List<String> values) { |
||||
addCriterion("ext_3 not in", values, "ext3"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt3Between(String value1, String value2) { |
||||
addCriterion("ext_3 between", value1, value2, "ext3"); |
||||
return (Criteria) this; |
||||
} |
||||
|
||||
public Criteria andExt3NotBetween(String value1, String value2) { |
||||
addCriterion("ext_3 not between", value1, value2, "ext3"); |
||||
return (Criteria) this; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
*/ |
||||
public static class Criteria extends GeneratedCriteria { |
||||
|
||||
protected Criteria() { |
||||
super(); |
||||
} |
||||
} |
||||
|
||||
public static class Criterion { |
||||
private String condition; |
||||
|
||||
private Object value; |
||||
|
||||
private Object secondValue; |
||||
|
||||
private boolean noValue; |
||||
|
||||
private boolean singleValue; |
||||
|
||||
private boolean betweenValue; |
||||
|
||||
private boolean listValue; |
||||
|
||||
private String typeHandler; |
||||
|
||||
public String getCondition() { |
||||
return condition; |
||||
} |
||||
|
||||
public Object getValue() { |
||||
return value; |
||||
} |
||||
|
||||
public Object getSecondValue() { |
||||
return secondValue; |
||||
} |
||||
|
||||
public boolean isNoValue() { |
||||
return noValue; |
||||
} |
||||
|
||||
public boolean isSingleValue() { |
||||
return singleValue; |
||||
} |
||||
|
||||
public boolean isBetweenValue() { |
||||
return betweenValue; |
||||
} |
||||
|
||||
public boolean isListValue() { |
||||
return listValue; |
||||
} |
||||
|
||||
public String getTypeHandler() { |
||||
return typeHandler; |
||||
} |
||||
|
||||
protected Criterion(String condition) { |
||||
super(); |
||||
this.condition = condition; |
||||
this.typeHandler = null; |
||||
this.noValue = true; |
||||
} |
||||
|
||||
protected Criterion(String condition, Object value, String typeHandler) { |
||||
super(); |
||||
this.condition = condition; |
||||
this.value = value; |
||||
this.typeHandler = typeHandler; |
||||
if (value instanceof List<?>) { |
||||
this.listValue = true; |
||||
} else { |
||||
this.singleValue = true; |
||||
} |
||||
} |
||||
|
||||
protected Criterion(String condition, Object value) { |
||||
this(condition, value, null); |
||||
} |
||||
|
||||
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { |
||||
super(); |
||||
this.condition = condition; |
||||
this.value = value; |
||||
this.secondValue = secondValue; |
||||
this.typeHandler = typeHandler; |
||||
this.betweenValue = true; |
||||
} |
||||
|
||||
protected Criterion(String condition, Object value, Object secondValue) { |
||||
this(condition, value, secondValue, null); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,35 @@ |
||||
package com.hai.enum_type; |
||||
|
||||
/** |
||||
* 油卡绑定状态 |
||||
* @author hurui |
||||
*/ |
||||
public enum OilCardBindStatusEnum { |
||||
status0(0 , "未绑定"), |
||||
status1(1 , "已绑定"), |
||||
; |
||||
|
||||
private Integer status; |
||||
private String name; |
||||
|
||||
OilCardBindStatusEnum(int status , String name) { |
||||
this.status = status; |
||||
this.name = name; |
||||
} |
||||
|
||||
public Integer getStatus() { |
||||
return status; |
||||
} |
||||
|
||||
public void setStatus(Integer status) { |
||||
this.status = status; |
||||
} |
||||
|
||||
public String getName() { |
||||
return name; |
||||
} |
||||
|
||||
public void setName(String name) { |
||||
this.name = name; |
||||
} |
||||
} |
@ -0,0 +1,35 @@ |
||||
package com.hai.enum_type; |
||||
|
||||
/** |
||||
* 油卡记录 |
||||
* @author hurui |
||||
*/ |
||||
public enum OilCardRecordSourceTypeEnum { |
||||
type1(1 , "充值金额"), |
||||
type2(2 , "订单消费"), |
||||
; |
||||
|
||||
private Integer type; |
||||
private String name; |
||||
|
||||
OilCardRecordSourceTypeEnum(int type , String name) { |
||||
this.type = type; |
||||
this.name = name; |
||||
} |
||||
|
||||
public Integer getType() { |
||||
return type; |
||||
} |
||||
|
||||
public void setType(Integer type) { |
||||
this.type = type; |
||||
} |
||||
|
||||
public String getName() { |
||||
return name; |
||||
} |
||||
|
||||
public void setName(String name) { |
||||
this.name = name; |
||||
} |
||||
} |
@ -0,0 +1,35 @@ |
||||
package com.hai.enum_type; |
||||
|
||||
/** |
||||
* 油卡记录 |
||||
* @author hurui |
||||
*/ |
||||
public enum OilCardRecordTypeEnum { |
||||
type1(1 , "进账"), |
||||
type2(2 , "出账"), |
||||
; |
||||
|
||||
private Integer type; |
||||
private String name; |
||||
|
||||
OilCardRecordTypeEnum(int type , String name) { |
||||
this.type = type; |
||||
this.name = name; |
||||
} |
||||
|
||||
public Integer getType() { |
||||
return type; |
||||
} |
||||
|
||||
public void setType(Integer type) { |
||||
this.type = type; |
||||
} |
||||
|
||||
public String getName() { |
||||
return name; |
||||
} |
||||
|
||||
public void setName(String name) { |
||||
this.name = name; |
||||
} |
||||
} |
@ -0,0 +1,36 @@ |
||||
package com.hai.enum_type; |
||||
|
||||
/** |
||||
* 油卡状态 |
||||
* @author hurui |
||||
*/ |
||||
public enum OilCardStatusEnum { |
||||
status0(0 , "删除"), |
||||
status1(1 , "正常"), |
||||
status2(2 , "禁用"), |
||||
; |
||||
|
||||
private Integer status; |
||||
private String name; |
||||
|
||||
OilCardStatusEnum(int status , String name) { |
||||
this.status = status; |
||||
this.name = name; |
||||
} |
||||
|
||||
public Integer getStatus() { |
||||
return status; |
||||
} |
||||
|
||||
public void setStatus(Integer status) { |
||||
this.status = status; |
||||
} |
||||
|
||||
public String getName() { |
||||
return name; |
||||
} |
||||
|
||||
public void setName(String name) { |
||||
this.name = name; |
||||
} |
||||
} |
@ -0,0 +1,24 @@ |
||||
package com.hai.service; |
||||
|
||||
import com.hai.entity.HighCompanyTwoPwd; |
||||
|
||||
/** |
||||
* 公司二级密码 |
||||
* @author hurui |
||||
*/ |
||||
public interface HighCompanyTwoPwdService { |
||||
|
||||
/** |
||||
* 编辑二级密码 |
||||
* @param companyTwoPwd |
||||
*/ |
||||
void editData(HighCompanyTwoPwd companyTwoPwd); |
||||
|
||||
/** |
||||
* 根据部门查询二级密码 |
||||
* @param orgId |
||||
* @return |
||||
*/ |
||||
HighCompanyTwoPwd getTwoPwdByOrg(Long orgId); |
||||
|
||||
} |
@ -0,0 +1,27 @@ |
||||
package com.hai.service; |
||||
|
||||
import com.hai.entity.HighOilCardContactRecord; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* 油卡联系人变更记录 |
||||
* @author hurui |
||||
*/ |
||||
public interface HighOilCardContactRecordService { |
||||
|
||||
/** |
||||
* 增加 |
||||
* @param oilCardId |
||||
* @param content |
||||
*/ |
||||
void insert(Long oilCardId,String content); |
||||
|
||||
/** |
||||
* 查询记录列表 |
||||
* @param param |
||||
* @return |
||||
*/ |
||||
List<HighOilCardContactRecord> getRecordList(Map<String,Object> param); |
||||
} |
@ -0,0 +1,26 @@ |
||||
package com.hai.service; |
||||
|
||||
import com.hai.entity.HighOilCardRecord; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* 油卡进账、出账记录 |
||||
* @author hurui |
||||
*/ |
||||
public interface HighOilCardRecordService { |
||||
|
||||
/** |
||||
* 增加记录 |
||||
* @param oilCardRecord |
||||
*/ |
||||
void insertRecord(HighOilCardRecord oilCardRecord); |
||||
|
||||
/** |
||||
* 查询记录列表 |
||||
* @param map |
||||
* @return |
||||
*/ |
||||
List<HighOilCardRecord> getRecordList(Map<String, Object> map); |
||||
} |
@ -0,0 +1,77 @@ |
||||
package com.hai.service; |
||||
|
||||
import com.hai.entity.HighOilCard; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* 油卡 |
||||
* @author hurui |
||||
*/ |
||||
public interface HighOilCardService { |
||||
|
||||
/** |
||||
* 编辑数据 |
||||
* @param oilCard |
||||
*/ |
||||
void editData(HighOilCard oilCard); |
||||
|
||||
/** |
||||
* 油卡充值 |
||||
* @param cardNo 油卡卡号 |
||||
* @param price 充值金额 |
||||
* @param orgId 部门id |
||||
*/ |
||||
void recharge(String cardNo, BigDecimal price, Long orgId); |
||||
|
||||
/** |
||||
* 生成油卡 |
||||
* @param orgId 部门id |
||||
* @param generateNum 生成数量 |
||||
*/ |
||||
void generateCard(Long orgId, Integer generateNum); |
||||
|
||||
/** |
||||
* 绑定联系人 |
||||
* @param cardNo 卡号 |
||||
* @param contactName 联系人名称 |
||||
* @param contactPhone 联系人手机号 |
||||
*/ |
||||
void setContact(String cardNo,String contactName, String contactPhone); |
||||
|
||||
/** |
||||
* 禁用 |
||||
* @param cardNo 卡号 |
||||
*/ |
||||
void disabled(String cardNo); |
||||
|
||||
/** |
||||
* 启用 |
||||
* @param cardNo 卡号 |
||||
*/ |
||||
void enable(String cardNo); |
||||
|
||||
/** |
||||
* 根据手机号查询油卡 |
||||
* @param phone 手机号 |
||||
* @return |
||||
*/ |
||||
HighOilCard getOilCardByPhone(String phone); |
||||
|
||||
/** |
||||
* 根据卡号查询油卡 |
||||
* @param cardNo 卡号 |
||||
* @return |
||||
*/ |
||||
HighOilCard getOilCardByCardNo(String cardNo); |
||||
|
||||
/** |
||||
* 查询油卡列表 |
||||
* @param param 参数 |
||||
* @return |
||||
*/ |
||||
List<HighOilCard> getOilCardList(Map<String,Object> param); |
||||
|
||||
} |
@ -0,0 +1,42 @@ |
||||
package com.hai.service.impl; |
||||
|
||||
import com.hai.dao.HighCompanyTwoPwdMapper; |
||||
import com.hai.entity.HighCompanyTwoPwd; |
||||
import com.hai.entity.HighCompanyTwoPwdExample; |
||||
import com.hai.service.HighCompanyTwoPwdService; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
|
||||
@Service("companyTwoPwdService") |
||||
public class HighCompanyTwoPwdServiceImpl implements HighCompanyTwoPwdService { |
||||
|
||||
@Resource |
||||
private HighCompanyTwoPwdMapper companyTwoPwdMapper; |
||||
|
||||
@Override |
||||
public void editData(HighCompanyTwoPwd companyTwoPwd) { |
||||
if (companyTwoPwd.getId() == null) { |
||||
companyTwoPwd.setCreateTime(new Date()); |
||||
companyTwoPwd.setUpdateTime(new Date()); |
||||
companyTwoPwd.setStatus(1); |
||||
companyTwoPwdMapper.insert(companyTwoPwd); |
||||
} else { |
||||
companyTwoPwd.setUpdateTime(new Date()); |
||||
companyTwoPwdMapper.updateByPrimaryKey(companyTwoPwd); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public HighCompanyTwoPwd getTwoPwdByOrg(Long orgId) { |
||||
HighCompanyTwoPwdExample example = new HighCompanyTwoPwdExample(); |
||||
example.createCriteria().andStatusEqualTo(1).andOrgIdEqualTo(orgId); |
||||
List<HighCompanyTwoPwd> list = companyTwoPwdMapper.selectByExample(example); |
||||
if (list.size() > 0) { |
||||
return list.get(0); |
||||
} |
||||
return null; |
||||
} |
||||
} |
@ -0,0 +1,52 @@ |
||||
package com.hai.service.impl; |
||||
|
||||
import com.hai.common.security.UserCenter; |
||||
import com.hai.dao.HighOilCardContactRecordMapper; |
||||
import com.hai.entity.HighOilCardContactRecord; |
||||
import com.hai.entity.HighOilCardContactRecordExample; |
||||
import com.hai.model.UserInfoModel; |
||||
import com.hai.service.HighOilCardContactRecordService; |
||||
import org.apache.commons.collections4.MapUtils; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
@Service("oilCardContactRecordService") |
||||
public class HighOilCardContactRecordServiceImpl implements HighOilCardContactRecordService { |
||||
|
||||
@Resource |
||||
private HighOilCardContactRecordMapper oilCardContactRecordMapper; |
||||
|
||||
@Resource |
||||
private UserCenter userCenter; |
||||
|
||||
@Override |
||||
public void insert(Long oilCardId, String content) { |
||||
UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class); |
||||
|
||||
HighOilCardContactRecord record = new HighOilCardContactRecord(); |
||||
record.setOilCardId(oilCardId); |
||||
record.setContent(content); |
||||
record.setCreateTime(new Date()); |
||||
record.setStatus(1); |
||||
record.setOpUserId(userInfoModel.getSecUser().getId()); |
||||
record.setOpUserName(userInfoModel.getSecUser().getUserName()); |
||||
oilCardContactRecordMapper.insert(record); |
||||
} |
||||
|
||||
@Override |
||||
public List<HighOilCardContactRecord> getRecordList(Map<String, Object> param) { |
||||
HighOilCardContactRecordExample example = new HighOilCardContactRecordExample(); |
||||
HighOilCardContactRecordExample.Criteria criteria = example.createCriteria().andStatusEqualTo(1); |
||||
|
||||
if (MapUtils.getLong(param, "oilCardId") != null) { |
||||
criteria.andOilCardIdEqualTo(MapUtils.getLong(param, "oilCardId")); |
||||
} |
||||
|
||||
example.setOrderByClause("create_time desc"); |
||||
return oilCardContactRecordMapper.selectByExample(example); |
||||
} |
||||
} |
@ -0,0 +1,57 @@ |
||||
package com.hai.service.impl; |
||||
|
||||
import com.hai.common.security.UserCenter; |
||||
import com.hai.dao.HighOilCardRecordMapper; |
||||
import com.hai.entity.HighOilCardRecord; |
||||
import com.hai.entity.HighOilCardRecordExample; |
||||
import com.hai.model.UserInfoModel; |
||||
import com.hai.service.HighOilCardRecordService; |
||||
import org.apache.commons.collections4.MapUtils; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
@Service("oilCardRecordService") |
||||
public class HighOilCardRecordServiceImpl implements HighOilCardRecordService { |
||||
|
||||
@Resource |
||||
private HighOilCardRecordMapper oilCardRecordMapper; |
||||
|
||||
@Resource |
||||
private UserCenter userCenter; |
||||
|
||||
@Override |
||||
public void insertRecord(HighOilCardRecord oilCardRecord) { |
||||
UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class); |
||||
|
||||
oilCardRecord.setCreateTime(new Date()); |
||||
oilCardRecord.setStatus(1); |
||||
oilCardRecord.setOpUserId(userInfoModel.getSecUser().getId()); |
||||
oilCardRecord.setOpUserName(userInfoModel.getSecUser().getUserName()); |
||||
oilCardRecordMapper.insert(oilCardRecord); |
||||
} |
||||
|
||||
@Override |
||||
public List<HighOilCardRecord> getRecordList(Map<String, Object> map) { |
||||
HighOilCardRecordExample example = new HighOilCardRecordExample(); |
||||
HighOilCardRecordExample.Criteria criteria = example.createCriteria().andStatusEqualTo(1); |
||||
|
||||
if (MapUtils.getLong(map, "oilCardId") == null) { |
||||
criteria.andOilCardIdEqualTo(MapUtils.getLong(map, "oilCardId")); |
||||
} |
||||
|
||||
if (MapUtils.getInteger(map, "type") == null) { |
||||
criteria.andTypeEqualTo(MapUtils.getInteger(map, "type")); |
||||
} |
||||
|
||||
if (MapUtils.getInteger(map, "sourceType") == null) { |
||||
criteria.andSourceTypeEqualTo(MapUtils.getInteger(map, "sourceType")); |
||||
} |
||||
|
||||
example.setOrderByClause("create_time desc"); |
||||
return oilCardRecordMapper.selectByExample(example); |
||||
} |
||||
} |
@ -0,0 +1,274 @@ |
||||
package com.hai.service.impl; |
||||
|
||||
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.UserCenter; |
||||
import com.hai.common.utils.BankNumberUtil; |
||||
import com.hai.dao.HighOilCardMapper; |
||||
import com.hai.entity.*; |
||||
import com.hai.enum_type.OilCardBindStatusEnum; |
||||
import com.hai.enum_type.OilCardRecordTypeEnum; |
||||
import com.hai.enum_type.OilCardStatusEnum; |
||||
import com.hai.model.UserInfoModel; |
||||
import com.hai.service.*; |
||||
import org.apache.commons.collections4.MapUtils; |
||||
import org.apache.commons.lang3.StringUtils; |
||||
import org.springframework.stereotype.Service; |
||||
import org.springframework.transaction.annotation.Isolation; |
||||
import org.springframework.transaction.annotation.Propagation; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.math.BigDecimal; |
||||
import java.util.*; |
||||
|
||||
@Service("oilCardService") |
||||
public class HighOilCardServiceImpl implements HighOilCardService { |
||||
|
||||
@Resource |
||||
private HighOilCardMapper oilCardMapper; |
||||
|
||||
@Resource |
||||
private HighOilCardContactRecordService oilCardContactRecordService; |
||||
|
||||
@Resource |
||||
private HighOilCardRecordService oilCardRecordService; |
||||
|
||||
@Resource |
||||
private BsOrganizationService organizationService; |
||||
|
||||
@Resource |
||||
private BsCompanyService companyService; |
||||
|
||||
@Resource |
||||
private HighCompanyAccountService companyAccountService; |
||||
|
||||
@Resource |
||||
private UserCenter userCenter; |
||||
|
||||
@Override |
||||
public void editData(HighOilCard oilCard) { |
||||
if (oilCard.getId() == null) { |
||||
oilCard.setCreateTime(new Date()); |
||||
oilCard.setUpdateTime(new Date()); |
||||
oilCard.setStatus(OilCardStatusEnum.status1.getStatus()); |
||||
oilCard.setBindStatus(OilCardBindStatusEnum.status0.getStatus()); |
||||
oilCardMapper.insert(oilCard); |
||||
} else { |
||||
oilCard.setUpdateTime(new Date()); |
||||
oilCardMapper.updateByPrimaryKey(oilCard); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
@Transactional(rollbackFor=Exception.class,isolation = Isolation.SERIALIZABLE,propagation= Propagation.REQUIRES_NEW) |
||||
public synchronized void recharge(String cardNo, BigDecimal price, Long orgId) { |
||||
HighOilCard oilCard = getOilCardByCardNo(cardNo); |
||||
if (oilCard == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到部门"); |
||||
} |
||||
if (!oilCard.getStatus().equals(OilCardStatusEnum.status1.getStatus())) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "油卡不处于正常状态"); |
||||
} |
||||
// 账户扣款
|
||||
Map<String, Object> consumeType = new HashMap<>(); |
||||
consumeType.put("sourceType", "2"); |
||||
consumeType.put("sourceId", oilCard.getId()); |
||||
consumeType.put("sourceContent", "油卡:"+oilCard.getCardNo()+",充值:"+price.toString()); |
||||
companyAccountService.consume(orgId, price, consumeType); |
||||
|
||||
// 变更前金额
|
||||
BigDecimal beforeAmount = oilCard.getAmount(); |
||||
// 计算金额
|
||||
oilCard.setAmount(oilCard.getAmount().add(price)); |
||||
editData(oilCard); |
||||
// 变更后金额
|
||||
BigDecimal afterAmount = oilCard.getAmount(); |
||||
|
||||
HighOilCardRecord record = new HighOilCardRecord(); |
||||
record.setOilCardId(oilCard.getId()); |
||||
record.setType(OilCardRecordTypeEnum.type1.getType()); |
||||
record.setAmount(price); |
||||
record.setBeforeAmount(beforeAmount); |
||||
record.setAfterAmount(afterAmount); |
||||
record.setSourceContent("充值油卡金额:" + record.getAmount()); |
||||
oilCardRecordService.insertRecord(record); |
||||
} |
||||
|
||||
@Override |
||||
@Transactional(propagation= Propagation.REQUIRES_NEW, rollbackFor = Exception.class) |
||||
public void generateCard(Long orgId, Integer generateNum) { |
||||
UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class); |
||||
// 查询部门信息
|
||||
BsOrganization organization = organizationService.findById(orgId); |
||||
if (organization == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到部门"); |
||||
} |
||||
BsCompany company = companyService.getCompanyById(organization.getCompanyId()); |
||||
|
||||
List<HighOilCard> oilCardList = new ArrayList<>(); |
||||
|
||||
HighOilCard oilCard; |
||||
for (int i = 0; i < generateNum; i++) { |
||||
oilCard = new HighOilCard(); |
||||
oilCard.setCompanyId(organization.getCompanyId()); |
||||
oilCard.setCompanyName(company.getName()); |
||||
oilCard.setOrgId(organization.getId()); |
||||
oilCard.setOrgName(organization.getName()); |
||||
oilCard.setAmount(new BigDecimal("0")); |
||||
oilCard.setCardNo(BankNumberUtil.getBrankNumber("8")); |
||||
oilCard.setOpUserId(userInfoModel.getSecUser().getId()); |
||||
oilCard.setOpUserName(userInfoModel.getSecUser().getUserName()); |
||||
oilCard.setCreateTime(new Date()); |
||||
oilCard.setUpdateTime(new Date()); |
||||
oilCard.setStatus(OilCardStatusEnum.status1.getStatus()); |
||||
oilCard.setBindStatus(OilCardBindStatusEnum.status0.getStatus()); |
||||
oilCardList.add(oilCard); |
||||
} |
||||
oilCardMapper.insertList(oilCardList); |
||||
} |
||||
|
||||
@Override |
||||
@Transactional(propagation= Propagation.REQUIRES_NEW, rollbackFor = Exception.class) |
||||
public void setContact(String cardNo, String contactName, String contactPhone) { |
||||
// 查询油卡
|
||||
HighOilCard oilCard = getOilCardByCardNo(cardNo); |
||||
if (oilCard == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到油卡"); |
||||
} |
||||
// 查询手机号是否绑定油卡
|
||||
HighOilCard phone = getOilCardByPhone(contactPhone); |
||||
if (phone != null && !phone.getId().equals(oilCard.getId())) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "联系电话已绑定其他油卡"); |
||||
} |
||||
oilCard.setContactName(contactName); |
||||
oilCard.setContactPhone(contactPhone); |
||||
editData(oilCard); |
||||
|
||||
// 绑定状态 0:未绑定 1:已绑定
|
||||
if (oilCard.getBindStatus() == 1) { |
||||
oilCardContactRecordService.insert(oilCard.getId(), "新设置:联系人【"+oilCard.getContactName()+"】,联系电话【"+oilCard.getContactPhone()+"】"); |
||||
} else { |
||||
oilCardContactRecordService.insert(oilCard.getId(), "联系信息变更:原来联系人【"+oilCard.getContactName()+"】,联系电话【"+oilCard.getContactPhone()+"】。" + |
||||
"变跟后联系人【"+oilCard.getContactName()+ "】,联系电话【"+oilCard.getContactPhone()+"】"); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void disabled(String cardNo) { |
||||
// 查询油卡
|
||||
HighOilCard oilCard = getOilCardByCardNo(cardNo); |
||||
if (oilCard == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到油卡"); |
||||
} |
||||
if (!oilCard.getStatus().equals(OilCardStatusEnum.status1.getStatus())) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "油卡状态错误"); |
||||
} |
||||
oilCard.setStatus(OilCardStatusEnum.status2.getStatus()); |
||||
editData(oilCard); |
||||
|
||||
oilCardContactRecordService.insert(oilCard.getId(), "禁用油卡"); |
||||
} |
||||
|
||||
@Override |
||||
public void enable(String cardNo) { |
||||
// 查询油卡
|
||||
HighOilCard oilCard = getOilCardByCardNo(cardNo); |
||||
if (oilCard == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到油卡"); |
||||
} |
||||
if (!oilCard.getStatus().equals(OilCardStatusEnum.status2.getStatus())) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "油卡状态错误"); |
||||
} |
||||
oilCard.setStatus(OilCardStatusEnum.status1.getStatus()); |
||||
editData(oilCard); |
||||
|
||||
oilCardContactRecordService.insert(oilCard.getId(), "启用油卡"); |
||||
} |
||||
|
||||
@Override |
||||
public HighOilCard getOilCardByPhone(String phone) { |
||||
HighOilCardExample example = new HighOilCardExample(); |
||||
example.createCriteria().andStatusNotEqualTo(0).andContactPhoneEqualTo(phone); |
||||
List<HighOilCard> list = oilCardMapper.selectByExample(example); |
||||
if (list.size() > 0) { |
||||
return list.get(0); |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public HighOilCard getOilCardByCardNo(String cardNo) { |
||||
HighOilCardExample example = new HighOilCardExample(); |
||||
example.createCriteria().andStatusNotEqualTo(0).andCardNoEqualTo(cardNo); |
||||
List<HighOilCard> list = oilCardMapper.selectByExample(example); |
||||
if (list.size() > 0) { |
||||
return list.get(0); |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public List<HighOilCard> getOilCardList(Map<String, Object> param) { |
||||
HighOilCardExample example = new HighOilCardExample(); |
||||
HighOilCardExample.Criteria criteria = example.createCriteria().andStatusNotEqualTo(0); |
||||
|
||||
if (MapUtils.getLong(param, "companyId") != null) { |
||||
criteria.andCompanyIdEqualTo(MapUtils.getLong(param, "companyId")); |
||||
} |
||||
|
||||
if (MapUtils.getLong(param, "orgId") != null) { |
||||
criteria.andOrgIdEqualTo(MapUtils.getLong(param, "orgId")); |
||||
} |
||||
|
||||
if (StringUtils.isNotBlank(MapUtils.getString(param, "cardNo"))) { |
||||
criteria.andCardNoLike("%" + MapUtils.getString(param, "cardNo") + "%"); |
||||
} |
||||
|
||||
if (StringUtils.isNotBlank(MapUtils.getString(param, "contactName"))) { |
||||
criteria.andContactNameLike("%" + MapUtils.getString(param, "contactName") + "%"); |
||||
} |
||||
|
||||
if (StringUtils.isNotBlank(MapUtils.getString(param, "contactPhone"))) { |
||||
criteria.andContactPhoneLike("%" + MapUtils.getString(param, "contactPhone") + "%"); |
||||
} |
||||
|
||||
if (MapUtils.getLong(param, "createTimeS") != null) { |
||||
criteria.andCreateTimeGreaterThanOrEqualTo(new Date(MapUtils.getLong(param, "createTimeS"))); |
||||
} |
||||
|
||||
if (MapUtils.getLong(param, "createTimeE") != null) { |
||||
criteria.andCreateTimeLessThanOrEqualTo(new Date(MapUtils.getLong(param, "createTimeE"))); |
||||
} |
||||
|
||||
if (MapUtils.getLong(param, "bindTimeS") != null) { |
||||
criteria.andBindTimeGreaterThanOrEqualTo(new Date(MapUtils.getLong(param, "bindTimeS"))); |
||||
} |
||||
|
||||
if (MapUtils.getLong(param, "bindTimeE") != null) { |
||||
criteria.andBindTimeLessThanOrEqualTo(new Date(MapUtils.getLong(param, "bindTimeE"))); |
||||
} |
||||
|
||||
if (MapUtils.getBoolean(param, "isConfigContact") != null) { |
||||
if (MapUtils.getBoolean(param, "isConfigContact") == true) { |
||||
criteria.andContactPhoneIsNotNull(); |
||||
} |
||||
if (MapUtils.getBoolean(param, "isConfigContact") == false) { |
||||
criteria.andContactPhoneIsNull(); |
||||
} |
||||
} |
||||
|
||||
if (MapUtils.getInteger(param, "status") != null) { |
||||
criteria.andStatusEqualTo(MapUtils.getInteger(param, "status")); |
||||
} |
||||
|
||||
if (MapUtils.getInteger(param, "bindStatus") != null) { |
||||
criteria.andBindStatusEqualTo(MapUtils.getInteger(param, "bindStatus")); |
||||
} |
||||
|
||||
example.setOrderByClause("create_time desc"); |
||||
return oilCardMapper.selectByExample(example); |
||||
} |
||||
} |
Loading…
Reference in new issue