| | |
| | | public static final String STORE_TYPE_ADMIN = "800900000001"; |
| | | public static final String STORE_TYPE_PROPERTY = "800900000003"; |
| | | |
| | | public static final String STATE_NORMAL = "48001"; |
| | | public static final String STATE_LOGIN_FAIL = "48001"; |
| | | |
| | | private String storeId; |
| | | private String[] storeIds; |
| | | private String userId; |
| New file |
| | |
| | | <?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="storeV1ServiceDaoImpl"> |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | <!-- 保存商户信息信息 add by wuxw 2018-07-03 --> |
| | | <insert id="saveStoreInfo" parameterType="Map"> |
| | | insert into s_store( |
| | | address,store_type_cd,name,tel,state,store_id,user_id,map_y,map_x |
| | | ) values ( |
| | | #{address},#{storeTypeCd},#{name},#{tel},#{state},#{storeId},#{userId},#{mapY},#{mapX} |
| | | ) |
| | | </insert> |
| | | |
| | | |
| | | |
| | | <!-- 查询商户信息信息 add by wuxw 2018-07-03 --> |
| | | <select id="getStoreInfo" parameterType="Map" resultType="Map"> |
| | | select t.address,t.store_type_cd,t.store_type_cd storeTypeCd,t.name,t.tel,t.status_cd,t.status_cd statusCd,t.state,t.store_id,t.store_id storeId,t.user_id,t.user_id userId,t.map_y,t.map_y mapY,t.map_x,t.map_x mapX |
| | | from s_store t |
| | | where 1 =1 |
| | | <if test="address !=null and address != ''"> |
| | | and t.address= #{address} |
| | | </if> |
| | | <if test="storeTypeCd !=null and storeTypeCd != ''"> |
| | | and t.store_type_cd= #{storeTypeCd} |
| | | </if> |
| | | <if test="name !=null and name != ''"> |
| | | and t.name= #{name} |
| | | </if> |
| | | <if test="tel !=null and tel != ''"> |
| | | and t.tel= #{tel} |
| | | </if> |
| | | <if test="statusCd !=null and statusCd != ''"> |
| | | and t.status_cd= #{statusCd} |
| | | </if> |
| | | <if test="state !=null and state != ''"> |
| | | and t.state= #{state} |
| | | </if> |
| | | <if test="storeId !=null and storeId != ''"> |
| | | and t.store_id= #{storeId} |
| | | </if> |
| | | <if test="userId !=null and userId != ''"> |
| | | and t.user_id= #{userId} |
| | | </if> |
| | | <if test="mapY !=null and mapY != ''"> |
| | | and t.map_y= #{mapY} |
| | | </if> |
| | | <if test="mapX !=null and mapX != ''"> |
| | | and t.map_x= #{mapX} |
| | | </if> |
| | | order by t.create_time desc |
| | | <if test="page != -1 and page != null "> |
| | | limit #{page}, #{row} |
| | | </if> |
| | | |
| | | </select> |
| | | |
| | | |
| | | |
| | | |
| | | <!-- 修改商户信息信息 add by wuxw 2018-07-03 --> |
| | | <update id="updateStoreInfo" parameterType="Map"> |
| | | update s_store t set t.status_cd = #{statusCd} |
| | | <if test="newBId != null and newBId != ''"> |
| | | ,t.b_id = #{newBId} |
| | | </if> |
| | | <if test="address !=null and address != ''"> |
| | | , t.address= #{address} |
| | | </if> |
| | | <if test="storeTypeCd !=null and storeTypeCd != ''"> |
| | | , t.store_type_cd= #{storeTypeCd} |
| | | </if> |
| | | <if test="name !=null and name != ''"> |
| | | , t.name= #{name} |
| | | </if> |
| | | <if test="tel !=null and tel != ''"> |
| | | , t.tel= #{tel} |
| | | </if> |
| | | <if test="state !=null and state != ''"> |
| | | , t.state= #{state} |
| | | </if> |
| | | <if test="userId !=null and userId != ''"> |
| | | , t.user_id= #{userId} |
| | | </if> |
| | | <if test="mapY !=null and mapY != ''"> |
| | | , t.map_y= #{mapY} |
| | | </if> |
| | | <if test="mapX !=null and mapX != ''"> |
| | | , t.map_x= #{mapX} |
| | | </if> |
| | | where 1=1 <if test="storeId !=null and storeId != ''"> |
| | | and t.store_id= #{storeId} |
| | | </if> |
| | | |
| | | </update> |
| | | |
| | | <!-- 查询商户信息数量 add by wuxw 2018-07-03 --> |
| | | <select id="queryStoresCount" parameterType="Map" resultType="Map"> |
| | | select count(1) count |
| | | from s_store t |
| | | where 1 =1 |
| | | <if test="address !=null and address != ''"> |
| | | and t.address= #{address} |
| | | </if> |
| | | <if test="storeTypeCd !=null and storeTypeCd != ''"> |
| | | and t.store_type_cd= #{storeTypeCd} |
| | | </if> |
| | | <if test="name !=null and name != ''"> |
| | | and t.name= #{name} |
| | | </if> |
| | | <if test="tel !=null and tel != ''"> |
| | | and t.tel= #{tel} |
| | | </if> |
| | | <if test="statusCd !=null and statusCd != ''"> |
| | | and t.status_cd= #{statusCd} |
| | | </if> |
| | | <if test="state !=null and state != ''"> |
| | | and t.state= #{state} |
| | | </if> |
| | | <if test="storeId !=null and storeId != ''"> |
| | | and t.store_id= #{storeId} |
| | | </if> |
| | | <if test="userId !=null and userId != ''"> |
| | | and t.user_id= #{userId} |
| | | </if> |
| | | <if test="mapY !=null and mapY != ''"> |
| | | and t.map_y= #{mapY} |
| | | </if> |
| | | <if test="mapX !=null and mapX != ''"> |
| | | and t.map_x= #{mapX} |
| | | </if> |
| | | |
| | | |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | public class TableToJson { |
| | | |
| | | //show create table c_orders 用这个语句获取 |
| | | public static final String createTableSql = "CREATE TABLE `m_menu_user` (\n" + |
| | | " `mu_id` varchar(30) NOT NULL COMMENT '编号',\n" + |
| | | " `m_id` varchar(30) NOT NULL COMMENT '菜单ID',\n" + |
| | | " `staff_id` varchar(30) NOT NULL COMMENT '员工ID',\n" + |
| | | " `name` varchar(64) NOT NULL COMMENT '菜单名称',\n" + |
| | | " `icon` varchar(128) NOT NULL COMMENT '菜单组ID',\n" + |
| | | " `url` varchar(200) NOT NULL COMMENT '打开地址',\n" + |
| | | " `seq` int(11) NOT NULL COMMENT '列顺序',\n" + |
| | | public static final String createTableSql = "CREATE TABLE `s_store` (\n" + |
| | | " `store_id` varchar(30) NOT NULL COMMENT '商店ID',\n" + |
| | | " `b_id` varchar(30) NOT NULL COMMENT '业务Id',\n" + |
| | | " `user_id` varchar(30) NOT NULL COMMENT '用户ID',\n" + |
| | | " `name` varchar(100) NOT NULL COMMENT '店铺名称',\n" + |
| | | " `address` varchar(200) NOT NULL COMMENT '店铺地址',\n" + |
| | | " `tel` varchar(11) NOT NULL COMMENT '电话',\n" + |
| | | " `store_type_cd` varchar(12) DEFAULT NULL,\n" + |
| | | " `nearby_landmarks` varchar(200) DEFAULT NULL COMMENT '地标,如王府井北60米',\n" + |
| | | " `map_x` varchar(20) NOT NULL COMMENT '地区 x坐标',\n" + |
| | | " `map_y` varchar(20) NOT NULL COMMENT '地区 y坐标',\n" + |
| | | " `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',\n" + |
| | | " `status_cd` varchar(2) NOT NULL DEFAULT '0' COMMENT '数据状态,详细参考c_status表,0在用,1失效'\n" + |
| | | " `status_cd` varchar(2) NOT NULL DEFAULT '0' COMMENT '数据状态,详细参考c_status表,S 保存,0, 在用 1失效',\n" + |
| | | " `state` varchar(12) NOT NULL DEFAULT '48001' COMMENT '48001 商户正常状态 48002 限制商户登录'\n" + |
| | | ") "; |
| | | |
| | | public static void main(String[] args) { |
| | | String desc = "自定义菜单"; |
| | | String id = "muId"; |
| | | String name = "menuUser"; |
| | | String shareName = "user"; //生成到那个服务下 |
| | | String shareColumn = "m_id"; |
| | | String shareParam = "mId"; |
| | | String desc = "商户信息"; |
| | | String id = "storeId"; |
| | | String name = "store"; |
| | | String shareName = "store"; //生成到那个服务下 |
| | | String shareColumn = "store_type_cd"; |
| | | String shareParam = "storeTypeCd"; |
| | | //业务名称 desc 业务编码名称生成后类名 name 主键 id 需要放到那个服务 shareName |
| | | String newSql = createTableSql.substring(createTableSql.indexOf("(") + 1, createTableSql.lastIndexOf(")")); |
| | | String tableName = createTableSql.substring(createTableSql.indexOf("TABLE") + 5, createTableSql.indexOf("(")); |
| | |
| | | generatorInnerServiceSMOImpl.generator(data); |
| | | |
| | | GeneratorDtoBean generatorDtoBean = new GeneratorDtoBean(); |
| | | generatorDtoBean.generator(data); |
| | | //generatorDtoBean.generator(data); |
| | | |
| | | GeneratorIInnerServiceSMO generatorIInnerServiceSMO = new GeneratorIInnerServiceSMO(); |
| | | generatorIInnerServiceSMO.generator(data); |
| | |
| | | * @param data |
| | | */ |
| | | public void generator(Data data) throws Exception { |
| | | genneratorPo(data); //API DataVo对象 |
| | | //genneratorPo(data); //API DataVo对象 |
| | | genneratorSaveCmd(data); //Api BmoImpl |
| | | genneratorUpdateBmoImpl(data); //Api BmoImpl |
| | | genneratorDeleteBmoImpl(data); //Api BmoImpl |
| | |
| | | { |
| | | "param": { |
| | | "muId": "mu_id", |
| | | "address": "address", |
| | | "storeTypeCd": "store_type_cd", |
| | | "name": "name", |
| | | "icon": "icon", |
| | | "mId": "m_id", |
| | | "tel": "tel", |
| | | "statusCd": "status_cd", |
| | | "staffId": "staff_id", |
| | | "url": "url", |
| | | "seq": "seq" |
| | | "state": "state", |
| | | "storeId": "store_id", |
| | | "userId": "user_id", |
| | | "mapY": "map_y", |
| | | "mapX": "map_x" |
| | | }, |
| | | "name": "menuUser", |
| | | "shareColumn": "m_id", |
| | | "id": "muId", |
| | | "shareName": "user", |
| | | "name": "store", |
| | | "shareColumn": "store_type_cd", |
| | | "id": "storeId", |
| | | "shareName": "store", |
| | | "autoMove": true, |
| | | "required": [ |
| | | { |
| | | "msg": "菜单ID不能为空", |
| | | "code": "mId" |
| | | }, |
| | | { |
| | | "msg": "员工ID不能为空", |
| | | "code": "staffId" |
| | | }, |
| | | { |
| | | "msg": "菜单名称不能为空", |
| | | "msg": "店铺名称不能为空", |
| | | "code": "name" |
| | | }, |
| | | { |
| | | "msg": "菜单组ID不能为空", |
| | | "code": "icon" |
| | | "msg": "店铺地址不能为空", |
| | | "code": "address" |
| | | }, |
| | | { |
| | | "msg": "打开地址不能为空", |
| | | "code": "url" |
| | | }, |
| | | { |
| | | "msg": "列顺序不能为空", |
| | | "code": "seq" |
| | | "msg": "电话不能为空", |
| | | "code": "tel" |
| | | } |
| | | ], |
| | | "desc": "自定义菜单", |
| | | "shareParam": "mId", |
| | | "tableName": "m_menu_user" |
| | | } |
| | | "desc": "商户信息", |
| | | "shareParam": "storeTypeCd", |
| | | "tableName": "s_store" |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2017-2020 吴学文 and java110 team. |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package com.java110.intf.store; |
| | | |
| | | import com.java110.config.feign.FeignConfiguration; |
| | | import com.java110.dto.store.StoreDto; |
| | | import com.java110.po.store.StorePo; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 类表述: 服务之前调用的接口类,不对外提供接口能力 只用于接口建调用 |
| | | * add by 吴学文 at 2022-02-28 10:46:30 mail: 928255095@qq.com |
| | | * open source address: https://gitee.com/wuxw7/MicroCommunity |
| | | * 官网:http://www.homecommunity.cn |
| | | * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下 |
| | | * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行 |
| | | */ |
| | | @FeignClient(name = "store-service", configuration = {FeignConfiguration.class}) |
| | | @RequestMapping("/storeV1Api") |
| | | public interface IStoreV1InnerServiceSMO { |
| | | |
| | | |
| | | @RequestMapping(value = "/saveStore", method = RequestMethod.POST) |
| | | public int saveStore(@RequestBody StorePo storePo); |
| | | |
| | | @RequestMapping(value = "/updateStore", method = RequestMethod.POST) |
| | | public int updateStore(@RequestBody StorePo storePo); |
| | | |
| | | @RequestMapping(value = "/deleteStore", method = RequestMethod.POST) |
| | | public int deleteStore(@RequestBody StorePo storePo); |
| | | |
| | | /** |
| | | * <p>查询小区楼信息</p> |
| | | * |
| | | * |
| | | * @param storeDto 数据对象分享 |
| | | * @return StoreDto 对象数据 |
| | | */ |
| | | @RequestMapping(value = "/queryStores", method = RequestMethod.POST) |
| | | List<StoreDto> queryStores(@RequestBody StoreDto storeDto); |
| | | |
| | | /** |
| | | * 查询<p>小区楼</p>总记录数 |
| | | * |
| | | * @param storeDto 数据对象分享 |
| | | * @return 小区下的小区楼记录数 |
| | | */ |
| | | @RequestMapping(value = "/queryStoresCount", method = RequestMethod.POST) |
| | | int queryStoresCount(@RequestBody StoreDto storeDto); |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2017-2020 吴学文 and java110 team. |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package com.java110.store.cmd.property; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.annotation.Java110Cmd; |
| | | import com.java110.core.annotation.Java110Transactional; |
| | | import com.java110.core.context.ICmdDataFlowContext; |
| | | import com.java110.core.event.cmd.AbstractServiceCmdListener; |
| | | import com.java110.core.event.cmd.CmdEvent; |
| | | import com.java110.intf.store.IStoreV1InnerServiceSMO; |
| | | import com.java110.po.store.StorePo; |
| | | import com.java110.utils.exception.CmdException; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import com.java110.vo.ResultVo; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | |
| | | /** |
| | | * 类表述:删除 |
| | | * 服务编码:store.deleteStore |
| | | * 请求路劲:/app/store.DeleteStore |
| | | * add by 吴学文 at 2022-02-28 10:46:30 mail: 928255095@qq.com |
| | | * open source address: https://gitee.com/wuxw7/MicroCommunity |
| | | * 官网:http://www.homecommunity.cn |
| | | * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下 |
| | | * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行 |
| | | */ |
| | | @Java110Cmd(serviceCode = "property.deleteProperty") |
| | | public class DeletePropertyCmd extends AbstractServiceCmdListener { |
| | | private static Logger logger = LoggerFactory.getLogger(DeletePropertyCmd.class); |
| | | |
| | | @Autowired |
| | | private IStoreV1InnerServiceSMO storeV1InnerServiceSMOImpl; |
| | | |
| | | @Override |
| | | public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) { |
| | | Assert.hasKeyAndValue(reqJson, "storeId", "storeId不能为空"); |
| | | Assert.hasKeyAndValue(reqJson, "storeTypeCd", "storeTypeCd不能为空"); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | @Java110Transactional |
| | | public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException { |
| | | |
| | | StorePo storePo = BeanConvertUtil.covertBean(reqJson, StorePo.class); |
| | | int flag = storeV1InnerServiceSMOImpl.deleteStore(storePo); |
| | | |
| | | if (flag < 1) { |
| | | throw new CmdException("删除数据失败"); |
| | | } |
| | | |
| | | cmdDataFlowContext.setResponseEntity(ResultVo.success()); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2017-2020 吴学文 and java110 team. |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package com.java110.store.cmd.property; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.annotation.Java110Cmd; |
| | | import com.java110.core.context.ICmdDataFlowContext; |
| | | import com.java110.core.event.cmd.AbstractServiceCmdListener; |
| | | import com.java110.core.event.cmd.CmdEvent; |
| | | import com.java110.intf.store.IStoreV1InnerServiceSMO; |
| | | import com.java110.utils.exception.CmdException; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import com.java110.vo.ResultVo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.java110.dto.store.StoreDto; |
| | | import java.util.List; |
| | | import java.util.ArrayList; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | |
| | | /** |
| | | * 类表述:查询 |
| | | * 服务编码:store.listStore |
| | | * 请求路劲:/app/store.ListStore |
| | | * add by 吴学文 at 2022-02-28 10:46:30 mail: 928255095@qq.com |
| | | * open source address: https://gitee.com/wuxw7/MicroCommunity |
| | | * 官网:http://www.homecommunity.cn |
| | | * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下 |
| | | * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行 |
| | | */ |
| | | @Java110Cmd(serviceCode = "property.listProperty") |
| | | public class ListPropertyCmd extends AbstractServiceCmdListener { |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(ListPropertyCmd.class); |
| | | @Autowired |
| | | private IStoreV1InnerServiceSMO storeV1InnerServiceSMOImpl; |
| | | |
| | | @Override |
| | | public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) { |
| | | super.validatePageInfo(reqJson); |
| | | } |
| | | |
| | | @Override |
| | | public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException { |
| | | |
| | | StoreDto storeDto = BeanConvertUtil.covertBean(reqJson, StoreDto.class); |
| | | |
| | | int count = storeV1InnerServiceSMOImpl.queryStoresCount(storeDto); |
| | | |
| | | List<StoreDto> storeDtos = null; |
| | | |
| | | if (count > 0) { |
| | | storeDtos = storeV1InnerServiceSMOImpl.queryStores(storeDto); |
| | | } else { |
| | | storeDtos = new ArrayList<>(); |
| | | } |
| | | |
| | | ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) reqJson.getInteger("row")), count, storeDtos); |
| | | |
| | | ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK); |
| | | |
| | | cmdDataFlowContext.setResponseEntity(responseEntity); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2017-2020 吴学文 and java110 team. |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package com.java110.store.cmd.property; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.annotation.Java110Cmd; |
| | | import com.java110.core.annotation.Java110Transactional; |
| | | import com.java110.core.context.ICmdDataFlowContext; |
| | | import com.java110.core.event.cmd.AbstractServiceCmdListener; |
| | | import com.java110.core.event.cmd.CmdEvent; |
| | | import com.java110.core.factory.GenerateCodeFactory; |
| | | import com.java110.dto.store.StoreDto; |
| | | import com.java110.intf.store.IStoreV1InnerServiceSMO; |
| | | import com.java110.po.store.StorePo; |
| | | import com.java110.utils.exception.CmdException; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import com.java110.vo.ResultVo; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | |
| | | /** |
| | | * 类表述:保存 |
| | | * 服务编码:store.saveStore |
| | | * 请求路劲:/app/store.SaveStore |
| | | * add by 吴学文 at 2022-02-28 10:46:30 mail: 928255095@qq.com |
| | | * open source address: https://gitee.com/wuxw7/MicroCommunity |
| | | * 官网:http://www.homecommunity.cn |
| | | * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下 |
| | | * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行 |
| | | */ |
| | | @Java110Cmd(serviceCode = "property.saveProperty") |
| | | public class SavePropertyCmd extends AbstractServiceCmdListener { |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(SavePropertyCmd.class); |
| | | |
| | | public static final String CODE_PREFIX_ID = "10"; |
| | | |
| | | @Autowired |
| | | private IStoreV1InnerServiceSMO storeV1InnerServiceSMOImpl; |
| | | |
| | | @Override |
| | | public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) { |
| | | Assert.hasKeyAndValue(reqJson, "name", "请求报文中未包含name"); |
| | | Assert.hasKeyAndValue(reqJson, "address", "请求报文中未包含address"); |
| | | Assert.hasKeyAndValue(reqJson, "tel", "请求报文中未包含tel"); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | @Java110Transactional |
| | | public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException { |
| | | |
| | | StorePo storePo = BeanConvertUtil.covertBean(reqJson, StorePo.class); |
| | | storePo.setStoreId(GenerateCodeFactory.getGeneratorId(CODE_PREFIX_ID)); |
| | | storePo.setStoreTypeCd(StoreDto.STORE_TYPE_PROPERTY); |
| | | storePo.setState(StoreDto.STATE_NORMAL); |
| | | int flag = storeV1InnerServiceSMOImpl.saveStore(storePo); |
| | | |
| | | if (flag < 1) { |
| | | throw new CmdException("保存数据失败"); |
| | | } |
| | | |
| | | cmdDataFlowContext.setResponseEntity(ResultVo.success()); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2017-2020 吴学文 and java110 team. |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package com.java110.store.cmd.property; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.annotation.Java110Cmd; |
| | | import com.java110.core.annotation.Java110Transactional; |
| | | import com.java110.core.context.ICmdDataFlowContext; |
| | | import com.java110.core.event.cmd.AbstractServiceCmdListener; |
| | | import com.java110.core.event.cmd.CmdEvent; |
| | | import com.java110.intf.store.IStoreV1InnerServiceSMO; |
| | | import com.java110.po.store.StorePo; |
| | | import com.java110.utils.exception.CmdException; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import com.java110.vo.ResultVo; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | |
| | | |
| | | /** |
| | | * 类表述:更新 |
| | | * 服务编码:store.updateStore |
| | | * 请求路劲:/app/store.UpdateStore |
| | | * add by 吴学文 at 2022-02-28 10:46:30 mail: 928255095@qq.com |
| | | * open source address: https://gitee.com/wuxw7/MicroCommunity |
| | | * 官网:http://www.homecommunity.cn |
| | | * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下 |
| | | * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行 |
| | | */ |
| | | @Java110Cmd(serviceCode = "property.updateProperty") |
| | | public class UpdatePropertyCmd extends AbstractServiceCmdListener { |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(UpdatePropertyCmd.class); |
| | | |
| | | |
| | | @Autowired |
| | | private IStoreV1InnerServiceSMO storeV1InnerServiceSMOImpl; |
| | | |
| | | @Override |
| | | public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) { |
| | | Assert.hasKeyAndValue(reqJson, "storeId", "storeId不能为空"); |
| | | Assert.hasKeyAndValue(reqJson, "storeTypeCd", "storeTypeCd不能为空"); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | @Java110Transactional |
| | | public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException { |
| | | |
| | | StorePo storePo = BeanConvertUtil.covertBean(reqJson, StorePo.class); |
| | | int flag = storeV1InnerServiceSMOImpl.updateStore(storePo); |
| | | |
| | | if (flag < 1) { |
| | | throw new CmdException("更新数据失败"); |
| | | } |
| | | |
| | | cmdDataFlowContext.setResponseEntity(ResultVo.success()); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2017-2020 吴学文 and java110 team. |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package com.java110.store.dao; |
| | | |
| | | |
| | | import com.java110.utils.exception.DAOException; |
| | | import com.java110.entity.merchant.BoMerchant; |
| | | import com.java110.entity.merchant.BoMerchantAttr; |
| | | import com.java110.entity.merchant.Merchant; |
| | | import com.java110.entity.merchant.MerchantAttr; |
| | | |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 类表述: |
| | | * add by 吴学文 at 2022-02-28 10:46:30 mail: 928255095@qq.com |
| | | * open source address: https://gitee.com/wuxw7/MicroCommunity |
| | | * 官网:http://www.homecommunity.cn |
| | | * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下 |
| | | * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行 |
| | | */ |
| | | public interface IStoreV1ServiceDao { |
| | | |
| | | |
| | | /** |
| | | * 保存 商户信息信息 |
| | | * @param info |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | int saveStoreInfo(Map info) throws DAOException; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 查询商户信息信息(instance过程) |
| | | * 根据bId 查询商户信息信息 |
| | | * @param info bId 信息 |
| | | * @return 商户信息信息 |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | List<Map> getStoreInfo(Map info) throws DAOException; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 修改商户信息信息 |
| | | * @param info 修改信息 |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | int updateStoreInfo(Map info) throws DAOException; |
| | | |
| | | |
| | | /** |
| | | * 查询商户信息总数 |
| | | * |
| | | * @param info 商户信息信息 |
| | | * @return 商户信息数量 |
| | | */ |
| | | int queryStoresCount(Map info); |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2017-2020 吴学文 and java110 team. |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package com.java110.store.dao.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.utils.constant.ResponseConstant; |
| | | import com.java110.utils.exception.DAOException; |
| | | import com.java110.utils.util.DateUtil; |
| | | import com.java110.core.base.dao.BaseServiceDao; |
| | | import com.java110.store.dao.IStoreV1ServiceDao; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 类表述: |
| | | * add by 吴学文 at 2022-02-28 10:46:30 mail: 928255095@qq.com |
| | | * open source address: https://gitee.com/wuxw7/MicroCommunity |
| | | * 官网:http://www.homecommunity.cn |
| | | * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下 |
| | | * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行 |
| | | */ |
| | | @Service("storeV1ServiceDaoImpl") |
| | | public class StoreV1ServiceDaoImpl extends BaseServiceDao implements IStoreV1ServiceDao { |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(StoreV1ServiceDaoImpl.class); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 保存商户信息信息 到 instance |
| | | * @param info bId 信息 |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | @Override |
| | | public int saveStoreInfo(Map info) throws DAOException { |
| | | logger.debug("保存 saveStoreInfo 入参 info : {}",info); |
| | | |
| | | int saveFlag = sqlSessionTemplate.insert("storeV1ServiceDaoImpl.saveStoreInfo",info); |
| | | |
| | | return saveFlag; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询商户信息信息(instance) |
| | | * @param info bId 信息 |
| | | * @return List<Map> |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | @Override |
| | | public List<Map> getStoreInfo(Map info) throws DAOException { |
| | | logger.debug("查询 getStoreInfo 入参 info : {}",info); |
| | | |
| | | List<Map> businessStoreInfos = sqlSessionTemplate.selectList("storeV1ServiceDaoImpl.getStoreInfo",info); |
| | | |
| | | return businessStoreInfos; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改商户信息信息 |
| | | * @param info 修改信息 |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | @Override |
| | | public int updateStoreInfo(Map info) throws DAOException { |
| | | logger.debug("修改 updateStoreInfo 入参 info : {}",info); |
| | | |
| | | int saveFlag = sqlSessionTemplate.update("storeV1ServiceDaoImpl.updateStoreInfo",info); |
| | | |
| | | return saveFlag; |
| | | } |
| | | |
| | | /** |
| | | * 查询商户信息数量 |
| | | * @param info 商户信息信息 |
| | | * @return 商户信息数量 |
| | | */ |
| | | @Override |
| | | public int queryStoresCount(Map info) { |
| | | logger.debug("查询 queryStoresCount 入参 info : {}",info); |
| | | |
| | | List<Map> businessStoreInfos = sqlSessionTemplate.selectList("storeV1ServiceDaoImpl.queryStoresCount", info); |
| | | if (businessStoreInfos.size() < 1) { |
| | | return 0; |
| | | } |
| | | |
| | | return Integer.parseInt(businessStoreInfos.get(0).get("count").toString()); |
| | | } |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2017-2020 吴学文 and java110 team. |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package com.java110.store.smo.impl; |
| | | |
| | | |
| | | import com.java110.store.dao.IStoreV1ServiceDao; |
| | | import com.java110.intf.store.IStoreV1InnerServiceSMO; |
| | | import com.java110.dto.store.StoreDto; |
| | | import com.java110.po.store.StorePo; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import com.java110.core.base.smo.BaseServiceSMO; |
| | | import com.java110.dto.user.UserDto; |
| | | import com.java110.dto.PageDto; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 类表述: 服务之前调用的接口实现类,不对外提供接口能力 只用于接口建调用 |
| | | * add by 吴学文 at 2022-02-28 10:46:30 mail: 928255095@qq.com |
| | | * open source address: https://gitee.com/wuxw7/MicroCommunity |
| | | * 官网:http://www.homecommunity.cn |
| | | * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下 |
| | | * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行 |
| | | */ |
| | | @RestController |
| | | public class StoreV1InnerServiceSMOImpl extends BaseServiceSMO implements IStoreV1InnerServiceSMO { |
| | | |
| | | @Autowired |
| | | private IStoreV1ServiceDao storeV1ServiceDaoImpl; |
| | | |
| | | |
| | | @Override |
| | | public int saveStore(@RequestBody StorePo storePo) { |
| | | int saveFlag = storeV1ServiceDaoImpl.saveStoreInfo(BeanConvertUtil.beanCovertMap(storePo)); |
| | | return saveFlag; |
| | | } |
| | | |
| | | @Override |
| | | public int updateStore(@RequestBody StorePo storePo) { |
| | | int saveFlag = storeV1ServiceDaoImpl.updateStoreInfo(BeanConvertUtil.beanCovertMap(storePo)); |
| | | return saveFlag; |
| | | } |
| | | |
| | | @Override |
| | | public int deleteStore(@RequestBody StorePo storePo) { |
| | | storePo.setStatusCd("1"); |
| | | int saveFlag = storeV1ServiceDaoImpl.updateStoreInfo(BeanConvertUtil.beanCovertMap(storePo)); |
| | | return saveFlag; |
| | | } |
| | | |
| | | @Override |
| | | public List<StoreDto> queryStores(@RequestBody StoreDto storeDto) { |
| | | |
| | | //校验是否传了 分页信息 |
| | | |
| | | int page = storeDto.getPage(); |
| | | |
| | | if (page != PageDto.DEFAULT_PAGE) { |
| | | storeDto.setPage((page - 1) * storeDto.getRow()); |
| | | } |
| | | |
| | | List<StoreDto> stores = BeanConvertUtil.covertBeanList(storeV1ServiceDaoImpl.getStoreInfo(BeanConvertUtil.beanCovertMap(storeDto)), StoreDto.class); |
| | | |
| | | return stores; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public int queryStoresCount(@RequestBody StoreDto storeDto) { |
| | | return storeV1ServiceDaoImpl.queryStoresCount(BeanConvertUtil.beanCovertMap(storeDto)); } |
| | | |
| | | } |