Commit 9c41dbfb by huluobin

update

parent c4c95a1d
......@@ -29,17 +29,23 @@ public class StoreDataServiceImpl extends ServiceImpl<StoreDataMapper, StoreData
Integer technicianId = SessionUtils.getTechnicianId();
GogirlToken gogirlToken = SessionUtils.getTechnicianToken();
StoreData storeData = storeDataMapper.selectOne(new LambdaQueryWrapper<StoreData>().eq(StoreData::getDepartmentId, gogirlToken.getDepartmentId()));
Integer departmentId = SessionUtils.getTechnicianToken().getDepartmentId();
//总订单业绩
List<StoreTradeAmount> storeTradeAmountList = storeDataMapper.storeTradeAmount(month);
List<StoreTradeAmount> storeTradeAmountList = storeDataMapper.storeTradeAmount(month, departmentId);
//总开卡业绩
StoreTradeAmount storeTradeAmount = new StoreTradeAmount();
storeTradeAmount.setAmount(storeDataMapper.chargeAchieve(month));
storeTradeAmount.setAmount(storeDataMapper.chargeAchieve(month, departmentId));
storeTradeAmount.setServeType("开卡");
storeTradeAmountList.add(storeTradeAmount);
//个人业绩
List<StoreTechnicianAchieve> storeTechnicianAchieveList = storeDataMapper.storeTechnicianAchieve(month);
List<StoreTechnicianAchieve> storeTechnicianAchieveList = storeDataMapper.storeTechnicianAchieve(month)
.stream()
.filter(storeTechnicianAchieve -> storeTechnicianAchieve.getDepartmentId().equals(departmentId))
.collect(Collectors.toList());
storeData.setStoreTradeAmountList(storeTradeAmountList);
storeData.setStoreTechnicianAchieveList(storeTechnicianAchieveList);
......
......@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gogirl.domain.store.store.StoreData;
import com.gogirl.domain.store.store.StoreTechnicianAchieve;
import com.gogirl.domain.store.store.StoreTradeAmount;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
......@@ -89,9 +88,9 @@ public interface StoreDataMapper extends BaseMapper<StoreData> {
BigDecimal queryMonthOrderServeAmount(@Param("serveType") Integer serveType, @Param("month") String month);
List<StoreTradeAmount> storeTradeAmount(@Param("month") String month);
List<StoreTradeAmount> storeTradeAmount(@Param("month") String month, @Param("departmentId") Integer departmentId);
List<StoreTechnicianAchieve> storeTechnicianAchieve(String month);
BigDecimal chargeAchieve(String month);
BigDecimal chargeAchieve(@Param("month") String month, @Param("departmentId") Integer departmentId);
}
......@@ -61,7 +61,9 @@
and (t1.`status` = 3 or t1.`status` = 4)
and t1.launch_time > #{month}
GROUP BY t1.id) tt
LEFT JOIN order_manage oo on tt.order_user = oo.order_user and oo.launch_time &gt; DATE_SUB(tt.launch_time, INTERVAL 45 day) and oo.launch_time &lt; tt.launch_time
LEFT JOIN order_manage oo on tt.order_user = oo.order_user and
oo.launch_time &gt; DATE_SUB(tt.launch_time, INTERVAL 45 day) and
oo.launch_time &lt; tt.launch_time
where oo.id is not null
</select>
......@@ -73,7 +75,9 @@
where t1.department_id = #{departmentId}
and (t1.`status` = 3 or t1.`status` = 4)
GROUP BY t1.id) tt
LEFT JOIN order_manage oo on tt.order_user = oo.order_user and oo.launch_time &gt; DATE_SUB(tt.launch_time, INTERVAL 45 day) and oo.launch_time &lt; tt.launch_time
LEFT JOIN order_manage oo on tt.order_user = oo.order_user and
oo.launch_time &gt; DATE_SUB(tt.launch_time, INTERVAL 45 day) and
oo.launch_time &lt; tt.launch_time
where oo.id is not null
</select>
......@@ -88,9 +92,12 @@
<select id="storeTradeAmount" resultType="com.gogirl.domain.store.store.StoreTradeAmount">
SELECT sum(pay_price) as amount, serve_type
from order_serve
where start_time like concat(#{month}, '%')
and serve_type is not null
from order_serve t1
left join order_manage t2 on t1.order_id = t2.id
where t1.start_time like concat(#{month}, '%')
and t1.serve_type is not null
and t2.department_id = #{departmentId}
and (t2.`status` = 3 or t2.`status` = 4)
GROUP BY serve_type
</select>
......@@ -104,16 +111,21 @@
t1.department_id
from (
SELECT a.id,
a.order_amount / (char_length(a.referee_id) - char_length(REPLACE(a.referee_id, ',', '')) + 1) / 100 as achievement,
'开卡' as serve_type,
a.order_amount / (char_length(a.referee_id) - char_length(REPLACE(a.referee_id, ',', '')) + 1) /
100 as achievement,
'开卡' as serve_type,
# substring_index(substring_index(a.referee_id, ',', b.help_topic_id + 1), ',', -1) as technician_id,
t2.id as technician_id,
t2.`name` technician_name,
t2.picture_path technician_picture,
t2.id as technician_id,
t2.`name` technician_name,
t2.picture_path technician_picture,
t2.department_id
FROM customer_balance_record a
JOIN mysql.help_topic AS b ON b.help_topic_id &lt; (char_length(a.referee_id) - char_length(REPLACE(a.referee_id, ',', '')) + 1)
LEFT JOIN store_technician t2 on substring_index(substring_index(a.referee_id, ',', b.help_topic_id + 1), ',', -1) = t2.user_id and t2.`status` = 1
JOIN mysql.help_topic AS b ON b.help_topic_id &lt; (char_length(a.referee_id) -
char_length(REPLACE(a.referee_id, ',', '')) +
1)
LEFT JOIN store_technician t2
on substring_index(substring_index(a.referee_id, ',', b.help_topic_id + 1), ',',
-1) = t2.user_id and t2.`status` = 1
WHERE (a.type = 1 OR a.type = 2)
and t2.`name` is not null
and a.time LIKE concat(#{month}, '%')
......@@ -129,15 +141,21 @@
t1.department_id
FROM (
SELECT a.id,
a.achievement / (char_length(a.technician_id) - char_length(REPLACE(a.technician_id, ',', '')) + 1) as achievement,
a.achievement / (char_length(a.technician_id) - char_length(REPLACE(a.technician_id, ',', '')) +
1) as achievement,
a.serve_type,
substring_index(substring_index(a.technician_id, ',', b.help_topic_id + 1), ',', -1) as technician_id,
t2.`name` technician_name,
t2.picture_path technician_picture,
substring_index(substring_index(a.technician_id, ',', b.help_topic_id + 1), ',',
-1) as technician_id,
t2.`name` technician_name,
t2.picture_path technician_picture,
t2.department_id
FROM order_serve a
JOIN mysql.help_topic AS b ON b.help_topic_id &lt; (char_length(a.technician_id) - char_length(REPLACE(a.technician_id, ',', '')) + 1)
LEFT JOIN store_technician t2 on substring_index(substring_index(a.technician_id, ',', b.help_topic_id + 1), ',', -1) = t2.id and t2.`status` = 1
JOIN mysql.help_topic AS b ON b.help_topic_id &lt; (char_length(a.technician_id) -
char_length(REPLACE(a.technician_id, ',', '')) +
1)
LEFT JOIN store_technician t2
on substring_index(substring_index(a.technician_id, ',', b.help_topic_id + 1), ',',
-1) = t2.id and t2.`status` = 1
LEFT JOIN order_manage c on a.order_id = c.id
WHERE a.serve_type IS NOT NULL
and a.achievement is not null
......@@ -152,6 +170,7 @@
select (select sum(order_amount)
from customer_balance_record
where time LIKE concat(#{month}, '%')
and department_id = #{departmentId}
and (type = 1 or type = 2) / 100)
/ 100
</select>
......
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