| New file |
| | |
| | | package com.java110.dto.product; |
| | | |
| | | import com.java110.dto.PageDto; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @ClassName FloorDto |
| | | * @Description 产品规格数据层封装 |
| | | * @Author wuxw |
| | | * @Date 2019/4/24 8:52 |
| | | * @Version 1.0 |
| | | * add by wuxw 2019/4/24 |
| | | **/ |
| | | public class ProductSpecDto extends PageDto implements Serializable { |
| | | |
| | | private String specId; |
| | | private String specName; |
| | | private String storeId; |
| | | |
| | | |
| | | private Date createTime; |
| | | |
| | | private String statusCd = "0"; |
| | | |
| | | |
| | | public String getSpecId() { |
| | | return specId; |
| | | } |
| | | public void setSpecId(String specId) { |
| | | this.specId = specId; |
| | | } |
| | | public String getSpecName() { |
| | | return specName; |
| | | } |
| | | public void setSpecName(String specName) { |
| | | this.specName = specName; |
| | | } |
| | | public String getStoreId() { |
| | | return storeId; |
| | | } |
| | | public void setStoreId(String storeId) { |
| | | this.storeId = storeId; |
| | | } |
| | | |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public String getStatusCd() { |
| | | return statusCd; |
| | | } |
| | | |
| | | public void setStatusCd(String statusCd) { |
| | | this.statusCd = statusCd; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.java110.po.product; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | public class ProductSpecPo implements Serializable { |
| | | |
| | | private String specId; |
| | | private String specName; |
| | | private String statusCd = "0"; |
| | | private String storeId; |
| | | public String getSpecId() { |
| | | return specId; |
| | | } |
| | | public void setSpecId(String specId) { |
| | | this.specId = specId; |
| | | } |
| | | public String getSpecName() { |
| | | return specName; |
| | | } |
| | | public void setSpecName(String specName) { |
| | | this.specName = specName; |
| | | } |
| | | public String getStatusCd() { |
| | | return statusCd; |
| | | } |
| | | public void setStatusCd(String statusCd) { |
| | | this.statusCd = statusCd; |
| | | } |
| | | public String getStoreId() { |
| | | return storeId; |
| | | } |
| | | public void setStoreId(String storeId) { |
| | | this.storeId = storeId; |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | public static final String CODE_PREFIX_typeCd = "85"; |
| | | public static final String CODE_PREFIX_docId = "86"; |
| | | public static final String CODE_PREFIX_categoryId = "87"; |
| | | public static final String CODE_PREFIX_specId = "88"; |
| | | public static final String CODE_PREFIX_productId = "90"; |
| | | |
| | | |
| 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="productSpecServiceDaoImpl"> |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | <!-- 保存产品规格信息 add by wuxw 2018-07-03 --> |
| | | <insert id="saveProductSpecInfo" parameterType="Map"> |
| | | insert into product_spec( |
| | | spec_id,spec_name,store_id |
| | | ) values ( |
| | | #{specId},#{specName},#{storeId} |
| | | ) |
| | | </insert> |
| | | |
| | | |
| | | |
| | | <!-- 查询产品规格信息 add by wuxw 2018-07-03 --> |
| | | <select id="getProductSpecInfo" parameterType="Map" resultType="Map"> |
| | | select t.spec_id,t.spec_id specId,t.spec_name,t.spec_name specName,t.status_cd,t.status_cd statusCd,t.store_id,t.store_id storeId |
| | | from product_spec t |
| | | where 1 =1 |
| | | <if test="specId !=null and specId != ''"> |
| | | and t.spec_id= #{specId} |
| | | </if> |
| | | <if test="specName !=null and specName != ''"> |
| | | and t.spec_name= #{specName} |
| | | </if> |
| | | <if test="statusCd !=null and statusCd != ''"> |
| | | and t.status_cd= #{statusCd} |
| | | </if> |
| | | <if test="storeId !=null and storeId != ''"> |
| | | and t.store_id= #{storeId} |
| | | </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="updateProductSpecInfo" parameterType="Map"> |
| | | update product_spec t set t.status_cd = #{statusCd} |
| | | <if test="newBId != null and newBId != ''"> |
| | | ,t.b_id = #{newBId} |
| | | </if> |
| | | <if test="specName !=null and specName != ''"> |
| | | , t.spec_name= #{specName} |
| | | </if> |
| | | <if test="storeId !=null and storeId != ''"> |
| | | , t.store_id= #{storeId} |
| | | </if> |
| | | where 1=1 <if test="specId !=null and specId != ''"> |
| | | and t.spec_id= #{specId} |
| | | </if> |
| | | |
| | | </update> |
| | | |
| | | <!-- 查询产品规格数量 add by wuxw 2018-07-03 --> |
| | | <select id="queryProductSpecsCount" parameterType="Map" resultType="Map"> |
| | | select count(1) count |
| | | from product_spec t |
| | | where 1 =1 |
| | | <if test="specId !=null and specId != ''"> |
| | | and t.spec_id= #{specId} |
| | | </if> |
| | | <if test="specName !=null and specName != ''"> |
| | | and t.spec_name= #{specName} |
| | | </if> |
| | | <if test="statusCd !=null and statusCd != ''"> |
| | | and t.status_cd= #{statusCd} |
| | | </if> |
| | | <if test="storeId !=null and storeId != ''"> |
| | | and t.store_id= #{storeId} |
| | | </if> |
| | | |
| | | |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | { |
| | | "autoMove": false, |
| | | "id": "productId", |
| | | "name": "product", |
| | | "desc": "产品", |
| | | "id": "specId", |
| | | "name": "productSpec", |
| | | "desc": "产品规格", |
| | | "shareParam": "storeId", |
| | | "shareColumn": "store_id", |
| | | "shareName": "goods", |
| | | "tableName": "product", |
| | | "tableName": "product_spec", |
| | | "param": { |
| | | "productId": "product_id", |
| | | "specId": "spec_id", |
| | | "storeId": "store_id", |
| | | "prodName": "prod_name", |
| | | "prodDesc": "prod_desc", |
| | | "keyword": "keyword", |
| | | "barCode": "bar_code", |
| | | "categoryId": "category_id", |
| | | "unitName": "unit_name", |
| | | "state": "state", |
| | | "sort": "sort", |
| | | "postage": "postage", |
| | | "isPostage": "is_postage", |
| | | "specName": "spec_name", |
| | | "statusCd": "status_cd" |
| | | }, |
| | | "required": [ |
| | | { |
| | | "code": "prodName", |
| | | "msg": "产品名称不能为空" |
| | | "code": "specName", |
| | | "msg": "规格名称不能为空" |
| | | }, |
| | | { |
| | | "code": "storeId", |
| | | "msg": "商户不能为空" |
| | | }, |
| | | { |
| | | "code": "keyword", |
| | | "msg": "关键字不能为空" |
| | | }, |
| | | { |
| | | "code": "categoryId", |
| | | "msg": "产品目录不能为空" |
| | | }, |
| | | { |
| | | "code": "unitName", |
| | | "msg": "单位不能为空" |
| | | }, |
| | | { |
| | | "code": "sort", |
| | | "msg": "排序不能为空" |
| | | }, |
| | | { |
| | | "code": "isPostage", |
| | | "msg": "是否包邮不能为空" |
| | | } |
| | | ] |
| | | } |
| New file |
| | |
| | | { |
| | | "autoMove": false, |
| | | "id": "productId", |
| | | "name": "product", |
| | | "desc": "产品", |
| | | "shareParam": "storeId", |
| | | "shareColumn": "store_id", |
| | | "shareName": "goods", |
| | | "tableName": "product", |
| | | "param": { |
| | | "productId": "product_id", |
| | | "storeId": "store_id", |
| | | "prodName": "prod_name", |
| | | "prodDesc": "prod_desc", |
| | | "keyword": "keyword", |
| | | "barCode": "bar_code", |
| | | "categoryId": "category_id", |
| | | "unitName": "unit_name", |
| | | "state": "state", |
| | | "sort": "sort", |
| | | "postage": "postage", |
| | | "isPostage": "is_postage", |
| | | "statusCd": "status_cd" |
| | | }, |
| | | "required": [ |
| | | { |
| | | "code": "prodName", |
| | | "msg": "产品名称不能为空" |
| | | }, |
| | | { |
| | | "code": "storeId", |
| | | "msg": "商户不能为空" |
| | | }, |
| | | { |
| | | "code": "keyword", |
| | | "msg": "关键字不能为空" |
| | | }, |
| | | { |
| | | "code": "categoryId", |
| | | "msg": "产品目录不能为空" |
| | | }, |
| | | { |
| | | "code": "unitName", |
| | | "msg": "单位不能为空" |
| | | }, |
| | | { |
| | | "code": "sort", |
| | | "msg": "排序不能为空" |
| | | }, |
| | | { |
| | | "code": "isPostage", |
| | | "msg": "是否包邮不能为空" |
| | | } |
| | | ] |
| | | } |
| | | |
| New file |
| | |
| | | package com.java110.intf.goods; |
| | | |
| | | import com.java110.config.feign.FeignConfiguration; |
| | | import com.java110.dto.product.ProductSpecDto; |
| | | import com.java110.po.product.ProductSpecPo; |
| | | 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; |
| | | |
| | | /** |
| | | * @ClassName IProductSpecInnerServiceSMO |
| | | * @Description 产品规格接口类 |
| | | * @Author wuxw |
| | | * @Date 2019/4/24 9:04 |
| | | * @Version 1.0 |
| | | * add by wuxw 2019/4/24 |
| | | **/ |
| | | @FeignClient(name = "goods-service", configuration = {FeignConfiguration.class}) |
| | | @RequestMapping("/productSpecApi") |
| | | public interface IProductSpecInnerServiceSMO { |
| | | |
| | | |
| | | @RequestMapping(value = "/saveProductSpec", method = RequestMethod.POST) |
| | | public int saveProductSpec(@RequestBody ProductSpecPo productSpecPo); |
| | | |
| | | @RequestMapping(value = "/updateProductSpec", method = RequestMethod.POST) |
| | | public int updateProductSpec(@RequestBody ProductSpecPo productSpecPo); |
| | | |
| | | @RequestMapping(value = "/deleteProductSpec", method = RequestMethod.POST) |
| | | public int deleteProductSpec(@RequestBody ProductSpecPo productSpecPo); |
| | | |
| | | /** |
| | | * <p>查询小区楼信息</p> |
| | | * |
| | | * @param productSpecDto 数据对象分享 |
| | | * @return ProductSpecDto 对象数据 |
| | | */ |
| | | @RequestMapping(value = "/queryProductSpecs", method = RequestMethod.POST) |
| | | List<ProductSpecDto> queryProductSpecs(@RequestBody ProductSpecDto productSpecDto); |
| | | |
| | | /** |
| | | * 查询<p>小区楼</p>总记录数 |
| | | * |
| | | * @param productSpecDto 数据对象分享 |
| | | * @return 小区下的小区楼记录数 |
| | | */ |
| | | @RequestMapping(value = "/queryProductSpecsCount", method = RequestMethod.POST) |
| | | int queryProductSpecsCount(@RequestBody ProductSpecDto productSpecDto); |
| | | } |
| | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.dto.product.ProductDto; |
| | | import com.java110.dto.product.ProductSpecDto; |
| | | import com.java110.goods.bmo.product.IDeleteProductBMO; |
| | | import com.java110.goods.bmo.product.IGetProductBMO; |
| | | import com.java110.goods.bmo.product.ISaveProductBMO; |
| | | import com.java110.goods.bmo.product.IUpdateProductBMO; |
| | | import com.java110.goods.bmo.productSpec.IDeleteProductSpecBMO; |
| | | import com.java110.goods.bmo.productSpec.IGetProductSpecBMO; |
| | | import com.java110.goods.bmo.productSpec.ISaveProductSpecBMO; |
| | | import com.java110.goods.bmo.productSpec.IUpdateProductSpecBMO; |
| | | import com.java110.po.product.ProductPo; |
| | | import com.java110.po.product.ProductSpecPo; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | @Autowired |
| | | private IGetProductBMO getProductBMOImpl; |
| | | |
| | | @Autowired |
| | | private ISaveProductSpecBMO saveProductSpecBMOImpl; |
| | | @Autowired |
| | | private IUpdateProductSpecBMO updateProductSpecBMOImpl; |
| | | @Autowired |
| | | private IDeleteProductSpecBMO deleteProductSpecBMOImpl; |
| | | |
| | | @Autowired |
| | | private IGetProductSpecBMO getProductSpecBMOImpl; |
| | | |
| | | /** |
| | | * 微信保存消息模板 |
| | |
| | | productDto.setStoreId(storeId); |
| | | return getProductBMOImpl.get(productDto); |
| | | } |
| | | |
| | | /** |
| | | * 微信保存消息模板 |
| | | * @serviceCode /product/saveProductSpec |
| | | * @path /app/product/saveProductSpec |
| | | * @param reqJson |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/saveProductSpec", method = RequestMethod.POST) |
| | | public ResponseEntity<String> saveProductSpec(@RequestBody JSONObject reqJson) { |
| | | |
| | | Assert.hasKeyAndValue(reqJson, "specName", "请求报文中未包含specName"); |
| | | Assert.hasKeyAndValue(reqJson, "storeId", "请求报文中未包含storeId"); |
| | | |
| | | |
| | | ProductSpecPo productSpecPo = BeanConvertUtil.covertBean(reqJson, ProductSpecPo.class); |
| | | return saveProductSpecBMOImpl.save(productSpecPo); |
| | | } |
| | | |
| | | /** |
| | | * 微信修改消息模板 |
| | | * @serviceCode /product/updateProductSpec |
| | | * @path /app/product/updateProductSpec |
| | | * @param reqJson |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/updateProductSpec", method = RequestMethod.POST) |
| | | public ResponseEntity<String> updateProductSpec(@RequestBody JSONObject reqJson) { |
| | | |
| | | Assert.hasKeyAndValue(reqJson, "specName", "请求报文中未包含specName"); |
| | | Assert.hasKeyAndValue(reqJson, "storeId", "请求报文中未包含storeId"); |
| | | Assert.hasKeyAndValue(reqJson, "specId", "specId不能为空"); |
| | | |
| | | |
| | | ProductSpecPo productSpecPo = BeanConvertUtil.covertBean(reqJson, ProductSpecPo.class); |
| | | return updateProductSpecBMOImpl.update(productSpecPo); |
| | | } |
| | | |
| | | /** |
| | | * 微信删除消息模板 |
| | | * @serviceCode /product/deleteProductSpec |
| | | * @path /app/product/deleteProductSpec |
| | | * @param reqJson |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/deleteProductSpec", method = RequestMethod.POST) |
| | | public ResponseEntity<String> deleteProductSpec(@RequestBody JSONObject reqJson) { |
| | | Assert.hasKeyAndValue(reqJson, "communityId", "小区ID不能为空"); |
| | | |
| | | Assert.hasKeyAndValue(reqJson, "specId", "specId不能为空"); |
| | | |
| | | |
| | | ProductSpecPo productSpecPo = BeanConvertUtil.covertBean(reqJson, ProductSpecPo.class); |
| | | return deleteProductSpecBMOImpl.delete(productSpecPo); |
| | | } |
| | | |
| | | /** |
| | | * 微信删除消息模板 |
| | | * @serviceCode /product/queryProductSpec |
| | | * @path /app/product/queryProductSpec |
| | | * @param storeId 商户ID |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/queryProductSpec", method = RequestMethod.GET) |
| | | public ResponseEntity<String> queryProductSpec(@RequestParam(value = "store-id") String storeId, |
| | | @RequestParam(value = "page") int page, |
| | | @RequestParam(value = "row") int row) { |
| | | ProductSpecDto productSpecDto = new ProductSpecDto(); |
| | | productSpecDto.setPage(page); |
| | | productSpecDto.setRow(row); |
| | | productSpecDto.setStoreId(storeId); |
| | | return getProductSpecBMOImpl.get(productSpecDto); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.java110.goods.bmo.productSpec; |
| | | import com.java110.po.product.ProductSpecPo; |
| | | import org.springframework.http.ResponseEntity; |
| | | |
| | | public interface IDeleteProductSpecBMO { |
| | | |
| | | |
| | | /** |
| | | * 修改产品规格 |
| | | * add by wuxw |
| | | * @param productSpecPo |
| | | * @return |
| | | */ |
| | | ResponseEntity<String> delete(ProductSpecPo productSpecPo); |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.goods.bmo.productSpec; |
| | | import com.java110.dto.product.ProductSpecDto; |
| | | import org.springframework.http.ResponseEntity; |
| | | public interface IGetProductSpecBMO { |
| | | |
| | | |
| | | /** |
| | | * 查询产品规格 |
| | | * add by wuxw |
| | | * @param productSpecDto |
| | | * @return |
| | | */ |
| | | ResponseEntity<String> get(ProductSpecDto productSpecDto); |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.goods.bmo.productSpec; |
| | | |
| | | import com.java110.po.product.ProductSpecPo; |
| | | import org.springframework.http.ResponseEntity; |
| | | public interface ISaveProductSpecBMO { |
| | | |
| | | |
| | | /** |
| | | * 添加产品规格 |
| | | * add by wuxw |
| | | * @param productSpecPo |
| | | * @return |
| | | */ |
| | | ResponseEntity<String> save(ProductSpecPo productSpecPo); |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.goods.bmo.productSpec; |
| | | import com.java110.po.product.ProductSpecPo; |
| | | import org.springframework.http.ResponseEntity; |
| | | |
| | | public interface IUpdateProductSpecBMO { |
| | | |
| | | |
| | | /** |
| | | * 修改产品规格 |
| | | * add by wuxw |
| | | * @param productSpecPo |
| | | * @return |
| | | */ |
| | | ResponseEntity<String> update(ProductSpecPo productSpecPo); |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.goods.bmo.productSpec.impl; |
| | | |
| | | import com.java110.core.annotation.Java110Transactional; |
| | | import com.java110.goods.bmo.productSpec.IDeleteProductSpecBMO; |
| | | import com.java110.intf.goods.IProductSpecInnerServiceSMO; |
| | | import com.java110.po.product.ProductSpecPo; |
| | | import com.java110.vo.ResultVo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service("deleteProductSpecBMOImpl") |
| | | public class DeleteProductSpecBMOImpl implements IDeleteProductSpecBMO { |
| | | |
| | | @Autowired |
| | | private IProductSpecInnerServiceSMO productSpecInnerServiceSMOImpl; |
| | | |
| | | /** |
| | | * @param productSpecPo 数据 |
| | | * @return 订单服务能够接受的报文 |
| | | */ |
| | | @Java110Transactional |
| | | public ResponseEntity<String> delete(ProductSpecPo productSpecPo) { |
| | | |
| | | int flag = productSpecInnerServiceSMOImpl.deleteProductSpec(productSpecPo); |
| | | |
| | | if (flag > 0) { |
| | | return ResultVo.createResponseEntity(ResultVo.CODE_OK, "保存成功"); |
| | | } |
| | | |
| | | return ResultVo.createResponseEntity(ResultVo.CODE_ERROR, "保存失败"); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.goods.bmo.productSpec.impl; |
| | | |
| | | import com.java110.dto.product.ProductSpecDto; |
| | | import com.java110.goods.bmo.productSpec.IGetProductSpecBMO; |
| | | import com.java110.intf.goods.IProductSpecInnerServiceSMO; |
| | | import com.java110.vo.ResultVo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @Service("getProductSpecBMOImpl") |
| | | public class GetProductSpecBMOImpl implements IGetProductSpecBMO { |
| | | |
| | | @Autowired |
| | | private IProductSpecInnerServiceSMO productSpecInnerServiceSMOImpl; |
| | | |
| | | /** |
| | | * @param productSpecDto |
| | | * @return 订单服务能够接受的报文 |
| | | */ |
| | | public ResponseEntity<String> get(ProductSpecDto productSpecDto) { |
| | | |
| | | |
| | | int count = productSpecInnerServiceSMOImpl.queryProductSpecsCount(productSpecDto); |
| | | |
| | | List<ProductSpecDto> productSpecDtos = null; |
| | | if (count > 0) { |
| | | productSpecDtos = productSpecInnerServiceSMOImpl.queryProductSpecs(productSpecDto); |
| | | } else { |
| | | productSpecDtos = new ArrayList<>(); |
| | | } |
| | | |
| | | ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) productSpecDto.getRow()), count, productSpecDtos); |
| | | |
| | | ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK); |
| | | |
| | | return responseEntity; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.goods.bmo.productSpec.impl; |
| | | |
| | | import com.java110.core.annotation.Java110Transactional; |
| | | import com.java110.core.factory.GenerateCodeFactory; |
| | | import com.java110.goods.bmo.productSpec.ISaveProductSpecBMO; |
| | | import com.java110.intf.goods.IProductSpecInnerServiceSMO; |
| | | import com.java110.po.product.ProductSpecPo; |
| | | import com.java110.vo.ResultVo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service("saveProductSpecBMOImpl") |
| | | public class SaveProductSpecBMOImpl implements ISaveProductSpecBMO { |
| | | |
| | | @Autowired |
| | | private IProductSpecInnerServiceSMO productSpecInnerServiceSMOImpl; |
| | | |
| | | /** |
| | | * 添加小区信息 |
| | | * |
| | | * @param productSpecPo |
| | | * @return 订单服务能够接受的报文 |
| | | */ |
| | | @Java110Transactional |
| | | public ResponseEntity<String> save(ProductSpecPo productSpecPo) { |
| | | |
| | | productSpecPo.setSpecId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_specId)); |
| | | int flag = productSpecInnerServiceSMOImpl.saveProductSpec(productSpecPo); |
| | | |
| | | if (flag > 0) { |
| | | return ResultVo.createResponseEntity(ResultVo.CODE_OK, "保存成功"); |
| | | } |
| | | |
| | | return ResultVo.createResponseEntity(ResultVo.CODE_ERROR, "保存失败"); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.goods.bmo.productSpec.impl; |
| | | |
| | | import com.java110.core.annotation.Java110Transactional; |
| | | import com.java110.goods.bmo.productSpec.IUpdateProductSpecBMO; |
| | | import com.java110.intf.goods.IProductSpecInnerServiceSMO; |
| | | import com.java110.po.product.ProductSpecPo; |
| | | import com.java110.vo.ResultVo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service("updateProductSpecBMOImpl") |
| | | public class UpdateProductSpecBMOImpl implements IUpdateProductSpecBMO { |
| | | |
| | | @Autowired |
| | | private IProductSpecInnerServiceSMO productSpecInnerServiceSMOImpl; |
| | | |
| | | /** |
| | | * @param productSpecPo |
| | | * @return 订单服务能够接受的报文 |
| | | */ |
| | | @Java110Transactional |
| | | public ResponseEntity<String> update(ProductSpecPo productSpecPo) { |
| | | |
| | | int flag = productSpecInnerServiceSMOImpl.updateProductSpec(productSpecPo); |
| | | |
| | | if (flag > 0) { |
| | | return ResultVo.createResponseEntity(ResultVo.CODE_OK, "保存成功"); |
| | | } |
| | | |
| | | return ResultVo.createResponseEntity(ResultVo.CODE_ERROR, "保存失败"); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.goods.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; |
| | | |
| | | /** |
| | | * 产品规格组件内部之间使用,没有给外围系统提供服务能力 |
| | | * 产品规格服务接口类,要求全部以字符串传输,方便微服务化 |
| | | * 新建客户,修改客户,删除客户,查询客户等功能 |
| | | * |
| | | * Created by wuxw on 2016/12/27. |
| | | */ |
| | | public interface IProductSpecServiceDao { |
| | | |
| | | |
| | | /** |
| | | * 保存 产品规格信息 |
| | | * @param info |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | void saveProductSpecInfo(Map info) throws DAOException; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 查询产品规格信息(instance过程) |
| | | * 根据bId 查询产品规格信息 |
| | | * @param info bId 信息 |
| | | * @return 产品规格信息 |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | List<Map> getProductSpecInfo(Map info) throws DAOException; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 修改产品规格信息 |
| | | * @param info 修改信息 |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | void updateProductSpecInfo(Map info) throws DAOException; |
| | | |
| | | |
| | | /** |
| | | * 查询产品规格总数 |
| | | * |
| | | * @param info 产品规格信息 |
| | | * @return 产品规格数量 |
| | | */ |
| | | int queryProductSpecsCount(Map info); |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.goods.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.goods.dao.IProductSpecServiceDao; |
| | | 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; |
| | | |
| | | /** |
| | | * 产品规格服务 与数据库交互 |
| | | * Created by wuxw on 2017/4/5. |
| | | */ |
| | | @Service("productSpecServiceDaoImpl") |
| | | //@Transactional |
| | | public class ProductSpecServiceDaoImpl extends BaseServiceDao implements IProductSpecServiceDao { |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(ProductSpecServiceDaoImpl.class); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 保存产品规格信息 到 instance |
| | | * @param info bId 信息 |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | @Override |
| | | public void saveProductSpecInfo(Map info) throws DAOException { |
| | | logger.debug("保存产品规格信息Instance 入参 info : {}",info); |
| | | |
| | | int saveFlag = sqlSessionTemplate.insert("productSpecServiceDaoImpl.saveProductSpecInfo",info); |
| | | |
| | | if(saveFlag < 1){ |
| | | throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存产品规格信息Instance数据失败:"+ JSONObject.toJSONString(info)); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询产品规格信息(instance) |
| | | * @param info bId 信息 |
| | | * @return List<Map> |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | @Override |
| | | public List<Map> getProductSpecInfo(Map info) throws DAOException { |
| | | logger.debug("查询产品规格信息 入参 info : {}",info); |
| | | |
| | | List<Map> businessProductSpecInfos = sqlSessionTemplate.selectList("productSpecServiceDaoImpl.getProductSpecInfo",info); |
| | | |
| | | return businessProductSpecInfos; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改产品规格信息 |
| | | * @param info 修改信息 |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | @Override |
| | | public void updateProductSpecInfo(Map info) throws DAOException { |
| | | logger.debug("修改产品规格信息Instance 入参 info : {}",info); |
| | | |
| | | int saveFlag = sqlSessionTemplate.update("productSpecServiceDaoImpl.updateProductSpecInfo",info); |
| | | |
| | | if(saveFlag < 1){ |
| | | throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改产品规格信息Instance数据失败:"+ JSONObject.toJSONString(info)); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 查询产品规格数量 |
| | | * @param info 产品规格信息 |
| | | * @return 产品规格数量 |
| | | */ |
| | | @Override |
| | | public int queryProductSpecsCount(Map info) { |
| | | logger.debug("查询产品规格数据 入参 info : {}",info); |
| | | |
| | | List<Map> businessProductSpecInfos = sqlSessionTemplate.selectList("productSpecServiceDaoImpl.queryProductSpecsCount", info); |
| | | if (businessProductSpecInfos.size() < 1) { |
| | | return 0; |
| | | } |
| | | |
| | | return Integer.parseInt(businessProductSpecInfos.get(0).get("count").toString()); |
| | | } |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.goods.smo.impl; |
| | | |
| | | |
| | | import com.java110.core.base.smo.BaseServiceSMO; |
| | | import com.java110.dto.PageDto; |
| | | import com.java110.dto.product.ProductSpecDto; |
| | | import com.java110.goods.dao.IProductSpecServiceDao; |
| | | import com.java110.intf.goods.IProductSpecInnerServiceSMO; |
| | | import com.java110.po.product.ProductSpecPo; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @ClassName FloorInnerServiceSMOImpl |
| | | * @Description 产品规格内部服务实现类 |
| | | * @Author wuxw |
| | | * @Date 2019/4/24 9:20 |
| | | * @Version 1.0 |
| | | * add by wuxw 2019/4/24 |
| | | **/ |
| | | @RestController |
| | | public class ProductSpecInnerServiceSMOImpl extends BaseServiceSMO implements IProductSpecInnerServiceSMO { |
| | | |
| | | @Autowired |
| | | private IProductSpecServiceDao productSpecServiceDaoImpl; |
| | | |
| | | |
| | | @Override |
| | | public int saveProductSpec(@RequestBody ProductSpecPo productSpecPo) { |
| | | int saveFlag = 1; |
| | | productSpecServiceDaoImpl.saveProductSpecInfo(BeanConvertUtil.beanCovertMap(productSpecPo)); |
| | | return saveFlag; |
| | | } |
| | | |
| | | @Override |
| | | public int updateProductSpec(@RequestBody ProductSpecPo productSpecPo) { |
| | | int saveFlag = 1; |
| | | productSpecServiceDaoImpl.updateProductSpecInfo(BeanConvertUtil.beanCovertMap(productSpecPo)); |
| | | return saveFlag; |
| | | } |
| | | |
| | | @Override |
| | | public int deleteProductSpec(@RequestBody ProductSpecPo productSpecPo) { |
| | | int saveFlag = 1; |
| | | productSpecPo.setStatusCd("1"); |
| | | productSpecServiceDaoImpl.updateProductSpecInfo(BeanConvertUtil.beanCovertMap(productSpecPo)); |
| | | return saveFlag; |
| | | } |
| | | |
| | | @Override |
| | | public List<ProductSpecDto> queryProductSpecs(@RequestBody ProductSpecDto productSpecDto) { |
| | | |
| | | //校验是否传了 分页信息 |
| | | |
| | | int page = productSpecDto.getPage(); |
| | | |
| | | if (page != PageDto.DEFAULT_PAGE) { |
| | | productSpecDto.setPage((page - 1) * productSpecDto.getRow()); |
| | | } |
| | | |
| | | List<ProductSpecDto> productSpecs = BeanConvertUtil.covertBeanList(productSpecServiceDaoImpl.getProductSpecInfo(BeanConvertUtil.beanCovertMap(productSpecDto)), ProductSpecDto.class); |
| | | |
| | | return productSpecs; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public int queryProductSpecsCount(@RequestBody ProductSpecDto productSpecDto) { |
| | | return productSpecServiceDaoImpl.queryProductSpecsCount(BeanConvertUtil.beanCovertMap(productSpecDto)); |
| | | } |
| | | |
| | | public IProductSpecServiceDao getProductSpecServiceDaoImpl() { |
| | | return productSpecServiceDaoImpl; |
| | | } |
| | | |
| | | public void setProductSpecServiceDaoImpl(IProductSpecServiceDao productSpecServiceDaoImpl) { |
| | | this.productSpecServiceDaoImpl = productSpecServiceDaoImpl; |
| | | } |
| | | } |