Commit 1ff9d0f2 by XiaHou

万科接口补充

parent 189de1f2
...@@ -29,8 +29,8 @@ public class VankeDepartmentController { ...@@ -29,8 +29,8 @@ public class VankeDepartmentController {
@ApiOperation("万科后台_部门分页操作") @ApiOperation("万科后台_部门分页操作")
@RequestMapping(value = "/list", method = RequestMethod.GET) @RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody @ResponseBody
public CommonResult<CommonPage<VankeDepartment>> list(@ApiParam(value="分页页数") @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize, public CommonResult<CommonPage<VankeDepartment>> list(@ApiParam(value="分页大小") @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@ApiParam(value="分页大小") @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) { @ApiParam(value="分页页数") @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
return CommonResult.success(CommonPage.restPage(this.vankeDepartmentSerive.getPageList(pageNum, pageSize))); return CommonResult.success(CommonPage.restPage(this.vankeDepartmentSerive.getPageList(pageNum, pageSize)));
} }
......
package com.macro.mall.controller.vanke;
import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.VankeGoodsCategory;
import com.macro.mall.model.VankeStockRoom;
import com.macro.mall.model.common.ResultMsg;
import com.macro.mall.service.vanke.IVankeGoodsCategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@Api(tags = "万科后台_物品类别相关接口", description = "物品类别控制器")
@RequestMapping("/vankeGoodsCategory")
public class VankeGoodsCategoryController {
@Autowired
private IVankeGoodsCategoryService vankeGoodsCategoryService;
@ApiOperation("万科后台_物品类别分页操作")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<VankeGoodsCategory>> list(@ApiParam(value="分页大小") @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@ApiParam(value="分页页数") @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
return CommonResult.success(CommonPage.restPage(this.vankeGoodsCategoryService.getPageList(pageNum, pageSize)));
}
@ApiOperation("万科后台_物品类别插入操作")
@RequestMapping(value = "/insertGoodsCategory", method = RequestMethod.POST)
@ResponseBody
public CommonResult insertGoodsCategory(VankeGoodsCategory vankeGoodsCategory){
ResultMsg res = this.vankeGoodsCategoryService.insertGoodsCategory(vankeGoodsCategory);
if(res.isFlag()){
return CommonResult.success(null,res.getMsg());
}
return CommonResult.failed(res.getMsg());
}
@ApiOperation("万科后台_根据物品类别id修改一条数据")
@RequestMapping(value = "/updateGoodsCategory", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateGoodsCategory(VankeGoodsCategory vankeGoodsCategory){
ResultMsg res = this.vankeGoodsCategoryService.updateGoodsCategory(vankeGoodsCategory);
if(res.isFlag()){
return CommonResult.success(null,res.getMsg());
}
return CommonResult.failed(res.getMsg());
}
}
package com.macro.mall.controller.vanke;
import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.VankeGoods;
import com.macro.mall.model.VankeSupplier;
import com.macro.mall.model.common.ResultMsg;
import com.macro.mall.model.dto.vanke.VankeGoodsDto;
import com.macro.mall.service.vanke.IVankeGoodsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@Api(tags = "万科后台_物品相关接口", description = "物品控制器")
@RequestMapping("/vankeGoods")
public class VankeGoodsController {
@Autowired
private IVankeGoodsService vankeGoodsService;
@ApiOperation("万科后台_物品分页操作")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<VankeGoodsDto>> list(@ApiParam(value="分页大小") @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@ApiParam(value="分页页数") @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
@ApiParam(value="物品名称") @RequestParam(value = "name") String name,
@ApiParam(value="物品名称") @RequestParam(value = "goodsCategoryName") String goodsCategoryName,
@ApiParam(value="物品名称") @RequestParam(value = "supplierName") String supplierName,
@ApiParam(value="物品名称") @RequestParam(value = "stockRoomName") String stockRoomName
) {
return CommonResult.success(CommonPage.restPage(this.vankeGoodsService.selectList(pageNum,pageSize,name,goodsCategoryName,supplierName,stockRoomName)));
}
@ApiOperation("万科后台_物品插入操作")
@RequestMapping(value = "/insertGoods", method = RequestMethod.POST)
@ResponseBody
public CommonResult insertGoods(VankeGoods vankeGoods){
ResultMsg res = this.vankeGoodsService.insertGoods(vankeGoods);
if(res.isFlag()){
return CommonResult.success(null,res.getMsg());
}
return CommonResult.failed(res.getMsg());
}
@ApiOperation("万科后台_根据物品id修改一条数据")
@RequestMapping(value = "/updateGoods", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateGoods(VankeGoods vankeGoods){
ResultMsg res = this.vankeGoodsService.updateGoods(vankeGoods);
if(res.isFlag()){
return CommonResult.success(null,res.getMsg());
}
return CommonResult.failed(res.getMsg());
}
}
package com.macro.mall.controller.vanke;
import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.VankeDepartment;
import com.macro.mall.model.VankeStockRoom;
import com.macro.mall.model.common.ResultMsg;
import com.macro.mall.service.vanke.IVankeStockRoomService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@Api(tags = "万科后台_库房相关接口", description = "库房控制器")
@RequestMapping("/vankeStockRoom")
public class VankeStockRoomController {
@Autowired
private IVankeStockRoomService vankeStockRoomService;
@ApiOperation("万科后台_库房分页操作")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<VankeStockRoom>> list(@ApiParam(value="分页大小 不传则不分页") @RequestParam(value = "pageSize", required = false) Integer pageSize,
@ApiParam(value="分页页数") @RequestParam(value = "pageNum", required = false) Integer pageNum) {
return CommonResult.success(CommonPage.restPage(this.vankeStockRoomService.getPageList(pageNum, pageSize)));
}
@ApiOperation("万科后台_库房插入操作")
@RequestMapping(value = "/insertDepartment", method = RequestMethod.POST)
@ResponseBody
public CommonResult insertDepartment(VankeStockRoom vankeStockRoom){
ResultMsg res = this.vankeStockRoomService.insertStockRoom(vankeStockRoom);
if(res.isFlag()){
return CommonResult.success(null,res.getMsg());
}
return CommonResult.failed(res.getMsg());
}
@ApiOperation("万科后台_根据库房id修改一条数据")
@RequestMapping(value = "/updateDepartment", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateDepartment(VankeStockRoom vankeStockRoom){
ResultMsg res = this.vankeStockRoomService.updateStockRoom(vankeStockRoom);
if(res.isFlag()){
return CommonResult.success(null,res.getMsg());
}
return CommonResult.failed(res.getMsg());
}
}
package com.macro.mall.controller.vanke;
import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.VankeSupplier;
import com.macro.mall.model.common.ResultMsg;
import com.macro.mall.service.vanke.IVankeSupplierService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@Api(tags = "万科后台_供应商相关接口", description = "供应商控制器")
@RequestMapping("/vankeSupplier")
public class VankeSupplierController {
@Autowired
private IVankeSupplierService vankeSupplierService;
@ApiOperation("万科后台_供应商分页操作")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<VankeSupplier>> list(@ApiParam(value="分页大小 不传则不分页操作") @RequestParam(value = "pageSize", required = false) Integer pageSize,
@ApiParam(value="分页页数") @RequestParam(value = "pageNum", required = false) Integer pageNum) {
return CommonResult.success(CommonPage.restPage(this.vankeSupplierService.getPageList(pageNum, pageSize)));
}
@ApiOperation("万科后台_供应商插入操作")
@RequestMapping(value = "/insertSupplier", method = RequestMethod.POST)
@ResponseBody
public CommonResult insertSupplier(VankeSupplier vankeSupplier){
ResultMsg res = this.vankeSupplierService.insertSupplier(vankeSupplier);
if(res.isFlag()){
return CommonResult.success(null,res.getMsg());
}
return CommonResult.failed(res.getMsg());
}
@ApiOperation("万科后台_根据供应商id修改一条数据")
@RequestMapping(value = "/updateSupplier", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateSupplier(VankeSupplier vankeSupplier){
ResultMsg res = this.vankeSupplierService.updateSupplier(vankeSupplier);
if(res.isFlag()){
return CommonResult.success(null,res.getMsg());
}
return CommonResult.failed(res.getMsg());
}
}
...@@ -2,7 +2,7 @@ server: ...@@ -2,7 +2,7 @@ server:
port: 8180 port: 8180
spring: spring:
datasource: datasource:
url: jdbc:mysql://115.29.198.90:3306/quanxing?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai url: jdbc:mysql://115.29.198.90:3306/vanke?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: root username: root
password: root password: root
druid: druid:
......
package com.macro.mall.common.utils;
import java.io.*;
import java.net.URL;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.KeyManager;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSession;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
public class HttpsUtil {
private static final class DefaultTrustManager implements X509TrustManager {
@Override
public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
}
@Override
public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
}
@Override
public X509Certificate[] getAcceptedIssuers() {
return null;
}
}
private static HttpsURLConnection getHttpsURLConnection(String uri, String method) throws IOException {
SSLContext ctx = null;
try {
ctx = SSLContext.getInstance("TLS");
ctx.init(new KeyManager[0], new TrustManager[] { new DefaultTrustManager() }, new SecureRandom());
} catch (KeyManagementException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
SSLSocketFactory ssf = ctx.getSocketFactory();
URL url = new URL(uri);
HttpsURLConnection httpsConn = (HttpsURLConnection) url.openConnection();
httpsConn.setSSLSocketFactory(ssf);
httpsConn.setRequestProperty("Content-Type","application/x-www-form-urlencoded;charset=UTF-8");
httpsConn.setRequestProperty("Authorization","username");
httpsConn.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11");
/*
在握手期间,如果 URL 的主机名和服务器的标识主机名不匹配,
则验证机制可以回调此接口的实现程序来确定是否应该允许此连接。
策略可以是基于证书的或依赖于其他验证方案。
当验证 URL 主机名使用的默认规则失败时使用这些回调。
*/
httpsConn.setHostnameVerifier(new HostnameVerifier() {
@Override
public boolean verify(String arg0, SSLSession arg1) {
return true;
}
});
httpsConn.setRequestMethod(method);
httpsConn.setDoInput(true);
httpsConn.setDoOutput(true);
return httpsConn;
}
private static byte[] getBytesFromStream(InputStream is) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] kb = new byte[1024];
int len;
while ((len = is.read(kb)) != -1) {
baos.write(kb, 0, len);
}
byte[] bytes = baos.toByteArray();
baos.close();
is.close();
return bytes;
}
private static void setBytesToStream(OutputStream os, byte[] bytes) throws IOException {
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
byte[] kb = new byte[1024];
int len;
while ((len = bais.read(kb)) != -1) {
os.write(kb, 0, len);
}
os.flush();
os.close();
bais.close();
}
public static byte[] doGet(String uri) throws IOException {
HttpsURLConnection httpsConn = getHttpsURLConnection(uri, "GET");
return getBytesFromStream(httpsConn.getInputStream());
}
public static byte[] doPost(String uri, String data) throws IOException {
HttpsURLConnection httpsConn = getHttpsURLConnection(uri, "POST");
setBytesToStream(httpsConn.getOutputStream(), data.getBytes());
return getBytesFromStream(httpsConn.getInputStream());
}
}
...@@ -12,7 +12,7 @@ public class UmsAdmin implements Serializable { ...@@ -12,7 +12,7 @@ public class UmsAdmin implements Serializable {
@GeneratedValue(strategy= GenerationType.IDENTITY) @GeneratedValue(strategy= GenerationType.IDENTITY)
private Long id; private Long id;
@ApiModelProperty(value = "用户类型 1平台 2商家 3服务商") @ApiModelProperty(value = "账户类型 1管理员 2其他用户")
private Integer type; private Integer type;
private String username; private String username;
...@@ -77,12 +77,6 @@ public class UmsAdmin implements Serializable { ...@@ -77,12 +77,6 @@ public class UmsAdmin implements Serializable {
@ApiModelProperty(value = "供应商申请标识(0未申请1已申请)") @ApiModelProperty(value = "供应商申请标识(0未申请1已申请)")
private Integer applyCode; private Integer applyCode;
@ApiModelProperty(value = "供应商快递鸟配置用户id")
private String kdnUid;
@ApiModelProperty(value = "供应商快递鸟配置AppKey")
private String kdnAppkey;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public Long getId() { public Long getId() {
...@@ -261,22 +255,6 @@ public class UmsAdmin implements Serializable { ...@@ -261,22 +255,6 @@ public class UmsAdmin implements Serializable {
this.applyCode = applyCode; this.applyCode = applyCode;
} }
public String getKdnUid() {
return kdnUid;
}
public void setKdnUid(String kdnUid) {
this.kdnUid = kdnUid;
}
public String getKdnAppkey() {
return kdnAppkey;
}
public void setKdnAppkey(String kdnAppkey) {
this.kdnAppkey = kdnAppkey;
}
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
...@@ -305,8 +283,6 @@ public class UmsAdmin implements Serializable { ...@@ -305,8 +283,6 @@ public class UmsAdmin implements Serializable {
sb.append(", memberId=").append(memberId); sb.append(", memberId=").append(memberId);
sb.append(", departId=").append(departId); sb.append(", departId=").append(departId);
sb.append(", applyCode=").append(applyCode); sb.append(", applyCode=").append(applyCode);
sb.append(", kdnUid=").append(kdnUid);
sb.append(", kdnAppkey=").append(kdnAppkey);
sb.append(", serialVersionUID=").append(serialVersionUID); sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]"); sb.append("]");
return sb.toString(); return sb.toString();
......
...@@ -1504,146 +1504,6 @@ public class UmsAdminExample { ...@@ -1504,146 +1504,6 @@ public class UmsAdminExample {
addCriterion("apply_code not between", value1, value2, "applyCode"); addCriterion("apply_code not between", value1, value2, "applyCode");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andKdnUidIsNull() {
addCriterion("kdn_uid is null");
return (Criteria) this;
}
public Criteria andKdnUidIsNotNull() {
addCriterion("kdn_uid is not null");
return (Criteria) this;
}
public Criteria andKdnUidEqualTo(String value) {
addCriterion("kdn_uid =", value, "kdnUid");
return (Criteria) this;
}
public Criteria andKdnUidNotEqualTo(String value) {
addCriterion("kdn_uid <>", value, "kdnUid");
return (Criteria) this;
}
public Criteria andKdnUidGreaterThan(String value) {
addCriterion("kdn_uid >", value, "kdnUid");
return (Criteria) this;
}
public Criteria andKdnUidGreaterThanOrEqualTo(String value) {
addCriterion("kdn_uid >=", value, "kdnUid");
return (Criteria) this;
}
public Criteria andKdnUidLessThan(String value) {
addCriterion("kdn_uid <", value, "kdnUid");
return (Criteria) this;
}
public Criteria andKdnUidLessThanOrEqualTo(String value) {
addCriterion("kdn_uid <=", value, "kdnUid");
return (Criteria) this;
}
public Criteria andKdnUidLike(String value) {
addCriterion("kdn_uid like", value, "kdnUid");
return (Criteria) this;
}
public Criteria andKdnUidNotLike(String value) {
addCriterion("kdn_uid not like", value, "kdnUid");
return (Criteria) this;
}
public Criteria andKdnUidIn(List<String> values) {
addCriterion("kdn_uid in", values, "kdnUid");
return (Criteria) this;
}
public Criteria andKdnUidNotIn(List<String> values) {
addCriterion("kdn_uid not in", values, "kdnUid");
return (Criteria) this;
}
public Criteria andKdnUidBetween(String value1, String value2) {
addCriterion("kdn_uid between", value1, value2, "kdnUid");
return (Criteria) this;
}
public Criteria andKdnUidNotBetween(String value1, String value2) {
addCriterion("kdn_uid not between", value1, value2, "kdnUid");
return (Criteria) this;
}
public Criteria andKdnAppkeyIsNull() {
addCriterion("kdn_appkey is null");
return (Criteria) this;
}
public Criteria andKdnAppkeyIsNotNull() {
addCriterion("kdn_appkey is not null");
return (Criteria) this;
}
public Criteria andKdnAppkeyEqualTo(String value) {
addCriterion("kdn_appkey =", value, "kdnAppkey");
return (Criteria) this;
}
public Criteria andKdnAppkeyNotEqualTo(String value) {
addCriterion("kdn_appkey <>", value, "kdnAppkey");
return (Criteria) this;
}
public Criteria andKdnAppkeyGreaterThan(String value) {
addCriterion("kdn_appkey >", value, "kdnAppkey");
return (Criteria) this;
}
public Criteria andKdnAppkeyGreaterThanOrEqualTo(String value) {
addCriterion("kdn_appkey >=", value, "kdnAppkey");
return (Criteria) this;
}
public Criteria andKdnAppkeyLessThan(String value) {
addCriterion("kdn_appkey <", value, "kdnAppkey");
return (Criteria) this;
}
public Criteria andKdnAppkeyLessThanOrEqualTo(String value) {
addCriterion("kdn_appkey <=", value, "kdnAppkey");
return (Criteria) this;
}
public Criteria andKdnAppkeyLike(String value) {
addCriterion("kdn_appkey like", value, "kdnAppkey");
return (Criteria) this;
}
public Criteria andKdnAppkeyNotLike(String value) {
addCriterion("kdn_appkey not like", value, "kdnAppkey");
return (Criteria) this;
}
public Criteria andKdnAppkeyIn(List<String> values) {
addCriterion("kdn_appkey in", values, "kdnAppkey");
return (Criteria) this;
}
public Criteria andKdnAppkeyNotIn(List<String> values) {
addCriterion("kdn_appkey not in", values, "kdnAppkey");
return (Criteria) this;
}
public Criteria andKdnAppkeyBetween(String value1, String value2) {
addCriterion("kdn_appkey between", value1, value2, "kdnAppkey");
return (Criteria) this;
}
public Criteria andKdnAppkeyNotBetween(String value1, String value2) {
addCriterion("kdn_appkey not between", value1, value2, "kdnAppkey");
return (Criteria) this;
}
} }
public static class Criteria extends GeneratedCriteria { public static class Criteria extends GeneratedCriteria {
......
package com.macro.mall.model.dto.vanke;
import com.macro.mall.model.VankeGoods;
import lombok.Data;
@Data
public class VankeGoodsDto extends VankeGoods {
private String supplierName;//供应商名称
private String stockRoomName;//库房名称
private String goodsCategoryName;//商品分类名称
}
...@@ -24,8 +24,6 @@ ...@@ -24,8 +24,6 @@
<result column="member_id" jdbcType="BIGINT" property="memberId" /> <result column="member_id" jdbcType="BIGINT" property="memberId" />
<result column="depart_id" jdbcType="BIGINT" property="departId" /> <result column="depart_id" jdbcType="BIGINT" property="departId" />
<result column="apply_code" jdbcType="INTEGER" property="applyCode" /> <result column="apply_code" jdbcType="INTEGER" property="applyCode" />
<result column="kdn_uid" jdbcType="VARCHAR" property="kdnUid" />
<result column="kdn_appkey" jdbcType="VARCHAR" property="kdnAppkey" />
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<where> <where>
...@@ -88,7 +86,7 @@ ...@@ -88,7 +86,7 @@
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, type, username, phone, password, icon, email, nick_name, note, create_time, login_time, id, type, username, phone, password, icon, email, nick_name, note, create_time, login_time,
status, create_date, create_by, update_date, update_by, delete_status, name, parent_id, status, create_date, create_by, update_date, update_by, delete_status, name, parent_id,
member_id, depart_id, apply_code, kdn_uid, kdn_appkey member_id, depart_id, apply_code
</sql> </sql>
<select id="selectByExample" parameterType="com.macro.mall.model.UmsAdminExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="com.macro.mall.model.UmsAdminExample" resultMap="BaseResultMap">
select select
...@@ -130,16 +128,16 @@ ...@@ -130,16 +128,16 @@
login_time, status, create_date, login_time, status, create_date,
create_by, update_date, update_by, create_by, update_date, update_by,
delete_status, name, parent_id, delete_status, name, parent_id,
member_id, depart_id, apply_code, member_id, depart_id, apply_code
kdn_uid, kdn_appkey) )
values (#{type,jdbcType=INTEGER}, #{username,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, values (#{type,jdbcType=INTEGER}, #{username,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR},
#{password,jdbcType=VARCHAR}, #{icon,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, #{icon,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR},
#{nickName,jdbcType=VARCHAR}, #{note,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{nickName,jdbcType=VARCHAR}, #{note,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{loginTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, #{createDate,jdbcType=TIMESTAMP}, #{loginTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, #{createDate,jdbcType=TIMESTAMP},
#{createBy,jdbcType=BIGINT}, #{updateDate,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=BIGINT}, #{createBy,jdbcType=BIGINT}, #{updateDate,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=BIGINT},
#{deleteStatus,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{parentId,jdbcType=BIGINT}, #{deleteStatus,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{parentId,jdbcType=BIGINT},
#{memberId,jdbcType=BIGINT}, #{departId,jdbcType=BIGINT}, #{applyCode,jdbcType=INTEGER}, #{memberId,jdbcType=BIGINT}, #{departId,jdbcType=BIGINT}, #{applyCode,jdbcType=INTEGER}
#{kdnUid,jdbcType=VARCHAR}, #{kdnAppkey,jdbcType=VARCHAR}) )
</insert> </insert>
<insert id="insertSelective" parameterType="com.macro.mall.model.UmsAdmin"> <insert id="insertSelective" parameterType="com.macro.mall.model.UmsAdmin">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long"> <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
...@@ -210,12 +208,6 @@ ...@@ -210,12 +208,6 @@
<if test="applyCode != null"> <if test="applyCode != null">
apply_code, apply_code,
</if> </if>
<if test="kdnUid != null">
kdn_uid,
</if>
<if test="kdnAppkey != null">
kdn_appkey,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="type != null"> <if test="type != null">
...@@ -281,12 +273,6 @@ ...@@ -281,12 +273,6 @@
<if test="applyCode != null"> <if test="applyCode != null">
#{applyCode,jdbcType=INTEGER}, #{applyCode,jdbcType=INTEGER},
</if> </if>
<if test="kdnUid != null">
#{kdnUid,jdbcType=VARCHAR},
</if>
<if test="kdnAppkey != null">
#{kdnAppkey,jdbcType=VARCHAR},
</if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="com.macro.mall.model.UmsAdminExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="com.macro.mall.model.UmsAdminExample" resultType="java.lang.Long">
...@@ -364,12 +350,6 @@ ...@@ -364,12 +350,6 @@
<if test="record.applyCode != null"> <if test="record.applyCode != null">
apply_code = #{record.applyCode,jdbcType=INTEGER}, apply_code = #{record.applyCode,jdbcType=INTEGER},
</if> </if>
<if test="record.kdnUid != null">
kdn_uid = #{record.kdnUid,jdbcType=VARCHAR},
</if>
<if test="record.kdnAppkey != null">
kdn_appkey = #{record.kdnAppkey,jdbcType=VARCHAR},
</if>
</set> </set>
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
...@@ -398,9 +378,7 @@ ...@@ -398,9 +378,7 @@
parent_id = #{record.parentId,jdbcType=BIGINT}, parent_id = #{record.parentId,jdbcType=BIGINT},
member_id = #{record.memberId,jdbcType=BIGINT}, member_id = #{record.memberId,jdbcType=BIGINT},
depart_id = #{record.departId,jdbcType=BIGINT}, depart_id = #{record.departId,jdbcType=BIGINT},
apply_code = #{record.applyCode,jdbcType=INTEGER}, apply_code = #{record.applyCode,jdbcType=INTEGER}
kdn_uid = #{record.kdnUid,jdbcType=VARCHAR},
kdn_appkey = #{record.kdnAppkey,jdbcType=VARCHAR}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
...@@ -471,12 +449,6 @@ ...@@ -471,12 +449,6 @@
<if test="applyCode != null"> <if test="applyCode != null">
apply_code = #{applyCode,jdbcType=INTEGER}, apply_code = #{applyCode,jdbcType=INTEGER},
</if> </if>
<if test="kdnUid != null">
kdn_uid = #{kdnUid,jdbcType=VARCHAR},
</if>
<if test="kdnAppkey != null">
kdn_appkey = #{kdnAppkey,jdbcType=VARCHAR},
</if>
</set> </set>
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
...@@ -502,9 +474,7 @@ ...@@ -502,9 +474,7 @@
parent_id = #{parentId,jdbcType=BIGINT}, parent_id = #{parentId,jdbcType=BIGINT},
member_id = #{memberId,jdbcType=BIGINT}, member_id = #{memberId,jdbcType=BIGINT},
depart_id = #{departId,jdbcType=BIGINT}, depart_id = #{departId,jdbcType=BIGINT},
apply_code = #{applyCode,jdbcType=INTEGER}, apply_code = #{applyCode,jdbcType=INTEGER}
kdn_uid = #{kdnUid,jdbcType=VARCHAR},
kdn_appkey = #{kdnAppkey,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
</mapper> </mapper>
\ No newline at end of file
...@@ -43,12 +43,12 @@ public class KdniaoSubscribeAPI { ...@@ -43,12 +43,12 @@ public class KdniaoSubscribeAPI {
* @throws Exception * @throws Exception
*/ */
public KdniaoSubscribeParam getOrderTracesByJson(UmsAdmin admin, String expCode, String expNo) throws Exception { public KdniaoSubscribeParam getOrderTracesByJson(UmsAdmin admin, String expCode, String expNo) throws Exception {
if (!StringUtils.isEmpty(EBusinessID)) { /* if (!StringUtils.isEmpty(EBusinessID)) {
EBusinessID = admin.getKdnUid(); EBusinessID = admin.getKdnUid();
} }
if (!StringUtils.isEmpty(AppKey)) { if (!StringUtils.isEmpty(AppKey)) {
AppKey = admin.getKdnAppkey(); AppKey = admin.getKdnAppkey();
} }*/
String requestData = "{'OrderCode':'','ShipperCode':'" + expCode + "','LogisticCode':'" + expNo + "'}"; String requestData = "{'OrderCode':'','ShipperCode':'" + expCode + "','LogisticCode':'" + expNo + "'}";
Map<String, String> params = new HashMap<String, String>(); Map<String, String> params = new HashMap<String, String>();
......
package com.macro.mall.dao.vanke;
import com.macro.mall.model.dto.vanke.VankeGoodsDto;
import java.util.List;
public interface VankeGoodsDao {
List<VankeGoodsDto> selectList(VankeGoodsDto vankeGoodsDto);
}
...@@ -1676,9 +1676,9 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService { ...@@ -1676,9 +1676,9 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
try { try {
Long mchtId = orderSon.getMchtId(); Long mchtId = orderSon.getMchtId();
UmsAdmin admin = adminMapper.selectByPrimaryKey(mchtId); UmsAdmin admin = adminMapper.selectByPrimaryKey(mchtId);
if (StringUtils.isEmpty(admin.getKdnUid()) || StringUtils.isEmpty(admin.getKdnAppkey())) { /* if (StringUtils.isEmpty(admin.getKdnUid()) || StringUtils.isEmpty(admin.getKdnAppkey())) {
CommonResult.failed("供应商未开通快递查询服务"); CommonResult.failed("供应商未开通快递查询服务");
} }*/
KdniaoSubscribeParam result = api.getOrderTracesByJson(admin, orderSon.getDeliveryExpCode(), orderSon.getDeliverySn()); KdniaoSubscribeParam result = api.getOrderTracesByJson(admin, orderSon.getDeliveryExpCode(), orderSon.getDeliverySn());
result.setShipperName(orderSon.getDeliveryCompany()); result.setShipperName(orderSon.getDeliveryCompany());
return CommonResult.success(result); return CommonResult.success(result);
......
...@@ -645,7 +645,7 @@ public class UmsAdminServiceImpl implements UmsAdminService { ...@@ -645,7 +645,7 @@ public class UmsAdminServiceImpl implements UmsAdminService {
public UmsAdmin getCurrentUmsAdmin() { public UmsAdmin getCurrentUmsAdmin() {
SecurityContext ctx = SecurityContextHolder.getContext(); SecurityContext ctx = SecurityContextHolder.getContext();
Authentication auth = ctx.getAuthentication(); Authentication auth = ctx.getAuthentication();
if (auth != null && auth.getPrincipal() instanceof MemberDetails) { if (auth != null) {
AdminUserDetails adminUserDetails = (AdminUserDetails)auth.getPrincipal(); AdminUserDetails adminUserDetails = (AdminUserDetails)auth.getPrincipal();
return adminUserDetails.getUmsAdmin(); return adminUserDetails.getUmsAdmin();
} }
......
package com.macro.mall.service.vanke; package com.macro.mall.service.vanke;
import com.macro.mall.model.VankeGoodsCategory;
import com.macro.mall.model.common.ResultMsg;
import java.util.List;
public interface IVankeGoodsCategoryService { public interface IVankeGoodsCategoryService {
/**
* 插入物品类别
* @param vankeGoodsCategory
* @return
*/
ResultMsg insertGoodsCategory(VankeGoodsCategory vankeGoodsCategory);
/**
* 根据id修改一条记录
* @param vankeGoodsCategory
* @return
*/
ResultMsg updateGoodsCategory(VankeGoodsCategory vankeGoodsCategory);
/**
* 分页获取物品类别
* @param pageNum
* @param pageSize
* @return
*/
List<VankeGoodsCategory> getPageList(Integer pageNum,Integer pageSize);
} }
package com.macro.mall.service.vanke;
import com.macro.mall.model.VankeGoods;
import com.macro.mall.model.common.ResultMsg;
import com.macro.mall.model.dto.vanke.VankeGoodsDto;
import java.util.List;
public interface IVankeGoodsService {
/**
* 插入一条商品
* @param vankeGoods
* @return
*/
ResultMsg insertGoods(VankeGoods vankeGoods);
/**
* 根据id 修改一个物品
* @param vankeGoods
* @return
*/
ResultMsg updateGoods(VankeGoods vankeGoods);
/**
*
* @param pageNum 页数
* @param pageSize 页数大小
* @param name 物品名称
* @param goodsCategoryName 类别名称
* @param supplierName 供应商名称
* @param stockRoomName 库房名称
* @return
*/
List<VankeGoodsDto> selectList(Integer pageNum,Integer pageSize,String name,String goodsCategoryName,String supplierName,String stockRoomName);
}
...@@ -3,6 +3,8 @@ package com.macro.mall.service.vanke; ...@@ -3,6 +3,8 @@ package com.macro.mall.service.vanke;
import com.macro.mall.model.VankeStockRoom; import com.macro.mall.model.VankeStockRoom;
import com.macro.mall.model.common.ResultMsg; import com.macro.mall.model.common.ResultMsg;
import java.util.List;
public interface IVankeStockRoomService { public interface IVankeStockRoomService {
/** /**
...@@ -19,6 +21,12 @@ public interface IVankeStockRoomService { ...@@ -19,6 +21,12 @@ public interface IVankeStockRoomService {
*/ */
ResultMsg updateStockRoom(VankeStockRoom vankeStockRoom); ResultMsg updateStockRoom(VankeStockRoom vankeStockRoom);
/**
* 分页查询库房操作
* @param pageNum
* @param pageSize
* @return
*/
List<VankeStockRoom> getPageList(Integer pageNum,Integer pageSize);
} }
package com.macro.mall.service.vanke;
import com.macro.mall.model.VankeSupplier;
import com.macro.mall.model.common.ResultMsg;
import java.util.List;
public interface IVankeSupplierService {
/**
* 插入供应商
* @param vankeSupplier
* @return
*/
ResultMsg insertSupplier(VankeSupplier vankeSupplier);
/**
* 根据id修改供应商数据
* @param vankeSupplier
* @return
*/
ResultMsg updateSupplier(VankeSupplier vankeSupplier);
/**
* 分页操作
* @param pageNum
* @param pageSize
* @return
*/
List<VankeSupplier> getPageList(Integer pageNum,Integer pageSize);
}
...@@ -12,6 +12,7 @@ import com.macro.mall.service.vanke.IVankeBackLogService; ...@@ -12,6 +12,7 @@ import com.macro.mall.service.vanke.IVankeBackLogService;
import com.macro.mall.service.vanke.IVankeDepartmentSerive; import com.macro.mall.service.vanke.IVankeDepartmentSerive;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
...@@ -39,6 +40,7 @@ public class VankeDepartmentSeriveImpl implements IVankeDepartmentSerive { ...@@ -39,6 +40,7 @@ public class VankeDepartmentSeriveImpl implements IVankeDepartmentSerive {
} }
@Override @Override
@Transactional(rollbackFor = Exception.class)
public ResultMsg insertDepartment(VankeDepartment vankeDepartment) { public ResultMsg insertDepartment(VankeDepartment vankeDepartment) {
//插入部门 //插入部门
if(vankeDepartment.getName() == null && "".equals(vankeDepartment.getName())){ if(vankeDepartment.getName() == null && "".equals(vankeDepartment.getName())){
...@@ -60,6 +62,7 @@ public class VankeDepartmentSeriveImpl implements IVankeDepartmentSerive { ...@@ -60,6 +62,7 @@ public class VankeDepartmentSeriveImpl implements IVankeDepartmentSerive {
* @return * @return
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class)
public ResultMsg updateDepartment(VankeDepartment vankeDepartment){ public ResultMsg updateDepartment(VankeDepartment vankeDepartment){
if(vankeDepartment.getId() == null){ if(vankeDepartment.getId() == null){
return new ResultMsg(false,"传入id为空"); return new ResultMsg(false,"传入id为空");
...@@ -82,7 +85,6 @@ public class VankeDepartmentSeriveImpl implements IVankeDepartmentSerive { ...@@ -82,7 +85,6 @@ public class VankeDepartmentSeriveImpl implements IVankeDepartmentSerive {
UmsAdmin admin = umsAdminService.getCurrentUmsAdmin(); UmsAdmin admin = umsAdminService.getCurrentUmsAdmin();
vankeDepartment.setUpdateBy(admin.getId()); vankeDepartment.setUpdateBy(admin.getId());
this.vankeDepartmentMapper.updateByPrimaryKeySelective(vankeDepartment); this.vankeDepartmentMapper.updateByPrimaryKeySelective(vankeDepartment);
return new ResultMsg(true,"操作成功"); return new ResultMsg(true,"操作成功");
} }
......
package com.macro.mall.service.vanke.impl; package com.macro.mall.service.vanke.impl;
import com.github.pagehelper.PageHelper;
import com.macro.mall.mapper.VankeGoodsCategoryMapper; import com.macro.mall.mapper.VankeGoodsCategoryMapper;
import com.macro.mall.model.*;
import com.macro.mall.model.common.ResultMsg;
import com.macro.mall.service.system.UmsAdminService;
import com.macro.mall.service.vanke.IVankeBackLogService;
import com.macro.mall.service.vanke.IVankeGoodsCategoryService; import com.macro.mall.service.vanke.IVankeGoodsCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List;
@Service @Service
public class VankeGoodsCategoryServiceImpl implements IVankeGoodsCategoryService { public class VankeGoodsCategoryServiceImpl implements IVankeGoodsCategoryService {
...@@ -12,6 +20,69 @@ public class VankeGoodsCategoryServiceImpl implements IVankeGoodsCategoryService ...@@ -12,6 +20,69 @@ public class VankeGoodsCategoryServiceImpl implements IVankeGoodsCategoryService
@Resource @Resource
private VankeGoodsCategoryMapper vankeGoodsCategoryMapper; private VankeGoodsCategoryMapper vankeGoodsCategoryMapper;
@Autowired
private UmsAdminService umsAdminService;
@Autowired
private IVankeBackLogService vankeBackLogService;
@Override
@Transactional(rollbackFor = Exception.class)
public ResultMsg insertGoodsCategory(VankeGoodsCategory vankeGoodsCategory) {
//插入类别
if(vankeGoodsCategory.getName() == null && "".equals(vankeGoodsCategory.getName())){
return new ResultMsg(false,"请输入类别名称");
}
UmsAdmin admin = umsAdminService.getCurrentUmsAdmin();
vankeGoodsCategory.setCreateBy(admin.getId());
vankeGoodsCategory.setUpdateBy(admin.getId());
this.vankeGoodsCategoryMapper.insertSelective(vankeGoodsCategory);
String msg = "新增物品类别:"+vankeGoodsCategory.getName();
//插入日志表
this.vankeBackLogService.insertVankeBackLog(msg);
return new ResultMsg(true,"操作成功");
}
@Override
@Transactional(rollbackFor = Exception.class)
public ResultMsg updateGoodsCategory(VankeGoodsCategory vankeGoodsCategory) {
if(vankeGoodsCategory.getId() == null){
return new ResultMsg(false,"传入id为空");
}
String msg = "";
if( vankeGoodsCategory.getName() != null && "".equals(vankeGoodsCategory.getName())){ //如果传入名字 则需加上名字信息
//通过id获得之前名称
VankeGoodsCategory vgc =this.vankeGoodsCategoryMapper.selectByPrimaryKey(vankeGoodsCategory.getId());
msg = "将物品类别:"+vgc.getName()+"修改为:"+vankeGoodsCategory.getName();
//插入日志表
this.vankeBackLogService.insertVankeBackLog(msg);
}
if(vankeGoodsCategory.getDeleteStatus() != null && vankeGoodsCategory.getDeleteStatus() == 0){
//通过id获得之前名称
VankeGoodsCategory vgc =this.vankeGoodsCategoryMapper.selectByPrimaryKey(vankeGoodsCategory.getId());
msg="将物品类别:"+vgc.getName()+"删除";
//插入日志表
this.vankeBackLogService.insertVankeBackLog(msg);
}
UmsAdmin admin = umsAdminService.getCurrentUmsAdmin();
vankeGoodsCategory.setUpdateBy(admin.getId());
this.vankeGoodsCategoryMapper.updateByPrimaryKeySelective(vankeGoodsCategory);
return new ResultMsg(true,"操作成功");
}
/**
* 分页获取物品类别
* @param pageNum
* @param pageSize
* @return
*/
@Override
public List<VankeGoodsCategory> getPageList(Integer pageNum, Integer pageSize) {
if(pageNum != null && pageSize != null){
PageHelper.startPage(pageNum, pageSize);
}
VankeGoodsCategoryExample example = new VankeGoodsCategoryExample();
VankeGoodsCategoryExample.Criteria criteria = example.createCriteria();
criteria.andDeleteStatusEqualTo(1);//1未删除 0已删除
return this.vankeGoodsCategoryMapper.selectByExample(example);
}
} }
package com.macro.mall.service.vanke.impl;
import com.github.pagehelper.PageHelper;
import com.macro.mall.dao.vanke.VankeGoodsDao;
import com.macro.mall.mapper.VankeGoodsMapper;
import com.macro.mall.model.UmsAdmin;
import com.macro.mall.model.VankeGoods;
import com.macro.mall.model.VankeStockRoom;
import com.macro.mall.model.common.ResultMsg;
import com.macro.mall.model.dto.vanke.VankeGoodsDto;
import com.macro.mall.service.system.UmsAdminService;
import com.macro.mall.service.vanke.IVankeBackLogService;
import com.macro.mall.service.vanke.IVankeGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
@Service
public class VankeGoodsServiceImpl implements IVankeGoodsService {
@Resource
private VankeGoodsMapper vankeGoodsMapper;
@Resource
private VankeGoodsDao vankeGoodsDao;
@Autowired
private UmsAdminService umsAdminService;
@Autowired
private IVankeBackLogService vankeBackLogService;
/**
*
* @param pageNum 页数
* @param pageSize 页数大小
* @param name 物品名称
* @param goodsCategoryName 类别名称
* @param supplierName 供应商名称
* @param stockRoomName 库房名称
* @return
*/
@Override
public List<VankeGoodsDto> selectList(Integer pageNum, Integer pageSize, String name, String goodsCategoryName, String supplierName, String stockRoomName){
//分页操作
PageHelper.startPage(pageNum, pageSize);
VankeGoodsDto vankeGoodsDto = new VankeGoodsDto();
vankeGoodsDto.setName(name);
vankeGoodsDto.setGoodsCategoryName(goodsCategoryName);
vankeGoodsDto.setSupplierName(supplierName);
vankeGoodsDto.setStockRoomName(stockRoomName);
return this.vankeGoodsDao.selectList(vankeGoodsDto);
}
/**
* 插入一条商品
* @param vankeGoods
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public ResultMsg insertGoods(VankeGoods vankeGoods) {
ResultMsg res = this.checkGoods(vankeGoods);
if(!res.isFlag()){
return new ResultMsg(false,res.getMsg());
}
UmsAdmin admin = umsAdminService.getCurrentUmsAdmin();
vankeGoods.setUpdateBy(admin.getId());
vankeGoods.setCreateBy(admin.getId());
this.vankeGoodsMapper.insertSelective(vankeGoods);
String msg = "新增物品:" + vankeGoods.getName();
//插入日志表
this.vankeBackLogService.insertVankeBackLog(msg);
return new ResultMsg(true,"插入成功");
}
/**
* 根据id修改一条物品
* @param vankeGoods
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public ResultMsg updateGoods(VankeGoods vankeGoods){
ResultMsg res = this.checkGoods(vankeGoods);
if(vankeGoods.getId() == null){
return new ResultMsg(false,"传入id为空");
}
if(vankeGoods.getDeleteStatus() == 0){//如果传入的状态为删除
//通过id获得之前名称
VankeGoods vg = this.vankeGoodsMapper.selectByPrimaryKey(vankeGoods.getId());
String msg = "将物品名称:" + vg.getName() + "删除";
//插入日志表
this.vankeBackLogService.insertVankeBackLog(msg);
}
UmsAdmin admin = umsAdminService.getCurrentUmsAdmin();
vankeGoods.setUpdateBy(admin.getId());
this.vankeGoodsMapper.insertSelective(vankeGoods);
return new ResultMsg(true,"操作成功");
}
private ResultMsg checkGoods(VankeGoods vankeGoods){
if(vankeGoods.getName() == null || "".equals(vankeGoods.getName())){
return new ResultMsg(false,"传入物品名称为空");
}
if(vankeGoods.getGoodsCategoryId() == null ){
return new ResultMsg(false,"传入商品分类id为空");
}
if(vankeGoods.getGoodsNum() == null){
return new ResultMsg(false,"传入物品数量为空");
}
if(vankeGoods.getSupplierId() == null){
return new ResultMsg(false,"传入供应商id为空");
}
if(vankeGoods.getStockRoomId() == null){
return new ResultMsg(false,"传入库房Id为空");
}
if(vankeGoods.getPrict() == null){
return new ResultMsg(false,"传入价格为空");
}
if(vankeGoods.getBarCode() == null){
return new ResultMsg(false,"传入条形码为空");
}
return new ResultMsg(true,"校验物品成功");
}
}
package com.macro.mall.service.vanke.impl; package com.macro.mall.service.vanke.impl;
import com.github.pagehelper.PageHelper;
import com.macro.mall.common.utils.HttpsUtil;
import com.macro.mall.mapper.VankeStockRoomMapper; import com.macro.mall.mapper.VankeStockRoomMapper;
import com.macro.mall.model.UmsAdmin; import com.macro.mall.model.UmsAdmin;
import com.macro.mall.model.VankeDepartment; import com.macro.mall.model.VankeDepartment;
import com.macro.mall.model.VankeStockRoom; import com.macro.mall.model.VankeStockRoom;
import com.macro.mall.model.VankeStockRoomExample;
import com.macro.mall.model.common.ResultMsg; import com.macro.mall.model.common.ResultMsg;
import com.macro.mall.service.system.UmsAdminService; import com.macro.mall.service.system.UmsAdminService;
import com.macro.mall.service.vanke.IVankeBackLogService; import com.macro.mall.service.vanke.IVankeBackLogService;
import com.macro.mall.service.vanke.IVankeStockRoomService; import com.macro.mall.service.vanke.IVankeStockRoomService;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.List;
/** /**
* 库房业务 * 库房业务
...@@ -26,45 +36,70 @@ public class VankeStockRoomServiceImpl implements IVankeStockRoomService { ...@@ -26,45 +36,70 @@ public class VankeStockRoomServiceImpl implements IVankeStockRoomService {
@Autowired @Autowired
private IVankeBackLogService vankeBackLogService; private IVankeBackLogService vankeBackLogService;
@Override @Override
@Transactional(rollbackFor = Exception.class)
public ResultMsg insertStockRoom(VankeStockRoom vankeStockRoom) { public ResultMsg insertStockRoom(VankeStockRoom vankeStockRoom) {
if(vankeStockRoom.getName() == null || "".equals(vankeStockRoom.getName())){ if (vankeStockRoom.getName() == null || "".equals(vankeStockRoom.getName())) {
return new ResultMsg(false,"传入库房名称为空"); return new ResultMsg(false, "传入库房名称为空");
} }
UmsAdmin admin = umsAdminService.getCurrentUmsAdmin(); UmsAdmin admin = umsAdminService.getCurrentUmsAdmin();
vankeStockRoom.setCreateBy(admin.getId()); vankeStockRoom.setCreateBy(admin.getId());
vankeStockRoom.setUpdateBy(admin.getId()); vankeStockRoom.setUpdateBy(admin.getId());
this.vankeStockRoomMapper.insertSelective(vankeStockRoom); this.vankeStockRoomMapper.insertSelective(vankeStockRoom);
String msg = "新增库房:"+vankeStockRoom.getName(); String msg = "新增库房:" + vankeStockRoom.getName();
//插入日志表 //插入日志表
this.vankeBackLogService.insertVankeBackLog(msg); this.vankeBackLogService.insertVankeBackLog(msg);
return new ResultMsg(true,"操作成功"); return new ResultMsg(true, "操作成功");
} }
@Override @Override
@Transactional(rollbackFor = Exception.class)
public ResultMsg updateStockRoom(VankeStockRoom vankeStockRoom) { public ResultMsg updateStockRoom(VankeStockRoom vankeStockRoom) {
if(vankeStockRoom.getId() == null){ if (vankeStockRoom.getId() == null) {
return new ResultMsg(false,"传入id为空"); return new ResultMsg(false, "传入id为空");
} }
String msg = ""; String msg = "";
if( vankeStockRoom.getName() != null && "".equals(vankeStockRoom.getName())){ //如果传入名字 则需加上名字信息 if (vankeStockRoom.getName() != null && "".equals(vankeStockRoom.getName())) { //如果传入名字 则需加上名字信息
//通过id获得之前名称 //通过id获得之前名称
VankeStockRoom vsr =this.vankeStockRoomMapper.selectByPrimaryKey(vankeStockRoom.getId()); VankeStockRoom vsr = this.vankeStockRoomMapper.selectByPrimaryKey(vankeStockRoom.getId());
msg = "将库房名称:"+vsr.getName()+"修改为:"+vankeStockRoom.getName(); msg = "将库房名称:" + vsr.getName() + "修改为:" + vankeStockRoom.getName();
//插入日志表 //插入日志表
this.vankeBackLogService.insertVankeBackLog(msg); this.vankeBackLogService.insertVankeBackLog(msg);
} }
if(vankeStockRoom.getDeleteStatus() != null && vankeStockRoom.getDeleteStatus() == 0){ if (vankeStockRoom.getDeleteStatus() != null && vankeStockRoom.getDeleteStatus() == 0) {
//通过id获得之前名称 //通过id获得之前名称
VankeStockRoom vsr =this.vankeStockRoomMapper.selectByPrimaryKey(vankeStockRoom.getId()); VankeStockRoom vsr = this.vankeStockRoomMapper.selectByPrimaryKey(vankeStockRoom.getId());
msg="将库房名称:"+vsr.getName()+"删除"; msg = "将库房名称:" + vsr.getName() + "删除";
//插入日志表 //插入日志表
this.vankeBackLogService.insertVankeBackLog(msg); this.vankeBackLogService.insertVankeBackLog(msg);
} }
UmsAdmin admin = umsAdminService.getCurrentUmsAdmin(); UmsAdmin admin = umsAdminService.getCurrentUmsAdmin();
vankeStockRoom.setUpdateBy(admin.getId()); vankeStockRoom.setUpdateBy(admin.getId());
this.vankeStockRoomMapper.updateByPrimaryKeySelective(vankeStockRoom); this.vankeStockRoomMapper.updateByPrimaryKeySelective(vankeStockRoom);
return new ResultMsg(true,"操作成功"); return new ResultMsg(true, "操作成功");
}
@Override
public List<VankeStockRoom> getPageList(Integer pageNum, Integer pageSize) {
if(pageNum != null && pageSize != null){
PageHelper.startPage(pageNum, pageSize);
}
VankeStockRoomExample example = new VankeStockRoomExample();
VankeStockRoomExample.Criteria criteria = example.createCriteria();
criteria.andDeleteStatusEqualTo(0);//1未删除 0已删除
return this.vankeStockRoomMapper.selectByExample(example);
}
@Test
public void testHttps() throws Exception {
long timeNew = System.currentTimeMillis(); // 13位数的时间戳
// String uri = "https://vvtest.vanke.com/gateway/oauth2/token/getAccessToken?appid=111&secret=222&timestamp="+timeNew+"&scope=app";
String uri = "https://vvtest.vanke.com/gateway/oauth2/token/getAccessToken?appid=111&secret=222&timestamp="+timeNew+"&scope=app";
String data="";
byte[] bytes = HttpsUtil.doPost(uri,data);
System.out.println(new String(bytes));
} }
} }
\ No newline at end of file
package com.macro.mall.service.vanke.impl;
import com.github.pagehelper.PageHelper;
import com.macro.mall.mapper.VankeSupplierMapper;
import com.macro.mall.model.UmsAdmin;
import com.macro.mall.model.VankeStockRoom;
import com.macro.mall.model.VankeSupplier;
import com.macro.mall.model.VankeSupplierExample;
import com.macro.mall.model.common.ResultMsg;
import com.macro.mall.service.system.UmsAdminService;
import com.macro.mall.service.vanke.IVankeBackLogService;
import com.macro.mall.service.vanke.IVankeSupplierService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class VankeSupplierServiceImpl implements IVankeSupplierService {
@Resource
private VankeSupplierMapper vankeSupplierMapper;
@Autowired
private UmsAdminService umsAdminService;
@Autowired
private IVankeBackLogService vankeBackLogService;
/**
* 分页操作
* @param pageNum
* @param pageSize
* @return
*/
@Override
public List<VankeSupplier> getPageList(Integer pageNum, Integer pageSize){
if(pageNum != null && pageSize != null){
PageHelper.startPage(pageNum, pageSize);
}
VankeSupplierExample example = new VankeSupplierExample();
VankeSupplierExample.Criteria criteria = example.createCriteria();
criteria.andDeleteStatusEqualTo(1);//1未删除 0已删除
return this.vankeSupplierMapper.selectByExample(example);
}
/**
* 插入供应商
* @param vankeSupplier
* @return
*/
@Override
public ResultMsg insertSupplier(VankeSupplier vankeSupplier){
ResultMsg res = this.checkSupplier(vankeSupplier);
if(!res.isFlag()){
return new ResultMsg(false,res.getMsg());
}
UmsAdmin admin = umsAdminService.getCurrentUmsAdmin();
vankeSupplier.setUpdateBy(admin.getId());
vankeSupplier.setCreateBy(admin.getId());
this.vankeSupplierMapper.insertSelective(vankeSupplier);
String msg = "新增供应商:" + vankeSupplier.getSupplierName();
//插入日志表
this.vankeBackLogService.insertVankeBackLog(msg);
return new ResultMsg(true,"操作成功");
}
/**
* 根据id修改供应商数据
* @param vankeSupplier
* @return
*/
@Override
public ResultMsg updateSupplier(VankeSupplier vankeSupplier){
if (vankeSupplier.getId() == null) {
return new ResultMsg(false, "传入id为空");
}
if (vankeSupplier.getDeleteStatus() != null && vankeSupplier.getDeleteStatus() == 0) {
//通过id获得之前名称
VankeSupplier vs = this.vankeSupplierMapper.selectByPrimaryKey(vankeSupplier.getId());
String msg = "将供应商删除:" + vs.getName() + "删除";
//插入日志表
this.vankeBackLogService.insertVankeBackLog(msg);
}
UmsAdmin admin = umsAdminService.getCurrentUmsAdmin();
vankeSupplier.setUpdateBy(admin.getId());
this.vankeSupplierMapper.updateByPrimaryKeySelective(vankeSupplier);
return new ResultMsg(true, "操作成功");
}
private ResultMsg checkSupplier(VankeSupplier vankeSupplier){
if(vankeSupplier.getSupplierName() == null || "".equals(vankeSupplier.getSupplierName())){
return new ResultMsg(false,"供应商名称为空");
}
if(vankeSupplier.getName() == null || "".equals(vankeSupplier.getName())){
return new ResultMsg(false,"联系人为空");
}
if(vankeSupplier.getTel() == null || "".equals(vankeSupplier.getTel())){
return new ResultMsg(false,"传入手机号为空");
}
return new ResultMsg(true,"校验成功");
}
}
<?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.macro.mall.dao.vanke.VankeGoodsDao">
<resultMap id="BaseResultMap" type="com.macro.mall.model.dto.vanke.VankeGoodsDto" extends="com.macro.mall.mapper.VankeGoodsMapper.BaseResultMap">
<result column="supplierName" jdbcType="VARCHAR" property="supplierName" />
<result column="stockRoomName" jdbcType="VARCHAR" property="stockRoomName" />
<result column="goodsCategoryName" jdbcType="VARCHAR" property="goodsCategoryName" />
</resultMap>
<select id="selectList" resultMap="BaseResultMap" parameterType="com.macro.mall.model.dto.vanke.VankeGoodsDto">
select a.*,b.name goodsCategoryName,c.name stockRoomName,d.name supplierName from vanke_goods a
left join vanke_goods_category b ON a.goods_category_id = b.id
left join vanke_stock_room c ON a.stock_room_id = c.id
left join vanke_supplier d ON a.supplier_id = d.id
where a.delete_status = 1
<if test="name != null and name!=''">
and a.name like CONCAT(#{name},'%')
</if>
<if test="goodsCategoryName != null and goodsCategoryName!=''">
and b.name = #{goodsCategoryName}
</if>
<if test="stockRoomName != null and stockRoomName!=''">
and c.name = #{stockRoomName}
</if>
<if test="supplierName != null and supplierName!=''">
and d.name = #{supplierName}
</if>
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment