浏览代码

发运单完成

jz.kai 2 年之前
父节点
当前提交
57d94bbfbe

+ 18 - 0
common/src/main/java/com/jpsoft/prices/modules/base/dao/InvoiceDAO.java

@@ -0,0 +1,18 @@
+package com.jpsoft.prices.modules.base.dao;
+
+import java.util.List;
+import org.springframework.stereotype.Repository;
+import com.jpsoft.prices.modules.base.entity.Invoice;
+import java.util.Map;
+import com.jpsoft.prices.modules.common.dto.Sort;
+
+@Repository
+public interface InvoiceDAO {
+	int insert(Invoice entity);
+	int update(Invoice entity);
+	int exist(String id);
+	Invoice get(String id);
+	int delete(String id);
+	List<Invoice> list();
+	List<Invoice> search(Map<String,Object> searchParams,List<Sort> sortList);
+}

+ 18 - 0
common/src/main/java/com/jpsoft/prices/modules/base/dao/InvoiceInfoDAO.java

@@ -0,0 +1,18 @@
+package com.jpsoft.prices.modules.base.dao;
+
+import java.util.List;
+import org.springframework.stereotype.Repository;
+import com.jpsoft.prices.modules.base.entity.InvoiceInfo;
+import java.util.Map;
+import com.jpsoft.prices.modules.common.dto.Sort;
+
+@Repository
+public interface InvoiceInfoDAO {
+	int insert(InvoiceInfo entity);
+	int update(InvoiceInfo entity);
+	int exist(String id);
+	InvoiceInfo get(String id);
+	int delete(String id);
+	List<InvoiceInfo> list();
+	List<InvoiceInfo> search(Map<String,Object> searchParams,List<Sort> sortList);
+}

+ 1 - 1
common/src/main/java/com/jpsoft/prices/modules/base/entity/Destination.java

@@ -23,7 +23,7 @@ public class Destination {
     private String code;
     private String parentName;
     private String parentFullName;
-        @ApiModelProperty(value = "区域名称")
+        @ApiModelProperty(value = "名称")
     private String name;
         @ApiModelProperty(value = "是否删除")
     private Boolean delFlag;

+ 51 - 0
common/src/main/java/com/jpsoft/prices/modules/base/entity/Invoice.java

@@ -0,0 +1,51 @@
+package com.jpsoft.prices.modules.base.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.text.SimpleDateFormat;
+import java.math.BigDecimal;
+import org.springframework.format.annotation.DateTimeFormat;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+/**
+  描述:base_invoice的实体类
+ */
+@Data
+@ApiModel(value = "base_invoice的实体类")
+public class Invoice {
+        @ApiModelProperty(value = "UUID")
+    private String id;
+        @DateTimeFormat(pattern="yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone ="GMT+8")
+	    @ApiModelProperty(value = "发货日期")
+    private Date shipment;
+        @ApiModelProperty(value = "收货人")
+    private String recipient;
+        @ApiModelProperty(value = "联系电话")
+    private String recipientTelephone;
+        @ApiModelProperty(value = "收货单位")
+    private String recipientEntity;
+        @ApiModelProperty(value = "收货地址")
+    private String recipientAddress;
+        @ApiModelProperty(value = "货值")
+    private Integer goodsValue;
+        @ApiModelProperty(value = "状态")
+    private Boolean status;
+        @ApiModelProperty(value = "是否删除")
+    private Boolean delFlag;
+        @DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
+	    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+        @ApiModelProperty(value = "创建人")
+    private String createBy;
+        @DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
+	    @ApiModelProperty(value = "更新时间")
+    private Date updateTime;
+        @ApiModelProperty(value = "更新人")
+    private String updateBy;
+}

+ 53 - 0
common/src/main/java/com/jpsoft/prices/modules/base/entity/InvoiceInfo.java

@@ -0,0 +1,53 @@
+package com.jpsoft.prices.modules.base.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.text.SimpleDateFormat;
+import java.math.BigDecimal;
+import org.springframework.format.annotation.DateTimeFormat;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+/**
+  描述:base_invoice_info的实体类
+ */
+@Data
+@ApiModel(value = "base_invoice_info的实体类")
+public class InvoiceInfo {
+        @ApiModelProperty(value = "编号")
+    private String id;
+        @ApiModelProperty(value = "发运单编号")
+    private String invoiceId;
+        @ApiModelProperty(value = "订单号")
+    private String orderNumber;
+        @ApiModelProperty(value = "名称")
+    private String name;
+        @ApiModelProperty(value = "条形码")
+    private String barCode;
+        @ApiModelProperty(value = "长(CM)")
+    private Integer boxLength;
+        @ApiModelProperty(value = "宽(CM)")
+    private Integer boxWidth;
+        @ApiModelProperty(value = "高(CM)")
+    private Integer boxHight;
+        @ApiModelProperty(value = "净重(KG)")
+    private BigDecimal netWeight;
+        @ApiModelProperty(value = "毛重(KG)")
+    private BigDecimal grossWeight;
+        @ApiModelProperty(value = "是否删除")
+    private Boolean delFlag;
+        @DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
+	    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+        @ApiModelProperty(value = "创建人")
+    private String createBy;
+        @DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
+	    @ApiModelProperty(value = "更新时间")
+    private Date updateTime;
+        @ApiModelProperty(value = "更新人")
+    private String updateBy;
+}

+ 17 - 0
common/src/main/java/com/jpsoft/prices/modules/base/service/InvoiceInfoService.java

@@ -0,0 +1,17 @@
+package com.jpsoft.prices.modules.base.service;
+
+import java.util.List;
+import java.util.Map;
+import com.jpsoft.prices.modules.base.entity.InvoiceInfo;
+import com.github.pagehelper.Page;
+import com.jpsoft.prices.modules.common.dto.Sort;
+
+public interface InvoiceInfoService {
+	InvoiceInfo get(String id);
+	boolean exist(String id);
+	int insert(InvoiceInfo model);
+	int update(InvoiceInfo model);
+	int delete(String id);
+	List<InvoiceInfo> list();
+	Page<InvoiceInfo> pageSearch(Map<String, Object> searchParams,int pageNum,int pageSize,boolean count,List<Sort> sortList);
+}

+ 17 - 0
common/src/main/java/com/jpsoft/prices/modules/base/service/InvoiceService.java

@@ -0,0 +1,17 @@
+package com.jpsoft.prices.modules.base.service;
+
+import java.util.List;
+import java.util.Map;
+import com.jpsoft.prices.modules.base.entity.Invoice;
+import com.github.pagehelper.Page;
+import com.jpsoft.prices.modules.common.dto.Sort;
+
+public interface InvoiceService {
+	Invoice get(String id);
+	boolean exist(String id);
+	int insert(Invoice model);
+	int update(Invoice model);
+	int delete(String id);
+	List<Invoice> list();
+	Page<Invoice> pageSearch(Map<String, Object> searchParams,int pageNum,int pageSize,boolean count,List<Sort> sortList);
+}

+ 70 - 0
common/src/main/java/com/jpsoft/prices/modules/base/service/impl/InvoiceInfoServiceImpl.java

@@ -0,0 +1,70 @@
+package com.jpsoft.prices.modules.base.service.impl;
+
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import javax.annotation.Resource;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+import com.jpsoft.prices.modules.base.dao.InvoiceInfoDAO;
+import com.jpsoft.prices.modules.base.entity.InvoiceInfo;
+import com.jpsoft.prices.modules.base.service.InvoiceInfoService;
+import com.github.pagehelper.Page;
+import com.jpsoft.prices.modules.common.dto.Sort;
+import com.github.pagehelper.PageHelper;
+
+@Transactional
+@Component(value="invoiceInfoService")
+public class InvoiceInfoServiceImpl implements InvoiceInfoService {
+	@Resource(name="invoiceInfoDAO")
+	private InvoiceInfoDAO invoiceInfoDAO;
+
+	@Override
+	public InvoiceInfo get(String id) {
+		// TODO Auto-generated method stub
+		return invoiceInfoDAO.get(id);
+	}
+
+	@Override
+	public int insert(InvoiceInfo model) {
+		// TODO Auto-generated method stub
+		//model.setId(UUID.randomUUID().toString());
+		
+		return invoiceInfoDAO.insert(model);
+	}
+
+	@Override
+	public int update(InvoiceInfo model) {
+		// TODO Auto-generated method stub
+		return invoiceInfoDAO.update(model);		
+	}
+
+	@Override
+	public int delete(String id) {
+		// TODO Auto-generated method stub
+		return invoiceInfoDAO.delete(id);
+	}
+
+	@Override
+	public boolean exist(String id) {
+		// TODO Auto-generated method stub
+		int count = invoiceInfoDAO.exist(id);
+		
+		return count > 0 ? true : false;
+	}
+	
+	@Override
+	public List<InvoiceInfo> list() {
+		// TODO Auto-generated method stub
+		return invoiceInfoDAO.list();
+	}
+		
+	@Override
+	public Page<InvoiceInfo> pageSearch(Map<String, Object> searchParams, int pageNumber, int pageSize,boolean count,List<Sort> sortList) {
+        Page<InvoiceInfo> page = PageHelper.startPage(pageNumber,pageSize,count).doSelectPage(()->{
+            invoiceInfoDAO.search(searchParams,sortList);
+        });
+        
+        return page;
+	}
+}

+ 70 - 0
common/src/main/java/com/jpsoft/prices/modules/base/service/impl/InvoiceServiceImpl.java

@@ -0,0 +1,70 @@
+package com.jpsoft.prices.modules.base.service.impl;
+
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import javax.annotation.Resource;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+import com.jpsoft.prices.modules.base.dao.InvoiceDAO;
+import com.jpsoft.prices.modules.base.entity.Invoice;
+import com.jpsoft.prices.modules.base.service.InvoiceService;
+import com.github.pagehelper.Page;
+import com.jpsoft.prices.modules.common.dto.Sort;
+import com.github.pagehelper.PageHelper;
+
+@Transactional
+@Component(value="invoiceService")
+public class InvoiceServiceImpl implements InvoiceService {
+	@Resource(name="invoiceDAO")
+	private InvoiceDAO invoiceDAO;
+
+	@Override
+	public Invoice get(String id) {
+		// TODO Auto-generated method stub
+		return invoiceDAO.get(id);
+	}
+
+	@Override
+	public int insert(Invoice model) {
+		// TODO Auto-generated method stub
+		//model.setId(UUID.randomUUID().toString());
+		
+		return invoiceDAO.insert(model);
+	}
+
+	@Override
+	public int update(Invoice model) {
+		// TODO Auto-generated method stub
+		return invoiceDAO.update(model);		
+	}
+
+	@Override
+	public int delete(String id) {
+		// TODO Auto-generated method stub
+		return invoiceDAO.delete(id);
+	}
+
+	@Override
+	public boolean exist(String id) {
+		// TODO Auto-generated method stub
+		int count = invoiceDAO.exist(id);
+		
+		return count > 0 ? true : false;
+	}
+	
+	@Override
+	public List<Invoice> list() {
+		// TODO Auto-generated method stub
+		return invoiceDAO.list();
+	}
+		
+	@Override
+	public Page<Invoice> pageSearch(Map<String, Object> searchParams, int pageNumber, int pageSize,boolean count,List<Sort> sortList) {
+        Page<Invoice> page = PageHelper.startPage(pageNumber,pageSize,count).doSelectPage(()->{
+            invoiceDAO.search(searchParams,sortList);
+        });
+        
+        return page;
+	}
+}

+ 132 - 0
common/src/main/resources/mapper/base/Invoice.xml

@@ -0,0 +1,132 @@
+<?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">
+<!-- namespace必须指向DAO接口 -->
+<mapper namespace="com.jpsoft.prices.modules.base.dao.InvoiceDAO">
+	<resultMap id="InvoiceMap" type="com.jpsoft.prices.modules.base.entity.Invoice">
+		<id property="id" column="id_" />
+		<result property="shipment" column="shipment_" />
+		<result property="recipient" column="recipient_" />
+		<result property="recipientTelephone" column="recipient_telephone" />
+		<result property="recipientEntity" column="recipient_entity" />
+		<result property="recipientAddress" column="recipient_address" />
+		<result property="goodsValue" column="goods_value" />
+		<result property="status" column="status_" />
+		<result property="delFlag" column="del_flag" />
+		<result property="createTime" column="create_time" />
+		<result property="createBy" column="create_by" />
+		<result property="updateTime" column="update_time" />
+		<result property="updateBy" column="update_by" />
+	</resultMap>
+	<insert id="insert" parameterType="com.jpsoft.prices.modules.base.entity.Invoice">
+	<!--
+	<selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
+		select sys_guid() from dual
+	</selectKey>
+	-->
+	<![CDATA[
+		insert into base_invoice
+	    (id_,shipment_,recipient_,recipient_telephone,recipient_entity,recipient_address,goods_value,status_,del_flag,create_time,create_by,update_time,update_by)
+		values
+		(
+#{id,jdbcType=VARCHAR}
+,#{shipment,jdbcType= TIMESTAMP }
+,#{recipient,jdbcType=VARCHAR}
+,#{recipientTelephone,jdbcType=VARCHAR}
+,#{recipientEntity,jdbcType=VARCHAR}
+,#{recipientAddress,jdbcType=VARCHAR}
+,#{goodsValue,jdbcType= NUMERIC }
+,#{status,jdbcType= NUMERIC }
+,#{delFlag,jdbcType= NUMERIC }
+,#{createTime,jdbcType= TIMESTAMP }
+,#{createBy,jdbcType=VARCHAR}
+,#{updateTime,jdbcType= TIMESTAMP }
+,#{updateBy,jdbcType=VARCHAR}
+		)
+	]]>
+	</insert>
+	<delete id="delete" parameterType="string">
+		delete from base_invoice where id_=#{id,jdbcType=VARCHAR}
+	</delete>
+	<update id="update" parameterType="com.jpsoft.prices.modules.base.entity.Invoice">
+		update base_invoice
+		<set>
+				<if test="shipment!=null">
+		shipment_=#{shipment,jdbcType= TIMESTAMP },
+		</if>
+				<if test="recipient!=null">
+		recipient_=#{recipient,jdbcType=VARCHAR},
+		</if>
+				<if test="recipientTelephone!=null">
+		recipient_telephone=#{recipientTelephone,jdbcType=VARCHAR},
+		</if>
+				<if test="recipientEntity!=null">
+		recipient_entity=#{recipientEntity,jdbcType=VARCHAR},
+		</if>
+				<if test="recipientAddress!=null">
+		recipient_address=#{recipientAddress,jdbcType=VARCHAR},
+		</if>
+				<if test="status!=null">
+		status_=#{status,jdbcType= NUMERIC },
+		</if>
+				<if test="goodsValue!=null">
+		goods_value=#{goodsValue,jdbcType= NUMERIC },
+		</if>
+				<if test="delFlag!=null">
+		del_flag=#{delFlag,jdbcType= NUMERIC },
+		</if>
+				<if test="createTime!=null">
+		create_time=#{createTime,jdbcType= TIMESTAMP },
+		</if>
+				<if test="createBy!=null">
+		create_by=#{createBy,jdbcType=VARCHAR},
+		</if>
+				<if test="updateTime!=null">
+		update_time=#{updateTime,jdbcType= TIMESTAMP },
+		</if>
+				<if test="updateBy!=null">
+		update_by=#{updateBy,jdbcType=VARCHAR},
+		</if>
+		</set>
+	where id_=#{id}
+	</update>
+	<select id="get" parameterType="string" resultMap="InvoiceMap">
+		select 
+id_,shipment_,recipient_,recipient_telephone,recipient_entity,recipient_address,goods_value,status_,del_flag,create_time,create_by,update_time,update_by		from base_invoice where id_=#{0}
+	</select>
+	<select id="exist" parameterType="string" resultType="int">
+		select count(*) from base_invoice where id_=#{0}
+	</select>
+	<select id="list" resultMap="InvoiceMap">
+		select * from base_invoice
+	</select>
+	<select id="search" parameterType="hashmap" resultMap="InvoiceMap">
+		<![CDATA[
+			select * from base_invoice
+		]]>
+		<where>
+			del_flag = 0
+			<if test="searchParams.shipment != null">
+				and shipment_ = #{searchParams.shipment}
+			</if>
+			<if test="searchParams.recipient != null">
+				and recipient_ like #{searchParams.recipient}
+			</if>
+			<if test="searchParams.recipientTelephone != null">
+				and recipient_telephone like #{searchParams.recipientTelephone}
+			</if>
+			<if test="searchParams.recipientEntity != null">
+				and recipient_entity like #{searchParams.recipientEntity}
+			</if>
+			<if test="searchParams.recipientAddress != null">
+				and recipient_address like #{searchParams.recipientAddress}
+			</if>
+			<if test="searchParams.status != null">
+				and status_ = #{searchParams.status}
+			</if>
+		</where>
+		<foreach item="sort" collection="sortList"  open="order by" separator=",">
+	        ${sort.name} ${sort.order}
+	 	</foreach>
+	</select>
+</mapper>

+ 126 - 0
common/src/main/resources/mapper/base/InvoiceInfo.xml

@@ -0,0 +1,126 @@
+<?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">
+<!-- namespace必须指向DAO接口 -->
+<mapper namespace="com.jpsoft.prices.modules.base.dao.InvoiceInfoDAO">
+	<resultMap id="InvoiceInfoMap" type="com.jpsoft.prices.modules.base.entity.InvoiceInfo">
+		<id property="id" column="id_" />
+			<result property="invoiceId" column="invoice_id" />
+			<result property="orderNumber" column="order_number" />
+			<result property="name" column="name_" />
+			<result property="barCode" column="bar_code" />
+			<result property="boxLength" column="box_length" />
+			<result property="boxWidth" column="box_width" />
+			<result property="boxHight" column="box_hight" />
+			<result property="netWeight" column="net_weight" />
+			<result property="grossWeight" column="gross_weight" />
+			<result property="delFlag" column="del_flag" />
+			<result property="createTime" column="create_time" />
+			<result property="createBy" column="create_by" />
+			<result property="updateTime" column="update_time" />
+			<result property="updateBy" column="update_by" />
+			</resultMap>
+	<insert id="insert" parameterType="com.jpsoft.prices.modules.base.entity.InvoiceInfo">
+	<!--
+	<selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
+		select sys_guid() from dual
+	</selectKey>
+	-->
+	<![CDATA[
+		insert into base_invoice_info
+	    (id_,invoice_id,order_number,name_,bar_code,box_length,box_width,box_hight,net_weight,gross_weight,del_flag,create_time,create_by,update_time,update_by)
+		values
+		(
+#{id,jdbcType=VARCHAR}
+,#{invoiceId,jdbcType=VARCHAR}
+,#{orderNumber,jdbcType=VARCHAR}
+,#{name,jdbcType=VARCHAR}
+,#{barCode,jdbcType=VARCHAR}
+,#{boxLength,jdbcType= NUMERIC }
+,#{boxWidth,jdbcType= NUMERIC }
+,#{boxHight,jdbcType= NUMERIC }
+,#{netWeight,jdbcType= NUMERIC }
+,#{grossWeight,jdbcType= NUMERIC }
+,#{delFlag,jdbcType= NUMERIC }
+,#{createTime,jdbcType= TIMESTAMP }
+,#{createBy,jdbcType=VARCHAR}
+,#{updateTime,jdbcType= TIMESTAMP }
+,#{updateBy,jdbcType=VARCHAR}
+		)
+	]]>
+	</insert>
+	<delete id="delete" parameterType="string">
+		delete from base_invoice_info where id_=#{id,jdbcType=VARCHAR}
+	</delete>
+	<update id="update" parameterType="com.jpsoft.prices.modules.base.entity.InvoiceInfo">
+		update base_invoice_info
+		<set>
+				<if test="invoiceId!=null">
+		invoice_id=#{invoiceId,jdbcType=VARCHAR},
+		</if>
+				<if test="orderNumber!=null">
+		order_number=#{orderNumber,jdbcType=VARCHAR},
+		</if>
+				<if test="name!=null">
+		name_=#{name,jdbcType=VARCHAR},
+		</if>
+				<if test="barCode!=null">
+		bar_code=#{barCode,jdbcType=VARCHAR},
+		</if>
+				<if test="boxLength!=null">
+		box_length=#{boxLength,jdbcType= NUMERIC },
+		</if>
+				<if test="boxWidth!=null">
+		box_width=#{boxWidth,jdbcType= NUMERIC },
+		</if>
+				<if test="boxHight!=null">
+		box_hight=#{boxHight,jdbcType= NUMERIC },
+		</if>
+				<if test="netWeight!=null">
+		net_weight=#{netWeight,jdbcType= NUMERIC },
+		</if>
+				<if test="grossWeight!=null">
+		gross_weight=#{grossWeight,jdbcType= NUMERIC },
+		</if>
+				<if test="delFlag!=null">
+		del_flag=#{delFlag,jdbcType= NUMERIC },
+		</if>
+				<if test="createTime!=null">
+		create_time=#{createTime,jdbcType= TIMESTAMP },
+		</if>
+				<if test="createBy!=null">
+		create_by=#{createBy,jdbcType=VARCHAR},
+		</if>
+				<if test="updateTime!=null">
+		update_time=#{updateTime,jdbcType= TIMESTAMP },
+		</if>
+				<if test="updateBy!=null">
+		update_by=#{updateBy,jdbcType=VARCHAR},
+		</if>
+		</set>
+	where id_=#{id}
+	</update>
+	<select id="get" parameterType="string" resultMap="InvoiceInfoMap">
+		select 
+id_,invoice_id,order_number,name_,bar_code,box_length,box_width,box_hight,net_weight,gross_weight,del_flag,create_time,create_by,update_time,update_by		from base_invoice_info where id_=#{0}
+	</select>
+	<select id="exist" parameterType="string" resultType="int">
+		select count(*) from base_invoice_info where id_=#{0}
+	</select>
+	<select id="list" resultMap="InvoiceInfoMap">
+		select * from base_invoice_info
+	</select>
+	<select id="search" parameterType="hashmap" resultMap="InvoiceInfoMap">
+		<![CDATA[
+			select * from base_invoice_info
+		]]>
+		<where>
+			<if test="searchParams.id != null">
+				and ID_ like #{searchParams.id}
+			</if>
+		</where>
+		<foreach item="sort" collection="sortList"  open="order by" separator=",">
+	        ${sort.name} ${sort.order}
+	 	</foreach>
+	</select>
+</mapper>

+ 237 - 0
web/src/main/java/com/jpsoft/prices/modules/base/controller/InvoiceController.java

@@ -0,0 +1,237 @@
+package com.jpsoft.prices.modules.base.controller;
+
+import com.github.pagehelper.Page;
+import com.jpsoft.prices.modules.common.utils.PojoUtils;
+import com.jpsoft.prices.modules.common.dto.Sort;
+import com.jpsoft.prices.modules.common.dto.MessageResult;
+import com.jpsoft.prices.modules.base.entity.Invoice;
+import com.jpsoft.prices.modules.base.service.InvoiceService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+@RestController
+@RequestMapping("/base/invoice")
+@Api(description = "invoice")
+public class InvoiceController {
+    private Logger logger = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private InvoiceService invoiceService;
+
+    @ApiOperation(value="创建空记录")
+    @GetMapping("create")
+    public MessageResult<Invoice> create(){
+        MessageResult<Invoice> msgResult = new MessageResult<>();
+
+        Invoice invoice = new Invoice();
+
+        msgResult.setData(invoice);
+        msgResult.setResult(true);
+
+        return msgResult;
+    }
+    
+    @ApiOperation(value="添加信息")
+    @PostMapping("add")
+    public MessageResult<Invoice> add(@RequestBody Invoice invoice,@RequestAttribute String subject){
+        MessageResult<Invoice> msgResult = new MessageResult<>();
+
+        try {
+            invoice.setId(UUID.randomUUID().toString());
+            invoice.setStatus(false);
+            invoice.setDelFlag(false);
+            invoice.setCreateBy(subject);
+            invoice.setCreateTime(new Date());
+            
+            int affectCount = invoiceService.insert(invoice);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(invoice);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库添加失败");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="获取信息")
+    @GetMapping("edit/{id}")
+    public MessageResult<Invoice> edit(@PathVariable("id") String id){
+        MessageResult<Invoice> msgResult = new MessageResult<>();
+
+        try {
+            Invoice invoice = invoiceService.get(id);
+
+            if (invoice != null) {
+                msgResult.setResult(true);
+                msgResult.setData(invoice);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库不存在该记录!");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="更新用户")
+    @PostMapping("update")
+    public MessageResult<Invoice> update(@RequestBody Invoice invoice,@RequestAttribute String subject){
+        MessageResult<Invoice> msgResult = new MessageResult<>();
+
+        try {
+            invoice.setUpdateBy(subject);
+            invoice.setUpdateTime(new Date());
+            
+            int affectCount = invoiceService.update(invoice);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(invoice);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库更新失败");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+	@ApiOperation(value="删除")
+    @PostMapping("delete/{id}")
+    public MessageResult<Integer> delete(@PathVariable("id") String id,@RequestAttribute String subject){
+        MessageResult<Integer> msgResult = new MessageResult<>();
+
+        try {
+            Invoice invoice = invoiceService.get(id);
+            invoice.setDelFlag(true);
+            invoice.setUpdateBy(subject);
+            invoice.setUpdateTime(new Date());
+
+            int affectCount = invoiceService.update(invoice);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(affectCount);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("删除失败");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+
+    @ApiOperation(value="批量删除")
+    @PostMapping("batchDelete")
+    public MessageResult<Integer> batchDelete(@RequestBody List<String> idList,@RequestAttribute String subject){
+        MessageResult<Integer> msgResult = new MessageResult<>();
+
+        try {
+            int affectCount = 0;
+
+            for (String id : idList) {
+                Invoice invoice = invoiceService.get(id);
+                invoice.setDelFlag(true);
+                invoice.setUpdateBy(subject);
+                invoice.setUpdateTime(new Date());
+
+                affectCount += invoiceService.update(invoice);
+            }
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(affectCount);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("删除失败");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="列表")
+    @RequestMapping(value = "pageList",method = RequestMethod.POST)
+    public MessageResult<Map> pageList(
+            String shipment, String recipient, String recipientTelephone, String recipientEntity, String recipientAddress, Boolean status,
+            @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
+            @RequestParam(value="pageSize",defaultValue="20") int pageSize,
+            @RequestAttribute String subject){
+        MessageResult<Map> msgResult = new MessageResult<>();
+
+        Map<String,Object> searchParams = new HashMap<>();
+        if (StringUtils.isNotEmpty(shipment) && !"null".equals(shipment)) {
+            searchParams.put("shipment",shipment);
+        }
+        if (StringUtils.isNotEmpty(recipient)) {
+            searchParams.put("recipient","%" + recipient + "%");
+        }
+        if (StringUtils.isNotEmpty(recipientTelephone)) {
+            searchParams.put("recipientTelephone","%" + recipientTelephone + "%");
+        }
+        if (StringUtils.isNotEmpty(recipientEntity)) {
+            searchParams.put("recipientEntity","%" + recipientEntity + "%");
+        }
+        if (StringUtils.isNotEmpty(recipientAddress)) {
+            searchParams.put("recipientAddress","%" + recipientAddress + "%");
+        }
+        if (status != null) {
+            searchParams.put("status",status);
+        }
+
+        List<Sort> sortList = new ArrayList<>();
+        sortList.add(new Sort("status_","asc"));
+        sortList.add(new Sort("shipment_","asc"));
+
+        Page<Invoice> page = invoiceService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
+
+        msgResult.setResult(true);
+        msgResult.setData(PojoUtils.pageWrapper(page));
+
+        return msgResult;
+    }
+}

+ 171 - 0
web/src/main/java/com/jpsoft/prices/modules/base/controller/InvoiceInfoController.java

@@ -0,0 +1,171 @@
+package com.jpsoft.prices.modules.base.controller;
+
+import com.github.pagehelper.Page;
+import com.jpsoft.prices.modules.common.utils.PojoUtils;
+import com.jpsoft.prices.modules.common.dto.Sort;
+import com.jpsoft.prices.modules.common.dto.MessageResult;
+import com.jpsoft.prices.modules.base.entity.InvoiceInfo;
+import com.jpsoft.prices.modules.base.service.InvoiceInfoService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+@RestController
+@RequestMapping("/base/invoiceInfo")
+@Api(description = "invoiceInfo")
+public class InvoiceInfoController {
+    private Logger logger = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private InvoiceInfoService invoiceInfoService;
+    
+    @ApiOperation(value="添加信息")
+    @PostMapping("add")
+    public MessageResult<InvoiceInfo> add(@RequestBody InvoiceInfo invoiceInfo,@RequestAttribute String subject){
+        MessageResult<InvoiceInfo> msgResult = new MessageResult<>();
+
+        try {
+            invoiceInfo.setId(UUID.randomUUID().toString());
+            invoiceInfo.setDelFlag(false);
+            invoiceInfo.setCreateBy(subject);
+            invoiceInfo.setCreateTime(new Date());
+            
+            int affectCount = invoiceInfoService.insert(invoiceInfo);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(invoiceInfo);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库添加失败");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="获取信息")
+    @GetMapping("edit/{id}")
+    public MessageResult<InvoiceInfo> edit(@PathVariable("id") String id){
+        MessageResult<InvoiceInfo> msgResult = new MessageResult<>();
+
+        try {
+            InvoiceInfo invoiceInfo = invoiceInfoService.get(id);
+
+            if (invoiceInfo != null) {
+                msgResult.setResult(true);
+                msgResult.setData(invoiceInfo);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库不存在该记录!");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="更新用户")
+    @PostMapping("update")
+    public MessageResult<InvoiceInfo> update(@RequestBody InvoiceInfo invoiceInfo,@RequestAttribute String subject){
+        MessageResult<InvoiceInfo> msgResult = new MessageResult<>();
+
+        try {
+            invoiceInfo.setUpdateBy(subject);
+            invoiceInfo.setUpdateTime(new Date());
+            
+            int affectCount = invoiceInfoService.update(invoiceInfo);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(invoiceInfo);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库更新失败");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+	@ApiOperation(value="删除")
+    @PostMapping("delete/{id}")
+    public MessageResult<Integer> delete(@PathVariable("id") String id,@RequestAttribute String subject){
+        MessageResult<Integer> msgResult = new MessageResult<>();
+
+        try {
+            InvoiceInfo invoiceInfo = invoiceInfoService.get(id);
+            invoiceInfo.setDelFlag(true);
+            invoiceInfo.setUpdateBy(subject);
+            invoiceInfo.setUpdateTime(new Date());
+
+            int affectCount = invoiceInfoService.update(invoiceInfo);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(affectCount);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("删除失败");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="列表")
+    @RequestMapping(value = "pageList",method = RequestMethod.POST)
+    public MessageResult<Map> pageList(
+            String id,
+            @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
+            @RequestParam(value="pageSize",defaultValue="20") int pageSize){
+        MessageResult<Map> msgResult = new MessageResult<>();
+
+        Map<String,Object> searchParams = new HashMap<>();
+
+        List<Sort> sortList = new ArrayList<>();
+        sortList.add(new Sort("id_","asc"));
+
+        if (StringUtils.isNotEmpty(id)) {
+            searchParams.put("id","%" + id + "%");
+        }
+
+        Page<InvoiceInfo> page = invoiceInfoService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
+
+        msgResult.setResult(true);
+        msgResult.setData(PojoUtils.pageWrapper(page));
+
+        return msgResult;
+    }
+}

+ 1 - 1
web/src/main/resources/application-dev.yml

@@ -5,7 +5,7 @@ server:
 
 spring:
   datasource:
-    url: jdbc:log4jdbc:mysql://192.168.77.122:3306/feilihua_prices?autoReconnect=true&characterEncoding=utf8&serverTimezone=GMT%2B8
+    url: jdbc:log4jdbc:mysql://192.168.77.122:3306/feilihua_prices?useSSL=false&autoReconnect=true&characterEncoding=utf8&serverTimezone=GMT%2B8
     username: root
     password: 123456