commit
f619d0e909
@ -0,0 +1,108 @@ |
||||
package com.cweb.controller; |
||||
|
||||
import com.hfkj.common.exception.ErrorCode; |
||||
import com.hfkj.common.exception.ErrorHelp; |
||||
import com.hfkj.common.exception.SysCode; |
||||
import com.hfkj.common.utils.ResponseMsgUtil; |
||||
import com.hfkj.entity.BsStore; |
||||
import com.hfkj.entity.BsStoreCid; |
||||
import com.hfkj.model.ResponseData; |
||||
import com.hfkj.service.BsStoreCidService; |
||||
import com.hfkj.service.BsStoreService; |
||||
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.Date; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @author sum1dream |
||||
*/ |
||||
@Controller |
||||
@RequestMapping(value = "/storeCid") |
||||
@Api(value = "门店CID") |
||||
public class BsStoreCidController { |
||||
|
||||
private static Logger log = LoggerFactory.getLogger(BsStoreCidController.class); |
||||
|
||||
@Resource |
||||
private BsStoreCidService bsStoreCidService; |
||||
|
||||
@Resource |
||||
private BsStoreService bsStoreService; |
||||
|
||||
@RequestMapping(value="/connectStoreCid",method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "连接门店和CID") |
||||
public ResponseData connectStoreCid(@RequestBody BsStoreCid storeCid) { |
||||
try { |
||||
|
||||
if (storeCid == null |
||||
|| StringUtils.isBlank(storeCid.getCid()) |
||||
|| storeCid.getStoreId() == null |
||||
) { |
||||
log.error("configStore error!","参数错误"); |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
|
||||
|
||||
BsStore store = bsStoreService.getStoreById(storeCid.getStoreId()); |
||||
|
||||
if (store == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前门店不存在!"); |
||||
} |
||||
|
||||
Map<String , Object> map = new HashMap<>(); |
||||
map.put("storeId" , storeCid.getStoreId()); |
||||
|
||||
BsStoreCid bsStoreCid = bsStoreCidService.findByMap(map); |
||||
|
||||
if (bsStoreCid == null) { |
||||
bsStoreCid = new BsStoreCid(); |
||||
bsStoreCid.setCid(storeCid.getCid()); |
||||
bsStoreCid.setStoreId(store.getId()); |
||||
bsStoreCid.setStoreNo(store.getStoreNo()); |
||||
bsStoreCid.setStoreName(store.getName()); |
||||
bsStoreCid.setCreateTime(new Date()); |
||||
bsStoreCid.setUpdateTime(new Date()); |
||||
bsStoreCidService.insertStoreCid(bsStoreCid); |
||||
} else { |
||||
bsStoreCid.setCid(storeCid.getCid()); |
||||
bsStoreCid.setUpdateTime(new Date()); |
||||
bsStoreCidService.editStoreCid(bsStoreCid); |
||||
} |
||||
|
||||
return ResponseMsgUtil.success("操作成功"); |
||||
|
||||
} catch (Exception e) { |
||||
log.error(e.getMessage(), e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value="/voiceSucceed",method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "语音播报成功") |
||||
public ResponseData voiceSucceed(@RequestParam(value = "storeId", required = true) Long storeId, |
||||
@RequestParam(value = "taskNo", required = true) String taskNo) { |
||||
try { |
||||
|
||||
bsStoreCidService.voiceSucceed(storeId , taskNo); |
||||
|
||||
return ResponseMsgUtil.success("操作成功"); |
||||
|
||||
} catch (Exception e) { |
||||
log.error(e.getMessage(), e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,128 @@ |
||||
package com.hfkj.dao; |
||||
|
||||
import com.hfkj.entity.BsStoreCid; |
||||
import com.hfkj.entity.BsStoreCidExample; |
||||
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 BsStoreCidMapper extends BsStoreCidMapperExt { |
||||
@SelectProvider(type=BsStoreCidSqlProvider.class, method="countByExample") |
||||
long countByExample(BsStoreCidExample example); |
||||
|
||||
@DeleteProvider(type=BsStoreCidSqlProvider.class, method="deleteByExample") |
||||
int deleteByExample(BsStoreCidExample example); |
||||
|
||||
@Delete({ |
||||
"delete from bs_store_cid", |
||||
"where id = #{id,jdbcType=BIGINT}" |
||||
}) |
||||
int deleteByPrimaryKey(Long id); |
||||
|
||||
@Insert({ |
||||
"insert into bs_store_cid (store_id, store_no, ", |
||||
"store_name, cid, ", |
||||
"create_time, update_time, ", |
||||
"ext_1, ext_2, ext_3, ", |
||||
"ext_4, ext_5, ext_6)", |
||||
"values (#{storeId,jdbcType=BIGINT}, #{storeNo,jdbcType=BIGINT}, ", |
||||
"#{storeName,jdbcType=VARCHAR}, #{cid,jdbcType=VARCHAR}, ", |
||||
"#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ", |
||||
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR}, ", |
||||
"#{ext4,jdbcType=VARCHAR}, #{ext5,jdbcType=VARCHAR}, #{ext6,jdbcType=VARCHAR})" |
||||
}) |
||||
@Options(useGeneratedKeys=true,keyProperty="id") |
||||
int insert(BsStoreCid record); |
||||
|
||||
@InsertProvider(type=BsStoreCidSqlProvider.class, method="insertSelective") |
||||
@Options(useGeneratedKeys=true,keyProperty="id") |
||||
int insertSelective(BsStoreCid record); |
||||
|
||||
@SelectProvider(type=BsStoreCidSqlProvider.class, method="selectByExample") |
||||
@Results({ |
||||
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), |
||||
@Result(column="store_id", property="storeId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="store_no", property="storeNo", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="store_name", property="storeName", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="cid", property="cid", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@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), |
||||
@Result(column="ext_4", property="ext4", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_5", property="ext5", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_6", property="ext6", jdbcType=JdbcType.VARCHAR) |
||||
}) |
||||
List<BsStoreCid> selectByExample(BsStoreCidExample example); |
||||
|
||||
@Select({ |
||||
"select", |
||||
"id, store_id, store_no, store_name, cid, create_time, update_time, ext_1, ext_2, ", |
||||
"ext_3, ext_4, ext_5, ext_6", |
||||
"from bs_store_cid", |
||||
"where id = #{id,jdbcType=BIGINT}" |
||||
}) |
||||
@Results({ |
||||
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), |
||||
@Result(column="store_id", property="storeId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="store_no", property="storeNo", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="store_name", property="storeName", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="cid", property="cid", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@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), |
||||
@Result(column="ext_4", property="ext4", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_5", property="ext5", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_6", property="ext6", jdbcType=JdbcType.VARCHAR) |
||||
}) |
||||
BsStoreCid selectByPrimaryKey(Long id); |
||||
|
||||
@UpdateProvider(type=BsStoreCidSqlProvider.class, method="updateByExampleSelective") |
||||
int updateByExampleSelective(@Param("record") BsStoreCid record, @Param("example") BsStoreCidExample example); |
||||
|
||||
@UpdateProvider(type=BsStoreCidSqlProvider.class, method="updateByExample") |
||||
int updateByExample(@Param("record") BsStoreCid record, @Param("example") BsStoreCidExample example); |
||||
|
||||
@UpdateProvider(type=BsStoreCidSqlProvider.class, method="updateByPrimaryKeySelective") |
||||
int updateByPrimaryKeySelective(BsStoreCid record); |
||||
|
||||
@Update({ |
||||
"update bs_store_cid", |
||||
"set store_id = #{storeId,jdbcType=BIGINT},", |
||||
"store_no = #{storeNo,jdbcType=BIGINT},", |
||||
"store_name = #{storeName,jdbcType=VARCHAR},", |
||||
"cid = #{cid,jdbcType=VARCHAR},", |
||||
"create_time = #{createTime,jdbcType=TIMESTAMP},", |
||||
"update_time = #{updateTime,jdbcType=TIMESTAMP},", |
||||
"ext_1 = #{ext1,jdbcType=VARCHAR},", |
||||
"ext_2 = #{ext2,jdbcType=VARCHAR},", |
||||
"ext_3 = #{ext3,jdbcType=VARCHAR},", |
||||
"ext_4 = #{ext4,jdbcType=VARCHAR},", |
||||
"ext_5 = #{ext5,jdbcType=VARCHAR},", |
||||
"ext_6 = #{ext6,jdbcType=VARCHAR}", |
||||
"where id = #{id,jdbcType=BIGINT}" |
||||
}) |
||||
int updateByPrimaryKey(BsStoreCid record); |
||||
} |
@ -0,0 +1,7 @@ |
||||
package com.hfkj.dao; |
||||
|
||||
/** |
||||
* mapper扩展类 |
||||
*/ |
||||
public interface BsStoreCidMapperExt { |
||||
} |
@ -0,0 +1,346 @@ |
||||
package com.hfkj.dao; |
||||
|
||||
import com.hfkj.entity.BsStoreCid; |
||||
import com.hfkj.entity.BsStoreCidExample.Criteria; |
||||
import com.hfkj.entity.BsStoreCidExample.Criterion; |
||||
import com.hfkj.entity.BsStoreCidExample; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
import org.apache.ibatis.jdbc.SQL; |
||||
|
||||
public class BsStoreCidSqlProvider { |
||||
|
||||
public String countByExample(BsStoreCidExample example) { |
||||
SQL sql = new SQL(); |
||||
sql.SELECT("count(*)").FROM("bs_store_cid"); |
||||
applyWhere(sql, example, false); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String deleteByExample(BsStoreCidExample example) { |
||||
SQL sql = new SQL(); |
||||
sql.DELETE_FROM("bs_store_cid"); |
||||
applyWhere(sql, example, false); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String insertSelective(BsStoreCid record) { |
||||
SQL sql = new SQL(); |
||||
sql.INSERT_INTO("bs_store_cid"); |
||||
|
||||
if (record.getStoreId() != null) { |
||||
sql.VALUES("store_id", "#{storeId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getStoreNo() != null) { |
||||
sql.VALUES("store_no", "#{storeNo,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getStoreName() != null) { |
||||
sql.VALUES("store_name", "#{storeName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getCid() != null) { |
||||
sql.VALUES("cid", "#{cid,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getCreateTime() != null) { |
||||
sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getUpdateTime() != null) { |
||||
sql.VALUES("update_time", "#{updateTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
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}"); |
||||
} |
||||
|
||||
if (record.getExt4() != null) { |
||||
sql.VALUES("ext_4", "#{ext4,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt5() != null) { |
||||
sql.VALUES("ext_5", "#{ext5,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt6() != null) { |
||||
sql.VALUES("ext_6", "#{ext6,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String selectByExample(BsStoreCidExample example) { |
||||
SQL sql = new SQL(); |
||||
if (example != null && example.isDistinct()) { |
||||
sql.SELECT_DISTINCT("id"); |
||||
} else { |
||||
sql.SELECT("id"); |
||||
} |
||||
sql.SELECT("store_id"); |
||||
sql.SELECT("store_no"); |
||||
sql.SELECT("store_name"); |
||||
sql.SELECT("cid"); |
||||
sql.SELECT("create_time"); |
||||
sql.SELECT("update_time"); |
||||
sql.SELECT("ext_1"); |
||||
sql.SELECT("ext_2"); |
||||
sql.SELECT("ext_3"); |
||||
sql.SELECT("ext_4"); |
||||
sql.SELECT("ext_5"); |
||||
sql.SELECT("ext_6"); |
||||
sql.FROM("bs_store_cid"); |
||||
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) { |
||||
BsStoreCid record = (BsStoreCid) parameter.get("record"); |
||||
BsStoreCidExample example = (BsStoreCidExample) parameter.get("example"); |
||||
|
||||
SQL sql = new SQL(); |
||||
sql.UPDATE("bs_store_cid"); |
||||
|
||||
if (record.getId() != null) { |
||||
sql.SET("id = #{record.id,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getStoreId() != null) { |
||||
sql.SET("store_id = #{record.storeId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getStoreNo() != null) { |
||||
sql.SET("store_no = #{record.storeNo,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getStoreName() != null) { |
||||
sql.SET("store_name = #{record.storeName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getCid() != null) { |
||||
sql.SET("cid = #{record.cid,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getCreateTime() != null) { |
||||
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getUpdateTime() != null) { |
||||
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
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}"); |
||||
} |
||||
|
||||
if (record.getExt4() != null) { |
||||
sql.SET("ext_4 = #{record.ext4,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt5() != null) { |
||||
sql.SET("ext_5 = #{record.ext5,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt6() != null) { |
||||
sql.SET("ext_6 = #{record.ext6,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
applyWhere(sql, example, true); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String updateByExample(Map<String, Object> parameter) { |
||||
SQL sql = new SQL(); |
||||
sql.UPDATE("bs_store_cid"); |
||||
|
||||
sql.SET("id = #{record.id,jdbcType=BIGINT}"); |
||||
sql.SET("store_id = #{record.storeId,jdbcType=BIGINT}"); |
||||
sql.SET("store_no = #{record.storeNo,jdbcType=BIGINT}"); |
||||
sql.SET("store_name = #{record.storeName,jdbcType=VARCHAR}"); |
||||
sql.SET("cid = #{record.cid,jdbcType=VARCHAR}"); |
||||
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); |
||||
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}"); |
||||
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); |
||||
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); |
||||
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); |
||||
sql.SET("ext_4 = #{record.ext4,jdbcType=VARCHAR}"); |
||||
sql.SET("ext_5 = #{record.ext5,jdbcType=VARCHAR}"); |
||||
sql.SET("ext_6 = #{record.ext6,jdbcType=VARCHAR}"); |
||||
|
||||
BsStoreCidExample example = (BsStoreCidExample) parameter.get("example"); |
||||
applyWhere(sql, example, true); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String updateByPrimaryKeySelective(BsStoreCid record) { |
||||
SQL sql = new SQL(); |
||||
sql.UPDATE("bs_store_cid"); |
||||
|
||||
if (record.getStoreId() != null) { |
||||
sql.SET("store_id = #{storeId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getStoreNo() != null) { |
||||
sql.SET("store_no = #{storeNo,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getStoreName() != null) { |
||||
sql.SET("store_name = #{storeName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getCid() != null) { |
||||
sql.SET("cid = #{cid,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getCreateTime() != null) { |
||||
sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getUpdateTime() != null) { |
||||
sql.SET("update_time = #{updateTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
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}"); |
||||
} |
||||
|
||||
if (record.getExt4() != null) { |
||||
sql.SET("ext_4 = #{ext4,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt5() != null) { |
||||
sql.SET("ext_5 = #{ext5,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt6() != null) { |
||||
sql.SET("ext_6 = #{ext6,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
sql.WHERE("id = #{id,jdbcType=BIGINT}"); |
||||
|
||||
return sql.toString(); |
||||
} |
||||
|
||||
protected void applyWhere(SQL sql, BsStoreCidExample 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()); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,125 @@ |
||||
package com.hfkj.dao; |
||||
|
||||
import com.hfkj.entity.BsStorePushRecord; |
||||
import com.hfkj.entity.BsStorePushRecordExample; |
||||
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 BsStorePushRecordMapper extends BsStorePushRecordMapperExt { |
||||
@SelectProvider(type=BsStorePushRecordSqlProvider.class, method="countByExample") |
||||
long countByExample(BsStorePushRecordExample example); |
||||
|
||||
@DeleteProvider(type=BsStorePushRecordSqlProvider.class, method="deleteByExample") |
||||
int deleteByExample(BsStorePushRecordExample example); |
||||
|
||||
@Delete({ |
||||
"delete from bs_store_push_record", |
||||
"where id = #{id,jdbcType=BIGINT}" |
||||
}) |
||||
int deleteByPrimaryKey(Long id); |
||||
|
||||
@Insert({ |
||||
"insert into bs_store_push_record (store_id, voice_url, ", |
||||
"create_time, update_time, ", |
||||
"`status`, ext_1, ext_2, ", |
||||
"ext_3, ext_4, ext_5, ", |
||||
"ext_6)", |
||||
"values (#{storeId,jdbcType=BIGINT}, #{voiceUrl,jdbcType=VARCHAR}, ", |
||||
"#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ", |
||||
"#{status,jdbcType=INTEGER}, #{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, ", |
||||
"#{ext3,jdbcType=VARCHAR}, #{ext4,jdbcType=VARCHAR}, #{ext5,jdbcType=VARCHAR}, ", |
||||
"#{ext6,jdbcType=VARCHAR})" |
||||
}) |
||||
@Options(useGeneratedKeys=true,keyProperty="id") |
||||
int insert(BsStorePushRecord record); |
||||
|
||||
@InsertProvider(type=BsStorePushRecordSqlProvider.class, method="insertSelective") |
||||
@Options(useGeneratedKeys=true,keyProperty="id") |
||||
int insertSelective(BsStorePushRecord record); |
||||
|
||||
@SelectProvider(type=BsStorePushRecordSqlProvider.class, method="selectByExample") |
||||
@Results({ |
||||
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), |
||||
@Result(column="store_id", property="storeId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="voice_url", property="voiceUrl", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER), |
||||
@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), |
||||
@Result(column="ext_4", property="ext4", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_5", property="ext5", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_6", property="ext6", jdbcType=JdbcType.VARCHAR) |
||||
}) |
||||
List<BsStorePushRecord> selectByExample(BsStorePushRecordExample example); |
||||
|
||||
@Select({ |
||||
"select", |
||||
"id, store_id, voice_url, create_time, update_time, `status`, ext_1, ext_2, ext_3, ", |
||||
"ext_4, ext_5, ext_6", |
||||
"from bs_store_push_record", |
||||
"where id = #{id,jdbcType=BIGINT}" |
||||
}) |
||||
@Results({ |
||||
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), |
||||
@Result(column="store_id", property="storeId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="voice_url", property="voiceUrl", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER), |
||||
@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), |
||||
@Result(column="ext_4", property="ext4", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_5", property="ext5", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_6", property="ext6", jdbcType=JdbcType.VARCHAR) |
||||
}) |
||||
BsStorePushRecord selectByPrimaryKey(Long id); |
||||
|
||||
@UpdateProvider(type=BsStorePushRecordSqlProvider.class, method="updateByExampleSelective") |
||||
int updateByExampleSelective(@Param("record") BsStorePushRecord record, @Param("example") BsStorePushRecordExample example); |
||||
|
||||
@UpdateProvider(type=BsStorePushRecordSqlProvider.class, method="updateByExample") |
||||
int updateByExample(@Param("record") BsStorePushRecord record, @Param("example") BsStorePushRecordExample example); |
||||
|
||||
@UpdateProvider(type=BsStorePushRecordSqlProvider.class, method="updateByPrimaryKeySelective") |
||||
int updateByPrimaryKeySelective(BsStorePushRecord record); |
||||
|
||||
@Update({ |
||||
"update bs_store_push_record", |
||||
"set store_id = #{storeId,jdbcType=BIGINT},", |
||||
"voice_url = #{voiceUrl,jdbcType=VARCHAR},", |
||||
"create_time = #{createTime,jdbcType=TIMESTAMP},", |
||||
"update_time = #{updateTime,jdbcType=TIMESTAMP},", |
||||
"`status` = #{status,jdbcType=INTEGER},", |
||||
"ext_1 = #{ext1,jdbcType=VARCHAR},", |
||||
"ext_2 = #{ext2,jdbcType=VARCHAR},", |
||||
"ext_3 = #{ext3,jdbcType=VARCHAR},", |
||||
"ext_4 = #{ext4,jdbcType=VARCHAR},", |
||||
"ext_5 = #{ext5,jdbcType=VARCHAR},", |
||||
"ext_6 = #{ext6,jdbcType=VARCHAR}", |
||||
"where id = #{id,jdbcType=BIGINT}" |
||||
}) |
||||
int updateByPrimaryKey(BsStorePushRecord record); |
||||
} |
@ -0,0 +1,7 @@ |
||||
package com.hfkj.dao; |
||||
|
||||
/** |
||||
* mapper扩展类 |
||||
*/ |
||||
public interface BsStorePushRecordMapperExt { |
||||
} |
@ -0,0 +1,332 @@ |
||||
package com.hfkj.dao; |
||||
|
||||
import com.hfkj.entity.BsStorePushRecord; |
||||
import com.hfkj.entity.BsStorePushRecordExample.Criteria; |
||||
import com.hfkj.entity.BsStorePushRecordExample.Criterion; |
||||
import com.hfkj.entity.BsStorePushRecordExample; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
import org.apache.ibatis.jdbc.SQL; |
||||
|
||||
public class BsStorePushRecordSqlProvider { |
||||
|
||||
public String countByExample(BsStorePushRecordExample example) { |
||||
SQL sql = new SQL(); |
||||
sql.SELECT("count(*)").FROM("bs_store_push_record"); |
||||
applyWhere(sql, example, false); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String deleteByExample(BsStorePushRecordExample example) { |
||||
SQL sql = new SQL(); |
||||
sql.DELETE_FROM("bs_store_push_record"); |
||||
applyWhere(sql, example, false); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String insertSelective(BsStorePushRecord record) { |
||||
SQL sql = new SQL(); |
||||
sql.INSERT_INTO("bs_store_push_record"); |
||||
|
||||
if (record.getStoreId() != null) { |
||||
sql.VALUES("store_id", "#{storeId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getVoiceUrl() != null) { |
||||
sql.VALUES("voice_url", "#{voiceUrl,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getCreateTime() != null) { |
||||
sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getUpdateTime() != null) { |
||||
sql.VALUES("update_time", "#{updateTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getStatus() != null) { |
||||
sql.VALUES("`status`", "#{status,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
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}"); |
||||
} |
||||
|
||||
if (record.getExt4() != null) { |
||||
sql.VALUES("ext_4", "#{ext4,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt5() != null) { |
||||
sql.VALUES("ext_5", "#{ext5,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt6() != null) { |
||||
sql.VALUES("ext_6", "#{ext6,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String selectByExample(BsStorePushRecordExample example) { |
||||
SQL sql = new SQL(); |
||||
if (example != null && example.isDistinct()) { |
||||
sql.SELECT_DISTINCT("id"); |
||||
} else { |
||||
sql.SELECT("id"); |
||||
} |
||||
sql.SELECT("store_id"); |
||||
sql.SELECT("voice_url"); |
||||
sql.SELECT("create_time"); |
||||
sql.SELECT("update_time"); |
||||
sql.SELECT("`status`"); |
||||
sql.SELECT("ext_1"); |
||||
sql.SELECT("ext_2"); |
||||
sql.SELECT("ext_3"); |
||||
sql.SELECT("ext_4"); |
||||
sql.SELECT("ext_5"); |
||||
sql.SELECT("ext_6"); |
||||
sql.FROM("bs_store_push_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) { |
||||
BsStorePushRecord record = (BsStorePushRecord) parameter.get("record"); |
||||
BsStorePushRecordExample example = (BsStorePushRecordExample) parameter.get("example"); |
||||
|
||||
SQL sql = new SQL(); |
||||
sql.UPDATE("bs_store_push_record"); |
||||
|
||||
if (record.getId() != null) { |
||||
sql.SET("id = #{record.id,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getStoreId() != null) { |
||||
sql.SET("store_id = #{record.storeId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getVoiceUrl() != null) { |
||||
sql.SET("voice_url = #{record.voiceUrl,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getCreateTime() != null) { |
||||
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getUpdateTime() != null) { |
||||
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getStatus() != null) { |
||||
sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
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}"); |
||||
} |
||||
|
||||
if (record.getExt4() != null) { |
||||
sql.SET("ext_4 = #{record.ext4,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt5() != null) { |
||||
sql.SET("ext_5 = #{record.ext5,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt6() != null) { |
||||
sql.SET("ext_6 = #{record.ext6,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
applyWhere(sql, example, true); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String updateByExample(Map<String, Object> parameter) { |
||||
SQL sql = new SQL(); |
||||
sql.UPDATE("bs_store_push_record"); |
||||
|
||||
sql.SET("id = #{record.id,jdbcType=BIGINT}"); |
||||
sql.SET("store_id = #{record.storeId,jdbcType=BIGINT}"); |
||||
sql.SET("voice_url = #{record.voiceUrl,jdbcType=VARCHAR}"); |
||||
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); |
||||
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}"); |
||||
sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); |
||||
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); |
||||
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); |
||||
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); |
||||
sql.SET("ext_4 = #{record.ext4,jdbcType=VARCHAR}"); |
||||
sql.SET("ext_5 = #{record.ext5,jdbcType=VARCHAR}"); |
||||
sql.SET("ext_6 = #{record.ext6,jdbcType=VARCHAR}"); |
||||
|
||||
BsStorePushRecordExample example = (BsStorePushRecordExample) parameter.get("example"); |
||||
applyWhere(sql, example, true); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String updateByPrimaryKeySelective(BsStorePushRecord record) { |
||||
SQL sql = new SQL(); |
||||
sql.UPDATE("bs_store_push_record"); |
||||
|
||||
if (record.getStoreId() != null) { |
||||
sql.SET("store_id = #{storeId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getVoiceUrl() != null) { |
||||
sql.SET("voice_url = #{voiceUrl,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getCreateTime() != null) { |
||||
sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getUpdateTime() != null) { |
||||
sql.SET("update_time = #{updateTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getStatus() != null) { |
||||
sql.SET("`status` = #{status,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
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}"); |
||||
} |
||||
|
||||
if (record.getExt4() != null) { |
||||
sql.SET("ext_4 = #{ext4,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt5() != null) { |
||||
sql.SET("ext_5 = #{ext5,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt6() != null) { |
||||
sql.SET("ext_6 = #{ext6,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
sql.WHERE("id = #{id,jdbcType=BIGINT}"); |
||||
|
||||
return sql.toString(); |
||||
} |
||||
|
||||
protected void applyWhere(SQL sql, BsStorePushRecordExample 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()); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,257 @@ |
||||
package com.hfkj.entity; |
||||
|
||||
import java.io.Serializable; |
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* bs_store_cid |
||||
* @author |
||||
*/ |
||||
/** |
||||
* |
||||
* 代码由工具生成 |
||||
* |
||||
**/ |
||||
public class BsStoreCid implements Serializable { |
||||
/** |
||||
* ID |
||||
*/ |
||||
private Long id; |
||||
|
||||
/** |
||||
* 门店id |
||||
*/ |
||||
private Long storeId; |
||||
|
||||
/** |
||||
* 门店编码 |
||||
*/ |
||||
private Long storeNo; |
||||
|
||||
/** |
||||
* 门店名称 |
||||
*/ |
||||
private String storeName; |
||||
|
||||
/** |
||||
* 设备唯一编码 |
||||
*/ |
||||
private String cid; |
||||
|
||||
/** |
||||
* 创建时间 |
||||
*/ |
||||
private Date createTime; |
||||
|
||||
/** |
||||
* 更新时间 |
||||
*/ |
||||
private Date updateTime; |
||||
|
||||
/** |
||||
* ext_1 |
||||
*/ |
||||
private String ext1; |
||||
|
||||
/** |
||||
* ext_2 |
||||
*/ |
||||
private String ext2; |
||||
|
||||
/** |
||||
* ext_3 |
||||
*/ |
||||
private String ext3; |
||||
|
||||
/** |
||||
* ext_4 |
||||
*/ |
||||
private String ext4; |
||||
|
||||
/** |
||||
* ext_5 |
||||
*/ |
||||
private String ext5; |
||||
|
||||
/** |
||||
* ext_6 |
||||
*/ |
||||
private String ext6; |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
public Long getId() { |
||||
return id; |
||||
} |
||||
|
||||
public void setId(Long id) { |
||||
this.id = id; |
||||
} |
||||
|
||||
public Long getStoreId() { |
||||
return storeId; |
||||
} |
||||
|
||||
public void setStoreId(Long storeId) { |
||||
this.storeId = storeId; |
||||
} |
||||
|
||||
public Long getStoreNo() { |
||||
return storeNo; |
||||
} |
||||
|
||||
public void setStoreNo(Long storeNo) { |
||||
this.storeNo = storeNo; |
||||
} |
||||
|
||||
public String getStoreName() { |
||||
return storeName; |
||||
} |
||||
|
||||
public void setStoreName(String storeName) { |
||||
this.storeName = storeName; |
||||
} |
||||
|
||||
public String getCid() { |
||||
return cid; |
||||
} |
||||
|
||||
public void setCid(String cid) { |
||||
this.cid = cid; |
||||
} |
||||
|
||||
public Date getCreateTime() { |
||||
return createTime; |
||||
} |
||||
|
||||
public void setCreateTime(Date createTime) { |
||||
this.createTime = createTime; |
||||
} |
||||
|
||||
public Date getUpdateTime() { |
||||
return updateTime; |
||||
} |
||||
|
||||
public void setUpdateTime(Date updateTime) { |
||||
this.updateTime = updateTime; |
||||
} |
||||
|
||||
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; |
||||
} |
||||
|
||||
public String getExt4() { |
||||
return ext4; |
||||
} |
||||
|
||||
public void setExt4(String ext4) { |
||||
this.ext4 = ext4; |
||||
} |
||||
|
||||
public String getExt5() { |
||||
return ext5; |
||||
} |
||||
|
||||
public void setExt5(String ext5) { |
||||
this.ext5 = ext5; |
||||
} |
||||
|
||||
public String getExt6() { |
||||
return ext6; |
||||
} |
||||
|
||||
public void setExt6(String ext6) { |
||||
this.ext6 = ext6; |
||||
} |
||||
|
||||
@Override |
||||
public boolean equals(Object that) { |
||||
if (this == that) { |
||||
return true; |
||||
} |
||||
if (that == null) { |
||||
return false; |
||||
} |
||||
if (getClass() != that.getClass()) { |
||||
return false; |
||||
} |
||||
BsStoreCid other = (BsStoreCid) that; |
||||
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) |
||||
&& (this.getStoreId() == null ? other.getStoreId() == null : this.getStoreId().equals(other.getStoreId())) |
||||
&& (this.getStoreNo() == null ? other.getStoreNo() == null : this.getStoreNo().equals(other.getStoreNo())) |
||||
&& (this.getStoreName() == null ? other.getStoreName() == null : this.getStoreName().equals(other.getStoreName())) |
||||
&& (this.getCid() == null ? other.getCid() == null : this.getCid().equals(other.getCid())) |
||||
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) |
||||
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())) |
||||
&& (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())) |
||||
&& (this.getExt4() == null ? other.getExt4() == null : this.getExt4().equals(other.getExt4())) |
||||
&& (this.getExt5() == null ? other.getExt5() == null : this.getExt5().equals(other.getExt5())) |
||||
&& (this.getExt6() == null ? other.getExt6() == null : this.getExt6().equals(other.getExt6())); |
||||
} |
||||
|
||||
@Override |
||||
public int hashCode() { |
||||
final int prime = 31; |
||||
int result = 1; |
||||
result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); |
||||
result = prime * result + ((getStoreId() == null) ? 0 : getStoreId().hashCode()); |
||||
result = prime * result + ((getStoreNo() == null) ? 0 : getStoreNo().hashCode()); |
||||
result = prime * result + ((getStoreName() == null) ? 0 : getStoreName().hashCode()); |
||||
result = prime * result + ((getCid() == null) ? 0 : getCid().hashCode()); |
||||
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); |
||||
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().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()); |
||||
result = prime * result + ((getExt4() == null) ? 0 : getExt4().hashCode()); |
||||
result = prime * result + ((getExt5() == null) ? 0 : getExt5().hashCode()); |
||||
result = prime * result + ((getExt6() == null) ? 0 : getExt6().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(", storeId=").append(storeId); |
||||
sb.append(", storeNo=").append(storeNo); |
||||
sb.append(", storeName=").append(storeName); |
||||
sb.append(", cid=").append(cid); |
||||
sb.append(", createTime=").append(createTime); |
||||
sb.append(", updateTime=").append(updateTime); |
||||
sb.append(", ext1=").append(ext1); |
||||
sb.append(", ext2=").append(ext2); |
||||
sb.append(", ext3=").append(ext3); |
||||
sb.append(", ext4=").append(ext4); |
||||
sb.append(", ext5=").append(ext5); |
||||
sb.append(", ext6=").append(ext6); |
||||
sb.append(", serialVersionUID=").append(serialVersionUID); |
||||
sb.append("]"); |
||||
return sb.toString(); |
||||
} |
||||
} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,241 @@ |
||||
package com.hfkj.entity; |
||||
|
||||
import java.io.Serializable; |
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* bs_store_push_record |
||||
* @author |
||||
*/ |
||||
/** |
||||
* |
||||
* 代码由工具生成 |
||||
* |
||||
**/ |
||||
public class BsStorePushRecord implements Serializable { |
||||
/** |
||||
* ID |
||||
*/ |
||||
private Long id; |
||||
|
||||
/** |
||||
* 门店id |
||||
*/ |
||||
private Long storeId; |
||||
|
||||
/** |
||||
* 语音url |
||||
*/ |
||||
private String voiceUrl; |
||||
|
||||
/** |
||||
* 创建时间 |
||||
*/ |
||||
private Date createTime; |
||||
|
||||
/** |
||||
* 更新时间 |
||||
*/ |
||||
private Date updateTime; |
||||
|
||||
/** |
||||
* 状态 1: 播报完成 2:未播报 |
||||
*/ |
||||
private Integer status; |
||||
|
||||
/** |
||||
* ext_1 |
||||
*/ |
||||
private String ext1; |
||||
|
||||
/** |
||||
* ext_2 |
||||
*/ |
||||
private String ext2; |
||||
|
||||
/** |
||||
* ext_3 |
||||
*/ |
||||
private String ext3; |
||||
|
||||
/** |
||||
* ext_4 |
||||
*/ |
||||
private String ext4; |
||||
|
||||
/** |
||||
* ext_5 |
||||
*/ |
||||
private String ext5; |
||||
|
||||
/** |
||||
* ext_6 |
||||
*/ |
||||
private String ext6; |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
public Long getId() { |
||||
return id; |
||||
} |
||||
|
||||
public void setId(Long id) { |
||||
this.id = id; |
||||
} |
||||
|
||||
public Long getStoreId() { |
||||
return storeId; |
||||
} |
||||
|
||||
public void setStoreId(Long storeId) { |
||||
this.storeId = storeId; |
||||
} |
||||
|
||||
public String getVoiceUrl() { |
||||
return voiceUrl; |
||||
} |
||||
|
||||
public void setVoiceUrl(String voiceUrl) { |
||||
this.voiceUrl = voiceUrl; |
||||
} |
||||
|
||||
public Date getCreateTime() { |
||||
return createTime; |
||||
} |
||||
|
||||
public void setCreateTime(Date createTime) { |
||||
this.createTime = createTime; |
||||
} |
||||
|
||||
public Date getUpdateTime() { |
||||
return updateTime; |
||||
} |
||||
|
||||
public void setUpdateTime(Date updateTime) { |
||||
this.updateTime = updateTime; |
||||
} |
||||
|
||||
public Integer getStatus() { |
||||
return status; |
||||
} |
||||
|
||||
public void setStatus(Integer status) { |
||||
this.status = status; |
||||
} |
||||
|
||||
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; |
||||
} |
||||
|
||||
public String getExt4() { |
||||
return ext4; |
||||
} |
||||
|
||||
public void setExt4(String ext4) { |
||||
this.ext4 = ext4; |
||||
} |
||||
|
||||
public String getExt5() { |
||||
return ext5; |
||||
} |
||||
|
||||
public void setExt5(String ext5) { |
||||
this.ext5 = ext5; |
||||
} |
||||
|
||||
public String getExt6() { |
||||
return ext6; |
||||
} |
||||
|
||||
public void setExt6(String ext6) { |
||||
this.ext6 = ext6; |
||||
} |
||||
|
||||
@Override |
||||
public boolean equals(Object that) { |
||||
if (this == that) { |
||||
return true; |
||||
} |
||||
if (that == null) { |
||||
return false; |
||||
} |
||||
if (getClass() != that.getClass()) { |
||||
return false; |
||||
} |
||||
BsStorePushRecord other = (BsStorePushRecord) that; |
||||
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) |
||||
&& (this.getStoreId() == null ? other.getStoreId() == null : this.getStoreId().equals(other.getStoreId())) |
||||
&& (this.getVoiceUrl() == null ? other.getVoiceUrl() == null : this.getVoiceUrl().equals(other.getVoiceUrl())) |
||||
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) |
||||
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())) |
||||
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) |
||||
&& (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())) |
||||
&& (this.getExt4() == null ? other.getExt4() == null : this.getExt4().equals(other.getExt4())) |
||||
&& (this.getExt5() == null ? other.getExt5() == null : this.getExt5().equals(other.getExt5())) |
||||
&& (this.getExt6() == null ? other.getExt6() == null : this.getExt6().equals(other.getExt6())); |
||||
} |
||||
|
||||
@Override |
||||
public int hashCode() { |
||||
final int prime = 31; |
||||
int result = 1; |
||||
result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); |
||||
result = prime * result + ((getStoreId() == null) ? 0 : getStoreId().hashCode()); |
||||
result = prime * result + ((getVoiceUrl() == null) ? 0 : getVoiceUrl().hashCode()); |
||||
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); |
||||
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode()); |
||||
result = prime * result + ((getStatus() == null) ? 0 : getStatus().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()); |
||||
result = prime * result + ((getExt4() == null) ? 0 : getExt4().hashCode()); |
||||
result = prime * result + ((getExt5() == null) ? 0 : getExt5().hashCode()); |
||||
result = prime * result + ((getExt6() == null) ? 0 : getExt6().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(", storeId=").append(storeId); |
||||
sb.append(", voiceUrl=").append(voiceUrl); |
||||
sb.append(", createTime=").append(createTime); |
||||
sb.append(", updateTime=").append(updateTime); |
||||
sb.append(", status=").append(status); |
||||
sb.append(", ext1=").append(ext1); |
||||
sb.append(", ext2=").append(ext2); |
||||
sb.append(", ext3=").append(ext3); |
||||
sb.append(", ext4=").append(ext4); |
||||
sb.append(", ext5=").append(ext5); |
||||
sb.append(", ext6=").append(ext6); |
||||
sb.append(", serialVersionUID=").append(serialVersionUID); |
||||
sb.append("]"); |
||||
return sb.toString(); |
||||
} |
||||
} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,100 @@ |
||||
package com.hfkj.service; |
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.hfkj.entity.BsStoreCid; |
||||
import com.hfkj.entity.BsStorePushRecord; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @author sum1dream |
||||
*/ |
||||
public interface BsStoreCidService { |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name insertStoreCid |
||||
* @Description // 新增门店cid内容
|
||||
* @Date 15:14 2023/6/14 |
||||
* @Param [storeCid] |
||||
* @Return void |
||||
*/ |
||||
void insertStoreCid(BsStoreCid storeCid); |
||||
|
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name editStoreCid |
||||
* @Description // 编辑门店cid内容
|
||||
* @Date 15:15 2023/6/14 |
||||
* @Param [storeCid] |
||||
* @Return void |
||||
*/ |
||||
void editStoreCid(BsStoreCid storeCid); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name findByMap |
||||
* @Description // 查询门店CID内容
|
||||
* @Date 15:40 2023/6/14 |
||||
* @Param [map] |
||||
* @Return com.hfkj.entity.BsStoreCid |
||||
*/ |
||||
BsStoreCid findByMap(Map<String , Object> map); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name storePush |
||||
* @Description // 门店语音推送
|
||||
* @Date 16:11 2023/6/14 |
||||
* @Param [object] |
||||
* @Return void |
||||
*/ |
||||
void storePush(JSONObject object); |
||||
|
||||
|
||||
void voiceSucceed(Long storeId , String taskNo); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name insertStoreCid |
||||
* @Description // 新增门店语音播报推送记录
|
||||
* @Date 15:14 2023/6/14 |
||||
* @Param [storeCid] |
||||
* @Return void |
||||
*/ |
||||
void insertStorePushRecord(BsStorePushRecord storePushRecord); |
||||
|
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name editStoreCid |
||||
* @Description // 编辑门店语音播报推送记录
|
||||
* @Date 15:15 2023/6/14 |
||||
* @Param [storeCid] |
||||
* @Return void |
||||
*/ |
||||
void editStorePushRecord(BsStorePushRecord storePushRecord); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name findByMap |
||||
* @Description // 查询门店语音播报推送记录
|
||||
* @Date 15:40 2023/6/14 |
||||
* @Param [map] |
||||
* @Return com.hfkj.entity.BsStoreCid |
||||
*/ |
||||
BsStorePushRecord findPushRecordByMap(Map<String , Object> map); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name getList |
||||
* @Description // 查询门店语音播报推送记录列表
|
||||
* @Date 10:41 2023/6/15 |
||||
* @Param [map] |
||||
* @Return java.util.List<com.hfkj.entity.BsStorePushRecord> |
||||
*/ |
||||
List<BsStorePushRecord> getList(Map<String , Object> map); |
||||
|
||||
} |
@ -0,0 +1,231 @@ |
||||
package com.hfkj.service.impl; |
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.hfkj.common.Base64Util; |
||||
import com.hfkj.common.exception.ErrorCode; |
||||
import com.hfkj.common.exception.ErrorHelp; |
||||
import com.hfkj.common.exception.SysCode; |
||||
import com.hfkj.common.utils.RedisUtil; |
||||
import com.hfkj.config.CommonSysConst; |
||||
import com.hfkj.dao.BsStoreCidMapper; |
||||
import com.hfkj.dao.BsStorePushRecordMapper; |
||||
import com.hfkj.entity.BsStoreCid; |
||||
import com.hfkj.entity.BsStoreCidExample; |
||||
import com.hfkj.entity.BsStorePushRecord; |
||||
import com.hfkj.entity.BsStorePushRecordExample; |
||||
import com.hfkj.service.BsStoreCidService; |
||||
import com.hfkj.tts.HWYunSisService; |
||||
import com.hfkj.unipush.UniPushService; |
||||
import org.apache.commons.collections4.MapUtils; |
||||
import org.apache.commons.lang3.StringUtils; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.Date; |
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @author sum1dream |
||||
*/ |
||||
@Service("bsStoreCidService") |
||||
public class BsStoreCidServiceImpl implements BsStoreCidService { |
||||
|
||||
private static Logger log = LoggerFactory.getLogger(BsStoreCidService.class); |
||||
|
||||
@Resource |
||||
private BsStoreCidMapper bsStoreCidMapper; |
||||
|
||||
@Resource |
||||
private BsStorePushRecordMapper storePushRecordMapper; |
||||
|
||||
@Resource |
||||
private RedisUtil redisUtil; |
||||
|
||||
@Override |
||||
public void insertStoreCid(BsStoreCid storeCid) { |
||||
bsStoreCidMapper.insert(storeCid); |
||||
} |
||||
|
||||
@Override |
||||
public void editStoreCid(BsStoreCid storeCid) { |
||||
bsStoreCidMapper.updateByPrimaryKey(storeCid); |
||||
} |
||||
|
||||
@Override |
||||
public BsStoreCid findByMap(Map<String, Object> map) { |
||||
|
||||
BsStoreCidExample example = new BsStoreCidExample(); |
||||
BsStoreCidExample.Criteria criteria = example.createCriteria(); |
||||
|
||||
if (MapUtils.getLong(map, "storeId") != null) { |
||||
criteria.andStoreIdEqualTo(MapUtils.getLong(map, "storeId")); |
||||
} |
||||
|
||||
if (MapUtils.getLong(map, "storeNo") != null) { |
||||
criteria.andStoreNoEqualTo(MapUtils.getLong(map, "storeNo")); |
||||
} |
||||
|
||||
if (StringUtils.isNotBlank(MapUtils.getString(map, "storeName"))) { |
||||
criteria.andStoreNameLike("%"+MapUtils.getString(map, "storeName")+"%"); |
||||
} |
||||
|
||||
List<BsStoreCid> list = bsStoreCidMapper.selectByExample(example); |
||||
|
||||
if (list.size() > 0) { |
||||
return list.get(0); |
||||
} |
||||
|
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void storePush(JSONObject object) { |
||||
|
||||
try { |
||||
|
||||
String key = "APP_PUSH" + object.getLong("storeId"); |
||||
|
||||
if (redisUtil.get(key) == null) { |
||||
redisUtil.set(key,object.getLong("storeId"), 5); |
||||
if (object.getBigDecimal("price") == null || object.getLong("storeId") == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
|
||||
Map<String, Object> map = new HashMap<>(); |
||||
map.put("storeId", object.getLong("storeId")); |
||||
BsStoreCid bsStoreCid = findByMap(map); |
||||
|
||||
if (bsStoreCid == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "不存在推送关系"); |
||||
} |
||||
|
||||
// 获取语音播报地址
|
||||
String auditPath = HWYunSisService.ttsCustomDemo(object); |
||||
|
||||
if (auditPath == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "生成语音失败"); |
||||
} |
||||
|
||||
String taskNo = Base64Util.generateOrderNo(); |
||||
object.put("taskNo", taskNo); |
||||
object.put("cid", bsStoreCid.getCid()); |
||||
String msg = CommonSysConst.getSysConfig().getDomainName() + auditPath + "!@#PUSH#@!" + taskNo + "!@#PUSH#@!" + "惠支付收款:" + object.getBigDecimal("price"); |
||||
object.put("body", msg); |
||||
if (UniPushService.pushToSingleByCid(object)) { |
||||
BsStorePushRecord storePushRecord = new BsStorePushRecord(); |
||||
storePushRecord.setStoreId(object.getLong("storeId")); |
||||
storePushRecord.setCreateTime(new Date()); |
||||
storePushRecord.setUpdateTime(new Date()); |
||||
storePushRecord.setStatus(2); |
||||
storePushRecord.setExt1(taskNo); |
||||
storePushRecord.setVoiceUrl(msg); |
||||
insertStorePushRecord(storePushRecord); |
||||
} |
||||
} else { |
||||
storePush(object); |
||||
} |
||||
|
||||
} catch (Exception e) { |
||||
log.info("请求超时:" + e); |
||||
} |
||||
|
||||
} |
||||
|
||||
|
||||
|
||||
private void getPushRecord(Long storeId) { |
||||
|
||||
Map<String, Object> map = new HashMap<>(); |
||||
map.put("storeId", storeId); |
||||
BsStoreCid bsStoreCid = findByMap(map); |
||||
|
||||
if (bsStoreCid == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "不存在推送关系"); |
||||
} |
||||
|
||||
// 查询可推送语音
|
||||
|
||||
Map<String , Object> pushMap = new HashMap<>(); |
||||
pushMap.put("storeId" , storeId); |
||||
pushMap.put("status" , 2); |
||||
BsStorePushRecord storePushRecord = findPushRecordByMap(pushMap); |
||||
|
||||
if (storePushRecord != null) { |
||||
JSONObject object = new JSONObject(); |
||||
object.put("cid", bsStoreCid.getCid()); |
||||
object.put("storeId", bsStoreCid.getCid()); |
||||
object.put("body", storePushRecord.getVoiceUrl()); |
||||
UniPushService.pushToSingleByCid(object); |
||||
} |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void voiceSucceed(Long storeId , String taskNo) { |
||||
Map<String , Object> pushMap = new HashMap<>(); |
||||
pushMap.put("storeId" , storeId); |
||||
pushMap.put("ext1" , storeId); |
||||
pushMap.put("status" , 2); |
||||
BsStorePushRecord storePushRecord = findPushRecordByMap(pushMap); |
||||
|
||||
if (storePushRecord != null) { |
||||
storePushRecord.setStatus(1); |
||||
storePushRecordMapper.updateByPrimaryKey(storePushRecord); |
||||
|
||||
redisUtil.del("APP_PUSH" + storePushRecord.getStoreId()); |
||||
} |
||||
|
||||
getPushRecord(storeId); |
||||
} |
||||
|
||||
@Override |
||||
public void insertStorePushRecord(BsStorePushRecord storePushRecord) { |
||||
storePushRecordMapper.insert(storePushRecord); |
||||
} |
||||
|
||||
@Override |
||||
public void editStorePushRecord(BsStorePushRecord storePushRecord) { |
||||
storePushRecordMapper.updateByPrimaryKey(storePushRecord); |
||||
} |
||||
|
||||
@Override |
||||
public BsStorePushRecord findPushRecordByMap(Map<String, Object> map) { |
||||
BsStorePushRecordExample example = new BsStorePushRecordExample(); |
||||
BsStorePushRecordExample.Criteria criteria = example.createCriteria(); |
||||
|
||||
if (MapUtils.getLong(map, "storeId") != null) { |
||||
criteria.andStoreIdEqualTo(MapUtils.getLong(map, "storeId")); |
||||
} |
||||
if (MapUtils.getInteger(map, "status") != null) { |
||||
criteria.andStatusEqualTo(MapUtils.getInteger(map, "status")); |
||||
} |
||||
|
||||
List<BsStorePushRecord> list = storePushRecordMapper.selectByExample(example); |
||||
|
||||
if (list.size() > 0) { |
||||
return list.get(0); |
||||
} |
||||
|
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public List<BsStorePushRecord> getList(Map<String, Object> map) { |
||||
|
||||
BsStorePushRecordExample example = new BsStorePushRecordExample(); |
||||
BsStorePushRecordExample.Criteria criteria = example.createCriteria(); |
||||
|
||||
if (MapUtils.getLong(map, "storeId") != null) { |
||||
criteria.andStoreIdEqualTo(MapUtils.getLong(map, "storeId")); |
||||
} |
||||
if (MapUtils.getInteger(map, "status") != null) { |
||||
criteria.andStatusEqualTo(MapUtils.getInteger(map, "status")); |
||||
} |
||||
|
||||
return storePushRecordMapper.selectByExample(example); |
||||
} |
||||
} |
@ -0,0 +1,133 @@ |
||||
package com.hfkj.tts; |
||||
|
||||
|
||||
import com.alibaba.fastjson.JSON; |
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.hfkj.config.CommonSysConst; |
||||
import com.huawei.sis.bean.AuthInfo; |
||||
import com.huawei.sis.bean.SisConfig; |
||||
import com.huawei.sis.bean.SisConstant; |
||||
import com.huawei.sis.bean.request.TtsCustomRequest; |
||||
import com.huawei.sis.bean.response.TtsCustomResponse; |
||||
import com.huawei.sis.client.TtsCustomizationClient; |
||||
import com.huawei.sis.exception.SisException; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
|
||||
import java.io.File; |
||||
|
||||
|
||||
public class HWYunSisService { |
||||
|
||||
private static Logger log = LoggerFactory.getLogger(HWYunSisService.class); |
||||
|
||||
private static final int DEFAULT_PITCH = 0; |
||||
private static final int DEFAULT_SPEED = 0; |
||||
private static final int DEFAULT_VOLUME = 50; |
||||
|
||||
private static String ak = "SQ9ERSS9KKJ7VC72TK4D"; |
||||
private static String sk = "YqG2MDTsjXPel5URmKpOfyePrzbMWCU9YdzCUPmp"; |
||||
// 区域,如cn-north-1、cn-north-4
|
||||
private static String region = "cn-east-3"; |
||||
// 项目id。登录管理控制台,鼠标移动到右上角的用户名上,在下拉列表中选择我的凭证,在项目列表中查看项目id。多项目时,展开“所属区域”,从“项目ID”列获取子项目ID。
|
||||
private static String projectId = "075456f65780107f2f4ec013ff43b487"; |
||||
// 待合成的文本
|
||||
private static String text = ""; |
||||
// 设置本地音频保存路径.可选择不保存到本地
|
||||
private static String path = ""; |
||||
|
||||
|
||||
/** |
||||
* 用于语音合成参数设置,例如发声人、音高、语速、音量、采样率、连接超时。所有参数均可以不设置,采用默认。 |
||||
* |
||||
* @param request 语音合成请求 |
||||
*/ |
||||
private static void setParameter(TtsCustomRequest request) { |
||||
|
||||
// 设置语音格式,可选MP3,pcm等,默认wav
|
||||
request.setAudioFormat("mp3"); |
||||
// 音高,[-500, 500], 默认0
|
||||
request.setPitch(DEFAULT_PITCH); |
||||
// 语速,[-500, 500],默认0
|
||||
request.setSpeed(DEFAULT_SPEED); |
||||
// 音量,[0, 100],默认50
|
||||
request.setVolume(DEFAULT_VOLUME); |
||||
// 当前支持8000和16000,默认8000
|
||||
request.setSampleRate("8000"); |
||||
// 设置property,特征字符串,{language}_{speaker}_{domain}
|
||||
request.setProperty("chinese_huaxiaowen_common"); |
||||
|
||||
// 设置返回数据是否保存,默认不保存。若保存,则需要设置一下保存路径,如D:/1.wav
|
||||
request.setSaved(true); |
||||
request.setSavePath(path); |
||||
} |
||||
|
||||
/** |
||||
* 定义config,所有参数可选,设置超时时间等。 |
||||
* |
||||
* @return SisConfig |
||||
*/ |
||||
private static SisConfig getConfig() { |
||||
SisConfig config = new SisConfig(); |
||||
// 设置连接超时,默认10000ms
|
||||
config.setConnectionTimeout(SisConstant.DEFAULT_CONNECTION_TIMEOUT); |
||||
// 设置读取超时,默认10000ms
|
||||
config.setReadTimeout(SisConstant.DEFAULT_READ_TIMEOUT); |
||||
// 设置代理, 一定要确保代理可用才启动此设置。 代理初始化也可用不加密的代理,new ProxyHostInfo(host, port);
|
||||
// ProxyHostInfo proxy = new ProxyHostInfo(host, port, username, password);
|
||||
// config.setProxy(proxy);
|
||||
return config; |
||||
} |
||||
|
||||
/** |
||||
* 根据文本和api,获取生成的音频数据 |
||||
*/ |
||||
public static String ttsCustomDemo(JSONObject object) { |
||||
try { |
||||
log.info("========= START 华为云生成音频数据 START ==========="); |
||||
|
||||
// 1. 初始化TtsCustomizationClient
|
||||
// 定义authInfo,根据ak,sk,region, projectId.
|
||||
AuthInfo authInfo = new AuthInfo(ak, sk, region, projectId); |
||||
// 定义config,所有参数可选,设置超时时间。
|
||||
SisConfig config = getConfig(); |
||||
// 根据authInfo和config,构造TtsCustomizationClient
|
||||
TtsCustomizationClient tts = new TtsCustomizationClient(authInfo, config); |
||||
|
||||
text = "惠支付收款" + object.getString("price") + "元"; |
||||
|
||||
path = CommonSysConst.getSysConfig().getFilesystem() + "/tts/" + object.getString("price") + ".mp3"; |
||||
|
||||
File file = new File(path); |
||||
if (file.exists()) { |
||||
log.info("返回服务器语音内容 " + JSON.toJSONString(path)); |
||||
return "/filesystem/tts/" + object.getString("price") + ".mp3"; |
||||
} |
||||
// 2. 配置请求
|
||||
TtsCustomRequest request = new TtsCustomRequest(text); |
||||
// 设置参数,所有参数均可选,如果要保存合成音频文件,需要在request设置
|
||||
setParameter(request); |
||||
|
||||
// 3. 发送请求,获取响应。具体结果可通过response.getXX获取。
|
||||
TtsCustomResponse response = tts.getTtsResponse(request); |
||||
|
||||
log.info("华为云-参数: " + JSON.toJSONString(response)); |
||||
|
||||
if (response.getResult().getData() != null) { |
||||
return "/filesystem/tts/" + object.getString("price") + ".mp3"; |
||||
} |
||||
|
||||
return null; |
||||
|
||||
} catch (SisException e) { |
||||
e.printStackTrace(); |
||||
System.out.println("error_code:" + e.getErrorCode() + "\nerror_msg:" + e.getErrorMsg()); |
||||
return null; |
||||
|
||||
} finally { |
||||
log.info("========= END 华为云生成音频数据 END ==========="); |
||||
} |
||||
|
||||
} |
||||
|
||||
} |
@ -0,0 +1,86 @@ |
||||
package com.hfkj.unipush; |
||||
|
||||
import com.alibaba.fastjson.JSON; |
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.getui.push.v2.sdk.ApiHelper; |
||||
import com.getui.push.v2.sdk.GtApiConfiguration; |
||||
import com.getui.push.v2.sdk.api.PushApi; |
||||
import com.getui.push.v2.sdk.common.ApiResult; |
||||
import com.getui.push.v2.sdk.dto.req.Audience; |
||||
import com.getui.push.v2.sdk.dto.req.message.PushDTO; |
||||
import com.getui.push.v2.sdk.dto.req.message.PushMessage; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
|
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @author sum1dream |
||||
*/ |
||||
public class UniPushService { |
||||
private static Logger log = LoggerFactory.getLogger(UniPushService.class); |
||||
|
||||
/** |
||||
* 创建请求 |
||||
* @return |
||||
*/ |
||||
private static PushApi createClient() { |
||||
// 设置httpClient最大连接数,当并发较大时建议调大此参数。或者启动参数加上 -Dhttp.maxConnections=200
|
||||
System.setProperty("http.maxConnections", "200"); |
||||
GtApiConfiguration apiConfiguration = new GtApiConfiguration(); |
||||
//填写应用配置
|
||||
apiConfiguration.setAppId("9LTgsDR5Y26MTWpN1uBhb1"); |
||||
apiConfiguration.setAppKey("GV7qmZoFh1AaqD4uDfH857"); |
||||
apiConfiguration.setMasterSecret("JX9m0F92tZ5ciBtrfiJu93"); |
||||
// 接口调用前缀,请查看文档: 接口调用规范 -> 接口前缀, 可不填写appId
|
||||
apiConfiguration.setDomain("https://restapi.getui.com/v2/"); |
||||
// 实例化ApiHelper对象,用于创建接口对象
|
||||
ApiHelper apiHelper = ApiHelper.build(apiConfiguration); |
||||
// 创建对象,建议复用。目前有PushApi、StatisticApi、UserApi
|
||||
return apiHelper.creatApi(PushApi.class); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name androidTemplate |
||||
* @Description // 安卓模版
|
||||
* @Date 16:08 2023/6/9 |
||||
* @Param [uniPushModel] |
||||
* @Return void |
||||
*/ |
||||
public static Boolean pushToSingleByCid(JSONObject object) { |
||||
|
||||
log.info("========= START 个推手机端推送 START ==========="); |
||||
|
||||
|
||||
PushApi pushApi = createClient(); |
||||
|
||||
//根据cid进行单推
|
||||
PushDTO<Audience> pushDTO = new PushDTO<>(); |
||||
// 设置推送参数
|
||||
pushDTO.setRequestId(System.currentTimeMillis() + ""); |
||||
// 设置个推通道参数
|
||||
PushMessage pushMessage = new PushMessage(); |
||||
pushDTO.setPushMessage(pushMessage); |
||||
pushMessage.setTransmission(object.getString("body")); |
||||
/*设置接收人信息*/ |
||||
Audience audience = new Audience(); |
||||
pushDTO.setAudience(audience); |
||||
audience.addCid(object.getString("cid")); |
||||
log.info("个推-请求参数: " + JSON.toJSONString(pushDTO)); |
||||
// 进行cid单推
|
||||
ApiResult<Map<String, Map<String, String>>> apiResult = pushApi.pushToSingleByCid(pushDTO); |
||||
log.info("个推-返回参数: " + JSON.toJSONString(apiResult)); |
||||
log.info("========= END 个推手机端推送 END ==========="); |
||||
|
||||
if (apiResult.isSuccess()) { |
||||
return apiResult.getData().toString().contains("successed_online"); |
||||
} else { |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
} |
Loading…
Reference in new issue