25 changed files with 1124 additions and 61 deletions
			
			
		| @ -0,0 +1,53 @@ | |||||
|  | package com.epmet.commons.tools.utils; | ||||
|  | 
 | ||||
|  | import org.springframework.web.multipart.MultipartFile; | ||||
|  | 
 | ||||
|  | import java.io.File; | ||||
|  | import java.io.FileOutputStream; | ||||
|  | import java.io.InputStream; | ||||
|  | import java.io.OutputStream; | ||||
|  | 
 | ||||
|  | /** | ||||
|  |  * @author zhaoqifeng | ||||
|  |  * @dscription | ||||
|  |  * @date 2020/7/17 14:01 | ||||
|  |  */ | ||||
|  | public class MultipartFileToFileUtils { | ||||
|  | 	/** | ||||
|  | 	 * MultipartFile 转 File | ||||
|  | 	 * | ||||
|  | 	 * @param file | ||||
|  | 	 * @throws Exception | ||||
|  | 	 */ | ||||
|  | 	public static File multipartFileToFile(MultipartFile file) throws Exception { | ||||
|  | 		File toFile = null; | ||||
|  | 		if (("").equals(file) || file.getSize() <= 0) { | ||||
|  | 			file = null; | ||||
|  | 		} else { | ||||
|  | 			InputStream ins = null; | ||||
|  | 			ins = file.getInputStream(); | ||||
|  | 			toFile = new File(file.getOriginalFilename()); | ||||
|  | 			toFile = inputStreamToFile(ins, toFile); | ||||
|  | 			ins.close(); | ||||
|  | 		} | ||||
|  | 		return toFile; | ||||
|  | 	} | ||||
|  | 
 | ||||
|  | 
 | ||||
|  | 	private static File inputStreamToFile(InputStream ins, File file) { | ||||
|  | 		try { | ||||
|  | 			OutputStream os = new FileOutputStream(file); | ||||
|  | 			int bytesRead = 0; | ||||
|  | 			byte[] buffer = new byte[8192]; | ||||
|  | 			while ((bytesRead = ins.read(buffer, 0, 8192)) != -1) { | ||||
|  | 				os.write(buffer, 0, bytesRead); | ||||
|  | 			} | ||||
|  | 			os.close(); | ||||
|  | 			ins.close(); | ||||
|  | 			return file; | ||||
|  | 		} catch (Exception e) { | ||||
|  | 			e.printStackTrace(); | ||||
|  | 		} | ||||
|  | 		return null; | ||||
|  | 	} | ||||
|  | } | ||||
| @ -0,0 +1,91 @@ | |||||
|  | /** | ||||
|  |  * Copyright 2018 人人开源 https://www.renren.io
 | ||||
|  |  * <p> | ||||
|  |  * This program is free software: you can redistribute it and/or modify | ||||
|  |  * it under the terms of the GNU General Public License as published by | ||||
|  |  * the Free Software Foundation, either version 3 of the License, or | ||||
|  |  * (at your option) any later version. | ||||
|  |  * <p> | ||||
|  |  * This program is distributed in the hope that it will be useful, | ||||
|  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|  |  * GNU General Public License for more details. | ||||
|  |  * <p> | ||||
|  |  * You should have received a copy of the GNU General Public License | ||||
|  |  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
|  |  */ | ||||
|  | 
 | ||||
|  | package com.epmet.dto; | ||||
|  | 
 | ||||
|  | import java.io.Serializable; | ||||
|  | import java.util.Date; | ||||
|  | import lombok.Data; | ||||
|  | 
 | ||||
|  | 
 | ||||
|  | /** | ||||
|  |  * 代码第三方配置  | ||||
|  |  * | ||||
|  |  * @author generator generator@elink-cn.com | ||||
|  |  * @since v1.0.0 2020-07-17 | ||||
|  |  */ | ||||
|  | @Data | ||||
|  | public class CodeExtDTO implements Serializable { | ||||
|  | 
 | ||||
|  |     private static final long serialVersionUID = 1L; | ||||
|  | 
 | ||||
|  |     /** | ||||
|  |      * 主键 | ||||
|  |      */ | ||||
|  | 	private String id; | ||||
|  | 
 | ||||
|  |     /** | ||||
|  |      * 客户ID | ||||
|  |      */ | ||||
|  | 	private String customerId; | ||||
|  | 
 | ||||
|  |     /** | ||||
|  |      * 所属端 居民的:resi,工作端:work | ||||
|  |      */ | ||||
|  | 	private String clientType; | ||||
|  | 
 | ||||
|  |     /** | ||||
|  |      * APPID | ||||
|  |      */ | ||||
|  | 	private String appId; | ||||
|  | 
 | ||||
|  |     /** | ||||
|  |      * 自定义配置 | ||||
|  |      */ | ||||
|  | 	private String extJson; | ||||
|  | 
 | ||||
|  |     /** | ||||
|  |      * 乐观锁 | ||||
|  |      */ | ||||
|  | 	private Integer revision; | ||||
|  | 
 | ||||
|  |     /** | ||||
|  |      * 是否删除 | ||||
|  |      */ | ||||
|  | 	private String delFlag; | ||||
|  | 
 | ||||
|  |     /** | ||||
|  |      * 创建人 | ||||
|  |      */ | ||||
|  | 	private String createdBy; | ||||
|  | 
 | ||||
|  |     /** | ||||
|  |      * 创建时间 | ||||
|  |      */ | ||||
|  | 	private Date createdTime; | ||||
|  | 
 | ||||
|  |     /** | ||||
|  |      * 更新人 | ||||
|  |      */ | ||||
|  | 	private String updatedBy; | ||||
|  | 
 | ||||
|  |     /** | ||||
|  |      * 更新时间 | ||||
|  |      */ | ||||
|  | 	private Date updatedTime; | ||||
|  | 
 | ||||
|  | } | ||||
| @ -0,0 +1,19 @@ | |||||
|  | package com.epmet.dto.form; | ||||
|  | 
 | ||||
|  | import lombok.Data; | ||||
|  | import org.springframework.web.multipart.MultipartFile; | ||||
|  | 
 | ||||
|  | import java.io.Serializable; | ||||
|  | 
 | ||||
|  | /** | ||||
|  |  * @author zhaoqifeng | ||||
|  |  * @dscription | ||||
|  |  * @date 2020/7/17 11:15 | ||||
|  |  */ | ||||
|  | @Data | ||||
|  | public class MediaUploadFormDTO implements Serializable { | ||||
|  | 	private static final long serialVersionUID = -7342624180676221309L; | ||||
|  | 	private String codeId; | ||||
|  | 	private String type; | ||||
|  | 	private MultipartFile media; | ||||
|  | } | ||||
| @ -0,0 +1,17 @@ | |||||
|  | package com.epmet.dto.result; | ||||
|  | 
 | ||||
|  | import lombok.Data; | ||||
|  | 
 | ||||
|  | import java.io.Serializable; | ||||
|  | 
 | ||||
|  | /** | ||||
|  |  * @author zhaoqifeng | ||||
|  |  * @dscription | ||||
|  |  * @date 2020/7/17 11:17 | ||||
|  |  */ | ||||
|  | @Data | ||||
|  | public class MediaUploadResultDTO implements Serializable { | ||||
|  | 	private static final long serialVersionUID = -8462768939270515547L; | ||||
|  | 	private String id; | ||||
|  | 	private String name; | ||||
|  | } | ||||
| @ -0,0 +1,84 @@ | |||||
|  | /** | ||||
|  |  * Copyright 2018 人人开源 https://www.renren.io
 | ||||
|  |  * <p> | ||||
|  |  * This program is free software: you can redistribute it and/or modify | ||||
|  |  * it under the terms of the GNU General Public License as published by | ||||
|  |  * the Free Software Foundation, either version 3 of the License, or | ||||
|  |  * (at your option) any later version. | ||||
|  |  * <p> | ||||
|  |  * This program is distributed in the hope that it will be useful, | ||||
|  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|  |  * GNU General Public License for more details. | ||||
|  |  * <p> | ||||
|  |  * You should have received a copy of the GNU General Public License | ||||
|  |  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
|  |  */ | ||||
|  | 
 | ||||
|  | package com.epmet.controller; | ||||
|  | 
 | ||||
|  | import com.epmet.commons.tools.page.PageData; | ||||
|  | import com.epmet.commons.tools.utils.Result; | ||||
|  | import com.epmet.commons.tools.validator.AssertUtils; | ||||
|  | import com.epmet.commons.tools.validator.ValidatorUtils; | ||||
|  | import com.epmet.commons.tools.validator.group.AddGroup; | ||||
|  | import com.epmet.commons.tools.validator.group.DefaultGroup; | ||||
|  | import com.epmet.commons.tools.validator.group.UpdateGroup; | ||||
|  | import com.epmet.dto.CodeExtDTO; | ||||
|  | import com.epmet.service.CodeExtService; | ||||
|  | import org.springframework.beans.factory.annotation.Autowired; | ||||
|  | import org.springframework.web.bind.annotation.*; | ||||
|  | 
 | ||||
|  | import java.util.Map; | ||||
|  | 
 | ||||
|  | 
 | ||||
|  | /** | ||||
|  |  * 代码第三方配置  | ||||
|  |  * | ||||
|  |  * @author generator generator@elink-cn.com | ||||
|  |  * @since v1.0.0 2020-07-17 | ||||
|  |  */ | ||||
|  | @RestController | ||||
|  | @RequestMapping("codeext") | ||||
|  | public class CodeExtController { | ||||
|  |      | ||||
|  |     @Autowired | ||||
|  |     private CodeExtService codeExtService; | ||||
|  | 
 | ||||
|  |     @GetMapping("page") | ||||
|  |     public Result<PageData<CodeExtDTO>> page(@RequestParam Map<String, Object> params){ | ||||
|  |         PageData<CodeExtDTO> page = codeExtService.page(params); | ||||
|  |         return new Result<PageData<CodeExtDTO>>().ok(page); | ||||
|  |     } | ||||
|  | 
 | ||||
|  |     @GetMapping("{id}") | ||||
|  |     public Result<CodeExtDTO> get(@PathVariable("id") String id){ | ||||
|  |         CodeExtDTO data = codeExtService.get(id); | ||||
|  |         return new Result<CodeExtDTO>().ok(data); | ||||
|  |     } | ||||
|  | 
 | ||||
|  |     @PostMapping | ||||
|  |     public Result save(@RequestBody CodeExtDTO dto){ | ||||
|  |         //效验数据
 | ||||
|  |         ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); | ||||
|  |         codeExtService.save(dto); | ||||
|  |         return new Result(); | ||||
|  |     } | ||||
|  | 
 | ||||
|  |     @PutMapping | ||||
|  |     public Result update(@RequestBody CodeExtDTO dto){ | ||||
|  |         //效验数据
 | ||||
|  |         ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); | ||||
|  |         codeExtService.update(dto); | ||||
|  |         return new Result(); | ||||
|  |     } | ||||
|  | 
 | ||||
|  |     @DeleteMapping | ||||
|  |     public Result delete(@RequestBody String[] ids){ | ||||
|  |         //效验数据
 | ||||
|  |         AssertUtils.isArrayEmpty(ids, "id"); | ||||
|  |         codeExtService.delete(ids); | ||||
|  |         return new Result(); | ||||
|  |     } | ||||
|  | 
 | ||||
|  | } | ||||
| @ -0,0 +1,54 @@ | |||||
|  | /** | ||||
|  |  * Copyright 2018 人人开源 https://www.renren.io
 | ||||
|  |  * <p> | ||||
|  |  * This program is free software: you can redistribute it and/or modify | ||||
|  |  * it under the terms of the GNU General Public License as published by | ||||
|  |  * the Free Software Foundation, either version 3 of the License, or | ||||
|  |  * (at your option) any later version. | ||||
|  |  * <p> | ||||
|  |  * This program is distributed in the hope that it will be useful, | ||||
|  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|  |  * GNU General Public License for more details. | ||||
|  |  * <p> | ||||
|  |  * You should have received a copy of the GNU General Public License | ||||
|  |  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
|  |  */ | ||||
|  | 
 | ||||
|  | package com.epmet.dao; | ||||
|  | 
 | ||||
|  | import com.epmet.commons.mybatis.dao.BaseDao; | ||||
|  | import com.epmet.dto.CodeExtDTO; | ||||
|  | import com.epmet.entity.CodeExtEntity; | ||||
|  | import org.apache.ibatis.annotations.Mapper; | ||||
|  | import org.apache.ibatis.annotations.Param; | ||||
|  | 
 | ||||
|  | /** | ||||
|  |  * 代码第三方配置  | ||||
|  |  * | ||||
|  |  * @author generator generator@elink-cn.com | ||||
|  |  * @since v1.0.0 2020-07-17 | ||||
|  |  */ | ||||
|  | @Mapper | ||||
|  | public interface CodeExtDao extends BaseDao<CodeExtEntity> { | ||||
|  | 
 | ||||
|  | 	/** | ||||
|  | 	 * 获取第三方配置模板 | ||||
|  | 	 * @author zhaoqifeng | ||||
|  | 	 * @date 2020/7/17 15:25 | ||||
|  | 	 * @param | ||||
|  | 	 * @return java.lang.String | ||||
|  | 	 */ | ||||
|  | 	String selectExtTemplate(@Param("clientType") String clientType); | ||||
|  | 
 | ||||
|  | 	/** | ||||
|  | 	 * 获取客户的第三方配置 | ||||
|  | 	 * @author zhaoqifeng | ||||
|  | 	 * @date 2020/7/17 15:26 | ||||
|  | 	 * @param customerId | ||||
|  | 	 * @param clientType | ||||
|  | 	 * @return java.lang.String | ||||
|  | 	 */ | ||||
|  | 	CodeExtDTO selectExtByCustomerId(@Param("customerId") String customerId, @Param("clientType") String clientType); | ||||
|  | 	 | ||||
|  | } | ||||
| @ -0,0 +1,61 @@ | |||||
|  | /** | ||||
|  |  * Copyright 2018 人人开源 https://www.renren.io
 | ||||
|  |  * <p> | ||||
|  |  * This program is free software: you can redistribute it and/or modify | ||||
|  |  * it under the terms of the GNU General Public License as published by | ||||
|  |  * the Free Software Foundation, either version 3 of the License, or | ||||
|  |  * (at your option) any later version. | ||||
|  |  * <p> | ||||
|  |  * This program is distributed in the hope that it will be useful, | ||||
|  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|  |  * GNU General Public License for more details. | ||||
|  |  * <p> | ||||
|  |  * You should have received a copy of the GNU General Public License | ||||
|  |  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
|  |  */ | ||||
|  | 
 | ||||
|  | package com.epmet.entity; | ||||
|  | 
 | ||||
|  | import com.baomidou.mybatisplus.annotation.TableName; | ||||
|  | 
 | ||||
|  | import com.epmet.commons.mybatis.entity.BaseEpmetEntity; | ||||
|  | import lombok.Data; | ||||
|  | import lombok.EqualsAndHashCode; | ||||
|  | 
 | ||||
|  | import java.util.Date; | ||||
|  | 
 | ||||
|  | /** | ||||
|  |  * 代码第三方配置  | ||||
|  |  * | ||||
|  |  * @author generator generator@elink-cn.com | ||||
|  |  * @since v1.0.0 2020-07-17 | ||||
|  |  */ | ||||
|  | @Data | ||||
|  | @EqualsAndHashCode(callSuper=false) | ||||
|  | @TableName("code_ext") | ||||
|  | public class CodeExtEntity extends BaseEpmetEntity { | ||||
|  | 
 | ||||
|  | 	private static final long serialVersionUID = 1L; | ||||
|  | 
 | ||||
|  |     /** | ||||
|  |      * 客户ID | ||||
|  |      */ | ||||
|  | 	private String customerId; | ||||
|  | 
 | ||||
|  |     /** | ||||
|  |      * 所属端 居民的:resi,工作端:work | ||||
|  |      */ | ||||
|  | 	private String clientType; | ||||
|  | 
 | ||||
|  |     /** | ||||
|  |      * APPID | ||||
|  |      */ | ||||
|  | 	private String appId; | ||||
|  | 
 | ||||
|  |     /** | ||||
|  |      * 自定义配置 | ||||
|  |      */ | ||||
|  | 	private String extJson; | ||||
|  | 
 | ||||
|  | } | ||||
| @ -0,0 +1,47 @@ | |||||
|  | /** | ||||
|  |  * Copyright 2018 人人开源 https://www.renren.io
 | ||||
|  |  * <p> | ||||
|  |  * This program is free software: you can redistribute it and/or modify | ||||
|  |  * it under the terms of the GNU General Public License as published by | ||||
|  |  * the Free Software Foundation, either version 3 of the License, or | ||||
|  |  * (at your option) any later version. | ||||
|  |  * <p> | ||||
|  |  * This program is distributed in the hope that it will be useful, | ||||
|  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|  |  * GNU General Public License for more details. | ||||
|  |  * <p> | ||||
|  |  * You should have received a copy of the GNU General Public License | ||||
|  |  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
|  |  */ | ||||
|  | 
 | ||||
|  | package com.epmet.redis; | ||||
|  | 
 | ||||
|  | import com.epmet.commons.tools.redis.RedisUtils; | ||||
|  | import org.springframework.beans.factory.annotation.Autowired; | ||||
|  | import org.springframework.stereotype.Component; | ||||
|  | 
 | ||||
|  | /** | ||||
|  |  * 代码第三方配置  | ||||
|  |  * | ||||
|  |  * @author generator generator@elink-cn.com | ||||
|  |  * @since v1.0.0 2020-07-17 | ||||
|  |  */ | ||||
|  | @Component | ||||
|  | public class CodeExtRedis { | ||||
|  |     @Autowired | ||||
|  |     private RedisUtils redisUtils; | ||||
|  | 
 | ||||
|  |     public void delete(Object[] ids) { | ||||
|  | 
 | ||||
|  |     } | ||||
|  | 
 | ||||
|  |     public void set(){ | ||||
|  | 
 | ||||
|  |     } | ||||
|  | 
 | ||||
|  |     public String get(String id){ | ||||
|  |         return null; | ||||
|  |     } | ||||
|  | 
 | ||||
|  | } | ||||
| @ -0,0 +1,116 @@ | |||||
|  | /** | ||||
|  |  * Copyright 2018 人人开源 https://www.renren.io
 | ||||
|  |  * <p> | ||||
|  |  * This program is free software: you can redistribute it and/or modify | ||||
|  |  * it under the terms of the GNU General Public License as published by | ||||
|  |  * the Free Software Foundation, either version 3 of the License, or | ||||
|  |  * (at your option) any later version. | ||||
|  |  * <p> | ||||
|  |  * This program is distributed in the hope that it will be useful, | ||||
|  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|  |  * GNU General Public License for more details. | ||||
|  |  * <p> | ||||
|  |  * You should have received a copy of the GNU General Public License | ||||
|  |  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
|  |  */ | ||||
|  | 
 | ||||
|  | package com.epmet.service; | ||||
|  | 
 | ||||
|  | import com.epmet.commons.mybatis.service.BaseService; | ||||
|  | import com.epmet.commons.tools.page.PageData; | ||||
|  | import com.epmet.dto.CodeExtDTO; | ||||
|  | import com.epmet.entity.CodeExtEntity; | ||||
|  | 
 | ||||
|  | import java.util.List; | ||||
|  | import java.util.Map; | ||||
|  | 
 | ||||
|  | /** | ||||
|  |  * 代码第三方配置 | ||||
|  |  * | ||||
|  |  * @author generator generator@elink-cn.com | ||||
|  |  * @since v1.0.0 2020-07-17 | ||||
|  |  */ | ||||
|  | public interface CodeExtService extends BaseService<CodeExtEntity> { | ||||
|  | 
 | ||||
|  | 	/** | ||||
|  | 	 * 默认分页 | ||||
|  | 	 * | ||||
|  | 	 * @param params | ||||
|  | 	 * @return PageData<CodeExtDTO> | ||||
|  | 	 * @author generator | ||||
|  | 	 * @date 2020-07-17 | ||||
|  | 	 */ | ||||
|  | 	PageData<CodeExtDTO> page(Map<String, Object> params); | ||||
|  | 
 | ||||
|  | 	/** | ||||
|  | 	 * 默认查询 | ||||
|  | 	 * | ||||
|  | 	 * @param params | ||||
|  | 	 * @return java.util.List<CodeExtDTO> | ||||
|  | 	 * @author generator | ||||
|  | 	 * @date 2020-07-17 | ||||
|  | 	 */ | ||||
|  | 	List<CodeExtDTO> list(Map<String, Object> params); | ||||
|  | 
 | ||||
|  | 	/** | ||||
|  | 	 * 单条查询 | ||||
|  | 	 * | ||||
|  | 	 * @param id | ||||
|  | 	 * @return CodeExtDTO | ||||
|  | 	 * @author generator | ||||
|  | 	 * @date 2020-07-17 | ||||
|  | 	 */ | ||||
|  | 	CodeExtDTO get(String id); | ||||
|  | 
 | ||||
|  | 	/** | ||||
|  | 	 * 默认保存 | ||||
|  | 	 * | ||||
|  | 	 * @param dto | ||||
|  | 	 * @return void | ||||
|  | 	 * @author generator | ||||
|  | 	 * @date 2020-07-17 | ||||
|  | 	 */ | ||||
|  | 	void save(CodeExtDTO dto); | ||||
|  | 
 | ||||
|  | 	/** | ||||
|  | 	 * 默认更新 | ||||
|  | 	 * | ||||
|  | 	 * @param dto | ||||
|  | 	 * @return void | ||||
|  | 	 * @author generator | ||||
|  | 	 * @date 2020-07-17 | ||||
|  | 	 */ | ||||
|  | 	void update(CodeExtDTO dto); | ||||
|  | 
 | ||||
|  | 	/** | ||||
|  | 	 * 批量删除 | ||||
|  | 	 * | ||||
|  | 	 * @param ids | ||||
|  | 	 * @return void | ||||
|  | 	 * @author generator | ||||
|  | 	 * @date 2020-07-17 | ||||
|  | 	 */ | ||||
|  | 	void delete(String[] ids); | ||||
|  | 
 | ||||
|  | 	/** | ||||
|  | 	 * 获取配置模板 | ||||
|  | 	 * | ||||
|  | 	 * @param clientType | ||||
|  | 	 * @return java.lang.String | ||||
|  | 	 * @author zhaoqifeng | ||||
|  | 	 * @date 2020/7/17 15:29 | ||||
|  | 	 */ | ||||
|  | 	String getExtTemplate(String clientType); | ||||
|  | 
 | ||||
|  | 	/** | ||||
|  | 	 * 获取客户第三方配置 | ||||
|  | 	 * | ||||
|  | 	 * @param customerId | ||||
|  | 	 * @param clientType | ||||
|  | 	 * @return java.lang.String | ||||
|  | 	 * @author zhaoqifeng | ||||
|  | 	 * @date 2020/7/17 15:29 | ||||
|  | 	 */ | ||||
|  | 	CodeExtDTO getExtByCustomer(String customerId, String clientType); | ||||
|  | } | ||||
| @ -0,0 +1,114 @@ | |||||
|  | /** | ||||
|  |  * Copyright 2018 人人开源 https://www.renren.io
 | ||||
|  |  * <p> | ||||
|  |  * This program is free software: you can redistribute it and/or modify | ||||
|  |  * it under the terms of the GNU General Public License as published by | ||||
|  |  * the Free Software Foundation, either version 3 of the License, or | ||||
|  |  * (at your option) any later version. | ||||
|  |  * <p> | ||||
|  |  * This program is distributed in the hope that it will be useful, | ||||
|  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|  |  * GNU General Public License for more details. | ||||
|  |  * <p> | ||||
|  |  * You should have received a copy of the GNU General Public License | ||||
|  |  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
|  |  */ | ||||
|  | 
 | ||||
|  | package com.epmet.service.impl; | ||||
|  | 
 | ||||
|  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||||
|  | import com.baomidou.mybatisplus.core.metadata.IPage; | ||||
|  | import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; | ||||
|  | import com.epmet.commons.tools.page.PageData; | ||||
|  | import com.epmet.commons.tools.utils.ConvertUtils; | ||||
|  | import com.epmet.commons.tools.constant.FieldConstant; | ||||
|  | import com.epmet.dao.CodeExtDao; | ||||
|  | import com.epmet.dto.CodeExtDTO; | ||||
|  | import com.epmet.entity.CodeExtEntity; | ||||
|  | import com.epmet.redis.CodeExtRedis; | ||||
|  | import com.epmet.service.CodeExtService; | ||||
|  | import org.apache.commons.lang3.StringUtils; | ||||
|  | import org.springframework.beans.factory.annotation.Autowired; | ||||
|  | import org.springframework.stereotype.Service; | ||||
|  | import org.springframework.transaction.annotation.Transactional; | ||||
|  | 
 | ||||
|  | import java.util.Arrays; | ||||
|  | import java.util.List; | ||||
|  | import java.util.Map; | ||||
|  | 
 | ||||
|  | /** | ||||
|  |  * 代码第三方配置  | ||||
|  |  * | ||||
|  |  * @author generator generator@elink-cn.com | ||||
|  |  * @since v1.0.0 2020-07-17 | ||||
|  |  */ | ||||
|  | @Service | ||||
|  | public class CodeExtServiceImpl extends BaseServiceImpl<CodeExtDao, CodeExtEntity> implements CodeExtService { | ||||
|  | 
 | ||||
|  |     @Autowired | ||||
|  |     private CodeExtRedis codeExtRedis; | ||||
|  | 
 | ||||
|  |     @Override | ||||
|  |     public PageData<CodeExtDTO> page(Map<String, Object> params) { | ||||
|  |         IPage<CodeExtEntity> page = baseDao.selectPage( | ||||
|  |                 getPage(params, FieldConstant.CREATED_TIME, false), | ||||
|  |                 getWrapper(params) | ||||
|  |         ); | ||||
|  |         return getPageData(page, CodeExtDTO.class); | ||||
|  |     } | ||||
|  | 
 | ||||
|  |     @Override | ||||
|  |     public List<CodeExtDTO> list(Map<String, Object> params) { | ||||
|  |         List<CodeExtEntity> entityList = baseDao.selectList(getWrapper(params)); | ||||
|  | 
 | ||||
|  |         return ConvertUtils.sourceToTarget(entityList, CodeExtDTO.class); | ||||
|  |     } | ||||
|  | 
 | ||||
|  |     private QueryWrapper<CodeExtEntity> getWrapper(Map<String, Object> params){ | ||||
|  |         String id = (String)params.get(FieldConstant.ID_HUMP); | ||||
|  | 
 | ||||
|  |         QueryWrapper<CodeExtEntity> wrapper = new QueryWrapper<>(); | ||||
|  |         wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); | ||||
|  | 
 | ||||
|  |         return wrapper; | ||||
|  |     } | ||||
|  | 
 | ||||
|  |     @Override | ||||
|  |     public CodeExtDTO get(String id) { | ||||
|  |         CodeExtEntity entity = baseDao.selectById(id); | ||||
|  |         return ConvertUtils.sourceToTarget(entity, CodeExtDTO.class); | ||||
|  |     } | ||||
|  | 
 | ||||
|  |     @Override | ||||
|  |     @Transactional(rollbackFor = Exception.class) | ||||
|  |     public void save(CodeExtDTO dto) { | ||||
|  |         CodeExtEntity entity = ConvertUtils.sourceToTarget(dto, CodeExtEntity.class); | ||||
|  |         insert(entity); | ||||
|  |     } | ||||
|  | 
 | ||||
|  |     @Override | ||||
|  |     @Transactional(rollbackFor = Exception.class) | ||||
|  |     public void update(CodeExtDTO dto) { | ||||
|  |         CodeExtEntity entity = ConvertUtils.sourceToTarget(dto, CodeExtEntity.class); | ||||
|  |         updateById(entity); | ||||
|  |     } | ||||
|  | 
 | ||||
|  |     @Override | ||||
|  |     @Transactional(rollbackFor = Exception.class) | ||||
|  |     public void delete(String[] ids) { | ||||
|  |         // 逻辑删除(@TableLogic 注解)
 | ||||
|  |         baseDao.deleteBatchIds(Arrays.asList(ids)); | ||||
|  |     } | ||||
|  | 
 | ||||
|  |     @Override | ||||
|  |     public String getExtTemplate(String clientType) { | ||||
|  |         return baseDao.selectExtTemplate(clientType); | ||||
|  |     } | ||||
|  | 
 | ||||
|  |     @Override | ||||
|  |     public CodeExtDTO getExtByCustomer(String customerId, String clientType) { | ||||
|  |         return baseDao.selectExtByCustomerId(customerId, clientType); | ||||
|  |     } | ||||
|  | 
 | ||||
|  | } | ||||
| @ -0,0 +1,44 @@ | |||||
|  | package com.epmet.wxapi.param; | ||||
|  | 
 | ||||
|  | import com.google.gson.annotations.SerializedName; | ||||
|  | import lombok.Data; | ||||
|  | import lombok.NoArgsConstructor; | ||||
|  | 
 | ||||
|  | import java.io.Serializable; | ||||
|  | import java.util.List; | ||||
|  | 
 | ||||
|  | /** | ||||
|  |  * @author zhaoqifeng | ||||
|  |  * @dscription | ||||
|  |  * @date 2020/7/16 17:28 | ||||
|  |  */ | ||||
|  | @NoArgsConstructor | ||||
|  | @Data | ||||
|  | public class WxMaModifyDomainReq implements Serializable { | ||||
|  | 
 | ||||
|  | 	private static final long serialVersionUID = 2768949609300541671L; | ||||
|  | 	/** | ||||
|  | 	 * 操作类型 | ||||
|  | 	 */ | ||||
|  | 	private String action; | ||||
|  | 	/** | ||||
|  | 	 * request 合法域名 | ||||
|  | 	 */ | ||||
|  | 	@SerializedName("requestdomain") | ||||
|  | 	private List<String> requestDomain; | ||||
|  | 	/** | ||||
|  | 	 * socket 合法域名 | ||||
|  | 	 */ | ||||
|  | 	@SerializedName("wsrequestdomain") | ||||
|  | 	private List<String> wsRequestDomain; | ||||
|  | 	/** | ||||
|  | 	 * uploadFile 合法域名 | ||||
|  | 	 */ | ||||
|  | 	@SerializedName("uploaddomain") | ||||
|  | 	private List<String> uploadDomain; | ||||
|  | 	/** | ||||
|  | 	 * downloadFile 合法域名 | ||||
|  | 	 */ | ||||
|  | 	@SerializedName("downloaddomain") | ||||
|  | 	private List<String> downloadDomain; | ||||
|  | } | ||||
| @ -0,0 +1,29 @@ | |||||
|  | package com.epmet.wxapi.param; | ||||
|  | 
 | ||||
|  | import com.google.gson.annotations.SerializedName; | ||||
|  | import lombok.Data; | ||||
|  | import lombok.NoArgsConstructor; | ||||
|  | 
 | ||||
|  | import java.io.Serializable; | ||||
|  | import java.util.List; | ||||
|  | 
 | ||||
|  | /** | ||||
|  |  * @author zhaoqifeng | ||||
|  |  * @dscription | ||||
|  |  * @date 2020/7/16 17:31 | ||||
|  |  */ | ||||
|  | @NoArgsConstructor | ||||
|  | @Data | ||||
|  | public class WxMaSetWebviewDomainReq implements Serializable { | ||||
|  | 
 | ||||
|  | 	private static final long serialVersionUID = 4560145267553484959L; | ||||
|  | 	/** | ||||
|  | 	 * 操作类型 | ||||
|  | 	 */ | ||||
|  | 	private String action; | ||||
|  | 	/** | ||||
|  | 	 * 小程序业务域名 | ||||
|  | 	 */ | ||||
|  | 	@SerializedName("webviewdomain") | ||||
|  | 	private List<String> webViewDomain; | ||||
|  | } | ||||
| @ -0,0 +1,25 @@ | |||||
|  | package com.epmet.wxapi.result; | ||||
|  | 
 | ||||
|  | import com.google.gson.annotations.SerializedName; | ||||
|  | import lombok.Data; | ||||
|  | 
 | ||||
|  | import java.io.Serializable; | ||||
|  | 
 | ||||
|  | /** | ||||
|  |  * @author zhaoqifeng | ||||
|  |  * @dscription | ||||
|  |  * @date 2020/7/17 14:10 | ||||
|  |  */ | ||||
|  | @Data | ||||
|  | public class WxMaUploadMediaResult implements Serializable { | ||||
|  | 	private static final long serialVersionUID = 7258823761146570668L; | ||||
|  | 	@SerializedName("errcode") | ||||
|  | 	private Integer errCode = 0; | ||||
|  | 	@SerializedName("errmsg") | ||||
|  | 	private String errMsg; | ||||
|  | 	private String type; | ||||
|  | 	@SerializedName("media_id") | ||||
|  | 	private String mediaId; | ||||
|  | 	@SerializedName("created_at") | ||||
|  | 	private String createdAt; | ||||
|  | } | ||||
| @ -0,0 +1,41 @@ | |||||
|  | <?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="com.epmet.dao.CodeExtDao"> | ||||
|  | 
 | ||||
|  |     <resultMap type="com.epmet.entity.CodeExtEntity" id="codeExtMap"> | ||||
|  |         <result property="id" column="ID"/> | ||||
|  |         <result property="customerId" column="CUSTOMER_ID"/> | ||||
|  |         <result property="clientType" column="CLIENT_TYPE"/> | ||||
|  |         <result property="appId" column="APP_ID"/> | ||||
|  |         <result property="extJson" column="EXT_JSON"/> | ||||
|  |         <result property="revision" column="REVISION"/> | ||||
|  |         <result property="delFlag" column="DEL_FLAG"/> | ||||
|  |         <result property="createdBy" column="CREATED_BY"/> | ||||
|  |         <result property="createdTime" column="CREATED_TIME"/> | ||||
|  |         <result property="updatedBy" column="UPDATED_BY"/> | ||||
|  |         <result property="updatedTime" column="UPDATED_TIME"/> | ||||
|  |     </resultMap> | ||||
|  |     <select id="selectExtTemplate" resultType="java.lang.String"> | ||||
|  |         SELECT | ||||
|  |             EXT_JSON | ||||
|  |         FROM | ||||
|  |             code_ext | ||||
|  |         WHERE | ||||
|  |             DEL_FLAG = '0' | ||||
|  |             AND CUSTOMER_ID = '*' | ||||
|  |             AND CLIENT_TYPE = #{clientType} | ||||
|  |     </select> | ||||
|  |     <select id="selectExtByCustomerId" resultType="com.epmet.dto.CodeExtDTO"> | ||||
|  |         SELECT | ||||
|  |             * | ||||
|  |         FROM | ||||
|  |             code_ext | ||||
|  |         WHERE | ||||
|  |             DEL_FLAG = '0' | ||||
|  |           AND CUSTOMER_ID = #{customerId} | ||||
|  |           AND CLIENT_TYPE = #{clientType} | ||||
|  |     </select> | ||||
|  | 
 | ||||
|  | 
 | ||||
|  | </mapper> | ||||
					Loading…
					
					
				
		Reference in new issue