Commit 3d21119a by 吴迪

【新增】新增 codeeagent表清洗代码

parent 247011f5
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.CodeagentEntity;
import io.office.modules.manage.service.CodeagentService;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2022-01-09 10:19:30
*/
@RestController
@RequestMapping("/codeagent")
public class CodeagentController {
@Autowired
private CodeagentService codeagentService;
/**
* 列表
*/
@RequestMapping("/list")
// @RequiresPermissions("manage:codeagent:list")
public R list(@RequestParam Map<String, Object> params){
PageUtils page = codeagentService.queryPage(params);
return R.ok().put("page", page);
}
/**
* 信息
*/
@RequestMapping("/info/{id}")
// @RequiresPermissions("manage:codeagent:info")
public R info(@PathVariable("id") Integer id){
CodeagentEntity codeagent = codeagentService.getById(id);
return R.ok().put("codeagent", codeagent);
}
/**
* 保存
*/
@RequestMapping("/save")
// @RequiresPermissions("manage:codeagent:save")
public R save(@RequestBody CodeagentEntity codeagent){
codeagentService.save(codeagent);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
// @RequiresPermissions("manage:codeagent:update")
public R update(@RequestBody CodeagentEntity codeagent){
codeagentService.updateById(codeagent);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
// @RequiresPermissions("manage:codeagent:delete")
public R delete(@RequestBody Integer[] ids){
codeagentService.removeByIds(Arrays.asList(ids));
return R.ok();
}
}
package io.office.modules.manage.dao;
import io.office.modules.manage.entity.CodeagentEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2022-01-09 10:19:30
*/
@Mapper
public interface CodeagentDao extends BaseMapper<CodeagentEntity> {
}
package io.office.modules.manage.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2022-01-09 10:19:30
*/
@Data
@TableName("CodeAgent")
public class CodeagentEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* $column.comments
*/
@TableId
private Integer id;
/**
* $column.comments
*/
private String title;
/**
* $column.comments
*/
private String content;
/**
* $column.comments
*/
private String address;
/**
* $column.comments
*/
private String phone;
/**
* $column.comments
*/
private String postcode;
/**
* $column.comments
*/
private String contactman;
/**
* $column.comments
*/
private String fax;
/**
* $column.comments
*/
private String description;
/**
* $column.comments
*/
private String mail;
/**
* $column.comments
*/
private String website;
/**
* $column.comments
*/
private String addressDescription;
}
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.CodeagentEntity;
import java.util.Map;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2022-01-09 10:19:30
*/
public interface CodeagentService extends IService<CodeagentEntity> {
PageUtils queryPage(Map<String, Object> params);
}
package io.office.modules.manage.service.impl;
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.CodeagentDao;
import io.office.modules.manage.entity.CodeagentEntity;
import io.office.modules.manage.service.CodeagentService;
@Service("codeagentService")
public class CodeagentServiceImpl extends ServiceImpl<CodeagentDao, CodeagentEntity> implements CodeagentService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<CodeagentEntity> page = this.page(
new Query<CodeagentEntity>().getPage(params),
new QueryWrapper<CodeagentEntity>()
);
return new PageUtils(page);
}
}
\ No newline at end of file
...@@ -50,6 +50,8 @@ public class TransferController { ...@@ -50,6 +50,8 @@ public class TransferController {
private NewsMovieService newsMovieService; private NewsMovieService newsMovieService;
@Autowired @Autowired
private AnnounceService announceService; private AnnounceService announceService;
@Autowired
private CodeagentService codeagentService;
@RequestMapping("/api/indexCarouselManage") @RequestMapping("/api/indexCarouselManage")
...@@ -294,7 +296,7 @@ public class TransferController { ...@@ -294,7 +296,7 @@ public class TransferController {
if (partnersEntity.getPic().startsWith("http://81.68.189.225:8080")) {//官网的链接 if (partnersEntity.getPic().startsWith("http://81.68.189.225:8080")) {//官网的链接
partnersEntity.setPic(partnersEntity.getPic().replaceAll("http://81.68.189.225:8080", fileRequestPrefix)); partnersEntity.setPic(partnersEntity.getPic().replaceAll("http://81.68.189.225:8080", fileRequestPrefix));
} }
partnersEntity.setPic(fileRequestPrefix +"Service/Partners/img/"+partnersEntity.getPic()); partnersEntity.setPic(fileRequestPrefix + "Service/Partners/img/" + partnersEntity.getPic());
//修改 //修改
UpdateWrapper<PartnersEntity> updateWrapper = new UpdateWrapper(); UpdateWrapper<PartnersEntity> updateWrapper = new UpdateWrapper();
updateWrapper.eq("id", partnersEntity.getId()); updateWrapper.eq("id", partnersEntity.getId());
...@@ -383,11 +385,11 @@ public class TransferController { ...@@ -383,11 +385,11 @@ public class TransferController {
//如果不为空 //如果不为空
if (StringUtils.isNotBlank(newsEntity.getDirectpath())) { if (StringUtils.isNotBlank(newsEntity.getDirectpath())) {
//先判断是否是官网的前缀 //先判断是否是官网的前缀
if (newsEntity.getDirectpath().startsWith("http://www.gs1cn.org") ) { if (newsEntity.getDirectpath().startsWith("http://www.gs1cn.org")) {
//官网的链接 //官网的链接
newsEntityDB.setDirectpath(newsEntity.getDirectpath().replaceAll("http://www.gs1cn.org", domainListProperties.getDomain())); newsEntityDB.setDirectpath(newsEntity.getDirectpath().replaceAll("http://www.gs1cn.org", domainListProperties.getDomain()));
} }
if (newsEntity.getDirectpath().startsWith("http://www.ancc.org.cn") ) { if (newsEntity.getDirectpath().startsWith("http://www.ancc.org.cn")) {
//官网的链接 //官网的链接
newsEntityDB.setDirectpath(newsEntity.getDirectpath().replaceAll("http://www.ancc.org.cn", domainListProperties.getDomain())); newsEntityDB.setDirectpath(newsEntity.getDirectpath().replaceAll("http://www.ancc.org.cn", domainListProperties.getDomain()));
} }
...@@ -433,11 +435,11 @@ public class TransferController { ...@@ -433,11 +435,11 @@ public class TransferController {
if (StringUtils.isNotBlank(newsEntity.getContent())) { if (StringUtils.isNotBlank(newsEntity.getContent())) {
if (newsEntity.getContent().indexOf("http://www.gs1cn.org") > -1 && !(newsEntity.getContent().indexOf("http://www.gs1cn.org/UserImages")>-1) && !(newsEntity.getContent().indexOf("http://www.ancc.org.cn/UserFiles")>-1)) { if (newsEntity.getContent().indexOf("http://www.gs1cn.org") > -1 && !(newsEntity.getContent().indexOf("http://www.gs1cn.org/UserImages") > -1) && !(newsEntity.getContent().indexOf("http://www.ancc.org.cn/UserFiles") > -1)) {
//官网的链接 //官网的链接
newsEntityDB.setContent(newsEntity.getContent().replaceAll("http://www.gs1cn.org", domainListProperties.getDomain())); newsEntityDB.setContent(newsEntity.getContent().replaceAll("http://www.gs1cn.org", domainListProperties.getDomain()));
} }
if (newsEntity.getContent().indexOf("http://www.ancc.org.cn") > -1 && !(newsEntity.getContent().indexOf("http://www.gs1cn.org/UserImages") >-1) && !(newsEntity.getContent().indexOf("http://www.ancc.org.cn/UserFiles")>-1)) { if (newsEntity.getContent().indexOf("http://www.ancc.org.cn") > -1 && !(newsEntity.getContent().indexOf("http://www.gs1cn.org/UserImages") > -1) && !(newsEntity.getContent().indexOf("http://www.ancc.org.cn/UserFiles") > -1)) {
//官网的链接 //官网的链接
newsEntityDB.setContent(newsEntity.getContent().replaceAll("http://www.ancc.org.cn", domainListProperties.getDomain())); newsEntityDB.setContent(newsEntity.getContent().replaceAll("http://www.ancc.org.cn", domainListProperties.getDomain()));
} }
...@@ -520,8 +522,6 @@ public class TransferController { ...@@ -520,8 +522,6 @@ public class TransferController {
} }
@RequestMapping("/api/newtopic") @RequestMapping("/api/newtopic")
// @RequiresPermissions("generator:topicnews:list") // @RequiresPermissions("generator:topicnews:list")
public R newtopic() { public R newtopic() {
...@@ -548,11 +548,11 @@ public class TransferController { ...@@ -548,11 +548,11 @@ public class TransferController {
//如果不为空 //如果不为空
if (StringUtils.isNotBlank(newtopicEntity.getDirectpath())) { if (StringUtils.isNotBlank(newtopicEntity.getDirectpath())) {
//先判断是否是官网的前缀 //先判断是否是官网的前缀
if (newtopicEntity.getDirectpath().startsWith("http://www.gs1cn.org") ) { if (newtopicEntity.getDirectpath().startsWith("http://www.gs1cn.org")) {
//官网的链接 //官网的链接
newtopicEntityDB.setDirectpath(newtopicEntity.getDirectpath().replaceAll("http://www.gs1cn.org", domainListProperties.getDomain())); newtopicEntityDB.setDirectpath(newtopicEntity.getDirectpath().replaceAll("http://www.gs1cn.org", domainListProperties.getDomain()));
} }
if (newtopicEntity.getDirectpath().startsWith("http://www.ancc.org.cn") ) { if (newtopicEntity.getDirectpath().startsWith("http://www.ancc.org.cn")) {
//官网的链接 //官网的链接
newtopicEntityDB.setDirectpath(newtopicEntity.getDirectpath().replaceAll("http://www.ancc.org.cn", domainListProperties.getDomain())); newtopicEntityDB.setDirectpath(newtopicEntity.getDirectpath().replaceAll("http://www.ancc.org.cn", domainListProperties.getDomain()));
} }
...@@ -595,11 +595,11 @@ public class TransferController { ...@@ -595,11 +595,11 @@ public class TransferController {
if (StringUtils.isNotBlank(newtopicEntity.getContent())) { if (StringUtils.isNotBlank(newtopicEntity.getContent())) {
if (newtopicEntity.getContent().indexOf("http://www.gs1cn.org") > -1 && !(newtopicEntity.getContent().indexOf("http://www.gs1cn.org/UserImages")>-1) && !(newtopicEntity.getContent().indexOf("http://www.ancc.org.cn/UserFiles")>-1)) { if (newtopicEntity.getContent().indexOf("http://www.gs1cn.org") > -1 && !(newtopicEntity.getContent().indexOf("http://www.gs1cn.org/UserImages") > -1) && !(newtopicEntity.getContent().indexOf("http://www.ancc.org.cn/UserFiles") > -1)) {
//官网的链接 //官网的链接
newtopicEntityDB.setContent(newtopicEntity.getContent().replaceAll("http://www.gs1cn.org", domainListProperties.getDomain())); newtopicEntityDB.setContent(newtopicEntity.getContent().replaceAll("http://www.gs1cn.org", domainListProperties.getDomain()));
} }
if (newtopicEntity.getContent().indexOf("http://www.ancc.org.cn") > -1 && !(newtopicEntity.getContent().indexOf("http://www.gs1cn.org/UserImages") >-1) && !(newtopicEntity.getContent().indexOf("http://www.ancc.org.cn/UserFiles")>-1)) { if (newtopicEntity.getContent().indexOf("http://www.ancc.org.cn") > -1 && !(newtopicEntity.getContent().indexOf("http://www.gs1cn.org/UserImages") > -1) && !(newtopicEntity.getContent().indexOf("http://www.ancc.org.cn/UserFiles") > -1)) {
//官网的链接 //官网的链接
newtopicEntityDB.setContent(newtopicEntity.getContent().replaceAll("http://www.ancc.org.cn", domainListProperties.getDomain())); newtopicEntityDB.setContent(newtopicEntity.getContent().replaceAll("http://www.ancc.org.cn", domainListProperties.getDomain()));
} }
...@@ -769,7 +769,7 @@ public class TransferController { ...@@ -769,7 +769,7 @@ public class TransferController {
//官网的链接 //官网的链接
newsEntityDB.setDirectpath(newsEntity.getDirectpath().replaceAll("http://www.ancc.org.cn", domainListProperties.getDomain())); newsEntityDB.setDirectpath(newsEntity.getDirectpath().replaceAll("http://www.ancc.org.cn", domainListProperties.getDomain()));
}*//* }*//*
*//*if (newsEntity.getDirectpath().startsWith("http://81.68.189.225:8080")) { *//*if (newsEntity.getDirectpath().startsWith("http://81.68.189.225:8080")) {
//官网的链接 //官网的链接
newsEntityDB.setDirectpath(newsEntity.getDirectpath().replaceAll("http://81.68.189.225:8080", domainListProperties.getDomain())); newsEntityDB.setDirectpath(newsEntity.getDirectpath().replaceAll("http://81.68.189.225:8080", domainListProperties.getDomain()));
}*//* }*//*
...@@ -811,11 +811,11 @@ public class TransferController { ...@@ -811,11 +811,11 @@ public class TransferController {
if (StringUtils.isNotBlank(announceEntity.getContent())) { if (StringUtils.isNotBlank(announceEntity.getContent())) {
if (announceEntity.getContent().indexOf("http://www.gs1cn.org") > -1 && !(announceEntity.getContent().indexOf("http://www.gs1cn.org/UserImages")>-1) && !(announceEntity.getContent().indexOf("http://www.ancc.org.cn/UserFiles")>-1)) { if (announceEntity.getContent().indexOf("http://www.gs1cn.org") > -1 && !(announceEntity.getContent().indexOf("http://www.gs1cn.org/UserImages") > -1) && !(announceEntity.getContent().indexOf("http://www.ancc.org.cn/UserFiles") > -1)) {
//官网的链接 //官网的链接
announceEntityDB.setContent(announceEntity.getContent().replaceAll("http://www.gs1cn.org", domainListProperties.getDomain())); announceEntityDB.setContent(announceEntity.getContent().replaceAll("http://www.gs1cn.org", domainListProperties.getDomain()));
} }
if (announceEntity.getContent().indexOf("http://www.ancc.org.cn") > -1 && !(announceEntity.getContent().indexOf("http://www.gs1cn.org/UserImages") >-1) && !(announceEntity.getContent().indexOf("http://www.ancc.org.cn/UserFiles")>-1)) { if (announceEntity.getContent().indexOf("http://www.ancc.org.cn") > -1 && !(announceEntity.getContent().indexOf("http://www.gs1cn.org/UserImages") > -1) && !(announceEntity.getContent().indexOf("http://www.ancc.org.cn/UserFiles") > -1)) {
//官网的链接 //官网的链接
announceEntityDB.setContent(announceEntity.getContent().replaceAll("http://www.ancc.org.cn", domainListProperties.getDomain())); announceEntityDB.setContent(announceEntity.getContent().replaceAll("http://www.ancc.org.cn", domainListProperties.getDomain()));
} }
...@@ -862,8 +862,6 @@ public class TransferController { ...@@ -862,8 +862,6 @@ public class TransferController {
} }
} }
...@@ -907,7 +905,48 @@ public class TransferController { ...@@ -907,7 +905,48 @@ public class TransferController {
} }
@RequestMapping("/api/codeagent")
// @RequiresPermissions("generator:topicnews:list")
public R codeagent() {
QueryWrapper<CodeagentEntity> indexCarouselManageEntityQueryWrapper = new QueryWrapper<>();
int count = codeagentService.count(indexCarouselManageEntityQueryWrapper);
if (count > 0) {
boolean flag = true;
int n = 1;
while (flag) {
int limit = 10;
int pages = 0;
if ((count % limit) == 0) {
pages = (count / limit);
} else {
pages = (count / limit) + 1;
}
if (n <= pages) {
IPage<CodeagentEntity> pageData = codeagentService.page(new Page(n, limit), indexCarouselManageEntityQueryWrapper);
if (CollectionUtils.isNotEmpty(pageData.getRecords())) {
for (CodeagentEntity codeagentEntity : pageData.getRecords()) {
CodeagentEntity codeagentEntityDb = new CodeagentEntity();
if(StringUtils.isNotBlank(codeagentEntity.getAddressDescription())) {
if (codeagentEntity.getAddressDescription().indexOf("/CodeAgent/CodeAgentDetail.aspx?codeagent_id=") > -1) {//官网的链接
codeagentEntityDb.setAddressDescription(codeagentEntity.getAddressDescription().replaceAll("/CodeAgent/CodeAgentDetail\\.aspx\\?codeagent_id=", "/Org/BranchMsg?branchCode="));
}
}
if (StringUtils.isNotBlank(codeagentEntity.getAddressDescription()) /*|| StringUtils.isNotBlank(newsEntityDB.getDirectpath()) || StringUtils.isNotBlank(newsEntityDB.getPic())*/) {
UpdateWrapper<CodeagentEntity> updateWrapper = new UpdateWrapper();
updateWrapper.eq("id", codeagentEntity.getId());
codeagentService.update(codeagentEntityDb, updateWrapper);
}
}
n = n + 1;
}
} else {
flag = false;
}
}
}
return R.ok().put("data", null);
}
public static void main(String[] args) { public static void main(String[] args) {
......
...@@ -14,7 +14,7 @@ spring: ...@@ -14,7 +14,7 @@ spring:
name: GS1OfficeWebSit name: GS1OfficeWebSit
# 环境 dev|test|prod # 环境 dev|test|prod
profiles: profiles:
active: test active: dev
# jackson时间格式化 # jackson时间格式化
jackson: jackson:
time-zone: GMT+8 time-zone: GMT+8
......
<?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.CodeagentDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="io.office.modules.manage.entity.CodeagentEntity" id="codeagentMap">
<result property="id" column="Id"/>
<result property="title" column="Title"/>
<result property="content" column="content"/>
<result property="address" column="Address"/>
<result property="phone" column="Phone"/>
<result property="postcode" column="Postcode"/>
<result property="contactman" column="contactman"/>
<result property="fax" column="fax"/>
<result property="description" column="description"/>
<result property="mail" column="mail"/>
<result property="website" column="website"/>
<result property="addressDescription" column="address_description"/>
</resultMap>
</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