Commit 5164814b by 吴迪

【新增】新增接口

parent 0c0d5523
package io.office.modules.manage.controller;
import java.util.Arrays;
import java.util.Map;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import io.office.modules.manage.entity.FirmEntity;
import io.office.modules.manage.service.FirmService;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-11-29 18:30:59
*/
@RestController
@RequestMapping("/firm")
public class FirmController {
@Autowired
private FirmService firmService;
/**
* 列表
*/
@RequestMapping("/list")
// @RequiresPermissions("manage:firm:list")
public R list(@RequestParam Map<String, Object> params){
PageUtils page = firmService.queryPage(params);
return R.ok().put("page", page);
}
/**
* 信息
*/
@RequestMapping("/info/{fId}")
// @RequiresPermissions("manage:firm:info")
public R info(@PathVariable("fId") Integer fId){
FirmEntity firm = firmService.getById(fId);
return R.ok().put("firm", firm);
}
/**
* 保存
*/
@RequestMapping("/save")
// @RequiresPermissions("manage:firm:save")
public R save(@RequestBody FirmEntity firm){
firmService.save(firm);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
// @RequiresPermissions("manage:firm:update")
public R update(@RequestBody FirmEntity firm){
firmService.updateById(firm);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
// @RequiresPermissions("manage:firm:delete")
public R delete(@RequestBody Integer[] fIds){
firmService.removeByIds(Arrays.asList(fIds));
return R.ok();
}
}
...@@ -4,9 +4,13 @@ import io.office.common.utils.IPUtils; ...@@ -4,9 +4,13 @@ import io.office.common.utils.IPUtils;
import io.office.common.utils.R; import io.office.common.utils.R;
import io.office.modules.app.annotation.Login; import io.office.modules.app.annotation.Login;
import io.office.modules.manage.entity.SearchgtinlogEntity; import io.office.modules.manage.entity.SearchgtinlogEntity;
import io.office.modules.manage.service.FirmService;
import io.office.modules.manage.service.SearchgtinlogService; import io.office.modules.manage.service.SearchgtinlogService;
import io.office.modules.manage.utils.ESSearchUtils;
import io.office.modules.manage.utils.GLNSearchUtils; import io.office.modules.manage.utils.GLNSearchUtils;
import io.office.modules.manage.utils.UploadUtils; import io.office.modules.manage.utils.UploadUtils;
import io.office.modules.manage.vo.request.DomesticCodeDetailRequest;
import io.office.modules.manage.vo.request.DomesticCodeVo;
import io.office.modules.manage.vo.request.GLNRequestBo; import io.office.modules.manage.vo.request.GLNRequestBo;
import io.office.modules.sys.service.SysCaptchaService; import io.office.modules.sys.service.SysCaptchaService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -32,15 +36,17 @@ public class GLNController { ...@@ -32,15 +36,17 @@ public class GLNController {
private SysCaptchaService sysCaptchaService; private SysCaptchaService sysCaptchaService;
@Autowired @Autowired
private SearchgtinlogService searchgtinlogService; private SearchgtinlogService searchgtinlogService;
@Autowired
private FirmService firmService;
@Login @Login
@PostMapping("/api/gln") @PostMapping("/api/gln")
public R uploadFile(@RequestBody GLNRequestBo glnRequestBo, HttpServletRequest request) { public R uploadFile(@RequestBody GLNRequestBo glnRequestBo, HttpServletRequest request) {
boolean captcha = sysCaptchaService.validate(glnRequestBo.getUuid(), glnRequestBo.getCaptcha());
/* boolean captcha = sysCaptchaService.validate(glnRequestBo.getUuid(), glnRequestBo.getCaptcha());
if(!captcha){ if(!captcha){
return R.error("验证码不正确"); return R.error("验证码不正确");
}*/ }
SearchgtinlogEntity searchgtinlogEntity = new SearchgtinlogEntity(); SearchgtinlogEntity searchgtinlogEntity = new SearchgtinlogEntity();
searchgtinlogEntity.setCreatedate(new Date()); searchgtinlogEntity.setCreatedate(new Date());
searchgtinlogEntity.setIp(IPUtils.getIpAddr(request)); searchgtinlogEntity.setIp(IPUtils.getIpAddr(request));
...@@ -56,4 +62,77 @@ public class GLNController { ...@@ -56,4 +62,77 @@ public class GLNController {
return R.ok().put("data",GLNSearchUtils.getGLNResult("9","GLN",glnRequestBo.getCode(),glnRequestBo.getRequestedLanguage())); return R.ok().put("data",GLNSearchUtils.getGLNResult("9","GLN",glnRequestBo.getCode(),glnRequestBo.getRequestedLanguage()));
} }
/**
* 境内码接口
* @param domesticCodeVo
* @param request
* @return
*/
@Login
@PostMapping("/api/domesticCode")
public R domesticCode(@RequestBody DomesticCodeVo domesticCodeVo, HttpServletRequest request) {
boolean captcha = sysCaptchaService.validate(domesticCodeVo.getUuid(), domesticCodeVo.getCaptcha());
if(!captcha){
return R.error("验证码不正确");
}
SearchgtinlogEntity searchgtinlogEntity = new SearchgtinlogEntity();
searchgtinlogEntity.setCreatedate(new Date());
searchgtinlogEntity.setIp(IPUtils.getIpAddr(request));
if(domesticCodeVo.getType().equals("1")) {
searchgtinlogEntity.setClassStr("境内条码查询:厂商识别代码查询");
} else if(domesticCodeVo.getType().equals("2")){
searchgtinlogEntity.setClassStr("境内条码查询:厂商名称查询");
} else if(domesticCodeVo.getType().equals("3")){
searchgtinlogEntity.setClassStr("境内条码查询:厂商地址查询");
}
searchgtinlogEntity.setKeyword(domesticCodeVo.getCode());
searchgtinlogEntity.setSearchsource(0);
//新增查询日志
searchgtinlogService.save(searchgtinlogEntity);
if(domesticCodeVo.getType().equals("1")) {
return R.ok().put("data", ESSearchUtils.getInfoByCode(searchgtinlogEntity.getKeyword()));
} else if(domesticCodeVo.getType().equals("2")){
return R.ok().put("data", ESSearchUtils.getInfoByName(searchgtinlogEntity.getKeyword()));
} else if(domesticCodeVo.getType().equals("3")){
return R.ok().put("data", ESSearchUtils.getInfoByAddress(searchgtinlogEntity.getKeyword()));
}
return R.error("参数不合法");
}
/**
* 境内码详情
* @param domesticCodeDetailRequest
* @param request
* @return
*/
@Login
@PostMapping("/api/domesticCodeDetail")
public R domesticCodeDetail(@RequestBody DomesticCodeDetailRequest domesticCodeDetailRequest, HttpServletRequest request) {
return R.ok().put("data",firmService.getDetail(domesticCodeDetailRequest));
}
/**
* 查看变更记录
* @param domesticCodeDetailRequest
* @param request
* @return
*/
@Login
@PostMapping("/api/domesticCodeUpdateList")
public R domesticCodeUpdateList(@RequestBody DomesticCodeDetailRequest domesticCodeDetailRequest, HttpServletRequest request) {
return R.ok().put("data",firmService.domesticCodeUpdateList(domesticCodeDetailRequest.getCode()));
}
} }
...@@ -97,4 +97,8 @@ public class GlossaryController extends AbstractController { ...@@ -97,4 +97,8 @@ public class GlossaryController extends AbstractController {
return R.ok("术语删除成功!"); return R.ok("术语删除成功!");
} }
} }
package io.office.modules.manage.controller; package io.office.modules.manage.controller;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date;
import java.util.Map; import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.office.common.utils.IPUtils;
import io.office.modules.app.annotation.Login; import io.office.modules.app.annotation.Login;
import io.office.modules.manage.entity.SearchgtinlogEntity;
import io.office.modules.manage.entity.ShortCodeEntity; import io.office.modules.manage.entity.ShortCodeEntity;
import io.office.modules.manage.service.SearchgtinlogService;
import io.office.modules.manage.service.ShortCodeService; import io.office.modules.manage.service.ShortCodeService;
import io.office.modules.manage.vo.request.ShortCodeVo; import io.office.modules.manage.vo.request.ShortCodeVo;
import io.office.modules.sys.service.SysCaptchaService;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
...@@ -18,6 +24,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -18,6 +24,7 @@ import org.springframework.web.bind.annotation.RestController;
import io.office.common.utils.PageUtils; import io.office.common.utils.PageUtils;
import io.office.common.utils.R; import io.office.common.utils.R;
import javax.servlet.http.HttpServletRequest;
/** /**
...@@ -32,6 +39,11 @@ import io.office.common.utils.R; ...@@ -32,6 +39,11 @@ import io.office.common.utils.R;
public class ShortCodeController { public class ShortCodeController {
@Autowired @Autowired
private ShortCodeService shortCodeService; private ShortCodeService shortCodeService;
@Autowired
private SearchgtinlogService searchgtinlogService;
@Autowired
private SysCaptchaService sysCaptchaService;
/** /**
* 列表 * 列表
...@@ -93,9 +105,31 @@ public class ShortCodeController { ...@@ -93,9 +105,31 @@ public class ShortCodeController {
@Login @Login
@RequestMapping("/api/getList") @RequestMapping("/api/getList")
// @RequiresPermissions("manage:shortcode:delete") // @RequiresPermissions("manage:shortcode:delete")
public R getList(@RequestBody ShortCodeVo shortCodeVo){ public R getList(@RequestBody ShortCodeVo shortCodeVo, HttpServletRequest request){
boolean captcha = sysCaptchaService.validate(shortCodeVo.getUuid(), shortCodeVo.getCaptcha());
if(!captcha){
return R.error("验证码不正确");
}
SearchgtinlogEntity searchgtinlogEntity = new SearchgtinlogEntity();
searchgtinlogEntity.setCreatedate(new Date());
searchgtinlogEntity.setIp(IPUtils.getIpAddr(request));
if(StringUtils.isNotBlank(shortCodeVo.getShortCode())) {
searchgtinlogEntity.setKeyword(shortCodeVo.getShortCode());
searchgtinlogEntity.setClassStr("缩短码查询:缩短码查询");
}
if(StringUtils.isNotBlank(shortCodeVo.getFirmName())) {
searchgtinlogEntity.setKeyword(shortCodeVo.getFirmName());
searchgtinlogEntity.setClassStr("缩短码查询:厂商名称查询");
}
if(StringUtils.isNotBlank(shortCodeVo.getRegisterAddress())) {
searchgtinlogEntity.setKeyword(shortCodeVo.getRegisterAddress());
searchgtinlogEntity.setClassStr("缩短码查询:厂商地址查询");
}
searchgtinlogEntity.setSearchsource(0);
//新增查询日志
searchgtinlogService.save(searchgtinlogEntity);
return R.ok().put("data",shortCodeService.getList(shortCodeVo)); return R.ok().put("data",shortCodeService.getList(shortCodeVo));
} }
......
package io.office.modules.manage.dao;
import io.office.modules.manage.entity.FirmEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.office.modules.manage.vo.request.DomesticCodeDetailRequest;
import io.office.modules.manage.vo.response.DomesticCodeDetailVo;
import io.office.modules.manage.vo.response.DomesticCodeResponse;
import io.office.modules.manage.vo.response.DomesticCodeUpdateResponse;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-11-29 18:30:59
*/
@Mapper
public interface FirmDao extends BaseMapper<FirmEntity> {
DomesticCodeDetailVo getDetail(DomesticCodeDetailRequest domesticCodeDetailRequest);
DomesticCodeUpdateResponse domesticCodeUpdateList(@Param(value = "firmId") String firmId);
}
package io.office.modules.manage.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.math.BigDecimal;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-11-29 18:30:59
*/
@Data
@TableName("firm")
public class FirmEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* $column.comments
*/
@TableId
private Integer fId;
/**
* $column.comments
*/
private Date loginDate;
/**
* $column.comments
*/
private String dm;
/**
* $column.comments
*/
private String tJDm;
/**
* $column.comments
*/
private String firmType;
/**
* $column.comments
*/
private String firmName;
/**
* $column.comments
*/
private String firmName1;
/**
* $column.comments
*/
private String registerAddress;
/**
* $column.comments
*/
private String registerAddress1;
/**
* $column.comments
*/
private String registerPostalcode;
/**
* $column.comments
*/
private String address;
/**
* $column.comments
*/
private String address1;
/**
* $column.comments
*/
private String postcode;
/**
* $column.comments
*/
private String certificateCode;
/**
* $column.comments
*/
private String political;
/**
* $column.comments
*/
private BigDecimal registerPrincipal;
/**
* $column.comments
*/
private String coinType;
/**
* $column.comments
*/
private String firmCode;
/**
* $column.comments
*/
private String leader;
/**
* $column.comments
*/
private String leaderTele;
/**
* $column.comments
*/
private String leaderHandset;
/**
* $column.comments
*/
private String contactman;
/**
* $column.comments
*/
private String tele;
/**
* $column.comments
*/
private String fax;
/**
* $column.comments
*/
private String email;
/**
* $column.comments
*/
private String netStation;
/**
* $column.comments
*/
private Integer wishusedNum;
/**
* $column.comments
*/
private Integer usedNum;
/**
* $column.comments
*/
private String branchCode;
/**
* $column.comments
*/
private String logoutFlag;
/**
* $column.comments
*/
private String inFlag;
}
package io.office.modules.manage.service;
import com.baomidou.mybatisplus.extension.service.IService;
import io.office.common.utils.PageUtils;
import io.office.modules.manage.entity.FirmEntity;
import io.office.modules.manage.vo.request.DomesticCodeDetailRequest;
import io.office.modules.manage.vo.response.DomesticCodeDetailVo;
import io.office.modules.manage.vo.response.DomesticCodeUpdateResponse;
import org.apache.ibatis.annotations.Param;
import java.util.Map;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-11-29 18:30:59
*/
public interface FirmService extends IService<FirmEntity> {
PageUtils queryPage(Map<String, Object> params);
DomesticCodeDetailVo getDetail(DomesticCodeDetailRequest domesticCodeDetailRequest);
DomesticCodeUpdateResponse domesticCodeUpdateList(String firmId);
}
package io.office.modules.manage.service.impl;
import io.office.modules.manage.vo.request.DomesticCodeDetailRequest;
import io.office.modules.manage.vo.response.DomesticCodeDetailVo;
import io.office.modules.manage.vo.response.DomesticCodeResponse;
import io.office.modules.manage.vo.response.DomesticCodeUpdateResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.office.common.utils.PageUtils;
import io.office.common.utils.Query;
import io.office.modules.manage.dao.FirmDao;
import io.office.modules.manage.entity.FirmEntity;
import io.office.modules.manage.service.FirmService;
@Service("firmService")
public class FirmServiceImpl extends ServiceImpl<FirmDao, FirmEntity> implements FirmService {
@Autowired
FirmDao firmDao;
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<FirmEntity> page = this.page(
new Query<FirmEntity>().getPage(params),
new QueryWrapper<FirmEntity>()
);
return new PageUtils(page);
}
@Override
public DomesticCodeDetailVo getDetail(DomesticCodeDetailRequest domesticCodeDetailRequest) {
return firmDao.getDetail(domesticCodeDetailRequest);
}
@Override
public DomesticCodeUpdateResponse domesticCodeUpdateList(String firmId) {
return firmDao.domesticCodeUpdateList(firmId.trim());
}
}
\ No newline at end of file
...@@ -33,7 +33,6 @@ public class ShortCodeServiceImpl extends ServiceImpl<ShortCodeDao, ShortCodeEnt ...@@ -33,7 +33,6 @@ public class ShortCodeServiceImpl extends ServiceImpl<ShortCodeDao, ShortCodeEnt
@Override @Override
public List<ShortCodeVo> getList(ShortCodeVo shortCodeVo) { public List<ShortCodeVo> getList(ShortCodeVo shortCodeVo) {
return baseMapper.getList(shortCodeVo); return baseMapper.getList(shortCodeVo);
} }
......
package io.office.modules.manage.utils;
import cn.hutool.json.JSONUtil;
import io.office.modules.manage.vo.response.DomesticCodeResponse;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;
/**
* 
 @description:
*
* @author wudi
* @date 16:40 2021/11/29
*/
public class ESSearchUtils {
private static final String ES_URL = "http://192.168.100.136:9200/ancc_search/_search";
public static DomesticCodeResponse getInfoByCode(String keyword) {
String addressTemplate = "{\n" +
"\t\"query\": {\n" +
"\t\t\"bool\": {\n" +
"\t\t\t\"must\": [{\n" +
"\t\t\t\t\"match\": {\n" +
"\t\t\t\t\t\"code\":\"${queryString}\"\n" +
"\t\t\t\t}\n" +
"\t\t\t}, {\n" +
"\t\t\t\t\"range\": {\n" +
"\t\t\t\t\t\"login_date\": {\n" +
"\t\t\t\t\t\t\"lt\":\""+DateUtils.getAfterDayDate("-3", "yyyy-MM-dd")+"\" \n" +
"\t\t\t\t\t}\n" +
"\t\t\t\t}\n" +
"\t\t\t}],\n" +
"\t\t\t\"must_not\": [{\n" +
"\t\t\t\t\"term\": {\n" +
"\t\t\t\t\t\"code\": \"6901234\"\n" +
"\t\t\t\t}\n" +
"\t\t\t}, {\n" +
"\t\t\t\t\"term\": {\n" +
"\t\t\t\t\t\"code\": \"69290200\"\n" +
"\t\t\t\t}\n" +
"\t\t\t}, {\n" +
"\t\t\t\t\"term\": {\n" +
"\t\t\t\t\t\"code\": \"6900000\"\n" +
"\t\t\t\t}\n" +
"\t\t\t}],\n" +
"\t\t\t\"should\": []\n" +
"\t\t}\n" +
"\t},\n" +
"\t\"from\": 0,\n" +
"\t\"size\": 10,\n" +
"\t\"sort\": [],\n" +
"\t\"aggs\": {}\n" +
"}";
String smsTemplateXml = addressTemplate.replaceAll("\\$\\{queryString\\}", keyword);
RestTemplate restTemplate = new RestTemplate();
//创建请求头
//创建请求头
HttpHeaders headers = new HttpHeaders();
headers.set("Content-Type", "application/json; charset=utf-8");
HttpEntity<String> entity = new HttpEntity<>(smsTemplateXml, headers);
System.out.println(smsTemplateXml);
ResponseEntity<String> responseEntity = restTemplate.postForEntity(ES_URL, entity, String.class);
if (responseEntity.getStatusCode().value() == 200) {
System.out.println(responseEntity.getBody());
return JSONUtil.toBean(responseEntity.getBody(), DomesticCodeResponse.class);
}
return null;
}
public static DomesticCodeResponse getInfoByName(String keyword) {
String nameTemplate = "{\n" +
"\t\"query\": {\n" +
"\t\t\"bool\": {\n" +
"\t\t\t\"must\": [{\n" +
"\t\t\t\t\"match\": {\n" +
"\t\t\t\t\t\"firm_name\": \"${queryString}\"\n" +
"\t\t\t\t}\n" +
"\t\t\t}, {\n" +
"\t\t\t\t\"range\": {\n" +
"\t\t\t\t\t\"login_date\": {\n" +
"\t\t\t\t\t\t\"lt\":\""+DateUtils.getAfterDayDate("-3", "yyyy-MM-dd")+"\"\n" +
"\t\t\t\t\t}\n" +
"\t\t\t\t}\n" +
"\t\t\t}],\n" +
"\t\t\t\"must_not\": [{\n" +
"\t\t\t\t\"term\": {\n" +
"\t\t\t\t\t\"code\": \"6901234\"\n" +
"\t\t\t\t}\n" +
"\t\t\t}, {\n" +
"\t\t\t\t\"term\": {\n" +
"\t\t\t\t\t\"code\": \"69290200\"\n" +
"\t\t\t\t}\n" +
"\t\t\t}, {\n" +
"\t\t\t\t\"term\": {\n" +
"\t\t\t\t\t\"code\": \"6900000\"\n" +
"\t\t\t\t}\n" +
"\t\t\t}],\n" +
"\t\t\t\"should\": []\n" +
"\t\t}\n" +
"\t},\n" +
"\t\"from\": 0,\n" +
"\t\"size\": 10,\n" +
"\t\"sort\": [],\n" +
"\t\"aggs\": {}\n" +
"}";
String smsTemplateXml = nameTemplate.replaceAll("\\$\\{queryString\\}", keyword);
RestTemplate restTemplate = new RestTemplate();
//创建请求头
//创建请求头
HttpHeaders headers = new HttpHeaders();
headers.set("Content-Type", "application/json; charset=utf-8");
HttpEntity<String> entity = new HttpEntity<>(smsTemplateXml, headers);
System.out.println(smsTemplateXml);
ResponseEntity<String> responseEntity = restTemplate.postForEntity(ES_URL, entity, String.class);
if (responseEntity.getStatusCode().value() == 200) {
System.out.println(responseEntity.getBody());
return JSONUtil.toBean(responseEntity.getBody(), DomesticCodeResponse.class);
}
return null;
}
public static DomesticCodeResponse getInfoByAddress(String keyword) {
String addressTemplate = "{\n" +
"\t\"query\": {\n" +
"\t\t\"bool\": {\n" +
"\t\t\t\"must\": [{\n" +
"\t\t\t\t\"match\": {\n" +
"\t\t\t\t\t\"address\": \"${queryString}\"\n" +
"\t\t\t\t}\n" +
"\t\t\t}, {\n" +
"\t\t\t\t\"range\": {\n" +
"\t\t\t\t\t\"login_date\": {\n" +
"\t\t\t\t\t\t\"lt\":\""+DateUtils.getAfterDayDate("-3", "yyyy-MM-dd")+"\"\n" +
"\t\t\t\t\t}\n" +
"\t\t\t\t}\n" +
"\t\t\t}],\n" +
"\t\t\t\"must_not\": [{\n" +
"\t\t\t\t\"term\": {\n" +
"\t\t\t\t\t\"code\": \"6901234\"\n" +
"\t\t\t\t}\n" +
"\t\t\t}, {\n" +
"\t\t\t\t\"term\": {\n" +
"\t\t\t\t\t\"code\": \"69290200\"\n" +
"\t\t\t\t}\n" +
"\t\t\t}, {\n" +
"\t\t\t\t\"term\": {\n" +
"\t\t\t\t\t\"code\": \"6900000\"\n" +
"\t\t\t\t}\n" +
"\t\t\t}],\n" +
"\t\t\t\"should\": []\n" +
"\t\t}\n" +
"\t},\n" +
"\t\"from\": 0,\n" +
"\t\"size\": 10,\n" +
"\t\"sort\": [],\n" +
"\t\"aggs\": {}\n" +
"}";
String smsTemplateXml = addressTemplate.replaceAll("\\$\\{queryString\\}", keyword);
RestTemplate restTemplate = new RestTemplate();
//创建请求头
//创建请求头
HttpHeaders headers = new HttpHeaders();
headers.set("Content-Type", "application/json; charset=utf-8");
HttpEntity<String> entity = new HttpEntity<>(smsTemplateXml, headers);
System.out.println(smsTemplateXml);
ResponseEntity<String> responseEntity = restTemplate.postForEntity(ES_URL, entity, String.class);
if (responseEntity.getStatusCode().value() == 200) {
System.out.println(responseEntity.getBody());
return JSONUtil.toBean(responseEntity.getBody(), DomesticCodeResponse.class);
}
return null;
}
}
package io.office.modules.manage.utils;
/**
*
* 
 @description:
*
* @author wudi
* @date 17:55 2021/11/29
*/
public class IdCardUtils {
public static boolean isIDNumber(String IDNumber) {
if (IDNumber == null || "".equals(IDNumber)) {
return false;
}
// 定义判别用户身份证号的正则表达式(15位或者18位,最后一位可以为字母)
String regularExpression = "^\\d{17}(\\d|x|X)$";
boolean matches = IDNumber.matches(regularExpression);
return matches;
}
}
package io.office.modules.manage.vo.request;
import lombok.Data;
import java.io.Serializable;
/**
*
* 
 @description:
*
* @author wudi
* @date 18:38 2021/11/29
*/
@Data
public class DomesticCodeDetailRequest implements Serializable {
private String f_id;
private String code;
}
package io.office.modules.manage.vo.request;
import lombok.Data;
import java.io.Serializable;
/**
*
* 
 @description:
*
* @author wudi
* @date 16:27 2021/11/29
*/
@Data
public class DomesticCodeVo implements Serializable {
private static final long serialVersionUID = 1L;
private String captcha;
private String uuid;
private String type;
private String code;
}
package io.office.modules.manage.vo.request;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
*
* 
 @description:
*
* @author wudi
* @date 14:29 2021/11/23
*/
@Data
public class GlossaryVo implements Serializable {
private static final long serialVersionUID = 1L;
private String captcha;
private String uuid;
private Integer id;
/**
* $column.comments
*/
private String titleEn;
/**
* $column.comments
*/
private String titleCn;
/**
* $column.comments
*/
private String keyword;
/**
* $column.comments
*/
private String brief;
/**
* $column.comments
*/
private Date releasedate;
/**
* $column.comments
*/
private Date updatedate;
/**
* $column.comments
*/
private String author;
/**
* $column.comments
*/
private String content;
/**
* $column.comments
*/
private Integer hits;
/**
* $column.comments
*/
private String editor;
/**
* $column.comments
*/
private String lasteditor;
}
...@@ -72,8 +72,6 @@ public class ShortCodeVo implements Serializable { ...@@ -72,8 +72,6 @@ public class ShortCodeVo implements Serializable {
*/ */
private Date issueDate; private Date issueDate;
private String fireName;
......
package io.office.modules.manage.vo.response;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
*
* 
 @description:
*
* @author wudi
* @date 18:35 2021/11/29
*/
@Data
public class DomesticCodeDetailVo implements Serializable {
private String firmName;
private String registerAddress;
private String postcode;
private String code;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date validDate;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date loginDate;
private String logoutFlag;
private String fId;
private String logoutDate;
}
package io.office.modules.manage.vo.response;
import com.google.gson.annotations.SerializedName;
import io.office.modules.manage.utils.IdCardUtils;
import java.io.Serializable;
import java.util.List;
/**
*
* 
 @description:
*
* @author wudi
* @date 17:09 2021/11/29
*/
public class DomesticCodeResponse implements Serializable {
/**
* took : 1
* timed_out : false
* _shards : {"total":1,"successful":1,"skipped":0,"failed":0}
* hits : {"total":{"value":1,"relation":"eq"},"max_score":14.323673,"hits":[{"_index":"ancc_search","_type":"_doc","_id":"d1fkaH0BFTn4iGHneApd","_score":14.323673,"_source":{"firm_name":"厦门联华食品有限公司","f_id":1030326,"firm_code":null,"logout_flag":"0","leader":"林敬付","branch_code":"3505 ","register_address1":null,"dm":"150","register_postalcode":"361100","contactman":"吕福广","email":"lfg_007@126.com ","used_num":null,"in_flag":"0","code":"697495415","register_address":"厦门市同安区轻工(食品)工业区美禾九路179号之A区","political":"350212","register_principal":10987,"net_station":null,"code_type":"1","wishused_num":1,"t_j_dm":"L7431","leader_tele":null,"mp":"18106973959 ","logout_date":null,"firm_name1":null,"firm_type":"1 ","coin_type":"1 ","@timestamp":"2021-11-28T23:32:23.237Z","dbd_code":null,"approve_man":"631 ","login_date":"2021-10-28T16:00:00.000Z","address":"厦门市同安区轻工(食品)工业区美禾九路179号之A区","address1":null,"postcode":"361100","type":"anccfirm","memo":null,"@version":"1","fax":null,"leader_handset":"13696926306 ","certificate_code":"91350200791254698U ","tele":"18106973959","valid_date":"2023-10-28T16:00:00.000Z"}}]}
*/
private int took;
private boolean timed_out;
private ShardsBean _shards;
private HitsBeanX hits;
public int getTook() {
return took;
}
public void setTook(int took) {
this.took = took;
}
public boolean isTimed_out() {
return timed_out;
}
public void setTimed_out(boolean timed_out) {
this.timed_out = timed_out;
}
public ShardsBean get_shards() {
return _shards;
}
public void set_shards(ShardsBean _shards) {
this._shards = _shards;
}
public HitsBeanX getHits() {
return hits;
}
public void setHits(HitsBeanX hits) {
this.hits = hits;
}
public static class ShardsBean implements Serializable{
/**
* total : 1
* successful : 1
* skipped : 0
* failed : 0
*/
private int total;
private int successful;
private int skipped;
private int failed;
public int getTotal() {
return total;
}
public void setTotal(int total) {
this.total = total;
}
public int getSuccessful() {
return successful;
}
public void setSuccessful(int successful) {
this.successful = successful;
}
public int getSkipped() {
return skipped;
}
public void setSkipped(int skipped) {
this.skipped = skipped;
}
public int getFailed() {
return failed;
}
public void setFailed(int failed) {
this.failed = failed;
}
}
public static class HitsBeanX implements Serializable{
/**
* total : {"value":1,"relation":"eq"}
* max_score : 14.323673
* hits : [{"_index":"ancc_search","_type":"_doc","_id":"d1fkaH0BFTn4iGHneApd","_score":14.323673,"_source":{"firm_name":"厦门联华食品有限公司","f_id":1030326,"firm_code":null,"logout_flag":"0","leader":"林敬付","branch_code":"3505 ","register_address1":null,"dm":"150","register_postalcode":"361100","contactman":"吕福广","email":"lfg_007@126.com ","used_num":null,"in_flag":"0","code":"697495415","register_address":"厦门市同安区轻工(食品)工业区美禾九路179号之A区","political":"350212","register_principal":10987,"net_station":null,"code_type":"1","wishused_num":1,"t_j_dm":"L7431","leader_tele":null,"mp":"18106973959 ","logout_date":null,"firm_name1":null,"firm_type":"1 ","coin_type":"1 ","@timestamp":"2021-11-28T23:32:23.237Z","dbd_code":null,"approve_man":"631 ","login_date":"2021-10-28T16:00:00.000Z","address":"厦门市同安区轻工(食品)工业区美禾九路179号之A区","address1":null,"postcode":"361100","type":"anccfirm","memo":null,"@version":"1","fax":null,"leader_handset":"13696926306 ","certificate_code":"91350200791254698U ","tele":"18106973959","valid_date":"2023-10-28T16:00:00.000Z"}}]
*/
private TotalBean total;
private String max_score;
private List<HitsBean> hits;
public TotalBean getTotal() {
return total;
}
public void setTotal(TotalBean total) {
this.total = total;
}
public String getMax_score() {
return max_score;
}
public void setMax_score(String max_score) {
this.max_score = max_score;
}
public List<HitsBean> getHits() {
return hits;
}
public void setHits(List<HitsBean> hits) {
this.hits = hits;
}
public static class TotalBean implements Serializable{
/**
* value : 1
* relation : eq
*/
private int value;
private String relation;
public int getValue() {
return value;
}
public void setValue(int value) {
this.value = value;
}
public String getRelation() {
return relation;
}
public void setRelation(String relation) {
this.relation = relation;
}
}
public static class HitsBean implements Serializable{
/**
* _index : ancc_search
* _type : _doc
* _id : d1fkaH0BFTn4iGHneApd
* _score : 14.323673
* _source : {"firm_name":"厦门联华食品有限公司","f_id":1030326,"firm_code":null,"logout_flag":"0","leader":"林敬付","branch_code":"3505 ","register_address1":null,"dm":"150","register_postalcode":"361100","contactman":"吕福广","email":"lfg_007@126.com ","used_num":null,"in_flag":"0","code":"697495415","register_address":"厦门市同安区轻工(食品)工业区美禾九路179号之A区","political":"350212","register_principal":10987,"net_station":null,"code_type":"1","wishused_num":1,"t_j_dm":"L7431","leader_tele":null,"mp":"18106973959 ","logout_date":null,"firm_name1":null,"firm_type":"1 ","coin_type":"1 ","@timestamp":"2021-11-28T23:32:23.237Z","dbd_code":null,"approve_man":"631 ","login_date":"2021-10-28T16:00:00.000Z","address":"厦门市同安区轻工(食品)工业区美禾九路179号之A区","address1":null,"postcode":"361100","type":"anccfirm","memo":null,"@version":"1","fax":null,"leader_handset":"13696926306 ","certificate_code":"91350200791254698U ","tele":"18106973959","valid_date":"2023-10-28T16:00:00.000Z"}
*/
private String _index;
private String _type;
private String _id;
private double _score;
private SourceBean _source;
public String get_index() {
return _index;
}
public void set_index(String _index) {
this._index = _index;
}
public String get_type() {
return _type;
}
public void set_type(String _type) {
this._type = _type;
}
public String get_id() {
return _id;
}
public void set_id(String _id) {
this._id = _id;
}
public double get_score() {
return _score;
}
public void set_score(double _score) {
this._score = _score;
}
public SourceBean get_source() {
return _source;
}
public void set_source(SourceBean _source) {
this._source = _source;
}
public static class SourceBean implements Serializable{
/**
* firm_name : 厦门联华食品有限公司
* f_id : 1030326
* firm_code : null
* logout_flag : 0
* leader : 林敬付
* branch_code : 3505
* register_address1 : null
* dm : 150
* register_postalcode : 361100
* contactman : 吕福广
* email : lfg_007@126.com
* used_num : null
* in_flag : 0
* code : 697495415
* register_address : 厦门市同安区轻工(食品)工业区美禾九路179号之A区
* political : 350212
* register_principal : 10987
* net_station : null
* code_type : 1
* wishused_num : 1
* t_j_dm : L7431
* leader_tele : null
* mp : 18106973959
* logout_date : null
* firm_name1 : null
* firm_type : 1
* coin_type : 1
* @timestamp : 2021-11-28T23:32:23.237Z
* dbd_code : null
* approve_man : 631
* login_date : 2021-10-28T16:00:00.000Z
* address : 厦门市同安区轻工(食品)工业区美禾九路179号之A区
* address1 : null
* postcode : 361100
* type : anccfirm
* memo : null
* @version : 1
* fax : null
* leader_handset : 13696926306
* certificate_code : 91350200791254698U
* tele : 18106973959
* valid_date : 2023-10-28T16:00:00.000Z
*/
private String firm_name;
private int f_id;
private String firm_code;
private String logout_flag;
private String leader;
private String branch_code;
private String register_address1;
private String dm;
private String register_postalcode;
private String contactman;
private String email;
private String used_num;
private String in_flag;
private String code;
private String register_address;
private String political;
private int register_principal;
private String net_station;
private String code_type;
private int wishused_num;
private String t_j_dm;
private String leader_tele;
private String mp;
private String logout_date;
private String firm_name1;
private String firm_type;
private String coin_type;
@SerializedName("@timestamp")
private String _$Timestamp306; // FIXME check this code
private String dbd_code;
private String approve_man;
private String login_date;
private String address;
private String address1;
private String postcode;
private String type;
private String memo;
@SerializedName("@version")
private String _$Version316; // FIXME check this code
private String fax;
private String leader_handset;
private String certificate_code;
private String tele;
private String valid_date;
public String getFirm_name() {
if(firm_name.length()>19) {
String firmNameNew = firm_name.substring(19);
if(IdCardUtils.isIDNumber(firmNameNew)) {
return firm_name.substring(0,firm_name.length()-19);
}
}
return firm_name;
}
public void setFirm_name(String firm_name) {
this.firm_name = firm_name;
}
public int getF_id() {
return f_id;
}
public void setF_id(int f_id) {
this.f_id = f_id;
}
public String getFirm_code() {
return firm_code;
}
public void setFirm_code(String firm_code) {
this.firm_code = firm_code;
}
public String getLogout_flag() {
return logout_flag;
}
public void setLogout_flag(String logout_flag) {
this.logout_flag = logout_flag;
}
public String getLeader() {
return leader;
}
public void setLeader(String leader) {
this.leader = leader;
}
public String getBranch_code() {
return branch_code;
}
public void setBranch_code(String branch_code) {
this.branch_code = branch_code;
}
public String getRegister_address1() {
return register_address1;
}
public void setRegister_address1(String register_address1) {
this.register_address1 = register_address1;
}
public String getDm() {
return dm;
}
public void setDm(String dm) {
this.dm = dm;
}
public String getRegister_postalcode() {
return register_postalcode;
}
public void setRegister_postalcode(String register_postalcode) {
this.register_postalcode = register_postalcode;
}
public String getContactman() {
return contactman;
}
public void setContactman(String contactman) {
this.contactman = contactman;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getUsed_num() {
return used_num;
}
public void setUsed_num(String used_num) {
this.used_num = used_num;
}
public String getIn_flag() {
return in_flag;
}
public void setIn_flag(String in_flag) {
this.in_flag = in_flag;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getRegister_address() {
return register_address;
}
public void setRegister_address(String register_address) {
this.register_address = register_address;
}
public String getPolitical() {
return political;
}
public void setPolitical(String political) {
this.political = political;
}
public int getRegister_principal() {
return register_principal;
}
public void setRegister_principal(int register_principal) {
this.register_principal = register_principal;
}
public String getNet_station() {
return net_station;
}
public void setNet_station(String net_station) {
this.net_station = net_station;
}
public String getCode_type() {
return code_type;
}
public void setCode_type(String code_type) {
this.code_type = code_type;
}
public int getWishused_num() {
return wishused_num;
}
public void setWishused_num(int wishused_num) {
this.wishused_num = wishused_num;
}
public String getT_j_dm() {
return t_j_dm;
}
public void setT_j_dm(String t_j_dm) {
this.t_j_dm = t_j_dm;
}
public String getLeader_tele() {
return leader_tele;
}
public void setLeader_tele(String leader_tele) {
this.leader_tele = leader_tele;
}
public String getMp() {
return mp;
}
public void setMp(String mp) {
this.mp = mp;
}
public String getLogout_date() {
return logout_date;
}
public void setLogout_date(String logout_date) {
this.logout_date = logout_date;
}
public String getFirm_name1() {
return firm_name1;
}
public void setFirm_name1(String firm_name1) {
this.firm_name1 = firm_name1;
}
public String getFirm_type() {
return firm_type;
}
public void setFirm_type(String firm_type) {
this.firm_type = firm_type;
}
public String getCoin_type() {
return coin_type;
}
public void setCoin_type(String coin_type) {
this.coin_type = coin_type;
}
public String get_$Timestamp306() {
return _$Timestamp306;
}
public void set_$Timestamp306(String _$Timestamp306) {
this._$Timestamp306 = _$Timestamp306;
}
public String getDbd_code() {
return dbd_code;
}
public void setDbd_code(String dbd_code) {
this.dbd_code = dbd_code;
}
public String getApprove_man() {
return approve_man;
}
public void setApprove_man(String approve_man) {
this.approve_man = approve_man;
}
public String getLogin_date() {
return login_date;
}
public void setLogin_date(String login_date) {
this.login_date = login_date;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getAddress1() {
return address1;
}
public void setAddress1(String address1) {
this.address1 = address1;
}
public String getPostcode() {
return postcode;
}
public void setPostcode(String postcode) {
this.postcode = postcode;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getMemo() {
return memo;
}
public void setMemo(String memo) {
this.memo = memo;
}
public String get_$Version316() {
return _$Version316;
}
public void set_$Version316(String _$Version316) {
this._$Version316 = _$Version316;
}
public String getFax() {
return fax;
}
public void setFax(String fax) {
this.fax = fax;
}
public String getLeader_handset() {
return leader_handset;
}
public void setLeader_handset(String leader_handset) {
this.leader_handset = leader_handset;
}
public String getCertificate_code() {
return certificate_code;
}
public void setCertificate_code(String certificate_code) {
this.certificate_code = certificate_code;
}
public String getTele() {
return tele;
}
public void setTele(String tele) {
this.tele = tele;
}
public String getValid_date() {
return valid_date;
}
public void setValid_date(String valid_date) {
this.valid_date = valid_date;
}
}
}
}
}
package io.office.modules.manage.vo.response;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
*
* 
 @description:
*
* @author wudi
* @date 11:07 2021/11/30
*/
@Data
public class DomesticCodeUpdateResponse implements Serializable {
private String firmName;
private String firmNameNow;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date auditDate;
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.office.modules.manage.dao.FirmDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="io.office.modules.manage.entity.FirmEntity" id="firmMap">
<result property="fId" column="f_id"/>
<result property="loginDate" column="login_date"/>
<result property="dm" column="dm"/>
<result property="tJDm" column="t_j_dm"/>
<result property="firmType" column="firm_type"/>
<result property="firmName" column="firm_name"/>
<result property="firmName1" column="firm_name1"/>
<result property="registerAddress" column="register_address"/>
<result property="registerAddress1" column="register_address1"/>
<result property="registerPostalcode" column="register_postalcode"/>
<result property="address" column="address"/>
<result property="address1" column="address1"/>
<result property="postcode" column="postcode"/>
<result property="certificateCode" column="certificate_code"/>
<result property="political" column="political"/>
<result property="registerPrincipal" column="register_principal"/>
<result property="coinType" column="coin_type"/>
<result property="firmCode" column="firm_code"/>
<result property="leader" column="leader"/>
<result property="leaderTele" column="leader_tele"/>
<result property="leaderHandset" column="leader_handset"/>
<result property="contactman" column="contactman"/>
<result property="tele" column="tele"/>
<result property="fax" column="fax"/>
<result property="email" column="email"/>
<result property="netStation" column="net_station"/>
<result property="wishusedNum" column="wishused_num"/>
<result property="usedNum" column="used_num"/>
<result property="branchCode" column="branch_code"/>
<result property="logoutFlag" column="logout_flag"/>
<result property="inFlag" column="in_flag"/>
</resultMap>
<select id="getDetail" parameterType="io.office.modules.manage.vo.request.DomesticCodeDetailRequest" resultType="io.office.modules.manage.vo.response.DomesticCodeDetailVo">
SELECT
a.firm_name,
a.register_address,
a.postcode,
b.code,
b.valid_date,
b.login_date,
b.logout_flag,
b.f_id,
b.logout_date
FROM
firm a
LEFT JOIN ean_upc b ON a.f_id = b.f_id
LEFT JOIN center_outer.dbo.bulletin c ON c.code = b.code
WHERE
a.f_id = #{f_id}
AND b.code = #{code}
ORDER BY
c.Id DESC
</select>
<select id="domesticCodeUpdateList" parameterType="string" resultType="io.office.modules.manage.vo.response.DomesticCodeUpdateResponse">
SELECT
FIRM_NAME,
FIRM_NAME_NOW,
AUDIT_DATE
FROM
center_outer.dbo.CHANGE_HISTORY
WHERE
(FIRM_NAME &lt;&gt; FIRM_NAME_now)
AND (
(CHANGE_TYPE = '0')
OR (CHANGE_TYPE = '01')
)
and ltrim(rtrim(code))= #{firmId}
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment