修改餐饮预约以及留言板信息脱敏

master
bmpandlcm 1 year ago
parent 272402177d
commit ebeef34e27

@ -46,9 +46,10 @@ public class AppointmentInfoController {
public ResultData<List> getList(@RequestParam(value = "userId") String userId,
@RequestParam(value = "appointmentType") String appointmentType,
@RequestParam(value = "orderScope",required = false) String orderScope,
@RequestParam(value = "pageSize") String pageSize,
@RequestParam(value = "currentPage") String currentPage,
@RequestParam(value = "id",required = false) String id){
@RequestParam(value = "pageSize",required = false) String pageSize,
@RequestParam(value = "currentPage",required = false) String currentPage,
@RequestParam(value = "id",required = false) String id,
@RequestParam(value = "orderId",required = false) String orderId){
int start=0;
int end=1000000000;
List integrationList =null;
@ -56,10 +57,10 @@ public class AppointmentInfoController {
if(!PubTools.isNull(pageSize) && !PubTools.isNull(currentPage)){
start=(Integer.parseInt(currentPage)-1)* Integer.parseInt(pageSize)+1;
end=Integer.parseInt(currentPage)*Integer.parseInt(pageSize);
integrationList = this.appointmentInfoService.getList(id, userId,appointmentType,orderScope,start,end);
totalList = this.appointmentInfoService.getList(id, userId,appointmentType,orderScope,0,0);
integrationList = this.appointmentInfoService.getList(id,orderId, userId,appointmentType,orderScope,start,end);
totalList = this.appointmentInfoService.getList(id,orderId, userId,appointmentType,orderScope,0,0);
}else{
integrationList = this.appointmentInfoService.getList(id, userId,appointmentType,orderScope,start,end);
integrationList = this.appointmentInfoService.getList(id,orderId, userId,appointmentType,orderScope,start,end);
totalList=integrationList;
}
if(integrationList != null){

@ -0,0 +1,42 @@
package com.nmgs.controller;
import com.nmgs.config.ResultData;
import com.nmgs.service.UserTableService;
import com.nmgs.service.impl.SerivceAreaOperationMealServiceImpl;
import com.nmgs.util.PubTools;
import com.nmgs.util.WebsocketUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("serviceMeal")
@Api(tags="商户套餐信息操作")
public class ServiceMealController {
public SerivceAreaOperationMealServiceImpl serivceAreaOperationMealServiceImpl;
@Autowired
public void setSerivceAreaOperationMealServiceImpl(SerivceAreaOperationMealServiceImpl serivceAreaOperationMealServiceImpl) {
this.serivceAreaOperationMealServiceImpl = serivceAreaOperationMealServiceImpl;
}
@RequestMapping(value = "getMealInfoById",
method = {RequestMethod.POST}
)
@ApiOperation(value="根据套餐ID获取套餐信息",httpMethod = "POST")
public ResultData<List> getMealInfoById(@RequestParam("mealId") String mealId){
List userByOpenId = serivceAreaOperationMealServiceImpl.getMealInfoById(mealId);
if(userByOpenId ==null){
return ResultData.fail("查询失败");
}else if(userByOpenId !=null){
return ResultData.success("查询成功",userByOpenId,userByOpenId.size());
}
return ResultData.success(1,"查询成功");
}
}

@ -8,13 +8,14 @@ public interface AppointmentInfoService {
/**
*
* @param id
* @param orderId
* @param userId
* @param appointmentType
* @param start
* @param end
* @return
*/
public List getList(String id, String userId,String appointmentType,String orderSope,int start,int end);
public List getList(String id,String orderId, String userId,String appointmentType,String orderSope,int start,int end);
/**
* 线

@ -58,11 +58,9 @@ public class ApponintmentInfoServiceImpl implements AppointmentInfoService {
" OR ait.ACARNO = '' \n" +
" OR ait.ACARNO = 'null' THEN\n" +
" '' ELSE to_char(\n" +
" CONCAT(\n" +
" substr( ait.ACARNO, 1, instr( ait.ACARNO, '_' ) - 1 ) || '_',\n" +
" substr( ait.ACARNO, 1, instr( ait.ACARNO, '_' ) - 1 ) || '_' || " +
" ( SELECT text FROM PLATECOLOR_TEXT WHERE value = substr( ait.ACARNO, instr( ait.ACARNO, '_' ) + 1 ) ) \n" +
" ) \n" +
" ) \n" +
" END AS ACARNONAME,\n" +
"\t(\n" +
"\tCASE\n" +
@ -100,12 +98,10 @@ public class ApponintmentInfoServiceImpl implements AppointmentInfoService {
"\t CASE WHEN ait.ACARNO IS NULL \n" +
" OR ait.ACARNO = '' \n" +
" OR ait.ACARNO = 'null' THEN\n" +
" '' ELSE to_char(\n" +
" CONCAT(\n" +
" '' ELSE CONCAT(\n" +
" substr( ait.ACARNO, 1, instr( ait.ACARNO, '_' ) - 1 ) , '_',\n" +
" ( SELECT text FROM PLATECOLOR_TEXT WHERE value = substr( ait.ACARNO, instr( ait.ACARNO, '_' ) + 1 ) ) \n" +
" ) \n" +
" ) \n" +
" END AS ACARNONAME,\n" +
"\t(\n" +
"\tCASE\n" +
@ -132,7 +128,7 @@ public class ApponintmentInfoServiceImpl implements AppointmentInfoService {
public static String returnSql="SELECT ID,AREANAME,USERNAME,STROEPIC,APPOINTMENTTIME,CREATETIME,TOTALINTEGRAL,APPOINTMENTTYPE," +
"MEALS,MEALSCOUNT,APPOINTMENTLINEID,INTEGRATIONLISTID,ACARNONAME,ORDERID,COMPLETESTATUS,(CASE COMPLETESTATUS WHEN 1 THEN '待使用' WHEN 2 THEN '已使用' ELSE '已过期' END ) AS COMPLETESTATUSNAME ";
@Override
public List getList(String id, String userId,String appointmentType,String orderSope,int start,int end) {
public List getList(String id, String orderId, String userId, String appointmentType, String orderSope, int start, int end) {
List list=null;
List listRet=new ArrayList();
String sqlTemp=sql;
@ -140,6 +136,9 @@ public class ApponintmentInfoServiceImpl implements AppointmentInfoService {
if(!PubTools.isNull(id)){
sqlTemp += " and ait.ID = "+id+"";
}
if (!PubTools.isNull(orderId)) {
sqlTemp += " and ait.ORDERID='" + orderId + "'";
}
if(!PubTools.isNull(userId)){
sqlTemp += " AND wut.OPENID='"+userId+"'";
}
@ -209,6 +208,8 @@ public class ApponintmentInfoServiceImpl implements AppointmentInfoService {
ja.add(jo);
}
}
map.remove("STROEPIC");
map.put("STROEPIC", PubTools.isEmpty(map.get("STROEPIC")) ? "" : PubTools.ClobToString(map.get("MEALPIC")));
map.put("MEALINFO",ja);
listRet.add(map);
}
@ -270,6 +271,7 @@ public class ApponintmentInfoServiceImpl implements AppointmentInfoService {
String mealTotalMoney,String dateTime) {
JSONObject retJo=new JSONObject();
String ret="-2";// -1 代表接口处理失败 1 处理成功 2 用户不存在 3 兑换积分大于用户可用积分 4 二维码信息过期 5 商户不存在 6 积分类型与消费方式不匹配 7 商户角色未设置 8 用户已冻结
String jobNumber = "";//商户工号
try{
String currentDate=PubTools.getCurrentDate();
if("2".equals(appointmentType)) {//餐饮预约需要扣除积分
@ -332,22 +334,13 @@ public class ApponintmentInfoServiceImpl implements AppointmentInfoService {
retJo.put("PAYINTEGRAL", rebateIntegrateIFcZK);
}
//查询用户累积获取的总积分.消费的不用管
/* String totalAddIntegralSql = "SELECT COALESCE(MAX(ilt.TOTALADDINTEGRATION),0) AS TOTALADDINTEGRATION FROM INTEGRATION_LIST_TABLE ilt,WEIXN_USER_TABLE ut WHERE ilt.USERID = ut.ID AND ut.OPENID='" + openId + "'";
List selectforlistTotalAdd = this.mapperI.selectforlist(totalAddIntegralSql);
double totalAddIntegral = 0.0;
if (selectforlistTotalAdd.size() > 0) {
Map<String, Object> o = (Map<String, Object>) selectforlistTotalAdd.get(0);
totalAddIntegral = Double.parseDouble(o.get("TOTALADDINTEGRATION").toString());
}*/
//判断选择的套餐是哪几个商户的, 分别消费了多少积分
String servicelistSql = "";
if ("2".equals(DBType)) {//oralce数据库
servicelistSql = "select tt.JOBNUMBER,LISTAGG ( tt.ID, ',' ) WITHIN GROUP ( ORDER BY tt.JOBNUMBER ) AS MEALIDS,LISTAGG ( tt.MEALPRICE, ',' ) WITHIN GROUP ( ORDER BY tt.JOBNUMBER ) AS MEALPRICES from SERVICE_AREA_OPERATION_MEAL_TABLE tt where tt.ID in(" + mealId + ") group by tt.JOBNUMBER";
} else if ("4".equals(DBType)) {//mysql数据库
servicelistSql = "select tt.JOBNUMBER,GROUP_CONCAT(tt.ID ORDER BY tt.JOBNUMBER Separator ',') AS MEALIDS,GROUP_CONCAT(tt.MEALPRICE ORDER BY tt.JOBNUMBER Separator ',') AS MEALPRICES from SERVICE_AREA_OPERATION_MEAL_TABLE tt where tt.ID in(" + mealId + ") group by tt.JOBNUMBER";
String serivceOperatorRole = "SELECT saot.ID,saot.USERNAME,saot.ROLEID,saot.JOBNUMBER,saot.SERVICEAREAID FROM SERVICE_AREA_OPERATORS_TABLE saot" +
" WHERE saot.ID=" + operatorId + "";
List serviceOperatorList = this.mapperI.selectforlist(serivceOperatorRole);
if (serviceOperatorList != null && serviceOperatorList.size() > 0) {//商户不存在
Map<String, Object> oTemp = (Map<String, Object>) serviceOperatorList.get(0);
jobNumber = oTemp.get("JOBNUMBER").toString();
}
//List serviceforlist = this.mapperI.selectforlist(servicelistSql);
String integralListId = "";//积分流水的ID
String enabledIntegral = "";//本次消费之后,剩余的餐饮积分
// if (serviceforlist != null && serviceforlist.size() > 0) {
@ -415,7 +408,7 @@ public class ApponintmentInfoServiceImpl implements AppointmentInfoService {
} else {
integralListId += "," + (maxId + 1);
}
LogUtil.WriteLog_Info("积分核减=====积分流水已插入", "QCodeInfoServiceImpl");
LogUtil.WriteLog_Info("积分核减=====积分流水已插入", "ApponintmentInfoServiceImpl");
//2、新加一条消费记录
String sqlIntegralList = "insert into CAFTER_TABLE(ID,\n" +
"ACARNO,\n" +
@ -426,7 +419,7 @@ public class ApponintmentInfoServiceImpl implements AppointmentInfoService {
"INTEGRATIONLISTID,\n" +
"ORDERID) values (\n" +
" (select COALESCE(max(t.ID),0)+1 from CAFTER_TABLE t),''," +
"" + userIdNew + ",to_date('" + rollbackTime + "','yyyy-MM-dd HH24:mi:ss'),'" + operatorId + "','SUCCESS'," + (maxId + 1) + ",'" + operatorId + "'" +
"" + userIdNew + ",to_date('" + rollbackTime + "','yyyy-MM-dd HH24:mi:ss'),'" + jobNumber + "','SUCCESS'," + (maxId + 1) + ",'" + operatorId + "'" +
")";
if ("4".equals(DBType)) {
sqlIntegralList = "insert into CAFTER_TABLE(ID,\n" +
@ -438,11 +431,11 @@ public class ApponintmentInfoServiceImpl implements AppointmentInfoService {
"INTEGRATIONLISTID,\n" +
"ORDERID) values (\n" +
" (select COALESCE(max(t.ID),0)+1 from CAFTER_TABLE t),''," +
"" + userIdNew + ",str_to_date('" + rollbackTime + "','%Y-%m-%d %H:%i:%s'),'" + operatorId + "','SUCCESS'," + (maxId + 1) + ",'" + operatorId + "'" +
"" + userIdNew + ",str_to_date('" + rollbackTime + "','%Y-%m-%d %H:%i:%s'),'" + jobNumber + "','SUCCESS'," + (maxId + 1) + ",'" + jobNumber + "'" +
")";
}
this.mapperI.insert(sqlIntegralList);
LogUtil.WriteLog_Info("积分核减=====消费记录已插入", "QCodeInfoServiceImpl");
LogUtil.WriteLog_Info("积分核减=====消费记录已插入", "ApponintmentInfoServiceImpl");
// }
String currentDate1 = PubTools.getCurrentDateNoStr().replace("-","").trim()+PubTools.getlinkNo();
String sqlTemp2 = "insert into APPOINTMENT_INFO_TABLE(ID,USERID,ACARNO,APPOINTMENTTYPE,APPOINTMENTTIME,APPOINTMENTLINEID,CREATETIME,SERVICEAREAID,MEALS,MEALSCOUNT,COMPLETESTATUS,INTEGRATIONLISTID,SERVICEOPERATIONID,TOTALINTEGRAL,ORDERID) " +
@ -475,12 +468,13 @@ public class ApponintmentInfoServiceImpl implements AppointmentInfoService {
enabledIntegral = PubTools.doubleSave1(enabledTICp / 100) + "";
retJo.put("ENABLEINTEGRATION", enabledIntegral);
retJo.put("ORDERID", currentDate1);
LogUtil.WriteLog_Info("用户更新可用积分完成", "QCodeInfoServiceImpl");
LogUtil.WriteLog_Info("用户更新可用积分完成", "ApponintmentInfoServiceImpl");
}
//发送消息
String integralTypePu = "餐饮预约";
String consumeIntegral = rebateIntegrateSave + "";
LogUtil.WriteLog_Info("餐饮预约积分核减已完成=====" + PubTools.getCurrentDate(), "ApponintmentInfoServiceImpl");
String integralTypePu = "餐饮预约";
this.messagePushServiceImpl.pushMsg(openId, integralTypePu, "-" + consumeIntegral, enabledIntegral);
//}
}else{
@ -660,9 +654,30 @@ public class ApponintmentInfoServiceImpl implements AppointmentInfoService {
}
content= dataStr+"|"+ rebateIntegrateTStr +"|"+resStr;
// content= dateTimes+"|" +serialsT +"|"+rebateIntegrateT+"|"+res;
LogUtil.WriteLog_Info("用户:"+openId+"---->核销积分类型"+integrateType+"生成的流水号======"+content,"QCodeInfoServiceImpl");
LogUtil.WriteLog_Info("用户:" + openId + "---->核销积分类型" + integrateType + "生成的流水号======" + content, "ApponintmentInfoServiceImpl");
Consistant.map.put(content,jo);
return content;
}
/**
* O
*/
public void updateCompleteStastus() {
String selStr = "select t.id FROM APPOINTMENT_INFO_TABLE t WHERE t.COMPLETESTATUS='N'";
String sql = "update APPOINTMENT_INFO_TABLE set COMPLETESTATUS='O' WHERE COMPLETESTATUS='N'";
if ("2".equals(DBType)) {
selStr += " and t.APPOINTMENTTIME <to_date('" + PubTools.getCurrentDateYYD() + "','yyyy-MM-dd')";
sql += " and APPOINTMENTTIME <to_date('" + PubTools.getCurrentDateYYD() + "','yyyy-MM-dd')";
}
if ("4".equals(DBType)) {
selStr += " and t.APPOINTMENTTIME <str_to_date('" + PubTools.getCurrentDateYYD() + "','%Y-%m-%d')";
sql += " and APPOINTMENTTIME <str_to_date('" + PubTools.getCurrentDateYYD() + "','%Y-%m-%d')";
}
List selectforlist = this.mapperI.selectforlist(selStr);
if (selectforlist != null && selectforlist.size() > 0 && !PubTools.isEmpty(selectforlist.get(0))) {
this.mapperI.update(sql);
}
}
}

@ -6,6 +6,7 @@ import com.nmgs.service.IntegralLevelMessageService;
import com.nmgs.util.LogUtil;
import com.nmgs.util.PropertiesUtil;
import com.nmgs.util.PubTools;
import com.nmgs.util.SensitiveFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -16,6 +17,8 @@ public class IntegralLevelMessageServiceImpl implements IntegralLevelMessageServ
@Autowired
public Mapper mapperI;
private static String DBType=PropertiesUtil.getValue("DBType");
@Autowired
SensitiveFilter sensitiveFilter;
private static String sql="SELECT ilt.ID,\n" +
"ilt.POSITION,\n" +
"ilt.MESSAGE,\n" +
@ -67,6 +70,9 @@ public class IntegralLevelMessageServiceImpl implements IntegralLevelMessageServ
int ret=1;
try{
String currentDate=PubTools.getCurrentDate();
message = sensitiveFilter.replaceSensitiveWord(message);
String sql="insert into INTEGRAL_LEAVEMESSAGE_TABLE(ID,USERID,POSITION,MESSAGE,CREATETIME,REPLYSTATUS) " +
" values((SELECT NVL(MAX(ID),0)+1 FROM INTEGRAL_LEAVEMESSAGE_TABLE ),(SELECT ID FROM WEIXN_USER_TABLE WHERE OPENID='"+userId+"'),'"+positon+"','"+message+"',to_date('"+currentDate+"','YYYY-MM-DD HH24:MI:SS'),'N') ";
if("4".equals(DBType)) {

@ -49,7 +49,7 @@ public class MessagePushServiceImpl {
url = map.get("BAK3").toString();
}
if (!PubTools.isNull(templete_id) && !PubTools.isNull(page) && !PubTools.isNull(url)) {
LogUtil.WriteLog_Info("小程序消息推送接口执行===templete_id===" + templete_id + "=====page===" + page + "====url===" + url, "QCodeInfoServiceImpl");
LogUtil.WriteLog_Info("小程序消息推送接口执行===templete_id===" + templete_id + "=====page===" + page + "====url===" + url, "MessagePushServiceImpl");
HttpParamDto dto = new HttpParamDto(integralType, PubTools.getCurrentDate(), consumeIntegral, enabledIntegral, "进入小程序查看积分详情。");
dto.setTemplate_id(templete_id);
dto.setPage(page);
@ -59,16 +59,16 @@ public class MessagePushServiceImpl {
String retCode = retJo.get("code").toString();
if (!"200".equals(retCode)) {
Object message = retJo.get("message");
LogUtil.WriteLog_Error("小程序消息推送接口执行失败===code===" + retCode + "=====message===" + message, "QCodeInfoServiceImpl");
LogUtil.WriteLog_Error("小程序消息推送接口执行失败===code===" + retCode + "=====message===" + message, "MessagePushServiceImpl");
}
}
System.out.println(s);
} else {
LogUtil.WriteLog_Error("小程序消息推送接口未配置", "QCodeInfoServiceImpl");
LogUtil.WriteLog_Error("小程序消息推送接口未配置", "MessagePushServiceImpl");
}
System.out.println("更新任务线程,线程名:" + Thread.currentThread().getName());
} catch (Exception e) {
LogUtil.WriteLog_Error("小程序消息推送接口报错====" + e.getMessage(), "QCodeInfoServiceImpl");
LogUtil.WriteLog_Error("小程序消息推送接口报错====" + e.getMessage(), "MessagePushServiceImpl");
}
}
}

@ -39,6 +39,7 @@ public class SerivceAreaOperationMealServiceImpl {
if(!PubTools.isNull(jobNumber)){
sqlTemp += " and saot.JOBNUMBER = '"+jobNumber+"'";
}
sqlTemp += " order by saom.MEALNAME";
list= this.mapperI.selectforlist(sqlTemp);
if(list != null && list.size()>0){
for(Object obj:list){
@ -67,4 +68,41 @@ public class SerivceAreaOperationMealServiceImpl {
}
return retList;
}
public List getMealInfoById( String mealIds) {
List list=null;
String sqlTemp=sql;
List retList=new ArrayList();
try{
if(!PubTools.isNull(mealIds)){
sqlTemp += " and saom.ID in( "+mealIds+")";
}
list= this.mapperI.selectforlist(sqlTemp);
if(list != null && list.size()>0){
for(Object obj:list){
Map<String, Object> obj1 = (Map<String, Object>) obj;
Object o=obj1.get("MEALPIC");
if(!PubTools.isEmpty(o)){
String s = PubTools.ClobToString( o);
if(!PubTools.isNull(s)){
obj1.remove("MEALPIC");
obj1.put("MEALPIC",s);
}else{
obj1.remove("MEALPIC");
obj1.put("MEALPIC","");
}
}else{
obj1.put("MEALPIC","");
}
retList.add(obj1);
}
}else{
retList=list;
}
}catch (Exception e){
LogUtil.WriteLog_Error("根据套餐ID查询套餐列表失败===>"+e.getMessage(),"ServiceAreaServiceImpl");
return retList=null;
}
return retList;
}
}

@ -245,7 +245,7 @@ static{
" case when oper.OPEN=0 then '暂停服务' else '营业中' end AS OPENNAME,\n" +
//" oper.PASSWORD,\n" +
// " r.VALUE as roleName,\n" +
" area.AREANAME as serviceAreaName\n" +
" area.AREANAME as SERVICEAREANAME" +
" FROM\n" +
" service_area_operators_table oper\n" +
" LEFT JOIN service_area_table area on area.ID = oper.SERVICEAREAID\n" +

@ -122,7 +122,7 @@ public class UserTableServiceImpl implements UserTableService {
try{
//图片加水印
if(!PubTools.isNull(numberPic)){
String permitpicPic = ImageUtils.addImageWaterMark(numberPic, "仅用于内蒙古交通货运车辆积分会员认证");
String permitpicPic = ImageUtils.addImageWaterMark(numberPic, "仅用于内蒙古交通货运车辆积分会员认证", userId + "NUMPIC" + ".jpg");
if(!PubTools.isNull(permitpicPic)){
numberPic=permitpicPic;
}
@ -131,12 +131,37 @@ public class UserTableServiceImpl implements UserTableService {
numberPic=PubTools.StringToClob(numberPic);
}
String sql="update WEIXN_USER_TABLE " +
" set REALNAME='"+realName+"',IDNUMBER='"+idNumber+"',PHONE='"+phone+"',NUMBERPIC="+numberPic+",CERTIFICATION=2 "+
" where OPENID='"+userId+"'";
" set CERTIFICATION=2 ";
if (!PubTools.isNull(realName)) {
sql += ",REALNAME='" + realName + "'";
}
if (!PubTools.isNull(idNumber) && !idNumber.contains("*")) {
sql += ",IDNUMBER='" + idNumber + "'";
}
if (!PubTools.isNull(phone)) {
sql += ",PHONE='" + phone + "'";
}
if (!PubTools.isNull(numberPic)) {
sql += ",NUMBERPIC=" + numberPic + "";
}
sql += " where OPENID='" + userId + "'";
if("4".equals(DBType)){
sql="update WEIXN_USER_TABLE " +
" set REALNAME='"+realName+"',IDNUMBER='"+idNumber+"',PHONE='"+phone+"',NUMBERPIC='"+numberPic+"',CERTIFICATION=2 "+
" where OPENID='"+userId+"'";
" set CERTIFICATION=2 ";
if (!PubTools.isNull(realName)) {
sql += ",REALNAME='" + realName + "'";
}
if (!PubTools.isNull(idNumber) && !idNumber.contains("*")) {
sql += ",IDNUMBER='" + idNumber + "'";
}
if (!PubTools.isNull(phone)) {
sql += ",PHONE='" + phone + "'";
}
if (!PubTools.isNull(numberPic)) {
sql += ",NUMBERPIC='" + numberPic + "'";
}
sql += " where OPENID='" + userId + "'";
}
ret=this.mapperI.update(sql);

@ -248,7 +248,7 @@ public class UserVehicleServiceImpl implements UserVehicleService {
try{
//图片加水印
if(!PubTools.isNull(permitpic)){
String permitpicPic = ImageUtils.addImageWaterMark(permitpic, "仅用于内蒙古交通货运车辆积分会员认证");
String permitpicPic = ImageUtils.addImageWaterMark(permitpic, "仅用于内蒙古交通货运车辆积分会员认证", userId + aCarNo + "per.jpg");
if(!PubTools.isNull(permitpicPic)){
permitpic=permitpicPic;
}
@ -262,7 +262,7 @@ public class UserVehicleServiceImpl implements UserVehicleService {
}
//图片加水印
if(!PubTools.isNull(licensepic)){
String permitpicPic = ImageUtils.addImageWaterMark(licensepic, "仅用于内蒙古交通货运车辆积分会员认证");
String permitpicPic = ImageUtils.addImageWaterMark(licensepic, "仅用于内蒙古交通货运车辆积分会员认证", userId + aCarNo + "lic.jpg");
if(!PubTools.isNull(permitpicPic)){
licensepic=permitpicPic;
}
@ -277,7 +277,7 @@ public class UserVehicleServiceImpl implements UserVehicleService {
}
//图片加水印
if(!PubTools.isNull(vehiclePic)){
String permitpicPic = ImageUtils.addImageWaterMark(vehiclePic, "仅用于内蒙古交通货运车辆积分会员认证");
String permitpicPic = ImageUtils.addImageWaterMark(vehiclePic, "仅用于内蒙古交通货运车辆积分会员认证", userId + aCarNo + "veh.jpg");
if(!PubTools.isNull(permitpicPic)){
vehiclePic=permitpicPic;
}
@ -291,16 +291,43 @@ public class UserVehicleServiceImpl implements UserVehicleService {
}
String sql="update user_vehicle_table "+
" set LICENSEPIC="+licensepic+",PERMITPIC="+permitpic+",VEHICLEPIC="+vehiclePic+", "+
" CERTIFICATION="+certification+",REFERRERCODE='"+referrerCode+"',"+
" CHECKUSERNAME='"+checkName+"',CHECKUSERNUMBER='"+checkUserNumber+"'"+
" where USERID="+userId+" and ACARNO='"+aCarNo+"' AND CERTIFICATION not in(4)";
" set LICENSEPIC=" + licensepic + ",PERMITPIC=" + permitpic + ",VEHICLEPIC=" + vehiclePic + " ";
if (!PubTools.isNull(certification)) {
sql += ",CERTIFICATION=" + certification;
}
if (!PubTools.isNull(referrerCode)) {
sql += ",REFERRERCODE='" + referrerCode + "'";
}
if (!PubTools.isNull(checkName)) {
sql += ",CHECKUSERNAME='" + checkName + "'";
}
if (!PubTools.isNull(checkUserNumber) && !checkUserNumber.contains("*")) {
sql += ",CHECKUSERNUMBER='" + checkUserNumber + "'";
}
if (!PubTools.isNull(referrerCode)) {
sql += ",REFERRERCODE='" + referrerCode + "'";
}
sql += " where USERID=" + userId + " and ACARNO='" + aCarNo + "' AND CERTIFICATION not in(4)";
if("4".equals(DBType)){
sql="update user_vehicle_table "+
" set LICENSEPIC='"+licensepic+"',PERMITPIC='"+permitpic+"',VEHICLEPIC='"+vehiclePic+"', "+
" CERTIFICATION="+certification+",REFERRERCODE='"+referrerCode+"',"+
" CHECKUSERNAME='"+checkName+"',CHECKUSERNUMBER='"+checkUserNumber+"'"+
" where USERID="+userId+" and ACARNO='"+aCarNo+"' AND CERTIFICATION not in(4)";
" set LICENSEPIC='" + licensepic + "',PERMITPIC='" + permitpic + "',VEHICLEPIC='" + vehiclePic + "'";
if (!PubTools.isNull(certification)) {
sql += ",CERTIFICATION=" + certification;
}
if (!PubTools.isNull(referrerCode)) {
sql += ",REFERRERCODE='" + referrerCode + "'";
}
if (!PubTools.isNull(checkName)) {
sql += ",CHECKUSERNAME='" + checkName + "'";
}
if (!PubTools.isNull(checkUserNumber) && !checkUserNumber.contains("*")) {
sql += ",CHECKUSERNUMBER='" + checkUserNumber + "'";
}
if (!PubTools.isNull(referrerCode)) {
sql += ",REFERRERCODE='" + referrerCode + "'";
}
sql += " where USERID=" + userId + " and ACARNO='" + aCarNo + "' AND CERTIFICATION not in(4)";
}
this.mapperI.insert(sql);
}catch (Exception e){

File diff suppressed because one or more lines are too long

@ -48,13 +48,13 @@ public class PathUtil {
isWin = true;
// TomcatPath = System.getProperty("user.dir").substring(0, System.getProperty("user.dir").lastIndexOf('\\'));
webappsPath = TomcatPath + "\\webapps";
uploadPath = TomcatPath + "\\uploadfiles";
uploadPath = TomcatPath + "\\integralFile";
uploadWarPath = TomcatPath + "\\taskWarFiles\\uploadWarFile";
downloadWarPath = TomcatPath + "\\taskWarFiles\\downloadWarFile";
webPath = webPath.substring(1, webPath.length()) + webName;
} else {
webappsPath = TomcatPath + "/webapps";
uploadPath = TomcatPath + "/uploadfiles";
uploadPath = TomcatPath + "/integralFile";
uploadWarPath = TomcatPath + "/taskWarFiles/uploadWarFile";
downloadWarPath = TomcatPath + "/taskWarFiles/downloadWarFile";
webPath = webPath + webName;

@ -17,6 +17,8 @@ public class PubTools {
static SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
static SimpleDateFormat dfYYD=new SimpleDateFormat("yyyy-MM-dd");
/**
*
* yyp 20190305
@ -212,13 +214,17 @@ public class PubTools {
public static void main(String[] args) {
System.out.println(getCurrentDateNoStr());
}
public static String ClobToString(Object clob) throws Exception {
public static String ClobToString(Object clob) {
String reString = "";
try{
if(clob instanceof CLOB){
reString = ((CLOB)clob).getSubString((long) 1, (int) ((CLOB)clob).length());
}else if(clob instanceof Blob){
reString = clob.toString();
}
}catch (Exception e){
reString="";
}
return reString;
}
}

@ -0,0 +1,165 @@
package com.nmgs.util;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
@Component
public class SensitiveFilter {
/**
* DFA
*/
private Map sensitiveWordMap = null;
/**
* ["中国","中国人"]"我是中国人"[]
*/
public static int minMatchType = 1;
/**
* ["中国","中国人"]"我是中国人"[]
*/
public static int maxMatchType = 2;
/**
*
*/
public static String placeHolder = "*";
// 单例
private static SensitiveFilter instance = null;
/**
*
*/
private SensitiveFilter() throws IOException {
sensitiveWordMap = new WordInit().initKeyWord();
}
/**
*
*/
public static SensitiveFilter getInstance() throws IOException {
if (null == instance) {
instance = new SensitiveFilter();
}
return instance;
}
/**
*
*/
public Set<String> getSensitiveWord(String txt, int matchType) {
Set<String> sensitiveWordList = new HashSet<>();
for (int i = 0; i < txt.length(); i++) {
// 判断是否包含敏感字符
int length = CheckSensitiveWord(txt, i, matchType);
// 存在,加入list中
if (length > 0) {
sensitiveWordList.add(txt.substring(i, i + length));
// 减1的原因是因为for会自增
i = i + length - 1;
}
}
return sensitiveWordList;
}
/**
* ,使
*/
public String replaceSensitiveWord(String txt) {
return replaceSensitiveWord(txt, minMatchType ,placeHolder);
}
/**
* ,使
*/
public String replaceSensitiveWord(String txt, int matchType) {
return replaceSensitiveWord(txt, matchType,placeHolder);
}
/**
*
*/
public String replaceSensitiveWord(String txt, int matchType,
String replaceChar) {
String resultTxt = txt;
// 获取所有的敏感词
Set<String> set = getSensitiveWord(txt, matchType);
Iterator<String> iterator = set.iterator();
String word = null;
String replaceString = null;
while (iterator.hasNext()) {
word = iterator.next();
replaceString = getReplaceChars(replaceChar, word.length());
resultTxt = resultTxt.replaceAll(word, replaceString);
}
return resultTxt;
}
/**
*
*/
private String getReplaceChars(String replaceChar, int length) {
StringBuilder resultReplace = new StringBuilder(replaceChar);
for (int i = 1; i < length; i++) {
resultReplace.append(replaceChar);
}
return resultReplace.toString();
}
/**
* <br>
* 0
*
*/
public int CheckSensitiveWord(String txt, int beginIndex, int matchType) {
// 敏感词结束标识位用于敏感词只有1的情况结束
boolean flag = false;
// 匹配标识数默认为0
int matchFlag = 0;
Map nowMap = sensitiveWordMap;
for (int i = beginIndex; i < txt.length(); i++) {
char word = txt.charAt(i);
// 获取指定key
nowMap = (Map) nowMap.get(word);
// 存在,则判断是否为最后一个
if (nowMap != null) {
// 找到相应key匹配标识+1
matchFlag++;
// 如果为最后一个匹配规则,结束循环,返回匹配标识数
if ("1".equals(nowMap.get("isEnd"))) {
// 结束标志位为true
flag = true;
// 最小规则,直接返回,最大规则还需继续查找
if (SensitiveFilter.minMatchType == matchType) {
break;
}
}
}
// 不存在,直接返回
else {
break;
}
}
// 匹配长度如果匹配上了最小匹配长度或者最大匹配长度
if (SensitiveFilter.maxMatchType == matchType || SensitiveFilter.minMatchType == matchType){
//长度必须大于等于1为词或者敏感词库还没有结束(匹配了一半)flag为false
if(matchFlag < 2 || !flag){
matchFlag = 0;
}
}
return matchFlag;
}
public static void main(String[] args) throws IOException {
SensitiveFilter sensitiveFilter =new SensitiveFilter();
String s = sensitiveFilter.replaceSensitiveWord("你大爷");
System.out.println(s);
}
}

@ -0,0 +1,85 @@
package com.nmgs.util;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
@Configuration
public class WordInit {
// 字符编码
private String ENCODING = "UTF-8";
// 初始化敏感字库
public Map initKeyWord() throws IOException {
// 读取敏感词库 ,存入Set中
Set<String> wordSet = readSensitiveWordFile();
// 将敏感词库加入到HashMap中//确定有穷自动机DFA
return addSensitiveWordToHashMap(wordSet);
}
// 读取敏感词库 ,存入HashMap中
private Set<String> readSensitiveWordFile() throws IOException {
Set<String> wordSet = null;
ClassPathResource classPathResource = new ClassPathResource("static/Sensitive.txt");
InputStream inputStream = classPathResource.getInputStream();
//敏感词库
try {
// 读取文件输入流
InputStreamReader read = new InputStreamReader(inputStream, ENCODING);
// 文件是否是文件 和 是否存在
wordSet = new HashSet<String>();
// StringBuffer sb = new StringBuffer();
// BufferedReader是包装类先把字符读到缓存里到缓存满了再读入内存提高了读的效率。
BufferedReader br = new BufferedReader(read);
String txt = null;
// 读取文件将文件内容放入到set中
while ((txt = br.readLine()) != null) {
wordSet.add(txt);
}
br.close();
// 关闭文件流
read.close();
} catch (Exception e) {
e.printStackTrace();
}
return wordSet;
}
// 将HashSet中的敏感词,存入HashMap中
private Map addSensitiveWordToHashMap(Set<String> wordSet) {
// 初始化敏感词容器,减少扩容操作
Map wordMap = new HashMap(wordSet.size());
for (String word : wordSet) {
Map nowMap = wordMap;
for (int i = 0; i < word.length(); i++) {
// 转换成char型
char keyChar = word.charAt(i);
// 获取
Object tempMap = nowMap.get(keyChar);
// 如果存在该key直接赋值
if (tempMap != null) {
nowMap = (Map) tempMap;
}
// 不存在则则构建一个map同时将isEnd设置为0因为他不是最后一个
else {
// 设置标志位
Map<String, String> newMap = new HashMap<String, String>();
newMap.put("isEnd", "0");
// 添加到集合
nowMap.put(keyChar, newMap);
nowMap = newMap;
}
// 最后一个
if (i == word.length() - 1) {
nowMap.put("isEnd", "1");
}
}
}
return wordMap;
}
}

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save