Browse Source

Merge remote-tracking branch 'origin/master'

zhengqiang 4 years ago
parent
commit
46552f2487

+ 8 - 0
common/src/main/java/com/jpsoft/bus/modules/base/entity/PaymentInfo.java

@@ -53,4 +53,12 @@ public class PaymentInfo {
     private Date updateTime;
     @ApiModelProperty(value = "是否删除")
     private Boolean delFlag;
+
+    @ApiModelProperty(value = "是否开启微信支付")
+    private Boolean isOpenWechat;
+    @ApiModelProperty(value = "是否开启支付宝支付")
+    private Boolean isOpenAlipay;
+
+    @ApiModelProperty(value = "对应公司")
+    private String companyName;
 }

+ 9 - 0
common/src/main/java/com/jpsoft/bus/modules/bus/entity/DriverRecordInfo.java

@@ -49,4 +49,13 @@ public class DriverRecordInfo {
     @ApiModelProperty(value = "是否删除")
     private Boolean delFlag = false;
 
+    @ApiModelProperty(value = "司机姓名")
+    private String driverName;
+
+    @ApiModelProperty(value = "考勤定位")
+    private String location;
+
+
+
+
 }

+ 17 - 3
common/src/main/resources/mapper/base/PaymentInfo.xml

@@ -20,6 +20,8 @@
 			<result property="updateBy" column="update_by" />
 			<result property="updateTime" column="update_time" />
 			<result property="delFlag" column="del_flag" />
+			<result property="isOpenWechat" column="is_open_wechat" />
+			<result property="isOpenAlipay" column="is_open_alipay" />
 			</resultMap>
 	<insert id="insert" parameterType="com.jpsoft.bus.modules.base.entity.PaymentInfo">
 	<!--
@@ -29,7 +31,7 @@
 	-->
 	<![CDATA[
 		insert into base_payment_info
-	    (id_,company_id,name_,wechat_notify_url,alipay_notify_url,app_id,sub_app_secret,mch_id,sub_app_id,sub_mch_id,app_auth_token,create_by,create_time,update_by,update_time,del_flag)
+	    (id_,company_id,name_,wechat_notify_url,alipay_notify_url,app_id,sub_app_secret,mch_id,sub_app_id,sub_mch_id,app_auth_token,create_by,create_time,update_by,update_time,del_flag,is_open_wechat,is_open_alipay)
 		values
 		(
 #{id,jdbcType=VARCHAR}
@@ -48,6 +50,8 @@
 ,#{updateBy,jdbcType=VARCHAR}
 ,#{updateTime,jdbcType= TIMESTAMP }
 ,#{delFlag,jdbcType= NUMERIC }
+,#{isOpenWechat,jdbcType= NUMERIC }
+,#{isOpenAlipay,jdbcType= NUMERIC }
 		)
 	]]>
 	</insert>
@@ -102,6 +106,12 @@
 				<if test="delFlag!=null">
 		del_flag=#{delFlag,jdbcType= NUMERIC },
 		</if>
+			<if test="isOpenWechat!=null">
+				is_open_wechat=#{isOpenWechat,jdbcType= NUMERIC },
+			</if>
+			<if test="isOpenAlipay!=null">
+				is_open_alipay=#{isOpenAlipay,jdbcType= NUMERIC },
+			</if>
 		</set>
 	where id_=#{id}
 	</update>
@@ -119,8 +129,12 @@
 			select * from base_payment_info
 		]]>
 		<where>
-			<if test="searchParams.id != null">
-				and ID_ like #{searchParams.id}
+			del_flag = false
+			<if test="searchParams.name != null">
+				and name_ like #{searchParams.name}
+			</if>
+			<if test="searchParams.companyId != null">
+				and company_id = #{searchParams.companyId}
 			</if>
 		</where>
 		<foreach item="sort" collection="sortList"  open="order by" separator=",">

+ 17 - 4
common/src/main/resources/mapper/bus/DriverRecordInfo.xml

@@ -101,12 +101,25 @@
 	</select>
     <select id="search" parameterType="hashmap" resultMap="DriverRecordInfoMap">
         <![CDATA[
-			select * from bus_driver_record_info
+			select * from bus_driver_record_info a inner join bus_driver_info b on a.driver_id = b.id_
 		]]>
         <where>
-            del_flag = false
-            <if test="searchParams.id != null">
-                and id_ = #{searchParams.id}
+            a.del_flag = false and b.del_flag=false
+            <if test="searchParams.name != null">
+                and b.name_ like #{searchParams.name}
+            </if>
+            <if test="searchParams.licensePlateNumber != null">
+                and a.license_plate_number like #{searchParams.licensePlateNumber}
+            </if>
+            <if test="searchParams.beginTime != null">
+                <![CDATA[
+                  and a.record_time >= #{searchParams.beginTime}
+            ]]>
+            </if>
+            <if test="searchParams.endTime != null">
+                <![CDATA[
+                  and a.record_time <= #{searchParams.endTime}
+            ]]>
             </if>
         </where>
         <foreach item="sort" collection="sortList"  open="order by" separator=",">

+ 59 - 4
web/src/main/java/com/jpsoft/bus/modules/base/controller/PaymentInfoController.java

@@ -1,6 +1,8 @@
 package com.jpsoft.bus.modules.base.controller;
 
 import com.github.pagehelper.Page;
+import com.jpsoft.bus.modules.bus.entity.CompanyInfo;
+import com.jpsoft.bus.modules.bus.service.CompanyInfoService;
 import com.jpsoft.bus.modules.common.dto.MessageResult;
 import com.jpsoft.bus.modules.common.dto.Sort;
 import com.jpsoft.bus.modules.base.entity.PaymentInfo;
@@ -27,6 +29,9 @@ public class PaymentInfoController {
     @Autowired
     private PaymentInfoService paymentInfoService;
 
+    @Autowired
+    private CompanyInfoService companyInfoService;
+
     @ApiOperation(value="创建空记录")
     @GetMapping("create")
     public MessageResult<PaymentInfo> create(){
@@ -196,7 +201,7 @@ public class PaymentInfoController {
     @ApiOperation(value="列表")
     @RequestMapping(value = "pageList",method = RequestMethod.POST)
     public MessageResult<Map> pageList(
-            String id,
+            String companyId,String name,
             @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
             @RequestParam(value="pageSize",defaultValue="20") int pageSize,
             @RequestAttribute String subject){
@@ -209,17 +214,67 @@ public class PaymentInfoController {
         Map<String,Object> searchParams = new HashMap<>();
 
         List<Sort> sortList = new ArrayList<>();
-        sortList.add(new Sort("id_","asc"));
+        sortList.add(new Sort("create_time","desc"));
+
+        if (StringUtils.isNotEmpty(companyId)) {
+            searchParams.put("companyId",companyId);
+        }
 
-        if (StringUtils.isNotEmpty(id)) {
-            searchParams.put("id","%" + id + "%");
+        if (StringUtils.isNotEmpty(name)) {
+            searchParams.put("name","%"+name+"%");
         }
 
         Page<PaymentInfo> page = paymentInfoService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
 
+        for (PaymentInfo paymentInfo:page) {
+            CompanyInfo companyInfo = companyInfoService.get(paymentInfo.getCompanyId());
+            if(companyInfo!=null){
+                paymentInfo.setCompanyName(companyInfo.getName());
+            }
+        }
+
         msgResult.setResult(true);
         msgResult.setData(PojoUtils.pageWrapper(page));
 
         return msgResult;
     }
+
+    @ApiOperation(value="修改是否支持微信支付宝支付")
+    @PostMapping("updateWechatPayOrAliPay")
+    public MessageResult<Integer> updateWechatPayOrAliPay(String id,Boolean wechatPay,Boolean aliPay, @RequestAttribute String subject) {
+        MessageResult<Integer> msgResult = new MessageResult<>();
+
+        try {
+            PaymentInfo paymentInfo = paymentInfoService.get(id);
+
+            if(paymentInfo!=null){
+                if(wechatPay!=null) {
+                    paymentInfo.setIsOpenWechat(wechatPay);
+                }
+                if(aliPay!=null) {
+                    paymentInfo.setIsOpenAlipay(aliPay);
+                }
+
+                paymentInfo.setUpdateBy(subject);
+                paymentInfo.setUpdateTime(new Date());
+
+                int count = paymentInfoService.update(paymentInfo);
+
+                msgResult.setResult(true);
+                msgResult.setData(count);
+            }
+            else{
+                msgResult.setResult(false);
+                msgResult.setMessage("更新失败");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
 }

+ 98 - 0
web/src/main/java/com/jpsoft/bus/modules/bus/controller/DriverRecordInfoController.java

@@ -0,0 +1,98 @@
+package com.jpsoft.bus.modules.bus.controller;
+
+import com.github.pagehelper.Page;
+import com.jpsoft.bus.modules.bus.entity.DriverInfo;
+import com.jpsoft.bus.modules.bus.entity.DriverRecordInfo;
+import com.jpsoft.bus.modules.bus.service.DriverInfoService;
+import com.jpsoft.bus.modules.bus.service.DriverRecordInfoService;
+import com.jpsoft.bus.modules.common.dto.MessageResult;
+import com.jpsoft.bus.modules.common.dto.Sort;
+import com.jpsoft.bus.modules.common.utils.PojoUtils;
+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 java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@RestController
+@RequestMapping("/bus/driverRecordInfo")
+@Api(description = "driverRecordInfo")
+public class DriverRecordInfoController {
+    private Logger logger = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private DriverInfoService driverInfoService;
+
+    @Autowired
+    private DriverRecordInfoService driverRecordInfoService;
+
+    @ApiOperation(value="列表")
+    @RequestMapping(value = "pageList",method = RequestMethod.POST)
+    public MessageResult<Map> pageList(
+            String name,String licensePlateNumber,String recordTimeRanges,
+            @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
+            @RequestParam(value="pageSize",defaultValue="20") int pageSize,
+            @RequestAttribute String subject){
+
+        //当前用户ID
+        System.out.println(subject);
+
+        MessageResult<Map> msgResult = new MessageResult<>();
+
+        Map<String,Object> searchParams = new HashMap<>();
+
+        List<Sort> sortList = new ArrayList<>();
+        sortList.add(new Sort("a.create_time","desc"));
+
+        if (StringUtils.isNotEmpty(name)) {
+            searchParams.put("name", name);
+        }
+
+        if (StringUtils.isNotEmpty(licensePlateNumber)) {
+            searchParams.put("licensePlateNumber","%" + licensePlateNumber + "%");
+        }
+
+        if(StringUtils.isNotEmpty(recordTimeRanges)){
+            String[] timeRangeArray = recordTimeRanges.split(",");
+            String beginTime = "";
+            String endTime = "";
+            if (timeRangeArray.length == 1) {
+                beginTime = timeRangeArray[0];
+                beginTime+=" 00:00:00";
+            } else if (timeRangeArray.length == 2) {
+                beginTime = timeRangeArray[0];
+                endTime = timeRangeArray[1];
+                beginTime+=" 00:00:00";
+                endTime+=" 23:59:59";
+            }
+
+            searchParams.put("beginTime", beginTime);
+            searchParams.put("endTime", endTime);
+        }
+
+
+        Page<DriverRecordInfo> page = driverRecordInfoService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
+
+        for (DriverRecordInfo driverRecordInfo:page) {
+            DriverInfo driverInfo = driverInfoService.get(driverRecordInfo.getDriverId().toString());
+            if(driverInfo!=null){
+                driverRecordInfo.setDriverName(driverInfo.getName());
+            }
+            if(StringUtils.isNoneEmpty(driverRecordInfo.getLongitude())&&StringUtils.isNoneEmpty(driverRecordInfo.getLatitude())){
+                driverRecordInfo.setLocation(driverRecordInfo.getLongitude()+","+driverRecordInfo.getLatitude());
+            }
+        }
+
+        msgResult.setResult(true);
+        msgResult.setData(PojoUtils.pageWrapper(page));
+
+        return msgResult;
+    }
+}