Browse Source

统计修改外出打卡,签单时增加状态

anderx 4 years ago
parent
commit
8279ca2178

+ 5 - 0
src/main/java/com/goafanti/common/dao/PublicReleaseMapper.java

@@ -1,7 +1,10 @@
 package com.goafanti.common.dao;
 
+import java.util.Calendar;
 import java.util.Date;
+import java.util.List;
 
+import com.goafanti.common.model.outUserFollowCount;
 import org.apache.ibatis.annotations.Param;
 
 import com.goafanti.common.model.PublicRelease;
@@ -27,4 +30,6 @@ public interface PublicReleaseMapper {
 	int checkTime(@Param("aid")String aid,@Param("start")Date start, @Param("end")Date end);
 
     void updateSignByAidAndUid(@Param("uid") String buyerId, @Param("aid") String salesmanId);
+
+    List<outUserFollowCount> getTimeUserFollow(@Param("date")Date date, @Param("now")Date now);
 }

+ 4 - 0
src/main/java/com/goafanti/common/dao/TOrderNewMapper.java

@@ -7,6 +7,8 @@ import com.goafanti.order.bo.OrderRefundDetailBo;
 import com.goafanti.order.bo.TOrderNewBo;
 import org.apache.ibatis.annotations.Param;
 
+import java.math.BigDecimal;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
@@ -38,4 +40,6 @@ public interface TOrderNewMapper {
     int updateSalesmanId(@Param("aid")String aid, @Param("transferId")String transferId);
     List<TOrderNewBo> selectUsedOrderByOrder(String orderNo);
     void updaterefund(TOrderNew o);
+
+    List<BigDecimal> selectByUidAndNewUser(@Param("uid")String uid, @Param("newUser")Integer newUser, @Param("date") Date date, @Param("now")Date now);
 }

+ 5 - 0
src/main/java/com/goafanti/common/mapper/PublicReleaseMapper.xml

@@ -616,5 +616,10 @@ a.annex_url annexUrl ,a.remarks,a.duration ,a.valid_date validDate ,a.latitude ,
   or  (release_start &lt; #{start} and release_end &gt; #{start})
   or  (release_start &lt; #{end} and release_end &gt; #{end}))
   </select>
+    <select id="getTimeUserFollow" resultType="com.goafanti.common.model.outUserFollowCount">
+      select e.id province,uid,new_user newUser from public_release a left join admin c on a.aid=c.id
+          left join department d on c.department_id =d.id left join district_glossory e on d.province =e.id
+      where a.main_status =1 and a.create_time between #{date} and #{now} group by aid,uid,new_user
+    </select>
 
 </mapper>

+ 6 - 0
src/main/java/com/goafanti/common/mapper/TOrderNewMapper.xml

@@ -1397,4 +1397,10 @@
       and a.start_time between #{tStarTime,jdbcType=VARCHAR} and #{tEndTime,jdbcType=VARCHAR}
     </if>
   </select>
+  <select id="selectByUidAndNewUser" resultType="java.math.BigDecimal">
+    select total_amount from t_order_new
+    where process_status >4 and  buyer_id = #{uid}
+    and new_user = #{newUser}
+    and create_time  between #{date} and #{now}
+  </select>
 </mapper>

+ 53 - 0
src/main/java/com/goafanti/common/model/outUserFollowCount.java

@@ -0,0 +1,53 @@
+package com.goafanti.common.model;
+
+import java.math.BigDecimal;
+
+public class outUserFollowCount {
+
+    private String uid;
+    private Integer province;
+    private Integer newUser;
+    private Integer quantity;
+    private BigDecimal total;
+
+    public String getUid() {
+        return uid;
+    }
+
+    public void setUid(String uid) {
+        this.uid = uid;
+    }
+
+    public Integer getProvince() {
+        return province;
+    }
+
+    public void setProvince(Integer province) {
+        this.province = province;
+    }
+
+    public Integer getNewUser() {
+        return newUser;
+    }
+
+    public void setNewUser(Integer newUser) {
+        this.newUser = newUser;
+    }
+
+    public Integer getQuantity() {
+        return quantity;
+    }
+
+    public void setQuantity(Integer quantity) {
+        this.quantity = quantity;
+    }
+
+    public BigDecimal getTotal() {
+        return total;
+    }
+
+    public void setTotal(BigDecimal total) {
+        this.total = total;
+    }
+
+}

+ 3 - 4
src/main/java/com/goafanti/common/task/ReleaseUserTask.java

@@ -1,9 +1,6 @@
 package com.goafanti.common.task;
 
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.UUID;
+import java.util.*;
 
 import javax.annotation.Resource;
 
@@ -60,11 +57,13 @@ public class ReleaseUserTask {
 			pushUserDays();
 			Thread.sleep(2000);
 			updateUser();
+			Thread.sleep(2000);
 		} catch (InterruptedException e) {
 			e.printStackTrace();
 		}
 
 	}
+
 	@ResponseBody
 	@RequestMapping(value = "/open/remindUser", method = RequestMethod.GET)
 	private void pushUserDays() throws InterruptedException {

+ 63 - 0
src/main/java/com/goafanti/common/task/UserFollowTask.java

@@ -0,0 +1,63 @@
+package com.goafanti.common.task;
+
+import com.goafanti.common.dao.PublicReleaseMapper;
+import com.goafanti.common.dao.TOrderNewMapper;
+import com.goafanti.common.model.outUserFollowCount;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+import java.math.BigDecimal;
+import java.util.Calendar;
+import java.util.List;
+
+@Component
+public class UserFollowTask {
+
+    @Autowired
+    private PublicReleaseMapper publicReleaseMapper;
+    @Autowired
+    private TOrderNewMapper tOrderNewMapper;
+
+    /**
+     * 	每月1号凌晨5点轮询统计
+     *
+     */
+
+    @Scheduled(cron = "0 0 5 1 * ?")
+    @RequestMapping(value = "/open/pushOrderArrearsDun", method = RequestMethod.GET)
+    public void 	userFollowStatistics(){
+        //获取上月1号到本月1号的外出
+        Calendar now=getNowDate();
+        Calendar date=getNowDate();
+        date.set(Calendar.MONTH,now.get(Calendar.MONTH)-1);
+        List<outUserFollowCount> list =publicReleaseMapper.getTimeUserFollow(date.getTime(),now.getTime());
+        for (outUserFollowCount out : list) {
+            List<BigDecimal> aList=tOrderNewMapper.selectByUidAndNewUser(out.getUid(),out.getNewUser(),date.getTime(),now.getTime());
+            if (aList.isEmpty()){
+                out.setQuantity(0);
+                out.setTotal(new BigDecimal(0));
+            }else{
+                out.setQuantity(aList.size());
+                BigDecimal total=new BigDecimal(0);
+                for (BigDecimal bigDecimal : aList) {
+                    total=total.add(bigDecimal);
+                }
+                out.setTotal(total);
+            }
+        }
+
+    }
+
+    public Calendar getNowDate(){
+        Calendar now=Calendar.getInstance();
+        now.set(Calendar.HOUR_OF_DAY, 0);
+        now.clear(Calendar.MINUTE);
+        now.clear(Calendar.SECOND);
+        return now;
+    }
+
+    public static void main(String[] args) {}
+}

+ 1 - 1
src/main/java/com/goafanti/order/controller/AdminNewOrderApiController.java

@@ -40,7 +40,7 @@ public class AdminNewOrderApiController extends CertifyApiController {
 	@Value(value = "${upload.path}")
 	private String	uploadPath			= null;
 	/**
-	 * 创建订单
+	 * 创建订单、开单
 	 * @param uid
 	 * @param orderType
 	 * @return

+ 1 - 33
src/main/java/com/goafanti/order/controller/AdminOrderApiController.java

@@ -356,39 +356,7 @@ public class AdminOrderApiController extends CertifyApiController {
 		return res;
 	}
 	
-	/**
-	 * 创建订单
-	 * @param uid
-	 * @param orderType
-	 * @return
-	 */
-	@RequestMapping(value = "/createOrder",method = RequestMethod.POST)
-	public Result createOrder(String uid,Integer orderType,String contractType){
-		Result res = new Result();
-		if(StringUtils.isBlank(uid)){
-			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"","客户编号"));
-			return res;
-		}
-		/*if(orderServiceImpl.checkCustomerInformation(uid)){
-			res.getError().add(buildError("","请到客户资料-客户资料维护模块完善您的客户信息!"));
-			return res;
-		}*/
-		if(orderType == null){
-			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"","订单类型"));
-			return res;
-		}
-		if(orderType != CommodityType.SERVICE.getTypeCode()){
-			res.getError().add(buildError(ErrorConstants.PARAM_ERROR,"","暂不支持创建该类型订单"));
-			return res;
-		}else {
-			if(StringUtils.isBlank(contractType)) {
-				res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"","业务品类"));
-				return res;
-			}
-		}
-		orderServiceImpl.createServiceOrder(uid,orderType,contractType);
-		return res;
-	}
+
 	
 
 	/** 图片上传 **/

+ 1 - 8
src/main/java/com/goafanti/order/service/OrderService.java

@@ -235,14 +235,7 @@ public interface OrderService {
 	Pagination<OrderListBo> selectApprovalServiceOrder(OrderListBo bo,String startDate,String endDate,
 			String depIds,Integer approvalHistory,Integer pageNo, Integer pageSize);
 
-	/**
-	 * 创建订单
-	 * @param uid
-	 * @param orderType
-	 * @param contractType 合同类型
-	 * @return
-	 */
-	int createServiceOrder(String uid, Integer orderType,String contractType);
+
 
 	/**
 	 * 查询公共订单

+ 6 - 0
src/main/java/com/goafanti/order/service/impl/OrderNewServiceImpl.java

@@ -229,6 +229,12 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		t.setCreateTime(new Date());
 		t.setUpdateTime(new Date());
 		t.setBuyerId(uid);
+		User u=userMapper.selectByPrimaryKey(uid);
+		if(u.getShareType()!=null&&u.getShareType()==2){
+			t.setNewUser(1);
+		}else {
+			t.setNewUser(0);
+		}
 		TOrderExtend te=new TOrderExtend();
 		te.setOrderNo(orderNo);
 		te.setServiceStatus(0);

+ 1 - 26
src/main/java/com/goafanti/order/service/impl/OrderServiceImpl.java

@@ -1323,32 +1323,7 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 				params, pageNo, pageSize);
 	}
 
-	@Override
-	public int createServiceOrder(String uid, Integer orderType,String contractType) {
-		BigDecimal initial = new BigDecimal(0);
-		TOrder tOrder = new TOrder();
-		tOrder.setOrderType(orderType);
-		tOrder.setOrderNo(idGenerator.generateId().toString());	
-		tOrder.setCreater(TokenManager.getAdminId());
-		tOrder.setCreateTime(new Date());
-		tOrder.setBuyerId(uid);
-		tOrder.setSellerId(DEFAULT_PLATFORM_ID);
-		tOrder.setSalesmanId(TokenManager.getAdminId());
-		tOrder.setBrokerageAmount(initial);
-		tOrder.setFirstPayment(initial);
-		tOrder.setOrderAmount(initial);
-		tOrder.setSignBrokerageAmount(initial);
-		tOrder.setSignFirstPayment(initial);
-		tOrder.setSignTotalAmount(initial);
-		tOrder.setSignWithdrawAmount(initial);
-		tOrder.setOrderChannel(OrderChannel.PORTAL.getCode());	
-		tOrder.setDeleteSign(ActiveState.NORMAL.getCode());
-		tOrder.setApproval(ApprovalState.NORMAL.getCode());
-		tOrder.setContractType(contractType);
-		tOrder.setChangeStatus(ChangeState.UNCHANGE.getCode());
-		setOrderState(OrderAction.ADD_INTENTION, new BigDecimal(0), tOrder, false);
-		return tOrderMapper.insert(tOrder);
-	}
+
 
 	@SuppressWarnings("unchecked")
 	@Override